@record-evolution/widget-switch 1.0.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.
@@ -0,0 +1,3142 @@
1
+ /* @license Copyright (c) 2023 Record Evolution GmbH. All rights reserved.*/
2
+ /******************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
17
+
18
+ function __decorate(decorators, target, key, desc) {
19
+ var c = arguments.length,
20
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
21
+ d;
22
+ 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;
23
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
24
+ }
25
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
26
+ var e = new Error(message);
27
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
28
+ };
29
+
30
+ /**
31
+ * @license
32
+ * Copyright 2019 Google LLC
33
+ * SPDX-License-Identifier: BSD-3-Clause
34
+ */
35
+ const t$4 = globalThis,
36
+ e$6 = t$4.ShadowRoot && (void 0 === t$4.ShadyCSS || t$4.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
37
+ s$3 = Symbol(),
38
+ o$4 = new WeakMap();
39
+ let n$3 = class n {
40
+ constructor(t, e, o) {
41
+ if (this._$cssResult$ = true, o !== s$3) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
42
+ this.cssText = t, this.t = e;
43
+ }
44
+ get styleSheet() {
45
+ let t = this.o;
46
+ const s = this.t;
47
+ if (e$6 && void 0 === t) {
48
+ const e = void 0 !== s && 1 === s.length;
49
+ e && (t = o$4.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$4.set(s, t));
50
+ }
51
+ return t;
52
+ }
53
+ toString() {
54
+ return this.cssText;
55
+ }
56
+ };
57
+ const r$5 = t => new n$3("string" == typeof t ? t : t + "", void 0, s$3),
58
+ i$4 = (t, ...e) => {
59
+ const o = 1 === t.length ? t[0] : e.reduce((e, s, o) => e + (t => {
60
+ if (true === t._$cssResult$) return t.cssText;
61
+ if ("number" == typeof t) return t;
62
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
63
+ })(s) + t[o + 1], t[0]);
64
+ return new n$3(o, t, s$3);
65
+ },
66
+ S$1 = (s, o) => {
67
+ if (e$6) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
68
+ const o = document.createElement("style"),
69
+ n = t$4.litNonce;
70
+ void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
71
+ }
72
+ },
73
+ c$3 = e$6 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
74
+ let e = "";
75
+ for (const s of t.cssRules) e += s.cssText;
76
+ return r$5(e);
77
+ })(t) : t;
78
+
79
+ /**
80
+ * @license
81
+ * Copyright 2017 Google LLC
82
+ * SPDX-License-Identifier: BSD-3-Clause
83
+ */
84
+ const {
85
+ is: i$3,
86
+ defineProperty: e$5,
87
+ getOwnPropertyDescriptor: h$1,
88
+ getOwnPropertyNames: r$4,
89
+ getOwnPropertySymbols: o$3,
90
+ getPrototypeOf: n$2
91
+ } = Object,
92
+ a$1 = globalThis,
93
+ c$2 = a$1.trustedTypes,
94
+ l$1 = c$2 ? c$2.emptyScript : "",
95
+ p$2 = a$1.reactiveElementPolyfillSupport,
96
+ d$1 = (t, s) => t,
97
+ u$3 = {
98
+ toAttribute(t, s) {
99
+ switch (s) {
100
+ case Boolean:
101
+ t = t ? l$1 : null;
102
+ break;
103
+ case Object:
104
+ case Array:
105
+ t = null == t ? t : JSON.stringify(t);
106
+ }
107
+ return t;
108
+ },
109
+ fromAttribute(t, s) {
110
+ let i = t;
111
+ switch (s) {
112
+ case Boolean:
113
+ i = null !== t;
114
+ break;
115
+ case Number:
116
+ i = null === t ? null : Number(t);
117
+ break;
118
+ case Object:
119
+ case Array:
120
+ try {
121
+ i = JSON.parse(t);
122
+ } catch (t) {
123
+ i = null;
124
+ }
125
+ }
126
+ return i;
127
+ }
128
+ },
129
+ f$1 = (t, s) => !i$3(t, s),
130
+ b = {
131
+ attribute: true,
132
+ type: String,
133
+ converter: u$3,
134
+ reflect: false,
135
+ useDefault: false,
136
+ hasChanged: f$1
137
+ };
138
+ Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= new WeakMap();
139
+ let y$1 = class y extends HTMLElement {
140
+ static addInitializer(t) {
141
+ this._$Ei(), (this.l ??= []).push(t);
142
+ }
143
+ static get observedAttributes() {
144
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
145
+ }
146
+ static createProperty(t, s = b) {
147
+ 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) {
148
+ const i = Symbol(),
149
+ h = this.getPropertyDescriptor(t, i, s);
150
+ void 0 !== h && e$5(this.prototype, t, h);
151
+ }
152
+ }
153
+ static getPropertyDescriptor(t, s, i) {
154
+ const {
155
+ get: e,
156
+ set: r
157
+ } = h$1(this.prototype, t) ?? {
158
+ get() {
159
+ return this[s];
160
+ },
161
+ set(t) {
162
+ this[s] = t;
163
+ }
164
+ };
165
+ return {
166
+ get: e,
167
+ set(s) {
168
+ const h = e?.call(this);
169
+ r?.call(this, s), this.requestUpdate(t, h, i);
170
+ },
171
+ configurable: true,
172
+ enumerable: true
173
+ };
174
+ }
175
+ static getPropertyOptions(t) {
176
+ return this.elementProperties.get(t) ?? b;
177
+ }
178
+ static _$Ei() {
179
+ if (this.hasOwnProperty(d$1("elementProperties"))) return;
180
+ const t = n$2(this);
181
+ t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
182
+ }
183
+ static finalize() {
184
+ if (this.hasOwnProperty(d$1("finalized"))) return;
185
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
186
+ const t = this.properties,
187
+ s = [...r$4(t), ...o$3(t)];
188
+ for (const i of s) this.createProperty(i, t[i]);
189
+ }
190
+ const t = this[Symbol.metadata];
191
+ if (null !== t) {
192
+ const s = litPropertyMetadata.get(t);
193
+ if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
194
+ }
195
+ this._$Eh = new Map();
196
+ for (const [t, s] of this.elementProperties) {
197
+ const i = this._$Eu(t, s);
198
+ void 0 !== i && this._$Eh.set(i, t);
199
+ }
200
+ this.elementStyles = this.finalizeStyles(this.styles);
201
+ }
202
+ static finalizeStyles(s) {
203
+ const i = [];
204
+ if (Array.isArray(s)) {
205
+ const e = new Set(s.flat(1 / 0).reverse());
206
+ for (const s of e) i.unshift(c$3(s));
207
+ } else void 0 !== s && i.push(c$3(s));
208
+ return i;
209
+ }
210
+ static _$Eu(t, s) {
211
+ const i = s.attribute;
212
+ return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
213
+ }
214
+ constructor() {
215
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
216
+ }
217
+ _$Ev() {
218
+ this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
219
+ }
220
+ addController(t) {
221
+ (this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
222
+ }
223
+ removeController(t) {
224
+ this._$EO?.delete(t);
225
+ }
226
+ _$E_() {
227
+ const t = new Map(),
228
+ s = this.constructor.elementProperties;
229
+ for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
230
+ t.size > 0 && (this._$Ep = t);
231
+ }
232
+ createRenderRoot() {
233
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
234
+ return S$1(t, this.constructor.elementStyles), t;
235
+ }
236
+ connectedCallback() {
237
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
238
+ }
239
+ enableUpdating(t) {}
240
+ disconnectedCallback() {
241
+ this._$EO?.forEach(t => t.hostDisconnected?.());
242
+ }
243
+ attributeChangedCallback(t, s, i) {
244
+ this._$AK(t, i);
245
+ }
246
+ _$ET(t, s) {
247
+ const i = this.constructor.elementProperties.get(t),
248
+ e = this.constructor._$Eu(t, i);
249
+ if (void 0 !== e && true === i.reflect) {
250
+ const h = (void 0 !== i.converter?.toAttribute ? i.converter : u$3).toAttribute(s, i.type);
251
+ this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
252
+ }
253
+ }
254
+ _$AK(t, s) {
255
+ const i = this.constructor,
256
+ e = i._$Eh.get(t);
257
+ if (void 0 !== e && this._$Em !== e) {
258
+ const t = i.getPropertyOptions(e),
259
+ h = "function" == typeof t.converter ? {
260
+ fromAttribute: t.converter
261
+ } : void 0 !== t.converter?.fromAttribute ? t.converter : u$3;
262
+ this._$Em = e, this[e] = h.fromAttribute(s, t.type) ?? this._$Ej?.get(e) ?? null, this._$Em = null;
263
+ }
264
+ }
265
+ requestUpdate(t, s, i) {
266
+ if (void 0 !== t) {
267
+ const e = this.constructor,
268
+ h = this[t];
269
+ if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f$1)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
270
+ this.C(t, s, i);
271
+ }
272
+ false === this.isUpdatePending && (this._$ES = this._$EP());
273
+ }
274
+ C(t, s, {
275
+ useDefault: i,
276
+ reflect: e,
277
+ wrapped: h
278
+ }, r) {
279
+ 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));
280
+ }
281
+ async _$EP() {
282
+ this.isUpdatePending = true;
283
+ try {
284
+ await this._$ES;
285
+ } catch (t) {
286
+ Promise.reject(t);
287
+ }
288
+ const t = this.scheduleUpdate();
289
+ return null != t && (await t), !this.isUpdatePending;
290
+ }
291
+ scheduleUpdate() {
292
+ return this.performUpdate();
293
+ }
294
+ performUpdate() {
295
+ if (!this.isUpdatePending) return;
296
+ if (!this.hasUpdated) {
297
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
298
+ for (const [t, s] of this._$Ep) this[t] = s;
299
+ this._$Ep = void 0;
300
+ }
301
+ const t = this.constructor.elementProperties;
302
+ if (t.size > 0) for (const [s, i] of t) {
303
+ const {
304
+ wrapped: t
305
+ } = i,
306
+ e = this[s];
307
+ true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
308
+ }
309
+ }
310
+ let t = false;
311
+ const s = this._$AL;
312
+ try {
313
+ t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
314
+ } catch (s) {
315
+ throw t = false, this._$EM(), s;
316
+ }
317
+ t && this._$AE(s);
318
+ }
319
+ willUpdate(t) {}
320
+ _$AE(t) {
321
+ this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
322
+ }
323
+ _$EM() {
324
+ this._$AL = new Map(), this.isUpdatePending = false;
325
+ }
326
+ get updateComplete() {
327
+ return this.getUpdateComplete();
328
+ }
329
+ getUpdateComplete() {
330
+ return this._$ES;
331
+ }
332
+ shouldUpdate(t) {
333
+ return true;
334
+ }
335
+ update(t) {
336
+ this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
337
+ }
338
+ updated(t) {}
339
+ firstUpdated(t) {}
340
+ };
341
+ y$1.elementStyles = [], y$1.shadowRootOptions = {
342
+ mode: "open"
343
+ }, y$1[d$1("elementProperties")] = new Map(), y$1[d$1("finalized")] = new Map(), p$2?.({
344
+ ReactiveElement: y$1
345
+ }), (a$1.reactiveElementVersions ??= []).push("2.1.0");
346
+
347
+ /**
348
+ * @license
349
+ * Copyright 2017 Google LLC
350
+ * SPDX-License-Identifier: BSD-3-Clause
351
+ */
352
+ const t$3 = globalThis,
353
+ i$2 = t$3.trustedTypes,
354
+ s$2 = i$2 ? i$2.createPolicy("lit-html", {
355
+ createHTML: t => t
356
+ }) : void 0,
357
+ e$4 = "$lit$",
358
+ h = `lit$${Math.random().toFixed(9).slice(2)}$`,
359
+ o$2 = "?" + h,
360
+ n$1 = `<${o$2}>`,
361
+ r$3 = document,
362
+ l = () => r$3.createComment(""),
363
+ c$1 = t => null === t || "object" != typeof t && "function" != typeof t,
364
+ a = Array.isArray,
365
+ u$2 = t => a(t) || "function" == typeof t?.[Symbol.iterator],
366
+ d = "[ \t\n\f\r]",
367
+ f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
368
+ v$1 = /-->/g,
369
+ _ = />/g,
370
+ m$1 = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"),
371
+ p$1 = /'/g,
372
+ g = /"/g,
373
+ $ = /^(?:script|style|textarea|title)$/i,
374
+ y = t => (i, ...s) => ({
375
+ _$litType$: t,
376
+ strings: i,
377
+ values: s
378
+ }),
379
+ x = y(1),
380
+ T = Symbol.for("lit-noChange"),
381
+ E = Symbol.for("lit-nothing"),
382
+ A = new WeakMap(),
383
+ C = r$3.createTreeWalker(r$3, 129);
384
+ function P(t, i) {
385
+ if (!a(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
386
+ return void 0 !== s$2 ? s$2.createHTML(i) : i;
387
+ }
388
+ const V = (t, i) => {
389
+ const s = t.length - 1,
390
+ o = [];
391
+ let r,
392
+ l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "",
393
+ c = f;
394
+ for (let i = 0; i < s; i++) {
395
+ const s = t[i];
396
+ let a,
397
+ u,
398
+ d = -1,
399
+ y = 0;
400
+ for (; y < s.length && (c.lastIndex = y, u = c.exec(s), null !== u);) y = c.lastIndex, c === f ? "!--" === u[1] ? c = v$1 : void 0 !== u[1] ? c = _ : void 0 !== u[2] ? ($.test(u[2]) && (r = RegExp("</" + u[2], "g")), c = m$1) : void 0 !== u[3] && (c = m$1) : c === m$1 ? ">" === u[0] ? (c = r ?? f, d = -1) : void 0 === u[1] ? d = -2 : (d = c.lastIndex - u[2].length, a = u[1], c = void 0 === u[3] ? m$1 : '"' === u[3] ? g : p$1) : c === g || c === p$1 ? c = m$1 : c === v$1 || c === _ ? c = f : (c = m$1, r = void 0);
401
+ const x = c === m$1 && t[i + 1].startsWith("/>") ? " " : "";
402
+ l += c === f ? s + n$1 : d >= 0 ? (o.push(a), s.slice(0, d) + e$4 + s.slice(d) + h + x) : s + h + (-2 === d ? i : x);
403
+ }
404
+ return [P(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")), o];
405
+ };
406
+ class N {
407
+ constructor({
408
+ strings: t,
409
+ _$litType$: s
410
+ }, n) {
411
+ let r;
412
+ this.parts = [];
413
+ let c = 0,
414
+ a = 0;
415
+ const u = t.length - 1,
416
+ d = this.parts,
417
+ [f, v] = V(t, s);
418
+ if (this.el = N.createElement(f, n), C.currentNode = this.el.content, 2 === s || 3 === s) {
419
+ const t = this.el.content.firstChild;
420
+ t.replaceWith(...t.childNodes);
421
+ }
422
+ for (; null !== (r = C.nextNode()) && d.length < u;) {
423
+ if (1 === r.nodeType) {
424
+ if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(e$4)) {
425
+ const i = v[a++],
426
+ s = r.getAttribute(t).split(h),
427
+ e = /([.?@])?(.*)/.exec(i);
428
+ d.push({
429
+ type: 1,
430
+ index: c,
431
+ name: e[2],
432
+ strings: s,
433
+ ctor: "." === e[1] ? H : "?" === e[1] ? I : "@" === e[1] ? L : k
434
+ }), r.removeAttribute(t);
435
+ } else t.startsWith(h) && (d.push({
436
+ type: 6,
437
+ index: c
438
+ }), r.removeAttribute(t));
439
+ if ($.test(r.tagName)) {
440
+ const t = r.textContent.split(h),
441
+ s = t.length - 1;
442
+ if (s > 0) {
443
+ r.textContent = i$2 ? i$2.emptyScript : "";
444
+ for (let i = 0; i < s; i++) r.append(t[i], l()), C.nextNode(), d.push({
445
+ type: 2,
446
+ index: ++c
447
+ });
448
+ r.append(t[s], l());
449
+ }
450
+ }
451
+ } else if (8 === r.nodeType) if (r.data === o$2) d.push({
452
+ type: 2,
453
+ index: c
454
+ });else {
455
+ let t = -1;
456
+ for (; -1 !== (t = r.data.indexOf(h, t + 1));) d.push({
457
+ type: 7,
458
+ index: c
459
+ }), t += h.length - 1;
460
+ }
461
+ c++;
462
+ }
463
+ }
464
+ static createElement(t, i) {
465
+ const s = r$3.createElement("template");
466
+ return s.innerHTML = t, s;
467
+ }
468
+ }
469
+ function S(t, i, s = t, e) {
470
+ if (i === T) return i;
471
+ let h = void 0 !== e ? s._$Co?.[e] : s._$Cl;
472
+ const o = c$1(i) ? void 0 : i._$litDirective$;
473
+ return h?.constructor !== o && (h?._$AO?.(false), void 0 === o ? h = void 0 : (h = new o(t), h._$AT(t, s, e)), void 0 !== e ? (s._$Co ??= [])[e] = h : s._$Cl = h), void 0 !== h && (i = S(t, h._$AS(t, i.values), h, e)), i;
474
+ }
475
+ let M$1 = class M {
476
+ constructor(t, i) {
477
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
478
+ }
479
+ get parentNode() {
480
+ return this._$AM.parentNode;
481
+ }
482
+ get _$AU() {
483
+ return this._$AM._$AU;
484
+ }
485
+ u(t) {
486
+ const {
487
+ el: {
488
+ content: i
489
+ },
490
+ parts: s
491
+ } = this._$AD,
492
+ e = (t?.creationScope ?? r$3).importNode(i, true);
493
+ C.currentNode = e;
494
+ let h = C.nextNode(),
495
+ o = 0,
496
+ n = 0,
497
+ l = s[0];
498
+ for (; void 0 !== l;) {
499
+ if (o === l.index) {
500
+ let i;
501
+ 2 === l.type ? i = new R(h, h.nextSibling, this, t) : 1 === l.type ? i = new l.ctor(h, l.name, l.strings, this, t) : 6 === l.type && (i = new z(h, this, t)), this._$AV.push(i), l = s[++n];
502
+ }
503
+ o !== l?.index && (h = C.nextNode(), o++);
504
+ }
505
+ return C.currentNode = r$3, e;
506
+ }
507
+ p(t) {
508
+ let i = 0;
509
+ for (const s of this._$AV) void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
510
+ }
511
+ };
512
+ class R {
513
+ get _$AU() {
514
+ return this._$AM?._$AU ?? this._$Cv;
515
+ }
516
+ constructor(t, i, s, e) {
517
+ this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cv = e?.isConnected ?? true;
518
+ }
519
+ get parentNode() {
520
+ let t = this._$AA.parentNode;
521
+ const i = this._$AM;
522
+ return void 0 !== i && 11 === t?.nodeType && (t = i.parentNode), t;
523
+ }
524
+ get startNode() {
525
+ return this._$AA;
526
+ }
527
+ get endNode() {
528
+ return this._$AB;
529
+ }
530
+ _$AI(t, i = this) {
531
+ t = S(this, t, i), c$1(t) ? t === E || null == t || "" === t ? (this._$AH !== E && this._$AR(), this._$AH = E) : t !== this._$AH && t !== T && this._(t) : void 0 !== t._$litType$ ? this.$(t) : void 0 !== t.nodeType ? this.T(t) : u$2(t) ? this.k(t) : this._(t);
532
+ }
533
+ O(t) {
534
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
535
+ }
536
+ T(t) {
537
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
538
+ }
539
+ _(t) {
540
+ this._$AH !== E && c$1(this._$AH) ? this._$AA.nextSibling.data = t : this.T(r$3.createTextNode(t)), this._$AH = t;
541
+ }
542
+ $(t) {
543
+ const {
544
+ values: i,
545
+ _$litType$: s
546
+ } = t,
547
+ e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = N.createElement(P(s.h, s.h[0]), this.options)), s);
548
+ if (this._$AH?._$AD === e) this._$AH.p(i);else {
549
+ const t = new M$1(e, this),
550
+ s = t.u(this.options);
551
+ t.p(i), this.T(s), this._$AH = t;
552
+ }
553
+ }
554
+ _$AC(t) {
555
+ let i = A.get(t.strings);
556
+ return void 0 === i && A.set(t.strings, i = new N(t)), i;
557
+ }
558
+ k(t) {
559
+ a(this._$AH) || (this._$AH = [], this._$AR());
560
+ const i = this._$AH;
561
+ let s,
562
+ e = 0;
563
+ for (const h of t) e === i.length ? i.push(s = new R(this.O(l()), this.O(l()), this, this.options)) : s = i[e], s._$AI(h), e++;
564
+ e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
565
+ }
566
+ _$AR(t = this._$AA.nextSibling, i) {
567
+ for (this._$AP?.(false, true, i); t && t !== this._$AB;) {
568
+ const i = t.nextSibling;
569
+ t.remove(), t = i;
570
+ }
571
+ }
572
+ setConnected(t) {
573
+ void 0 === this._$AM && (this._$Cv = t, this._$AP?.(t));
574
+ }
575
+ }
576
+ class k {
577
+ get tagName() {
578
+ return this.element.tagName;
579
+ }
580
+ get _$AU() {
581
+ return this._$AM._$AU;
582
+ }
583
+ constructor(t, i, s, e, h) {
584
+ this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = h, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = E;
585
+ }
586
+ _$AI(t, i = this, s, e) {
587
+ const h = this.strings;
588
+ let o = false;
589
+ if (void 0 === h) t = S(this, t, i, 0), o = !c$1(t) || t !== this._$AH && t !== T, o && (this._$AH = t);else {
590
+ const e = t;
591
+ let n, r;
592
+ for (t = h[0], n = 0; n < h.length - 1; n++) r = S(this, e[s + n], i, n), r === T && (r = this._$AH[n]), o ||= !c$1(r) || r !== this._$AH[n], r === E ? t = E : t !== E && (t += (r ?? "") + h[n + 1]), this._$AH[n] = r;
593
+ }
594
+ o && !e && this.j(t);
595
+ }
596
+ j(t) {
597
+ t === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
598
+ }
599
+ }
600
+ class H extends k {
601
+ constructor() {
602
+ super(...arguments), this.type = 3;
603
+ }
604
+ j(t) {
605
+ this.element[this.name] = t === E ? void 0 : t;
606
+ }
607
+ }
608
+ class I extends k {
609
+ constructor() {
610
+ super(...arguments), this.type = 4;
611
+ }
612
+ j(t) {
613
+ this.element.toggleAttribute(this.name, !!t && t !== E);
614
+ }
615
+ }
616
+ class L extends k {
617
+ constructor(t, i, s, e, h) {
618
+ super(t, i, s, e, h), this.type = 5;
619
+ }
620
+ _$AI(t, i = this) {
621
+ if ((t = S(this, t, i, 0) ?? E) === T) return;
622
+ const s = this._$AH,
623
+ e = t === E && s !== E || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive,
624
+ h = t !== E && (s === E || e);
625
+ e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
626
+ }
627
+ handleEvent(t) {
628
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
629
+ }
630
+ }
631
+ class z {
632
+ constructor(t, i, s) {
633
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
634
+ }
635
+ get _$AU() {
636
+ return this._$AM._$AU;
637
+ }
638
+ _$AI(t) {
639
+ S(this, t);
640
+ }
641
+ }
642
+ const Z = {
643
+ I: R},
644
+ j = t$3.litHtmlPolyfillSupport;
645
+ j?.(N, R), (t$3.litHtmlVersions ??= []).push("3.3.0");
646
+ const B = (t, i, s) => {
647
+ const e = s?.renderBefore ?? i;
648
+ let h = e._$litPart$;
649
+ if (void 0 === h) {
650
+ const t = s?.renderBefore ?? null;
651
+ e._$litPart$ = h = new R(i.insertBefore(l(), t), t, void 0, s ?? {});
652
+ }
653
+ return h._$AI(t), h;
654
+ };
655
+
656
+ /**
657
+ * @license
658
+ * Copyright 2017 Google LLC
659
+ * SPDX-License-Identifier: BSD-3-Clause
660
+ */
661
+ const s$1 = globalThis;
662
+ let i$1 = class i extends y$1 {
663
+ constructor() {
664
+ super(...arguments), this.renderOptions = {
665
+ host: this
666
+ }, this._$Do = void 0;
667
+ }
668
+ createRenderRoot() {
669
+ const t = super.createRenderRoot();
670
+ return this.renderOptions.renderBefore ??= t.firstChild, t;
671
+ }
672
+ update(t) {
673
+ const r = this.render();
674
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = B(r, this.renderRoot, this.renderOptions);
675
+ }
676
+ connectedCallback() {
677
+ super.connectedCallback(), this._$Do?.setConnected(true);
678
+ }
679
+ disconnectedCallback() {
680
+ super.disconnectedCallback(), this._$Do?.setConnected(false);
681
+ }
682
+ render() {
683
+ return T;
684
+ }
685
+ };
686
+ i$1._$litElement$ = true, i$1["finalized"] = true, s$1.litElementHydrateSupport?.({
687
+ LitElement: i$1
688
+ });
689
+ const o$1 = s$1.litElementPolyfillSupport;
690
+ o$1?.({
691
+ LitElement: i$1
692
+ });
693
+ (s$1.litElementVersions ??= []).push("4.2.0");
694
+
695
+ /**
696
+ * @license
697
+ * Copyright 2017 Google LLC
698
+ * SPDX-License-Identifier: BSD-3-Clause
699
+ */
700
+ const t$2 = {
701
+ ATTRIBUTE: 1,
702
+ CHILD: 2},
703
+ e$3 = t => (...e) => ({
704
+ _$litDirective$: t,
705
+ values: e
706
+ });
707
+ class i {
708
+ constructor(t) {}
709
+ get _$AU() {
710
+ return this._$AM._$AU;
711
+ }
712
+ _$AT(t, e, i) {
713
+ this._$Ct = t, this._$AM = e, this._$Ci = i;
714
+ }
715
+ _$AS(t, e) {
716
+ return this.update(t, e);
717
+ }
718
+ update(t, e) {
719
+ return this.render(...e);
720
+ }
721
+ }
722
+
723
+ /**
724
+ * @license
725
+ * Copyright 2020 Google LLC
726
+ * SPDX-License-Identifier: BSD-3-Clause
727
+ */
728
+ const {
729
+ I: t$1
730
+ } = Z,
731
+ s = () => document.createComment(""),
732
+ r$2 = (o, i, n) => {
733
+ const e = o._$AA.parentNode,
734
+ l = void 0 === i ? o._$AB : i._$AA;
735
+ if (void 0 === n) {
736
+ const i = e.insertBefore(s(), l),
737
+ c = e.insertBefore(s(), l);
738
+ n = new t$1(i, c, o, o.options);
739
+ } else {
740
+ const t = n._$AB.nextSibling,
741
+ i = n._$AM,
742
+ c = i !== o;
743
+ if (c) {
744
+ let t;
745
+ n._$AQ?.(o), n._$AM = o, void 0 !== n._$AP && (t = o._$AU) !== i._$AU && n._$AP(t);
746
+ }
747
+ if (t !== l || c) {
748
+ let o = n._$AA;
749
+ for (; o !== t;) {
750
+ const t = o.nextSibling;
751
+ e.insertBefore(o, l), o = t;
752
+ }
753
+ }
754
+ }
755
+ return n;
756
+ },
757
+ v = (o, t, i = o) => (o._$AI(t, i), o),
758
+ u$1 = {},
759
+ m = (o, t = u$1) => o._$AH = t,
760
+ p = o => o._$AH,
761
+ M = o => {
762
+ o._$AP?.(false, true);
763
+ let t = o._$AA;
764
+ const i = o._$AB.nextSibling;
765
+ for (; t !== i;) {
766
+ const o = t.nextSibling;
767
+ t.remove(), t = o;
768
+ }
769
+ };
770
+
771
+ /**
772
+ * @license
773
+ * Copyright 2017 Google LLC
774
+ * SPDX-License-Identifier: BSD-3-Clause
775
+ */
776
+ const u = (e, s, t) => {
777
+ const r = new Map();
778
+ for (let l = s; l <= t; l++) r.set(e[l], l);
779
+ return r;
780
+ },
781
+ c = e$3(class extends i {
782
+ constructor(e) {
783
+ if (super(e), e.type !== t$2.CHILD) throw Error("repeat() can only be used in text expressions");
784
+ }
785
+ dt(e, s, t) {
786
+ let r;
787
+ void 0 === t ? t = s : void 0 !== s && (r = s);
788
+ const l = [],
789
+ o = [];
790
+ let i = 0;
791
+ for (const s of e) l[i] = r ? r(s, i) : i, o[i] = t(s, i), i++;
792
+ return {
793
+ values: o,
794
+ keys: l
795
+ };
796
+ }
797
+ render(e, s, t) {
798
+ return this.dt(e, s, t).values;
799
+ }
800
+ update(s, [t, r, c]) {
801
+ const d = p(s),
802
+ {
803
+ values: p$1,
804
+ keys: a
805
+ } = this.dt(t, r, c);
806
+ if (!Array.isArray(d)) return this.ut = a, p$1;
807
+ const h = this.ut ??= [],
808
+ v$1 = [];
809
+ let m$1,
810
+ y,
811
+ x = 0,
812
+ j = d.length - 1,
813
+ k = 0,
814
+ w = p$1.length - 1;
815
+ for (; x <= j && k <= w;) if (null === d[x]) x++;else if (null === d[j]) j--;else if (h[x] === a[k]) v$1[k] = v(d[x], p$1[k]), x++, k++;else if (h[j] === a[w]) v$1[w] = v(d[j], p$1[w]), j--, w--;else if (h[x] === a[w]) v$1[w] = v(d[x], p$1[w]), r$2(s, v$1[w + 1], d[x]), x++, w--;else if (h[j] === a[k]) v$1[k] = v(d[j], p$1[k]), r$2(s, d[x], d[j]), j--, k++;else if (void 0 === m$1 && (m$1 = u(a, k, w), y = u(h, x, j)), m$1.has(h[x])) {
816
+ if (m$1.has(h[j])) {
817
+ const e = y.get(a[k]),
818
+ t = void 0 !== e ? d[e] : null;
819
+ if (null === t) {
820
+ const e = r$2(s, d[x]);
821
+ v(e, p$1[k]), v$1[k] = e;
822
+ } else v$1[k] = v(t, p$1[k]), r$2(s, d[x], t), d[e] = null;
823
+ k++;
824
+ } else M(d[j]), j--;
825
+ } else M(d[x]), x++;
826
+ for (; k <= w;) {
827
+ const e = r$2(s, v$1[w + 1]);
828
+ v(e, p$1[k]), v$1[k++] = e;
829
+ }
830
+ for (; x <= j;) {
831
+ const e = d[x++];
832
+ null !== e && M(e);
833
+ }
834
+ return this.ut = a, m(s, v$1), T;
835
+ }
836
+ });
837
+
838
+ /**
839
+ * @license
840
+ * Copyright 2017 Google LLC
841
+ * SPDX-License-Identifier: BSD-3-Clause
842
+ */
843
+ const t = t => (e, o) => {
844
+ void 0 !== o ? o.addInitializer(() => {
845
+ customElements.define(t, e);
846
+ }) : customElements.define(t, e);
847
+ };
848
+
849
+ /**
850
+ * @license
851
+ * Copyright 2017 Google LLC
852
+ * SPDX-License-Identifier: BSD-3-Clause
853
+ */
854
+ const o = {
855
+ attribute: true,
856
+ type: String,
857
+ converter: u$3,
858
+ reflect: false,
859
+ hasChanged: f$1
860
+ },
861
+ r$1 = (t = o, e, r) => {
862
+ const {
863
+ kind: n,
864
+ metadata: i
865
+ } = r;
866
+ let s = globalThis.litPropertyMetadata.get(i);
867
+ 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) {
868
+ const {
869
+ name: o
870
+ } = r;
871
+ return {
872
+ set(r) {
873
+ const n = e.get.call(this);
874
+ e.set.call(this, r), this.requestUpdate(o, n, t);
875
+ },
876
+ init(e) {
877
+ return void 0 !== e && this.C(o, void 0, t, e), e;
878
+ }
879
+ };
880
+ }
881
+ if ("setter" === n) {
882
+ const {
883
+ name: o
884
+ } = r;
885
+ return function (r) {
886
+ const n = this[o];
887
+ e.call(this, r), this.requestUpdate(o, n, t);
888
+ };
889
+ }
890
+ throw Error("Unsupported decorator location: " + n);
891
+ };
892
+ function n(t) {
893
+ return (e, o) => "object" == typeof o ? r$1(t, e, o) : ((t, e, o) => {
894
+ const r = e.hasOwnProperty(o);
895
+ return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
896
+ })(t, e, o);
897
+ }
898
+
899
+ /**
900
+ * @license
901
+ * Copyright 2017 Google LLC
902
+ * SPDX-License-Identifier: BSD-3-Clause
903
+ */
904
+ function r(r) {
905
+ return n({
906
+ ...r,
907
+ state: true,
908
+ attribute: false
909
+ });
910
+ }
911
+
912
+ /**
913
+ * @license
914
+ * Copyright 2017 Google LLC
915
+ * SPDX-License-Identifier: BSD-3-Clause
916
+ */
917
+ const e$2 = (e, t, c) => (c.configurable = true, c.enumerable = true, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
918
+
919
+ /**
920
+ * @license
921
+ * Copyright 2017 Google LLC
922
+ * SPDX-License-Identifier: BSD-3-Clause
923
+ */
924
+ function e$1(e, r) {
925
+ return (n, s, i) => {
926
+ const o = t => t.renderRoot?.querySelector(e) ?? null;
927
+ return e$2(n, s, {
928
+ get() {
929
+ return o(this);
930
+ }
931
+ });
932
+ };
933
+ }
934
+
935
+ /**
936
+ * @license
937
+ * Copyright 2023 Google LLC
938
+ * SPDX-License-Identifier: Apache-2.0
939
+ */
940
+ /**
941
+ * A key to retrieve an `Attachable` element's `AttachableController` from a
942
+ * global `MutationObserver`.
943
+ */
944
+ const ATTACHABLE_CONTROLLER = Symbol('attachableController');
945
+ let FOR_ATTRIBUTE_OBSERVER;
946
+ {
947
+ /**
948
+ * A global `MutationObserver` that reacts to `for` attribute changes on
949
+ * `Attachable` elements. If the `for` attribute changes, the controller will
950
+ * re-attach to the new referenced element.
951
+ */
952
+ FOR_ATTRIBUTE_OBSERVER = new MutationObserver(records => {
953
+ for (const record of records) {
954
+ // When a control's `for` attribute changes, inform its
955
+ // `AttachableController` to update to a new control.
956
+ record.target[ATTACHABLE_CONTROLLER]?.hostConnected();
957
+ }
958
+ });
959
+ }
960
+ /**
961
+ * A controller that provides an implementation for `Attachable` elements.
962
+ *
963
+ * @example
964
+ * ```ts
965
+ * class MyElement extends LitElement implements Attachable {
966
+ * get control() { return this.attachableController.control; }
967
+ *
968
+ * private readonly attachableController = new AttachableController(
969
+ * this,
970
+ * (previousControl, newControl) => {
971
+ * previousControl?.removeEventListener('click', this.handleClick);
972
+ * newControl?.addEventListener('click', this.handleClick);
973
+ * }
974
+ * );
975
+ *
976
+ * // Implement remaining `Attachable` properties/methods that call the
977
+ * // controller's properties/methods.
978
+ * }
979
+ * ```
980
+ */
981
+ class AttachableController {
982
+ get htmlFor() {
983
+ return this.host.getAttribute('for');
984
+ }
985
+ set htmlFor(htmlFor) {
986
+ if (htmlFor === null) {
987
+ this.host.removeAttribute('for');
988
+ } else {
989
+ this.host.setAttribute('for', htmlFor);
990
+ }
991
+ }
992
+ get control() {
993
+ if (this.host.hasAttribute('for')) {
994
+ if (!this.htmlFor || !this.host.isConnected) {
995
+ return null;
996
+ }
997
+ return this.host.getRootNode().querySelector(`#${this.htmlFor}`);
998
+ }
999
+ return this.currentControl || this.host.parentElement;
1000
+ }
1001
+ set control(control) {
1002
+ if (control) {
1003
+ this.attach(control);
1004
+ } else {
1005
+ this.detach();
1006
+ }
1007
+ }
1008
+ /**
1009
+ * Creates a new controller for an `Attachable` element.
1010
+ *
1011
+ * @param host The `Attachable` element.
1012
+ * @param onControlChange A callback with two parameters for the previous and
1013
+ * next control. An `Attachable` element may perform setup or teardown
1014
+ * logic whenever the control changes.
1015
+ */
1016
+ constructor(host, onControlChange) {
1017
+ this.host = host;
1018
+ this.onControlChange = onControlChange;
1019
+ this.currentControl = null;
1020
+ host.addController(this);
1021
+ host[ATTACHABLE_CONTROLLER] = this;
1022
+ FOR_ATTRIBUTE_OBSERVER?.observe(host, {
1023
+ attributeFilter: ['for']
1024
+ });
1025
+ }
1026
+ attach(control) {
1027
+ if (control === this.currentControl) {
1028
+ return;
1029
+ }
1030
+ this.setCurrentControl(control);
1031
+ // When imperatively attaching, remove the `for` attribute so
1032
+ // that the attached control is used instead of a referenced one.
1033
+ this.host.removeAttribute('for');
1034
+ }
1035
+ detach() {
1036
+ this.setCurrentControl(null);
1037
+ // When imperatively detaching, add an empty `for=""` attribute. This will
1038
+ // ensure the control is `null` rather than the `parentElement`.
1039
+ this.host.setAttribute('for', '');
1040
+ }
1041
+ /** @private */
1042
+ hostConnected() {
1043
+ this.setCurrentControl(this.control);
1044
+ }
1045
+ /** @private */
1046
+ hostDisconnected() {
1047
+ this.setCurrentControl(null);
1048
+ }
1049
+ setCurrentControl(control) {
1050
+ this.onControlChange(this.currentControl, control);
1051
+ this.currentControl = control;
1052
+ }
1053
+ }
1054
+
1055
+ /**
1056
+ * @license
1057
+ * Copyright 2021 Google LLC
1058
+ * SPDX-License-Identifier: Apache-2.0
1059
+ */
1060
+ /**
1061
+ * Events that the focus ring listens to.
1062
+ */
1063
+ const EVENTS$1 = ['focusin', 'focusout', 'pointerdown'];
1064
+ /**
1065
+ * A focus ring component.
1066
+ *
1067
+ * @fires visibility-changed {Event} Fired whenever `visible` changes.
1068
+ */
1069
+ class FocusRing extends i$1 {
1070
+ constructor() {
1071
+ super(...arguments);
1072
+ /**
1073
+ * Makes the focus ring visible.
1074
+ */
1075
+ this.visible = false;
1076
+ /**
1077
+ * Makes the focus ring animate inwards instead of outwards.
1078
+ */
1079
+ this.inward = false;
1080
+ this.attachableController = new AttachableController(this, this.onControlChange.bind(this));
1081
+ }
1082
+ get htmlFor() {
1083
+ return this.attachableController.htmlFor;
1084
+ }
1085
+ set htmlFor(htmlFor) {
1086
+ this.attachableController.htmlFor = htmlFor;
1087
+ }
1088
+ get control() {
1089
+ return this.attachableController.control;
1090
+ }
1091
+ set control(control) {
1092
+ this.attachableController.control = control;
1093
+ }
1094
+ attach(control) {
1095
+ this.attachableController.attach(control);
1096
+ }
1097
+ detach() {
1098
+ this.attachableController.detach();
1099
+ }
1100
+ connectedCallback() {
1101
+ super.connectedCallback();
1102
+ // Needed for VoiceOver, which will create a "group" if the element is a
1103
+ // sibling to other content.
1104
+ this.setAttribute('aria-hidden', 'true');
1105
+ }
1106
+ /** @private */
1107
+ handleEvent(event) {
1108
+ if (event[HANDLED_BY_FOCUS_RING]) {
1109
+ // This ensures the focus ring does not activate when multiple focus rings
1110
+ // are used within a single component.
1111
+ return;
1112
+ }
1113
+ switch (event.type) {
1114
+ default:
1115
+ return;
1116
+ case 'focusin':
1117
+ this.visible = this.control?.matches(':focus-visible') ?? false;
1118
+ break;
1119
+ case 'focusout':
1120
+ case 'pointerdown':
1121
+ this.visible = false;
1122
+ break;
1123
+ }
1124
+ event[HANDLED_BY_FOCUS_RING] = true;
1125
+ }
1126
+ onControlChange(prev, next) {
1127
+ for (const event of EVENTS$1) {
1128
+ prev?.removeEventListener(event, this);
1129
+ next?.addEventListener(event, this);
1130
+ }
1131
+ }
1132
+ update(changed) {
1133
+ if (changed.has('visible')) {
1134
+ // This logic can be removed once the `:has` selector has been introduced
1135
+ // to Firefox. This is necessary to allow correct submenu styles.
1136
+ this.dispatchEvent(new Event('visibility-changed'));
1137
+ }
1138
+ super.update(changed);
1139
+ }
1140
+ }
1141
+ __decorate([n({
1142
+ type: Boolean,
1143
+ reflect: true
1144
+ })], FocusRing.prototype, "visible", void 0);
1145
+ __decorate([n({
1146
+ type: Boolean,
1147
+ reflect: true
1148
+ })], FocusRing.prototype, "inward", void 0);
1149
+ const HANDLED_BY_FOCUS_RING = Symbol('handledByFocusRing');
1150
+
1151
+ /**
1152
+ * @license
1153
+ * Copyright 2024 Google LLC
1154
+ * SPDX-License-Identifier: Apache-2.0
1155
+ */
1156
+ // Generated stylesheet for ./focus/internal/focus-ring-styles.css.
1157
+ const styles$2 = i$4`:host{animation-delay:0s,calc(var(--md-focus-ring-duration, 600ms)*.25);animation-duration:calc(var(--md-focus-ring-duration, 600ms)*.25),calc(var(--md-focus-ring-duration, 600ms)*.75);animation-timing-function:cubic-bezier(0.2, 0, 0, 1);box-sizing:border-box;color:var(--md-focus-ring-color, var(--md-sys-color-secondary, #625b71));display:none;pointer-events:none;position:absolute}:host([visible]){display:flex}:host(:not([inward])){animation-name:outward-grow,outward-shrink;border-end-end-radius:calc(var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) + var(--md-focus-ring-outward-offset, 2px));border-end-start-radius:calc(var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) + var(--md-focus-ring-outward-offset, 2px));border-start-end-radius:calc(var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) + var(--md-focus-ring-outward-offset, 2px));border-start-start-radius:calc(var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) + var(--md-focus-ring-outward-offset, 2px));inset:calc(-1*var(--md-focus-ring-outward-offset, 2px));outline:var(--md-focus-ring-width, 3px) solid currentColor}:host([inward]){animation-name:inward-grow,inward-shrink;border-end-end-radius:calc(var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(--md-focus-ring-inward-offset, 0px));border-end-start-radius:calc(var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(--md-focus-ring-inward-offset, 0px));border-start-end-radius:calc(var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(--md-focus-ring-inward-offset, 0px));border-start-start-radius:calc(var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(--md-focus-ring-inward-offset, 0px));border:var(--md-focus-ring-width, 3px) solid currentColor;inset:var(--md-focus-ring-inward-offset, 0px)}@keyframes outward-grow{from{outline-width:0}to{outline-width:var(--md-focus-ring-active-width, 8px)}}@keyframes outward-shrink{from{outline-width:var(--md-focus-ring-active-width, 8px)}}@keyframes inward-grow{from{border-width:0}to{border-width:var(--md-focus-ring-active-width, 8px)}}@keyframes inward-shrink{from{border-width:var(--md-focus-ring-active-width, 8px)}}@media(prefers-reduced-motion){:host{animation:none}}
1158
+ `;
1159
+
1160
+ /**
1161
+ * @license
1162
+ * Copyright 2021 Google LLC
1163
+ * SPDX-License-Identifier: Apache-2.0
1164
+ */
1165
+ /**
1166
+ * TODO(b/267336424): add docs
1167
+ *
1168
+ * @final
1169
+ * @suppress {visibility}
1170
+ */
1171
+ let MdFocusRing = class MdFocusRing extends FocusRing {};
1172
+ MdFocusRing.styles = [styles$2];
1173
+ MdFocusRing = __decorate([t('md-focus-ring')], MdFocusRing);
1174
+
1175
+ /**
1176
+ * @license
1177
+ * Copyright 2018 Google LLC
1178
+ * SPDX-License-Identifier: BSD-3-Clause
1179
+ */
1180
+ const e = e$3(class extends i {
1181
+ constructor(t) {
1182
+ if (super(t), t.type !== t$2.ATTRIBUTE || "class" !== t.name || t.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
1183
+ }
1184
+ render(t) {
1185
+ return " " + Object.keys(t).filter(s => t[s]).join(" ") + " ";
1186
+ }
1187
+ update(s, [i]) {
1188
+ if (void 0 === this.st) {
1189
+ this.st = new Set(), void 0 !== s.strings && (this.nt = new Set(s.strings.join(" ").split(/\s/).filter(t => "" !== t)));
1190
+ for (const t in i) i[t] && !this.nt?.has(t) && this.st.add(t);
1191
+ return this.render(i);
1192
+ }
1193
+ const r = s.element.classList;
1194
+ for (const t of this.st) t in i || (r.remove(t), this.st.delete(t));
1195
+ for (const t in i) {
1196
+ const s = !!i[t];
1197
+ s === this.st.has(t) || this.nt?.has(t) || (s ? (r.add(t), this.st.add(t)) : (r.remove(t), this.st.delete(t)));
1198
+ }
1199
+ return T;
1200
+ }
1201
+ });
1202
+
1203
+ /**
1204
+ * @license
1205
+ * Copyright 2021 Google LLC
1206
+ * SPDX-License-Identifier: Apache-2.0
1207
+ */
1208
+ /**
1209
+ * Easing functions to use for web animations.
1210
+ *
1211
+ * **NOTE:** `EASING.EMPHASIZED` is approximated with unknown accuracy.
1212
+ *
1213
+ * TODO(b/241113345): replace with tokens
1214
+ */
1215
+ const EASING = {
1216
+ STANDARD: 'cubic-bezier(0.2, 0, 0, 1)'};
1217
+
1218
+ /**
1219
+ * @license
1220
+ * Copyright 2022 Google LLC
1221
+ * SPDX-License-Identifier: Apache-2.0
1222
+ */
1223
+ const PRESS_GROW_MS = 450;
1224
+ const MINIMUM_PRESS_MS = 225;
1225
+ const INITIAL_ORIGIN_SCALE = 0.2;
1226
+ const PADDING = 10;
1227
+ const SOFT_EDGE_MINIMUM_SIZE = 75;
1228
+ const SOFT_EDGE_CONTAINER_RATIO = 0.35;
1229
+ const PRESS_PSEUDO = '::after';
1230
+ const ANIMATION_FILL = 'forwards';
1231
+ /**
1232
+ * Interaction states for the ripple.
1233
+ *
1234
+ * On Touch:
1235
+ * - `INACTIVE -> TOUCH_DELAY -> WAITING_FOR_CLICK -> INACTIVE`
1236
+ * - `INACTIVE -> TOUCH_DELAY -> HOLDING -> WAITING_FOR_CLICK -> INACTIVE`
1237
+ *
1238
+ * On Mouse or Pen:
1239
+ * - `INACTIVE -> WAITING_FOR_CLICK -> INACTIVE`
1240
+ */
1241
+ var State;
1242
+ (function (State) {
1243
+ /**
1244
+ * Initial state of the control, no touch in progress.
1245
+ *
1246
+ * Transitions:
1247
+ * - on touch down: transition to `TOUCH_DELAY`.
1248
+ * - on mouse down: transition to `WAITING_FOR_CLICK`.
1249
+ */
1250
+ State[State["INACTIVE"] = 0] = "INACTIVE";
1251
+ /**
1252
+ * Touch down has been received, waiting to determine if it's a swipe or
1253
+ * scroll.
1254
+ *
1255
+ * Transitions:
1256
+ * - on touch up: begin press; transition to `WAITING_FOR_CLICK`.
1257
+ * - on cancel: transition to `INACTIVE`.
1258
+ * - after `TOUCH_DELAY_MS`: begin press; transition to `HOLDING`.
1259
+ */
1260
+ State[State["TOUCH_DELAY"] = 1] = "TOUCH_DELAY";
1261
+ /**
1262
+ * A touch has been deemed to be a press
1263
+ *
1264
+ * Transitions:
1265
+ * - on up: transition to `WAITING_FOR_CLICK`.
1266
+ */
1267
+ State[State["HOLDING"] = 2] = "HOLDING";
1268
+ /**
1269
+ * The user touch has finished, transition into rest state.
1270
+ *
1271
+ * Transitions:
1272
+ * - on click end press; transition to `INACTIVE`.
1273
+ */
1274
+ State[State["WAITING_FOR_CLICK"] = 3] = "WAITING_FOR_CLICK";
1275
+ })(State || (State = {}));
1276
+ /**
1277
+ * Events that the ripple listens to.
1278
+ */
1279
+ const EVENTS = ['click', 'contextmenu', 'pointercancel', 'pointerdown', 'pointerenter', 'pointerleave', 'pointerup'];
1280
+ /**
1281
+ * Delay reacting to touch so that we do not show the ripple for a swipe or
1282
+ * scroll interaction.
1283
+ */
1284
+ const TOUCH_DELAY_MS = 150;
1285
+ /**
1286
+ * Used to detect if HCM is active. Events do not process during HCM when the
1287
+ * ripple is not displayed.
1288
+ */
1289
+ const FORCED_COLORS = window.matchMedia('(forced-colors: active)');
1290
+ /**
1291
+ * A ripple component.
1292
+ */
1293
+ class Ripple extends i$1 {
1294
+ constructor() {
1295
+ super(...arguments);
1296
+ /**
1297
+ * Disables the ripple.
1298
+ */
1299
+ this.disabled = false;
1300
+ this.hovered = false;
1301
+ this.pressed = false;
1302
+ this.rippleSize = '';
1303
+ this.rippleScale = '';
1304
+ this.initialSize = 0;
1305
+ this.state = State.INACTIVE;
1306
+ this.checkBoundsAfterContextMenu = false;
1307
+ this.attachableController = new AttachableController(this, this.onControlChange.bind(this));
1308
+ }
1309
+ get htmlFor() {
1310
+ return this.attachableController.htmlFor;
1311
+ }
1312
+ set htmlFor(htmlFor) {
1313
+ this.attachableController.htmlFor = htmlFor;
1314
+ }
1315
+ get control() {
1316
+ return this.attachableController.control;
1317
+ }
1318
+ set control(control) {
1319
+ this.attachableController.control = control;
1320
+ }
1321
+ attach(control) {
1322
+ this.attachableController.attach(control);
1323
+ }
1324
+ detach() {
1325
+ this.attachableController.detach();
1326
+ }
1327
+ connectedCallback() {
1328
+ super.connectedCallback();
1329
+ // Needed for VoiceOver, which will create a "group" if the element is a
1330
+ // sibling to other content.
1331
+ this.setAttribute('aria-hidden', 'true');
1332
+ }
1333
+ render() {
1334
+ const classes = {
1335
+ 'hovered': this.hovered,
1336
+ 'pressed': this.pressed
1337
+ };
1338
+ return x`<div class="surface ${e(classes)}"></div>`;
1339
+ }
1340
+ update(changedProps) {
1341
+ if (changedProps.has('disabled') && this.disabled) {
1342
+ this.hovered = false;
1343
+ this.pressed = false;
1344
+ }
1345
+ super.update(changedProps);
1346
+ }
1347
+ /**
1348
+ * TODO(b/269799771): make private
1349
+ * @private only public for slider
1350
+ */
1351
+ handlePointerenter(event) {
1352
+ if (!this.shouldReactToEvent(event)) {
1353
+ return;
1354
+ }
1355
+ this.hovered = true;
1356
+ }
1357
+ /**
1358
+ * TODO(b/269799771): make private
1359
+ * @private only public for slider
1360
+ */
1361
+ handlePointerleave(event) {
1362
+ if (!this.shouldReactToEvent(event)) {
1363
+ return;
1364
+ }
1365
+ this.hovered = false;
1366
+ // release a held mouse or pen press that moves outside the element
1367
+ if (this.state !== State.INACTIVE) {
1368
+ this.endPressAnimation();
1369
+ }
1370
+ }
1371
+ handlePointerup(event) {
1372
+ if (!this.shouldReactToEvent(event)) {
1373
+ return;
1374
+ }
1375
+ if (this.state === State.HOLDING) {
1376
+ this.state = State.WAITING_FOR_CLICK;
1377
+ return;
1378
+ }
1379
+ if (this.state === State.TOUCH_DELAY) {
1380
+ this.state = State.WAITING_FOR_CLICK;
1381
+ this.startPressAnimation(this.rippleStartEvent);
1382
+ return;
1383
+ }
1384
+ }
1385
+ async handlePointerdown(event) {
1386
+ if (!this.shouldReactToEvent(event)) {
1387
+ return;
1388
+ }
1389
+ this.rippleStartEvent = event;
1390
+ if (!this.isTouch(event)) {
1391
+ this.state = State.WAITING_FOR_CLICK;
1392
+ this.startPressAnimation(event);
1393
+ return;
1394
+ }
1395
+ // after a longpress contextmenu event, an extra `pointerdown` can be
1396
+ // dispatched to the pressed element. Check that the down is within
1397
+ // bounds of the element in this case.
1398
+ if (this.checkBoundsAfterContextMenu && !this.inBounds(event)) {
1399
+ return;
1400
+ }
1401
+ this.checkBoundsAfterContextMenu = false;
1402
+ // Wait for a hold after touch delay
1403
+ this.state = State.TOUCH_DELAY;
1404
+ await new Promise(resolve => {
1405
+ setTimeout(resolve, TOUCH_DELAY_MS);
1406
+ });
1407
+ if (this.state !== State.TOUCH_DELAY) {
1408
+ return;
1409
+ }
1410
+ this.state = State.HOLDING;
1411
+ this.startPressAnimation(event);
1412
+ }
1413
+ handleClick() {
1414
+ // Click is a MouseEvent in Firefox and Safari, so we cannot use
1415
+ // `shouldReactToEvent`
1416
+ if (this.disabled) {
1417
+ return;
1418
+ }
1419
+ if (this.state === State.WAITING_FOR_CLICK) {
1420
+ this.endPressAnimation();
1421
+ return;
1422
+ }
1423
+ if (this.state === State.INACTIVE) {
1424
+ // keyboard synthesized click event
1425
+ this.startPressAnimation();
1426
+ this.endPressAnimation();
1427
+ }
1428
+ }
1429
+ handlePointercancel(event) {
1430
+ if (!this.shouldReactToEvent(event)) {
1431
+ return;
1432
+ }
1433
+ this.endPressAnimation();
1434
+ }
1435
+ handleContextmenu() {
1436
+ if (this.disabled) {
1437
+ return;
1438
+ }
1439
+ this.checkBoundsAfterContextMenu = true;
1440
+ this.endPressAnimation();
1441
+ }
1442
+ determineRippleSize() {
1443
+ const {
1444
+ height,
1445
+ width
1446
+ } = this.getBoundingClientRect();
1447
+ const maxDim = Math.max(height, width);
1448
+ const softEdgeSize = Math.max(SOFT_EDGE_CONTAINER_RATIO * maxDim, SOFT_EDGE_MINIMUM_SIZE);
1449
+ const initialSize = Math.floor(maxDim * INITIAL_ORIGIN_SCALE);
1450
+ const hypotenuse = Math.sqrt(width ** 2 + height ** 2);
1451
+ const maxRadius = hypotenuse + PADDING;
1452
+ this.initialSize = initialSize;
1453
+ this.rippleScale = `${(maxRadius + softEdgeSize) / initialSize}`;
1454
+ this.rippleSize = `${initialSize}px`;
1455
+ }
1456
+ getNormalizedPointerEventCoords(pointerEvent) {
1457
+ const {
1458
+ scrollX,
1459
+ scrollY
1460
+ } = window;
1461
+ const {
1462
+ left,
1463
+ top
1464
+ } = this.getBoundingClientRect();
1465
+ const documentX = scrollX + left;
1466
+ const documentY = scrollY + top;
1467
+ const {
1468
+ pageX,
1469
+ pageY
1470
+ } = pointerEvent;
1471
+ return {
1472
+ x: pageX - documentX,
1473
+ y: pageY - documentY
1474
+ };
1475
+ }
1476
+ getTranslationCoordinates(positionEvent) {
1477
+ const {
1478
+ height,
1479
+ width
1480
+ } = this.getBoundingClientRect();
1481
+ // end in the center
1482
+ const endPoint = {
1483
+ x: (width - this.initialSize) / 2,
1484
+ y: (height - this.initialSize) / 2
1485
+ };
1486
+ let startPoint;
1487
+ if (positionEvent instanceof PointerEvent) {
1488
+ startPoint = this.getNormalizedPointerEventCoords(positionEvent);
1489
+ } else {
1490
+ startPoint = {
1491
+ x: width / 2,
1492
+ y: height / 2
1493
+ };
1494
+ }
1495
+ // center around start point
1496
+ startPoint = {
1497
+ x: startPoint.x - this.initialSize / 2,
1498
+ y: startPoint.y - this.initialSize / 2
1499
+ };
1500
+ return {
1501
+ startPoint,
1502
+ endPoint
1503
+ };
1504
+ }
1505
+ startPressAnimation(positionEvent) {
1506
+ if (!this.mdRoot) {
1507
+ return;
1508
+ }
1509
+ this.pressed = true;
1510
+ this.growAnimation?.cancel();
1511
+ this.determineRippleSize();
1512
+ const {
1513
+ startPoint,
1514
+ endPoint
1515
+ } = this.getTranslationCoordinates(positionEvent);
1516
+ const translateStart = `${startPoint.x}px, ${startPoint.y}px`;
1517
+ const translateEnd = `${endPoint.x}px, ${endPoint.y}px`;
1518
+ this.growAnimation = this.mdRoot.animate({
1519
+ top: [0, 0],
1520
+ left: [0, 0],
1521
+ height: [this.rippleSize, this.rippleSize],
1522
+ width: [this.rippleSize, this.rippleSize],
1523
+ transform: [`translate(${translateStart}) scale(1)`, `translate(${translateEnd}) scale(${this.rippleScale})`]
1524
+ }, {
1525
+ pseudoElement: PRESS_PSEUDO,
1526
+ duration: PRESS_GROW_MS,
1527
+ easing: EASING.STANDARD,
1528
+ fill: ANIMATION_FILL
1529
+ });
1530
+ }
1531
+ async endPressAnimation() {
1532
+ this.rippleStartEvent = undefined;
1533
+ this.state = State.INACTIVE;
1534
+ const animation = this.growAnimation;
1535
+ let pressAnimationPlayState = Infinity;
1536
+ if (typeof animation?.currentTime === 'number') {
1537
+ pressAnimationPlayState = animation.currentTime;
1538
+ } else if (animation?.currentTime) {
1539
+ pressAnimationPlayState = animation.currentTime.to('ms').value;
1540
+ }
1541
+ if (pressAnimationPlayState >= MINIMUM_PRESS_MS) {
1542
+ this.pressed = false;
1543
+ return;
1544
+ }
1545
+ await new Promise(resolve => {
1546
+ setTimeout(resolve, MINIMUM_PRESS_MS - pressAnimationPlayState);
1547
+ });
1548
+ if (this.growAnimation !== animation) {
1549
+ // A new press animation was started. The old animation was canceled and
1550
+ // should not finish the pressed state.
1551
+ return;
1552
+ }
1553
+ this.pressed = false;
1554
+ }
1555
+ /**
1556
+ * Returns `true` if
1557
+ * - the ripple element is enabled
1558
+ * - the pointer is primary for the input type
1559
+ * - the pointer is the pointer that started the interaction, or will start
1560
+ * the interaction
1561
+ * - the pointer is a touch, or the pointer state has the primary button
1562
+ * held, or the pointer is hovering
1563
+ */
1564
+ shouldReactToEvent(event) {
1565
+ if (this.disabled || !event.isPrimary) {
1566
+ return false;
1567
+ }
1568
+ if (this.rippleStartEvent && this.rippleStartEvent.pointerId !== event.pointerId) {
1569
+ return false;
1570
+ }
1571
+ if (event.type === 'pointerenter' || event.type === 'pointerleave') {
1572
+ return !this.isTouch(event);
1573
+ }
1574
+ const isPrimaryButton = event.buttons === 1;
1575
+ return this.isTouch(event) || isPrimaryButton;
1576
+ }
1577
+ /**
1578
+ * Check if the event is within the bounds of the element.
1579
+ *
1580
+ * This is only needed for the "stuck" contextmenu longpress on Chrome.
1581
+ */
1582
+ inBounds({
1583
+ x,
1584
+ y
1585
+ }) {
1586
+ const {
1587
+ top,
1588
+ left,
1589
+ bottom,
1590
+ right
1591
+ } = this.getBoundingClientRect();
1592
+ return x >= left && x <= right && y >= top && y <= bottom;
1593
+ }
1594
+ isTouch({
1595
+ pointerType
1596
+ }) {
1597
+ return pointerType === 'touch';
1598
+ }
1599
+ /** @private */
1600
+ async handleEvent(event) {
1601
+ if (FORCED_COLORS?.matches) {
1602
+ // Skip event logic since the ripple is `display: none`.
1603
+ return;
1604
+ }
1605
+ switch (event.type) {
1606
+ case 'click':
1607
+ this.handleClick();
1608
+ break;
1609
+ case 'contextmenu':
1610
+ this.handleContextmenu();
1611
+ break;
1612
+ case 'pointercancel':
1613
+ this.handlePointercancel(event);
1614
+ break;
1615
+ case 'pointerdown':
1616
+ await this.handlePointerdown(event);
1617
+ break;
1618
+ case 'pointerenter':
1619
+ this.handlePointerenter(event);
1620
+ break;
1621
+ case 'pointerleave':
1622
+ this.handlePointerleave(event);
1623
+ break;
1624
+ case 'pointerup':
1625
+ this.handlePointerup(event);
1626
+ break;
1627
+ }
1628
+ }
1629
+ onControlChange(prev, next) {
1630
+ for (const event of EVENTS) {
1631
+ prev?.removeEventListener(event, this);
1632
+ next?.addEventListener(event, this);
1633
+ }
1634
+ }
1635
+ }
1636
+ __decorate([n({
1637
+ type: Boolean,
1638
+ reflect: true
1639
+ })], Ripple.prototype, "disabled", void 0);
1640
+ __decorate([r()], Ripple.prototype, "hovered", void 0);
1641
+ __decorate([r()], Ripple.prototype, "pressed", void 0);
1642
+ __decorate([e$1('.surface')], Ripple.prototype, "mdRoot", void 0);
1643
+
1644
+ /**
1645
+ * @license
1646
+ * Copyright 2024 Google LLC
1647
+ * SPDX-License-Identifier: Apache-2.0
1648
+ */
1649
+ // Generated stylesheet for ./ripple/internal/ripple-styles.css.
1650
+ const styles$1 = i$4`:host{display:flex;margin:auto;pointer-events:none}:host([disabled]){display:none}@media(forced-colors: active){:host{display:none}}:host,.surface{border-radius:inherit;position:absolute;inset:0;overflow:hidden}.surface{-webkit-tap-highlight-color:rgba(0,0,0,0)}.surface::before,.surface::after{content:"";opacity:0;position:absolute}.surface::before{background-color:var(--md-ripple-hover-color, var(--md-sys-color-on-surface, #1d1b20));inset:0;transition:opacity 15ms linear,background-color 15ms linear}.surface::after{background:radial-gradient(closest-side, var(--md-ripple-pressed-color, var(--md-sys-color-on-surface, #1d1b20)) max(100% - 70px, 65%), transparent 100%);transform-origin:center center;transition:opacity 375ms linear}.hovered::before{background-color:var(--md-ripple-hover-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-ripple-hover-opacity, 0.08)}.pressed::after{opacity:var(--md-ripple-pressed-opacity, 0.12);transition-duration:105ms}
1651
+ `;
1652
+
1653
+ /**
1654
+ * @license
1655
+ * Copyright 2022 Google LLC
1656
+ * SPDX-License-Identifier: Apache-2.0
1657
+ */
1658
+ /**
1659
+ * @summary Ripples, also known as state layers, are visual indicators used to
1660
+ * communicate the status of a component or interactive element.
1661
+ *
1662
+ * @description A state layer is a semi-transparent covering on an element that
1663
+ * indicates its state. State layers provide a systematic approach to
1664
+ * visualizing states by using opacity. A layer can be applied to an entire
1665
+ * element or in a circular shape and only one state layer can be applied at a
1666
+ * given time.
1667
+ *
1668
+ * @final
1669
+ * @suppress {visibility}
1670
+ */
1671
+ let MdRipple = class MdRipple extends Ripple {};
1672
+ MdRipple.styles = [styles$1];
1673
+ MdRipple = __decorate([t('md-ripple')], MdRipple);
1674
+
1675
+ /**
1676
+ * @license
1677
+ * Copyright 2023 Google LLC
1678
+ * SPDX-License-Identifier: Apache-2.0
1679
+ */
1680
+ /**
1681
+ * Accessibility Object Model reflective aria properties.
1682
+ */
1683
+ const ARIA_PROPERTIES = ['role', 'ariaAtomic', 'ariaAutoComplete', 'ariaBusy', 'ariaChecked', 'ariaColCount', 'ariaColIndex', 'ariaColSpan', 'ariaCurrent', 'ariaDisabled', 'ariaExpanded', 'ariaHasPopup', 'ariaHidden', 'ariaInvalid', 'ariaKeyShortcuts', 'ariaLabel', 'ariaLevel', 'ariaLive', 'ariaModal', 'ariaMultiLine', 'ariaMultiSelectable', 'ariaOrientation', 'ariaPlaceholder', 'ariaPosInSet', 'ariaPressed', 'ariaReadOnly', 'ariaRequired', 'ariaRoleDescription', 'ariaRowCount', 'ariaRowIndex', 'ariaRowSpan', 'ariaSelected', 'ariaSetSize', 'ariaSort', 'ariaValueMax', 'ariaValueMin', 'ariaValueNow', 'ariaValueText'];
1684
+ /**
1685
+ * Accessibility Object Model aria attributes.
1686
+ */
1687
+ const ARIA_ATTRIBUTES = ARIA_PROPERTIES.map(ariaPropertyToAttribute);
1688
+ /**
1689
+ * Checks if an attribute is one of the AOM aria attributes.
1690
+ *
1691
+ * @example
1692
+ * isAriaAttribute('aria-label'); // true
1693
+ *
1694
+ * @param attribute The attribute to check.
1695
+ * @return True if the attribute is an aria attribute, or false if not.
1696
+ */
1697
+ function isAriaAttribute(attribute) {
1698
+ return ARIA_ATTRIBUTES.includes(attribute);
1699
+ }
1700
+ /**
1701
+ * Converts an AOM aria property into its corresponding attribute.
1702
+ *
1703
+ * @example
1704
+ * ariaPropertyToAttribute('ariaLabel'); // 'aria-label'
1705
+ *
1706
+ * @param property The aria property.
1707
+ * @return The aria attribute.
1708
+ */
1709
+ function ariaPropertyToAttribute(property) {
1710
+ return property.replace('aria', 'aria-')
1711
+ // IDREF attributes also include an "Element" or "Elements" suffix
1712
+ .replace(/Elements?/g, '').toLowerCase();
1713
+ }
1714
+
1715
+ /**
1716
+ * @license
1717
+ * Copyright 2023 Google LLC
1718
+ * SPDX-License-Identifier: Apache-2.0
1719
+ */
1720
+ // Private symbols
1721
+ const privateIgnoreAttributeChangesFor = Symbol('privateIgnoreAttributeChangesFor');
1722
+ /**
1723
+ * Mixes in aria delegation for elements that delegate focus and aria to inner
1724
+ * shadow root elements.
1725
+ *
1726
+ * This mixin fixes invalid aria announcements with shadow roots, caused by
1727
+ * duplicate aria attributes on both the host and the inner shadow root element.
1728
+ *
1729
+ * Note: this mixin **does not yet support** ID reference attributes, such as
1730
+ * `aria-labelledby` or `aria-controls`.
1731
+ *
1732
+ * @example
1733
+ * ```ts
1734
+ * class MyButton extends mixinDelegatesAria(LitElement) {
1735
+ * static shadowRootOptions = {mode: 'open', delegatesFocus: true};
1736
+ *
1737
+ * render() {
1738
+ * return html`
1739
+ * <button aria-label=${this.ariaLabel || nothing}>
1740
+ * <slot></slot>
1741
+ * </button>
1742
+ * `;
1743
+ * }
1744
+ * }
1745
+ * ```
1746
+ * ```html
1747
+ * <my-button aria-label="Plus one">+1</my-button>
1748
+ * ```
1749
+ *
1750
+ * Use `ARIAMixinStrict` for lit analyzer strict types, such as the "role"
1751
+ * attribute.
1752
+ *
1753
+ * @example
1754
+ * ```ts
1755
+ * return html`
1756
+ * <button role=${(this as ARIAMixinStrict).role || nothing}>
1757
+ * <slot></slot>
1758
+ * </button>
1759
+ * `;
1760
+ * ```
1761
+ *
1762
+ * In the future, updates to the Accessibility Object Model (AOM) will provide
1763
+ * built-in aria delegation features that will replace this mixin.
1764
+ *
1765
+ * @param base The class to mix functionality into.
1766
+ * @return The provided class with aria delegation mixed in.
1767
+ */
1768
+ function mixinDelegatesAria(base) {
1769
+ var _a;
1770
+ class WithDelegatesAriaElement extends base {
1771
+ constructor() {
1772
+ super(...arguments);
1773
+ this[_a] = new Set();
1774
+ }
1775
+ attributeChangedCallback(name, oldValue, newValue) {
1776
+ if (!isAriaAttribute(name)) {
1777
+ super.attributeChangedCallback(name, oldValue, newValue);
1778
+ return;
1779
+ }
1780
+ if (this[privateIgnoreAttributeChangesFor].has(name)) {
1781
+ return;
1782
+ }
1783
+ // Don't trigger another `attributeChangedCallback` once we remove the
1784
+ // aria attribute from the host. We check the explicit name of the
1785
+ // attribute to ignore since `attributeChangedCallback` can be called
1786
+ // multiple times out of an expected order when hydrating an element with
1787
+ // multiple attributes.
1788
+ this[privateIgnoreAttributeChangesFor].add(name);
1789
+ this.removeAttribute(name);
1790
+ this[privateIgnoreAttributeChangesFor].delete(name);
1791
+ const dataProperty = ariaAttributeToDataProperty(name);
1792
+ if (newValue === null) {
1793
+ delete this.dataset[dataProperty];
1794
+ } else {
1795
+ this.dataset[dataProperty] = newValue;
1796
+ }
1797
+ this.requestUpdate(ariaAttributeToDataProperty(name), oldValue);
1798
+ }
1799
+ getAttribute(name) {
1800
+ if (isAriaAttribute(name)) {
1801
+ return super.getAttribute(ariaAttributeToDataAttribute(name));
1802
+ }
1803
+ return super.getAttribute(name);
1804
+ }
1805
+ removeAttribute(name) {
1806
+ super.removeAttribute(name);
1807
+ if (isAriaAttribute(name)) {
1808
+ super.removeAttribute(ariaAttributeToDataAttribute(name));
1809
+ // Since `aria-*` attributes are already removed`, we need to request
1810
+ // an update because `attributeChangedCallback` will not be called.
1811
+ this.requestUpdate();
1812
+ }
1813
+ }
1814
+ }
1815
+ _a = privateIgnoreAttributeChangesFor;
1816
+ setupDelegatesAriaProperties(WithDelegatesAriaElement);
1817
+ return WithDelegatesAriaElement;
1818
+ }
1819
+ /**
1820
+ * Overrides the constructor's native `ARIAMixin` properties to ensure that
1821
+ * aria properties reflect the values that were shifted to a data attribute.
1822
+ *
1823
+ * @param ctor The `ReactiveElement` constructor to patch.
1824
+ */
1825
+ function setupDelegatesAriaProperties(ctor) {
1826
+ for (const ariaProperty of ARIA_PROPERTIES) {
1827
+ // The casing between ariaProperty and the dataProperty may be different.
1828
+ // ex: aria-haspopup -> ariaHasPopup
1829
+ const ariaAttribute = ariaPropertyToAttribute(ariaProperty);
1830
+ // ex: aria-haspopup -> data-aria-haspopup
1831
+ const dataAttribute = ariaAttributeToDataAttribute(ariaAttribute);
1832
+ // ex: aria-haspopup -> dataset.ariaHaspopup
1833
+ const dataProperty = ariaAttributeToDataProperty(ariaAttribute);
1834
+ // Call `ReactiveElement.createProperty()` so that the `aria-*` and `data-*`
1835
+ // attributes are added to the `static observedAttributes` array. This
1836
+ // triggers `attributeChangedCallback` for the delegates aria mixin to
1837
+ // handle.
1838
+ ctor.createProperty(ariaProperty, {
1839
+ attribute: ariaAttribute,
1840
+ noAccessor: true
1841
+ });
1842
+ ctor.createProperty(Symbol(dataAttribute), {
1843
+ attribute: dataAttribute,
1844
+ noAccessor: true
1845
+ });
1846
+ // Re-define the `ARIAMixin` properties to handle data attribute shifting.
1847
+ // It is safe to use `Object.defineProperty` here because the properties
1848
+ // are native and not renamed.
1849
+ // tslint:disable-next-line:ban-unsafe-reflection
1850
+ Object.defineProperty(ctor.prototype, ariaProperty, {
1851
+ configurable: true,
1852
+ enumerable: true,
1853
+ get() {
1854
+ return this.dataset[dataProperty] ?? null;
1855
+ },
1856
+ set(value) {
1857
+ const prevValue = this.dataset[dataProperty] ?? null;
1858
+ if (value === prevValue) {
1859
+ return;
1860
+ }
1861
+ if (value === null) {
1862
+ delete this.dataset[dataProperty];
1863
+ } else {
1864
+ this.dataset[dataProperty] = value;
1865
+ }
1866
+ this.requestUpdate(ariaProperty, prevValue);
1867
+ }
1868
+ });
1869
+ }
1870
+ }
1871
+ function ariaAttributeToDataAttribute(ariaAttribute) {
1872
+ // aria-haspopup -> data-aria-haspopup
1873
+ return `data-${ariaAttribute}`;
1874
+ }
1875
+ function ariaAttributeToDataProperty(ariaAttribute) {
1876
+ // aria-haspopup -> dataset.ariaHaspopup
1877
+ return ariaAttribute.replace(/-\w/, dashLetter => dashLetter[1].toUpperCase());
1878
+ }
1879
+
1880
+ /**
1881
+ * @license
1882
+ * Copyright 2023 Google LLC
1883
+ * SPDX-License-Identifier: Apache-2.0
1884
+ */
1885
+ /**
1886
+ * A symbol used to access dispatch hooks on an event.
1887
+ */
1888
+ const dispatchHooks = Symbol('dispatchHooks');
1889
+ /**
1890
+ * Add a hook for an event that is called after the event is dispatched and
1891
+ * propagates to other event listeners.
1892
+ *
1893
+ * This is useful for behaviors that need to check if an event is canceled.
1894
+ *
1895
+ * The callback is invoked synchronously, which allows for better integration
1896
+ * with synchronous platform APIs (like `<form>` or `<label>` clicking).
1897
+ *
1898
+ * Note: `setupDispatchHooks()` must be called on the element before adding any
1899
+ * other event listeners. Call it in the constructor of an element or
1900
+ * controller.
1901
+ *
1902
+ * @example
1903
+ * ```ts
1904
+ * class MyControl extends LitElement {
1905
+ * constructor() {
1906
+ * super();
1907
+ * setupDispatchHooks(this, 'click');
1908
+ * this.addEventListener('click', event => {
1909
+ * afterDispatch(event, () => {
1910
+ * if (event.defaultPrevented) {
1911
+ * return
1912
+ * }
1913
+ *
1914
+ * // ... perform logic
1915
+ * });
1916
+ * });
1917
+ * }
1918
+ * }
1919
+ * ```
1920
+ *
1921
+ * @example
1922
+ * ```ts
1923
+ * class MyController implements ReactiveController {
1924
+ * constructor(host: ReactiveElement) {
1925
+ * // setupDispatchHooks() may be called multiple times for the same
1926
+ * // element and events, making it safe for multiple controllers to use it.
1927
+ * setupDispatchHooks(host, 'click');
1928
+ * host.addEventListener('click', event => {
1929
+ * afterDispatch(event, () => {
1930
+ * if (event.defaultPrevented) {
1931
+ * return;
1932
+ * }
1933
+ *
1934
+ * // ... perform logic
1935
+ * });
1936
+ * });
1937
+ * }
1938
+ * }
1939
+ * ```
1940
+ *
1941
+ * @param event The event to add a hook to.
1942
+ * @param callback A hook that is called after the event finishes dispatching.
1943
+ */
1944
+ function afterDispatch(event, callback) {
1945
+ const hooks = event[dispatchHooks];
1946
+ if (!hooks) {
1947
+ throw new Error(`'${event.type}' event needs setupDispatchHooks().`);
1948
+ }
1949
+ hooks.addEventListener('after', callback);
1950
+ }
1951
+ /**
1952
+ * A lookup map of elements and event types that have a dispatch hook listener
1953
+ * set up. Used to ensure we don't set up multiple hook listeners on the same
1954
+ * element for the same event.
1955
+ */
1956
+ const ELEMENT_DISPATCH_HOOK_TYPES = new WeakMap();
1957
+ /**
1958
+ * Sets up an element to add dispatch hooks to given event types. This must be
1959
+ * called before adding any event listeners that need to use dispatch hooks
1960
+ * like `afterDispatch()`.
1961
+ *
1962
+ * This function is safe to call multiple times with the same element or event
1963
+ * types. Call it in the constructor of elements, mixins, and controllers to
1964
+ * ensure it is set up before external listeners.
1965
+ *
1966
+ * @example
1967
+ * ```ts
1968
+ * class MyControl extends LitElement {
1969
+ * constructor() {
1970
+ * super();
1971
+ * setupDispatchHooks(this, 'click');
1972
+ * this.addEventListener('click', this.listenerUsingAfterDispatch);
1973
+ * }
1974
+ * }
1975
+ * ```
1976
+ *
1977
+ * @param element The element to set up event dispatch hooks for.
1978
+ * @param eventTypes The event types to add dispatch hooks to.
1979
+ */
1980
+ function setupDispatchHooks(element, ...eventTypes) {
1981
+ let typesAlreadySetUp = ELEMENT_DISPATCH_HOOK_TYPES.get(element);
1982
+ if (!typesAlreadySetUp) {
1983
+ typesAlreadySetUp = new Set();
1984
+ ELEMENT_DISPATCH_HOOK_TYPES.set(element, typesAlreadySetUp);
1985
+ }
1986
+ for (const eventType of eventTypes) {
1987
+ // Don't register multiple dispatch hook listeners. A second registration
1988
+ // would lead to the second listener re-dispatching a re-dispatched event,
1989
+ // which can cause an infinite loop inside the other one.
1990
+ if (typesAlreadySetUp.has(eventType)) {
1991
+ continue;
1992
+ }
1993
+ // When we re-dispatch the event, it's going to immediately trigger this
1994
+ // listener again. Use a flag to ignore it.
1995
+ let isRedispatching = false;
1996
+ element.addEventListener(eventType, event => {
1997
+ if (isRedispatching) {
1998
+ return;
1999
+ }
2000
+ // Do not let the event propagate to any other listener (not just
2001
+ // bubbling listeners with `stopPropagation()`).
2002
+ event.stopImmediatePropagation();
2003
+ // Make a copy.
2004
+ const eventCopy = Reflect.construct(event.constructor, [event.type, event]);
2005
+ // Add hooks onto the event.
2006
+ const hooks = new EventTarget();
2007
+ eventCopy[dispatchHooks] = hooks;
2008
+ // Re-dispatch the event. We can't reuse `redispatchEvent()` since we
2009
+ // need to add the hooks to the copy before it's dispatched.
2010
+ isRedispatching = true;
2011
+ const dispatched = element.dispatchEvent(eventCopy);
2012
+ isRedispatching = false;
2013
+ if (!dispatched) {
2014
+ event.preventDefault();
2015
+ }
2016
+ // Synchronously call afterDispatch() hooks.
2017
+ hooks.dispatchEvent(new Event('after'));
2018
+ }, {
2019
+ // Ensure this listener runs before other listeners.
2020
+ // `setupDispatchHooks()` should be called in constructors to also
2021
+ // ensure they run before any other externally-added capture listeners.
2022
+ capture: true
2023
+ });
2024
+ typesAlreadySetUp.add(eventType);
2025
+ }
2026
+ }
2027
+
2028
+ /**
2029
+ * @license
2030
+ * Copyright 2021 Google LLC
2031
+ * SPDX-License-Identifier: Apache-2.0
2032
+ */
2033
+ /**
2034
+ * Dispatches a click event to the given element that triggers a native action,
2035
+ * but is not composed and therefore is not seen outside the element.
2036
+ *
2037
+ * This is useful for responding to an external click event on the host element
2038
+ * that should trigger an internal action like a button click.
2039
+ *
2040
+ * Note, a helper is provided because setting this up correctly is a bit tricky.
2041
+ * In particular, calling `click` on an element creates a composed event, which
2042
+ * is not desirable, and a manually dispatched event must specifically be a
2043
+ * `MouseEvent` to trigger a native action.
2044
+ *
2045
+ * @example
2046
+ * hostClickListener = (event: MouseEvent) {
2047
+ * if (isActivationClick(event)) {
2048
+ * this.dispatchActivationClick(this.buttonElement);
2049
+ * }
2050
+ * }
2051
+ *
2052
+ */
2053
+ function dispatchActivationClick(element) {
2054
+ const event = new MouseEvent('click', {
2055
+ bubbles: true
2056
+ });
2057
+ element.dispatchEvent(event);
2058
+ return event;
2059
+ }
2060
+ /**
2061
+ * Returns true if the click event should trigger an activation behavior. The
2062
+ * behavior is defined by the element and is whatever it should do when
2063
+ * clicked.
2064
+ *
2065
+ * Typically when an element needs to handle a click, the click is generated
2066
+ * from within the element and an event listener within the element implements
2067
+ * the needed behavior; however, it's possible to fire a click directly
2068
+ * at the element that the element should handle. This method helps
2069
+ * distinguish these "external" clicks.
2070
+ *
2071
+ * An "external" click can be triggered in a number of ways: via a click
2072
+ * on an associated label for a form associated element, calling
2073
+ * `element.click()`, or calling
2074
+ * `element.dispatchEvent(new MouseEvent('click', ...))`.
2075
+ *
2076
+ * Also works around Firefox issue
2077
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=1804576 by squelching
2078
+ * events for a microtask after called.
2079
+ *
2080
+ * @example
2081
+ * hostClickListener = (event: MouseEvent) {
2082
+ * if (isActivationClick(event)) {
2083
+ * this.dispatchActivationClick(this.buttonElement);
2084
+ * }
2085
+ * }
2086
+ *
2087
+ */
2088
+ function isActivationClick(event) {
2089
+ // Event must start at the event target.
2090
+ if (event.currentTarget !== event.target) {
2091
+ return false;
2092
+ }
2093
+ // Event must not be retargeted from shadowRoot.
2094
+ if (event.composedPath()[0] !== event.target) {
2095
+ return false;
2096
+ }
2097
+ // Target must not be disabled; this should only occur for a synthetically
2098
+ // dispatched click.
2099
+ if (event.target.disabled) {
2100
+ return false;
2101
+ }
2102
+ // This is an activation if the event should not be squelched.
2103
+ return !squelchEvent(event);
2104
+ }
2105
+ // TODO(https://bugzilla.mozilla.org/show_bug.cgi?id=1804576)
2106
+ // Remove when Firefox bug is addressed.
2107
+ function squelchEvent(event) {
2108
+ const squelched = isSquelchingEvents;
2109
+ if (squelched) {
2110
+ event.preventDefault();
2111
+ event.stopImmediatePropagation();
2112
+ }
2113
+ squelchEventsForMicrotask();
2114
+ return squelched;
2115
+ }
2116
+ // Ignore events for one microtask only.
2117
+ let isSquelchingEvents = false;
2118
+ async function squelchEventsForMicrotask() {
2119
+ isSquelchingEvents = true;
2120
+ // Need to pause for just one microtask.
2121
+ // tslint:disable-next-line
2122
+ await null;
2123
+ isSquelchingEvents = false;
2124
+ }
2125
+
2126
+ /**
2127
+ * @license
2128
+ * Copyright 2021 Google LLC
2129
+ * SPDX-License-Identifier: Apache-2.0
2130
+ */
2131
+ /**
2132
+ * Re-dispatches an event from the provided element.
2133
+ *
2134
+ * This function is useful for forwarding non-composed events, such as `change`
2135
+ * events.
2136
+ *
2137
+ * @example
2138
+ * class MyInput extends LitElement {
2139
+ * render() {
2140
+ * return html`<input @change=${this.redispatchEvent}>`;
2141
+ * }
2142
+ *
2143
+ * protected redispatchEvent(event: Event) {
2144
+ * redispatchEvent(this, event);
2145
+ * }
2146
+ * }
2147
+ *
2148
+ * @param element The element to dispatch the event from.
2149
+ * @param event The event to re-dispatch.
2150
+ * @return Whether or not the event was dispatched (if cancelable).
2151
+ */
2152
+ function redispatchEvent(element, event) {
2153
+ // For bubbling events in SSR light DOM (or composed), stop their propagation
2154
+ // and dispatch the copy.
2155
+ if (event.bubbles && (!element.shadowRoot || event.composed)) {
2156
+ event.stopPropagation();
2157
+ }
2158
+ const copy = Reflect.construct(event.constructor, [event.type, event]);
2159
+ const dispatched = element.dispatchEvent(copy);
2160
+ if (!dispatched) {
2161
+ event.preventDefault();
2162
+ }
2163
+ return dispatched;
2164
+ }
2165
+
2166
+ /**
2167
+ * @license
2168
+ * Copyright 2023 Google LLC
2169
+ * SPDX-License-Identifier: Apache-2.0
2170
+ */
2171
+ /**
2172
+ * A unique symbol used for protected access to an instance's
2173
+ * `ElementInternals`.
2174
+ *
2175
+ * @example
2176
+ * ```ts
2177
+ * class MyElement extends mixinElementInternals(LitElement) {
2178
+ * constructor() {
2179
+ * super();
2180
+ * this[internals].role = 'button';
2181
+ * }
2182
+ * }
2183
+ * ```
2184
+ */
2185
+ const internals = Symbol('internals');
2186
+ // Private symbols
2187
+ const privateInternals = Symbol('privateInternals');
2188
+ /**
2189
+ * Mixes in an attached `ElementInternals` instance.
2190
+ *
2191
+ * This mixin is only needed when other shared code needs access to a
2192
+ * component's `ElementInternals`, such as form-associated mixins.
2193
+ *
2194
+ * @param base The class to mix functionality into.
2195
+ * @return The provided class with `WithElementInternals` mixed in.
2196
+ */
2197
+ function mixinElementInternals(base) {
2198
+ class WithElementInternalsElement extends base {
2199
+ get [internals]() {
2200
+ // Create internals in getter so that it can be used in methods called on
2201
+ // construction in `ReactiveElement`, such as `requestUpdate()`.
2202
+ if (!this[privateInternals]) {
2203
+ // Cast needed for closure
2204
+ this[privateInternals] = this.attachInternals();
2205
+ }
2206
+ return this[privateInternals];
2207
+ }
2208
+ }
2209
+ return WithElementInternalsElement;
2210
+ }
2211
+
2212
+ /**
2213
+ * @license
2214
+ * Copyright 2023 Google LLC
2215
+ * SPDX-License-Identifier: Apache-2.0
2216
+ */
2217
+ /**
2218
+ * A symbol property used to create a constraint validation `Validator`.
2219
+ * Required for all `mixinConstraintValidation()` elements.
2220
+ */
2221
+ const createValidator = Symbol('createValidator');
2222
+ /**
2223
+ * A symbol property used to return an anchor for constraint validation popups.
2224
+ * Required for all `mixinConstraintValidation()` elements.
2225
+ */
2226
+ const getValidityAnchor = Symbol('getValidityAnchor');
2227
+ // Private symbol members, used to avoid name clashing.
2228
+ const privateValidator = Symbol('privateValidator');
2229
+ const privateSyncValidity = Symbol('privateSyncValidity');
2230
+ const privateCustomValidationMessage = Symbol('privateCustomValidationMessage');
2231
+ /**
2232
+ * Mixes in constraint validation APIs for an element.
2233
+ *
2234
+ * See https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
2235
+ * for more details.
2236
+ *
2237
+ * Implementations must provide a validator to cache and compute its validity,
2238
+ * along with a shadow root element to anchor validation popups to.
2239
+ *
2240
+ * @example
2241
+ * ```ts
2242
+ * const baseClass = mixinConstraintValidation(
2243
+ * mixinFormAssociated(mixinElementInternals(LitElement))
2244
+ * );
2245
+ *
2246
+ * class MyCheckbox extends baseClass {
2247
+ * \@property({type: Boolean}) checked = false;
2248
+ * \@property({type: Boolean}) required = false;
2249
+ *
2250
+ * [createValidator]() {
2251
+ * return new CheckboxValidator(() => this);
2252
+ * }
2253
+ *
2254
+ * [getValidityAnchor]() {
2255
+ * return this.renderRoot.querySelector('.root');
2256
+ * }
2257
+ * }
2258
+ * ```
2259
+ *
2260
+ * @param base The class to mix functionality into.
2261
+ * @return The provided class with `ConstraintValidation` mixed in.
2262
+ */
2263
+ function mixinConstraintValidation(base) {
2264
+ var _a;
2265
+ class ConstraintValidationElement extends base {
2266
+ constructor() {
2267
+ super(...arguments);
2268
+ /**
2269
+ * Needed for Safari, see https://bugs.webkit.org/show_bug.cgi?id=261432
2270
+ * Replace with this[internals].validity.customError when resolved.
2271
+ */
2272
+ this[_a] = '';
2273
+ }
2274
+ get validity() {
2275
+ this[privateSyncValidity]();
2276
+ return this[internals].validity;
2277
+ }
2278
+ get validationMessage() {
2279
+ this[privateSyncValidity]();
2280
+ return this[internals].validationMessage;
2281
+ }
2282
+ get willValidate() {
2283
+ this[privateSyncValidity]();
2284
+ return this[internals].willValidate;
2285
+ }
2286
+ checkValidity() {
2287
+ this[privateSyncValidity]();
2288
+ return this[internals].checkValidity();
2289
+ }
2290
+ reportValidity() {
2291
+ this[privateSyncValidity]();
2292
+ return this[internals].reportValidity();
2293
+ }
2294
+ setCustomValidity(error) {
2295
+ this[privateCustomValidationMessage] = error;
2296
+ this[privateSyncValidity]();
2297
+ }
2298
+ requestUpdate(name, oldValue, options) {
2299
+ super.requestUpdate(name, oldValue, options);
2300
+ this[privateSyncValidity]();
2301
+ }
2302
+ firstUpdated(changed) {
2303
+ super.firstUpdated(changed);
2304
+ // Sync the validity again when the element first renders, since the
2305
+ // validity anchor is now available.
2306
+ //
2307
+ // Elements that `delegatesFocus: true` to an `<input>` will throw an
2308
+ // error in Chrome and Safari when a form tries to submit or call
2309
+ // `form.reportValidity()`:
2310
+ // "An invalid form control with name='' is not focusable"
2311
+ //
2312
+ // The validity anchor MUST be provided in `internals.setValidity()` and
2313
+ // MUST be the `<input>` element rendered.
2314
+ //
2315
+ // See https://lit.dev/playground/#gist=6c26e418e0010f7a5aac15005cde8bde
2316
+ // for a reproduction.
2317
+ this[privateSyncValidity]();
2318
+ }
2319
+ [(_a = privateCustomValidationMessage, privateSyncValidity)]() {
2320
+ if (!this[privateValidator]) {
2321
+ this[privateValidator] = this[createValidator]();
2322
+ }
2323
+ const {
2324
+ validity,
2325
+ validationMessage: nonCustomValidationMessage
2326
+ } = this[privateValidator].getValidity();
2327
+ const customError = !!this[privateCustomValidationMessage];
2328
+ const validationMessage = this[privateCustomValidationMessage] || nonCustomValidationMessage;
2329
+ this[internals].setValidity({
2330
+ ...validity,
2331
+ customError
2332
+ }, validationMessage, this[getValidityAnchor]() ?? undefined);
2333
+ }
2334
+ [createValidator]() {
2335
+ throw new Error('Implement [createValidator]');
2336
+ }
2337
+ [getValidityAnchor]() {
2338
+ throw new Error('Implement [getValidityAnchor]');
2339
+ }
2340
+ }
2341
+ return ConstraintValidationElement;
2342
+ }
2343
+
2344
+ /**
2345
+ * @license
2346
+ * Copyright 2023 Google LLC
2347
+ * SPDX-License-Identifier: Apache-2.0
2348
+ */
2349
+ /**
2350
+ * A symbol property to retrieve the form value for an element.
2351
+ */
2352
+ const getFormValue = Symbol('getFormValue');
2353
+ /**
2354
+ * A symbol property to retrieve the form state for an element.
2355
+ */
2356
+ const getFormState = Symbol('getFormState');
2357
+ /**
2358
+ * Mixes in form-associated behavior for a class. This allows an element to add
2359
+ * values to `<form>` elements.
2360
+ *
2361
+ * Implementing classes should provide a `[formValue]` to return the current
2362
+ * value of the element, as well as reset and restore callbacks.
2363
+ *
2364
+ * @example
2365
+ * ```ts
2366
+ * const base = mixinFormAssociated(mixinElementInternals(LitElement));
2367
+ *
2368
+ * class MyControl extends base {
2369
+ * \@property()
2370
+ * value = '';
2371
+ *
2372
+ * override [getFormValue]() {
2373
+ * return this.value;
2374
+ * }
2375
+ *
2376
+ * override formResetCallback() {
2377
+ * const defaultValue = this.getAttribute('value');
2378
+ * this.value = defaultValue;
2379
+ * }
2380
+ *
2381
+ * override formStateRestoreCallback(state: string) {
2382
+ * this.value = state;
2383
+ * }
2384
+ * }
2385
+ * ```
2386
+ *
2387
+ * Elements may optionally provide a `[formState]` if their values do not
2388
+ * represent the state of the component.
2389
+ *
2390
+ * @example
2391
+ * ```ts
2392
+ * const base = mixinFormAssociated(mixinElementInternals(LitElement));
2393
+ *
2394
+ * class MyCheckbox extends base {
2395
+ * \@property()
2396
+ * value = 'on';
2397
+ *
2398
+ * \@property({type: Boolean})
2399
+ * checked = false;
2400
+ *
2401
+ * override [getFormValue]() {
2402
+ * return this.checked ? this.value : null;
2403
+ * }
2404
+ *
2405
+ * override [getFormState]() {
2406
+ * return String(this.checked);
2407
+ * }
2408
+ *
2409
+ * override formResetCallback() {
2410
+ * const defaultValue = this.hasAttribute('checked');
2411
+ * this.checked = defaultValue;
2412
+ * }
2413
+ *
2414
+ * override formStateRestoreCallback(state: string) {
2415
+ * this.checked = Boolean(state);
2416
+ * }
2417
+ * }
2418
+ * ```
2419
+ *
2420
+ * IMPORTANT: Requires declares for lit-analyzer
2421
+ * @example
2422
+ * ```ts
2423
+ * const base = mixinFormAssociated(mixinElementInternals(LitElement));
2424
+ * class MyControl extends base {
2425
+ * // Writable mixin properties for lit-html binding, needed for lit-analyzer
2426
+ * declare disabled: boolean;
2427
+ * declare name: string;
2428
+ * }
2429
+ * ```
2430
+ *
2431
+ * @param base The class to mix functionality into. The base class must use
2432
+ * `mixinElementInternals()`.
2433
+ * @return The provided class with `FormAssociated` mixed in.
2434
+ */
2435
+ function mixinFormAssociated(base) {
2436
+ class FormAssociatedElement extends base {
2437
+ get form() {
2438
+ return this[internals].form;
2439
+ }
2440
+ get labels() {
2441
+ return this[internals].labels;
2442
+ }
2443
+ // Use @property for the `name` and `disabled` properties to add them to the
2444
+ // `observedAttributes` array and trigger `attributeChangedCallback()`.
2445
+ //
2446
+ // We don't use Lit's default getter/setter (`noAccessor: true`) because
2447
+ // the attributes need to be updated synchronously to work with synchronous
2448
+ // form APIs, and Lit updates attributes async by default.
2449
+ get name() {
2450
+ return this.getAttribute('name') ?? '';
2451
+ }
2452
+ set name(name) {
2453
+ // Note: setting name to null or empty does not remove the attribute.
2454
+ this.setAttribute('name', name);
2455
+ // We don't need to call `requestUpdate()` since it's called synchronously
2456
+ // in `attributeChangedCallback()`.
2457
+ }
2458
+ get disabled() {
2459
+ return this.hasAttribute('disabled');
2460
+ }
2461
+ set disabled(disabled) {
2462
+ this.toggleAttribute('disabled', disabled);
2463
+ // We don't need to call `requestUpdate()` since it's called synchronously
2464
+ // in `attributeChangedCallback()`.
2465
+ }
2466
+ attributeChangedCallback(name, old, value) {
2467
+ // Manually `requestUpdate()` for `name` and `disabled` when their
2468
+ // attribute or property changes.
2469
+ // The properties update their attributes, so this callback is invoked
2470
+ // immediately when the properties are set. We call `requestUpdate()` here
2471
+ // instead of letting Lit set the properties from the attribute change.
2472
+ // That would cause the properties to re-set the attribute and invoke this
2473
+ // callback again in a loop. This leads to stale state when Lit tries to
2474
+ // determine if a property changed or not.
2475
+ if (name === 'name' || name === 'disabled') {
2476
+ // Disabled's value is only false if the attribute is missing and null.
2477
+ const oldValue = name === 'disabled' ? old !== null : old;
2478
+ // Trigger a lit update when the attribute changes.
2479
+ this.requestUpdate(name, oldValue);
2480
+ return;
2481
+ }
2482
+ super.attributeChangedCallback(name, old, value);
2483
+ }
2484
+ requestUpdate(name, oldValue, options) {
2485
+ super.requestUpdate(name, oldValue, options);
2486
+ // If any properties change, update the form value, which may have changed
2487
+ // as well.
2488
+ // Update the form value synchronously in `requestUpdate()` rather than
2489
+ // `update()` or `updated()`, which are async. This is necessary to ensure
2490
+ // that form data is updated in time for synchronous event listeners.
2491
+ this[internals].setFormValue(this[getFormValue](), this[getFormState]());
2492
+ }
2493
+ [getFormValue]() {
2494
+ // Closure does not allow abstract symbol members, so a default
2495
+ // implementation is needed.
2496
+ throw new Error('Implement [getFormValue]');
2497
+ }
2498
+ [getFormState]() {
2499
+ return this[getFormValue]();
2500
+ }
2501
+ formDisabledCallback(disabled) {
2502
+ this.disabled = disabled;
2503
+ }
2504
+ }
2505
+ /** @nocollapse */
2506
+ FormAssociatedElement.formAssociated = true;
2507
+ __decorate([n({
2508
+ noAccessor: true
2509
+ })], FormAssociatedElement.prototype, "name", null);
2510
+ __decorate([n({
2511
+ type: Boolean,
2512
+ noAccessor: true
2513
+ })], FormAssociatedElement.prototype, "disabled", null);
2514
+ return FormAssociatedElement;
2515
+ }
2516
+
2517
+ /**
2518
+ * @license
2519
+ * Copyright 2023 Google LLC
2520
+ * SPDX-License-Identifier: Apache-2.0
2521
+ */
2522
+ /**
2523
+ * A class that computes and caches `ValidityStateFlags` for a component with
2524
+ * a given `State` interface.
2525
+ *
2526
+ * Cached performance before computing validity is important since constraint
2527
+ * validation must be checked frequently and synchronously when properties
2528
+ * change.
2529
+ *
2530
+ * @template State The expected interface of properties relevant to constraint
2531
+ * validation.
2532
+ */
2533
+ class Validator {
2534
+ /**
2535
+ * Creates a new validator.
2536
+ *
2537
+ * @param getCurrentState A callback that returns the current state of
2538
+ * constraint validation-related properties.
2539
+ */
2540
+ constructor(getCurrentState) {
2541
+ this.getCurrentState = getCurrentState;
2542
+ /**
2543
+ * The current validity state and message. This is cached and returns if
2544
+ * constraint validation state does not change.
2545
+ */
2546
+ this.currentValidity = {
2547
+ validity: {},
2548
+ validationMessage: ''
2549
+ };
2550
+ }
2551
+ /**
2552
+ * Returns the current `ValidityStateFlags` and validation message for the
2553
+ * validator.
2554
+ *
2555
+ * If the constraint validation state has not changed, this will return a
2556
+ * cached result. This is important since `getValidity()` can be called
2557
+ * frequently in response to synchronous property changes.
2558
+ *
2559
+ * @return The current validity and validation message.
2560
+ */
2561
+ getValidity() {
2562
+ const state = this.getCurrentState();
2563
+ const hasStateChanged = !this.prevState || !this.equals(this.prevState, state);
2564
+ if (!hasStateChanged) {
2565
+ return this.currentValidity;
2566
+ }
2567
+ const {
2568
+ validity,
2569
+ validationMessage
2570
+ } = this.computeValidity(state);
2571
+ this.prevState = this.copy(state);
2572
+ this.currentValidity = {
2573
+ validationMessage,
2574
+ validity: {
2575
+ // Change any `ValidityState` instances into `ValidityStateFlags` since
2576
+ // `ValidityState` cannot be easily `{...spread}`.
2577
+ badInput: validity.badInput,
2578
+ customError: validity.customError,
2579
+ patternMismatch: validity.patternMismatch,
2580
+ rangeOverflow: validity.rangeOverflow,
2581
+ rangeUnderflow: validity.rangeUnderflow,
2582
+ stepMismatch: validity.stepMismatch,
2583
+ tooLong: validity.tooLong,
2584
+ tooShort: validity.tooShort,
2585
+ typeMismatch: validity.typeMismatch,
2586
+ valueMissing: validity.valueMissing
2587
+ }
2588
+ };
2589
+ return this.currentValidity;
2590
+ }
2591
+ }
2592
+
2593
+ /**
2594
+ * @license
2595
+ * Copyright 2023 Google LLC
2596
+ * SPDX-License-Identifier: Apache-2.0
2597
+ */
2598
+ /**
2599
+ * A validator that provides constraint validation that emulates
2600
+ * `<input type="checkbox">` validation.
2601
+ */
2602
+ class CheckboxValidator extends Validator {
2603
+ computeValidity(state) {
2604
+ if (!this.checkboxControl) {
2605
+ // Lazily create the platform input
2606
+ this.checkboxControl = document.createElement('input');
2607
+ this.checkboxControl.type = 'checkbox';
2608
+ }
2609
+ this.checkboxControl.checked = state.checked;
2610
+ this.checkboxControl.required = state.required;
2611
+ return {
2612
+ validity: this.checkboxControl.validity,
2613
+ validationMessage: this.checkboxControl.validationMessage
2614
+ };
2615
+ }
2616
+ equals(prev, next) {
2617
+ return prev.checked === next.checked && prev.required === next.required;
2618
+ }
2619
+ copy({
2620
+ checked,
2621
+ required
2622
+ }) {
2623
+ return {
2624
+ checked,
2625
+ required
2626
+ };
2627
+ }
2628
+ }
2629
+
2630
+ /**
2631
+ * @license
2632
+ * Copyright 2021 Google LLC
2633
+ * SPDX-License-Identifier: Apache-2.0
2634
+ */
2635
+ // Separate variable needed for closure.
2636
+ const switchBaseClass = mixinDelegatesAria(mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(i$1))));
2637
+ /**
2638
+ * @fires input {InputEvent} Fired whenever `selected` changes due to user
2639
+ * interaction (bubbles and composed).
2640
+ * @fires change {Event} Fired whenever `selected` changes due to user
2641
+ * interaction (bubbles).
2642
+ */
2643
+ class Switch extends switchBaseClass {
2644
+ constructor() {
2645
+ super();
2646
+ /**
2647
+ * Puts the switch in the selected state and sets the form submission value to
2648
+ * the `value` property.
2649
+ */
2650
+ this.selected = false;
2651
+ /**
2652
+ * Shows both the selected and deselected icons.
2653
+ */
2654
+ this.icons = false;
2655
+ /**
2656
+ * Shows only the selected icon, and not the deselected icon. If `true`,
2657
+ * overrides the behavior of the `icons` property.
2658
+ */
2659
+ this.showOnlySelectedIcon = false;
2660
+ /**
2661
+ * When true, require the switch to be selected when participating in
2662
+ * form submission.
2663
+ *
2664
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#validation
2665
+ */
2666
+ this.required = false;
2667
+ /**
2668
+ * The value associated with this switch on form submission. `null` is
2669
+ * submitted when `selected` is `false`.
2670
+ */
2671
+ this.value = 'on';
2672
+ // This click listener does not currently need dispatch hooks since it does
2673
+ // not check `event.defaultPrevented`.
2674
+ this.addEventListener('click', event => {
2675
+ if (!isActivationClick(event) || !this.input) {
2676
+ return;
2677
+ }
2678
+ this.focus();
2679
+ dispatchActivationClick(this.input);
2680
+ });
2681
+ // Add the aria keyboard interaction pattern for switch and the Enter key.
2682
+ // See https://www.w3.org/WAI/ARIA/apg/patterns/switch/.
2683
+ setupDispatchHooks(this, 'keydown');
2684
+ this.addEventListener('keydown', event => {
2685
+ afterDispatch(event, () => {
2686
+ const ignoreEvent = event.defaultPrevented || event.key !== 'Enter';
2687
+ if (ignoreEvent || this.disabled || !this.input) {
2688
+ return;
2689
+ }
2690
+ this.input.click();
2691
+ });
2692
+ });
2693
+ }
2694
+ render() {
2695
+ return x`
2696
+ <div class="switch ${e(this.getRenderClasses())}">
2697
+ <input
2698
+ id="switch"
2699
+ class="touch"
2700
+ type="checkbox"
2701
+ role="switch"
2702
+ aria-label=${this.ariaLabel || E}
2703
+ ?checked=${this.selected}
2704
+ ?disabled=${this.disabled}
2705
+ ?required=${this.required}
2706
+ @input=${this.handleInput}
2707
+ @change=${this.handleChange} />
2708
+
2709
+ <md-focus-ring part="focus-ring" for="switch"></md-focus-ring>
2710
+ <span class="track"> ${this.renderHandle()} </span>
2711
+ </div>
2712
+ `;
2713
+ }
2714
+ getRenderClasses() {
2715
+ return {
2716
+ 'selected': this.selected,
2717
+ 'unselected': !this.selected,
2718
+ 'disabled': this.disabled
2719
+ };
2720
+ }
2721
+ renderHandle() {
2722
+ const classes = {
2723
+ 'with-icon': this.showOnlySelectedIcon ? this.selected : this.icons
2724
+ };
2725
+ return x`
2726
+ ${this.renderTouchTarget()}
2727
+ <span class="handle-container">
2728
+ <md-ripple for="switch" ?disabled="${this.disabled}"></md-ripple>
2729
+ <span class="handle ${e(classes)}">
2730
+ ${this.shouldShowIcons() ? this.renderIcons() : x``}
2731
+ </span>
2732
+ </span>
2733
+ `;
2734
+ }
2735
+ renderIcons() {
2736
+ return x`
2737
+ <div class="icons">
2738
+ ${this.renderOnIcon()}
2739
+ ${this.showOnlySelectedIcon ? x`` : this.renderOffIcon()}
2740
+ </div>
2741
+ `;
2742
+ }
2743
+ /**
2744
+ * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Acheck%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024
2745
+ */
2746
+ renderOnIcon() {
2747
+ return x`
2748
+ <slot class="icon icon--on" name="on-icon">
2749
+ <svg viewBox="0 0 24 24">
2750
+ <path
2751
+ d="M9.55 18.2 3.65 12.3 5.275 10.675 9.55 14.95 18.725 5.775 20.35 7.4Z" />
2752
+ </svg>
2753
+ </slot>
2754
+ `;
2755
+ }
2756
+ /**
2757
+ * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Aclose%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024
2758
+ */
2759
+ renderOffIcon() {
2760
+ return x`
2761
+ <slot class="icon icon--off" name="off-icon">
2762
+ <svg viewBox="0 0 24 24">
2763
+ <path
2764
+ d="M6.4 19.2 4.8 17.6 10.4 12 4.8 6.4 6.4 4.8 12 10.4 17.6 4.8 19.2 6.4 13.6 12 19.2 17.6 17.6 19.2 12 13.6Z" />
2765
+ </svg>
2766
+ </slot>
2767
+ `;
2768
+ }
2769
+ renderTouchTarget() {
2770
+ return x`<span class="touch"></span>`;
2771
+ }
2772
+ shouldShowIcons() {
2773
+ return this.icons || this.showOnlySelectedIcon;
2774
+ }
2775
+ handleInput(event) {
2776
+ const target = event.target;
2777
+ this.selected = target.checked;
2778
+ // <input> 'input' event bubbles and is composed, don't re-dispatch it.
2779
+ }
2780
+ handleChange(event) {
2781
+ // <input> 'change' event is not composed, re-dispatch it.
2782
+ redispatchEvent(this, event);
2783
+ }
2784
+ [getFormValue]() {
2785
+ return this.selected ? this.value : null;
2786
+ }
2787
+ [getFormState]() {
2788
+ return String(this.selected);
2789
+ }
2790
+ formResetCallback() {
2791
+ // The selected property does not reflect, so the original attribute set by
2792
+ // the user is used to determine the default value.
2793
+ this.selected = this.hasAttribute('selected');
2794
+ }
2795
+ formStateRestoreCallback(state) {
2796
+ this.selected = state === 'true';
2797
+ }
2798
+ [createValidator]() {
2799
+ return new CheckboxValidator(() => ({
2800
+ checked: this.selected,
2801
+ required: this.required
2802
+ }));
2803
+ }
2804
+ [getValidityAnchor]() {
2805
+ return this.input;
2806
+ }
2807
+ }
2808
+ /** @nocollapse */
2809
+ Switch.shadowRootOptions = {
2810
+ mode: 'open',
2811
+ delegatesFocus: true
2812
+ };
2813
+ __decorate([n({
2814
+ type: Boolean
2815
+ })], Switch.prototype, "selected", void 0);
2816
+ __decorate([n({
2817
+ type: Boolean
2818
+ })], Switch.prototype, "icons", void 0);
2819
+ __decorate([n({
2820
+ type: Boolean,
2821
+ attribute: 'show-only-selected-icon'
2822
+ })], Switch.prototype, "showOnlySelectedIcon", void 0);
2823
+ __decorate([n({
2824
+ type: Boolean
2825
+ })], Switch.prototype, "required", void 0);
2826
+ __decorate([n()], Switch.prototype, "value", void 0);
2827
+ __decorate([e$1('input')], Switch.prototype, "input", void 0);
2828
+
2829
+ /**
2830
+ * @license
2831
+ * Copyright 2024 Google LLC
2832
+ * SPDX-License-Identifier: Apache-2.0
2833
+ */
2834
+ // Generated stylesheet for ./switch/internal/switch-styles.css.
2835
+ const styles = i$4`@layer styles, hcm;@layer styles{:host{display:inline-flex;outline:none;vertical-align:top;-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer}:host([disabled]){cursor:default}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--md-switch-track-height, 32px))/2) 0px}md-focus-ring{--md-focus-ring-shape-start-start: var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-start-end: var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-end: var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-start: var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}.switch{align-items:center;display:inline-flex;flex-shrink:0;position:relative;width:var(--md-switch-track-width, 52px);height:var(--md-switch-track-height, 32px);border-start-start-radius:var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}input{appearance:none;height:max(100%,var(--md-switch-touch-target-size, 48px));outline:none;margin:0;position:absolute;width:max(100%,var(--md-switch-touch-target-size, 48px));z-index:1;cursor:inherit;top:50%;left:50%;transform:translate(-50%, -50%)}:host([touch-target=none]) input{display:none}}@layer styles{.track{position:absolute;width:100%;height:100%;box-sizing:border-box;border-radius:inherit;display:flex;justify-content:center;align-items:center}.track::before{content:"";display:flex;position:absolute;height:100%;width:100%;border-radius:inherit;box-sizing:border-box;transition-property:opacity,background-color;transition-timing-function:linear;transition-duration:67ms}.disabled .track{background-color:rgba(0,0,0,0);border-color:rgba(0,0,0,0)}.disabled .track::before,.disabled .track::after{transition:none;opacity:var(--md-switch-disabled-track-opacity, 0.12)}.disabled .track::before{background-clip:content-box}.selected .track::before{background-color:var(--md-switch-selected-track-color, var(--md-sys-color-primary, #6750a4))}.selected:hover .track::before{background-color:var(--md-switch-selected-hover-track-color, var(--md-sys-color-primary, #6750a4))}.selected:focus-within .track::before{background-color:var(--md-switch-selected-focus-track-color, var(--md-sys-color-primary, #6750a4))}.selected:active .track::before{background-color:var(--md-switch-selected-pressed-track-color, var(--md-sys-color-primary, #6750a4))}.selected.disabled .track{background-clip:border-box}.selected.disabled .track::before{background-color:var(--md-switch-disabled-selected-track-color, var(--md-sys-color-on-surface, #1d1b20))}.unselected .track::before{background-color:var(--md-switch-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-track-outline-color, var(--md-sys-color-outline, #79747e));border-style:solid;border-width:var(--md-switch-track-outline-width, 2px)}.unselected:hover .track::before{background-color:var(--md-switch-hover-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-hover-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:focus-visible .track::before{background-color:var(--md-switch-focus-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-focus-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:active .track::before{background-color:var(--md-switch-pressed-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-pressed-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected.disabled .track::before{background-color:var(--md-switch-disabled-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-disabled-track-outline-color, var(--md-sys-color-on-surface, #1d1b20))}}@layer hcm{@media(forced-colors: active){.selected .track::before{background:ButtonText;border-color:ButtonText}.disabled .track::before{border-color:GrayText;opacity:1}.disabled.selected .track::before{background:GrayText}}}@layer styles{.handle-container{display:flex;place-content:center;place-items:center;position:relative;transition:margin 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275)}.selected .handle-container{margin-inline-start:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.unselected .handle-container{margin-inline-end:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.disabled .handle-container{transition:none}.handle{border-start-start-radius:var(--md-switch-handle-shape-start-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-handle-shape-start-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-handle-shape-end-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-handle-shape-end-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));height:var(--md-switch-handle-height, 16px);width:var(--md-switch-handle-width, 16px);transform-origin:center;transition-property:height,width;transition-duration:250ms,250ms;transition-timing-function:cubic-bezier(0.2, 0, 0, 1),cubic-bezier(0.2, 0, 0, 1);z-index:0}.handle::before{content:"";display:flex;inset:0;position:absolute;border-radius:inherit;box-sizing:border-box;transition:background-color 67ms linear}.disabled .handle,.disabled .handle::before{transition:none}.selected .handle{height:var(--md-switch-selected-handle-height, 24px);width:var(--md-switch-selected-handle-width, 24px)}.handle.with-icon{height:var(--md-switch-with-icon-handle-height, 24px);width:var(--md-switch-with-icon-handle-width, 24px)}.selected:not(.disabled):active .handle,.unselected:not(.disabled):active .handle{height:var(--md-switch-pressed-handle-height, 28px);width:var(--md-switch-pressed-handle-width, 28px);transition-timing-function:linear;transition-duration:100ms}.selected .handle::before{background-color:var(--md-switch-selected-handle-color, var(--md-sys-color-on-primary, #fff))}.selected:hover .handle::before{background-color:var(--md-switch-selected-hover-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:focus-within .handle::before{background-color:var(--md-switch-selected-focus-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:active .handle::before{background-color:var(--md-switch-selected-pressed-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected.disabled .handle::before{background-color:var(--md-switch-disabled-selected-handle-color, var(--md-sys-color-surface, #fef7ff));opacity:var(--md-switch-disabled-selected-handle-opacity, 1)}.unselected .handle::before{background-color:var(--md-switch-handle-color, var(--md-sys-color-outline, #79747e))}.unselected:hover .handle::before{background-color:var(--md-switch-hover-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:focus-within .handle::before{background-color:var(--md-switch-focus-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:active .handle::before{background-color:var(--md-switch-pressed-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected.disabled .handle::before{background-color:var(--md-switch-disabled-handle-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-handle-opacity, 0.38)}md-ripple{border-radius:var(--md-switch-state-layer-shape, var(--md-sys-shape-corner-full, 9999px));height:var(--md-switch-state-layer-size, 40px);inset:unset;width:var(--md-switch-state-layer-size, 40px)}.selected md-ripple{--md-ripple-hover-color: var(--md-switch-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-color: var(--md-switch-selected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-switch-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-selected-pressed-state-layer-opacity, 0.12)}.unselected md-ripple{--md-ripple-hover-color: var(--md-switch-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-color: var(--md-switch-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-switch-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-pressed-state-layer-opacity, 0.12)}}@layer hcm{@media(forced-colors: active){.unselected .handle::before{background:ButtonText}.disabled .handle::before{opacity:1}.disabled.unselected .handle::before{background:GrayText}}}@layer styles{.icons{position:relative;height:100%;width:100%}.icon{position:absolute;inset:0;margin:auto;display:flex;align-items:center;justify-content:center;fill:currentColor;transition:fill 67ms linear,opacity 33ms linear,transform 167ms cubic-bezier(0.2, 0, 0, 1);opacity:0}.disabled .icon{transition:none}.selected .icon--on,.unselected .icon--off{opacity:1}.unselected .handle:not(.with-icon) .icon--on{transform:rotate(-45deg)}.icon--off{width:var(--md-switch-icon-size, 16px);height:var(--md-switch-icon-size, 16px);color:var(--md-switch-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:hover .icon--off{color:var(--md-switch-hover-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:focus-within .icon--off{color:var(--md-switch-focus-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:active .icon--off{color:var(--md-switch-pressed-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected.disabled .icon--off{color:var(--md-switch-disabled-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9));opacity:var(--md-switch-disabled-icon-opacity, 0.38)}.icon--on{width:var(--md-switch-selected-icon-size, 16px);height:var(--md-switch-selected-icon-size, 16px);color:var(--md-switch-selected-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:hover .icon--on{color:var(--md-switch-selected-hover-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:focus-within .icon--on{color:var(--md-switch-selected-focus-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:active .icon--on{color:var(--md-switch-selected-pressed-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected.disabled .icon--on{color:var(--md-switch-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-selected-icon-opacity, 0.38)}}@layer hcm{@media(forced-colors: active){.icon--off{fill:Canvas}.icon--on{fill:ButtonText}.disabled.unselected .icon--off,.disabled.selected .icon--on{opacity:1}.disabled .icon--on{fill:GrayText}}}
2836
+ `;
2837
+
2838
+ /**
2839
+ * @license
2840
+ * Copyright 2021 Google LLC
2841
+ * SPDX-License-Identifier: Apache-2.0
2842
+ */
2843
+ /**
2844
+ * @summary Switches toggle the state of a single item on or off.
2845
+ *
2846
+ * @description
2847
+ * There's one type of switch in Material. Use this selection control when the
2848
+ * user needs to toggle a single item on or off.
2849
+ *
2850
+ * @final
2851
+ * @suppress {visibility}
2852
+ */
2853
+ let MdSwitch = class MdSwitch extends Switch {};
2854
+ MdSwitch.styles = [styles];
2855
+ MdSwitch = __decorate([t('md-switch')], MdSwitch);
2856
+
2857
+ let WidgetSwitch = class WidgetSwitch extends i$1 {
2858
+ constructor() {
2859
+ super();
2860
+ this.dataSets = new Map();
2861
+ this.textActive = true;
2862
+ this.version = '1.0.1';
2863
+ this.origWidth = 0;
2864
+ this.origHeight = 0;
2865
+ this.resizeObserver = new ResizeObserver(this.applyData.bind(this));
2866
+ this.resizeObserver.observe(this);
2867
+ }
2868
+ disconnectedCallback() {
2869
+ super.disconnectedCallback();
2870
+ if (this.resizeObserver) {
2871
+ this.resizeObserver.disconnect();
2872
+ }
2873
+ }
2874
+ firstUpdated(_changedProperties) {
2875
+ var _a;
2876
+ this.valueContainer = (_a = this === null || this === void 0 ? void 0 : this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.value-container');
2877
+ this.registerTheme(this.theme);
2878
+ this.transformData();
2879
+ this.applyData();
2880
+ }
2881
+ update(changedProperties) {
2882
+ if (changedProperties.has('inputData')) {
2883
+ this.transformData();
2884
+ this.applyData();
2885
+ }
2886
+ if (changedProperties.has('theme')) {
2887
+ this.registerTheme(this.theme);
2888
+ }
2889
+ super.update(changedProperties);
2890
+ }
2891
+ registerTheme(theme) {
2892
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2893
+ const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim();
2894
+ const cssBgColor = getComputedStyle(this).getPropertyValue('--re-tile-background-color').trim();
2895
+ this.themeBgColor = cssBgColor || ((_b = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.theme_object) === null || _b === void 0 ? void 0 : _b.backgroundColor);
2896
+ this.themeTitleColor = cssTextColor || ((_f = (_e = (_d = (_c = this.theme) === null || _c === void 0 ? void 0 : _c.theme_object) === null || _d === void 0 ? void 0 : _d.title) === null || _e === void 0 ? void 0 : _e.textStyle) === null || _f === void 0 ? void 0 : _f.color);
2897
+ this.themeSubtitleColor =
2898
+ cssTextColor || ((_k = (_j = (_h = (_g = this.theme) === null || _g === void 0 ? void 0 : _g.theme_object) === null || _h === void 0 ? void 0 : _h.title) === null || _j === void 0 ? void 0 : _j.subtextStyle) === null || _k === void 0 ? void 0 : _k.color) || this.themeTitleColor;
2899
+ }
2900
+ applyData() { }
2901
+ async transformData() {
2902
+ var _a, _b;
2903
+ if (!this.inputData)
2904
+ return;
2905
+ this.dataSets.forEach((d) => {
2906
+ var _a;
2907
+ (_a = d.label) !== null && _a !== void 0 ? _a : (d.label = '');
2908
+ });
2909
+ this.dataSets = new Map();
2910
+ (_b = (_a = this.inputData) === null || _a === void 0 ? void 0 : _a.dataseries) === null || _b === void 0 ? void 0 : _b.forEach((ds) => {
2911
+ var _a;
2912
+ // pivot data
2913
+ const distincts = [...new Set((_a = ds.data) === null || _a === void 0 ? void 0 : _a.map((d) => d.pivot))].sort();
2914
+ ds.selected = undefined;
2915
+ distincts.forEach((piv) => {
2916
+ var _a, _b, _c, _d, _e;
2917
+ const prefix = piv !== null && piv !== void 0 ? piv : '';
2918
+ const label = (_a = ds.label) !== null && _a !== void 0 ? _a : '';
2919
+ const value = distincts.length === 1 ? (_b = ds.data) === null || _b === void 0 ? void 0 : _b[0] : (_d = (_c = ds.data) === null || _c === void 0 ? void 0 : _c.filter((d) => d.pivot === piv)) === null || _d === void 0 ? void 0 : _d[0];
2920
+ const pds = {
2921
+ label: prefix + (!!prefix && !!label ? ' - ' : '') + label,
2922
+ actionApp: value === null || value === void 0 ? void 0 : value.actionApp,
2923
+ actionDevice: value === null || value === void 0 ? void 0 : value.actionDevice,
2924
+ actionTopic: value === null || value === void 0 ? void 0 : value.actionTopic,
2925
+ styling: ds.styling,
2926
+ selected: this.isSelected(ds, value)
2927
+ };
2928
+ this.dataSets.set((_e = pds.label) !== null && _e !== void 0 ? _e : '', pds);
2929
+ });
2930
+ });
2931
+ // console.log('Value Datasets', this.dataSets)
2932
+ }
2933
+ isSelected(ds, value) {
2934
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
2935
+ if (!value)
2936
+ return undefined;
2937
+ const on = (_a = ds === null || ds === void 0 ? void 0 : ds.stateMap) === null || _a === void 0 ? void 0 : _a.on;
2938
+ if (on === null || on === void 0 ? void 0 : on.startsWith('<=')) {
2939
+ const val = parseFloat((_b = value.value) !== null && _b !== void 0 ? _b : '');
2940
+ const comp = parseFloat(on.substring(2));
2941
+ return isNaN(val) || isNaN(comp) ? undefined : val <= comp;
2942
+ }
2943
+ if (on === null || on === void 0 ? void 0 : on.startsWith('<')) {
2944
+ const val = parseFloat((_c = value.value) !== null && _c !== void 0 ? _c : '');
2945
+ const comp = parseFloat(on.substring(1));
2946
+ return isNaN(val) || isNaN(comp) ? undefined : val < comp;
2947
+ }
2948
+ if (on === null || on === void 0 ? void 0 : on.startsWith('>=')) {
2949
+ const val = parseFloat((_d = value.value) !== null && _d !== void 0 ? _d : '');
2950
+ const comp = parseFloat(on.substring(2));
2951
+ return isNaN(val) || isNaN(comp) ? undefined : val >= comp;
2952
+ }
2953
+ if (on === null || on === void 0 ? void 0 : on.startsWith('>')) {
2954
+ const val = parseFloat((_e = value.value) !== null && _e !== void 0 ? _e : '');
2955
+ const comp = parseFloat(on.substring(1));
2956
+ return isNaN(val) || isNaN(comp) ? undefined : val > comp;
2957
+ }
2958
+ const off = (_f = ds === null || ds === void 0 ? void 0 : ds.stateMap) === null || _f === void 0 ? void 0 : _f.off;
2959
+ if (off === null || off === void 0 ? void 0 : off.startsWith('<=')) {
2960
+ const val = parseFloat((_g = value.value) !== null && _g !== void 0 ? _g : '');
2961
+ const comp = parseFloat(off.substring(2));
2962
+ return isNaN(val) || isNaN(comp) ? undefined : val > comp;
2963
+ }
2964
+ if (off === null || off === void 0 ? void 0 : off.startsWith('<')) {
2965
+ const val = parseFloat((_h = value.value) !== null && _h !== void 0 ? _h : '');
2966
+ const comp = parseFloat(off.substring(1));
2967
+ return isNaN(val) || isNaN(comp) ? undefined : val <= comp;
2968
+ }
2969
+ if (off === null || off === void 0 ? void 0 : off.startsWith('>=')) {
2970
+ const val = parseFloat((_j = value.value) !== null && _j !== void 0 ? _j : '');
2971
+ const comp = parseFloat(off.substring(2));
2972
+ return isNaN(val) || isNaN(comp) ? undefined : val < comp;
2973
+ }
2974
+ if (off === null || off === void 0 ? void 0 : off.startsWith('>')) {
2975
+ const val = parseFloat((_k = value.value) !== null && _k !== void 0 ? _k : '');
2976
+ const comp = parseFloat(off.substring(1));
2977
+ return isNaN(val) || isNaN(comp) ? undefined : val <= comp;
2978
+ }
2979
+ const onValues = (_l = on === null || on === void 0 ? void 0 : on.split(',').map((v) => v.trim().replace('"', '').replace("'", ''))) !== null && _l !== void 0 ? _l : [];
2980
+ if (onValues.includes((_m = String(value.value)) !== null && _m !== void 0 ? _m : ''))
2981
+ return true;
2982
+ const offValues = (_o = off === null || off === void 0 ? void 0 : off.split(',').map((v) => v.trim().replace('"', '').replace("'", ''))) !== null && _o !== void 0 ? _o : [];
2983
+ if (offValues.includes((_p = String(value.value)) !== null && _p !== void 0 ? _p : ''))
2984
+ return false;
2985
+ return undefined;
2986
+ }
2987
+ handleActionSubmit(e) {
2988
+ const switchEl = e.target;
2989
+ const payload = {
2990
+ args: switchEl === null || switchEl === void 0 ? void 0 : switchEl.selected,
2991
+ actionApp: switchEl === null || switchEl === void 0 ? void 0 : switchEl.actionApp,
2992
+ actionDevice: switchEl === null || switchEl === void 0 ? void 0 : switchEl.actionDevice,
2993
+ actionTopic: switchEl === null || switchEl === void 0 ? void 0 : switchEl.actionTopic,
2994
+ label: switchEl === null || switchEl === void 0 ? void 0 : switchEl.label
2995
+ };
2996
+ console.log('Action Submit', payload);
2997
+ this.dispatchEvent(new CustomEvent('action-submit', {
2998
+ detail: payload,
2999
+ bubbles: false,
3000
+ composed: false
3001
+ }));
3002
+ }
3003
+ render() {
3004
+ var _a, _b, _c, _d;
3005
+ return x `
3006
+ <div
3007
+ class="wrapper"
3008
+ style="background-color: ${this.themeBgColor}; color: ${this.themeTitleColor}"
3009
+ >
3010
+ <header>
3011
+ <h3 class="paging" ?active=${(_a = this.inputData) === null || _a === void 0 ? void 0 : _a.title}>${(_b = this.inputData) === null || _b === void 0 ? void 0 : _b.title}</h3>
3012
+ <p
3013
+ class="paging"
3014
+ ?active=${(_c = this.inputData) === null || _c === void 0 ? void 0 : _c.subTitle}
3015
+ style="color: ${this.themeSubtitleColor}"
3016
+ >
3017
+ ${(_d = this.inputData) === null || _d === void 0 ? void 0 : _d.subTitle}
3018
+ </p>
3019
+ </header>
3020
+
3021
+ <div class="paging no-data" ?active=${!this.dataSets.size}>No Data</div>
3022
+ <div class="value-container">
3023
+ ${c([...this.dataSets.entries()].sort(), ([label]) => label, ([label, ds]) => {
3024
+ return x `
3025
+ <div class="switch" label="${label}">
3026
+ ${label}
3027
+ <label
3028
+ ><md-switch
3029
+ aria-label="${label}"
3030
+ ?selected="${!!ds.selected}"
3031
+ .actionApp="${ds === null || ds === void 0 ? void 0 : ds.actionApp}"
3032
+ .actionDevice="${ds === null || ds === void 0 ? void 0 : ds.actionDevice}"
3033
+ .actionTopic="${ds === null || ds === void 0 ? void 0 : ds.actionTopic}"
3034
+ .label="${label}"
3035
+ @change="${this.handleActionSubmit}"
3036
+ ></md-switch
3037
+ ></label>
3038
+ </div>
3039
+ `;
3040
+ })}
3041
+ </div>
3042
+ </div>
3043
+ `;
3044
+ }
3045
+ };
3046
+ WidgetSwitch.styles = i$4 `
3047
+ :host {
3048
+ display: block;
3049
+ font-family: sans-serif;
3050
+ box-sizing: border-box;
3051
+ position: relative;
3052
+ margin: auto;
3053
+ }
3054
+
3055
+ .paging:not([active]) {
3056
+ display: none !important;
3057
+ }
3058
+
3059
+ .wrapper {
3060
+ display: flex;
3061
+ flex-direction: column;
3062
+ height: 100%;
3063
+ width: 100%;
3064
+ padding: 16px;
3065
+ box-sizing: border-box;
3066
+ }
3067
+
3068
+ h3 {
3069
+ margin: 0;
3070
+ max-width: 300px;
3071
+ overflow: hidden;
3072
+ text-overflow: ellipsis;
3073
+ white-space: nowrap;
3074
+ }
3075
+ p {
3076
+ margin: 10px 0 0 0;
3077
+ max-width: 300px;
3078
+ font-size: 14px;
3079
+ line-height: 17px;
3080
+ overflow: hidden;
3081
+ text-overflow: ellipsis;
3082
+ white-space: nowrap;
3083
+ }
3084
+
3085
+ .value-container {
3086
+ display: flex;
3087
+ flex-wrap: wrap;
3088
+ align-items: center;
3089
+ justify-content: center;
3090
+ line-height: 0.9;
3091
+ flex: 1;
3092
+ overflow: hidden;
3093
+ position: relative;
3094
+ gap: 12px;
3095
+ }
3096
+
3097
+ .switch {
3098
+ overflow: hidden;
3099
+ display: flex;
3100
+ align-items: center;
3101
+ gap: 12px;
3102
+ box-sizing: border-box;
3103
+ /* border-left: 4px solid #ddd; */
3104
+ }
3105
+
3106
+ .no-data {
3107
+ font-size: 20px;
3108
+ display: flex;
3109
+ height: 100%;
3110
+ width: 100%;
3111
+ text-align: center;
3112
+ align-items: center;
3113
+ justify-content: center;
3114
+ }
3115
+ `;
3116
+ __decorate([
3117
+ n({ type: Object })
3118
+ ], WidgetSwitch.prototype, "inputData", void 0);
3119
+ __decorate([
3120
+ n({ type: Object })
3121
+ ], WidgetSwitch.prototype, "theme", void 0);
3122
+ __decorate([
3123
+ r()
3124
+ ], WidgetSwitch.prototype, "dataSets", void 0);
3125
+ __decorate([
3126
+ r()
3127
+ ], WidgetSwitch.prototype, "textActive", void 0);
3128
+ __decorate([
3129
+ r()
3130
+ ], WidgetSwitch.prototype, "themeBgColor", void 0);
3131
+ __decorate([
3132
+ r()
3133
+ ], WidgetSwitch.prototype, "themeTitleColor", void 0);
3134
+ __decorate([
3135
+ r()
3136
+ ], WidgetSwitch.prototype, "themeSubtitleColor", void 0);
3137
+ WidgetSwitch = __decorate([
3138
+ t('widget-switch-1.0.1')
3139
+ ], WidgetSwitch);
3140
+
3141
+ export { WidgetSwitch };
3142
+ //# sourceMappingURL=widget-switch.js.map