@livelike/embet 0.0.9 → 0.0.13
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/CHANGELOG.md +21 -0
- package/README.md +7 -0
- package/embet.cjs.js +289 -183
- package/embet.cjs.min.js +92 -10
- package/embet.esm.js +375 -179
- package/embet.esm.min.js +92 -10
- package/embet.umd.js +289 -183
- package/embet.umd.min.js +94 -12
- package/package.json +1 -1
package/embet.umd.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* emBET SDK Version 0.0.
|
|
1
|
+
/* emBET SDK Version 0.0.13 */
|
|
2
2
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).embet={})}(this,(function(e){"use strict";!function(){if(void 0===window.Reflect||void 0===window.customElements||window.customElements.polyfillWrapFlushCallback)return;const e=HTMLElement,t=function(){return Reflect.construct(e,[],this.constructor)};window.HTMLElement=t,HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}();
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -67,7 +67,7 @@ class b{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this
|
|
|
67
67
|
* Code distributed by Google as part of the polymer project is also
|
|
68
68
|
* subject to an additional IP rights grant found at
|
|
69
69
|
* http://polymer.github.io/PATENTS.txt
|
|
70
|
-
*/const P=e=>null===e||!("object"==typeof e||"function"==typeof e),S=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class x{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e<n.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new O(this)}_getValue(){const e=this.strings,t=e.length-1,n=this.parts;if(1===t&&""===e[0]&&""===e[1]){const e=n[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!S(e))return e}let i="";for(let r=0;r<t;r++){i+=e[r];const t=n[r];if(void 0!==t){const e=t.value;if(P(e)||!S(e))i+="string"==typeof e?e:String(e);else for(const t of e)i+="string"==typeof t?t:String(t)}}return i+=e[t],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class O{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===v||P(e)&&e===this.value||(this.value=e,m(e)||(this.committer.dirty=!0))}commit(){for(;m(this.value);){const e=this.value;this.value=v,e(this)}this.value!==v&&this.committer.commit()}}class T{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(u()),this.endNode=e.appendChild(u())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=u()),e.__insert(this.endNode=u())}insertAfterPart(e){e.__insert(this.startNode=u()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;m(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=v,e(this)}const e=this.__pendingValue;e!==v&&(P(e)?e!==this.value&&this.__commitText(e):e instanceof _?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):S(e)?this.__commitIterable(e):e===y?(this.value=y,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,n="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=n:this.__commitNode(document.createTextNode(n)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof b&&this.value.template===t)this.value.update(e.values);else{const n=new b(t,e.processor,this.options),i=n._clone();n.update(e.values),this.__commitNode(i),this.value=n}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let n,i=0;for(const r of e)n=t[i],void 0===n&&(n=new T(this.options),t.push(n),0===i?n.appendIntoPart(this):n.insertAfterPart(t[i-1])),n.setValue(r),n.commit(),i++;i<t.length&&(t.length=i,this.clear(n&&n.endNode))}clear(e=this.startNode){n(this.startNode.parentNode,e.nextSibling,this.endNode)}}class C{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;m(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=v,e(this)}if(this.__pendingValue===v)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=v}}class E extends x{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new
|
|
70
|
+
*/const P=e=>null===e||!("object"==typeof e||"function"==typeof e),S=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class x{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e<n.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new O(this)}_getValue(){const e=this.strings,t=e.length-1,n=this.parts;if(1===t&&""===e[0]&&""===e[1]){const e=n[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!S(e))return e}let i="";for(let r=0;r<t;r++){i+=e[r];const t=n[r];if(void 0!==t){const e=t.value;if(P(e)||!S(e))i+="string"==typeof e?e:String(e);else for(const t of e)i+="string"==typeof t?t:String(t)}}return i+=e[t],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class O{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===v||P(e)&&e===this.value||(this.value=e,m(e)||(this.committer.dirty=!0))}commit(){for(;m(this.value);){const e=this.value;this.value=v,e(this)}this.value!==v&&this.committer.commit()}}class T{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(u()),this.endNode=e.appendChild(u())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=u()),e.__insert(this.endNode=u())}insertAfterPart(e){e.__insert(this.startNode=u()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;m(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=v,e(this)}const e=this.__pendingValue;e!==v&&(P(e)?e!==this.value&&this.__commitText(e):e instanceof _?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):S(e)?this.__commitIterable(e):e===y?(this.value=y,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,n="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=n:this.__commitNode(document.createTextNode(n)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof b&&this.value.template===t)this.value.update(e.values);else{const n=new b(t,e.processor,this.options),i=n._clone();n.update(e.values),this.__commitNode(i),this.value=n}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let n,i=0;for(const r of e)n=t[i],void 0===n&&(n=new T(this.options),t.push(n),0===i?n.appendIntoPart(this):n.insertAfterPart(t[i-1])),n.setValue(r),n.commit(),i++;i<t.length&&(t.length=i,this.clear(n&&n.endNode))}clear(e=this.startNode){n(this.startNode.parentNode,e.nextSibling,this.endNode)}}class C{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;m(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=v,e(this)}if(this.__pendingValue===v)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=v}}class E extends x{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new R(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class R extends O{}let A=!1;(()=>{try{const e={get capture(){return A=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class M{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;m(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=v,e(this)}if(this.__pendingValue===v)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=j(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=v}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const j=e=>e&&(A?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
73
73
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -133,7 +133,7 @@ class{handleAttributeExpressions(e,t,n,i){const r=t[0];if("."===r){return new E(
|
|
|
133
133
|
* Code distributed by Google as part of the polymer project is also
|
|
134
134
|
* subject to an additional IP rights grant found at
|
|
135
135
|
* http://polymer.github.io/PATENTS.txt
|
|
136
|
-
|
|
136
|
+
*/,B=(e,t)=>`${e}--${t}`;let $=!0;void 0===window.ShadyCSS?$=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),$=!1);const F=e=>t=>{const n=B(t.type,e);let r=N.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},N.set(n,r));let o=r.stringsArray.get(t.strings);if(void 0!==o)return o;const s=t.strings.join(i);if(o=r.keyString.get(s),void 0===o){const n=t.getTemplateElement();$&&window.ShadyCSS.prepareTemplateDom(n,e),o=new a(t,n),r.keyString.set(s,o)}return r.stringsArray.set(t.strings,o),o},K=["html","svg"],q=new Set,z=(e,t,n)=>{q.add(e);const i=n?n.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:o}=r;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(i,e);const s=document.createElement("style");for(let e=0;e<o;e++){const t=r[e];t.parentNode.removeChild(t),s.textContent+=t.textContent}(e=>{K.forEach((t=>{const n=N.get(B(t,e));void 0!==n&&n.keyString.forEach((e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{n.add(e)})),h(e,n)}))}))})(e);const a=i.content;n?function(e,t,n=null){const{element:{content:i},parts:r}=e;if(null==n)return void i.appendChild(t);const o=document.createTreeWalker(i,133,null,!1);let s=f(r),a=0,c=-1;for(;o.nextNode();)for(c++,o.currentNode===n&&(a=p(t),n.parentNode.insertBefore(t,n));-1!==s&&r[s].index===c;){if(a>0){for(;-1!==s;)r[s].index+=a,s=f(r,s);return}s=f(r,s)}}(n,s,a.firstChild):a.insertBefore(s,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)t.insertBefore(c.cloneNode(!0),t.firstChild);else if(n){a.insertBefore(s,a.firstChild);const e=new Set;e.add(s),h(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const H={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},V=(e,t)=>t!==e&&(t==t||e==e),G={attribute:!0,type:String,converter:H,reflect:!1,hasChanged:V},W="finalized";class Y extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,n)=>{const i=this._attributeNameForProperty(n,t);void 0!==i&&(this._attributeToPropertyMap.set(i,n),e.push(i))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=G){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const r=this[e];this[t]=i,this.requestUpdateInternal(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||G}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(W)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=V){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,i=t.converter||H,r="function"==typeof i?i:i.fromAttribute;return r?r(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,i=t.converter;return(i&&i.toAttribute||H.toAttribute)(e,n)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=G){const i=this.constructor,r=i._attributeNameForProperty(e,n);if(void 0!==r){const e=i._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){const e=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,n){let i=!0;if(void 0!==e){const r=this.constructor;n=n||r.getPropertyOptions(e),r._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}Y.finalized=!0;
|
|
137
137
|
/**
|
|
138
138
|
* @license
|
|
139
139
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -171,22 +171,22 @@ const J=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object
|
|
|
171
171
|
* subject to an additional IP rights grant found at
|
|
172
172
|
* http://polymer.github.io/PATENTS.txt
|
|
173
173
|
*/
|
|
174
|
-
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const re={};class oe extends Y{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight(((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e)),n),n=t(e,new Set),i=[];n.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!te){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new ie(String(t),ne)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?te?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==re&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return re}}oe.finalized=!0,oe.render=(e,t,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const r=i.scopeName,o=U.has(t),s
|
|
174
|
+
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const re={};class oe extends Y{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight(((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e)),n),n=t(e,new Set),i=[];n.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!te){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new ie(String(t),ne)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?te?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==re&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return re}}oe.finalized=!0,oe.render=(e,t,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const r=i.scopeName,o=U.has(t),s=$&&11===t.nodeType&&!!t.host,a=s&&!q.has(r),c=a?document.createDocumentFragment():t;if(((e,t,i)=>{let r=U.get(t);void 0===r&&(n(t,t.firstChild),U.set(t,r=new T(Object.assign({templateFactory:L},i))),r.appendInto(t)),r.setValue(e),r.commit()})(e,c,Object.assign({templateFactory:F(r)},i)),a){const e=U.get(c);U.delete(c);const i=e.value instanceof b?e.value.template:void 0;z(r,c,i),n(t,t.firstChild),t.appendChild(c),U.set(t,e)}!o&&s&&window.ShadyCSS.styleElement(t.host)};var se={eb:null,appResource:{},progResource:{},chatRooms:{},ready:!1,clientId:null,accessToken:null,syncStrategy:null,storageStrategy:null,lsKey:null,logger:!1,pn:null,chatUrlTemplate:null,createChatUrlTemplate:null,programUrlTemplate:null,pageVisible:!0,leaderboardUrlTemplate:null,endpoint:"https://cf-blast.livelikecdn.com/api/v1/",localizedStrings:{en:{"chat.inputPlaceholder":"Say something...","chat.messageMenu.blockUser":"Block this user","chat.messageMenu.reportMessage":"Report message","chat.messageMenu.cancel":"Cancel","chat.messageMenu.ariaLabel":"Message options","chat.blockConfirmation.message":"You will no longer see messages from this user.","chat.reportConfirmation.message":"The message has been reported to the moderators. Thank you.","chat.mutedMessage":"Unable to send message.","chat.errorMessage":"There was an error. Please try again.","chat.messageDeleted":"This message has been removed.","chat.sendButton.ariaLabel":"Send Message","chat.scrollDownButton.ariaLabel":"Scroll Down","chat.stickerPicker.title":"STICKERS","chat.stickerPicker.openButton.ariaLabel":"Open Stickers","chat.stickerPicker.closeButton.ariaLabel":"Close Stickers","chat.stickerPicker.stickerPackTab.ariaLabel":"Sticker pack <packName>","chat.stickerPicker.stickerSelectionButton.ariaLabel":"<stickerName> Sticker","chat.giphyPicker.title":"GIPHY","chat.giphyPicker.placeholder":"Search GIFs via GIPHY","chat.giphyPicker.openButton.ariaLabel":"Open GIPHY","chat.giphyPicker.closeButton.ariaLabel":"Close GIPHY","chat.giphyPicker.stickerSelectionButton.ariaLabel":"<stickerName> GIF","chat.reactions.openButton.ariaLabel":"Message reactions","chat.reactions.reactionSelectionButton.ariaLabel":"Reaction <reactionName>","widget.quiz.voteButton.label":"Vote","widget.quiz.votedText":"Voted!","widget.slider.voteButton.label":"Vote","widget.slider.votedText":"Voted!","widget.textAsk.placeholder":"Type something...","widget.textAsk.sendButton.label":"SEND","widget.video.playbackError":"Can’t play this video","widget.sponsors.label":"Sponsored by","widget.quiz.tag":"","widget.poll.tag":"","widget.prediction.tag":"","widget.followup.tag":""}},profileDetailUrlTemplate:null,profileUrl:null};var ae={version:"2.8.2",ready:!1,theme:{}},ce={access_token:"",badges:null,created_at:"",id:"",nickname:"",points:0,reported_count:0,subscribe_channel:"",url:"",blockList:null,custom_data:null,reactions:null,chat_room_memberships_url:null,badges_url:"",badge_progress_url:""};const le="interactive",ue="finished",de="results",he={"LIVELIKE-EMOJI-SLIDER":"slider","LIVELIKE-CHEER-METER":"cheer","LIVELIKE-TEXT-POLL":"vote","LIVELIKE-IMAGE-POLL":"vote","LIVELIKE-TEXT-QUIZ":"answer","LIVELIKE-IMAGE-QUIZ":"answer","LIVELIKE-TEXT-PREDICTION":"prediction","LIVELIKE-IMAGE-PREDICTION":"prediction","LIVELIKE-TEXT-ASK":"reply"},pe={alert:"alert","text-poll":"poll","image-poll":"poll","text-quiz":"quiz","image-quiz":"quiz","cheer-meter":"cheerMeter","social-embed":"socialEmbed","rich-post":"richText","text-prediction":"prediction","image-prediction":"prediction","text-prediction-follow-up":"predictionFollowUp","image-prediction-follow-up":"predictionFollowUp","emoji-slider":"imageSlider","text-ask":"textAsk","video-alert":"videoAlert"},fe="alert",ge="text-prediction-follow-up",me="image-prediction-follow-up",ve="video-alert",ye=["alert-created","cheer-meter-created","emoji-slider-created","social-embed-created","rich-post-created","text-poll-created","image-poll-created","text-quiz-created","image-quiz-created","text-prediction-created","text-prediction-follow-up-updated","image-prediction-created","image-prediction-follow-up-updated","text-ask-created","video-alert-created"],be=["cheer-meter","emoji-slider","text-poll","image-poll","text-quiz","image-quiz","text-prediction",ge,"image-prediction",me,"text-ask"];var we,ke=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){
|
|
175
175
|
/*! 4.30.0 / Consumer */
|
|
176
|
-
window,e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=30)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default={PNTimeOperation:"PNTimeOperation",PNHistoryOperation:"PNHistoryOperation",PNDeleteMessagesOperation:"PNDeleteMessagesOperation",PNFetchMessagesOperation:"PNFetchMessagesOperation",PNMessageCounts:"PNMessageCountsOperation",PNSubscribeOperation:"PNSubscribeOperation",PNUnsubscribeOperation:"PNUnsubscribeOperation",PNPublishOperation:"PNPublishOperation",PNSignalOperation:"PNSignalOperation",PNAddMessageActionOperation:"PNAddActionOperation",PNRemoveMessageActionOperation:"PNRemoveMessageActionOperation",PNGetMessageActionsOperation:"PNGetMessageActionsOperation",PNCreateUserOperation:"PNCreateUserOperation",PNUpdateUserOperation:"PNUpdateUserOperation",PNDeleteUserOperation:"PNDeleteUserOperation",PNGetUserOperation:"PNGetUsersOperation",PNGetUsersOperation:"PNGetUsersOperation",PNCreateSpaceOperation:"PNCreateSpaceOperation",PNUpdateSpaceOperation:"PNUpdateSpaceOperation",PNDeleteSpaceOperation:"PNDeleteSpaceOperation",PNGetSpaceOperation:"PNGetSpacesOperation",PNGetSpacesOperation:"PNGetSpacesOperation",PNGetMembersOperation:"PNGetMembersOperation",PNUpdateMembersOperation:"PNUpdateMembersOperation",PNGetMembershipsOperation:"PNGetMembershipsOperation",PNUpdateMembershipsOperation:"PNUpdateMembershipsOperation",PNListFilesOperation:"PNListFilesOperation",PNGenerateUploadUrlOperation:"PNGenerateUploadUrlOperation",PNPublishFileOperation:"PNPublishFileOperation",PNGetFileUrlOperation:"PNGetFileUrlOperation",PNDownloadFileOperation:"PNDownloadFileOperation",PNGetAllUUIDMetadataOperation:"PNGetAllUUIDMetadataOperation",PNGetUUIDMetadataOperation:"PNGetUUIDMetadataOperation",PNSetUUIDMetadataOperation:"PNSetUUIDMetadataOperation",PNRemoveUUIDMetadataOperation:"PNRemoveUUIDMetadataOperation",PNGetAllChannelMetadataOperation:"PNGetAllChannelMetadataOperation",PNGetChannelMetadataOperation:"PNGetChannelMetadataOperation",PNSetChannelMetadataOperation:"PNSetChannelMetadataOperation",PNRemoveChannelMetadataOperation:"PNRemoveChannelMetadataOperation",PNSetMembersOperation:"PNSetMembersOperation",PNSetMembershipsOperation:"PNSetMembershipsOperation",PNPushNotificationEnabledChannelsOperation:"PNPushNotificationEnabledChannelsOperation",PNRemoveAllPushNotificationsOperation:"PNRemoveAllPushNotificationsOperation",PNWhereNowOperation:"PNWhereNowOperation",PNSetStateOperation:"PNSetStateOperation",PNHereNowOperation:"PNHereNowOperation",PNGetStateOperation:"PNGetStateOperation",PNHeartbeatOperation:"PNHeartbeatOperation",PNChannelGroupsOperation:"PNChannelGroupsOperation",PNRemoveGroupOperation:"PNRemoveGroupOperation",PNChannelsForGroupOperation:"PNChannelsForGroupOperation",PNAddChannelsToGroupOperation:"PNAddChannelsToGroupOperation",PNRemoveChannelsFromGroupOperation:"PNRemoveChannelsFromGroupOperation",PNAccessManagerGrant:"PNAccessManagerGrant",PNAccessManagerGrantToken:"PNAccessManagerGrantToken",PNAccessManagerAudit:"PNAccessManagerAudit"},e.exports=t.default},function(e,t,n){e.exports={}},function(e,t,n){(function(t){function n(e){return encodeURIComponent(e).replace(/[!~*'()]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())}))}function i(e){return function(e){var t=[];return Object.keys(e).forEach((function(e){return t.push(e)})),t}(e).sort()}var r="The Objects v1 API has been deprecated.\nYou can learn more about Objects v2 API at https://www.pubnub.com/docs/web-javascript/api-reference-objects.\nIf you have questions about the Objects v2 API or require additional help with migrating to the new data model, please contact PubNub Support at support@pubnub.com.";e.exports={signPamFromParams:function(e){return i(e).map((function(t){return"".concat(t,"=").concat(n(e[t]))})).join("&")},endsWith:function(e,t){return-1!==e.indexOf(t,this.length-t.length)},createPromise:function(){var e,t;return{promise:new Promise((function(n,i){e=n,t=i})),reject:t,fulfill:e}},encodeString:n,deprecated:function(e){return function(){var n,i;return void 0!==t&&"test"!==(null===(n=t)||void 0===n||null===(i=n.env)||void 0===i?void 0:"production")&&console.warn(r),e.apply(void 0,arguments)}}}}).call(this,n(42))},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=i(n(17)),c=(n(2),function(){function e(t){var n,i,o=t.setup,c=t.db;(0,r.default)(this,e),(0,s.default)(this,"_db",void 0),(0,s.default)(this,"subscribeKey",void 0),(0,s.default)(this,"publishKey",void 0),(0,s.default)(this,"secretKey",void 0),(0,s.default)(this,"cipherKey",void 0),(0,s.default)(this,"authKey",void 0),(0,s.default)(this,"UUID",void 0),(0,s.default)(this,"proxy",void 0),(0,s.default)(this,"instanceId",void 0),(0,s.default)(this,"sdkName",void 0),(0,s.default)(this,"sdkFamily",void 0),(0,s.default)(this,"partnerId",void 0),(0,s.default)(this,"filterExpression",void 0),(0,s.default)(this,"suppressLeaveEvents",void 0),(0,s.default)(this,"secure",void 0),(0,s.default)(this,"origin",void 0),(0,s.default)(this,"logVerbosity",void 0),(0,s.default)(this,"useInstanceId",void 0),(0,s.default)(this,"useRequestId",void 0),(0,s.default)(this,"keepAlive",void 0),(0,s.default)(this,"keepAliveSettings",void 0),(0,s.default)(this,"autoNetworkDetection",void 0),(0,s.default)(this,"announceSuccessfulHeartbeats",void 0),(0,s.default)(this,"announceFailedHeartbeats",void 0),(0,s.default)(this,"_presenceTimeout",void 0),(0,s.default)(this,"_heartbeatInterval",void 0),(0,s.default)(this,"_subscribeRequestTimeout",void 0),(0,s.default)(this,"_transactionalRequestTimeout",void 0),(0,s.default)(this,"_useSendBeacon",void 0),(0,s.default)(this,"_PNSDKSuffix",void 0),(0,s.default)(this,"requestMessageCountThreshold",void 0),(0,s.default)(this,"restore",void 0),(0,s.default)(this,"dedupeOnSubscribe",void 0),(0,s.default)(this,"maximumCacheSize",void 0),(0,s.default)(this,"customEncrypt",void 0),(0,s.default)(this,"customDecrypt",void 0),(0,s.default)(this,"fileUploadPublishRetryLimit",void 0),(0,s.default)(this,"useRandomIVs",void 0),this._PNSDKSuffix={},this._db=c,this.instanceId="pn-".concat(a.default.createUUID()),this.secretKey=o.secretKey||o.secret_key,this.subscribeKey=o.subscribeKey||o.subscribe_key,this.publishKey=o.publishKey||o.publish_key,this.sdkName=o.sdkName,this.sdkFamily=o.sdkFamily,this.partnerId=o.partnerId,this.setAuthKey(o.authKey),this.setCipherKey(o.cipherKey),this.setFilterExpression(o.filterExpression),this.origin=o.origin||"ps.pndsn.com",this.secure=o.ssl||!1,this.restore=o.restore||!1,this.proxy=o.proxy,this.keepAlive=o.keepAlive,this.keepAliveSettings=o.keepAliveSettings,this.autoNetworkDetection=o.autoNetworkDetection||!1,this.dedupeOnSubscribe=o.dedupeOnSubscribe||!1,this.maximumCacheSize=o.maximumCacheSize||100,this.customEncrypt=o.customEncrypt,this.customDecrypt=o.customDecrypt,this.fileUploadPublishRetryLimit=null!==(n=o.fileUploadPublishRetryLimit)&&void 0!==n?n:5,this.useRandomIVs=null===(i=o.useRandomIVs)||void 0===i||i,"undefined"!=typeof location&&"https:"===location.protocol&&(this.secure=!0),this.logVerbosity=o.logVerbosity||!1,this.suppressLeaveEvents=o.suppressLeaveEvents||!1,this.announceFailedHeartbeats=o.announceFailedHeartbeats||!0,this.announceSuccessfulHeartbeats=o.announceSuccessfulHeartbeats||!1,this.useInstanceId=o.useInstanceId||!1,this.useRequestId=o.useRequestId||!1,this.requestMessageCountThreshold=o.requestMessageCountThreshold,this.setTransactionTimeout(o.transactionalRequestTimeout||15e3),this.setSubscribeTimeout(o.subscribeRequestTimeout||31e4),this.setSendBeaconConfig(o.useSendBeacon||!0),o.presenceTimeout?this.setPresenceTimeout(o.presenceTimeout):this._presenceTimeout=300,null!=o.heartbeatInterval&&this.setHeartbeatInterval(o.heartbeatInterval),this.setUUID(this._decideUUID(o.uuid))}return(0,o.default)(e,[{key:"hasCustomOrigin",value:function(){return"ps.pndsn.com"!==this.origin}},{key:"getAuthKey",value:function(){return this.authKey}},{key:"setAuthKey",value:function(e){return this.authKey=e,this}},{key:"setCipherKey",value:function(e){return this.cipherKey=e,this}},{key:"getUUID",value:function(){return this.UUID}},{key:"setUUID",value:function(e){return this._db&&this._db.set&&this._db.set("".concat(this.subscribeKey,"uuid"),e),this.UUID=e,this}},{key:"getFilterExpression",value:function(){return this.filterExpression}},{key:"setFilterExpression",value:function(e){return this.filterExpression=e,this}},{key:"getPresenceTimeout",value:function(){return this._presenceTimeout}},{key:"setPresenceTimeout",value:function(e){return e>=20?this._presenceTimeout=e:(this._presenceTimeout=20,console.log("WARNING: Presence timeout is less than the minimum. Using minimum value: ",this._presenceTimeout)),this.setHeartbeatInterval(this._presenceTimeout/2-1),this}},{key:"setProxy",value:function(e){this.proxy=e}},{key:"getHeartbeatInterval",value:function(){return this._heartbeatInterval}},{key:"setHeartbeatInterval",value:function(e){return this._heartbeatInterval=e,this}},{key:"getSubscribeTimeout",value:function(){return this._subscribeRequestTimeout}},{key:"setSubscribeTimeout",value:function(e){return this._subscribeRequestTimeout=e,this}},{key:"getTransactionTimeout",value:function(){return this._transactionalRequestTimeout}},{key:"setTransactionTimeout",value:function(e){return this._transactionalRequestTimeout=e,this}},{key:"isSendBeaconEnabled",value:function(){return this._useSendBeacon}},{key:"setSendBeaconConfig",value:function(e){return this._useSendBeacon=e,this}},{key:"getVersion",value:function(){return"4.30.0"}},{key:"_addPnsdkSuffix",value:function(e,t){this._PNSDKSuffix[e]=t}},{key:"_getPnsdkSuffix",value:function(e){var t=this;return Object.keys(this._PNSDKSuffix).reduce((function(n,i){return n+e+t._PNSDKSuffix[i]}),"")}},{key:"_decideUUID",value:function(e){return e||(this._db&&this._db.get&&this._db.get("".concat(this.subscribeKey,"uuid"))?this._db.get("".concat(this.subscribeKey,"uuid")):"pn-".concat(a.default.createUUID()))}}]),e}());t.default=c,e.exports=t.default},function(e,t,n){var i=n(26),r=n(80),o=n(27),s=n(28);e.exports=function(e,t){return i(e)||r(e,t)||o(e,t)||s()}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default={PNNetworkUpCategory:"PNNetworkUpCategory",PNNetworkDownCategory:"PNNetworkDownCategory",PNNetworkIssuesCategory:"PNNetworkIssuesCategory",PNTimeoutCategory:"PNTimeoutCategory",PNBadRequestCategory:"PNBadRequestCategory",PNAccessDeniedCategory:"PNAccessDeniedCategory",PNUnknownCategory:"PNUnknownCategory",PNReconnectedCategory:"PNReconnectedCategory",PNConnectedCategory:"PNConnectedCategory",PNRequestMessageCountExceededCategory:"PNRequestMessageCountExceededCategory"},e.exports=t.default},function(e,t,n){e.exports=n(75)},function(e,t){function n(e,t,n,i,r,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(i,r)}e.exports=function(e){return function(){var t=this,i=arguments;return new Promise((function(r,o){var s=e.apply(t,i);function a(e){n(s,r,o,a,c,"next",e)}function c(e){n(s,r,o,a,c,"throw",e)}a(void 0)}))}}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var i=n(15);e.exports=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}}),t&&i(e,t)}},function(e,t){function n(t,i){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,i)}e.exports=n},function(e,t,n){var i=n(7),r=n(19);e.exports=function(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?r(e):t}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(34)),o={createUUID:function(){return r.default.uuid?r.default.uuid():(0,r.default)()}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.createValidationError=y,t.generatePNSDK=k,t.signRequest=P,t.default=function(e,t){var n=e.networking,i=e.config,r=e.telemetryManager,o=u.default.createUUID(),s=null,a=null,c={};t.getOperation()===h.default.PNTimeOperation||t.getOperation()===h.default.PNChannelGroupsOperation?s=arguments.length<=2?void 0:arguments[2]:(c=arguments.length<=2?void 0:arguments[2],s=arguments.length<=3?void 0:arguments[3]),"undefined"==typeof Promise||s||(a=d.default.createPromise());var l=t.validateParams(e,c);if(l)return s?s(y(l)):a?(a.reject(new v("Validation failed, check status for details",y(l))),a.promise):void 0;var f,m=t.prepareParams(e,c),S=b(t,e,c),x={url:S,operation:t.getOperation(),timeout:t.getRequestTimeout(e),headers:t.getRequestHeaders?t.getRequestHeaders():{},ignoreBody:"function"==typeof t.ignoreBody&&t.ignoreBody(e),forceBuffered:"function"==typeof t.forceBuffered?t.forceBuffered(e,c):null};m.uuid=i.UUID,m.pnsdk=k(i);var O=r.operationsLatencyForRequest();if(Object.keys(O).length&&(m=g(g({},m),O)),i.useInstanceId&&(m.instanceid=i.instanceId),i.useRequestId&&(m.requestid=o),t.isAuthSupported()){var T=w(t,e,c)||i.getAuthKey();T&&(m.auth=T)}i.secretKey&&P(e,S,m,c,t);var C=function(n,i){var l;if(n.error)s?s(n):a&&a.reject(new v("PubNub call failed, check status for details",n));else{r.stopLatencyMeasure(t.getOperation(),o);var u=t.handleResponse(e,i,c);"function"!=typeof(null===(l=u)||void 0===l?void 0:l.then)&&(u=Promise.resolve(u)),u.then((function(e){s?s(n,e):a&&a.fulfill(e)})).catch((function(e){if(s){var n=e;t.getOperation()===h.default.PNSubscribeOperation&&(n={statusCode:400,error:!0,operation:t.getOperation(),errorData:e,category:p.default.PNUnknownCategory}),s(n,null)}else a&&a.reject(new v("PubNub call failed, check status for details",e))}))}};if(r.startLatencyMeasure(t.getOperation(),o),"POST"===_(e,t,c)){var E=t.postPayload(e,c);f=n.POST(m,E,x,C)}else if("PATCH"===_(e,t,c)){var A=t.patchPayload(e,c);f=n.PATCH(m,A,x,C)}else f="DELETE"===_(e,t,c)?n.DELETE(m,x,C):"GETFILE"===_(e,t,c)?n.GETFILE(m,x,C):n.GET(m,x,C);return t.getOperation()===h.default.PNSubscribeOperation?f:a?a.promise:void 0},t.PubNubError=void 0;var r=i(n(4)),o=i(n(5)),s=i(n(14)),a=i(n(16)),c=i(n(13)),l=i(n(48)),u=i(n(17)),d=(n(2),i(n(3))),h=(i(n(8)),i(n(1))),p=i(n(10));function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){(0,r.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return(0,a.default)(this,n)}}var v=function(e){(0,s.default)(n,e);var t=m(n);function n(e,i){var r;return(0,o.default)(this,n),(r=t.call(this,e)).name=r.constructor.name,r.status=i,r.message=e,r}return n}((0,l.default)(Error));function y(e){return(t={message:e}).type="validationError",t.error=!0,t;var t}function b(e,t,n){return e.usePost&&e.usePost(t,n)?e.postURL(t,n):e.usePatch&&e.usePatch(t,n)?e.patchURL(t,n):e.useGetFile&&e.useGetFile(t,n)?e.getFileURL(t,n):e.getURL(t,n)}function w(e,t,n){var i;return e.getAuthToken&&(i=e.getAuthToken(t,n)),i}function k(e){if(e.sdkName)return e.sdkName;var t="PubNub-JS-".concat(e.sdkFamily);e.partnerId&&(t+="-".concat(e.partnerId)),t+="/".concat(e.getVersion());var n=e._getPnsdkSuffix(" ");return n.length>0&&(t+=n),t}function _(e,t,n){return t.usePost&&t.usePost(e,n)?"POST":t.usePatch&&t.usePatch(e,n)?"PATCH":t.useDelete&&t.useDelete(e,n)?"DELETE":t.useGetFile&&t.useGetFile(e,n)?"GETFILE":"GET"}function P(e,t,n,i,r){var o=e.config,s=e.crypto,a=_(e,r,i);n.timestamp=Math.floor((new Date).getTime()/1e3),"PNPublishOperation"===r.getOperation()&&r.usePost&&r.usePost(e,i)&&(a="GET"),"GETFILE"===a&&(a="GET");var c="".concat(a,"\n").concat(o.publishKey,"\n").concat(t,"\n").concat(d.default.signPamFromParams(n),"\n");if("POST"===a){var l=r.postPayload(e,i);c+="string"==typeof l?l:JSON.stringify(l)}else if("PATCH"===a){var u=r.patchPayload(e,i);c+="string"==typeof u?u:JSON.stringify(u)}var h="v2.".concat(s.HMACSHA256(c));h=(h=(h=h.replace(/\+/g,"-")).replace(/\//g,"_")).replace(/=+$/,""),n.signature=h}t.PubNubError=v},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){(function(i){var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(5)),s=r(n(6)),a=r(n(4)),c=(r(n(8)),r(n(22)));function l(e){var t,n=[];for(t=0;t<e.length;t+=1)n[t/4|0]|=e[t]<<24-8*t;return c.default.lib.WordArray.create(n,e.length)}var u=function(){function e(t){var n=t.config;(0,o.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_iv",void 0),(0,a.default)(this,"_allowedKeyEncodings",void 0),(0,a.default)(this,"_allowedKeyLengths",void 0),(0,a.default)(this,"_allowedModes",void 0),(0,a.default)(this,"_defaultOptions",void 0),this._config=n,this._iv="0123456789012345",this._allowedKeyEncodings=["hex","utf8","base64","binary"],this._allowedKeyLengths=[128,256],this._allowedModes=["ecb","cbc"],this._defaultOptions={encryptKey:!0,keyEncoding:"utf8",keyLength:256,mode:"cbc"}}return(0,s.default)(e,[{key:"HMACSHA256",value:function(e){return c.default.HmacSHA256(e,this._config.secretKey).toString(c.default.enc.Base64)}},{key:"SHA256",value:function(e){return c.default.SHA256(e).toString(c.default.enc.Hex)}},{key:"_parseOptions",value:function(e){var t=e||{};return t.hasOwnProperty("encryptKey")||(t.encryptKey=this._defaultOptions.encryptKey),t.hasOwnProperty("keyEncoding")||(t.keyEncoding=this._defaultOptions.keyEncoding),t.hasOwnProperty("keyLength")||(t.keyLength=this._defaultOptions.keyLength),t.hasOwnProperty("mode")||(t.mode=this._defaultOptions.mode),-1===this._allowedKeyEncodings.indexOf(t.keyEncoding.toLowerCase())&&(t.keyEncoding=this._defaultOptions.keyEncoding),-1===this._allowedKeyLengths.indexOf(parseInt(t.keyLength,10))&&(t.keyLength=this._defaultOptions.keyLength),-1===this._allowedModes.indexOf(t.mode.toLowerCase())&&(t.mode=this._defaultOptions.mode),t}},{key:"_decodeKey",value:function(e,t){return"base64"===t.keyEncoding?c.default.enc.Base64.parse(e):"hex"===t.keyEncoding?c.default.enc.Hex.parse(e):e}},{key:"_getPaddedKey",value:function(e,t){return e=this._decodeKey(e,t),t.encryptKey?c.default.enc.Utf8.parse(this.SHA256(e).slice(0,32)):e}},{key:"_getMode",value:function(e){return"ecb"===e.mode?c.default.mode.ECB:c.default.mode.CBC}},{key:"_getIV",value:function(e){return"cbc"===e.mode?c.default.enc.Utf8.parse(this._iv):null}},{key:"_getRandomIV",value:function(){return c.default.lib.WordArray.random(16)}},{key:"encrypt",value:function(e,t,n){return this._config.customEncrypt?this._config.customEncrypt(e):this.pnEncrypt(e,t,n)}},{key:"decrypt",value:function(e,t,n){return this._config.customDecrypt?this._config.customDecrypt(e):this.pnDecrypt(e,t,n)}},{key:"pnEncrypt",value:function(e,t,n){if(!t&&!this._config.cipherKey)return e;n=this._parseOptions(n);var i=this._getMode(n),r=this._getPaddedKey(t||this._config.cipherKey,n);if(this._config.useRandomIVs){var o=this._getRandomIV(),s=c.default.AES.encrypt(e,r,{iv:o,mode:i}).ciphertext;return o.clone().concat(s.clone()).toString(c.default.enc.Base64)}var a=this._getIV(n);return c.default.AES.encrypt(e,r,{iv:a,mode:i}).ciphertext.toString(c.default.enc.Base64)||e}},{key:"pnDecrypt",value:function(e,t,n){if(!t&&!this._config.cipherKey)return e;n=this._parseOptions(n);var r=this._getMode(n),o=this._getPaddedKey(t||this._config.cipherKey,n);if(this._config.useRandomIVs){var s=i.from(e,"base64"),a=l(s.slice(0,16)),u=l(s.slice(16));try{var d=c.default.AES.decrypt({ciphertext:u},o,{iv:a,mode:r}).toString(c.default.enc.Utf8);return JSON.parse(d)}catch(e){return null}}else{var h=this._getIV(n);try{var p=c.default.enc.Base64.parse(e),f=c.default.AES.decrypt({ciphertext:p},o,{iv:h,mode:r}).toString(c.default.enc.Utf8);return JSON.parse(f)}catch(e){return null}}}}]),e}();t.default=u,e.exports=t.default}).call(this,n(21).Buffer)},function(e,t,n){(function(e){
|
|
176
|
+
window,e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=30)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default={PNTimeOperation:"PNTimeOperation",PNHistoryOperation:"PNHistoryOperation",PNDeleteMessagesOperation:"PNDeleteMessagesOperation",PNFetchMessagesOperation:"PNFetchMessagesOperation",PNMessageCounts:"PNMessageCountsOperation",PNSubscribeOperation:"PNSubscribeOperation",PNUnsubscribeOperation:"PNUnsubscribeOperation",PNPublishOperation:"PNPublishOperation",PNSignalOperation:"PNSignalOperation",PNAddMessageActionOperation:"PNAddActionOperation",PNRemoveMessageActionOperation:"PNRemoveMessageActionOperation",PNGetMessageActionsOperation:"PNGetMessageActionsOperation",PNCreateUserOperation:"PNCreateUserOperation",PNUpdateUserOperation:"PNUpdateUserOperation",PNDeleteUserOperation:"PNDeleteUserOperation",PNGetUserOperation:"PNGetUsersOperation",PNGetUsersOperation:"PNGetUsersOperation",PNCreateSpaceOperation:"PNCreateSpaceOperation",PNUpdateSpaceOperation:"PNUpdateSpaceOperation",PNDeleteSpaceOperation:"PNDeleteSpaceOperation",PNGetSpaceOperation:"PNGetSpacesOperation",PNGetSpacesOperation:"PNGetSpacesOperation",PNGetMembersOperation:"PNGetMembersOperation",PNUpdateMembersOperation:"PNUpdateMembersOperation",PNGetMembershipsOperation:"PNGetMembershipsOperation",PNUpdateMembershipsOperation:"PNUpdateMembershipsOperation",PNListFilesOperation:"PNListFilesOperation",PNGenerateUploadUrlOperation:"PNGenerateUploadUrlOperation",PNPublishFileOperation:"PNPublishFileOperation",PNGetFileUrlOperation:"PNGetFileUrlOperation",PNDownloadFileOperation:"PNDownloadFileOperation",PNGetAllUUIDMetadataOperation:"PNGetAllUUIDMetadataOperation",PNGetUUIDMetadataOperation:"PNGetUUIDMetadataOperation",PNSetUUIDMetadataOperation:"PNSetUUIDMetadataOperation",PNRemoveUUIDMetadataOperation:"PNRemoveUUIDMetadataOperation",PNGetAllChannelMetadataOperation:"PNGetAllChannelMetadataOperation",PNGetChannelMetadataOperation:"PNGetChannelMetadataOperation",PNSetChannelMetadataOperation:"PNSetChannelMetadataOperation",PNRemoveChannelMetadataOperation:"PNRemoveChannelMetadataOperation",PNSetMembersOperation:"PNSetMembersOperation",PNSetMembershipsOperation:"PNSetMembershipsOperation",PNPushNotificationEnabledChannelsOperation:"PNPushNotificationEnabledChannelsOperation",PNRemoveAllPushNotificationsOperation:"PNRemoveAllPushNotificationsOperation",PNWhereNowOperation:"PNWhereNowOperation",PNSetStateOperation:"PNSetStateOperation",PNHereNowOperation:"PNHereNowOperation",PNGetStateOperation:"PNGetStateOperation",PNHeartbeatOperation:"PNHeartbeatOperation",PNChannelGroupsOperation:"PNChannelGroupsOperation",PNRemoveGroupOperation:"PNRemoveGroupOperation",PNChannelsForGroupOperation:"PNChannelsForGroupOperation",PNAddChannelsToGroupOperation:"PNAddChannelsToGroupOperation",PNRemoveChannelsFromGroupOperation:"PNRemoveChannelsFromGroupOperation",PNAccessManagerGrant:"PNAccessManagerGrant",PNAccessManagerGrantToken:"PNAccessManagerGrantToken",PNAccessManagerAudit:"PNAccessManagerAudit"},e.exports=t.default},function(e,t,n){e.exports={}},function(e,t,n){(function(t){function n(e){return encodeURIComponent(e).replace(/[!~*'()]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())}))}function i(e){return function(e){var t=[];return Object.keys(e).forEach((function(e){return t.push(e)})),t}(e).sort()}var r="The Objects v1 API has been deprecated.\nYou can learn more about Objects v2 API at https://www.pubnub.com/docs/web-javascript/api-reference-objects.\nIf you have questions about the Objects v2 API or require additional help with migrating to the new data model, please contact PubNub Support at support@pubnub.com.";e.exports={signPamFromParams:function(e){return i(e).map((function(t){return"".concat(t,"=").concat(n(e[t]))})).join("&")},endsWith:function(e,t){return-1!==e.indexOf(t,this.length-t.length)},createPromise:function(){var e,t;return{promise:new Promise((function(n,i){e=n,t=i})),reject:t,fulfill:e}},encodeString:n,deprecated:function(e){return function(){var n,i;return void 0!==t&&"test"!==(null===(n=t)||void 0===n||null===(i=n.env)||void 0===i?void 0:"production")&&console.warn(r),e.apply(void 0,arguments)}}}}).call(this,n(42))},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=i(n(17)),c=(n(2),function(){function e(t){var n,i,o=t.setup,c=t.db;(0,r.default)(this,e),(0,s.default)(this,"_db",void 0),(0,s.default)(this,"subscribeKey",void 0),(0,s.default)(this,"publishKey",void 0),(0,s.default)(this,"secretKey",void 0),(0,s.default)(this,"cipherKey",void 0),(0,s.default)(this,"authKey",void 0),(0,s.default)(this,"UUID",void 0),(0,s.default)(this,"proxy",void 0),(0,s.default)(this,"instanceId",void 0),(0,s.default)(this,"sdkName",void 0),(0,s.default)(this,"sdkFamily",void 0),(0,s.default)(this,"partnerId",void 0),(0,s.default)(this,"filterExpression",void 0),(0,s.default)(this,"suppressLeaveEvents",void 0),(0,s.default)(this,"secure",void 0),(0,s.default)(this,"origin",void 0),(0,s.default)(this,"logVerbosity",void 0),(0,s.default)(this,"useInstanceId",void 0),(0,s.default)(this,"useRequestId",void 0),(0,s.default)(this,"keepAlive",void 0),(0,s.default)(this,"keepAliveSettings",void 0),(0,s.default)(this,"autoNetworkDetection",void 0),(0,s.default)(this,"announceSuccessfulHeartbeats",void 0),(0,s.default)(this,"announceFailedHeartbeats",void 0),(0,s.default)(this,"_presenceTimeout",void 0),(0,s.default)(this,"_heartbeatInterval",void 0),(0,s.default)(this,"_subscribeRequestTimeout",void 0),(0,s.default)(this,"_transactionalRequestTimeout",void 0),(0,s.default)(this,"_useSendBeacon",void 0),(0,s.default)(this,"_PNSDKSuffix",void 0),(0,s.default)(this,"requestMessageCountThreshold",void 0),(0,s.default)(this,"restore",void 0),(0,s.default)(this,"dedupeOnSubscribe",void 0),(0,s.default)(this,"maximumCacheSize",void 0),(0,s.default)(this,"customEncrypt",void 0),(0,s.default)(this,"customDecrypt",void 0),(0,s.default)(this,"fileUploadPublishRetryLimit",void 0),(0,s.default)(this,"useRandomIVs",void 0),this._PNSDKSuffix={},this._db=c,this.instanceId="pn-".concat(a.default.createUUID()),this.secretKey=o.secretKey||o.secret_key,this.subscribeKey=o.subscribeKey||o.subscribe_key,this.publishKey=o.publishKey||o.publish_key,this.sdkName=o.sdkName,this.sdkFamily=o.sdkFamily,this.partnerId=o.partnerId,this.setAuthKey(o.authKey),this.setCipherKey(o.cipherKey),this.setFilterExpression(o.filterExpression),this.origin=o.origin||"ps.pndsn.com",this.secure=o.ssl||!1,this.restore=o.restore||!1,this.proxy=o.proxy,this.keepAlive=o.keepAlive,this.keepAliveSettings=o.keepAliveSettings,this.autoNetworkDetection=o.autoNetworkDetection||!1,this.dedupeOnSubscribe=o.dedupeOnSubscribe||!1,this.maximumCacheSize=o.maximumCacheSize||100,this.customEncrypt=o.customEncrypt,this.customDecrypt=o.customDecrypt,this.fileUploadPublishRetryLimit=null!==(n=o.fileUploadPublishRetryLimit)&&void 0!==n?n:5,this.useRandomIVs=null===(i=o.useRandomIVs)||void 0===i||i,"undefined"!=typeof location&&"https:"===location.protocol&&(this.secure=!0),this.logVerbosity=o.logVerbosity||!1,this.suppressLeaveEvents=o.suppressLeaveEvents||!1,this.announceFailedHeartbeats=o.announceFailedHeartbeats||!0,this.announceSuccessfulHeartbeats=o.announceSuccessfulHeartbeats||!1,this.useInstanceId=o.useInstanceId||!1,this.useRequestId=o.useRequestId||!1,this.requestMessageCountThreshold=o.requestMessageCountThreshold,this.setTransactionTimeout(o.transactionalRequestTimeout||15e3),this.setSubscribeTimeout(o.subscribeRequestTimeout||31e4),this.setSendBeaconConfig(o.useSendBeacon||!0),o.presenceTimeout?this.setPresenceTimeout(o.presenceTimeout):this._presenceTimeout=300,null!=o.heartbeatInterval&&this.setHeartbeatInterval(o.heartbeatInterval),this.setUUID(this._decideUUID(o.uuid))}return(0,o.default)(e,[{key:"hasCustomOrigin",value:function(){return"ps.pndsn.com"!==this.origin}},{key:"getAuthKey",value:function(){return this.authKey}},{key:"setAuthKey",value:function(e){return this.authKey=e,this}},{key:"setCipherKey",value:function(e){return this.cipherKey=e,this}},{key:"getUUID",value:function(){return this.UUID}},{key:"setUUID",value:function(e){return this._db&&this._db.set&&this._db.set("".concat(this.subscribeKey,"uuid"),e),this.UUID=e,this}},{key:"getFilterExpression",value:function(){return this.filterExpression}},{key:"setFilterExpression",value:function(e){return this.filterExpression=e,this}},{key:"getPresenceTimeout",value:function(){return this._presenceTimeout}},{key:"setPresenceTimeout",value:function(e){return e>=20?this._presenceTimeout=e:(this._presenceTimeout=20,console.log("WARNING: Presence timeout is less than the minimum. Using minimum value: ",this._presenceTimeout)),this.setHeartbeatInterval(this._presenceTimeout/2-1),this}},{key:"setProxy",value:function(e){this.proxy=e}},{key:"getHeartbeatInterval",value:function(){return this._heartbeatInterval}},{key:"setHeartbeatInterval",value:function(e){return this._heartbeatInterval=e,this}},{key:"getSubscribeTimeout",value:function(){return this._subscribeRequestTimeout}},{key:"setSubscribeTimeout",value:function(e){return this._subscribeRequestTimeout=e,this}},{key:"getTransactionTimeout",value:function(){return this._transactionalRequestTimeout}},{key:"setTransactionTimeout",value:function(e){return this._transactionalRequestTimeout=e,this}},{key:"isSendBeaconEnabled",value:function(){return this._useSendBeacon}},{key:"setSendBeaconConfig",value:function(e){return this._useSendBeacon=e,this}},{key:"getVersion",value:function(){return"4.30.0"}},{key:"_addPnsdkSuffix",value:function(e,t){this._PNSDKSuffix[e]=t}},{key:"_getPnsdkSuffix",value:function(e){var t=this;return Object.keys(this._PNSDKSuffix).reduce((function(n,i){return n+e+t._PNSDKSuffix[i]}),"")}},{key:"_decideUUID",value:function(e){return e||(this._db&&this._db.get&&this._db.get("".concat(this.subscribeKey,"uuid"))?this._db.get("".concat(this.subscribeKey,"uuid")):"pn-".concat(a.default.createUUID()))}}]),e}());t.default=c,e.exports=t.default},function(e,t,n){var i=n(26),r=n(80),o=n(27),s=n(28);e.exports=function(e,t){return i(e)||r(e,t)||o(e,t)||s()}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default={PNNetworkUpCategory:"PNNetworkUpCategory",PNNetworkDownCategory:"PNNetworkDownCategory",PNNetworkIssuesCategory:"PNNetworkIssuesCategory",PNTimeoutCategory:"PNTimeoutCategory",PNBadRequestCategory:"PNBadRequestCategory",PNAccessDeniedCategory:"PNAccessDeniedCategory",PNUnknownCategory:"PNUnknownCategory",PNReconnectedCategory:"PNReconnectedCategory",PNConnectedCategory:"PNConnectedCategory",PNRequestMessageCountExceededCategory:"PNRequestMessageCountExceededCategory"},e.exports=t.default},function(e,t,n){e.exports=n(75)},function(e,t){function n(e,t,n,i,r,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(i,r)}e.exports=function(e){return function(){var t=this,i=arguments;return new Promise((function(r,o){var s=e.apply(t,i);function a(e){n(s,r,o,a,c,"next",e)}function c(e){n(s,r,o,a,c,"throw",e)}a(void 0)}))}}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var i=n(15);e.exports=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}}),t&&i(e,t)}},function(e,t){function n(t,i){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,i)}e.exports=n},function(e,t,n){var i=n(7),r=n(19);e.exports=function(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?r(e):t}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(34)),o={createUUID:function(){return r.default.uuid?r.default.uuid():(0,r.default)()}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.createValidationError=y,t.generatePNSDK=k,t.signRequest=P,t.default=function(e,t){var n=e.networking,i=e.config,r=e.telemetryManager,o=u.default.createUUID(),s=null,a=null,c={};t.getOperation()===h.default.PNTimeOperation||t.getOperation()===h.default.PNChannelGroupsOperation?s=arguments.length<=2?void 0:arguments[2]:(c=arguments.length<=2?void 0:arguments[2],s=arguments.length<=3?void 0:arguments[3]),"undefined"==typeof Promise||s||(a=d.default.createPromise());var l=t.validateParams(e,c);if(l)return s?s(y(l)):a?(a.reject(new v("Validation failed, check status for details",y(l))),a.promise):void 0;var f,m=t.prepareParams(e,c),S=b(t,e,c),x={url:S,operation:t.getOperation(),timeout:t.getRequestTimeout(e),headers:t.getRequestHeaders?t.getRequestHeaders():{},ignoreBody:"function"==typeof t.ignoreBody&&t.ignoreBody(e),forceBuffered:"function"==typeof t.forceBuffered?t.forceBuffered(e,c):null};m.uuid=i.UUID,m.pnsdk=k(i);var O=r.operationsLatencyForRequest();if(Object.keys(O).length&&(m=g(g({},m),O)),i.useInstanceId&&(m.instanceid=i.instanceId),i.useRequestId&&(m.requestid=o),t.isAuthSupported()){var T=w(t,e,c)||i.getAuthKey();T&&(m.auth=T)}i.secretKey&&P(e,S,m,c,t);var C=function(n,i){var l;if(n.error)s?s(n):a&&a.reject(new v("PubNub call failed, check status for details",n));else{r.stopLatencyMeasure(t.getOperation(),o);var u=t.handleResponse(e,i,c);"function"!=typeof(null===(l=u)||void 0===l?void 0:l.then)&&(u=Promise.resolve(u)),u.then((function(e){s?s(n,e):a&&a.fulfill(e)})).catch((function(e){if(s){var n=e;t.getOperation()===h.default.PNSubscribeOperation&&(n={statusCode:400,error:!0,operation:t.getOperation(),errorData:e,category:p.default.PNUnknownCategory}),s(n,null)}else a&&a.reject(new v("PubNub call failed, check status for details",e))}))}};if(r.startLatencyMeasure(t.getOperation(),o),"POST"===_(e,t,c)){var E=t.postPayload(e,c);f=n.POST(m,E,x,C)}else if("PATCH"===_(e,t,c)){var R=t.patchPayload(e,c);f=n.PATCH(m,R,x,C)}else f="DELETE"===_(e,t,c)?n.DELETE(m,x,C):"GETFILE"===_(e,t,c)?n.GETFILE(m,x,C):n.GET(m,x,C);return t.getOperation()===h.default.PNSubscribeOperation?f:a?a.promise:void 0},t.PubNubError=void 0;var r=i(n(4)),o=i(n(5)),s=i(n(14)),a=i(n(16)),c=i(n(13)),l=i(n(48)),u=i(n(17)),d=(n(2),i(n(3))),h=(i(n(8)),i(n(1))),p=i(n(10));function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){(0,r.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return(0,a.default)(this,n)}}var v=function(e){(0,s.default)(n,e);var t=m(n);function n(e,i){var r;return(0,o.default)(this,n),(r=t.call(this,e)).name=r.constructor.name,r.status=i,r.message=e,r}return n}((0,l.default)(Error));function y(e){return(t={message:e}).type="validationError",t.error=!0,t;var t}function b(e,t,n){return e.usePost&&e.usePost(t,n)?e.postURL(t,n):e.usePatch&&e.usePatch(t,n)?e.patchURL(t,n):e.useGetFile&&e.useGetFile(t,n)?e.getFileURL(t,n):e.getURL(t,n)}function w(e,t,n){var i;return e.getAuthToken&&(i=e.getAuthToken(t,n)),i}function k(e){if(e.sdkName)return e.sdkName;var t="PubNub-JS-".concat(e.sdkFamily);e.partnerId&&(t+="-".concat(e.partnerId)),t+="/".concat(e.getVersion());var n=e._getPnsdkSuffix(" ");return n.length>0&&(t+=n),t}function _(e,t,n){return t.usePost&&t.usePost(e,n)?"POST":t.usePatch&&t.usePatch(e,n)?"PATCH":t.useDelete&&t.useDelete(e,n)?"DELETE":t.useGetFile&&t.useGetFile(e,n)?"GETFILE":"GET"}function P(e,t,n,i,r){var o=e.config,s=e.crypto,a=_(e,r,i);n.timestamp=Math.floor((new Date).getTime()/1e3),"PNPublishOperation"===r.getOperation()&&r.usePost&&r.usePost(e,i)&&(a="GET"),"GETFILE"===a&&(a="GET");var c="".concat(a,"\n").concat(o.publishKey,"\n").concat(t,"\n").concat(d.default.signPamFromParams(n),"\n");if("POST"===a){var l=r.postPayload(e,i);c+="string"==typeof l?l:JSON.stringify(l)}else if("PATCH"===a){var u=r.patchPayload(e,i);c+="string"==typeof u?u:JSON.stringify(u)}var h="v2.".concat(s.HMACSHA256(c));h=(h=(h=h.replace(/\+/g,"-")).replace(/\//g,"_")).replace(/=+$/,""),n.signature=h}t.PubNubError=v},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){(function(i){var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(5)),s=r(n(6)),a=r(n(4)),c=(r(n(8)),r(n(22)));function l(e){var t,n=[];for(t=0;t<e.length;t+=1)n[t/4|0]|=e[t]<<24-8*t;return c.default.lib.WordArray.create(n,e.length)}var u=function(){function e(t){var n=t.config;(0,o.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_iv",void 0),(0,a.default)(this,"_allowedKeyEncodings",void 0),(0,a.default)(this,"_allowedKeyLengths",void 0),(0,a.default)(this,"_allowedModes",void 0),(0,a.default)(this,"_defaultOptions",void 0),this._config=n,this._iv="0123456789012345",this._allowedKeyEncodings=["hex","utf8","base64","binary"],this._allowedKeyLengths=[128,256],this._allowedModes=["ecb","cbc"],this._defaultOptions={encryptKey:!0,keyEncoding:"utf8",keyLength:256,mode:"cbc"}}return(0,s.default)(e,[{key:"HMACSHA256",value:function(e){return c.default.HmacSHA256(e,this._config.secretKey).toString(c.default.enc.Base64)}},{key:"SHA256",value:function(e){return c.default.SHA256(e).toString(c.default.enc.Hex)}},{key:"_parseOptions",value:function(e){var t=e||{};return t.hasOwnProperty("encryptKey")||(t.encryptKey=this._defaultOptions.encryptKey),t.hasOwnProperty("keyEncoding")||(t.keyEncoding=this._defaultOptions.keyEncoding),t.hasOwnProperty("keyLength")||(t.keyLength=this._defaultOptions.keyLength),t.hasOwnProperty("mode")||(t.mode=this._defaultOptions.mode),-1===this._allowedKeyEncodings.indexOf(t.keyEncoding.toLowerCase())&&(t.keyEncoding=this._defaultOptions.keyEncoding),-1===this._allowedKeyLengths.indexOf(parseInt(t.keyLength,10))&&(t.keyLength=this._defaultOptions.keyLength),-1===this._allowedModes.indexOf(t.mode.toLowerCase())&&(t.mode=this._defaultOptions.mode),t}},{key:"_decodeKey",value:function(e,t){return"base64"===t.keyEncoding?c.default.enc.Base64.parse(e):"hex"===t.keyEncoding?c.default.enc.Hex.parse(e):e}},{key:"_getPaddedKey",value:function(e,t){return e=this._decodeKey(e,t),t.encryptKey?c.default.enc.Utf8.parse(this.SHA256(e).slice(0,32)):e}},{key:"_getMode",value:function(e){return"ecb"===e.mode?c.default.mode.ECB:c.default.mode.CBC}},{key:"_getIV",value:function(e){return"cbc"===e.mode?c.default.enc.Utf8.parse(this._iv):null}},{key:"_getRandomIV",value:function(){return c.default.lib.WordArray.random(16)}},{key:"encrypt",value:function(e,t,n){return this._config.customEncrypt?this._config.customEncrypt(e):this.pnEncrypt(e,t,n)}},{key:"decrypt",value:function(e,t,n){return this._config.customDecrypt?this._config.customDecrypt(e):this.pnDecrypt(e,t,n)}},{key:"pnEncrypt",value:function(e,t,n){if(!t&&!this._config.cipherKey)return e;n=this._parseOptions(n);var i=this._getMode(n),r=this._getPaddedKey(t||this._config.cipherKey,n);if(this._config.useRandomIVs){var o=this._getRandomIV(),s=c.default.AES.encrypt(e,r,{iv:o,mode:i}).ciphertext;return o.clone().concat(s.clone()).toString(c.default.enc.Base64)}var a=this._getIV(n);return c.default.AES.encrypt(e,r,{iv:a,mode:i}).ciphertext.toString(c.default.enc.Base64)||e}},{key:"pnDecrypt",value:function(e,t,n){if(!t&&!this._config.cipherKey)return e;n=this._parseOptions(n);var r=this._getMode(n),o=this._getPaddedKey(t||this._config.cipherKey,n);if(this._config.useRandomIVs){var s=i.from(e,"base64"),a=l(s.slice(0,16)),u=l(s.slice(16));try{var d=c.default.AES.decrypt({ciphertext:u},o,{iv:a,mode:r}).toString(c.default.enc.Utf8);return JSON.parse(d)}catch(e){return null}}else{var h=this._getIV(n);try{var p=c.default.enc.Base64.parse(e),f=c.default.AES.decrypt({ciphertext:p},o,{iv:h,mode:r}).toString(c.default.enc.Utf8);return JSON.parse(f)}catch(e){return null}}}}]),e}();t.default=u,e.exports=t.default}).call(this,n(21).Buffer)},function(e,t,n){(function(e){
|
|
177
177
|
/*!
|
|
178
178
|
* The buffer module from node.js, for the browser.
|
|
179
179
|
*
|
|
180
180
|
* @author Feross Aboukhadijeh <http://feross.org>
|
|
181
181
|
* @license MIT
|
|
182
182
|
*/
|
|
183
|
-
var i=n(36),r=n(37),o=n(38);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return l(this,e,t,n)}function l(e,t,n,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,i){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,n):new Uint8Array(t,n,i),c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=h(e,t),e}(e,t,n,i):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|f(t,n),r=(e=a(e,i)).write(t,n);return r!==i&&(e=e.slice(0,r)),e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|p(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(u(t),e=a(e,t<0?0:0|p(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function h(e,t){var n=t.length<0?0:0|p(t.length);e=a(e,n);for(var i=0;i<n;i+=1)e[i]=255&t[i];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(i)return B(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return x(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function v(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,i,r);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,i,r){var o,s=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var u=-1;for(o=n;o<a;o++)if(l(e,o)===l(t,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===c)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var d=!0,h=0;h<c;h++)if(l(e,o+h)!==l(t,h)){d=!1;break}if(d)return o}return-1}function b(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function w(e,t,n,i){return K(B(t,e.length-n),e,n,i)}function k(e,t,n,i){return K(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function _(e,t,n,i){return k(e,t,n,i)}function P(e,t,n,i){return K(F(t),e,n,i)}function S(e,t,n,i){return K(function(e,t){for(var n,i,r,o=[],s=0;s<e.length&&!((t-=2)<0);++s)i=(n=e.charCodeAt(s))>>8,r=n%256,o.push(r),o.push(i);return o}(t,e.length-n),e,n,i)}function x(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var o,s,a,c,l=e[r],u=null,d=l>239?4:l>223?3:l>191?2:1;if(r+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[r+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[r+1],s=e[r+2],128==(192&o)&&128==(192&s)&&(c=(15&l)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[r+1],s=e[r+2],a=e[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",i=0;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return n}(i)}function T(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function C(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function E(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=t;o<n;++o)r+=$(e[o]);return r}function A(e,t,n){for(var i=e.slice(t,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+256*i[o+1]);return r}function R(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,i,r,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<o)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function j(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,o=Math.min(e.length-n,2);r<o;++r)e[n+r]=(t&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function L(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,o=Math.min(e.length-n,4);r<o;++r)e[n+r]=t>>>8*(i?r:3-r)&255}function N(e,t,n,i,r,o){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,i,o){return o||N(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function I(e,t,n,i,o){return o||N(e,0,n,8),r.write(e,t,n,i,52,8),n+8}t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return l(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,i){return u(t),t<=0?a(e,t):void 0!==n?"string"==typeof i?a(e,t).fill(n,i):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return d(null,e)},c.allocUnsafeSlow=function(e){return d(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,r=0,o=Math.min(n,i);r<o;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=c.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var s=e[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r),r+=s.length}return i},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?O(this,0,e):g.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,i,r){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(r>>>=0)-(i>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(i,r),u=e.slice(t,n),d=0;d<a;++d)if(l[d]!==u[d]){o=l[d],s=u[d];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},c.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return k(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return P(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(e,t){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var r=t-e;n=new c(r,void 0);for(var o=0;o<r;++o)n[o]=this[o+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var i=this[e],r=1,o=0;++o<t&&(r*=256);)i+=this[e+o]*r;return i},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},c.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var i=this[e],r=1,o=0;++o<t&&(r*=256);)i+=this[e+o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var i=t,r=1,o=this[e+--i];i>0&&(r*=256);)o+=this[e+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),r.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),r.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),r.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),r.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,i){e=+e,t|=0,n|=0,i||M(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[t]=255&e;++o<n&&(r*=256);)this[t+o]=e/r&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,i){e=+e,t|=0,n|=0,i||M(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,o=1;for(this[t+r]=255&e;--r>=0&&(o*=256);)this[t+r]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return I(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return I(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var r,o=i-n;if(this===e&&n<t&&t<i)for(r=o-1;r>=0;--r)e[r+t]=this[r+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)e[r+t]=this[r+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},c.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=c.isBuffer(e)?e:B(new c(e,i).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function $(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var n;t=t||1/0;for(var i=e.length,r=null,o=[],s=0;s<i;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,n,i){for(var r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,n(35))},function(e,t,n){var i,r,o,s,a,c=c||function(e,t){var n={},i=n.lib={},r=function(){},o=i.Base={extend:function(e){r.prototype=this;var t=new r;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var r=0;r<e;r++)t[i+r>>>2]|=(n[r>>>2]>>>24-r%4*8&255)<<24-(i+r)%4*8;else if(65535<n.length)for(r=0;r<e;r+=4)t[i+r>>>2]=n[r>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i<t;i+=4)n.push(4294967296*e.random()|0);return new s.init(n,t)}}),a=n.enc={},c=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i<e;i++){var r=t[i>>>2]>>>24-i%4*8&255;n.push((r>>>4).toString(16)),n.push((15&r).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,t/2)}},l=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i<e;i++)n.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,i=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o);if(t=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,r=e.min(4*t,r),t){for(var c=0;c<t;c+=o)this._doProcessBlock(i,c);c=i.splice(0,t),n.sigBytes-=r}return new s.init(c,r)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=d.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}});var h=n.algo={};return n}(Math);!function(e){for(var t=c,n=(r=t.lib).WordArray,i=r.Hasher,r=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},l=2,u=0;64>u;){var d;e:{d=l;for(var h=e.sqrt(d),p=2;p<=h;p++)if(!(d%p)){d=!1;break e}d=!0}d&&(8>u&&(o[u]=a(e.pow(l,.5))),s[u]=a(e.pow(l,1/3)),u++),l++}var f=[];r=r.SHA256=i.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],a=n[3],c=n[4],l=n[5],u=n[6],d=n[7],h=0;64>h;h++){if(16>h)f[h]=0|e[t+h];else{var p=f[h-15],g=f[h-2];f[h]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+f[h-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+f[h-16]}p=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+s[h]+f[h],g=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&r^i&o^r&o),d=u,u=l,l=c,c=a+p|0,a=o,o=r,r=i,i=p+g|0}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+c|0,n[5]=n[5]+l|0,n[6]=n[6]+u|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA256=i._createHelper(r),t.HmacSHA256=i._createHmacHelper(r)}(Math),r=(i=c).enc.Utf8,i.algo.HMAC=i.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,c=s.words,l=0;l<n;l++)a[l]^=1549556828,c[l]^=909522486;o.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}}),s=(o=c).lib.WordArray,o.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,i=this._map;e.clamp(),e=[];for(var r=0;r<n;r+=3)for(var o=(t[r>>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,s=0;4>s&&r+.75*s<n;s++)e.push(i.charAt(o>>>6*(3-s)&63));if(t=i.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var t=e.length,n=this._map;(i=n.charAt(64))&&-1!=(i=e.indexOf(i))&&(t=i);for(var i=[],r=0,o=0;o<t;o++)if(o%4){var a=n.indexOf(e.charAt(o-1))<<o%4*2,c=n.indexOf(e.charAt(o))>>>6-o%4*2;i[r>>>2]|=(a|c)<<24-r%4*8,r++}return s.create(i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){function t(e,t,n,i,r,o,s){return((e=e+(t&n|~t&i)+r+s)<<o|e>>>32-o)+t}function n(e,t,n,i,r,o,s){return((e=e+(t&i|n&~i)+r+s)<<o|e>>>32-o)+t}function i(e,t,n,i,r,o,s){return((e=e+(t^n^i)+r+s)<<o|e>>>32-o)+t}function r(e,t,n,i,r,o,s){return((e=e+(n^(t|~i))+r+s)<<o|e>>>32-o)+t}for(var o=c,s=(l=o.lib).WordArray,a=l.Hasher,l=o.algo,u=[],d=0;64>d;d++)u[d]=4294967296*e.abs(e.sin(d+1))|0;l=l.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,o){for(var s=0;16>s;s++){var a=e[c=o+s];e[c]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}s=this._hash.words;var c=e[o+0],l=(a=e[o+1],e[o+2]),d=e[o+3],h=e[o+4],p=e[o+5],f=e[o+6],g=e[o+7],m=e[o+8],v=e[o+9],y=e[o+10],b=e[o+11],w=e[o+12],k=e[o+13],_=e[o+14],P=e[o+15],S=t(S=s[0],T=s[1],O=s[2],x=s[3],c,7,u[0]),x=t(x,S,T,O,a,12,u[1]),O=t(O,x,S,T,l,17,u[2]),T=t(T,O,x,S,d,22,u[3]);S=t(S,T,O,x,h,7,u[4]),x=t(x,S,T,O,p,12,u[5]),O=t(O,x,S,T,f,17,u[6]),T=t(T,O,x,S,g,22,u[7]),S=t(S,T,O,x,m,7,u[8]),x=t(x,S,T,O,v,12,u[9]),O=t(O,x,S,T,y,17,u[10]),T=t(T,O,x,S,b,22,u[11]),S=t(S,T,O,x,w,7,u[12]),x=t(x,S,T,O,k,12,u[13]),O=t(O,x,S,T,_,17,u[14]),S=n(S,T=t(T,O,x,S,P,22,u[15]),O,x,a,5,u[16]),x=n(x,S,T,O,f,9,u[17]),O=n(O,x,S,T,b,14,u[18]),T=n(T,O,x,S,c,20,u[19]),S=n(S,T,O,x,p,5,u[20]),x=n(x,S,T,O,y,9,u[21]),O=n(O,x,S,T,P,14,u[22]),T=n(T,O,x,S,h,20,u[23]),S=n(S,T,O,x,v,5,u[24]),x=n(x,S,T,O,_,9,u[25]),O=n(O,x,S,T,d,14,u[26]),T=n(T,O,x,S,m,20,u[27]),S=n(S,T,O,x,k,5,u[28]),x=n(x,S,T,O,l,9,u[29]),O=n(O,x,S,T,g,14,u[30]),S=i(S,T=n(T,O,x,S,w,20,u[31]),O,x,p,4,u[32]),x=i(x,S,T,O,m,11,u[33]),O=i(O,x,S,T,b,16,u[34]),T=i(T,O,x,S,_,23,u[35]),S=i(S,T,O,x,a,4,u[36]),x=i(x,S,T,O,h,11,u[37]),O=i(O,x,S,T,g,16,u[38]),T=i(T,O,x,S,y,23,u[39]),S=i(S,T,O,x,k,4,u[40]),x=i(x,S,T,O,c,11,u[41]),O=i(O,x,S,T,d,16,u[42]),T=i(T,O,x,S,f,23,u[43]),S=i(S,T,O,x,v,4,u[44]),x=i(x,S,T,O,w,11,u[45]),O=i(O,x,S,T,P,16,u[46]),S=r(S,T=i(T,O,x,S,l,23,u[47]),O,x,c,6,u[48]),x=r(x,S,T,O,g,10,u[49]),O=r(O,x,S,T,_,15,u[50]),T=r(T,O,x,S,p,21,u[51]),S=r(S,T,O,x,w,6,u[52]),x=r(x,S,T,O,d,10,u[53]),O=r(O,x,S,T,y,15,u[54]),T=r(T,O,x,S,a,21,u[55]),S=r(S,T,O,x,m,6,u[56]),x=r(x,S,T,O,P,10,u[57]),O=r(O,x,S,T,f,15,u[58]),T=r(T,O,x,S,k,21,u[59]),S=r(S,T,O,x,h,6,u[60]),x=r(x,S,T,O,b,10,u[61]),O=r(O,x,S,T,l,15,u[62]),T=r(T,O,x,S,v,21,u[63]),s[0]=s[0]+S|0,s[1]=s[1]+T|0,s[2]=s[2]+O|0,s[3]=s[3]+x|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(i/4294967296);for(n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process(),n=(t=this._hash).words,i=0;4>i;i++)r=n[i],n[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return t},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),o.MD5=a._createHelper(l),o.HmacMD5=a._createHmacHelper(l)}(Math),function(){var e,t=c,n=(e=t.lib).Base,i=e.WordArray,r=(e=t.algo).EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:e.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=(a=this.cfg).hasher.create(),r=i.create(),o=r.words,s=a.keySize,a=a.iterations;o.length<s;){c&&n.update(c);var c=n.update(e).finalize(t);n.reset();for(var l=1;l<a;l++)c=n.finalize(c),n.reset();r.concat(c)}return r.sigBytes=4*s,r}});t.EvpKDF=function(e,t,n){return r.create(n).compute(e,t)}}(),c.lib.Cipher||function(e){var t=(f=c).lib,n=t.Base,i=t.WordArray,r=t.BufferedBlockAlgorithm,o=f.enc.Base64,s=f.algo.EvpKDF,a=t.Cipher=r.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,i){return("string"==typeof n?g:p).encrypt(e,t,n,i)},decrypt:function(t,n,i){return("string"==typeof n?g:p).decrypt(e,t,n,i)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=f.mode={},u=function(e,t,n){var i=this._iv;i?this._iv=void 0:i=this._prevBlock;for(var r=0;r<n;r++)e[t+r]^=i[r]},d=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();d.Encryptor=d.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;u.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),d.Decryptor=d.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,r=e.slice(t,t+i);n.decryptBlock(e,t),u.call(this,e,t,i),this._prevBlock=r}}),l=l.CBC=d,d=(f.pad={}).Pkcs7={pad:function(e,t){for(var n,r=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(r);n=i.create(o,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:l,padding:d}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var h=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(l=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:l}),encrypt:function(e,t,n,i){i=this.cfg.extend(i);var r=e.createEncryptor(n,i);return t=r.finalize(t),r=r.cfg,h.create({ciphertext:t,key:n,iv:r.iv,algorithm:e,mode:r.mode,padding:r.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(n,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=i.random(8)),e=s.create({keySize:t+n}).compute(e,r),n=i.create(e.words.slice(t),4*n),e.sigBytes=4*t,h.create({key:e,iv:n,salt:r})}},g=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:f}),encrypt:function(e,t,n,i){return n=(i=this.cfg.extend(i)).kdf.execute(n,e.keySize,e.ivSize),i.iv=n.iv,(e=p.encrypt.call(this,e,t,n.key,i)).mixIn(n),e},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),n=i.kdf.execute(n,e.keySize,e.ivSize,t.salt),i.iv=n.iv,p.decrypt.call(this,e,t,n.key,i)}})}(),function(){for(var e=c,t=e.lib.BlockCipher,n=e.algo,i=[],r=[],o=[],s=[],a=[],l=[],u=[],d=[],h=[],p=[],f=[],g=0;256>g;g++)f[g]=128>g?g<<1:g<<1^283;var m=0,v=0;for(g=0;256>g;g++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;i[m]=y,r[y]=m;var b=f[m],w=f[b],k=f[w],_=257*f[y]^16843008*y;o[m]=_<<24|_>>>8,s[m]=_<<16|_>>>16,a[m]=_<<8|_>>>24,l[m]=_,_=16843009*k^65537*w^257*b^16843008*m,u[y]=_<<24|_>>>8,d[y]=_<<16|_>>>16,h[y]=_<<8|_>>>24,p[y]=_,m?(m=b^f[f[f[k^b]]],v^=f[f[v]]):m=v=1}var P=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),r=this._keySchedule=[],o=0;o<n;o++)if(o<t)r[o]=e[o];else{var s=r[o-1];o%t?6<t&&4==o%t&&(s=i[s>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s]):(s=i[(s=s<<8|s>>>24)>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s],s^=P[o/t|0]<<24),r[o]=r[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<n;t++)o=n-t,s=t%4?r[o]:r[o-4],e[t]=4>t||4>=o?s:u[i[s>>>24]]^d[i[s>>>16&255]]^h[i[s>>>8&255]]^p[i[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,l,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,p,r),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,r,o,s,a){for(var c=this._nRounds,l=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],h=e[t+3]^n[3],p=4,f=1;f<c;f++){var g=i[l>>>24]^r[u>>>16&255]^o[d>>>8&255]^s[255&h]^n[p++],m=i[u>>>24]^r[d>>>16&255]^o[h>>>8&255]^s[255&l]^n[p++],v=i[d>>>24]^r[h>>>16&255]^o[l>>>8&255]^s[255&u]^n[p++];h=i[h>>>24]^r[l>>>16&255]^o[u>>>8&255]^s[255&d]^n[p++],l=g,u=m,d=v}g=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^n[p++],m=(a[u>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^n[p++],v=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^n[p++],h=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&d])^n[p++],e[t]=g,e[t+1]=m,e[t+2]=v,e[t+3]=h},keySize:8}),e.AES=t._createHelper(n)}(),c.mode.ECB=((a=c.lib.BlockCipherMode.extend()).Encryptor=a.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),a.Decryptor=a.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),a),e.exports=c},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=(n(2),i(n(10))),c=function(){function e(){(0,r.default)(this,e),(0,s.default)(this,"_listeners",void 0),this._listeners=[]}return(0,o.default)(e,[{key:"addListener",value:function(e){this._listeners.push(e)}},{key:"removeListener",value:function(e){var t=[];this._listeners.forEach((function(n){n!==e&&t.push(n)})),this._listeners=t}},{key:"removeAllListeners",value:function(){this._listeners=[]}},{key:"announcePresence",value:function(e){this._listeners.forEach((function(t){t.presence&&t.presence(e)}))}},{key:"announceStatus",value:function(e){this._listeners.forEach((function(t){t.status&&t.status(e)}))}},{key:"announceMessage",value:function(e){this._listeners.forEach((function(t){t.message&&t.message(e)}))}},{key:"announceSignal",value:function(e){this._listeners.forEach((function(t){t.signal&&t.signal(e)}))}},{key:"announceMessageAction",value:function(e){this._listeners.forEach((function(t){t.messageAction&&t.messageAction(e)}))}},{key:"announceFile",value:function(e){this._listeners.forEach((function(t){t.file&&t.file(e)}))}},{key:"announceObjects",value:function(e){this._listeners.forEach((function(t){t.objects&&t.objects(e)}))}},{key:"announceUser",value:function(e){this._listeners.forEach((function(t){t.user&&t.user(e)}))}},{key:"announceSpace",value:function(e){this._listeners.forEach((function(t){t.space&&t.space(e)}))}},{key:"announceMembership",value:function(e){this._listeners.forEach((function(t){t.membership&&t.membership(e)}))}},{key:"announceNetworkUp",value:function(){var e={};e.category=a.default.PNNetworkUpCategory,this.announceStatus(e)}},{key:"announceNetworkDown",value:function(){var e={};e.category=a.default.PNNetworkDownCategory,this.announceStatus(e)}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNTimeOperation},t.getURL=function(){return"/time/0"},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(){return{}},t.isAuthSupported=function(){return!1},t.handleResponse=function(e,t){return{timetoken:t[0]}},t.validateParams=function(){},n(2);var r=i(n(1))},function(e,t,n){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t,n){var i=n(81);e.exports=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){e.exports=function(e){return null!==e&&"object"==typeof e}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(14)),s=i(n(16)),a=i(n(13)),c=i(n(7)),l=i(n(31)),u=i(n(32)),d=i(n(121)),h=i(n(22)),p=i(n(124)),f=i(n(125)),g=n(126),m=(n(2),i(n(133))),v=i(n(134));function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=(0,a.default)(e);if(t){var r=(0,a.default)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return(0,s.default)(this,n)}}function b(e){if(!navigator||!navigator.sendBeacon)return!1;navigator.sendBeacon(e)}function w(e){for(var t=h.default.enc.Base64.parse(e).words,n=new ArrayBuffer(4*t.length),i=new Uint8Array(n),r=0,o=0,s=0;s<t.length;s+=1){var a=t[s];i[o=4*s]=(4278190080&a)>>24,i[o+1]=(16711680&a)>>16,i[o+2]=(65280&a)>>8,i[o+3]=255&a}for(var c=o+3;c>=o;c-=1)0===i[c]&&(r+=1);return r>0?i.buffer.slice(0,i.byteLength-r):i.buffer}function k(e){var t=function(e){return e&&"object"===(0,c.default)(e)&&e.constructor===Object};if(!t(e))return e;var n={};return Object.keys(e).forEach((function(i){var r=function(e){return"string"==typeof e||e instanceof String}(i),o=i,s=e[i];Array.isArray(i)||r&&i.indexOf(",")>=0?o=(r?i.split(","):i).reduce((function(e,t){return e+String.fromCharCode(t)}),""):(function(e){return"number"==typeof e&&isFinite(e)}(i)||r&&!isNaN(i))&&(o=String.fromCharCode(r?parseInt(i,10):10)),n[o]=t(s)?k(s):s})),n}var _=function(e){(0,o.default)(n,e);var t=y(n);function n(e){var i;(0,r.default)(this,n);var o=e.listenToBrowserNetworkEvents,s=void 0===o||o;return e.db=p.default,e.sdkFamily="Web",e.networking=new d.default({del:g.del,get:g.get,post:g.post,patch:g.patch,sendBeacon:b,getfile:g.getfile,postfile:g.postfile}),e.cbor=new f.default((function(e){return k(l.default.decode(e))}),w),e.PubNubFile=v.default,e.cryptography=new m.default,i=t.call(this,e),s&&(window.addEventListener("offline",(function(){i.networkDownDetected()})),window.addEventListener("online",(function(){i.networkUpDetected()}))),i}return n}(u.default);t.default=_,e.exports=t.default},function(e,t,n){var i,r,o,s,a;o=Math.pow(2,-24),s=Math.pow(2,32),a=Math.pow(2,53),void 0===(r="function"==typeof(i={encode:function(e){var t,n=new ArrayBuffer(256),i=new DataView(n),r=0;function o(e){for(var o=n.byteLength,s=r+e;o<s;)o*=2;if(o!==n.byteLength){var a=i;n=new ArrayBuffer(o),i=new DataView(n);for(var c=r+3>>2,l=0;l<c;++l)i.setUint32(4*l,a.getUint32(4*l))}return t=e,i}function c(){r+=t}function l(e){c(o(1).setUint8(r,e))}function u(e){for(var t=o(e.length),n=0;n<e.length;++n)t.setUint8(r+n,e[n]);c()}function d(e,t){t<24?l(e<<5|t):t<256?(l(e<<5|24),l(t)):t<65536?(l(e<<5|25),function(e){c(o(2).setUint16(r,e))}(t)):t<4294967296?(l(e<<5|26),function(e){c(o(4).setUint32(r,e))}(t)):(l(e<<5|27),function(e){var t=e%s,n=(e-t)/s,i=o(8);i.setUint32(r,n),i.setUint32(r+4,t),c()}(t))}if(function e(t){var n;if(!1===t)return l(244);if(!0===t)return l(245);if(null===t)return l(246);if(void 0===t)return l(247);switch(typeof t){case"number":if(Math.floor(t)===t){if(0<=t&&t<=a)return d(0,t);if(-a<=t&&t<0)return d(1,-(t+1))}return l(251),function(e){c(o(8).setFloat64(r,e))}(t);case"string":var i=[];for(n=0;n<t.length;++n){var s=t.charCodeAt(n);s<128?i.push(s):s<2048?(i.push(192|s>>6),i.push(128|63&s)):s<55296?(i.push(224|s>>12),i.push(128|s>>6&63),i.push(128|63&s)):(s=(1023&s)<<10,s|=1023&t.charCodeAt(++n),s+=65536,i.push(240|s>>18),i.push(128|s>>12&63),i.push(128|s>>6&63),i.push(128|63&s))}return d(3,i.length),u(i);default:var h;if(Array.isArray(t))for(d(4,h=t.length),n=0;n<h;++n)e(t[n]);else if(t instanceof Uint8Array)d(2,t.length),u(t);else{var p=Object.keys(t);for(d(5,h=p.length),n=0;n<h;++n){var f=p[n];e(f),e(t[f])}}}}(e),"slice"in n)return n.slice(0,r);for(var h=new ArrayBuffer(r),p=new DataView(h),f=0;f<r;++f)p.setUint8(f,i.getUint8(f));return h},decode:function(e,t,n){var i=new DataView(e),r=0;function a(e,t){return r+=t,e}function c(t){return a(new Uint8Array(e,r,t),t)}function l(){return a(i.getUint8(r),1)}function u(){return a(i.getUint16(r),2)}function d(){return a(i.getUint32(r),4)}function h(){return 255===i.getUint8(r)&&(r+=1,!0)}function p(e){if(e<24)return e;if(24===e)return l();if(25===e)return u();if(26===e)return d();if(27===e)return d()*s+d();if(31===e)return-1;throw"Invalid length encoding"}function f(e){var t=l();if(255===t)return-1;var n=p(31&t);if(n<0||t>>5!==e)throw"Invalid indefinite length element";return n}function g(e,t){for(var n=0;n<t;++n){var i=l();128&i&&(i<224?(i=(31&i)<<6|63&l(),t-=1):i<240?(i=(15&i)<<12|(63&l())<<6|63&l(),t-=2):(i=(15&i)<<18|(63&l())<<12|(63&l())<<6|63&l(),t-=3)),i<65536?e.push(i):(i-=65536,e.push(55296|i>>10),e.push(56320|1023&i))}}"function"!=typeof t&&(t=function(e){return e}),"function"!=typeof n&&(n=function(){});var m=function e(){var s,d,m=l(),v=m>>5,y=31&m;if(7===v)switch(y){case 25:return function(){var e=new ArrayBuffer(4),t=new DataView(e),n=u(),i=32768&n,r=31744&n,s=1023&n;if(31744===r)r=261120;else if(0!==r)r+=114688;else if(0!==s)return s*o;return t.setUint32(0,i<<16|r<<13|s<<13),t.getFloat32(0)}();case 26:return a(i.getFloat32(r),4);case 27:return a(i.getFloat64(r),8)}if((d=p(y))<0&&(v<2||6<v))throw"Invalid length";switch(v){case 0:return d;case 1:return-1-d;case 2:if(d<0){for(var b=[],w=0;(d=f(v))>=0;)w+=d,b.push(c(d));var k=new Uint8Array(w),_=0;for(s=0;s<b.length;++s)k.set(b[s],_),_+=b[s].length;return k}return c(d);case 3:var P=[];if(d<0)for(;(d=f(v))>=0;)g(P,d);else g(P,d);return String.fromCharCode.apply(null,P);case 4:var S;if(d<0)for(S=[];!h();)S.push(e());else for(S=new Array(d),s=0;s<d;++s)S[s]=e();return S;case 5:var x={};for(s=0;s<d||d<0&&!h();++s)x[e()]=e();return x;case 6:return t(e(),d);case 7:switch(d){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:return n(d)}}}();if(r!==e.byteLength)throw"Remaining bytes";return m}})?i.call(t,n,t,e):i)||(e.exports=r)},function(e,t,n){var i=n(33),r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(5)),s=r(n(6)),a=r(n(4)),c=r(n(8)),l=r(n(20)),u=r(n(39)),d=r(n(43)),h=r(n(44)),p=r(n(23)),f=r(n(47)),g=r(n(18)),m=n(3),v=i(n(52)),y=i(n(53)),b=i(n(54)),w=i(n(55)),k=i(n(56)),_=i(n(57)),P=i(n(58)),S=i(n(59)),x=i(n(60)),O=i(n(61)),T=i(n(62)),C=i(n(63)),E=i(n(64)),A=i(n(65)),R=i(n(66)),M=i(n(67)),j=i(n(68)),L=i(n(69)),N=(n(25),i(n(70)),r(n(71))),U=r(n(72)),I=r(n(73)),D=r(n(74)),$=r(n(76)),B=r(n(77)),F=r(n(78)),K=r(n(79)),q=r(n(82)),z=r(n(83)),H=r(n(84)),V=r(n(85)),G=r(n(86)),W=r(n(87)),Y=r(n(88)),J=r(n(89)),X=r(n(90)),Z=r(n(91)),Q=r(n(92)),ee=i(n(93)),te=i(n(94)),ne=i(n(95)),ie=i(n(96)),re=i(n(97)),oe=i(n(98)),se=i(n(99)),ae=i(n(100)),ce=i(n(101)),le=i(n(102)),ue=i(n(103)),de=i(n(104)),he=i(n(105)),pe=i(n(106)),fe=i(n(107)),ge=i(n(108)),me=i(n(109)),ve=i(n(110)),ye=i(n(111)),be=i(n(112)),we=i(n(113)),ke=i(n(114)),_e=i(n(115)),Pe=i(n(116)),Se=i(n(117)),xe=i(n(118)),Oe=i(n(119)),Te=i(n(24)),Ce=i(n(120)),Ee=r(n(1)),Ae=r(n(10)),Re=(n(2),r(n(17)));function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function je(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){(0,a.default)(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}var Le=function(){function e(t){var n=this;(0,o.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_telemetryManager",void 0),(0,a.default)(this,"_listenerManager",void 0),(0,a.default)(this,"_tokenManager",void 0),(0,a.default)(this,"time",void 0),(0,a.default)(this,"publish",void 0),(0,a.default)(this,"fire",void 0),(0,a.default)(this,"history",void 0),(0,a.default)(this,"deleteMessages",void 0),(0,a.default)(this,"messageCounts",void 0),(0,a.default)(this,"fetchMessages",void 0),(0,a.default)(this,"channelGroups",void 0),(0,a.default)(this,"push",void 0),(0,a.default)(this,"hereNow",void 0),(0,a.default)(this,"whereNow",void 0),(0,a.default)(this,"getState",void 0),(0,a.default)(this,"setState",void 0),(0,a.default)(this,"grant",void 0),(0,a.default)(this,"grantToken",void 0),(0,a.default)(this,"audit",void 0),(0,a.default)(this,"subscribe",void 0),(0,a.default)(this,"signal",void 0),(0,a.default)(this,"presence",void 0),(0,a.default)(this,"unsubscribe",void 0),(0,a.default)(this,"unsubscribeAll",void 0),(0,a.default)(this,"addMessageAction",void 0),(0,a.default)(this,"removeMessageAction",void 0),(0,a.default)(this,"getMessageActions",void 0),(0,a.default)(this,"File",void 0),(0,a.default)(this,"encryptFile",void 0),(0,a.default)(this,"decryptFile",void 0),(0,a.default)(this,"listFiles",void 0),(0,a.default)(this,"sendFile",void 0),(0,a.default)(this,"downloadFile",void 0),(0,a.default)(this,"getFileUrl",void 0),(0,a.default)(this,"deleteFile",void 0),(0,a.default)(this,"publishFile",void 0),(0,a.default)(this,"objects",void 0),(0,a.default)(this,"createUser",void 0),(0,a.default)(this,"updateUser",void 0),(0,a.default)(this,"deleteUser",void 0),(0,a.default)(this,"getUser",void 0),(0,a.default)(this,"getUsers",void 0),(0,a.default)(this,"createSpace",void 0),(0,a.default)(this,"updateSpace",void 0),(0,a.default)(this,"deleteSpace",void 0),(0,a.default)(this,"getSpaces",void 0),(0,a.default)(this,"getSpace",void 0),(0,a.default)(this,"getMembers",void 0),(0,a.default)(this,"addMembers",void 0),(0,a.default)(this,"updateMembers",void 0),(0,a.default)(this,"removeMembers",void 0),(0,a.default)(this,"getMemberships",void 0),(0,a.default)(this,"joinSpaces",void 0),(0,a.default)(this,"updateMemberships",void 0),(0,a.default)(this,"leaveSpaces",void 0),(0,a.default)(this,"disconnect",void 0),(0,a.default)(this,"reconnect",void 0),(0,a.default)(this,"destroy",void 0),(0,a.default)(this,"stop",void 0),(0,a.default)(this,"getSubscribedChannels",void 0),(0,a.default)(this,"getSubscribedChannelGroups",void 0),(0,a.default)(this,"addListener",void 0),(0,a.default)(this,"removeListener",void 0),(0,a.default)(this,"removeAllListeners",void 0),(0,a.default)(this,"parseToken",void 0),(0,a.default)(this,"setToken",void 0),(0,a.default)(this,"setTokens",void 0),(0,a.default)(this,"getToken",void 0),(0,a.default)(this,"getTokens",void 0),(0,a.default)(this,"clearTokens",void 0),(0,a.default)(this,"getAuthKey",void 0),(0,a.default)(this,"setAuthKey",void 0),(0,a.default)(this,"setCipherKey",void 0),(0,a.default)(this,"setUUID",void 0),(0,a.default)(this,"getUUID",void 0),(0,a.default)(this,"getFilterExpression",void 0),(0,a.default)(this,"setFilterExpression",void 0),(0,a.default)(this,"setHeartbeatInterval",void 0),(0,a.default)(this,"setProxy",void 0),(0,a.default)(this,"encrypt",void 0),(0,a.default)(this,"decrypt",void 0);var i=t.db,r=t.networking,s=t.cbor,h=this._config=new c.default({setup:t,db:i}),Ee=new l.default({config:h}),Ae=t.cryptography;r.init(h);var Re=this._tokenManager=new f.default(h,s),Me=this._telemetryManager=new d.default({maximumSamplesCount:6e4}),Le={config:h,networking:r,crypto:Ee,cryptography:Ae,tokenManager:Re,telemetryManager:Me,PubNubFile:t.PubNubFile};this.File=t.PubNubFile,this.encryptFile=function(e,t){return Ae.encryptFile(e,t,n.File)},this.decryptFile=function(e,t){return Ae.decryptFile(e,t,n.File)};var Ne=g.default.bind(this,Le,Te),Ue=g.default.bind(this,Le,O),Ie=g.default.bind(this,Le,C),De=g.default.bind(this,Le,A),$e=g.default.bind(this,Le,Ce),Be=this._listenerManager=new p.default,Fe=new u.default({timeEndpoint:Ne,leaveEndpoint:Ue,heartbeatEndpoint:Ie,setStateEndpoint:De,subscribeEndpoint:$e,crypto:Le.crypto,config:Le.config,listenerManager:Be,getFileUrl:function(e){return(0,$.default)(Le,e)}});this.addListener=Be.addListener.bind(Be),this.removeListener=Be.removeListener.bind(Be),this.removeAllListeners=Be.removeAllListeners.bind(Be),this.parseToken=Re.parseToken.bind(Re),this.setToken=Re.setToken.bind(Re),this.setTokens=Re.setTokens.bind(Re),this.getToken=Re.getToken.bind(Re),this.getTokens=Re.getTokens.bind(Re),this.clearTokens=Re.clearTokens.bind(Re),this.channelGroups={listGroups:g.default.bind(this,Le,w),listChannels:g.default.bind(this,Le,k),addChannels:g.default.bind(this,Le,v),removeChannels:g.default.bind(this,Le,y),deleteGroup:g.default.bind(this,Le,b)},this.push={addChannels:g.default.bind(this,Le,_),removeChannels:g.default.bind(this,Le,P),deleteDevice:g.default.bind(this,Le,x),listChannels:g.default.bind(this,Le,S)},this.hereNow=g.default.bind(this,Le,R),this.whereNow=g.default.bind(this,Le,T),this.getState=g.default.bind(this,Le,E),this.setState=Fe.adaptStateChange.bind(Fe),this.grant=g.default.bind(this,Le,be),this.grantToken=g.default.bind(this,Le,we),this.audit=g.default.bind(this,Le,ye),this.publish=g.default.bind(this,Le,ke),this.fire=function(e,t){return e.replicate=!1,e.storeInHistory=!1,n.publish(e,t)},this.signal=g.default.bind(this,Le,_e),this.history=g.default.bind(this,Le,Pe),this.deleteMessages=g.default.bind(this,Le,Se),this.messageCounts=g.default.bind(this,Le,xe),this.fetchMessages=g.default.bind(this,Le,Oe),this.addMessageAction=g.default.bind(this,Le,M),this.removeMessageAction=g.default.bind(this,Le,j),this.getMessageActions=g.default.bind(this,Le,L),this.listFiles=g.default.bind(this,Le,N.default);var Ke=g.default.bind(this,Le,U.default);this.publishFile=g.default.bind(this,Le,I.default),this.sendFile=(0,D.default)({generateUploadUrl:Ke,publishFile:this.publishFile,modules:Le}),this.getFileUrl=function(e){return(0,$.default)(Le,e)},this.downloadFile=g.default.bind(this,Le,B.default),this.deleteFile=g.default.bind(this,Le,F.default),this.objects={getAllUUIDMetadata:g.default.bind(this,Le,K.default),getUUIDMetadata:g.default.bind(this,Le,q.default),setUUIDMetadata:g.default.bind(this,Le,z.default),removeUUIDMetadata:g.default.bind(this,Le,H.default),getAllChannelMetadata:g.default.bind(this,Le,V.default),getChannelMetadata:g.default.bind(this,Le,G.default),setChannelMetadata:g.default.bind(this,Le,W.default),removeChannelMetadata:g.default.bind(this,Le,Y.default),getChannelMembers:g.default.bind(this,Le,J.default),setChannelMembers:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,X.default,je({type:"set"},e)].concat(i))},removeChannelMembers:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,X.default,je({type:"delete"},e)].concat(i))},getMemberships:g.default.bind(this,Le,Z.default),setMemberships:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,Q.default,je({type:"set"},e)].concat(i))},removeMemberships:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,Q.default,je({type:"delete"},e)].concat(i))}},this.createUser=(0,m.deprecated)(g.default.bind(this,Le,ee)),this.updateUser=(0,m.deprecated)(g.default.bind(this,Le,te)),this.deleteUser=(0,m.deprecated)(g.default.bind(this,Le,ne)),this.getUser=(0,m.deprecated)(g.default.bind(this,Le,ie)),this.getUsers=(0,m.deprecated)(g.default.bind(this,Le,re)),this.createSpace=(0,m.deprecated)(g.default.bind(this,Le,oe)),this.updateSpace=(0,m.deprecated)(g.default.bind(this,Le,se)),this.deleteSpace=(0,m.deprecated)(g.default.bind(this,Le,ae)),this.getSpaces=(0,m.deprecated)(g.default.bind(this,Le,ce)),this.getSpace=(0,m.deprecated)(g.default.bind(this,Le,le)),this.addMembers=(0,m.deprecated)(g.default.bind(this,Le,de)),this.updateMembers=(0,m.deprecated)(g.default.bind(this,Le,he)),this.removeMembers=(0,m.deprecated)(g.default.bind(this,Le,pe)),this.getMembers=(0,m.deprecated)(g.default.bind(this,Le,ue)),this.getMemberships=(0,m.deprecated)(g.default.bind(this,Le,fe)),this.joinSpaces=(0,m.deprecated)(g.default.bind(this,Le,me)),this.updateMemberships=(0,m.deprecated)(g.default.bind(this,Le,ge)),this.leaveSpaces=(0,m.deprecated)(g.default.bind(this,Le,ve)),this.time=Ne,this.subscribe=Fe.adaptSubscribeChange.bind(Fe),this.presence=Fe.adaptPresenceChange.bind(Fe),this.unsubscribe=Fe.adaptUnsubscribeChange.bind(Fe),this.disconnect=Fe.disconnect.bind(Fe),this.reconnect=Fe.reconnect.bind(Fe),this.destroy=function(e){Fe.unsubscribeAll(e),Fe.disconnect()},this.stop=this.destroy,this.unsubscribeAll=Fe.unsubscribeAll.bind(Fe),this.getSubscribedChannels=Fe.getSubscribedChannels.bind(Fe),this.getSubscribedChannelGroups=Fe.getSubscribedChannelGroups.bind(Fe),this.encrypt=Ee.encrypt.bind(Ee),this.decrypt=Ee.decrypt.bind(Ee),this.getAuthKey=Le.config.getAuthKey.bind(Le.config),this.setAuthKey=Le.config.setAuthKey.bind(Le.config),this.setCipherKey=Le.config.setCipherKey.bind(Le.config),this.getUUID=Le.config.getUUID.bind(Le.config),this.setUUID=Le.config.setUUID.bind(Le.config),this.getFilterExpression=Le.config.getFilterExpression.bind(Le.config),this.setFilterExpression=Le.config.setFilterExpression.bind(Le.config),this.setHeartbeatInterval=Le.config.setHeartbeatInterval.bind(Le.config),r.hasModule("proxy")&&(this.setProxy=function(e){Le.config.setProxy(e),n.reconnect()})}return(0,s.default)(e,[{key:"getVersion",value:function(){return this._config.getVersion()}},{key:"_addPnsdkSuffix",value:function(e,t){this._config._addPnsdkSuffix(e,t)}},{key:"networkDownDetected",value:function(){this._listenerManager.announceNetworkDown(),this._config.restore?this.disconnect():this.destroy(!0)}},{key:"networkUpDetected",value:function(){this._listenerManager.announceNetworkUp(),this.reconnect()}}],[{key:"notificationPayload",value:function(e,t){return new h.default(e,t)}},{key:"generateUUID",value:function(){return Re.default.createUUID()}}]),e}();t.default=Le,(0,a.default)(Le,"OPERATIONS",Ee.default),(0,a.default)(Le,"CATEGORIES",Ae.default),e.exports=t.default},function(e,t,n){var i=n(7);function r(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return r=function(){return e},e}e.exports=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var t=r();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,t&&t.set(e,n),n}},function(e,t,n){var i,r,o;/*! lil-uuid - v0.1 - MIT License - https://github.com/lil-js/uuid */r=[t],void 0===(o="function"==typeof(i=function(e){var t={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};function n(){var e,t,n="";for(e=0;e<32;e++)t=16*Math.random()|0,8!==e&&12!==e&&16!==e&&20!==e||(n+="-"),n+=(12===e?4:16===e?3&t|8:t).toString(16);return n}function i(e,n){var i=t[n||"all"];return i&&i.test(e)||!1}n.isUUID=i,n.VERSION="0.1.0",e.uuid=n,e.isUUID=i})?i.apply(t,r):i)||(e.exports=o)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){t.byteLength=function(e){var t=l(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,i=l(e),s=i[0],a=i[1],c=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),u=0,d=a>0?s-4:s;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[u++]=255&t),1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],s=0,a=n-r;s<a;s+=16383)o.push(u(e,s,s+16383>a?a:s+16383));return 1===r?(t=e[n-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"=")),o.join("")};for(var i=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)i[a]=s[a],r[s.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var r,o,s=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(i[(o=r)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,i,r){var o,s,a=8*r-i-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?r-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=i;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=l}return(p?-1:1)*s*Math.pow(2,o-i)},t.write=function(e,t,n,i,r,o){var s,a,c,l=8*o-r-1,u=(1<<l)-1,d=u>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*c-1)*Math.pow(2,r),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),s=0));r>=8;e[n+p]=255&a,p+=f,a/=256,r-=8);for(s=s<<r|a,l+=r;l>0;e[n+p]=255&s,p+=f,s/=256,l-=8);e[n+p-f]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=(i(n(20)),i(n(8)),i(n(23)),i(n(40))),l=i(n(41)),u=i(n(3)),d=(n(2),i(n(10))),h=function(){function e(t){var n=t.subscribeEndpoint,i=t.leaveEndpoint,r=t.heartbeatEndpoint,s=t.setStateEndpoint,u=t.timeEndpoint,d=t.getFileUrl,h=t.config,p=t.crypto,f=t.listenerManager;(0,o.default)(this,e),(0,a.default)(this,"_crypto",void 0),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_listenerManager",void 0),(0,a.default)(this,"_reconnectionManager",void 0),(0,a.default)(this,"_leaveEndpoint",void 0),(0,a.default)(this,"_heartbeatEndpoint",void 0),(0,a.default)(this,"_setStateEndpoint",void 0),(0,a.default)(this,"_subscribeEndpoint",void 0),(0,a.default)(this,"_getFileUrl",void 0),(0,a.default)(this,"_channels",void 0),(0,a.default)(this,"_presenceChannels",void 0),(0,a.default)(this,"_heartbeatChannels",void 0),(0,a.default)(this,"_heartbeatChannelGroups",void 0),(0,a.default)(this,"_channelGroups",void 0),(0,a.default)(this,"_presenceChannelGroups",void 0),(0,a.default)(this,"_currentTimetoken",void 0),(0,a.default)(this,"_lastTimetoken",void 0),(0,a.default)(this,"_storedTimetoken",void 0),(0,a.default)(this,"_region",void 0),(0,a.default)(this,"_subscribeCall",void 0),(0,a.default)(this,"_heartbeatTimer",void 0),(0,a.default)(this,"_subscriptionStatusAnnounced",void 0),(0,a.default)(this,"_autoNetworkDetection",void 0),(0,a.default)(this,"_isOnline",void 0),(0,a.default)(this,"_pendingChannelSubscriptions",void 0),(0,a.default)(this,"_pendingChannelGroupSubscriptions",void 0),(0,a.default)(this,"_dedupingManager",void 0),this._listenerManager=f,this._config=h,this._leaveEndpoint=i,this._heartbeatEndpoint=r,this._setStateEndpoint=s,this._subscribeEndpoint=n,this._getFileUrl=d,this._crypto=p,this._channels={},this._presenceChannels={},this._heartbeatChannels={},this._heartbeatChannelGroups={},this._channelGroups={},this._presenceChannelGroups={},this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[],this._currentTimetoken=0,this._lastTimetoken=0,this._storedTimetoken=null,this._subscriptionStatusAnnounced=!1,this._isOnline=!0,this._reconnectionManager=new c.default({timeEndpoint:u}),this._dedupingManager=new l.default({config:h})}return(0,s.default)(e,[{key:"adaptStateChange",value:function(e,t){var n=this,i=e.state,r=e.channels,o=void 0===r?[]:r,s=e.channelGroups,a=void 0===s?[]:s;return o.forEach((function(e){e in n._channels&&(n._channels[e].state=i)})),a.forEach((function(e){e in n._channelGroups&&(n._channelGroups[e].state=i)})),this._setStateEndpoint({state:i,channels:o,channelGroups:a},t)}},{key:"adaptPresenceChange",value:function(e){var t=this,n=e.connected,i=e.channels,r=void 0===i?[]:i,o=e.channelGroups,s=void 0===o?[]:o;n?(r.forEach((function(e){t._heartbeatChannels[e]={state:{}}})),s.forEach((function(e){t._heartbeatChannelGroups[e]={state:{}}}))):(r.forEach((function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]})),s.forEach((function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]})),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:r,channelGroups:s},(function(e){t._listenerManager.announceStatus(e)}))),this.reconnect()}},{key:"adaptSubscribeChange",value:function(e){var t=this,n=e.timetoken,i=e.channels,r=void 0===i?[]:i,o=e.channelGroups,s=void 0===o?[]:o,a=e.withPresence,c=void 0!==a&&a,l=e.withHeartbeats,u=void 0!==l&&l;this._config.subscribeKey&&""!==this._config.subscribeKey?(n&&(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=n),"0"!==this._currentTimetoken&&0!==this._currentTimetoken&&(this._storedTimetoken=this._currentTimetoken,this._currentTimetoken=0),r.forEach((function(e){t._channels[e]={state:{}},c&&(t._presenceChannels[e]={}),(u||t._config.getHeartbeatInterval())&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)})),s.forEach((function(e){t._channelGroups[e]={state:{}},c&&(t._presenceChannelGroups[e]={}),(u||t._config.getHeartbeatInterval())&&(t._heartbeatChannelGroups[e]={}),t._pendingChannelGroupSubscriptions.push(e)})),this._subscriptionStatusAnnounced=!1,this.reconnect()):console&&console.log&&console.log("subscribe key missing; aborting subscribe")}},{key:"adaptUnsubscribeChange",value:function(e,t){var n=this,i=e.channels,r=void 0===i?[]:i,o=e.channelGroups,s=void 0===o?[]:o,a=[],c=[];r.forEach((function(e){e in n._channels&&(delete n._channels[e],a.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],a.push(e))})),s.forEach((function(e){e in n._channelGroups&&(delete n._channelGroups[e],c.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._channelGroups[e],c.push(e))})),0===a.length&&0===c.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:a,channelGroups:c},(function(e){e.affectedChannels=a,e.affectedChannelGroups=c,e.currentTimetoken=n._currentTimetoken,e.lastTimetoken=n._lastTimetoken,n._listenerManager.announceStatus(e)})),0===Object.keys(this._channels).length&&0===Object.keys(this._presenceChannels).length&&0===Object.keys(this._channelGroups).length&&0===Object.keys(this._presenceChannelGroups).length&&(this._lastTimetoken=0,this._currentTimetoken=0,this._storedTimetoken=null,this._region=null,this._reconnectionManager.stopPolling()),this.reconnect())}},{key:"unsubscribeAll",value:function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)}},{key:"getHeartbeatChannels",value:function(){return Object.keys(this._heartbeatChannels)}},{key:"getHeartbeatChannelGroups",value:function(){return Object.keys(this._heartbeatChannelGroups)}},{key:"getSubscribedChannels",value:function(){return Object.keys(this._channels)}},{key:"getSubscribedChannelGroups",value:function(){return Object.keys(this._channelGroups)}},{key:"reconnect",value:function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()}},{key:"disconnect",value:function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()}},{key:"_registerHeartbeatTimer",value:function(){this._stopHeartbeatTimer(),0!==this._config.getHeartbeatInterval()&&void 0!==this._config.getHeartbeatInterval()&&(this._performHeartbeatLoop(),this._heartbeatTimer=setInterval(this._performHeartbeatLoop.bind(this),1e3*this._config.getHeartbeatInterval()))}},{key:"_stopHeartbeatTimer",value:function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)}},{key:"_performHeartbeatLoop",value:function(){var e=this,t=this.getHeartbeatChannels(),n=this.getHeartbeatChannelGroups(),i={};0===t.length&&0===n.length||(this.getSubscribedChannels().forEach((function(t){var n=e._channels[t].state;Object.keys(n).length&&(i[t]=n)})),this.getSubscribedChannelGroups().forEach((function(t){var n=e._channelGroups[t].state;Object.keys(n).length&&(i[t]=n)})),this._heartbeatEndpoint({channels:t,channelGroups:n,state:i},function(t){t.error&&e._config.announceFailedHeartbeats&&e._listenerManager.announceStatus(t),t.error&&e._config.autoNetworkDetection&&e._isOnline&&(e._isOnline=!1,e.disconnect(),e._listenerManager.announceNetworkDown(),e.reconnect()),!t.error&&e._config.announceSuccessfulHeartbeats&&e._listenerManager.announceStatus(t)}.bind(this)))}},{key:"_startSubscribeLoop",value:function(){var e=this;this._stopSubscribeLoop();var t={},n=[],i=[];if(Object.keys(this._channels).forEach((function(i){var r=e._channels[i].state;Object.keys(r).length&&(t[i]=r),n.push(i)})),Object.keys(this._presenceChannels).forEach((function(e){n.push("".concat(e,"-pnpres"))})),Object.keys(this._channelGroups).forEach((function(n){var r=e._channelGroups[n].state;Object.keys(r).length&&(t[n]=r),i.push(n)})),Object.keys(this._presenceChannelGroups).forEach((function(e){i.push("".concat(e,"-pnpres"))})),0!==n.length||0!==i.length){var r={channels:n,channelGroups:i,state:t,timetoken:this._currentTimetoken,filterExpression:this._config.filterExpression,region:this._region};this._subscribeCall=this._subscribeEndpoint(r,this._processSubscribeResponse.bind(this))}}},{key:"_processSubscribeResponse",value:function(e,t){var n=this;if(e.error)e.category===d.default.PNTimeoutCategory?this._startSubscribeLoop():e.category===d.default.PNNetworkIssuesCategory?(this.disconnect(),e.error&&this._config.autoNetworkDetection&&this._isOnline&&(this._isOnline=!1,this._listenerManager.announceNetworkDown()),this._reconnectionManager.onReconnection((function(){n._config.autoNetworkDetection&&!n._isOnline&&(n._isOnline=!0,n._listenerManager.announceNetworkUp()),n.reconnect(),n._subscriptionStatusAnnounced=!0;var t={category:d.default.PNReconnectedCategory,operation:e.operation,lastTimetoken:n._lastTimetoken,currentTimetoken:n._currentTimetoken};n._listenerManager.announceStatus(t)})),this._reconnectionManager.startPolling(),this._listenerManager.announceStatus(e)):e.category===d.default.PNBadRequestCategory?(this._stopHeartbeatTimer(),this._listenerManager.announceStatus(e)):this._listenerManager.announceStatus(e);else{if(this._storedTimetoken?(this._currentTimetoken=this._storedTimetoken,this._storedTimetoken=null):(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=t.metadata.timetoken),!this._subscriptionStatusAnnounced){var i={};i.category=d.default.PNConnectedCategory,i.operation=e.operation,i.affectedChannels=this._pendingChannelSubscriptions,i.subscribedChannels=this.getSubscribedChannels(),i.affectedChannelGroups=this._pendingChannelGroupSubscriptions,i.lastTimetoken=this._lastTimetoken,i.currentTimetoken=this._currentTimetoken,this._subscriptionStatusAnnounced=!0,this._listenerManager.announceStatus(i),this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[]}var o=t.messages||[],s=this._config,a=s.requestMessageCountThreshold,c=s.dedupeOnSubscribe;if(a&&o.length>=a){var l={};l.category=d.default.PNRequestMessageCountExceededCategory,l.operation=e.operation,this._listenerManager.announceStatus(l)}o.forEach((function(e){var t=e.channel,i=e.subscriptionMatch,o=e.publishMetaData;if(t===i&&(i=null),c){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(u.default.endsWith(e.channel,"-pnpres")){var s={channel:null,subscription:null};s.actualChannel=null!=i?t:null,s.subscribedChannel=null!=i?i:t,t&&(s.channel=t.substring(0,t.lastIndexOf("-pnpres"))),i&&(s.subscription=i.substring(0,i.lastIndexOf("-pnpres"))),s.action=e.payload.action,s.state=e.payload.data,s.timetoken=o.publishTimetoken,s.occupancy=e.payload.occupancy,s.uuid=e.payload.uuid,s.timestamp=e.payload.timestamp,e.payload.join&&(s.join=e.payload.join),e.payload.leave&&(s.leave=e.payload.leave),e.payload.timeout&&(s.timeout=e.payload.timeout),n._listenerManager.announcePresence(s)}else if(1===e.messageType){var a={channel:null,subscription:null};a.channel=t,a.subscription=i,a.timetoken=o.publishTimetoken,a.publisher=e.issuingClientId,e.userMetadata&&(a.userMetadata=e.userMetadata),a.message=e.payload,n._listenerManager.announceSignal(a)}else if(2===e.messageType){var l={channel:null,subscription:null};l.channel=t,l.subscription=i,l.timetoken=o.publishTimetoken,l.publisher=e.issuingClientId,e.userMetadata&&(l.userMetadata=e.userMetadata),l.message={event:e.payload.event,type:e.payload.type,data:e.payload.data},n._listenerManager.announceObjects(l),"user"===e.payload.type?n._listenerManager.announceUser(l):"space"===e.payload.type?n._listenerManager.announceSpace(l):"membership"===e.payload.type&&n._listenerManager.announceMembership(l)}else if(3===e.messageType){var d={};d.channel=t,d.subscription=i,d.timetoken=o.publishTimetoken,d.publisher=e.issuingClientId,d.data={messageTimetoken:e.payload.data.messageTimetoken,actionTimetoken:e.payload.data.actionTimetoken,type:e.payload.data.type,uuid:e.issuingClientId,value:e.payload.data.value},d.event=e.payload.event,n._listenerManager.announceMessageAction(d)}else if(4===e.messageType){var h={};h.channel=t,h.subscription=i,h.timetoken=o.publishTimetoken,h.publisher=e.issuingClientId;var p=e.payload;if(n._config.cipherKey){var f=n._crypto.decrypt(e.payload);"object"===(0,r.default)(f)&&null!==f&&(p=f)}e.userMetadata&&(h.userMetadata=e.userMetadata),h.message=p.message,h.file={id:p.file.id,name:p.file.name,url:n._getFileUrl({id:p.file.id,name:p.file.name,channel:t})},n._listenerManager.announceFile(h)}else{var g={channel:null,subscription:null};g.actualChannel=null!=i?t:null,g.subscribedChannel=null!=i?i:t,g.channel=t,g.subscription=i,g.timetoken=o.publishTimetoken,g.publisher=e.issuingClientId,e.userMetadata&&(g.userMetadata=e.userMetadata),n._config.cipherKey?g.message=n._crypto.decrypt(e.payload):g.message=e.payload,n._listenerManager.announceMessage(g)}})),this._region=t.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=h,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=(i(n(24)),n(2),function(){function e(t){var n=t.timeEndpoint;(0,r.default)(this,e),(0,s.default)(this,"_reconnectionCallback",void 0),(0,s.default)(this,"_timeEndpoint",void 0),(0,s.default)(this,"_timeTimer",void 0),this._timeEndpoint=n}return(0,o.default)(e,[{key:"onReconnection",value:function(e){this._reconnectionCallback=e}},{key:"startPolling",value:function(){this._timeTimer=setInterval(this._performTimeLoop.bind(this),3e3)}},{key:"stopPolling",value:function(){clearInterval(this._timeTimer)}},{key:"_performTimeLoop",value:function(){var e=this;this._timeEndpoint((function(t){t.error||(clearInterval(e._timeTimer),e._reconnectionCallback())}))}}]),e}());t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=(i(n(8)),n(2),function(){function e(t){var n=t.config;(0,r.default)(this,e),(0,s.default)(this,"_config",void 0),(0,s.default)(this,"hashHistory",void 0),this.hashHistory=[],this._config=n}return(0,o.default)(e,[{key:"getKey",value:function(e){var t=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}(JSON.stringify(e.payload)).toString(),n=e.publishMetaData.publishTimetoken;return"".concat(n,"-").concat(t)}},{key:"isDuplicate",value:function(e){return this.hashHistory.includes(this.getKey(e))}},{key:"addEntry",value:function(e){this.hashHistory.length>=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}());t.default=a,e.exports=t.default},function(e,t){var n,i,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c,l=[],u=!1,d=-1;function h(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&p())}function p(){if(!u){var e=a(h);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||u||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=i(n(1)),c=function(){function e(t){(0,r.default)(this,e),(0,s.default)(this,"_maximumSamplesCount",100),(0,s.default)(this,"_trackedLatencies",{}),(0,s.default)(this,"_latencies",{}),this._maximumSamplesCount=t.maximumSamplesCount||this._maximumSamplesCount}return(0,o.default)(e,[{key:"operationsLatencyForRequest",value:function(){var e=this,t={};return Object.keys(this._latencies).forEach((function(n){var i=e._latencies[n],r=e._averageLatency(i);r>0&&(t["l_".concat(n)]=r)})),t}},{key:"startLatencyMeasure",value:function(e,t){e!==a.default.PNSubscribeOperation&&t&&(this._trackedLatencies[t]=Date.now())}},{key:"stopLatencyMeasure",value:function(e,t){if(e!==a.default.PNSubscribeOperation&&t){var n=this._endpointName(e),i=this._latencies[n],r=this._trackedLatencies[t];i||(i=this._latencies[n]=[]),i.push(Date.now()-r),i.length>this._maximumSamplesCount&&i.splice(0,i.length-this._maximumSamplesCount),delete this._trackedLatencies[t]}}},{key:"_averageLatency",value:function(e){return Math.floor(e.reduce((function(e,t){return e+t}),0)/e.length)}},{key:"_endpointName",value:function(e){var t=null;switch(e){case a.default.PNPublishOperation:t="pub";break;case a.default.PNSignalOperation:t="sig";break;case a.default.PNHistoryOperation:case a.default.PNFetchMessagesOperation:case a.default.PNDeleteMessagesOperation:case a.default.PNMessageCounts:t="hist";break;case a.default.PNUnsubscribeOperation:case a.default.PNWhereNowOperation:case a.default.PNHereNowOperation:case a.default.PNHeartbeatOperation:case a.default.PNSetStateOperation:case a.default.PNGetStateOperation:t="pres";break;case a.default.PNAddChannelsToGroupOperation:case a.default.PNRemoveChannelsFromGroupOperation:case a.default.PNChannelGroupsOperation:case a.default.PNRemoveGroupOperation:case a.default.PNChannelsForGroupOperation:t="cg";break;case a.default.PNPushNotificationEnabledChannelsOperation:case a.default.PNRemoveAllPushNotificationsOperation:t="push";break;case a.default.PNCreateUserOperation:case a.default.PNUpdateUserOperation:case a.default.PNDeleteUserOperation:case a.default.PNGetUserOperation:case a.default.PNGetUsersOperation:case a.default.PNCreateSpaceOperation:case a.default.PNUpdateSpaceOperation:case a.default.PNDeleteSpaceOperation:case a.default.PNGetSpaceOperation:case a.default.PNGetSpacesOperation:case a.default.PNGetMembersOperation:case a.default.PNUpdateMembersOperation:case a.default.PNGetMembershipsOperation:case a.default.PNUpdateMembershipsOperation:t="obj";break;case a.default.PNAddMessageActionOperation:case a.default.PNRemoveMessageActionOperation:case a.default.PNGetMessageActionsOperation:t="msga";break;case a.default.PNAccessManagerGrant:case a.default.PNAccessManagerAudit:t="pam";break;case a.default.PNAccessManagerGrantToken:t="pam3";break;default:t="time"}return t}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.FCMNotificationPayload=t.MPNSNotificationPayload=t.APNSNotificationPayload=void 0;var r=i(n(45)),o=i(n(19)),s=i(n(14)),a=i(n(16)),c=i(n(13)),l=i(n(5)),u=i(n(6)),d=i(n(4));function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){(0,d.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return(0,a.default)(this,n)}}n(2);var g=function(){function e(t,n,i){(0,l.default)(this,e),(0,d.default)(this,"_subtitle",void 0),(0,d.default)(this,"_payload",void 0),(0,d.default)(this,"_badge",void 0),(0,d.default)(this,"_sound",void 0),(0,d.default)(this,"_title",void 0),(0,d.default)(this,"_body",void 0),this._payload=t,this._setDefaultPayloadStructure(),this.title=n,this.body=i}return(0,u.default)(e,[{key:"payload",get:function(){return this._payload}},{key:"title",set:function(e){this._title=e}},{key:"subtitle",set:function(e){this._subtitle=e}},{key:"body",set:function(e){this._body=e}},{key:"badge",set:function(e){this._badge=e}},{key:"sound",set:function(e){this._sound=e}}]),(0,u.default)(e,[{key:"_setDefaultPayloadStructure",value:function(){}},{key:"toObject",value:function(){return{}}}]),e}(),m=function(e){(0,s.default)(n,e);var t=f(n);function n(){var e;(0,l.default)(this,n);for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return e=t.call.apply(t,[this].concat(r)),(0,d.default)((0,o.default)(e),"_configurations",void 0),(0,d.default)((0,o.default)(e),"_apnsPushType",void 0),(0,d.default)((0,o.default)(e),"_isSilent",void 0),e}return(0,u.default)(n,[{key:"_setDefaultPayloadStructure",value:function(){this._payload.aps={alert:{}}}},{key:"toObject",value:function(){var e=this,t=p({},this._payload),n=t.aps,i=n.alert;if(this._isSilent&&(n["content-available"]=1),"apns2"===this._apnsPushType){if(!this._configurations||!this._configurations.length)throw new ReferenceError("APNS2 configuration is missing");var r=[];this._configurations.forEach((function(t){r.push(e._objectFromAPNS2Configuration(t))})),r.length&&(t.pn_push=r)}return i&&Object.keys(i).length||delete n.alert,this._isSilent&&(delete n.alert,delete n.badge,delete n.sound,i={}),this._isSilent||Object.keys(i).length?t:null}},{key:"_objectFromAPNS2Configuration",value:function(e){var t=this;if(!e.targets||!e.targets.length)throw new ReferenceError("At least one APNS2 target should be provided");var n=[];e.targets.forEach((function(e){n.push(t._objectFromAPNSTarget(e))}));var i=e.collapseId,r=e.expirationDate,o={auth_method:"token",targets:n,version:"v2"};return i&&i.length&&(o.collapse_id=i),r&&(o.expiration=r.toISOString()),o}},{key:"_objectFromAPNSTarget",value:function(e){if(!e.topic||!e.topic.length)throw new TypeError("Target 'topic' undefined.");var t=e.topic,n=e.environment,i=void 0===n?"development":n,r=e.excludedDevices,o=void 0===r?[]:r,s={topic:t,environment:i};return o.length&&(s.excluded_devices=o),s}},{key:"configurations",set:function(e){e&&e.length&&(this._configurations=e)}},{key:"notification",get:function(){return this._payload.aps}},{key:"title",get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.aps.alert.title=e,this._title=e)}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){e&&e.length&&(this._payload.aps.alert.subtitle=e,this._subtitle=e)}},{key:"body",get:function(){return this._body},set:function(e){e&&e.length&&(this._payload.aps.alert.body=e,this._body=e)}},{key:"badge",get:function(){return this._badge},set:function(e){null!=e&&(this._payload.aps.badge=e,this._badge=e)}},{key:"sound",get:function(){return this._sound},set:function(e){e&&e.length&&(this._payload.aps.sound=e,this._sound=e)}},{key:"silent",set:function(e){this._isSilent=e}}]),n}(g);t.APNSNotificationPayload=m;var v=function(e){(0,s.default)(n,e);var t=f(n);function n(){var e;(0,l.default)(this,n);for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return e=t.call.apply(t,[this].concat(r)),(0,d.default)((0,o.default)(e),"_backContent",void 0),(0,d.default)((0,o.default)(e),"_backTitle",void 0),(0,d.default)((0,o.default)(e),"_count",void 0),(0,d.default)((0,o.default)(e),"_type",void 0),e}return(0,u.default)(n,[{key:"toObject",value:function(){return Object.keys(this._payload).length?p({},this._payload):null}},{key:"backContent",get:function(){return this._backContent},set:function(e){e&&e.length&&(this._payload.back_content=e,this._backContent=e)}},{key:"backTitle",get:function(){return this._backTitle},set:function(e){e&&e.length&&(this._payload.back_title=e,this._backTitle=e)}},{key:"count",get:function(){return this._count},set:function(e){null!=e&&(this._payload.count=e,this._count=e)}},{key:"title",get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.title=e,this._title=e)}},{key:"type",get:function(){return this._type},set:function(e){e&&e.length&&(this._payload.type=e,this._type=e)}},{key:"subtitle",get:function(){return this.backTitle},set:function(e){this.backTitle=e}},{key:"body",get:function(){return this.backContent},set:function(e){this.backContent=e}},{key:"badge",get:function(){return this.count},set:function(e){this.count=e}}]),n}(g);t.MPNSNotificationPayload=v;var y=function(e){(0,s.default)(n,e);var t=f(n);function n(){var e;(0,l.default)(this,n);for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return e=t.call.apply(t,[this].concat(r)),(0,d.default)((0,o.default)(e),"_isSilent",void 0),(0,d.default)((0,o.default)(e),"_icon",void 0),(0,d.default)((0,o.default)(e),"_tag",void 0),e}return(0,u.default)(n,[{key:"_setDefaultPayloadStructure",value:function(){this._payload.notification={},this._payload.data={}}},{key:"toObject",value:function(){var e=p({},this._payload.data),t=null,n={};if(Object.keys(this._payload).length>2){var i=this._payload,o=(i.notification,i.data,(0,r.default)(i,["notification","data"]));e=p(p({},e),o)}return this._isSilent?e.notification=this._payload.notification:t=this._payload.notification,Object.keys(e).length&&(n.data=e),t&&Object.keys(t).length&&(n.notification=t),Object.keys(n).length?n:null}},{key:"notification",get:function(){return this._payload.notification}},{key:"data",get:function(){return this._payload.data}},{key:"title",get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.notification.title=e,this._title=e)}},{key:"body",get:function(){return this._body},set:function(e){e&&e.length&&(this._payload.notification.body=e,this._body=e)}},{key:"sound",get:function(){return this._sound},set:function(e){e&&e.length&&(this._payload.notification.sound=e,this._sound=e)}},{key:"icon",get:function(){return this._icon},set:function(e){e&&e.length&&(this._payload.notification.icon=e,this._icon=e)}},{key:"tag",get:function(){return this._tag},set:function(e){e&&e.length&&(this._payload.notification.tag=e,this._tag=e)}},{key:"silent",set:function(e){this._isSilent=e}}]),n}(g);t.FCMNotificationPayload=y;var b=function(){function e(t,n){(0,l.default)(this,e),(0,d.default)(this,"_payload",void 0),(0,d.default)(this,"_debugging",void 0),(0,d.default)(this,"_subtitle",void 0),(0,d.default)(this,"_badge",void 0),(0,d.default)(this,"_sound",void 0),(0,d.default)(this,"_title",void 0),(0,d.default)(this,"_body",void 0),(0,d.default)(this,"apns",void 0),(0,d.default)(this,"mpns",void 0),(0,d.default)(this,"fcm",void 0),this._payload={apns:{},mpns:{},fcm:{}},this._title=t,this._body=n,this.apns=new m(this._payload.apns,t,n),this.mpns=new v(this._payload.mpns,t,n),this.fcm=new y(this._payload.fcm,t,n)}return(0,u.default)(e,[{key:"debugging",set:function(e){this._debugging=e}},{key:"title",get:function(){return this._title}},{key:"body",get:function(){return this._body}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){this._subtitle=e,this.apns.subtitle=e,this.mpns.subtitle=e,this.fcm.subtitle=e}},{key:"badge",get:function(){return this._badge},set:function(e){this._badge=e,this.apns.badge=e,this.mpns.badge=e,this.fcm.badge=e}},{key:"sound",get:function(){return this._sound},set:function(e){this._sound=e,this.apns.sound=e,this.mpns.sound=e,this.fcm.sound=e}}]),(0,u.default)(e,[{key:"buildPayload",value:function(e){var t={};if(e.includes("apns")||e.includes("apns2")){this.apns._apnsPushType=e.includes("apns")?"apns":"apns2";var n=this.apns.toObject();n&&Object.keys(n).length&&(t.pn_apns=n)}if(e.includes("mpns")){var i=this.mpns.toObject();i&&Object.keys(i).length&&(t.pn_mpns=i)}if(e.includes("fcm")){var r=this.fcm.toObject();r&&Object.keys(r).length&&(t.pn_gcm=r)}return Object.keys(t).length&&this._debugging&&(t.pn_debug=!0),t}}]),e}();t.default=b},function(e,t,n){var i=n(46);e.exports=function(e,t){if(null==e)return{};var n,r,o=i(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=(i(n(8)),n(2),function(){function e(t,n){(0,o.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_cbor",void 0),(0,a.default)(this,"_userTokens",void 0),(0,a.default)(this,"_spaceTokens",void 0),(0,a.default)(this,"_userToken",void 0),(0,a.default)(this,"_spaceToken",void 0),this._config=t,this._cbor=n,this._initializeTokens()}return(0,s.default)(e,[{key:"_initializeTokens",value:function(){this._userTokens={},this._spaceTokens={},this._userToken=void 0,this._spaceToken=void 0}},{key:"_setToken",value:function(e){var t=this,n=this.parseToken(e);n&&n.resources&&(n.resources.users&&Object.keys(n.resources.users).forEach((function(n){t._userTokens[n]=e})),n.resources.spaces&&Object.keys(n.resources.spaces).forEach((function(n){t._spaceTokens[n]=e}))),n&&n.patterns&&(n.patterns.users&&Object.keys(n.patterns.users).length>0&&(this._userToken=e),n.patterns.spaces&&Object.keys(n.patterns.spaces).length>0&&(this._spaceToken=e))}},{key:"setToken",value:function(e){e&&e.length>0&&this._setToken(e)}},{key:"setTokens",value:function(e){var t=this;e&&e.length&&"object"===(0,r.default)(e)&&e.forEach((function(e){t.setToken(e)}))}},{key:"getTokens",value:function(e){var t=this,n={users:{},spaces:{}};return e?(e.user&&(n.user=this._userToken),e.space&&(n.space=this._spaceToken),e.users&&e.users.forEach((function(e){n.users[e]=t._userTokens[e]})),e.space&&e.spaces.forEach((function(e){n.spaces[e]=t._spaceTokens[e]}))):(this._userToken&&(n.user=this._userToken),this._spaceToken&&(n.space=this._spaceToken),Object.keys(this._userTokens).forEach((function(e){n.users[e]=t._userTokens[e]})),Object.keys(this._spaceTokens).forEach((function(e){n.spaces[e]=t._spaceTokens[e]}))),n}},{key:"getToken",value:function(e,t){var n;return t?"user"===e?n=this._userTokens[t]:"space"===e&&(n=this._spaceTokens[t]):"user"===e?n=this._userToken:"space"===e&&(n=this._spaceToken),n}},{key:"extractPermissions",value:function(e){var t={create:!1,read:!1,write:!1,manage:!1,delete:!1};return 16==(16&e)&&(t.create=!0),8==(8&e)&&(t.delete=!0),4==(4&e)&&(t.manage=!0),2==(2&e)&&(t.write=!0),1==(1&e)&&(t.read=!0),t}},{key:"parseToken",value:function(e){var t=this,n=this._cbor.decodeToken(e);if(void 0!==n){var i=Object.keys(n.res.usr),r=Object.keys(n.res.spc),o=Object.keys(n.pat.usr),s=Object.keys(n.pat.spc),a={version:n.v,timestamp:n.t,ttl:n.ttl},c=i.length>0,l=r.length>0;(c||l)&&(a.resources={},c&&(a.resources.users={},i.forEach((function(e){a.resources.users[e]=t.extractPermissions(n.res.usr[e])}))),l&&(a.resources.spaces={},r.forEach((function(e){a.resources.spaces[e]=t.extractPermissions(n.res.spc[e])}))));var u=o.length>0,d=s.length>0;return(u||d)&&(a.patterns={},u&&(a.patterns.users={},o.forEach((function(e){a.patterns.users[e]=t.extractPermissions(n.pat.usr[e])}))),d&&(a.patterns.spaces={},s.forEach((function(e){a.patterns.spaces[e]=t.extractPermissions(n.pat.spc[e])})))),Object.keys(n.meta).length>0&&(a.meta=n.meta),a.signature=n.sig,a}}},{key:"clearTokens",value:function(){this._initializeTokens()}}]),e}());t.default=c,e.exports=t.default},function(e,t,n){var i=n(13),r=n(15),o=n(49),s=n(50);function a(t){var n="function"==typeof Map?new Map:void 0;return e.exports=a=function(e){if(null===e||!o(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return s(e,arguments,i(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r(t,e)},a(t)}e.exports=a},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}},function(e,t,n){var i=n(15),r=n(51);function o(t,n,s){return r()?e.exports=o=Reflect.construct:e.exports=o=function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o},o.apply(null,arguments)}e.exports=o},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAddChannelsToGroupOperation},t.validateParams=function(e,t){var n=t.channels,i=t.channelGroup,r=e.config;return i?n&&0!==n.length?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveChannelsFromGroupOperation},t.validateParams=function(e,t){var n=t.channels,i=t.channelGroup,r=e.config;return i?n&&0!==n.length?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveGroupOperation},t.validateParams=function(e,t){var n=t.channelGroup,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n),"/remove")},t.isAuthSupported=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(){return{}},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNChannelGroupsOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e){var t=e.config;return"/v1/channel-registration/sub-key/".concat(t.subscribeKey,"/channel-group")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{groups:t.payload.groups}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNChannelsForGroupOperation},t.validateParams=function(e,t){var n=t.channelGroup,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{channels:t.payload.channels}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.channels,o=t.topic,s=e.config;return n?i?"apns2"!==i||o?r&&0!==r.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.channels,r=void 0===i?[]:i,o=t.environment,s=void 0===o?"development":o,a=t.topic,c={type:n,add:r.join(",")};return"apns2"===n&&delete(c=Object.assign({},c,{environment:s,topic:a})).type,c},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.channels,o=t.topic,s=e.config;return n?i?"apns2"!==i||o?r&&0!==r.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.channels,r=void 0===i?[]:i,o=t.environment,s=void 0===o?"development":o,a=t.topic,c={type:n,remove:r.join(",")};return"apns2"===n&&delete(c=Object.assign({},c,{environment:s,topic:a})).type,c},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.topic,o=e.config;return n?i?"apns2"!==i||r?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.environment,r=void 0===i?"development":i,o=t.topic,s={type:n};return"apns2"===n&&delete(s=Object.assign({},s,{environment:r,topic:o})).type,s},t.handleResponse=function(e,t){return{channels:t}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveAllPushNotificationsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.topic,o=e.config;return n?i?"apns2"!==i||r?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n,"/remove"):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n,"/remove")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.environment,r=void 0===i?"development":i,o=t.topic,s={type:n};return"apns2"===n&&delete(s=Object.assign({},s,{environment:r,topic:o})).type,s},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUnsubscribeOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/leave")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r={};return i.length>0&&(r["channel-group"]=i.join(",")),r},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNWhereNowOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.uuid,r=void 0===i?n.UUID:i;return"/v2/presence/sub-key/".concat(n.subscribeKey,"/uuid/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return t.payload?{channels:t.payload.channels}:{channels:[]}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNHeartbeatOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/heartbeat")},t.isAuthSupported=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r=t.state,o=void 0===r?{}:r,s=e.config,a={};return i.length>0&&(a["channel-group"]=i.join(",")),a.state=JSON.stringify(o),a.heartbeat=s.getPresenceTimeout(),a},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetStateOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.uuid,r=void 0===i?n.UUID:i,s=t.channels,a=void 0===s?[]:s,c=a.length>0?a.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(c),"/uuid/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r={};return i.length>0&&(r["channel-group"]=i.join(",")),r},t.handleResponse=function(e,t,n){var i=n.channels,r=void 0===i?[]:i,o=n.channelGroups,s=void 0===o?[]:o,a={};return 1===r.length&&0===s.length?a[r[0]]=t.payload:a=t.payload,{channels:a}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNSetStateOperation},t.validateParams=function(e,t){var n=e.config,i=t.state,r=t.channels,o=void 0===r?[]:r,s=t.channelGroups,a=void 0===s?[]:s;return i?n.subscribeKey?0===o.length&&0===a.length?"Please provide a list of channels and/or channel-groups":void 0:"Missing Subscribe Key":"Missing State"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/uuid/").concat(n.UUID,"/data")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.state,i=t.channelGroups,r=void 0===i?[]:i,o={};return o.state=JSON.stringify(n),r.length>0&&(o["channel-group"]=r.join(",")),o},t.handleResponse=function(e,t){return{state:t.payload}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNHereNowOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,o=t.channelGroups,a=void 0===o?[]:o,c="/v2/presence/sub-key/".concat(n.subscribeKey);if(r.length>0||a.length>0){var l=r.length>0?r.join(","):",";c+="/channel/".concat(s.default.encodeString(l))}return c},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r=t.includeUUIDs,o=void 0===r||r,s=t.includeState,a=void 0!==s&&s,l=t.queryParameters,u=void 0===l?{}:l,d={};return o||(d.disable_uuids=1),a&&(d.state=1),i.length>0&&(d["channel-group"]=i.join(",")),c(c({},d),u)},t.handleResponse=function(e,t,n){var i=n.channels,r=void 0===i?[]:i,o=n.channelGroups,s=void 0===o?[]:o,a=n.includeUUIDs,c=void 0===a||a,l=n.includeState,u=void 0!==l&&l;return r.length>1||s.length>0||0===s.length&&0===r.length?function(){var e={};return e.totalChannels=t.payload.total_channels,e.totalOccupancy=t.payload.total_occupancy,e.channels={},Object.keys(t.payload.channels).forEach((function(n){var i=t.payload.channels[n],r=[];return e.channels[n]={occupants:r,name:n,occupancy:i.occupancy},c&&i.uuids.forEach((function(e){u?r.push({state:e.state,uuid:e.uuid}):r.push({state:null,uuid:e})})),e})),e}():function(){var e={},n=[];return e.totalChannels=1,e.totalOccupancy=t.occupancy,e.channels={},e.channels[r[0]]={occupants:n,name:r[0],occupancy:t.occupancy},c&&t.uuids&&t.uuids.forEach((function(e){u?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})})),e}()};var r=i(n(4)),o=(n(2),i(n(1))),s=i(n(3));function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){(0,r.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAddMessageActionOperation},t.validateParams=function(e,t){var n=e.config,i=t.action,r=t.channel;return t.messageTimetoken?n.subscribeKey?r?i?i.value?i.type?i.type.length>15?"Action.type value exceed maximum length of 15":void 0:"Missing Action.type":"Missing Action.value":"Missing Action":"Missing message channel":"Missing Subscribe Key":"Missing message timetoken"},t.usePost=function(){return!0},t.postURL=function(e,t){var n=e.config,i=t.channel,r=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(i,"/message/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getRequestHeaders=function(){return{"Content-Type":"application/json"}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.postPayload=function(e,t){return t.action},t.handleResponse=function(e,t){return{data:t.data}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveMessageActionOperation},t.validateParams=function(e,t){var n=e.config,i=t.channel,r=t.actionTimetoken;return t.messageTimetoken?r?n.subscribeKey?i?void 0:"Missing message channel":"Missing Subscribe Key":"Missing action timetoken":"Missing message timetoken"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=e.config,i=t.channel,r=t.actionTimetoken,o=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(i,"/message/").concat(o,"/action/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{data:t.data}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetMessageActionsOperation},t.validateParams=function(e,t){var n=e.config,i=t.channel;return n.subscribeKey?i?void 0:"Missing message channel":"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channel;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(i)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.limit,i=t.start,r=t.end,o={};return n&&(o.limit=n),i&&(o.start=i),r&&(o.end=r),o},t.handleResponse=function(e,t){var n={data:t.data,start:null,end:null};return n.data.length&&(n.end=n.data[n.data.length-1].actionTimetoken,n.start=n.data[0].actionTimetoken),n},n(2);var r=i(n(1))},function(e,t,n){},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNListFilesOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"channel can't be empty"},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/files")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(e,t){var n={};return t.limit&&(n.limit=t.limit),t.next&&(n.next=t.next),n},handleResponse:function(e,t){return{status:t.status,data:t.data,next:t.next,count:t.count}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNGenerateUploadUrlOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.name)?void 0:"name can't be empty":"channel can't be empty"},usePost:function(){return!0},postURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/generate-upload-url")},postPayload:function(e,t){return{name:t.name}},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status,data:t.data,file_upload_request:t.file_upload_request}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(1)),s=i(n(3)),a={getOperation:function(){return o.default.PNPublishFileOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.fileId)?(null==t?void 0:t.fileName)?void 0:"file name can't be empty":"file id can't be empty":"channel can't be empty"},getURL:function(e,t){var n=e.config,i=n.publishKey,r=n.subscribeKey,o=function(e,t){var n=e.crypto,i=e.config,r=JSON.stringify(t);return i.cipherKey&&(r=n.encrypt(r),r=JSON.stringify(r)),r||""}(e,{message:t.message,file:{name:t.fileName,id:t.fileId}});return"/v1/files/publish-file/".concat(i,"/").concat(r,"/0/").concat(t.channel,"/0/").concat(s.default.encodeString(o))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(e,t){var n={};return t.ttl&&(n.ttl=t.ttl),void 0!==t.storeInHistory&&(n.store=t.storeInHistory?"1":"0"),t.meta&&"object"===(0,r.default)(t.meta)&&(n.meta=JSON.stringify(t.meta)),n},handleResponse:function(e,t){return{timetoken:t[2]}}};t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(11)),o=i(n(12)),s=n(18),a=function(e){return new Promise((function(t){var n="";e.on("data",(function(e){n+=e.toString("utf8")})),e.on("end",(function(){t(n)}))}))};t.default=function(e){var t,n,i,c,l,u,d,h,p,f=(i=(t=e).generateUploadUrl,c=t.publishFile,l=t.modules,u=l.PubNubFile,d=l.config,h=l.cryptography,p=l.networking,n=(0,o.default)(r.default.mark((function e(t){var n,o,l,f,g,m,v,y,b,w,k,_,P,S,x,O,T,C,E,A,R,M;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channel,o=t.file,l=t.message,f=t.cipherKey,g=t.meta,m=t.ttl,v=t.storeInHistory,n){e.next=3;break}throw new s.PubNubError("Validation failed, check status for details",(0,s.createValidationError)("channel can't be empty"));case 3:if(o){e.next=5;break}throw new s.PubNubError("Validation failed, check status for details",(0,s.createValidationError)("file can't be empty"));case 5:return y=u.create(o),e.next=8,i({channel:n,name:y.name});case 8:if(b=e.sent,w=b.file_upload_request,k=w.url,_=w.form_fields,P=b.data,S=P.id,x=P.name,!u.supportsEncryptFile||!(null!=f?f:d.cipherKey)){e.next=19;break}return e.next=18,h.encryptFile(null!=f?f:d.cipherKey,y,u);case 18:y=e.sent;case 19:if(O=_,y.mimeType&&(O=_.map((function(e){return"Content-Type"===e.key?{key:e.key,value:y.mimeType}:e}))),e.prev=21,!u.supportsFileUri||!o.uri){e.next=34;break}return e.t0=p,e.t1=k,e.t2=O,e.next=28,y.toFileUri();case 28:return e.t3=e.sent,e.next=31,e.t0.POSTFILE.call(e.t0,e.t1,e.t2,e.t3);case 31:T=e.sent,e.next=71;break;case 34:if(!u.supportsFile){e.next=46;break}return e.t4=p,e.t5=k,e.t6=O,e.next=40,y.toFile();case 40:return e.t7=e.sent,e.next=43,e.t4.POSTFILE.call(e.t4,e.t5,e.t6,e.t7);case 43:T=e.sent,e.next=71;break;case 46:if(!u.supportsBuffer){e.next=58;break}return e.t8=p,e.t9=k,e.t10=O,e.next=52,y.toBuffer();case 52:return e.t11=e.sent,e.next=55,e.t8.POSTFILE.call(e.t8,e.t9,e.t10,e.t11);case 55:T=e.sent,e.next=71;break;case 58:if(!u.supportsBlob){e.next=70;break}return e.t12=p,e.t13=k,e.t14=O,e.next=64,y.toBlob();case 64:return e.t15=e.sent,e.next=67,e.t12.POSTFILE.call(e.t12,e.t13,e.t14,e.t15);case 67:T=e.sent,e.next=71;break;case 70:throw new Error("Unsupported environment");case 71:e.next=80;break;case 73:return e.prev=73,e.t16=e.catch(21),e.next=77,a(e.t16.response);case 77:throw C=e.sent,E=/<Message>(.*)<\/Message>/gi.exec(C),new s.PubNubError(E?"Upload to bucket failed: ".concat(E[1]):"Upload to bucket failed.",e.t16);case 80:if(204===T.status){e.next=82;break}throw new s.PubNubError("Upload to bucket was unsuccessful",T);case 82:A=5,R=!1,M={timetoken:"0"};case 85:if(R||!(A>0)){e.next=98;break}return e.prev=86,e.next=89,c({channel:n,message:l,fileId:S,fileName:x,meta:g,storeInHistory:v,ttl:m});case 89:M=e.sent,R=!0,e.next=96;break;case 93:e.prev=93,e.t17=e.catch(86),A-=1;case 96:e.next=85;break;case 98:if(R){e.next=102;break}throw new s.PubNubError("Publish failed. You may want to execute that operation manually using pubnub.publishFile",{channel:n,id:S,name:x});case 102:return e.abrupt("return",{timetoken:M.timetoken,id:S,name:x});case 103:case"end":return e.stop()}}),e,null,[[21,73],[86,93]])}))),function(e){return n.apply(this,arguments)});return function(e,t){var n=f(e);return"function"==typeof t?(n.then((function(e){return t(null,e)})).catch((function(e){return t(e,null)})),n):n}},e.exports=t.default},function(e,t,n){var i=function(e){var t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var r=t&&t.prototype instanceof d?t:d,o=Object.create(r.prototype),s=new P(i||[]);return o._invoke=function(e,t,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=w(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var c=l(e,t,n);if("normal"===c.type){if(i=n.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i="completed",n.method="throw",n.arg=c.arg)}}}(e,n,s),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function d(){}function h(){}function p(){}var f={};f[r]=function(){return this};var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==t&&n.call(m,r)&&(f=m);var v=p.prototype=d.prototype=Object.create(f);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(r,o){function s(){return new t((function(i,s){!function i(r,o,s,a){var c=l(e[r],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,s,a)}),(function(e){i("throw",e,s,a)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,a)}))}a(c.arg)}(r,o,i,s)}))}return i=i?i.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,u;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function S(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return h.prototype=v.constructor=p,p.constructor=h,h.displayName=a(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(b.prototype),b.prototype[o]=function(){return this},e.AsyncIterator=b,e.async=function(t,n,i,r,o){void 0===o&&(o=Promise);var s=new b(c(t,n,i,r),o);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},y(v),a(v,s,"Generator"),v[r]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=S,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;_(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(18);t.default=function(e,t){var n=t.channel,r=t.id,o=t.name,s=e.config;if(!n)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("channel can't be empty"));if(!r)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file id can't be empty"));if(!o)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file name can't be empty"));var a="/v1/files/".concat(s.subscribeKey,"/channels/").concat(n,"/files/").concat(r,"/").concat(o),c={};c.uuid=s.getUUID(),c.pnsdk=(0,i.generatePNSDK)(s),s.getAuthKey()&&(c.auth=s.getAuthKey()),s.secretKey&&(0,i.signRequest)(e,a,c,{},{getOperation:function(){return"PubNubGetFileUrlOperation"}});var l=Object.keys(c).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(c[e]))})).join("&");return""!==l?"https://".concat(s.origin).concat(a,"?").concat(l):"https://".concat(s.origin).concat(a)},e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=i(n(11)),s=i(n(12)),a=i(n(1)),c={getOperation:function(){return a.default.PNDownloadFileOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.name)?(null==t?void 0:t.id)?void 0:"id can't be empty":"name can't be empty":"channel can't be empty"},useGetFile:function(){return!0},getFileURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/files/").concat(t.id,"/").concat(t.name)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},ignoreBody:function(){return!0},forceBuffered:function(){return!0},prepareParams:function(){return{}},handleResponse:(r=(0,s.default)(o.default.mark((function e(t,n,i){var r,s,a,c,l,u;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=t.PubNubFile,a=t.config,c=t.cryptography,l=n.response.body,!s.supportsEncryptFile||!a.cipherKey){e.next=6;break}return e.next=5,c.decrypt(null!==(u=i.cipherKey)&&void 0!==u?u:a.cipherKey,l);case 5:l=e.sent;case 6:return e.abrupt("return",s.create({data:l,name:null!==(r=n.response.name)&&void 0!==r?r:i.name,mimeType:n.response.type}));case 7:case"end":return e.stop()}}),e)}))),function(e,t,n){return r.apply(this,arguments)})};t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNListFilesOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.id)?(null==t?void 0:t.name)?void 0:"file name can't be empty":"file id can't be empty":"channel can't be empty"},useDelete:function(){return!0},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/files/").concat(t.id,"/").concat(t.name)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetAllUUIDMetadataOperation},validateParams:function(){},getURL:function(e){var t=e.config;return"/v2/objects/".concat(t.subscribeKey,"/uuids")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d={};return(null==t||null===(n=t.include)||void 0===n?void 0:n.customFields)&&(d.include="custom"),(null==t||null===(i=t.include)||void 0===i?void 0:i.totalCount)&&(d.count=null===(a=t.include)||void 0===a?void 0:a.totalCount),(null==t||null===(o=t.page)||void 0===o?void 0:o.next)&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next),(null==t||null===(s=t.page)||void 0===s?void 0:s.prev)&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev),(null==t?void 0:t.filter)&&(d.filter=t.filter),d.limit=null==t?void 0:t.limit,(null==t?void 0:t.sort)&&(d.sort=Object.entries(null!==(u=t.sort)&&void 0!==u?u:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,next:t.next,prev:t.prev}}};t.default=s,e.exports=t.default},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNGetUUIDMetadataOperation},validateParams:function(){},getURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID())},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i,r,o=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:o.getUUID(),include:(null===(i=null==t||null===(r=t.include)||void 0===r?void 0:r.customFields)||void 0===i||i)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNSetUUIDMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.data))return"Data cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID())},patchPayload:function(e,t){return t.data},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i,r,o=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:o.getUUID(),include:(null===(i=null==t||null===(r=t.include)||void 0===r?void 0:r.customFields)||void 0===i||i)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNRemoveUUIDMetadataOperation},validateParams:function(){},getURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID())},useDelete:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID()}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetAllChannelMetadataOperation},validateParams:function(){},getURL:function(e){var t=e.config;return"/v2/objects/".concat(t.subscribeKey,"/channels")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d={};return(null==t||null===(n=t.include)||void 0===n?void 0:n.customFields)&&(d.include="custom"),(null==t||null===(i=t.include)||void 0===i?void 0:i.totalCount)&&(d.count=null===(a=t.include)||void 0===a?void 0:a.totalCount),(null==t||null===(o=t.page)||void 0===o?void 0:o.next)&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next),(null==t||null===(s=t.page)||void 0===s?void 0:s.prev)&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev),(null==t?void 0:t.filter)&&(d.filter=t.filter),(null==t?void 0:t.limit)&&(d.limit=t.limit),(null==t?void 0:t.sort)&&(d.sort=Object.entries(null!==(u=t.sort)&&void 0!==u?u:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=s,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNGetChannelMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"Channel cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(e,t){var n,i;return{include:(null===(n=null==t||null===(i=t.include)||void 0===i?void 0:i.customFields)||void 0===n||n)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNSetChannelMetadataOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.data)?void 0:"Data cannot be empty":"Channel cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel)},patchPayload:function(e,t){return t.data},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(e,t){var n,i;return{include:(null===(n=null==t||null===(i=t.include)||void 0===i?void 0:i.customFields)||void 0===n||n)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNRemoveChannelMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"Channel cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel)},useDelete:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetMembersOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"UUID cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/uuids")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("member")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h,p,f,g={};return(null==t?void 0:t.include)&&(g.include=[],(null===(a=t.include)||void 0===a?void 0:a.customFields)&&g.include.push("custom"),(null===(c=t.include)||void 0===c?void 0:c.customUUIDFields)&&g.include.push("uuid.custom"),(null===(l=null===(u=t.include)||void 0===u?void 0:u.UUIDFields)||void 0===l||l)&&g.include.push("uuid"),g.include=g.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(g.count=null===(d=t.include)||void 0===d?void 0:d.totalCount),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(g.start=null===(h=t.page)||void 0===h?void 0:h.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(g.end=null===(p=t.page)||void 0===p?void 0:p.prev),(null==t?void 0:t.filter)&&(g.filter=t.filter),g.limit=null!==(s=null==t?void 0:t.limit)&&void 0!==s?s:100,(null==t?void 0:t.sort)&&(g.sort=Object.entries(null!==(f=t.sort)&&void 0!==f?f:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),g},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=s,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(4)),s=i(n(1)),a={getOperation:function(){return s.default.PNSetMembersOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.uuids)&&0!==(null==t?void 0:t.uuids.length)?void 0:"UUIDs cannot be empty":"Channel cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/uuids")},patchPayload:function(e,t){return(0,o.default)({set:[],remove:[]},t.type,t.uuids.map((function(e){return"string"==typeof e?{uuid:{id:e}}:{uuid:{id:e.id},custom:e.custom}})))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("member")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h={};return(null==t?void 0:t.include)&&(h.include=[],(null===(s=t.include)||void 0===s?void 0:s.customFields)&&h.include.push("custom"),(null===(a=t.include)||void 0===a?void 0:a.customUUIDFields)&&h.include.push("uuid.custom"),(null===(c=t.include)||void 0===c?void 0:c.UUIDFields)&&h.include.push("uuid"),h.include=h.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(h.count=!0),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(h.start=null===(l=t.page)||void 0===l?void 0:l.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(h.end=null===(u=t.page)||void 0===u?void 0:u.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),(null==t?void 0:t.limit)&&(h.limit=t.limit),(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(d=t.sort)&&void 0!==d?d:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetMembershipsOperation},validateParams:function(e,t){if(!(null==t?void 0:t.uuid))return"UUID cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/uuids/").concat(t.uuid,"/channels")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("membership")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h,p,f={};return(null==t?void 0:t.include)&&(f.include=[],(null===(a=t.include)||void 0===a?void 0:a.customFields)&&f.include.push("custom"),(null===(c=t.include)||void 0===c?void 0:c.customChannelFields)&&f.include.push("channel.custom"),(null===(l=t.include)||void 0===l?void 0:l.channelFields)&&f.include.push("channel"),f.include=f.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(f.count=null===(u=t.include)||void 0===u?void 0:u.totalCount),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(f.start=null===(d=t.page)||void 0===d?void 0:d.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(f.end=null===(h=t.page)||void 0===h?void 0:h.prev),(null==t?void 0:t.filter)&&(f.filter=t.filter),f.limit=null!==(s=null==t?void 0:t.limit)&&void 0!==s?s:100,(null==t?void 0:t.sort)&&(f.sort=Object.entries(null!==(p=t.sort)&&void 0!==p?p:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),f},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=s,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(4)),s=i(n(1)),a={getOperation:function(){return s.default.PNSetMembershipsOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channels)||0===(null==t?void 0:t.channels.length))return"Channels cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=t.uuid)&&void 0!==n?n:i.getUUID(),"/channels")},patchPayload:function(e,t){return(0,o.default)({set:[],remove:[]},t.type,t.channels.map((function(e){return"string"==typeof e?{channel:{id:e}}:{channel:{id:e.id},custom:e.custom}})))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("membership")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h={};return(null==t?void 0:t.include)&&(h.include=[],(null===(s=t.include)||void 0===s?void 0:s.customFields)&&h.include.push("custom"),(null===(a=t.include)||void 0===a?void 0:a.customChannelFields)&&h.include.push("channel.custom"),(null===(c=t.include)||void 0===c?void 0:c.channelFields)&&h.include.push("channel"),h.include=h.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(h.count=!0),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(h.start=null===(l=t.page)||void 0===l?void 0:l.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(h.end=null===(u=t.page)||void 0===u?void 0:u.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),(null==t?void 0:t.limit)&&(h.limit=t.limit),(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(d=t.sort)&&void 0!==d?d:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNCreateUserOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing User.name":"Missing User.id"},t.usePost=function(){return!0},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.id)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateUserOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing User.name":"Missing User.id"},t.usePatch=function(){return!0},t.getURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(i)},t.patchURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(i)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.id)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNDeleteUserOperation},t.validateParams=function(e,t){var n=e.config;return t?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing UserId"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t)||e.tokenManager.getToken("user")},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetUserOperation},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetUsersOperation},t.validateParams=function(){},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e){return e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNCreateSpaceOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing Space.name":"Missing Space.id"},t.usePost=function(){return!0},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.id)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateSpaceOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing Space.name":"Missing Space.id"},t.usePatch=function(){return!0},t.getURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(i)},t.patchURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(i)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.id)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNDeleteSpaceOperation},t.validateParams=function(e,t){var n=e.config;return t?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing SpaceId"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t)||e.tokenManager.getToken("space")},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetSpacesOperation},t.validateParams=function(){},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e){return e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetSpaceOperation},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetMembersOperation},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom"),n.userFields&&a.push("user"),n.customUserFields&&a.push("user.custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembersOperation},t.validateParams=function(e,t){var n=t.spaceId,i=t.users;return n?i?void 0:"Missing users":"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.users,i={};return n&&n.length>0&&(i.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),i.add.push(t)}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembersOperation},t.validateParams=function(e,t){var n=t.spaceId,i=t.users;return n?i?void 0:"Missing users":"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.addMembers,i=t.updateMembers,r=t.removeMembers,o=t.users,s={};return n&&n.length>0&&(s.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.add.push(t)}))),i&&i.length>0&&(s.update=[],i.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),o&&o.length>0&&(s.update=s.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),r&&r.length>0&&(s.remove=[],r.forEach((function(e){s.remove.push({id:e})}))),s}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembersOperation},t.validateParams=function(e,t){var n=t.spaceId,i=t.users;return n?i?void 0:"Missing users":"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.users,i={};return n&&n.length>0&&(i.remove=[],n.forEach((function(e){i.remove.push({id:e})}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetMembershipsOperation},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembershipsOperation},t.validateParams=function(e,t){var n=t.userId,i=t.spaces;return n?i?void 0:"Missing spaces":"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.addMemberships,i=t.updateMemberships,r=t.removeMemberships,o=t.spaces,s={};return n&&n.length>0&&(s.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.add.push(t)}))),i&&i.length>0&&(s.update=[],i.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),o&&o.length>0&&(s.update=s.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),r&&r.length>0&&(s.remove=[],r.forEach((function(e){s.remove.push({id:e})}))),s}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembershipsOperation},t.validateParams=function(e,t){var n=t.userId,i=t.spaces;return n?i?void 0:"Missing spaces":"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,i={};return n&&n.length>0&&(i.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),i.add.push(t)}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembershipsOperation},t.validateParams=function(e,t){var n=t.userId,i=t.spaces;return n?i?void 0:"Missing spaces":"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,i={};return n&&n.length>0&&(i.remove=[],n.forEach((function(e){i.remove.push({id:e})}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAccessManagerAudit},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e){var t=e.config;return"/v2/auth/audit/sub-key/".concat(t.subscribeKey)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channel,i=t.channelGroup,r=t.authKeys,o=void 0===r?[]:r,s={};return n&&(s.channel=n),i&&(s["channel-group"]=i),o.length>0&&(s.auth=o.join(",")),s},t.handleResponse=function(e,t){return t.payload},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAccessManagerGrant},t.validateParams=function(e,t){var n=e.config;return n.subscribeKey?n.publishKey?n.secretKey?null==t.uuids||t.authKeys?null==t.uuids||null==t.channels&&null==t.channelGroups?void 0:"Both channel/channelgroup and uuid cannot be used in the same request":"authKeys are required for grant request on uuids":"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"},t.getURL=function(e){var t=e.config;return"/v2/auth/grant/sub-key/".concat(t.subscribeKey)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channels,i=void 0===n?[]:n,r=t.channelGroups,o=void 0===r?[]:r,s=t.uuids,a=void 0===s?[]:s,c=t.ttl,l=t.read,u=void 0!==l&&l,d=t.write,h=void 0!==d&&d,p=t.manage,f=void 0!==p&&p,g=t.get,m=void 0!==g&&g,v=t.join,y=void 0!==v&&v,b=t.update,w=void 0!==b&&b,k=t.authKeys,_=void 0===k?[]:k,P=t.delete,S={};return S.r=u?"1":"0",S.w=h?"1":"0",S.m=f?"1":"0",S.d=P?"1":"0",S.g=m?"1":"0",S.j=y?"1":"0",S.u=w?"1":"0",i.length>0&&(S.channel=i.join(",")),o.length>0&&(S["channel-group"]=o.join(",")),_.length>0&&(S.auth=_.join(",")),a.length>0&&(S["target-uuid"]=a.join(",")),(c||0===c)&&(S.ttl=c),S},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAccessManagerGrantToken},t.extractPermissions=o,t.validateParams=function(e,t){var n=e.config;return n.subscribeKey?n.publishKey?n.secretKey?t.resources||t.patterns?(!t.resources||t.resources.users&&0!==Object.keys(t.resources.users).length||t.resources.spaces&&0!==Object.keys(t.resources.spaces).length)&&(!t.patterns||t.patterns.users&&0!==Object.keys(t.patterns.users).length||t.patterns.spaces&&0!==Object.keys(t.patterns.spaces).length)?void 0:"Missing values for either Resources or Patterns.":"Missing either Resources or Patterns.":"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"},t.postURL=function(e){var t=e.config;return"/v3/pam/".concat(t.subscribeKey,"/grant")},t.usePost=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(){return{}},t.postPayload=function(e,t){return function(e,t){var n=t.ttl,i=t.resources,r=t.patterns,s=t.meta,a={ttl:0,permissions:{resources:{channels:{},groups:{},users:{},spaces:{}},patterns:{channels:{},groups:{},users:{},spaces:{}},meta:{}}};if(i){var c=i.users,l=i.spaces;c&&Object.keys(c).forEach((function(e){a.permissions.resources.users[e]=o(c[e])})),l&&Object.keys(l).forEach((function(e){a.permissions.resources.spaces[e]=o(l[e])}))}if(r){var u=r.users,d=r.spaces;u&&Object.keys(u).forEach((function(e){a.permissions.patterns.users[e]=o(u[e])})),d&&Object.keys(d).forEach((function(e){a.permissions.patterns.spaces[e]=o(d[e])}))}return(n||0===n)&&(a.ttl=n),s&&(a.permissions.meta=s),a}(0,t)},t.handleResponse=function(e,t){return t.data.token},n(2);var r=i(n(1));function o(e){var t=0;return e.create&&(t|=16),e.delete&&(t|=8),e.manage&&(t|=4),e.write&&(t|=2),e.read&&(t|=1),t}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNPublishOperation},t.validateParams=function(e,t){var n=e.config,i=t.message;return t.channel?i?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"},t.usePost=function(e,t){var n=t.sendByPost;return void 0!==n&&n},t.getURL=function(e,t){var n=e.config,i=t.channel,r=a(e,t.message);return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(s.default.encodeString(i),"/0/").concat(s.default.encodeString(r))},t.postURL=function(e,t){var n=e.config,i=t.channel;return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(s.default.encodeString(i),"/0")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){return a(e,t.message)},t.prepareParams=function(e,t){var n=t.meta,i=t.replicate,o=void 0===i||i,s=t.storeInHistory,a=t.ttl,c={};return null!=s&&(c.store=s?"1":"0"),a&&(c.ttl=a),!1===o&&(c.norep="true"),n&&"object"===(0,r.default)(n)&&(c.meta=JSON.stringify(n)),c},t.handleResponse=function(e,t){return{timetoken:t[2]}};var r=i(n(7)),o=(n(2),i(n(1))),s=i(n(3));function a(e,t){var n=e.crypto,i=e.config,r=JSON.stringify(t);return i.cipherKey&&(r=n.encrypt(r),r=JSON.stringify(r)),r}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNSignalOperation},t.validateParams=function(e,t){var n=e.config,i=t.message;return t.channel?i?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"},t.getURL=function(e,t){var n,i=e.config,r=t.channel,s=(n=t.message,JSON.stringify(n));return"/signal/".concat(i.publishKey,"/").concat(i.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0/").concat(o.default.encodeString(s))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{timetoken:t[2]}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNHistoryOperation},t.validateParams=function(e,t){var n=t.channel,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.getURL=function(e,t){var n=t.channel,i=e.config;return"/v2/history/sub-key/".concat(i.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,i=t.end,r=t.reverse,o=t.count,s=void 0===o?100:o,a=t.stringifiedTimeToken,c=void 0!==a&&a,l=t.includeMeta,u=void 0!==l&&l,d={include_token:"true"};return d.count=s,n&&(d.start=n),i&&(d.end=i),c&&(d.string_message_token="true"),null!=r&&(d.reverse=r.toString()),u&&(d.include_meta="true"),d},t.handleResponse=function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};return Array.isArray(t[0])&&t[0].forEach((function(t){var i={timetoken:t.timetoken,entry:s(e,t.message)};t.meta&&(i.meta=t.meta),n.messages.push(i)})),n},n(2);var r=i(n(1)),o=i(n(3));function s(e,t){var n=e.config,i=e.crypto;if(!n.cipherKey)return t;try{return i.decrypt(t)}catch(e){return t}}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNDeleteMessagesOperation},t.validateParams=function(e,t){var n=t.channel,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=t.channel,i=e.config;return"/v3/history/sub-key/".concat(i.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,i=t.end,r={};return n&&(r.start=n),i&&(r.end=i),r},t.handleResponse=function(e,t){return t.payload},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNMessageCounts},t.validateParams=function(e,t){var n=t.channels,i=t.timetoken,r=t.channelTimetokens,o=e.config;return n?i&&r?"timetoken and channelTimetokens are incompatible together":i&&r&&r.length>1&&n.length!==r.length?"Length of channelTimetokens and channels do not match":o.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.getURL=function(e,t){var n=t.channels,i=e.config,r=n.join(",");return"/v3/history/sub-key/".concat(i.subscribeKey,"/message-counts/").concat(s.default.encodeString(r))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.timetoken,i=t.channelTimetokens,o={};if(i&&1===i.length){var s=(0,r.default)(i,1)[0];o.timetoken=s}else i?o.channelsTimetoken=i.join(","):n&&(o.timetoken=n);return o},t.handleResponse=function(e,t){return{channels:t.channels}};var r=i(n(9)),o=i(n(1)),s=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNFetchMessagesOperation},t.validateParams=function(e,t){var n=t.channels,i=t.includeMessageActions,r=void 0!==i&&i,o=e.config;if(!n||0===n.length)return"Missing channels";if(!o.subscribeKey)return"Missing Subscribe Key";if(r&&n.length>1)throw new TypeError("History can return actions data for a single channel only. Either pass a single channel or disable the includeMessageActions flag.")},t.getURL=function(e,t){var n=t.channels,i=void 0===n?[]:n,r=t.includeMessageActions,s=void 0!==r&&r,a=e.config,c=s?"history-with-actions":"history",l=i.length>0?i.join(","):",";return"/v3/".concat(c,"/sub-key/").concat(a.subscribeKey,"/channel/").concat(o.default.encodeString(l))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels,i=t.start,r=t.end,o=t.includeMessageActions,s=t.count,a=t.stringifiedTimeToken,c=void 0!==a&&a,l=t.includeMeta,u=void 0!==l&&l,d=t.includeUuid,h=t.includeUUID,p=void 0===h||h,f=t.includeMessageType,g=void 0===f||f,m={};return m.max=s||(n.length>1||!0===o?25:100),i&&(m.start=i),r&&(m.end=r),c&&(m.string_message_token="true"),u&&(m.include_meta="true"),p&&!1!==d&&(m.include_uuid="true"),g&&(m.include_message_type="true"),m},t.handleResponse=function(e,t){var n={channels:{}};return Object.keys(t.channels||{}).forEach((function(i){n.channels[i]=[],(t.channels[i]||[]).forEach((function(t){var r={};r.channel=i,r.timetoken=t.timetoken,r.message=function(e,t){var n=e.config,i=e.crypto;if(!n.cipherKey)return t;try{return i.decrypt(t)}catch(e){return t}}(e,t.message),r.messageType=t.message_type,r.uuid=t.uuid,t.actions&&(r.actions=t.actions,r.data=t.actions),t.meta&&(r.meta=t.meta),n.channels[i].push(r)}))})),t.more&&(n.more=t.more),n},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNSubscribeOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/subscribe/".concat(n.subscribeKey,"/").concat(o.default.encodeString(s),"/0")},t.getRequestTimeout=function(e){return e.config.getSubscribeTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=e.config,i=t.state,r=t.channelGroups,o=void 0===r?[]:r,s=t.timetoken,a=t.filterExpression,c=t.region,l={heartbeat:n.getPresenceTimeout()};return o.length>0&&(l["channel-group"]=o.join(",")),a&&a.length>0&&(l["filter-expr"]=a),Object.keys(i).length&&(l.state=JSON.stringify(i)),s&&(l.tt=s),c&&(l.tr=c),l},t.handleResponse=function(e,t){var n=[];t.m.forEach((function(e){var t={publishTimetoken:e.p.t,region:e.p.r},i={shard:parseInt(e.a,10),subscriptionMatch:e.b,channel:e.c,messageType:e.e,payload:e.d,flags:e.f,issuingClientId:e.i,subscribeKey:e.k,originationTimetoken:e.o,userMetadata:e.u,publishMetaData:t};n.push(i)}));var i={timetoken:t.t.t,region:t.t.r};return{messages:n,metadata:i}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(122)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=(i(n(8)),i(n(10))),l=(n(2),function(){function e(t){var n=this;(0,o.default)(this,e),(0,a.default)(this,"_modules",void 0),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_maxSubDomain",void 0),(0,a.default)(this,"_currentSubDomain",void 0),(0,a.default)(this,"_standardOrigin",void 0),(0,a.default)(this,"_subscribeOrigin",void 0),(0,a.default)(this,"_requestTimeout",void 0),(0,a.default)(this,"_coreParams",void 0),this._modules={},Object.keys(t).forEach((function(e){n._modules[e]=t[e].bind(n)}))}return(0,s.default)(e,[{key:"init",value:function(e){this._config=e,this._maxSubDomain=10,this._currentSubDomain=Math.floor(Math.random()*this._maxSubDomain),this._coreParams={},this.shiftStandardOrigin()}},{key:"nextOrigin",value:function(){this._currentSubDomain+=1,this._currentSubDomain>=this._maxSubDomain&&(this._currentSubDomain=0);var e=this._config.origin.split("."),t=(0,r.default)(e),n=t[0],i=t.slice(1),o=this._config.secure?"https://":"http://",s=this._config.hasCustomOrigin()?"-":"",a=this._config.hasCustomOrigin()?this._currentSubDomain:this._currentSubDomain+1;return"".concat(o).concat(n).concat(s).concat(a,".").concat(i.join("."))}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){return this._standardOrigin=this.nextOrigin(),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POSTFILE",value:function(e,t,n){return this._modules.postfile(e,t,n)}},{key:"GETFILE",value:function(e,t,n){return this._modules.getfile(e,t,n)}},{key:"POST",value:function(e,t,n,i){return this._modules.post(e,t,n,i)}},{key:"PATCH",value:function(e,t,n,i){return this._modules.patch(e,t,n,i)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return c.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return c.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return c.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return c.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return c.default.PNNetworkIssuesCategory;if(e.timeout)return c.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return c.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return c.default.PNBadRequestCategory;if(e.response.forbidden)return c.default.PNAccessDeniedCategory}return c.default.PNUnknownCategory}}]),e}());t.default=l,e.exports=t.default},function(e,t,n){var i=n(26),r=n(123),o=n(27),s=n(28);e.exports=function(e){return i(e)||r(e)||o(e)||s()}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={get:function(e){try{return localStorage.getItem(e)}catch(e){return null}},set:function(e,t){try{return localStorage.setItem(e,t)}catch(e){return null}}};t.default=i,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=function(){function e(t,n){(0,o.default)(this,e),(0,a.default)(this,"_base64ToBinary",void 0),(0,a.default)(this,"_cborReader",void 0),this._base64ToBinary=n,this._decode=t}return(0,s.default)(e,[{key:"decodeToken",value:function(e){var t="";e.length%4==3?t="=":e.length%4==2&&(t="==");var n=e.replace(/-/gi,"+").replace(/_/gi,"/")+t,i=this._decode(this._base64ToBinary(n));if("object"===(0,r.default)(i))return i}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.postfile=function(e,t,n){return l.apply(this,arguments)},t.getfile=function(e,t,n){var i=s.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return c.call(this,i,t,n)},t.get=function(e,t,n){var i=s.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return c.call(this,i,t,n)},t.post=function(e,t,n,i){var r=s.default.post(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return c.call(this,r,n,i)},t.patch=function(e,t,n,i){var r=s.default.patch(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return c.call(this,r,n,i)},t.del=function(e,t,n){var i=s.default.delete(this.getStandardOrigin()+t.url).set(t.headers).query(e);return c.call(this,i,t,n)};var r=i(n(11)),o=i(n(12)),s=i(n(127));function a(e){var t=(new Date).getTime(),n=(new Date).toISOString(),i=console&&console.log?console:window&&window.console&&window.console.log?window.console:console;i.log("<<<<<"),i.log("[".concat(n,"]"),"\n",e.url,"\n",e.qs),i.log("-----"),e.on("response",(function(n){var r=(new Date).getTime()-t,o=(new Date).toISOString();i.log(">>>>>>"),i.log("[".concat(o," / ").concat(r,"]"),"\n",e.url,"\n",e.qs,"\n",n.text),i.log("-----")}))}function c(e,t,n){var i=this;this._config.logVerbosity&&(e=e.use(a)),this._config.proxy&&this._modules.proxy&&(e=this._modules.proxy.call(this,e)),this._config.keepAlive&&this._modules.keepAlive&&(e=this._modules.keepAlive(e));var r=e;return!0===t.forceBuffered?r="undefined"==typeof Blob?r.buffer().responseType("arraybuffer"):r.responseType("arraybuffer"):!1===t.forceBuffered&&(r=r.buffer(!1)),r.timeout(t.timeout).end((function(e,r){var o,s={};if(s.error=null!==e,s.operation=t.operation,r&&r.status&&(s.statusCode=r.status),e){if(e.response&&e.response.text&&!i._config.logVerbosity)try{s.errorData=JSON.parse(e.response.text)}catch(t){s.errorData=e}else s.errorData=e;return s.category=i._detectErrorCategory(e),n(s,null)}if(t.ignoreBody)o={headers:r.headers,redirects:r.redirects,response:r};else try{o=JSON.parse(r.text)}catch(e){return s.errorData=r,s.error=!0,n(s,null)}return o.error&&1===o.error&&o.status&&o.message&&o.service?(s.errorData=o,s.statusCode=o.status,s.error=!0,s.category=i._detectErrorCategory(s),n(s,null)):(o.error&&o.error.message&&(s.errorData=o.error),n(s,o))}))}function l(){return(l=(0,o.default)(r.default.mark((function e(t,n,i){var o,a;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=s.default.post(t),n.forEach((function(e){var t=e.key,n=e.value;o=o.field(t,n)})),o.attach("file",i,{contentType:"application/octet-stream"}),e.next=5,o;case 5:return a=e.sent,e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}n(2)},function(e,t,n){var i;"undefined"!=typeof window?i=window:"undefined"!=typeof self?i=self:(console.warn("Using browser-only version of superagent in non-browser environment"),i=this);var r=n(128),o=n(129),s=n(29),a=n(130),c=n(132);function l(){}var u=t=e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1==arguments.length?new t.Request("GET",e):new t.Request(e,n)};t.Request=v,u.getXHR=function(){if(!(!i.XMLHttpRequest||i.location&&"file:"==i.location.protocol&&i.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only version of superagent could not find XHR")};var d="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function h(e){if(!s(e))return e;var t=[];for(var n in e)p(t,n,e[n]);return t.join("&")}function p(e,t,n){if(null!=n)if(Array.isArray(n))n.forEach((function(n){p(e,t,n)}));else if(s(n))for(var i in n)p(e,t+"["+i+"]",n[i]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(n));else null===n&&e.push(encodeURIComponent(t))}function f(e){for(var t,n,i={},r=e.split("&"),o=0,s=r.length;o<s;++o)-1==(n=(t=r[o]).indexOf("="))?i[decodeURIComponent(t)]="":i[decodeURIComponent(t.slice(0,n))]=decodeURIComponent(t.slice(n+1));return i}function g(e){return/[\/+]json($|[^-\w])/.test(e)}function m(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.header=this.headers=function(e){for(var t,n,i,r,o=e.split(/\r?\n/),s={},a=0,c=o.length;a<c;++a)-1!==(t=(n=o[a]).indexOf(":"))&&(i=n.slice(0,t).toLowerCase(),r=d(n.slice(t+1)),s[i]=r);return s}(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function v(e,t){var n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,i=null;try{i=new m(n)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,n.xhr?(t.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.status=n.xhr.status?n.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),n.callback(t)}n.emit("response",i);try{n._isResponseOK(i)||(e=new Error(i.statusText||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=i,e.status=i.status,n.callback(e,i)):n.callback(null,i)}))}function y(e,t,n){var i=u("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i}u.serializeObject=h,u.parseString=f,u.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},u.serialize={"application/x-www-form-urlencoded":h,"application/json":JSON.stringify},u.parse={"application/x-www-form-urlencoded":f,"application/json":JSON.parse},a(m.prototype),m.prototype._parseBody=function(e){var t=u.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&g(this.type)&&(t=u.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null)},m.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,i="cannot "+t+" "+n+" ("+this.status+")",r=new Error(i);return r.status=this.status,r.method=t,r.url=n,r},u.Response=m,r(v.prototype),o(v.prototype),v.prototype.type=function(e){return this.set("Content-Type",u.types[e]||e),this},v.prototype.accept=function(e){return this.set("Accept",u.types[e]||e),this},v.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"==typeof t&&null!==t&&(n=t,t=""),n||(n={type:"function"==typeof btoa?"basic":"auto"});var i=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,n,i)},v.prototype.query=function(e){return"string"!=typeof e&&(e=h(e)),e&&this._query.push(e),this},v.prototype.attach=function(e,t,n){if(t){if(this._data)throw Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},v.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},v.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},v.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},v.prototype.buffer=v.prototype.ca=v.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},v.prototype.pipe=v.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},v.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},v.prototype.end=function(e){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||l,this._finalizeQueryString(),this._end()},v.prototype._end=function(){var e=this,t=this.xhr=u.getXHR(),n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==n){var i;try{i=t.status}catch(e){i=0}if(!i){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var i=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.onprogress=i.bind(null,"download"),t.upload&&(t.upload.onprogress=i.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var r=this._header["content-type"],o=this._serializer||u.serialize[r?r.split(";")[0]:""];!o&&g(r)&&(o=u.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!=this.header[s]&&this.header.hasOwnProperty(s)&&t.setRequestHeader(s,this.header[s]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==n?n:null),this},u.agent=function(){return new c},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){c.prototype[e.toLowerCase()]=function(t,n){var i=new u.Request(e,t);return this._setDefaults(i),n&&i.end(n),i}})),c.prototype.del=c.prototype.delete,u.get=function(e,t,n){var i=u("GET",e);return"function"==typeof t&&(n=t,t=null),t&&i.query(t),n&&i.end(n),i},u.head=function(e,t,n){var i=u("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&i.query(t),n&&i.end(n),i},u.options=function(e,t,n){var i=u("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i},u.del=y,u.delete=y,u.patch=function(e,t,n){var i=u("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i},u.post=function(e,t,n){var i=u("POST",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i},u.put=function(e,t,n){var i=u("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i}},function(e,t,n){function i(e){if(e)return function(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}(e)}e.exports=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},i.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<i.length;r++)if((n=i[r])===t||n.fn===t){i.splice(r,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},i.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){i=0;for(var r=(n=n.slice(0)).length;i<r;++i)n[i].apply(this,t)}return this},i.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},i.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,n){var i=n(29);function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},r.prototype.parse=function(e){return this._parser=e,this},r.prototype.responseType=function(e){return this._responseType=e,this},r.prototype.serialize=function(e){return this._serializer=e,this},r.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this;for(var t in e)switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;default:console.warn("Unknown timeout option",t)}return this},r.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var o=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];r.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!=t.status)return!0;if(e){if(e.code&&~o.indexOf(e.code))return!0;if(e.timeout&&"ECONNABORTED"==e.code)return!0;if(e.crossDomain)return!0}return!1},r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},r.prototype.then=function(e,t){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){n.end((function(n,i){n?t(n):e(i)}))}))}return this._fullfilledPromise.then(e,t)},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype.use=function(e){return e(this),this},r.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},r.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(e,t){if(i(e)){for(var n in e)this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},r.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},r.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),i(e)){for(var n in e)this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)this.field(e,t[r]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},r.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},r.prototype._auth=function(e,t,n,i){switch(n.type){case"basic":this.set("Authorization","Basic "+i(e+":"+t));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer "+e)}return this},r.prototype.withCredentials=function(e){return null==e&&(e=!0),this._withCredentials=e,this},r.prototype.redirects=function(e){return this._maxRedirects=e,this},r.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw TypeError("Invalid argument");return this._maxResponseSize=e,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(e){var t=i(e),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&i(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||n||this.type("json"),this},r.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},r.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.substring(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,t)+"?"+n.join("&")}}},r.prototype._appendQueryString=function(){console.trace("Unsupported")},r.prototype._timeoutError=function(e,t,n){if(!this._aborted){var i=new Error(e+t+"ms exceeded");i.timeout=t,i.code="ECONNABORTED",i.errno=n,this.timedout=!0,this.abort(),this.callback(i)}},r.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},function(e,t,n){var i=n(131);function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.get=function(e){return this.header[e.toLowerCase()]},r.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=i.type(t);var n=i.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=i.parseLinks(e.link))}catch(e){}},r.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.created=201==e,this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e,this.unprocessableEntity=422==e}},function(e,t,n){t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce((function(e,t){var n=t.split(/ *= */),i=n.shift(),r=n.shift();return i&&r&&(e[i]=r),e}),{})},t.parseLinks=function(e){return e.split(/ *, */).reduce((function(e,t){var n=t.split(/ *; */),i=n[0].slice(1,-1);return e[n[1].split(/ *= */)[1].slice(1,-1)]=i,e}),{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},function(e,t){function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach((function(e){n.prototype[e]=function(){return this._defaults.push({fn:e,arguments:arguments}),this}})),n.prototype._setDefaults=function(e){this._defaults.forEach((function(t){e[t.fn].apply(e,t.arguments)}))},e.exports=n},function(e,t,n){(function(i){var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(11)),s=r(n(12)),a=r(n(5)),c=r(n(6)),l=r(n(4)),u=r(n(135));function d(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}var h=function(){function e(){(0,a.default)(this,e)}var t,n,r,l,h,p,f,g,m;return(0,c.default)(e,[{key:"encrypt",value:(m=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:if(i=e.sent,!(n instanceof ArrayBuffer)){e.next=7;break}return e.abrupt("return",this.encryptArrayBuffer(i,n));case 7:if("string"!=typeof n){e.next=11;break}return e.abrupt("return",this.encryptString(i,n));case 11:throw new Error("Cannot encrypt this file. In browsers file encryption supports only string or ArrayBuffer");case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"decrypt",value:(g=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:if(i=e.sent,!(n instanceof ArrayBuffer)){e.next=7;break}return e.abrupt("return",this.decryptArrayBuffer(i,n));case 7:if("string"!=typeof n){e.next=11;break}return e.abrupt("return",this.decryptString(i,n));case 11:throw new Error("Cannot decrypt this file. In browsers file decryption supports only string or ArrayBuffer");case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"encryptFile",value:(f=(0,s.default)(o.default.mark((function e(t,n,i){var r,s,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:return r=e.sent,e.next=5,n.toArrayBuffer();case 5:return s=e.sent,e.next=8,this.encryptArrayBuffer(r,s);case 8:return a=e.sent,e.abrupt("return",i.create({name:n.name,mimeType:"application/octet-stream",data:a}));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return f.apply(this,arguments)})},{key:"decryptFile",value:(p=(0,s.default)(o.default.mark((function e(t,n,i){var r,s,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:return r=e.sent,e.next=5,n.toArrayBuffer();case 5:return s=e.sent,e.next=8,this.decryptArrayBuffer(r,s);case 8:if(a=e.sent,!(n.data instanceof ArrayBuffer)){e.next=13;break}return e.abrupt("return",i.create({name:n.name,data:a}));case 13:throw new Error("Cannot decrypt this file. In browser environment file decryption supports only ArrayBuffer.");case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"getKey",value:(h=(0,s.default)(o.default.mark((function e(t){var n,r,s;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.from(t),e.next=3,u.default.subtle.digest("SHA-256",n.buffer);case 3:return r=e.sent,s=i.from(i.from(r).toString("hex").slice(0,32),"utf8").buffer,e.abrupt("return",u.default.subtle.importKey("raw",s,"AES-CBC",!0,["encrypt","decrypt"]));case 6:case"end":return e.stop()}}),e)}))),function(e){return h.apply(this,arguments)})},{key:"encryptArrayBuffer",value:(l=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=u.default.getRandomValues(new Uint8Array(16)),e.t0=d,e.t1=i.buffer,e.next=5,u.default.subtle.encrypt({name:"AES-CBC",iv:i},t,n);case 5:return e.t2=e.sent,e.abrupt("return",(0,e.t0)(e.t1,e.t2));case 7:case"end":return e.stop()}}),e)}))),function(e,t){return l.apply(this,arguments)})},{key:"decryptArrayBuffer",value:(r=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.slice(0,16),e.abrupt("return",u.default.subtle.decrypt({name:"AES-CBC",iv:i},t,n.slice(16)));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})},{key:"encryptString",value:(n=(0,s.default)(o.default.mark((function e(t,n){var r,s,a,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.default.getRandomValues(new Uint8Array(16)),s=i.from(n).buffer,e.next=4,u.default.subtle.encrypt({name:"AES-CBC",iv:r},t,s);case 4:return a=e.sent,c=d(r.buffer,a),e.abrupt("return",i.from(c).toString("utf8"));case 7:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"decryptString",value:(t=(0,s.default)(o.default.mark((function e(t,n){var r,s,a,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.from(n),s=r.slice(0,16),a=r.slice(16),e.next=5,u.default.subtle.decrypt({name:"AES-CBC",iv:s},t,a);case 5:return c=e.sent,e.abrupt("return",i.from(c).toString("utf8"));case 7:case"end":return e.stop()}}),e)}))),function(e,n){return t.apply(this,arguments)})},{key:"algo",get:function(){return"aes-256-cbc"}}]),e}();t.default=h,(0,l.default)(h,"IV_LENGTH",16),e.exports=t.default}).call(this,n(21).Buffer)},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o,s=i(n(11)),a=i(n(12)),c=i(n(5)),l=i(n(6)),u=i(n(4)),d=(n(25),o=r=function(){function e(t){if((0,c.default)(this,e),(0,u.default)(this,"data",void 0),(0,u.default)(this,"name",void 0),(0,u.default)(this,"mimeType",void 0),t instanceof File)this.data=t,this.name=this.data.name,this.mimeType=this.data.type;else if(t.data){var n=t.data;this.data=new File([n],t.name,{type:t.mimeType}),this.name=t.name,t.mimeType&&(this.mimeType=t.mimeType)}if(void 0===this.data)throw new Error("Couldn't construct a file out of supplied options.");if(void 0===this.name)throw new Error("Couldn't guess filename out of the options. Please provide one.")}var t,n,i,r,o,d,h;return(0,l.default)(e,null,[{key:"create",value:function(e){return new this(e)}}]),(0,l.default)(e,[{key:"toBuffer",value:(h=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("This feature is only supported in Node.js environments.");case 1:case"end":return e.stop()}}),e)}))),function(){return h.apply(this,arguments)})},{key:"toStream",value:(d=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("This feature is only supported in Node.js environments.");case 1:case"end":return e.stop()}}),e)}))),function(){return d.apply(this,arguments)})},{key:"toFileUri",value:(o=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("This feature is only supported in react native environments.");case 1:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"toBlob",value:(r=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.data);case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"toArrayBuffer",value:(i=(0,a.default)(s.default.mark((function e(){var t=this;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var i=new FileReader;i.addEventListener("load",(function(){if(i.result instanceof ArrayBuffer)return e(i.result)})),i.addEventListener("error",(function(){n(i.error)})),i.readAsArrayBuffer(t.data)})));case 1:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"toString",value:(n=(0,a.default)(s.default.mark((function e(){var t=this;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var i=new FileReader;i.addEventListener("load",(function(){if("string"==typeof i.result)return e(i.result)})),i.addEventListener("error",(function(){n(i.error)})),i.readAsBinaryString(t.data)})));case 1:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"toFile",value:(t=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.data);case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),(0,u.default)(r,"supportsFile","undefined"!=typeof File),(0,u.default)(r,"supportsBlob","undefined"!=typeof Blob),(0,u.default)(r,"supportsArrayBuffer","undefined"!=typeof ArrayBuffer),(0,u.default)(r,"supportsBuffer",!1),(0,u.default)(r,"supportsStream",!1),(0,u.default)(r,"supportsString",!0),(0,u.default)(r,"supportsEncryptFile",!0),(0,u.default)(r,"supportsFileUri",!1),o);t.default=d,e.exports=t.default},function(t,n,i){i.r(n),
|
|
183
|
+
var i=n(36),r=n(37),o=n(38);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return l(this,e,t,n)}function l(e,t,n,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,i){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,n):new Uint8Array(t,n,i),c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=h(e,t),e}(e,t,n,i):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|f(t,n),r=(e=a(e,i)).write(t,n);return r!==i&&(e=e.slice(0,r)),e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|p(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(u(t),e=a(e,t<0?0:0|p(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function h(e,t){var n=t.length<0?0:0|p(t.length);e=a(e,n);for(var i=0;i<n;i+=1)e[i]=255&t[i];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(i)return $(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return x(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function v(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,i,r);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,i,r){var o,s=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var u=-1;for(o=n;o<a;o++)if(l(e,o)===l(t,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===c)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var d=!0,h=0;h<c;h++)if(l(e,o+h)!==l(t,h)){d=!1;break}if(d)return o}return-1}function b(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function w(e,t,n,i){return K($(t,e.length-n),e,n,i)}function k(e,t,n,i){return K(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function _(e,t,n,i){return k(e,t,n,i)}function P(e,t,n,i){return K(F(t),e,n,i)}function S(e,t,n,i){return K(function(e,t){for(var n,i,r,o=[],s=0;s<e.length&&!((t-=2)<0);++s)i=(n=e.charCodeAt(s))>>8,r=n%256,o.push(r),o.push(i);return o}(t,e.length-n),e,n,i)}function x(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var o,s,a,c,l=e[r],u=null,d=l>239?4:l>223?3:l>191?2:1;if(r+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[r+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[r+1],s=e[r+2],128==(192&o)&&128==(192&s)&&(c=(15&l)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[r+1],s=e[r+2],a=e[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",i=0;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return n}(i)}function T(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function C(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function E(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=t;o<n;++o)r+=B(e[o]);return r}function R(e,t,n){for(var i=e.slice(t,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+256*i[o+1]);return r}function A(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,i,r,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<o)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function j(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,o=Math.min(e.length-n,2);r<o;++r)e[n+r]=(t&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function L(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,o=Math.min(e.length-n,4);r<o;++r)e[n+r]=t>>>8*(i?r:3-r)&255}function N(e,t,n,i,r,o){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,i,o){return o||N(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function I(e,t,n,i,o){return o||N(e,0,n,8),r.write(e,t,n,i,52,8),n+8}t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return l(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,i){return u(t),t<=0?a(e,t):void 0!==n?"string"==typeof i?a(e,t).fill(n,i):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return d(null,e)},c.allocUnsafeSlow=function(e){return d(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,r=0,o=Math.min(n,i);r<o;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=c.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var s=e[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r),r+=s.length}return i},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?O(this,0,e):g.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,i,r){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(r>>>=0)-(i>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(i,r),u=e.slice(t,n),d=0;d<a;++d)if(l[d]!==u[d]){o=l[d],s=u[d];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},c.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return k(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return P(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(e,t){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var r=t-e;n=new c(r,void 0);for(var o=0;o<r;++o)n[o]=this[o+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var i=this[e],r=1,o=0;++o<t&&(r*=256);)i+=this[e+o]*r;return i},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},c.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var i=this[e],r=1,o=0;++o<t&&(r*=256);)i+=this[e+o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var i=t,r=1,o=this[e+--i];i>0&&(r*=256);)o+=this[e+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),r.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),r.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),r.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),r.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,i){e=+e,t|=0,n|=0,i||M(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[t]=255&e;++o<n&&(r*=256);)this[t+o]=e/r&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,i){e=+e,t|=0,n|=0,i||M(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,o=1;for(this[t+r]=255&e;--r>=0&&(o*=256);)this[t+r]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return I(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return I(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var r,o=i-n;if(this===e&&n<t&&t<i)for(r=o-1;r>=0;--r)e[r+t]=this[r+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)e[r+t]=this[r+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},c.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=c.isBuffer(e)?e:$(new c(e,i).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function B(e){return e<16?"0"+e.toString(16):e.toString(16)}function $(e,t){var n;t=t||1/0;for(var i=e.length,r=null,o=[],s=0;s<i;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,n,i){for(var r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,n(35))},function(e,t,n){var i,r,o,s,a,c=c||function(e,t){var n={},i=n.lib={},r=function(){},o=i.Base={extend:function(e){r.prototype=this;var t=new r;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var r=0;r<e;r++)t[i+r>>>2]|=(n[r>>>2]>>>24-r%4*8&255)<<24-(i+r)%4*8;else if(65535<n.length)for(r=0;r<e;r+=4)t[i+r>>>2]=n[r>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i<t;i+=4)n.push(4294967296*e.random()|0);return new s.init(n,t)}}),a=n.enc={},c=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i<e;i++){var r=t[i>>>2]>>>24-i%4*8&255;n.push((r>>>4).toString(16)),n.push((15&r).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,t/2)}},l=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i<e;i++)n.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,i=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o);if(t=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,r=e.min(4*t,r),t){for(var c=0;c<t;c+=o)this._doProcessBlock(i,c);c=i.splice(0,t),n.sigBytes-=r}return new s.init(c,r)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=d.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}});var h=n.algo={};return n}(Math);!function(e){for(var t=c,n=(r=t.lib).WordArray,i=r.Hasher,r=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},l=2,u=0;64>u;){var d;e:{d=l;for(var h=e.sqrt(d),p=2;p<=h;p++)if(!(d%p)){d=!1;break e}d=!0}d&&(8>u&&(o[u]=a(e.pow(l,.5))),s[u]=a(e.pow(l,1/3)),u++),l++}var f=[];r=r.SHA256=i.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],a=n[3],c=n[4],l=n[5],u=n[6],d=n[7],h=0;64>h;h++){if(16>h)f[h]=0|e[t+h];else{var p=f[h-15],g=f[h-2];f[h]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+f[h-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+f[h-16]}p=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+s[h]+f[h],g=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&r^i&o^r&o),d=u,u=l,l=c,c=a+p|0,a=o,o=r,r=i,i=p+g|0}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+c|0,n[5]=n[5]+l|0,n[6]=n[6]+u|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA256=i._createHelper(r),t.HmacSHA256=i._createHmacHelper(r)}(Math),r=(i=c).enc.Utf8,i.algo.HMAC=i.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,c=s.words,l=0;l<n;l++)a[l]^=1549556828,c[l]^=909522486;o.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}}),s=(o=c).lib.WordArray,o.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,i=this._map;e.clamp(),e=[];for(var r=0;r<n;r+=3)for(var o=(t[r>>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,s=0;4>s&&r+.75*s<n;s++)e.push(i.charAt(o>>>6*(3-s)&63));if(t=i.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var t=e.length,n=this._map;(i=n.charAt(64))&&-1!=(i=e.indexOf(i))&&(t=i);for(var i=[],r=0,o=0;o<t;o++)if(o%4){var a=n.indexOf(e.charAt(o-1))<<o%4*2,c=n.indexOf(e.charAt(o))>>>6-o%4*2;i[r>>>2]|=(a|c)<<24-r%4*8,r++}return s.create(i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){function t(e,t,n,i,r,o,s){return((e=e+(t&n|~t&i)+r+s)<<o|e>>>32-o)+t}function n(e,t,n,i,r,o,s){return((e=e+(t&i|n&~i)+r+s)<<o|e>>>32-o)+t}function i(e,t,n,i,r,o,s){return((e=e+(t^n^i)+r+s)<<o|e>>>32-o)+t}function r(e,t,n,i,r,o,s){return((e=e+(n^(t|~i))+r+s)<<o|e>>>32-o)+t}for(var o=c,s=(l=o.lib).WordArray,a=l.Hasher,l=o.algo,u=[],d=0;64>d;d++)u[d]=4294967296*e.abs(e.sin(d+1))|0;l=l.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,o){for(var s=0;16>s;s++){var a=e[c=o+s];e[c]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}s=this._hash.words;var c=e[o+0],l=(a=e[o+1],e[o+2]),d=e[o+3],h=e[o+4],p=e[o+5],f=e[o+6],g=e[o+7],m=e[o+8],v=e[o+9],y=e[o+10],b=e[o+11],w=e[o+12],k=e[o+13],_=e[o+14],P=e[o+15],S=t(S=s[0],T=s[1],O=s[2],x=s[3],c,7,u[0]),x=t(x,S,T,O,a,12,u[1]),O=t(O,x,S,T,l,17,u[2]),T=t(T,O,x,S,d,22,u[3]);S=t(S,T,O,x,h,7,u[4]),x=t(x,S,T,O,p,12,u[5]),O=t(O,x,S,T,f,17,u[6]),T=t(T,O,x,S,g,22,u[7]),S=t(S,T,O,x,m,7,u[8]),x=t(x,S,T,O,v,12,u[9]),O=t(O,x,S,T,y,17,u[10]),T=t(T,O,x,S,b,22,u[11]),S=t(S,T,O,x,w,7,u[12]),x=t(x,S,T,O,k,12,u[13]),O=t(O,x,S,T,_,17,u[14]),S=n(S,T=t(T,O,x,S,P,22,u[15]),O,x,a,5,u[16]),x=n(x,S,T,O,f,9,u[17]),O=n(O,x,S,T,b,14,u[18]),T=n(T,O,x,S,c,20,u[19]),S=n(S,T,O,x,p,5,u[20]),x=n(x,S,T,O,y,9,u[21]),O=n(O,x,S,T,P,14,u[22]),T=n(T,O,x,S,h,20,u[23]),S=n(S,T,O,x,v,5,u[24]),x=n(x,S,T,O,_,9,u[25]),O=n(O,x,S,T,d,14,u[26]),T=n(T,O,x,S,m,20,u[27]),S=n(S,T,O,x,k,5,u[28]),x=n(x,S,T,O,l,9,u[29]),O=n(O,x,S,T,g,14,u[30]),S=i(S,T=n(T,O,x,S,w,20,u[31]),O,x,p,4,u[32]),x=i(x,S,T,O,m,11,u[33]),O=i(O,x,S,T,b,16,u[34]),T=i(T,O,x,S,_,23,u[35]),S=i(S,T,O,x,a,4,u[36]),x=i(x,S,T,O,h,11,u[37]),O=i(O,x,S,T,g,16,u[38]),T=i(T,O,x,S,y,23,u[39]),S=i(S,T,O,x,k,4,u[40]),x=i(x,S,T,O,c,11,u[41]),O=i(O,x,S,T,d,16,u[42]),T=i(T,O,x,S,f,23,u[43]),S=i(S,T,O,x,v,4,u[44]),x=i(x,S,T,O,w,11,u[45]),O=i(O,x,S,T,P,16,u[46]),S=r(S,T=i(T,O,x,S,l,23,u[47]),O,x,c,6,u[48]),x=r(x,S,T,O,g,10,u[49]),O=r(O,x,S,T,_,15,u[50]),T=r(T,O,x,S,p,21,u[51]),S=r(S,T,O,x,w,6,u[52]),x=r(x,S,T,O,d,10,u[53]),O=r(O,x,S,T,y,15,u[54]),T=r(T,O,x,S,a,21,u[55]),S=r(S,T,O,x,m,6,u[56]),x=r(x,S,T,O,P,10,u[57]),O=r(O,x,S,T,f,15,u[58]),T=r(T,O,x,S,k,21,u[59]),S=r(S,T,O,x,h,6,u[60]),x=r(x,S,T,O,b,10,u[61]),O=r(O,x,S,T,l,15,u[62]),T=r(T,O,x,S,v,21,u[63]),s[0]=s[0]+S|0,s[1]=s[1]+T|0,s[2]=s[2]+O|0,s[3]=s[3]+x|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(i/4294967296);for(n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process(),n=(t=this._hash).words,i=0;4>i;i++)r=n[i],n[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return t},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),o.MD5=a._createHelper(l),o.HmacMD5=a._createHmacHelper(l)}(Math),function(){var e,t=c,n=(e=t.lib).Base,i=e.WordArray,r=(e=t.algo).EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:e.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=(a=this.cfg).hasher.create(),r=i.create(),o=r.words,s=a.keySize,a=a.iterations;o.length<s;){c&&n.update(c);var c=n.update(e).finalize(t);n.reset();for(var l=1;l<a;l++)c=n.finalize(c),n.reset();r.concat(c)}return r.sigBytes=4*s,r}});t.EvpKDF=function(e,t,n){return r.create(n).compute(e,t)}}(),c.lib.Cipher||function(e){var t=(f=c).lib,n=t.Base,i=t.WordArray,r=t.BufferedBlockAlgorithm,o=f.enc.Base64,s=f.algo.EvpKDF,a=t.Cipher=r.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,i){return("string"==typeof n?g:p).encrypt(e,t,n,i)},decrypt:function(t,n,i){return("string"==typeof n?g:p).decrypt(e,t,n,i)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=f.mode={},u=function(e,t,n){var i=this._iv;i?this._iv=void 0:i=this._prevBlock;for(var r=0;r<n;r++)e[t+r]^=i[r]},d=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();d.Encryptor=d.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;u.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),d.Decryptor=d.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,r=e.slice(t,t+i);n.decryptBlock(e,t),u.call(this,e,t,i),this._prevBlock=r}}),l=l.CBC=d,d=(f.pad={}).Pkcs7={pad:function(e,t){for(var n,r=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(r);n=i.create(o,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:l,padding:d}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var h=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(l=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:l}),encrypt:function(e,t,n,i){i=this.cfg.extend(i);var r=e.createEncryptor(n,i);return t=r.finalize(t),r=r.cfg,h.create({ciphertext:t,key:n,iv:r.iv,algorithm:e,mode:r.mode,padding:r.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(n,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=i.random(8)),e=s.create({keySize:t+n}).compute(e,r),n=i.create(e.words.slice(t),4*n),e.sigBytes=4*t,h.create({key:e,iv:n,salt:r})}},g=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:f}),encrypt:function(e,t,n,i){return n=(i=this.cfg.extend(i)).kdf.execute(n,e.keySize,e.ivSize),i.iv=n.iv,(e=p.encrypt.call(this,e,t,n.key,i)).mixIn(n),e},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),n=i.kdf.execute(n,e.keySize,e.ivSize,t.salt),i.iv=n.iv,p.decrypt.call(this,e,t,n.key,i)}})}(),function(){for(var e=c,t=e.lib.BlockCipher,n=e.algo,i=[],r=[],o=[],s=[],a=[],l=[],u=[],d=[],h=[],p=[],f=[],g=0;256>g;g++)f[g]=128>g?g<<1:g<<1^283;var m=0,v=0;for(g=0;256>g;g++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;i[m]=y,r[y]=m;var b=f[m],w=f[b],k=f[w],_=257*f[y]^16843008*y;o[m]=_<<24|_>>>8,s[m]=_<<16|_>>>16,a[m]=_<<8|_>>>24,l[m]=_,_=16843009*k^65537*w^257*b^16843008*m,u[y]=_<<24|_>>>8,d[y]=_<<16|_>>>16,h[y]=_<<8|_>>>24,p[y]=_,m?(m=b^f[f[f[k^b]]],v^=f[f[v]]):m=v=1}var P=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),r=this._keySchedule=[],o=0;o<n;o++)if(o<t)r[o]=e[o];else{var s=r[o-1];o%t?6<t&&4==o%t&&(s=i[s>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s]):(s=i[(s=s<<8|s>>>24)>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s],s^=P[o/t|0]<<24),r[o]=r[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<n;t++)o=n-t,s=t%4?r[o]:r[o-4],e[t]=4>t||4>=o?s:u[i[s>>>24]]^d[i[s>>>16&255]]^h[i[s>>>8&255]]^p[i[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,l,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,p,r),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,r,o,s,a){for(var c=this._nRounds,l=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],h=e[t+3]^n[3],p=4,f=1;f<c;f++){var g=i[l>>>24]^r[u>>>16&255]^o[d>>>8&255]^s[255&h]^n[p++],m=i[u>>>24]^r[d>>>16&255]^o[h>>>8&255]^s[255&l]^n[p++],v=i[d>>>24]^r[h>>>16&255]^o[l>>>8&255]^s[255&u]^n[p++];h=i[h>>>24]^r[l>>>16&255]^o[u>>>8&255]^s[255&d]^n[p++],l=g,u=m,d=v}g=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^n[p++],m=(a[u>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^n[p++],v=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^n[p++],h=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&d])^n[p++],e[t]=g,e[t+1]=m,e[t+2]=v,e[t+3]=h},keySize:8}),e.AES=t._createHelper(n)}(),c.mode.ECB=((a=c.lib.BlockCipherMode.extend()).Encryptor=a.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),a.Decryptor=a.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),a),e.exports=c},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=(n(2),i(n(10))),c=function(){function e(){(0,r.default)(this,e),(0,s.default)(this,"_listeners",void 0),this._listeners=[]}return(0,o.default)(e,[{key:"addListener",value:function(e){this._listeners.push(e)}},{key:"removeListener",value:function(e){var t=[];this._listeners.forEach((function(n){n!==e&&t.push(n)})),this._listeners=t}},{key:"removeAllListeners",value:function(){this._listeners=[]}},{key:"announcePresence",value:function(e){this._listeners.forEach((function(t){t.presence&&t.presence(e)}))}},{key:"announceStatus",value:function(e){this._listeners.forEach((function(t){t.status&&t.status(e)}))}},{key:"announceMessage",value:function(e){this._listeners.forEach((function(t){t.message&&t.message(e)}))}},{key:"announceSignal",value:function(e){this._listeners.forEach((function(t){t.signal&&t.signal(e)}))}},{key:"announceMessageAction",value:function(e){this._listeners.forEach((function(t){t.messageAction&&t.messageAction(e)}))}},{key:"announceFile",value:function(e){this._listeners.forEach((function(t){t.file&&t.file(e)}))}},{key:"announceObjects",value:function(e){this._listeners.forEach((function(t){t.objects&&t.objects(e)}))}},{key:"announceUser",value:function(e){this._listeners.forEach((function(t){t.user&&t.user(e)}))}},{key:"announceSpace",value:function(e){this._listeners.forEach((function(t){t.space&&t.space(e)}))}},{key:"announceMembership",value:function(e){this._listeners.forEach((function(t){t.membership&&t.membership(e)}))}},{key:"announceNetworkUp",value:function(){var e={};e.category=a.default.PNNetworkUpCategory,this.announceStatus(e)}},{key:"announceNetworkDown",value:function(){var e={};e.category=a.default.PNNetworkDownCategory,this.announceStatus(e)}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNTimeOperation},t.getURL=function(){return"/time/0"},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(){return{}},t.isAuthSupported=function(){return!1},t.handleResponse=function(e,t){return{timetoken:t[0]}},t.validateParams=function(){},n(2);var r=i(n(1))},function(e,t,n){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t,n){var i=n(81);e.exports=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){e.exports=function(e){return null!==e&&"object"==typeof e}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(14)),s=i(n(16)),a=i(n(13)),c=i(n(7)),l=i(n(31)),u=i(n(32)),d=i(n(121)),h=i(n(22)),p=i(n(124)),f=i(n(125)),g=n(126),m=(n(2),i(n(133))),v=i(n(134));function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=(0,a.default)(e);if(t){var r=(0,a.default)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return(0,s.default)(this,n)}}function b(e){if(!navigator||!navigator.sendBeacon)return!1;navigator.sendBeacon(e)}function w(e){for(var t=h.default.enc.Base64.parse(e).words,n=new ArrayBuffer(4*t.length),i=new Uint8Array(n),r=0,o=0,s=0;s<t.length;s+=1){var a=t[s];i[o=4*s]=(4278190080&a)>>24,i[o+1]=(16711680&a)>>16,i[o+2]=(65280&a)>>8,i[o+3]=255&a}for(var c=o+3;c>=o;c-=1)0===i[c]&&(r+=1);return r>0?i.buffer.slice(0,i.byteLength-r):i.buffer}function k(e){var t=function(e){return e&&"object"===(0,c.default)(e)&&e.constructor===Object};if(!t(e))return e;var n={};return Object.keys(e).forEach((function(i){var r=function(e){return"string"==typeof e||e instanceof String}(i),o=i,s=e[i];Array.isArray(i)||r&&i.indexOf(",")>=0?o=(r?i.split(","):i).reduce((function(e,t){return e+String.fromCharCode(t)}),""):(function(e){return"number"==typeof e&&isFinite(e)}(i)||r&&!isNaN(i))&&(o=String.fromCharCode(r?parseInt(i,10):10)),n[o]=t(s)?k(s):s})),n}var _=function(e){(0,o.default)(n,e);var t=y(n);function n(e){var i;(0,r.default)(this,n);var o=e.listenToBrowserNetworkEvents,s=void 0===o||o;return e.db=p.default,e.sdkFamily="Web",e.networking=new d.default({del:g.del,get:g.get,post:g.post,patch:g.patch,sendBeacon:b,getfile:g.getfile,postfile:g.postfile}),e.cbor=new f.default((function(e){return k(l.default.decode(e))}),w),e.PubNubFile=v.default,e.cryptography=new m.default,i=t.call(this,e),s&&(window.addEventListener("offline",(function(){i.networkDownDetected()})),window.addEventListener("online",(function(){i.networkUpDetected()}))),i}return n}(u.default);t.default=_,e.exports=t.default},function(e,t,n){var i,r,o,s,a;o=Math.pow(2,-24),s=Math.pow(2,32),a=Math.pow(2,53),void 0===(r="function"==typeof(i={encode:function(e){var t,n=new ArrayBuffer(256),i=new DataView(n),r=0;function o(e){for(var o=n.byteLength,s=r+e;o<s;)o*=2;if(o!==n.byteLength){var a=i;n=new ArrayBuffer(o),i=new DataView(n);for(var c=r+3>>2,l=0;l<c;++l)i.setUint32(4*l,a.getUint32(4*l))}return t=e,i}function c(){r+=t}function l(e){c(o(1).setUint8(r,e))}function u(e){for(var t=o(e.length),n=0;n<e.length;++n)t.setUint8(r+n,e[n]);c()}function d(e,t){t<24?l(e<<5|t):t<256?(l(e<<5|24),l(t)):t<65536?(l(e<<5|25),function(e){c(o(2).setUint16(r,e))}(t)):t<4294967296?(l(e<<5|26),function(e){c(o(4).setUint32(r,e))}(t)):(l(e<<5|27),function(e){var t=e%s,n=(e-t)/s,i=o(8);i.setUint32(r,n),i.setUint32(r+4,t),c()}(t))}if(function e(t){var n;if(!1===t)return l(244);if(!0===t)return l(245);if(null===t)return l(246);if(void 0===t)return l(247);switch(typeof t){case"number":if(Math.floor(t)===t){if(0<=t&&t<=a)return d(0,t);if(-a<=t&&t<0)return d(1,-(t+1))}return l(251),function(e){c(o(8).setFloat64(r,e))}(t);case"string":var i=[];for(n=0;n<t.length;++n){var s=t.charCodeAt(n);s<128?i.push(s):s<2048?(i.push(192|s>>6),i.push(128|63&s)):s<55296?(i.push(224|s>>12),i.push(128|s>>6&63),i.push(128|63&s)):(s=(1023&s)<<10,s|=1023&t.charCodeAt(++n),s+=65536,i.push(240|s>>18),i.push(128|s>>12&63),i.push(128|s>>6&63),i.push(128|63&s))}return d(3,i.length),u(i);default:var h;if(Array.isArray(t))for(d(4,h=t.length),n=0;n<h;++n)e(t[n]);else if(t instanceof Uint8Array)d(2,t.length),u(t);else{var p=Object.keys(t);for(d(5,h=p.length),n=0;n<h;++n){var f=p[n];e(f),e(t[f])}}}}(e),"slice"in n)return n.slice(0,r);for(var h=new ArrayBuffer(r),p=new DataView(h),f=0;f<r;++f)p.setUint8(f,i.getUint8(f));return h},decode:function(e,t,n){var i=new DataView(e),r=0;function a(e,t){return r+=t,e}function c(t){return a(new Uint8Array(e,r,t),t)}function l(){return a(i.getUint8(r),1)}function u(){return a(i.getUint16(r),2)}function d(){return a(i.getUint32(r),4)}function h(){return 255===i.getUint8(r)&&(r+=1,!0)}function p(e){if(e<24)return e;if(24===e)return l();if(25===e)return u();if(26===e)return d();if(27===e)return d()*s+d();if(31===e)return-1;throw"Invalid length encoding"}function f(e){var t=l();if(255===t)return-1;var n=p(31&t);if(n<0||t>>5!==e)throw"Invalid indefinite length element";return n}function g(e,t){for(var n=0;n<t;++n){var i=l();128&i&&(i<224?(i=(31&i)<<6|63&l(),t-=1):i<240?(i=(15&i)<<12|(63&l())<<6|63&l(),t-=2):(i=(15&i)<<18|(63&l())<<12|(63&l())<<6|63&l(),t-=3)),i<65536?e.push(i):(i-=65536,e.push(55296|i>>10),e.push(56320|1023&i))}}"function"!=typeof t&&(t=function(e){return e}),"function"!=typeof n&&(n=function(){});var m=function e(){var s,d,m=l(),v=m>>5,y=31&m;if(7===v)switch(y){case 25:return function(){var e=new ArrayBuffer(4),t=new DataView(e),n=u(),i=32768&n,r=31744&n,s=1023&n;if(31744===r)r=261120;else if(0!==r)r+=114688;else if(0!==s)return s*o;return t.setUint32(0,i<<16|r<<13|s<<13),t.getFloat32(0)}();case 26:return a(i.getFloat32(r),4);case 27:return a(i.getFloat64(r),8)}if((d=p(y))<0&&(v<2||6<v))throw"Invalid length";switch(v){case 0:return d;case 1:return-1-d;case 2:if(d<0){for(var b=[],w=0;(d=f(v))>=0;)w+=d,b.push(c(d));var k=new Uint8Array(w),_=0;for(s=0;s<b.length;++s)k.set(b[s],_),_+=b[s].length;return k}return c(d);case 3:var P=[];if(d<0)for(;(d=f(v))>=0;)g(P,d);else g(P,d);return String.fromCharCode.apply(null,P);case 4:var S;if(d<0)for(S=[];!h();)S.push(e());else for(S=new Array(d),s=0;s<d;++s)S[s]=e();return S;case 5:var x={};for(s=0;s<d||d<0&&!h();++s)x[e()]=e();return x;case 6:return t(e(),d);case 7:switch(d){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:return n(d)}}}();if(r!==e.byteLength)throw"Remaining bytes";return m}})?i.call(t,n,t,e):i)||(e.exports=r)},function(e,t,n){var i=n(33),r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(5)),s=r(n(6)),a=r(n(4)),c=r(n(8)),l=r(n(20)),u=r(n(39)),d=r(n(43)),h=r(n(44)),p=r(n(23)),f=r(n(47)),g=r(n(18)),m=n(3),v=i(n(52)),y=i(n(53)),b=i(n(54)),w=i(n(55)),k=i(n(56)),_=i(n(57)),P=i(n(58)),S=i(n(59)),x=i(n(60)),O=i(n(61)),T=i(n(62)),C=i(n(63)),E=i(n(64)),R=i(n(65)),A=i(n(66)),M=i(n(67)),j=i(n(68)),L=i(n(69)),N=(n(25),i(n(70)),r(n(71))),U=r(n(72)),I=r(n(73)),D=r(n(74)),B=r(n(76)),$=r(n(77)),F=r(n(78)),K=r(n(79)),q=r(n(82)),z=r(n(83)),H=r(n(84)),V=r(n(85)),G=r(n(86)),W=r(n(87)),Y=r(n(88)),J=r(n(89)),X=r(n(90)),Z=r(n(91)),Q=r(n(92)),ee=i(n(93)),te=i(n(94)),ne=i(n(95)),ie=i(n(96)),re=i(n(97)),oe=i(n(98)),se=i(n(99)),ae=i(n(100)),ce=i(n(101)),le=i(n(102)),ue=i(n(103)),de=i(n(104)),he=i(n(105)),pe=i(n(106)),fe=i(n(107)),ge=i(n(108)),me=i(n(109)),ve=i(n(110)),ye=i(n(111)),be=i(n(112)),we=i(n(113)),ke=i(n(114)),_e=i(n(115)),Pe=i(n(116)),Se=i(n(117)),xe=i(n(118)),Oe=i(n(119)),Te=i(n(24)),Ce=i(n(120)),Ee=r(n(1)),Re=r(n(10)),Ae=(n(2),r(n(17)));function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function je(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){(0,a.default)(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}var Le=function(){function e(t){var n=this;(0,o.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_telemetryManager",void 0),(0,a.default)(this,"_listenerManager",void 0),(0,a.default)(this,"_tokenManager",void 0),(0,a.default)(this,"time",void 0),(0,a.default)(this,"publish",void 0),(0,a.default)(this,"fire",void 0),(0,a.default)(this,"history",void 0),(0,a.default)(this,"deleteMessages",void 0),(0,a.default)(this,"messageCounts",void 0),(0,a.default)(this,"fetchMessages",void 0),(0,a.default)(this,"channelGroups",void 0),(0,a.default)(this,"push",void 0),(0,a.default)(this,"hereNow",void 0),(0,a.default)(this,"whereNow",void 0),(0,a.default)(this,"getState",void 0),(0,a.default)(this,"setState",void 0),(0,a.default)(this,"grant",void 0),(0,a.default)(this,"grantToken",void 0),(0,a.default)(this,"audit",void 0),(0,a.default)(this,"subscribe",void 0),(0,a.default)(this,"signal",void 0),(0,a.default)(this,"presence",void 0),(0,a.default)(this,"unsubscribe",void 0),(0,a.default)(this,"unsubscribeAll",void 0),(0,a.default)(this,"addMessageAction",void 0),(0,a.default)(this,"removeMessageAction",void 0),(0,a.default)(this,"getMessageActions",void 0),(0,a.default)(this,"File",void 0),(0,a.default)(this,"encryptFile",void 0),(0,a.default)(this,"decryptFile",void 0),(0,a.default)(this,"listFiles",void 0),(0,a.default)(this,"sendFile",void 0),(0,a.default)(this,"downloadFile",void 0),(0,a.default)(this,"getFileUrl",void 0),(0,a.default)(this,"deleteFile",void 0),(0,a.default)(this,"publishFile",void 0),(0,a.default)(this,"objects",void 0),(0,a.default)(this,"createUser",void 0),(0,a.default)(this,"updateUser",void 0),(0,a.default)(this,"deleteUser",void 0),(0,a.default)(this,"getUser",void 0),(0,a.default)(this,"getUsers",void 0),(0,a.default)(this,"createSpace",void 0),(0,a.default)(this,"updateSpace",void 0),(0,a.default)(this,"deleteSpace",void 0),(0,a.default)(this,"getSpaces",void 0),(0,a.default)(this,"getSpace",void 0),(0,a.default)(this,"getMembers",void 0),(0,a.default)(this,"addMembers",void 0),(0,a.default)(this,"updateMembers",void 0),(0,a.default)(this,"removeMembers",void 0),(0,a.default)(this,"getMemberships",void 0),(0,a.default)(this,"joinSpaces",void 0),(0,a.default)(this,"updateMemberships",void 0),(0,a.default)(this,"leaveSpaces",void 0),(0,a.default)(this,"disconnect",void 0),(0,a.default)(this,"reconnect",void 0),(0,a.default)(this,"destroy",void 0),(0,a.default)(this,"stop",void 0),(0,a.default)(this,"getSubscribedChannels",void 0),(0,a.default)(this,"getSubscribedChannelGroups",void 0),(0,a.default)(this,"addListener",void 0),(0,a.default)(this,"removeListener",void 0),(0,a.default)(this,"removeAllListeners",void 0),(0,a.default)(this,"parseToken",void 0),(0,a.default)(this,"setToken",void 0),(0,a.default)(this,"setTokens",void 0),(0,a.default)(this,"getToken",void 0),(0,a.default)(this,"getTokens",void 0),(0,a.default)(this,"clearTokens",void 0),(0,a.default)(this,"getAuthKey",void 0),(0,a.default)(this,"setAuthKey",void 0),(0,a.default)(this,"setCipherKey",void 0),(0,a.default)(this,"setUUID",void 0),(0,a.default)(this,"getUUID",void 0),(0,a.default)(this,"getFilterExpression",void 0),(0,a.default)(this,"setFilterExpression",void 0),(0,a.default)(this,"setHeartbeatInterval",void 0),(0,a.default)(this,"setProxy",void 0),(0,a.default)(this,"encrypt",void 0),(0,a.default)(this,"decrypt",void 0);var i=t.db,r=t.networking,s=t.cbor,h=this._config=new c.default({setup:t,db:i}),Ee=new l.default({config:h}),Re=t.cryptography;r.init(h);var Ae=this._tokenManager=new f.default(h,s),Me=this._telemetryManager=new d.default({maximumSamplesCount:6e4}),Le={config:h,networking:r,crypto:Ee,cryptography:Re,tokenManager:Ae,telemetryManager:Me,PubNubFile:t.PubNubFile};this.File=t.PubNubFile,this.encryptFile=function(e,t){return Re.encryptFile(e,t,n.File)},this.decryptFile=function(e,t){return Re.decryptFile(e,t,n.File)};var Ne=g.default.bind(this,Le,Te),Ue=g.default.bind(this,Le,O),Ie=g.default.bind(this,Le,C),De=g.default.bind(this,Le,R),Be=g.default.bind(this,Le,Ce),$e=this._listenerManager=new p.default,Fe=new u.default({timeEndpoint:Ne,leaveEndpoint:Ue,heartbeatEndpoint:Ie,setStateEndpoint:De,subscribeEndpoint:Be,crypto:Le.crypto,config:Le.config,listenerManager:$e,getFileUrl:function(e){return(0,B.default)(Le,e)}});this.addListener=$e.addListener.bind($e),this.removeListener=$e.removeListener.bind($e),this.removeAllListeners=$e.removeAllListeners.bind($e),this.parseToken=Ae.parseToken.bind(Ae),this.setToken=Ae.setToken.bind(Ae),this.setTokens=Ae.setTokens.bind(Ae),this.getToken=Ae.getToken.bind(Ae),this.getTokens=Ae.getTokens.bind(Ae),this.clearTokens=Ae.clearTokens.bind(Ae),this.channelGroups={listGroups:g.default.bind(this,Le,w),listChannels:g.default.bind(this,Le,k),addChannels:g.default.bind(this,Le,v),removeChannels:g.default.bind(this,Le,y),deleteGroup:g.default.bind(this,Le,b)},this.push={addChannels:g.default.bind(this,Le,_),removeChannels:g.default.bind(this,Le,P),deleteDevice:g.default.bind(this,Le,x),listChannels:g.default.bind(this,Le,S)},this.hereNow=g.default.bind(this,Le,A),this.whereNow=g.default.bind(this,Le,T),this.getState=g.default.bind(this,Le,E),this.setState=Fe.adaptStateChange.bind(Fe),this.grant=g.default.bind(this,Le,be),this.grantToken=g.default.bind(this,Le,we),this.audit=g.default.bind(this,Le,ye),this.publish=g.default.bind(this,Le,ke),this.fire=function(e,t){return e.replicate=!1,e.storeInHistory=!1,n.publish(e,t)},this.signal=g.default.bind(this,Le,_e),this.history=g.default.bind(this,Le,Pe),this.deleteMessages=g.default.bind(this,Le,Se),this.messageCounts=g.default.bind(this,Le,xe),this.fetchMessages=g.default.bind(this,Le,Oe),this.addMessageAction=g.default.bind(this,Le,M),this.removeMessageAction=g.default.bind(this,Le,j),this.getMessageActions=g.default.bind(this,Le,L),this.listFiles=g.default.bind(this,Le,N.default);var Ke=g.default.bind(this,Le,U.default);this.publishFile=g.default.bind(this,Le,I.default),this.sendFile=(0,D.default)({generateUploadUrl:Ke,publishFile:this.publishFile,modules:Le}),this.getFileUrl=function(e){return(0,B.default)(Le,e)},this.downloadFile=g.default.bind(this,Le,$.default),this.deleteFile=g.default.bind(this,Le,F.default),this.objects={getAllUUIDMetadata:g.default.bind(this,Le,K.default),getUUIDMetadata:g.default.bind(this,Le,q.default),setUUIDMetadata:g.default.bind(this,Le,z.default),removeUUIDMetadata:g.default.bind(this,Le,H.default),getAllChannelMetadata:g.default.bind(this,Le,V.default),getChannelMetadata:g.default.bind(this,Le,G.default),setChannelMetadata:g.default.bind(this,Le,W.default),removeChannelMetadata:g.default.bind(this,Le,Y.default),getChannelMembers:g.default.bind(this,Le,J.default),setChannelMembers:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,X.default,je({type:"set"},e)].concat(i))},removeChannelMembers:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,X.default,je({type:"delete"},e)].concat(i))},getMemberships:g.default.bind(this,Le,Z.default),setMemberships:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,Q.default,je({type:"set"},e)].concat(i))},removeMemberships:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return g.default.call.apply(g.default,[n,Le,Q.default,je({type:"delete"},e)].concat(i))}},this.createUser=(0,m.deprecated)(g.default.bind(this,Le,ee)),this.updateUser=(0,m.deprecated)(g.default.bind(this,Le,te)),this.deleteUser=(0,m.deprecated)(g.default.bind(this,Le,ne)),this.getUser=(0,m.deprecated)(g.default.bind(this,Le,ie)),this.getUsers=(0,m.deprecated)(g.default.bind(this,Le,re)),this.createSpace=(0,m.deprecated)(g.default.bind(this,Le,oe)),this.updateSpace=(0,m.deprecated)(g.default.bind(this,Le,se)),this.deleteSpace=(0,m.deprecated)(g.default.bind(this,Le,ae)),this.getSpaces=(0,m.deprecated)(g.default.bind(this,Le,ce)),this.getSpace=(0,m.deprecated)(g.default.bind(this,Le,le)),this.addMembers=(0,m.deprecated)(g.default.bind(this,Le,de)),this.updateMembers=(0,m.deprecated)(g.default.bind(this,Le,he)),this.removeMembers=(0,m.deprecated)(g.default.bind(this,Le,pe)),this.getMembers=(0,m.deprecated)(g.default.bind(this,Le,ue)),this.getMemberships=(0,m.deprecated)(g.default.bind(this,Le,fe)),this.joinSpaces=(0,m.deprecated)(g.default.bind(this,Le,me)),this.updateMemberships=(0,m.deprecated)(g.default.bind(this,Le,ge)),this.leaveSpaces=(0,m.deprecated)(g.default.bind(this,Le,ve)),this.time=Ne,this.subscribe=Fe.adaptSubscribeChange.bind(Fe),this.presence=Fe.adaptPresenceChange.bind(Fe),this.unsubscribe=Fe.adaptUnsubscribeChange.bind(Fe),this.disconnect=Fe.disconnect.bind(Fe),this.reconnect=Fe.reconnect.bind(Fe),this.destroy=function(e){Fe.unsubscribeAll(e),Fe.disconnect()},this.stop=this.destroy,this.unsubscribeAll=Fe.unsubscribeAll.bind(Fe),this.getSubscribedChannels=Fe.getSubscribedChannels.bind(Fe),this.getSubscribedChannelGroups=Fe.getSubscribedChannelGroups.bind(Fe),this.encrypt=Ee.encrypt.bind(Ee),this.decrypt=Ee.decrypt.bind(Ee),this.getAuthKey=Le.config.getAuthKey.bind(Le.config),this.setAuthKey=Le.config.setAuthKey.bind(Le.config),this.setCipherKey=Le.config.setCipherKey.bind(Le.config),this.getUUID=Le.config.getUUID.bind(Le.config),this.setUUID=Le.config.setUUID.bind(Le.config),this.getFilterExpression=Le.config.getFilterExpression.bind(Le.config),this.setFilterExpression=Le.config.setFilterExpression.bind(Le.config),this.setHeartbeatInterval=Le.config.setHeartbeatInterval.bind(Le.config),r.hasModule("proxy")&&(this.setProxy=function(e){Le.config.setProxy(e),n.reconnect()})}return(0,s.default)(e,[{key:"getVersion",value:function(){return this._config.getVersion()}},{key:"_addPnsdkSuffix",value:function(e,t){this._config._addPnsdkSuffix(e,t)}},{key:"networkDownDetected",value:function(){this._listenerManager.announceNetworkDown(),this._config.restore?this.disconnect():this.destroy(!0)}},{key:"networkUpDetected",value:function(){this._listenerManager.announceNetworkUp(),this.reconnect()}}],[{key:"notificationPayload",value:function(e,t){return new h.default(e,t)}},{key:"generateUUID",value:function(){return Ae.default.createUUID()}}]),e}();t.default=Le,(0,a.default)(Le,"OPERATIONS",Ee.default),(0,a.default)(Le,"CATEGORIES",Re.default),e.exports=t.default},function(e,t,n){var i=n(7);function r(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return r=function(){return e},e}e.exports=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var t=r();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,t&&t.set(e,n),n}},function(e,t,n){var i,r,o;/*! lil-uuid - v0.1 - MIT License - https://github.com/lil-js/uuid */r=[t],void 0===(o="function"==typeof(i=function(e){var t={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};function n(){var e,t,n="";for(e=0;e<32;e++)t=16*Math.random()|0,8!==e&&12!==e&&16!==e&&20!==e||(n+="-"),n+=(12===e?4:16===e?3&t|8:t).toString(16);return n}function i(e,n){var i=t[n||"all"];return i&&i.test(e)||!1}n.isUUID=i,n.VERSION="0.1.0",e.uuid=n,e.isUUID=i})?i.apply(t,r):i)||(e.exports=o)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){t.byteLength=function(e){var t=l(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,i=l(e),s=i[0],a=i[1],c=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),u=0,d=a>0?s-4:s;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[u++]=255&t),1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],s=0,a=n-r;s<a;s+=16383)o.push(u(e,s,s+16383>a?a:s+16383));return 1===r?(t=e[n-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"=")),o.join("")};for(var i=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)i[a]=s[a],r[s.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var r,o,s=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(i[(o=r)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,i,r){var o,s,a=8*r-i-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?r-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=i;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=l}return(p?-1:1)*s*Math.pow(2,o-i)},t.write=function(e,t,n,i,r,o){var s,a,c,l=8*o-r-1,u=(1<<l)-1,d=u>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*c-1)*Math.pow(2,r),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),s=0));r>=8;e[n+p]=255&a,p+=f,a/=256,r-=8);for(s=s<<r|a,l+=r;l>0;e[n+p]=255&s,p+=f,s/=256,l-=8);e[n+p-f]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=(i(n(20)),i(n(8)),i(n(23)),i(n(40))),l=i(n(41)),u=i(n(3)),d=(n(2),i(n(10))),h=function(){function e(t){var n=t.subscribeEndpoint,i=t.leaveEndpoint,r=t.heartbeatEndpoint,s=t.setStateEndpoint,u=t.timeEndpoint,d=t.getFileUrl,h=t.config,p=t.crypto,f=t.listenerManager;(0,o.default)(this,e),(0,a.default)(this,"_crypto",void 0),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_listenerManager",void 0),(0,a.default)(this,"_reconnectionManager",void 0),(0,a.default)(this,"_leaveEndpoint",void 0),(0,a.default)(this,"_heartbeatEndpoint",void 0),(0,a.default)(this,"_setStateEndpoint",void 0),(0,a.default)(this,"_subscribeEndpoint",void 0),(0,a.default)(this,"_getFileUrl",void 0),(0,a.default)(this,"_channels",void 0),(0,a.default)(this,"_presenceChannels",void 0),(0,a.default)(this,"_heartbeatChannels",void 0),(0,a.default)(this,"_heartbeatChannelGroups",void 0),(0,a.default)(this,"_channelGroups",void 0),(0,a.default)(this,"_presenceChannelGroups",void 0),(0,a.default)(this,"_currentTimetoken",void 0),(0,a.default)(this,"_lastTimetoken",void 0),(0,a.default)(this,"_storedTimetoken",void 0),(0,a.default)(this,"_region",void 0),(0,a.default)(this,"_subscribeCall",void 0),(0,a.default)(this,"_heartbeatTimer",void 0),(0,a.default)(this,"_subscriptionStatusAnnounced",void 0),(0,a.default)(this,"_autoNetworkDetection",void 0),(0,a.default)(this,"_isOnline",void 0),(0,a.default)(this,"_pendingChannelSubscriptions",void 0),(0,a.default)(this,"_pendingChannelGroupSubscriptions",void 0),(0,a.default)(this,"_dedupingManager",void 0),this._listenerManager=f,this._config=h,this._leaveEndpoint=i,this._heartbeatEndpoint=r,this._setStateEndpoint=s,this._subscribeEndpoint=n,this._getFileUrl=d,this._crypto=p,this._channels={},this._presenceChannels={},this._heartbeatChannels={},this._heartbeatChannelGroups={},this._channelGroups={},this._presenceChannelGroups={},this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[],this._currentTimetoken=0,this._lastTimetoken=0,this._storedTimetoken=null,this._subscriptionStatusAnnounced=!1,this._isOnline=!0,this._reconnectionManager=new c.default({timeEndpoint:u}),this._dedupingManager=new l.default({config:h})}return(0,s.default)(e,[{key:"adaptStateChange",value:function(e,t){var n=this,i=e.state,r=e.channels,o=void 0===r?[]:r,s=e.channelGroups,a=void 0===s?[]:s;return o.forEach((function(e){e in n._channels&&(n._channels[e].state=i)})),a.forEach((function(e){e in n._channelGroups&&(n._channelGroups[e].state=i)})),this._setStateEndpoint({state:i,channels:o,channelGroups:a},t)}},{key:"adaptPresenceChange",value:function(e){var t=this,n=e.connected,i=e.channels,r=void 0===i?[]:i,o=e.channelGroups,s=void 0===o?[]:o;n?(r.forEach((function(e){t._heartbeatChannels[e]={state:{}}})),s.forEach((function(e){t._heartbeatChannelGroups[e]={state:{}}}))):(r.forEach((function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]})),s.forEach((function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]})),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:r,channelGroups:s},(function(e){t._listenerManager.announceStatus(e)}))),this.reconnect()}},{key:"adaptSubscribeChange",value:function(e){var t=this,n=e.timetoken,i=e.channels,r=void 0===i?[]:i,o=e.channelGroups,s=void 0===o?[]:o,a=e.withPresence,c=void 0!==a&&a,l=e.withHeartbeats,u=void 0!==l&&l;this._config.subscribeKey&&""!==this._config.subscribeKey?(n&&(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=n),"0"!==this._currentTimetoken&&0!==this._currentTimetoken&&(this._storedTimetoken=this._currentTimetoken,this._currentTimetoken=0),r.forEach((function(e){t._channels[e]={state:{}},c&&(t._presenceChannels[e]={}),(u||t._config.getHeartbeatInterval())&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)})),s.forEach((function(e){t._channelGroups[e]={state:{}},c&&(t._presenceChannelGroups[e]={}),(u||t._config.getHeartbeatInterval())&&(t._heartbeatChannelGroups[e]={}),t._pendingChannelGroupSubscriptions.push(e)})),this._subscriptionStatusAnnounced=!1,this.reconnect()):console&&console.log&&console.log("subscribe key missing; aborting subscribe")}},{key:"adaptUnsubscribeChange",value:function(e,t){var n=this,i=e.channels,r=void 0===i?[]:i,o=e.channelGroups,s=void 0===o?[]:o,a=[],c=[];r.forEach((function(e){e in n._channels&&(delete n._channels[e],a.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],a.push(e))})),s.forEach((function(e){e in n._channelGroups&&(delete n._channelGroups[e],c.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._channelGroups[e],c.push(e))})),0===a.length&&0===c.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:a,channelGroups:c},(function(e){e.affectedChannels=a,e.affectedChannelGroups=c,e.currentTimetoken=n._currentTimetoken,e.lastTimetoken=n._lastTimetoken,n._listenerManager.announceStatus(e)})),0===Object.keys(this._channels).length&&0===Object.keys(this._presenceChannels).length&&0===Object.keys(this._channelGroups).length&&0===Object.keys(this._presenceChannelGroups).length&&(this._lastTimetoken=0,this._currentTimetoken=0,this._storedTimetoken=null,this._region=null,this._reconnectionManager.stopPolling()),this.reconnect())}},{key:"unsubscribeAll",value:function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)}},{key:"getHeartbeatChannels",value:function(){return Object.keys(this._heartbeatChannels)}},{key:"getHeartbeatChannelGroups",value:function(){return Object.keys(this._heartbeatChannelGroups)}},{key:"getSubscribedChannels",value:function(){return Object.keys(this._channels)}},{key:"getSubscribedChannelGroups",value:function(){return Object.keys(this._channelGroups)}},{key:"reconnect",value:function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()}},{key:"disconnect",value:function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()}},{key:"_registerHeartbeatTimer",value:function(){this._stopHeartbeatTimer(),0!==this._config.getHeartbeatInterval()&&void 0!==this._config.getHeartbeatInterval()&&(this._performHeartbeatLoop(),this._heartbeatTimer=setInterval(this._performHeartbeatLoop.bind(this),1e3*this._config.getHeartbeatInterval()))}},{key:"_stopHeartbeatTimer",value:function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)}},{key:"_performHeartbeatLoop",value:function(){var e=this,t=this.getHeartbeatChannels(),n=this.getHeartbeatChannelGroups(),i={};0===t.length&&0===n.length||(this.getSubscribedChannels().forEach((function(t){var n=e._channels[t].state;Object.keys(n).length&&(i[t]=n)})),this.getSubscribedChannelGroups().forEach((function(t){var n=e._channelGroups[t].state;Object.keys(n).length&&(i[t]=n)})),this._heartbeatEndpoint({channels:t,channelGroups:n,state:i},function(t){t.error&&e._config.announceFailedHeartbeats&&e._listenerManager.announceStatus(t),t.error&&e._config.autoNetworkDetection&&e._isOnline&&(e._isOnline=!1,e.disconnect(),e._listenerManager.announceNetworkDown(),e.reconnect()),!t.error&&e._config.announceSuccessfulHeartbeats&&e._listenerManager.announceStatus(t)}.bind(this)))}},{key:"_startSubscribeLoop",value:function(){var e=this;this._stopSubscribeLoop();var t={},n=[],i=[];if(Object.keys(this._channels).forEach((function(i){var r=e._channels[i].state;Object.keys(r).length&&(t[i]=r),n.push(i)})),Object.keys(this._presenceChannels).forEach((function(e){n.push("".concat(e,"-pnpres"))})),Object.keys(this._channelGroups).forEach((function(n){var r=e._channelGroups[n].state;Object.keys(r).length&&(t[n]=r),i.push(n)})),Object.keys(this._presenceChannelGroups).forEach((function(e){i.push("".concat(e,"-pnpres"))})),0!==n.length||0!==i.length){var r={channels:n,channelGroups:i,state:t,timetoken:this._currentTimetoken,filterExpression:this._config.filterExpression,region:this._region};this._subscribeCall=this._subscribeEndpoint(r,this._processSubscribeResponse.bind(this))}}},{key:"_processSubscribeResponse",value:function(e,t){var n=this;if(e.error)e.category===d.default.PNTimeoutCategory?this._startSubscribeLoop():e.category===d.default.PNNetworkIssuesCategory?(this.disconnect(),e.error&&this._config.autoNetworkDetection&&this._isOnline&&(this._isOnline=!1,this._listenerManager.announceNetworkDown()),this._reconnectionManager.onReconnection((function(){n._config.autoNetworkDetection&&!n._isOnline&&(n._isOnline=!0,n._listenerManager.announceNetworkUp()),n.reconnect(),n._subscriptionStatusAnnounced=!0;var t={category:d.default.PNReconnectedCategory,operation:e.operation,lastTimetoken:n._lastTimetoken,currentTimetoken:n._currentTimetoken};n._listenerManager.announceStatus(t)})),this._reconnectionManager.startPolling(),this._listenerManager.announceStatus(e)):e.category===d.default.PNBadRequestCategory?(this._stopHeartbeatTimer(),this._listenerManager.announceStatus(e)):this._listenerManager.announceStatus(e);else{if(this._storedTimetoken?(this._currentTimetoken=this._storedTimetoken,this._storedTimetoken=null):(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=t.metadata.timetoken),!this._subscriptionStatusAnnounced){var i={};i.category=d.default.PNConnectedCategory,i.operation=e.operation,i.affectedChannels=this._pendingChannelSubscriptions,i.subscribedChannels=this.getSubscribedChannels(),i.affectedChannelGroups=this._pendingChannelGroupSubscriptions,i.lastTimetoken=this._lastTimetoken,i.currentTimetoken=this._currentTimetoken,this._subscriptionStatusAnnounced=!0,this._listenerManager.announceStatus(i),this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[]}var o=t.messages||[],s=this._config,a=s.requestMessageCountThreshold,c=s.dedupeOnSubscribe;if(a&&o.length>=a){var l={};l.category=d.default.PNRequestMessageCountExceededCategory,l.operation=e.operation,this._listenerManager.announceStatus(l)}o.forEach((function(e){var t=e.channel,i=e.subscriptionMatch,o=e.publishMetaData;if(t===i&&(i=null),c){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(u.default.endsWith(e.channel,"-pnpres")){var s={channel:null,subscription:null};s.actualChannel=null!=i?t:null,s.subscribedChannel=null!=i?i:t,t&&(s.channel=t.substring(0,t.lastIndexOf("-pnpres"))),i&&(s.subscription=i.substring(0,i.lastIndexOf("-pnpres"))),s.action=e.payload.action,s.state=e.payload.data,s.timetoken=o.publishTimetoken,s.occupancy=e.payload.occupancy,s.uuid=e.payload.uuid,s.timestamp=e.payload.timestamp,e.payload.join&&(s.join=e.payload.join),e.payload.leave&&(s.leave=e.payload.leave),e.payload.timeout&&(s.timeout=e.payload.timeout),n._listenerManager.announcePresence(s)}else if(1===e.messageType){var a={channel:null,subscription:null};a.channel=t,a.subscription=i,a.timetoken=o.publishTimetoken,a.publisher=e.issuingClientId,e.userMetadata&&(a.userMetadata=e.userMetadata),a.message=e.payload,n._listenerManager.announceSignal(a)}else if(2===e.messageType){var l={channel:null,subscription:null};l.channel=t,l.subscription=i,l.timetoken=o.publishTimetoken,l.publisher=e.issuingClientId,e.userMetadata&&(l.userMetadata=e.userMetadata),l.message={event:e.payload.event,type:e.payload.type,data:e.payload.data},n._listenerManager.announceObjects(l),"user"===e.payload.type?n._listenerManager.announceUser(l):"space"===e.payload.type?n._listenerManager.announceSpace(l):"membership"===e.payload.type&&n._listenerManager.announceMembership(l)}else if(3===e.messageType){var d={};d.channel=t,d.subscription=i,d.timetoken=o.publishTimetoken,d.publisher=e.issuingClientId,d.data={messageTimetoken:e.payload.data.messageTimetoken,actionTimetoken:e.payload.data.actionTimetoken,type:e.payload.data.type,uuid:e.issuingClientId,value:e.payload.data.value},d.event=e.payload.event,n._listenerManager.announceMessageAction(d)}else if(4===e.messageType){var h={};h.channel=t,h.subscription=i,h.timetoken=o.publishTimetoken,h.publisher=e.issuingClientId;var p=e.payload;if(n._config.cipherKey){var f=n._crypto.decrypt(e.payload);"object"===(0,r.default)(f)&&null!==f&&(p=f)}e.userMetadata&&(h.userMetadata=e.userMetadata),h.message=p.message,h.file={id:p.file.id,name:p.file.name,url:n._getFileUrl({id:p.file.id,name:p.file.name,channel:t})},n._listenerManager.announceFile(h)}else{var g={channel:null,subscription:null};g.actualChannel=null!=i?t:null,g.subscribedChannel=null!=i?i:t,g.channel=t,g.subscription=i,g.timetoken=o.publishTimetoken,g.publisher=e.issuingClientId,e.userMetadata&&(g.userMetadata=e.userMetadata),n._config.cipherKey?g.message=n._crypto.decrypt(e.payload):g.message=e.payload,n._listenerManager.announceMessage(g)}})),this._region=t.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=h,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=(i(n(24)),n(2),function(){function e(t){var n=t.timeEndpoint;(0,r.default)(this,e),(0,s.default)(this,"_reconnectionCallback",void 0),(0,s.default)(this,"_timeEndpoint",void 0),(0,s.default)(this,"_timeTimer",void 0),this._timeEndpoint=n}return(0,o.default)(e,[{key:"onReconnection",value:function(e){this._reconnectionCallback=e}},{key:"startPolling",value:function(){this._timeTimer=setInterval(this._performTimeLoop.bind(this),3e3)}},{key:"stopPolling",value:function(){clearInterval(this._timeTimer)}},{key:"_performTimeLoop",value:function(){var e=this;this._timeEndpoint((function(t){t.error||(clearInterval(e._timeTimer),e._reconnectionCallback())}))}}]),e}());t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=(i(n(8)),n(2),function(){function e(t){var n=t.config;(0,r.default)(this,e),(0,s.default)(this,"_config",void 0),(0,s.default)(this,"hashHistory",void 0),this.hashHistory=[],this._config=n}return(0,o.default)(e,[{key:"getKey",value:function(e){var t=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}(JSON.stringify(e.payload)).toString(),n=e.publishMetaData.publishTimetoken;return"".concat(n,"-").concat(t)}},{key:"isDuplicate",value:function(e){return this.hashHistory.includes(this.getKey(e))}},{key:"addEntry",value:function(e){this.hashHistory.length>=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}());t.default=a,e.exports=t.default},function(e,t){var n,i,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c,l=[],u=!1,d=-1;function h(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&p())}function p(){if(!u){var e=a(h);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||u||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(5)),o=i(n(6)),s=i(n(4)),a=i(n(1)),c=function(){function e(t){(0,r.default)(this,e),(0,s.default)(this,"_maximumSamplesCount",100),(0,s.default)(this,"_trackedLatencies",{}),(0,s.default)(this,"_latencies",{}),this._maximumSamplesCount=t.maximumSamplesCount||this._maximumSamplesCount}return(0,o.default)(e,[{key:"operationsLatencyForRequest",value:function(){var e=this,t={};return Object.keys(this._latencies).forEach((function(n){var i=e._latencies[n],r=e._averageLatency(i);r>0&&(t["l_".concat(n)]=r)})),t}},{key:"startLatencyMeasure",value:function(e,t){e!==a.default.PNSubscribeOperation&&t&&(this._trackedLatencies[t]=Date.now())}},{key:"stopLatencyMeasure",value:function(e,t){if(e!==a.default.PNSubscribeOperation&&t){var n=this._endpointName(e),i=this._latencies[n],r=this._trackedLatencies[t];i||(i=this._latencies[n]=[]),i.push(Date.now()-r),i.length>this._maximumSamplesCount&&i.splice(0,i.length-this._maximumSamplesCount),delete this._trackedLatencies[t]}}},{key:"_averageLatency",value:function(e){return Math.floor(e.reduce((function(e,t){return e+t}),0)/e.length)}},{key:"_endpointName",value:function(e){var t=null;switch(e){case a.default.PNPublishOperation:t="pub";break;case a.default.PNSignalOperation:t="sig";break;case a.default.PNHistoryOperation:case a.default.PNFetchMessagesOperation:case a.default.PNDeleteMessagesOperation:case a.default.PNMessageCounts:t="hist";break;case a.default.PNUnsubscribeOperation:case a.default.PNWhereNowOperation:case a.default.PNHereNowOperation:case a.default.PNHeartbeatOperation:case a.default.PNSetStateOperation:case a.default.PNGetStateOperation:t="pres";break;case a.default.PNAddChannelsToGroupOperation:case a.default.PNRemoveChannelsFromGroupOperation:case a.default.PNChannelGroupsOperation:case a.default.PNRemoveGroupOperation:case a.default.PNChannelsForGroupOperation:t="cg";break;case a.default.PNPushNotificationEnabledChannelsOperation:case a.default.PNRemoveAllPushNotificationsOperation:t="push";break;case a.default.PNCreateUserOperation:case a.default.PNUpdateUserOperation:case a.default.PNDeleteUserOperation:case a.default.PNGetUserOperation:case a.default.PNGetUsersOperation:case a.default.PNCreateSpaceOperation:case a.default.PNUpdateSpaceOperation:case a.default.PNDeleteSpaceOperation:case a.default.PNGetSpaceOperation:case a.default.PNGetSpacesOperation:case a.default.PNGetMembersOperation:case a.default.PNUpdateMembersOperation:case a.default.PNGetMembershipsOperation:case a.default.PNUpdateMembershipsOperation:t="obj";break;case a.default.PNAddMessageActionOperation:case a.default.PNRemoveMessageActionOperation:case a.default.PNGetMessageActionsOperation:t="msga";break;case a.default.PNAccessManagerGrant:case a.default.PNAccessManagerAudit:t="pam";break;case a.default.PNAccessManagerGrantToken:t="pam3";break;default:t="time"}return t}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.FCMNotificationPayload=t.MPNSNotificationPayload=t.APNSNotificationPayload=void 0;var r=i(n(45)),o=i(n(19)),s=i(n(14)),a=i(n(16)),c=i(n(13)),l=i(n(5)),u=i(n(6)),d=i(n(4));function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){(0,d.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return(0,a.default)(this,n)}}n(2);var g=function(){function e(t,n,i){(0,l.default)(this,e),(0,d.default)(this,"_subtitle",void 0),(0,d.default)(this,"_payload",void 0),(0,d.default)(this,"_badge",void 0),(0,d.default)(this,"_sound",void 0),(0,d.default)(this,"_title",void 0),(0,d.default)(this,"_body",void 0),this._payload=t,this._setDefaultPayloadStructure(),this.title=n,this.body=i}return(0,u.default)(e,[{key:"payload",get:function(){return this._payload}},{key:"title",set:function(e){this._title=e}},{key:"subtitle",set:function(e){this._subtitle=e}},{key:"body",set:function(e){this._body=e}},{key:"badge",set:function(e){this._badge=e}},{key:"sound",set:function(e){this._sound=e}}]),(0,u.default)(e,[{key:"_setDefaultPayloadStructure",value:function(){}},{key:"toObject",value:function(){return{}}}]),e}(),m=function(e){(0,s.default)(n,e);var t=f(n);function n(){var e;(0,l.default)(this,n);for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return e=t.call.apply(t,[this].concat(r)),(0,d.default)((0,o.default)(e),"_configurations",void 0),(0,d.default)((0,o.default)(e),"_apnsPushType",void 0),(0,d.default)((0,o.default)(e),"_isSilent",void 0),e}return(0,u.default)(n,[{key:"_setDefaultPayloadStructure",value:function(){this._payload.aps={alert:{}}}},{key:"toObject",value:function(){var e=this,t=p({},this._payload),n=t.aps,i=n.alert;if(this._isSilent&&(n["content-available"]=1),"apns2"===this._apnsPushType){if(!this._configurations||!this._configurations.length)throw new ReferenceError("APNS2 configuration is missing");var r=[];this._configurations.forEach((function(t){r.push(e._objectFromAPNS2Configuration(t))})),r.length&&(t.pn_push=r)}return i&&Object.keys(i).length||delete n.alert,this._isSilent&&(delete n.alert,delete n.badge,delete n.sound,i={}),this._isSilent||Object.keys(i).length?t:null}},{key:"_objectFromAPNS2Configuration",value:function(e){var t=this;if(!e.targets||!e.targets.length)throw new ReferenceError("At least one APNS2 target should be provided");var n=[];e.targets.forEach((function(e){n.push(t._objectFromAPNSTarget(e))}));var i=e.collapseId,r=e.expirationDate,o={auth_method:"token",targets:n,version:"v2"};return i&&i.length&&(o.collapse_id=i),r&&(o.expiration=r.toISOString()),o}},{key:"_objectFromAPNSTarget",value:function(e){if(!e.topic||!e.topic.length)throw new TypeError("Target 'topic' undefined.");var t=e.topic,n=e.environment,i=void 0===n?"development":n,r=e.excludedDevices,o=void 0===r?[]:r,s={topic:t,environment:i};return o.length&&(s.excluded_devices=o),s}},{key:"configurations",set:function(e){e&&e.length&&(this._configurations=e)}},{key:"notification",get:function(){return this._payload.aps}},{key:"title",get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.aps.alert.title=e,this._title=e)}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){e&&e.length&&(this._payload.aps.alert.subtitle=e,this._subtitle=e)}},{key:"body",get:function(){return this._body},set:function(e){e&&e.length&&(this._payload.aps.alert.body=e,this._body=e)}},{key:"badge",get:function(){return this._badge},set:function(e){null!=e&&(this._payload.aps.badge=e,this._badge=e)}},{key:"sound",get:function(){return this._sound},set:function(e){e&&e.length&&(this._payload.aps.sound=e,this._sound=e)}},{key:"silent",set:function(e){this._isSilent=e}}]),n}(g);t.APNSNotificationPayload=m;var v=function(e){(0,s.default)(n,e);var t=f(n);function n(){var e;(0,l.default)(this,n);for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return e=t.call.apply(t,[this].concat(r)),(0,d.default)((0,o.default)(e),"_backContent",void 0),(0,d.default)((0,o.default)(e),"_backTitle",void 0),(0,d.default)((0,o.default)(e),"_count",void 0),(0,d.default)((0,o.default)(e),"_type",void 0),e}return(0,u.default)(n,[{key:"toObject",value:function(){return Object.keys(this._payload).length?p({},this._payload):null}},{key:"backContent",get:function(){return this._backContent},set:function(e){e&&e.length&&(this._payload.back_content=e,this._backContent=e)}},{key:"backTitle",get:function(){return this._backTitle},set:function(e){e&&e.length&&(this._payload.back_title=e,this._backTitle=e)}},{key:"count",get:function(){return this._count},set:function(e){null!=e&&(this._payload.count=e,this._count=e)}},{key:"title",get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.title=e,this._title=e)}},{key:"type",get:function(){return this._type},set:function(e){e&&e.length&&(this._payload.type=e,this._type=e)}},{key:"subtitle",get:function(){return this.backTitle},set:function(e){this.backTitle=e}},{key:"body",get:function(){return this.backContent},set:function(e){this.backContent=e}},{key:"badge",get:function(){return this.count},set:function(e){this.count=e}}]),n}(g);t.MPNSNotificationPayload=v;var y=function(e){(0,s.default)(n,e);var t=f(n);function n(){var e;(0,l.default)(this,n);for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return e=t.call.apply(t,[this].concat(r)),(0,d.default)((0,o.default)(e),"_isSilent",void 0),(0,d.default)((0,o.default)(e),"_icon",void 0),(0,d.default)((0,o.default)(e),"_tag",void 0),e}return(0,u.default)(n,[{key:"_setDefaultPayloadStructure",value:function(){this._payload.notification={},this._payload.data={}}},{key:"toObject",value:function(){var e=p({},this._payload.data),t=null,n={};if(Object.keys(this._payload).length>2){var i=this._payload,o=(i.notification,i.data,(0,r.default)(i,["notification","data"]));e=p(p({},e),o)}return this._isSilent?e.notification=this._payload.notification:t=this._payload.notification,Object.keys(e).length&&(n.data=e),t&&Object.keys(t).length&&(n.notification=t),Object.keys(n).length?n:null}},{key:"notification",get:function(){return this._payload.notification}},{key:"data",get:function(){return this._payload.data}},{key:"title",get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.notification.title=e,this._title=e)}},{key:"body",get:function(){return this._body},set:function(e){e&&e.length&&(this._payload.notification.body=e,this._body=e)}},{key:"sound",get:function(){return this._sound},set:function(e){e&&e.length&&(this._payload.notification.sound=e,this._sound=e)}},{key:"icon",get:function(){return this._icon},set:function(e){e&&e.length&&(this._payload.notification.icon=e,this._icon=e)}},{key:"tag",get:function(){return this._tag},set:function(e){e&&e.length&&(this._payload.notification.tag=e,this._tag=e)}},{key:"silent",set:function(e){this._isSilent=e}}]),n}(g);t.FCMNotificationPayload=y;var b=function(){function e(t,n){(0,l.default)(this,e),(0,d.default)(this,"_payload",void 0),(0,d.default)(this,"_debugging",void 0),(0,d.default)(this,"_subtitle",void 0),(0,d.default)(this,"_badge",void 0),(0,d.default)(this,"_sound",void 0),(0,d.default)(this,"_title",void 0),(0,d.default)(this,"_body",void 0),(0,d.default)(this,"apns",void 0),(0,d.default)(this,"mpns",void 0),(0,d.default)(this,"fcm",void 0),this._payload={apns:{},mpns:{},fcm:{}},this._title=t,this._body=n,this.apns=new m(this._payload.apns,t,n),this.mpns=new v(this._payload.mpns,t,n),this.fcm=new y(this._payload.fcm,t,n)}return(0,u.default)(e,[{key:"debugging",set:function(e){this._debugging=e}},{key:"title",get:function(){return this._title}},{key:"body",get:function(){return this._body}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){this._subtitle=e,this.apns.subtitle=e,this.mpns.subtitle=e,this.fcm.subtitle=e}},{key:"badge",get:function(){return this._badge},set:function(e){this._badge=e,this.apns.badge=e,this.mpns.badge=e,this.fcm.badge=e}},{key:"sound",get:function(){return this._sound},set:function(e){this._sound=e,this.apns.sound=e,this.mpns.sound=e,this.fcm.sound=e}}]),(0,u.default)(e,[{key:"buildPayload",value:function(e){var t={};if(e.includes("apns")||e.includes("apns2")){this.apns._apnsPushType=e.includes("apns")?"apns":"apns2";var n=this.apns.toObject();n&&Object.keys(n).length&&(t.pn_apns=n)}if(e.includes("mpns")){var i=this.mpns.toObject();i&&Object.keys(i).length&&(t.pn_mpns=i)}if(e.includes("fcm")){var r=this.fcm.toObject();r&&Object.keys(r).length&&(t.pn_gcm=r)}return Object.keys(t).length&&this._debugging&&(t.pn_debug=!0),t}}]),e}();t.default=b},function(e,t,n){var i=n(46);e.exports=function(e,t){if(null==e)return{};var n,r,o=i(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=(i(n(8)),n(2),function(){function e(t,n){(0,o.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_cbor",void 0),(0,a.default)(this,"_userTokens",void 0),(0,a.default)(this,"_spaceTokens",void 0),(0,a.default)(this,"_userToken",void 0),(0,a.default)(this,"_spaceToken",void 0),this._config=t,this._cbor=n,this._initializeTokens()}return(0,s.default)(e,[{key:"_initializeTokens",value:function(){this._userTokens={},this._spaceTokens={},this._userToken=void 0,this._spaceToken=void 0}},{key:"_setToken",value:function(e){var t=this,n=this.parseToken(e);n&&n.resources&&(n.resources.users&&Object.keys(n.resources.users).forEach((function(n){t._userTokens[n]=e})),n.resources.spaces&&Object.keys(n.resources.spaces).forEach((function(n){t._spaceTokens[n]=e}))),n&&n.patterns&&(n.patterns.users&&Object.keys(n.patterns.users).length>0&&(this._userToken=e),n.patterns.spaces&&Object.keys(n.patterns.spaces).length>0&&(this._spaceToken=e))}},{key:"setToken",value:function(e){e&&e.length>0&&this._setToken(e)}},{key:"setTokens",value:function(e){var t=this;e&&e.length&&"object"===(0,r.default)(e)&&e.forEach((function(e){t.setToken(e)}))}},{key:"getTokens",value:function(e){var t=this,n={users:{},spaces:{}};return e?(e.user&&(n.user=this._userToken),e.space&&(n.space=this._spaceToken),e.users&&e.users.forEach((function(e){n.users[e]=t._userTokens[e]})),e.space&&e.spaces.forEach((function(e){n.spaces[e]=t._spaceTokens[e]}))):(this._userToken&&(n.user=this._userToken),this._spaceToken&&(n.space=this._spaceToken),Object.keys(this._userTokens).forEach((function(e){n.users[e]=t._userTokens[e]})),Object.keys(this._spaceTokens).forEach((function(e){n.spaces[e]=t._spaceTokens[e]}))),n}},{key:"getToken",value:function(e,t){var n;return t?"user"===e?n=this._userTokens[t]:"space"===e&&(n=this._spaceTokens[t]):"user"===e?n=this._userToken:"space"===e&&(n=this._spaceToken),n}},{key:"extractPermissions",value:function(e){var t={create:!1,read:!1,write:!1,manage:!1,delete:!1};return 16==(16&e)&&(t.create=!0),8==(8&e)&&(t.delete=!0),4==(4&e)&&(t.manage=!0),2==(2&e)&&(t.write=!0),1==(1&e)&&(t.read=!0),t}},{key:"parseToken",value:function(e){var t=this,n=this._cbor.decodeToken(e);if(void 0!==n){var i=Object.keys(n.res.usr),r=Object.keys(n.res.spc),o=Object.keys(n.pat.usr),s=Object.keys(n.pat.spc),a={version:n.v,timestamp:n.t,ttl:n.ttl},c=i.length>0,l=r.length>0;(c||l)&&(a.resources={},c&&(a.resources.users={},i.forEach((function(e){a.resources.users[e]=t.extractPermissions(n.res.usr[e])}))),l&&(a.resources.spaces={},r.forEach((function(e){a.resources.spaces[e]=t.extractPermissions(n.res.spc[e])}))));var u=o.length>0,d=s.length>0;return(u||d)&&(a.patterns={},u&&(a.patterns.users={},o.forEach((function(e){a.patterns.users[e]=t.extractPermissions(n.pat.usr[e])}))),d&&(a.patterns.spaces={},s.forEach((function(e){a.patterns.spaces[e]=t.extractPermissions(n.pat.spc[e])})))),Object.keys(n.meta).length>0&&(a.meta=n.meta),a.signature=n.sig,a}}},{key:"clearTokens",value:function(){this._initializeTokens()}}]),e}());t.default=c,e.exports=t.default},function(e,t,n){var i=n(13),r=n(15),o=n(49),s=n(50);function a(t){var n="function"==typeof Map?new Map:void 0;return e.exports=a=function(e){if(null===e||!o(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return s(e,arguments,i(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r(t,e)},a(t)}e.exports=a},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}},function(e,t,n){var i=n(15),r=n(51);function o(t,n,s){return r()?e.exports=o=Reflect.construct:e.exports=o=function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o},o.apply(null,arguments)}e.exports=o},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAddChannelsToGroupOperation},t.validateParams=function(e,t){var n=t.channels,i=t.channelGroup,r=e.config;return i?n&&0!==n.length?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveChannelsFromGroupOperation},t.validateParams=function(e,t){var n=t.channels,i=t.channelGroup,r=e.config;return i?n&&0!==n.length?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveGroupOperation},t.validateParams=function(e,t){var n=t.channelGroup,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n),"/remove")},t.isAuthSupported=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(){return{}},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNChannelGroupsOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e){var t=e.config;return"/v1/channel-registration/sub-key/".concat(t.subscribeKey,"/channel-group")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{groups:t.payload.groups}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNChannelsForGroupOperation},t.validateParams=function(e,t){var n=t.channelGroup,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},t.getURL=function(e,t){var n=t.channelGroup,i=e.config;return"/v1/channel-registration/sub-key/".concat(i.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{channels:t.payload.channels}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.channels,o=t.topic,s=e.config;return n?i?"apns2"!==i||o?r&&0!==r.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.channels,r=void 0===i?[]:i,o=t.environment,s=void 0===o?"development":o,a=t.topic,c={type:n,add:r.join(",")};return"apns2"===n&&delete(c=Object.assign({},c,{environment:s,topic:a})).type,c},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.channels,o=t.topic,s=e.config;return n?i?"apns2"!==i||o?r&&0!==r.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.channels,r=void 0===i?[]:i,o=t.environment,s=void 0===o?"development":o,a=t.topic,c={type:n,remove:r.join(",")};return"apns2"===n&&delete(c=Object.assign({},c,{environment:s,topic:a})).type,c},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNPushNotificationEnabledChannelsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.topic,o=e.config;return n?i?"apns2"!==i||r?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.environment,r=void 0===i?"development":i,o=t.topic,s={type:n};return"apns2"===n&&delete(s=Object.assign({},s,{environment:r,topic:o})).type,s},t.handleResponse=function(e,t){return{channels:t}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveAllPushNotificationsOperation},t.validateParams=function(e,t){var n=t.device,i=t.pushGateway,r=t.topic,o=e.config;return n?i?"apns2"!==i||r?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},t.getURL=function(e,t){var n=t.device,i=t.pushGateway,r=e.config;return"apns2"===i?"/v2/push/sub-key/".concat(r.subscribeKey,"/devices-apns2/").concat(n,"/remove"):"/v1/push/sub-key/".concat(r.subscribeKey,"/devices/").concat(n,"/remove")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,i=t.environment,r=void 0===i?"development":i,o=t.topic,s={type:n};return"apns2"===n&&delete(s=Object.assign({},s,{environment:r,topic:o})).type,s},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUnsubscribeOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/leave")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r={};return i.length>0&&(r["channel-group"]=i.join(",")),r},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNWhereNowOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.uuid,r=void 0===i?n.UUID:i;return"/v2/presence/sub-key/".concat(n.subscribeKey,"/uuid/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return t.payload?{channels:t.payload.channels}:{channels:[]}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNHeartbeatOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/heartbeat")},t.isAuthSupported=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r=t.state,o=void 0===r?{}:r,s=e.config,a={};return i.length>0&&(a["channel-group"]=i.join(",")),a.state=JSON.stringify(o),a.heartbeat=s.getPresenceTimeout(),a},t.handleResponse=function(){return{}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetStateOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.uuid,r=void 0===i?n.UUID:i,s=t.channels,a=void 0===s?[]:s,c=a.length>0?a.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(c),"/uuid/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r={};return i.length>0&&(r["channel-group"]=i.join(",")),r},t.handleResponse=function(e,t,n){var i=n.channels,r=void 0===i?[]:i,o=n.channelGroups,s=void 0===o?[]:o,a={};return 1===r.length&&0===s.length?a[r[0]]=t.payload:a=t.payload,{channels:a}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNSetStateOperation},t.validateParams=function(e,t){var n=e.config,i=t.state,r=t.channels,o=void 0===r?[]:r,s=t.channelGroups,a=void 0===s?[]:s;return i?n.subscribeKey?0===o.length&&0===a.length?"Please provide a list of channels and/or channel-groups":void 0:"Missing Subscribe Key":"Missing State"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/uuid/").concat(n.UUID,"/data")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.state,i=t.channelGroups,r=void 0===i?[]:i,o={};return o.state=JSON.stringify(n),r.length>0&&(o["channel-group"]=r.join(",")),o},t.handleResponse=function(e,t){return{state:t.payload}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNHereNowOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,o=t.channelGroups,a=void 0===o?[]:o,c="/v2/presence/sub-key/".concat(n.subscribeKey);if(r.length>0||a.length>0){var l=r.length>0?r.join(","):",";c+="/channel/".concat(s.default.encodeString(l))}return c},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,i=void 0===n?[]:n,r=t.includeUUIDs,o=void 0===r||r,s=t.includeState,a=void 0!==s&&s,l=t.queryParameters,u=void 0===l?{}:l,d={};return o||(d.disable_uuids=1),a&&(d.state=1),i.length>0&&(d["channel-group"]=i.join(",")),c(c({},d),u)},t.handleResponse=function(e,t,n){var i=n.channels,r=void 0===i?[]:i,o=n.channelGroups,s=void 0===o?[]:o,a=n.includeUUIDs,c=void 0===a||a,l=n.includeState,u=void 0!==l&&l;return r.length>1||s.length>0||0===s.length&&0===r.length?function(){var e={};return e.totalChannels=t.payload.total_channels,e.totalOccupancy=t.payload.total_occupancy,e.channels={},Object.keys(t.payload.channels).forEach((function(n){var i=t.payload.channels[n],r=[];return e.channels[n]={occupants:r,name:n,occupancy:i.occupancy},c&&i.uuids.forEach((function(e){u?r.push({state:e.state,uuid:e.uuid}):r.push({state:null,uuid:e})})),e})),e}():function(){var e={},n=[];return e.totalChannels=1,e.totalOccupancy=t.occupancy,e.channels={},e.channels[r[0]]={occupants:n,name:r[0],occupancy:t.occupancy},c&&t.uuids&&t.uuids.forEach((function(e){u?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})})),e}()};var r=i(n(4)),o=(n(2),i(n(1))),s=i(n(3));function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){(0,r.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAddMessageActionOperation},t.validateParams=function(e,t){var n=e.config,i=t.action,r=t.channel;return t.messageTimetoken?n.subscribeKey?r?i?i.value?i.type?i.type.length>15?"Action.type value exceed maximum length of 15":void 0:"Missing Action.type":"Missing Action.value":"Missing Action":"Missing message channel":"Missing Subscribe Key":"Missing message timetoken"},t.usePost=function(){return!0},t.postURL=function(e,t){var n=e.config,i=t.channel,r=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(i,"/message/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getRequestHeaders=function(){return{"Content-Type":"application/json"}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.postPayload=function(e,t){return t.action},t.handleResponse=function(e,t){return{data:t.data}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNRemoveMessageActionOperation},t.validateParams=function(e,t){var n=e.config,i=t.channel,r=t.actionTimetoken;return t.messageTimetoken?r?n.subscribeKey?i?void 0:"Missing message channel":"Missing Subscribe Key":"Missing action timetoken":"Missing message timetoken"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=e.config,i=t.channel,r=t.actionTimetoken,o=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(i,"/message/").concat(o,"/action/").concat(r)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{data:t.data}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetMessageActionsOperation},t.validateParams=function(e,t){var n=e.config,i=t.channel;return n.subscribeKey?i?void 0:"Missing message channel":"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channel;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(i)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.limit,i=t.start,r=t.end,o={};return n&&(o.limit=n),i&&(o.start=i),r&&(o.end=r),o},t.handleResponse=function(e,t){var n={data:t.data,start:null,end:null};return n.data.length&&(n.end=n.data[n.data.length-1].actionTimetoken,n.start=n.data[0].actionTimetoken),n},n(2);var r=i(n(1))},function(e,t,n){},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNListFilesOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"channel can't be empty"},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/files")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(e,t){var n={};return t.limit&&(n.limit=t.limit),t.next&&(n.next=t.next),n},handleResponse:function(e,t){return{status:t.status,data:t.data,next:t.next,count:t.count}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNGenerateUploadUrlOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.name)?void 0:"name can't be empty":"channel can't be empty"},usePost:function(){return!0},postURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/generate-upload-url")},postPayload:function(e,t){return{name:t.name}},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status,data:t.data,file_upload_request:t.file_upload_request}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(1)),s=i(n(3)),a={getOperation:function(){return o.default.PNPublishFileOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.fileId)?(null==t?void 0:t.fileName)?void 0:"file name can't be empty":"file id can't be empty":"channel can't be empty"},getURL:function(e,t){var n=e.config,i=n.publishKey,r=n.subscribeKey,o=function(e,t){var n=e.crypto,i=e.config,r=JSON.stringify(t);return i.cipherKey&&(r=n.encrypt(r),r=JSON.stringify(r)),r||""}(e,{message:t.message,file:{name:t.fileName,id:t.fileId}});return"/v1/files/publish-file/".concat(i,"/").concat(r,"/0/").concat(t.channel,"/0/").concat(s.default.encodeString(o))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(e,t){var n={};return t.ttl&&(n.ttl=t.ttl),void 0!==t.storeInHistory&&(n.store=t.storeInHistory?"1":"0"),t.meta&&"object"===(0,r.default)(t.meta)&&(n.meta=JSON.stringify(t.meta)),n},handleResponse:function(e,t){return{timetoken:t[2]}}};t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(11)),o=i(n(12)),s=n(18),a=function(e){return new Promise((function(t){var n="";e.on("data",(function(e){n+=e.toString("utf8")})),e.on("end",(function(){t(n)}))}))};t.default=function(e){var t,n,i,c,l,u,d,h,p,f=(i=(t=e).generateUploadUrl,c=t.publishFile,l=t.modules,u=l.PubNubFile,d=l.config,h=l.cryptography,p=l.networking,n=(0,o.default)(r.default.mark((function e(t){var n,o,l,f,g,m,v,y,b,w,k,_,P,S,x,O,T,C,E,R,A,M;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channel,o=t.file,l=t.message,f=t.cipherKey,g=t.meta,m=t.ttl,v=t.storeInHistory,n){e.next=3;break}throw new s.PubNubError("Validation failed, check status for details",(0,s.createValidationError)("channel can't be empty"));case 3:if(o){e.next=5;break}throw new s.PubNubError("Validation failed, check status for details",(0,s.createValidationError)("file can't be empty"));case 5:return y=u.create(o),e.next=8,i({channel:n,name:y.name});case 8:if(b=e.sent,w=b.file_upload_request,k=w.url,_=w.form_fields,P=b.data,S=P.id,x=P.name,!u.supportsEncryptFile||!(null!=f?f:d.cipherKey)){e.next=19;break}return e.next=18,h.encryptFile(null!=f?f:d.cipherKey,y,u);case 18:y=e.sent;case 19:if(O=_,y.mimeType&&(O=_.map((function(e){return"Content-Type"===e.key?{key:e.key,value:y.mimeType}:e}))),e.prev=21,!u.supportsFileUri||!o.uri){e.next=34;break}return e.t0=p,e.t1=k,e.t2=O,e.next=28,y.toFileUri();case 28:return e.t3=e.sent,e.next=31,e.t0.POSTFILE.call(e.t0,e.t1,e.t2,e.t3);case 31:T=e.sent,e.next=71;break;case 34:if(!u.supportsFile){e.next=46;break}return e.t4=p,e.t5=k,e.t6=O,e.next=40,y.toFile();case 40:return e.t7=e.sent,e.next=43,e.t4.POSTFILE.call(e.t4,e.t5,e.t6,e.t7);case 43:T=e.sent,e.next=71;break;case 46:if(!u.supportsBuffer){e.next=58;break}return e.t8=p,e.t9=k,e.t10=O,e.next=52,y.toBuffer();case 52:return e.t11=e.sent,e.next=55,e.t8.POSTFILE.call(e.t8,e.t9,e.t10,e.t11);case 55:T=e.sent,e.next=71;break;case 58:if(!u.supportsBlob){e.next=70;break}return e.t12=p,e.t13=k,e.t14=O,e.next=64,y.toBlob();case 64:return e.t15=e.sent,e.next=67,e.t12.POSTFILE.call(e.t12,e.t13,e.t14,e.t15);case 67:T=e.sent,e.next=71;break;case 70:throw new Error("Unsupported environment");case 71:e.next=80;break;case 73:return e.prev=73,e.t16=e.catch(21),e.next=77,a(e.t16.response);case 77:throw C=e.sent,E=/<Message>(.*)<\/Message>/gi.exec(C),new s.PubNubError(E?"Upload to bucket failed: ".concat(E[1]):"Upload to bucket failed.",e.t16);case 80:if(204===T.status){e.next=82;break}throw new s.PubNubError("Upload to bucket was unsuccessful",T);case 82:R=5,A=!1,M={timetoken:"0"};case 85:if(A||!(R>0)){e.next=98;break}return e.prev=86,e.next=89,c({channel:n,message:l,fileId:S,fileName:x,meta:g,storeInHistory:v,ttl:m});case 89:M=e.sent,A=!0,e.next=96;break;case 93:e.prev=93,e.t17=e.catch(86),R-=1;case 96:e.next=85;break;case 98:if(A){e.next=102;break}throw new s.PubNubError("Publish failed. You may want to execute that operation manually using pubnub.publishFile",{channel:n,id:S,name:x});case 102:return e.abrupt("return",{timetoken:M.timetoken,id:S,name:x});case 103:case"end":return e.stop()}}),e,null,[[21,73],[86,93]])}))),function(e){return n.apply(this,arguments)});return function(e,t){var n=f(e);return"function"==typeof t?(n.then((function(e){return t(null,e)})).catch((function(e){return t(e,null)})),n):n}},e.exports=t.default},function(e,t,n){var i=function(e){var t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var r=t&&t.prototype instanceof d?t:d,o=Object.create(r.prototype),s=new P(i||[]);return o._invoke=function(e,t,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=w(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var c=l(e,t,n);if("normal"===c.type){if(i=n.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i="completed",n.method="throw",n.arg=c.arg)}}}(e,n,s),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function d(){}function h(){}function p(){}var f={};f[r]=function(){return this};var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==t&&n.call(m,r)&&(f=m);var v=p.prototype=d.prototype=Object.create(f);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(r,o){function s(){return new t((function(i,s){!function i(r,o,s,a){var c=l(e[r],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,s,a)}),(function(e){i("throw",e,s,a)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,a)}))}a(c.arg)}(r,o,i,s)}))}return i=i?i.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,u;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function S(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return h.prototype=v.constructor=p,p.constructor=h,h.displayName=a(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(b.prototype),b.prototype[o]=function(){return this},e.AsyncIterator=b,e.async=function(t,n,i,r,o){void 0===o&&(o=Promise);var s=new b(c(t,n,i,r),o);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},y(v),a(v,s,"Generator"),v[r]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=S,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;_(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(18);t.default=function(e,t){var n=t.channel,r=t.id,o=t.name,s=e.config;if(!n)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("channel can't be empty"));if(!r)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file id can't be empty"));if(!o)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file name can't be empty"));var a="/v1/files/".concat(s.subscribeKey,"/channels/").concat(n,"/files/").concat(r,"/").concat(o),c={};c.uuid=s.getUUID(),c.pnsdk=(0,i.generatePNSDK)(s),s.getAuthKey()&&(c.auth=s.getAuthKey()),s.secretKey&&(0,i.signRequest)(e,a,c,{},{getOperation:function(){return"PubNubGetFileUrlOperation"}});var l=Object.keys(c).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(c[e]))})).join("&");return""!==l?"https://".concat(s.origin).concat(a,"?").concat(l):"https://".concat(s.origin).concat(a)},e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=i(n(11)),s=i(n(12)),a=i(n(1)),c={getOperation:function(){return a.default.PNDownloadFileOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.name)?(null==t?void 0:t.id)?void 0:"id can't be empty":"name can't be empty":"channel can't be empty"},useGetFile:function(){return!0},getFileURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/files/").concat(t.id,"/").concat(t.name)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},ignoreBody:function(){return!0},forceBuffered:function(){return!0},prepareParams:function(){return{}},handleResponse:(r=(0,s.default)(o.default.mark((function e(t,n,i){var r,s,a,c,l,u;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=t.PubNubFile,a=t.config,c=t.cryptography,l=n.response.body,!s.supportsEncryptFile||!a.cipherKey){e.next=6;break}return e.next=5,c.decrypt(null!==(u=i.cipherKey)&&void 0!==u?u:a.cipherKey,l);case 5:l=e.sent;case 6:return e.abrupt("return",s.create({data:l,name:null!==(r=n.response.name)&&void 0!==r?r:i.name,mimeType:n.response.type}));case 7:case"end":return e.stop()}}),e)}))),function(e,t,n){return r.apply(this,arguments)})};t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNListFilesOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.id)?(null==t?void 0:t.name)?void 0:"file name can't be empty":"file id can't be empty":"channel can't be empty"},useDelete:function(){return!0},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/files/").concat(t.id,"/").concat(t.name)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("fileUpload")},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetAllUUIDMetadataOperation},validateParams:function(){},getURL:function(e){var t=e.config;return"/v2/objects/".concat(t.subscribeKey,"/uuids")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d={};return(null==t||null===(n=t.include)||void 0===n?void 0:n.customFields)&&(d.include="custom"),(null==t||null===(i=t.include)||void 0===i?void 0:i.totalCount)&&(d.count=null===(a=t.include)||void 0===a?void 0:a.totalCount),(null==t||null===(o=t.page)||void 0===o?void 0:o.next)&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next),(null==t||null===(s=t.page)||void 0===s?void 0:s.prev)&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev),(null==t?void 0:t.filter)&&(d.filter=t.filter),d.limit=null==t?void 0:t.limit,(null==t?void 0:t.sort)&&(d.sort=Object.entries(null!==(u=t.sort)&&void 0!==u?u:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,next:t.next,prev:t.prev}}};t.default=s,e.exports=t.default},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNGetUUIDMetadataOperation},validateParams:function(){},getURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID())},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i,r,o=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:o.getUUID(),include:(null===(i=null==t||null===(r=t.include)||void 0===r?void 0:r.customFields)||void 0===i||i)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNSetUUIDMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.data))return"Data cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID())},patchPayload:function(e,t){return t.data},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i,r,o=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:o.getUUID(),include:(null===(i=null==t||null===(r=t.include)||void 0===r?void 0:r.customFields)||void 0===i||i)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNRemoveUUIDMetadataOperation},validateParams:function(){},getURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID())},useDelete:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("user")},prepareParams:function(e,t){var n,i=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:i.getUUID()}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetAllChannelMetadataOperation},validateParams:function(){},getURL:function(e){var t=e.config;return"/v2/objects/".concat(t.subscribeKey,"/channels")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d={};return(null==t||null===(n=t.include)||void 0===n?void 0:n.customFields)&&(d.include="custom"),(null==t||null===(i=t.include)||void 0===i?void 0:i.totalCount)&&(d.count=null===(a=t.include)||void 0===a?void 0:a.totalCount),(null==t||null===(o=t.page)||void 0===o?void 0:o.next)&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next),(null==t||null===(s=t.page)||void 0===s?void 0:s.prev)&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev),(null==t?void 0:t.filter)&&(d.filter=t.filter),(null==t?void 0:t.limit)&&(d.limit=t.limit),(null==t?void 0:t.sort)&&(d.sort=Object.entries(null!==(u=t.sort)&&void 0!==u?u:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=s,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNGetChannelMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"Channel cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(e,t){var n,i;return{include:(null===(n=null==t||null===(i=t.include)||void 0===i?void 0:i.customFields)||void 0===n||n)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNSetChannelMetadataOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.data)?void 0:"Data cannot be empty":"Channel cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel)},patchPayload:function(e,t){return t.data},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(e,t){var n,i;return{include:(null===(n=null==t||null===(i=t.include)||void 0===i?void 0:i.customFields)||void 0===n||n)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1)),o={getOperation:function(){return r.default.PNRemoveChannelMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"Channel cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel)},useDelete:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("channel")},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};t.default=o,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetMembersOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"UUID cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/uuids")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("member")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h,p,f,g={};return(null==t?void 0:t.include)&&(g.include=[],(null===(a=t.include)||void 0===a?void 0:a.customFields)&&g.include.push("custom"),(null===(c=t.include)||void 0===c?void 0:c.customUUIDFields)&&g.include.push("uuid.custom"),(null===(l=null===(u=t.include)||void 0===u?void 0:u.UUIDFields)||void 0===l||l)&&g.include.push("uuid"),g.include=g.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(g.count=null===(d=t.include)||void 0===d?void 0:d.totalCount),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(g.start=null===(h=t.page)||void 0===h?void 0:h.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(g.end=null===(p=t.page)||void 0===p?void 0:p.prev),(null==t?void 0:t.filter)&&(g.filter=t.filter),g.limit=null!==(s=null==t?void 0:t.limit)&&void 0!==s?s:100,(null==t?void 0:t.sort)&&(g.sort=Object.entries(null!==(f=t.sort)&&void 0!==f?f:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),g},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=s,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(4)),s=i(n(1)),a={getOperation:function(){return s.default.PNSetMembersOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.uuids)&&0!==(null==t?void 0:t.uuids.length)?void 0:"UUIDs cannot be empty":"Channel cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(t.channel,"/uuids")},patchPayload:function(e,t){return(0,o.default)({set:[],remove:[]},t.type,t.uuids.map((function(e){return"string"==typeof e?{uuid:{id:e}}:{uuid:{id:e.id},custom:e.custom}})))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("member")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h={};return(null==t?void 0:t.include)&&(h.include=[],(null===(s=t.include)||void 0===s?void 0:s.customFields)&&h.include.push("custom"),(null===(a=t.include)||void 0===a?void 0:a.customUUIDFields)&&h.include.push("uuid.custom"),(null===(c=t.include)||void 0===c?void 0:c.UUIDFields)&&h.include.push("uuid"),h.include=h.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(h.count=!0),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(h.start=null===(l=t.page)||void 0===l?void 0:l.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(h.end=null===(u=t.page)||void 0===u?void 0:u.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),(null==t?void 0:t.limit)&&(h.limit=t.limit),(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(d=t.sort)&&void 0!==d?d:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(1)),s={getOperation:function(){return o.default.PNGetMembershipsOperation},validateParams:function(e,t){if(!(null==t?void 0:t.uuid))return"UUID cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/uuids/").concat(t.uuid,"/channels")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("membership")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h,p,f={};return(null==t?void 0:t.include)&&(f.include=[],(null===(a=t.include)||void 0===a?void 0:a.customFields)&&f.include.push("custom"),(null===(c=t.include)||void 0===c?void 0:c.customChannelFields)&&f.include.push("channel.custom"),(null===(l=t.include)||void 0===l?void 0:l.channelFields)&&f.include.push("channel"),f.include=f.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(f.count=null===(u=t.include)||void 0===u?void 0:u.totalCount),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(f.start=null===(d=t.page)||void 0===d?void 0:d.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(f.end=null===(h=t.page)||void 0===h?void 0:h.prev),(null==t?void 0:t.filter)&&(f.filter=t.filter),f.limit=null!==(s=null==t?void 0:t.limit)&&void 0!==s?s:100,(null==t?void 0:t.sort)&&(f.sort=Object.entries(null!==(p=t.sort)&&void 0!==p?p:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),f},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=s,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(9)),o=i(n(4)),s=i(n(1)),a={getOperation:function(){return s.default.PNSetMembershipsOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channels)||0===(null==t?void 0:t.channels.length))return"Channels cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n,i=e.config;return"/v2/objects/".concat(i.subscribeKey,"/uuids/").concat(null!==(n=t.uuid)&&void 0!==n?n:i.getUUID(),"/channels")},patchPayload:function(e,t){return(0,o.default)({set:[],remove:[]},t.type,t.channels.map((function(e){return"string"==typeof e?{channel:{id:e}}:{channel:{id:e.id},custom:e.custom}})))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},getAuthToken:function(e){return e.tokenManager.getToken("membership")},prepareParams:function(e,t){var n,i,o,s,a,c,l,u,d,h={};return(null==t?void 0:t.include)&&(h.include=[],(null===(s=t.include)||void 0===s?void 0:s.customFields)&&h.include.push("custom"),(null===(a=t.include)||void 0===a?void 0:a.customChannelFields)&&h.include.push("channel.custom"),(null===(c=t.include)||void 0===c?void 0:c.channelFields)&&h.include.push("channel"),h.include=h.include.join(",")),(null==t||null===(n=t.include)||void 0===n?void 0:n.totalCount)&&(h.count=!0),(null==t||null===(i=t.page)||void 0===i?void 0:i.next)&&(h.start=null===(l=t.page)||void 0===l?void 0:l.next),(null==t||null===(o=t.page)||void 0===o?void 0:o.prev)&&(h.end=null===(u=t.page)||void 0===u?void 0:u.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),(null==t?void 0:t.limit)&&(h.limit=t.limit),(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(d=t.sort)&&void 0!==d?d:{}).map((function(e){var t=(0,r.default)(e,2),n=t[0],i=t[1];return"asc"===i||"desc"===i?"".concat(n,":").concat(i):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};t.default=a,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNCreateUserOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing User.name":"Missing User.id"},t.usePost=function(){return!0},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.id)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateUserOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing User.name":"Missing User.id"},t.usePatch=function(){return!0},t.getURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(i)},t.patchURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(i)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.id)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNDeleteUserOperation},t.validateParams=function(e,t){var n=e.config;return t?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing UserId"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t)||e.tokenManager.getToken("user")},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetUserOperation},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetUsersOperation},t.validateParams=function(){},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e){return e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNCreateSpaceOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing Space.name":"Missing Space.id"},t.usePost=function(){return!0},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.id)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateSpaceOperation},t.validateParams=function(e,t){var n=e.config,i=t.id,r=t.name,o=t.custom;return i?r?n.subscribeKey?o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))?"Invalid custom type, only string, number and boolean values are allowed.":void 0:"Missing Subscribe Key":"Missing Space.name":"Missing Space.id"},t.usePatch=function(){return!0},t.getURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(i)},t.patchURL=function(e,t){var n=e.config,i=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(i)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.id)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNDeleteSpaceOperation},t.validateParams=function(e,t){var n=e.config;return t?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing SpaceId"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t)||e.tokenManager.getToken("space")},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetSpacesOperation},t.validateParams=function(){},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e){return e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetSpaceOperation},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i={};if(n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0},n){var r=[];n.customFields&&r.push("custom");var o=r.join(",");o.length>0&&(i.include=o)}return i},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetMembersOperation},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom"),n.userFields&&a.push("user"),n.customUserFields&&a.push("user.custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembersOperation},t.validateParams=function(e,t){var n=t.spaceId,i=t.users;return n?i?void 0:"Missing users":"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.users,i={};return n&&n.length>0&&(i.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),i.add.push(t)}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembersOperation},t.validateParams=function(e,t){var n=t.spaceId,i=t.users;return n?i?void 0:"Missing users":"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.addMembers,i=t.updateMembers,r=t.removeMembers,o=t.users,s={};return n&&n.length>0&&(s.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.add.push(t)}))),i&&i.length>0&&(s.update=[],i.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),o&&o.length>0&&(s.update=s.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),r&&r.length>0&&(s.remove=[],r.forEach((function(e){s.remove.push({id:e})}))),s}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembersOperation},t.validateParams=function(e,t){var n=t.spaceId,i=t.users;return n?i?void 0:"Missing users":"Missing spaceId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(t.spaceId,"/users")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("space",t.spaceId)||e.tokenManager.getToken("space")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.users,i={};return n&&n.length>0&&(i.remove=[],n.forEach((function(e){i.remove.push({id:e})}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNGetMembershipsOperation},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o=t.filter,s={};if(i&&(s.limit=i),n){var a=[];n.totalCount&&(s.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var c=a.join(",");c.length>0&&(s.include=c)}return r&&(r.next&&(s.start=r.next),r.prev&&(s.end=r.prev)),o&&(s.filter=o),s},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembershipsOperation},t.validateParams=function(e,t){var n=t.userId,i=t.spaces;return n?i?void 0:"Missing spaces":"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.addMemberships,i=t.updateMemberships,r=t.removeMemberships,o=t.spaces,s={};return n&&n.length>0&&(s.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.add.push(t)}))),i&&i.length>0&&(s.update=[],i.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),o&&o.length>0&&(s.update=s.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),s.update.push(t)}))),r&&r.length>0&&(s.remove=[],r.forEach((function(e){s.remove.push({id:e})}))),s}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembershipsOperation},t.validateParams=function(e,t){var n=t.userId,i=t.spaces;return n?i?void 0:"Missing spaces":"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,i={};return n&&n.length>0&&(i.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),i.add.push(t)}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNUpdateMembershipsOperation},t.validateParams=function(e,t){var n=t.userId,i=t.spaces;return n?i?void 0:"Missing spaces":"Missing userId"},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(t.userId,"/spaces")},t.usePatch=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.getAuthToken=function(e,t){return e.tokenManager.getToken("user",t.userId)||e.tokenManager.getToken("user")},t.prepareParams=function(e,t){var n=t.include,i=t.limit,r=t.page,o={};if(i&&(o.limit=i),n){var s=[];n.totalCount&&(o.count=!0),n.customFields&&s.push("custom"),n.spaceFields&&s.push("space"),n.customSpaceFields&&s.push("space.custom");var a=s.join(",");a.length>0&&(o.include=a)}return r&&(r.next&&(o.start=r.next),r.prev&&(o.end=r.prev)),o},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,i={};return n&&n.length>0&&(i.remove=[],n.forEach((function(e){i.remove.push({id:e})}))),i}(0,t)},t.handleResponse=function(e,t){return t},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAccessManagerAudit},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e){var t=e.config;return"/v2/auth/audit/sub-key/".concat(t.subscribeKey)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channel,i=t.channelGroup,r=t.authKeys,o=void 0===r?[]:r,s={};return n&&(s.channel=n),i&&(s["channel-group"]=i),o.length>0&&(s.auth=o.join(",")),s},t.handleResponse=function(e,t){return t.payload},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAccessManagerGrant},t.validateParams=function(e,t){var n=e.config;return n.subscribeKey?n.publishKey?n.secretKey?null==t.uuids||t.authKeys?null==t.uuids||null==t.channels&&null==t.channelGroups?void 0:"Both channel/channelgroup and uuid cannot be used in the same request":"authKeys are required for grant request on uuids":"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"},t.getURL=function(e){var t=e.config;return"/v2/auth/grant/sub-key/".concat(t.subscribeKey)},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channels,i=void 0===n?[]:n,r=t.channelGroups,o=void 0===r?[]:r,s=t.uuids,a=void 0===s?[]:s,c=t.ttl,l=t.read,u=void 0!==l&&l,d=t.write,h=void 0!==d&&d,p=t.manage,f=void 0!==p&&p,g=t.get,m=void 0!==g&&g,v=t.join,y=void 0!==v&&v,b=t.update,w=void 0!==b&&b,k=t.authKeys,_=void 0===k?[]:k,P=t.delete,S={};return S.r=u?"1":"0",S.w=h?"1":"0",S.m=f?"1":"0",S.d=P?"1":"0",S.g=m?"1":"0",S.j=y?"1":"0",S.u=w?"1":"0",i.length>0&&(S.channel=i.join(",")),o.length>0&&(S["channel-group"]=o.join(",")),_.length>0&&(S.auth=_.join(",")),a.length>0&&(S["target-uuid"]=a.join(",")),(c||0===c)&&(S.ttl=c),S},t.handleResponse=function(){return{}},n(2);var r=i(n(1))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNAccessManagerGrantToken},t.extractPermissions=o,t.validateParams=function(e,t){var n=e.config;return n.subscribeKey?n.publishKey?n.secretKey?t.resources||t.patterns?(!t.resources||t.resources.users&&0!==Object.keys(t.resources.users).length||t.resources.spaces&&0!==Object.keys(t.resources.spaces).length)&&(!t.patterns||t.patterns.users&&0!==Object.keys(t.patterns.users).length||t.patterns.spaces&&0!==Object.keys(t.patterns.spaces).length)?void 0:"Missing values for either Resources or Patterns.":"Missing either Resources or Patterns.":"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"},t.postURL=function(e){var t=e.config;return"/v3/pam/".concat(t.subscribeKey,"/grant")},t.usePost=function(){return!0},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!1},t.prepareParams=function(){return{}},t.postPayload=function(e,t){return function(e,t){var n=t.ttl,i=t.resources,r=t.patterns,s=t.meta,a={ttl:0,permissions:{resources:{channels:{},groups:{},users:{},spaces:{}},patterns:{channels:{},groups:{},users:{},spaces:{}},meta:{}}};if(i){var c=i.users,l=i.spaces;c&&Object.keys(c).forEach((function(e){a.permissions.resources.users[e]=o(c[e])})),l&&Object.keys(l).forEach((function(e){a.permissions.resources.spaces[e]=o(l[e])}))}if(r){var u=r.users,d=r.spaces;u&&Object.keys(u).forEach((function(e){a.permissions.patterns.users[e]=o(u[e])})),d&&Object.keys(d).forEach((function(e){a.permissions.patterns.spaces[e]=o(d[e])}))}return(n||0===n)&&(a.ttl=n),s&&(a.permissions.meta=s),a}(0,t)},t.handleResponse=function(e,t){return t.data.token},n(2);var r=i(n(1));function o(e){var t=0;return e.create&&(t|=16),e.delete&&(t|=8),e.manage&&(t|=4),e.write&&(t|=2),e.read&&(t|=1),t}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNPublishOperation},t.validateParams=function(e,t){var n=e.config,i=t.message;return t.channel?i?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"},t.usePost=function(e,t){var n=t.sendByPost;return void 0!==n&&n},t.getURL=function(e,t){var n=e.config,i=t.channel,r=a(e,t.message);return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(s.default.encodeString(i),"/0/").concat(s.default.encodeString(r))},t.postURL=function(e,t){var n=e.config,i=t.channel;return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(s.default.encodeString(i),"/0")},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){return a(e,t.message)},t.prepareParams=function(e,t){var n=t.meta,i=t.replicate,o=void 0===i||i,s=t.storeInHistory,a=t.ttl,c={};return null!=s&&(c.store=s?"1":"0"),a&&(c.ttl=a),!1===o&&(c.norep="true"),n&&"object"===(0,r.default)(n)&&(c.meta=JSON.stringify(n)),c},t.handleResponse=function(e,t){return{timetoken:t[2]}};var r=i(n(7)),o=(n(2),i(n(1))),s=i(n(3));function a(e,t){var n=e.crypto,i=e.config,r=JSON.stringify(t);return i.cipherKey&&(r=n.encrypt(r),r=JSON.stringify(r)),r}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNSignalOperation},t.validateParams=function(e,t){var n=e.config,i=t.message;return t.channel?i?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"},t.getURL=function(e,t){var n,i=e.config,r=t.channel,s=(n=t.message,JSON.stringify(n));return"/signal/".concat(i.publishKey,"/").concat(i.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0/").concat(o.default.encodeString(s))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.handleResponse=function(e,t){return{timetoken:t[2]}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNHistoryOperation},t.validateParams=function(e,t){var n=t.channel,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.getURL=function(e,t){var n=t.channel,i=e.config;return"/v2/history/sub-key/".concat(i.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,i=t.end,r=t.reverse,o=t.count,s=void 0===o?100:o,a=t.stringifiedTimeToken,c=void 0!==a&&a,l=t.includeMeta,u=void 0!==l&&l,d={include_token:"true"};return d.count=s,n&&(d.start=n),i&&(d.end=i),c&&(d.string_message_token="true"),null!=r&&(d.reverse=r.toString()),u&&(d.include_meta="true"),d},t.handleResponse=function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};return Array.isArray(t[0])&&t[0].forEach((function(t){var i={timetoken:t.timetoken,entry:s(e,t.message)};t.meta&&(i.meta=t.meta),n.messages.push(i)})),n},n(2);var r=i(n(1)),o=i(n(3));function s(e,t){var n=e.config,i=e.crypto;if(!n.cipherKey)return t;try{return i.decrypt(t)}catch(e){return t}}},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNDeleteMessagesOperation},t.validateParams=function(e,t){var n=t.channel,i=e.config;return n?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.useDelete=function(){return!0},t.getURL=function(e,t){var n=t.channel,i=e.config;return"/v3/history/sub-key/".concat(i.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,i=t.end,r={};return n&&(r.start=n),i&&(r.end=i),r},t.handleResponse=function(e,t){return t.payload},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNMessageCounts},t.validateParams=function(e,t){var n=t.channels,i=t.timetoken,r=t.channelTimetokens,o=e.config;return n?i&&r?"timetoken and channelTimetokens are incompatible together":i&&r&&r.length>1&&n.length!==r.length?"Length of channelTimetokens and channels do not match":o.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},t.getURL=function(e,t){var n=t.channels,i=e.config,r=n.join(",");return"/v3/history/sub-key/".concat(i.subscribeKey,"/message-counts/").concat(s.default.encodeString(r))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.timetoken,i=t.channelTimetokens,o={};if(i&&1===i.length){var s=(0,r.default)(i,1)[0];o.timetoken=s}else i?o.channelsTimetoken=i.join(","):n&&(o.timetoken=n);return o},t.handleResponse=function(e,t){return{channels:t.channels}};var r=i(n(9)),o=i(n(1)),s=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNFetchMessagesOperation},t.validateParams=function(e,t){var n=t.channels,i=t.includeMessageActions,r=void 0!==i&&i,o=e.config;if(!n||0===n.length)return"Missing channels";if(!o.subscribeKey)return"Missing Subscribe Key";if(r&&n.length>1)throw new TypeError("History can return actions data for a single channel only. Either pass a single channel or disable the includeMessageActions flag.")},t.getURL=function(e,t){var n=t.channels,i=void 0===n?[]:n,r=t.includeMessageActions,s=void 0!==r&&r,a=e.config,c=s?"history-with-actions":"history",l=i.length>0?i.join(","):",";return"/v3/".concat(c,"/sub-key/").concat(a.subscribeKey,"/channel/").concat(o.default.encodeString(l))},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels,i=t.start,r=t.end,o=t.includeMessageActions,s=t.count,a=t.stringifiedTimeToken,c=void 0!==a&&a,l=t.includeMeta,u=void 0!==l&&l,d=t.includeUuid,h=t.includeUUID,p=void 0===h||h,f=t.includeMessageType,g=void 0===f||f,m={};return m.max=s||(n.length>1||!0===o?25:100),i&&(m.start=i),r&&(m.end=r),c&&(m.string_message_token="true"),u&&(m.include_meta="true"),p&&!1!==d&&(m.include_uuid="true"),g&&(m.include_message_type="true"),m},t.handleResponse=function(e,t){var n={channels:{}};return Object.keys(t.channels||{}).forEach((function(i){n.channels[i]=[],(t.channels[i]||[]).forEach((function(t){var r={};r.channel=i,r.timetoken=t.timetoken,r.message=function(e,t){var n=e.config,i=e.crypto;if(!n.cipherKey)return t;try{return i.decrypt(t)}catch(e){return t}}(e,t.message),r.messageType=t.message_type,r.uuid=t.uuid,t.actions&&(r.actions=t.actions,r.data=t.actions),t.meta&&(r.meta=t.meta),n.channels[i].push(r)}))})),t.more&&(n.more=t.more),n},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return r.default.PNSubscribeOperation},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},t.getURL=function(e,t){var n=e.config,i=t.channels,r=void 0===i?[]:i,s=r.length>0?r.join(","):",";return"/v2/subscribe/".concat(n.subscribeKey,"/").concat(o.default.encodeString(s),"/0")},t.getRequestTimeout=function(e){return e.config.getSubscribeTimeout()},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=e.config,i=t.state,r=t.channelGroups,o=void 0===r?[]:r,s=t.timetoken,a=t.filterExpression,c=t.region,l={heartbeat:n.getPresenceTimeout()};return o.length>0&&(l["channel-group"]=o.join(",")),a&&a.length>0&&(l["filter-expr"]=a),Object.keys(i).length&&(l.state=JSON.stringify(i)),s&&(l.tt=s),c&&(l.tr=c),l},t.handleResponse=function(e,t){var n=[];t.m.forEach((function(e){var t={publishTimetoken:e.p.t,region:e.p.r},i={shard:parseInt(e.a,10),subscriptionMatch:e.b,channel:e.c,messageType:e.e,payload:e.d,flags:e.f,issuingClientId:e.i,subscribeKey:e.k,originationTimetoken:e.o,userMetadata:e.u,publishMetaData:t};n.push(i)}));var i={timetoken:t.t.t,region:t.t.r};return{messages:n,metadata:i}},n(2);var r=i(n(1)),o=i(n(3))},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(122)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=(i(n(8)),i(n(10))),l=(n(2),function(){function e(t){var n=this;(0,o.default)(this,e),(0,a.default)(this,"_modules",void 0),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_maxSubDomain",void 0),(0,a.default)(this,"_currentSubDomain",void 0),(0,a.default)(this,"_standardOrigin",void 0),(0,a.default)(this,"_subscribeOrigin",void 0),(0,a.default)(this,"_requestTimeout",void 0),(0,a.default)(this,"_coreParams",void 0),this._modules={},Object.keys(t).forEach((function(e){n._modules[e]=t[e].bind(n)}))}return(0,s.default)(e,[{key:"init",value:function(e){this._config=e,this._maxSubDomain=10,this._currentSubDomain=Math.floor(Math.random()*this._maxSubDomain),this._coreParams={},this.shiftStandardOrigin()}},{key:"nextOrigin",value:function(){this._currentSubDomain+=1,this._currentSubDomain>=this._maxSubDomain&&(this._currentSubDomain=0);var e=this._config.origin.split("."),t=(0,r.default)(e),n=t[0],i=t.slice(1),o=this._config.secure?"https://":"http://",s=this._config.hasCustomOrigin()?"-":"",a=this._config.hasCustomOrigin()?this._currentSubDomain:this._currentSubDomain+1;return"".concat(o).concat(n).concat(s).concat(a,".").concat(i.join("."))}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){return this._standardOrigin=this.nextOrigin(),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POSTFILE",value:function(e,t,n){return this._modules.postfile(e,t,n)}},{key:"GETFILE",value:function(e,t,n){return this._modules.getfile(e,t,n)}},{key:"POST",value:function(e,t,n,i){return this._modules.post(e,t,n,i)}},{key:"PATCH",value:function(e,t,n,i){return this._modules.patch(e,t,n,i)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return c.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return c.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return c.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return c.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return c.default.PNNetworkIssuesCategory;if(e.timeout)return c.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return c.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return c.default.PNBadRequestCategory;if(e.response.forbidden)return c.default.PNAccessDeniedCategory}return c.default.PNUnknownCategory}}]),e}());t.default=l,e.exports=t.default},function(e,t,n){var i=n(26),r=n(123),o=n(27),s=n(28);e.exports=function(e){return i(e)||r(e)||o(e)||s()}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={get:function(e){try{return localStorage.getItem(e)}catch(e){return null}},set:function(e,t){try{return localStorage.setItem(e,t)}catch(e){return null}}};t.default=i,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(7)),o=i(n(5)),s=i(n(6)),a=i(n(4)),c=function(){function e(t,n){(0,o.default)(this,e),(0,a.default)(this,"_base64ToBinary",void 0),(0,a.default)(this,"_cborReader",void 0),this._base64ToBinary=n,this._decode=t}return(0,s.default)(e,[{key:"decodeToken",value:function(e){var t="";e.length%4==3?t="=":e.length%4==2&&(t="==");var n=e.replace(/-/gi,"+").replace(/_/gi,"/")+t,i=this._decode(this._base64ToBinary(n));if("object"===(0,r.default)(i))return i}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.postfile=function(e,t,n){return l.apply(this,arguments)},t.getfile=function(e,t,n){var i=s.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return c.call(this,i,t,n)},t.get=function(e,t,n){var i=s.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return c.call(this,i,t,n)},t.post=function(e,t,n,i){var r=s.default.post(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return c.call(this,r,n,i)},t.patch=function(e,t,n,i){var r=s.default.patch(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return c.call(this,r,n,i)},t.del=function(e,t,n){var i=s.default.delete(this.getStandardOrigin()+t.url).set(t.headers).query(e);return c.call(this,i,t,n)};var r=i(n(11)),o=i(n(12)),s=i(n(127));function a(e){var t=(new Date).getTime(),n=(new Date).toISOString(),i=console&&console.log?console:window&&window.console&&window.console.log?window.console:console;i.log("<<<<<"),i.log("[".concat(n,"]"),"\n",e.url,"\n",e.qs),i.log("-----"),e.on("response",(function(n){var r=(new Date).getTime()-t,o=(new Date).toISOString();i.log(">>>>>>"),i.log("[".concat(o," / ").concat(r,"]"),"\n",e.url,"\n",e.qs,"\n",n.text),i.log("-----")}))}function c(e,t,n){var i=this;this._config.logVerbosity&&(e=e.use(a)),this._config.proxy&&this._modules.proxy&&(e=this._modules.proxy.call(this,e)),this._config.keepAlive&&this._modules.keepAlive&&(e=this._modules.keepAlive(e));var r=e;return!0===t.forceBuffered?r="undefined"==typeof Blob?r.buffer().responseType("arraybuffer"):r.responseType("arraybuffer"):!1===t.forceBuffered&&(r=r.buffer(!1)),r.timeout(t.timeout).end((function(e,r){var o,s={};if(s.error=null!==e,s.operation=t.operation,r&&r.status&&(s.statusCode=r.status),e){if(e.response&&e.response.text&&!i._config.logVerbosity)try{s.errorData=JSON.parse(e.response.text)}catch(t){s.errorData=e}else s.errorData=e;return s.category=i._detectErrorCategory(e),n(s,null)}if(t.ignoreBody)o={headers:r.headers,redirects:r.redirects,response:r};else try{o=JSON.parse(r.text)}catch(e){return s.errorData=r,s.error=!0,n(s,null)}return o.error&&1===o.error&&o.status&&o.message&&o.service?(s.errorData=o,s.statusCode=o.status,s.error=!0,s.category=i._detectErrorCategory(s),n(s,null)):(o.error&&o.error.message&&(s.errorData=o.error),n(s,o))}))}function l(){return(l=(0,o.default)(r.default.mark((function e(t,n,i){var o,a;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=s.default.post(t),n.forEach((function(e){var t=e.key,n=e.value;o=o.field(t,n)})),o.attach("file",i,{contentType:"application/octet-stream"}),e.next=5,o;case 5:return a=e.sent,e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}n(2)},function(e,t,n){var i;"undefined"!=typeof window?i=window:"undefined"!=typeof self?i=self:(console.warn("Using browser-only version of superagent in non-browser environment"),i=this);var r=n(128),o=n(129),s=n(29),a=n(130),c=n(132);function l(){}var u=t=e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1==arguments.length?new t.Request("GET",e):new t.Request(e,n)};t.Request=v,u.getXHR=function(){if(!(!i.XMLHttpRequest||i.location&&"file:"==i.location.protocol&&i.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only version of superagent could not find XHR")};var d="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function h(e){if(!s(e))return e;var t=[];for(var n in e)p(t,n,e[n]);return t.join("&")}function p(e,t,n){if(null!=n)if(Array.isArray(n))n.forEach((function(n){p(e,t,n)}));else if(s(n))for(var i in n)p(e,t+"["+i+"]",n[i]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(n));else null===n&&e.push(encodeURIComponent(t))}function f(e){for(var t,n,i={},r=e.split("&"),o=0,s=r.length;o<s;++o)-1==(n=(t=r[o]).indexOf("="))?i[decodeURIComponent(t)]="":i[decodeURIComponent(t.slice(0,n))]=decodeURIComponent(t.slice(n+1));return i}function g(e){return/[\/+]json($|[^-\w])/.test(e)}function m(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.header=this.headers=function(e){for(var t,n,i,r,o=e.split(/\r?\n/),s={},a=0,c=o.length;a<c;++a)-1!==(t=(n=o[a]).indexOf(":"))&&(i=n.slice(0,t).toLowerCase(),r=d(n.slice(t+1)),s[i]=r);return s}(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function v(e,t){var n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,i=null;try{i=new m(n)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,n.xhr?(t.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.status=n.xhr.status?n.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),n.callback(t)}n.emit("response",i);try{n._isResponseOK(i)||(e=new Error(i.statusText||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=i,e.status=i.status,n.callback(e,i)):n.callback(null,i)}))}function y(e,t,n){var i=u("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i}u.serializeObject=h,u.parseString=f,u.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},u.serialize={"application/x-www-form-urlencoded":h,"application/json":JSON.stringify},u.parse={"application/x-www-form-urlencoded":f,"application/json":JSON.parse},a(m.prototype),m.prototype._parseBody=function(e){var t=u.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&g(this.type)&&(t=u.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null)},m.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,i="cannot "+t+" "+n+" ("+this.status+")",r=new Error(i);return r.status=this.status,r.method=t,r.url=n,r},u.Response=m,r(v.prototype),o(v.prototype),v.prototype.type=function(e){return this.set("Content-Type",u.types[e]||e),this},v.prototype.accept=function(e){return this.set("Accept",u.types[e]||e),this},v.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"==typeof t&&null!==t&&(n=t,t=""),n||(n={type:"function"==typeof btoa?"basic":"auto"});var i=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,n,i)},v.prototype.query=function(e){return"string"!=typeof e&&(e=h(e)),e&&this._query.push(e),this},v.prototype.attach=function(e,t,n){if(t){if(this._data)throw Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},v.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},v.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},v.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},v.prototype.buffer=v.prototype.ca=v.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},v.prototype.pipe=v.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},v.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},v.prototype.end=function(e){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||l,this._finalizeQueryString(),this._end()},v.prototype._end=function(){var e=this,t=this.xhr=u.getXHR(),n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==n){var i;try{i=t.status}catch(e){i=0}if(!i){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var i=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.onprogress=i.bind(null,"download"),t.upload&&(t.upload.onprogress=i.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var r=this._header["content-type"],o=this._serializer||u.serialize[r?r.split(";")[0]:""];!o&&g(r)&&(o=u.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!=this.header[s]&&this.header.hasOwnProperty(s)&&t.setRequestHeader(s,this.header[s]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==n?n:null),this},u.agent=function(){return new c},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){c.prototype[e.toLowerCase()]=function(t,n){var i=new u.Request(e,t);return this._setDefaults(i),n&&i.end(n),i}})),c.prototype.del=c.prototype.delete,u.get=function(e,t,n){var i=u("GET",e);return"function"==typeof t&&(n=t,t=null),t&&i.query(t),n&&i.end(n),i},u.head=function(e,t,n){var i=u("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&i.query(t),n&&i.end(n),i},u.options=function(e,t,n){var i=u("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i},u.del=y,u.delete=y,u.patch=function(e,t,n){var i=u("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i},u.post=function(e,t,n){var i=u("POST",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i},u.put=function(e,t,n){var i=u("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&i.send(t),n&&i.end(n),i}},function(e,t,n){function i(e){if(e)return function(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}(e)}e.exports=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},i.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<i.length;r++)if((n=i[r])===t||n.fn===t){i.splice(r,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},i.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){i=0;for(var r=(n=n.slice(0)).length;i<r;++i)n[i].apply(this,t)}return this},i.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},i.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,n){var i=n(29);function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},r.prototype.parse=function(e){return this._parser=e,this},r.prototype.responseType=function(e){return this._responseType=e,this},r.prototype.serialize=function(e){return this._serializer=e,this},r.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this;for(var t in e)switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;default:console.warn("Unknown timeout option",t)}return this},r.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var o=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];r.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!=t.status)return!0;if(e){if(e.code&&~o.indexOf(e.code))return!0;if(e.timeout&&"ECONNABORTED"==e.code)return!0;if(e.crossDomain)return!0}return!1},r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},r.prototype.then=function(e,t){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){n.end((function(n,i){n?t(n):e(i)}))}))}return this._fullfilledPromise.then(e,t)},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype.use=function(e){return e(this),this},r.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},r.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(e,t){if(i(e)){for(var n in e)this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},r.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},r.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),i(e)){for(var n in e)this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)this.field(e,t[r]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},r.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},r.prototype._auth=function(e,t,n,i){switch(n.type){case"basic":this.set("Authorization","Basic "+i(e+":"+t));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer "+e)}return this},r.prototype.withCredentials=function(e){return null==e&&(e=!0),this._withCredentials=e,this},r.prototype.redirects=function(e){return this._maxRedirects=e,this},r.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw TypeError("Invalid argument");return this._maxResponseSize=e,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(e){var t=i(e),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&i(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||n||this.type("json"),this},r.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},r.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.substring(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,t)+"?"+n.join("&")}}},r.prototype._appendQueryString=function(){console.trace("Unsupported")},r.prototype._timeoutError=function(e,t,n){if(!this._aborted){var i=new Error(e+t+"ms exceeded");i.timeout=t,i.code="ECONNABORTED",i.errno=n,this.timedout=!0,this.abort(),this.callback(i)}},r.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},function(e,t,n){var i=n(131);function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.get=function(e){return this.header[e.toLowerCase()]},r.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=i.type(t);var n=i.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=i.parseLinks(e.link))}catch(e){}},r.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.created=201==e,this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e,this.unprocessableEntity=422==e}},function(e,t,n){t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce((function(e,t){var n=t.split(/ *= */),i=n.shift(),r=n.shift();return i&&r&&(e[i]=r),e}),{})},t.parseLinks=function(e){return e.split(/ *, */).reduce((function(e,t){var n=t.split(/ *; */),i=n[0].slice(1,-1);return e[n[1].split(/ *= */)[1].slice(1,-1)]=i,e}),{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},function(e,t){function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach((function(e){n.prototype[e]=function(){return this._defaults.push({fn:e,arguments:arguments}),this}})),n.prototype._setDefaults=function(e){this._defaults.forEach((function(t){e[t.fn].apply(e,t.arguments)}))},e.exports=n},function(e,t,n){(function(i){var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(11)),s=r(n(12)),a=r(n(5)),c=r(n(6)),l=r(n(4)),u=r(n(135));function d(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}var h=function(){function e(){(0,a.default)(this,e)}var t,n,r,l,h,p,f,g,m;return(0,c.default)(e,[{key:"encrypt",value:(m=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:if(i=e.sent,!(n instanceof ArrayBuffer)){e.next=7;break}return e.abrupt("return",this.encryptArrayBuffer(i,n));case 7:if("string"!=typeof n){e.next=11;break}return e.abrupt("return",this.encryptString(i,n));case 11:throw new Error("Cannot encrypt this file. In browsers file encryption supports only string or ArrayBuffer");case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"decrypt",value:(g=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:if(i=e.sent,!(n instanceof ArrayBuffer)){e.next=7;break}return e.abrupt("return",this.decryptArrayBuffer(i,n));case 7:if("string"!=typeof n){e.next=11;break}return e.abrupt("return",this.decryptString(i,n));case 11:throw new Error("Cannot decrypt this file. In browsers file decryption supports only string or ArrayBuffer");case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"encryptFile",value:(f=(0,s.default)(o.default.mark((function e(t,n,i){var r,s,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:return r=e.sent,e.next=5,n.toArrayBuffer();case 5:return s=e.sent,e.next=8,this.encryptArrayBuffer(r,s);case 8:return a=e.sent,e.abrupt("return",i.create({name:n.name,mimeType:"application/octet-stream",data:a}));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return f.apply(this,arguments)})},{key:"decryptFile",value:(p=(0,s.default)(o.default.mark((function e(t,n,i){var r,s,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getKey(t);case 2:return r=e.sent,e.next=5,n.toArrayBuffer();case 5:return s=e.sent,e.next=8,this.decryptArrayBuffer(r,s);case 8:if(a=e.sent,!(n.data instanceof ArrayBuffer)){e.next=13;break}return e.abrupt("return",i.create({name:n.name,data:a}));case 13:throw new Error("Cannot decrypt this file. In browser environment file decryption supports only ArrayBuffer.");case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"getKey",value:(h=(0,s.default)(o.default.mark((function e(t){var n,r,s;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.from(t),e.next=3,u.default.subtle.digest("SHA-256",n.buffer);case 3:return r=e.sent,s=i.from(i.from(r).toString("hex").slice(0,32),"utf8").buffer,e.abrupt("return",u.default.subtle.importKey("raw",s,"AES-CBC",!0,["encrypt","decrypt"]));case 6:case"end":return e.stop()}}),e)}))),function(e){return h.apply(this,arguments)})},{key:"encryptArrayBuffer",value:(l=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=u.default.getRandomValues(new Uint8Array(16)),e.t0=d,e.t1=i.buffer,e.next=5,u.default.subtle.encrypt({name:"AES-CBC",iv:i},t,n);case 5:return e.t2=e.sent,e.abrupt("return",(0,e.t0)(e.t1,e.t2));case 7:case"end":return e.stop()}}),e)}))),function(e,t){return l.apply(this,arguments)})},{key:"decryptArrayBuffer",value:(r=(0,s.default)(o.default.mark((function e(t,n){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.slice(0,16),e.abrupt("return",u.default.subtle.decrypt({name:"AES-CBC",iv:i},t,n.slice(16)));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})},{key:"encryptString",value:(n=(0,s.default)(o.default.mark((function e(t,n){var r,s,a,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.default.getRandomValues(new Uint8Array(16)),s=i.from(n).buffer,e.next=4,u.default.subtle.encrypt({name:"AES-CBC",iv:r},t,s);case 4:return a=e.sent,c=d(r.buffer,a),e.abrupt("return",i.from(c).toString("utf8"));case 7:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"decryptString",value:(t=(0,s.default)(o.default.mark((function e(t,n){var r,s,a,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.from(n),s=r.slice(0,16),a=r.slice(16),e.next=5,u.default.subtle.decrypt({name:"AES-CBC",iv:s},t,a);case 5:return c=e.sent,e.abrupt("return",i.from(c).toString("utf8"));case 7:case"end":return e.stop()}}),e)}))),function(e,n){return t.apply(this,arguments)})},{key:"algo",get:function(){return"aes-256-cbc"}}]),e}();t.default=h,(0,l.default)(h,"IV_LENGTH",16),e.exports=t.default}).call(this,n(21).Buffer)},function(e,t,n){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o,s=i(n(11)),a=i(n(12)),c=i(n(5)),l=i(n(6)),u=i(n(4)),d=(n(25),o=r=function(){function e(t){if((0,c.default)(this,e),(0,u.default)(this,"data",void 0),(0,u.default)(this,"name",void 0),(0,u.default)(this,"mimeType",void 0),t instanceof File)this.data=t,this.name=this.data.name,this.mimeType=this.data.type;else if(t.data){var n=t.data;this.data=new File([n],t.name,{type:t.mimeType}),this.name=t.name,t.mimeType&&(this.mimeType=t.mimeType)}if(void 0===this.data)throw new Error("Couldn't construct a file out of supplied options.");if(void 0===this.name)throw new Error("Couldn't guess filename out of the options. Please provide one.")}var t,n,i,r,o,d,h;return(0,l.default)(e,null,[{key:"create",value:function(e){return new this(e)}}]),(0,l.default)(e,[{key:"toBuffer",value:(h=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("This feature is only supported in Node.js environments.");case 1:case"end":return e.stop()}}),e)}))),function(){return h.apply(this,arguments)})},{key:"toStream",value:(d=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("This feature is only supported in Node.js environments.");case 1:case"end":return e.stop()}}),e)}))),function(){return d.apply(this,arguments)})},{key:"toFileUri",value:(o=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("This feature is only supported in react native environments.");case 1:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"toBlob",value:(r=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.data);case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"toArrayBuffer",value:(i=(0,a.default)(s.default.mark((function e(){var t=this;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var i=new FileReader;i.addEventListener("load",(function(){if(i.result instanceof ArrayBuffer)return e(i.result)})),i.addEventListener("error",(function(){n(i.error)})),i.readAsArrayBuffer(t.data)})));case 1:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"toString",value:(n=(0,a.default)(s.default.mark((function e(){var t=this;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var i=new FileReader;i.addEventListener("load",(function(){if("string"==typeof i.result)return e(i.result)})),i.addEventListener("error",(function(){n(i.error)})),i.readAsBinaryString(t.data)})));case 1:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"toFile",value:(t=(0,a.default)(s.default.mark((function e(){return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.data);case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),(0,u.default)(r,"supportsFile","undefined"!=typeof File),(0,u.default)(r,"supportsBlob","undefined"!=typeof Blob),(0,u.default)(r,"supportsArrayBuffer","undefined"!=typeof ArrayBuffer),(0,u.default)(r,"supportsBuffer",!1),(0,u.default)(r,"supportsStream",!1),(0,u.default)(r,"supportsString",!0),(0,u.default)(r,"supportsEncryptFile",!0),(0,u.default)(r,"supportsFileUri",!1),o);t.default=d,e.exports=t.default},function(t,n,i){i.r(n),
|
|
184
184
|
/**
|
|
185
185
|
* @file Web Cryptography API shim
|
|
186
186
|
* @author Artem S Vybornov <vybornov@gmail.com>
|
|
187
187
|
* @license MIT
|
|
188
188
|
*/
|
|
189
|
-
function(t,n){e.exports?e.exports=n(t):n(t)}("undefined"!=typeof self?self:void 0,(function(e){if("function"!=typeof Promise)throw"Promise support required";var t=e.crypto||e.msCrypto;if(t){var n=t.subtle||t.webkitSubtle;if(n){var i=e.Crypto||t.constructor||Object,r=e.SubtleCrypto||n.constructor||Object,o=(e.CryptoKey||e.Key,e.navigator.userAgent.indexOf("Edge/")>-1),s=!!e.msCrypto&&!o,a=!t.subtle&&!!t.webkitSubtle;if(s||a){var c={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},l={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach((function(e){var i=n[e];n[e]=function(r,o,c){var l,u,d,f,w=[].slice.call(arguments);switch(e){case"generateKey":l=g(r),u=o,d=c;break;case"importKey":l=g(c),u=w[3],d=w[4],"jwk"===r&&((o=v(o)).alg||(o.alg=m(l)),o.key_ops||(o.key_ops="oct"!==o.kty?"d"in o?d.filter(x):d.filter(S):d.slice()),w[1]=y(o));break;case"unwrapKey":l=w[4],u=w[5],d=w[6],w[2]=c._key}if("generateKey"===e&&"HMAC"===l.name&&l.hash)return l.length=l.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[l.hash.name],n.importKey("raw",t.getRandomValues(new Uint8Array(l.length+7>>3)),l,u,d);if(a&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===l.name&&(!l.modulusLength||l.modulusLength>=2048))return(r=g(r)).name="RSAES-PKCS1-v1_5",delete r.hash,n.generateKey(r,!0,["encrypt","decrypt"]).then((function(e){return Promise.all([n.exportKey("jwk",e.publicKey),n.exportKey("jwk",e.privateKey)])})).then((function(e){return e[0].alg=e[1].alg=m(l),e[0].key_ops=d.filter(S),e[1].key_ops=d.filter(x),Promise.all([n.importKey("jwk",e[0],l,!0,e[0].key_ops),n.importKey("jwk",e[1],l,u,e[1].key_ops)])})).then((function(e){return{publicKey:e[0],privateKey:e[1]}}));if((a||s&&"SHA-1"===(l.hash||{}).name)&&"importKey"===e&&"jwk"===r&&"HMAC"===l.name&&"oct"===o.kty)return n.importKey("raw",p(h(o.k)),c,w[3],w[4]);if(a&&"importKey"===e&&("spki"===r||"pkcs8"===r))return n.importKey("jwk",b(o),c,w[3],w[4]);if(s&&"unwrapKey"===e)return n.decrypt(w[3],c,o).then((function(e){return n.importKey(r,e,w[4],w[5],w[6])}));try{f=i.apply(n,w)}catch(e){return Promise.reject(e)}return s&&(f=new Promise((function(e,t){f.onabort=f.onerror=function(e){t(e)},f.oncomplete=function(t){e(t.target.result)}}))),f=f.then((function(e){return"HMAC"===l.name&&(l.length||(l.length=8*e.algorithm.length)),0==l.name.search("RSA")&&(l.modulusLength||(l.modulusLength=(e.publicKey||e).algorithm.modulusLength),l.publicExponent||(l.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e.publicKey&&e.privateKey?{publicKey:new P(e.publicKey,l,u,d.filter(S)),privateKey:new P(e.privateKey,l,u,d.filter(x))}:new P(e,l,u,d)}))}})),["exportKey","wrapKey"].forEach((function(e){var t=n[e];n[e]=function(i,r,o){var c,l=[].slice.call(arguments);switch(e){case"exportKey":l[1]=r._key;break;case"wrapKey":l[1]=r._key,l[2]=o._key}if((a||s&&"SHA-1"===(r.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===i&&"HMAC"===r.algorithm.name&&(l[0]="raw"),!a||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(l[0]="jwk"),s&&"wrapKey"===e)return n.exportKey(i,r).then((function(e){return"jwk"===i&&(e=p(unescape(encodeURIComponent(JSON.stringify(v(e)))))),n.encrypt(l[3],o,e)}));try{c=t.apply(n,l)}catch(e){return Promise.reject(e)}return s&&(c=new Promise((function(e,t){c.onabort=c.onerror=function(e){t(e)},c.oncomplete=function(t){e(t.target.result)}}))),"exportKey"===e&&"jwk"===i&&(c=c.then((function(e){return(a||s&&"SHA-1"===(r.algorithm.hash||{}).name)&&"HMAC"===r.algorithm.name?{kty:"oct",alg:m(r.algorithm),key_ops:r.usages.slice(),ext:!0,k:d(f(e))}:((e=v(e)).alg||(e.alg=m(r.algorithm)),e.key_ops||(e.key_ops="public"===r.type?r.usages.filter(S):"private"===r.type?r.usages.filter(x):r.usages.slice()),e)}))),!a||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(c=c.then((function(e){return w(v(e))}))),c}})),["encrypt","decrypt","sign","verify"].forEach((function(e){var t=n[e];n[e]=function(i,r,o,a){if(s&&(!o.byteLength||a&&!a.byteLength))throw new Error("Empy input is not allowed");var c,l=[].slice.call(arguments),u=g(i);if(s&&"decrypt"===e&&"AES-GCM"===u.name){var d=i.tagLength>>3;l[2]=(o.buffer||o).slice(0,o.byteLength-d),i.tag=(o.buffer||o).slice(o.byteLength-d)}l[1]=r._key;try{c=t.apply(n,l)}catch(e){return Promise.reject(e)}return s&&(c=new Promise((function(t,n){c.onabort=c.onerror=function(e){n(e)},c.oncomplete=function(n){if(n=n.target.result,"encrypt"===e&&n instanceof AesGcmEncryptResult){var i=n.ciphertext,r=n.tag;(n=new Uint8Array(i.byteLength+r.byteLength)).set(new Uint8Array(i),0),n.set(new Uint8Array(r),i.byteLength),n=n.buffer}t(n)}}))),c}})),s){var u=n.digest;n.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var i;try{i=u.call(n,e,t)}catch(e){return Promise.reject(e)}return i=new Promise((function(e,t){i.onabort=i.onerror=function(e){t(e)},i.oncomplete=function(t){e(t.target.result)}}))},e.crypto=Object.create(t,{getRandomValues:{value:function(e){return t.getRandomValues(e)}},subtle:{value:n}}),e.CryptoKey=P}a&&(t.subtle=n,e.Crypto=i,e.SubtleCrypto=r,e.CryptoKey=P)}}}function d(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){return e=(e+="===").slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function p(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function f(e){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),String.fromCharCode.apply(String,e)}function g(e){var t={name:(e.name||e||"").toUpperCase().replace("V","v")};switch(t.name){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;case"AES-CBC":case"AES-GCM":case"AES-KW":e.length&&(t.length=e.length);break;case"HMAC":e.hash&&(t.hash=g(e.hash)),e.length&&(t.length=e.length);break;case"RSAES-PKCS1-v1_5":e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;case"RSASSA-PKCS1-v1_5":case"RSA-OAEP":e.hash&&(t.hash=g(e.hash)),e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;default:throw new SyntaxError("Bad algorithm name")}return t}function m(e){return{HMAC:{"SHA-1":"HS1","SHA-256":"HS256","SHA-384":"HS384","SHA-512":"HS512"},"RSASSA-PKCS1-v1_5":{"SHA-1":"RS1","SHA-256":"RS256","SHA-384":"RS384","SHA-512":"RS512"},"RSAES-PKCS1-v1_5":{"":"RSA1_5"},"RSA-OAEP":{"SHA-1":"RSA-OAEP","SHA-256":"RSA-OAEP-256"},"AES-KW":{128:"A128KW",192:"A192KW",256:"A256KW"},"AES-GCM":{128:"A128GCM",192:"A192GCM",256:"A256GCM"},"AES-CBC":{128:"A128CBC",192:"A192CBC",256:"A256CBC"}}[e.name][(e.hash||{}).name||e.length||""]}function v(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=JSON.parse(decodeURIComponent(escape(f(e)))));var t={kty:e.kty,alg:e.alg,ext:e.ext||e.extractable};switch(t.kty){case"oct":t.k=e.k;case"RSA":["n","e","d","p","q","dp","dq","qi","oth"].forEach((function(n){n in e&&(t[n]=e[n])}));break;default:throw new TypeError("Unsupported key type")}return t}function y(e){var t=v(e);return s&&(t.extractable=t.ext,delete t.ext),p(unescape(encodeURIComponent(JSON.stringify(t)))).buffer}function b(e){var t=k(e),n=!1;t.length>2&&(n=!0,t.shift());var i={ext:!0};switch(t[0][0]){case"1.2.840.113549.1.1.1":var r=["n","e","d","p","q","dp","dq","qi"],o=k(t[1]);n&&o.shift();for(var s=0;s<o.length;s++)o[s][0]||(o[s]=o[s].subarray(1)),i[r[s]]=d(f(o[s]));i.kty="RSA";break;default:throw new TypeError("Unsupported key type")}return i}function w(e){var t,n=[["",null]],i=!1;switch(e.kty){case"RSA":for(var r=["n","e","d","p","q","dp","dq","qi"],o=[],s=0;s<r.length&&r[s]in e;s++){var a=o[s]=p(h(e[r[s]]));128&a[0]&&(o[s]=new Uint8Array(a.length+1),o[s].set(a,1))}o.length>2&&(i=!0,o.unshift(new Uint8Array([0]))),n[0][0]="1.2.840.113549.1.1.1",t=o;break;default:throw new TypeError("Unsupported key type")}return n.push(new Uint8Array(_(t)).buffer),i?n.unshift(new Uint8Array([0])):n[1]={tag:3,value:n[1]},new Uint8Array(_(n)).buffer}function k(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),t.end-t.pos<2||t.end>e.length)throw new RangeError("Malformed DER");var n,i=e[t.pos++],r=e[t.pos++];if(r>=128){if(r&=127,t.end-t.pos<r)throw new RangeError("Malformed DER");for(var o=0;r--;)o<<=8,o|=e[t.pos++];r=o}if(t.end-t.pos<r)throw new RangeError("Malformed DER");switch(i){case 2:n=e.subarray(t.pos,t.pos+=r);break;case 3:if(e[t.pos++])throw new Error("Unsupported bit string");r--;case 4:n=new Uint8Array(e.subarray(t.pos,t.pos+=r)).buffer;break;case 5:n=null;break;case 6:var s=btoa(f(e.subarray(t.pos,t.pos+=r)));if(!(s in c))throw new Error("Unsupported OBJECT ID "+s);n=c[s];break;case 48:n=[];for(var a=t.pos+r;t.pos<a;)n.push(k(e,t));break;default:throw new Error("Unsupported DER tag 0x"+i.toString(16))}return n}function _(e,t){t||(t=[]);var n=0,i=0,r=t.length+2;if(t.push(0,0),e instanceof Uint8Array){n=2,i=e.length;for(var o=0;o<i;o++)t.push(e[o])}else if(e instanceof ArrayBuffer)for(n=4,i=e.byteLength,e=new Uint8Array(e),o=0;o<i;o++)t.push(e[o]);else if(null===e)n=5,i=0;else if("string"==typeof e&&e in l){var s=p(atob(l[e]));for(n=6,i=s.length,o=0;o<i;o++)t.push(s[o])}else if(e instanceof Array){for(o=0;o<e.length;o++)_(e[o],t);n=48,i=t.length-r}else{if(!("object"==typeof e&&3===e.tag&&e.value instanceof ArrayBuffer))throw new Error("Unsupported DER value "+e);for(n=3,i=(e=new Uint8Array(e.value)).byteLength,t.push(0),o=0;o<i;o++)t.push(e[o]);i++}if(i>=128){var a=i;for(i=4,t.splice(r,0,a>>24&255,a>>16&255,a>>8&255,255&a);i>1&&!(a>>24);)a<<=8,i--;i<4&&t.splice(r,4-i),i|=128}return t.splice(r-2,2,n,i),t}function P(e,t,n,i){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===n?e.extractable:n,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===i?e.usages:i,enumerable:!0}})}function S(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function x(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}})),n.default=window.crypto}])})),_e=(we=ke)&&we.__esModule&&Object.prototype.hasOwnProperty.call(we,"default")?we.default:we;ke.PubNub;const Pe=(e,t,n=null)=>{n&&(t["Program ID"]=n),n&&se.progResource[n]&&(t=Object.assign(Object.assign({},t),se.progResource[n].analytics_properties)),!0===se.logger&&console.log("Mixpanel track event: ",e),window.mixpanel&&window.mixpanel.track(e,t)},Se=(e,t,n)=>{const{message:i,id:r,image_url:o,messageLink:s}=e,a=i&&i.match(/:([^:]*):/g),c={"Chat Room ID":t,"Chat Message ID":r,"Has External Image":!!o};a&&a.length>0&&(c["Sticker Shortcodes"]=a),s&&(c["Chat Message Link"]=s),Pe(n,c)};let xe;const Oe=()=>_e.generateUUID(),Te=e=>xe&&!xe.getSubscribedChannels().some((t=>t===e))&&(e=>xe.subscribe({channels:[e]}))(e),Ce=e=>xe.addListener(e),Ee=(e,t={count:25,end:null,start:null})=>new Promise(((n,i)=>{xe.fetchMessages({channels:[e],count:t.count,stringifiedTimeToken:!0,start:t.start,end:t.end,includeMessageActions:!0},((e,t)=>e.error?i(e):n(t)))})),Ae={add:(e,t,n,i,r,o)=>xe.addMessageAction({channel:e,messageTimetoken:t,action:n},(function(e,t){e.error?o("Error creating reaction"):(Pe("Chat Reaction Added",i),r(t))})),remove:(e,t,n,i,r,o)=>xe.removeMessageAction({channel:e,messageTimetoken:t,actionTimetoken:n},(function(e,t){e.error?o("Error removing reaction"):(Pe("Chat Reaction Removed",i),r(t))}))},Re=e=>t=>{if(!t.url&&!t.path)return console.warn("Need either a url or a path"),Promise.reject("Need either a url or a path");let n,i,r=t.accessToken;const o=se.storageStrategy.get(),s=o&&o.access_token;void 0===r&&(r=s||se.accessToken||ce.access_token),t.url?i=t.url:t.path&&(i=se.endpoint+t.path);const a=new Headers;r&&a.append("Authorization","Bearer "+r),"POST"!==e&&"PATCH"!==e||(a.append("Content-Type","application/json"),t.data&&(n=JSON.stringify(t.data)));const c=new Request(i,{method:e,body:n,headers:a});return fetch(c).then((e=>{let t={400:"Incorrect data.",401:"Unauthorized. Access token missing from request.",403:"Access Denied. Access token incorrect.",404:"Resource not found.",405:"Method not allowed.",409:"Resource already exists",415:"Unsupported media type."}[e.status];if(e.status>=500&&(t="Server error. Try again."),e.status>=300)return Promise.reject({status:e.status,message:t});{const t=e.headers.get("content-type");return t&&-1!==t.indexOf("application/json")?e.json():void 0}}))},Me={get:Re("GET"),put:Re("PUT"),post:Re("POST"),patch:Re("PATCH"),delete:Re("DELETE")},je="messagedeleted",Le="messagereceived",Ne={"chatroom-updated":"chatroom-updated","message-deleted":je,"message-created":Le,"image-created":Le,"custom-message-created":Le,"image-deleted":je,"message-updated":"messageupdated","message-sent":"messagesent",added:"reactionadded",removed:"reactionremoved"},Ue=e=>{const t=e.match(/(-)?P(?:([.,\d]+)Y)?(?:([.,\d]+)M)?(?:([.,\d]+)W)?(?:([.,\d]+)D)?(?:T(?:([.,\d]+)H)?(?:([.,\d]+)M)?(?:([.,\d]+)S)?)?/);return(t[8]&&1e3*t[8])+(t[7]&&6e4*t[7])+(t[6]&&36e5*t[6])+(t[5]&&864e5*t[5])},Ie=e=>e.split("-").map((e=>e[0].toUpperCase()+e.substr(1).toLowerCase())).join(" ");function De(e,t){return Object.keys(t).forEach((n=>{!e.hasOwnProperty(n)||"object"!=typeof e[n]||e[n]instanceof Array?e[n]=t[n]:De(e[n],t[n])})),e}const $e=(e,t)=>{const n=e.slice();return n.splice(e.length,0,t),n},Be=(e,t)=>{const n="text-prediction-follow-up"===t.kind||"image-prediction-follow-up"===t.kind;return e.attach(t).then((()=>n?Promise.resolve():t.interactive())).then((()=>t.results({timeout:n&&t.timeout?Ue(t.timeout):5e3})))},Fe=({target:e,widget:t})=>Be(e,t).then(t.expire).then((()=>e.detach(t))),Ke=({target:e,widget:t})=>{t.hide_dismiss_button=!0,t.initialLoad?e.attach(t,"append").then(t.results).then(t.expire).then(t.finished):Be(e,t).then(t.expire).then(t.finished)},qe=e=>{const{target:t,widget:n,timer:i}=e,{widgetPayload:r}=n;n.hide_dismiss_button=!0;const o="text-prediction-follow-up"===n.kind||"image-prediction-follow-up"===n.kind;return t.attach(n,n.initialLoad?"append":"prepend").then((()=>{let e=!1;switch(n.kind){case"text-prediction-follow-up":case"image-prediction-follow-up":{const n=r.text_prediction_id||r.image_prediction_id;let i=t.querySelector(`[widgetid="${n}"]`);i&&(!i.disabled||i.phase!==de&&i.phase!==ue)&&i.results(),e=!0;break}case"text-prediction":case"image-prediction":e=r.follow_ups.some((e=>"published"===e.status));break;case"text-quiz":case"image-quiz":n.interaction||n.addEventListener("answer",(e=>{n.results()})),e=!!n.interaction;break;case"emoji-slider":n.interaction||n.addEventListener("slider",(e=>{setTimeout(n.results,2e3)})),e=!!n.interaction;break;case"text-ask":n.interaction||n.addEventListener("reply",(e=>{n.results()})),e=!!n.interaction;break;default:e=!1}return e?Promise.resolve():n.interactive&&n.interactive({timeout:i||null})})).then((()=>n.results({timeout:o&&n.timeout?Ue(n.timeout):5e3}))).then(n.expire).then((()=>n.finished({timeout:null})))},ze=(e,t)=>(...n)=>{let i;return clearTimeout(i,i=setTimeout(e,t||250,...n))},He=(e,t,n)=>new Date(e).toLocaleDateString(n||"en-US",t),Ve=e=>{if(!e.lang){const t=n=>{const i=n.querySelector("[lang]");i?e.lang=i.getAttribute("lang"):n.parentElement&&t(n.parentElement)};t(e.parentElement)}},Ge=(e,t,n=0)=>{const i=e.options||e.choices,r=t.vote_count?"vote_count":"answer_count",o=i.reduce(((e,t)=>e+t[r]),0);return o>0?Math.round(t[r]/o*100):n},We=(e,t)=>{const n=se.chatRooms[e]&&"none"!==se.chatRooms[e].content_filter&&t.content_filter&&t.content_filter.length>0,i=t.sender_id===ce.id;return"Producer"===ce.nickname||i||!n},Ye=(e,t)=>{if(t&&Array.isArray(t)){const n=[],i=[];return t.map((t=>{const r=t.entry||t.message;We(e,r.payload)&&(r.payload.timetoken=t.timetoken,r.payload.reactions=t.data&&t.data.rc?t.data.rc:{},"messagereceived"===Ne[r.event]?n.push(r.payload):i.push(r.payload))})),i.map((e=>{const t=n.findIndex((t=>t.id===e.id));-1!==t&&n.splice(t,1)})),n}return[]},Je=(e,t)=>t&&encodeURI(t.replace(/{(.*?)}/g,e)),Xe=(e,t)=>e?fetch(e).then((e=>{const n=404===e.status,i=403===e.status,r="Room"===t&&e.status>202;if(n||r||i)return Promise.reject(`${t} resource not found. Check ${t} Id.\nRead more: https://www.npmjs.com/package/@livelike/engagementsdk`);{const t=e.headers.get("content-type");return t&&-1!==t.indexOf("application/json")?e.json():void 0}})):Promise.reject(`${t} url missing.`),Ze={program:e=>Xe(Je(e,se.programUrlTemplate),"Program"),app:e=>Xe(encodeURI(`${se.endpoint}applications/${e}/`),"Client"),chatRoom:e=>Xe(Je(e,se.chatUrlTemplate),"Room"),leaderboard:e=>Xe(Je(e,se.leaderboardUrlTemplate),"Leaderboard"),leaderboardEntryDetail:(e,t)=>Xe(Je(t,e),"Leaderboard Entry")},Qe=(e,t,n)=>e[t]?Promise.resolve(e[t]):Ze[n](t).then((n=>(e[t]=n,n))).catch((e=>Promise.reject(e))),et=()=>Qe(se.appResource,se.clientId,"app"),tt=e=>Qe(se.chatRooms,e,"chatRoom"),nt=e=>Qe(se.progResource,e,"program"),it=e=>new Promise(((t,n)=>se.chatRooms&&se.chatRooms[e]&&se.chatRooms[e].channels?t(se.chatRooms[e].channels.chat.pubnub):tt(e).then((e=>t(e.channels.chat.pubnub))).catch((e=>n(e)))));function rt(e,t,n){let i={next:e,prev:null};const r=e=>i[e]?t(i[e]).then((e=>(i={next:e.next,prev:e.previous},Promise.resolve({value:n(e),done:!e.next})))):Promise.resolve({done:!0});return{[Symbol.asyncIterator]:()=>({next:()=>r("next"),previous:()=>r("prev")}),next:()=>r("next"),previous:()=>r("prev")}}const ot=(e,t)=>t.next().then((n=>{let i={count:n.value.count,iterator:t,next:t.next,previous:t.previous};return e.forEach((e=>{i[e]=n.value[e]})),i}));const st=function(e){e=e||Object.create(null);const t=(t,n)=>(e[t]||(e[t]=[])).push(n);return{on:t,peak:()=>e,uniqueOn:(n,i)=>(!e[n]||0===e[n].length)&&t(n,i),off:(t,n)=>{e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:(t,n)=>{(e[t]||[]).slice().map((e=>e(n))),(e["*"]||[]).slice().map((e=>e(t,n)))}}}();se.eb=st.peak;const at=(e,t,n)=>{const i=new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return e.dispatchEvent(i),i};function ct(e,t){return at(e,t,{}).detail.provider}const lt=e=>`\nSee https://docs.livelike.com/docs/${e||"getting-started-with-the-web-sdk"} for more details.`,ut=(e,t="")=>console.error(e,(e=>{const t=ae.version.split(".");return t[2]="0","See https://websdk.livelikecdn.com/docs/"+t.join(".")+"/modules/_scripts_"+e+"_.html for more details."})(t)),dt=(e,t,n)=>console.error(`${e}: ${t} must be of type <${n}>`),ht=(e,t)=>Promise.reject(((e,t)=>ut("Missing "+e+" argument\n",t))(e,t)),pt=(e,t)=>console.error(e,lt(t)),ft=e=>e.parentElement&&e.parentElement.localName===e.localName&&console.error(e.localName+" cannot be a child of itself."),gt={get:()=>JSON.parse(localStorage.getItem(se.lsKey)),set:e=>localStorage.setItem(se.lsKey,JSON.stringify(e))},mt=(e,t,n)=>se.chatRooms[e][n]&&(e=>new Promise((t=>{let n=[],i=!0;setTimeout((()=>i=!1),1e4);const r=e=>Me.get({url:e}).then((e=>{e&&e.results?(n=[...n,...e.results],e.next?r(e.next):t(n)):t([])})).catch((()=>i?setTimeout((()=>r(e)),2e3):t([])));r(e)})))(se.chatRooms[e][n]).then((n=>(se.chatRooms[e][t]=n,n))),vt=(e,t,n)=>{let i=t&&t.slice(0,2);t&&se.localizedStrings[i]||(i="en");let r=se.localizedStrings[i][e]||se.localizedStrings.en[e];return r&&n&&Object.keys(n).forEach((e=>r=r.replace("<"+e+">",n[e]))),r};const yt=function(){let e=!1,t={};return(n,i,r)=>new Promise((o=>{const s=()=>{if(e)setTimeout(s,50);else if(e=!0,!t[r]&&(t[r]={}),t[r].sequence&&i!==t[r].sequence)e=!1,o(t[r]);else{t[r].sequence=i+1;const s=localStorage.getItem("ltt-"+r),a=!s||n>s;a&&localStorage.setItem("ltt-"+r,n),t[r].allowNext=a,e=!1,o(t[r])}};s()}))}(),bt=(()=>{const e=[];return{add:(t,n,i,r)=>{e.push({id:n,listener:r,callback:i}),Ce(r),Te(t)},remove:(t,n)=>{const i=e.findIndex((e=>e.id===t&&String(e.callback)===String(n)));var r;-1!==i?(r=e[i].listener,xe.removeListener(r),e.splice(i,1)):console.warn("Listener not removed. Check arguments.")}}})(),wt=e=>e&&"object"==typeof e?e:{get currentTimecode(){return null}},kt=(e,t,n)=>{if(!e.isUpdating){e.isUpdating=!0;const i=()=>{e.queue&&e.queue.hasNextItem()?e.queue.isNextItemReady()&&t()?(n(e.queue.dequeueItem()),i()):setTimeout((()=>{e.isUpdating=!1,i()}),1e3):e.isUpdating=!1};i()}},_t=(e,t)=>{let n=0;const i=()=>{30===n||e.syncStrategy&&void 0!==e.syncStrategy.currentTimecode?t():setTimeout((()=>{n++,i()}),100)};i()},Pt=e=>({number:!0,string:!isNaN(Date.parse(St(e))),object:e instanceof Date&&!isNaN(e.getTime())}[typeof e]),St=e=>"string"==typeof e&&/^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2}(?:[,.]\d*)?)(([+-](\d{2}):(\d{2})|Z)?)$/.test(e)?e.replace(",","."):e,xt=({widgets:e,interactions:t})=>e.map((e=>{let n=Ot(e);if(n){const{kind:i,id:r}=n;return{widgetPayload:e,interactions:t&&t[i]?t[i].filter((e=>e.widget_id===r)):null}}return{widgetPayload:e,interactions:null}})),Ot=e=>be.some((t=>e.kind===t))?{kind:e.kind.replace("-follow-up",""),id:e.kind===ge||e.kind===me?e.text_prediction_id||e.image_prediction_id:e.id}:null,Tt=e=>class extends e{connectedCallback(){super.connectedCallback()}render(){return this.customTemplate?this.customTemplate():this.defaultTemplate()}},Ct=e=>class extends e{constructor(){super(...arguments),this.updateOwnerProps=e=>{this.owner.widgetPayload.id===e.key&&this.owner.dataId===e.owner.dataId&&(this.ownerUpdated(e),"disabled"!==e.name&&"changed"!==e.name||(this[e.name]=e.prop),"options"!==e.name&&"choices"!==e.name||(this[e.name]=e.prop,this.items=e.prop,this.optionListUpdated(e.prop),at(this,"options-updated",this.items)))}}static get properties(){return{owner:{type:Object},items:{type:Array},options:{type:Array},choices:{type:Array},disabled:{type:Boolean,reflect:!0},changed:{type:Boolean,reflect:!0}}}ownerUpdated(e){}optionListUpdated(e){}optionUpdated(e){}connectedCallback(){super.connectedCallback(),st.on("widget-updated",this.updateOwnerProps),!this.owner&&(this.owner=ct(this,"widget-provider")),this.items=this.owner.options||this.owner.choices,this.owner.options&&(this.options=this.owner.options),this.owner.choices&&(this.choices=this.owner.choices)}disconnectedCallback(){st.off("widget-updated",this.updateOwnerProps),super.disconnectedCallback()}};class Et extends(Ct(oe)){}const At=e=>class extends e{constructor(){super(...arguments),this.appendStyles=e=>{(this.shadowRoot||this).appendChild(e)},this.updateTheme=e=>e.theme&&e.theme.widgets&&this.defaultStyles&&this.updateComplete.then((()=>{const t=this.owner.kind||this.owner.localName.replace("livelike-",""),n=pe[t],i=e.theme.widgets[n],r=document.createElement("style");r.innerHTML+=this.defaultStyles(i),this.appendStyles(r)}))}connectedCallback(){super.connectedCallback(),st.on("themeUpdate",this.updateTheme),this.updateTheme({theme:this.owner.theme||ae.theme})}disconnectedCallback(){st.off("themeUpdate",this.updateTheme),super.disconnectedCallback()}};class Rt extends(Tt(At(Et))){}const Mt=["selected","correct","incorrect","image","disabled"],jt=e=>class extends e{constructor(){super(...arguments),this.updateItem=e=>{this.item&&this.item.id===e.key&&this.owner.widgetPayload.id===e.owner.widgetPayload.id&&this.owner.dataId===e.owner.dataId&&(("items"===e.name||"options"===e.name||"choices"===e.name)&&(this[e.name.slice(0,-1)]=e.prop.find((e=>e.id===this.item.id))),this.requestUpdate(),super.requestUpdate(),this.optionUpdated(this.item),Mt.some((t=>t===e.name))&&(this[e.name]=e.prop))}}static get properties(){return{item:{type:Object},option:{type:Object},choice:{type:Object},selected:{type:Boolean,reflect:!0},correct:{type:Boolean,reflect:!0},incorrect:{type:Boolean,reflect:!0},image:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}}}connectedCallback(){st.on("option-updated",this.updateItem);const e=ct(this,"option-provider");e&&(this.item=e.item,e.option&&(this.option=e.option),e.choice&&(this.choice=e.choice)),super.connectedCallback()}disconnectedCallback(){st.off("option-updated",this.updateItem),super.disconnectedCallback()}};class Lt extends(Tt(At(jt(Et)))){}const{modeList:Nt,getMode:Ut,register:It}=function(){const e={};return{modeList:e,getMode:t=>"function"==typeof t?t:e[t]?e[t]:pt('Widget mode: "'+t+'" not found.'),register:(t,n)=>e[t]=n}}(),Dt=({programId:e})=>e?nt(e).then((e=>{const t=e.subscribe_channel;return rt(e.timeline_url,(e=>{const n=[];let i="";return fetch(e).then((e=>{const r=e.headers&&Number(e.headers.get("age"));if(r&&r>0){const e=(new Date).getTime()-1e3*r+"0111";Ee(t,{end:e}).then((e=>e.channels[t]&&e.channels[t].map((e=>{if(e.message&&e.message.payload){n.push(e.message.payload);let t=Ot(e.message.payload);if(t){const{kind:e,id:n}=t;i=i+"&"+e.replace(/-/g,"_")+"_id="+n}}}))))}return e.json()})).then((e=>(e.results=[...n,...e.results],e.widget_interactions_url_template.includes("?")&&i?e.widget_interactions_url_template=e.widget_interactions_url_template+i:i&&!e.widget_interactions_url_template.includes("?")&&(e.widget_interactions_url_template=e.widget_interactions_url_template+"?"+i),e)))}),(e=>({count:e.count,widgets:e.results,widget_interactions_url_template:e.widget_interactions_url_template})))})):ht("programId","getwidgets"),$t=e=>{const t="z"===e.kind[e.kind.length-1]?"zes":"s";return fetch(se.endpoint+e.kind+t+"/"+e.id+"/").then((e=>e.ok?e.json():Promise.reject("Error getting widget")))},Bt=(e,t)=>It(e,t),Ft=e=>{if(e.programId||e.interactionUrl){if(e.interactionUrl&&!e.interactionUrl.includes("?"))return Promise.reject("No Interaction Found");{let t="";return e.interactionUrl?(t=e.interactionUrl,Me.get({url:Je(ce.id,e.interactionUrl)}).then((e=>Promise.resolve(e.interactions))).catch((e=>Promise.reject(e)))):nt(e.programId).then((n=>(t=Je(ce.id,n.widget_interactions_url_template)+"/?",e.widgets.forEach((e=>{const n=e.kind.replace(/-/g,"_")+"_id";t+=n+"="+e.id+"&"})),Me.get({url:t}).then((e=>Promise.resolve(e.interactions))).catch((e=>Promise.resolve([]))))))}}return ht("programId","getWidgetInteractions")},Kt=(e,t)=>customElements.get(e)?console.warn(`${e} has already been registered`):customElements.define(e,t),qt=e=>t=>Kt(e,t);const zt=function(){let e=[];const t=(t,n,i)=>{e.forEach((e=>{e.channel===t&&e.callback({message:n,event:i})}))},n={message:e=>{"program-status-updated"===e.message.event&&at(document,e.message.event,e.message.payload),e.timetoken&&(e.message.payload.timetoken=e.timetoken),t(e.channel,e.message.payload,e.message.event)},messageAction:e=>{t(e.channel,e.data,e.event)}};return{listeners:e,subscribe:e=>Te(e),addListener:(t,n)=>e.push({channel:t,callback:n}),unsubscribe:t=>!e.some((e=>e.channel===t))&&(e=>xe.unsubscribe({channels:[e]}))(t),removeListener:(t,n)=>(e=e.filter((e=>e.channel!==t||e.callback!==n)),e),initialize:()=>Ce(n)}}();window.SCPEAK=()=>zt.listeners;var Ht=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};class Vt extends oe{constructor(){super(...arguments),this.firstInteractionTime=null,this.changed=!1,this.disabled=!1,this.phase="ready",this.selectedOption={},this.syntheticIncrement=!1,this.vote=null,this.isInteractable=!0,this.interaction=null,this.interactions=null,this.hide_dismiss_button=!1,this.initialLoad=!1,this.interacted=!1,this.localize=(e,t)=>vt(e,this.lang,t),this.onResults=e=>{if(e.message.id===this.widgetPayload.id)if(this.syntheticIncrement)this.syntheticIncrement=!1;else{let t=null;const n=e.message.options||e.message.choices,i=e.message.options?"vote_count":"answer_count",r=e.message.options?"options":"choices";if(n){const o=this[r].map(((e,r)=>(e[i]!==n[r][i]&&(t=n[r],e[i]=n[r][i]),e)));if(t){this[r]=o,this.changed=!0,"vote_count"===i?this.voteCountChanged(t):this.answerCountChanged(t);at(this,"vote_count"===i?"votecountchanged":"answercountchanged",t),at(this,e.event,n)}}}},this.removeListener=e=>(e&&at(this,e,{element:this,widget:this.widgetPayload}),zt.removeListener(this.widgetPayload.subscribe_channel,this.onResults),zt.unsubscribe(this.widgetPayload.subscribe_channel),Promise.resolve()),this.expire=()=>this.removeListener("expire"),this.dismiss=()=>{const e={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};return Pe("Widget Dismissed",e,this.programid),this.removeListener("dismiss")},this.detach=()=>{const e=this.parentElement;e&&e.detach?e.detach(this):this.remove()},this.widgetDismissClick=()=>this.dismiss().then(this.detach),this.interactionTrack=()=>{!this.firstInteractionTime&&(this.firstInteractionTime=new Date),this.interacted=!0},this.interactionEvent=e=>{"cheer-meter"!==this.widgetPayload.kind&&this.interactionTrack();const t={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};Pe("Widget Interacted",t,this.programid)},this.ready=e=>new Promise((t=>setTimeout((()=>t()),e&&e.timeout||0))),this.interactive=e=>new Promise((t=>{this.phase=le,this.disabled=!1;const n={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};this.isInteractable&&Pe("Widget Became Interactive",n,this.programid);let i=e&&void 0!==e.timeout?e.timeout:this.widgetPayload.timeout&&Ue(this.widgetPayload.timeout);this.timeout=i,null!==i&&setTimeout(t,i)})),this.results=e=>new Promise((t=>{this.phase=de;const n=e&&e.timeout||8e3;this.changed=!0,this.disabled=!0,this.resultEvent(),setTimeout(t,n)})),this.finished=e=>new Promise((t=>{this.phase=ue,this.changed=!0,this.disabled=!0,setTimeout(t,e&&e.timeout||0)})),this.rankChanged=(e,t)=>{t&&t.length&&at(this,"rankchange",{widget:e,rewards:t,element:this})},this.voteBase=(e,t,n)=>Me[t]({url:e,data:n}).then((e=>(this.voteDisable=!1,this.vote=e,this.rankChanged(this.widgetPayload,e.rewards),Promise.resolve(e)))).catch((e=>(this.voteDisable=!1,Promise.reject(e)))),this.updateVote=(e,t)=>this.voteBase(e,"patch",t),this.createVote=(e,t)=>this.voteBase(e,"post",t)}shouldUpdate(){return!!this.widgetPayload}firstUpdated(){zt.subscribe(this.widgetPayload.subscribe_channel),zt.addListener(this.widgetPayload.subscribe_channel,this.onResults),this.widgetPayload.impression_url&&Me.post({url:this.widgetPayload.impression_url}).catch((e=>console.warn("Widget impression request failed")))}connectedCallback(){this.addEventListener("dismiss-clicked",this.widgetDismissClick),this.addEventListener("widget-provider",(e=>{e.detail.provider=this,e.stopPropagation()})),super.connectedCallback()}disconnectedCallback(){this.removeListener(),this.removeEventListener("dismiss-clicked",this.widgetDismissClick),super.disconnectedCallback()}updated(e){e.forEach(((e,t)=>{const n=e=>void 0!==this[e]&&at(this,e,{widget:this.widgetPayload,element:this,[e]:this[e],item:this.selectedOption});if("interacted"===t&&n(t),"phase"===t&&(n(t),this.phase!==de&&this.phase!==ue||(this.changed=!0,this.disabled=!0)),"vote"===t&&this.vote&&this.vote.id){this.changed=!0;const e=he[this.nodeName];at(this,e,{[e]:this.vote,element:this,widget:this.widgetPayload})}if("reply"===t&&this.reply&&this.reply.length>0){this.changed=!0;const e=he[this.nodeName];at(this,e,{[e]:this.reply,element:this,widget:this.widgetPayload})}void 0!==this[t]&&null!==this[t]&&st.emit("widget-updated",{name:t,key:this.widgetPayload.id,prop:this[t],owner:this})}))}answerCountChanged(e){}voteCountChanged(e){}resultEvent(){}submitVote(e){}lockInVote(){}}Ht([X({type:Boolean,reflect:!0})],Vt.prototype,"changed",void 0),Ht([X({type:Boolean,reflect:!0})],Vt.prototype,"disabled",void 0),Ht([X({type:String,reflect:!0})],Vt.prototype,"lang",void 0),Ht([X({type:Boolean})],Vt.prototype,"reactions",void 0),Ht([X({type:String})],Vt.prototype,"phase",void 0),Ht([X({type:Object})],Vt.prototype,"selectedOption",void 0),Ht([X({type:String})],Vt.prototype,"timeout",void 0),Ht([X({type:Object})],Vt.prototype,"widgetPayload",void 0),Ht([X({type:Object})],Vt.prototype,"mode",void 0),Ht([X({type:String})],Vt.prototype,"kind",void 0),Ht([X({type:Boolean})],Vt.prototype,"syntheticIncrement",void 0),Ht([X({type:Object})],Vt.prototype,"vote",void 0),Ht([X({type:Boolean})],Vt.prototype,"voteDisable",void 0),Ht([X({type:Array})],Vt.prototype,"options",void 0),Ht([X({type:Array})],Vt.prototype,"choices",void 0),Ht([X({type:String})],Vt.prototype,"question",void 0),Ht([X({type:Boolean})],Vt.prototype,"isInteractable",void 0),Ht([X({type:Object})],Vt.prototype,"interaction",void 0),Ht([X({type:Array})],Vt.prototype,"interactions",void 0),Ht([X({type:Boolean})],Vt.prototype,"authors",void 0),Ht([X({type:Boolean})],Vt.prototype,"timestamps",void 0),Ht([X({type:Boolean})],Vt.prototype,"timeformat",void 0),Ht([X({type:Boolean})],Vt.prototype,"hide_dismiss_button",void 0),Ht([X({type:String})],Vt.prototype,"reply",void 0),Ht([X({type:Boolean,hasChanged:()=>!0})],Vt.prototype,"interacted",void 0);const Gt=e=>class extends e{constructor(){super(...arguments),this.setupWidget=()=>new Promise((e=>{const t=()=>{if(window.LiveLike._config.ready&&window.LiveLike._config.theme&&window.LiveLike._config.theme.widgets){const t=this.kind||this.getAttribute("kind")||this.localName.replace("livelike-",""),n=this.widgetId||this.getAttribute("widgetid"),i=this.mode||this.getAttribute("mode"),r="string"==typeof i?Ut(i):i,o=n=>{this.widgetPayload=n,this.programid=this.widgetPayload.program_id,Object.keys(n).forEach((e=>this[e]=n[e])),this.theme=window.LiveLike._config.theme,r?r():(this.widgetPayload.timeout=null,t===ge||t===me?this.results():this.interactive(),this.interactionTrack=()=>{!this.firstInteractionTime&&(this.firstInteractionTime=new Date),this.interacted=!0,this.results()}),e()};$t({kind:t,id:n}).then((e=>{let t=Ot(e);t?Ft({programId:e.program_id,widgets:[{kind:t.kind,id:t.id}]}).then((n=>{n&&n[t.kind]&&(this.interactions=n[t.kind].filter((e=>e.widget_id===t.id)),this.interactions&&(this.interaction=this.interactions[0])),o(e)})):o(e)}))}else setTimeout(t,50)};t()}))}},Wt=e=>class extends e{constructor(){super(...arguments),this.appendStyles=e=>{this.appendChild(e)}}connectedCallback(){super.connectedCallback();const e=()=>new Promise((e=>{this.updateComplete.then((()=>{this.shadowRoot&&this.shadowRoot.appendChild(document.createElement("slot"));const t=!!this.customTemplate&&this.customTemplate({widgetPayload:this.widgetPayload});if(t&&!(t instanceof HTMLTemplateElement))return console.error("customTemplateRenderer must return an HTMLTemplateElement");const n=document.querySelector(`template[kind=${this.widgetPayload.kind}]`),i=this.shadowRoot.querySelector("template"),r=t||n;r||i?(this.appendChild(r?document.importNode(r.content,!0):i.content),e()):e()}))}));return this.widgetPayload&&0!==Object.keys(this.widgetPayload).length?e():this.setupWidget().then(e)}};class Yt extends(Wt(Gt(Vt))){}class Jt extends(Wt(Gt(At(Vt)))){}let Xt=class extends Vt{render(){return D`<slot></slot>`}};function Zt(e){let t=[];return{queueArray:t,hasNextItem:()=>t.length>0,dequeueItem:()=>t.shift(),enqueueItem:(n,i)=>{const{payload:r}=n;-1===t.findIndex((e=>e.payload.id===r.id))&&(t.push(n),e&&e.currentTimecode&&t.sort(((e,t)=>{const n=Pt(e.payload.program_date_time)?new Date(St(e.payload.program_date_time)):null,i=Pt(t.payload.program_date_time)?new Date(St(t.payload.program_date_time)):null;return n>i?1:i>n?-1:0})),i&&i())},isNextItemReady:()=>{if(!e||!e.currentTimecode)return!0;if(e.ready)return e.ready(t[0].payload);const n=t[0].payload.program_date_time&&Pt(t[0].payload.program_date_time)&&new Date(St(t[0].payload.program_date_time)),i=Pt(e.currentTimecode)&&new Date(St(e.currentTimecode));return se.logger&&console.log("syncTime >= pdt",i>=n),!n||!i||i>=n}}}Xt=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget")],Xt);const Qt=(e,t)=>it(e).then((n=>{!t&&(t={});const i=rt((new Date).getTime()+"1234",(i=>(t.start=i,Ee(n,t).then((t=>{const i=t.channels[n]?Ye(e,t.channels[n]):[];return{results:i,next:i[0]?i[0].timetoken:null}})))),(e=>({messages:e.results})));return i.next().then((e=>({messages:e.value.messages,next:i.next})))})),en={},tn=e=>new Promise(((t,n)=>{let i={id:Oe(),sender_id:ce.id,sender_nickname:ce.nickname,sender_image_url:e.sender_image_url||null,sender_profile_url:ce.url,badge_image_url:null,created_at:(new Date).toISOString(),program_date_time:e.timestamp||null,message:e.message||null};const r=()=>{en[e.roomId]&&(i=en[e.roomId](i));const r={event:e.image_url?"image-created":"message-created",payload:i};it(e.roomId).then((i=>{Se(r.payload,e.roomId,"Chat Message Sent"),(e=>new Promise(((t,n)=>xe.publish({message:e.message,channel:e.channel,ttl:0},((e,i)=>e.error?n(e):t(i))))))({message:r,channel:i}).then((()=>{t(r.payload)})).catch((e=>{console.error("Error: "+e+" Message failed to send."),n()}))}))};var o;e.image_url?(o=e.image_url,fetch(o).then((e=>e.blob()))).then((t=>{tt(e.roomId).then((o=>{((e,t)=>{var n=new FormData;return n.append("type","file"),n.append("image",t,"image.png"),fetch(e,{method:"POST",body:n}).then((e=>e.json()))})(o.upload_url,t).then((function(t){i.image_url=t.image_url,i.image_width=~~e.image_width||null,i.image_height=~~e.image_height||null,r()})).catch((function(e){console.error((e.message,e.message)),n()}))}))})).catch((function(e){console.error((e.message,e.message)),n()})):r()})),nn=D`<style>:host{overflow:auto}.message-item-container{position:relative;margin:0 0 .5rem 0;display:flex;justify-content:flex-start}.message-item-container>.menu-button-container>.more-icon{opacity:0;transition:opacity ease .3s}.message-item-container:hover>.menu-button-container>.more-icon{opacity:1;transition:opacity ease .3s}.menu-button-container{display:flex;flex-direction:column;justify-content:center}.more-icon:focus{opacity:0;transition:opacity ease .3s}.message-item-container>.menu-button-container>.more-icon.active{opacity:1}.more-icon.active{opacity:1}.message-wrapper{display:inline-grid;opacity:1;transition:all .4s;background:rgba(0,0,0,.4);border-radius:.75rem;padding:.5rem 1rem;max-width:80%;position:relative}.message-wrapper:focus{outline:0}.avatar{display:flex;flex-direction:column;justify-content:flex-start;margin:0 .5rem 0 0}.avatar img,.avatar svg{width:3rem;height:3rem;margin:0;border-radius:50%}.sender-name{font-size:1rem;display:inline-block;color:inherit;margin:0 0 .25rem 0;word-break:break-word;word-wrap:break-word}.sender-message{font-size:1rem;display:flex;word-break:break-word;word-wrap:break-word;color:inherit;line-height:1.3;padding:0 .25rem .25rem 0;flex-wrap:wrap}.sender-message.deleted{font-style:oblique;color:inherit}.word-item{align-self:flex-end}.image-message-container{max-width:480px}.image-message{max-width:100%;height:auto;border-radius:.5rem}.message-timestamp{font-size:.8rem}.more-icon{background:0 0;border:none;margin:1rem 0;display:flex;align-items:center;padding:0 1rem}.more-icon:hover{cursor:pointer}.more-icon svg{fill:#777}.more-icon:hover svg{fill:#555}.no-message-container{height:100%;position:relative;display:flex;justify-content:center}.no-messages{margin:0;color:#fff;position:absolute;top:50%}</style>`,rn=D`<svg width="24" height="24" viewBox="0 0 24 24"><path d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"/></svg>`,on=D`<svg width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg>`,sn=D`<svg viewBox="0 0 512 512" height="12" width="12"><path d="M98.9,184.7l1.8,2.1l136,156.5c4.6,5.3,11.5,8.6,19.2,8.6c7.7,0,14.6-3.4,19.2-8.6L411,187.1l2.3-2.6 c1.7-2.5,2.7-5.5,2.7-8.7c0-8.7-7.4-15.8-16.6-15.8v0H112.6v0c-9.2,0-16.6,7.1-16.6,15.8C96,179.1,97.1,182.2,98.9,184.7z"/></svg>`,an=D`<svg width="18" height="18" viewBox="0 0 16 16"><path fill-rule="nonzero" d="M2.083 9a6.002 6.002 0 0 0 11.834 0H2.083zM8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zM5.5 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm5 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"/></svg>`,cn=D`<svg width="4" height="20" viewBox="0 0 3 15"><path fill-rule="nonzero" d="M1.5 12a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm0-6a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm0-6a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3z"/></svg>`,ln=D`<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1"><g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><circle id="circle" fill="#000000" opacity="0.200000003" cx="9" cy="9" r="9"></circle><path d="M10.1443526,8.99976063 L12.7631923,11.617505 C13.0789359,11.9337699 13.0789359,12.4465365 12.7631923,12.7628014 C12.4474488,13.0790662 11.9355273,13.0790662 11.6197838,12.7628014 L9.00023937,10.1443526 L6.38249497,12.7631923 C6.06623012,13.0789359 5.55346349,13.0789359 5.23719864,12.7631923 C4.92093379,12.4474488 4.92093379,11.9355273 5.23719864,11.6197838 L7.85564741,9.00023937 L5.23680767,6.38249497 C4.92106411,6.06623012 4.92106411,5.55346349 5.23680767,5.23719864 C5.55255122,4.92093379 6.06447267,4.92093379 6.38021623,5.23719864 L8.99976063,7.85564741 L11.617505,5.23680767 C11.9337699,4.92106411 12.4465365,4.92106411 12.7628014,5.23680767 C13.0790662,5.55255122 13.0790662,6.06447267 12.7628014,6.38021623 L10.1443526,8.99976063 Z" id="x" fill="#FFFFFF" fill-rule="nonzero"></path></g></svg>`,un=D`<svg width="64px" height="64px" viewBox="0 0 64 64"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g><g><rect id="Rectangle" fill="#505A64" x="0" y="0" width="64" height="64"/><path d="M31.9590262,14 C40.9427465,14 44.8185604,18.1297028 43.8568799,26.9807577 C42.8951994,35.8318125 39.1802051,40 31.9730147,40 C26.0823195,40 21.3936793,37.5331739 20.2595234,28.1644789 C19.1253676,18.7957839 21.4756955,14 31.9590262,14 Z" id="Path-2" fill="#8C96A0"/><path d="M8,64 C13.6440504,52.375041 21.5113023,46.3802666 31.6017556,46.0156768 C41.692209,45.651087 49.8249571,51.6458614 56,64 L8,64 Z" id="Path-3" fill="#8C96A0"/></g></g></g></svg>`,dn=D`<svg height="18" width="18" viewBox="0 0 64 64"><g id="Giphy"><rect fill="#00ff92" x="8.61" y="9.09" width="6.31" height="46.75"/><rect fill="#fff24d" x="8.61" y="3.06" width="26.37" height="6.46"/><rect fill="#00c9ff" x="8.73" y="55.23" width="45.68" height="6.46"/><rect fill="#971eff" x="48.1" y="22.62" width="6.31" height="32.62"/><polygon fill="#ff6562" points="47.81 16.2 47.81 9.8 41.28 9.8 41.28 3.05 34.74 3.05 34.74 16.2 34.74 22.62 41.28 22.62 54.41 22.62 54.41 16.2 47.81 16.2"/><polygon fill="#5d1498" points="48.1 22.62 54.41 22.62 48.1 29.09 48.1 22.62"/><polygon fill="#968f2d" points="34.74 9.44 34.74 3.14 28.27 9.44 34.74 9.44"/></g></svg>`,hn=D`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" fill="none" viewBox="0 0 36 36"><path fill="#fff" d="M24.675 20.215l3.825-2.43L12 7.285v.255l12.675 12.675zM4.215 4l-2.13 2.115L12 16.03v12.255l7.485-4.77 10.17 10.17 2.115-2.115L4.215 4zM15 22.825V19.03l2.325 2.325L15 22.825z"/></svg>`,pn=D`<style>.reaction-button{border:none;border-radius:.5rem;background:rgba(255,255,255,.1);position:absolute;padding:.125rem .25rem;transform:translate(12px,-2px);right:0;bottom:0;top:auto;height:21px;width:21px;background-image:url("data:image/svg+xml;utf8,${"<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 16 16' fill='rgba(150, 150, 150, 0.5)'><path fill-rule='nonzero' d='M2.083 9a6.002 6.002 0 0 0 11.834 0H2.083zM8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zM5.5 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm5 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z'></path></svg>"}");background-repeat:no-repeat;background-size:13px 13px;background-position:center}.reaction-button:hover{cursor:pointer}.reaction-button>svg{fill:rgba(150,150,150,.5);height:13px;width:13px}.reaction-item-container{position:absolute;display:flex;margin:0;transition:opacity ease .3s;opacity:0;z-index:25;left:auto;right:auto;bottom:0;top:auto}.reaction-item-wrap{position:relative;display:inline-flex;padding:0 1.4rem 0 0;height:45px;border-radius:12px;min-height:inherit;width:inherit;background:#282828}.reaction-item{display:inline-block;position:relative;width:2.5rem;height:2.25rem;background:0 0;border-radius:12px;border:none;margin:4.5px 4px;cursor:pointer;padding:0}.reaction-item.selected,.reaction-item:focus,.reaction-item:hover{background:rgba(255,255,255,.2)}.reaction-image{width:25px;height:25px;position:relative;padding:0}.reaction-count{color:#fff;position:absolute;top:0}.mini-reactions{display:flex;position:absolute;right:0}.mini-reaction-image{height:16px;width:16px;margin:0 0 0 -5px;vertical-align:middle}.mini-reaction-count{color:#fff}</style>`;const fn="1",gn="0",mn=(e,t)=>{e.outsideClick.remove(),e.animation=gn,setTimeout((()=>e[t]=null),300)},vn=(e,t,n)=>{e[t]=n,setTimeout((()=>{e.outsideClick=function(e,t){function n(n){const i=(e.shadowRoot||document).elementFromPoint(n.x,n.y),r=e.contains(i),o=e.shadowRoot&&e.shadowRoot.contains(i);!r&&!o&&t()}return{register:()=>window.addEventListener("click",n,!1),remove:()=>window.removeEventListener("click",n,!1)}}(e,(()=>mn(e,t))),e.outsideClick.register(),e.animation=fn}),50);const i={"Chat Room ID":e.owner.roomid,"Chat Message ID":n};"selectedReactions"===t&&Pe("Chat Reaction Panel Opened",i)},yn=(e,t,n)=>e[n]===t?mn(e,n):vn(e,n,t);function bn(e){const t=Math.log10(e)/3|0;if(0==t)return e;const n=e/Math.pow(10,3*t),i=n%1==0||n>=10?0:1;return n.toFixed(i)+["","k","M"][t]}const wn=e=>class extends e{constructor(){super(...arguments),this.updateOwnerProps=e=>{this.owner.dataId===e.key&&(this.ownerUpdated(e),this.requestUpdate(),super.requestUpdate())}}static get properties(){return{owner:{type:Object}}}ownerUpdated(e){}connectedCallback(){if(!this.owner&&(this.owner=ct(this,"chat-provider")),st.on("chat-updated",this.updateOwnerProps),this.defaultStyles){const e=document.createElement("style");e.innerHTML+=this.defaultStyles(),this.appendChild(e)}super.connectedCallback()}};class kn extends(wn(oe)){}const _n=D`<style>.livelike-modal{color:#000;padding:1rem;background:#fff;border-radius:5px;position:absolute;z-index:15;width:50%;top:50%;left:25%;opacity:0}.livelike-modal.showing{transition:all ease .3s;opacity:1}</style>`;var Pn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Sn=class extends kn{render(){const e={block:this.owner.localize("chat.blockConfirmation.message",{username:this.data?this.data.nickname:null}),report:this.owner.localize("chat.reportConfirmation.message"),muted:this.owner.localize("chat.mutedMessage"),error:this.owner.localize("chat.errorMessage")};return D`${_n}<div class="livelike-modal ${""!==this.type?"showing":null}"><div class="modal-body">${e[this.type]}</div></div>`}};Pn([X({type:String,reflect:!0})],Sn.prototype,"type",void 0),Pn([X({type:Object})],Sn.prototype,"data",void 0),Sn=Pn([qt("livelike-modal")],Sn);const xn=D`<style>.message-options{z-index:21;background:#fff;border-radius:5px}.menu-button{display:flex;font-size:.75rem;color:#000;padding:.25rem 1rem;width:100%;border:none;background:0 0;transition:background ease .3s;text-align:left}.menu-button:hover{background:rgba(0,0,0,.2);transition:background ease .3s;cursor:pointer}.block-user.blocked{color:gray;cursor:default}.menu-item-label{margin:0 0 0 .5rem}.menu-icon{line-height:1.1rem;font-size:.95rem;width:18px}.sub-item-icon{position:absolute;right:.5rem}</style>`;var On=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Tn=class extends oe{constructor(){super(...arguments),this.subMenuOpen=null,this.renderSubIcon=e=>"multi"===e.type?D`<div class="sub-item-icon">${sn}</div>`:null,this.renderButton=(e,t,n)=>D`<button id="menu-button-${t}" aria-label="${e.label}" @click="${n}" class="button menu-button"><div class="menu-item-label">${e.label}</div>${this.renderSubIcon(e)}</button>`,this.renderCustomHtml=e=>{const t=(new DOMParser).parseFromString(e.html,"text/html"),n=[];return t.body.childNodes.forEach((e=>n.push(e))),n.map((e=>D`${e}`))},this.renderItem=(e,t)=>{const n=this.message.id+String(t),i="single"===e.type?()=>{e.onClick(),this.closeMenu("selectedMessage")}:()=>this.subMenuOpen===n?this.subMenuOpen=null:this.subMenuOpen=n;return D`${"custom"===e.type&&e.html?this.renderCustomHtml(e):this.renderButton(e,t,i)} ${this.subMenuOpen===n&&"multi"===e.type?this.renderSubMenu(e.items):null}`},this.renderSubMenu=e=>D`<div class="sub-menu-container">${this.renderMenu(e,10)}</div>`,this.renderMenu=(e,t)=>e.map(((e,n)=>"separator"===e.type?D`<hr style="margin:0">`:this.renderItem(e,t?n+t:n)))}createRenderRoot(){return this}render(){return D`${xn}<style>message-menu{position:absolute;width:100%;max-width:10rem;right:2.5rem;display:block;top:50%;margin:auto;top:0;bottom:0;right:1rem;display:flex;align-items:center;justify-content:center;text-align:center}.message-options-anchor{z-index:21;transition:opacity .3s ease;opacity:${this.animation}}</style><div class="message-options-anchor" id="chat_moderation"><div class="message-options">${this.renderMenu(this.menu)}</div></div>`}};On([X({type:Array})],Tn.prototype,"menu",void 0),On([X({type:Object})],Tn.prototype,"message",void 0),On([X({type:Number})],Tn.prototype,"animation",void 0),On([X({type:String})],Tn.prototype,"subMenuOpen",void 0),On([X({type:Function})],Tn.prototype,"closeMenu",void 0),Tn=On([qt("message-menu")],Tn);
|
|
189
|
+
function(t,n){e.exports?e.exports=n(t):n(t)}("undefined"!=typeof self?self:void 0,(function(e){if("function"!=typeof Promise)throw"Promise support required";var t=e.crypto||e.msCrypto;if(t){var n=t.subtle||t.webkitSubtle;if(n){var i=e.Crypto||t.constructor||Object,r=e.SubtleCrypto||n.constructor||Object,o=(e.CryptoKey||e.Key,e.navigator.userAgent.indexOf("Edge/")>-1),s=!!e.msCrypto&&!o,a=!t.subtle&&!!t.webkitSubtle;if(s||a){var c={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},l={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach((function(e){var i=n[e];n[e]=function(r,o,c){var l,u,d,f,w=[].slice.call(arguments);switch(e){case"generateKey":l=g(r),u=o,d=c;break;case"importKey":l=g(c),u=w[3],d=w[4],"jwk"===r&&((o=v(o)).alg||(o.alg=m(l)),o.key_ops||(o.key_ops="oct"!==o.kty?"d"in o?d.filter(x):d.filter(S):d.slice()),w[1]=y(o));break;case"unwrapKey":l=w[4],u=w[5],d=w[6],w[2]=c._key}if("generateKey"===e&&"HMAC"===l.name&&l.hash)return l.length=l.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[l.hash.name],n.importKey("raw",t.getRandomValues(new Uint8Array(l.length+7>>3)),l,u,d);if(a&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===l.name&&(!l.modulusLength||l.modulusLength>=2048))return(r=g(r)).name="RSAES-PKCS1-v1_5",delete r.hash,n.generateKey(r,!0,["encrypt","decrypt"]).then((function(e){return Promise.all([n.exportKey("jwk",e.publicKey),n.exportKey("jwk",e.privateKey)])})).then((function(e){return e[0].alg=e[1].alg=m(l),e[0].key_ops=d.filter(S),e[1].key_ops=d.filter(x),Promise.all([n.importKey("jwk",e[0],l,!0,e[0].key_ops),n.importKey("jwk",e[1],l,u,e[1].key_ops)])})).then((function(e){return{publicKey:e[0],privateKey:e[1]}}));if((a||s&&"SHA-1"===(l.hash||{}).name)&&"importKey"===e&&"jwk"===r&&"HMAC"===l.name&&"oct"===o.kty)return n.importKey("raw",p(h(o.k)),c,w[3],w[4]);if(a&&"importKey"===e&&("spki"===r||"pkcs8"===r))return n.importKey("jwk",b(o),c,w[3],w[4]);if(s&&"unwrapKey"===e)return n.decrypt(w[3],c,o).then((function(e){return n.importKey(r,e,w[4],w[5],w[6])}));try{f=i.apply(n,w)}catch(e){return Promise.reject(e)}return s&&(f=new Promise((function(e,t){f.onabort=f.onerror=function(e){t(e)},f.oncomplete=function(t){e(t.target.result)}}))),f=f.then((function(e){return"HMAC"===l.name&&(l.length||(l.length=8*e.algorithm.length)),0==l.name.search("RSA")&&(l.modulusLength||(l.modulusLength=(e.publicKey||e).algorithm.modulusLength),l.publicExponent||(l.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e.publicKey&&e.privateKey?{publicKey:new P(e.publicKey,l,u,d.filter(S)),privateKey:new P(e.privateKey,l,u,d.filter(x))}:new P(e,l,u,d)}))}})),["exportKey","wrapKey"].forEach((function(e){var t=n[e];n[e]=function(i,r,o){var c,l=[].slice.call(arguments);switch(e){case"exportKey":l[1]=r._key;break;case"wrapKey":l[1]=r._key,l[2]=o._key}if((a||s&&"SHA-1"===(r.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===i&&"HMAC"===r.algorithm.name&&(l[0]="raw"),!a||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(l[0]="jwk"),s&&"wrapKey"===e)return n.exportKey(i,r).then((function(e){return"jwk"===i&&(e=p(unescape(encodeURIComponent(JSON.stringify(v(e)))))),n.encrypt(l[3],o,e)}));try{c=t.apply(n,l)}catch(e){return Promise.reject(e)}return s&&(c=new Promise((function(e,t){c.onabort=c.onerror=function(e){t(e)},c.oncomplete=function(t){e(t.target.result)}}))),"exportKey"===e&&"jwk"===i&&(c=c.then((function(e){return(a||s&&"SHA-1"===(r.algorithm.hash||{}).name)&&"HMAC"===r.algorithm.name?{kty:"oct",alg:m(r.algorithm),key_ops:r.usages.slice(),ext:!0,k:d(f(e))}:((e=v(e)).alg||(e.alg=m(r.algorithm)),e.key_ops||(e.key_ops="public"===r.type?r.usages.filter(S):"private"===r.type?r.usages.filter(x):r.usages.slice()),e)}))),!a||"exportKey"!==e||"spki"!==i&&"pkcs8"!==i||(c=c.then((function(e){return w(v(e))}))),c}})),["encrypt","decrypt","sign","verify"].forEach((function(e){var t=n[e];n[e]=function(i,r,o,a){if(s&&(!o.byteLength||a&&!a.byteLength))throw new Error("Empy input is not allowed");var c,l=[].slice.call(arguments),u=g(i);if(s&&"decrypt"===e&&"AES-GCM"===u.name){var d=i.tagLength>>3;l[2]=(o.buffer||o).slice(0,o.byteLength-d),i.tag=(o.buffer||o).slice(o.byteLength-d)}l[1]=r._key;try{c=t.apply(n,l)}catch(e){return Promise.reject(e)}return s&&(c=new Promise((function(t,n){c.onabort=c.onerror=function(e){n(e)},c.oncomplete=function(n){if(n=n.target.result,"encrypt"===e&&n instanceof AesGcmEncryptResult){var i=n.ciphertext,r=n.tag;(n=new Uint8Array(i.byteLength+r.byteLength)).set(new Uint8Array(i),0),n.set(new Uint8Array(r),i.byteLength),n=n.buffer}t(n)}}))),c}})),s){var u=n.digest;n.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var i;try{i=u.call(n,e,t)}catch(e){return Promise.reject(e)}return i=new Promise((function(e,t){i.onabort=i.onerror=function(e){t(e)},i.oncomplete=function(t){e(t.target.result)}}))},e.crypto=Object.create(t,{getRandomValues:{value:function(e){return t.getRandomValues(e)}},subtle:{value:n}}),e.CryptoKey=P}a&&(t.subtle=n,e.Crypto=i,e.SubtleCrypto=r,e.CryptoKey=P)}}}function d(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){return e=(e+="===").slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function p(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function f(e){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),String.fromCharCode.apply(String,e)}function g(e){var t={name:(e.name||e||"").toUpperCase().replace("V","v")};switch(t.name){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;case"AES-CBC":case"AES-GCM":case"AES-KW":e.length&&(t.length=e.length);break;case"HMAC":e.hash&&(t.hash=g(e.hash)),e.length&&(t.length=e.length);break;case"RSAES-PKCS1-v1_5":e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;case"RSASSA-PKCS1-v1_5":case"RSA-OAEP":e.hash&&(t.hash=g(e.hash)),e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;default:throw new SyntaxError("Bad algorithm name")}return t}function m(e){return{HMAC:{"SHA-1":"HS1","SHA-256":"HS256","SHA-384":"HS384","SHA-512":"HS512"},"RSASSA-PKCS1-v1_5":{"SHA-1":"RS1","SHA-256":"RS256","SHA-384":"RS384","SHA-512":"RS512"},"RSAES-PKCS1-v1_5":{"":"RSA1_5"},"RSA-OAEP":{"SHA-1":"RSA-OAEP","SHA-256":"RSA-OAEP-256"},"AES-KW":{128:"A128KW",192:"A192KW",256:"A256KW"},"AES-GCM":{128:"A128GCM",192:"A192GCM",256:"A256GCM"},"AES-CBC":{128:"A128CBC",192:"A192CBC",256:"A256CBC"}}[e.name][(e.hash||{}).name||e.length||""]}function v(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=JSON.parse(decodeURIComponent(escape(f(e)))));var t={kty:e.kty,alg:e.alg,ext:e.ext||e.extractable};switch(t.kty){case"oct":t.k=e.k;case"RSA":["n","e","d","p","q","dp","dq","qi","oth"].forEach((function(n){n in e&&(t[n]=e[n])}));break;default:throw new TypeError("Unsupported key type")}return t}function y(e){var t=v(e);return s&&(t.extractable=t.ext,delete t.ext),p(unescape(encodeURIComponent(JSON.stringify(t)))).buffer}function b(e){var t=k(e),n=!1;t.length>2&&(n=!0,t.shift());var i={ext:!0};switch(t[0][0]){case"1.2.840.113549.1.1.1":var r=["n","e","d","p","q","dp","dq","qi"],o=k(t[1]);n&&o.shift();for(var s=0;s<o.length;s++)o[s][0]||(o[s]=o[s].subarray(1)),i[r[s]]=d(f(o[s]));i.kty="RSA";break;default:throw new TypeError("Unsupported key type")}return i}function w(e){var t,n=[["",null]],i=!1;switch(e.kty){case"RSA":for(var r=["n","e","d","p","q","dp","dq","qi"],o=[],s=0;s<r.length&&r[s]in e;s++){var a=o[s]=p(h(e[r[s]]));128&a[0]&&(o[s]=new Uint8Array(a.length+1),o[s].set(a,1))}o.length>2&&(i=!0,o.unshift(new Uint8Array([0]))),n[0][0]="1.2.840.113549.1.1.1",t=o;break;default:throw new TypeError("Unsupported key type")}return n.push(new Uint8Array(_(t)).buffer),i?n.unshift(new Uint8Array([0])):n[1]={tag:3,value:n[1]},new Uint8Array(_(n)).buffer}function k(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),t.end-t.pos<2||t.end>e.length)throw new RangeError("Malformed DER");var n,i=e[t.pos++],r=e[t.pos++];if(r>=128){if(r&=127,t.end-t.pos<r)throw new RangeError("Malformed DER");for(var o=0;r--;)o<<=8,o|=e[t.pos++];r=o}if(t.end-t.pos<r)throw new RangeError("Malformed DER");switch(i){case 2:n=e.subarray(t.pos,t.pos+=r);break;case 3:if(e[t.pos++])throw new Error("Unsupported bit string");r--;case 4:n=new Uint8Array(e.subarray(t.pos,t.pos+=r)).buffer;break;case 5:n=null;break;case 6:var s=btoa(f(e.subarray(t.pos,t.pos+=r)));if(!(s in c))throw new Error("Unsupported OBJECT ID "+s);n=c[s];break;case 48:n=[];for(var a=t.pos+r;t.pos<a;)n.push(k(e,t));break;default:throw new Error("Unsupported DER tag 0x"+i.toString(16))}return n}function _(e,t){t||(t=[]);var n=0,i=0,r=t.length+2;if(t.push(0,0),e instanceof Uint8Array){n=2,i=e.length;for(var o=0;o<i;o++)t.push(e[o])}else if(e instanceof ArrayBuffer)for(n=4,i=e.byteLength,e=new Uint8Array(e),o=0;o<i;o++)t.push(e[o]);else if(null===e)n=5,i=0;else if("string"==typeof e&&e in l){var s=p(atob(l[e]));for(n=6,i=s.length,o=0;o<i;o++)t.push(s[o])}else if(e instanceof Array){for(o=0;o<e.length;o++)_(e[o],t);n=48,i=t.length-r}else{if(!("object"==typeof e&&3===e.tag&&e.value instanceof ArrayBuffer))throw new Error("Unsupported DER value "+e);for(n=3,i=(e=new Uint8Array(e.value)).byteLength,t.push(0),o=0;o<i;o++)t.push(e[o]);i++}if(i>=128){var a=i;for(i=4,t.splice(r,0,a>>24&255,a>>16&255,a>>8&255,255&a);i>1&&!(a>>24);)a<<=8,i--;i<4&&t.splice(r,4-i),i|=128}return t.splice(r-2,2,n,i),t}function P(e,t,n,i){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===n?e.extractable:n,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===i?e.usages:i,enumerable:!0}})}function S(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function x(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}})),n.default=window.crypto}])})),_e=(we=ke)&&we.__esModule&&Object.prototype.hasOwnProperty.call(we,"default")?we.default:we;ke.PubNub;const Pe=(e,t,n=null)=>{n&&(t["Program ID"]=n),n&&se.progResource[n]&&(t=Object.assign(Object.assign({},t),se.progResource[n].analytics_properties)),!0===se.logger&&console.log("Mixpanel track event: ",e),window.mixpanel&&window.mixpanel.track(e,t)},Se=(e,t,n)=>{const{message:i,id:r,image_url:o,messageLink:s}=e,a=i&&i.match(/:([^:]*):/g),c={"Chat Room ID":t,"Chat Message ID":r,"Has External Image":!!o};a&&a.length>0&&(c["Sticker Shortcodes"]=a),s&&(c["Chat Message Link"]=s),Pe(n,c)};let xe;const Oe=()=>_e.generateUUID(),Te=e=>xe&&!xe.getSubscribedChannels().some((t=>t===e))&&(e=>xe.subscribe({channels:[e]}))(e),Ce=e=>xe.addListener(e),Ee=(e,t={count:25,end:null,start:null})=>new Promise(((n,i)=>{xe.fetchMessages({channels:[e],count:t.count,stringifiedTimeToken:!0,start:t.start,end:t.end,includeMessageActions:!0},((e,t)=>e.error?i(e):n(t)))})),Re={add:(e,t,n,i,r,o)=>xe.addMessageAction({channel:e,messageTimetoken:t,action:n},(function(e,t){e.error?o("Error creating reaction"):(Pe("Chat Reaction Added",i),r(t))})),remove:(e,t,n,i,r,o)=>xe.removeMessageAction({channel:e,messageTimetoken:t,actionTimetoken:n},(function(e,t){e.error?o("Error removing reaction"):(Pe("Chat Reaction Removed",i),r(t))}))},Ae=e=>t=>{if(!t.url&&!t.path)return console.warn("Need either a url or a path"),Promise.reject("Need either a url or a path");let n,i,r=t.accessToken;const o=se.storageStrategy.get(),s=o&&o.access_token;void 0===r&&(r=s||se.accessToken||ce.access_token),t.url?i=t.url:t.path&&(i=se.endpoint+t.path);const a=new Headers;r&&a.append("Authorization","Bearer "+r),"POST"!==e&&"PATCH"!==e||(a.append("Content-Type","application/json"),t.data&&(n=JSON.stringify(t.data)));const c=new Request(i,{method:e,body:n,headers:a});return fetch(c).then((e=>{let t={400:"Incorrect data.",401:"Unauthorized. Access token missing from request.",403:"Access Denied. Access token incorrect.",404:"Resource not found.",405:"Method not allowed.",409:"Resource already exists",415:"Unsupported media type."}[e.status];if(e.status>=500&&(t="Server error. Try again."),e.status>=300)return Promise.reject({status:e.status,message:t});{const t=e.headers.get("content-type");return t&&-1!==t.indexOf("application/json")?e.json():void 0}}))},Me={get:Ae("GET"),put:Ae("PUT"),post:Ae("POST"),patch:Ae("PATCH"),delete:Ae("DELETE")},je="messagedeleted",Le="messagereceived",Ne={"chatroom-updated":"chatroom-updated","message-deleted":je,"message-created":Le,"image-created":Le,"custom-message-created":Le,"image-deleted":je,"message-updated":"messageupdated","message-sent":"messagesent",added:"reactionadded",removed:"reactionremoved"},Ue=e=>{const t=e.match(/(-)?P(?:([.,\d]+)Y)?(?:([.,\d]+)M)?(?:([.,\d]+)W)?(?:([.,\d]+)D)?(?:T(?:([.,\d]+)H)?(?:([.,\d]+)M)?(?:([.,\d]+)S)?)?/);return(t[8]&&1e3*t[8])+(t[7]&&6e4*t[7])+(t[6]&&36e5*t[6])+(t[5]&&864e5*t[5])},Ie=e=>e.split("-").map((e=>e[0].toUpperCase()+e.substr(1).toLowerCase())).join(" ");function De(e,t){return Object.keys(t).forEach((n=>{!e.hasOwnProperty(n)||"object"!=typeof e[n]||e[n]instanceof Array?e[n]=t[n]:De(e[n],t[n])})),e}const Be=(e,t)=>{const n=e.slice();return n.splice(e.length,0,t),n},$e=(e,t)=>{const n="text-prediction-follow-up"===t.kind||"image-prediction-follow-up"===t.kind;return e.attach(t).then((()=>n?Promise.resolve():t.interactive())).then((()=>t.results({timeout:n&&t.timeout?Ue(t.timeout):5e3})))},Fe=({target:e,widget:t})=>$e(e,t).then(t.expire).then((()=>e.detach(t))),Ke=({target:e,widget:t})=>{t.hide_dismiss_button=!0,t.initialLoad?e.attach(t,"append").then(t.results).then(t.expire).then(t.finished):$e(e,t).then(t.expire).then(t.finished)},qe=e=>{const{target:t,widget:n,timer:i}=e,{widgetPayload:r}=n;n.hide_dismiss_button=!0;const o="text-prediction-follow-up"===n.kind||"image-prediction-follow-up"===n.kind;return t.attach(n,n.initialLoad?"append":"prepend").then((()=>{let e=!1;switch(n.kind){case"text-prediction-follow-up":case"image-prediction-follow-up":{const n=r.text_prediction_id||r.image_prediction_id;let i=t.querySelector(`[widgetid="${n}"]`);i&&(!i.disabled||i.phase!==de&&i.phase!==ue)&&i.results(),e=!0;break}case"text-prediction":case"image-prediction":e=r.follow_ups.some((e=>"published"===e.status));break;case"text-quiz":case"image-quiz":n.interaction||n.addEventListener("answer",(e=>{n.results()})),e=!!n.interaction;break;case"emoji-slider":n.interaction||n.addEventListener("slider",(e=>{setTimeout(n.results,2e3)})),e=!!n.interaction;break;case"text-ask":n.interaction||n.addEventListener("reply",(e=>{n.results()})),e=!!n.interaction;break;default:e=!1}return e?Promise.resolve():n.interactive&&n.interactive({timeout:i||null})})).then((()=>n.results({timeout:o&&n.timeout?Ue(n.timeout):5e3}))).then(n.expire).then((()=>n.finished({timeout:null})))},ze=(e,t)=>(...n)=>{let i;return clearTimeout(i,i=setTimeout(e,t||250,...n))},He=(e,t,n)=>new Date(e).toLocaleDateString(n||"en-US",t),Ve=e=>{if(!e.lang){const t=n=>{const i=n.querySelector("[lang]");i?e.lang=i.getAttribute("lang"):n.parentElement&&t(n.parentElement)};t(e.parentElement)}},Ge=(e,t,n=0)=>{const i=e.options||e.choices,r=t.vote_count?"vote_count":"answer_count",o=i.reduce(((e,t)=>e+t[r]),0);return o>0?Math.round(t[r]/o*100):n},We=(e,t)=>{const n=se.chatRooms[e]&&"none"!==se.chatRooms[e].content_filter&&t.content_filter&&t.content_filter.length>0,i=t.sender_id===ce.id;return"Producer"===ce.nickname||i||!n},Ye=(e,t)=>{if(t&&Array.isArray(t)){const n=[],i=[];return t.map((t=>{const r=t.entry||t.message;We(e,r.payload)&&(r.payload.timetoken=t.timetoken,r.payload.reactions=t.data&&t.data.rc?t.data.rc:{},"messagereceived"===Ne[r.event]?n.push(r.payload):i.push(r.payload))})),i.map((e=>{const t=n.findIndex((t=>t.id===e.id));-1!==t&&n.splice(t,1)})),n}return[]},Je=(e,t)=>t&&encodeURI(t.replace(/{(.*?)}/g,e)),Xe=(e,t)=>e?fetch(e).then((e=>{const n=404===e.status,i=403===e.status,r="Room"===t&&e.status>202;if(n||r||i)return Promise.reject(`${t} resource not found. Check ${t} Id.\nRead more: https://www.npmjs.com/package/@livelike/engagementsdk`);{const t=e.headers.get("content-type");return t&&-1!==t.indexOf("application/json")?e.json():void 0}})):Promise.reject(`${t} url missing.`),Ze={program:e=>Xe(Je(e,se.programUrlTemplate),"Program"),app:e=>Xe(encodeURI(`${se.endpoint}applications/${e}/`),"Client"),chatRoom:e=>Xe(Je(e,se.chatUrlTemplate),"Room"),leaderboard:e=>Xe(Je(e,se.leaderboardUrlTemplate),"Leaderboard"),leaderboardEntryDetail:(e,t)=>Xe(Je(t,e),"Leaderboard Entry")},Qe=(e,t,n)=>e[t]?Promise.resolve(e[t]):Ze[n](t).then((n=>(e[t]=n,n))).catch((e=>Promise.reject(e))),et=()=>Qe(se.appResource,se.clientId,"app"),tt=e=>Qe(se.chatRooms,e,"chatRoom"),nt=e=>Qe(se.progResource,e,"program"),it=e=>new Promise(((t,n)=>se.chatRooms&&se.chatRooms[e]&&se.chatRooms[e].channels?t(se.chatRooms[e].channels.chat.pubnub):tt(e).then((e=>t(e.channels.chat.pubnub))).catch((e=>n(e)))));function rt(e,t,n){let i={next:e,prev:null};const r=e=>i[e]?t(i[e]).then((e=>(i={next:e.next,prev:e.previous},Promise.resolve({value:n(e),done:!e.next})))):Promise.resolve({done:!0});return{[Symbol.asyncIterator]:()=>({next:()=>r("next"),previous:()=>r("prev")}),next:()=>r("next"),previous:()=>r("prev")}}const ot=(e,t)=>t.next().then((n=>{let i={count:n.value.count,iterator:t,next:t.next,previous:t.previous};return e.forEach((e=>{i[e]=n.value[e]})),i}));const st=function(e){e=e||Object.create(null);const t=(t,n)=>(e[t]||(e[t]=[])).push(n);return{on:t,peak:()=>e,uniqueOn:(n,i)=>(!e[n]||0===e[n].length)&&t(n,i),off:(t,n)=>{e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:(t,n)=>{(e[t]||[]).slice().map((e=>e(n))),(e["*"]||[]).slice().map((e=>e(t,n)))}}}();se.eb=st.peak;const at=(e,t,n)=>{const i=new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return e.dispatchEvent(i),i};function ct(e,t){return at(e,t,{}).detail.provider}const lt=e=>`\nSee https://docs.livelike.com/docs/${e||"getting-started-with-the-web-sdk"} for more details.`,ut=(e,t="")=>console.error(e,(e=>{const t=ae.version.split(".");return t[2]="0","See https://websdk.livelikecdn.com/docs/"+t.join(".")+"/modules/_scripts_"+e+"_.html for more details."})(t)),dt=(e,t,n)=>console.error(`${e}: ${t} must be of type <${n}>`),ht=(e,t)=>Promise.reject(((e,t)=>ut("Missing "+e+" argument\n",t))(e,t)),pt=(e,t)=>console.error(e,lt(t)),ft=e=>e.parentElement&&e.parentElement.localName===e.localName&&console.error(e.localName+" cannot be a child of itself."),gt={get:()=>JSON.parse(localStorage.getItem(se.lsKey)),set:e=>localStorage.setItem(se.lsKey,JSON.stringify(e))},mt=(e,t,n)=>se.chatRooms[e][n]&&(e=>new Promise((t=>{let n=[],i=!0;setTimeout((()=>i=!1),1e4);const r=e=>Me.get({url:e}).then((e=>{e&&e.results?(n=[...n,...e.results],e.next?r(e.next):t(n)):t([])})).catch((()=>i?setTimeout((()=>r(e)),2e3):t([])));r(e)})))(se.chatRooms[e][n]).then((n=>(se.chatRooms[e][t]=n,n))),vt=(e,t,n)=>{let i=t&&t.slice(0,2);t&&se.localizedStrings[i]||(i="en");let r=se.localizedStrings[i][e]||se.localizedStrings.en[e];return r&&n&&Object.keys(n).forEach((e=>r=r.replace("<"+e+">",n[e]))),r};const yt=function(){let e=!1,t={};return(n,i,r)=>new Promise((o=>{const s=()=>{if(e)setTimeout(s,50);else if(e=!0,!t[r]&&(t[r]={}),t[r].sequence&&i!==t[r].sequence)e=!1,o(t[r]);else{t[r].sequence=i+1;const s=localStorage.getItem("ltt-"+r),a=!s||n>s;a&&localStorage.setItem("ltt-"+r,n),t[r].allowNext=a,e=!1,o(t[r])}};s()}))}(),bt=(()=>{const e=[];return{add:(t,n,i,r)=>{e.push({id:n,listener:r,callback:i}),Ce(r),Te(t)},remove:(t,n)=>{const i=e.findIndex((e=>e.id===t&&String(e.callback)===String(n)));var r;-1!==i?(r=e[i].listener,xe.removeListener(r),e.splice(i,1)):console.warn("Listener not removed. Check arguments.")}}})(),wt=e=>e&&"object"==typeof e?e:{get currentTimecode(){return null}},kt=(e,t,n)=>{if(!e.isUpdating){e.isUpdating=!0;const i=()=>{e.queue&&e.queue.hasNextItem()?e.queue.isNextItemReady()&&t()?(n(e.queue.dequeueItem()),i()):setTimeout((()=>{e.isUpdating=!1,i()}),1e3):e.isUpdating=!1};i()}},_t=(e,t)=>{let n=0;const i=()=>{30===n||e.syncStrategy&&void 0!==e.syncStrategy.currentTimecode?t():setTimeout((()=>{n++,i()}),100)};i()},Pt=e=>({number:!0,string:!isNaN(Date.parse(St(e))),object:e instanceof Date&&!isNaN(e.getTime())}[typeof e]),St=e=>"string"==typeof e&&/^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2}(?:[,.]\d*)?)(([+-](\d{2}):(\d{2})|Z)?)$/.test(e)?e.replace(",","."):e,xt=({widgets:e,interactions:t})=>e.map((e=>{let n=Ot(e);if(n){const{kind:i,id:r}=n;return{widgetPayload:e,interactions:t&&t[i]?t[i].filter((e=>e.widget_id===r)):null}}return{widgetPayload:e,interactions:null}})),Ot=e=>be.some((t=>e.kind===t))?{kind:e.kind.replace("-follow-up",""),id:e.kind===ge||e.kind===me?e.text_prediction_id||e.image_prediction_id:e.id}:null,Tt=e=>class extends e{connectedCallback(){super.connectedCallback()}render(){return this.customTemplate?this.customTemplate():this.defaultTemplate()}},Ct=e=>class extends e{constructor(){super(...arguments),this.updateOwnerProps=e=>{this.owner.widgetPayload.id===e.key&&this.owner.dataId===e.owner.dataId&&(this.ownerUpdated(e),"disabled"!==e.name&&"changed"!==e.name||(this[e.name]=e.prop),"options"!==e.name&&"choices"!==e.name||(this[e.name]=e.prop,this.items=e.prop,this.optionListUpdated(e.prop),at(this,"options-updated",this.items)))}}static get properties(){return{owner:{type:Object},items:{type:Array},options:{type:Array},choices:{type:Array},disabled:{type:Boolean,reflect:!0},changed:{type:Boolean,reflect:!0}}}ownerUpdated(e){}optionListUpdated(e){}optionUpdated(e){}connectedCallback(){super.connectedCallback(),st.on("widget-updated",this.updateOwnerProps),!this.owner&&(this.owner=ct(this,"widget-provider")),this.items=this.owner.options||this.owner.choices,this.owner.options&&(this.options=this.owner.options),this.owner.choices&&(this.choices=this.owner.choices)}disconnectedCallback(){st.off("widget-updated",this.updateOwnerProps),super.disconnectedCallback()}};class Et extends(Ct(oe)){}const Rt=e=>class extends e{constructor(){super(...arguments),this.appendStyles=e=>{(this.shadowRoot||this).appendChild(e)},this.updateTheme=e=>e.theme&&e.theme.widgets&&this.defaultStyles&&this.updateComplete.then((()=>{const t=this.owner.kind||this.owner.localName.replace("livelike-",""),n=pe[t],i=e.theme.widgets[n],r=document.createElement("style");r.innerHTML+=this.defaultStyles(i),this.appendStyles(r)}))}connectedCallback(){super.connectedCallback(),st.on("themeUpdate",this.updateTheme),this.updateTheme({theme:this.owner.theme||ae.theme})}disconnectedCallback(){st.off("themeUpdate",this.updateTheme),super.disconnectedCallback()}};class At extends(Tt(Rt(Et))){}const Mt=["selected","correct","incorrect","image","disabled"],jt=e=>class extends e{constructor(){super(...arguments),this.updateItem=e=>{this.item&&this.item.id===e.key&&this.owner.widgetPayload.id===e.owner.widgetPayload.id&&this.owner.dataId===e.owner.dataId&&(("items"===e.name||"options"===e.name||"choices"===e.name)&&(this[e.name.slice(0,-1)]=e.prop.find((e=>e.id===this.item.id))),this.requestUpdate(),super.requestUpdate(),this.optionUpdated(this.item),Mt.some((t=>t===e.name))&&(this[e.name]=e.prop))}}static get properties(){return{item:{type:Object},option:{type:Object},choice:{type:Object},selected:{type:Boolean,reflect:!0},correct:{type:Boolean,reflect:!0},incorrect:{type:Boolean,reflect:!0},image:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}}}connectedCallback(){st.on("option-updated",this.updateItem);const e=ct(this,"option-provider");e&&(this.item=e.item,e.option&&(this.option=e.option),e.choice&&(this.choice=e.choice)),super.connectedCallback()}disconnectedCallback(){st.off("option-updated",this.updateItem),super.disconnectedCallback()}};class Lt extends(Tt(Rt(jt(Et)))){}const{modeList:Nt,getMode:Ut,register:It}=function(){const e={};return{modeList:e,getMode:t=>"function"==typeof t?t:e[t]?e[t]:pt('Widget mode: "'+t+'" not found.'),register:(t,n)=>e[t]=n}}(),Dt=({programId:e})=>e?nt(e).then((e=>{const t=e.subscribe_channel;return rt(e.timeline_url,(e=>{const n=[];let i="";return fetch(e).then((e=>{const r=e.headers&&Number(e.headers.get("age"));if(r&&r>0){const e=(new Date).getTime()-1e3*r+"0111";Ee(t,{end:e}).then((e=>e.channels[t]&&e.channels[t].map((e=>{if(e.message&&e.message.payload){n.push(e.message.payload);let t=Ot(e.message.payload);if(t){const{kind:e,id:n}=t;i=i+"&"+e.replace(/-/g,"_")+"_id="+n}}}))))}return e.json()})).then((e=>(e.results=[...n,...e.results],e.widget_interactions_url_template.includes("?")&&i?e.widget_interactions_url_template=e.widget_interactions_url_template+i:i&&!e.widget_interactions_url_template.includes("?")&&(e.widget_interactions_url_template=e.widget_interactions_url_template+"?"+i),e)))}),(e=>({count:e.count,widgets:e.results,widget_interactions_url_template:e.widget_interactions_url_template})))})):ht("programId","getwidgets"),Bt=e=>{const t="z"===e.kind[e.kind.length-1]?"zes":"s";return fetch(se.endpoint+e.kind+t+"/"+e.id+"/").then((e=>e.ok?e.json():Promise.reject("Error getting widget")))},$t=(e,t)=>It(e,t),Ft=e=>{if(e.programId||e.interactionUrl){if(e.interactionUrl&&!e.interactionUrl.includes("?"))return Promise.reject("No Interaction Found");{let t="";return e.interactionUrl?(t=e.interactionUrl,Me.get({url:Je(ce.id,e.interactionUrl)}).then((e=>Promise.resolve(e.interactions))).catch((e=>Promise.reject(e)))):nt(e.programId).then((n=>(t=Je(ce.id,n.widget_interactions_url_template)+"/?",e.widgets.forEach((e=>{const n=e.kind.replace(/-/g,"_")+"_id";t+=n+"="+e.id+"&"})),Me.get({url:t}).then((e=>Promise.resolve(e.interactions))).catch((e=>Promise.resolve([]))))))}}return ht("programId","getWidgetInteractions")},Kt=(e,t)=>customElements.get(e)?console.warn(`${e} has already been registered`):customElements.define(e,t),qt=e=>t=>Kt(e,t);const zt=function(){let e=[];const t=(t,n,i)=>{e.forEach((e=>{e.channel===t&&e.callback({message:n,event:i})}))},n={message:e=>{"program-status-updated"===e.message.event&&at(document,e.message.event,e.message.payload),e.timetoken&&(e.message.payload.timetoken=e.timetoken),t(e.channel,e.message.payload,e.message.event)},messageAction:e=>{t(e.channel,e.data,e.event)}};return{listeners:e,subscribe:e=>Te(e),addListener:(t,n)=>e.push({channel:t,callback:n}),unsubscribe:t=>!e.some((e=>e.channel===t))&&(e=>xe.unsubscribe({channels:[e]}))(t),removeListener:(t,n)=>(e=e.filter((e=>e.channel!==t||e.callback!==n)),e),initialize:()=>Ce(n)}}();window.SCPEAK=()=>zt.listeners;var Ht=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};class Vt extends oe{constructor(){super(...arguments),this.firstInteractionTime=null,this.changed=!1,this.disabled=!1,this.phase="ready",this.selectedOption={},this.syntheticIncrement=!1,this.vote=null,this.isInteractable=!0,this.interaction=null,this.interactions=null,this.hide_dismiss_button=!1,this.initialLoad=!1,this.interacted=!1,this.localize=(e,t)=>vt(e,this.lang,t),this.onResults=e=>{if(e.message.id===this.widgetPayload.id)if(this.syntheticIncrement)this.syntheticIncrement=!1;else{let t=null;const n=e.message.options||e.message.choices,i=e.message.options?"vote_count":"answer_count",r=e.message.options?"options":"choices";if(n){const o=this[r].map(((e,r)=>(e[i]!==n[r][i]&&(t=n[r],e[i]=n[r][i]),e)));if(t){this[r]=o,this.changed=!0,"vote_count"===i?this.voteCountChanged(t):this.answerCountChanged(t);at(this,"vote_count"===i?"votecountchanged":"answercountchanged",t),at(this,e.event,n)}}}},this.removeListener=e=>(e&&at(this,e,{element:this,widget:this.widgetPayload}),zt.removeListener(this.widgetPayload.subscribe_channel,this.onResults),zt.unsubscribe(this.widgetPayload.subscribe_channel),Promise.resolve()),this.expire=()=>this.removeListener("expire"),this.dismiss=()=>{const e={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};return Pe("Widget Dismissed",e,this.programid),this.removeListener("dismiss")},this.detach=()=>{const e=this.parentElement;e&&e.detach?e.detach(this):this.remove()},this.widgetDismissClick=()=>this.dismiss().then(this.detach),this.interactionTrack=()=>{!this.firstInteractionTime&&(this.firstInteractionTime=new Date),this.interacted=!0},this.interactionEvent=e=>{"cheer-meter"!==this.widgetPayload.kind&&this.interactionTrack();const t={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};Pe("Widget Interacted",t,this.programid)},this.ready=e=>new Promise((t=>setTimeout((()=>t()),e&&e.timeout||0))),this.interactive=e=>new Promise((t=>{this.phase=le,this.disabled=!1;const n={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};this.isInteractable&&Pe("Widget Became Interactive",n,this.programid);let i=e&&void 0!==e.timeout?e.timeout:this.widgetPayload.timeout&&Ue(this.widgetPayload.timeout);this.timeout=i,null!==i&&setTimeout(t,i)})),this.results=e=>new Promise((t=>{this.phase=de;const n=e&&e.timeout||8e3;this.changed=!0,this.disabled=!0,this.resultEvent(),setTimeout(t,n)})),this.finished=e=>new Promise((t=>{this.phase=ue,this.changed=!0,this.disabled=!0,setTimeout(t,e&&e.timeout||0)})),this.rankChanged=(e,t)=>{t&&t.length&&at(this,"rankchange",{widget:e,rewards:t,element:this})},this.voteBase=(e,t,n)=>Me[t]({url:e,data:n}).then((e=>(this.voteDisable=!1,this.vote=e,this.rankChanged(this.widgetPayload,e.rewards),Promise.resolve(e)))).catch((e=>(this.voteDisable=!1,Promise.reject(e)))),this.updateVote=(e,t)=>this.voteBase(e,"patch",t),this.createVote=(e,t)=>this.voteBase(e,"post",t)}shouldUpdate(){return!!this.widgetPayload}firstUpdated(){zt.subscribe(this.widgetPayload.subscribe_channel),zt.addListener(this.widgetPayload.subscribe_channel,this.onResults),this.widgetPayload.impression_url&&Me.post({url:this.widgetPayload.impression_url}).catch((e=>console.warn("Widget impression request failed")))}connectedCallback(){this.addEventListener("dismiss-clicked",this.widgetDismissClick),this.addEventListener("widget-provider",(e=>{e.detail.provider=this,e.stopPropagation()})),super.connectedCallback()}disconnectedCallback(){this.removeListener(),this.removeEventListener("dismiss-clicked",this.widgetDismissClick),super.disconnectedCallback()}updated(e){e.forEach(((e,t)=>{const n=e=>void 0!==this[e]&&at(this,e,{widget:this.widgetPayload,element:this,[e]:this[e],item:this.selectedOption});if("interacted"===t&&n(t),"phase"===t&&(n(t),this.phase!==de&&this.phase!==ue||(this.changed=!0,this.disabled=!0)),"vote"===t&&this.vote&&this.vote.id){this.changed=!0;const e=he[this.nodeName];at(this,e,{[e]:this.vote,element:this,widget:this.widgetPayload})}if("reply"===t&&this.reply&&this.reply.length>0){this.changed=!0;const e=he[this.nodeName];at(this,e,{[e]:this.reply,element:this,widget:this.widgetPayload})}void 0!==this[t]&&null!==this[t]&&st.emit("widget-updated",{name:t,key:this.widgetPayload.id,prop:this[t],owner:this})}))}answerCountChanged(e){}voteCountChanged(e){}resultEvent(){}submitVote(e){}lockInVote(){}}Ht([X({type:Boolean,reflect:!0})],Vt.prototype,"changed",void 0),Ht([X({type:Boolean,reflect:!0})],Vt.prototype,"disabled",void 0),Ht([X({type:String,reflect:!0})],Vt.prototype,"lang",void 0),Ht([X({type:Boolean})],Vt.prototype,"reactions",void 0),Ht([X({type:String})],Vt.prototype,"phase",void 0),Ht([X({type:Object})],Vt.prototype,"selectedOption",void 0),Ht([X({type:String})],Vt.prototype,"timeout",void 0),Ht([X({type:Object})],Vt.prototype,"widgetPayload",void 0),Ht([X({type:Object})],Vt.prototype,"mode",void 0),Ht([X({type:String})],Vt.prototype,"kind",void 0),Ht([X({type:Boolean})],Vt.prototype,"syntheticIncrement",void 0),Ht([X({type:Object})],Vt.prototype,"vote",void 0),Ht([X({type:Boolean})],Vt.prototype,"voteDisable",void 0),Ht([X({type:Array})],Vt.prototype,"options",void 0),Ht([X({type:Array})],Vt.prototype,"choices",void 0),Ht([X({type:String})],Vt.prototype,"question",void 0),Ht([X({type:Boolean})],Vt.prototype,"isInteractable",void 0),Ht([X({type:Object})],Vt.prototype,"interaction",void 0),Ht([X({type:Array})],Vt.prototype,"interactions",void 0),Ht([X({type:Boolean})],Vt.prototype,"authors",void 0),Ht([X({type:Boolean})],Vt.prototype,"timestamps",void 0),Ht([X({type:Boolean})],Vt.prototype,"timeformat",void 0),Ht([X({type:Boolean})],Vt.prototype,"hide_dismiss_button",void 0),Ht([X({type:String})],Vt.prototype,"reply",void 0),Ht([X({type:Boolean,hasChanged:()=>!0})],Vt.prototype,"interacted",void 0);const Gt=e=>class extends e{constructor(){super(...arguments),this.setupWidget=()=>new Promise((e=>{const t=()=>{if(window.LiveLike._config.ready&&window.LiveLike._config.theme&&window.LiveLike._config.theme.widgets){const t=this.kind||this.getAttribute("kind")||this.localName.replace("livelike-",""),n=this.widgetId||this.getAttribute("widgetid"),i=this.mode||this.getAttribute("mode"),r="string"==typeof i?Ut(i):i,o=n=>{this.widgetPayload=n,this.programid=this.widgetPayload.program_id,Object.keys(n).forEach((e=>this[e]=n[e])),this.theme=window.LiveLike._config.theme,r?r():(this.widgetPayload.timeout=null,t===ge||t===me?this.results():this.interactive(),this.interactionTrack=()=>{!this.firstInteractionTime&&(this.firstInteractionTime=new Date),this.interacted=!0,this.results()}),e()};Bt({kind:t,id:n}).then((e=>{let t=Ot(e);t?Ft({programId:e.program_id,widgets:[{kind:t.kind,id:t.id}]}).then((n=>{n&&n[t.kind]&&(this.interactions=n[t.kind].filter((e=>e.widget_id===t.id)),this.interactions&&(this.interaction=this.interactions[0])),o(e)})):o(e)}))}else setTimeout(t,50)};t()}))}},Wt=e=>class extends e{constructor(){super(...arguments),this.appendStyles=e=>{this.appendChild(e)}}connectedCallback(){super.connectedCallback();const e=()=>new Promise((e=>{this.updateComplete.then((()=>{this.shadowRoot&&this.shadowRoot.appendChild(document.createElement("slot"));const t=!!this.customTemplate&&this.customTemplate({widgetPayload:this.widgetPayload});if(t&&!(t instanceof HTMLTemplateElement))return console.error("customTemplateRenderer must return an HTMLTemplateElement");const n=document.querySelector(`template[kind=${this.widgetPayload.kind}]`),i=this.shadowRoot.querySelector("template"),r=t||n;r||i?(this.appendChild(r?document.importNode(r.content,!0):i.content),e()):e()}))}));return this.widgetPayload&&0!==Object.keys(this.widgetPayload).length?e():this.setupWidget().then(e)}};class Yt extends(Wt(Gt(Vt))){}class Jt extends(Wt(Gt(Rt(Vt)))){}let Xt=class extends Vt{render(){return D`<slot></slot>`}};function Zt(e){let t=[];return{queueArray:t,hasNextItem:()=>t.length>0,dequeueItem:()=>t.shift(),enqueueItem:(n,i)=>{const{payload:r}=n;-1===t.findIndex((e=>e.payload.id===r.id))&&(t.push(n),e&&e.currentTimecode&&t.sort(((e,t)=>{const n=Pt(e.payload.program_date_time)?new Date(St(e.payload.program_date_time)):null,i=Pt(t.payload.program_date_time)?new Date(St(t.payload.program_date_time)):null;return n>i?1:i>n?-1:0})),i&&i())},isNextItemReady:()=>{if(!e||!e.currentTimecode)return!0;if(e.ready)return e.ready(t[0].payload);const n=t[0].payload.program_date_time&&Pt(t[0].payload.program_date_time)&&new Date(St(t[0].payload.program_date_time)),i=Pt(e.currentTimecode)&&new Date(St(e.currentTimecode));return se.logger&&console.log("syncTime >= pdt",i>=n),!n||!i||i>=n}}}Xt=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget")],Xt);const Qt=(e,t)=>it(e).then((n=>{!t&&(t={});const i=rt((new Date).getTime()+"1234",(i=>(t.start=i,Ee(n,t).then((t=>{const i=t.channels[n]?Ye(e,t.channels[n]):[];return{results:i,next:i[0]?i[0].timetoken:null}})))),(e=>({messages:e.results})));return i.next().then((e=>({messages:e.value.messages,next:i.next})))})),en={},tn=e=>new Promise(((t,n)=>{let i={id:Oe(),sender_id:ce.id,sender_nickname:ce.nickname,sender_image_url:e.sender_image_url||null,sender_profile_url:ce.url,badge_image_url:null,created_at:(new Date).toISOString(),program_date_time:e.timestamp||null,message:e.message||null};const r=()=>{en[e.roomId]&&(i=en[e.roomId](i));const r={event:e.image_url?"image-created":"message-created",payload:i};it(e.roomId).then((i=>{Se(r.payload,e.roomId,"Chat Message Sent"),(e=>new Promise(((t,n)=>xe.publish({message:e.message,channel:e.channel,ttl:0},((e,i)=>e.error?n(e):t(i))))))({message:r,channel:i}).then((()=>{t(r.payload)})).catch((e=>{console.error("Error: "+e+" Message failed to send."),n()}))}))};var o;e.image_url?(o=e.image_url,fetch(o).then((e=>e.blob()))).then((t=>{tt(e.roomId).then((o=>{((e,t)=>{var n=new FormData;return n.append("type","file"),n.append("image",t,"image.png"),fetch(e,{method:"POST",body:n}).then((e=>e.json()))})(o.upload_url,t).then((function(t){i.image_url=t.image_url,i.image_width=~~e.image_width||null,i.image_height=~~e.image_height||null,r()})).catch((function(e){console.error((e.message,e.message)),n()}))}))})).catch((function(e){console.error((e.message,e.message)),n()})):r()})),nn=D`<style>:host{overflow:auto}.message-item-container{position:relative;margin:0 0 .5rem 0;display:flex;justify-content:flex-start}.message-item-container>.menu-button-container>.more-icon{opacity:0;transition:opacity ease .3s}.message-item-container:hover>.menu-button-container>.more-icon{opacity:1;transition:opacity ease .3s}.menu-button-container{display:flex;flex-direction:column;justify-content:center}.more-icon:focus{opacity:0;transition:opacity ease .3s}.message-item-container>.menu-button-container>.more-icon.active{opacity:1}.more-icon.active{opacity:1}.message-wrapper{display:inline-grid;opacity:1;transition:all .4s;background:rgba(0,0,0,.4);border-radius:.75rem;padding:.5rem 1rem;max-width:80%;position:relative}.message-wrapper:focus{outline:0}.avatar{display:flex;flex-direction:column;justify-content:flex-start;margin:0 .5rem 0 0}.avatar img,.avatar svg{width:3rem;height:3rem;margin:0;border-radius:50%}.sender-name{font-size:1rem;display:inline-block;color:inherit;margin:0 0 .25rem 0;word-break:break-word;word-wrap:break-word}.sender-message{font-size:1rem;display:flex;word-break:break-word;word-wrap:break-word;color:inherit;line-height:1.3;padding:0 .25rem .25rem 0;flex-wrap:wrap}.sender-message.deleted{font-style:oblique;color:inherit}.word-item{align-self:flex-end}.image-message-container{max-width:480px}.image-message{max-width:100%;height:auto;border-radius:.5rem}.message-timestamp{font-size:.8rem}.more-icon{background:0 0;border:none;margin:1rem 0;display:flex;align-items:center;padding:0 1rem}.more-icon:hover{cursor:pointer}.more-icon svg{fill:#777}.more-icon:hover svg{fill:#555}.no-message-container{height:100%;position:relative;display:flex;justify-content:center}.no-messages{margin:0;color:#fff;position:absolute;top:50%}</style>`,rn=D`<svg width="24" height="24" viewBox="0 0 24 24"><path d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"/></svg>`,on=D`<svg width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg>`,sn=D`<svg viewBox="0 0 512 512" height="12" width="12"><path d="M98.9,184.7l1.8,2.1l136,156.5c4.6,5.3,11.5,8.6,19.2,8.6c7.7,0,14.6-3.4,19.2-8.6L411,187.1l2.3-2.6 c1.7-2.5,2.7-5.5,2.7-8.7c0-8.7-7.4-15.8-16.6-15.8v0H112.6v0c-9.2,0-16.6,7.1-16.6,15.8C96,179.1,97.1,182.2,98.9,184.7z"/></svg>`,an=D`<svg width="18" height="18" viewBox="0 0 16 16"><path fill-rule="nonzero" d="M2.083 9a6.002 6.002 0 0 0 11.834 0H2.083zM8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zM5.5 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm5 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"/></svg>`,cn=D`<svg width="4" height="20" viewBox="0 0 3 15"><path fill-rule="nonzero" d="M1.5 12a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm0-6a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm0-6a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3z"/></svg>`,ln=D`<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1"><g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><circle id="circle" fill="#000000" opacity="0.200000003" cx="9" cy="9" r="9"></circle><path d="M10.1443526,8.99976063 L12.7631923,11.617505 C13.0789359,11.9337699 13.0789359,12.4465365 12.7631923,12.7628014 C12.4474488,13.0790662 11.9355273,13.0790662 11.6197838,12.7628014 L9.00023937,10.1443526 L6.38249497,12.7631923 C6.06623012,13.0789359 5.55346349,13.0789359 5.23719864,12.7631923 C4.92093379,12.4474488 4.92093379,11.9355273 5.23719864,11.6197838 L7.85564741,9.00023937 L5.23680767,6.38249497 C4.92106411,6.06623012 4.92106411,5.55346349 5.23680767,5.23719864 C5.55255122,4.92093379 6.06447267,4.92093379 6.38021623,5.23719864 L8.99976063,7.85564741 L11.617505,5.23680767 C11.9337699,4.92106411 12.4465365,4.92106411 12.7628014,5.23680767 C13.0790662,5.55255122 13.0790662,6.06447267 12.7628014,6.38021623 L10.1443526,8.99976063 Z" id="x" fill="#FFFFFF" fill-rule="nonzero"></path></g></svg>`,un=D`<svg width="64px" height="64px" viewBox="0 0 64 64"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g><g><rect id="Rectangle" fill="#505A64" x="0" y="0" width="64" height="64"/><path d="M31.9590262,14 C40.9427465,14 44.8185604,18.1297028 43.8568799,26.9807577 C42.8951994,35.8318125 39.1802051,40 31.9730147,40 C26.0823195,40 21.3936793,37.5331739 20.2595234,28.1644789 C19.1253676,18.7957839 21.4756955,14 31.9590262,14 Z" id="Path-2" fill="#8C96A0"/><path d="M8,64 C13.6440504,52.375041 21.5113023,46.3802666 31.6017556,46.0156768 C41.692209,45.651087 49.8249571,51.6458614 56,64 L8,64 Z" id="Path-3" fill="#8C96A0"/></g></g></g></svg>`,dn=D`<svg height="18" width="18" viewBox="0 0 64 64"><g id="Giphy"><rect fill="#00ff92" x="8.61" y="9.09" width="6.31" height="46.75"/><rect fill="#fff24d" x="8.61" y="3.06" width="26.37" height="6.46"/><rect fill="#00c9ff" x="8.73" y="55.23" width="45.68" height="6.46"/><rect fill="#971eff" x="48.1" y="22.62" width="6.31" height="32.62"/><polygon fill="#ff6562" points="47.81 16.2 47.81 9.8 41.28 9.8 41.28 3.05 34.74 3.05 34.74 16.2 34.74 22.62 41.28 22.62 54.41 22.62 54.41 16.2 47.81 16.2"/><polygon fill="#5d1498" points="48.1 22.62 54.41 22.62 48.1 29.09 48.1 22.62"/><polygon fill="#968f2d" points="34.74 9.44 34.74 3.14 28.27 9.44 34.74 9.44"/></g></svg>`,hn=D`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" fill="none" viewBox="0 0 36 36"><path fill="#fff" d="M24.675 20.215l3.825-2.43L12 7.285v.255l12.675 12.675zM4.215 4l-2.13 2.115L12 16.03v12.255l7.485-4.77 10.17 10.17 2.115-2.115L4.215 4zM15 22.825V19.03l2.325 2.325L15 22.825z"/></svg>`,pn=D`<style>.reaction-button{border:none;border-radius:.5rem;background:rgba(255,255,255,.1);position:absolute;padding:.125rem .25rem;transform:translate(12px,-2px);right:0;bottom:0;top:auto;height:21px;width:21px;background-image:url("data:image/svg+xml;utf8,${"<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 16 16' fill='rgba(150, 150, 150, 0.5)'><path fill-rule='nonzero' d='M2.083 9a6.002 6.002 0 0 0 11.834 0H2.083zM8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zM5.5 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm5 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z'></path></svg>"}");background-repeat:no-repeat;background-size:13px 13px;background-position:center}.reaction-button:hover{cursor:pointer}.reaction-button>svg{fill:rgba(150,150,150,.5);height:13px;width:13px}.reaction-item-container{position:absolute;display:flex;margin:0;transition:opacity ease .3s;opacity:0;z-index:25;left:auto;right:auto;bottom:0;top:auto}.reaction-item-wrap{position:relative;display:inline-flex;padding:0 1.4rem 0 0;height:45px;border-radius:12px;min-height:inherit;width:inherit;background:#282828}.reaction-item{display:inline-block;position:relative;width:2.5rem;height:2.25rem;background:0 0;border-radius:12px;border:none;margin:4.5px 4px;cursor:pointer;padding:0}.reaction-item.selected,.reaction-item:focus,.reaction-item:hover{background:rgba(255,255,255,.2)}.reaction-image{width:25px;height:25px;position:relative;padding:0}.reaction-count{color:#fff;position:absolute;top:0}.mini-reactions{display:flex;position:absolute;right:0}.mini-reaction-image{height:16px;width:16px;margin:0 0 0 -5px;vertical-align:middle}.mini-reaction-count{color:#fff}</style>`;const fn="1",gn="0",mn=(e,t)=>{e.outsideClick.remove(),e.animation=gn,setTimeout((()=>e[t]=null),300)},vn=(e,t,n)=>{e[t]=n,setTimeout((()=>{e.outsideClick=function(e,t){function n(n){const i=(e.shadowRoot||document).elementFromPoint(n.x,n.y),r=e.contains(i),o=e.shadowRoot&&e.shadowRoot.contains(i);!r&&!o&&t()}return{register:()=>window.addEventListener("click",n,!1),remove:()=>window.removeEventListener("click",n,!1)}}(e,(()=>mn(e,t))),e.outsideClick.register(),e.animation=fn}),50);const i={"Chat Room ID":e.owner.roomid,"Chat Message ID":n};"selectedReactions"===t&&Pe("Chat Reaction Panel Opened",i)},yn=(e,t,n)=>e[n]===t?mn(e,n):vn(e,n,t);function bn(e){const t=Math.log10(e)/3|0;if(0==t)return e;const n=e/Math.pow(10,3*t),i=n%1==0||n>=10?0:1;return n.toFixed(i)+["","k","M"][t]}const wn=e=>class extends e{constructor(){super(...arguments),this.updateOwnerProps=e=>{this.owner.dataId===e.key&&(this.ownerUpdated(e),this.requestUpdate(),super.requestUpdate())}}static get properties(){return{owner:{type:Object}}}ownerUpdated(e){}connectedCallback(){if(!this.owner&&(this.owner=ct(this,"chat-provider")),st.on("chat-updated",this.updateOwnerProps),this.defaultStyles){const e=document.createElement("style");e.innerHTML+=this.defaultStyles(),this.appendChild(e)}super.connectedCallback()}};class kn extends(wn(oe)){}const _n=D`<style>.livelike-modal{color:#000;padding:1rem;background:#fff;border-radius:5px;position:absolute;z-index:15;width:50%;top:50%;left:25%;opacity:0}.livelike-modal.showing{transition:all ease .3s;opacity:1}</style>`;var Pn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Sn=class extends kn{render(){const e={block:this.owner.localize("chat.blockConfirmation.message",{username:this.data?this.data.nickname:null}),report:this.owner.localize("chat.reportConfirmation.message"),muted:this.owner.localize("chat.mutedMessage"),error:this.owner.localize("chat.errorMessage")};return D`${_n}<div class="livelike-modal ${""!==this.type?"showing":null}"><div class="modal-body">${e[this.type]}</div></div>`}};Pn([X({type:String,reflect:!0})],Sn.prototype,"type",void 0),Pn([X({type:Object})],Sn.prototype,"data",void 0),Sn=Pn([qt("livelike-modal")],Sn);const xn=D`<style>.message-options{z-index:21;background:#fff;border-radius:5px}.menu-button{display:flex;font-size:.75rem;color:#000;padding:.25rem 1rem;width:100%;border:none;background:0 0;transition:background ease .3s;text-align:left}.menu-button:hover{background:rgba(0,0,0,.2);transition:background ease .3s;cursor:pointer}.block-user.blocked{color:gray;cursor:default}.menu-item-label{margin:0 0 0 .5rem}.menu-icon{line-height:1.1rem;font-size:.95rem;width:18px}.sub-item-icon{position:absolute;right:.5rem}</style>`;var On=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Tn=class extends oe{constructor(){super(...arguments),this.subMenuOpen=null,this.renderSubIcon=e=>"multi"===e.type?D`<div class="sub-item-icon">${sn}</div>`:null,this.renderButton=(e,t,n)=>D`<button id="menu-button-${t}" aria-label="${e.label}" @click="${n}" class="button menu-button"><div class="menu-item-label">${e.label}</div>${this.renderSubIcon(e)}</button>`,this.renderCustomHtml=e=>{const t=(new DOMParser).parseFromString(e.html,"text/html"),n=[];return t.body.childNodes.forEach((e=>n.push(e))),n.map((e=>D`${e}`))},this.renderItem=(e,t)=>{const n=this.message.id+String(t),i="single"===e.type?()=>{e.onClick(),this.closeMenu("selectedMessage")}:()=>this.subMenuOpen===n?this.subMenuOpen=null:this.subMenuOpen=n;return D`${"custom"===e.type&&e.html?this.renderCustomHtml(e):this.renderButton(e,t,i)} ${this.subMenuOpen===n&&"multi"===e.type?this.renderSubMenu(e.items):null}`},this.renderSubMenu=e=>D`<div class="sub-menu-container">${this.renderMenu(e,10)}</div>`,this.renderMenu=(e,t)=>e.map(((e,n)=>"separator"===e.type?D`<hr style="margin:0">`:this.renderItem(e,t?n+t:n)))}createRenderRoot(){return this}render(){return D`${xn}<style>message-menu{position:absolute;width:100%;max-width:10rem;right:2.5rem;display:block;top:50%;margin:auto;top:0;bottom:0;right:1rem;display:flex;align-items:center;justify-content:center;text-align:center}.message-options-anchor{z-index:21;transition:opacity .3s ease;opacity:${this.animation}}</style><div class="message-options-anchor" id="chat_moderation"><div class="message-options">${this.renderMenu(this.menu)}</div></div>`}};On([X({type:Array})],Tn.prototype,"menu",void 0),On([X({type:Object})],Tn.prototype,"message",void 0),On([X({type:Number})],Tn.prototype,"animation",void 0),On([X({type:String})],Tn.prototype,"subMenuOpen",void 0),On([X({type:Function})],Tn.prototype,"closeMenu",void 0),Tn=On([qt("message-menu")],Tn);
|
|
190
190
|
/**
|
|
191
191
|
* @license
|
|
192
192
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -200,7 +200,7 @@ function(t,n){e.exports?e.exports=n(t):n(t)}("undefined"!=typeof self?self:void
|
|
|
200
200
|
* subject to an additional IP rights grant found at
|
|
201
201
|
* http://polymer.github.io/PATENTS.txt
|
|
202
202
|
*/
|
|
203
|
-
const Cn=new WeakMap,En=(An=e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTML can only be used in text bindings");const n=Cn.get(t);if(void 0!==n&&P(e)&&e===n.value&&t.value===n.fragment)return;const i=document.createElement("template");i.innerHTML=e;const r=document.importNode(i.content,!0);t.setValue(r),Cn.set(t,{value:e,fragment:r})},(...e)=>{const t=An(...e);return g.set(t,!0),t});var An;var Rn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Mn=class extends kn{constructor(){super(...arguments),this.message=null,this.animation=0,this.selectedMessage=null,this.selectedReactions=null,this.isDeleted=!1,this.messageDeleted=e=>{const t=this.owner.localize("chat.messageDeleted");this.message&&e.message&&e.message.id===this.message.id&&(this.isDeleted=!0,this.message=Object.assign(Object.assign({},this.message),{image_url:null,message:t,filtered_message:t}))},this.ownerUpdated=e=>{"deletedMessages"===e.name&&this.messageDeleted({message:e.prop[e.prop.length-1]})},this.renderMessageMenu=e=>D`<message-menu .menu="${this.owner.messageMenuFunc(e)}" .message="${e}" .animation="${this.animation}" .closeMenu="${()=>mn(this,"selectedMessage")}"></message-menu>`,this.renderMenuButton=(e,t)=>this.owner.messagemenus&&!this.isDeleted&&this.owner.messageMenuFunc(t)&&this.owner.messageMenuFunc(t).length?D`<div class="menu-button-container"><button aria-label="${this.owner.localize("chat.messageMenu.ariaLabel")}" class="more-icon ${e}" @click="${()=>yn(this,t.id,"selectedMessage")}">${cn}</button></div>`:null,this.renderTimestamp=e=>{const t=e.timetoken&&e.timetoken.slice(0,e.timetoken.length-4),n=He(Number(t),this.owner.timeformat,this.owner.lang);return D`<time aria-label="${n}" class="message-timestamp" datetime="${t}">${n}</time>`},this.reactionAction=e=>{const t=this.message.reactions[e.id]&&this.message.reactions[e.id].find((e=>e.uuid===ce.id)),n=()=>mn(this,"selectedReactions"),i={value:e.id,uuid:ce.id,messageTimetoken:this.message.timetoken,actionTimetoken:t&&t.actionTimetoken||null},r=(t,r)=>{this.owner[t]({messageId:this.message.id,reactionId:e.id}).then(n),this.owner.updateReaction(i,r)};t?r("removeMessageReaction","reactionremoved"):r("addMessageReaction","reactionadded")},this.getReactionCount=e=>this.message.reactions[e.id]?this.message.reactions[e.id].length:0,this.renderMiniReactions=()=>((e,t,n)=>D`<div class="mini-reactions">${n.map((e=>t(e)>0?D`<img class="mini-reaction-image" src="${e.file}" alt="Reaction ${e.name}">`:null))} ${e>0?D`<span class="mini-reaction-count">${bn(e)}</span>`:null}</div>`)(Object.values(this.message.reactions).reduce(((e,t)=>e.concat(t)),[]).length,this.getReactionCount,this.owner.reactionPack),this.renderReactions=()=>{const e=e=>this.message.reactions[e.id]&&this.message.reactions[e.id].find((e=>e.uuid===ce.id));return((e,t,n,i,r,o,s)=>D`<div class="reaction-item-container" style="opacity:${t}"><div class="reaction-item-wrap">${e.map((e=>{const t=i(e);return D`<button aria-label="${o?vt(o,s||"en-US",{reactionName:e.name}):"Reaction "+e.name}" class="reaction-item ${n(e)}" @click="${()=>r(e)}"><img class="reaction-image" src="${e.file}" alt=""> ${t>0?D`<span class="reaction-count">${bn(t)}</span>`:null}</button>`}))}</div></div>`)(this.owner.reactionPack,this.animation,(t=>e(t)?"selected":""),this.getReactionCount,this.reactionAction,"chat.reactions.reactionSelectionButton.ariaLabel",this.owner.lang)},this.renderAvatar=()=>D`<div class="avatar">${this.message.sender_image_url?D`<img src="${this.message.sender_image_url}" alt="Avatar" @error="${()=>{this.message=Object.assign(Object.assign({},this.message),{sender_image_url:null})}}">`:un}</div>`,this.trackClickEvent=e=>{if(e.target&&e.target.href){const t=this.message;t.messageLink=e.target.href,Se(t,this.owner.roomid,"Chat Message Link Clicked")}},this.buildMessage=(e,t,n,i)=>((e,t,n,i)=>{const r=t?t.reduce(((e,t)=>e.concat(t.stickers)),[]):[];if(e.image_url)return D`<div class="image-message-container"><img class="image-message" width="${e.image_width}" height="${e.image_height}" src="${e.image_url}" alt="Chat image"></div>`;if(e.message){let t=e.message;n&&i&&i.length>0&&i.forEach((e=>{t=t.replace(e,(e=>{const t=0!==e.indexOf("http")?"//"+e:e;return`<a class="livelike-message-link" title="${t}" target="_blank" href="${t}">${e}</a>`}))}));const o=/:[^\/\/]([^:]*):/g,s=0===t.indexOf(":"),a=(t.match(o)||[]).length>1||t.split(" ").length>1?"22px":"32px";return t=t.replace(o,(e=>{const t=r&&r.find((t=>t.shortcode===e.slice(1,-1)));return t?`\n <span style="margin: 0 4px 0 ${s?"0":"4px"};">\n <img\n class="word-item"\n height=${a}\n src=${t.file}\n alt=${t.shortcode}\n />\n </span>\n `:e})),En(t)}})(e,t,n,i)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Se(this.message,this.owner.roomid,"Chat Message Displayed")}render(){const e=this.owner.blockList.find((e=>e===this.message.sender_id)),t=this.selectedMessage===this.message.id,n=t?"active":"",i=this.message.sender_id===ce.id?"self":"",r=this.owner.showavatar?"has-avatar":"",o=this.isDeleted?"deleted":"";return e?null:D`${nn} ${pn}<div class="message-item-container ${n} ${i}">${this.owner.showavatar?this.renderAvatar():null}<div class="message-wrapper ${r}" tabindex="0">${this.owner.reactionPack&&this.owner.reactionPack.length>0?this.renderMiniReactions():null}<div aria-live="polite" role="log"><div class="sender-name" aria-label="${this.message.sender_nickname}">${this.message.sender_nickname}</div><div @click="${this.trackClickEvent}" aria-label="${this.message.image_url?this.message.image_url:this.message.message}" id="senderMessage-${this.message.id}" class="sender-message ${o}">${this.buildMessage(this.message,this.owner.stickerPacks,this.owner.messageurls,this.owner.messageUrlPatterns)}</div>${this.owner.timestamps?this.renderTimestamp(this.message):null}</div>${this.owner.reactionPack&&this.owner.reactionPack.length>0&&!this.isDeleted?(s=this,a=this.message.id,c="chat.reactions.openButton.ariaLabel",D`<div class="reaction-button-container"><button class="reaction-button" aria-label="${c?s.owner.localize(c):"Open Reactions"}" @click="${()=>yn(s,a,"selectedReactions")}"></button></div>`):null}</div>${this.selectedReactions===this.message.id?this.renderReactions():null} ${t?this.renderMessageMenu(this.message):null} ${this.renderMenuButton(n,this.message)}</div>`;var s,a,c}};Rn([X({type:Object})],Mn.prototype,"message",void 0),Rn([X({type:Number})],Mn.prototype,"animation",void 0),Rn([X({type:String})],Mn.prototype,"selectedMessage",void 0),Rn([X({type:String})],Mn.prototype,"selectedReactions",void 0),Rn([X({type:Boolean})],Mn.prototype,"isDeleted",void 0),Mn=Rn([qt("livelike-message-item")],Mn);let jn=class extends kn{constructor(){super(...arguments),this.appendMessage=e=>{const t=e.detail.message;if(t.message||t.image_url||t.custom_data&&this.owner.customMessageRenderer){const e=t.custom_data&&this.owner.customMessageRenderer?this.owner.customMessageRenderer({message:t}):document.createElement("livelike-message-item");e.message=t,e.owner=this.owner;const n=this.scrollTop+this.clientHeight===this.scrollHeight;this.appendChild(e);(e.updateComplete?e:this).updateComplete.then((()=>(t.sender_id===ce.id||n)&&this.scrollToBottom()))}},this.softKeyboardHandler=ze((()=>this.scrollTop+this.clientHeight===this.scrollHeight&&this.scrollToBottom())),this.scrollListener=ze((()=>{st.emit("userScrolled",{key:this.owner.dataId,scrolled:this.scrollTop+this.clientHeight+10<this.scrollHeight})})),this.scrollToBottom=()=>this.scrollTop=this.scrollHeight+1e4,this.scrollToBottomListener=e=>e.key===this.owner.dataId&&this.scrollToBottom()}connectedCallback(){this.addEventListener("scroll",this.scrollListener),st.on("scrollDown",this.scrollToBottomListener),window.addEventListener("resize",this.softKeyboardHandler),super.connectedCallback(),this.setAttribute("role","log"),this.owner.addEventListener("message-ready",this.appendMessage)}disconnectedCallback(){st.off("scrollDown",this.scrollToBottomListener),this.removeEventListener("scroll",this.scrollListener),this.owner.removeEventListener("message-ready",this.appendMessage),window.removeEventListener("resize",this.softKeyboardHandler),super.disconnectedCallback()}render(){return D`<style>:host{display:block;overflow:auto}</style><slot></slot>`}};jn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-message-list")],jn);const Ln=()=>"\n :host {\n display: flex;\n }\n livelike-chat-composer {\n display: flex;\n position: relative;\n flex-shrink: 0;\n }\n .livelike-chat-input {\n border: 0;\n background: #fff;\n box-sizing: border-box;\n border-radius: 0.5rem;\n color: inherit;\n font-size: 1rem;\n font-family: inherit;\n line-height: 1.5rem;\n height: 40px;\n min-height: 2.5rem;\n overflow: hidden;\n padding: 0.5rem 5rem 0.5rem 0.5rem;\n resize: none;\n width: 100%;\n }\n .livelike-chat-input:focus {\n outline: none;\n border: 1px solid rgba(255, 255, 255, 0.2);\n }\n .livelike-chat-input::placeholder {\n color: rgba(0, 0, 0, 0.35);\n }\n .send-button {\n background: none;\n border: none;\n padding: 0;\n margin-left: 1rem;\n display: flex;\n align-items: center;\n transition: all 0.3s ease-out;\n }\n .send-icon {\n border: none;\n background: none;\n }\n .send-icon svg {\n fill: #777;\n }\n .send-icon:hover svg, .send-icon:focus svg {\n filter: invert(1);\n transition: all 0.3s ease-out;\n }\n .send-icon:hover {\n cursor: pointer;\n }\n .sticker-picker-container {\n position: absolute;\n border: none;\n background: none;\n right: 2rem;\n bottom: 0.5rem;\n transition: all 0.3s ease-out;\n }\n",Nn=D`<style>.sticker-nav-container{position:relative;background:#282828;height:40px;width:100%;border-radius:0 0 8px 8px;overflow:scroll;min-width:15rem}.sticker-nav-wrap{display:flex;list-style-type:none;padding:0;margin:0}.sticker-nav-item{border:none;background:rgba(255,255,255,0);transition:all .2s;padding:10px}.sticker-nav-item.active{background:#141414;border-radius:0 0 8px 8px}.sticker-nav-item:hover{cursor:pointer}.sticker-nav-item img{width:20px;height:20px;vertical-align:middle;border:0}</style>`,Un=D`<style>@keyframes slideIn{from{opacity:0;transform:translate3d(0,-1rem,0)}to{opacity:1;transform:translate3d(0,-.5rem,0)}}.sticker-icon{border:none;background:0 0;padding:1px 6px}.sticker-icon:hover{cursor:pointer}.sticker-icon svg{fill:#888}.sticker-container{position:absolute;bottom:4rem;opacity:0;transition:all ease .3s;z-index:21;right:0;max-width:20rem}.sticker-container.show{opacity:1;transition:all ease .3s}.sticker-container.hide{opacity:0;transition:all ease .3s}.sticker-container-header{position:relative;border-radius:.5rem .5rem 0 0;background:#141414;padding:.625rem 1rem;color:#fff;font-size:1rem;font-weight:700}.sticker-close-icon{border:none;background:0 0;position:relative;float:right;top:-1px;right:0;background-size:contain;width:1.25rem;height:1.25rem;cursor:pointer}.sticker-body{position:relative;background:#141414;padding:.625rem .3rem;display:flex;justify-content:flex-start;flex-wrap:wrap;overflow-y:auto;min-height:8rem;max-height:8rem}.sticker-wrap{border:none;color:#fff;padding-left:0 .625rem;width:3.75rem;background:0 0;border-radius:.75rem;transition:all ease .3s;margin:0 auto .625rem auto}.sticker-wrap:focus,.sticker-wrap:hover{outline:0;background:#818592;cursor:pointer}.sticker-image{width:100%;vertical-align:middle}</style>`;var In=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Dn=class extends kn{constructor(){super(...arguments),this.drawerOpen=!1,this.animation=0,this.keyedLocalize=(e,t)=>this.owner.localize(this.localizationKey+e,t),this.closeDrawer=()=>{at(this,"drawer-closed"),mn(this,"drawerOpen")},this.stickerBody=()=>this.stickers&&this.stickers.map((e=>D`<button tabindex="0" type="button" class="sticker-wrap" aria-label="${this.keyedLocalize(".stickerSelectionButton.ariaLabel",{stickerName:e.shortcode||e.title})}" @click="${()=>{at(this,"sticker-selected",{sticker:e}),this.closeDrawer()}}"><div class="sticker-wrap-image"><img class="sticker-image" src="${e.file||e.images.preview_gif.url}" alt="${e.shortcode||e.title}"></div></button>`)),this.renderStickerDrawer=()=>{const e=this.title||this.keyedLocalize(".title");return D`<div class="sticker-container" style="opacity:${this.animation}" aria-label="${e}"><header class="sticker-container-header"><span class="title">${e}</span> <button tabindex="0" type="button" class="sticker-close-icon" aria-label="${this.keyedLocalize(".closeButton.ariaLabel")}" @click="${this.closeDrawer}">${ln}</button></header><div class="sticker-body">${this.stickerBody()}</div>${this.navFooterTemplate?this.navFooterTemplate():null}</div>`}}createRenderRoot(){return this}render(){return D`${Un} <button tabindex="0" type="button" class="sticker-icon" aria-label="${this.keyedLocalize(".openButton.ariaLabel")}" @click="${()=>{yn(this,this.owner.dataId,"drawerOpen"),setTimeout((()=>{at(this,"drawer-opened")}),50)}}">${this.buttonIcon}</button> ${this.drawerOpen?this.renderStickerDrawer():null}`}};In([X({type:Array})],Dn.prototype,"stickers",void 0),In([X({type:String})],Dn.prototype,"buttonIcon",void 0),In([X({type:Function})],Dn.prototype,"onStickerClick",void 0),In([X({type:String,reflect:!0})],Dn.prototype,"title",void 0),In([X({type:Boolean})],Dn.prototype,"drawerOpen",void 0),In([X({type:String})],Dn.prototype,"animation",void 0),In([X({type:String})],Dn.prototype,"localizationKey",void 0),Dn=In([qt("livelike-stickers")],Dn);var $n=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Bn=class extends kn{constructor(){super(...arguments),this.selectedPack="",this.changePack=e=>{this.selectedPack=e&&e.id,this.selectedStickers=e&&e.stickers},this.stickerNav=()=>this.owner.stickerPacks&&this.owner.stickerPacks.map((e=>{const t=e.id===this.selectedPack?"active":"";return D`<button tabindex="0" type="button" aria-label="${this.owner.localize("chat.stickerPicker.stickerPackTab.ariaLabel",{packName:e.name})}" class="sticker-nav-item ${t}" @click="${()=>this.changePack(e)}"><img src="${e.file}" alt="${e.name}"></button>`})),this.stickerNavFooter=()=>D`<nav slot="sticker-drawer-footer" class="sticker-nav-container"><div class="sticker-nav-wrap">${this.stickerNav()}</div></nav>`}createRenderRoot(){return this}ownerUpdated(e){!this.selectedStickers&&"stickerPacks"===e.name&&this.owner.stickerPacks&&this.owner.stickerPacks[0]&&this.changePack(this.owner.stickerPacks[0])}render(){return D`${Nn} ${this.owner.stickerPacks&&this.owner.stickerPacks.length?D`<livelike-stickers .localizationKey="${"chat.stickerPicker"}" .stickers="${this.selectedStickers}" .buttonIcon="${an}" @drawer-opened="${()=>{}}" .navFooterTemplate="${this.stickerNavFooter}"></livelike-stickers>`:null}`}};$n([X({type:String})],Bn.prototype,"selectedPack",void 0),$n([X({type:Array})],Bn.prototype,"selectedStickers",void 0),Bn=$n([qt("livelike-sticker-picker")],Bn);var Fn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Kn=class extends kn{constructor(){super(...arguments),this.message="",this.giphyList=[],this.offset=0,this.isDoneFetching=!0,this.loading=!1,this.scrollListenerAdded=!1,this.fetchNextPageIfBottom=ze((()=>{const e=this.querySelector(".sticker-body");!(e&&e.scrollHeight-e.scrollTop===e.clientHeight)||this.isDoneFetching||this.loading||this.fetchGifs()})),this.fetchGifs=()=>{this.loading=!0,fetch(`https://api.giphy.com/v1/gifs/search?q=${this.message}&api_key=jlvX8uZILp5PhutmuW6fdATBP3E5uayi&offset=${this.offset}&rating=g`).then((e=>e.json())).then((e=>{this.loading=!1,this.giphyList=[...this.giphyList,...e.data],this.offset=e.pagination?e.pagination.count+e.pagination.offset:0,this.isDoneFetching=!e.pagination||this.offset===e.pagination.total_count}))},this.onStickerClick=e=>tn({image_url:e.detail.sticker.images.downsized.url,image_width:e.detail.sticker.images.downsized.width,image_height:e.detail.sticker.images.downsized.height,roomId:this.owner.roomid,sender_image_url:this.owner.avatarurl,timestamp:this.owner.syncStrategy&&this.owner.syncStrategy.currentTimecode?this.owner.syncStrategy.currentTimecode:null}),this.debouncedInputEvent=ze((()=>{this.offset=0,this.giphyList=[],this.fetchGifs()})),this.handleMessage=e=>{this.message=e.target.value,this.debouncedInputEvent()},this.handleOpen=e=>{const t=e.target.querySelector(".sticker-body");t&&t.addEventListener("scroll",this.fetchNextPageIfBottom)},this.handleClose=e=>{this.message="",this.giphyList=[],this.offset=0;const t=e.target.querySelector(".sticker-body");t&&t.removeEventListener("scroll",this.fetchNextPageIfBottom)},this.stickerNavFooter=()=>D`<nav slot="sticker-drawer-footer" class="sticker-nav-container"><div class="sticker-nav-wrap"><input type="text" maxlength="25" style="height:25px" class="livelike-chat-input livelike-giphy-input" placeholder="${this.owner.localize("chat.giphyPicker.placeholder")}" @input="${this.handleMessage}" .value="${this.message}"></div></nav>`}createRenderRoot(){return this}render(){return D`${Nn}<livelike-stickers .localizationKey="${"chat.giphyPicker"}" .stickers="${this.giphyList}" .buttonIcon="${dn}" @sticker-selected="${this.onStickerClick}" @drawer-opened="${this.handleOpen}" @drawer-closed="${this.handleClose}" .navFooterTemplate="${this.stickerNavFooter}"></livelike-stickers>`}};Fn([X({type:String})],Kn.prototype,"message",void 0),Fn([X({type:Array})],Kn.prototype,"giphyList",void 0),Fn([X({type:Number})],Kn.prototype,"offset",void 0),Fn([X({type:Boolean})],Kn.prototype,"isDoneFetching",void 0),Fn([X({type:Boolean})],Kn.prototype,"loading",void 0),Fn([X({type:Boolean})],Kn.prototype,"scrollListenerAdded",void 0),Kn=Fn([qt("livelike-giphy-picker")],Kn);var qn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let zn=class extends kn{constructor(){super(...arguments),this.defaultStyles=Ln,this.message="",this.ownerUpdated=e=>{"placeholder"===e.name&&(this.placeholder=e.prop),("lang"===e.name||"translations"===e.name)&&this.updateLocalizedPlaceholder()},this.updateLocalizedPlaceholder=()=>{if(!this.placeholder){const e=this.owner.localize("chat.inputPlaceholder");this.inputEl.placeholder=e,this.inputEl.setAttribute("aria-label",e)}this.sendBtn.setAttribute("aria-label",this.owner.localize("chat.sendButton.ariaLabel"))},this.sendClickHandler=()=>{this.message&&(at(this,"sendChatMessage",{message:this.message}),this.message="",this.inputEl.value="",this.resize("40px"))},this.addSticker=e=>{e.detail.sticker&&e.detail.sticker.shortcode&&this.message.length+e.detail.sticker.shortcode.length<=200&&(this.message=this.message+`:${e.detail.sticker.shortcode}:`,this.inputEl.value=this.message,this.inputEl.focus())},this.handleMessage=e=>{void 0!==e.target.value&&(this.message=e.target.value),this.resize(""===e.target.value?"40px":null)},this.handleKeyDown=e=>{13!==e.which||e.shiftKey||(e.preventDefault(),this.sendClickHandler())},this.resize=e=>{this.inputEl.style.height=e||`${this.inputEl.scrollHeight}px`}}get inputEl(){return this.querySelector("[slot=body]")}get sendBtn(){return this.querySelector("[slot=send]")}updated(e){e.forEach(((e,t)=>{"placeholder"===t&&(this.inputEl.placeholder=this.placeholder,this.inputEl.setAttribute("aria-label",this.placeholder))}))}connectedCallback(){super.connectedCallback(),this.addEventListener("sticker-selected",this.addSticker);const e=this.placeholder||this.owner.placeholder||this.owner.localize("chat.inputPlaceholder");this.insertAdjacentHTML("beforeend",`<textarea slot="body" class="livelike-chat-input" maxlength="200" placeholder="${e}" aria-label="${e}"></textarea>`),this.insertAdjacentHTML("beforeend",'<div slot="body" class="sticker-picker-container">\n <livelike-sticker-picker></livelike-sticker-picker>\n <livelike-giphy-picker></livelike-giphy-picker>\n </div>'),this.insertAdjacentHTML("beforeend",`<button slot="send" aria-label="${this.owner.localize("chat.sendButton.ariaLabel")}" class="send-icon">\n \n <svg width="16" height="16" viewBox="0 0 16 16">\n <path fill-rule="nonzero" d="M.579.29l14.705 7.352a.4.4 0 0 1 0 .716L.58 15.71A.4.4 0 0 1 0 15.353V10.47a1 1 0 0 1 .863-.99L8.71 8.396a.4.4 0 0 0 0-.792L.863 6.519A1 1 0 0 1 0 5.53V.647A.4.4 0 0 1 .579.29z"/>\n </svg>\n </button>`)}disconnectedCallback(){this.removeEventListener("sticker-selected",this.addSticker),super.disconnectedCallback()}render(){return D`<slot name="body" @input="${this.handleMessage}" @keydown="${this.handleKeyDown}"></slot><slot @click="${this.sendClickHandler}" name="send"></slot><slot></slot>`}};qn([X({type:String,reflect:!0})],zn.prototype,"placeholder",void 0),qn([X({type:String})],zn.prototype,"message",void 0),zn=qn([qt("livelike-chat-composer")],zn);const Hn=()=>"\n <style>\n @keyframes slideDown {\n from {\n opacity: 0;\n transform: translate3d(0, -3rem, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0rem, 0);\n }\n }\n\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translate3d(0, 0rem, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, -2rem, 0);\n }\n }\n\n .down-icon {\n z-index: 15;\n position: absolute;\n border: none;\n right: 3.75rem;\n bottom: 5.5rem;\n padding: 0;\n border-radius: 50%;\n height: auto;\n width: auto;\n display: none;\n flex-direction: column;\n animation: slideDown 0.5s ease forwards;\n transition: all 0.3s ease;\n }\n .down-icon.show {\n display: flex;\n animation: slideUp 0.5s ease forwards;\n }\n .down-icon:hover {\n cursor: pointer;\n transition: all 0.3s ease;\n }\n .down-icon svg > rect {\n fill: #b0b0b0;\n }\n .down-icon svg > path {\n fill: #fff;\n }\n </style>\n";var Vn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Gn=class extends kn{constructor(){super(...arguments),this.defaultStyles=Hn,this.userScrolled=!1,this.ownerUpdated=e=>{("translations"===e.name||"lang"===e.name)&&this.updateLocalizedStrings()},this.setScrolled=e=>{if(e.key===this.owner.dataId){const t=this.querySelector(".down-icon"),n=e.scrolled?"down-icon show":"down-icon";t&&t.setAttribute("class",n)}},this.scrollDown=()=>st.emit("scrollDown",{key:this.owner.dataId}),this.updateLocalizedStrings=()=>{this.querySelector("button.down-icon").setAttribute("aria-label",this.owner.localize("chat.scrollDownButton.ariaLabel"))}}connectedCallback(){super.connectedCallback(),st.on("userScrolled",this.setScrolled),this.addEventListener("click",this.scrollDown),this.insertAdjacentHTML("beforeend",`<button tabindex="0" aria-label="${this.owner.localize("chat.scrollDownButton.ariaLabel")}" class="down-icon">\n <svg width="25px" height="25px" viewBox="0 0 30 30">\n <rect id="snap-to-live-button" fill="#FFFFFF" x="0" y="0" width="30" height="30" rx="15"></rect>\n <path d="M15.0326453,21 C14.7426596,21 14.4527097,20.8852999 14.2316216,20.6563819 L7.2744003,13.4491933 C6.83183015,12.9907267 6.83183015,12.2787537 7.97485699,11.4850649 C9.11788383,10.6913761 9.53369152,11.0267838 9.97629747,11.4850649 L15.0326453,16.7405562 L20.0890468,11.4850649 C20.5316169,11.0267838 21.1431577,10.6735312 22.0549346,11.4850649 C22.9667115,12.2965986 23.2335678,12.9909492 22.7907828,13.4494158 L15.8336689,20.6566045 C15.6124734,20.8855596 15.3225235,21 15.0326453,21 Z" id="ic_arrowDown" fill="#23282D"></path>\n </svg></button>`)}render(){return D`<slot></slot>`}};Vn([X({type:Boolean})],Gn.prototype,"userScrolled",void 0),Gn=Vn([qt("livelike-scroll-down")],Gn);var Wn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Yn=class extends oe{constructor(){super(...arguments),this.dataId=Oe(),this.deletedMessages=[],this.hidecomposer=!1,this.loaded=!1,this.timestamps=!1,this.messagemenus=!1,this.blockList=ce.blockList||[],this.messageList=["Loading"],this.timeformat={month:"short",day:"numeric",hour:"numeric",minute:"numeric"},this.messageUrlPatterns=[/((https?):\/\/|www\.)?([-A-Z0-9._\+~#=]*)\.[a-z]{2,}\b([-A-Z0-9@%_\+.~#?&://=]*)/gi],this.translations=se.localizedStrings,this.updateLocalization=e=>this.translations=e.localizedStrings,this.sendChatMessage=e=>{const t=t=>at(this,t,{message:e.detail.message,roomId:this.roomid});e.detail.message&&e.detail.message.match(/([^\n]+\n)*[^\n]+/g)&&tn({message:e.detail.message,roomId:this.roomid,sender_image_url:this.avatarurl,timestamp:this.syncStrategy&&this.syncStrategy.currentTimecode?this.syncStrategy.currentTimecode:null}).then((()=>t("messagesent"))).catch((()=>{this.displayModal("muted"),t("messagefailed")}))},this.connectChat=()=>{se.ready&&ce&&ce.id?(this.loaded=!1,this.syncStrategy?this.queue=Zt(this.syncStrategy):this.syncStrategy=wt(se.syncStrategy),tt(this.roomid).then((e=>{var t;this.channel=e.channels.chat.pubnub,zt.subscribe(this.channel),(t=this.roomid,mt(t,"reactionPack","reaction_packs_url")).then((e=>this.reactionPack=e[0]&&e[0].emojis?e[0].emojis:e)),(e=>mt(e,"stickerPacks","sticker_packs_url"))(this.roomid).then((e=>this.stickerPacks=e)),this.loaded=!0,at(this,"roomentered",{room:this,roomId:this.roomid}),this.getMessages()}))):setTimeout(this.connectChat,1e3)},this.demultiplex=e=>{const t=Ne[e.event];"messagereceived"===t&&this.messageReceived(e,this.updateEl),("reactionremoved"===t||"reactionadded"===t)&&this.updateReaction(e.message,t),"messagedeleted"===t&&this.messageDeleted(e),at(this,t,{message:e.message,roomId:this.roomid})},this.getMessages=()=>{const e=this.querySelector("livelike-message-list");return e&&e.remove(),Qt(this.roomid).then((e=>{this.messageList=["No Messages"],this.appendElements((()=>{e.messages&&e.messages.length>0&&_t(this,(()=>{e.messages.forEach((e=>this.messageReceived({message:e}))),this.updateEl()}))})),at(this,"messagehistory",{messages:e.messages})}))},this.updateReaction=(e,t)=>{if(this.messageList){const n=[...this.messageList],{messageTimetoken:i,actionTimetoken:r,uuid:o,value:s}=e,a=n.findIndex((e=>e.timetoken===i));if(-1!==a){let e=n[a].reactions[s];const i=e=>e.uuid===ce.id,c=e=>e.actionTimetoken===r,l=e=>n[a].reactions[s].findIndex(e),u=()=>o===ce.id?l(i):l(c);if("reactionadded"===t){!e&&(n[a].reactions[s]=[]);let t=u();-1===t||o!==ce.id?n[a].reactions[s].push({uuid:o,actionTimetoken:r}):n[a].reactions[s][t].actionTimetoken=r}if("reactionremoved"===t){let e=u();-1!==e&&n[a].reactions[s].splice(e,1)}this.messageList=n}}},this.handleMessageReaction=(e,t,n)=>new Promise(((i,r)=>{const o=e=>r(console.error(e)),s={"Chat Room ID":this.roomid,"Chat Message ID":e,"Chat Reaction ID":t},a=e=>Ae[n](this.channel,c.timetoken,e,s,i,o),c=this.messageList.find((t=>t.id===e));if(!c&&o("Could not find message for reaction action."),"remove"===n){const e="Reaction not deleted. Reaction not found.";!c.reactions[t]&&o(e);let n=c.reactions[t].find((e=>e.uuid===ce.id));n?a(n.actionTimetoken):o(e)}else this.reactionPack.find((e=>e.id===t))?a({type:"rc",value:t}):o("Reaction not added. Reaction not found")})),this.addMessageReaction=({messageId:e,reactionId:t})=>this.handleMessageReaction(e,t,"add"),this.removeMessageReaction=({messageId:e,reactionId:t})=>this.handleMessageReaction(e,t,"remove"),this.messageReceived=(e,t)=>{-1===Array.from(this.querySelectorAll("livelike-message-item")).findIndex((t=>t.id===e.message.id))&&We(this.roomid,e.message)&&this.queue&&this.queue.enqueueItem({payload:e.message},t)},this.messageDeleted=e=>{const t=this.messageList.findIndex((t=>String(e.message.id)===String(t.id)));-1!==t&&(this.deletedMessages=$e(this.deletedMessages,this.messageList[t]),at(this,Ne[e.event],{message:e.message,roomId:this.roomid}))},this.updateEl=()=>{kt(this,(()=>!0),(e=>{let t=e.payload;t&&!t.reactions&&(t.reactions={}),this.messageList&&"string"==typeof this.messageList[0]?this.messageList=[t]:this.messageList=$e(this.messageList,t),at(this,"message-ready",{message:t,element:this})}))},this.registerMessageMenu=e=>{let t=!1;if(e({}).map((e=>e.items&&e.items.map((e=>e.items&&(t=!0))))),t)return pt("Message menu currently supports submenus only one level deep.");this.messageMenuFunc=e},this.appendElements=e=>{this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("slot[name=message-list]");!(t&&t.assignedNodes({flatten:!0}).filter((e=>1===e.nodeType)).length>0)&&this.insertAdjacentHTML("afterbegin",'<livelike-message-list slot="message-list">\n </livelike-message-list>'),this.insertAdjacentHTML("beforeend",'<livelike-scroll-down slot="snap-to-live"></livelike-scroll-down>'),e&&e()}))},this.localize=(e,t)=>vt(e,this.lang,t),this.reportUser=e=>this.sendReport(e).then((e=>this.displayModal("report",e))),this.sendReport=e=>Me.post({url:se.chatRooms[this.roomid].report_message_url,data:{channel:this.channel,user_id:e.sender_id,nickname:e.sender_nickname,message_id:e.id,message:e.image_url?e.image_url:e.message,profile_id:e.sender_id,pubnub_timetoken:e.timetoken}}),this.blockUser=e=>{if(!this.blockList.find((t=>t===e.sender_id))){const t=this.blockList.slice();t.push(e.sender_id),this.blockList=t,((e,t)=>{let n=se.storageStrategy.get()||{};n[e]=t,se.storageStrategy.set(n)})("blockList",this.blockList),this.sendReport(e).then((e=>this.displayModal("block",e)))}},this.displayModal=(e,t)=>{const n=document.createElement("livelike-modal");n.type=e,n.data=t;this.querySelector("livelike-message-list").append(n),setTimeout((()=>n.remove()),4e3)},this.defaultMessageMenuFunc=e=>{if(e.sender_id!==ce.id){const t=[{label:this.localize("chat.messageMenu.reportMessage"),type:"single",onClick:()=>this.reportUser(e)},{label:this.localize("chat.messageMenu.cancel"),type:"single",onClick:()=>{}}];return-1===this.blockList.findIndex((t=>t===e.sender_id))&&t.unshift({label:this.localize("chat.messageMenu.blockUser"),type:"single",onClick:()=>this.blockUser(e)}),t}}}connectedCallback(){st.on("localizationUpdate",this.updateLocalization),this.addEventListener("sendChatMessage",this.sendChatMessage),this.addEventListener("chat-provider",(e=>{e.detail.provider=this,e.stopPropagation()})),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("sendChatMessage",this.sendChatMessage),zt.removeListener(this.channel,this.demultiplex),st.off("localizationUpdate",this.updateLocalization)}firstUpdated(){this.messageMenuFunc=this.defaultMessageMenuFunc,ft(this),Ve(this),this.style+="display:flex; display: -webkit-box; display: -webkit-flex;display: -ms-flexbox;"}updated(e){e.forEach(((e,t)=>{if("hidecomposer"===t){const e=this.querySelector("livelike-chat-composer"),t=this.shadowRoot.querySelector("slot[name=composer]"),n=t&&t.assignedNodes().length>0;this.hidecomposer?e&&e.remove():!n&&this.insertAdjacentHTML("beforeend",'<livelike-chat-composer slot="composer"></livelike-chat-composer>')}"syncStrategy"===t&&this.syncStrategy&&(this.queue=Zt(this.syncStrategy)),"channel"===t&&this.channel&&(e&&(zt.removeListener(e,this.demultiplex),zt.unsubscribe(e)),zt.addListener(this.channel,this.demultiplex));"roomid"===t&&this.roomid&&(null!=e&&at(this,"roomexited",{roomId:this.roomid}),this.connectChat()),void 0!==this[t]&&null!==this[t]&&st.emit("chat-updated",{name:t,key:this.dataId,prop:this[t],owner:this})}))}render(){return D`<style>:host{display:flex;flex-direction:column;height:100%}</style>${this.loaded&&ce&&ce.id&&this.dataId&&this.roomid?D`${this.messageList&&this.messageList[0]&&"No Messages"===this.messageList[0]?D`<slot name="message-list-empty"></slot>`:null}<slot name="message-list">${this.messageList&&this.messageList[0]&&"Loading"===this.messageList[0]?D`<slot name="message-list-loading"></slot>`:null}</slot><slot name="composer"></slot><slot name="snap-to-live"></slot>`:D`<slot name="chat-element-loading"></slot>`}`}};Wn([X({type:Array})],Yn.prototype,"deletedMessages",void 0),Wn([X({type:String})],Yn.prototype,"channel",void 0),Wn([X({type:String,reflect:!0})],Yn.prototype,"roomid",void 0),Wn([X({type:String,reflect:!0})],Yn.prototype,"lang",void 0),Wn([X({type:String})],Yn.prototype,"placeholder",void 0),Wn([X({type:Boolean})],Yn.prototype,"hidecomposer",void 0),Wn([X({type:Boolean})],Yn.prototype,"loaded",void 0),Wn([X({type:Boolean})],Yn.prototype,"timestamps",void 0),Wn([X({type:Boolean})],Yn.prototype,"messagemenus",void 0),Wn([X({type:Function})],Yn.prototype,"messageMenuFunc",void 0),Wn([X({type:Array})],Yn.prototype,"blockList",void 0),Wn([X({type:Array})],Yn.prototype,"messageList",void 0),Wn([X({type:Object})],Yn.prototype,"syncStrategy",void 0),Wn([X({type:Object})],Yn.prototype,"queue",void 0),Wn([X({type:Array})],Yn.prototype,"stickerPacks",void 0),Wn([X({type:Array})],Yn.prototype,"reactionPack",void 0),Wn([X({type:Object})],Yn.prototype,"timeformat",void 0),Wn([X({type:String})],Yn.prototype,"avatarurl",void 0),Wn([X({type:Boolean})],Yn.prototype,"showavatar",void 0),Wn([X({type:Function})],Yn.prototype,"customMessageRenderer",void 0),Wn([X({type:Boolean})],Yn.prototype,"messageurls",void 0),Wn([X({type:Array})],Yn.prototype,"messageUrlPatterns",void 0),Wn([X({type:Object,hasChanged:()=>!0})],Yn.prototype,"translations",void 0),Yn=Wn([qt("livelike-chat")],Yn);var Jn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Xn=class extends oe{constructor(){super(...arguments),this.owner=document.querySelector(this.getAttribute("for"))||this.parentElement,this.loaded=!0,this.loadPage=()=>{this.loaded&&(this.loaded=!1,this.buttonEl.innerHTML='<div class="loading-spinner"></div>',this.owner.loadNextPage().then((e=>{this.loaded=!0,e&&this.buttonEl.remove(),this.buttonEl&&(this.buttonEl.innerHTML="Load More")})))}}connectedCallback(){super.connectedCallback();const e=document.createElement("style");e.innerHTML="\n livelike-load-more-button button{\n display: flex;\n justify-content: center;\n width:100%;\n height: auto;\n border: none;\n border-radius: 0.25rem;\n background: #086fac;\n font-size: 1rem;\n color: #fff;\n padding: 0.75rem;\n margin:1rem 0 0 0;\n }\n\n livelike-load-more-button button:hover {\n cursor: pointer;\n }\n\n livelike-load-more-button .loading-spinner {\n position: relative;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 4px solid rgba(255, 255, 255, 0.1);\n border-top: 4px solid #fff;\n animation: rotating 1.2s infinite cubic-bezier(0.785, 0.135, 0.15, 0.86);\n }\n\n @keyframes rotating {\n 100% {\n transform: rotate(360deg);\n }\n }\n",this.appendChild(e);const t=document.createElement("button");t.addEventListener("click",this.loadPage),t.setAttribute("class","livelike-load-more-button"),t.setAttribute("aria-label","Load more widgets"),t.innerHTML="Load More",this.buttonEl=t,this.appendChild(t)}render(){return D`<slot></slot>`}};Jn([X({type:Boolean})],Xn.prototype,"loaded",void 0),Xn=Jn([qt("livelike-load-more-button")],Xn);var Zn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Qn=class extends oe{constructor(){super(...arguments),this.dataId=Oe(),this.updating=!1,this.hasWidgetAttached=!1,this.sequence=1,this.mode="pop-up",this.loaded=!1,this.authors=!1,this.timestamps=!1,this.reactions=!1,this.timeformat={month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric"},this.hide_dismiss_button=!1,this.widgetListener=e=>{ye.some((t=>e.event===t))&&yt(e.message.timetoken,this.sequence,this.programid).then((t=>{if(this.sequence=t.sequence,t.allowNext){let t=this.onWidgetReceived(e.message);t&&this.enqueueWidget({mode:this.mode,widgetPayload:t})}}))},this.connectWidget=()=>{if(se.ready)return this.loaded=!1,this.syncStrategy?this.queue=Zt(this.syncStrategy):this.syncStrategy=wt(se.syncStrategy),nt(this.programid).then((e=>{this.channel=e.subscribe_channel,zt.subscribe(this.channel),this.mode.includes("timeline")?this.loadTimeline(this.programid):this.loaded=!0}));setTimeout(this.connectWidget,1e3)},this.onInitialWidgetsLoaded=({widgets:e})=>e,this.loadTimeline=e=>Dt({programId:e}).then((e=>{this.widgetPaginator=e,this.widgetPaginator.next().then((e=>{_t(this,(()=>{let t=this.onInitialWidgetsLoaded({widgets:e.value.widgets});Ft({interactionUrl:e.value.widget_interactions_url_template}).then((e=>xt({widgets:t,interactions:e}).map((({widgetPayload:e,interactions:t})=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0,interactions:t})})))).catch((e=>{t.map((e=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0})}))}))})),this.loaded=!0,!e.done&&this.insertAdjacentHTML("beforeend",'<livelike-load-more-button slot="load-more-button"></livelike-load-more-button>')}))})),this.onMoreWidgetsLoaded=({widgets:e})=>e,this.loadNextPage=()=>this.widgetPaginator.next().then((e=>{let t=this.onMoreWidgetsLoaded({widgets:e.value.widgets});return Ft({interactionUrl:e.value.widget_interactions_url_template}).then((e=>xt({widgets:t,interactions:e}).map((({widgetPayload:e,interactions:t})=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0,interactions:t})})))).catch((e=>{t.map((e=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0})}))})),e.done})),this.updateEl=()=>{kt(this,(()=>"pop-up"!==this.mode||!this.hasWidgetAttached),(e=>{e.payload&&!this.querySelector(`[widgetid="${e.payload.id}"]`)&&(this.hasWidgetAttached=!0,this.showWidget({mode:e.mode,widgetPayload:e.payload,initialLoad:e.initialLoad,interactions:e.interactions}))}))},this.registerWidgetMode=(e,t)=>Bt(e,t),this.showWidget=e=>this.start(e),this.enqueueWidget=e=>this.queue.enqueueItem({payload:e.widgetPayload,mode:e.mode,initialLoad:e.initialLoad,interactions:e.interactions},this.updateEl),this.createWidgetElement=e=>$t({id:e.id,kind:e.kind}).then((t=>this.showWidget({widgetPayload:t,mode:e.mode,interactions:e.interactions}))),this.createSyncWidget=e=>$t({id:e.id,kind:e.kind}).then((t=>this.enqueueWidget({widgetPayload:t,mode:e.mode,interactions:e.interactions}))),this.overRideTimer=({widget:e})=>null,this.start=e=>{at(this,"beforewidgetattached",{widget:e.widgetPayload});const t=Ut(e.mode||this.mode);return this.createWidget(e).then((e=>e&&t({target:this,widget:e,timer:this.overRideTimer({widget:e})})))},this.attach=(e,t)=>{const n="append"===t?"beforeend":"afterbegin";if(this.insertAdjacentElement(n,e),at(this,"widgetattached",{element:e,widget:e.widgetPayload}),e.widgetPayload){const t={"Widget Type":Ie(e.widgetPayload.kind),"Widget ID":e.widgetPayload.id};e.widgetPayload.kind!==fe&&e.widgetPayload.kind!==ve||(t["Link URL"]=e.widgetPayload.link_url),Pe("Widget Displayed",t,this.programid)}return Promise.resolve()},this.detach=e=>{const t={element:e,widget:e.widgetPayload};return e&&this.contains(e)&&(at(this,"beforewidgetdetached",t),e.remove(),at(this,"widgetdetached",t),this.hasWidgetAttached=!1),Promise.resolve()},this.createWidget=e=>{const{widgetPayload:t,mode:n,initialLoad:i,interactions:r}=e,o=this.customWidgetRenderer&&"function"==typeof this.customWidgetRenderer&&this.customWidgetRenderer({widgetPayload:t});let s=o instanceof Element||o instanceof Node?o:document.createElement("livelike-"+t.kind);for(let e in t)"id"!==e&&(s[e]=t[e]);return s.widgetId=t.id,s.setAttribute("widgetid",t.id),s.widgetPayload=t,s.interactions=r,r&&(s.interaction=r[0]),s.reactions=this.reactions,s.dataId=this.dataId,s.programid=this.programid,s.authors=this.authors,s.timestamps=this.timestamps,s.timeformat=this.timeformat,s.lang=this.lang,s.customTemplate=this.customTemplateRenderer?"function"==typeof this.customTemplateRenderer?this.customTemplateRenderer:dt(this.localName,"customTemplateRenderer","Function"):null,s.theme=ae.theme,s.hide_dismiss_button=this.hide_dismiss_button,e.initialLoad&&(s.initialLoad=e.initialLoad),Promise.resolve(s)},this.getUnclaimedRewards=()=>{return(e={programId:this.programid},nt(e.programId).then((e=>rt(Je(ce.id,e.unclaimed_widget_interactions_url_template),(e=>Me.get({url:e})),(e=>({count:e.count,results:e.results}))))).catch((e=>Promise.reject(e)))).then((e=>ot(["results"],e)));var e}}firstUpdated(){ft(this),Ve(this),Bt("pop-up",Fe),Bt("timeline",Ke),Bt("interactive-timeline",qe)}onWidgetReceived(e){return e}disconnectedCallback(){super.disconnectedCallback(),zt.removeListener(this.channel,this.widgetListener)}updated(e){e.forEach(((e,t)=>{"syncStrategy"===t&&this.syncStrategy&&(this.queue=Zt(this.syncStrategy));("hasWidgetAttached"===t||"loaded"===t)&&(e=>{void 0!==this[e]&&at(this,e,{[e]:!0})})(t),"channel"===t&&this.channel&&(e&&(zt.removeListener(e,this.widgetListener),zt.unsubscribe(e)),zt.addListener(this.channel,this.widgetListener));const n="programid"===t&&this.programid&&this.programid!==e,i="mode"===t&&void 0!==e&&this.mode!==e;if(this.programid){if(n&&void 0!==e||i){for(;this.firstChild;)this.removeChild(this.firstChild);!this.firstChild&&(this.hasWidgetAttached=!1)}this.mode?(n||i)&&this.connectWidget():this.mode="pop-up"}}))}render(){return D`<style>:host{display:block}livelike-widgets{display:block}</style>${this.loaded?D`<slot></slot><slot name="load-more-button"></slot>`:D`<slot name="widgets-loading"></slot>`}`}};Zn([X({type:Object})],Qn.prototype,"widgetPaginator",void 0),Zn([X({type:String})],Qn.prototype,"channel",void 0),Zn([X({type:String,reflect:!0})],Qn.prototype,"programid",void 0),Zn([X({type:String,reflect:!0})],Qn.prototype,"lang",void 0),Zn([X({type:String})],Qn.prototype,"mode",void 0),Zn([X({type:Boolean})],Qn.prototype,"loaded",void 0),Zn([X({type:Boolean})],Qn.prototype,"authors",void 0),Zn([X({type:Boolean})],Qn.prototype,"timestamps",void 0),Zn([X({type:Boolean})],Qn.prototype,"reactions",void 0),Zn([X({type:Function})],Qn.prototype,"customWidgetRenderer",void 0),Zn([X({type:Function})],Qn.prototype,"customTemplateRenderer",void 0),Zn([X({type:Object})],Qn.prototype,"queue",void 0),Zn([X({type:Object})],Qn.prototype,"syncStrategy",void 0),Zn([X({type:Object})],Qn.prototype,"timeformat",void 0),Zn([X({type:Boolean})],Qn.prototype,"hide_dismiss_button",void 0),Qn=Zn([qt("livelike-widgets")],Qn);const ei="hlsLevelSwitched",ti="hlsFragChanged";class ni{get currentTimecode(){return this.programDateTime}get programDateTime(){return null}}const ii={direction:0,format:"uniformGradient"},ri={background:Object.assign(Object.assign({},ii),{colors:["003264","0096c8"]})},oi={background:{format:"fill",color:"111111"}},si={correctOptionBar:{background:Object.assign(Object.assign({},ii),{colors:["81ca00","429321"]})},incorrectOptionBar:{background:Object.assign(Object.assign({},ii),{colors:["dc0028","d0021b"]})},correctOption:{borderWidth:2,borderColor:"81ca00"},incorrectOption:{borderWidth:2,borderColor:"dc0028"}},ai={widgets:{alert:{body:{},header:{background:Object.assign(Object.assign({},ii),{colors:["9f041b","f5515f"]})}},imageSlider:{header:Object.assign({},oi),body:{},interactiveTrackRight:{background:{format:"fill",color:"888"}},interactiveTrackLeft:{background:{format:"fill",color:"ff6a13"}},resultsTrackRight:{},resultsTrackLeft:{}},prediction:{header:Object.assign({},ri),selectedOption:{borderColor:"0096c8"},selectedOptionBar:{borderColor:"0096c8",background:Object.assign(Object.assign({},ii),{colors:["003264","0096c8"]})}},predictionFollowUp:Object.assign(Object.assign({},si),{header:Object.assign({},ri),selectedOption:{borderColor:"0096c8"},selectedOptionBar:{borderColor:"c96dd7",background:Object.assign(Object.assign({},ii),{colors:["003264","0096c8"]})}}),poll:{header:{background:Object.assign(Object.assign({},ii),{colors:["3123ae","c96dd7"]})},selectedOption:{borderColor:"c86dd7"},selectedOptionBar:{borderColor:"c96dd7",background:Object.assign(Object.assign({},ii),{colors:["3123ae","c86dd7"]})}},quiz:Object.assign(Object.assign({},si),{header:{background:Object.assign(Object.assign({},ii),{colors:["f76b1c","ffb400"]})},selectedOption:{borderColor:"ffb400"},selectedOptionBar:{borderColor:"c96dd7",background:Object.assign(Object.assign({},ii),{colors:["f76b1c","ffb400"]})}}),socialEmbed:{header:Object.assign({},oi),body:{}},richText:{header:Object.assign({},oi),body:{}},cheerMeter:{header:Object.assign({},oi),body:{}},videoAlert:{body:{},header:{background:Object.assign(Object.assign({},ii),{colors:["9f041b","f5515f"]})}},textAsk:{header:{background:Object.assign(Object.assign({},ii),{colors:["9f041b","f5515f"]})},body:{}}},version:1};function ci(e){return parseInt(e.repeat(2/e.length),16)}const li=e=>/^([A-Fa-f0-9]{3,4}){1,2}$/.test(e);function ui(e){if(li(e)){const t=Math.floor(e.length/3),n=e.match(new RegExp(`.{${t}}`,"g")).map(ci),i=n[3]||0===n[3]?(n[3]/255).toFixed(2):1;return`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i})`}return e}function di(e){return Object.keys(e).forEach((t=>{const n=e[t]instanceof Array;if("fontFamily"===t)e[t]=n?e[t].join(" "):e[t];else if("object"!=typeof e[t]||n)if(n){const n=e[t].map((e=>e+"px"));e[t]=n.join(" ")}else-1!==t.toLowerCase().indexOf("color")?e[t]="rgb"===e[t].slice(0,3)?e[t]:ui(e[t]):"fontSize"!==t&&"borderWidth"!==t||String(e[t]).match(/px/gi)||(e[t]=`${e[t]}px`);else"background"===t?function(e,t){const n=e[t];"fill"===n.format?e[t]=li(n.color)?ui(n.color):n.color:"uniformGradient"===n.format&&(e[t]=`linear-gradient(90deg, ${ui(n.colors[0])}, ${ui(n.colors[1])})`)}(e,t):di(e[t])})),e}function hi(e){if(e){let t="";return Object.keys(e).forEach((n=>{let i=n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();"fontColor"===n&&(i="color"),t+=`${i}: ${e[n]};\n`})),t}return""}const pi=e=>new Promise((t=>{const n=di(De(ai,e));ae.theme=n,st.emit("themeUpdate",{theme:n}),function e(){n&&n.version?t():setTimeout(e,1e3)}()})),fi=e=>(se.localizedStrings=De(se.localizedStrings,e),st.emit("localizationUpdate",{localizedStrings:se.localizedStrings}),Promise.resolve(!0)),gi=(e,t,n)=>Me[e]({url:se.profileUrl,data:t,accessToken:n}),mi=e=>e.accessToken||e.profileId?e.accessToken?gi("get",null,e.accessToken).then((t=>(t.access_token=e.accessToken,t))):e.profileId&&Me.get({url:Je(e.profileId,se.profileDetailUrlTemplate)}):ht("accessToken or profileId","fetchUserProfile"),vi=e=>gi("post",e&&e.nickname&&e,null).then((e=>(Pe("Unique Profile Created",{"Profile ID":e.id}),e))),yi=e=>rt(e.badges_url,(e=>Me.get({url:e})),(e=>({count:e.count,results:e.results}))),bi=e=>({id:e.id,title:e.title,created_at:e.created_at,visibility:e.visibility,content_filter:e.content_filter}),wi=()=>Promise.resolve(!0),ki=e=>e.roomId?tt(e.roomId):ht("roomId","chatroom"),_i=(e,t)=>ki(e).then((e=>Me[t]({url:e.memberships_url}))),Pi=D`<livelike-widget-header slot="header"><livelike-title slot="title"></livelike-title><livelike-dismiss-button slot="dismiss"></livelike-dismiss-button><livelike-timer></livelike-timer></livelike-widget-header>`,Si=D`<style>livelike-option::slotted(.container){width:75%;max-width:75%;position:relative}livelike-progress[image]{top:0;height:1.5rem;margin-top:.5rem}.livelike-voting-image-container{width:100%;position:relative}livelike-footer{background-color:#444;display:block;font-weight:bolder;border-radius:0 0 6px 6px}.vote-button{margin:.5rem .5rem .5rem 1rem;padding:8px 16px;border-radius:5px;border:none;color:#fff;background:purple;cursor:pointer}.vote-button[disabled]{background:rgba(128,0,128,.5);color:rgba(255,255,255,.5);cursor:default}.voted-text{font-family:Arial}.sponsorship{padding:16px 8px;text-align:center;font-size:12px;font-family:HelveticaNeue-Medium}.sponsorship img{height:20px;vertical-align:middle;margin-left:8px}</style>`,xi=(e,t)=>{Kt(e,class extends t{constructor(){super(...arguments),this.waitForResponse=!0}render(){const t=D`<div style="position:relative;width:100%;display:flex"><livelike-progress></livelike-progress><livelike-description></livelike-description><livelike-percentage></livelike-percentage></div>`,n=D`<div class="livelike-voting-image-container"><div class="image-description-wrapper"><livelike-description></livelike-description><livelike-progress></livelike-progress></div><livelike-percentage></livelike-percentage></div><livelike-image height="80px" width="80px"></livelike-image>`;return D`<template><livelike-widget-root>${Si} ${Pi}<livelike-widget-body><livelike-select><template><livelike-option>${-1!==e.indexOf("image")?n:t}</livelike-option></template></livelike-select>${-1!==e.indexOf("quiz")?D`<livelike-footer><button class="vote-button" @click="${this.lockInVote}" ?disabled="${!this.selectedOption||!this.selectedOption.id||this.quizVoteSubmitted||this.voteDisable||this.disabled}">${this.owner.localize("widget.quiz.voteButton.label")}</button> ${this.quizVoteSubmitted?D`<span class="voted-text">${this.owner.localize("widget.quiz.votedText")}</span>`:null}</livelike-footer>`:null} ${-1!==e.indexOf("poll")&&this.widgetPayload.sponsors&&this.widgetPayload.sponsors.length?D`<livelike-widget-footer><div class="sponsorship">${this.owner.localize("widget.sponsors.label")} <img src="${this.widgetPayload.sponsors[0].logo_url}" alt="${this.widgetPayload.sponsors[0].name}"></div></livelike-widget-footer>`:null}</livelike-widget-body></livelike-widget-root></template>`}})};class Oi extends Yt{constructor(){super(...arguments),this.owner=this,this.hideVoteInResults=!0,this.submitVote=e=>{this.disabled||e.id===this.selectedOption.id||this.voteDisable||(this.selectedOption=e,this.interactionEvent(),this.voteDisable=!0,this.vote&&this.vote.id?this.updateVote(this.vote.url,{option_id:e.id}):this.createVote(e.vote_url))}}firstUpdated(){super.firstUpdated(),this.interaction&&(this.selectedOption=this.options.find((e=>e.id===this.interaction.option_id))),this.interaction&&(this.vote={id:this.interaction.id,url:this.interaction.url})}}xi("livelike-text-poll",Oi),xi("livelike-image-poll",Oi);const Ti=e=>class extends e{constructor(){super(...arguments),this.resultEvent=()=>{super.resultEvent();let e="unattempted";this.selectedOption&&this.selectedOption.id&&this.selectedOption.hasOwnProperty("is_correct")&&(e=this.selectedOption.is_correct?"correct":"incorrect"),at(this,"results",{result:e,element:this,widget:this.widgetPayload,selectedOption:this.selectedOption}),-1!==this.localName.indexOf("quiz")&&!this.quizVoteSubmitted&&!this.vote&&this.selectedOption&&this.selectedOption.id&&this.lockInVote(this.selectedOption.answer_url)}}};class Ci extends(Ti(Yt)){constructor(){super(...arguments),this.defaultVoteHide=!0,this.quizVoteSubmitted=!1,this.owner=this,this.submitVote=e=>{if(!this.disabled&&e.id!==this.selectedOption.id){this.selectedOption=e;const t=this.choices.findIndex((t=>t.id===e.id));this.choices[t].answer_count++,this.syntheticIncrement=!0,this.interactionEvent()}},this.lockInVote=e=>{this.voteDisable||(this.voteDisable=!0,this.selectedOption&&this.selectedOption.id&&this.createVote(this.selectedOption.answer_url).then((()=>{this.quizVoteSubmitted=!0,this.disabled=!0})))}}firstUpdated(){super.firstUpdated(),this.interaction&&(this.selectedOption=this.choices.find((e=>e.id===this.interaction.choice_id)),this.quizVoteSubmitted=!0,this.disabled=!0)}}xi("livelike-text-quiz",Ci),xi("livelike-image-quiz",Ci);const Ei={};class Ai extends Oi{constructor(){super(...arguments),this.defaultVoteHide=!0,this.hideVoteInResults=!0}firstUpdated(){super.firstUpdated(),this.addEventListener("prediction",(e=>{Ei[e.detail.widget.id]={option_id:e.detail.prediction.option_id,claim_token:e.detail.prediction.claim_token}}))}}xi("livelike-text-prediction",Ai),xi("livelike-image-prediction",Ai);class Ri extends(Ti(Yt)){constructor(){super(...arguments),this.claimRewards=(e,t)=>{e.claim_token&&Me.post({url:this.widgetPayload.claim_url,data:{claim_token:e.claim_token}}).then((e=>{Ei[t]&&(Ei[t].claim_token=null),this.rankChanged(this.widgetPayload,e.rewards)}))},this.interactive=()=>Promise.resolve()}firstUpdated(){super.firstUpdated(),this.updateComplete.then((()=>this.disabled=!0));const e=this.widgetPayload.text_prediction_id||this.widgetPayload.image_prediction_id,t=this.widgetPayload.text_prediction_id?"text-prediction":"image-prediction",n=Ei[e]||this.interaction;n?(n&&(this.selectedOption={id:n.option_id}),this.claimRewards(n,e)):Ft({programId:this.programid,widgets:[{kind:t,id:e}]}).then((n=>{n&&n[t]&&n[t][0]&&(this.selectedOption={id:n[t][0].option_id},this.claimRewards(n[t][0],e))}))}}xi("livelike-image-prediction-follow-up",Ri),xi("livelike-text-prediction-follow-up",Ri);const Mi=e=>"\n .widget-captioned-media {\n align-items: center;\n display: flex;\n margin: 0;\n }\n\n .widget-caption-container {\n padding: 1rem;\n }\n\n .widget-caption {\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n width: 100%;\n }\n\n .widget-caption.media-caption {\n padding: 1rem;\n }\n\n .widget-media {\n font-size: 0;\n text-align: center;\n }\n\n .widget-media img {\n max-height: 90px;\n max-width: 100%;\n }\n\n .widget-captioned-media .widget-caption {\n order: 1;\n }\n\n .widget-caption ~ .widget-media {\n order: 2;\n max-height: 90px;\n max-width: 35%;\n }\n\n .widget-link {\n word-wrap: break-word;\n background-color: #444;\n display: block;\n font-weight: bolder;\n padding: 0.5rem 1rem;\n position: relative;\n text-decoration: none;\n border-radius: 0 0 6px 6px;\n }\n .widget-link:after {\n content: '';\n background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2280px%22%20height%3D%22100px%22%20viewBox%3D%220%200%2080%20100%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3C!--%20Generator%3A%20Sketch%2050%20(54983)%20-%20http%3A%2F%2Fwww.bohemiancoding.com%2Fsketch%20--%3E%0A%20%20%20%20%3Ctitle%3Esort-down%3C%2Ftitle%3E%0A%20%20%20%20%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%0A%20%20%20%20%3Cdefs%3E%3C%2Fdefs%3E%0A%20%20%20%20%3Cg%20id%3D%22Page-1%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%0A%20%20%20%20%20%20%20%20%3Cg%20id%3D%22sort-down%22%20transform%3D%22translate(40.000000%2C%2050.000000)%20rotate(-90.000000)%20translate(-40.000000%2C%20-50.000000)%20translate(-10.000000%2C%2010.000000)%22%20fill%3D%22%23FFFFFF%22%20fill-rule%3D%22nonzero%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M98.1437396%2C2.63850125%20C96.9076009%2C0.879013967%2095.4422941%2C0%2093.7491877%2C0%20L6.25047031%2C0%20C4.55667973%2C0%203.09239915%2C0.879013967%201.85523426%2C2.63850125%20C0.61806938%2C4.39993433%200%2C6.48242398%200%2C8.88986179%20C0%2C11.2968131%200.61806938%2C13.3793028%201.85523426%2C15.1392765%20L45.604764%2C77.359553%20C46.843297%2C79.1190402%2048.3075776%2C80%2050%2C80%20C51.6924224%2C80%2053.1580712%2C79.1190402%2054.3942099%2C77.359553%20L98.1437396%2C15.1387901%20C99.3795363%2C13.3793028%20100%2C11.2968131%20100%2C8.88937534%20C100%2C6.48242398%2099.3795363%2C4.39993433%2098.1437396%2C2.63850125%20Z%22%20id%3D%22Shape%22%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E');\n background-position: center right 0.5rem;\n background-size: 0.5rem;\n background-repeat: no-repeat;\n position: absolute;\n width: calc(100% - 2rem);\n height: calc(100% - 1rem);\n left: 0;\n top: 0;\n z-index: 0;\n padding: 0.5rem 1rem;\n }\n\n *[dir=\"rtl\"] .widget-link {\n background-position: center left 0.5rem;\n }\n *[dir=\"rtl\"] .widget-link:after {\n transform: scaleX(-1);\n }\n\n ";var ji=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Li=class extends Jt{constructor(){super(...arguments),this.kind="alert",this.owner=this,this.defaultStyles=Mi,this.trackLinkOpened=()=>{this.interactionEvent();let e={"Alert Id":this.widgetPayload&&this.widgetPayload.id,"Program ID":this.widgetPayload&&this.widgetPayload.program_id,"Widget Type":Ie(this.widgetPayload.kind),"Link URL":this.link_url};Pe("Alert Link Opened",e,this.programid)}}firstUpdated(){this.isInteractable=this.link_url&&this.link_url.length,super.firstUpdated()}render(){const e=!!this.text&&!!this.image_url,t=!this.text&&!!this.image_url,n=!!this.text&&!this.image_url;return D`<template><livelike-widget-root>${Pi}<livelike-widget-body>${e?D`<figure class="widget-captioned-media">${this.text&&D`<figcaption class="widget-caption media-caption">${this.text}</figcaption>`} ${this.image_url&&D`<img class="widget-media" src="${this.image_url}" alt="${this.text}">`}</figure>`:t?D`<div class="widget-media"><img src="${this.image_url}"></div>`:n?D`<div class="widget-caption-container"><span class="widget-caption">${this.text}</span></div>`:null} ${this.link_url&&D`<livelike-footer><a class="widget-link" href="${this.link_url}" target="_blank" @click="${this.trackLinkOpened}">${this.link_label}</a></livelike-footer>`}</livelike-widget-body></livelike-widget-root></template>`}};ji([X({type:String})],Li.prototype,"title",void 0),ji([X({type:String})],Li.prototype,"text",void 0),ji([X({type:String})],Li.prototype,"image_url",void 0),ji([X({type:String})],Li.prototype,"link_url",void 0),ji([X({type:String})],Li.prototype,"link_label",void 0),Li=ji([qt("livelike-alert")],Li);const Ni=e=>{const t=`\n border: none;\n width: 100%;\n height: 1.125rem;\n border-radius: 1.5rem;\n background: ${e.interactiveTrackRight.background};\n background-image: linear-gradient(\n 90deg,\n ${e.interactiveTrackLeft.background},\n ${e.interactiveTrackRight.background} var(--x),\n transparent 0\n );\n `,n="\n border: none;\n width: var(--thumb-width);\n height: 1em;\n border-radius: 50%;\n margin-top: 0;\n ";return`\n .input-form {\n --x: calc(var(--val) / 100 * (100% - var(--thumb-width)));\n position: relative;\n width: 90%;\n margin: 0px auto;\n }\n\n .input-container {\n display: block;\n position: relative;\n }\n\n .slider-input {\n -webkit-appearance: none;\n width: 100%;\n display: block;\n height: 5em;\n background: none;\n cursor: pointer;\n position: relative;\n margin: 0;\n }\n\n .slider-input:focus {\n outline: none;\n }\n\n .slider-input::-webkit-slider-runnable-track {\n ${t}\n }\n .slider-input::-moz-range-track {\n ${t}\n }\n .slider-input::-ms-track {\n ${t}\n }\n\n .slider-input::-webkit-slider-thumb {\n ${n}\n }\n .slider-input::-moz-range-thumb {\n ${n}\n }\n .slider-input::-ms-thumb {\n ${n}\n }\n\n .slider-input:disabled {\n cursor: default;\n }\n\n .slider-image {\n height: 50px;\n }\n\n .slider-thumb {\n position: absolute;\n bottom: 0.1em;\n left: var(--x);\n pointer-events: none;\n }\n\n .result-mark {\n background: rgb(233, 0, 0);\n width: 1rem;\n height: 1rem;\n bottom: 1.1rem;\n position: absolute;\n background: #d23a3a;\n border: 3px solid white;\n border-radius: 1rem;\n bottom: 1.5rem;\n z-index: 1;\n ${hi(e.marker)}\n }\n livelike-emoji-slider livelike-footer{\n background-color: transparent;\n font-weight: normal;\n }\n .vote-button{\n margin: 0.5rem 0.5rem 0.5rem 1rem;\n padding: 8px 16px;\n border-radius: 5px;\n border: none;\n color: #fff;\n background: rgba(128, 0, 128, 1);\n cursor: pointer;\n }\n .vote-button[disabled]{\n background: rgba(128, 0, 128, 0.5);\n color: rgba(255, 255, 255, 0.5);\n cursor: default;\n }\n .voted-text{\n font-family: Arial;\n }\n .sponsorship{\n padding: 16px 8px;\n text-align: center;\n font-size: 12px;\n font-family: "HelveticaNeue-Medium";\n }\n .sponsorship img{\n height: 20px;\n vertical-align: middle;\n margin-left: 8px;\n }\n`};var Ui=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Ii=class extends Jt{constructor(){super(...arguments),this.owner=this,this.kind="emoji-slider",this.defaultStyles=Ni,this.val=null,this.sliderVoteSubmitted=!1,this.setThumbWidth=()=>{this.imageEl&&this.imageEl.offsetWidth>0?this.inputContainer.style.setProperty("--thumb-width",this.imageEl.offsetWidth+"px"):setTimeout(this.setThumbWidth,10)},this.changeVal=()=>{this.interactionEvent(),this.updateVal()},this.updateVal=()=>{if(this.inputEl){let e=+this.inputEl.value;if(this.val!==e){this.inputContainer.style.setProperty("--val",this.val=e);for(let e of this.options)this.val>=e.max&&this.imageEl.src!==e.image_url&&(this.imageEl.src=e.image_url,this.setThumbWidth())}}},this.resultEvent=()=>{super.resultEvent(),this.updateComplete.then((()=>{this.interacted&&!this.sliderVoteSubmitted&&this.lockInVote(this.val/100)}))},this.onResults=e=>{e.message.average_magnitude&&(this.average_magnitude=e.message.average_magnitude,at(this,e.event,e.message.average_magnitude))},this.interactive=e=>new Promise((t=>this.updateComplete.then((()=>{this.phase="interactive",this.disabled=!1;const n={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};Pe("Widget Became Interactive",n,this.programid);let i=e&&void 0!==e.timeout?e.timeout:this.widgetPayload.timeout&&Ue(this.widgetPayload.timeout);this.timeout=i,null!==i&&setTimeout((()=>{this.interacted&&!this.sliderVoteSubmitted?this.lockInVote(this.val/100).then((()=>setTimeout(t,2e3))):(this.interacted||this.sliderVoteSubmitted||(this.val=null),setTimeout(t,2e3))}),this.timeout)})))),this.lockInVote=e=>new Promise(((t,n)=>{!this.voteDisable&&e>=0&&e<=1?(this.voteDisable=!0,this.createVote(this.widgetPayload.vote_url,{magnitude:e.toString()}).then((()=>{this.sliderVoteSubmitted=!0,this.disabled=!0,t(!0)}))):n(new Error("Magnitude not a number between 0 and 1."))}))}get inputContainer(){return this.querySelector(".input-form")}get inputEl(){return this.querySelector(".slider-input")}get imageEl(){return this.querySelector(".slider-image")}connectedCallback(){super.connectedCallback().then((()=>{this.interaction&&this.interaction.magnitude&&(this.sliderVoteSubmitted=!0),this.updateComplete.then((()=>{this.inputEl&&(this.inputEl.addEventListener("change",this.changeVal),this.inputEl.addEventListener("input",this.updateVal)),this.options=this.options.map(((e,t)=>Object.assign(Object.assign({},e),{mag:0===t?0:t/(this.options.length-1)*100,max:t/this.options.length*100}))),this.updateVal()}))}))}render(){const e=Math.round(100*(this.interaction?this.interaction.magnitude:this.widgetPayload.initial_magnitude)),t="ready"!==this.phase&&"interactive"!==this.phase&&"null"!==String(this.val)?D`<div class="result-mark" style="left:calc(${Math.round(100*this.average_magnitude)}% - .5rem)"></div>`:null;return D`<template><livelike-widget-root>${Pi}<livelike-widget-body><form style="--val:${e}" class="input-form"><div class="input-container"><input type="range" class="slider-input" value="${e}" ?disabled="${this.disabled}"> ${t}</div><output class="slider-thumb"><img class="slider-image"></output></form><livelike-footer><button class="vote-button" @click="${()=>this.lockInVote(this.val/100)}" ?disabled="${this.sliderVoteSubmitted||this.voteDisable||this.disabled}">${this.owner.localize("widget.slider.voteButton.label")}</button> ${this.sliderVoteSubmitted?D`<span class="voted-text">${this.owner.localize("widget.slider.votedText")}</span>`:null} ${this.widgetPayload.sponsors&&this.widgetPayload.sponsors.length?D`<div class="sponsorship">${this.owner.localize("widget.sponsors.label")} <img src="${this.widgetPayload.sponsors[0].logo_url}" alt="${this.widgetPayload.sponsors[0].name}"></div>`:null}</livelike-footer></livelike-widget-body></livelike-widget-root></template>`}};Ui([X({type:Number})],Ii.prototype,"val",void 0),Ui([X({type:String})],Ii.prototype,"average_magnitude",void 0),Ui([X({type:Boolean})],Ii.prototype,"sliderVoteSubmitted",void 0),Ii=Ui([qt("livelike-emoji-slider")],Ii);var Di=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let $i=[];class Bi extends Jt{constructor(){super(),this.owner=this,this.moving=!1,this.slide=0,this.slides=null,this.totalSlides=0,this.scriptsLoaded=!1,this.finalLoad=!1,this.forceScriptLoad=()=>{window.instgrm&&window.instgrm.Embeds.process(),window.FB&&window.FB.XFBML.parse(),window.twttr&&window.twttr.widgets.load()},this.initSlider=()=>new Promise((e=>{const t=this.querySelector("#dot0");t&&(t.checked=!0),this.slides=this.querySelectorAll(".slide");const n=this.slides.length;this.totalSlides=n,this.slide=0,this.slides&&this.slides[0]&&(this.slides[0].className+=" active"),n>1&&(this.slides[1].className+=" next"),n>2&&(this.slides[n-1].className+=" prev"),e()})),this.insertHTML=()=>new Promise((e=>{this.items.forEach(((e,t)=>{const n=this.querySelector(`#embed${t}`),i=document.createElement("div");i.innerHTML=e.oembed&&e.oembed.html;const r=e=>{if("SCRIPT"===e.nodeName){const t=e.src.replace("file://","https://");if(!$i.includes(t)){$i.push(t);const e=document.createElement("script");e.src=t,document.body.insertAdjacentElement("beforeend",e)}}},o=e=>{for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];r(n),e.hasChildNodes()&&o(n)}};o(i),n&&(n.innerHTML=e.oembed&&e.oembed.html),setTimeout((()=>{if(this.forceScriptLoad(),e.oembed&&"Twitter"===e.oembed.provider_name){function e(t){const n=t.querySelector("twitter-widget");n&&n.shadowRoot&&n.shadowRoot.querySelector(".TweetInfo")?(n.shadowRoot.querySelector(".TweetInfo").style.display="none",n.shadowRoot.querySelector(".CallToAction").style.display="none"):setTimeout((()=>e(t)),100)}e(this)}setTimeout((()=>{this.scriptsLoaded=!0}),1500)}),500)})),e()})),this.moveCarouselTo=(e,t)=>{this.checkDot();const n="slide";let i=e-1,r=e+1;0===e?i=t-1:e===t-1&&(i=e-1,r=0),this.items.forEach(((e,t)=>{this.slides[t].className=n})),this.slides[i].className="slide prev",this.slides[e].className="slide active",this.slides[r].className="slide next"},this.moveNext=()=>{this.slide===this.totalSlides-1?this.slide=0:this.slide++,this.moveCarouselTo(this.slide,this.totalSlides)},this.movePrev=()=>{0===this.slide?this.slide=this.totalSlides-1:this.slide--,this.moveCarouselTo(this.slide,this.totalSlides)},this.moveToSlide=e=>{this.slide=e,this.moveCarouselTo(this.slide,this.totalSlides)},this.checkDot=()=>{this.items.forEach(((e,t)=>{this.querySelector(`#dot${t}`).checked=this.slide===t}))},this.disableInteraction=()=>{this.moving=!0,setTimeout((()=>{this.moving=!1}),500)},this.moving=!1,this.slide=0,this.slides=null,this.totalSlides=0,this.scriptsLoaded=!1,this.finalLoad=!1}updated(e){e.forEach(((e,t)=>{"scriptsLoaded"===t&&!0===this.scriptsLoaded&&this.forceScriptLoad(),"finalLoad"===t&&!0===this.finalLoad&&this.forceScriptLoad()}))}connectedCallback(){super.connectedCallback().then((()=>{this.updateComplete.then((()=>{this.insertHTML().then((()=>this.initSlider())).then((()=>setTimeout((()=>{this.finalLoad=!0}),3e3)))}))}))}}Di([X({type:Array})],Bi.prototype,"items",void 0),Di([X({type:String})],Bi.prototype,"comment",void 0),Di([X({type:Boolean})],Bi.prototype,"moving",void 0),Di([X({type:Number})],Bi.prototype,"slide",void 0),Di([X({type:Array})],Bi.prototype,"slides",void 0),Di([X({type:Number})],Bi.prototype,"totalSlides",void 0),Di([X({type:Boolean})],Bi.prototype,"scriptsLoaded",void 0),Di([X({type:Boolean})],Bi.prototype,"finalLoad",void 0);const Fi=D`<style>.slider-wrapper{overflow:hidden;margin:auto}.slider-wrapper *{box-sizing:border-box;display:flex;justify-content:center}.slider{-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;transform-style:preserve-3d}.slide{opacity:0;position:absolute;top:0;width:100%;display:none;margin:auto;z-index:100;transition:transform .5s,opacity .5s,z-index .5s}.slide.active,.slide.initial{opacity:1;position:relative;z-index:900;display:flex}.slide.next,.slide.prev{z-index:800;display:flex}.slide.prev{transform:translateX(-100%)}.slide.next{transform:translateX(100%)}.slide-button{background:0 0;position:absolute;top:50%;width:3rem;height:3rem;transform:translateY(-50%);border-radius:50%;cursor:pointer;z-index:20;border:none}.slide-button>svg{fill:#fff;filter:drop-shadow( 3px 3px 2px rgba(20, 20, 20, .7))}.left-button{left:0}.right-button{right:0}.dot-nav-container{z-index:20;margin-top:1rem}.dot-item{border:none;height:15px;width:15px;border-radius:1rem}</style>`;let Ki=class extends Bi{constructor(){super(...arguments),this.kind="social-embed",this.isInteractable=!1}render(){const e=this.items.length>1,t=D`<div class="button-wrapper"><button class="left-button slide-button" @click="${this.movePrev}">${on}</button> <button class="right-button slide-button" @click="${this.moveNext}">${rn}</button></div>`,n=D`<form class="dot-nav-container">${this.items.map(((e,t)=>D`<input class="dot-input" id="dot${t}" name="dot" type="radio" @click="${()=>this.moveToSlide(t)}">`))}</form>`;return D`<template>${Fi}<livelike-widget-root style="opacity:${this.scriptsLoaded&&this.finalLoad?1:0}">${Pi}<livelike-widget-body><div class="slider-wrapper">${e?t:null}<div class="slider">${this.items.length>0&&this.items.map(((e,t)=>D`<div id="embed${t}" class="slide ${0===t?"initial":""}"></div>`))}</div>${e?n:null}</div></livelike-widget-body></livelike-widget-root></template>`}};Ki=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-social-embed")],Ki);var qi=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let zi=class extends Jt{constructor(){super(...arguments),this.owner=this,this.kind="rich-post",this.isInteractable=!1}render(){return D`<template><livelike-widget-root>${Pi}<livelike-widget-body style="display:flex"><section>${En(this.content)}</section></livelike-widget-body></livelike-widget-root></template>`}};qi([X({type:String})],zi.prototype,"content",void 0),zi=qi([qt("livelike-rich-post")],zi);const Hi=e=>`\n @keyframes image0 {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.2); }\n 100% { transform: scale(1); }\n }\n @keyframes image1 {\n 0% { transform: scale(1.2); }\n 50% { transform: scale(1); }\n 100% { transform: scale(1.2); }\n }\n\n .cheer-image-body {\n position: relative;\n display: flex;\n }\n\n .cheer-image-body livelike-vote-count {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 2rem;\n z-index: 100;\n }\n\n .cheer-item-container {\n display: flex;\n flex-direction: column;\n width: 50%;\n position: relative;\n overflow: hidden;\n padding: 0 1.5rem;\n margin: auto;\n }\n\n .cheer-image-wrap {\n text-align: center;\n padding: 20px 0;\n }\n\n .cheer-image {\n position: relative;\n max-height: 80px;\n max-width: 85%;\n z-index: 5;\n top: 0;\n transition: all 0.2s;\n vertical-align: middle;\n }\n .cheer-image:hover {\n cursor: pointer;\n }\n .cheer-image.disabled:hover {\n cursor: default;\n }\n\n .button0.initial.enabled {\n animation: image0 2s linear 0s infinite normal;\n }\n .button1.initial.enabled {\n animation: image1 2s linear 0s infinite normal;\n }\n .cheer-image-wrap.enabled:after {\n content: '';\n position: absolute;\n display: block;\n z-index: 1;\n width: 100px;\n height: 100px;\n border-radius: 100%;\n top: 10px;\n left: 50%;\n margin-left: -50px;\n opacity: 0;\n transition: all 0.2s;\n }\n .cheer-image-wrap.enabled:active:after {\n opacity: 1;\n width: 200px;\n height: 200px;\n top: -40px;\n margin-left: -100px;\n }\n .button0{\n ${hi(e.sideAButton)}\n }\n .button1{\n ${hi(e.sideBButton)}\n }\n .cheer-image.enabled:active {\n -webkit-transform: scale(0.9);\n -webkit-transform: rotate(10deg);\n }\n .button0.enabled:after {\n border: 2px solid rgba(80, 160, 250, 0.6);\n background: rgba(80, 160, 250, 0.4);\n }\n .button1.enabled:after {\n border: 2px solid rgba(250, 80, 100, 0.6);\n background: rgba(250, 80, 100, 0.4);\n }\n`,Vi=e=>{let t=`\n :host {\n display: flex;\n position: relative;\n cursor: pointer;\n transition: border ease 0.3s;\n align-items: center;\n border: 2px solid transparent;\n border-radius: 6px;\n padding: 0.5rem;\n ${hi(e.unselectedOption)}\n }\n :host([selected]) {\n ${hi(e.selectedOption)}\n }\n :host([disabled]) {\n cursor: default;\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOption)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOption)}\n }\n `),t};var Gi=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Wi=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Vi,this.image=null,this.selected=null,this.correct=null,this.incorrect=null,this.disabled=null,this.optionSelected=()=>{this.disabled||(this.parentElement.querySelectorAll("livelike-option").forEach((e=>e!==this&&(e.selected=!1))),this.selected=!0,this.owner.submitVote(this.item),at(this,"option-clicked",{item:this.item}))},this.handleResults=e=>{this.item.hasOwnProperty("is_correct")&&(this.item.is_correct?this.correct=!0:this.selected&&(this.incorrect=!0))},this.ownerUpdated=e=>{"voteDisable"===e.name&&this.owner.waitForResponse&&(this.disabled=this.owner.disabled||e.prop)}}updated(e){e.forEach(((e,t)=>{if(void 0!==this[t]&&null!==this[t]&&this.item){const e={name:t,prop:this[t],key:this.item.id,owner:this.owner};if(st.emit("option-updated",e),at(this,"option-updated",e),"options"===t||"choices"===t||"items"===t){const e=this.items[this.optionIndex].vote_count;e!==this.voteCount&&(this.voteCount=e),at(this,"option-vote-updated",this.items[this.optionIndex])}}}))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.optionSelected);const e=this.parentElement;!this.owner&&(this.owner=e.owner);const t=this.getAttribute("index");this.optionIndex=t,this.removeAttribute("index");const n=this.owner.options||this.owner.choices;this.item=n[t],this.voteCount=n[t].vote_count,this.disabled=this.owner.disabled,this.value=this.item.id,this.image=!!this.item.image_url,this.owner.options&&(this.option=this.owner.options[t]),this.owner.choices&&(this.choice=this.owner.choices[t]),this.owner.selectedOption&&this.owner.selectedOption.id&&this.owner.selectedOption.id===this.value&&(this.selected=!0),("results"===this.owner.phase||"finished"===this.owner.phase)&&this.handleResults(),this.owner.addEventListener("results",this.handleResults),this.addEventListener("option-provider",(e=>{e.detail.provider=this,e.stopPropagation()}))}disconnectedCallback(){this.removeEventListener("click",this.optionSelected),super.disconnectedCallback()}render(){return D`<slot></slot>`}};Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"image",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"selected",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"correct",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"incorrect",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"disabled",void 0),Gi([X({type:Object})],Wi.prototype,"option",void 0),Gi([X({type:Object})],Wi.prototype,"choice",void 0),Gi([X({type:Object})],Wi.prototype,"item",void 0),Gi([X({type:String})],Wi.prototype,"value",void 0),Wi=Gi([qt("livelike-option")],Wi);const Yi=e=>{let t=`\n :host {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n position: relative;\n ${hi(e.unselectedOptionImage)}\n }\n ::slotted(img) {\n object-fit: contain;\n }\n img {\n max-width: 90px;\n display: block;\n margin: 0 auto;\n }\n :host([selected]) {\n ${hi(e.selectedOptionImage)}\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionImage)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionImage)}\n }\n `),t};var Ji=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Xi=class extends Lt{constructor(){super(...arguments),this.defaultStyles=Yi}connectedCallback(){super.connectedCallback();let e=this.src||this.item&&this.item.image_url||this.owner.image_url;if(e){const t=document.createElement("img");t.setAttribute("height",this.height),t.setAttribute("width",this.width),t.setAttribute("src",e),t.setAttribute("alt",this.alt||this.item&&this.item.description),this.appendChild(t)}}defaultTemplate(){return D`<slot></slot>`}};Ji([X({type:String,reflect:!0})],Xi.prototype,"src",void 0),Ji([X({type:String,reflect:!0})],Xi.prototype,"alt",void 0),Ji([X({type:String,reflect:!0})],Xi.prototype,"height",void 0),Ji([X({type:String,reflect:!0})],Xi.prototype,"width",void 0),Xi=Ji([qt("livelike-image")],Xi);var Zi=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Qi=class extends Jt{constructor(){super(...arguments),this.kind="cheer-meter",this.owner=this,this.defaultStyles=Hi,this.cheerVote={},this.count=0,this.submitVote=e=>{this.disabled||(this.cheerVote[e.id]?this.cheerVote[e.id].count++:this.cheerVote[e.id]={createUrl:e.vote_url,count:1},this.selectedOption=e,this.interactionTrack(),this.sendVote())},this.sendVote=((e,t)=>{let n,i;return function r(...o){const s=Date.now();i=clearTimeout(i),!n||s-n>=t?(e.apply(null,o),n=s):i=setTimeout(r.bind(null,...o),t-(s-n))}})((()=>{for(const e in this.cheerVote)if(this.cheerVote[e].count){this.interactionEvent(this.cheerVote[e].count);const t={vote_count:this.cheerVote[e].count};this.cheerVote[e].count=0;const n=t=>t.url&&(this.cheerVote[e].updateUrl=t.url);this.cheerVote[e].updateUrl?this.updateVote(this.cheerVote[e].updateUrl,t).then(n):this.createVote(this.cheerVote[e].createUrl,t).then(n)}}),3e3),this.updateTotalVoteCount=()=>{this.count=this.options.reduce(((e,t)=>e+t.vote_count),0)}}voteCountChanged(e){this.updateTotalVoteCount()}firstUpdated(){super.firstUpdated(),this.updateTotalVoteCount()}render(){return D`<template><livelike-widget-root>${Pi}<livelike-widget-body><livelike-dueling-progress></livelike-dueling-progress><div class="cheer-image-body"><livelike-vote-count></livelike-vote-count>${this.options.map(((e,t)=>{const n=this.disabled?"disabled":"enabled";return D`<div class="cheer-item-container"><livelike-option index="${t}" style="display:contents"><div class="cheer-image-wrap button${t} ${this.interacted?"":"initial"} ${n}"><img class="cheer-image ${n}" src="${e.image_url}"></div></livelike-option></div>`}))}</div></livelike-widget-body></livelike-widget-root></template>`}};Zi([X({type:Object})],Qi.prototype,"cheerVote",void 0),Zi([X({type:Number})],Qi.prototype,"count",void 0),Qi=Zi([qt("livelike-cheer-meter")],Qi);const er=e=>"\n .only-media{\n border-radius: 6px;\n }\n .no-header{\n border-top-right-radius: 6px;\n border-top-left-radius: 6px;\n }\n .no-footer{\n border-bottom-right-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n .video-alert-caption-container {\n padding: 0.6rem 0.8rem;\n }\n .video-alert-caption {\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n width: 100%;\n }\n .video-alert-link {\n word-wrap: break-word;\n background-color: #444;\n display: block;\n font-weight: bolder;\n padding: 0.5rem 1rem;\n position: relative;\n text-decoration: none;\n border-radius: 0 0 6px 6px;\n }\n .video-alert-link:after {\n content: '';\n background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2280px%22%20height%3D%22100px%22%20viewBox%3D%220%200%2080%20100%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3C!--%20Generator%3A%20Sketch%2050%20(54983)%20-%20http%3A%2F%2Fwww.bohemiancoding.com%2Fsketch%20--%3E%0A%20%20%20%20%3Ctitle%3Esort-down%3C%2Ftitle%3E%0A%20%20%20%20%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%0A%20%20%20%20%3Cdefs%3E%3C%2Fdefs%3E%0A%20%20%20%20%3Cg%20id%3D%22Page-1%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%0A%20%20%20%20%20%20%20%20%3Cg%20id%3D%22sort-down%22%20transform%3D%22translate(40.000000%2C%2050.000000)%20rotate(-90.000000)%20translate(-40.000000%2C%20-50.000000)%20translate(-10.000000%2C%2010.000000)%22%20fill%3D%22%23FFFFFF%22%20fill-rule%3D%22nonzero%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M98.1437396%2C2.63850125%20C96.9076009%2C0.879013967%2095.4422941%2C0%2093.7491877%2C0%20L6.25047031%2C0%20C4.55667973%2C0%203.09239915%2C0.879013967%201.85523426%2C2.63850125%20C0.61806938%2C4.39993433%200%2C6.48242398%200%2C8.88986179%20C0%2C11.2968131%200.61806938%2C13.3793028%201.85523426%2C15.1392765%20L45.604764%2C77.359553%20C46.843297%2C79.1190402%2048.3075776%2C80%2050%2C80%20C51.6924224%2C80%2053.1580712%2C79.1190402%2054.3942099%2C77.359553%20L98.1437396%2C15.1387901%20C99.3795363%2C13.3793028%20100%2C11.2968131%20100%2C8.88937534%20C100%2C6.48242398%2099.3795363%2C4.39993433%2098.1437396%2C2.63850125%20Z%22%20id%3D%22Shape%22%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E');\n background-position: center right 0.5rem;\n background-size: 0.5rem;\n background-repeat: no-repeat;\n position: absolute;\n width: calc(100% - 2rem);\n height: calc(100% - 1rem);\n left: 0;\n top: 0;\n z-index: 0;\n padding: 0.5rem 1rem;\n }\n\n *[dir=\"rtl\"] .video-alert-link {\n background-position: center left 0.5rem;\n }\n *[dir=\"rtl\"] .video-alert-link:after {\n transform: scaleX(-1);\n }\n\n ",tr=e=>"\n :host {\n display: block;\n }\n livelike-video{\n position: relative;\n }\n livelike-video video {\n width: 100%;\n max-height: 210px;\n border-radius: inherit;\n vertical-align: middle;\n }\n .video-playback-error {\n position: absolute;\n width: 100%;\n text-align: center;\n top: 50%;\n right:50%;\n transform: translate(50%,-50%);\n display: flex;\n align-items: center;\n padding: 0.5rem;\n justify-content: center;\n }\n ";var nr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let ir=class extends Rt{constructor(){super(...arguments),this.defaultStyles=tr,this.videoAttrs=["autoplay","controls","muted","loop","disablepictureinpicture"],this.preload="metadata",this.controlslist="nodownload",this.controls=!0,this.disablepictureinpicture=!0,this.onVideoPlay=e=>at(this,e.type),this.onVideoPlayError=e=>{this.error="Playback Failed"}}createRenderRoot(){return this}disconnectedCallback(){this.scrollObserver.disconnect(),this.videoEl.removeEventListener("play",this.onVideoPlay),super.disconnectedCallback()}firstUpdated(){super.firstUpdated(),this.videoAttrs.forEach((e=>this.videoEl[e]=!!this[e])),window.IntersectionObserver&&(this.scrollObserver=new IntersectionObserver((e=>e.forEach((e=>{1==e.intersectionRatio||this.videoEl.paused||this.videoEl.pause()}))),{threshold:.1}),this.scrollObserver.observe(this.videoEl)),this.videoEl.addEventListener("play",this.onVideoPlay)}updated(e){this.videoEl&&e.forEach(((e,t)=>{this.videoAttrs.some((e=>e===t))&&(this.videoEl[t]=!!this[t])}))}defaultTemplate(){return D`<video id="video" poster="${this.poster?this.poster:""}" preload="${this.preload}" controlslist="${this.controlslist}"><source src="${this.src}" type="video/mp4" @error="${this.onVideoPlayError}">${this.tracksrc?D`<track src="${this.tracksrc}" label="${this.tracklabel}" kind="${this.trackkind}" default>`:null}</video>${this.error?D`<div class="video-playback-error">${hn} <span class="video-playback-error-text">${this.owner.localize("widget.video.playbackError")}</span></div>`:null}`}};nr([Z("video")],ir.prototype,"videoEl",void 0),nr([X({type:String,reflect:!0})],ir.prototype,"src",void 0),nr([X({type:String})],ir.prototype,"error",void 0),nr([X({type:String})],ir.prototype,"poster",void 0),nr([X({type:String})],ir.prototype,"preload",void 0),nr([X({type:String})],ir.prototype,"controlslist",void 0),nr([X({type:String})],ir.prototype,"tracksrc",void 0),nr([X({type:String})],ir.prototype,"tracklabel",void 0),nr([X({type:String})],ir.prototype,"trackkind",void 0),nr([X({type:Boolean})],ir.prototype,"autoplay",void 0),nr([X({type:Boolean})],ir.prototype,"controls",void 0),nr([X({type:Boolean})],ir.prototype,"muted",void 0),nr([X({type:Boolean})],ir.prototype,"loop",void 0),nr([X({type:Boolean})],ir.prototype,"disablepictureinpicture",void 0),ir=nr([qt("livelike-video")],ir);var rr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let or=class extends Jt{constructor(){super(...arguments),this.kind="video-alert",this.owner=this,this.defaultStyles=er,this.trackLinkOpened=()=>{this.interactionEvent();const e={"Alert Id":this.widgetPayload&&this.widgetPayload.id,Nickname:ce&&ce.nickname,"Program ID":this.widgetPayload&&this.widgetPayload.program_id,"Widget Type":Ie(this.widgetPayload.kind),"Link URL":this.link_url};Pe("Alert Link Opened",e,this.programid)},this.onVideoPlayStarted=()=>{this.interactionEvent();const e={"Alert Id":this.widgetPayload&&this.widgetPayload.id,"Program ID":this.widgetPayload&&this.widgetPayload.program_id,"Widget Type":Ie(this.widgetPayload.kind),"Video URL":this.video_url};Pe("Video Alert Play Started",e,this.programid)}}firstUpdated(){super.firstUpdated(),this.isInteractable=this.video_url&&this.video_url.length||this.link_url&&this.link_url.length}render(){const e=this.title||this.text,t=e&&this.link_url?"":e?"no-footer":this.link_url?"no-header":"only-media";return D`<template><livelike-widget-root>${this.title?Pi:null}<livelike-widget-body class="${this.title?"":"no-header"}">${this.text&&D`<div class="video-alert-caption-container"><span class="video-alert-caption">${this.text}</span></div>`}<livelike-video class="${t}" .src="${this.src||this.video_url}" @play="${this.onVideoPlayStarted}"></livelike-video>${this.link_url&&D`<livelike-widget-footer><a class="video-alert-link" href="${this.link_url}" target="_blank" @click="${this.trackLinkOpened}">${this.link_label}</a></livelike-widget-footer>`}</livelike-widget-body></livelike-widget-root></template>`}};rr([X({type:String})],or.prototype,"title",void 0),rr([X({type:String})],or.prototype,"text",void 0),rr([X({type:String})],or.prototype,"video_url",void 0),rr([X({type:String})],or.prototype,"link_url",void 0),rr([X({type:String})],or.prototype,"link_label",void 0),rr([Z("video")],or.prototype,"videoEl",void 0),or=rr([qt("livelike-video-alert")],or);const sr=e=>{let t=`\n :host {\n display: block;\n flex-grow: 1;\n z-index: 10;\n padding: 0.5rem;\n word-break: break-word;\n position: relative;\n ${hi(e.unselectedOptionDescription)}\n }\n :host([image]) {\n padding: 0.75rem 0.5rem 0.25rem 0.5rem;\n }\n :host([selected]) {\n ${hi(e.selectedOptionDescription)}\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionDescription)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionDescription)}\n }`),t};var ar=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let cr=class extends Lt{constructor(){super(...arguments),this.defaultStyles=sr}defaultTemplate(){return D`<slot>${this.description||this.item&&this.item.description||this.owner.text}</slot>`}};ar([X({type:String})],cr.prototype,"description",void 0),cr=ar([qt("livelike-description")],cr);const lr=e=>`\n .widget-dismiss {\n z-index: 1;\n border: none;\n background:none;\n height: 18px;\n margin: 0.5rem;\n display: block;\n ${hi(e.dismiss)}\n }\n .widget-dismiss:hover {\n cursor: pointer;\n }\n `;let ur=class extends Rt{constructor(){super(...arguments),this.defaultStyles=lr,this.dismissClicked=()=>at(this,"dismiss-clicked")}defaultTemplate(){return D`${this.owner.hide_dismiss_button?null:D`<button class="widget-dismiss" aria-label="Dismiss" @click="${this.dismissClicked}">${ln}</button>`}`}};ur=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-dismiss-button")],ur);const dr=["text-quiz","image-quiz","text-prediction","image-prediction","text-poll","image-poll"],hr=e=>e.value=Ge(e.owner,e.item),pr=e=>{let t=e.owner.phase;e.owner.defaultVoteHide?dr.some((t=>t===e.owner.widgetPayload.kind))&&(e.style.visibility="results"!==t&&"finished"!==t||!(e=>!e.owner.hideVoteInResults||!!e.owner.selectedOption&&!!e.owner.selectedOption.id)(e)?"hidden":"visible"):e.style.visibility="ready"!==t&&("interactive"!==t&&!e.owner.hideVoteInResults||e.owner.selectedOption&&e.owner.selectedOption.id)?"visible":"hidden"},fr=e=>class extends e{constructor(){super(...arguments),this.ownerUpdated=e=>("phase"===e.name||"selectedOption"===e.name)&&pr(this),this.optionUpdated=e=>{hr(this)}}static get properties(){return{value:{type:Number,reflect:!0}}}firstUpdated(){hr(this),pr(this)}},gr=e=>{let t=`\n :host {\n display: block;\n position: relative;\n padding: 0.5rem;\n z-index: 10;\n ${hi(e.unselectedOptionPercentage)}\n }\n :host([selected]) {\n ${hi(e.selectedOptionPercentage)}\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionPercentage)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionPercentage)}\n }\n `),t};let mr=class extends(fr(Lt)){constructor(){super(...arguments),this.defaultStyles=gr}defaultTemplate(){return D`${this.value}%`}};mr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-percentage")],mr);const vr=e=>{let t=`\n :host {\n height: 2rem;\n position: absolute;\n border-radius: 3px;\n transition: ease width 0.4s;\n background: rgba(255, 255, 255, 0.12);\n ${hi(e.unselectedOptionBar)}\n }\n :host([selected]) {\n ${hi(e.selectedOptionBar)}\n }\n :host([hidden]) {\n display: none;\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionBar)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionBar)}\n }\n `),t};var yr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let br=class extends(fr(Lt)){constructor(){super(...arguments),this.defaultStyles=vr,this.max=100,this.min=0}updated(e){super.updated(e),e.has("value")&&(this.style.width=this.value+"%")}defaultTemplate(){return D`<slot></slot>`}};yr([X({type:Number,reflect:!0})],br.prototype,"max",void 0),yr([X({type:Number,reflect:!0})],br.prototype,"min",void 0),br=yr([qt("livelike-progress")],br);const wr=()=>"\n :host{\n display: block;\n }\n";var kr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let _r=class extends Rt{constructor(){super(...arguments),this.defaultStyles=wr}firstUpdated(){this.items=this.items||this.owner.options||this.owner.choices;const e=this.querySelector("template");this.items.map(((t,n)=>{const i=e.content.firstElementChild;i.setAttribute("index",n);const r=function(e){let t=e.cloneNode(!0);return Object.keys(e).forEach((n=>t[n]=e[n])),t}(i);this.appendChild(r)})),e.remove(),super.firstUpdated()}defaultTemplate(){return D`<slot></slot>`}};kr([X({type:Array})],_r.prototype,"items",void 0),_r=kr([qt("livelike-select")],_r);const Pr=e=>`\n :host {\n width: 0%;\n display: block;\n background: white;\n height: 2px;\n position: absolute;\n bottom: 0;\n transition-timing-function: linear;\n ${hi(e.timer)}\n }\n `;var Sr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let xr=class extends Rt{constructor(){super(...arguments),this.started=!1,this.defaultStyles=Pr,this.start=()=>{if(!this.started){this.started=!0;const e=(new Date).getTime(),t=()=>{const n=this.time||this.owner.timeout,i=(new Date).getTime()-e,r=100*(1-(n-i)/n);this.style.width=`${r>100?100:r}%`,i<n&&"interactive"===this.owner.phase&&requestAnimationFrame(t)};t()}},this.ownerUpdated=e=>{"phase"===e.name&&("interactive"===e.prop?this.start():this.style.display="none")}}firstUpdated(){"interactive"===this.owner.phase&&this.start(),this.pageVisible=!document.hidden,st.on("pageVisibilityChange",(e=>this.pageVisible=e.pageVisible))}render(){return D`<slot></slot>`}};Sr([X({type:Number,reflect:!0})],xr.prototype,"time",void 0),Sr([X({type:Boolean})],xr.prototype,"pageVisible",void 0),xr=Sr([qt("livelike-timer")],xr);const Or=e=>`\n :host {\n padding: 0.5rem 1rem;\n flex-grow: 1;\n overflow-wrap: break-word;\n width: 85%;\n margin: 0;\n ${hi(e.title)}\n }\n\n .widget-tag{\n font-size: 12px;\n color: rgba(255,255,255,0.5);\n font-family: "HelveticaNeue-Bold";\n ${hi(e.tag)}\n }\n `;var Tr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Cr=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Or,this.getTag=()=>{switch(this.kind||this.owner.kind){case"text-quiz":case"image-quiz":return this.owner.localize("widget.quiz.tag");case"text-poll":case"image-poll":return this.owner.localize("widget.poll.tag");case"text-prediction":case"image-prediction":return this.owner.localize("widget.prediction.tag");case"text-prediction-follow-up":case"image-prediction-follow-up":return this.owner.localize("widget.followup.tag");default:return""}}}defaultTemplate(){const e=this.getTag().trim();return D`<slot>${e.length>0?D`<div class="widget-tag">${e}</div>`:null}<div>${this.title||this.owner.question||this.owner.title||this.owner.comment}</div></slot>`}};Tr([X({type:String})],Cr.prototype,"title",void 0),Cr=Tr([qt("livelike-title")],Cr);const Er=e=>"\n :host {\n\n }\n ";var Ar=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Rr=class extends Lt{constructor(){super(...arguments),this.defaultStyles=Er,this.updateCount=e=>{const t=e&&(String(e.vote_count)||String(e.answer_count));this.count=t||this.owner.count||0},this.ownerUpdated=e=>{"options"!==e.name&&"choices"!==e.name&&"count"!==e.name||this.updateCount(this.item)}}connectedCallback(){super.connectedCallback(),this.updateCount(this.item)}defaultTemplate(){return D`${this.count}`}};Ar([X({type:String,reflect:!0})],Rr.prototype,"count",void 0),Rr=Ar([qt("livelike-vote-count")],Rr);const Mr=e=>`\n :host {\n display: block;\n border-radius: 0 0 6px 6px;\n background: rgba(0,0,0,6);\n ${hi(e.body)}\n }\n `;let jr=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Mr}defaultTemplate(){return D`<slot></slot>`}};jr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-body")],jr);const Lr=()=>"\n :host {\n display:flex;\n justify-content: center;\n margin: 0.5rem;\n }\n ";let Nr=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Lr}firstUpdated(){let e="";const t=`\n <time datetime="${this.owner.published_at}">\n ${He(this.owner.published_at,this.owner.timeformat,this.owner.lang)}\n </time>\n `;this.owner.authors&&this.owner.created_by.name&&(e+=`<span>${this.owner.created_by.name}</span>`,this.owner.timestamps&&(e+=" – ")),this.owner.timestamps&&(e+=t),this.insertAdjacentHTML("afterbegin",e)}defaultTemplate(){return D`<slot></slot>`}};Nr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-bylines")],Nr);const Ur=e=>`\n :host {\n ${hi(e.footer)}\n }\n `;let Ir=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Ur}defaultTemplate(){return D`<slot></slot>`}};Ir=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-footer")],Ir);const Dr=e=>`\n :host {\n display: flex;\n position: relative;\n border-radius: 6px 6px 0 0;\n ${hi(e.header)}\n }\n `;let $r=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Dr}defaultTemplate(){return D`<slot name="title"></slot><slot name="dismiss"></slot><slot></slot>`}};$r=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-header")],$r);const Br=e=>`\n :host {\n color: #fff;\n position: relative;\n display: block;\n ${hi(e.root)}\n }\n `;let Fr=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Br}defaultTemplate(){return D`<livelike-widget-bylines></livelike-widget-bylines><slot name="header"></slot><slot name="timer"></slot><slot name="body"></slot><slot></slot><livelike-widget-reactions></livelike-widget-reactions>`}};Fr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-root")],Fr);const Kr=e=>`\n :host {\n display:flex;\n }\n .bar-container {\n font-size: 14px;\n padding: .25rem 0;\n transition: all 0.4s ease;\n text-align: center;\n }\n .bar0{\n background: linear-gradient(to left, #3023ae, #53a0fd);\n ${hi(e.sideABar)}\n }\n .bar1{\n background: linear-gradient(to right, #9f041b, #f5515f);\n ${hi(e.sideBBar)}\n }\n `;var qr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let zr=class extends Rt{constructor(){super(...arguments),this.defaultStyles=Kr,this.ownerUpdated=e=>{"options"!==e.name&&"choices"!==e.name||(this.items=e.prop)}}connectedCallback(){super.connectedCallback(),this.items=this.items||this.owner.options||this.owner.choices}defaultTemplate(){const e=Math.round(1/this.items.length*100);return D`${this.items.map(((t,n)=>{const i=`width:${Ge(this.owner,t,e)}%`;return D`<div class="bar-container bar${n}" style="${i}">${t.description?D`<div>${t.description}</div>`:null}</div>`}))}`}};qr([X({type:Array})],zr.prototype,"items",void 0),zr=qr([qt("livelike-dueling-progress")],zr);const Hr=e=>`\n .text-ask-prompt-container {\n padding: 1rem;\n ${hi(e.prompt)}\n }\n .text-ask-prompt {\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n width: 100%;\n }\n .text-ask-form {\n padding: 0 16px 16px 16px;\n }\n .text-ask-input-container {\n padding: 15px 3px 17px 15px;\n border-radius: 4px;\n background-color: rgb(40,40,40);\n border-color: rgb(63,63,63);\n position: relative;\n }\n .text-ask-input {\n border: none;\n background-color: rgb(40,40,40);\n color: rgb(255,255,255);\n font-size: 12px;\n line-height: 20px;\n resize: none; \n width: 100%;\n box-sizing: border-box;\n padding: 0;\n padding-right: 8px;\n font-family: "HelveticaNeue-Regular";\n ${hi(e.replyEnabled)}\n }\n .text-ask-input::placeholder {\n color: rgb(171,171,171);\n ${hi(e.replyPlaceholder)}\n } \n .text-ask-input:focus {\n outline: none;\n }\n .text-ask-input[disabled] {\n color: rgb(171,171,171);\n ${hi(e.replyDisabled)}\n }\n .text-ask-input::-webkit-scrollbar {\n width: 4px;\n }\n .text-ask-input::-webkit-scrollbar-track {\n margin-right: 3px;\n }\n .text-ask-input::-webkit-scrollbar-thumb {\n -webkit-border-radius: 100px;\n border-radius: 100px;\n background: rgb(84,84,84);\n -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);\n }\n .text-ask-input-counter {\n font-size: 10px;\n color: rgb(171,171,171);\n position: absolute;\n right: 5px;\n bottom: 2px;\n }\n .text-ask-button {\n width: fit-content;\n padding: 12px 16px;\n border: none;\n border-radius: 4px;\n font-size: 10px;\n font-family: "HelveticaNeue-Bold";\n cursor: pointer;\n ${hi(e.submitButtonEnabled)} \n }\n .text-ask-button[disabled] {\n background-color: rgb(84,84,84);\n color: rgb(171,171,171);\n cursor: default;\n ${hi(e.submitButtonDisabled)}\n }\n .confirmation-message-container {\n padding: 0;\n padding-left: 11px;\n }\n .hidden {\n opacity: 0;\n }\n .confirmation-message {\n color: rgb(0,240,120);\n font-size: 12px;\n text-align: left;\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n ${hi(e.confirmation)}\n }\n .text-ask-footer {\n padding: 0 16px 16px 16px;\n display: flex;\n align-items: center;\n }\n `;var Vr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Gr=class extends Jt{constructor(){super(...arguments),this.kind="text-ask",this.owner=this,this.defaultStyles=Hr,this.text="",this.maxlength=240,this.replyDisable=!0,this.firstUpdated=()=>{super.firstUpdated(),this.interaction&&(this.text=this.interaction.text,this.disabled=!0,this.showConfirmation=!0)},this.submitReply=()=>{this.replyDisable=!0,this.interactionEvent(),Me.post({url:this.widgetPayload.reply_url,data:{text:this.text}}).then((e=>{this.disabled=!0,this.replyDisable=!1,this.reply=this.text,this.showConfirmation=!0})).catch((e=>{this.replyDisable=!1}))},this.inputHandler=e=>{this.text=e.target.value.trimLeft(),this.inputEl.value=this.text,this.counter.textContent=this.maxlength-this.text.length,this.replyDisable=!(this.text.length>0)}}get counter(){return this.querySelector(".text-ask-input-counter")}get inputEl(){return this.querySelector(".text-ask-input")}render(){return D`<template><livelike-widget-root>${Pi}<livelike-widget-body><div class="text-ask-prompt-container"><span class="text-ask-prompt">${this.prompt}</span></div><form class="text-ask-form"><div class="text-ask-input-container"><textarea class="text-ask-input" type="text" name="reply" rows="2" .value="${this.text}" maxlength="${this.maxlength}" ?disabled="${this.disabled}" placeholder="${this.owner.localize("widget.textAsk.placeholder")}" @input="${this.inputHandler}"></textarea> ${this.disabled?null:D`<span class="text-ask-input-counter">${this.maxlength}</span>`}</div></form><div class="text-ask-footer"><button class="text-ask-button" @click="${this.submitReply}" ?disabled="${this.disabled||this.replyDisable}"><span class="text-ask-button-label">${this.owner.localize("widget.textAsk.sendButton.label")}</span></button><div class="confirmation-message-container ${this.showConfirmation?"":"hidden"}"><span class="confirmation-message">${this.confirmation_message}</span></div></div></livelike-widget-body></livelike-widget-root></template>`}};Vr([X({type:String})],Gr.prototype,"title",void 0),Vr([X({type:String})],Gr.prototype,"prompt",void 0),Vr([X({type:String})],Gr.prototype,"confirmation_message",void 0),Vr([X({type:Boolean})],Gr.prototype,"replyDisable",void 0),Vr([X({type:Boolean})],Gr.prototype,"showConfirmation",void 0),Gr=Vr([qt("livelike-text-ask")],Gr);const Wr={_$$:se,_config:ae,userProfile:ce,applyTheme:pi,addMessageListener:(e,t)=>it(e.roomId).then((n=>{const i=i=>{i.message&&(i.message.payload.timetoken=i.timetoken),i.channel===n&&t({message:i.data||i.message.payload,roomId:e.roomId,event:Ne[i.event||i.message.event]})};bt.add(n,e.roomId,t,{message:i,messageAction:i})})),removeMessageListener:(e,t)=>bt.remove(e.roomId,t),createUserProfile:vi,getUserProfile:mi,init:e=>new Promise((t=>{let n=se.ready&&se.clientId&&ce;var i;n&&console.error("LiveLike EngagementSDK has already been initialized!"),n||((i=document.createElement("script")).type="text/javascript",i.src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2.4.4/webcomponents-loader.js",document.body.append(i),se.pageVisible=!document.hidden,document.addEventListener("visibilitychange",(()=>{se.pageVisible=!document.hidden,st.emit("pageVisibilityChange",{pageVisible:!document.hidden})}),!1)),!e.accessToken&&console.warn(`LiveLike EngagementSDK has been initialized without an accessToken.\n ${lt()}`),e.endpoint&&(se.endpoint=e.endpoint),se.ready=!1,se.logger=e.logger||null,se.clientId=e.clientId,se.accessToken=e.accessToken||null,se.lsKey="livelike-user-auth-"+e.clientId,e.syncStrategy&&(se.syncStrategy=e.syncStrategy),se.storageStrategy=e.storageStrategy||gt,e.localizedStrings&&fi(e.localizedStrings),pi(e.theme||{}).then((()=>et().then((i=>{!n&&i.mixpanel_token&&function(e,t){var n=document,i=window.mixpanel||[];if(!i.__SV){var r,o,s=window;try{var a,c,l,u=s.location,d=u.hash;a=function(e,t){return(c=e.match(RegExp(t+"=([^&]*)")))?c[1]:null},d&&a(d,"state")&&"mpeditor"===(l=JSON.parse(decodeURIComponent(a(d,"state")))).action&&(s.sessionStorage.setItem("_mpcehash",d),history.replaceState(l.desiredHash||"",n.title,u.pathname+u.search))}catch(e){}window.mixpanel=i,i._i=[],i.init=function(e,t,n){function s(e,t){var n=t.split(".");2==n.length&&(e=e[n[0]],t=n[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var a=i;for(void 0!==n?a=i[n]=[]:n="mixpanel",a.people=a.people||[],a.toString=function(e){var t="mixpanel";return"mixpanel"!==n&&(t+="."+n),e||(t+=" (stub)"),t},a.people.toString=function(){return a.toString(1)+".people (stub)"},r="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" "),o=0;o<r.length;o++)s(a,r[o]);var c="set set_once union unset remove delete".split(" ");a.get_group=function(){function e(e){t[e]=function(){call2_args=arguments,call2=[e].concat(Array.prototype.slice.call(call2_args,0)),a.push([n,call2])}}for(var t={},n=["get_group"].concat(Array.prototype.slice.call(arguments,0)),i=0;i<c.length;i++)e(c[i]);return t},i._i.push([e,t,n])},i.__SV=1.2,(s=n.createElement("script")).type="text/javascript",s.async=!0,s.src="undefined"!=typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===n.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js",(a=n.getElementsByTagName("script")[0]).parentNode.insertBefore(s,a)}mixpanel.init(e),mixpanel.register(t)}(i.mixpanel_token,i.analytics_properties),se.programUrlTemplate=i.program_detail_url_template,se.chatUrlTemplate=i.chat_room_detail_url_template,se.leaderboardUrlTemplate=i.leaderboard_detail_url_template,se.createChatUrlTemplate=i.create_chat_room_url,se.profileDetailUrlTemplate=i.profile_detail_url_template,se.profileUrl=i.profile_url,((e,t)=>{if(e)return mi({accessToken:e});{let e=se.storageStrategy.get();return e?mi({accessToken:e.access_token}):vi({nickname:t})}})(e.accessToken,e.nickName).then((r=>{se.storageStrategy.set(r),Object.assign(ce,r);const o={subscribeKey:i.pubnub_subscribe_key,origin:i.pubnub_origin,authKey:r.access_token};i.pubnub_heartbeat_interval&&(o.heartbeatInterval=i.pubnub_heartbeat_interval),i.pubnub_presence_timeout&&(o.presenceTimeout=i.pubnub_presence_timeout);const s=e.publishKey||i.pubnub_publish_key;s&&(o.publishKey=s);const a=()=>{se.ready=!0,ae.ready=!0,t(r)},c=-1!==Object.keys(o).findIndex((e=>se.pn&&se.pn._config[e]!==o[e]));!se.pn||c?(e=>(se.logger&&console.table(Object.assign(Object.assign({},e),{profileToken:ce.access_token})),xe=new _e(Object.assign(Object.assign({},e),{uuid:ce.id,restore:!0,ssl:!0})),se.pn=xe,Promise.resolve()))(o).then((()=>{!n&&zt.initialize(),a()})):a()}))}))))})),getMessageCount:(e,t)=>new Promise(((n,i)=>{e||ht("roomId","messagecount");let r=null;if(t&&t.since)if(Pt(t.since)){const e=new Date(t.since).getTime();r=String(e)+"0011"}else i(dt("messageCount","since","Date"));it(e).then((t=>((e,t)=>xe.history({channel:e,stringifiedTimeToken:!0,end:t,count:100}))(t,r).then((t=>{console.log("get history r.messages",t),n({roomId:e,count:Ye(e,t.messages).length})}))))})),getMessageList:Qt,sendMessage:tn,prepareOutgoingChatMessage:(e,t)=>en[e]=t,updateUserProfile:e=>e.accessToken?gi("patch",e.options,e.accessToken).then((t=>(t.access_token=e.accessToken,t.id===ce.id&&(se.storageStrategy.set(t),ce.nickname=t.nickname,Object.assign(ce,t)),t))):ht("accessToken","updateuserprofile"),registerWidgetMode:Bt,getWidget:$t,getPostedWidgets:({programId:e})=>Dt({programId:e}).then((e=>ot(["widgets","widget_interactions_url_template"],e))),addWidgetListener:(e,t)=>nt(e.programId).then((n=>bt.add(n.subscribe_channel,e.programId,t,{message:i=>i.channel===n.subscribe_channel&&t({event:i.message.event,widgetPayload:i.message.payload,programId:e.programId})}))),removeWidgetListener:(e,t)=>bt.remove(e.programId,t),createChatRoom:e=>e&&e.visibility&&"members"!==e.visibility&&"everyone"!==e.visibility?Promise.reject("Invalid value for visibility"):Me.post({url:se.createChatUrlTemplate,data:e}).then(bi),updateChatRoom:(e,t)=>ki({roomId:e}).then((e=>Me.patch({url:e.url,data:t}).then(bi))),getChatRoom:e=>ki(e).then(bi),joinChatRoom:e=>_i(e,"post"),leaveChatRoom:e=>_i(e,"delete").then(wi),getChatUserMutedStatus:e=>ki(e).then((e=>fetch(Je(ce.id,e.muted_status_url_template)).then((e=>e.json())))),getChatRoomMemberships:e=>_i(e,"get"),getProfileChatRoomMemberships:()=>Me.get({url:ce.chat_room_memberships_url}),getLeaderboards:e=>e&&e.programId?Ze.program(e.programId).then((e=>e.leaderboards)):ht("programId","leaderbaord"),getLeaderboard:e=>e&&e.leaderboardId?Ze.leaderboard(e.leaderboardId):ht("leaderboardId","leaderboard"),getLeaderboardEntries:e=>(e=>e&&e.leaderboardId?Ze.leaderboard(e.leaderboardId).then((e=>rt(e.entries_url,(e=>Me.get({url:e})),(e=>({count:e.count,entries:e.results}))))):ht("leaderboardId","leaderboard"))(e).then((e=>ot(["entries"],e))),getLeaderboardProfileRank:e=>e&&e.leaderboardId&&e.profileId?Ze.leaderboard(e.leaderboardId).then((t=>Ze.leaderboardEntryDetail(t.entry_detail_url_template,e.profileId))):e&&e.leaderboardId?ht("profileId","leaderboard"):ht("leaderboardId","leaderboard"),applyLocalization:fi,getWidgetInteractions:Ft,getSponsors:e=>e&&e.programId?Ze.program(e.programId).then((e=>e.sponsors)):ht("programId","sponsor"),getProfileBadges:e=>e&&e.profileId?(e=>mi(e).then(yi))(e).then((e=>ot(["results"],e))):ht("profileId","getProfileBadges"),getApplicationBadges:()=>et().then((e=>ot(["results"],yi(e)))),getBadgeProgress:e=>e&&e.profileId&&e.badgeIds&&e.badgeIds.length>0?mi(e).then((t=>Me.get({url:t.badge_progress_url+"?badge_id="+e.badgeIds.join("&badge_id=")}))):e&&e.profileId?ht("badgeIds","getBadgeProgress"):ht("profileId","getBadgeProgress")};window.LiveLike=Wr,window.ProgramDateTimeSyncStrategy=ni,window.HlsJsSyncStrategy=class extends ni{constructor(e,t){super(),this.hls=e,this.video=t,this.level=null,this.frag=null,this.hls.on(ei,((e,t)=>{this.level=this.hls.levels[t.level]})),this.hls.on(ti,((e,t)=>{this.frag=t.frag}))}get baseProgramDateTimeMs(){return this.frag?this.frag.programDateTime:this.level?this.level.details.fragments[0].programDateTime:void 0}get fragmentStartMs(){return this.frag?1e3*this.frag.start:this.level?1e3*this.level.details.fragments[0].start:void 0}get videoCurrentTimeMs(){return 1e3*this.video.currentTime}get programDateTime(){if(this.level){let e=this.baseProgramDateTimeMs+this.videoCurrentTimeMs-this.fragmentStartMs;return new Date(e)}}},window.html=D,window.property=X,window.LiveLikeWidgetElement=class extends Lt{},window.LiveLikeWidget=Xt,window.LiveLikeWidgetMixin=e=>class extends e{connectedCallback(){super.connectedCallback(),this.setupWidget()}},window.LiveLikePoll=Oi,window.LiveLikeQuiz=Ci,window.LiveLikePrediction=Ai,window.LiveLikeFollowUp=Ri,window.LiveLikeAlert=Li,window.LiveLikeEmojiSlider=Ii,window.LiveLikeSocialEmbed=Ki,window.LiveLikeRichPost=zi,window.LiveLikeCheerMeter=Qi,window.LiveLikeVideoAlert=or,window.LiveLikeDescription=cr,window.LiveLikeDismissButton=ur,window.LiveLikeImage=Xi,window.LiveLikeOption=Wi,window.LiveLikePercentage=mr,window.LiveLikeProgress=br,window.LiveLikeSelect=_r,window.LiveLikeTimer=xr,window.LiveLikeTitle=Cr,window.LiveLikeVoteCount=Rr,window.LiveLikeWidgetBody=jr,window.LiveLikeWidgetBylines=Nr,window.LiveLikeWidgetFooter=Ir,window.LiveLikeWidgetHeader=$r,window.LiveLikeWidgetRoot=Fr,window.LiveLikeDuelingProgress=zr,window.LiveLikeTextAsk=Gr,window.LiveLikeVideo=ir;
|
|
203
|
+
const Cn=new WeakMap,En=(Rn=e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTML can only be used in text bindings");const n=Cn.get(t);if(void 0!==n&&P(e)&&e===n.value&&t.value===n.fragment)return;const i=document.createElement("template");i.innerHTML=e;const r=document.importNode(i.content,!0);t.setValue(r),Cn.set(t,{value:e,fragment:r})},(...e)=>{const t=Rn(...e);return g.set(t,!0),t});var Rn;var An=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Mn=class extends kn{constructor(){super(...arguments),this.message=null,this.animation=0,this.selectedMessage=null,this.selectedReactions=null,this.isDeleted=!1,this.messageDeleted=e=>{const t=this.owner.localize("chat.messageDeleted");this.message&&e.message&&e.message.id===this.message.id&&(this.isDeleted=!0,this.message=Object.assign(Object.assign({},this.message),{image_url:null,message:t,filtered_message:t}))},this.ownerUpdated=e=>{"deletedMessages"===e.name&&this.messageDeleted({message:e.prop[e.prop.length-1]})},this.renderMessageMenu=e=>D`<message-menu .menu="${this.owner.messageMenuFunc(e)}" .message="${e}" .animation="${this.animation}" .closeMenu="${()=>mn(this,"selectedMessage")}"></message-menu>`,this.renderMenuButton=(e,t)=>this.owner.messagemenus&&!this.isDeleted&&this.owner.messageMenuFunc(t)&&this.owner.messageMenuFunc(t).length?D`<div class="menu-button-container"><button aria-label="${this.owner.localize("chat.messageMenu.ariaLabel")}" class="more-icon ${e}" @click="${()=>yn(this,t.id,"selectedMessage")}">${cn}</button></div>`:null,this.renderTimestamp=e=>{const t=e.timetoken&&e.timetoken.slice(0,e.timetoken.length-4),n=He(Number(t),this.owner.timeformat,this.owner.lang);return D`<time aria-label="${n}" class="message-timestamp" datetime="${t}">${n}</time>`},this.reactionAction=e=>{const t=this.message.reactions[e.id]&&this.message.reactions[e.id].find((e=>e.uuid===ce.id)),n=()=>mn(this,"selectedReactions"),i={value:e.id,uuid:ce.id,messageTimetoken:this.message.timetoken,actionTimetoken:t&&t.actionTimetoken||null},r=(t,r)=>{this.owner[t]({messageId:this.message.id,reactionId:e.id}).then(n),this.owner.updateReaction(i,r)};t?r("removeMessageReaction","reactionremoved"):r("addMessageReaction","reactionadded")},this.getReactionCount=e=>this.message.reactions[e.id]?this.message.reactions[e.id].length:0,this.renderMiniReactions=()=>((e,t,n)=>D`<div class="mini-reactions">${n.map((e=>t(e)>0?D`<img class="mini-reaction-image" src="${e.file}" alt="Reaction ${e.name}">`:null))} ${e>0?D`<span class="mini-reaction-count">${bn(e)}</span>`:null}</div>`)(Object.values(this.message.reactions).reduce(((e,t)=>e.concat(t)),[]).length,this.getReactionCount,this.owner.reactionPack),this.renderReactions=()=>{const e=e=>this.message.reactions[e.id]&&this.message.reactions[e.id].find((e=>e.uuid===ce.id));return((e,t,n,i,r,o,s)=>D`<div class="reaction-item-container" style="opacity:${t}"><div class="reaction-item-wrap">${e.map((e=>{const t=i(e);return D`<button aria-label="${o?vt(o,s||"en-US",{reactionName:e.name}):"Reaction "+e.name}" class="reaction-item ${n(e)}" @click="${()=>r(e)}"><img class="reaction-image" src="${e.file}" alt=""> ${t>0?D`<span class="reaction-count">${bn(t)}</span>`:null}</button>`}))}</div></div>`)(this.owner.reactionPack,this.animation,(t=>e(t)?"selected":""),this.getReactionCount,this.reactionAction,"chat.reactions.reactionSelectionButton.ariaLabel",this.owner.lang)},this.renderAvatar=()=>D`<div class="avatar">${this.message.sender_image_url?D`<img src="${this.message.sender_image_url}" alt="Avatar" @error="${()=>{this.message=Object.assign(Object.assign({},this.message),{sender_image_url:null})}}">`:un}</div>`,this.trackClickEvent=e=>{if(e.target&&e.target.href){const t=this.message;t.messageLink=e.target.href,Se(t,this.owner.roomid,"Chat Message Link Clicked")}},this.buildMessage=(e,t,n,i)=>((e,t,n,i)=>{const r=t?t.reduce(((e,t)=>e.concat(t.stickers)),[]):[];if(e.image_url)return D`<div class="image-message-container"><img class="image-message" width="${e.image_width}" height="${e.image_height}" src="${e.image_url}" alt="Chat image"></div>`;if(e.message){let t=e.message;n&&i&&i.length>0&&i.forEach((e=>{t=t.replace(e,(e=>{const t=0!==e.indexOf("http")?"//"+e:e;return`<a class="livelike-message-link" title="${t}" target="_blank" href="${t}">${e}</a>`}))}));const o=/:[^\/\/]([^:]*):/g,s=0===t.indexOf(":"),a=(t.match(o)||[]).length>1||t.split(" ").length>1?"22px":"32px";return t=t.replace(o,(e=>{const t=r&&r.find((t=>t.shortcode===e.slice(1,-1)));return t?`\n <span style="margin: 0 4px 0 ${s?"0":"4px"};">\n <img\n class="word-item"\n height=${a}\n src=${t.file}\n alt=${t.shortcode}\n />\n </span>\n `:e})),En(t)}})(e,t,n,i)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Se(this.message,this.owner.roomid,"Chat Message Displayed")}render(){const e=this.owner.blockList.find((e=>e===this.message.sender_id)),t=this.selectedMessage===this.message.id,n=t?"active":"",i=this.message.sender_id===ce.id?"self":"",r=this.owner.showavatar?"has-avatar":"",o=this.isDeleted?"deleted":"";return e?null:D`${nn} ${pn}<div class="message-item-container ${n} ${i}">${this.owner.showavatar?this.renderAvatar():null}<div class="message-wrapper ${r}" tabindex="0">${this.owner.reactionPack&&this.owner.reactionPack.length>0?this.renderMiniReactions():null}<div aria-live="polite" role="log"><div class="sender-name" aria-label="${this.message.sender_nickname}">${this.message.sender_nickname}</div><div @click="${this.trackClickEvent}" aria-label="${this.message.image_url?this.message.image_url:this.message.message}" id="senderMessage-${this.message.id}" class="sender-message ${o}">${this.buildMessage(this.message,this.owner.stickerPacks,this.owner.messageurls,this.owner.messageUrlPatterns)}</div>${this.owner.timestamps?this.renderTimestamp(this.message):null}</div>${this.owner.reactionPack&&this.owner.reactionPack.length>0&&!this.isDeleted?(s=this,a=this.message.id,c="chat.reactions.openButton.ariaLabel",D`<div class="reaction-button-container"><button class="reaction-button" aria-label="${c?s.owner.localize(c):"Open Reactions"}" @click="${()=>yn(s,a,"selectedReactions")}"></button></div>`):null}</div>${this.selectedReactions===this.message.id?this.renderReactions():null} ${t?this.renderMessageMenu(this.message):null} ${this.renderMenuButton(n,this.message)}</div>`;var s,a,c}};An([X({type:Object})],Mn.prototype,"message",void 0),An([X({type:Number})],Mn.prototype,"animation",void 0),An([X({type:String})],Mn.prototype,"selectedMessage",void 0),An([X({type:String})],Mn.prototype,"selectedReactions",void 0),An([X({type:Boolean})],Mn.prototype,"isDeleted",void 0),Mn=An([qt("livelike-message-item")],Mn);let jn=class extends kn{constructor(){super(...arguments),this.appendMessage=e=>{const t=e.detail.message;if(t.message||t.image_url||t.custom_data&&this.owner.customMessageRenderer){const e=t.custom_data&&this.owner.customMessageRenderer?this.owner.customMessageRenderer({message:t}):document.createElement("livelike-message-item");e.message=t,e.owner=this.owner;const n=this.scrollTop+this.clientHeight===this.scrollHeight;this.appendChild(e);(e.updateComplete?e:this).updateComplete.then((()=>(t.sender_id===ce.id||n)&&this.scrollToBottom()))}},this.softKeyboardHandler=ze((()=>this.scrollTop+this.clientHeight===this.scrollHeight&&this.scrollToBottom())),this.scrollListener=ze((()=>{st.emit("userScrolled",{key:this.owner.dataId,scrolled:this.scrollTop+this.clientHeight+10<this.scrollHeight})})),this.scrollToBottom=()=>this.scrollTop=this.scrollHeight+1e4,this.scrollToBottomListener=e=>e.key===this.owner.dataId&&this.scrollToBottom()}connectedCallback(){this.addEventListener("scroll",this.scrollListener),st.on("scrollDown",this.scrollToBottomListener),window.addEventListener("resize",this.softKeyboardHandler),super.connectedCallback(),this.setAttribute("role","log"),this.owner.addEventListener("message-ready",this.appendMessage)}disconnectedCallback(){st.off("scrollDown",this.scrollToBottomListener),this.removeEventListener("scroll",this.scrollListener),this.owner.removeEventListener("message-ready",this.appendMessage),window.removeEventListener("resize",this.softKeyboardHandler),super.disconnectedCallback()}render(){return D`<style>:host{display:block;overflow:auto}</style><slot></slot>`}};jn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-message-list")],jn);const Ln=()=>"\n :host {\n display: flex;\n }\n livelike-chat-composer {\n display: flex;\n position: relative;\n flex-shrink: 0;\n }\n .livelike-chat-input {\n border: 0;\n background: #fff;\n box-sizing: border-box;\n border-radius: 0.5rem;\n color: inherit;\n font-size: 1rem;\n font-family: inherit;\n line-height: 1.5rem;\n height: 40px;\n min-height: 2.5rem;\n overflow: hidden;\n padding: 0.5rem 5rem 0.5rem 0.5rem;\n resize: none;\n width: 100%;\n }\n .livelike-chat-input:focus {\n outline: none;\n border: 1px solid rgba(255, 255, 255, 0.2);\n }\n .livelike-chat-input::placeholder {\n color: rgba(0, 0, 0, 0.35);\n }\n .send-button {\n background: none;\n border: none;\n padding: 0;\n margin-left: 1rem;\n display: flex;\n align-items: center;\n transition: all 0.3s ease-out;\n }\n .send-icon {\n border: none;\n background: none;\n }\n .send-icon svg {\n fill: #777;\n }\n .send-icon:hover svg, .send-icon:focus svg {\n filter: invert(1);\n transition: all 0.3s ease-out;\n }\n .send-icon:hover {\n cursor: pointer;\n }\n .sticker-picker-container {\n position: absolute;\n border: none;\n background: none;\n right: 2rem;\n bottom: 0.5rem;\n transition: all 0.3s ease-out;\n }\n",Nn=D`<style>.sticker-nav-container{position:relative;background:#282828;height:40px;width:100%;border-radius:0 0 8px 8px;overflow:scroll;min-width:15rem}.sticker-nav-wrap{display:flex;list-style-type:none;padding:0;margin:0}.sticker-nav-item{border:none;background:rgba(255,255,255,0);transition:all .2s;padding:10px}.sticker-nav-item.active{background:#141414;border-radius:0 0 8px 8px}.sticker-nav-item:hover{cursor:pointer}.sticker-nav-item img{width:20px;height:20px;vertical-align:middle;border:0}</style>`,Un=D`<style>@keyframes slideIn{from{opacity:0;transform:translate3d(0,-1rem,0)}to{opacity:1;transform:translate3d(0,-.5rem,0)}}.sticker-icon{border:none;background:0 0;padding:1px 6px}.sticker-icon:hover{cursor:pointer}.sticker-icon svg{fill:#888}.sticker-container{position:absolute;bottom:4rem;opacity:0;transition:all ease .3s;z-index:21;right:0;max-width:20rem}.sticker-container.show{opacity:1;transition:all ease .3s}.sticker-container.hide{opacity:0;transition:all ease .3s}.sticker-container-header{position:relative;border-radius:.5rem .5rem 0 0;background:#141414;padding:.625rem 1rem;color:#fff;font-size:1rem;font-weight:700}.sticker-close-icon{border:none;background:0 0;position:relative;float:right;top:-1px;right:0;background-size:contain;width:1.25rem;height:1.25rem;cursor:pointer}.sticker-body{position:relative;background:#141414;padding:.625rem .3rem;display:flex;justify-content:flex-start;flex-wrap:wrap;overflow-y:auto;min-height:8rem;max-height:8rem}.sticker-wrap{border:none;color:#fff;padding-left:0 .625rem;width:3.75rem;background:0 0;border-radius:.75rem;transition:all ease .3s;margin:0 auto .625rem auto}.sticker-wrap:focus,.sticker-wrap:hover{outline:0;background:#818592;cursor:pointer}.sticker-image{width:100%;vertical-align:middle}</style>`;var In=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Dn=class extends kn{constructor(){super(...arguments),this.drawerOpen=!1,this.animation=0,this.keyedLocalize=(e,t)=>this.owner.localize(this.localizationKey+e,t),this.closeDrawer=()=>{at(this,"drawer-closed"),mn(this,"drawerOpen")},this.stickerBody=()=>this.stickers&&this.stickers.map((e=>D`<button tabindex="0" type="button" class="sticker-wrap" aria-label="${this.keyedLocalize(".stickerSelectionButton.ariaLabel",{stickerName:e.shortcode||e.title})}" @click="${()=>{at(this,"sticker-selected",{sticker:e}),this.closeDrawer()}}"><div class="sticker-wrap-image"><img class="sticker-image" src="${e.file||e.images.preview_gif.url}" alt="${e.shortcode||e.title}"></div></button>`)),this.renderStickerDrawer=()=>{const e=this.title||this.keyedLocalize(".title");return D`<div class="sticker-container" style="opacity:${this.animation}" aria-label="${e}"><header class="sticker-container-header"><span class="title">${e}</span> <button tabindex="0" type="button" class="sticker-close-icon" aria-label="${this.keyedLocalize(".closeButton.ariaLabel")}" @click="${this.closeDrawer}">${ln}</button></header><div class="sticker-body">${this.stickerBody()}</div>${this.navFooterTemplate?this.navFooterTemplate():null}</div>`}}createRenderRoot(){return this}render(){return D`${Un} <button tabindex="0" type="button" class="sticker-icon" aria-label="${this.keyedLocalize(".openButton.ariaLabel")}" @click="${()=>{yn(this,this.owner.dataId,"drawerOpen"),setTimeout((()=>{at(this,"drawer-opened")}),50)}}">${this.buttonIcon}</button> ${this.drawerOpen?this.renderStickerDrawer():null}`}};In([X({type:Array})],Dn.prototype,"stickers",void 0),In([X({type:String})],Dn.prototype,"buttonIcon",void 0),In([X({type:Function})],Dn.prototype,"onStickerClick",void 0),In([X({type:String,reflect:!0})],Dn.prototype,"title",void 0),In([X({type:Boolean})],Dn.prototype,"drawerOpen",void 0),In([X({type:String})],Dn.prototype,"animation",void 0),In([X({type:String})],Dn.prototype,"localizationKey",void 0),Dn=In([qt("livelike-stickers")],Dn);var Bn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let $n=class extends kn{constructor(){super(...arguments),this.selectedPack="",this.changePack=e=>{this.selectedPack=e&&e.id,this.selectedStickers=e&&e.stickers},this.stickerNav=()=>this.owner.stickerPacks&&this.owner.stickerPacks.map((e=>{const t=e.id===this.selectedPack?"active":"";return D`<button tabindex="0" type="button" aria-label="${this.owner.localize("chat.stickerPicker.stickerPackTab.ariaLabel",{packName:e.name})}" class="sticker-nav-item ${t}" @click="${()=>this.changePack(e)}"><img src="${e.file}" alt="${e.name}"></button>`})),this.stickerNavFooter=()=>D`<nav slot="sticker-drawer-footer" class="sticker-nav-container"><div class="sticker-nav-wrap">${this.stickerNav()}</div></nav>`}createRenderRoot(){return this}ownerUpdated(e){!this.selectedStickers&&"stickerPacks"===e.name&&this.owner.stickerPacks&&this.owner.stickerPacks[0]&&this.changePack(this.owner.stickerPacks[0])}render(){return D`${Nn} ${this.owner.stickerPacks&&this.owner.stickerPacks.length?D`<livelike-stickers .localizationKey="${"chat.stickerPicker"}" .stickers="${this.selectedStickers}" .buttonIcon="${an}" @drawer-opened="${()=>{}}" .navFooterTemplate="${this.stickerNavFooter}"></livelike-stickers>`:null}`}};Bn([X({type:String})],$n.prototype,"selectedPack",void 0),Bn([X({type:Array})],$n.prototype,"selectedStickers",void 0),$n=Bn([qt("livelike-sticker-picker")],$n);var Fn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Kn=class extends kn{constructor(){super(...arguments),this.message="",this.giphyList=[],this.offset=0,this.isDoneFetching=!0,this.loading=!1,this.scrollListenerAdded=!1,this.fetchNextPageIfBottom=ze((()=>{const e=this.querySelector(".sticker-body");!(e&&e.scrollHeight-e.scrollTop===e.clientHeight)||this.isDoneFetching||this.loading||this.fetchGifs()})),this.fetchGifs=()=>{this.loading=!0,fetch(`https://api.giphy.com/v1/gifs/search?q=${this.message}&api_key=jlvX8uZILp5PhutmuW6fdATBP3E5uayi&offset=${this.offset}&rating=g`).then((e=>e.json())).then((e=>{this.loading=!1,this.giphyList=[...this.giphyList,...e.data],this.offset=e.pagination?e.pagination.count+e.pagination.offset:0,this.isDoneFetching=!e.pagination||this.offset===e.pagination.total_count}))},this.onStickerClick=e=>tn({image_url:e.detail.sticker.images.downsized.url,image_width:e.detail.sticker.images.downsized.width,image_height:e.detail.sticker.images.downsized.height,roomId:this.owner.roomid,sender_image_url:this.owner.avatarurl,timestamp:this.owner.syncStrategy&&this.owner.syncStrategy.currentTimecode?this.owner.syncStrategy.currentTimecode:null}),this.debouncedInputEvent=ze((()=>{this.offset=0,this.giphyList=[],this.fetchGifs()})),this.handleMessage=e=>{this.message=e.target.value,this.debouncedInputEvent()},this.handleOpen=e=>{const t=e.target.querySelector(".sticker-body");t&&t.addEventListener("scroll",this.fetchNextPageIfBottom)},this.handleClose=e=>{this.message="",this.giphyList=[],this.offset=0;const t=e.target.querySelector(".sticker-body");t&&t.removeEventListener("scroll",this.fetchNextPageIfBottom)},this.stickerNavFooter=()=>D`<nav slot="sticker-drawer-footer" class="sticker-nav-container"><div class="sticker-nav-wrap"><input type="text" maxlength="25" style="height:25px" class="livelike-chat-input livelike-giphy-input" placeholder="${this.owner.localize("chat.giphyPicker.placeholder")}" @input="${this.handleMessage}" .value="${this.message}"></div></nav>`}createRenderRoot(){return this}render(){return D`${Nn}<livelike-stickers .localizationKey="${"chat.giphyPicker"}" .stickers="${this.giphyList}" .buttonIcon="${dn}" @sticker-selected="${this.onStickerClick}" @drawer-opened="${this.handleOpen}" @drawer-closed="${this.handleClose}" .navFooterTemplate="${this.stickerNavFooter}"></livelike-stickers>`}};Fn([X({type:String})],Kn.prototype,"message",void 0),Fn([X({type:Array})],Kn.prototype,"giphyList",void 0),Fn([X({type:Number})],Kn.prototype,"offset",void 0),Fn([X({type:Boolean})],Kn.prototype,"isDoneFetching",void 0),Fn([X({type:Boolean})],Kn.prototype,"loading",void 0),Fn([X({type:Boolean})],Kn.prototype,"scrollListenerAdded",void 0),Kn=Fn([qt("livelike-giphy-picker")],Kn);var qn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let zn=class extends kn{constructor(){super(...arguments),this.defaultStyles=Ln,this.message="",this.ownerUpdated=e=>{"placeholder"===e.name&&(this.placeholder=e.prop),("lang"===e.name||"translations"===e.name)&&this.updateLocalizedPlaceholder()},this.updateLocalizedPlaceholder=()=>{if(!this.placeholder){const e=this.owner.localize("chat.inputPlaceholder");this.inputEl.placeholder=e,this.inputEl.setAttribute("aria-label",e)}this.sendBtn.setAttribute("aria-label",this.owner.localize("chat.sendButton.ariaLabel"))},this.sendClickHandler=()=>{this.message&&(at(this,"sendChatMessage",{message:this.message}),this.message="",this.inputEl.value="",this.resize("40px"))},this.addSticker=e=>{e.detail.sticker&&e.detail.sticker.shortcode&&this.message.length+e.detail.sticker.shortcode.length<=200&&(this.message=this.message+`:${e.detail.sticker.shortcode}:`,this.inputEl.value=this.message,this.inputEl.focus())},this.handleMessage=e=>{void 0!==e.target.value&&(this.message=e.target.value),this.resize(""===e.target.value?"40px":null)},this.handleKeyDown=e=>{13!==e.which||e.shiftKey||(e.preventDefault(),this.sendClickHandler())},this.resize=e=>{this.inputEl.style.height=e||`${this.inputEl.scrollHeight}px`}}get inputEl(){return this.querySelector("[slot=body]")}get sendBtn(){return this.querySelector("[slot=send]")}updated(e){e.forEach(((e,t)=>{"placeholder"===t&&(this.inputEl.placeholder=this.placeholder,this.inputEl.setAttribute("aria-label",this.placeholder))}))}connectedCallback(){super.connectedCallback(),this.addEventListener("sticker-selected",this.addSticker);const e=this.placeholder||this.owner.placeholder||this.owner.localize("chat.inputPlaceholder");this.insertAdjacentHTML("beforeend",`<textarea slot="body" class="livelike-chat-input" maxlength="200" placeholder="${e}" aria-label="${e}"></textarea>`),this.insertAdjacentHTML("beforeend",'<div slot="body" class="sticker-picker-container">\n <livelike-sticker-picker></livelike-sticker-picker>\n <livelike-giphy-picker></livelike-giphy-picker>\n </div>'),this.insertAdjacentHTML("beforeend",`<button slot="send" aria-label="${this.owner.localize("chat.sendButton.ariaLabel")}" class="send-icon">\n \n <svg width="16" height="16" viewBox="0 0 16 16">\n <path fill-rule="nonzero" d="M.579.29l14.705 7.352a.4.4 0 0 1 0 .716L.58 15.71A.4.4 0 0 1 0 15.353V10.47a1 1 0 0 1 .863-.99L8.71 8.396a.4.4 0 0 0 0-.792L.863 6.519A1 1 0 0 1 0 5.53V.647A.4.4 0 0 1 .579.29z"/>\n </svg>\n </button>`)}disconnectedCallback(){this.removeEventListener("sticker-selected",this.addSticker),super.disconnectedCallback()}render(){return D`<slot name="body" @input="${this.handleMessage}" @keydown="${this.handleKeyDown}"></slot><slot @click="${this.sendClickHandler}" name="send"></slot><slot></slot>`}};qn([X({type:String,reflect:!0})],zn.prototype,"placeholder",void 0),qn([X({type:String})],zn.prototype,"message",void 0),zn=qn([qt("livelike-chat-composer")],zn);const Hn=()=>"\n <style>\n @keyframes slideDown {\n from {\n opacity: 0;\n transform: translate3d(0, -3rem, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0rem, 0);\n }\n }\n\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translate3d(0, 0rem, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, -2rem, 0);\n }\n }\n\n .down-icon {\n z-index: 15;\n position: absolute;\n border: none;\n right: 3.75rem;\n bottom: 5.5rem;\n padding: 0;\n border-radius: 50%;\n height: auto;\n width: auto;\n display: none;\n flex-direction: column;\n animation: slideDown 0.5s ease forwards;\n transition: all 0.3s ease;\n }\n .down-icon.show {\n display: flex;\n animation: slideUp 0.5s ease forwards;\n }\n .down-icon:hover {\n cursor: pointer;\n transition: all 0.3s ease;\n }\n .down-icon svg > rect {\n fill: #b0b0b0;\n }\n .down-icon svg > path {\n fill: #fff;\n }\n </style>\n";var Vn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Gn=class extends kn{constructor(){super(...arguments),this.defaultStyles=Hn,this.userScrolled=!1,this.ownerUpdated=e=>{("translations"===e.name||"lang"===e.name)&&this.updateLocalizedStrings()},this.setScrolled=e=>{if(e.key===this.owner.dataId){const t=this.querySelector(".down-icon"),n=e.scrolled?"down-icon show":"down-icon";t&&t.setAttribute("class",n)}},this.scrollDown=()=>st.emit("scrollDown",{key:this.owner.dataId}),this.updateLocalizedStrings=()=>{this.querySelector("button.down-icon").setAttribute("aria-label",this.owner.localize("chat.scrollDownButton.ariaLabel"))}}connectedCallback(){super.connectedCallback(),st.on("userScrolled",this.setScrolled),this.addEventListener("click",this.scrollDown),this.insertAdjacentHTML("beforeend",`<button tabindex="0" aria-label="${this.owner.localize("chat.scrollDownButton.ariaLabel")}" class="down-icon">\n <svg width="25px" height="25px" viewBox="0 0 30 30">\n <rect id="snap-to-live-button" fill="#FFFFFF" x="0" y="0" width="30" height="30" rx="15"></rect>\n <path d="M15.0326453,21 C14.7426596,21 14.4527097,20.8852999 14.2316216,20.6563819 L7.2744003,13.4491933 C6.83183015,12.9907267 6.83183015,12.2787537 7.97485699,11.4850649 C9.11788383,10.6913761 9.53369152,11.0267838 9.97629747,11.4850649 L15.0326453,16.7405562 L20.0890468,11.4850649 C20.5316169,11.0267838 21.1431577,10.6735312 22.0549346,11.4850649 C22.9667115,12.2965986 23.2335678,12.9909492 22.7907828,13.4494158 L15.8336689,20.6566045 C15.6124734,20.8855596 15.3225235,21 15.0326453,21 Z" id="ic_arrowDown" fill="#23282D"></path>\n </svg></button>`)}render(){return D`<slot></slot>`}};Vn([X({type:Boolean})],Gn.prototype,"userScrolled",void 0),Gn=Vn([qt("livelike-scroll-down")],Gn);var Wn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Yn=class extends oe{constructor(){super(...arguments),this.dataId=Oe(),this.deletedMessages=[],this.hidecomposer=!1,this.loaded=!1,this.timestamps=!1,this.messagemenus=!1,this.blockList=ce.blockList||[],this.messageList=["Loading"],this.timeformat={month:"short",day:"numeric",hour:"numeric",minute:"numeric"},this.messageUrlPatterns=[/((https?):\/\/|www\.)?([-A-Z0-9._\+~#=]*)\.[a-z]{2,}\b([-A-Z0-9@%_\+.~#?&://=]*)/gi],this.translations=se.localizedStrings,this.updateLocalization=e=>this.translations=e.localizedStrings,this.sendChatMessage=e=>{const t=t=>at(this,t,{message:e.detail.message,roomId:this.roomid});e.detail.message&&e.detail.message.match(/([^\n]+\n)*[^\n]+/g)&&tn({message:e.detail.message,roomId:this.roomid,sender_image_url:this.avatarurl,timestamp:this.syncStrategy&&this.syncStrategy.currentTimecode?this.syncStrategy.currentTimecode:null}).then((()=>t("messagesent"))).catch((()=>{this.displayModal("muted"),t("messagefailed")}))},this.connectChat=()=>{se.ready&&ce&&ce.id?(this.loaded=!1,this.syncStrategy?this.queue=Zt(this.syncStrategy):this.syncStrategy=wt(se.syncStrategy),tt(this.roomid).then((e=>{var t;this.channel=e.channels.chat.pubnub,zt.subscribe(this.channel),(t=this.roomid,mt(t,"reactionPack","reaction_packs_url")).then((e=>this.reactionPack=e[0]&&e[0].emojis?e[0].emojis:e)),(e=>mt(e,"stickerPacks","sticker_packs_url"))(this.roomid).then((e=>this.stickerPacks=e)),this.loaded=!0,at(this,"roomentered",{room:this,roomId:this.roomid}),this.getMessages()}))):setTimeout(this.connectChat,1e3)},this.demultiplex=e=>{const t=Ne[e.event];"messagereceived"===t&&this.messageReceived(e,this.updateEl),("reactionremoved"===t||"reactionadded"===t)&&this.updateReaction(e.message,t),"messagedeleted"===t&&this.messageDeleted(e),at(this,t,{message:e.message,roomId:this.roomid})},this.getMessages=()=>{const e=this.querySelector("livelike-message-list");return e&&e.remove(),Qt(this.roomid).then((e=>{this.messageList=["No Messages"],this.appendElements((()=>{e.messages&&e.messages.length>0&&_t(this,(()=>{e.messages.forEach((e=>this.messageReceived({message:e}))),this.updateEl()}))})),at(this,"messagehistory",{messages:e.messages})}))},this.updateReaction=(e,t)=>{if(this.messageList){const n=[...this.messageList],{messageTimetoken:i,actionTimetoken:r,uuid:o,value:s}=e,a=n.findIndex((e=>e.timetoken===i));if(-1!==a){let e=n[a].reactions[s];const i=e=>e.uuid===ce.id,c=e=>e.actionTimetoken===r,l=e=>n[a].reactions[s].findIndex(e),u=()=>o===ce.id?l(i):l(c);if("reactionadded"===t){!e&&(n[a].reactions[s]=[]);let t=u();-1===t||o!==ce.id?n[a].reactions[s].push({uuid:o,actionTimetoken:r}):n[a].reactions[s][t].actionTimetoken=r}if("reactionremoved"===t){let e=u();-1!==e&&n[a].reactions[s].splice(e,1)}this.messageList=n}}},this.handleMessageReaction=(e,t,n)=>new Promise(((i,r)=>{const o=e=>r(console.error(e)),s={"Chat Room ID":this.roomid,"Chat Message ID":e,"Chat Reaction ID":t},a=e=>Re[n](this.channel,c.timetoken,e,s,i,o),c=this.messageList.find((t=>t.id===e));if(!c&&o("Could not find message for reaction action."),"remove"===n){const e="Reaction not deleted. Reaction not found.";!c.reactions[t]&&o(e);let n=c.reactions[t].find((e=>e.uuid===ce.id));n?a(n.actionTimetoken):o(e)}else this.reactionPack.find((e=>e.id===t))?a({type:"rc",value:t}):o("Reaction not added. Reaction not found")})),this.addMessageReaction=({messageId:e,reactionId:t})=>this.handleMessageReaction(e,t,"add"),this.removeMessageReaction=({messageId:e,reactionId:t})=>this.handleMessageReaction(e,t,"remove"),this.messageReceived=(e,t)=>{-1===Array.from(this.querySelectorAll("livelike-message-item")).findIndex((t=>t.id===e.message.id))&&We(this.roomid,e.message)&&this.queue&&this.queue.enqueueItem({payload:e.message},t)},this.messageDeleted=e=>{const t=this.messageList.findIndex((t=>String(e.message.id)===String(t.id)));-1!==t&&(this.deletedMessages=Be(this.deletedMessages,this.messageList[t]),at(this,Ne[e.event],{message:e.message,roomId:this.roomid}))},this.updateEl=()=>{kt(this,(()=>!0),(e=>{let t=e.payload;t&&!t.reactions&&(t.reactions={}),this.messageList&&"string"==typeof this.messageList[0]?this.messageList=[t]:this.messageList=Be(this.messageList,t),at(this,"message-ready",{message:t,element:this})}))},this.registerMessageMenu=e=>{let t=!1;if(e({}).map((e=>e.items&&e.items.map((e=>e.items&&(t=!0))))),t)return pt("Message menu currently supports submenus only one level deep.");this.messageMenuFunc=e},this.appendElements=e=>{this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("slot[name=message-list]");!(t&&t.assignedNodes({flatten:!0}).filter((e=>1===e.nodeType)).length>0)&&this.insertAdjacentHTML("afterbegin",'<livelike-message-list slot="message-list">\n </livelike-message-list>'),this.insertAdjacentHTML("beforeend",'<livelike-scroll-down slot="snap-to-live"></livelike-scroll-down>'),e&&e()}))},this.localize=(e,t)=>vt(e,this.lang,t),this.reportUser=e=>this.sendReport(e).then((e=>this.displayModal("report",e))),this.sendReport=e=>Me.post({url:se.chatRooms[this.roomid].report_message_url,data:{channel:this.channel,user_id:e.sender_id,nickname:e.sender_nickname,message_id:e.id,message:e.image_url?e.image_url:e.message,profile_id:e.sender_id,pubnub_timetoken:e.timetoken}}),this.blockUser=e=>{if(!this.blockList.find((t=>t===e.sender_id))){const t=this.blockList.slice();t.push(e.sender_id),this.blockList=t,((e,t)=>{let n=se.storageStrategy.get()||{};n[e]=t,se.storageStrategy.set(n)})("blockList",this.blockList),this.sendReport(e).then((e=>this.displayModal("block",e)))}},this.displayModal=(e,t)=>{const n=document.createElement("livelike-modal");n.type=e,n.data=t;this.querySelector("livelike-message-list").append(n),setTimeout((()=>n.remove()),4e3)},this.defaultMessageMenuFunc=e=>{if(e.sender_id!==ce.id){const t=[{label:this.localize("chat.messageMenu.reportMessage"),type:"single",onClick:()=>this.reportUser(e)},{label:this.localize("chat.messageMenu.cancel"),type:"single",onClick:()=>{}}];return-1===this.blockList.findIndex((t=>t===e.sender_id))&&t.unshift({label:this.localize("chat.messageMenu.blockUser"),type:"single",onClick:()=>this.blockUser(e)}),t}}}connectedCallback(){st.on("localizationUpdate",this.updateLocalization),this.addEventListener("sendChatMessage",this.sendChatMessage),this.addEventListener("chat-provider",(e=>{e.detail.provider=this,e.stopPropagation()})),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("sendChatMessage",this.sendChatMessage),zt.removeListener(this.channel,this.demultiplex),st.off("localizationUpdate",this.updateLocalization)}firstUpdated(){this.messageMenuFunc=this.defaultMessageMenuFunc,ft(this),Ve(this),this.style+="display:flex; display: -webkit-box; display: -webkit-flex;display: -ms-flexbox;"}updated(e){e.forEach(((e,t)=>{if("hidecomposer"===t){const e=this.querySelector("livelike-chat-composer"),t=this.shadowRoot.querySelector("slot[name=composer]"),n=t&&t.assignedNodes().length>0;this.hidecomposer?e&&e.remove():!n&&this.insertAdjacentHTML("beforeend",'<livelike-chat-composer slot="composer"></livelike-chat-composer>')}"syncStrategy"===t&&this.syncStrategy&&(this.queue=Zt(this.syncStrategy)),"channel"===t&&this.channel&&(e&&(zt.removeListener(e,this.demultiplex),zt.unsubscribe(e)),zt.addListener(this.channel,this.demultiplex));"roomid"===t&&this.roomid&&(null!=e&&at(this,"roomexited",{roomId:this.roomid}),this.connectChat()),void 0!==this[t]&&null!==this[t]&&st.emit("chat-updated",{name:t,key:this.dataId,prop:this[t],owner:this})}))}render(){return D`<style>:host{display:flex;flex-direction:column;height:100%}</style>${this.loaded&&ce&&ce.id&&this.dataId&&this.roomid?D`${this.messageList&&this.messageList[0]&&"No Messages"===this.messageList[0]?D`<slot name="message-list-empty"></slot>`:null}<slot name="message-list">${this.messageList&&this.messageList[0]&&"Loading"===this.messageList[0]?D`<slot name="message-list-loading"></slot>`:null}</slot><slot name="composer"></slot><slot name="snap-to-live"></slot>`:D`<slot name="chat-element-loading"></slot>`}`}};Wn([X({type:Array})],Yn.prototype,"deletedMessages",void 0),Wn([X({type:String})],Yn.prototype,"channel",void 0),Wn([X({type:String,reflect:!0})],Yn.prototype,"roomid",void 0),Wn([X({type:String,reflect:!0})],Yn.prototype,"lang",void 0),Wn([X({type:String})],Yn.prototype,"placeholder",void 0),Wn([X({type:Boolean})],Yn.prototype,"hidecomposer",void 0),Wn([X({type:Boolean})],Yn.prototype,"loaded",void 0),Wn([X({type:Boolean})],Yn.prototype,"timestamps",void 0),Wn([X({type:Boolean})],Yn.prototype,"messagemenus",void 0),Wn([X({type:Function})],Yn.prototype,"messageMenuFunc",void 0),Wn([X({type:Array})],Yn.prototype,"blockList",void 0),Wn([X({type:Array})],Yn.prototype,"messageList",void 0),Wn([X({type:Object})],Yn.prototype,"syncStrategy",void 0),Wn([X({type:Object})],Yn.prototype,"queue",void 0),Wn([X({type:Array})],Yn.prototype,"stickerPacks",void 0),Wn([X({type:Array})],Yn.prototype,"reactionPack",void 0),Wn([X({type:Object})],Yn.prototype,"timeformat",void 0),Wn([X({type:String})],Yn.prototype,"avatarurl",void 0),Wn([X({type:Boolean})],Yn.prototype,"showavatar",void 0),Wn([X({type:Function})],Yn.prototype,"customMessageRenderer",void 0),Wn([X({type:Boolean})],Yn.prototype,"messageurls",void 0),Wn([X({type:Array})],Yn.prototype,"messageUrlPatterns",void 0),Wn([X({type:Object,hasChanged:()=>!0})],Yn.prototype,"translations",void 0),Yn=Wn([qt("livelike-chat")],Yn);var Jn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Xn=class extends oe{constructor(){super(...arguments),this.owner=document.querySelector(this.getAttribute("for"))||this.parentElement,this.loaded=!0,this.loadPage=()=>{this.loaded&&(this.loaded=!1,this.buttonEl.innerHTML='<div class="loading-spinner"></div>',this.owner.loadNextPage().then((e=>{this.loaded=!0,e&&this.buttonEl.remove(),this.buttonEl&&(this.buttonEl.innerHTML="Load More")})))}}connectedCallback(){super.connectedCallback();const e=document.createElement("style");e.innerHTML="\n livelike-load-more-button button{\n display: flex;\n justify-content: center;\n width:100%;\n height: auto;\n border: none;\n border-radius: 0.25rem;\n background: #086fac;\n font-size: 1rem;\n color: #fff;\n padding: 0.75rem;\n margin:1rem 0 0 0;\n }\n\n livelike-load-more-button button:hover {\n cursor: pointer;\n }\n\n livelike-load-more-button .loading-spinner {\n position: relative;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 4px solid rgba(255, 255, 255, 0.1);\n border-top: 4px solid #fff;\n animation: rotating 1.2s infinite cubic-bezier(0.785, 0.135, 0.15, 0.86);\n }\n\n @keyframes rotating {\n 100% {\n transform: rotate(360deg);\n }\n }\n",this.appendChild(e);const t=document.createElement("button");t.addEventListener("click",this.loadPage),t.setAttribute("class","livelike-load-more-button"),t.setAttribute("aria-label","Load more widgets"),t.innerHTML="Load More",this.buttonEl=t,this.appendChild(t)}render(){return D`<slot></slot>`}};Jn([X({type:Boolean})],Xn.prototype,"loaded",void 0),Xn=Jn([qt("livelike-load-more-button")],Xn);var Zn=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Qn=class extends oe{constructor(){super(...arguments),this.dataId=Oe(),this.updating=!1,this.hasWidgetAttached=!1,this.sequence=1,this.mode="pop-up",this.loaded=!1,this.authors=!1,this.timestamps=!1,this.reactions=!1,this.timeformat={month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric"},this.hide_dismiss_button=!1,this.widgetListener=e=>{ye.some((t=>e.event===t))&&yt(e.message.timetoken,this.sequence,this.programid).then((t=>{if(this.sequence=t.sequence,t.allowNext){let t=this.onWidgetReceived(e.message);t&&this.enqueueWidget({mode:this.mode,widgetPayload:t})}}))},this.connectWidget=()=>{if(se.ready)return this.loaded=!1,this.syncStrategy?this.queue=Zt(this.syncStrategy):this.syncStrategy=wt(se.syncStrategy),nt(this.programid).then((e=>{this.channel=e.subscribe_channel,zt.subscribe(this.channel),this.mode.includes("timeline")?this.loadTimeline(this.programid):this.loaded=!0}));setTimeout(this.connectWidget,1e3)},this.onInitialWidgetsLoaded=({widgets:e})=>e,this.loadTimeline=e=>Dt({programId:e}).then((e=>{this.widgetPaginator=e,this.widgetPaginator.next().then((e=>{_t(this,(()=>{let t=this.onInitialWidgetsLoaded({widgets:e.value.widgets});Ft({interactionUrl:e.value.widget_interactions_url_template}).then((e=>xt({widgets:t,interactions:e}).map((({widgetPayload:e,interactions:t})=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0,interactions:t})})))).catch((e=>{t.map((e=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0})}))}))})),this.loaded=!0,!e.done&&this.insertAdjacentHTML("beforeend",'<livelike-load-more-button slot="load-more-button"></livelike-load-more-button>')}))})),this.onMoreWidgetsLoaded=({widgets:e})=>e,this.loadNextPage=()=>this.widgetPaginator.next().then((e=>{let t=this.onMoreWidgetsLoaded({widgets:e.value.widgets});return Ft({interactionUrl:e.value.widget_interactions_url_template}).then((e=>xt({widgets:t,interactions:e}).map((({widgetPayload:e,interactions:t})=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0,interactions:t})})))).catch((e=>{t.map((e=>{this.enqueueWidget({mode:this.mode,widgetPayload:e,initialLoad:!0})}))})),e.done})),this.updateEl=()=>{kt(this,(()=>"pop-up"!==this.mode||!this.hasWidgetAttached),(e=>{e.payload&&!this.querySelector(`[widgetid="${e.payload.id}"]`)&&(this.hasWidgetAttached=!0,this.showWidget({mode:e.mode,widgetPayload:e.payload,initialLoad:e.initialLoad,interactions:e.interactions}))}))},this.registerWidgetMode=(e,t)=>$t(e,t),this.showWidget=e=>this.start(e),this.enqueueWidget=e=>this.queue.enqueueItem({payload:e.widgetPayload,mode:e.mode,initialLoad:e.initialLoad,interactions:e.interactions},this.updateEl),this.createWidgetElement=e=>Bt({id:e.id,kind:e.kind}).then((t=>this.showWidget({widgetPayload:t,mode:e.mode,interactions:e.interactions}))),this.createSyncWidget=e=>Bt({id:e.id,kind:e.kind}).then((t=>this.enqueueWidget({widgetPayload:t,mode:e.mode,interactions:e.interactions}))),this.overRideTimer=({widget:e})=>null,this.start=e=>{at(this,"beforewidgetattached",{widget:e.widgetPayload});const t=Ut(e.mode||this.mode);return this.createWidget(e).then((e=>e&&t({target:this,widget:e,timer:this.overRideTimer({widget:e})})))},this.attach=(e,t)=>{const n="append"===t?"beforeend":"afterbegin";if(this.insertAdjacentElement(n,e),at(this,"widgetattached",{element:e,widget:e.widgetPayload}),e.widgetPayload){const t={"Widget Type":Ie(e.widgetPayload.kind),"Widget ID":e.widgetPayload.id};e.widgetPayload.kind!==fe&&e.widgetPayload.kind!==ve||(t["Link URL"]=e.widgetPayload.link_url),Pe("Widget Displayed",t,this.programid)}return Promise.resolve()},this.detach=e=>{const t={element:e,widget:e.widgetPayload};return e&&this.contains(e)&&(at(this,"beforewidgetdetached",t),e.remove(),at(this,"widgetdetached",t),this.hasWidgetAttached=!1),Promise.resolve()},this.createWidget=e=>{const{widgetPayload:t,mode:n,initialLoad:i,interactions:r}=e,o=this.customWidgetRenderer&&"function"==typeof this.customWidgetRenderer&&this.customWidgetRenderer({widgetPayload:t});let s=o instanceof Element||o instanceof Node?o:document.createElement("livelike-"+t.kind);for(let e in t)"id"!==e&&(s[e]=t[e]);return s.widgetId=t.id,s.setAttribute("widgetid",t.id),s.widgetPayload=t,s.interactions=r,r&&(s.interaction=r[0]),s.reactions=this.reactions,s.dataId=this.dataId,s.programid=this.programid,s.authors=this.authors,s.timestamps=this.timestamps,s.timeformat=this.timeformat,s.lang=this.lang,s.customTemplate=this.customTemplateRenderer?"function"==typeof this.customTemplateRenderer?this.customTemplateRenderer:dt(this.localName,"customTemplateRenderer","Function"):null,s.theme=ae.theme,s.hide_dismiss_button=this.hide_dismiss_button,e.initialLoad&&(s.initialLoad=e.initialLoad),Promise.resolve(s)},this.getUnclaimedRewards=()=>{return(e={programId:this.programid},nt(e.programId).then((e=>rt(Je(ce.id,e.unclaimed_widget_interactions_url_template),(e=>Me.get({url:e})),(e=>({count:e.count,results:e.results}))))).catch((e=>Promise.reject(e)))).then((e=>ot(["results"],e)));var e}}firstUpdated(){ft(this),Ve(this),$t("pop-up",Fe),$t("timeline",Ke),$t("interactive-timeline",qe)}onWidgetReceived(e){return e}disconnectedCallback(){super.disconnectedCallback(),zt.removeListener(this.channel,this.widgetListener)}updated(e){e.forEach(((e,t)=>{"syncStrategy"===t&&this.syncStrategy&&(this.queue=Zt(this.syncStrategy));("hasWidgetAttached"===t||"loaded"===t)&&(e=>{void 0!==this[e]&&at(this,e,{[e]:!0})})(t),"channel"===t&&this.channel&&(e&&(zt.removeListener(e,this.widgetListener),zt.unsubscribe(e)),zt.addListener(this.channel,this.widgetListener));const n="programid"===t&&this.programid&&this.programid!==e,i="mode"===t&&void 0!==e&&this.mode!==e;if(this.programid){if(n&&void 0!==e||i){for(;this.firstChild;)this.removeChild(this.firstChild);!this.firstChild&&(this.hasWidgetAttached=!1)}this.mode?(n||i)&&this.connectWidget():this.mode="pop-up"}}))}render(){return D`<style>:host{display:block}livelike-widgets{display:block}</style>${this.loaded?D`<slot></slot><slot name="load-more-button"></slot>`:D`<slot name="widgets-loading"></slot>`}`}};Zn([X({type:Object})],Qn.prototype,"widgetPaginator",void 0),Zn([X({type:String})],Qn.prototype,"channel",void 0),Zn([X({type:String,reflect:!0})],Qn.prototype,"programid",void 0),Zn([X({type:String,reflect:!0})],Qn.prototype,"lang",void 0),Zn([X({type:String})],Qn.prototype,"mode",void 0),Zn([X({type:Boolean})],Qn.prototype,"loaded",void 0),Zn([X({type:Boolean})],Qn.prototype,"authors",void 0),Zn([X({type:Boolean})],Qn.prototype,"timestamps",void 0),Zn([X({type:Boolean})],Qn.prototype,"reactions",void 0),Zn([X({type:Function})],Qn.prototype,"customWidgetRenderer",void 0),Zn([X({type:Function})],Qn.prototype,"customTemplateRenderer",void 0),Zn([X({type:Object})],Qn.prototype,"queue",void 0),Zn([X({type:Object})],Qn.prototype,"syncStrategy",void 0),Zn([X({type:Object})],Qn.prototype,"timeformat",void 0),Zn([X({type:Boolean})],Qn.prototype,"hide_dismiss_button",void 0),Qn=Zn([qt("livelike-widgets")],Qn);const ei="hlsLevelSwitched",ti="hlsFragChanged";class ni{get currentTimecode(){return this.programDateTime}get programDateTime(){return null}}const ii={direction:0,format:"uniformGradient"},ri={background:Object.assign(Object.assign({},ii),{colors:["003264","0096c8"]})},oi={background:{format:"fill",color:"111111"}},si={correctOptionBar:{background:Object.assign(Object.assign({},ii),{colors:["81ca00","429321"]})},incorrectOptionBar:{background:Object.assign(Object.assign({},ii),{colors:["dc0028","d0021b"]})},correctOption:{borderWidth:2,borderColor:"81ca00"},incorrectOption:{borderWidth:2,borderColor:"dc0028"}},ai={widgets:{alert:{body:{},header:{background:Object.assign(Object.assign({},ii),{colors:["9f041b","f5515f"]})}},imageSlider:{header:Object.assign({},oi),body:{},interactiveTrackRight:{background:{format:"fill",color:"888"}},interactiveTrackLeft:{background:{format:"fill",color:"ff6a13"}},resultsTrackRight:{},resultsTrackLeft:{}},prediction:{header:Object.assign({},ri),selectedOption:{borderColor:"0096c8"},selectedOptionBar:{borderColor:"0096c8",background:Object.assign(Object.assign({},ii),{colors:["003264","0096c8"]})}},predictionFollowUp:Object.assign(Object.assign({},si),{header:Object.assign({},ri),selectedOption:{borderColor:"0096c8"},selectedOptionBar:{borderColor:"c96dd7",background:Object.assign(Object.assign({},ii),{colors:["003264","0096c8"]})}}),poll:{header:{background:Object.assign(Object.assign({},ii),{colors:["3123ae","c96dd7"]})},selectedOption:{borderColor:"c86dd7"},selectedOptionBar:{borderColor:"c96dd7",background:Object.assign(Object.assign({},ii),{colors:["3123ae","c86dd7"]})}},quiz:Object.assign(Object.assign({},si),{header:{background:Object.assign(Object.assign({},ii),{colors:["f76b1c","ffb400"]})},selectedOption:{borderColor:"ffb400"},selectedOptionBar:{borderColor:"c96dd7",background:Object.assign(Object.assign({},ii),{colors:["f76b1c","ffb400"]})}}),socialEmbed:{header:Object.assign({},oi),body:{}},richText:{header:Object.assign({},oi),body:{}},cheerMeter:{header:Object.assign({},oi),body:{}},videoAlert:{body:{},header:{background:Object.assign(Object.assign({},ii),{colors:["9f041b","f5515f"]})}},textAsk:{header:{background:Object.assign(Object.assign({},ii),{colors:["9f041b","f5515f"]})},body:{}}},version:1};function ci(e){return parseInt(e.repeat(2/e.length),16)}const li=e=>/^([A-Fa-f0-9]{3,4}){1,2}$/.test(e);function ui(e){if(li(e)){const t=Math.floor(e.length/3),n=e.match(new RegExp(`.{${t}}`,"g")).map(ci),i=n[3]||0===n[3]?(n[3]/255).toFixed(2):1;return`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i})`}return e}function di(e){return Object.keys(e).forEach((t=>{const n=e[t]instanceof Array;if("fontFamily"===t)e[t]=n?e[t].join(" "):e[t];else if("object"!=typeof e[t]||n)if(n){const n=e[t].map((e=>e+"px"));e[t]=n.join(" ")}else-1!==t.toLowerCase().indexOf("color")?e[t]="rgb"===e[t].slice(0,3)?e[t]:ui(e[t]):"fontSize"!==t&&"borderWidth"!==t||String(e[t]).match(/px/gi)||(e[t]=`${e[t]}px`);else"background"===t?function(e,t){const n=e[t];"fill"===n.format?e[t]=li(n.color)?ui(n.color):n.color:"uniformGradient"===n.format&&(e[t]=`linear-gradient(90deg, ${ui(n.colors[0])}, ${ui(n.colors[1])})`)}(e,t):di(e[t])})),e}function hi(e){if(e){let t="";return Object.keys(e).forEach((n=>{let i=n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();"fontColor"===n&&(i="color"),t+=`${i}: ${e[n]};\n`})),t}return""}const pi=e=>new Promise((t=>{const n=di(De(ai,e));ae.theme=n,st.emit("themeUpdate",{theme:n}),function e(){n&&n.version?t():setTimeout(e,1e3)}()})),fi=e=>(se.localizedStrings=De(se.localizedStrings,e),st.emit("localizationUpdate",{localizedStrings:se.localizedStrings}),Promise.resolve(!0)),gi=(e,t,n)=>Me[e]({url:se.profileUrl,data:t,accessToken:n}),mi=e=>e.accessToken||e.profileId?e.accessToken?gi("get",null,e.accessToken).then((t=>(t.access_token=e.accessToken,t))):e.profileId&&Me.get({url:Je(e.profileId,se.profileDetailUrlTemplate)}):ht("accessToken or profileId","fetchUserProfile"),vi=e=>gi("post",e&&e.nickname&&e,null).then((e=>(Pe("Unique Profile Created",{"Profile ID":e.id}),e))),yi=e=>rt(e.badges_url,(e=>Me.get({url:e})),(e=>({count:e.count,results:e.results}))),bi=e=>({id:e.id,title:e.title,created_at:e.created_at,visibility:e.visibility,content_filter:e.content_filter}),wi=()=>Promise.resolve(!0),ki=e=>e.roomId?tt(e.roomId):ht("roomId","chatroom"),_i=(e,t)=>ki(e).then((e=>Me[t]({url:e.memberships_url}))),Pi=D`<livelike-widget-header slot="header"><livelike-title slot="title"></livelike-title><livelike-dismiss-button slot="dismiss"></livelike-dismiss-button><livelike-timer></livelike-timer></livelike-widget-header>`,Si=D`<style>livelike-option::slotted(.container){width:75%;max-width:75%;position:relative}livelike-progress[image]{top:0;height:1.5rem;margin-top:.5rem}.livelike-voting-image-container{width:100%;position:relative}livelike-footer{background-color:#444;display:block;font-weight:bolder;border-radius:0 0 6px 6px}.vote-button{margin:.5rem .5rem .5rem 1rem;padding:8px 16px;border-radius:5px;border:none;color:#fff;background:purple;cursor:pointer}.vote-button[disabled]{background:rgba(128,0,128,.5);color:rgba(255,255,255,.5);cursor:default}.voted-text{font-family:Arial}.sponsorship{padding:16px 8px;text-align:center;font-size:12px;font-family:HelveticaNeue-Medium}.sponsorship img{height:20px;vertical-align:middle;margin-left:8px}</style>`,xi=(e,t)=>{Kt(e,class extends t{constructor(){super(...arguments),this.waitForResponse=!0}render(){const t=D`<div style="position:relative;width:100%;display:flex"><livelike-progress></livelike-progress><livelike-description></livelike-description><livelike-percentage></livelike-percentage></div>`,n=D`<div class="livelike-voting-image-container"><div class="image-description-wrapper"><livelike-description></livelike-description><livelike-progress></livelike-progress></div><livelike-percentage></livelike-percentage></div><livelike-image height="80px" width="80px"></livelike-image>`;return D`<template><livelike-widget-root>${Si} ${Pi}<livelike-widget-body><livelike-select><template><livelike-option>${-1!==e.indexOf("image")?n:t}</livelike-option></template></livelike-select>${-1!==e.indexOf("quiz")?D`<livelike-footer><button class="vote-button" @click="${this.lockInVote}" ?disabled="${!this.selectedOption||!this.selectedOption.id||this.quizVoteSubmitted||this.voteDisable||this.disabled}">${this.owner.localize("widget.quiz.voteButton.label")}</button> ${this.quizVoteSubmitted?D`<span class="voted-text">${this.owner.localize("widget.quiz.votedText")}</span>`:null}</livelike-footer>`:null} ${-1!==e.indexOf("poll")&&this.widgetPayload.sponsors&&this.widgetPayload.sponsors.length?D`<livelike-widget-footer><div class="sponsorship">${this.owner.localize("widget.sponsors.label")} <img src="${this.widgetPayload.sponsors[0].logo_url}" alt="${this.widgetPayload.sponsors[0].name}"></div></livelike-widget-footer>`:null}</livelike-widget-body></livelike-widget-root></template>`}})};class Oi extends Yt{constructor(){super(...arguments),this.owner=this,this.hideVoteInResults=!0,this.submitVote=e=>{this.disabled||e.id===this.selectedOption.id||this.voteDisable||(this.selectedOption=e,this.interactionEvent(),this.voteDisable=!0,this.vote&&this.vote.id?this.updateVote(this.vote.url,{option_id:e.id}):this.createVote(e.vote_url))}}firstUpdated(){super.firstUpdated(),this.interaction&&(this.selectedOption=this.options.find((e=>e.id===this.interaction.option_id))),this.interaction&&(this.vote={id:this.interaction.id,url:this.interaction.url})}}xi("livelike-text-poll",Oi),xi("livelike-image-poll",Oi);const Ti=e=>class extends e{constructor(){super(...arguments),this.resultEvent=()=>{super.resultEvent();let e="unattempted";this.selectedOption&&this.selectedOption.id&&this.selectedOption.hasOwnProperty("is_correct")&&(e=this.selectedOption.is_correct?"correct":"incorrect"),at(this,"results",{result:e,element:this,widget:this.widgetPayload,selectedOption:this.selectedOption}),-1!==this.localName.indexOf("quiz")&&!this.quizVoteSubmitted&&!this.vote&&this.selectedOption&&this.selectedOption.id&&this.lockInVote(this.selectedOption.answer_url)}}};class Ci extends(Ti(Yt)){constructor(){super(...arguments),this.defaultVoteHide=!0,this.quizVoteSubmitted=!1,this.owner=this,this.submitVote=e=>{if(!this.disabled&&e.id!==this.selectedOption.id){this.selectedOption=e;const t=this.choices.findIndex((t=>t.id===e.id));this.choices[t].answer_count++,this.syntheticIncrement=!0,this.interactionEvent()}},this.lockInVote=e=>{this.voteDisable||(this.voteDisable=!0,this.selectedOption&&this.selectedOption.id&&this.createVote(this.selectedOption.answer_url).then((()=>{this.quizVoteSubmitted=!0,this.disabled=!0})))}}firstUpdated(){super.firstUpdated(),this.interaction&&(this.selectedOption=this.choices.find((e=>e.id===this.interaction.choice_id)),this.quizVoteSubmitted=!0,this.disabled=!0)}}xi("livelike-text-quiz",Ci),xi("livelike-image-quiz",Ci);const Ei={};class Ri extends Oi{constructor(){super(...arguments),this.defaultVoteHide=!0,this.hideVoteInResults=!0}firstUpdated(){super.firstUpdated(),this.addEventListener("prediction",(e=>{Ei[e.detail.widget.id]={option_id:e.detail.prediction.option_id,claim_token:e.detail.prediction.claim_token}}))}}xi("livelike-text-prediction",Ri),xi("livelike-image-prediction",Ri);class Ai extends(Ti(Yt)){constructor(){super(...arguments),this.claimRewards=(e,t)=>{e.claim_token&&Me.post({url:this.widgetPayload.claim_url,data:{claim_token:e.claim_token}}).then((e=>{Ei[t]&&(Ei[t].claim_token=null),this.rankChanged(this.widgetPayload,e.rewards)}))},this.interactive=()=>Promise.resolve()}firstUpdated(){super.firstUpdated(),this.updateComplete.then((()=>this.disabled=!0));const e=this.widgetPayload.text_prediction_id||this.widgetPayload.image_prediction_id,t=this.widgetPayload.text_prediction_id?"text-prediction":"image-prediction",n=Ei[e]||this.interaction;n?(n&&(this.selectedOption={id:n.option_id}),this.claimRewards(n,e)):Ft({programId:this.programid,widgets:[{kind:t,id:e}]}).then((n=>{n&&n[t]&&n[t][0]&&(this.selectedOption={id:n[t][0].option_id},this.claimRewards(n[t][0],e))}))}}xi("livelike-image-prediction-follow-up",Ai),xi("livelike-text-prediction-follow-up",Ai);const Mi=e=>"\n .widget-captioned-media {\n align-items: center;\n display: flex;\n margin: 0;\n }\n\n .widget-caption-container {\n padding: 1rem;\n }\n\n .widget-caption {\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n width: 100%;\n }\n\n .widget-caption.media-caption {\n padding: 1rem;\n }\n\n .widget-media {\n font-size: 0;\n text-align: center;\n }\n\n .widget-media img {\n max-height: 90px;\n max-width: 100%;\n }\n\n .widget-captioned-media .widget-caption {\n order: 1;\n }\n\n .widget-caption ~ .widget-media {\n order: 2;\n max-height: 90px;\n max-width: 35%;\n }\n\n .widget-link {\n word-wrap: break-word;\n background-color: #444;\n display: block;\n font-weight: bolder;\n padding: 0.5rem 1rem;\n position: relative;\n text-decoration: none;\n border-radius: 0 0 6px 6px;\n }\n .widget-link:after {\n content: '';\n background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2280px%22%20height%3D%22100px%22%20viewBox%3D%220%200%2080%20100%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3C!--%20Generator%3A%20Sketch%2050%20(54983)%20-%20http%3A%2F%2Fwww.bohemiancoding.com%2Fsketch%20--%3E%0A%20%20%20%20%3Ctitle%3Esort-down%3C%2Ftitle%3E%0A%20%20%20%20%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%0A%20%20%20%20%3Cdefs%3E%3C%2Fdefs%3E%0A%20%20%20%20%3Cg%20id%3D%22Page-1%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%0A%20%20%20%20%20%20%20%20%3Cg%20id%3D%22sort-down%22%20transform%3D%22translate(40.000000%2C%2050.000000)%20rotate(-90.000000)%20translate(-40.000000%2C%20-50.000000)%20translate(-10.000000%2C%2010.000000)%22%20fill%3D%22%23FFFFFF%22%20fill-rule%3D%22nonzero%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M98.1437396%2C2.63850125%20C96.9076009%2C0.879013967%2095.4422941%2C0%2093.7491877%2C0%20L6.25047031%2C0%20C4.55667973%2C0%203.09239915%2C0.879013967%201.85523426%2C2.63850125%20C0.61806938%2C4.39993433%200%2C6.48242398%200%2C8.88986179%20C0%2C11.2968131%200.61806938%2C13.3793028%201.85523426%2C15.1392765%20L45.604764%2C77.359553%20C46.843297%2C79.1190402%2048.3075776%2C80%2050%2C80%20C51.6924224%2C80%2053.1580712%2C79.1190402%2054.3942099%2C77.359553%20L98.1437396%2C15.1387901%20C99.3795363%2C13.3793028%20100%2C11.2968131%20100%2C8.88937534%20C100%2C6.48242398%2099.3795363%2C4.39993433%2098.1437396%2C2.63850125%20Z%22%20id%3D%22Shape%22%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E');\n background-position: center right 0.5rem;\n background-size: 0.5rem;\n background-repeat: no-repeat;\n position: absolute;\n width: calc(100% - 2rem);\n height: calc(100% - 1rem);\n left: 0;\n top: 0;\n z-index: 0;\n padding: 0.5rem 1rem;\n }\n\n *[dir=\"rtl\"] .widget-link {\n background-position: center left 0.5rem;\n }\n *[dir=\"rtl\"] .widget-link:after {\n transform: scaleX(-1);\n }\n\n ";var ji=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Li=class extends Jt{constructor(){super(...arguments),this.kind="alert",this.owner=this,this.defaultStyles=Mi,this.trackLinkOpened=()=>{this.interactionEvent();let e={"Alert Id":this.widgetPayload&&this.widgetPayload.id,"Program ID":this.widgetPayload&&this.widgetPayload.program_id,"Widget Type":Ie(this.widgetPayload.kind),"Link URL":this.link_url};Pe("Alert Link Opened",e,this.programid)}}firstUpdated(){this.isInteractable=this.link_url&&this.link_url.length,super.firstUpdated()}render(){const e=!!this.text&&!!this.image_url,t=!this.text&&!!this.image_url,n=!!this.text&&!this.image_url;return D`<template><livelike-widget-root>${Pi}<livelike-widget-body>${e?D`<figure class="widget-captioned-media">${this.text&&D`<figcaption class="widget-caption media-caption">${this.text}</figcaption>`} ${this.image_url&&D`<img class="widget-media" src="${this.image_url}" alt="${this.text}">`}</figure>`:t?D`<div class="widget-media"><img src="${this.image_url}"></div>`:n?D`<div class="widget-caption-container"><span class="widget-caption">${this.text}</span></div>`:null} ${this.link_url&&D`<livelike-footer><a class="widget-link" href="${this.link_url}" target="_blank" @click="${this.trackLinkOpened}">${this.link_label}</a></livelike-footer>`}</livelike-widget-body></livelike-widget-root></template>`}};ji([X({type:String})],Li.prototype,"title",void 0),ji([X({type:String})],Li.prototype,"text",void 0),ji([X({type:String})],Li.prototype,"image_url",void 0),ji([X({type:String})],Li.prototype,"link_url",void 0),ji([X({type:String})],Li.prototype,"link_label",void 0),Li=ji([qt("livelike-alert")],Li);const Ni=e=>{const t=`\n border: none;\n width: 100%;\n height: 1.125rem;\n border-radius: 1.5rem;\n background: ${e.interactiveTrackRight.background};\n background-image: linear-gradient(\n 90deg,\n ${e.interactiveTrackLeft.background},\n ${e.interactiveTrackRight.background} var(--x),\n transparent 0\n );\n `,n="\n border: none;\n width: var(--thumb-width);\n height: 1em;\n border-radius: 50%;\n margin-top: 0;\n ";return`\n .input-form {\n --x: calc(var(--val) / 100 * (100% - var(--thumb-width)));\n position: relative;\n width: 90%;\n margin: 0px auto;\n }\n\n .input-container {\n display: block;\n position: relative;\n }\n\n .slider-input {\n -webkit-appearance: none;\n width: 100%;\n display: block;\n height: 5em;\n background: none;\n cursor: pointer;\n position: relative;\n margin: 0;\n }\n\n .slider-input:focus {\n outline: none;\n }\n\n .slider-input::-webkit-slider-runnable-track {\n ${t}\n }\n .slider-input::-moz-range-track {\n ${t}\n }\n .slider-input::-ms-track {\n ${t}\n }\n\n .slider-input::-webkit-slider-thumb {\n ${n}\n }\n .slider-input::-moz-range-thumb {\n ${n}\n }\n .slider-input::-ms-thumb {\n ${n}\n }\n\n .slider-input:disabled {\n cursor: default;\n }\n\n .slider-image {\n height: 50px;\n }\n\n .slider-thumb {\n position: absolute;\n bottom: 0.1em;\n left: var(--x);\n pointer-events: none;\n }\n\n .result-mark {\n background: rgb(233, 0, 0);\n width: 1rem;\n height: 1rem;\n bottom: 1.1rem;\n position: absolute;\n background: #d23a3a;\n border: 3px solid white;\n border-radius: 1rem;\n bottom: 1.5rem;\n z-index: 1;\n ${hi(e.marker)}\n }\n livelike-emoji-slider livelike-footer{\n background-color: transparent;\n font-weight: normal;\n }\n .vote-button{\n margin: 0.5rem 0.5rem 0.5rem 1rem;\n padding: 8px 16px;\n border-radius: 5px;\n border: none;\n color: #fff;\n background: rgba(128, 0, 128, 1);\n cursor: pointer;\n }\n .vote-button[disabled]{\n background: rgba(128, 0, 128, 0.5);\n color: rgba(255, 255, 255, 0.5);\n cursor: default;\n }\n .voted-text{\n font-family: Arial;\n }\n .sponsorship{\n padding: 16px 8px;\n text-align: center;\n font-size: 12px;\n font-family: "HelveticaNeue-Medium";\n }\n .sponsorship img{\n height: 20px;\n vertical-align: middle;\n margin-left: 8px;\n }\n`};var Ui=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Ii=class extends Jt{constructor(){super(...arguments),this.owner=this,this.kind="emoji-slider",this.defaultStyles=Ni,this.val=null,this.sliderVoteSubmitted=!1,this.setThumbWidth=()=>{this.imageEl&&this.imageEl.offsetWidth>0?this.inputContainer.style.setProperty("--thumb-width",this.imageEl.offsetWidth+"px"):setTimeout(this.setThumbWidth,10)},this.changeVal=()=>{this.interactionEvent(),this.updateVal()},this.updateVal=()=>{if(this.inputEl){let e=+this.inputEl.value;if(this.val!==e){this.inputContainer.style.setProperty("--val",this.val=e);for(let e of this.options)this.val>=e.max&&this.imageEl.src!==e.image_url&&(this.imageEl.src=e.image_url,this.setThumbWidth())}}},this.resultEvent=()=>{super.resultEvent(),this.updateComplete.then((()=>{this.interacted&&!this.sliderVoteSubmitted&&this.lockInVote(this.val/100)}))},this.onResults=e=>{e.message.average_magnitude&&(this.average_magnitude=e.message.average_magnitude,at(this,e.event,e.message.average_magnitude))},this.interactive=e=>new Promise((t=>this.updateComplete.then((()=>{this.phase="interactive",this.disabled=!1;const n={"Widget Type":Ie(this.widgetPayload.kind),"Widget ID":this.widgetPayload.id};Pe("Widget Became Interactive",n,this.programid);let i=e&&void 0!==e.timeout?e.timeout:this.widgetPayload.timeout&&Ue(this.widgetPayload.timeout);this.timeout=i,null!==i&&setTimeout((()=>{this.interacted&&!this.sliderVoteSubmitted?this.lockInVote(this.val/100).then((()=>setTimeout(t,2e3))):(this.interacted||this.sliderVoteSubmitted||(this.val=null),setTimeout(t,2e3))}),this.timeout)})))),this.lockInVote=e=>new Promise(((t,n)=>{!this.voteDisable&&e>=0&&e<=1?(this.voteDisable=!0,this.createVote(this.widgetPayload.vote_url,{magnitude:e.toString()}).then((()=>{this.sliderVoteSubmitted=!0,this.disabled=!0,t(!0)}))):n(new Error("Magnitude not a number between 0 and 1."))}))}get inputContainer(){return this.querySelector(".input-form")}get inputEl(){return this.querySelector(".slider-input")}get imageEl(){return this.querySelector(".slider-image")}connectedCallback(){super.connectedCallback().then((()=>{this.interaction&&this.interaction.magnitude&&(this.sliderVoteSubmitted=!0),this.updateComplete.then((()=>{this.inputEl&&(this.inputEl.addEventListener("change",this.changeVal),this.inputEl.addEventListener("input",this.updateVal)),this.options=this.options.map(((e,t)=>Object.assign(Object.assign({},e),{mag:0===t?0:t/(this.options.length-1)*100,max:t/this.options.length*100}))),this.updateVal()}))}))}render(){const e=Math.round(100*(this.interaction?this.interaction.magnitude:this.widgetPayload.initial_magnitude)),t="ready"!==this.phase&&"interactive"!==this.phase&&"null"!==String(this.val)?D`<div class="result-mark" style="left:calc(${Math.round(100*this.average_magnitude)}% - .5rem)"></div>`:null;return D`<template><livelike-widget-root>${Pi}<livelike-widget-body><form style="--val:${e}" class="input-form"><div class="input-container"><input type="range" class="slider-input" value="${e}" ?disabled="${this.disabled}"> ${t}</div><output class="slider-thumb"><img class="slider-image"></output></form><livelike-footer><button class="vote-button" @click="${()=>this.lockInVote(this.val/100)}" ?disabled="${this.sliderVoteSubmitted||this.voteDisable||this.disabled}">${this.owner.localize("widget.slider.voteButton.label")}</button> ${this.sliderVoteSubmitted?D`<span class="voted-text">${this.owner.localize("widget.slider.votedText")}</span>`:null} ${this.widgetPayload.sponsors&&this.widgetPayload.sponsors.length?D`<div class="sponsorship">${this.owner.localize("widget.sponsors.label")} <img src="${this.widgetPayload.sponsors[0].logo_url}" alt="${this.widgetPayload.sponsors[0].name}"></div>`:null}</livelike-footer></livelike-widget-body></livelike-widget-root></template>`}};Ui([X({type:Number})],Ii.prototype,"val",void 0),Ui([X({type:String})],Ii.prototype,"average_magnitude",void 0),Ui([X({type:Boolean})],Ii.prototype,"sliderVoteSubmitted",void 0),Ii=Ui([qt("livelike-emoji-slider")],Ii);var Di=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Bi=[];class $i extends Jt{constructor(){super(),this.owner=this,this.moving=!1,this.slide=0,this.slides=null,this.totalSlides=0,this.scriptsLoaded=!1,this.finalLoad=!1,this.forceScriptLoad=()=>{window.instgrm&&window.instgrm.Embeds.process(),window.FB&&window.FB.XFBML.parse(),window.twttr&&window.twttr.widgets.load()},this.initSlider=()=>new Promise((e=>{const t=this.querySelector("#dot0");t&&(t.checked=!0),this.slides=this.querySelectorAll(".slide");const n=this.slides.length;this.totalSlides=n,this.slide=0,this.slides&&this.slides[0]&&(this.slides[0].className+=" active"),n>1&&(this.slides[1].className+=" next"),n>2&&(this.slides[n-1].className+=" prev"),e()})),this.insertHTML=()=>new Promise((e=>{this.items.forEach(((e,t)=>{const n=this.querySelector(`#embed${t}`),i=document.createElement("div");i.innerHTML=e.oembed&&e.oembed.html;const r=e=>{if("SCRIPT"===e.nodeName){const t=e.src.replace("file://","https://");if(!Bi.includes(t)){Bi.push(t);const e=document.createElement("script");e.src=t,document.body.insertAdjacentElement("beforeend",e)}}},o=e=>{for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];r(n),e.hasChildNodes()&&o(n)}};o(i),n&&(n.innerHTML=e.oembed&&e.oembed.html),setTimeout((()=>{if(this.forceScriptLoad(),e.oembed&&"Twitter"===e.oembed.provider_name){function e(t){const n=t.querySelector("twitter-widget");n&&n.shadowRoot&&n.shadowRoot.querySelector(".TweetInfo")?(n.shadowRoot.querySelector(".TweetInfo").style.display="none",n.shadowRoot.querySelector(".CallToAction").style.display="none"):setTimeout((()=>e(t)),100)}e(this)}setTimeout((()=>{this.scriptsLoaded=!0}),1500)}),500)})),e()})),this.moveCarouselTo=(e,t)=>{this.checkDot();const n="slide";let i=e-1,r=e+1;0===e?i=t-1:e===t-1&&(i=e-1,r=0),this.items.forEach(((e,t)=>{this.slides[t].className=n})),this.slides[i].className="slide prev",this.slides[e].className="slide active",this.slides[r].className="slide next"},this.moveNext=()=>{this.slide===this.totalSlides-1?this.slide=0:this.slide++,this.moveCarouselTo(this.slide,this.totalSlides)},this.movePrev=()=>{0===this.slide?this.slide=this.totalSlides-1:this.slide--,this.moveCarouselTo(this.slide,this.totalSlides)},this.moveToSlide=e=>{this.slide=e,this.moveCarouselTo(this.slide,this.totalSlides)},this.checkDot=()=>{this.items.forEach(((e,t)=>{this.querySelector(`#dot${t}`).checked=this.slide===t}))},this.disableInteraction=()=>{this.moving=!0,setTimeout((()=>{this.moving=!1}),500)},this.moving=!1,this.slide=0,this.slides=null,this.totalSlides=0,this.scriptsLoaded=!1,this.finalLoad=!1}updated(e){e.forEach(((e,t)=>{"scriptsLoaded"===t&&!0===this.scriptsLoaded&&this.forceScriptLoad(),"finalLoad"===t&&!0===this.finalLoad&&this.forceScriptLoad()}))}connectedCallback(){super.connectedCallback().then((()=>{this.updateComplete.then((()=>{this.insertHTML().then((()=>this.initSlider())).then((()=>setTimeout((()=>{this.finalLoad=!0}),3e3)))}))}))}}Di([X({type:Array})],$i.prototype,"items",void 0),Di([X({type:String})],$i.prototype,"comment",void 0),Di([X({type:Boolean})],$i.prototype,"moving",void 0),Di([X({type:Number})],$i.prototype,"slide",void 0),Di([X({type:Array})],$i.prototype,"slides",void 0),Di([X({type:Number})],$i.prototype,"totalSlides",void 0),Di([X({type:Boolean})],$i.prototype,"scriptsLoaded",void 0),Di([X({type:Boolean})],$i.prototype,"finalLoad",void 0);const Fi=D`<style>.slider-wrapper{overflow:hidden;margin:auto}.slider-wrapper *{box-sizing:border-box;display:flex;justify-content:center}.slider{-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;transform-style:preserve-3d}.slide{opacity:0;position:absolute;top:0;width:100%;display:none;margin:auto;z-index:100;transition:transform .5s,opacity .5s,z-index .5s}.slide.active,.slide.initial{opacity:1;position:relative;z-index:900;display:flex}.slide.next,.slide.prev{z-index:800;display:flex}.slide.prev{transform:translateX(-100%)}.slide.next{transform:translateX(100%)}.slide-button{background:0 0;position:absolute;top:50%;width:3rem;height:3rem;transform:translateY(-50%);border-radius:50%;cursor:pointer;z-index:20;border:none}.slide-button>svg{fill:#fff;filter:drop-shadow( 3px 3px 2px rgba(20, 20, 20, .7))}.left-button{left:0}.right-button{right:0}.dot-nav-container{z-index:20;margin-top:1rem}.dot-item{border:none;height:15px;width:15px;border-radius:1rem}</style>`;let Ki=class extends $i{constructor(){super(...arguments),this.kind="social-embed",this.isInteractable=!1}render(){const e=this.items.length>1,t=D`<div class="button-wrapper"><button class="left-button slide-button" @click="${this.movePrev}">${on}</button> <button class="right-button slide-button" @click="${this.moveNext}">${rn}</button></div>`,n=D`<form class="dot-nav-container">${this.items.map(((e,t)=>D`<input class="dot-input" id="dot${t}" name="dot" type="radio" @click="${()=>this.moveToSlide(t)}">`))}</form>`;return D`<template>${Fi}<livelike-widget-root style="opacity:${this.scriptsLoaded&&this.finalLoad?1:0}">${Pi}<livelike-widget-body><div class="slider-wrapper">${e?t:null}<div class="slider">${this.items.length>0&&this.items.map(((e,t)=>D`<div id="embed${t}" class="slide ${0===t?"initial":""}"></div>`))}</div>${e?n:null}</div></livelike-widget-body></livelike-widget-root></template>`}};Ki=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-social-embed")],Ki);var qi=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let zi=class extends Jt{constructor(){super(...arguments),this.owner=this,this.kind="rich-post",this.isInteractable=!1}render(){return D`<template><livelike-widget-root>${Pi}<livelike-widget-body style="display:flex"><section>${En(this.content)}</section></livelike-widget-body></livelike-widget-root></template>`}};qi([X({type:String})],zi.prototype,"content",void 0),zi=qi([qt("livelike-rich-post")],zi);const Hi=e=>`\n @keyframes image0 {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.2); }\n 100% { transform: scale(1); }\n }\n @keyframes image1 {\n 0% { transform: scale(1.2); }\n 50% { transform: scale(1); }\n 100% { transform: scale(1.2); }\n }\n\n .cheer-image-body {\n position: relative;\n display: flex;\n }\n\n .cheer-image-body livelike-vote-count {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 2rem;\n z-index: 100;\n }\n\n .cheer-item-container {\n display: flex;\n flex-direction: column;\n width: 50%;\n position: relative;\n overflow: hidden;\n padding: 0 1.5rem;\n margin: auto;\n }\n\n .cheer-image-wrap {\n text-align: center;\n padding: 20px 0;\n }\n\n .cheer-image {\n position: relative;\n max-height: 80px;\n max-width: 85%;\n z-index: 5;\n top: 0;\n transition: all 0.2s;\n vertical-align: middle;\n }\n .cheer-image:hover {\n cursor: pointer;\n }\n .cheer-image.disabled:hover {\n cursor: default;\n }\n\n .button0.initial.enabled {\n animation: image0 2s linear 0s infinite normal;\n }\n .button1.initial.enabled {\n animation: image1 2s linear 0s infinite normal;\n }\n .cheer-image-wrap.enabled:after {\n content: '';\n position: absolute;\n display: block;\n z-index: 1;\n width: 100px;\n height: 100px;\n border-radius: 100%;\n top: 10px;\n left: 50%;\n margin-left: -50px;\n opacity: 0;\n transition: all 0.2s;\n }\n .cheer-image-wrap.enabled:active:after {\n opacity: 1;\n width: 200px;\n height: 200px;\n top: -40px;\n margin-left: -100px;\n }\n .button0{\n ${hi(e.sideAButton)}\n }\n .button1{\n ${hi(e.sideBButton)}\n }\n .cheer-image.enabled:active {\n -webkit-transform: scale(0.9);\n -webkit-transform: rotate(10deg);\n }\n .button0.enabled:after {\n border: 2px solid rgba(80, 160, 250, 0.6);\n background: rgba(80, 160, 250, 0.4);\n }\n .button1.enabled:after {\n border: 2px solid rgba(250, 80, 100, 0.6);\n background: rgba(250, 80, 100, 0.4);\n }\n`,Vi=e=>{let t=`\n :host {\n display: flex;\n position: relative;\n cursor: pointer;\n transition: border ease 0.3s;\n align-items: center;\n border: 2px solid transparent;\n border-radius: 6px;\n padding: 0.5rem;\n ${hi(e.unselectedOption)}\n }\n :host([selected]) {\n ${hi(e.selectedOption)}\n }\n :host([disabled]) {\n cursor: default;\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOption)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOption)}\n }\n `),t};var Gi=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Wi=class extends At{constructor(){super(...arguments),this.defaultStyles=Vi,this.image=null,this.selected=null,this.correct=null,this.incorrect=null,this.disabled=null,this.optionSelected=()=>{this.disabled||(this.parentElement.querySelectorAll("livelike-option").forEach((e=>e!==this&&(e.selected=!1))),this.selected=!0,this.owner.submitVote(this.item),at(this,"option-clicked",{item:this.item}))},this.handleResults=e=>{this.item.hasOwnProperty("is_correct")&&(this.item.is_correct?this.correct=!0:this.selected&&(this.incorrect=!0))},this.ownerUpdated=e=>{"voteDisable"===e.name&&this.owner.waitForResponse&&(this.disabled=this.owner.disabled||e.prop)}}updated(e){e.forEach(((e,t)=>{if(void 0!==this[t]&&null!==this[t]&&this.item){const e={name:t,prop:this[t],key:this.item.id,owner:this.owner};if(st.emit("option-updated",e),at(this,"option-updated",e),"options"===t||"choices"===t||"items"===t){const e=this.items[this.optionIndex].vote_count;e!==this.voteCount&&(this.voteCount=e),at(this,"option-vote-updated",this.items[this.optionIndex])}}}))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.optionSelected);const e=this.parentElement;!this.owner&&(this.owner=e.owner);const t=this.getAttribute("index");this.optionIndex=t,this.removeAttribute("index");const n=this.owner.options||this.owner.choices;this.item=n[t],this.voteCount=n[t].vote_count,this.disabled=this.owner.disabled,this.value=this.item.id,this.image=!!this.item.image_url,this.owner.options&&(this.option=this.owner.options[t]),this.owner.choices&&(this.choice=this.owner.choices[t]),this.owner.selectedOption&&this.owner.selectedOption.id&&this.owner.selectedOption.id===this.value&&(this.selected=!0),("results"===this.owner.phase||"finished"===this.owner.phase)&&this.handleResults(),this.owner.addEventListener("results",this.handleResults),this.addEventListener("option-provider",(e=>{e.detail.provider=this,e.stopPropagation()}))}disconnectedCallback(){this.removeEventListener("click",this.optionSelected),super.disconnectedCallback()}render(){return D`<slot></slot>`}};Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"image",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"selected",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"correct",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"incorrect",void 0),Gi([X({reflect:!0,type:Boolean})],Wi.prototype,"disabled",void 0),Gi([X({type:Object})],Wi.prototype,"option",void 0),Gi([X({type:Object})],Wi.prototype,"choice",void 0),Gi([X({type:Object})],Wi.prototype,"item",void 0),Gi([X({type:String})],Wi.prototype,"value",void 0),Wi=Gi([qt("livelike-option")],Wi);const Yi=e=>{let t=`\n :host {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n position: relative;\n ${hi(e.unselectedOptionImage)}\n }\n ::slotted(img) {\n object-fit: contain;\n }\n img {\n max-width: 90px;\n display: block;\n margin: 0 auto;\n }\n :host([selected]) {\n ${hi(e.selectedOptionImage)}\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionImage)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionImage)}\n }\n `),t};var Ji=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Xi=class extends Lt{constructor(){super(...arguments),this.defaultStyles=Yi}connectedCallback(){super.connectedCallback();let e=this.src||this.item&&this.item.image_url||this.owner.image_url;if(e){const t=document.createElement("img");t.setAttribute("height",this.height),t.setAttribute("width",this.width),t.setAttribute("src",e),t.setAttribute("alt",this.alt||this.item&&this.item.description),this.appendChild(t)}}defaultTemplate(){return D`<slot></slot>`}};Ji([X({type:String,reflect:!0})],Xi.prototype,"src",void 0),Ji([X({type:String,reflect:!0})],Xi.prototype,"alt",void 0),Ji([X({type:String,reflect:!0})],Xi.prototype,"height",void 0),Ji([X({type:String,reflect:!0})],Xi.prototype,"width",void 0),Xi=Ji([qt("livelike-image")],Xi);var Zi=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Qi=class extends Jt{constructor(){super(...arguments),this.kind="cheer-meter",this.owner=this,this.defaultStyles=Hi,this.cheerVote={},this.count=0,this.submitVote=e=>{this.disabled||(this.cheerVote[e.id]?this.cheerVote[e.id].count++:this.cheerVote[e.id]={createUrl:e.vote_url,count:1},this.selectedOption=e,this.interactionTrack(),this.sendVote())},this.sendVote=((e,t)=>{let n,i;return function r(...o){const s=Date.now();i=clearTimeout(i),!n||s-n>=t?(e.apply(null,o),n=s):i=setTimeout(r.bind(null,...o),t-(s-n))}})((()=>{for(const e in this.cheerVote)if(this.cheerVote[e].count){this.interactionEvent(this.cheerVote[e].count);const t={vote_count:this.cheerVote[e].count};this.cheerVote[e].count=0;const n=t=>t.url&&(this.cheerVote[e].updateUrl=t.url);this.cheerVote[e].updateUrl?this.updateVote(this.cheerVote[e].updateUrl,t).then(n):this.createVote(this.cheerVote[e].createUrl,t).then(n)}}),3e3),this.updateTotalVoteCount=()=>{this.count=this.options.reduce(((e,t)=>e+t.vote_count),0)}}voteCountChanged(e){this.updateTotalVoteCount()}firstUpdated(){super.firstUpdated(),this.updateTotalVoteCount()}render(){return D`<template><livelike-widget-root>${Pi}<livelike-widget-body><livelike-dueling-progress></livelike-dueling-progress><div class="cheer-image-body"><livelike-vote-count></livelike-vote-count>${this.options.map(((e,t)=>{const n=this.disabled?"disabled":"enabled";return D`<div class="cheer-item-container"><livelike-option index="${t}" style="display:contents"><div class="cheer-image-wrap button${t} ${this.interacted?"":"initial"} ${n}"><img class="cheer-image ${n}" src="${e.image_url}"></div></livelike-option></div>`}))}</div></livelike-widget-body></livelike-widget-root></template>`}};Zi([X({type:Object})],Qi.prototype,"cheerVote",void 0),Zi([X({type:Number})],Qi.prototype,"count",void 0),Qi=Zi([qt("livelike-cheer-meter")],Qi);const er=e=>"\n .only-media{\n border-radius: 6px;\n }\n .no-header{\n border-top-right-radius: 6px;\n border-top-left-radius: 6px;\n }\n .no-footer{\n border-bottom-right-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n .video-alert-caption-container {\n padding: 0.6rem 0.8rem;\n }\n .video-alert-caption {\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n width: 100%;\n }\n .video-alert-link {\n word-wrap: break-word;\n background-color: #444;\n display: block;\n font-weight: bolder;\n padding: 0.5rem 1rem;\n position: relative;\n text-decoration: none;\n border-radius: 0 0 6px 6px;\n }\n .video-alert-link:after {\n content: '';\n background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2280px%22%20height%3D%22100px%22%20viewBox%3D%220%200%2080%20100%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3C!--%20Generator%3A%20Sketch%2050%20(54983)%20-%20http%3A%2F%2Fwww.bohemiancoding.com%2Fsketch%20--%3E%0A%20%20%20%20%3Ctitle%3Esort-down%3C%2Ftitle%3E%0A%20%20%20%20%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%0A%20%20%20%20%3Cdefs%3E%3C%2Fdefs%3E%0A%20%20%20%20%3Cg%20id%3D%22Page-1%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%0A%20%20%20%20%20%20%20%20%3Cg%20id%3D%22sort-down%22%20transform%3D%22translate(40.000000%2C%2050.000000)%20rotate(-90.000000)%20translate(-40.000000%2C%20-50.000000)%20translate(-10.000000%2C%2010.000000)%22%20fill%3D%22%23FFFFFF%22%20fill-rule%3D%22nonzero%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M98.1437396%2C2.63850125%20C96.9076009%2C0.879013967%2095.4422941%2C0%2093.7491877%2C0%20L6.25047031%2C0%20C4.55667973%2C0%203.09239915%2C0.879013967%201.85523426%2C2.63850125%20C0.61806938%2C4.39993433%200%2C6.48242398%200%2C8.88986179%20C0%2C11.2968131%200.61806938%2C13.3793028%201.85523426%2C15.1392765%20L45.604764%2C77.359553%20C46.843297%2C79.1190402%2048.3075776%2C80%2050%2C80%20C51.6924224%2C80%2053.1580712%2C79.1190402%2054.3942099%2C77.359553%20L98.1437396%2C15.1387901%20C99.3795363%2C13.3793028%20100%2C11.2968131%20100%2C8.88937534%20C100%2C6.48242398%2099.3795363%2C4.39993433%2098.1437396%2C2.63850125%20Z%22%20id%3D%22Shape%22%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E');\n background-position: center right 0.5rem;\n background-size: 0.5rem;\n background-repeat: no-repeat;\n position: absolute;\n width: calc(100% - 2rem);\n height: calc(100% - 1rem);\n left: 0;\n top: 0;\n z-index: 0;\n padding: 0.5rem 1rem;\n }\n\n *[dir=\"rtl\"] .video-alert-link {\n background-position: center left 0.5rem;\n }\n *[dir=\"rtl\"] .video-alert-link:after {\n transform: scaleX(-1);\n }\n\n ",tr=e=>"\n :host {\n display: block;\n }\n livelike-video{\n position: relative;\n }\n livelike-video video {\n width: 100%;\n max-height: 210px;\n border-radius: inherit;\n vertical-align: middle;\n }\n .video-playback-error {\n position: absolute;\n width: 100%;\n text-align: center;\n top: 50%;\n right:50%;\n transform: translate(50%,-50%);\n display: flex;\n align-items: center;\n padding: 0.5rem;\n justify-content: center;\n }\n ";var nr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let ir=class extends At{constructor(){super(...arguments),this.defaultStyles=tr,this.videoAttrs=["autoplay","controls","muted","loop","disablepictureinpicture"],this.preload="metadata",this.controlslist="nodownload",this.controls=!0,this.disablepictureinpicture=!0,this.onVideoPlay=e=>at(this,e.type),this.onVideoPlayError=e=>{this.error="Playback Failed"}}createRenderRoot(){return this}disconnectedCallback(){this.scrollObserver.disconnect(),this.videoEl.removeEventListener("play",this.onVideoPlay),super.disconnectedCallback()}firstUpdated(){super.firstUpdated(),this.videoAttrs.forEach((e=>this.videoEl[e]=!!this[e])),window.IntersectionObserver&&(this.scrollObserver=new IntersectionObserver((e=>e.forEach((e=>{1==e.intersectionRatio||this.videoEl.paused||this.videoEl.pause()}))),{threshold:.1}),this.scrollObserver.observe(this.videoEl)),this.videoEl.addEventListener("play",this.onVideoPlay)}updated(e){this.videoEl&&e.forEach(((e,t)=>{this.videoAttrs.some((e=>e===t))&&(this.videoEl[t]=!!this[t])}))}defaultTemplate(){return D`<video id="video" poster="${this.poster?this.poster:""}" preload="${this.preload}" controlslist="${this.controlslist}"><source src="${this.src}" type="video/mp4" @error="${this.onVideoPlayError}">${this.tracksrc?D`<track src="${this.tracksrc}" label="${this.tracklabel}" kind="${this.trackkind}" default>`:null}</video>${this.error?D`<div class="video-playback-error">${hn} <span class="video-playback-error-text">${this.owner.localize("widget.video.playbackError")}</span></div>`:null}`}};nr([Z("video")],ir.prototype,"videoEl",void 0),nr([X({type:String,reflect:!0})],ir.prototype,"src",void 0),nr([X({type:String})],ir.prototype,"error",void 0),nr([X({type:String})],ir.prototype,"poster",void 0),nr([X({type:String})],ir.prototype,"preload",void 0),nr([X({type:String})],ir.prototype,"controlslist",void 0),nr([X({type:String})],ir.prototype,"tracksrc",void 0),nr([X({type:String})],ir.prototype,"tracklabel",void 0),nr([X({type:String})],ir.prototype,"trackkind",void 0),nr([X({type:Boolean})],ir.prototype,"autoplay",void 0),nr([X({type:Boolean})],ir.prototype,"controls",void 0),nr([X({type:Boolean})],ir.prototype,"muted",void 0),nr([X({type:Boolean})],ir.prototype,"loop",void 0),nr([X({type:Boolean})],ir.prototype,"disablepictureinpicture",void 0),ir=nr([qt("livelike-video")],ir);var rr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let or=class extends Jt{constructor(){super(...arguments),this.kind="video-alert",this.owner=this,this.defaultStyles=er,this.trackLinkOpened=()=>{this.interactionEvent();const e={"Alert Id":this.widgetPayload&&this.widgetPayload.id,Nickname:ce&&ce.nickname,"Program ID":this.widgetPayload&&this.widgetPayload.program_id,"Widget Type":Ie(this.widgetPayload.kind),"Link URL":this.link_url};Pe("Alert Link Opened",e,this.programid)},this.onVideoPlayStarted=()=>{this.interactionEvent();const e={"Alert Id":this.widgetPayload&&this.widgetPayload.id,"Program ID":this.widgetPayload&&this.widgetPayload.program_id,"Widget Type":Ie(this.widgetPayload.kind),"Video URL":this.video_url};Pe("Video Alert Play Started",e,this.programid)}}firstUpdated(){super.firstUpdated(),this.isInteractable=this.video_url&&this.video_url.length||this.link_url&&this.link_url.length}render(){const e=this.title||this.text,t=e&&this.link_url?"":e?"no-footer":this.link_url?"no-header":"only-media";return D`<template><livelike-widget-root>${this.title?Pi:null}<livelike-widget-body class="${this.title?"":"no-header"}">${this.text&&D`<div class="video-alert-caption-container"><span class="video-alert-caption">${this.text}</span></div>`}<livelike-video class="${t}" .src="${this.src||this.video_url}" @play="${this.onVideoPlayStarted}"></livelike-video>${this.link_url&&D`<livelike-widget-footer><a class="video-alert-link" href="${this.link_url}" target="_blank" @click="${this.trackLinkOpened}">${this.link_label}</a></livelike-widget-footer>`}</livelike-widget-body></livelike-widget-root></template>`}};rr([X({type:String})],or.prototype,"title",void 0),rr([X({type:String})],or.prototype,"text",void 0),rr([X({type:String})],or.prototype,"video_url",void 0),rr([X({type:String})],or.prototype,"link_url",void 0),rr([X({type:String})],or.prototype,"link_label",void 0),rr([Z("video")],or.prototype,"videoEl",void 0),or=rr([qt("livelike-video-alert")],or);const sr=e=>{let t=`\n :host {\n display: block;\n flex-grow: 1;\n z-index: 10;\n padding: 0.5rem;\n word-break: break-word;\n position: relative;\n ${hi(e.unselectedOptionDescription)}\n }\n :host([image]) {\n padding: 0.75rem 0.5rem 0.25rem 0.5rem;\n }\n :host([selected]) {\n ${hi(e.selectedOptionDescription)}\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionDescription)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionDescription)}\n }`),t};var ar=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let cr=class extends Lt{constructor(){super(...arguments),this.defaultStyles=sr}defaultTemplate(){return D`<slot>${this.description||this.item&&this.item.description||this.owner.text}</slot>`}};ar([X({type:String})],cr.prototype,"description",void 0),cr=ar([qt("livelike-description")],cr);const lr=e=>`\n .widget-dismiss {\n z-index: 1;\n border: none;\n background:none;\n height: 18px;\n margin: 0.5rem;\n display: block;\n ${hi(e.dismiss)}\n }\n .widget-dismiss:hover {\n cursor: pointer;\n }\n `;let ur=class extends At{constructor(){super(...arguments),this.defaultStyles=lr,this.dismissClicked=()=>at(this,"dismiss-clicked")}defaultTemplate(){return D`${this.owner.hide_dismiss_button?null:D`<button class="widget-dismiss" aria-label="Dismiss" @click="${this.dismissClicked}">${ln}</button>`}`}};ur=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-dismiss-button")],ur);const dr=["text-quiz","image-quiz","text-prediction","image-prediction","text-poll","image-poll"],hr=e=>e.value=Ge(e.owner,e.item),pr=e=>{let t=e.owner.phase;e.owner.defaultVoteHide?dr.some((t=>t===e.owner.widgetPayload.kind))&&(e.style.visibility="results"!==t&&"finished"!==t||!(e=>!e.owner.hideVoteInResults||!!e.owner.selectedOption&&!!e.owner.selectedOption.id)(e)?"hidden":"visible"):e.style.visibility="ready"!==t&&("interactive"!==t&&!e.owner.hideVoteInResults||e.owner.selectedOption&&e.owner.selectedOption.id)?"visible":"hidden"},fr=e=>class extends e{constructor(){super(...arguments),this.ownerUpdated=e=>("phase"===e.name||"selectedOption"===e.name)&&pr(this),this.optionUpdated=e=>{hr(this)}}static get properties(){return{value:{type:Number,reflect:!0}}}firstUpdated(){hr(this),pr(this)}},gr=e=>{let t=`\n :host {\n display: block;\n position: relative;\n padding: 0.5rem;\n z-index: 10;\n ${hi(e.unselectedOptionPercentage)}\n }\n :host([selected]) {\n ${hi(e.selectedOptionPercentage)}\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionPercentage)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionPercentage)}\n }\n `),t};let mr=class extends(fr(Lt)){constructor(){super(...arguments),this.defaultStyles=gr}defaultTemplate(){return D`${this.value}%`}};mr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-percentage")],mr);const vr=e=>{let t=`\n :host {\n height: 2rem;\n position: absolute;\n border-radius: 3px;\n transition: ease width 0.4s;\n background: rgba(255, 255, 255, 0.12);\n ${hi(e.unselectedOptionBar)}\n }\n :host([selected]) {\n ${hi(e.selectedOptionBar)}\n }\n :host([hidden]) {\n display: none;\n }\n `;return e.correctOption&&(t+=`\n :host([correct]) {\n ${hi(e.correctOptionBar)}\n }\n :host([incorrect]) {\n ${hi(e.incorrectOptionBar)}\n }\n `),t};var yr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let br=class extends(fr(Lt)){constructor(){super(...arguments),this.defaultStyles=vr,this.max=100,this.min=0}updated(e){super.updated(e),e.has("value")&&(this.style.width=this.value+"%")}defaultTemplate(){return D`<slot></slot>`}};yr([X({type:Number,reflect:!0})],br.prototype,"max",void 0),yr([X({type:Number,reflect:!0})],br.prototype,"min",void 0),br=yr([qt("livelike-progress")],br);const wr=()=>"\n :host{\n display: block;\n }\n";var kr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let _r=class extends At{constructor(){super(...arguments),this.defaultStyles=wr}firstUpdated(){this.items=this.items||this.owner.options||this.owner.choices;const e=this.querySelector("template");this.items.map(((t,n)=>{const i=e.content.firstElementChild;i.setAttribute("index",n);const r=function(e){let t=e.cloneNode(!0);return Object.keys(e).forEach((n=>t[n]=e[n])),t}(i);this.appendChild(r)})),e.remove(),super.firstUpdated()}defaultTemplate(){return D`<slot></slot>`}};kr([X({type:Array})],_r.prototype,"items",void 0),_r=kr([qt("livelike-select")],_r);const Pr=e=>`\n :host {\n width: 0%;\n display: block;\n background: white;\n height: 2px;\n position: absolute;\n bottom: 0;\n transition-timing-function: linear;\n ${hi(e.timer)}\n }\n `;var Sr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let xr=class extends At{constructor(){super(...arguments),this.started=!1,this.defaultStyles=Pr,this.start=()=>{if(!this.started){this.started=!0;const e=(new Date).getTime(),t=()=>{const n=this.time||this.owner.timeout,i=(new Date).getTime()-e,r=100*(1-(n-i)/n);this.style.width=`${r>100?100:r}%`,i<n&&"interactive"===this.owner.phase&&requestAnimationFrame(t)};t()}},this.ownerUpdated=e=>{"phase"===e.name&&("interactive"===e.prop?this.start():this.style.display="none")}}firstUpdated(){"interactive"===this.owner.phase&&this.start(),this.pageVisible=!document.hidden,st.on("pageVisibilityChange",(e=>this.pageVisible=e.pageVisible))}render(){return D`<slot></slot>`}};Sr([X({type:Number,reflect:!0})],xr.prototype,"time",void 0),Sr([X({type:Boolean})],xr.prototype,"pageVisible",void 0),xr=Sr([qt("livelike-timer")],xr);const Or=e=>`\n :host {\n padding: 0.5rem 1rem;\n flex-grow: 1;\n overflow-wrap: break-word;\n width: 85%;\n margin: 0;\n ${hi(e.title)}\n }\n\n .widget-tag{\n font-size: 12px;\n color: rgba(255,255,255,0.5);\n font-family: "HelveticaNeue-Bold";\n ${hi(e.tag)}\n }\n `;var Tr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Cr=class extends At{constructor(){super(...arguments),this.defaultStyles=Or,this.getTag=()=>{switch(this.kind||this.owner.kind){case"text-quiz":case"image-quiz":return this.owner.localize("widget.quiz.tag");case"text-poll":case"image-poll":return this.owner.localize("widget.poll.tag");case"text-prediction":case"image-prediction":return this.owner.localize("widget.prediction.tag");case"text-prediction-follow-up":case"image-prediction-follow-up":return this.owner.localize("widget.followup.tag");default:return""}}}defaultTemplate(){const e=this.getTag().trim();return D`<slot>${e.length>0?D`<div class="widget-tag">${e}</div>`:null}<div>${this.title||this.owner.question||this.owner.title||this.owner.comment}</div></slot>`}};Tr([X({type:String})],Cr.prototype,"title",void 0),Cr=Tr([qt("livelike-title")],Cr);const Er=e=>"\n :host {\n\n }\n ";var Rr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Ar=class extends Lt{constructor(){super(...arguments),this.defaultStyles=Er,this.updateCount=e=>{const t=e&&(String(e.vote_count)||String(e.answer_count));this.count=t||this.owner.count||0},this.ownerUpdated=e=>{"options"!==e.name&&"choices"!==e.name&&"count"!==e.name||this.updateCount(this.item)}}connectedCallback(){super.connectedCallback(),this.updateCount(this.item)}defaultTemplate(){return D`${this.count}`}};Rr([X({type:String,reflect:!0})],Ar.prototype,"count",void 0),Ar=Rr([qt("livelike-vote-count")],Ar);const Mr=e=>`\n :host {\n display: block;\n border-radius: 0 0 6px 6px;\n background: rgba(0,0,0,6);\n ${hi(e.body)}\n }\n `;let jr=class extends At{constructor(){super(...arguments),this.defaultStyles=Mr}defaultTemplate(){return D`<slot></slot>`}};jr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-body")],jr);const Lr=()=>"\n :host {\n display:flex;\n justify-content: center;\n margin: 0.5rem;\n }\n ";let Nr=class extends At{constructor(){super(...arguments),this.defaultStyles=Lr}firstUpdated(){let e="";const t=`\n <time datetime="${this.owner.published_at}">\n ${He(this.owner.published_at,this.owner.timeformat,this.owner.lang)}\n </time>\n `;this.owner.authors&&this.owner.created_by.name&&(e+=`<span>${this.owner.created_by.name}</span>`,this.owner.timestamps&&(e+=" – ")),this.owner.timestamps&&(e+=t),this.insertAdjacentHTML("afterbegin",e)}defaultTemplate(){return D`<slot></slot>`}};Nr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-bylines")],Nr);const Ur=e=>`\n :host {\n ${hi(e.footer)}\n }\n `;let Ir=class extends At{constructor(){super(...arguments),this.defaultStyles=Ur}defaultTemplate(){return D`<slot></slot>`}};Ir=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-footer")],Ir);const Dr=e=>`\n :host {\n display: flex;\n position: relative;\n border-radius: 6px 6px 0 0;\n ${hi(e.header)}\n }\n `;let Br=class extends At{constructor(){super(...arguments),this.defaultStyles=Dr}defaultTemplate(){return D`<slot name="title"></slot><slot name="dismiss"></slot><slot></slot>`}};Br=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-header")],Br);const $r=e=>`\n :host {\n color: #fff;\n position: relative;\n display: block;\n ${hi(e.root)}\n }\n `;let Fr=class extends At{constructor(){super(...arguments),this.defaultStyles=$r}defaultTemplate(){return D`<livelike-widget-bylines></livelike-widget-bylines><slot name="header"></slot><slot name="timer"></slot><slot name="body"></slot><slot></slot><livelike-widget-reactions></livelike-widget-reactions>`}};Fr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([qt("livelike-widget-root")],Fr);const Kr=e=>`\n :host {\n display:flex;\n }\n .bar-container {\n font-size: 14px;\n padding: .25rem 0;\n transition: all 0.4s ease;\n text-align: center;\n }\n .bar0{\n background: linear-gradient(to left, #3023ae, #53a0fd);\n ${hi(e.sideABar)}\n }\n .bar1{\n background: linear-gradient(to right, #9f041b, #f5515f);\n ${hi(e.sideBBar)}\n }\n `;var qr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let zr=class extends At{constructor(){super(...arguments),this.defaultStyles=Kr,this.ownerUpdated=e=>{"options"!==e.name&&"choices"!==e.name||(this.items=e.prop)}}connectedCallback(){super.connectedCallback(),this.items=this.items||this.owner.options||this.owner.choices}defaultTemplate(){const e=Math.round(1/this.items.length*100);return D`${this.items.map(((t,n)=>{const i=`width:${Ge(this.owner,t,e)}%`;return D`<div class="bar-container bar${n}" style="${i}">${t.description?D`<div>${t.description}</div>`:null}</div>`}))}`}};qr([X({type:Array})],zr.prototype,"items",void 0),zr=qr([qt("livelike-dueling-progress")],zr);const Hr=e=>`\n .text-ask-prompt-container {\n padding: 1rem;\n ${hi(e.prompt)}\n }\n .text-ask-prompt {\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n width: 100%;\n }\n .text-ask-form {\n padding: 0 16px 16px 16px;\n }\n .text-ask-input-container {\n padding: 15px 3px 17px 15px;\n border-radius: 4px;\n background-color: rgb(40,40,40);\n border-color: rgb(63,63,63);\n position: relative;\n }\n .text-ask-input {\n border: none;\n background-color: rgb(40,40,40);\n color: rgb(255,255,255);\n font-size: 12px;\n line-height: 20px;\n resize: none; \n width: 100%;\n box-sizing: border-box;\n padding: 0;\n padding-right: 8px;\n font-family: "HelveticaNeue-Regular";\n ${hi(e.replyEnabled)}\n }\n .text-ask-input::placeholder {\n color: rgb(171,171,171);\n ${hi(e.replyPlaceholder)}\n } \n .text-ask-input:focus {\n outline: none;\n }\n .text-ask-input[disabled] {\n color: rgb(171,171,171);\n ${hi(e.replyDisabled)}\n }\n .text-ask-input::-webkit-scrollbar {\n width: 4px;\n }\n .text-ask-input::-webkit-scrollbar-track {\n margin-right: 3px;\n }\n .text-ask-input::-webkit-scrollbar-thumb {\n -webkit-border-radius: 100px;\n border-radius: 100px;\n background: rgb(84,84,84);\n -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);\n }\n .text-ask-input-counter {\n font-size: 10px;\n color: rgb(171,171,171);\n position: absolute;\n right: 5px;\n bottom: 2px;\n }\n .text-ask-button {\n width: fit-content;\n padding: 12px 16px;\n border: none;\n border-radius: 4px;\n font-size: 10px;\n font-family: "HelveticaNeue-Bold";\n cursor: pointer;\n ${hi(e.submitButtonEnabled)} \n }\n .text-ask-button[disabled] {\n background-color: rgb(84,84,84);\n color: rgb(171,171,171);\n cursor: default;\n ${hi(e.submitButtonDisabled)}\n }\n .confirmation-message-container {\n padding: 0;\n padding-left: 11px;\n }\n .hidden {\n opacity: 0;\n }\n .confirmation-message {\n color: rgb(0,240,120);\n font-size: 12px;\n text-align: left;\n word-break: break-word;\n word-wrap: break-word;\n padding: 0;\n ${hi(e.confirmation)}\n }\n .text-ask-footer {\n padding: 0 16px 16px 16px;\n display: flex;\n align-items: center;\n }\n `;var Vr=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};let Gr=class extends Jt{constructor(){super(...arguments),this.kind="text-ask",this.owner=this,this.defaultStyles=Hr,this.text="",this.maxlength=240,this.replyDisable=!0,this.firstUpdated=()=>{super.firstUpdated(),this.interaction&&(this.text=this.interaction.text,this.disabled=!0,this.showConfirmation=!0)},this.submitReply=()=>{this.replyDisable=!0,this.interactionEvent(),Me.post({url:this.widgetPayload.reply_url,data:{text:this.text}}).then((e=>{this.disabled=!0,this.replyDisable=!1,this.reply=this.text,this.showConfirmation=!0})).catch((e=>{this.replyDisable=!1}))},this.inputHandler=e=>{this.text=e.target.value.trimLeft(),this.inputEl.value=this.text,this.counter.textContent=this.maxlength-this.text.length,this.replyDisable=!(this.text.length>0)}}get counter(){return this.querySelector(".text-ask-input-counter")}get inputEl(){return this.querySelector(".text-ask-input")}render(){return D`<template><livelike-widget-root>${Pi}<livelike-widget-body><div class="text-ask-prompt-container"><span class="text-ask-prompt">${this.prompt}</span></div><form class="text-ask-form"><div class="text-ask-input-container"><textarea class="text-ask-input" type="text" name="reply" rows="2" .value="${this.text}" maxlength="${this.maxlength}" ?disabled="${this.disabled}" placeholder="${this.owner.localize("widget.textAsk.placeholder")}" @input="${this.inputHandler}"></textarea> ${this.disabled?null:D`<span class="text-ask-input-counter">${this.maxlength}</span>`}</div></form><div class="text-ask-footer"><button class="text-ask-button" @click="${this.submitReply}" ?disabled="${this.disabled||this.replyDisable}"><span class="text-ask-button-label">${this.owner.localize("widget.textAsk.sendButton.label")}</span></button><div class="confirmation-message-container ${this.showConfirmation?"":"hidden"}"><span class="confirmation-message">${this.confirmation_message}</span></div></div></livelike-widget-body></livelike-widget-root></template>`}};Vr([X({type:String})],Gr.prototype,"title",void 0),Vr([X({type:String})],Gr.prototype,"prompt",void 0),Vr([X({type:String})],Gr.prototype,"confirmation_message",void 0),Vr([X({type:Boolean})],Gr.prototype,"replyDisable",void 0),Vr([X({type:Boolean})],Gr.prototype,"showConfirmation",void 0),Gr=Vr([qt("livelike-text-ask")],Gr);const Wr={_$$:se,_config:ae,userProfile:ce,applyTheme:pi,addMessageListener:(e,t)=>it(e.roomId).then((n=>{const i=i=>{i.message&&(i.message.payload.timetoken=i.timetoken),i.channel===n&&t({message:i.data||i.message.payload,roomId:e.roomId,event:Ne[i.event||i.message.event]})};bt.add(n,e.roomId,t,{message:i,messageAction:i})})),removeMessageListener:(e,t)=>bt.remove(e.roomId,t),createUserProfile:vi,getUserProfile:mi,init:e=>new Promise((t=>{let n=se.ready&&se.clientId&&ce;var i;n&&console.error("LiveLike EngagementSDK has already been initialized!"),n||((i=document.createElement("script")).type="text/javascript",i.src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2.4.4/webcomponents-loader.js",document.body.append(i),se.pageVisible=!document.hidden,document.addEventListener("visibilitychange",(()=>{se.pageVisible=!document.hidden,st.emit("pageVisibilityChange",{pageVisible:!document.hidden})}),!1)),!e.accessToken&&console.warn(`LiveLike EngagementSDK has been initialized without an accessToken.\n ${lt()}`),e.endpoint&&(se.endpoint=e.endpoint),se.ready=!1,se.logger=e.logger||null,se.clientId=e.clientId,se.accessToken=e.accessToken||null,se.lsKey="livelike-user-auth-"+e.clientId,e.syncStrategy&&(se.syncStrategy=e.syncStrategy),se.storageStrategy=e.storageStrategy||gt,e.localizedStrings&&fi(e.localizedStrings),pi(e.theme||{}).then((()=>et().then((i=>{!n&&i.mixpanel_token&&function(e,t){var n=document,i=window.mixpanel||[];if(!i.__SV){var r,o,s=window;try{var a,c,l,u=s.location,d=u.hash;a=function(e,t){return(c=e.match(RegExp(t+"=([^&]*)")))?c[1]:null},d&&a(d,"state")&&"mpeditor"===(l=JSON.parse(decodeURIComponent(a(d,"state")))).action&&(s.sessionStorage.setItem("_mpcehash",d),history.replaceState(l.desiredHash||"",n.title,u.pathname+u.search))}catch(e){}window.mixpanel=i,i._i=[],i.init=function(e,t,n){function s(e,t){var n=t.split(".");2==n.length&&(e=e[n[0]],t=n[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var a=i;for(void 0!==n?a=i[n]=[]:n="mixpanel",a.people=a.people||[],a.toString=function(e){var t="mixpanel";return"mixpanel"!==n&&(t+="."+n),e||(t+=" (stub)"),t},a.people.toString=function(){return a.toString(1)+".people (stub)"},r="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" "),o=0;o<r.length;o++)s(a,r[o]);var c="set set_once union unset remove delete".split(" ");a.get_group=function(){function e(e){t[e]=function(){call2_args=arguments,call2=[e].concat(Array.prototype.slice.call(call2_args,0)),a.push([n,call2])}}for(var t={},n=["get_group"].concat(Array.prototype.slice.call(arguments,0)),i=0;i<c.length;i++)e(c[i]);return t},i._i.push([e,t,n])},i.__SV=1.2,(s=n.createElement("script")).type="text/javascript",s.async=!0,s.src="undefined"!=typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===n.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js",(a=n.getElementsByTagName("script")[0]).parentNode.insertBefore(s,a)}mixpanel.init(e),mixpanel.register(t)}(i.mixpanel_token,i.analytics_properties),se.programUrlTemplate=i.program_detail_url_template,se.chatUrlTemplate=i.chat_room_detail_url_template,se.leaderboardUrlTemplate=i.leaderboard_detail_url_template,se.createChatUrlTemplate=i.create_chat_room_url,se.profileDetailUrlTemplate=i.profile_detail_url_template,se.profileUrl=i.profile_url,((e,t)=>{if(e)return mi({accessToken:e});{let e=se.storageStrategy.get();return e?mi({accessToken:e.access_token}):vi({nickname:t})}})(e.accessToken,e.nickName).then((r=>{se.storageStrategy.set(r),Object.assign(ce,r);const o={subscribeKey:i.pubnub_subscribe_key,origin:i.pubnub_origin,authKey:r.access_token};i.pubnub_heartbeat_interval&&(o.heartbeatInterval=i.pubnub_heartbeat_interval),i.pubnub_presence_timeout&&(o.presenceTimeout=i.pubnub_presence_timeout);const s=e.publishKey||i.pubnub_publish_key;s&&(o.publishKey=s);const a=()=>{se.ready=!0,ae.ready=!0,t(r)},c=-1!==Object.keys(o).findIndex((e=>se.pn&&se.pn._config[e]!==o[e]));!se.pn||c?(e=>(se.logger&&console.table(Object.assign(Object.assign({},e),{profileToken:ce.access_token})),xe=new _e(Object.assign(Object.assign({},e),{uuid:ce.id,restore:!0,ssl:!0})),se.pn=xe,Promise.resolve()))(o).then((()=>{!n&&zt.initialize(),a()})):a()}))}))))})),getMessageCount:(e,t)=>new Promise(((n,i)=>{e||ht("roomId","messagecount");let r=null;if(t&&t.since)if(Pt(t.since)){const e=new Date(t.since).getTime();r=String(e)+"0011"}else i(dt("messageCount","since","Date"));it(e).then((t=>((e,t)=>xe.history({channel:e,stringifiedTimeToken:!0,end:t,count:100}))(t,r).then((t=>{console.log("get history r.messages",t),n({roomId:e,count:Ye(e,t.messages).length})}))))})),getMessageList:Qt,sendMessage:tn,prepareOutgoingChatMessage:(e,t)=>en[e]=t,updateUserProfile:e=>e.accessToken?gi("patch",e.options,e.accessToken).then((t=>(t.access_token=e.accessToken,t.id===ce.id&&(se.storageStrategy.set(t),ce.nickname=t.nickname,Object.assign(ce,t)),t))):ht("accessToken","updateuserprofile"),registerWidgetMode:$t,getWidget:Bt,getPostedWidgets:({programId:e})=>Dt({programId:e}).then((e=>ot(["widgets","widget_interactions_url_template"],e))),addWidgetListener:(e,t)=>nt(e.programId).then((n=>bt.add(n.subscribe_channel,e.programId,t,{message:i=>i.channel===n.subscribe_channel&&t({event:i.message.event,widgetPayload:i.message.payload,programId:e.programId})}))),removeWidgetListener:(e,t)=>bt.remove(e.programId,t),createChatRoom:e=>e&&e.visibility&&"members"!==e.visibility&&"everyone"!==e.visibility?Promise.reject("Invalid value for visibility"):Me.post({url:se.createChatUrlTemplate,data:e}).then(bi),updateChatRoom:(e,t)=>ki({roomId:e}).then((e=>Me.patch({url:e.url,data:t}).then(bi))),getChatRoom:e=>ki(e).then(bi),joinChatRoom:e=>_i(e,"post"),leaveChatRoom:e=>_i(e,"delete").then(wi),getChatUserMutedStatus:e=>ki(e).then((e=>fetch(Je(ce.id,e.muted_status_url_template)).then((e=>e.json())))),getChatRoomMemberships:e=>_i(e,"get"),getProfileChatRoomMemberships:()=>Me.get({url:ce.chat_room_memberships_url}),getLeaderboards:e=>e&&e.programId?Ze.program(e.programId).then((e=>e.leaderboards)):ht("programId","leaderbaord"),getLeaderboard:e=>e&&e.leaderboardId?Ze.leaderboard(e.leaderboardId):ht("leaderboardId","leaderboard"),getLeaderboardEntries:e=>(e=>e&&e.leaderboardId?Ze.leaderboard(e.leaderboardId).then((e=>rt(e.entries_url,(e=>Me.get({url:e})),(e=>({count:e.count,entries:e.results}))))):ht("leaderboardId","leaderboard"))(e).then((e=>ot(["entries"],e))),getLeaderboardProfileRank:e=>e&&e.leaderboardId&&e.profileId?Ze.leaderboard(e.leaderboardId).then((t=>Ze.leaderboardEntryDetail(t.entry_detail_url_template,e.profileId))):e&&e.leaderboardId?ht("profileId","leaderboard"):ht("leaderboardId","leaderboard"),applyLocalization:fi,getWidgetInteractions:Ft,getSponsors:e=>e&&e.programId?Ze.program(e.programId).then((e=>e.sponsors)):ht("programId","sponsor"),getProfileBadges:e=>e&&e.profileId?(e=>mi(e).then(yi))(e).then((e=>ot(["results"],e))):ht("profileId","getProfileBadges"),getApplicationBadges:()=>et().then((e=>ot(["results"],yi(e)))),getBadgeProgress:e=>e&&e.profileId&&e.badgeIds&&e.badgeIds.length>0?mi(e).then((t=>Me.get({url:t.badge_progress_url+"?badge_id="+e.badgeIds.join("&badge_id=")}))):e&&e.profileId?ht("badgeIds","getBadgeProgress"):ht("profileId","getBadgeProgress")};window.LiveLike=Wr,window.ProgramDateTimeSyncStrategy=ni,window.HlsJsSyncStrategy=class extends ni{constructor(e,t){super(),this.hls=e,this.video=t,this.level=null,this.frag=null,this.hls.on(ei,((e,t)=>{this.level=this.hls.levels[t.level]})),this.hls.on(ti,((e,t)=>{this.frag=t.frag}))}get baseProgramDateTimeMs(){return this.frag?this.frag.programDateTime:this.level?this.level.details.fragments[0].programDateTime:void 0}get fragmentStartMs(){return this.frag?1e3*this.frag.start:this.level?1e3*this.level.details.fragments[0].start:void 0}get videoCurrentTimeMs(){return 1e3*this.video.currentTime}get programDateTime(){if(this.level){let e=this.baseProgramDateTimeMs+this.videoCurrentTimeMs-this.fragmentStartMs;return new Date(e)}}},window.html=D,window.property=X,window.LiveLikeWidgetElement=class extends Lt{},window.LiveLikeWidget=Xt,window.LiveLikeWidgetMixin=e=>class extends e{connectedCallback(){super.connectedCallback(),this.setupWidget()}},window.LiveLikePoll=Oi,window.LiveLikeQuiz=Ci,window.LiveLikePrediction=Ri,window.LiveLikeFollowUp=Ai,window.LiveLikeAlert=Li,window.LiveLikeEmojiSlider=Ii,window.LiveLikeSocialEmbed=Ki,window.LiveLikeRichPost=zi,window.LiveLikeCheerMeter=Qi,window.LiveLikeVideoAlert=or,window.LiveLikeDescription=cr,window.LiveLikeDismissButton=ur,window.LiveLikeImage=Xi,window.LiveLikeOption=Wi,window.LiveLikePercentage=mr,window.LiveLikeProgress=br,window.LiveLikeSelect=_r,window.LiveLikeTimer=xr,window.LiveLikeTitle=Cr,window.LiveLikeVoteCount=Ar,window.LiveLikeWidgetBody=jr,window.LiveLikeWidgetBylines=Nr,window.LiveLikeWidgetFooter=Ir,window.LiveLikeWidgetHeader=Br,window.LiveLikeWidgetRoot=Fr,window.LiveLikeDuelingProgress=zr,window.LiveLikeTextAsk=Gr,window.LiveLikeVideo=ir;
|
|
204
204
|
/**
|
|
205
205
|
* @license
|
|
206
206
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -281,7 +281,7 @@ class fo{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,thi
|
|
|
281
281
|
* Code distributed by Google as part of the polymer project is also
|
|
282
282
|
* subject to an additional IP rights grant found at
|
|
283
283
|
* http://polymer.github.io/PATENTS.txt
|
|
284
|
-
*/;function Eo(e){let t=
|
|
284
|
+
*/;function Eo(e){let t=Ro.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},Ro.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const i=e.strings.join(Xr);return n=t.keyString.get(i),void 0===n&&(n=new to(e,e.getTemplateElement()),t.keyString.set(i,n)),t.stringsArray.set(e.strings,n),n}const Ro=new Map,Ao=new WeakMap;
|
|
285
285
|
/**
|
|
286
286
|
* @license
|
|
287
287
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -334,7 +334,7 @@ class{handleAttributeExpressions(e,t,n,i){const r=t[0];if("."===r){return new So
|
|
|
334
334
|
* Code distributed by Google as part of the polymer project is also
|
|
335
335
|
* subject to an additional IP rights grant found at
|
|
336
336
|
* http://polymer.github.io/PATENTS.txt
|
|
337
|
-
*/,Lo=(e,t)=>`${e}--${t}`;let No=!0;void 0===window.ShadyCSS?No=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),No=!1);const Uo=e=>t=>{const n=Lo(t.type,e);let i=
|
|
337
|
+
*/,Lo=(e,t)=>`${e}--${t}`;let No=!0;void 0===window.ShadyCSS?No=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),No=!1);const Uo=e=>t=>{const n=Lo(t.type,e);let i=Ro.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},Ro.set(n,i));let r=i.stringsArray.get(t.strings);if(void 0!==r)return r;const o=t.strings.join(Xr);if(r=i.keyString.get(o),void 0===r){const n=t.getTemplateElement();No&&window.ShadyCSS.prepareTemplateDom(n,e),r=new to(t,n),i.keyString.set(o,r)}return i.stringsArray.set(t.strings,r),r},Io=["html","svg"],Do=new Set,Bo=(e,t,n)=>{Do.add(e);const i=n?n.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:o}=r;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(i,e);const s=document.createElement("style");for(let e=0;e<o;e++){const t=r[e];t.parentNode.removeChild(t),s.textContent+=t.textContent}(e=>{Io.forEach((t=>{const n=Ro.get(Lo(t,e));void 0!==n&&n.keyString.forEach((e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{n.add(e)})),so(e,n)}))}))})(e);const a=i.content;n?function(e,t,n=null){const{element:{content:i},parts:r}=e;if(null==n)return void i.appendChild(t);const o=document.createTreeWalker(i,133,null,!1);let s=co(r),a=0,c=-1;for(;o.nextNode();)for(c++,o.currentNode===n&&(a=ao(t),n.parentNode.insertBefore(t,n));-1!==s&&r[s].index===c;){if(a>0){for(;-1!==s;)r[s].index+=a,s=co(r,s);return}s=co(r,s)}}(n,s,a.firstChild):a.insertBefore(s,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)t.insertBefore(c.cloneNode(!0),t.firstChild);else if(n){a.insertBefore(s,a.firstChild);const e=new Set;e.add(s),so(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const $o={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Fo=(e,t)=>t!==e&&(t==t||e==e),Ko={attribute:!0,type:String,converter:$o,reflect:!1,hasChanged:Fo},qo="finalized";class zo extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,n)=>{const i=this._attributeNameForProperty(n,t);void 0!==i&&(this._attributeToPropertyMap.set(i,n),e.push(i))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=Ko){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const r=this[e];this[t]=i,this.requestUpdateInternal(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Ko}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(qo)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=Fo){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,i=t.converter||$o,r="function"==typeof i?i:i.fromAttribute;return r?r(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,i=t.converter;return(i&&i.toAttribute||$o.toAttribute)(e,n)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=Ko){const i=this.constructor,r=i._attributeNameForProperty(e,n);if(void 0!==r){const e=i._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){const e=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,n){let i=!0;if(void 0!==e){const r=this.constructor;n=n||r.getPropertyOptions(e),r._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}zo.finalized=!0;
|
|
338
338
|
/**
|
|
339
339
|
* @license
|
|
340
340
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -372,7 +372,7 @@ const Ho=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Objec
|
|
|
372
372
|
* subject to an additional IP rights grant found at
|
|
373
373
|
* http://polymer.github.io/PATENTS.txt
|
|
374
374
|
*/
|
|
375
|
-
(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const Zo={};class Qo extends zo{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight(((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e)),n),n=t(e,new Set),i=[];n.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!Yo){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new Xo(String(t),Jo)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Yo?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==Zo&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return Zo}}Qo.finalized=!0,Qo.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const i=n.scopeName,r=
|
|
375
|
+
(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const Zo={};class Qo extends zo{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight(((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e)),n),n=t(e,new Set),i=[];n.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!Yo){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new Xo(String(t),Jo)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Yo?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==Zo&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return Zo}}Qo.finalized=!0,Qo.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const i=n.scopeName,r=Ao.has(t),o=No&&11===t.nodeType&&!!t.host,s=o&&!Do.has(i),a=s?document.createDocumentFragment():t;if(((e,t,n)=>{let i=Ao.get(t);void 0===i&&(Jr(t,t.firstChild),Ao.set(t,i=new _o(Object.assign({templateFactory:Eo},n))),i.appendInto(t)),i.setValue(e),i.commit()})(e,a,Object.assign({templateFactory:Uo(i)},n)),s){const e=Ao.get(a);Ao.delete(a);const n=e.value instanceof fo?e.value.template:void 0;Bo(i,a,n),Jr(t,t.firstChild),t.appendChild(a),Ao.set(t,e)}!r&&o&&window.ShadyCSS.styleElement(t.host)},Qo.shadowRootOptions={mode:"open"};
|
|
376
376
|
/**
|
|
377
377
|
* @license
|
|
378
378
|
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
|
@@ -386,4 +386,86 @@ const Ho=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Objec
|
|
|
386
386
|
* subject to an additional IP rights grant found at
|
|
387
387
|
* http://polymer.github.io/PATENTS.txt
|
|
388
388
|
*/
|
|
389
|
-
const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=>t=>{const n=es.get(t);if(void 0===e&&t instanceof ko){if(void 0!==n||!es.has(t)){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==n&&t.setValue(e);es.set(t,e)})),ns=D`<style>live-moneyline,live-spread,live-total{display:block;opacity:0;transform:translateX(-200%);-webkit-transform:translateX(-200%)}.animate-widget-in{animation:slide-in .8s forwards;-webkit-animation:slide-in .8s forwards}@keyframes slide-in{100%{transform:translateX(0);opacity:1}}@-webkit-keyframes slide-in{100%{-webkit-transform:translateX(0);opacity:1}}.embet-widget livelike-widget-header{border-radius:0;height:22.5%}.embet-widget livelike-widget-header .center{width:100%;text-align:center;padding-top:1rem}.embet-widget .widget-tagline{font-size:18px;font-weight:700;font-family:sans-serif;padding-bottom:10px;text-transform:uppercase}.embet-widget livelike-title{color:#8c9aad;text-transform:uppercase;font-family:sans-serif;font-weight:700;padding:0;display:block;width:100%}.embet-widget livelike-widget-body{border-radius:0;height:47.5%}.embet-widget livelike-widget-footer{border-radius:0;height:30%}.embet-widget .option-container{padding:1rem;height:100%;align-items:stretch;display:flex;flex-direction:column}.embet-widget livelike-option{height:50%;border-width:2px;border-style:solid;border-radius:0;padding:0;box-shadow:5px 5px 10px 1px rgba(0,0,0,.2);align-items:unset}.embet-widget .option-container[interacted] livelike-option{background:rgba(50,50,50,.7);border:2px solid rgba(190,190,190,.7)}.embet-widget .option-container[interacted] livelike-option[selected]{border:2px solid rgba(0,250,0,.7)}.embet-widget livelike-option:not(:last-of-type){margin-bottom:1rem}.embet-widget livelike-option .option-image-wrap{display:flex;width:100%;position:relative}.embet-widget livelike-option .percentage-container{position:absolute;display:flex;text-align:center;transform:translate(-50%,-50%);top:50%;left:50%;white-space:nowrap}.embet-widget livelike-description{word-break:unset;align-self:center;padding:0 .5rem}.embet-widget .bet-details{padding:0 .5rem;align-self:center}.embet-widget livelike-image img{padding-left:6px}.embet-widget livelike-percentage{padding:0 5px 0 0}.embet-widget livelike-progress{height:100%;background:rgba(160,160,160,.7);border-radius:0}.embet-widget livelike-progress[selected]{background:rgba(0,225,0,.7)}.embet-widget .option-container[interacted] .bet-details,.embet-widget .option-container[interacted] livelike-description,live-moneyline .embet-widget .option-container[interacted] livelike-image,live-spread .embet-widget .option-container[interacted] livelike-image{opacity:.2}.embet-widget livelike-timer{height:3px}live-total .embet-widget .option-container{flex-direction:row}live-total .embet-widget livelike-image img{padding-left:0}live-total .embet-widget .bet-details,live-total .embet-widget livelike-descrption{padding:8px}.live-total-text-options{display:flex;flex-direction:column;width:100%;padding:0 10px}</style>`;function is(e){if(e){let t="";return Object.keys(e).forEach((n=>{let i=(e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase())(n);"fontColor"===n&&(i="color"),t+=`${i}: ${e[n]};\n`})),t}return""}function rs(e){return D`<style>.dismiss-button{background:0 0;border:none;position:absolute;top:12px;right:16px}.dismiss-button:hover{cursor:pointer}</style><button class="dismiss-button" @click="${()=>((e,t,n)=>{const i=new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return e.dispatchEvent(i),i})(e,"dismiss-clicked")}"><svg height="18px" width="18px" viewBox="0 0 28 28"><polygon points="28,22.398 19.594,14 28,5.602 22.398,0 14,8.402 5.598,0 0,5.602 8.398,14 0,22.398 5.598,28 14,19.598 22.398,28" style="fill:#979797"/></svg></button>`}class os extends Ai{constructor(){super(...arguments),this.defaultVoteHide=!1,this.hideVoteInResults=!1,this.voteCallback=e=>{e.detail&&e.detail.item&&e.detail.item.id&&!this.voted&&(this.voted=!0)},this.updateThemeStyles=e=>{this.themeStyles=Object.assign(Object.assign({},this.themeStyles),e)},this.themeUpdated=e=>{this.requestUpdate()},this.parseCustomData=e=>{if(this.sponsors=e.sponsors||this.widgetPayload.sponsors||[],this.place_bet_url=this.customData.place_bet_url||"",e.theme&&e.theme.widgets){Wr.applyTheme(e.theme);const t=this.kind||this.widgetPayload.kind;!this.widgetPayload.kind&&(this.widgetPayload.kind=t),this.themeStyles=e.theme.widgets[t.split("-")[1]]}if(e.customCss){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e.customCss),this.appendChild(t)}e.customStyles&&(this.customStyles=e.customStyles)},this.getWidth=()=>{const e=this.querySelector("livelike-widget-root").clientWidth;if(e){const t=e>=375?"1.5vw":e>=350?"1.75vw":"2vw",n=this.querySelectorAll("livelike-description"),i=this.querySelector("livelike-title"),r=this.querySelectorAll(".bet-details"),o=this.querySelector(".bet-button"),s=this.querySelector(".widget-tagline");n.forEach((e=>{e.style.fontSize=t})),i.style.fontSize=t,r.forEach((e=>{e.style.fontSize=t})),o.style.fontSize=t,s.style.fontSize=t}else setTimeout(this.getWidth,250)}}static get properties(){return{voted:{type:Boolean},customData:{type:Object},sponsors:{type:Array},place_bet_url:{type:String},themeStyles:{type:Object},customStyles:{type:String},options:{type:Array},optionsRenderer:{type:Function}}}connectedCallback(){super.connectedCallback(),this.addEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}disconnectedCallbck(){super.disconnectedCallbck(),window.removeEventListener("resize",this.getWidth),this.removeEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}firstUpdated(){super.firstUpdated(),this.customData&&this.parseCustomData(this.customData),this.widgetPayload.options&&(this.options=this.widgetPayload.options),this.updateComplete.then((()=>{this.classList.add("animate-widget-in");const e=this.querySelector("livelike-widget-root");window.addEventListener("resize",this.getWidth),this.getWidth(),e.updateComplete.then((()=>{const t=e.shadowRoot.querySelector("livelike-widget-bylines");t&&t.remove();const n=e.shadowRoot.querySelector("livelike-widget-reactions");n&&n.remove()}))}))}render(){const e=this.customData&&this.customData.type?D`<div class="widget-tagline">${this.customData.type}</div>`:null;return D`<template>${ns}<style>${this.customStyles}.embet-widget{height:${this.customData&&this.customData.widgetHeight?this.customData.widgetHeight:"100%"}}</style><livelike-widget-root class="embet-widget"><livelike-widget-header class="widget-header" slot="header"><div class="center">${e}<livelike-title></livelike-title></div>${rs(this)}</livelike-widget-header><livelike-widget-body>${this.optionsRenderer(this.options,this.customData,this.voted)}</livelike-widget-body>${function(e,t,n,i){let r,o;return t&&(r=is(t.footer),o=is(t.betButton)),D`<style>livelike-widget-footer{display:flex;border-radius:0;padding:10px 16px;${r}}.footer-container{width:50%;display:flex;flex-direction:column;justify-content:center;margin:5px;padding:5px}.footer-text{height:12px;text-align:center;font-size:12px;color:#999;font-family:sans-serif;white-space:nowrap;margin-bottom:10px}.footer-sponsor{border:2px solid rgba(255,255,255,.2);max-height:40px}.footer-sponsor img{object-fit:contain;box-sizing:border-box;width:100%;height:100%;padding:4px 10px}.bet-button{border-radius:3rem;padding:10px;white-space:nowrap;border-width:2px;border-style:solid;${o}}.bet-button:hover{cursor:pointer}.bet-button a{text-decoration:none;font-weight:700;color:inherit}${i}</style><livelike-widget-footer><div class="footer-container"><div class="footer-text">SPONSORED BY</div><div class="footer-sponsor">${n&&n[0]&&n[0].logo_url?D`<img src="${n[0].logo_url}" alt="${n[0].name}">`:null}</div></div><div class="footer-container"><div class="footer-text"></div><button class="bet-button"><a target="_blank" href="${e||""}">PLACE BET</a></button></div></livelike-widget-footer>`}(this.place_bet_url,this.themeStyles,this.sponsors,this.customStyles)}<livelike-timer class="custom-timer"></livelike-timer></livelike-widget-root></template>`}}const ss=(e,t)=>{const n=e.reduce(((e,t)=>e+t.vote_count),0);return n>0?Math.round(t.vote_count/n*100):0},as=(e,t)=>{if(e&&e.betDetails){const n=e.betDetails.find((e=>e.description===t.description));if(n)return D`<div class="bet-details">${n.bet}</div>`}};customElements.define("live-total",class extends os{constructor(){super(...arguments),this.optionsRenderer=(e,t,n)=>D`<div class="option-container" ?interacted="${this.voted}"><livelike-image src="${e[0].image_url}" height="60px"></livelike-image><div class="live-total-text-options">${e&&e.map(((i,r)=>D`<livelike-option index="${r}" .option="${i}"><div class="option-image-wrap"><livelike-description .description="${i.description}"></livelike-description>${as(t,i)}<livelike-progress .value="${ss(e,i)}"></livelike-progress><div class="percentage-container"><livelike-percentage .value="${ss(e,i)}"></livelike-percentage>${n?D`<span class="percentage-text">of votes</span>`:null}</div></div></livelike-option>`))}</div><livelike-image src="${e[1].image_url}" height="60px"></livelike-image></div>`}});class cs extends os{constructor(){super(...arguments),this.optionsRenderer=(e,t,n)=>D`<div class="option-container" ?interacted="${this.voted}">${e&&e.map(((i,r)=>D`<livelike-option index="${r}" .option="${i}"><div class="option-image-wrap"><livelike-image src="${i.image_url}" height="40px"></livelike-image><livelike-description .description="${i.description}"></livelike-description>${as(t,i)}<livelike-progress .value="${ss(e,i)}"></livelike-progress><div class="percentage-container"><livelike-percentage .value="${ss(e,i)}"></livelike-percentage>${n?D`<span class="percentage-text">of votes</span>`:null}</div></div></livelike-option>`))}</div>`}}customElements.define("live-moneyline",class extends cs{});customElements.define("live-spread",class extends cs{});var ls,us,ds=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};class hs extends Qo{constructor(){super(...arguments),this.getProgramFromCustomId=e=>{const t=window.LiveLike._$$;if(t&&t.ready){const n=(e,t)=>t&&encodeURI(t.replace(/{(.*?)}/g,e)),i=t.clientId,r=t.appResource[i].program_custom_id_url_template,o=n(e,r);return fetch(o).then((e=>e.json())).then((e=>{this.programid=e.id,this.widgetContainer.programid=e.id}))}return setTimeout((()=>this.getProgramFromCustomId(e)),100)}}createRenderRoot(){return this}firstUpdated(){this.widgetContainer.customWidgetRenderer=({widgetPayload:e})=>{const t=function(e){try{return JSON.parse(e)}catch(e){return null}}(e.custom_data);if(t){const e=t.type.toLowerCase().split(" ").join("-"),n=document.createElement(e);return n.customData=t,n}}}updated(e){e.forEach(((e,t)=>{"customid"===t&&this.customid&&this.getProgramFromCustomId(this.customid),"programid"===t&&this.programid&&!this.customid&&(this.widgetContainer.programid=this.programid)}))}render(){return jo`<livelike-widgets .mode="${ts(this.mode)}"></livelike-widgets>`}}ds([(ls="livelike-widgets",(e,t)=>{const n={get(){return this.renderRoot.querySelector(ls)},enumerable:!0,configurable:!0};if(us){const i=void 0!==t?t:e.key,r="symbol"==typeof i?Symbol():`__${i}`;n.get=function(){return void 0===this[r]&&(this[r]=this.renderRoot.querySelector(ls)),this[r]}}return void 0!==t?Go(n,e,t):Wo(n,e)})],hs.prototype,"widgetContainer",void 0),ds([Vo({type:String})],hs.prototype,"customid",void 0),ds([Vo({type:String})],hs.prototype,"programid",void 0),ds([Vo({type:String})],hs.prototype,"mode",void 0),customElements.define("embet-widgets",hs);const ps=Wr.applyTheme;function fs(e){return Wr.init(Object.assign({clientId:e.clientId},e))}Wr.applyTheme=e=>(document.dispatchEvent(new CustomEvent("livelike-theme-updated",{detail:{theme:e}})),ps(e));const gs={init:fs};window.embet=gs,e.default=gs,e.init=fs,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
389
|
+
const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=>t=>{const n=es.get(t);if(void 0===e&&t instanceof ko){if(void 0!==n||!es.has(t)){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==n&&t.setValue(e);es.set(t,e)})),ns={".widget-tagline":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-title":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-description":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],".bet-details":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],".footer-text":["fontSize","lineHeight","height","marginLeft","marginRight","marginTop","marginBottom"],".bet-button":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],".dismiss-button":["lineHeight","top","right","height"],".dismiss-button svg":["height","width"],".option-container livelike-image":["height","width"],".option-container livelike-image img":["paddingLeft"],"livelike-widget-body .option-container":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-widget-footer":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".footer-container":["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom"],".footer-sponsor":["lineHeight","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],".footer-sponsor img":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-widget-header div.center":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".live-total-text-options":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-option:not(:last-child)":["marginLeft","marginRight","marginTop","marginBottom"],"livelike-option":["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],"livelike-progress":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".percentage-container":["fontSize","lineHeight","paddingRight"],".percentage-text":["fontSize","lineHeight"],"livelike-timer":["height"]},is=D`<style>.embet-widget livelike-widget-header{border-radius:0;height:22.5%}.embet-widget livelike-widget-header .center{width:100%;text-align:center;padding-top:1rem}.embet-widget .widget-tagline{font-size:18px;font-weight:700;padding-bottom:10px;text-transform:uppercase}.embet-widget livelike-title{text-transform:uppercase;font-weight:700;padding:0;display:block;width:100%}.embet-widget livelike-widget-body{border-radius:0;height:47.5%}.embet-widget livelike-widget-footer{border-radius:0;height:30%}.embet-widget .option-container{padding:1rem;height:100%;align-items:stretch;display:flex;flex-direction:column}.embet-widget livelike-option{height:50%;border-width:2px;border-style:solid;border-radius:0;padding:0;box-shadow:5px 5px 10px 1px rgba(0,0,0,.2);align-items:unset;box-sizing:border-box}.embet-widget .option-container[interacted] livelike-option{background:rgba(50,50,50,.7);border:2px solid rgba(190,190,190,.7)}.embet-widget .option-container[interacted] livelike-option[selected]{border:2px solid rgba(0,250,0,.7)}.embet-widget livelike-option:not(:last-of-type){margin-bottom:1rem}.embet-widget livelike-option .option-image-wrap{display:flex;width:100%;position:relative;box-sizing:border-box}.embet-widget livelike-option .percentage-container{position:absolute;display:flex;transform:translate(-50%,-50%);top:50%;left:50%;white-space:nowrap}.embet-widget livelike-description{word-break:unset;align-self:center;padding:0 .5rem}.embet-widget .bet-details{padding:0 .5rem;align-self:center}.embet-widget livelike-image img{padding-left:6px}.embet-widget livelike-percentage{padding:0 5px 0 0}.embet-widget livelike-progress{height:calc(100% + 1px);background:rgba(160,160,160,.7);border-radius:0;box-sizing:border-box}.embet-widget livelike-progress[selected]{background:rgba(0,225,0,.7)}.embet-widget .image-grid[interacted] .bet-details,.embet-widget .image-grid[interacted] img,.embet-widget .image-grid[interacted] livelike-description,.embet-widget .option-container[interacted] .bet-details,.embet-widget .option-container[interacted] livelike-description,[variation=bar] .embet-widget .option-container[interacted] livelike-image,[variation=square] .embet-widget .option-container[interacted] livelike-image{opacity:.2}.embet-widget livelike-timer{height:3px}[variation=inline] .embet-widget .option-container{flex-direction:row}[variation=inline] .embet-widget livelike-image img{padding-left:0}[variation=inline] .embet-widget .bet-details,[variation=inline] .embet-widget livelike-descrption{padding:8px}[variation=inline] .live-total-text-options{display:flex;flex-direction:column;width:100%;padding:0 10px}[variation=square] .embet-widget livelike-option:not(:last-of-type){margin-bottom:0}[variation=square] .image-grid{padding:16px;display:grid;grid-column-gap:8px;grid-row-gap:8px}[variation=square] .embet-widget .square-option-0,[variation=square] .embet-widget .square-option-1,[variation=square] .embet-widget .square-option-2,[variation=square] .embet-widget .square-option-3{height:100%;border:none;box-shadow:0 0 0 1px #c1c2ca;border-radius:6px;flex-grow:1;transition:all .2s ease}[variation=square] .embet-widget .square-option-0:after,[variation=square] .embet-widget .square-option-1:after,[variation=square] .embet-widget .square-option-2:after,[variation=square] .embet-widget .square-option-3:after{content:'';width:100%;height:100%;z-index:4;position:absolute;border-radius:6px;transition:all .2s ease}[variation=square] .live-spread-option-text{display:flex;flex-direction:column;font-size:16px!important;width:100%;justify-content:center}[variation=square] .percentage-container{z-index:5}[variation=square] livelike-description{font-size:16px;text-align:center;flex-grow:0;padding:5px 0 0 0;z-index:1}</style>`;function rs(e){if(e){let t="";return Object.keys(e).forEach((n=>{let i=(e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase())(n);"fontColor"===n&&(i="color"),t+=`${i}: ${e[n]};\n`})),t}return""}function os(e){return D`<style>.dismiss-button{background:0 0;border:none;position:absolute;top:12px;right:16px}.dismiss-button:hover{cursor:pointer}</style><button class="dismiss-button" @click="${()=>((e,t,n)=>{const i=new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return e.dispatchEvent(i),i})(e,"dismiss-clicked")}"><svg height="18px" width="18px" viewBox="0 0 28 28"><polygon points="28,22.398 19.594,14 28,5.602 22.398,0 14,8.402 5.598,0 0,5.602 8.398,14 0,22.398 5.598,28 14,19.598 22.398,28" style="fill:#979797"/></svg></button>`}class ss extends Ri{constructor(){super(...arguments),this.defaultVoteHide=!1,this.hideVoteInResults=!1,this.voteCallback=e=>{e.detail&&e.detail.item&&e.detail.item.id&&!this.voted&&(this.voted=!0)},this.updateThemeStyles=e=>{this.themeStyles=Object.assign(Object.assign({},this.themeStyles),e)},this.themeUpdated=e=>{this.requestUpdate()},this.parseCustomData=e=>{this.sponsors=e.sponsors||this.widgetPayload.sponsors||[],this.place_bet_url=this.customData.place_bet_url||"";const t={"LIVE MONEYLINE":"bar","LIVE SPREAD":"square","LIVE TOTAL":"inline"}[this.customData.type];if(this.widgetVariation=this.customData.widgetVariation||t,this.setAttribute("variation",this.widgetVariation),e.theme&&e.theme.widgets){Wr.applyTheme(e.theme);const t=this.kind||this.widgetPayload.kind;!this.widgetPayload.kind&&(this.widgetPayload.kind=t),this.themeStyles=e.theme.widgets[t.split("-")[1]]}if(e.customCss){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e.customCss),this.appendChild(t)}e.customStyles&&(this.customStyles=e.customStyles)},this.getWidth=()=>{const e=this.querySelector("livelike-widget-root").clientWidth;if(e>0){const t=e>=375?"1.5vw":"1.75vw";this.querySelectorAll("livelike-description").forEach((e=>e.style.fontSize=t));this.querySelector("livelike-title").style.fontSize=t;this.querySelectorAll(".bet-details").forEach((e=>e.style.fontSize=t));this.querySelector(".bet-button").style.fontSize=t;if(this.querySelector(".widget-tagline").style.fontSize=t,this.customData&&"LIVE SPREAD"===this.customData.type){const t=e>300?"0":"10px 0",n=e>=300?"60px":"35px";this.querySelectorAll("livelike-image").forEach((e=>e.style.padding=t));this.querySelectorAll("livelike-image > img").forEach((e=>e.style.height=n))}}else setTimeout(this.getWidth,250)}}static get properties(){return{voted:{type:Boolean},customData:{type:Object},sponsors:{type:Array},place_bet_url:{type:String},themeStyles:{type:Object},customStyles:{type:String},options:{type:Array},optionsRenderer:{type:Function},widgetVariation:{type:String}}}connectedCallback(){super.connectedCallback(),this.addEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}disconnectedCallbck(){super.disconnectedCallbck(),window.removeEventListener("resize",this.getWidth),this.removeEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}firstUpdated(){super.firstUpdated(),this.customData&&this.parseCustomData(this.customData),this.widgetPayload.options&&(this.options=this.widgetPayload.options),this.updateComplete.then((()=>{const e=this.querySelector("livelike-widget-root");window.addEventListener("resize",this.getWidth),this.getWidth(),e.updateComplete.then((()=>{const t=e.shadowRoot.querySelector("livelike-widget-bylines");t&&t.remove();const n=e.shadowRoot.querySelector("livelike-widget-reactions");n&&n.remove()}))}))}render(){const e=this.customData&&this.customData.type?D`<div class="widget-tagline">${this.customData.type}</div>`:null;return D`<template>${is}<style>${this.customStyles}.embet-widget{height:${this.customData&&this.customData.widgetHeight?this.customData.widgetHeight:"100%"}}</style><livelike-widget-root class="embet-widget"><livelike-widget-header class="widget-header" slot="header"><div class="center">${e}<livelike-title></livelike-title></div>${os(this)}</livelike-widget-header><livelike-widget-body>${this.widgetVariation&&this.optionsRenderer(this.options,this.customData,this.voted,this.widgetVariation)}</livelike-widget-body>${function(e,t,n,i){let r,o;return t&&(r=rs(t.footer),o=rs(t.betButton)),D`<style>.embet-widget livelike-widget-footer{display:flex;border-radius:0;padding:10px 16px;${r}}.embet-widget .footer-container{width:50%;display:flex;flex-direction:column;justify-content:center;margin:5px;padding:5px}.embet-widget .footer-text{height:12px;text-align:center;font-size:12px;color:#999;white-space:nowrap;margin-bottom:10px}.embet-widget .footer-sponsor{border:2px solid rgba(255,255,255,.2);max-height:40px;box-sizing:border-box}.embet-widget .footer-sponsor img{object-fit:contain;box-sizing:border-box;width:100%;height:100%;padding:4px 10px}.embet-widget .bet-button{border-radius:3rem;padding:10px;white-space:nowrap;border-width:2px;border-style:solid;${o}}.embet-widget .bet-button:hover{cursor:pointer}.embet-widget .bet-button a{text-decoration:none;font-weight:700;color:inherit}${i}</style><livelike-widget-footer><div class="footer-container"><div class="footer-text">SPONSORED BY</div><div class="footer-sponsor">${n&&n[0]&&n[0].logo_url?D`<img src="${n[0].logo_url}" alt="${n[0].name}">`:null}</div></div><div class="footer-container"><div class="footer-text"></div><button class="bet-button"><a target="_blank" href="${e||""}">PLACE BET</a></button></div></livelike-widget-footer>`}(this.place_bet_url,this.themeStyles,this.sponsors,this.customStyles)}<livelike-timer class="custom-timer"></livelike-timer></livelike-widget-root></template>`}}const as=(e,t)=>{const n=e.reduce(((e,t)=>e+t.vote_count),0);return n>0?Math.round(t.vote_count/n*100):0},cs=(e,t)=>{if(e&&e.betDetails){const n=e.betDetails.find((e=>e.description===t.description));if(n)return D` <div class="bet-details">${n.bet}</div> `}},ls=(e,t,n)=>D`
|
|
390
|
+
<div class="option-container" ?interacted=${n}>
|
|
391
|
+
${e&&e.map(((i,r)=>D`
|
|
392
|
+
<livelike-option index=${r} .option=${i}>
|
|
393
|
+
<div class="option-image-wrap">
|
|
394
|
+
<livelike-image src=${i.image_url} height="40px"></livelike-image>
|
|
395
|
+
<livelike-description .description=${i.description}></livelike-description>
|
|
396
|
+
${cs(t,i)}
|
|
397
|
+
<livelike-progress
|
|
398
|
+
.value=${as(e,i)}
|
|
399
|
+
></livelike-progress>
|
|
400
|
+
<div class="percentage-container">
|
|
401
|
+
<livelike-percentage
|
|
402
|
+
.value=${as(e,i)}
|
|
403
|
+
></livelike-percentage>
|
|
404
|
+
${n?D` <span class="percentage-text">of votes</span> `:null}
|
|
405
|
+
</div>
|
|
406
|
+
</div>
|
|
407
|
+
</livelike-option>
|
|
408
|
+
`))}
|
|
409
|
+
</div>
|
|
410
|
+
`,us=(e,t,n)=>D`
|
|
411
|
+
<style>
|
|
412
|
+
[variation='square'] .image-grid {
|
|
413
|
+
grid-template-columns: repeat(${e.length}, 1fr);
|
|
414
|
+
}
|
|
415
|
+
</style>
|
|
416
|
+
<div class="image-grid" ?interacted=${n}>
|
|
417
|
+
${e&&e.map(((i,r)=>{const o=as(e,i);return D`
|
|
418
|
+
<style>
|
|
419
|
+
[variation='square'] .image-grid[interacted] .square-option-${r}:after {
|
|
420
|
+
background: linear-gradient(
|
|
421
|
+
0deg,
|
|
422
|
+
rgba(120, 120, 120, 0.9) ${o}%,
|
|
423
|
+
transparent 0
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
[variation='square']
|
|
427
|
+
.image-grid[interacted]
|
|
428
|
+
.square-option-${r}[selected]:after {
|
|
429
|
+
background: linear-gradient(
|
|
430
|
+
0deg,
|
|
431
|
+
rgba(0, 225, 0, 0.9) ${o}%,
|
|
432
|
+
transparent 0
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
</style>
|
|
436
|
+
<livelike-option index=${r} .option=${i} class="square-option-${r}">
|
|
437
|
+
<livelike-image src=${i.image_url} height="60px"></livelike-image>
|
|
438
|
+
<div class="live-spread-option-text">
|
|
439
|
+
<livelike-description .description=${i.description}></livelike-description>
|
|
440
|
+
${cs(t,i)}
|
|
441
|
+
<div class="percentage-container">
|
|
442
|
+
<livelike-percentage .value=${o}></livelike-percentage>
|
|
443
|
+
${n?D` <span class="percentage-text">of votes</span> `:null}
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
</livelike-option>
|
|
447
|
+
`}))}
|
|
448
|
+
</div>
|
|
449
|
+
`,ds=(e,t,n)=>D`
|
|
450
|
+
<div class="option-container" ?interacted=${n}>
|
|
451
|
+
<livelike-image src=${e[0].image_url} height="60px"></livelike-image>
|
|
452
|
+
<div class="live-total-text-options">${e&&e.map(((i,r)=>D`
|
|
453
|
+
<livelike-option index=${r} .option=${i}>
|
|
454
|
+
<div class="option-image-wrap">
|
|
455
|
+
<livelike-description .description=${i.description}></livelike-description>
|
|
456
|
+
${cs(t,i)}
|
|
457
|
+
<livelike-progress
|
|
458
|
+
.value=${as(e,i)}
|
|
459
|
+
></livelike-progress>
|
|
460
|
+
<div class="percentage-container">
|
|
461
|
+
<livelike-percentage
|
|
462
|
+
.value=${as(e,i)}
|
|
463
|
+
></livelike-percentage>
|
|
464
|
+
${n?D` <span class="percentage-text">of votes</span> `:null}
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
</livelike-option>
|
|
468
|
+
`))}</div>
|
|
469
|
+
<livelike-image src=${e[1].image_url} height="60px"></livelike-image>
|
|
470
|
+
</div>
|
|
471
|
+
`,hs=(e,t,n,i)=>(0,{bar:ls,square:us,inline:ds}[i])(e,t,n);customElements.define("live-total",class extends ss{constructor(){super(...arguments),this.optionsRenderer=hs}});customElements.define("live-spread",class extends ss{constructor(){super(...arguments),this.optionsRenderer=hs}});customElements.define("live-moneyline",class extends ss{constructor(){super(...arguments),this.optionsRenderer=hs}});var ps,fs,gs=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};class ms extends Qo{constructor(){super(...arguments),this.getProgramFromCustomId=e=>{const t=window.LiveLike._$$;if(t&&t.ready){const n=(e,t)=>t&&encodeURI(t.replace(/{(.*?)}/g,e)),i=t.clientId,r=t.appResource[i].program_custom_id_url_template,o=n(e,r);return fetch(o).then((e=>e.json())).then((e=>{this.programid=e.id,this.widgetContainer.programid=e.id}))}return setTimeout((()=>this.getProgramFromCustomId(e)),100)}}createRenderRoot(){return this}firstUpdated(){this.widgetContainer.customWidgetRenderer=({widgetPayload:e})=>{const t=function(e){try{return JSON.parse(e)}catch(e){return null}}(e.custom_data);if(t){const e=t.widgetWidth;this.resizeObserver=new ResizeObserver((n=e,e=>e.forEach((e=>{const t=e.target;if(t){const i=Math.round(e.contentRect.width),r=document.body.offsetWidth,o=n||.3*r,s="hasBeenResized",a=t.classList.contains(s),c=Number(t.dataset.lastWidgetWidth);let l=!1;if(c+1===i||c-1===i)return;Object.keys(ns).forEach((e=>{ns[e].forEach((n=>{t.querySelectorAll(e).forEach((e=>{const r=getComputedStyle(e)[n];if(r){const s=r.split(/^(-?[0-9]*.?[0-9]+)(.+)$/).filter((e=>0!==e.length)),c=s[0],u=s[1];if(c&&!isNaN(Number(c))&&0!==Number(c)){const r=a?Number(c)*o/Number(t.dataset.lastWidgetWidth):Number(c);e.style[n]=(r*i/o).toString()+u,l=!0}}}))}))})),l&&(t.dataset.lastWidgetWidth=String(i)),!a&&l&&t.classList.add(s)}})))),this.resizeObserver.observe(this);const i=t.type.toLowerCase().split(" ").join("-"),r=document.createElement(i);return r.customData=t,r}var n}}updated(e){e.forEach(((e,t)=>{"customid"===t&&this.customid&&this.getProgramFromCustomId(this.customid),"programid"===t&&this.programid&&!this.customid&&(this.widgetContainer.programid=this.programid)}))}render(){return jo`<style>embet-widgets{display:block}</style><livelike-widgets .mode="${ts(this.mode)}"></livelike-widgets>`}}gs([(ps="livelike-widgets",(e,t)=>{const n={get(){return this.renderRoot.querySelector(ps)},enumerable:!0,configurable:!0};if(fs){const i=void 0!==t?t:e.key,r="symbol"==typeof i?Symbol():`__${i}`;n.get=function(){return void 0===this[r]&&(this[r]=this.renderRoot.querySelector(ps)),this[r]}}return void 0!==t?Go(n,e,t):Wo(n,e)})],ms.prototype,"widgetContainer",void 0),gs([Vo({type:String})],ms.prototype,"customid",void 0),gs([Vo({type:String})],ms.prototype,"programid",void 0),gs([Vo({type:String})],ms.prototype,"mode",void 0),customElements.define("embet-widgets",ms);const vs=Wr.applyTheme;function ys(e){return Wr.init(Object.assign({clientId:e.clientId},e))}Wr.applyTheme=e=>(document.dispatchEvent(new CustomEvent("livelike-theme-updated",{detail:{theme:e}})),vs(e));const bs={init:ys};window.embet=bs,e.default=bs,e.init=ys,Object.defineProperty(e,"__esModule",{value:!0})}));
|