@m3e/badge 1.0.6 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -21,33 +21,30 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
21
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
22
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
23
  PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
26
-
27
-
28
- function __decorate(decorators, target, key, desc) {
29
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
32
- return c > 3 && r && Object.defineProperty(target, key, r), r;
33
- }
34
-
35
- function __classPrivateFieldGet(receiver, state, kind, f) {
36
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
37
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
38
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
39
- }
40
-
41
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
42
- if (kind === "m") throw new TypeError("Private method is not writable");
43
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
44
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
45
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
46
- }
47
-
48
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
49
- var e = new Error(message);
50
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
24
+ ***************************************************************************** */
25
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
26
+
27
+ function __decorate(decorators, target, key, desc) {
28
+ var c = arguments.length,
29
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
30
+ d;
31
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
32
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
33
+ }
34
+ function __classPrivateFieldGet(receiver, state, kind, f) {
35
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
36
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
37
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
38
+ }
39
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
40
+ if (kind === "m") throw new TypeError("Private method is not writable");
41
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
42
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
43
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
44
+ }
45
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
46
+ var e = new Error(message);
47
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
51
48
  };
52
49
 
53
50
  /**
@@ -55,26 +52,372 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
55
52
  * Copyright 2017 Google LLC
56
53
  * SPDX-License-Identifier: BSD-3-Clause
57
54
  */
58
- const t$1=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
55
+ const t$1 = t => (e, o) => {
56
+ void 0 !== o ? o.addInitializer(() => {
57
+ customElements.define(t, e);
58
+ }) : customElements.define(t, e);
59
+ };
59
60
 
60
61
  /**
61
62
  * @license
62
63
  * Copyright 2019 Google LLC
63
64
  * SPDX-License-Identifier: BSD-3-Clause
64
65
  */
65
- const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$1&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s),S=(s,o)=>{if(e$1)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$1?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
66
+ const t = globalThis,
67
+ e$1 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
68
+ s = Symbol(),
69
+ o$2 = new WeakMap();
70
+ let n$2 = class n {
71
+ constructor(t, e, o) {
72
+ if (this._$cssResult$ = true, o !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
73
+ this.cssText = t, this.t = e;
74
+ }
75
+ get styleSheet() {
76
+ let t = this.o;
77
+ const s = this.t;
78
+ if (e$1 && void 0 === t) {
79
+ const e = void 0 !== s && 1 === s.length;
80
+ e && (t = o$2.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$2.set(s, t));
81
+ }
82
+ return t;
83
+ }
84
+ toString() {
85
+ return this.cssText;
86
+ }
87
+ };
88
+ const r$2 = t => new n$2("string" == typeof t ? t : t + "", void 0, s),
89
+ S = (s, o) => {
90
+ if (e$1) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
91
+ const o = document.createElement("style"),
92
+ n = t.litNonce;
93
+ void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
94
+ }
95
+ },
96
+ c$1 = e$1 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
97
+ let e = "";
98
+ for (const s of t.cssRules) e += s.cssText;
99
+ return r$2(e);
100
+ })(t) : t;
66
101
 
