@telia-ace/widget-core-flamingo 1.1.111-rc.8 → 1.1.111-rc.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +10 -10
  2. package/index.mjs +229 -229
  3. package/package.json +3 -3
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ft=function(r,t){return ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])},ft(r,t)};function Y(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ft(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function gt(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function mt(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),s,o=[],n;try{for(;(t===void 0||t-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}return o}function vt(r,t,e){if(e||arguments.length===2)for(var i=0,s=t.length,o;i<s;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))}function _(r){return typeof r=="function"}function ae(r){var t=function(i){Error.call(i),i.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var nt=ae(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription:
2
2
  `+e.map(function(i,s){return s+1+") "+i.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=e}});function yt(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var rt=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,i,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=gt(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(_(h))try{h()}catch(v){o=v instanceof nt?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var u=gt(d),f=u.next();!f.done;f=u.next()){var g=f.value;try{Lt(g)}catch(v){o=o??[],v instanceof nt?o=vt(vt([],mt(o)),mt(v.errors)):o.push(v)}}}catch(v){i={error:v}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}if(o)throw new nt(o)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Lt(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&yt(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&yt(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}(),ce=rt.EMPTY;function he(r){return r instanceof rt||r&&"closed"in r&&_(r.remove)&&_(r.add)&&_(r.unsubscribe)}function Lt(r){_(r)?r():r.unsubscribe()}var ke={Promise:void 0},Te={setTimeout:function(r,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];return setTimeout.apply(void 0,vt([r,t],mt(e)))},clearTimeout:function(r){return clearTimeout(r)},delegate:void 0};function Re(r){Te.setTimeout(function(){throw r})}function jt(){}function G(r){r()}var le=function(r){Y(t,r);function t(e){var i=r.call(this)||this;return i.isStopped=!1,e?(i.destination=e,he(e)&&e.add(i)):i.destination=Ue,i}return t.create=function(e,i,s){return new bt(e,i,s)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(rt),Me=function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(i){Z(i)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(i){Z(i)}else Z(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){Z(e)}},r}(),bt=function(r){Y(t,r);function t(e,i,s){var o=r.call(this)||this,n;return _(e)||!e?n={next:e??void 0,error:i??void 0,complete:s??void 0}:n=e,o.destination=new Me(n),o}return t}(le);function Z(r){Re(r)}function Ne(r){throw r}var Ue={closed:!0,next:jt,error:Ne,complete:jt},Le=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function je(r){return r}function He(r){return r.length===0?je:r.length===1?r[0]:function(e){return r.reduce(function(i,s){return s(i)},e)}}var Ht=function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,i){var s=this,o=De(t)?t:new bt(t,e,i);return G(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var i=this;return e=Bt(e),new e(function(s,o){var n=new bt({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});i.subscribe(n)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[Le]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return He(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Bt(t),new t(function(i,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return i(o)})})},r.create=function(t){return new r(t)},r}();function Bt(r){var t;return(t=r??ke.Promise)!==null&&t!==void 0?t:Promise}function Be(r){return r&&_(r.next)&&_(r.error)&&_(r.complete)}function De(r){return r&&r instanceof le||Be(r)&&he(r)}var ze=ae(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),At=function(r){Y(t,r);function t(){var e=r.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var i=new Dt(this,this);return i.operator=e,i},t.prototype._throwIfClosed=function(){if(this.closed)throw new ze},t.prototype.next=function(e){var i=this;G(function(){var s,o;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var n=gt(i.currentObservers),a=n.next();!a.done;a=n.next()){var c=a.value;c.next(e)}}catch(l){s={error:l}}finally{try{a&&!a.done&&(o=n.return)&&o.call(n)}finally{if(s)throw s.error}}}})},t.prototype.error=function(e){var i=this;G(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=e;for(var s=i.observers;s.length;)s.shift().error(e)}})},t.prototype.complete=function(){var e=this;G(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var i=e.observers;i.length;)i.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var i=this,s=this,o=s.hasError,n=s.isStopped,a=s.observers;return o||n?ce:(this.currentObservers=null,a.push(e),new rt(function(){i.currentObservers=null,yt(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var i=this,s=i.hasError,o=i.thrownError,n=i.isStopped;s?e.error(o):n&&e.complete()},t.prototype.asObservable=function(){var e=new Ht;return e.source=this,e},t.create=function(e,i){return new Dt(e,i)},t}(Ht),Dt=function(r){Y(t,r);function t(e,i){var s=r.call(this)||this;return s.destination=e,s.source=i,s}return t.prototype.next=function(e){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,e)},t.prototype.error=function(e){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,e)},t.prototype.complete=function(){var e,i;(i=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||i===void 0||i.call(e)},t.prototype._subscribe=function(e){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(e))!==null&&s!==void 0?s:ce},t}(At),xt=function(r){Y(t,r);function t(e){var i=r.call(this)||this;return i._value=e,i}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(e){var i=r.prototype._subscribe.call(this,e);return!i.closed&&e.next(this._value),i},t.prototype.getValue=function(){var e=this,i=e.hasError,s=e.thrownError,o=e._value;if(i)throw s;return this._throwIfClosed(),o},t.prototype.next=function(e){r.prototype.next.call(this,this._value=e)},t}(At),de=(r=>(r.Loading="loading",r.Ready="ready",r))(de||{});class wt{constructor(t,e){this.state=new xt("loading"),this.resolvers=new Map,this.name=t,this.environment=e,this.state.next("ready")}setState(t){this.state.next(t)}async register(t,e){this.resolvers.set(t,e)}async get(t){return this.resolvers.get(t)}}/**
3
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function yt(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var rt=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,i,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=gt(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(_(h))try{h()}catch(v){o=v instanceof nt?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var u=gt(d),f=u.next();!f.done;f=u.next()){var g=f.value;try{Lt(g)}catch(v){o=o??[],v instanceof nt?o=vt(vt([],mt(o)),mt(v.errors)):o.push(v)}}}catch(v){i={error:v}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}if(o)throw new nt(o)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Lt(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&yt(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&yt(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}(),ce=rt.EMPTY;function he(r){return r instanceof rt||r&&"closed"in r&&_(r.remove)&&_(r.add)&&_(r.unsubscribe)}function Lt(r){_(r)?r():r.unsubscribe()}var Te={Promise:void 0},ke={setTimeout:function(r,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];return setTimeout.apply(void 0,vt([r,t],mt(e)))},clearTimeout:function(r){return clearTimeout(r)},delegate:void 0};function Re(r){ke.setTimeout(function(){throw r})}function jt(){}function G(r){r()}var le=function(r){Y(t,r);function t(e){var i=r.call(this)||this;return i.isStopped=!1,e?(i.destination=e,he(e)&&e.add(i)):i.destination=Ue,i}return t.create=function(e,i,s){return new bt(e,i,s)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(rt),Me=function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(i){Z(i)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(i){Z(i)}else Z(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){Z(e)}},r}(),bt=function(r){Y(t,r);function t(e,i,s){var o=r.call(this)||this,n;return _(e)||!e?n={next:e??void 0,error:i??void 0,complete:s??void 0}:n=e,o.destination=new Me(n),o}return t}(le);function Z(r){Re(r)}function Ne(r){throw r}var Ue={closed:!0,next:jt,error:Ne,complete:jt},Le=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function je(r){return r}function He(r){return r.length===0?je:r.length===1?r[0]:function(e){return r.reduce(function(i,s){return s(i)},e)}}var Ht=function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,i){var s=this,o=De(t)?t:new bt(t,e,i);return G(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var i=this;return e=Bt(e),new e(function(s,o){var n=new bt({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});i.subscribe(n)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[Le]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return He(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Bt(t),new t(function(i,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return i(o)})})},r.create=function(t){return new r(t)},r}();function Bt(r){var t;return(t=r??Te.Promise)!==null&&t!==void 0?t:Promise}function Be(r){return r&&_(r.next)&&_(r.error)&&_(r.complete)}function De(r){return r&&r instanceof le||Be(r)&&he(r)}var ze=ae(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),At=function(r){Y(t,r);function t(){var e=r.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var i=new Dt(this,this);return i.operator=e,i},t.prototype._throwIfClosed=function(){if(this.closed)throw new ze},t.prototype.next=function(e){var i=this;G(function(){var s,o;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var n=gt(i.currentObservers),a=n.next();!a.done;a=n.next()){var c=a.value;c.next(e)}}catch(l){s={error:l}}finally{try{a&&!a.done&&(o=n.return)&&o.call(n)}finally{if(s)throw s.error}}}})},t.prototype.error=function(e){var i=this;G(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=e;for(var s=i.observers;s.length;)s.shift().error(e)}})},t.prototype.complete=function(){var e=this;G(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var i=e.observers;i.length;)i.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var i=this,s=this,o=s.hasError,n=s.isStopped,a=s.observers;return o||n?ce:(this.currentObservers=null,a.push(e),new rt(function(){i.currentObservers=null,yt(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var i=this,s=i.hasError,o=i.thrownError,n=i.isStopped;s?e.error(o):n&&e.complete()},t.prototype.asObservable=function(){var e=new Ht;return e.source=this,e},t.create=function(e,i){return new Dt(e,i)},t}(Ht),Dt=function(r){Y(t,r);function t(e,i){var s=r.call(this)||this;return s.destination=e,s.source=i,s}return t.prototype.next=function(e){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,e)},t.prototype.error=function(e){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,e)},t.prototype.complete=function(){var e,i;(i=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||i===void 0||i.call(e)},t.prototype._subscribe=function(e){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(e))!==null&&s!==void 0?s:ce},t}(At),xt=function(r){Y(t,r);function t(e){var i=r.call(this)||this;return i._value=e,i}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(e){var i=r.prototype._subscribe.call(this,e);return!i.closed&&e.next(this._value),i},t.prototype.getValue=function(){var e=this,i=e.hasError,s=e.thrownError,o=e._value;if(i)throw s;return this._throwIfClosed(),o},t.prototype.next=function(e){r.prototype.next.call(this,this._value=e)},t}(At),de=(r=>(r.Loading="loading",r.Ready="ready",r))(de||{});class wt{constructor(t,e){this.state=new xt("loading"),this.resolvers=new Map,this.name=t,this.environment=e,this.state.next("ready")}setState(t){this.state.next(t)}async register(t,e){this.resolvers.set(t,e)}async get(t){return this.resolvers.get(t)}}/**
4
4
  * @license
5
5
  * Copyright 2019 Google LLC
6
6
  * SPDX-License-Identifier: BSD-3-Clause
@@ -8,7 +8,7 @@
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */const{is:We,defineProperty:Ye,getOwnPropertyDescriptor:qe,getOwnPropertyNames:Ke,getOwnPropertySymbols:Ze,getPrototypeOf:Ge}=Object,C=globalThis,Vt=C.trustedTypes,Je=Vt?Vt.emptyScript:"",at=C.reactiveElementPolyfillSupport,B=(r,t)=>r,X={toAttribute(r,t){switch(t){case Boolean:r=r?Je:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Et=(r,t)=>!We(r,t),Wt={attribute:!0,type:String,converter:X,reflect:!1,hasChanged:Et};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),C.litPropertyMetadata??(C.litPropertyMetadata=new WeakMap);let T=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Wt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Ye(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=qe(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return s==null?void 0:s.call(this)},set(n){const a=s==null?void 0:s.call(this);o.call(this,n),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wt}static _$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;const t=Ge(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){const e=this.properties,i=[...Ke(e),...Ze(e)];for(const s of i)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(Ft(s))}else t!==void 0&&e.push(Ft(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ve(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){var o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const n=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:X).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){var o;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const n=i.getPropertyOptions(s),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:X;this._$Em=s,this[s]=a.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??Et)(this[t],e))return;this.P(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,n]of s)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(s=>{var o;return(o=s.hostUpdate)==null?void 0:o.call(s)}),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[B("elementProperties")]=new Map,T[B("finalized")]=new Map,at==null||at({ReactiveElement:T}),(C.reactiveElementVersions??(C.reactiveElementVersions=[])).push("2.0.4");/**
11
+ */const{is:We,defineProperty:Ye,getOwnPropertyDescriptor:qe,getOwnPropertyNames:Ke,getOwnPropertySymbols:Ze,getPrototypeOf:Ge}=Object,C=globalThis,Vt=C.trustedTypes,Je=Vt?Vt.emptyScript:"",at=C.reactiveElementPolyfillSupport,B=(r,t)=>r,X={toAttribute(r,t){switch(t){case Boolean:r=r?Je:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Et=(r,t)=>!We(r,t),Wt={attribute:!0,type:String,converter:X,reflect:!1,hasChanged:Et};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),C.litPropertyMetadata??(C.litPropertyMetadata=new WeakMap);let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Wt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Ye(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=qe(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return s==null?void 0:s.call(this)},set(n){const a=s==null?void 0:s.call(this);o.call(this,n),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wt}static _$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;const t=Ge(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){const e=this.properties,i=[...Ke(e),...Ze(e)];for(const s of i)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(Ft(s))}else t!==void 0&&e.push(Ft(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ve(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){var o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const n=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:X).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){var o;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const n=i.getPropertyOptions(s),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:X;this._$Em=s,this[s]=a.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??Et)(this[t],e))return;this.P(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,n]of s)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(s=>{var o;return(o=s.hostUpdate)==null?void 0:o.call(s)}),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[B("elementProperties")]=new Map,k[B("finalized")]=new Map,at==null||at({ReactiveElement:k}),(C.reactiveElementVersions??(C.reactiveElementVersions=[])).push("2.0.4");/**
12
12
  * @license
13
13
  * Copyright 2017 Google LLC
14
14
  * SPDX-License-Identifier: BSD-3-Clause
@@ -18,7 +18,7 @@
18
18
  * @license
19
19
  * Copyright 2017 Google LLC
20
20
  * SPDX-License-Identifier: BSD-3-Clause
21
- */let A=class extends T{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ai(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return I}};var ne;A._$litElement$=!0,A.finalized=!0,(ne=globalThis.litElementHydrateSupport)==null||ne.call(globalThis,{LitElement:A});const lt=globalThis.litElementPolyfillSupport;lt==null||lt({LitElement:A});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
21
+ */let A=class extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ai(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return I}};var ne;A._$litElement$=!0,A.finalized=!0,(ne=globalThis.litElementHydrateSupport)==null||ne.call(globalThis,{LitElement:A});const lt=globalThis.litElementPolyfillSupport;lt==null||lt({LitElement:A});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
22
22
  * @license
23
23
  * Copyright 2017 Google LLC
24
24
  * SPDX-License-Identifier: BSD-3-Clause
@@ -26,7 +26,7 @@
26
26
  * @license
27
27
  * Copyright 2017 Google LLC
28
28
  * SPDX-License-Identifier: BSD-3-Clause
29
- */function j(r){return m({...r,state:!0,attribute:!1})}var li=Object.defineProperty,di=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&li(t,e,s),s};const Tt=class Tt extends A{constructor(){super(...arguments),this.anchor="BottomRight"}appendChild(t){var e;return(e=this.shadowRoot)==null||e.appendChild(t),t}render(){return this.anchor==="BottomLeft"?this.renderRoot.host.classList.add("bottom-left"):this.anchor==="BottomRight"&&this.renderRoot.host.classList.add("bottom-right"),p}};Tt.styles=[L`
29
+ */function j(r){return m({...r,state:!0,attribute:!1})}var li=Object.defineProperty,di=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&li(t,e,s),s};const kt=class kt extends A{constructor(){super(...arguments),this.anchor="BottomRight"}appendChild(t){var e;return(e=this.shadowRoot)==null||e.appendChild(t),t}render(){return this.anchor==="BottomLeft"?this.renderRoot.host.classList.add("bottom-left"):this.anchor==="BottomRight"&&this.renderRoot.host.classList.add("bottom-right"),p}};kt.styles=[L`
30
30
  :host {
31
31
  position: fixed;
32
32
  display: flex;
@@ -42,7 +42,7 @@
42
42
  bottom: 20px;
43
43
  left: 20px;
44
44
  }
45
- `];let W=Tt;di([m({attribute:!0})],W.prototype,"anchor");/**
45
+ `];let W=kt;di([m({attribute:!0})],W.prototype,"anchor");/**
46
46
  * @license
47
47
  * Copyright 2017 Google LLC
48
48
  * SPDX-License-Identifier: BSD-3-Clause
@@ -268,7 +268,7 @@
268
268
  * @license
269
269
  * Copyright 2021 Google LLC
270
270
  * SPDX-License-Identifier: BSD-3-Clause
271
- */let Ei=class extends Event{constructor(t,e,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=i??!1}};/**
271
+ */let Ei=class extends Event{constructor(t,e,i,s){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=s??!1}};/**
272
272
  * @license
273
273
  * Copyright 2021 Google LLC
274
274
  * SPDX-License-Identifier: BSD-3-Clause
@@ -280,11 +280,11 @@
280
280
  * @license
281
281
  * Copyright 2021 Google LLC
282
282
  * SPDX-License-Identifier: BSD-3-Clause
283
- */let Oi=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}};class oe extends Pi{constructor(t,e,i){var s,o;super(e.context!==void 0?e.initialValue:i),this.onContextRequest=n=>{const a=n.composedPath()[0];n.context===this.context&&a!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,a,n.subscribe))},this.onProviderRequest=n=>{const a=n.composedPath()[0];if(n.context!==this.context||a===this.host)return;const c=new Set;for(const[l,{consumerHost:h}]of this.subscriptions)c.has(l)||(c.add(l),h.dispatchEvent(new Ei(this.context,l,!0)));n.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(s=this.host).addController)==null||o.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Oi(this.context))}}/**
283
+ */let Oi=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}};class oe extends Pi{constructor(t,e,i){var s,o;super(e.context!==void 0?e.initialValue:i),this.onContextRequest=n=>{if(n.context!==this.context)return;const a=n.contextTarget??n.composedPath()[0];a!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,a,n.subscribe))},this.onProviderRequest=n=>{if(n.context!==this.context||(n.contextTarget??n.composedPath()[0])===this.host)return;const a=new Set;for(const[c,{consumerHost:l}]of this.subscriptions)a.has(c)||(a.add(c),l.dispatchEvent(new Ei(this.context,l,c,!0)));n.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(s=this.host).addController)==null||o.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Oi(this.context,this.host))}}/**
284
284
  * @license
285
285
  * Copyright 2017 Google LLC
286
286
  * SPDX-License-Identifier: BSD-3-Clause
287
- */function Ii({context:r}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){i.set(this,new oe(this,{context:r}))}),{get(){return t.get.call(this)},set(s){var o;return(o=i.get(this))==null||o.setValue(s),t.set.call(this,s)},init(s){var o;return(o=i.get(this))==null||o.setValue(s),s}};{t.constructor.addInitializer(n=>{i.set(n,new oe(n,{context:r}))});const s=Object.getOwnPropertyDescriptor(t,e);let o;if(s===void 0){const n=new WeakMap;o={get(){return n.get(this)},set(a){i.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{const n=s.set;o={...s,set(a){i.get(this).setValue(a),n==null||n.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}var ki=Object.defineProperty,Ce=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&ki(t,e,s),s};const Se="application",Nt=class Nt extends A{constructor(){super(...arguments),this.nodes=[],this.wrapperRef=_e(),this.fullscreen=!1,this.isReady=new xt(!1)}addChild(t){t.parent=this,this.nodes.push(t)}applyBranding(){if(!this.wrapperRef.value)return;const t=this.application.settings;t!=null&&t.branding&&$e(t.branding,this.wrapperRef.value)}applyStyles(){if(!this.wrapperRef.value)return;const t=this.application.styles(),e=this.wrapperRef.value;Object.entries(t).forEach(([i,s])=>{e.style.setProperty(`--${i}`,s)})}firstUpdated(t){this.applyBranding(),this.applyStyles()}render(){var i,s;const t=this.application.settings.components.conversation;return((s=(i=t==null?void 0:t.properties)==null?void 0:i.chat)==null?void 0:s.isThirdPartyWidget)?this.renderRoot.host.classList.add("third-party"):this.application.renderStrategy===$.Trigger&&(this.renderRoot.host.classList.add("floating"),this.application.anchor==="BottomLeft"?this.renderRoot.host.classList.add("bottom-left"):this.application.anchor==="BottomRight"&&this.renderRoot.host.classList.add("bottom-right")),this.application.fullscreen&&this.renderRoot.host.classList.add("fullscreen"),window.self!==window.top&&this.renderRoot.host.classList.add("embedded"),R`<div class="widget-container" ${Ae(this.wrapperRef)}>
287
+ */function Ii({context:r}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){i.set(this,new oe(this,{context:r}))}),{get(){return t.get.call(this)},set(s){var o;return(o=i.get(this))==null||o.setValue(s),t.set.call(this,s)},init(s){var o;return(o=i.get(this))==null||o.setValue(s),s}};{t.constructor.addInitializer(n=>{i.set(n,new oe(n,{context:r}))});const s=Object.getOwnPropertyDescriptor(t,e);let o;if(s===void 0){const n=new WeakMap;o={get(){return n.get(this)},set(a){i.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{const n=s.set;o={...s,set(a){i.get(this).setValue(a),n==null||n.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}var Ti=Object.defineProperty,Ce=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&Ti(t,e,s),s};const Se="application",Nt=class Nt extends A{constructor(){super(...arguments),this.nodes=[],this.wrapperRef=_e(),this.fullscreen=!1,this.isReady=new xt(!1)}addChild(t){t.parent=this,this.nodes.push(t)}applyBranding(){if(!this.wrapperRef.value)return;const t=this.application.settings;t!=null&&t.branding&&$e(t.branding,this.wrapperRef.value)}applyStyles(){if(!this.wrapperRef.value)return;const t=this.application.styles(),e=this.wrapperRef.value;Object.entries(t).forEach(([i,s])=>{e.style.setProperty(`--${i}`,s)})}firstUpdated(t){this.applyBranding(),this.applyStyles()}render(){var i,s;const t=this.application.settings.components.conversation;return((s=(i=t==null?void 0:t.properties)==null?void 0:i.chat)==null?void 0:s.isThirdPartyWidget)?this.renderRoot.host.classList.add("third-party"):this.application.renderStrategy===$.Trigger&&(this.renderRoot.host.classList.add("floating"),this.application.anchor==="BottomLeft"?this.renderRoot.host.classList.add("bottom-left"):this.application.anchor==="BottomRight"&&this.renderRoot.host.classList.add("bottom-right")),this.application.fullscreen&&this.renderRoot.host.classList.add("fullscreen"),window.self!==window.top&&this.renderRoot.host.classList.add("embedded"),R`<div class="widget-container" ${Ae(this.wrapperRef)}>
288
288
  ${Si(this.nodes,o=>o)}
289
289
  </div>`}};Nt.styles=L`
290
290
  :host {
@@ -438,8 +438,8 @@
438
438
  :host(.expanded.embedded) {
439
439
  animation: none;
440
440
  }
441
- `;let N=Nt;Ce([m({attribute:!0})],N.prototype,"fullscreen");Ce([m({attribute:!1}),Ii({context:Se})],N.prototype,"application");class Ti{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...l]=a;return{definitionId:c,overrides:l}}return{definitionId:a,overrides:[]}},s=(a,c,l,h)=>{l.forEach(d=>{const u=i(d),f=h[u.definitionId];if(!f){console.error(`No definition found for component type '${u.definitionId}'.`);return}const g=a.createNode(f.type,f.type);g&&(g.name=u.definitionId,g.application=e,f.properties&&g.writeProperties(f.properties),f.context&&g.writeContext(f.context),f.layout&&g.writeLayout(f.layout),c.addChild(g),f.children&&s(a,g,f.children,h))})},{entry:o,components:n}=t;return s(this,this.root,[o],n),this.root}createRoot(){return typeof window<"u"&&(window.customElements.get("ace-wrapper")||window.customElements.define("ace-wrapper",N)),document.createElement("ace-wrapper")}createNode(t,e){if(!this.resolveComponent(e))return console.warn(`Unable to resolve component: ${e}`),new et;const s=document.createElement(`ace-${e}`);return s.type=e,s.name=t,s}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const it=class it{constructor(){this.components=new Map}getComponent(t){const e=this.components.get(t);return e||console.warn(`Unable to resolve component: ${t}. You most likely forgot to register the required plugin.`),e}registerComponent(t,e){this.components.set(t,e)}async loadComponents(){const t=[...this.components.entries()].map(([e,i])=>i.then(s=>{this.defineAsWebComponent(e,s.default)}));await Promise.all(t)}defineAsWebComponent(t,e){const i=it.ResolveWebComponentName(t);customElements.get(i)||customElements.define(i,e)}};it.ResolveWebComponentName=t=>`ace-${t}`;let _t=it;var y=(r=>(r.Necessary="necessary",r.Functional="functional",r.Analytics="analytics",r))(y||{});class Ee{constructor(t,e,i,s){this.disallowedKeys=[],this.widgetId=t,this.storage=e==="localStorage"?window.localStorage:window.sessionStorage,this.policy=i,this.storageEntries=s}set(t,e){if(this.disallowedKeys.includes(t))return;const i=this.storageEntries[t];if(!i){console.warn(`Storage key '${t}' is not defined.`);return}const s=i.category;if(this.policy[s]){const o={value:e,category:s};this.storage.setItem(this._prefixKey(t),JSON.stringify(o))}else console.warn(`Storage policy does not allow storing items in category: ${s}`)}get(t){const e=this.storage.getItem(this._prefixKey(t));if(!e)return null;try{const i=JSON.parse(e);return this.policy[i.category]?i.value:(console.warn(`Storage policy does not allow retrieving items from category: ${i.category}`),null)}catch{return null}}removeItem(t){this.storage.removeItem(this._prefixKey(t))}enforcePolicy(){var t;for(const[e,i]of Object.entries(this.storage)){const s=(t=JSON.parse(i))==null?void 0:t.category;this.policy[s]||this.storage.removeItem(e)}}updatePolicy(t){this.policy=t,this.enforcePolicy()}disallowKey(t){this.disallowedKeys.includes(t)||this.disallowedKeys.push(t),this.removeItem(t)}stringify(){return JSON.stringify(this.storage)}_prefixKey(t){return`ace_${this.widgetId.substring(0,7)}-${t}`}}class Ri{constructor(){this.texts=new Map}loadTexts(t){this.texts=new Map(Object.entries(t))}get(t,e){const i=this.texts.get(t);return i||e||null}getOrFallback(t,e){return this.texts.get(t)||e}}const Mi="1.1.111-rc.8";class Ni{constructor(t){this.widget=t,this.name=t.name}open(t={}){this.widget.appendToDOM(t)}close(){this.widget.hide()}setFullscreenMode(t){this.widget.setFullscreenMode(t)}setZIndex(t){this.widget.setZIndex(t)}version(){return{version:Mi}}}class Pe{constructor(t,e,i,s,o){this.id=t,this.name=e,this.container=i,this.settings=s,this.options=o,this.platform=new Ti,this.texts=new Ri,this.renderStrategy=$.Inline,this.fullscreen=!1,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new _t,this.components=[],this.trigger=null,this.api=new Ni(this),this.onMessageReceived=async a=>{var l;const c=a.data;switch(c.type){case"set-storage-policies":{const{policies:h}=c.data||[],d={[y.Analytics]:h.includes("analytics"),[y.Necessary]:h.includes("necessary"),[y.Functional]:h.includes("functional")};this.storage.updatePolicy(d);return}case"disallow-storage-key":{const{storageKey:h}=c.data||null;h&&this.storage.disallowKey(h);return}case"set-fullscreen-mode":{const{value:h}=c.data;typeof h=="boolean"&&this.setFullscreenMode(h);return}case"open":{this.appendToDOM();return}case"close":{this.hide();return}case"set-z-index":{const{zIndex:h}=c.data||null;h&&this.setZIndex(h);return}case"deactivate-widget":{const h=this.storage.get("open");this.hide(),(l=this.trigger)==null||l.hideTrigger(),h&&this.storage.set("open",!0);return}case"set-open":{typeof c.data.value=="boolean"&&(this.storage.set("open",c.data.value),this.root&&c.data.value===!0&&!this.root.isReady.getValue()&&this.root.isReady.next(!0));return}default:return}},this.renderStrategy=this.options.renderStrategy||$.Inline,this.triggerIcon=this.options.triggerIcon;const n={[y.Necessary]:!0,[y.Functional]:!0,[y.Analytics]:!0};this.storage=new Ee(this.id,"sessionStorage",n,this.settings.storage),typeof o.autoActivate=="boolean"&&(this.autoActivate=o.autoActivate),o.anchor&&(this.anchor=o.anchor),this.container.register("$settings",s),this.texts.loadTexts(s.texts||{}),window.addEventListener("message",this.onMessageReceived)}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(de.Ready),this.autoActivate){const t=this.render();t&&this._getTargetElement().appendChild(t)}if(window!=null&&window.parent){const{version:t}=this.api.version();window.parent.postMessage({type:"widget-activated",data:{widgetId:this.id,version:t,storage:this.storage.stringify()}},"*")}}async loadPlugins(){for await(const t of this.plugins)await t(this)}styles(){return this.settings.styles||{}}branding(){return this.settings.branding||{}}plugin(t){return this.plugins.push(t),this}appendToDOM(t={}){this.root&&(this.root.classList.add("expanded"),this.root.classList.remove("hidden"),document.body.appendChild(this.root)),t.ignoreStorage||this.storage.set("open",!0)}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open",!1)}setZIndex(t){this.root&&(this.root.style.zIndex=t.toString())}mute(){this.storage.set("muteAudioNotifications",!0)}unmute(){this.storage.set("muteAudioNotifications",!1)}registerComponent(t,e){this.componentResolver.registerComponent(t,e)}resolveComponent(t){return this.componentResolver.getComponent(t)}mountComponent(t){this.components.push(t)}getComponent(t){const e=this.components.find(i=>i.type===t);return e||null}_getTargetElement(){let t="bottom-right";if(this.anchor==="BottomRight"?t="bottom-right":this.anchor==="BottomLeft"&&(t="bottom-left"),this.renderStrategy===$.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new W,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}_isEmbeddedInIFrame(){return window.self!==window.top}setFullscreenMode(t){this.fullscreen=t,this.root&&(this.root.fullscreen=!0)}render(){if(this._isEmbeddedInIFrame())return this.root;if(!this._isEmbeddedInIFrame()&&this.root&&(this.root.isReady.getValue()||this.root.isReady.next(!0)),this.renderStrategy===$.Trigger){const t=new b;return t.application=this,this.trigger=t,this.storage.get("open")&&this.trigger.toggleActive(),t}return this.root}}const Ui=r=>new U(r),st=class st{constructor(t=st.endpoint){this._endpoint=t}async getSite(t){const i=await(await fetch(t)).json();return i?{id:i.id,triggers:i.triggers||[],apps:(i.widgets||[]).map(s=>{let o=$.Trigger;s.renderStrategy.toLowerCase()==="inline"&&(o=$.Inline);const n=s.widgetId?s.widgetId:s.id,a=typeof s.autoActivate=="boolean"?s.autoActivate:!1,c=typeof s.anchor=="string"?s.anchor:"BottomRight",l=typeof s.triggerIcon=="string"?s.triggerIcon:"question";return{id:n,widgetId:n,renderStrategy:o,autoActivate:a,anchor:c,triggerIcon:{type:"Telia",content:l}}})}:null}async getWidget(t){const i=await(await fetch(`${this._endpoint}/widget/${t}`)).json();return i?{name:i.name,config:JSON.parse(i.configuration)}:null}};st.endpoint="https://widgets.ace.teliacompany.net/api";let U=st;class Li{constructor(t){this.site=t}storagePolicy(t){var i;(((i=this.site.environment)==null?void 0:i.applications)||[]).forEach(s=>{if(s.storage){const o={[y.Analytics]:t.includes("analytics"),[y.Necessary]:t.includes("necessary"),[y.Functional]:t.includes("functional")};s.storage.updatePolicy(o)}})}disallowStorageKey(t){var e;(((e=this.site.environment)==null?void 0:e.applications)||[]).forEach(i=>{i.storage&&i.storage.disallowKey(t)})}}class Oe{constructor(){this.applications=[],this.container=new wt("environment",this),this.bootstrapped=!1,this.site=null,this.widgetAPIHandlers=new Map,this.siteConfigurationHandlers=[],setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate(),this.siteConfigurationHandlers.forEach(t=>{this.site&&t(this.site.api)});for(const[t,e]of this.widgetAPIHandlers)e.forEach(i=>{i()});this.bootstrapped=!0}async activate(){var e;const t=this.applications.filter(i=>i.autoActivate);(((e=this.site)==null?void 0:e.triggers)||[]).filter(i=>i.triggerType==="visit").forEach(i=>{const s=window.location.pathname,o=i.condition.outputs||[];i.condition.type==="url"&&o.forEach(n=>{const a=n.action.type==="render_widget";if((n.value===s||n.value==="*")&&a){let l={widgetId:""};try{l=JSON.parse(n.action.data)}catch{l={widgetId:""}}const h=t.findIndex(u=>u.id===l.widgetId)>-1,d=this.applications.find(u=>u.id===l.widgetId);d&&!h&&(d.autoActivate=!0,t.push(d))}})});for await(const i of t)await i.activate()}notifyWidgetsOfCreation(){document.querySelectorAll("ace-widget").forEach(e=>{const i=this.applications.find(s=>s.name===e.name);i&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:i}}))})}configure(t){if(!this.site||!this.bootstrapped){this.siteConfigurationHandlers.push(t);return}t(this.site.api)}widget(t,e){const i=this.applications.find(s=>s.name===t);if(!i){const s=this.widgetAPIHandlers.get(t)||[];s.push(()=>{const o=this.applications.find(n=>n.name===t);e(o==null?void 0:o.api)}),this.widgetAPIHandlers.set(t,s);return}e(i==null?void 0:i.api)}registerApp(t,e,i,s){const o=new wt(e,this),n=new Pe(t,e,o,i,s);this.applications.push(n)}registerSite(t){this.site=t}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class Ie{constructor(t){this.configurations=[],this.httpClient=new U,this.api=new Li(this),this.triggers=[],this.httpClient=new U,typeof t=="string"?this.url=t:(t.httpClient&&(this.httpClient=t.httpClient),this.loadFromConfig(t))}async load(t){const e=await this.httpClient.getSite(t);if(!e){console.warn(`Unable to load site from the url provided: ${t}`);return}this.configurations=e.apps,this.triggers=e.triggers||[]}loadFromConfig(t){this.configurations=t.apps.map(e=>({id:"",renderStrategy:e.renderStrategy,widgetId:e.widgetId,autoActivate:e.autoActivate,anchor:e.anchor,triggerIcon:{type:"Telia",content:e.triggerIcon||"question"}}))}setHttpClient(t){this.httpClient=t}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new Oe,this.addGlobal(this.environment);for await(const i of this.configurations){const s=await this.httpClient.getWidget(i.widgetId);s&&((e=this.environment)==null||e.registerApp(i.widgetId,s.name,s.config,{renderStrategy:i.renderStrategy,triggerIcon:i.triggerIcon,autoActivate:i.autoActivate,anchor:i.anchor}))}t(this.environment),this.environment.registerSite(this),await this.environment.bootstrap()}addGlobal(t){const e=globalThis.ace;((e==null?void 0:e._w)||[]).forEach(([i,s])=>{t.widget(i,s)}),((e==null?void 0:e._c)||[]).forEach(i=>{t.configure(i)}),globalThis.ace=t}}var ji=Object.defineProperty,kt=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&ji(t,e,s),s};const Ut=class Ut extends A{constructor(){super(),this.status="deactivated",this.addEventListener("environment-created",this.onEnvironmentCreated)}async connectedCallback(){super.connectedCallback(),await this.getGlobalEnvironment()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("environment-created",this.onEnvironmentCreated)}async onEnvironmentCreated(t){this.widget=t.detail.widget,await this.activate(),this.requestUpdate()}async activate(){this.widget&&(await this.widget.activate(),this.status="activated")}async getGlobalEnvironment(){const t=globalThis.widgets;t&&(this.widget=t.applications.find(e=>e.name===this.name),await this.activate())}render(){if(!this.widget||this.status!=="activated")return p;if(this.widget.renderStrategy===$.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}};Ut.styles=[L`
441
+ `;let N=Nt;Ce([m({attribute:!0})],N.prototype,"fullscreen");Ce([m({attribute:!1}),Ii({context:Se})],N.prototype,"application");class ki{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...l]=a;return{definitionId:c,overrides:l}}return{definitionId:a,overrides:[]}},s=(a,c,l,h)=>{l.forEach(d=>{const u=i(d),f=h[u.definitionId];if(!f){console.error(`No definition found for component type '${u.definitionId}'.`);return}const g=a.createNode(f.type,f.type);g&&(g.name=u.definitionId,g.application=e,f.properties&&g.writeProperties(f.properties),f.context&&g.writeContext(f.context),f.layout&&g.writeLayout(f.layout),c.addChild(g),f.children&&s(a,g,f.children,h))})},{entry:o,components:n}=t;return s(this,this.root,[o],n),this.root}createRoot(){return typeof window<"u"&&(window.customElements.get("ace-wrapper")||window.customElements.define("ace-wrapper",N)),document.createElement("ace-wrapper")}createNode(t,e){if(!this.resolveComponent(e))return console.warn(`Unable to resolve component: ${e}`),new et;const s=document.createElement(`ace-${e}`);return s.type=e,s.name=t,s}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const it=class it{constructor(){this.components=new Map}getComponent(t){const e=this.components.get(t);return e||console.warn(`Unable to resolve component: ${t}. You most likely forgot to register the required plugin.`),e}registerComponent(t,e){this.components.set(t,e)}async loadComponents(){const t=[...this.components.entries()].map(([e,i])=>i.then(s=>{this.defineAsWebComponent(e,s.default)}));await Promise.all(t)}defineAsWebComponent(t,e){const i=it.ResolveWebComponentName(t);customElements.get(i)||customElements.define(i,e)}};it.ResolveWebComponentName=t=>`ace-${t}`;let _t=it;var y=(r=>(r.Necessary="necessary",r.Functional="functional",r.Analytics="analytics",r))(y||{});class Ee{constructor(t,e,i,s){this.disallowedKeys=[],this.widgetId=t,this.storage=e==="localStorage"?window.localStorage:window.sessionStorage,this.policy=i,this.storageEntries=s}set(t,e){if(this.disallowedKeys.includes(t))return;const i=this.storageEntries[t];if(!i){console.warn(`Storage key '${t}' is not defined.`);return}const s=i.category;if(this.policy[s]){const o={value:e,category:s};this.storage.setItem(this._prefixKey(t),JSON.stringify(o))}else console.warn(`Storage policy does not allow storing items in category: ${s}`)}get(t){const e=this.storage.getItem(this._prefixKey(t));if(!e)return null;try{const i=JSON.parse(e);return this.policy[i.category]?i.value:(console.warn(`Storage policy does not allow retrieving items from category: ${i.category}`),null)}catch{return null}}removeItem(t){this.storage.removeItem(this._prefixKey(t))}enforcePolicy(){var t;for(const[e,i]of Object.entries(this.storage)){const s=(t=JSON.parse(i))==null?void 0:t.category;this.policy[s]||this.storage.removeItem(e)}}updatePolicy(t){this.policy=t,this.enforcePolicy()}disallowKey(t){this.disallowedKeys.includes(t)||this.disallowedKeys.push(t),this.removeItem(t)}stringify(){return JSON.stringify(this.storage)}_prefixKey(t){return`ace_${this.widgetId.substring(0,7)}-${t}`}}class Ri{constructor(){this.texts=new Map}loadTexts(t){this.texts=new Map(Object.entries(t))}get(t,e){const i=this.texts.get(t);return i||e||null}getOrFallback(t,e){return this.texts.get(t)||e}}const Mi="1.1.111-rc.9";class Ni{constructor(t){this.widget=t,this.name=t.name}open(t={}){this.widget.appendToDOM(t)}close(){this.widget.hide()}setFullscreenMode(t){this.widget.setFullscreenMode(t)}setZIndex(t){this.widget.setZIndex(t)}version(){return{version:Mi}}}class Pe{constructor(t,e,i,s,o){this.id=t,this.name=e,this.container=i,this.settings=s,this.options=o,this.platform=new ki,this.texts=new Ri,this.renderStrategy=$.Inline,this.fullscreen=!1,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new _t,this.components=[],this.trigger=null,this.api=new Ni(this),this.onMessageReceived=async a=>{var l;const c=a.data;switch(c.type){case"set-storage-policies":{const{policies:h}=c.data||[],d={[y.Analytics]:h.includes("analytics"),[y.Necessary]:h.includes("necessary"),[y.Functional]:h.includes("functional")};this.storage.updatePolicy(d);return}case"disallow-storage-key":{const{storageKey:h}=c.data||null;h&&this.storage.disallowKey(h);return}case"set-fullscreen-mode":{const{value:h}=c.data;typeof h=="boolean"&&this.setFullscreenMode(h);return}case"open":{this.appendToDOM();return}case"close":{this.hide();return}case"set-z-index":{const{zIndex:h}=c.data||null;h&&this.setZIndex(h);return}case"deactivate-widget":{const h=this.storage.get("open");this.hide(),(l=this.trigger)==null||l.hideTrigger(),h&&this.storage.set("open",!0);return}case"set-open":{typeof c.data.value=="boolean"&&(this.storage.set("open",c.data.value),this.root&&c.data.value===!0&&!this.root.isReady.getValue()&&this.root.isReady.next(!0));return}default:return}},this.renderStrategy=this.options.renderStrategy||$.Inline,this.triggerIcon=this.options.triggerIcon;const n={[y.Necessary]:!0,[y.Functional]:!0,[y.Analytics]:!0};this.storage=new Ee(this.id,"sessionStorage",n,this.settings.storage),typeof o.autoActivate=="boolean"&&(this.autoActivate=o.autoActivate),o.anchor&&(this.anchor=o.anchor),this.container.register("$settings",s),this.texts.loadTexts(s.texts||{}),window.addEventListener("message",this.onMessageReceived)}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(de.Ready),this.autoActivate){const t=this.render();t&&this._getTargetElement().appendChild(t)}if(window!=null&&window.parent){const{version:t}=this.api.version();window.parent.postMessage({type:"widget-activated",data:{widgetId:this.id,version:t,storage:this.storage.stringify()}},"*")}}async loadPlugins(){for await(const t of this.plugins)await t(this)}styles(){return this.settings.styles||{}}branding(){return this.settings.branding||{}}plugin(t){return this.plugins.push(t),this}appendToDOM(t={}){this.root&&(this.root.classList.add("expanded"),this.root.classList.remove("hidden"),document.body.appendChild(this.root)),t.ignoreStorage||this.storage.set("open",!0)}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open",!1)}setZIndex(t){this.root&&(this.root.style.zIndex=t.toString())}mute(){this.storage.set("muteAudioNotifications",!0)}unmute(){this.storage.set("muteAudioNotifications",!1)}registerComponent(t,e){this.componentResolver.registerComponent(t,e)}resolveComponent(t){return this.componentResolver.getComponent(t)}mountComponent(t){this.components.push(t)}getComponent(t){const e=this.components.find(i=>i.type===t);return e||null}_getTargetElement(){let t="bottom-right";if(this.anchor==="BottomRight"?t="bottom-right":this.anchor==="BottomLeft"&&(t="bottom-left"),this.renderStrategy===$.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new W,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}_isEmbeddedInIFrame(){return window.self!==window.top}setFullscreenMode(t){this.fullscreen=t,this.root&&(this.root.fullscreen=!0)}render(){if(this._isEmbeddedInIFrame())return this.root;if(!this._isEmbeddedInIFrame()&&this.root&&(this.root.isReady.getValue()||this.root.isReady.next(!0)),this.renderStrategy===$.Trigger){const t=new b;return t.application=this,this.trigger=t,this.storage.get("open")&&this.trigger.toggleActive(),t}return this.root}}const Ui=r=>new U(r),st=class st{constructor(t=st.endpoint){this._endpoint=t}async getSite(t){const i=await(await fetch(t)).json();return i?{id:i.id,triggers:i.triggers||[],apps:(i.widgets||[]).map(s=>{let o=$.Trigger;s.renderStrategy.toLowerCase()==="inline"&&(o=$.Inline);const n=s.widgetId?s.widgetId:s.id,a=typeof s.autoActivate=="boolean"?s.autoActivate:!1,c=typeof s.anchor=="string"?s.anchor:"BottomRight",l=typeof s.triggerIcon=="string"?s.triggerIcon:"question";return{id:n,widgetId:n,renderStrategy:o,autoActivate:a,anchor:c,triggerIcon:{type:"Telia",content:l}}})}:null}async getWidget(t){const i=await(await fetch(`${this._endpoint}/widget/${t}`)).json();return i?{name:i.name,config:JSON.parse(i.configuration)}:null}};st.endpoint="https://widgets.ace.teliacompany.net/api";let U=st;class Li{constructor(t){this.site=t}storagePolicy(t){var i;(((i=this.site.environment)==null?void 0:i.applications)||[]).forEach(s=>{if(s.storage){const o={[y.Analytics]:t.includes("analytics"),[y.Necessary]:t.includes("necessary"),[y.Functional]:t.includes("functional")};s.storage.updatePolicy(o)}})}disallowStorageKey(t){var e;(((e=this.site.environment)==null?void 0:e.applications)||[]).forEach(i=>{i.storage&&i.storage.disallowKey(t)})}}class Oe{constructor(){this.applications=[],this.container=new wt("environment",this),this.bootstrapped=!1,this.site=null,this.widgetAPIHandlers=new Map,this.siteConfigurationHandlers=[],setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate(),this.siteConfigurationHandlers.forEach(t=>{this.site&&t(this.site.api)});for(const[t,e]of this.widgetAPIHandlers)e.forEach(i=>{i()});this.bootstrapped=!0}async activate(){var e;const t=this.applications.filter(i=>i.autoActivate);(((e=this.site)==null?void 0:e.triggers)||[]).filter(i=>i.triggerType==="visit").forEach(i=>{const s=window.location.pathname,o=i.condition.outputs||[];i.condition.type==="url"&&o.forEach(n=>{const a=n.action.type==="render_widget";if((n.value===s||n.value==="*")&&a){let l={widgetId:""};try{l=JSON.parse(n.action.data)}catch{l={widgetId:""}}const h=t.findIndex(u=>u.id===l.widgetId)>-1,d=this.applications.find(u=>u.id===l.widgetId);d&&!h&&(d.autoActivate=!0,t.push(d))}})});for await(const i of t)await i.activate()}notifyWidgetsOfCreation(){document.querySelectorAll("ace-widget").forEach(e=>{const i=this.applications.find(s=>s.name===e.name);i&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:i}}))})}configure(t){if(!this.site||!this.bootstrapped){this.siteConfigurationHandlers.push(t);return}t(this.site.api)}widget(t,e){const i=this.applications.find(s=>s.name===t);if(!i){const s=this.widgetAPIHandlers.get(t)||[];s.push(()=>{const o=this.applications.find(n=>n.name===t);e(o==null?void 0:o.api)}),this.widgetAPIHandlers.set(t,s);return}e(i==null?void 0:i.api)}registerApp(t,e,i,s){const o=new wt(e,this),n=new Pe(t,e,o,i,s);this.applications.push(n)}registerSite(t){this.site=t}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class Ie{constructor(t){this.configurations=[],this.httpClient=new U,this.api=new Li(this),this.triggers=[],this.httpClient=new U,typeof t=="string"?this.url=t:(t.httpClient&&(this.httpClient=t.httpClient),this.loadFromConfig(t))}async load(t){const e=await this.httpClient.getSite(t);if(!e){console.warn(`Unable to load site from the url provided: ${t}`);return}this.configurations=e.apps,this.triggers=e.triggers||[]}loadFromConfig(t){this.configurations=t.apps.map(e=>({id:"",renderStrategy:e.renderStrategy,widgetId:e.widgetId,autoActivate:e.autoActivate,anchor:e.anchor,triggerIcon:{type:"Telia",content:e.triggerIcon||"question"}}))}setHttpClient(t){this.httpClient=t}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new Oe,this.addGlobal(this.environment);for await(const i of this.configurations){const s=await this.httpClient.getWidget(i.widgetId);s&&((e=this.environment)==null||e.registerApp(i.widgetId,s.name,s.config,{renderStrategy:i.renderStrategy,triggerIcon:i.triggerIcon,autoActivate:i.autoActivate,anchor:i.anchor}))}t(this.environment),this.environment.registerSite(this),await this.environment.bootstrap()}addGlobal(t){const e=globalThis.ace;((e==null?void 0:e._w)||[]).forEach(([i,s])=>{t.widget(i,s)}),((e==null?void 0:e._c)||[]).forEach(i=>{t.configure(i)}),globalThis.ace=t}}var ji=Object.defineProperty,Tt=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&ji(t,e,s),s};const Ut=class Ut extends A{constructor(){super(),this.status="deactivated",this.addEventListener("environment-created",this.onEnvironmentCreated)}async connectedCallback(){super.connectedCallback(),await this.getGlobalEnvironment()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("environment-created",this.onEnvironmentCreated)}async onEnvironmentCreated(t){this.widget=t.detail.widget,await this.activate(),this.requestUpdate()}async activate(){this.widget&&(await this.widget.activate(),this.status="activated")}async getGlobalEnvironment(){const t=globalThis.widgets;t&&(this.widget=t.applications.find(e=>e.name===this.name),await this.activate())}render(){if(!this.widget||this.status!=="activated")return p;if(this.widget.renderStrategy===$.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}};Ut.styles=[L`
442
442
  :host {
443
443
  display: block;
444
444
  }
445
- `];let k=Ut;kt([m({attribute:!0})],k.prototype,"name");kt([j()],k.prototype,"widget");kt([j()],k.prototype,"status");customElements.get("ace-trigger-slot")||customElements.define("ace-trigger-slot",W);customElements.get("ace-trigger")||customElements.define("ace-trigger",b);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",et);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",N);customElements.get("ace-widget")||customElements.define("ace-widget",k);const Hi=async(r,t,e={})=>{const i=new Ie(r);e.httpClient&&i.setHttpClient(e.httpClient),await i.bootstrap(t)};exports.AceWidget=k;exports.Application=Pe;exports.Container=wt;exports.Environment=Oe;exports.HttpClient=U;exports.Site=Ie;exports.StorageCategory=y;exports.StorageService=Ee;exports.Trigger=b;exports.WidgetComponent=xe;exports.applicationContext=Se;exports.bootstrap=Hi;exports.createHttpClient=Ui;
445
+ `];let T=Ut;Tt([m({attribute:!0})],T.prototype,"name");Tt([j()],T.prototype,"widget");Tt([j()],T.prototype,"status");customElements.get("ace-trigger-slot")||customElements.define("ace-trigger-slot",W);customElements.get("ace-trigger")||customElements.define("ace-trigger",b);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",et);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",N);customElements.get("ace-widget")||customElements.define("ace-widget",T);const Hi=async(r,t,e={})=>{const i=new Ie(r);e.httpClient&&i.setHttpClient(e.httpClient),await i.bootstrap(t)};exports.AceWidget=T;exports.Application=Pe;exports.Container=wt;exports.Environment=Oe;exports.HttpClient=U;exports.Site=Ie;exports.StorageCategory=y;exports.StorageService=Ee;exports.Trigger=b;exports.WidgetComponent=xe;exports.applicationContext=Se;exports.bootstrap=Hi;exports.createHttpClient=Ui;