@telia-ace/widget-core-flamingo 1.1.70-rc.2 → 1.1.70-rc.21
Sign up to get free protection for your applications and to get access to all the features.
- package/components/trigger.component.d.ts +4 -0
- package/index.js +32 -24
- package/index.mjs +219 -208
- package/package.json +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import { LitElement, nothing } from 'lit';
|
2
2
|
import { Application } from '../models/application';
|
3
3
|
import { Ref } from 'lit-html/directives/ref.js';
|
4
|
+
import { BehaviorSubject, Subject } from 'rxjs';
|
4
5
|
export declare class Trigger extends LitElement {
|
5
6
|
static styles: import("lit").CSSResult[];
|
6
7
|
application?: Application;
|
@@ -8,7 +9,10 @@ export declare class Trigger extends LitElement {
|
|
8
9
|
loaded: boolean;
|
9
10
|
icon: any;
|
10
11
|
containerRef: Ref<HTMLDivElement>;
|
12
|
+
widgetActive$: BehaviorSubject<boolean>;
|
13
|
+
componentIsDestroyed$: Subject<void>;
|
11
14
|
connectedCallback(): Promise<void>;
|
15
|
+
disconnectedCallback(): void;
|
12
16
|
toggleActive(): void;
|
13
17
|
_applyBranding(): void;
|
14
18
|
_renderSymbol(): Promise<typeof nothing | import("lit-html").TemplateResult<1>>;
|
package/index.js
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ft=function(s,t){return ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])},ft(s,t)};function z(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ft(s,t);function e(){this.constructor=s}s.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function gt(s){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&s[t],i=0;if(e)return e.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&i>=s.length&&(s=void 0),{value:s&&s[i++],done:!s}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function G(s,t){var e=typeof Symbol=="function"&&s[Symbol.iterator];if(!e)return s;var i=e.call(s),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)n.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return n}function Z(s,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,n;i<r;i++)(n||!(i in t))&&(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return s.concat(n||Array.prototype.slice.call(t))}function b(s){return typeof s=="function"}function
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ft=function(s,t){return ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])},ft(s,t)};function z(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ft(s,t);function e(){this.constructor=s}s.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function gt(s){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&s[t],i=0;if(e)return e.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&i>=s.length&&(s=void 0),{value:s&&s[i++],done:!s}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function G(s,t){var e=typeof Symbol=="function"&&s[Symbol.iterator];if(!e)return s;var i=e.call(s),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)n.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return n}function Z(s,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,n;i<r;i++)(n||!(i in t))&&(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return s.concat(n||Array.prototype.slice.call(t))}function b(s){return typeof s=="function"}function Jt(s){var t=function(i){Error.call(i),i.stack=new Error().stack},e=s(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var nt=Jt(function(s){return function(e){s(this),this.message=e?e.length+` errors occurred during unsubscription:
|
2
2
|
`+e.map(function(i,r){return r+1+") "+i.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function mt(s,t){if(s){var e=s.indexOf(t);0<=e&&s.splice(e,1)}}var tt=function(){function s(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return s.prototype.unsubscribe=function(){var t,e,i,r,n;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=gt(o),c=a.next();!c.done;c=a.next()){var h=c.value;h.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 o.remove(this);var l=this.initialTeardown;if(b(l))try{l()}catch(v){n=v instanceof nt?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=gt(p),
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function mt(s,t){if(s){var e=s.indexOf(t);0<=e&&s.splice(e,1)}}var tt=function(){function s(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return s.prototype.unsubscribe=function(){var t,e,i,r,n;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=gt(o),c=a.next();!c.done;c=a.next()){var h=c.value;h.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 o.remove(this);var l=this.initialTeardown;if(b(l))try{l()}catch(v){n=v instanceof nt?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=gt(p),u=f.next();!u.done;u=f.next()){var g=u.value;try{Pt(g)}catch(v){n=n??[],v instanceof nt?n=Z(Z([],G(n)),G(v.errors)):n.push(v)}}}catch(v){i={error:v}}finally{try{u&&!u.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}}if(n)throw new nt(n)}},s.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Pt(t);else{if(t instanceof s){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},s.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},s.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},s.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&mt(e,t)},s.prototype.remove=function(t){var e=this._finalizers;e&&mt(e,t),t instanceof s&&t._removeParent(this)},s.EMPTY=function(){var t=new s;return t.closed=!0,t}(),s}(),Xt=tt.EMPTY;function Qt(s){return s instanceof tt||s&&"closed"in s&&b(s.remove)&&b(s.add)&&b(s.unsubscribe)}function Pt(s){b(s)?s():s.unsubscribe()}var te={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},vt={setTimeout:function(s,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];var r=vt.delegate;return r!=null&&r.setTimeout?r.setTimeout.apply(r,Z([s,t],G(e))):setTimeout.apply(void 0,Z([s,t],G(e)))},clearTimeout:function(s){var t=vt.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(s)},delegate:void 0};function Ce(s){vt.setTimeout(function(){throw s})}function Ot(){}function q(s){s()}var ee=function(s){z(t,s);function t(e){var i=s.call(this)||this;return i.isStopped=!1,e?(i.destination=e,Qt(e)&&e.add(i)):i.destination=Oe,i}return t.create=function(e,i,r){return new yt(e,i,r)},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,s.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}(tt),Se=Function.prototype.bind;function ot(s,t){return Se.call(s,t)}var Ee=function(){function s(t){this.partialObserver=t}return s.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(i){Y(i)}},s.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(i){Y(i)}else Y(t)},s.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){Y(e)}},s}(),yt=function(s){z(t,s);function t(e,i,r){var n=s.call(this)||this,o;if(b(e)||!e)o={next:e??void 0,error:i??void 0,complete:r??void 0};else{var a;n&&te.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return n.unsubscribe()},o={next:e.next&&ot(e.next,a),error:e.error&&ot(e.error,a),complete:e.complete&&ot(e.complete,a)}):o=e}return n.destination=new Ee(o),n}return t}(ee);function Y(s){Ce(s)}function Pe(s){throw s}var Oe={closed:!0,next:Ot,error:Pe,complete:Ot},Te=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Re(s){return s}function Ie(s){return s.length===0?Re:s.length===1?s[0]:function(e){return s.reduce(function(i,r){return r(i)},e)}}var Tt=function(){function s(t){t&&(this._subscribe=t)}return s.prototype.lift=function(t){var e=new s;return e.source=this,e.operator=t,e},s.prototype.subscribe=function(t,e,i){var r=this,n=ke(t)?t:new yt(t,e,i);return q(function(){var o=r,a=o.operator,c=o.source;n.add(a?a.call(n,c):c?r._subscribe(n):r._trySubscribe(n))}),n},s.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},s.prototype.forEach=function(t,e){var i=this;return e=Rt(e),new e(function(r,n){var o=new yt({next:function(a){try{t(a)}catch(c){n(c),o.unsubscribe()}},error:n,complete:r});i.subscribe(o)})},s.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},s.prototype[Te]=function(){return this},s.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Ie(t)(this)},s.prototype.toPromise=function(t){var e=this;return t=Rt(t),new t(function(i,r){var n;e.subscribe(function(o){return n=o},function(o){return r(o)},function(){return i(n)})})},s.create=function(t){return new s(t)},s}();function Rt(s){var t;return(t=s??te.Promise)!==null&&t!==void 0?t:Promise}function Ue(s){return s&&b(s.next)&&b(s.error)&&b(s.complete)}function ke(s){return s&&s instanceof ee||Ue(s)&&Qt(s)}var je=Jt(function(s){return function(){s(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),$t=function(s){z(t,s);function t(){var e=s.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 It(this,this);return i.operator=e,i},t.prototype._throwIfClosed=function(){if(this.closed)throw new je},t.prototype.next=function(e){var i=this;q(function(){var r,n;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var o=gt(i.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(e)}}catch(h){r={error:h}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var i=this;q(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=e;for(var r=i.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;q(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(),s.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,r=this,n=r.hasError,o=r.isStopped,a=r.observers;return n||o?Xt:(this.currentObservers=null,a.push(e),new tt(function(){i.currentObservers=null,mt(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var i=this,r=i.hasError,n=i.thrownError,o=i.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new Tt;return e.source=this,e},t.create=function(e,i){return new It(e,i)},t}(Tt),It=function(s){z(t,s);function t(e,i){var r=s.call(this)||this;return r.destination=e,r.source=i,r}return t.prototype.next=function(e){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.next)===null||r===void 0||r.call(i,e)},t.prototype.error=function(e){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.error)===null||r===void 0||r.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,r;return(r=(i=this.source)===null||i===void 0?void 0:i.subscribe(e))!==null&&r!==void 0?r:Xt},t}($t),ie=function(s){z(t,s);function t(e){var i=s.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=s.prototype._subscribe.call(this,e);return!i.closed&&e.next(this._value),i},t.prototype.getValue=function(){var e=this,i=e.hasError,r=e.thrownError,n=e._value;if(i)throw r;return this._throwIfClosed(),n},t.prototype.next=function(e){s.prototype.next.call(this,this._value=e)},t}($t),se=(s=>(s.Loading="loading",s.Ready="ready",s))(se||{});class bt{constructor(t,e){this.state=new ie("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
|
7
|
-
*/const K=globalThis
|
7
|
+
*/const K=globalThis,_t=K.ShadowRoot&&(K.ShadyCSS===void 0||K.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wt=Symbol(),Ut=new WeakMap;let re=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==wt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(_t&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=Ut.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ut.set(e,t))}return t}toString(){return this.cssText}};const Ne=s=>new re(typeof s=="string"?s:s+"",void 0,wt),I=(s,...t)=>{const e=s.length===1?s[0]:t.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new re(e,s,wt)},Me=(s,t)=>{if(_t)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),r=K.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,s.appendChild(i)}},kt=_t?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Ne(e)})(s):s;/**
|
8
8
|
* @license
|
9
9
|
* Copyright 2017 Google LLC
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
11
|
-
*/const{is:Le,defineProperty:He,getOwnPropertyDescriptor:
|
11
|
+
*/const{is:Le,defineProperty:He,getOwnPropertyDescriptor:De,getOwnPropertyNames:Be,getOwnPropertySymbols:ze,getPrototypeOf:We}=Object,A=globalThis,jt=A.trustedTypes,Fe=jt?jt.emptyScript:"",at=A.reactiveElementPolyfillSupport,j=(s,t)=>s,J={toAttribute(s,t){switch(t){case Boolean:s=s?Fe:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},At=(s,t)=>!Le(s,t),Nt={attribute:!0,type:String,converter:J,reflect:!1,hasChanged:At};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),A.litPropertyMetadata??(A.litPropertyMetadata=new WeakMap);let O=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=Nt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&He(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){const{get:r,set:n}=De(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Nt}static _$Ei(){if(this.hasOwnProperty(j("elementProperties")))return;const t=We(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(j("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(j("properties"))){const e=this.properties,i=[...Be(e),...ze(e)];for(const r of i)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,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 r of i)e.unshift(kt(r))}else t!==void 0&&e.push(kt(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 Me(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 n;const i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:J).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var n;const i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:J;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??At)(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[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.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){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[j("elementProperties")]=new Map,O[j("finalized")]=new Map,at==null||at({ReactiveElement:O}),(A.reactiveElementVersions??(A.reactiveElementVersions=[])).push("2.0.4");/**
|
12
12
|
* @license
|
13
13
|
* Copyright 2017 Google LLC
|
14
14
|
* SPDX-License-Identifier: BSD-3-Clause
|
15
|
-
*/const N=globalThis,X=N.trustedTypes,
|
16
|
-
\f\r]`,k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
17
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
15
|
+
*/const N=globalThis,X=N.trustedTypes,Mt=X?X.createPolicy("lit-html",{createHTML:s=>s}):void 0,ne="$lit$",w=`lit$${(Math.random()+"").slice(9)}$`,oe="?"+w,Ye=`<${oe}>`,E=document,L=()=>E.createComment(""),H=s=>s===null||typeof s!="object"&&typeof s!="function",ae=Array.isArray,Ve=s=>ae(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",ct=`[
|
16
|
+
\f\r]`,k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lt=/-->/g,Ht=/>/g,x=RegExp(`>|${ct}(?:([^\\s"'>=/]+)(${ct}*=${ct}*(?:[^
|
17
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dt=/'/g,Bt=/"/g,ce=/^(?:script|style|textarea|title)$/i,qe=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),T=qe(1),P=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),zt=new WeakMap,S=E.createTreeWalker(E,129);function he(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Mt!==void 0?Mt.createHTML(t):t}const Ke=(s,t)=>{const e=s.length-1,i=[];let r,n=t===2?"<svg>":"",o=k;for(let a=0;a<e;a++){const c=s[a];let h,l,p=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===k?l[1]==="!--"?o=Lt:l[1]!==void 0?o=Ht:l[2]!==void 0?(ce.test(l[2])&&(r=RegExp("</"+l[2],"g")),o=x):l[3]!==void 0&&(o=x):o===x?l[0]===">"?(o=r??k,p=-1):l[1]===void 0?p=-2:(p=o.lastIndex-l[2].length,h=l[1],o=l[3]===void 0?x:l[3]==='"'?Bt:Dt):o===Bt||o===Dt?o=x:o===Lt||o===Ht?o=k:(o=x,r=void 0);const u=o===x&&s[a+1].startsWith("/>")?" ":"";n+=o===k?c+Ye:p>=0?(i.push(h),c.slice(0,p)+ne+c.slice(p)+w+u):c+w+(p===-2?a:u)}return[he(s,n+(s[e]||"<?>")+(t===2?"</svg>":"")),i]};class D{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let n=0,o=0;const a=t.length-1,c=this.parts,[h,l]=Ke(t,e);if(this.el=D.createElement(h,i),S.currentNode=this.el.content,e===2){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(r=S.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const p of r.getAttributeNames())if(p.endsWith(ne)){const f=l[o++],u=r.getAttribute(p).split(w),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:g[2],strings:u,ctor:g[1]==="."?Ze:g[1]==="?"?Je:g[1]==="@"?Xe:et}),r.removeAttribute(p)}else p.startsWith(w)&&(c.push({type:6,index:n}),r.removeAttribute(p));if(ce.test(r.tagName)){const p=r.textContent.split(w),f=p.length-1;if(f>0){r.textContent=X?X.emptyScript:"";for(let u=0;u<f;u++)r.append(p[u],L()),S.nextNode(),c.push({type:2,index:++n});r.append(p[f],L())}}}else if(r.nodeType===8)if(r.data===oe)c.push({type:2,index:n});else{let p=-1;for(;(p=r.data.indexOf(w,p+1))!==-1;)c.push({type:7,index:n}),p+=w.length-1}n++}}static createElement(t,e){const i=E.createElement("template");return i.innerHTML=t,i}}function R(s,t,e=s,i){var o,a;if(t===P)return t;let r=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const n=H(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=r:e._$Cl=r),r!==void 0&&(t=R(s,r._$AS(s,t.values),r,i)),t}class Ge{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,r=((t==null?void 0:t.creationScope)??E).importNode(e,!0);S.currentNode=r;let n=S.nextNode(),o=0,a=0,c=i[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new W(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new Qe(n,this,t)),this._$AV.push(h),c=i[++a]}o!==(c==null?void 0:c.index)&&(n=S.nextNode(),o++)}return S.currentNode=E,r}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class W{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=R(this,t,e),H(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==P&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ve(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==d&&H(this._$AH)?this._$AA.nextSibling.data=t:this.T(E.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=D.createElement(he(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(e);else{const o=new Ge(r,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=zt.get(t.strings);return e===void 0&&zt.set(t.strings,e=new D(t)),e}k(t){ae(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const n of t)r===e.length?e.push(i=new W(this.S(L()),this.S(L()),this,this.options)):i=e[r],i._$AI(n),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,r){const n=this.strings;let o=!1;if(n===void 0)t=R(this,t,e,0),o=!H(t)||t!==this._$AH&&t!==P,o&&(this._$AH=t);else{const a=t;let c,h;for(t=n[0],c=0;c<n.length-1;c++)h=R(this,a[i+c],e,c),h===P&&(h=this._$AH[c]),o||(o=!H(h)||h!==this._$AH[c]),h===d?t=d:t!==d&&(t+=(h??"")+n[c+1]),this._$AH[c]=h}o&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ze extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Je extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Xe extends et{constructor(t,e,i,r,n){super(t,e,i,r,n),this.type=5}_$AI(t,e=this){if((t=R(this,t,e,0)??d)===P)return;const i=this._$AH,r=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==d&&(i===d||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Qe{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){R(this,t)}}const ht=N.litHtmlPolyfillSupport;ht==null||ht(D,W),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.1.2");const ti=(s,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let r=i._$litPart$;if(r===void 0){const n=(e==null?void 0:e.renderBefore)??null;i._$litPart$=r=new W(t.insertBefore(L(),n),n,void 0,e??{})}return r._$AI(s),r};/**
|
18
18
|
* @license
|
19
19
|
* Copyright 2017 Google LLC
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
21
|
-
*/let $=class extends O{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=ti(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 P}};var
|
21
|
+
*/let $=class extends O{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=ti(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 P}};var Zt;$._$litElement$=!0,$.finalized=!0,(Zt=globalThis.litElementHydrateSupport)==null||Zt.call(globalThis,{LitElement:$});const lt=globalThis.litElementPolyfillSupport;lt==null||lt({LitElement:$});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
|
22
22
|
* @license
|
23
23
|
* Copyright 2017 Google LLC
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
25
|
-
*/const ei={attribute:!0,type:String,converter:J,reflect:!1,hasChanged:
|
25
|
+
*/const ei={attribute:!0,type:String,converter:J,reflect:!1,hasChanged:At},ii=(s=ei,t,e)=>{const{kind:i,metadata:r}=e;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(e.name,s),i==="accessor"){const{name:o}=e;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,s)},init(a){return a!==void 0&&this.P(o,void 0,s),a}}}if(i==="setter"){const{name:o}=e;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,s)}}throw Error("Unsupported decorator location: "+i)};function m(s){return(t,e)=>typeof e=="object"?ii(s,t,e):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,t,e)}/**
|
26
26
|
* @license
|
27
27
|
* Copyright 2017 Google LLC
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
29
|
-
*/function F(s){return m({...s,state:!0,attribute:!1})}var si=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni=(s,t,e,i)=>{for(var r=i>1?void 0:i?ri(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&si(t,e,r),r};class it extends ${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"),
|
29
|
+
*/function F(s){return m({...s,state:!0,attribute:!1})}var si=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni=(s,t,e,i)=>{for(var r=i>1?void 0:i?ri(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&si(t,e,r),r};class it extends ${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"),d}}it.styles=[I`
|
30
30
|
:host {
|
31
31
|
position: fixed;
|
32
32
|
display: flex;
|
@@ -46,7 +46,7 @@
|
|
46
46
|
* @license
|
47
47
|
* Copyright 2017 Google LLC
|
48
48
|
* SPDX-License-Identifier: BSD-3-Clause
|
49
|
-
*/const
|
49
|
+
*/const xt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ct=s=>(...t)=>({_$litDirective$:s,values:t});let le=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
|
50
50
|
* @license
|
51
51
|
* Copyright 2020 Google LLC
|
52
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -54,19 +54,19 @@
|
|
54
54
|
* @license
|
55
55
|
* Copyright 2017 Google LLC
|
56
56
|
* SPDX-License-Identifier: BSD-3-Clause
|
57
|
-
*/const M=(s,t)=>{var i;const e=s._$AN;if(e===void 0)return!1;for(const r of e)(i=r._$AO)==null||i.call(r,t,!1),M(r,t);return!0},Q=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while((e==null?void 0:e.size)===0)},
|
57
|
+
*/const M=(s,t)=>{var i;const e=s._$AN;if(e===void 0)return!1;for(const r of e)(i=r._$AO)==null||i.call(r,t,!1),M(r,t);return!0},Q=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while((e==null?void 0:e.size)===0)},pe=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),hi(t)}};function ai(s){this._$AN!==void 0?(Q(this),this._$AM=s,pe(this)):this._$AM=s}function ci(s,t=!1,e=0){const i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(i))for(let n=e;n<i.length;n++)M(i[n],!1),Q(i[n]);else i!=null&&(M(i,!1),Q(i));else M(this,s)}const hi=s=>{s.type==xt.CHILD&&(s._$AP??(s._$AP=ci),s._$AQ??(s._$AQ=ai))};class de extends le{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),pe(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,r;t!==this.isConnected&&(this.isConnected=t,t?(i=this.reconnected)==null||i.call(this):(r=this.disconnected)==null||r.call(this)),e&&(M(this,t),Q(this))}setValue(t){if(oi(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}const li=new WeakMap;let Wt=0;const pt=new Map,Ft=new WeakSet,Yt=()=>new Promise(s=>requestAnimationFrame(s)),pi=[{transform:"translateX(100%) scale(0)",opacity:0}],Vt=(s,t)=>{const e=s-t;return e===0?void 0:e},qt=(s,t)=>{const e=s/t;return e===1?void 0:e},dt={left:(s,t)=>{const e=Vt(s,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(s,t)=>{const e=Vt(s,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(s,t)=>{let e;t===0&&(t=1,e={width:"1px"});const i=qt(s,t);return{value:i,overrideFrom:e,transform:i==null||isNaN(i)?void 0:`scaleX(${i})`}},height:(s,t)=>{let e;t===0&&(t=1,e={height:"1px"});const i=qt(s,t);return{value:i,overrideFrom:e,transform:i==null||isNaN(i)?void 0:`scaleY(${i})`}}},di={duration:333,easing:"ease-in-out"},ui=["left","top","width","height","opacity","color","background"],Kt=new WeakMap;class fi extends de{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===xt.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){var t;(t=this.resolveFinished)==null||t.call(this),this.finished=new Promise(e=>{this.l=e})}async resolveFinished(){var t;(t=this.l)==null||t.call(this),this.l=void 0}render(t){return d}getController(){return li.get(this.u)}isDisabled(){var t;return this.options.disabled||((t=this.getController())==null?void 0:t.disabled)}update(t,[e]){var r;const i=this.u===void 0;return i&&(this.u=(r=t.options)==null?void 0:r.host,this.u.addController(this),this.u.updateComplete.then(n=>this.t=!0),this.element=t.element,Kt.set(this.element,this)),this.optionsOrCallback=e,(i||typeof e!="function")&&this.p(e),this.render(e)}p(t){t=t??{};const e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=ui),this.options=t}m(){const t={},e=this.element.getBoundingClientRect(),i=getComputedStyle(this.element);return this.options.properties.forEach(r=>{const n=e[r]??(dt[r]?void 0:i[r]),o=Number(n);t[r]=isNaN(o)?n+"":o}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((i,r)=>{if(Array.isArray(i)){if(Array.isArray(r)&&r.length===i.length&&i.every((n,o)=>n===r[o]))return!1}else if(r===i)return!1;return!0})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Yt;const e=this.O(),i=this.j(this.options.keyframeOptions,e),r=this.m();if(this.A!==void 0){const{from:n,to:o}=this.N(this.A,r,e);this.log("measured",[this.A,r,n,o]),t=this.calculateKeyframes(n,o)}else{const n=pt.get(this.options.inId);if(n){pt.delete(this.options.inId);const{from:o,to:a}=this.N(n,r,e);t=this.calculateKeyframes(o,a),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,Wt++,t.forEach(c=>c.zIndex=Wt)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,i)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){var t,e;this.P=this.element.getAttribute("style"),(t=this.webAnimation)==null||t.commitStyles(),(e=this.webAnimation)==null||e.cancel()}reconnected(){}async disconnected(){var e;if(!this.h||(this.options.id!==void 0&&pt.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Yt(),(e=this.i)==null?void 0:e.isConnected){const i=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,i),this.options.stabilizeOut){const r=this.m();this.log("stabilizing out");const n=this.A.left-r.left,o=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||n===0&&o===0||(this.element.style.position="relative"),n!==0&&(this.element.style.left=n+"px"),o!==0&&(this.element.style.top=o+"px")}}const t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){var t,e;(e=(t=this.options).onStart)==null||e.call(t,this)}didFinish(t){var e,i;t&&((i=(e=this.options).onComplete)==null||i.call(e,this)),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){const t=[];for(let e=this.element.parentNode;e;e=e==null?void 0:e.parentNode){const i=Kt.get(e);i&&!i.isDisabled()&&i&&t.push(i)}return t}get isHostRendered(){const t=Ft.has(this.u);return t||this.u.updateComplete.then(()=>{Ft.add(this.u)}),t}j(t,e=this.O()){const i={...di};return e.forEach(r=>Object.assign(i,r.options.keyframeOptions)),Object.assign(i,t),i}N(t,e,i){t={...t},e={...e};const r=i.map(a=>a.animatingProperties).filter(a=>a!==void 0);let n=1,o=1;return r.length>0&&(r.forEach(a=>{a.width&&(n/=a.width),a.height&&(o/=a.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=n*t.left,e.left=n*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=o*t.top,e.top=o*e.top)),{from:t,to:e}}calculateKeyframes(t,e,i=!1){const r={},n={};let o=!1;const a={};for(const c in e){const h=t[c],l=e[c];if(c in dt){const p=dt[c];if(h===void 0||l===void 0)continue;const f=p(h,l);f.transform!==void 0&&(a[c]=f.value,o=!0,r.transform=`${r.transform??""} ${f.transform}`,f.overrideFrom!==void 0&&Object.assign(r,f.overrideFrom))}else h!==l&&h!==void 0&&l!==void 0&&(o=!0,r[c]=h,n[c]=l)}return r.transformOrigin=n.transformOrigin=i?"center center":"top left",this.animatingProperties=a,o?[r,n]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let i=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),i=!0,this.webAnimation=this.element.animate(t,e);const r=this.getController();r==null||r.add(this);try{await this.webAnimation.finished}catch{}r==null||r.remove(this)}return this.didFinish(i),i}isAnimating(){var t,e;return((t=this.webAnimation)==null?void 0:t.playState)==="running"||((e=this.webAnimation)==null?void 0:e.pending)}log(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}}const gi=Ct(fi),mi={name:"question",svg:'<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M32 4C16.536 4 4 16.536 4 32C4 47.464 16.536 60 32 60C47.464 60 60 47.464 60 32C59.9827 16.5432 47.4568 4.01731 32 4ZM32 55.6923C18.9151 55.6923 8.30769 45.0849 8.30769 32C8.30769 18.9151 18.9151 8.30769 32 8.30769C45.0849 8.30769 55.6923 18.9151 55.6923 32C55.6775 45.0788 45.0788 55.6775 32 55.6923Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M31.9423 37.5723L36.311 32.9068L36.7354 32.4448C39.7555 29.1161 40.7645 27.0647 40.7645 24.5087C40.7645 23.1091 40.4251 21.7942 39.7041 20.6491C38.3044 18.3587 35.6323 16.9166 32.2816 16.9166C28.7565 16.9166 25.3125 18.7414 23.2581 21.6772L23.1201 21.8791C22.8232 22.3032 22.696 22.6849 22.696 22.9818C22.696 23.7029 23.926 25.9932 25.2833 25.9932C25.5378 25.9932 25.7922 25.9084 26.0467 25.7388C26.2588 25.5691 26.5981 25.2298 27.0647 24.7208C28.8885 22.6849 30.1185 21.9215 31.7726 21.9215C33.6813 21.9215 35.081 23.1939 35.081 24.8905C35.081 26.375 34.2751 27.7746 32.3664 29.8529L28.2523 34.2216C27.9554 34.6033 27.7857 34.9426 27.7857 35.282C27.7857 35.6213 27.9978 36.1726 28.4219 36.8937C29.0581 37.8692 29.7368 38.3782 30.4578 38.3782C30.9244 38.3782 31.3909 38.1237 31.9423 37.5723ZM30.882 47.4972C29.2278 47.4972 27.6585 44.7403 27.6585 43.6799C27.6585 42.1954 30.0761 40.6261 32.4089 40.6261C33.6389 40.6261 34.2751 41.1775 34.2751 42.3227C34.2751 44.0616 33.4692 45.843 32.4513 46.7761C31.9423 47.2427 31.4334 47.4972 30.882 47.4972Z"/></svg>'};/**
|
58
58
|
* @license
|
59
59
|
* Copyright 2018 Google LLC
|
60
60
|
* SPDX-License-Identifier: BSD-3-Clause
|
61
|
-
*/const vi=
|
61
|
+
*/const vi=Ct(class extends le{constructor(s){var t;if(super(s),s.type!==xt.ATTRIBUTE||s.name!=="class"||((t=s.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(t=>s[t]).join(" ")+" "}update(s,[t]){var i,r;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in t)t[n]&&!((i=this.nt)!=null&&i.has(n))&&this.st.add(n);return this.render(t)}const e=s.element.classList;for(const n of this.st)n in t||(e.remove(n),this.st.delete(n));for(const n in t){const o=!!t[n];o===this.st.has(n)||(r=this.nt)!=null&&r.has(n)||(o?(e.add(n),this.st.add(n)):(e.remove(n),this.st.delete(n)))}return P}}),V=(s,t,e)=>{s&&e.style.setProperty(t,s)},ue=(s,t)=>{var e,i,r,n;V((e=s.colors)==null?void 0:e.primaryBackground,"--primary-background",t),V((i=s.colors)==null?void 0:i.textOnPrimaryBackground,"--text-on-primary-background",t),V((r=s.colors)==null?void 0:r.secondaryBackground,"--secondary-background",t),V((n=s.colors)==null?void 0:n.textOnSecondaryBackground,"--text-on-secondary-background",t)};/**
|
62
62
|
* @license
|
63
63
|
* Copyright 2020 Google LLC
|
64
64
|
* SPDX-License-Identifier: BSD-3-Clause
|
65
|
-
*/const
|
65
|
+
*/const fe=()=>new yi;class yi{}const ut=new WeakMap,ge=Ct(class extends de{render(s){return d}update(s,[t]){var i;const e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=(i=s.options)==null?void 0:i.host,this.rt(this.ct=s.element)),d}rt(s){if(typeof this.Y=="function"){const t=this.ht??globalThis;let e=ut.get(t);e===void 0&&(e=new WeakMap,ut.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,t;return typeof this.Y=="function"?(s=ut.get(this.ht??globalThis))==null?void 0:s.get(this.Y):(t=this.Y)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var bi=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,st=(s,t,e,i)=>{for(var r=i>1?void 0:i?$i(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&bi(t,e,r),r};class _ extends ${constructor(){super(...arguments),this.active=!1,this.loaded=!1,this.containerRef=fe(),this.widgetActive$=new ie(!1),this.componentIsDestroyed$=new $t}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(),this.loaded=!0,this._applyBranding()}disconnectedCallback(){super.disconnectedCallback(),this.componentIsDestroyed$.next(),this.componentIsDestroyed$.complete()}toggleActive(){var t;if(!((t=this.application)!=null&&t.root)){console.warn("Could not activate widget. No root element assigned to widget.");return}this.active=!this.active,this.active?(this.application.appendToDOM(),this.widgetActive$.next(!0)):(this.application.hide(),this.widgetActive$.next(!1))}_applyBranding(){var t;(t=this.application)!=null&&t.settings&&ue(this.application.settings.branding,this)}async _renderSymbol(){var a,c,h;const t=(a=this.application)==null?void 0:a.branding(),e=(c=t==null?void 0:t.graphics)==null?void 0:c.trigger;if(e)return T` <img src=${e} class="trigger-icon" alt="" /> `;const i=(h=this.application)==null?void 0:h.triggerIcon;if(!i)return d;const r=async l=>mi,{type:n,content:o}=i;switch(n){case"Telia":{const l=await r();return l?T`<telia-icon
|
66
66
|
class="trigger-icon"
|
67
67
|
svg=${l.svg}
|
68
68
|
size="lg"
|
69
|
-
></telia-icon>`:
|
69
|
+
></telia-icon>`:d}default:return d}}render(){var t,e,i,r;return T`<div class="trigger-container" ${ge(this.containerRef)}>
|
70
70
|
${!this.active&&((r=(i=(e=(t=this.application)==null?void 0:t.settings)==null?void 0:e.branding)==null?void 0:i.other)!=null&&r.showButtonLabel)?T`
|
71
71
|
<button
|
72
72
|
label="${this.application.settings.branding.other.buttonLabelText??"Widget trigger"}"
|
@@ -76,7 +76,7 @@
|
|
76
76
|
>
|
77
77
|
${this.application.settings.branding.other.buttonLabelText}
|
78
78
|
</button>
|
79
|
-
`:
|
79
|
+
`:d}
|
80
80
|
|
81
81
|
<button
|
82
82
|
label="Widget trigger"
|
@@ -112,7 +112,7 @@
|
|
112
112
|
</svg>
|
113
113
|
</span>
|
114
114
|
</button>
|
115
|
-
</div>`}}_.styles=[
|
115
|
+
</div>`}}_.styles=[I`
|
116
116
|
:host {
|
117
117
|
--voca-rem-multiplier: 0.625;
|
118
118
|
--trigger-label-bg: #f5e0ff;
|
@@ -188,6 +188,8 @@
|
|
188
188
|
display: flex;
|
189
189
|
justify-content: center;
|
190
190
|
align-items: center;
|
191
|
+
}
|
192
|
+
.trigger-close svg path {
|
191
193
|
fill: var(--trigger-text-color, var(--text-on-primary-background));
|
192
194
|
}
|
193
195
|
|
@@ -216,7 +218,7 @@
|
|
216
218
|
.trigger-label:hover {
|
217
219
|
opacity: 0.8;
|
218
220
|
}
|
219
|
-
`];st([m({attribute:!1})],_.prototype,"application",2);st([F()],_.prototype,"active",2);st([F()],_.prototype,"loaded",2);st([F()],_.prototype,"icon",2);var _i=Object.defineProperty,wi=Object.getOwnPropertyDescriptor,C=(s,t,e,i)=>{for(var r=i>1?void 0:i?wi(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&_i(t,e,r),r};const
|
221
|
+
`];st([m({attribute:!1})],_.prototype,"application",2);st([F()],_.prototype,"active",2);st([F()],_.prototype,"loaded",2);st([F()],_.prototype,"icon",2);var _i=Object.defineProperty,wi=Object.getOwnPropertyDescriptor,C=(s,t,e,i)=>{for(var r=i>1?void 0:i?wi(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&_i(t,e,r),r};const me=s=>{class t extends s{constructor(){super(...arguments),this.properties={},this.context={},this.layout={},this.nodes=[]}writeProperties(i){this.properties=i}writeLayout(i){this.layout=i}writeContext(i){this.context=i}addChild(i){i.parent=this,this.nodes.push(i)}connectedCallback(){super.connectedCallback(),this.renderRoot.host.style.setProperty("--width",this.layout.size==="full"?"var(--columns, 1)":`min(${this.layout.size||"var(--columns)"}, var(--columns))`),this.application.mountComponent(this)}}return t.styles=[I`
|
220
222
|
:host {
|
221
223
|
font-family: var(--font-family);
|
222
224
|
grid-column: span var(--width);
|
@@ -228,7 +230,7 @@
|
|
228
230
|
* {
|
229
231
|
box-sizing: border-box;
|
230
232
|
}
|
231
|
-
`],C([m()],t.prototype,"properties",2),C([m()],t.prototype,"context",2),C([m()],t.prototype,"layout",2),C([m()],t.prototype,"name",2),C([m()],t.prototype,"type",2),C([m({attribute:!1})],t.prototype,"application",2),C([m({attribute:!1})],t.prototype,"parent",2),t};class
|
233
|
+
`],C([m()],t.prototype,"properties",2),C([m()],t.prototype,"context",2),C([m()],t.prototype,"layout",2),C([m()],t.prototype,"name",2),C([m()],t.prototype,"type",2),C([m({attribute:!1})],t.prototype,"application",2),C([m({attribute:!1})],t.prototype,"parent",2),t};class St extends me($){render(){return T`Non resolved component`}}St.styles=[I`
|
232
234
|
:host {
|
233
235
|
display: block;
|
234
236
|
}
|
@@ -252,13 +254,13 @@
|
|
252
254
|
* @license
|
253
255
|
* Copyright 2021 Google LLC
|
254
256
|
* SPDX-License-Identifier: BSD-3-Clause
|
255
|
-
*/let Si=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}};class
|
257
|
+
*/let Si=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}};class Gt extends Ci{constructor(t,e,i){var r,n;super(e.context!==void 0?e.initialValue:i),this.onContextRequest=o=>{const a=o.composedPath()[0];o.context===this.context&&a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{const a=o.composedPath()[0];if(o.context!==this.context||a===this.host)return;const c=new Set;for(const[h,{consumerHost:l}]of this.subscriptions)c.has(h)||(c.add(h),l.dispatchEvent(new xi(this.context,h,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(n=(r=this.host).addController)==null||n.call(r,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Si(this.context))}}/**
|
256
258
|
* @license
|
257
259
|
* Copyright 2017 Google LLC
|
258
260
|
* SPDX-License-Identifier: BSD-3-Clause
|
259
|
-
*/function Ei({context:s}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){i.set(this,new
|
261
|
+
*/function Ei({context:s}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){i.set(this,new Gt(this,{context:s}))}),{get(){return t.get.call(this)},set(r){var n;return(n=i.get(this))==null||n.setValue(r),t.set.call(this,r)},init(r){var n;return(n=i.get(this))==null||n.setValue(r),r}};{t.constructor.addInitializer(o=>{i.set(o,new Gt(o,{context:s}))});const r=Object.getOwnPropertyDescriptor(t,e);let n;if(r===void 0){const o=new WeakMap;n={get:function(){return o.get(this)},set:function(a){i.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{const o=r.set;n={...r,set:function(a){i.get(this).setValue(a),o==null||o.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}var Pi=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ti=(s,t,e,i)=>{for(var r=i>1?void 0:i?Oi(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&Pi(t,e,r),r};const ve="application";class rt extends ${constructor(){super(...arguments),this.nodes=[],this.wrapperRef=fe()}addChild(t){t.parent=this,this.nodes.push(t)}applyBranding(){if(!this.wrapperRef.value)return;const t=this.application.settings;t!=null&&t.branding&&ue(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,r])=>{e.style.setProperty(`--${i}`,r)})}firstUpdated(t){this.applyBranding(),this.applyStyles()}render(){return this.application.renderStrategy===y.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")),T`<div class="widget-container" ${ge(this.wrapperRef)}>
|
260
262
|
${Ai(this.nodes,t=>t)}
|
261
|
-
</div>`}}rt.styles=
|
263
|
+
</div>`}}rt.styles=I`
|
262
264
|
:host {
|
263
265
|
--font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
|
264
266
|
--spacing-xs: 0.2rem;
|
@@ -303,6 +305,7 @@
|
|
303
305
|
@media screen and (max-width: 800px) {
|
304
306
|
:host(.floating) {
|
305
307
|
inset: 0 0 95px 0;
|
308
|
+
height: 100%;
|
306
309
|
}
|
307
310
|
}
|
308
311
|
@media screen and (min-width: 801px) {
|
@@ -323,6 +326,10 @@
|
|
323
326
|
:host(.floating) .widget-container {
|
324
327
|
box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
|
325
328
|
border-radius: 0.7rem;
|
329
|
+
|
330
|
+
@media screen and (max-width: 800px) {
|
331
|
+
border-radius: 0;
|
332
|
+
}
|
326
333
|
}
|
327
334
|
|
328
335
|
* {
|
@@ -361,9 +368,10 @@
|
|
361
368
|
:host(.hidden) {
|
362
369
|
opacity: 0;
|
363
370
|
animation: slideDown 0.3s linear;
|
371
|
+
pointer-events: none;
|
364
372
|
}
|
365
|
-
`;Ti([m({attribute:!1}),Ei({context:
|
373
|
+
`;Ti([m({attribute:!1}),Ei({context:ve})],rt.prototype,"application",2);class Ri{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...h]=a;return{definitionId:c,overrides:h}}return{definitionId:a,overrides:[]}},r=(a,c,h,l)=>{h.forEach(p=>{const f=i(p),u=l[f.definitionId];if(!u){console.error(`No definition found for component type '${f.definitionId}'.`);return}const g=a.createNode(u.type,u.type);g&&(g.name=f.definitionId,g.application=e,u.properties&&g.writeProperties(u.properties),u.context&&g.writeContext(u.context),u.layout&&g.writeLayout(u.layout),c.addChild(g),u.children&&r(a,g,u.children,l))})},{entry:n,components:o}=t;return r(this,this.root,[n],o),this.root}createRoot(){return new rt}createNode(t,e){const i=this.resolveComponent(e);if(!i)return console.warn(`Unable to resolve component: ${e}`),new St;const r=new i;return r.type=e,r.name=t,r}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const ye=class{constructor(){this.components=new Map}getComponent(s){const t=this.components.get(s);return t||console.warn(`Unable to resolve component: ${s}. You most likely forgot to register the required plugin.`),t}registerComponent(s,t){this.components.set(s,t)}async loadComponents(){const s=[...this.components.entries()].map(([t,e])=>e.then(i=>{this.defineAsWebComponent(t,i.default)}));await Promise.all(s)}defineAsWebComponent(s,t){const e=ye.ResolveWebComponentName(s);customElements.get(e)||customElements.define(e,t)}};let be=ye;be.ResolveWebComponentName=s=>`ace-${s}`;class $e{constructor(t){this.widgetId=t}_prefixKey(t){return`ace_${this.widgetId.substring(0,7)}-${t}`}set(t,e){sessionStorage.setItem(this._prefixKey(t),e)}get(t){const e=sessionStorage.getItem(this._prefixKey(t));if(!e)return null;try{return JSON.parse(e)}catch{return e}}}class Ii{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}}class _e{constructor(t,e,i,r,n){this.id=t,this.name=e,this.container=i,this.settings=r,this.options=n,this.platform=new Ri,this.texts=new Ii,this.renderStrategy=y.Inline,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new be,this.components=[],this.trigger=null,this.renderStrategy=this.options.renderStrategy||y.Inline,this.triggerIcon=this.options.triggerIcon,this.storage=new $e(this.id),typeof n.autoActivate=="boolean"&&(this.autoActivate=n.autoActivate),n.anchor&&(this.anchor=n.anchor),this.container.register("$settings",r),this.texts.loadTexts(r.texts||{})}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(se.Ready),this.autoActivate){const t=this.render();t&&this._getTargetElement().appendChild(t)}}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(){this.root&&(this.root.classList.add("expanded"),this.root.classList.remove("hidden"),document.body.appendChild(this.root)),this.storage.set("open","true")}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open","false")}mute(){this.storage.set("muteAudioNotifications","true")}unmute(){this.storage.set("muteAudioNotifications","false")}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===y.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new it,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}render(){if(this.renderStrategy===y.Trigger){const t=new _;return t.application=this,this.trigger=t,this.storage.get("open")&&this.trigger.toggleActive(),t}return this.root}}const Ui=s=>new B(s),we=class{constructor(s=we.endpoint){this._endpoint=s}async getSite(s){const e=await(await fetch(s)).json();return e?{id:e.id,apps:e.widgets.map(i=>{let r=y.Inline;return i.renderStrategy==="Trigger"&&(r=y.Trigger),{id:i.id,widgetId:i.widgetId,renderStrategy:r,autoActivate:i.autoActivate,anchor:i.anchor,triggerIcon:{type:"Telia",content:i.triggerIcon}}})}:null}async getWidget(s){const e=await(await fetch(`${this._endpoint}/widget/${s}`)).json();return e?{name:e.name,config:JSON.parse(e.configuration)}:null}};let B=we;B.endpoint="https://widgets.ace.teliacompany.net/api";class Ae{constructor(){this.applications=[],this.container=new bt("environment",this),setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate()}async activate(){const t=this.applications.filter(e=>e.autoActivate);for await(const e of t)await e.activate()}notifyWidgetsOfCreation(){document.querySelectorAll("ace-widget").forEach(e=>{const i=this.applications.find(r=>r.name===e.name);i&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:i}}))})}registerApp(t,e,i,r){const n=new bt(e,this),o=new _e(t,e,n,i,r);this.applications.push(o)}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class xe{constructor(t){this.configurations=[],this.httpClient=new B,this.httpClient=new B,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}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"}}))}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new Ae,this.addGlobal(this.environment);for await(const i of this.configurations){const r=await this.httpClient.getWidget(i.widgetId);r&&((e=this.environment)==null||e.registerApp(i.widgetId,r.name,r.config,{renderStrategy:i.renderStrategy,triggerIcon:i.triggerIcon,autoActivate:i.autoActivate,anchor:i.anchor}))}t(this.environment),await this.environment.bootstrap()}addGlobal(t){globalThis.widgets=t}}var ki=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Et=(s,t,e,i)=>{for(var r=i>1?void 0:i?ji(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&ki(t,e,r),r};class U extends ${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 d;if(this.widget.renderStrategy===y.Trigger){const t=new _;return t.application=this.widget,t}return this.widget.render()}}U.styles=[I`
|
366
374
|
:host {
|
367
375
|
display: block;
|
368
376
|
}
|
369
|
-
`];
|
377
|
+
`];Et([m({attribute:!0})],U.prototype,"name",2);Et([F()],U.prototype,"widget",2);Et([F()],U.prototype,"status",2);customElements.get("ace-trigger-slot")||customElements.define("ace-trigger-slot",it);customElements.get("ace-trigger")||customElements.define("ace-trigger",_);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",St);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",rt);customElements.get("ace-widget")||customElements.define("ace-widget",U);const Ni=async(s,t)=>{await new xe(s).bootstrap(t)};exports.AceWidget=U;exports.Application=_e;exports.Container=bt;exports.Environment=Ae;exports.HttpClient=B;exports.Site=xe;exports.StorageService=$e;exports.Trigger=_;exports.WidgetComponent=me;exports.applicationContext=ve;exports.bootstrap=Ni;exports.createHttpClient=Ui;
|