67
102
  /**
68
103
  * @license
69
104
  * Copyright 2017 Google LLC
70
105
  * SPDX-License-Identifier: BSD-3-Clause
71
- */const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f=(t,s)=>!i(t,s),b={attribute:true,type:String,converter:u,reflect:false,useDefault:false,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.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 S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d("elementProperties")]=new Map,y[d("finalized")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.1");
106
+ */
107
+ const {
108
+ is: i,
109
+ defineProperty: e,
110
+ getOwnPropertyDescriptor: h,
111
+ getOwnPropertyNames: r$1,
112
+ getOwnPropertySymbols: o$1,
113
+ getPrototypeOf: n$1
114
+ } = Object,
115
+ a = globalThis,
116
+ c = a.trustedTypes,
117
+ l = c ? c.emptyScript : "",
118
+ p = a.reactiveElementPolyfillSupport,
119
+ d = (t, s) => t,
120
+ u = {
121
+ toAttribute(t, s) {
122
+ switch (s) {
123
+ case Boolean:
124
+ t = t ? l : null;
125
+ break;
126
+ case Object:
127
+ case Array:
128
+ t = null == t ? t : JSON.stringify(t);
129
+ }
130
+ return t;
131
+ },
132
+ fromAttribute(t, s) {
133
+ let i = t;
134
+ switch (s) {
135
+ case Boolean:
136
+ i = null !== t;
137
+ break;
138
+ case Number:
139
+ i = null === t ? null : Number(t);
140
+ break;
141
+ case Object:
142
+ case Array:
143
+ try {
144
+ i = JSON.parse(t);
145
+ } catch (t) {
146
+ i = null;
147
+ }
148
+ }
149
+ return i;
150
+ }
151
+ },
152
+ f = (t, s) => !i(t, s),
153
+ b = {
154
+ attribute: true,
155
+ type: String,
156
+ converter: u,
157
+ reflect: false,
158
+ useDefault: false,
159
+ hasChanged: f
160
+ };
161
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= new WeakMap();
162
+ class y extends HTMLElement {
163
+ static addInitializer(t) {
164
+ this._$Ei(), (this.l ??= []).push(t);
165
+ }
166
+ static get observedAttributes() {
167
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
168
+ }
169
+ static createProperty(t, s = b) {
170
+ if (s.state && (s.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = true), this.elementProperties.set(t, s), !s.noAccessor) {
171
+ const i = Symbol(),
172
+ h = this.getPropertyDescriptor(t, i, s);
173
+ void 0 !== h && e(this.prototype, t, h);
174
+ }
175
+ }
176
+ static getPropertyDescriptor(t, s, i) {
177
+ const {
178
+ get: e,
179
+ set: r
180
+ } = h(this.prototype, t) ?? {
181
+ get() {
182
+ return this[s];
183
+ },
184
+ set(t) {
185
+ this[s] = t;
186
+ }
187
+ };
188
+ return {
189
+ get: e,
190
+ set(s) {
191
+ const h = e?.call(this);
192
+ r?.call(this, s), this.requestUpdate(t, h, i);
193
+ },
194
+ configurable: true,
195
+ enumerable: true
196
+ };
197
+ }
198
+ static getPropertyOptions(t) {
199
+ return this.elementProperties.get(t) ?? b;
200
+ }
201
+ static _$Ei() {
202
+ if (this.hasOwnProperty(d("elementProperties"))) return;
203
+ const t = n$1(this);
204
+ t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
205
+ }
206
+ static finalize() {
207
+ if (this.hasOwnProperty(d("finalized"))) return;
208
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
209
+ const t = this.properties,
210
+ s = [...r$1(t), ...o$1(t)];
211
+ for (const i of s) this.createProperty(i, t[i]);
212
+ }
213
+ const t = this[Symbol.metadata];
214
+ if (null !== t) {
215
+ const s = litPropertyMetadata.get(t);
216
+ if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
217
+ }
218
+ this._$Eh = new Map();
219
+ for (const [t, s] of this.elementProperties) {
220
+ const i = this._$Eu(t, s);
221
+ void 0 !== i && this._$Eh.set(i, t);
222
+ }
223
+ this.elementStyles = this.finalizeStyles(this.styles);
224
+ }
225
+ static finalizeStyles(s) {
226
+ const i = [];
227
+ if (Array.isArray(s)) {
228
+ const e = new Set(s.flat(1 / 0).reverse());
229
+ for (const s of e) i.unshift(c$1(s));
230
+ } else void 0 !== s && i.push(c$1(s));
231
+ return i;
232
+ }
233
+ static _$Eu(t, s) {
234
+ const i = s.attribute;
235
+ return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
236
+ }
237
+ constructor() {
238
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
239
+ }
240
+ _$Ev() {
241
+ this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
242
+ }
243
+ addController(t) {
244
+ (this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
245
+ }
246
+ removeController(t) {
247
+ this._$EO?.delete(t);
248
+ }
249
+ _$E_() {
250
+ const t = new Map(),
251
+ s = this.constructor.elementProperties;
252
+ for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
253
+ t.size > 0 && (this._$Ep = t);
254
+ }
255
+ createRenderRoot() {
256
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
257
+ return S(t, this.constructor.elementStyles), t;
258
+ }
259
+ connectedCallback() {
260
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
261
+ }
262
+ enableUpdating(t) {}
263
+ disconnectedCallback() {
264
+ this._$EO?.forEach(t => t.hostDisconnected?.());
265
+ }
266
+ attributeChangedCallback(t, s, i) {
267
+ this._$AK(t, i);
268
+ }
269
+ _$ET(t, s) {
270
+ const i = this.constructor.elementProperties.get(t),
271
+ e = this.constructor._$Eu(t, i);
272
+ if (void 0 !== e && true === i.reflect) {
273
+ const h = (void 0 !== i.converter?.toAttribute ? i.converter : u).toAttribute(s, i.type);
274
+ this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
275
+ }
276
+ }
277
+ _$AK(t, s) {
278
+ const i = this.constructor,
279
+ e = i._$Eh.get(t);
280
+ if (void 0 !== e && this._$Em !== e) {
281
+ const t = i.getPropertyOptions(e),
282
+ h = "function" == typeof t.converter ? {
283
+ fromAttribute: t.converter
284
+ } : void 0 !== t.converter?.fromAttribute ? t.converter : u;
285
+ this._$Em = e;
286
+ const r = h.fromAttribute(s, t.type);
287
+ this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
288
+ }
289
+ }
290
+ requestUpdate(t, s, i) {
291
+ if (void 0 !== t) {
292
+ const e = this.constructor,
293
+ h = this[t];
294
+ if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
295
+ this.C(t, s, i);
296
+ }
297
+ false === this.isUpdatePending && (this._$ES = this._$EP());
298
+ }
299
+ C(t, s, {
300
+ useDefault: i,
301
+ reflect: e,
302
+ wrapped: h
303
+ }, r) {
304
+ i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), true !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), true === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
305
+ }
306
+ async _$EP() {
307
+ this.isUpdatePending = true;
308
+ try {
309
+ await this._$ES;
310
+ } catch (t) {
311
+ Promise.reject(t);
312
+ }
313
+ const t = this.scheduleUpdate();
314
+ return null != t && (await t), !this.isUpdatePending;
315
+ }
316
+ scheduleUpdate() {
317
+ return this.performUpdate();
318
+ }
319
+ performUpdate() {
320
+ if (!this.isUpdatePending) return;
321
+ if (!this.hasUpdated) {
322
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
323
+ for (const [t, s] of this._$Ep) this[t] = s;
324
+ this._$Ep = void 0;
325
+ }
326
+ const t = this.constructor.elementProperties;
327
+ if (t.size > 0) for (const [s, i] of t) {
328
+ const {
329
+ wrapped: t
330
+ } = i,
331
+ e = this[s];
332
+ true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
333
+ }
334
+ }
335
+ let t = false;
336
+ const s = this._$AL;
337
+ try {
338
+ t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
339
+ } catch (s) {
340
+ throw t = false, this._$EM(), s;
341
+ }
342
+ t && this._$AE(s);
343
+ }
344
+ willUpdate(t) {}
345
+ _$AE(t) {
346
+ this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
347
+ }
348
+ _$EM() {
349
+ this._$AL = new Map(), this.isUpdatePending = false;
350
+ }
351
+ get updateComplete() {
352
+ return this.getUpdateComplete();
353
+ }
354
+ getUpdateComplete() {
355
+ return this._$ES;
356
+ }
357
+ shouldUpdate(t) {
358
+ return true;
359
+ }
360
+ update(t) {
361
+ this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
362
+ }
363
+ updated(t) {}
364
+ firstUpdated(t) {}
365
+ }
366
+ y.elementStyles = [], y.shadowRootOptions = {
367
+ mode: "open"
368
+ }, y[d("elementProperties")] = new Map(), y[d("finalized")] = new Map(), p?.({
369
+ ReactiveElement: y
370
+ }), (a.reactiveElementVersions ??= []).push("2.1.1");
72
371
 
