@wral/my-wral-settings 0.2.4

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,993 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const z = globalThis, F = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, D = Symbol(), V = /* @__PURE__ */ new WeakMap();
7
+ let et = class {
8
+ constructor(t, e, s) {
9
+ if (this._$cssResult$ = !0, s !== D) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
10
+ this.cssText = t, this.t = e;
11
+ }
12
+ get styleSheet() {
13
+ let t = this.o;
14
+ const e = this.t;
15
+ if (F && t === void 0) {
16
+ const s = e !== void 0 && e.length === 1;
17
+ s && (t = V.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && V.set(e, t));
18
+ }
19
+ return t;
20
+ }
21
+ toString() {
22
+ return this.cssText;
23
+ }
24
+ };
25
+ const ut = (r) => new et(typeof r == "string" ? r : r + "", void 0, D), ft = (r, ...t) => {
26
+ const e = r.length === 1 ? r[0] : t.reduce(((s, i, a) => s + ((n) => {
27
+ if (n._$cssResult$ === !0) return n.cssText;
28
+ if (typeof n == "number") return n;
29
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
30
+ })(i) + r[a + 1]), r[0]);
31
+ return new et(e, r, D);
32
+ }, mt = (r, t) => {
33
+ if (F) r.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
34
+ else for (const e of t) {
35
+ const s = document.createElement("style"), i = z.litNonce;
36
+ i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
37
+ }
38
+ }, Y = F ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
39
+ let e = "";
40
+ for (const s of t.cssRules) e += s.cssText;
41
+ return ut(e);
42
+ })(r) : r;
43
+ /**
44
+ * @license
45
+ * Copyright 2017 Google LLC
46
+ * SPDX-License-Identifier: BSD-3-Clause
47
+ */
48
+ const { is: $t, defineProperty: gt, getOwnPropertyDescriptor: _t, getOwnPropertyNames: yt, getOwnPropertySymbols: bt, getPrototypeOf: vt } = Object, M = globalThis, W = M.trustedTypes, At = W ? W.emptyScript : "", wt = M.reactiveElementPolyfillSupport, x = (r, t) => r, R = { toAttribute(r, t) {
49
+ switch (t) {
50
+ case Boolean:
51
+ r = r ? At : null;
52
+ break;
53
+ case Object:
54
+ case Array:
55
+ r = r == null ? r : JSON.stringify(r);
56
+ }
57
+ return r;
58
+ }, fromAttribute(r, t) {
59
+ let e = r;
60
+ switch (t) {
61
+ case Boolean:
62
+ e = r !== null;
63
+ break;
64
+ case Number:
65
+ e = r === null ? null : Number(r);
66
+ break;
67
+ case Object:
68
+ case Array:
69
+ try {
70
+ e = JSON.parse(r);
71
+ } catch {
72
+ e = null;
73
+ }
74
+ }
75
+ return e;
76
+ } }, st = (r, t) => !$t(r, t), q = { attribute: !0, type: String, converter: R, reflect: !1, useDefault: !1, hasChanged: st };
77
+ Symbol.metadata ??= Symbol("metadata"), M.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
78
+ let v = class extends HTMLElement {
79
+ static addInitializer(t) {
80
+ this._$Ei(), (this.l ??= []).push(t);
81
+ }
82
+ static get observedAttributes() {
83
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
84
+ }
85
+ static createProperty(t, e = q) {
86
+ if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
87
+ const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
88
+ i !== void 0 && gt(this.prototype, t, i);
89
+ }
90
+ }
91
+ static getPropertyDescriptor(t, e, s) {
92
+ const { get: i, set: a } = _t(this.prototype, t) ?? { get() {
93
+ return this[e];
94
+ }, set(n) {
95
+ this[e] = n;
96
+ } };
97
+ return { get: i, set(n) {
98
+ const l = i?.call(this);
99
+ a?.call(this, n), this.requestUpdate(t, l, s);
100
+ }, configurable: !0, enumerable: !0 };
101
+ }
102
+ static getPropertyOptions(t) {
103
+ return this.elementProperties.get(t) ?? q;
104
+ }
105
+ static _$Ei() {
106
+ if (this.hasOwnProperty(x("elementProperties"))) return;
107
+ const t = vt(this);
108
+ t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
109
+ }
110
+ static finalize() {
111
+ if (this.hasOwnProperty(x("finalized"))) return;
112
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(x("properties"))) {
113
+ const e = this.properties, s = [...yt(e), ...bt(e)];
114
+ for (const i of s) this.createProperty(i, e[i]);
115
+ }
116
+ const t = this[Symbol.metadata];
117
+ if (t !== null) {
118
+ const e = litPropertyMetadata.get(t);
119
+ if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i);
120
+ }
121
+ this._$Eh = /* @__PURE__ */ new Map();
122
+ for (const [e, s] of this.elementProperties) {
123
+ const i = this._$Eu(e, s);
124
+ i !== void 0 && this._$Eh.set(i, e);
125
+ }
126
+ this.elementStyles = this.finalizeStyles(this.styles);
127
+ }
128
+ static finalizeStyles(t) {
129
+ const e = [];
130
+ if (Array.isArray(t)) {
131
+ const s = new Set(t.flat(1 / 0).reverse());
132
+ for (const i of s) e.unshift(Y(i));
133
+ } else t !== void 0 && e.push(Y(t));
134
+ return e;
135
+ }
136
+ static _$Eu(t, e) {
137
+ const s = e.attribute;
138
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
139
+ }
140
+ constructor() {
141
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
142
+ }
143
+ _$Ev() {
144
+ this._$ES = new Promise(((t) => this.enableUpdating = t)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t) => t(this)));
145
+ }
146
+ addController(t) {
147
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
148
+ }
149
+ removeController(t) {
150
+ this._$EO?.delete(t);
151
+ }
152
+ _$E_() {
153
+ const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
154
+ for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
155
+ t.size > 0 && (this._$Ep = t);
156
+ }
157
+ createRenderRoot() {
158
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
159
+ return mt(t, this.constructor.elementStyles), t;
160
+ }
161
+ connectedCallback() {
162
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t) => t.hostConnected?.()));
163
+ }
164
+ enableUpdating(t) {
165
+ }
166
+ disconnectedCallback() {
167
+ this._$EO?.forEach(((t) => t.hostDisconnected?.()));
168
+ }
169
+ attributeChangedCallback(t, e, s) {
170
+ this._$AK(t, s);
171
+ }
172
+ _$ET(t, e) {
173
+ const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
174
+ if (i !== void 0 && s.reflect === !0) {
175
+ const a = (s.converter?.toAttribute !== void 0 ? s.converter : R).toAttribute(e, s.type);
176
+ this._$Em = t, a == null ? this.removeAttribute(i) : this.setAttribute(i, a), this._$Em = null;
177
+ }
178
+ }
179
+ _$AK(t, e) {
180
+ const s = this.constructor, i = s._$Eh.get(t);
181
+ if (i !== void 0 && this._$Em !== i) {
182
+ const a = s.getPropertyOptions(i), n = typeof a.converter == "function" ? { fromAttribute: a.converter } : a.converter?.fromAttribute !== void 0 ? a.converter : R;
183
+ this._$Em = i;
184
+ const l = n.fromAttribute(e, a.type);
185
+ this[i] = l ?? this._$Ej?.get(i) ?? l, this._$Em = null;
186
+ }
187
+ }
188
+ requestUpdate(t, e, s) {
189
+ if (t !== void 0) {
190
+ const i = this.constructor, a = this[t];
191
+ if (s ??= i.getPropertyOptions(t), !((s.hasChanged ?? st)(a, e) || s.useDefault && s.reflect && a === this._$Ej?.get(t) && !this.hasAttribute(i._$Eu(t, s)))) return;
192
+ this.C(t, e, s);
193
+ }
194
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
195
+ }
196
+ C(t, e, { useDefault: s, reflect: i, wrapped: a }, n) {
197
+ s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), a !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), i === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
198
+ }
199
+ async _$EP() {
200
+ this.isUpdatePending = !0;
201
+ try {
202
+ await this._$ES;
203
+ } catch (e) {
204
+ Promise.reject(e);
205
+ }
206
+ const t = this.scheduleUpdate();
207
+ return t != null && await t, !this.isUpdatePending;
208
+ }
209
+ scheduleUpdate() {
210
+ return this.performUpdate();
211
+ }
212
+ performUpdate() {
213
+ if (!this.isUpdatePending) return;
214
+ if (!this.hasUpdated) {
215
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
216
+ for (const [i, a] of this._$Ep) this[i] = a;
217
+ this._$Ep = void 0;
218
+ }
219
+ const s = this.constructor.elementProperties;
220
+ if (s.size > 0) for (const [i, a] of s) {
221
+ const { wrapped: n } = a, l = this[i];
222
+ n !== !0 || this._$AL.has(i) || l === void 0 || this.C(i, void 0, a, l);
223
+ }
224
+ }
225
+ let t = !1;
226
+ const e = this._$AL;
227
+ try {
228
+ t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(e)) : this._$EM();
229
+ } catch (s) {
230
+ throw t = !1, this._$EM(), s;
231
+ }
232
+ t && this._$AE(e);
233
+ }
234
+ willUpdate(t) {
235
+ }
236
+ _$AE(t) {
237
+ this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
238
+ }
239
+ _$EM() {
240
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
241
+ }
242
+ get updateComplete() {
243
+ return this.getUpdateComplete();
244
+ }
245
+ getUpdateComplete() {
246
+ return this._$ES;
247
+ }
248
+ shouldUpdate(t) {
249
+ return !0;
250
+ }
251
+ update(t) {
252
+ this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM();
253
+ }
254
+ updated(t) {
255
+ }
256
+ firstUpdated(t) {
257
+ }
258
+ };
259
+ v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[x("elementProperties")] = /* @__PURE__ */ new Map(), v[x("finalized")] = /* @__PURE__ */ new Map(), wt?.({ ReactiveElement: v }), (M.reactiveElementVersions ??= []).push("2.1.1");
260
+ /**
261
+ * @license
262
+ * Copyright 2017 Google LLC
263
+ * SPDX-License-Identifier: BSD-3-Clause
264
+ */
265
+ const I = globalThis, P = I.trustedTypes, Z = P ? P.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, it = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, rt = "?" + $, Et = `<${rt}>`, y = document, C = () => y.createComment(""), U = (r) => r === null || typeof r != "object" && typeof r != "function", j = Array.isArray, xt = (r) => j(r) || typeof r?.[Symbol.iterator] == "function", T = `[
266
+ \f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, K = /-->/g, J = />/g, g = RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^
267
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), G = /'/g, Q = /"/g, at = /^(?:script|style|textarea|title)$/i, St = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), m = St(1), A = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), X = /* @__PURE__ */ new WeakMap(), _ = y.createTreeWalker(y, 129);
268
+ function nt(r, t) {
269
+ if (!j(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
270
+ return Z !== void 0 ? Z.createHTML(t) : t;
271
+ }
272
+ const Ct = (r, t) => {
273
+ const e = r.length - 1, s = [];
274
+ let i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = E;
275
+ for (let l = 0; l < e; l++) {
276
+ const o = r[l];
277
+ let d, c, h = -1, u = 0;
278
+ for (; u < o.length && (n.lastIndex = u, c = n.exec(o), c !== null); ) u = n.lastIndex, n === E ? c[1] === "!--" ? n = K : c[1] !== void 0 ? n = J : c[2] !== void 0 ? (at.test(c[2]) && (i = RegExp("</" + c[2], "g")), n = g) : c[3] !== void 0 && (n = g) : n === g ? c[0] === ">" ? (n = i ?? E, h = -1) : c[1] === void 0 ? h = -2 : (h = n.lastIndex - c[2].length, d = c[1], n = c[3] === void 0 ? g : c[3] === '"' ? Q : G) : n === Q || n === G ? n = g : n === K || n === J ? n = E : (n = g, i = void 0);
279
+ const f = n === g && r[l + 1].startsWith("/>") ? " " : "";
280
+ a += n === E ? o + Et : h >= 0 ? (s.push(d), o.slice(0, h) + it + o.slice(h) + $ + f) : o + $ + (h === -2 ? l : f);
281
+ }
282
+ return [nt(r, a + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
283
+ };
284
+ class O {
285
+ constructor({ strings: t, _$litType$: e }, s) {
286
+ let i;
287
+ this.parts = [];
288
+ let a = 0, n = 0;
289
+ const l = t.length - 1, o = this.parts, [d, c] = Ct(t, e);
290
+ if (this.el = O.createElement(d, s), _.currentNode = this.el.content, e === 2 || e === 3) {
291
+ const h = this.el.content.firstChild;
292
+ h.replaceWith(...h.childNodes);
293
+ }
294
+ for (; (i = _.nextNode()) !== null && o.length < l; ) {
295
+ if (i.nodeType === 1) {
296
+ if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(it)) {
297
+ const u = c[n++], f = i.getAttribute(h).split($), b = /([.?@])?(.*)/.exec(u);
298
+ o.push({ type: 1, index: a, name: b[2], strings: f, ctor: b[1] === "." ? Ot : b[1] === "?" ? Nt : b[1] === "@" ? zt : B }), i.removeAttribute(h);
299
+ } else h.startsWith($) && (o.push({ type: 6, index: a }), i.removeAttribute(h));
300
+ if (at.test(i.tagName)) {
301
+ const h = i.textContent.split($), u = h.length - 1;
302
+ if (u > 0) {
303
+ i.textContent = P ? P.emptyScript : "";
304
+ for (let f = 0; f < u; f++) i.append(h[f], C()), _.nextNode(), o.push({ type: 2, index: ++a });
305
+ i.append(h[u], C());
306
+ }
307
+ }
308
+ } else if (i.nodeType === 8) if (i.data === rt) o.push({ type: 2, index: a });
309
+ else {
310
+ let h = -1;
311
+ for (; (h = i.data.indexOf($, h + 1)) !== -1; ) o.push({ type: 7, index: a }), h += $.length - 1;
312
+ }
313
+ a++;
314
+ }
315
+ }
316
+ static createElement(t, e) {
317
+ const s = y.createElement("template");
318
+ return s.innerHTML = t, s;
319
+ }
320
+ }
321
+ function w(r, t, e = r, s) {
322
+ if (t === A) return t;
323
+ let i = s !== void 0 ? e._$Co?.[s] : e._$Cl;
324
+ const a = U(t) ? void 0 : t._$litDirective$;
325
+ return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = i : e._$Cl = i), i !== void 0 && (t = w(r, i._$AS(r, t.values), i, s)), t;
326
+ }
327
+ class Ut {
328
+ constructor(t, e) {
329
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
330
+ }
331
+ get parentNode() {
332
+ return this._$AM.parentNode;
333
+ }
334
+ get _$AU() {
335
+ return this._$AM._$AU;
336
+ }
337
+ u(t) {
338
+ const { el: { content: e }, parts: s } = this._$AD, i = (t?.creationScope ?? y).importNode(e, !0);
339
+ _.currentNode = i;
340
+ let a = _.nextNode(), n = 0, l = 0, o = s[0];
341
+ for (; o !== void 0; ) {
342
+ if (n === o.index) {
343
+ let d;
344
+ o.type === 2 ? d = new N(a, a.nextSibling, this, t) : o.type === 1 ? d = new o.ctor(a, o.name, o.strings, this, t) : o.type === 6 && (d = new Pt(a, this, t)), this._$AV.push(d), o = s[++l];
345
+ }
346
+ n !== o?.index && (a = _.nextNode(), n++);
347
+ }
348
+ return _.currentNode = y, i;
349
+ }
350
+ p(t) {
351
+ let e = 0;
352
+ for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
353
+ }
354
+ }
355
+ class N {
356
+ get _$AU() {
357
+ return this._$AM?._$AU ?? this._$Cv;
358
+ }
359
+ constructor(t, e, s, i) {
360
+ this.type = 2, this._$AH = p, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = i?.isConnected ?? !0;
361
+ }
362
+ get parentNode() {
363
+ let t = this._$AA.parentNode;
364
+ const e = this._$AM;
365
+ return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
366
+ }
367
+ get startNode() {
368
+ return this._$AA;
369
+ }
370
+ get endNode() {
371
+ return this._$AB;
372
+ }
373
+ _$AI(t, e = this) {
374
+ t = w(this, t, e), U(t) ? t === p || t == null || t === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : t !== this._$AH && t !== A && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : xt(t) ? this.k(t) : this._(t);
375
+ }
376
+ O(t) {
377
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
378
+ }
379
+ T(t) {
380
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
381
+ }
382
+ _(t) {
383
+ this._$AH !== p && U(this._$AH) ? this._$AA.nextSibling.data = t : this.T(y.createTextNode(t)), this._$AH = t;
384
+ }
385
+ $(t) {
386
+ const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = O.createElement(nt(s.h, s.h[0]), this.options)), s);
387
+ if (this._$AH?._$AD === i) this._$AH.p(e);
388
+ else {
389
+ const a = new Ut(i, this), n = a.u(this.options);
390
+ a.p(e), this.T(n), this._$AH = a;
391
+ }
392
+ }
393
+ _$AC(t) {
394
+ let e = X.get(t.strings);
395
+ return e === void 0 && X.set(t.strings, e = new O(t)), e;
396
+ }
397
+ k(t) {
398
+ j(this._$AH) || (this._$AH = [], this._$AR());
399
+ const e = this._$AH;
400
+ let s, i = 0;
401
+ for (const a of t) i === e.length ? e.push(s = new N(this.O(C()), this.O(C()), this, this.options)) : s = e[i], s._$AI(a), i++;
402
+ i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
403
+ }
404
+ _$AR(t = this._$AA.nextSibling, e) {
405
+ for (this._$AP?.(!1, !0, e); t !== this._$AB; ) {
406
+ const s = t.nextSibling;
407
+ t.remove(), t = s;
408
+ }
409
+ }
410
+ setConnected(t) {
411
+ this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
412
+ }
413
+ }
414
+ class B {
415
+ get tagName() {
416
+ return this.element.tagName;
417
+ }
418
+ get _$AU() {
419
+ return this._$AM._$AU;
420
+ }
421
+ constructor(t, e, s, i, a) {
422
+ this.type = 1, this._$AH = p, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = a, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = p;
423
+ }
424
+ _$AI(t, e = this, s, i) {
425
+ const a = this.strings;
426
+ let n = !1;
427
+ if (a === void 0) t = w(this, t, e, 0), n = !U(t) || t !== this._$AH && t !== A, n && (this._$AH = t);
428
+ else {
429
+ const l = t;
430
+ let o, d;
431
+ for (t = a[0], o = 0; o < a.length - 1; o++) d = w(this, l[s + o], e, o), d === A && (d = this._$AH[o]), n ||= !U(d) || d !== this._$AH[o], d === p ? t = p : t !== p && (t += (d ?? "") + a[o + 1]), this._$AH[o] = d;
432
+ }
433
+ n && !i && this.j(t);
434
+ }
435
+ j(t) {
436
+ t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
437
+ }
438
+ }
439
+ class Ot extends B {
440
+ constructor() {
441
+ super(...arguments), this.type = 3;
442
+ }
443
+ j(t) {
444
+ this.element[this.name] = t === p ? void 0 : t;
445
+ }
446
+ }
447
+ class Nt extends B {
448
+ constructor() {
449
+ super(...arguments), this.type = 4;
450
+ }
451
+ j(t) {
452
+ this.element.toggleAttribute(this.name, !!t && t !== p);
453
+ }
454
+ }
455
+ class zt extends B {
456
+ constructor(t, e, s, i, a) {
457
+ super(t, e, s, i, a), this.type = 5;
458
+ }
459
+ _$AI(t, e = this) {
460
+ if ((t = w(this, t, e, 0) ?? p) === A) return;
461
+ const s = this._$AH, i = t === p && s !== p || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, a = t !== p && (s === p || i);
462
+ i && this.element.removeEventListener(this.name, this, s), a && this.element.addEventListener(this.name, this, t), this._$AH = t;
463
+ }
464
+ handleEvent(t) {
465
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
466
+ }
467
+ }
468
+ class Pt {
469
+ constructor(t, e, s) {
470
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
471
+ }
472
+ get _$AU() {
473
+ return this._$AM._$AU;
474
+ }
475
+ _$AI(t) {
476
+ w(this, t);
477
+ }
478
+ }
479
+ const Mt = I.litHtmlPolyfillSupport;
480
+ Mt?.(O, N), (I.litHtmlVersions ??= []).push("3.3.1");
481
+ const Bt = (r, t, e) => {
482
+ const s = e?.renderBefore ?? t;
483
+ let i = s._$litPart$;
484
+ if (i === void 0) {
485
+ const a = e?.renderBefore ?? null;
486
+ s._$litPart$ = i = new N(t.insertBefore(C(), a), a, void 0, e ?? {});
487
+ }
488
+ return i._$AI(r), i;
489
+ };
490
+ /**
491
+ * @license
492
+ * Copyright 2017 Google LLC
493
+ * SPDX-License-Identifier: BSD-3-Clause
494
+ */
495
+ const L = globalThis;
496
+ class S extends v {
497
+ constructor() {
498
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
499
+ }
500
+ createRenderRoot() {
501
+ const t = super.createRenderRoot();
502
+ return this.renderOptions.renderBefore ??= t.firstChild, t;
503
+ }
504
+ update(t) {
505
+ const e = this.render();
506
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Bt(e, this.renderRoot, this.renderOptions);
507
+ }
508
+ connectedCallback() {
509
+ super.connectedCallback(), this._$Do?.setConnected(!0);
510
+ }
511
+ disconnectedCallback() {
512
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
513
+ }
514
+ render() {
515
+ return A;
516
+ }
517
+ }
518
+ S._$litElement$ = !0, S.finalized = !0, L.litElementHydrateSupport?.({ LitElement: S });
519
+ const Tt = L.litElementPolyfillSupport;
520
+ Tt?.({ LitElement: S });
521
+ (L.litElementVersions ??= []).push("4.2.1");
522
+ const kt = {
523
+ md: 1024
524
+ }, k = {
525
+ preferredName: ["preferred_name"],
526
+ zipCode: ["zipcode", "zip_code"],
527
+ dateOfBirth: ["date_of_birth"]
528
+ }, Ht = (r) => r?.facts || r?.data?.facts || {}, H = (r, t) => {
529
+ for (const e of t) {
530
+ const s = r?.[e];
531
+ if (s) {
532
+ if (s?.item?.value != null) return String(s.item.value);
533
+ if (Array.isArray(s?.items) && s.items[0]?.value != null)
534
+ return String(s.items[0].value);
535
+ }
536
+ }
537
+ return "";
538
+ }, tt = (r) => {
539
+ const t = String(r || "").trim();
540
+ return t ? /^\d{4}-\d{2}-\d{2}/.test(t) ? t.slice(0, 10) : t : "";
541
+ };
542
+ class ot extends S {
543
+ static properties = {
544
+ getUserFacts: { attribute: !1 },
545
+ updateUserFact: { attribute: !1 },
546
+ updateUserFacts: { attribute: !1 },
547
+ loading: { state: !0 },
548
+ saving: { state: !0 },
549
+ error: { state: !0 },
550
+ success: { state: !0 },
551
+ _values: { state: !0 },
552
+ _dirty: { state: !0 },
553
+ _fieldErrors: { state: !0 }
554
+ };
555
+ constructor() {
556
+ super(), this.getUserFacts = null, this.updateUserFact = null, this.updateUserFacts = null, this.loading = !1, this.saving = !1, this.error = "", this.success = "", this._values = {
557
+ preferredName: "",
558
+ zipCode: "",
559
+ dateOfBirth: ""
560
+ }, this._originalValues = { ...this._values }, this._dirty = {
561
+ preferredName: !1,
562
+ zipCode: !1,
563
+ dateOfBirth: !1
564
+ }, this._fieldErrors = {
565
+ preferredName: "",
566
+ zipCode: "",
567
+ dateOfBirth: ""
568
+ }, this._handlePreferredNameInput = (t) => {
569
+ this._handleInput("preferredName", t);
570
+ }, this._handleZipCodeInput = (t) => {
571
+ this._handleInput("zipCode", t);
572
+ }, this._handleDateOfBirthInput = (t) => {
573
+ this._handleInput("dateOfBirth", t);
574
+ };
575
+ }
576
+ static styles = ft`
577
+ :host {
578
+ display: block;
579
+ color: var(--mw-settings-ink, #1b1a17);
580
+ font-family: var(--mw-settings-font-family, "Sora",
581
+ "Trebuchet MS", sans-serif);
582
+ }
583
+ .card {
584
+ position: relative;
585
+ overflow: hidden;
586
+ border-radius: 20px;
587
+ border: 1px solid var(--mw-settings-border, #e3dbd1);
588
+ background: var(--mw-settings-surface, #fbf7f2);
589
+ padding: 1.75rem;
590
+ box-shadow: 0 12px 24px rgba(34, 28, 20, 0.08);
591
+ animation: riseIn 0.4s ease-out;
592
+ }
593
+ .card::before {
594
+ content: '';
595
+ position: absolute;
596
+ inset: -60% -20% auto -20%;
597
+ height: 160px;
598
+ background:
599
+ radial-gradient(circle at 20% 20%, rgba(255, 194, 128, 0.55),
600
+ transparent 60%),
601
+ radial-gradient(circle at 85% 0%, rgba(129, 191, 255, 0.4),
602
+ transparent 55%);
603
+ pointer-events: none;
604
+ }
605
+ .header {
606
+ display: flex;
607
+ align-items: flex-start;
608
+ justify-content: space-between;
609
+ gap: 1.5rem;
610
+ position: relative;
611
+ z-index: 1;
612
+ }
613
+ .eyebrow {
614
+ text-transform: uppercase;
615
+ letter-spacing: 0.2em;
616
+ font-size: 0.7rem;
617
+ color: var(--mw-settings-muted, #6b6259);
618
+ margin: 0 0 0.35rem;
619
+ }
620
+ h2 {
621
+ margin: 0 0 0.25rem;
622
+ font-size: 1.5rem;
623
+ line-height: 1.2;
624
+ }
625
+ .subtitle {
626
+ margin: 0;
627
+ color: var(--mw-settings-muted, #6b6259);
628
+ font-size: 0.95rem;
629
+ }
630
+ .status-row {
631
+ display: flex;
632
+ gap: 0.5rem;
633
+ flex-wrap: wrap;
634
+ justify-content: flex-end;
635
+ }
636
+ .pill {
637
+ display: inline-flex;
638
+ align-items: center;
639
+ gap: 0.35rem;
640
+ padding: 0.35rem 0.75rem;
641
+ border-radius: 999px;
642
+ font-size: 0.8rem;
643
+ font-weight: 600;
644
+ background: #ffffff;
645
+ border: 1px solid var(--mw-settings-border, #e3dbd1);
646
+ color: var(--mw-settings-muted, #6b6259);
647
+ }
648
+ .status {
649
+ margin: 1rem 0 0;
650
+ font-size: 0.9rem;
651
+ color: var(--mw-settings-muted, #6b6259);
652
+ }
653
+ .status.error {
654
+ color: #9b2c2c;
655
+ }
656
+ .status.success {
657
+ color: #2f7c3d;
658
+ }
659
+ form {
660
+ margin-top: 1.5rem;
661
+ display: grid;
662
+ gap: 1.25rem;
663
+ position: relative;
664
+ z-index: 1;
665
+ }
666
+ .fields {
667
+ display: grid;
668
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
669
+ gap: 1rem;
670
+ }
671
+ .field {
672
+ background: var(--mw-settings-panel, #ffffff);
673
+ border: 1px solid var(--mw-settings-border, #e3dbd1);
674
+ border-radius: 14px;
675
+ padding: 0.85rem 0.9rem 0.95rem;
676
+ display: grid;
677
+ gap: 0.5rem;
678
+ animation: fieldIn 0.35s ease-out;
679
+ }
680
+ .field:nth-child(2) { animation-delay: 0.04s; }
681
+ .field:nth-child(3) { animation-delay: 0.08s; }
682
+ .label {
683
+ font-weight: 600;
684
+ font-size: 0.9rem;
685
+ }
686
+ .input {
687
+ border: 1px solid #d5cbc0;
688
+ border-radius: 10px;
689
+ padding: 0.55rem 0.7rem;
690
+ font-size: 0.95rem;
691
+ font-family: inherit;
692
+ color: inherit;
693
+ background: #fff;
694
+ }
695
+ .input:focus {
696
+ outline: 2px solid var(--mw-settings-focus, #2563eb);
697
+ outline-offset: 1px;
698
+ border-color: transparent;
699
+ }
700
+ .helper {
701
+ color: var(--mw-settings-muted, #6b6259);
702
+ font-size: 0.8rem;
703
+ }
704
+ .error-text {
705
+ color: #9b2c2c;
706
+ font-size: 0.8rem;
707
+ }
708
+ .action-row {
709
+ display: flex;
710
+ align-items: center;
711
+ justify-content: space-between;
712
+ gap: 0.75rem;
713
+ flex-wrap: wrap;
714
+ }
715
+ .buttons {
716
+ display: flex;
717
+ align-items: center;
718
+ gap: 0.75rem;
719
+ flex-wrap: wrap;
720
+ }
721
+ .button {
722
+ border-radius: 999px;
723
+ border: 1px solid transparent;
724
+ padding: 0.6rem 1.4rem;
725
+ font-size: 0.9rem;
726
+ font-weight: 600;
727
+ cursor: pointer;
728
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
729
+ }
730
+ .button.primary {
731
+ background: var(--mw-settings-accent, #b24b1c);
732
+ color: #fff;
733
+ box-shadow: 0 10px 18px rgba(178, 75, 28, 0.2);
734
+ }
735
+ .button.secondary {
736
+ background: #fff;
737
+ color: var(--mw-settings-ink, #1b1a17);
738
+ border-color: var(--mw-settings-border, #e3dbd1);
739
+ }
740
+ .button:disabled {
741
+ opacity: 0.6;
742
+ cursor: not-allowed;
743
+ transform: none;
744
+ box-shadow: none;
745
+ }
746
+ .meta-note {
747
+ font-size: 0.8rem;
748
+ color: var(--mw-settings-muted, #6b6259);
749
+ }
750
+ @keyframes riseIn {
751
+ from { opacity: 0; transform: translateY(12px); }
752
+ to { opacity: 1; transform: translateY(0); }
753
+ }
754
+ @keyframes fieldIn {
755
+ from { opacity: 0; transform: translateY(6px); }
756
+ to { opacity: 1; transform: translateY(0); }
757
+ }
758
+ @media (prefers-reduced-motion: reduce) {
759
+ .card, .field, .button { animation: none; transition: none; }
760
+ }
761
+ @media (max-width: ${kt.md}px) {
762
+ .card { padding: 1.4rem; }
763
+ .header { flex-direction: column; align-items: flex-start; }
764
+ .status-row { justify-content: flex-start; }
765
+ .action-row { flex-direction: column; align-items: stretch; }
766
+ .buttons { width: 100%; }
767
+ }
768
+ `;
769
+ firstUpdated() {
770
+ typeof this.getUserFacts == "function" && this._loadFacts();
771
+ }
772
+ updated(t) {
773
+ t.has("getUserFacts") && typeof this.getUserFacts == "function" && this._loadFacts();
774
+ }
775
+ async _loadFacts() {
776
+ if (typeof this.getUserFacts != "function") {
777
+ this.error = "Missing getUserFacts callback.";
778
+ return;
779
+ }
780
+ this.loading = !0, this.error = "", this.success = "";
781
+ try {
782
+ const t = await this.getUserFacts(), e = Ht(t), s = {
783
+ preferredName: H(e, k.preferredName),
784
+ zipCode: H(e, k.zipCode),
785
+ dateOfBirth: tt(
786
+ H(e, k.dateOfBirth)
787
+ )
788
+ };
789
+ this._values = { ...s }, this._originalValues = { ...s }, this._dirty = {
790
+ preferredName: !1,
791
+ zipCode: !1,
792
+ dateOfBirth: !1
793
+ }, this._fieldErrors = {
794
+ preferredName: "",
795
+ zipCode: "",
796
+ dateOfBirth: ""
797
+ };
798
+ } catch (t) {
799
+ console.error("[my-wral-settings]", t), this.error = "Unable to load user facts.";
800
+ } finally {
801
+ this.loading = !1;
802
+ }
803
+ }
804
+ _handleInput(t, e) {
805
+ const s = e.target.value;
806
+ this._values = { ...this._values, [t]: s }, this._dirty = {
807
+ ...this._dirty,
808
+ [t]: s !== this._originalValues[t]
809
+ }, this._fieldErrors = { ...this._fieldErrors, [t]: "" }, this.error = "", this.success = "";
810
+ }
811
+ _validate(t) {
812
+ const e = {
813
+ preferredName: "",
814
+ zipCode: "",
815
+ dateOfBirth: ""
816
+ };
817
+ return t.zipCode && !/^\d{5}$/.test(t.zipCode) && (e.zipCode = "Zip code must be 5 digits."), t.dateOfBirth && !/^\d{4}-\d{2}-\d{2}$/.test(t.dateOfBirth) && (e.dateOfBirth = "Use YYYY-MM-DD."), e;
818
+ }
819
+ async _handleSubmit(t) {
820
+ if (t.preventDefault(), this.saving) return;
821
+ const e = typeof this.updateUserFact == "function" ? this.updateUserFact : this.updateUserFacts;
822
+ if (typeof e != "function") {
823
+ this.error = "Missing updateUserFact callback.";
824
+ return;
825
+ }
826
+ const s = {
827
+ preferredName: (this._values.preferredName || "").trim(),
828
+ zipCode: (this._values.zipCode || "").trim(),
829
+ dateOfBirth: tt(this._values.dateOfBirth)
830
+ }, i = this._validate(s);
831
+ if (Object.values(i).some(Boolean)) {
832
+ this._fieldErrors = i;
833
+ return;
834
+ }
835
+ const n = [];
836
+ if (this._dirty.preferredName && n.push({ factName: "preferred_name", value: s.preferredName }), this._dirty.zipCode && n.push({ factName: "zipcode", value: s.zipCode }), this._dirty.dateOfBirth && n.push({ factName: "date_of_birth", value: s.dateOfBirth }), !!n.length) {
837
+ this.saving = !0, this.error = "", this.success = "", this._values = { ...s };
838
+ try {
839
+ for (const l of n)
840
+ await e(l.factName, l.value);
841
+ this._originalValues = { ...s }, this._dirty = {
842
+ preferredName: !1,
843
+ zipCode: !1,
844
+ dateOfBirth: !1
845
+ }, this.success = "Saved changes.";
846
+ } catch (l) {
847
+ console.error("[my-wral-settings]", l), this.error = "Unable to save changes.";
848
+ } finally {
849
+ this.saving = !1;
850
+ }
851
+ }
852
+ }
853
+ _handleReset() {
854
+ this._values = { ...this._originalValues }, this._dirty = {
855
+ preferredName: !1,
856
+ zipCode: !1,
857
+ dateOfBirth: !1
858
+ }, this._fieldErrors = {
859
+ preferredName: "",
860
+ zipCode: "",
861
+ dateOfBirth: ""
862
+ }, this.error = "", this.success = "";
863
+ }
864
+ render() {
865
+ const { loading: t, saving: e, error: s, success: i, _values: a, _fieldErrors: n } = this, l = Object.values(this._dirty).some(Boolean), o = typeof this.getUserFacts == "function", d = typeof this.updateUserFact == "function" || typeof this.updateUserFacts == "function", c = /* @__PURE__ */ new Date(), h = `${c.getFullYear()}-${String(c.getMonth() + 1).padStart(2, "0")}-${String(c.getDate()).padStart(2, "0")}`, u = s ? m`<div class="status error" role="status">${s}</div>` : "", f = i ? m`<div class="status success" role="status">${i}</div>` : "", b = o ? "" : m`
866
+ <div class="status" role="status">
867
+ Provide a getUserFacts callback to load values.
868
+ </div>
869
+ `, lt = o && !d ? m`
870
+ <div class="status" role="status">
871
+ Provide an updateUserFact callback to save changes.
872
+ </div>
873
+ ` : "", ht = n.preferredName ? m`
874
+ <span class="error-text">
875
+ ${n.preferredName}
876
+ </span>
877
+ ` : "", dt = n.zipCode ? m`
878
+ <span class="error-text">
879
+ ${n.zipCode}
880
+ </span>
881
+ ` : "", ct = n.dateOfBirth ? m`
882
+ <span class="error-text">
883
+ ${n.dateOfBirth}
884
+ </span>
885
+ ` : "", pt = l ? "You have unsaved changes." : "All changes are saved.";
886
+ return m`
887
+ <section class="card" aria-busy=${t ? "true" : "false"}>
888
+ <div class="header">
889
+ <div>
890
+ <p class="eyebrow">My WRAL</p>
891
+ <h2>Settings</h2>
892
+ <p class="subtitle">Update the basics tied to your account.</p>
893
+ </div>
894
+ <div class="status-row">
895
+ ${t ? m`<span class="pill">Loading</span>` : ""}
896
+ ${e ? m`<span class="pill">Saving</span>` : ""}
897
+ </div>
898
+ </div>
899
+
900
+ ${u}
901
+ ${f}
902
+ ${b}
903
+ ${lt}
904
+
905
+ <form @submit=${this._handleSubmit} novalidate>
906
+ <div class="fields">
907
+ <label class="field">
908
+ <span class="label">Preferred name</span>
909
+ <input
910
+ class="input"
911
+ type="text"
912
+ name="preferred-name"
913
+ autocomplete="name"
914
+ placeholder="e.g. Dominick"
915
+ .value=${a.preferredName}
916
+ @input=${this._handlePreferredNameInput}
917
+ ?disabled=${t || e}
918
+ />
919
+ <span class="helper">What should we call you?</span>
920
+ ${ht}
921
+ </label>
922
+
923
+ <label class="field">
924
+ <span class="label">Zip code</span>
925
+ <input
926
+ class="input"
927
+ type="text"
928
+ name="zip-code"
929
+ inputmode="numeric"
930
+ autocomplete="postal-code"
931
+ placeholder="5 digit zip"
932
+ .value=${a.zipCode}
933
+ @input=${this._handleZipCodeInput}
934
+ ?disabled=${t || e}
935
+ pattern="\\d{5}"
936
+ />
937
+ <span class="helper">Used for local weather and alerts.</span>
938
+ ${dt}
939
+ </label>
940
+
941
+ <label class="field">
942
+ <span class="label">Date of birth</span>
943
+ <input
944
+ class="input"
945
+ type="date"
946
+ name="date-of-birth"
947
+ autocomplete="bday"
948
+ .value=${a.dateOfBirth}
949
+ @input=${this._handleDateOfBirthInput}
950
+ ?disabled=${t || e}
951
+ max=${h}
952
+ />
953
+ <span class="helper">Format: YYYY-MM-DD</span>
954
+ ${ct}
955
+ </label>
956
+ </div>
957
+
958
+ <div class="action-row">
959
+ <span class="meta-note">
960
+ ${pt}
961
+ </span>
962
+ <div class="buttons">
963
+ <button
964
+ class="button secondary"
965
+ type="button"
966
+ @click=${this._handleReset}
967
+ ?disabled=${t || e || !l}
968
+ >
969
+ Reset
970
+ </button>
971
+ <button
972
+ class="button primary"
973
+ type="submit"
974
+ ?disabled=${t || e || !l || !d}
975
+ >
976
+ Save changes
977
+ </button>
978
+ </div>
979
+ </div>
980
+ </form>
981
+ </section>
982
+ `;
983
+ }
984
+ }
985
+ globalThis?.customElements && !globalThis.customElements.get("my-wral-settings") && globalThis.customElements.define("my-wral-settings", ot);
986
+ function Rt() {
987
+ const r = globalThis?.customElements;
988
+ r && (r.get("my-wral-settings") || r.define("my-wral-settings", ot));
989
+ }
990
+ typeof window < "u" && globalThis.customElements && Rt();
991
+ export {
992
+ Rt as defineAll
993
+ };