@ironflock/widget-value 0.0.0-stage → 1.1.34

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,948 @@
1
+ const H = globalThis, q = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, F = /* @__PURE__ */ Symbol(), Y = /* @__PURE__ */ new WeakMap();
2
+ let dt = class {
3
+ constructor(t, e, s) {
4
+ if (this._$cssResult$ = !0, s !== F) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5
+ this.cssText = t, this.t = e;
6
+ }
7
+ get styleSheet() {
8
+ let t = this.o;
9
+ const e = this.t;
10
+ if (q && t === void 0) {
11
+ const s = e !== void 0 && e.length === 1;
12
+ s && (t = Y.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Y.set(e, t));
13
+ }
14
+ return t;
15
+ }
16
+ toString() {
17
+ return this.cssText;
18
+ }
19
+ };
20
+ const mt = (i) => new dt(typeof i == "string" ? i : i + "", void 0, F), _t = (i, ...t) => {
21
+ const e = i.length === 1 ? i[0] : t.reduce(((s, r, n) => s + ((o) => {
22
+ if (o._$cssResult$ === !0) return o.cssText;
23
+ if (typeof o == "number") return o;
24
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
25
+ })(r) + i[n + 1]), i[0]);
26
+ return new dt(e, i, F);
27
+ }, yt = (i, t) => {
28
+ if (q) i.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
29
+ else for (const e of t) {
30
+ const s = document.createElement("style"), r = H.litNonce;
31
+ r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s);
32
+ }
33
+ }, tt = q ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
34
+ let e = "";
35
+ for (const s of t.cssRules) e += s.cssText;
36
+ return mt(e);
37
+ })(i) : i;
38
+ const { is: At, defineProperty: bt, getOwnPropertyDescriptor: xt, getOwnPropertyNames: St, getOwnPropertySymbols: wt, getPrototypeOf: Ct } = Object, B = globalThis, et = B.trustedTypes, Et = et ? et.emptyScript : "", Tt = B.reactiveElementPolyfillSupport, O = (i, t) => i, R = { toAttribute(i, t) {
39
+ switch (t) {
40
+ case Boolean:
41
+ i = i ? Et : null;
42
+ break;
43
+ case Object:
44
+ case Array:
45
+ i = i == null ? i : JSON.stringify(i);
46
+ }
47
+ return i;
48
+ }, fromAttribute(i, t) {
49
+ let e = i;
50
+ switch (t) {
51
+ case Boolean:
52
+ e = i !== null;
53
+ break;
54
+ case Number:
55
+ e = i === null ? null : Number(i);
56
+ break;
57
+ case Object:
58
+ case Array:
59
+ try {
60
+ e = JSON.parse(i);
61
+ } catch {
62
+ e = null;
63
+ }
64
+ }
65
+ return e;
66
+ } }, Z = (i, t) => !At(i, t), it = { attribute: !0, type: String, converter: R, reflect: !1, useDefault: !1, hasChanged: Z };
67
+ Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), B.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
68
+ let w = class extends HTMLElement {
69
+ static addInitializer(t) {
70
+ this._$Ei(), (this.l ??= []).push(t);
71
+ }
72
+ static get observedAttributes() {
73
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
74
+ }
75
+ static createProperty(t, e = it) {
76
+ 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) {
77
+ const s = /* @__PURE__ */ Symbol(), r = this.getPropertyDescriptor(t, s, e);
78
+ r !== void 0 && bt(this.prototype, t, r);
79
+ }
80
+ }
81
+ static getPropertyDescriptor(t, e, s) {
82
+ const { get: r, set: n } = xt(this.prototype, t) ?? { get() {
83
+ return this[e];
84
+ }, set(o) {
85
+ this[e] = o;
86
+ } };
87
+ return { get: r, set(o) {
88
+ const c = r?.call(this);
89
+ n?.call(this, o), this.requestUpdate(t, c, s);
90
+ }, configurable: !0, enumerable: !0 };
91
+ }
92
+ static getPropertyOptions(t) {
93
+ return this.elementProperties.get(t) ?? it;
94
+ }
95
+ static _$Ei() {
96
+ if (this.hasOwnProperty(O("elementProperties"))) return;
97
+ const t = Ct(this);
98
+ t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
99
+ }
100
+ static finalize() {
101
+ if (this.hasOwnProperty(O("finalized"))) return;
102
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(O("properties"))) {
103
+ const e = this.properties, s = [...St(e), ...wt(e)];
104
+ for (const r of s) this.createProperty(r, e[r]);
105
+ }
106
+ const t = this[Symbol.metadata];
107
+ if (t !== null) {
108
+ const e = litPropertyMetadata.get(t);
109
+ if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r);
110
+ }
111
+ this._$Eh = /* @__PURE__ */ new Map();
112
+ for (const [e, s] of this.elementProperties) {
113
+ const r = this._$Eu(e, s);
114
+ r !== void 0 && this._$Eh.set(r, e);
115
+ }
116
+ this.elementStyles = this.finalizeStyles(this.styles);
117
+ }
118
+ static finalizeStyles(t) {
119
+ const e = [];
120
+ if (Array.isArray(t)) {
121
+ const s = new Set(t.flat(1 / 0).reverse());
122
+ for (const r of s) e.unshift(tt(r));
123
+ } else t !== void 0 && e.push(tt(t));
124
+ return e;
125
+ }
126
+ static _$Eu(t, e) {
127
+ const s = e.attribute;
128
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
129
+ }
130
+ constructor() {
131
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
132
+ }
133
+ _$Ev() {
134
+ this._$ES = new Promise(((t) => this.enableUpdating = t)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t) => t(this)));
135
+ }
136
+ addController(t) {
137
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
138
+ }
139
+ removeController(t) {
140
+ this._$EO?.delete(t);
141
+ }
142
+ _$E_() {
143
+ const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
144
+ for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
145
+ t.size > 0 && (this._$Ep = t);
146
+ }
147
+ createRenderRoot() {
148
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
149
+ return yt(t, this.constructor.elementStyles), t;
150
+ }
151
+ connectedCallback() {
152
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t) => t.hostConnected?.()));
153
+ }
154
+ enableUpdating(t) {
155
+ }
156
+ disconnectedCallback() {
157
+ this._$EO?.forEach(((t) => t.hostDisconnected?.()));
158
+ }
159
+ attributeChangedCallback(t, e, s) {
160
+ this._$AK(t, s);
161
+ }
162
+ _$ET(t, e) {
163
+ const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s);
164
+ if (r !== void 0 && s.reflect === !0) {
165
+ const n = (s.converter?.toAttribute !== void 0 ? s.converter : R).toAttribute(e, s.type);
166
+ this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null;
167
+ }
168
+ }
169
+ _$AK(t, e) {
170
+ const s = this.constructor, r = s._$Eh.get(t);
171
+ if (r !== void 0 && this._$Em !== r) {
172
+ const n = s.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : R;
173
+ this._$Em = r, this[r] = o.fromAttribute(e, n.type) ?? this._$Ej?.get(r) ?? null, this._$Em = null;
174
+ }
175
+ }
176
+ requestUpdate(t, e, s) {
177
+ if (t !== void 0) {
178
+ const r = this.constructor, n = this[t];
179
+ if (s ??= r.getPropertyOptions(t), !((s.hasChanged ?? Z)(n, e) || s.useDefault && s.reflect && n === this._$Ej?.get(t) && !this.hasAttribute(r._$Eu(t, s)))) return;
180
+ this.C(t, e, s);
181
+ }
182
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
183
+ }
184
+ C(t, e, { useDefault: s, reflect: r, wrapped: n }, o) {
185
+ s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
186
+ }
187
+ async _$EP() {
188
+ this.isUpdatePending = !0;
189
+ try {
190
+ await this._$ES;
191
+ } catch (e) {
192
+ Promise.reject(e);
193
+ }
194
+ const t = this.scheduleUpdate();
195
+ return t != null && await t, !this.isUpdatePending;
196
+ }
197
+ scheduleUpdate() {
198
+ return this.performUpdate();
199
+ }
200
+ performUpdate() {
201
+ if (!this.isUpdatePending) return;
202
+ if (!this.hasUpdated) {
203
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
204
+ for (const [r, n] of this._$Ep) this[r] = n;
205
+ this._$Ep = void 0;
206
+ }
207
+ const s = this.constructor.elementProperties;
208
+ if (s.size > 0) for (const [r, n] of s) {
209
+ const { wrapped: o } = n, c = this[r];
210
+ o !== !0 || this._$AL.has(r) || c === void 0 || this.C(r, void 0, n, c);
211
+ }
212
+ }
213
+ let t = !1;
214
+ const e = this._$AL;
215
+ try {
216
+ t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(e)) : this._$EM();
217
+ } catch (s) {
218
+ throw t = !1, this._$EM(), s;
219
+ }
220
+ t && this._$AE(e);
221
+ }
222
+ willUpdate(t) {
223
+ }
224
+ _$AE(t) {
225
+ this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
226
+ }
227
+ _$EM() {
228
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
229
+ }
230
+ get updateComplete() {
231
+ return this.getUpdateComplete();
232
+ }
233
+ getUpdateComplete() {
234
+ return this._$ES;
235
+ }
236
+ shouldUpdate(t) {
237
+ return !0;
238
+ }
239
+ update(t) {
240
+ this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM();
241
+ }
242
+ updated(t) {
243
+ }
244
+ firstUpdated(t) {
245
+ }
246
+ };
247
+ w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, w[O("elementProperties")] = /* @__PURE__ */ new Map(), w[O("finalized")] = /* @__PURE__ */ new Map(), Tt?.({ ReactiveElement: w }), (B.reactiveElementVersions ??= []).push("2.1.0");
248
+ const J = globalThis, j = J.trustedTypes, st = j ? j.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, pt = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + _, Pt = `<${$t}>`, x = document, U = () => x.createComment(""), z = (i) => i === null || typeof i != "object" && typeof i != "function", K = Array.isArray, Ot = (i) => K(i) || typeof i?.[Symbol.iterator] == "function", I = `[
249
+ \f\r]`, T = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, rt = /-->/g, nt = />/g, y = RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^
250
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), ot = /'/g, at = /"/g, ft = /^(?:script|style|textarea|title)$/i, Mt = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), V = Mt(1), S = /* @__PURE__ */ Symbol.for("lit-noChange"), f = /* @__PURE__ */ Symbol.for("lit-nothing"), lt = /* @__PURE__ */ new WeakMap(), b = x.createTreeWalker(x, 129);
251
+ function gt(i, t) {
252
+ if (!K(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
253
+ return st !== void 0 ? st.createHTML(t) : t;
254
+ }
255
+ const Ut = (i, t) => {
256
+ const e = i.length - 1, s = [];
257
+ let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = T;
258
+ for (let c = 0; c < e; c++) {
259
+ const a = i[c];
260
+ let $, h, l = -1, u = 0;
261
+ for (; u < a.length && (o.lastIndex = u, h = o.exec(a), h !== null); ) u = o.lastIndex, o === T ? h[1] === "!--" ? o = rt : h[1] !== void 0 ? o = nt : h[2] !== void 0 ? (ft.test(h[2]) && (r = RegExp("</" + h[2], "g")), o = y) : h[3] !== void 0 && (o = y) : o === y ? h[0] === ">" ? (o = r ?? T, l = -1) : h[1] === void 0 ? l = -2 : (l = o.lastIndex - h[2].length, $ = h[1], o = h[3] === void 0 ? y : h[3] === '"' ? at : ot) : o === at || o === ot ? o = y : o === rt || o === nt ? o = T : (o = y, r = void 0);
262
+ const d = o === y && i[c + 1].startsWith("/>") ? " " : "";
263
+ n += o === T ? a + Pt : l >= 0 ? (s.push($), a.slice(0, l) + pt + a.slice(l) + _ + d) : a + _ + (l === -2 ? c : d);
264
+ }
265
+ return [gt(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
266
+ };
267
+ class D {
268
+ constructor({ strings: t, _$litType$: e }, s) {
269
+ let r;
270
+ this.parts = [];
271
+ let n = 0, o = 0;
272
+ const c = t.length - 1, a = this.parts, [$, h] = Ut(t, e);
273
+ if (this.el = D.createElement($, s), b.currentNode = this.el.content, e === 2 || e === 3) {
274
+ const l = this.el.content.firstChild;
275
+ l.replaceWith(...l.childNodes);
276
+ }
277
+ for (; (r = b.nextNode()) !== null && a.length < c; ) {
278
+ if (r.nodeType === 1) {
279
+ if (r.hasAttributes()) for (const l of r.getAttributeNames()) if (l.endsWith(pt)) {
280
+ const u = h[o++], d = r.getAttribute(l).split(_), p = /([.?@])?(.*)/.exec(u);
281
+ a.push({ type: 1, index: n, name: p[2], strings: d, ctor: p[1] === "." ? Dt : p[1] === "?" ? Nt : p[1] === "@" ? Ht : L }), r.removeAttribute(l);
282
+ } else l.startsWith(_) && (a.push({ type: 6, index: n }), r.removeAttribute(l));
283
+ if (ft.test(r.tagName)) {
284
+ const l = r.textContent.split(_), u = l.length - 1;
285
+ if (u > 0) {
286
+ r.textContent = j ? j.emptyScript : "";
287
+ for (let d = 0; d < u; d++) r.append(l[d], U()), b.nextNode(), a.push({ type: 2, index: ++n });
288
+ r.append(l[u], U());
289
+ }
290
+ }
291
+ } else if (r.nodeType === 8) if (r.data === $t) a.push({ type: 2, index: n });
292
+ else {
293
+ let l = -1;
294
+ for (; (l = r.data.indexOf(_, l + 1)) !== -1; ) a.push({ type: 7, index: n }), l += _.length - 1;
295
+ }
296
+ n++;
297
+ }
298
+ }
299
+ static createElement(t, e) {
300
+ const s = x.createElement("template");
301
+ return s.innerHTML = t, s;
302
+ }
303
+ }
304
+ function C(i, t, e = i, s) {
305
+ if (t === S) return t;
306
+ let r = s !== void 0 ? e._$Co?.[s] : e._$Cl;
307
+ const n = z(t) ? void 0 : t._$litDirective$;
308
+ return r?.constructor !== n && (r?._$AO?.(!1), n === void 0 ? r = void 0 : (r = new n(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = r : e._$Cl = r), r !== void 0 && (t = C(i, r._$AS(i, t.values), r, s)), t;
309
+ }
310
+ let zt = class {
311
+ constructor(t, e) {
312
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
313
+ }
314
+ get parentNode() {
315
+ return this._$AM.parentNode;
316
+ }
317
+ get _$AU() {
318
+ return this._$AM._$AU;
319
+ }
320
+ u(t) {
321
+ const { el: { content: e }, parts: s } = this._$AD, r = (t?.creationScope ?? x).importNode(e, !0);
322
+ b.currentNode = r;
323
+ let n = b.nextNode(), o = 0, c = 0, a = s[0];
324
+ for (; a !== void 0; ) {
325
+ if (o === a.index) {
326
+ let $;
327
+ a.type === 2 ? $ = new E(n, n.nextSibling, this, t) : a.type === 1 ? $ = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && ($ = new Rt(n, this, t)), this._$AV.push($), a = s[++c];
328
+ }
329
+ o !== a?.index && (n = b.nextNode(), o++);
330
+ }
331
+ return b.currentNode = x, r;
332
+ }
333
+ p(t) {
334
+ let e = 0;
335
+ 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++;
336
+ }
337
+ };
338
+ class E {
339
+ get _$AU() {
340
+ return this._$AM?._$AU ?? this._$Cv;
341
+ }
342
+ constructor(t, e, s, r) {
343
+ this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = r, this._$Cv = r?.isConnected ?? !0;
344
+ }
345
+ get parentNode() {
346
+ let t = this._$AA.parentNode;
347
+ const e = this._$AM;
348
+ return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
349
+ }
350
+ get startNode() {
351
+ return this._$AA;
352
+ }
353
+ get endNode() {
354
+ return this._$AB;
355
+ }
356
+ _$AI(t, e = this) {
357
+ t = C(this, t, e), z(t) ? t === f || t == null || t === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : t !== this._$AH && t !== S && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ot(t) ? this.k(t) : this._(t);
358
+ }
359
+ O(t) {
360
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
361
+ }
362
+ T(t) {
363
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
364
+ }
365
+ _(t) {
366
+ this._$AH !== f && z(this._$AH) ? this._$AA.nextSibling.data = t : this.T(x.createTextNode(t)), this._$AH = t;
367
+ }
368
+ $(t) {
369
+ const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = D.createElement(gt(s.h, s.h[0]), this.options)), s);
370
+ if (this._$AH?._$AD === r) this._$AH.p(e);
371
+ else {
372
+ const n = new zt(r, this), o = n.u(this.options);
373
+ n.p(e), this.T(o), this._$AH = n;
374
+ }
375
+ }
376
+ _$AC(t) {
377
+ let e = lt.get(t.strings);
378
+ return e === void 0 && lt.set(t.strings, e = new D(t)), e;
379
+ }
380
+ k(t) {
381
+ K(this._$AH) || (this._$AH = [], this._$AR());
382
+ const e = this._$AH;
383
+ let s, r = 0;
384
+ for (const n of t) r === e.length ? e.push(s = new E(this.O(U()), this.O(U()), this, this.options)) : s = e[r], s._$AI(n), r++;
385
+ r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
386
+ }
387
+ _$AR(t = this._$AA.nextSibling, e) {
388
+ for (this._$AP?.(!1, !0, e); t && t !== this._$AB; ) {
389
+ const s = t.nextSibling;
390
+ t.remove(), t = s;
391
+ }
392
+ }
393
+ setConnected(t) {
394
+ this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
395
+ }
396
+ }
397
+ class L {
398
+ get tagName() {
399
+ return this.element.tagName;
400
+ }
401
+ get _$AU() {
402
+ return this._$AM._$AU;
403
+ }
404
+ constructor(t, e, s, r, n) {
405
+ this.type = 1, this._$AH = f, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = f;
406
+ }
407
+ _$AI(t, e = this, s, r) {
408
+ const n = this.strings;
409
+ let o = !1;
410
+ if (n === void 0) t = C(this, t, e, 0), o = !z(t) || t !== this._$AH && t !== S, o && (this._$AH = t);
411
+ else {
412
+ const c = t;
413
+ let a, $;
414
+ for (t = n[0], a = 0; a < n.length - 1; a++) $ = C(this, c[s + a], e, a), $ === S && ($ = this._$AH[a]), o ||= !z($) || $ !== this._$AH[a], $ === f ? t = f : t !== f && (t += ($ ?? "") + n[a + 1]), this._$AH[a] = $;
415
+ }
416
+ o && !r && this.j(t);
417
+ }
418
+ j(t) {
419
+ t === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
420
+ }
421
+ }
422
+ class Dt extends L {
423
+ constructor() {
424
+ super(...arguments), this.type = 3;
425
+ }
426
+ j(t) {
427
+ this.element[this.name] = t === f ? void 0 : t;
428
+ }
429
+ }
430
+ class Nt extends L {
431
+ constructor() {
432
+ super(...arguments), this.type = 4;
433
+ }
434
+ j(t) {
435
+ this.element.toggleAttribute(this.name, !!t && t !== f);
436
+ }
437
+ }
438
+ class Ht extends L {
439
+ constructor(t, e, s, r, n) {
440
+ super(t, e, s, r, n), this.type = 5;
441
+ }
442
+ _$AI(t, e = this) {
443
+ if ((t = C(this, t, e, 0) ?? f) === S) return;
444
+ const s = this._$AH, r = t === f && s !== f || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== f && (s === f || r);
445
+ r && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
446
+ }
447
+ handleEvent(t) {
448
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
449
+ }
450
+ }
451
+ class Rt {
452
+ constructor(t, e, s) {
453
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
454
+ }
455
+ get _$AU() {
456
+ return this._$AM._$AU;
457
+ }
458
+ _$AI(t) {
459
+ C(this, t);
460
+ }
461
+ }
462
+ const jt = { I: E }, Bt = J.litHtmlPolyfillSupport;
463
+ Bt?.(D, E), (J.litHtmlVersions ??= []).push("3.3.0");
464
+ const Lt = (i, t, e) => {
465
+ const s = e?.renderBefore ?? t;
466
+ let r = s._$litPart$;
467
+ if (r === void 0) {
468
+ const n = e?.renderBefore ?? null;
469
+ s._$litPart$ = r = new E(t.insertBefore(U(), n), n, void 0, e ?? {});
470
+ }
471
+ return r._$AI(i), r;
472
+ };
473
+ const Q = globalThis;
474
+ let M = class extends w {
475
+ constructor() {
476
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
477
+ }
478
+ createRenderRoot() {
479
+ const t = super.createRenderRoot();
480
+ return this.renderOptions.renderBefore ??= t.firstChild, t;
481
+ }
482
+ update(t) {
483
+ const e = this.render();
484
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Lt(e, this.renderRoot, this.renderOptions);
485
+ }
486
+ connectedCallback() {
487
+ super.connectedCallback(), this._$Do?.setConnected(!0);
488
+ }
489
+ disconnectedCallback() {
490
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
491
+ }
492
+ render() {
493
+ return S;
494
+ }
495
+ };
496
+ M._$litElement$ = !0, M.finalized = !0, Q.litElementHydrateSupport?.({ LitElement: M });
497
+ const kt = Q.litElementPolyfillSupport;
498
+ kt?.({ LitElement: M });
499
+ (Q.litElementVersions ??= []).push("4.2.0");
500
+ const It = { CHILD: 2 }, Vt = (i) => (...t) => ({ _$litDirective$: i, values: t });
501
+ class Wt {
502
+ constructor(t) {
503
+ }
504
+ get _$AU() {
505
+ return this._$AM._$AU;
506
+ }
507
+ _$AT(t, e, s) {
508
+ this._$Ct = t, this._$AM = e, this._$Ci = s;
509
+ }
510
+ _$AS(t, e) {
511
+ return this.update(t, e);
512
+ }
513
+ update(t, e) {
514
+ return this.render(...e);
515
+ }
516
+ }
517
+ const { I: qt } = jt, ht = () => document.createComment(""), P = (i, t, e) => {
518
+ const s = i._$AA.parentNode, r = t === void 0 ? i._$AB : t._$AA;
519
+ if (e === void 0) {
520
+ const n = s.insertBefore(ht(), r), o = s.insertBefore(ht(), r);
521
+ e = new qt(n, o, i, i.options);
522
+ } else {
523
+ const n = e._$AB.nextSibling, o = e._$AM, c = o !== i;
524
+ if (c) {
525
+ let a;
526
+ e._$AQ?.(i), e._$AM = i, e._$AP !== void 0 && (a = i._$AU) !== o._$AU && e._$AP(a);
527
+ }
528
+ if (n !== r || c) {
529
+ let a = e._$AA;
530
+ for (; a !== n; ) {
531
+ const $ = a.nextSibling;
532
+ s.insertBefore(a, r), a = $;
533
+ }
534
+ }
535
+ }
536
+ return e;
537
+ }, A = (i, t, e = i) => (i._$AI(t, e), i), Ft = {}, Zt = (i, t = Ft) => i._$AH = t, Jt = (i) => i._$AH, W = (i) => {
538
+ i._$AP?.(!1, !0);
539
+ let t = i._$AA;
540
+ const e = i._$AB.nextSibling;
541
+ for (; t !== e; ) {
542
+ const s = t.nextSibling;
543
+ t.remove(), t = s;
544
+ }
545
+ };
546
+ const ct = (i, t, e) => {
547
+ const s = /* @__PURE__ */ new Map();
548
+ for (let r = t; r <= e; r++) s.set(i[r], r);
549
+ return s;
550
+ }, ut = Vt(class extends Wt {
551
+ constructor(i) {
552
+ if (super(i), i.type !== It.CHILD) throw Error("repeat() can only be used in text expressions");
553
+ }
554
+ dt(i, t, e) {
555
+ let s;
556
+ e === void 0 ? e = t : t !== void 0 && (s = t);
557
+ const r = [], n = [];
558
+ let o = 0;
559
+ for (const c of i) r[o] = s ? s(c, o) : o, n[o] = e(c, o), o++;
560
+ return { values: n, keys: r };
561
+ }
562
+ render(i, t, e) {
563
+ return this.dt(i, t, e).values;
564
+ }
565
+ update(i, [t, e, s]) {
566
+ const r = Jt(i), { values: n, keys: o } = this.dt(t, e, s);
567
+ if (!Array.isArray(r)) return this.ut = o, n;
568
+ const c = this.ut ??= [], a = [];
569
+ let $, h, l = 0, u = r.length - 1, d = 0, p = n.length - 1;
570
+ for (; l <= u && d <= p; ) if (r[l] === null) l++;
571
+ else if (r[u] === null) u--;
572
+ else if (c[l] === o[d]) a[d] = A(r[l], n[d]), l++, d++;
573
+ else if (c[u] === o[p]) a[p] = A(r[u], n[p]), u--, p--;
574
+ else if (c[l] === o[p]) a[p] = A(r[l], n[p]), P(i, a[p + 1], r[l]), l++, p--;
575
+ else if (c[u] === o[d]) a[d] = A(r[u], n[d]), P(i, r[l], r[u]), u--, d++;
576
+ else if ($ === void 0 && ($ = ct(o, d, p), h = ct(c, l, u)), $.has(c[l])) if ($.has(c[u])) {
577
+ const g = h.get(o[d]), k = g !== void 0 ? r[g] : null;
578
+ if (k === null) {
579
+ const X = P(i, r[l]);
580
+ A(X, n[d]), a[d] = X;
581
+ } else a[d] = A(k, n[d]), P(i, r[l], k), r[g] = null;
582
+ d++;
583
+ } else W(r[u]), u--;
584
+ else W(r[l]), l++;
585
+ for (; d <= p; ) {
586
+ const g = P(i, a[p + 1]);
587
+ A(g, n[d]), a[d++] = g;
588
+ }
589
+ for (; l <= u; ) {
590
+ const g = r[l++];
591
+ g !== null && W(g);
592
+ }
593
+ return this.ut = o, Zt(i, a), S;
594
+ }
595
+ });
596
+ const Kt = (i) => (t, e) => {
597
+ e !== void 0 ? e.addInitializer((() => {
598
+ customElements.define(i, t);
599
+ })) : customElements.define(i, t);
600
+ };
601
+ const Qt = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: Z }, Gt = (i = Qt, t, e) => {
602
+ const { kind: s, metadata: r } = e;
603
+ let n = globalThis.litPropertyMetadata.get(r);
604
+ if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), n.set(e.name, i), s === "accessor") {
605
+ const { name: o } = e;
606
+ return { set(c) {
607
+ const a = t.get.call(this);
608
+ t.set.call(this, c), this.requestUpdate(o, a, i);
609
+ }, init(c) {
610
+ return c !== void 0 && this.C(o, void 0, i, c), c;
611
+ } };
612
+ }
613
+ if (s === "setter") {
614
+ const { name: o } = e;
615
+ return function(c) {
616
+ const a = this[o];
617
+ t.call(this, c), this.requestUpdate(o, a, i);
618
+ };
619
+ }
620
+ throw Error("Unsupported decorator location: " + s);
621
+ };
622
+ function G(i) {
623
+ return (t, e) => typeof e == "object" ? Gt(i, t, e) : ((s, r, n) => {
624
+ const o = r.hasOwnProperty(n);
625
+ return r.constructor.createProperty(n, s), o ? Object.getOwnPropertyDescriptor(r, n) : void 0;
626
+ })(i, t, e);
627
+ }
628
+ function N(i) {
629
+ return G({ ...i, state: !0, attribute: !1 });
630
+ }
631
+ const Xt = (i, t, e) => (e.configurable = !0, e.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(i, t, e), e);
632
+ function vt(i, t) {
633
+ return (e, s, r) => {
634
+ const n = (o) => o.renderRoot?.querySelector(i) ?? null;
635
+ return Xt(e, s, { get() {
636
+ return n(this);
637
+ } });
638
+ };
639
+ }
640
+ var Yt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, m = (i, t, e, s) => {
641
+ for (var r = s > 1 ? void 0 : s ? te(t, e) : t, n = i.length - 1, o; n >= 0; n--)
642
+ (o = i[n]) && (r = (s ? o(t, e, r) : o(r)) || r);
643
+ return s && r && Yt(t, e, r), r;
644
+ };
645
+ const ee = new Intl.DateTimeFormat(void 0, {
646
+ year: "numeric",
647
+ month: "short",
648
+ day: "numeric",
649
+ hour: "2-digit",
650
+ minute: "2-digit"
651
+ }), ie = (i) => {
652
+ if (i == null || i === "") return;
653
+ const t = /^\s*-?\d+(\.\d+)?\s*$/.test(String(i)) ? Number(i) : Date.parse(String(i));
654
+ return Number.isFinite(t) ? new Date(t) : void 0;
655
+ };
656
+ let v = class extends M {
657
+ constructor() {
658
+ super(), this.dataSets = /* @__PURE__ */ new Map(), this.textActive = !0, this.version = "1.1.34", this.origWidth = 0, this.origHeight = 0, this.resizeObserver = new ResizeObserver(this.applyData.bind(this)), this.resizeObserver.observe(this);
659
+ }
660
+ disconnectedCallback() {
661
+ super.disconnectedCallback(), this.resizeObserver && this.resizeObserver.disconnect();
662
+ }
663
+ firstUpdated(i) {
664
+ this.registerTheme(this.theme);
665
+ }
666
+ update(i) {
667
+ i.has("inputData") && this.transformData(), super.update(i);
668
+ }
669
+ updated(i) {
670
+ i.has("inputData") && (this.sizingSetup(), this.applyData()), i.has("theme") && this.registerTheme(this.theme), super.updated(i);
671
+ }
672
+ registerTheme(i) {
673
+ const t = this.theme?.theme_object?.backgroundColor, e = this.theme?.theme_object?.title?.textStyle?.color, s = this.theme?.theme_object?.title?.subtextStyle?.color || e;
674
+ this.themeBgColor = `var(--re-tile-background-color, ${t ?? "transparent"})`, this.themeTitleColor = `var(--re-text-color, ${e ?? "inherit"})`, this.themeSubtitleColor = `var(--re-text-color, ${s ?? "inherit"})`;
675
+ }
676
+ subTitleText() {
677
+ const i = this.inputData?.subTitle;
678
+ if (this.inputData?.subTitleType !== "timestamp") return i;
679
+ const t = ie(i);
680
+ return t ? ee.format(t) : i;
681
+ }
682
+ sizingSetup() {
683
+ const i = Array.from(
684
+ this.sizingContainer?.querySelectorAll(".single-value")
685
+ );
686
+ let t = 0, e = 0;
687
+ for (const s of i) {
688
+ const r = s.getBoundingClientRect();
689
+ t = Math.max(r.width, t), e = Math.max(r.height, e);
690
+ }
691
+ t < this.origWidth ? (!this.lastLargerWidthTime || Date.now() - this.lastLargerWidthTime > 5e3) && (this.origWidth = t) : (this.origWidth = t, this.lastLargerWidthTime = Date.now()), this.origHeight = e;
692
+ }
693
+ applyData() {
694
+ if (!this.valueContainer) return;
695
+ const i = this.valueContainer.getBoundingClientRect().width, t = this.valueContainer.getBoundingClientRect().height, e = this.dataSets.size, s = this.origWidth, r = this.origHeight;
696
+ if (!i || !t || !s || !r) return;
697
+ const n = [];
698
+ for (let h = 1; h <= e; h++) {
699
+ const l = Math.ceil(e / h), u = i - 12 * (h - 1), d = t - 12 * (l - 1), p = u / s / h, g = p * p * s * r * e;
700
+ l * p * r <= d && n.push({ r: l, c: h, m: p, size: g, width: s, height: r, userWidth: i, userHeight: t });
701
+ }
702
+ for (let h = 1; h <= e; h++) {
703
+ const l = Math.ceil(e / h), u = i - 12 * (l - 1), p = (t - 12 * (h - 1)) / r / h, g = p * p * s * r * e;
704
+ l * p * s <= u && n.push({ r: h, c: l, m: p, size: g, width: s, height: r, userWidth: i, userHeight: t });
705
+ }
706
+ const o = n.reduce((h, l) => l.size < h ? h : l.size, 0), c = n.find((h) => h.size === o);
707
+ if (!c) return;
708
+ const a = c.m ?? 1, $ = Array.from(
709
+ this.valueContainer?.querySelectorAll(".single-value")
710
+ );
711
+ this.valueContainer.style.gridTemplateColumns = `repeat(${c.c}, 1fr)`;
712
+ for (const h of $) {
713
+ h.setAttribute(
714
+ "style",
715
+ `width:${a * s}px; height:${a * r}px; padding:${a * 6}px`
716
+ );
717
+ const l = h.getAttribute("label"), u = this.dataSets.get(l ?? "");
718
+ h.querySelector(".label").setAttribute(
719
+ "style",
720
+ `font-size: ${26 * a}px;
721
+ color: ${u?.styling?.labelColor || this.themeTitleColor};`
722
+ ), h.querySelector(".current-value").setAttribute(
723
+ "style",
724
+ `font-size: ${32 * a}px;
725
+ color: ${u?.styling?.valueColor || this.theme?.theme_object?.color?.[0] || this.themeTitleColor};`
726
+ ), h.querySelector(".unit").setAttribute("style", `font-size: ${26 * a}px;`);
727
+ }
728
+ this.textActive = !0;
729
+ }
730
+ async transformData() {
731
+ this.inputData && (this.dataSets.forEach((i) => {
732
+ i.label ??= "";
733
+ }), this.dataSets = /* @__PURE__ */ new Map(), this.inputData?.dataseries?.forEach((i) => {
734
+ const t = i.multiChart ? [...new Set(i.data?.map((e) => e.pivot))].sort() : [""];
735
+ t.forEach((e) => {
736
+ const s = e ?? "", r = i.label ?? "", n = {
737
+ label: s + (s && r ? " - " : "") + r,
738
+ order: i.order,
739
+ unit: i.unit,
740
+ precision: i.precision,
741
+ advanced: i.advanced,
742
+ styling: i.styling,
743
+ multiChart: i.multiChart,
744
+ value: i.value,
745
+ data: t.length === 1 ? i.data : i.data?.filter((o) => o.pivot === e),
746
+ needleValue: void 0
747
+ };
748
+ this.dataSets.set(n.label ?? "", n);
749
+ });
750
+ }), this.dataSets.forEach((i, t) => {
751
+ if (i.advanced ??= {}, (typeof i.advanced?.averageLatest != "number" || isNaN(i.advanced?.averageLatest)) && (i.advanced.averageLatest = 1), !i.multiChart)
752
+ i.needleValue = i.value === void 0 || i.value === null ? void 0 : Number(i.value);
753
+ else {
754
+ const e = i?.data?.slice(-i?.advanced?.averageLatest || -1) ?? [], s = e?.map((n) => n.value)?.filter((n) => n !== void 0)?.map(Number) ?? [];
755
+ i.needleValue = s.reduce((n, o) => n + o, 0) / s.length;
756
+ const r = Date.parse(e?.[e.length - 1]?.tsp ?? "");
757
+ isNaN(r) || (/* @__PURE__ */ new Date()).getTime() - r > (i.advanced?.maxLatency ?? 1 / 0) * 1e3 && (i.needleValue = void 0);
758
+ }
759
+ }));
760
+ }
761
+ render() {
762
+ return V`
763
+ <div
764
+ class="wrapper"
765
+ style="background-color: ${this.themeBgColor}; color: ${this.themeTitleColor}"
766
+ >
767
+ <header>
768
+ <h3 class="paging" ?active=${this.inputData?.title}>${this.inputData?.title}</h3>
769
+ <p
770
+ class="paging"
771
+ ?active=${this.inputData?.subTitle}
772
+ style="color: ${this.themeSubtitleColor}"
773
+ >
774
+ ${this.subTitleText()}
775
+ </p>
776
+ </header>
777
+ <div class="sizing-container">
778
+ ${ut(
779
+ this.dataSets,
780
+ ([i]) => i,
781
+ ([i, t]) => V`
782
+ <div class="single-value" label="${i}">
783
+ <div class="label paging" ?active=${this.textActive}>${i}</div>
784
+ <span
785
+ class="current-value paging"
786
+ ?active=${this.textActive}
787
+ style="color: ${t?.styling?.valueColor || this.theme?.theme_object?.color?.[0] || this.themeTitleColor}"
788
+ >
789
+ ${t.needleValue === void 0 || t.needleValue === null || isNaN(t.needleValue) ? "" : t.needleValue.toFixed(Math.max(0, t.precision ?? 0))}
790
+ <span class="unit paging" ?active=${this.textActive}>${t.unit}</span>
791
+ </span>
792
+ </div>
793
+ `
794
+ )}
795
+ </div>
796
+ <div class="paging no-data" ?active=${!this.dataSets.size}>No Data</div>
797
+ <div class="value-container">
798
+ ${ut(
799
+ [...this.dataSets.entries()].sort(),
800
+ ([i]) => i,
801
+ ([i, t]) => V`
802
+ <div class="single-value" label="${i}">
803
+ <div
804
+ class="label paging"
805
+ style="color: ${t?.styling?.labelColor || this.themeTitleColor}"
806
+ ?active=${this.textActive}
807
+ >
808
+ ${i}
809
+ </div>
810
+ <span
811
+ class="current-value paging"
812
+ ?active=${this.textActive}
813
+ style="color: ${t?.styling?.valueColor || this.theme?.theme_object?.color?.[0] || this.themeTitleColor}"
814
+ >
815
+ ${t.needleValue === void 0 || t.needleValue === null || isNaN(t.needleValue) ? "" : t.needleValue.toFixed(Math.max(0, t.precision ?? 0))}
816
+ <span class="unit paging" ?active=${this.textActive}>${t.unit}</span>
817
+ </span>
818
+ </div>
819
+ `
820
+ )}
821
+ </div>
822
+ </div>
823
+ `;
824
+ }
825
+ };
826
+ v.styles = _t`
827
+ :host {
828
+ display: block;
829
+ font-family: sans-serif;
830
+ box-sizing: border-box;
831
+ position: relative;
832
+ margin: auto;
833
+ overflow: hidden;
834
+ container-type: size;
835
+ }
836
+
837
+ .paging:not([active]) {
838
+ display: none !important;
839
+ }
840
+
841
+ .wrapper {
842
+ display: flex;
843
+ flex-direction: column;
844
+ height: 100%;
845
+ width: 100%;
846
+ padding: 2cqh 2cqw;
847
+ box-sizing: border-box;
848
+ }
849
+
850
+ h3 {
851
+ margin: 0;
852
+ max-width: 300px;
853
+ overflow: hidden;
854
+ text-overflow: ellipsis;
855
+ white-space: nowrap;
856
+ }
857
+ p {
858
+ margin: 10px 0 0 0;
859
+ max-width: 300px;
860
+ font-size: 14px;
861
+ line-height: 17px;
862
+ overflow: hidden;
863
+ text-overflow: ellipsis;
864
+ white-space: nowrap;
865
+ }
866
+
867
+ .value-container {
868
+ display: grid;
869
+ line-height: 0.9;
870
+ flex: 1;
871
+ overflow: hidden;
872
+ position: relative;
873
+ gap: 12px;
874
+ }
875
+
876
+ .single-value {
877
+ overflow: hidden;
878
+ position: relative;
879
+ align-items: end;
880
+ padding: 6px;
881
+ box-sizing: border-box;
882
+ }
883
+
884
+ .current-value {
885
+ font-size: 32px;
886
+ font-weight: 600;
887
+ white-space: nowrap;
888
+ }
889
+
890
+ .label,
891
+ .unit {
892
+ font-weight: 300;
893
+ font-size: 26px;
894
+ white-space: nowrap;
895
+ }
896
+
897
+ .sizing-container {
898
+ position: absolute;
899
+ left: 100000px;
900
+ line-height: 0.9;
901
+ overflow: hidden;
902
+ gap: 12px;
903
+ }
904
+
905
+ .no-data {
906
+ font-size: 20px;
907
+ display: flex;
908
+ height: 100%;
909
+ width: 100%;
910
+ text-align: center;
911
+ align-items: center;
912
+ justify-content: center;
913
+ }
914
+ `;
915
+ m([
916
+ G({ type: Object })
917
+ ], v.prototype, "inputData", 2);
918
+ m([
919
+ G({ type: Object })
920
+ ], v.prototype, "theme", 2);
921
+ m([
922
+ N()
923
+ ], v.prototype, "dataSets", 2);
924
+ m([
925
+ N()
926
+ ], v.prototype, "textActive", 2);
927
+ m([
928
+ N()
929
+ ], v.prototype, "themeBgColor", 2);
930
+ m([
931
+ N()
932
+ ], v.prototype, "themeTitleColor", 2);
933
+ m([
934
+ N()
935
+ ], v.prototype, "themeSubtitleColor", 2);
936
+ m([
937
+ vt(".value-container")
938
+ ], v.prototype, "valueContainer", 2);
939
+ m([
940
+ vt(".sizing-container")
941
+ ], v.prototype, "sizingContainer", 2);
942
+ v = m([
943
+ Kt("widget-value-1.1.34")
944
+ ], v);
945
+ export {
946
+ v as WidgetValue
947
+ };
948
+ //# sourceMappingURL=widget-value.js.map