73
372
  /**
74
373
  * @license
75
374
  * Copyright 2017 Google LLC
76
375
  * SPDX-License-Identifier: BSD-3-Clause
77
- */const o={attribute:true,type:String,converter:u,reflect:false,hasChanged:f},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
376
+ */
377
+ const o = {
378
+ attribute: true,
379
+ type: String,
380
+ converter: u,
381
+ reflect: false,
382
+ hasChanged: f
383
+ },
384
+ r = (t = o, e, r) => {
385
+ const {
386
+ kind: n,
387
+ metadata: i
388
+ } = r;
389
+ let s = globalThis.litPropertyMetadata.get(i);
390
+ if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map()), "setter" === n && ((t = Object.create(t)).wrapped = true), s.set(r.name, t), "accessor" === n) {
391
+ const {
392
+ name: o
393
+ } = r;
394
+ return {
395
+ set(r) {
396
+ const n = e.get.call(this);
397
+ e.set.call(this, r), this.requestUpdate(o, n, t);
398
+ },
399
+ init(e) {
400
+ return void 0 !== e && this.C(o, void 0, t, e), e;
401
+ }
402
+ };
403
+ }
404
+ if ("setter" === n) {
405
+ const {
406
+ name: o
407
+ } = r;
408
+ return function (r) {
409
+ const n = this[o];
410
+ e.call(this, r), this.requestUpdate(o, n, t);
411
+ };
412
+ }
413
+ throw Error("Unsupported decorator location: " + n);
414
+ };
415
+ function n(t) {
416
+ return (e, o) => "object" == typeof o ? r(t, e, o) : ((t, e, o) => {
417
+ const r = e.hasOwnProperty(o);
418
+ return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
419
+ })(t, e, o);
420
+ }
78
421
 
79
422
  var _M3eBadgeElement_instances, _M3eBadgeElement_directionalitySubscription, _M3eBadgeElement_anchorCleanup, _M3eBadgeElement_handleSlotChange, _M3eBadgeElement_detach, _M3eBadgeElement_attach;
80
423
  /**
@@ -116,196 +459,120 @@ var _M3eBadgeElement_instances, _M3eBadgeElement_directionalitySubscription, _M3
116
459
  * @cssprop --m3e-badge-large-tracking - Letter spacing for large badge label.
117
460
  */
118
461
  let M3eBadgeElement = class M3eBadgeElement extends HtmlFor(LitElement) {
119
- constructor() {
120
- super(...arguments);
121
- _M3eBadgeElement_instances.add(this);
122
- /** @private */ _M3eBadgeElement_directionalitySubscription.set(this, void 0);
123
- /** @private */ _M3eBadgeElement_anchorCleanup.set(this, void 0);
124
- /**
125
- * The size of the badge.
126
- * @default "medium"
127
- */
128
- this.size = "medium";
129
- /**
130
- * The position of the badge, when attached to another element.
131
- * @default "above-after"
132
- */
133
- this.position = "above-after";
134
- }
135
- /** @inheritdoc */
136
- detach() {
137
- super.detach();
138
- __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_detach).call(this);
139
- }
140
- /** @inheritdoc */
141
- connectedCallback() {
142
- super.connectedCallback();
143
- __classPrivateFieldSet(this, _M3eBadgeElement_directionalitySubscription, M3eDirectionality.observe(() => __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_attach).call(this)), "f");
144
- }
145
- /** @inheritdoc */
146
- disconnectedCallback() {
147
- super.disconnectedCallback();
148
- __classPrivateFieldGet(this, _M3eBadgeElement_directionalitySubscription, "f")?.call(this);
149
- }
150
- /** @inheritdoc */
151
- update(changedProperties) {
152
- super.update(changedProperties);
153
- if (changedProperties.has("position") || changedProperties.has("size") || changedProperties.has("htmlFor")) {
154
- __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_attach).call(this);
155
- }
156
- }
157
- /** @inheritdoc */
158
- render() {
159
- return html `<slot @slotchange="${__classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_handleSlotChange)}"> <span aria-hidden="true">&nbsp;</span></slot>`;
462
+ constructor() {
463
+ super(...arguments);
464
+ _M3eBadgeElement_instances.add(this);
465
+ /** @private */
466
+ _M3eBadgeElement_directionalitySubscription.set(this, void 0);
467
+ /** @private */
468
+ _M3eBadgeElement_anchorCleanup.set(this, void 0);
469
+ /**
470
+ * The size of the badge.
471
+ * @default "medium"
472
+ */
473
+ this.size = "medium";
474
+ /**
475
+ * The position of the badge, when attached to another element.
476
+ * @default "above-after"
477
+ */
478
+ this.position = "above-after";
479
+ }
480
+ /** @inheritdoc */
481
+ detach() {
482
+ super.detach();
483
+ __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_detach).call(this);
484
+ }
485
+ /** @inheritdoc */
486
+ connectedCallback() {
487
+ super.connectedCallback();
488
+ __classPrivateFieldSet(this, _M3eBadgeElement_directionalitySubscription, M3eDirectionality.observe(() => __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_attach).call(this)), "f");
489
+ }
490
+ /** @inheritdoc */
491
+ disconnectedCallback() {
492
+ super.disconnectedCallback();
493
+ __classPrivateFieldGet(this, _M3eBadgeElement_directionalitySubscription, "f")?.call(this);
494
+ }
495
+ /** @inheritdoc */
496
+ update(changedProperties) {
497
+ super.update(changedProperties);
498
+ if (changedProperties.has("position") || changedProperties.has("size") || changedProperties.has("htmlFor")) {
499
+ __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_attach).call(this);
160
500
  }
501
+ }
502
+ /** @inheritdoc */
503
+ render() {
504
+ return html`<slot @slotchange="${__classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_handleSlotChange)}"><span aria-hidden="true">&nbsp;</span></slot>`;
505
+ }
161
506
  };
162
507
  _M3eBadgeElement_directionalitySubscription = new WeakMap();
163
508
  _M3eBadgeElement_anchorCleanup = new WeakMap();
164
509
  _M3eBadgeElement_instances = new WeakSet();
165
510
  _M3eBadgeElement_handleSlotChange = function _M3eBadgeElement_handleSlotChange() {
166
- if (!this.isConnected)
167
- return;
168
- this.style.setProperty("--_badge-padding", this.textContent && this.textContent.length > 2
169
- ? `0 ${this.size === "medium" ? "0.25rem" : this.size === "large" ? "0.5rem" : "0"}`
170
- : "");
511
+ if (!this.isConnected) return;
512
+ this.style.setProperty("--_badge-padding", this.textContent && this.textContent.length > 2 ? `0 ${this.size === "medium" ? "0.25rem" : this.size === "large" ? "0.5rem" : "0"}` : "");
171
513
  };
172
514
  _M3eBadgeElement_detach = function _M3eBadgeElement_detach() {
173
- __classPrivateFieldGet(this, _M3eBadgeElement_anchorCleanup, "f")?.call(this);
174
- __classPrivateFieldSet(this, _M3eBadgeElement_anchorCleanup, undefined, "f");
175
- this.dir = "";
515
+ __classPrivateFieldGet(this, _M3eBadgeElement_anchorCleanup, "f")?.call(this);
516
+ __classPrivateFieldSet(this, _M3eBadgeElement_anchorCleanup, undefined, "f");
176
517
  };
177
- _M3eBadgeElement_attach =
178
- /** @private */
518
+ _M3eBadgeElement_attach = /** @private */
179
519
  async function _M3eBadgeElement_attach() {
180
- __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_detach).call(this);
181
- if (!this.control)
182
- return;
183
- let position = "top-end";
184
- switch (this.position) {
185
- case "above":
186
- position = "top";
187
- break;
188
- case "above-before":
189
- position = "top-start";
190
- break;
191
- case "after":
192
- position = "right";
193
- break;
194
- case "before":
195
- position = "left";
196
- break;
197
- case "below":
198
- position = "bottom";
199
- break;
200
- case "below-after":
201
- position = "bottom-end";
202
- break;
203
- case "below-before":
204
- position = "bottom-start";
205
- break;
520
+ __classPrivateFieldGet(this, _M3eBadgeElement_instances, "m", _M3eBadgeElement_detach).call(this);
521
+ if (!this.control) return;
522
+ let position = "top-end";
523
+ switch (this.position) {
524
+ case "above":
525
+ position = "top";
526
+ break;
527
+ case "above-before":
528
+ position = "top-start";
529
+ break;
530
+ case "after":
531
+ position = "right";
532
+ break;
533
+ case "before":
534
+ position = "left";
535
+ break;
536
+ case "below":
537
+ position = "bottom";
538
+ break;
539
+ case "below-after":
540
+ position = "bottom-end";
541
+ break;
542
+ case "below-before":
543
+ position = "bottom-start";
544
+ break;
545
+ }
546
+ __classPrivateFieldSet(this, _M3eBadgeElement_anchorCleanup, await positionAnchor(this, this.control, {
547
+ position
548
+ }, (x, y) => {
549
+ if (this.position.includes("before") && this.position !== "before") {
550
+ if (M3eDirectionality.current === "rtl") {
551
+ x += this.clientWidth;
552
+ } else {
553
+ x -= this.clientWidth;
554
+ }
206
555
  }
207
- __classPrivateFieldSet(this, _M3eBadgeElement_anchorCleanup, await positionAnchor(this, this.control, { position }, (x, y) => {
208
- this.dir = M3eDirectionality.current;
209
- if (this.position.includes("before") && this.position !== "before") {
210
- if (this.dir == "rtl") {
211
- x += this.clientWidth;
212
- }
213
- else {
214
- x -= this.clientWidth;
215
- }
216
- }
217
- if (this.position.includes("after") && this.position !== "after") {
218
- if (this.dir == "rtl") {
219
- x -= this.clientWidth;
220
- }
221
- else {
222
- x += this.clientWidth;
223
- }
224
- }
225
- this.style.left = `${x}px`;
226
- this.style.top = `${y}px`;
227
- }), "f");
556
+ if (this.position.includes("after") && this.position !== "after") {
557
+ if (M3eDirectionality.current === "rtl") {
558
+ x -= this.clientWidth;
559
+ } else {
560
+ x += this.clientWidth;
561
+ }
562
+ }
563
+ this.style.left = `${x}px`;
564
+ this.style.top = `${y}px`;
565
+ }), "f");
228
566
  };
229
567
  /** The styles of the element. */
230
- M3eBadgeElement.styles = css `
231
- :host {
232
- display: inline-flex;
233
- align-items: center;
234
- justify-content: center;
235
- text-align: center;
236
- white-space: nowrap;
237
- vertical-align: baseline;
238
- box-sizing: border-box;
239
- user-select: none;
240
- padding: var(--_badge-padding);
241
- border-radius: var(--m3e-badge-shape, ${DesignToken.shape.corner.full});
242
- color: var(--m3e-badge-color, ${DesignToken.color.onError});
243
- background-color: var(--m3e-badge-container-color, ${DesignToken.color.error});
244
- }
245
- :host([for]) {
246
- position: absolute;
247
- z-index: 1;
248
- }
249
- :host([for]:not([dir])) {
250
- visibility: hidden;
251
- }
252
- :host([for][position^="above"]) {
253
- margin-block-start: var(--_badge-offset, 0px);
254
- }
255
- :host([for][position^="below"]) {
256
- margin-block-start: calc(0px - var(--_badge-offset, 0px));
257
- }
258
- :host([for][position$="before"][dir="ltr"]),
259
- :host([for][position$="after"][dir="rtl"]) {
260
- margin-left: var(--_badge-offset, 0px);
261
- }
262
- :host([for][position$="before"][dir="rtl"]),
263
- :host([for][position$="after"][dir="ltr"]) {
264
- margin-left: calc(0px - var(--_badge-offset, 0px));
265
- }
266
- :host([size="small"]) {
267
- height: var(--m3e-badge-small-size, 0.375rem);
268
- max-height: var(--m3e-badge-small-size, 0.375rem);
269
- width: var(--m3e-badge-small-size, 0.375rem);
270
- min-width: var(--m3e-badge-small-size, 0.375rem);
271
- font-size: 0;
272
- --_badge-offset: var(--m3e-badge-small-offset, 0.375rem);
273
- }
274
- :host([size="medium"]) {
275
- height: var(--m3e-badge-medium-size, 1.375rem);
276
- min-width: var(--m3e-badge-medium-size, 1.375rem);
277
- font-size: var(--m3e-badge-medium-font-size, ${DesignToken.typescale.standard.label.small.fontSize});
278
- font-weight: var(--m3e-badge-medium-font-weight, ${DesignToken.typescale.standard.label.small.fontWeight});
279
- line-height: var(--m3e-badge-medium-line-height, ${DesignToken.typescale.standard.label.small.lineHeight});
280
- letter-spacing: var(--m3e-badge-medium-tracking, ${DesignToken.typescale.standard.label.small.tracking});
281
- --_badge-offset: var(--m3e-badge-small-offset, 0.75rem);
282
- }
283
- :host([size="large"]) {
284
- height: var(--m3e-badge-large-size, 1.75rem);
285
- min-width: var(--m3e-badge-large-size, 1.75rem);
286
- font-size: var(--m3e-badge-large-font-size, ${DesignToken.typescale.standard.label.large.fontSize});
287
- font-weight: var(--m3e-badge-large-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight});
288
- line-height: var(--m3e-badge-large-line-height, ${DesignToken.typescale.standard.label.large.lineHeight});
289
- letter-spacing: var(--m3e-badge-large-tracking, ${DesignToken.typescale.standard.label.large.tracking});
290
- --_badge-offset: var(--m3e-badge-small-offset, 1rem);
291
- }
292
- @media (forced-colors: active) {
293
- :host {
294
- background-color: ButtonFace;
295
- color: ButtonText;
296
- outline: 1px solid ButtonText;
297
- }
298
- }
299
- `;
300
- __decorate([
301
- n({ reflect: true })
302
- ], M3eBadgeElement.prototype, "size", void 0);
303
- __decorate([
304
- n({ reflect: true })
305
- ], M3eBadgeElement.prototype, "position", void 0);
306
- M3eBadgeElement = __decorate([
307
- t$1("m3e-badge")
308
- ], M3eBadgeElement);
568
+ M3eBadgeElement.styles = css`:host { display: inline-flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap; vertical-align: baseline; box-sizing: border-box; user-select: none; padding: var(--_badge-padding); border-radius: var(--m3e-badge-shape, ${DesignToken.shape.corner.full}); color: var(--m3e-badge-color, ${DesignToken.color.onError}); background-color: var(--m3e-badge-container-color, ${DesignToken.color.error}); } :host([for]) { position: absolute; z-index: 1; } :host([for][position^="above"]) { margin-block-start: var(--_badge-offset, 0px); } :host([for][position^="below"]) { margin-block-start: calc(0px - var(--_badge-offset, 0px)); } :host(:not(:dir(rtl))[for][position$="before"]), :host(:dir(rtl)[for][position$="after"]) { margin-left: var(--_badge-offset, 0px); } :host(:dir(rtl)[for][position$="before"]), :host(:not(:dir(rtl))[for][position$="after"]) { margin-left: calc(0px - var(--_badge-offset, 0px)); } :host([size="small"]) { height: var(--m3e-badge-small-size, 0.375rem); max-height: var(--m3e-badge-small-size, 0.375rem); width: var(--m3e-badge-small-size, 0.375rem); min-width: var(--m3e-badge-small-size, 0.375rem); font-size: 0; --_badge-offset: var(--m3e-badge-small-offset, 0.375rem); } :host([size="medium"]) { height: var(--m3e-badge-medium-size, 1.375rem); min-width: var(--m3e-badge-medium-size, 1.375rem); font-size: var(--m3e-badge-medium-font-size, ${DesignToken.typescale.standard.label.small.fontSize}); font-weight: var(--m3e-badge-medium-font-weight, ${DesignToken.typescale.standard.label.small.fontWeight}); line-height: var(--m3e-badge-medium-line-height, ${DesignToken.typescale.standard.label.small.lineHeight}); letter-spacing: var(--m3e-badge-medium-tracking, ${DesignToken.typescale.standard.label.small.tracking}); --_badge-offset: var(--m3e-badge-small-offset, 0.75rem); } :host([size="large"]) { height: var(--m3e-badge-large-size, 1.75rem); min-width: var(--m3e-badge-large-size, 1.75rem); font-size: var(--m3e-badge-large-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-badge-large-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-badge-large-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-badge-large-tracking, ${DesignToken.typescale.standard.label.large.tracking}); --_badge-offset: var(--m3e-badge-small-offset, 1rem); } @media (forced-colors: active) { :host { background-color: ButtonFace; color: ButtonText; outline: 1px solid ButtonText; } }`;
569
+ __decorate([n({
570
+ reflect: true
571
+ })], M3eBadgeElement.prototype, "size", void 0);
572
+ __decorate([n({
573
+ reflect: true
574
+ })], M3eBadgeElement.prototype, "position", void 0);
575
+ M3eBadgeElement = __decorate([t$1("m3e-badge")], M3eBadgeElement);
309
576
 
310
577
  export { M3eBadgeElement };
311
578
  //# sourceMappingURL=index.js.map