From 316503cf7302fd7629ea8a17700393ac8622e266 Mon Sep 17 00:00:00 2001 From: dev_agent <17+dev_agent@code.cubecraftcreations.com> Date: Wed, 23 Sep 2026 09:40:52 -0400 Subject: [PATCH] Feature 20: Cards auto-discover children from the household roster (#174) --- custom_components/nestquest/sensor.py | 69 +- .../nestquest/www/nestquest-cards.js | 724 +++++++++--------- frontend/package-lock.json | 522 +++++++++++++ frontend/package.json | 1 + frontend/src/cards/party-board.ts | 43 +- frontend/tests/render-party-board.mjs | 56 ++ tests/test_panel_cards.py | 133 +++- tests/test_sensors.py | 113 +++ 8 files changed, 1296 insertions(+), 365 deletions(-) create mode 100644 frontend/tests/render-party-board.mjs diff --git a/custom_components/nestquest/sensor.py b/custom_components/nestquest/sensor.py index eef0417..4159dc3 100644 --- a/custom_components/nestquest/sensor.py +++ b/custom_components/nestquest/sensor.py @@ -21,6 +21,8 @@ missed instances, and ``admin_instances`` includes them (D-009). """ from __future__ import annotations +import re +import unicodedata from collections.abc import Callable, Iterable from typing import Any @@ -41,13 +43,18 @@ from .coordinator import ( ) from .core.snapshot import instance_payload -#: Home Assistant's state machine refuses states longer than 255 +#: HA's state machine refuses states longer than 255 #: characters (its hard recorder/state limit). These sensors' states #: are numeric, but the guard is applied uniformly: a payload-bearing #: sensor can never crash the state write, and later string-state #: sensors reuse the same helper. MAX_STATE_LENGTH = 255 +#: Entity-id length cap the slug mirror applies: HA truncates the +#: entity_id (``sensor.`` + slug) at MAX_LENGTH_STATE_ENTITY_ID (64), +#: so the slugged object id alone may not exceed 64 - len("sensor."). +_MAX_SLUG_LENGTH = 64 - len("sensor.") + def _state_within_limit(state: Any) -> Any: """Return ``state`` unchanged, refusing strings over HA's limit. @@ -98,6 +105,56 @@ def _next_open_quest( ) +def _slugify(text: str) -> str: + """Slugify a display name the way Home Assistant derives entity ids. + + Mirrors ``homeassistant.util.slugify`` (the unicode path HA runs + entity names through) for accented-Latin names: NFKD-normalize, + fold to ASCII (accents drop out with their combining marks), + lowercase, and turn every run of non-alphanumerics into one + underscore, capped at HA's entity-id length like the registry does. + The documented divergence from HA's vendored slugifier is unidecode: + HA transliterates any script to ASCII (so e.g. non-Latin names + survive), this mirror drops those characters instead, and a name + that then slugs to nothing falls through to HA's ``unknown`` + sentinel — the same answer HA's wrapper gives. (The harness is + mock-only — no real HA to import the helper from — and entity ids + are registry identity, so the mirror is deliberate.) + """ + slug = unicodedata.normalize("NFKD", text) + slug = slug.encode("ascii", "ignore").decode("ascii") + slug = re.sub(r"[^a-z0-9]+", "_", slug.lower()).strip("_") + return (slug or "unknown")[:_MAX_SLUG_LENGTH] + + +def _child_roster(children: Iterable[ChildDaySnapshot]) -> list[dict[str, Any]]: + """The ordered child roster the panel cards discover children from. + + One entry per ACTIVE child in the snapshot's order (the API's + sort_order, then id): ``child_id``, ``name``, and the ``slug`` the + entity-id derivation produces for the child's name — the piece the + cards need to build ``sensor.nestquest__...`` ids. Duplicate + display names get the registry's ``_2``/``_3`` suffix in snapshot + order, matching how HA resolves the collision at registration. The + rollups' ``children`` attribute (per-child counts) is unchanged and + carries a different shape on purpose. + """ + slugs: dict[str, int] = {} + roster: list[dict[str, Any]] = [] + for child in children: + base = _slugify(child.child_name) + taken = slugs.get(base, 0) + 1 + slugs[base] = taken + roster.append( + { + "child_id": child.child_id, + "name": child.child_name, + "slug": base if taken == 1 else f"{base}_{taken}", + } + ) + return roster + + class _NestQuestChildDaySensor(CoordinatorEntity, SensorEntity): """Base for the per-child day sensors. @@ -356,7 +413,12 @@ class _NestQuestHouseholdSensor(CoordinatorEntity, SensorEntity): class NestQuestHouseholdDueTodaySensor(_NestQuestHouseholdSensor): - """Total quests due today across active children.""" + """Total quests due today across active children. + + Also publishes ``child_roster`` (see :func:`_child_roster`): the + ordered child identity list the panel cards read to discover the + board's children when the card config carries no ``child_order``. + """ _attr_name = "NestQuest household quests due today" _attr_state_class = SensorStateClass.MEASUREMENT @@ -380,7 +442,8 @@ class NestQuestHouseholdDueTodaySensor(_NestQuestHouseholdSensor): "children": { str(child.child_id): child.due_today for child in data.children - } + }, + "child_roster": _child_roster(data.children), } diff --git a/custom_components/nestquest/www/nestquest-cards.js b/custom_components/nestquest/www/nestquest-cards.js index ede7aab..68a717f 100644 --- a/custom_components/nestquest/www/nestquest-cards.js +++ b/custom_components/nestquest/www/nestquest-cards.js @@ -17,53 +17,53 @@ let zt = class { return this.cssText; } }; -const v = (s) => new zt(typeof s == "string" ? s : s + "", void 0, it), Pt = (s, ...t) => { - const e = s.length === 1 ? s[0] : t.reduce((n, i, r) => n + ((o) => { +const v = (i) => new zt(typeof i == "string" ? i : i + "", void 0, it), Pt = (i, ...t) => { + const e = i.length === 1 ? i[0] : t.reduce((n, s, r) => n + ((o) => { if (o._$cssResult$ === !0) return o.cssText; if (typeof o == "number") return o; throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); - })(i) + s[r + 1], s[0]); - return new zt(e, s, it); -}, Bt = (s, t) => { - if (nt) s.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet); + })(s) + i[r + 1], i[0]); + return new zt(e, i, it); +}, Bt = (i, t) => { + if (nt) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet); else for (const e of t) { - const n = document.createElement("style"), i = B.litNonce; - i !== void 0 && n.setAttribute("nonce", i), n.textContent = e.cssText, s.appendChild(n); + const n = document.createElement("style"), s = B.litNonce; + s !== void 0 && n.setAttribute("nonce", s), n.textContent = e.cssText, i.appendChild(n); } -}, ct = nt ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => { +}, ct = nt ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => { let e = ""; for (const n of t.cssRules) e += n.cssText; return v(e); -})(s) : s; -const { is: Ft, defineProperty: Qt, getOwnPropertyDescriptor: Wt, getOwnPropertyNames: Zt, getOwnPropertySymbols: Gt, getPrototypeOf: Vt } = Object, W = globalThis, dt = W.trustedTypes, Kt = dt ? dt.emptyScript : "", Jt = W.reactiveElementPolyfillSupport, I = (s, t) => s, et = { toAttribute(s, t) { +})(i) : i; +const { is: Ft, defineProperty: Qt, getOwnPropertyDescriptor: Wt, getOwnPropertyNames: Zt, getOwnPropertySymbols: Gt, getPrototypeOf: Vt } = Object, W = globalThis, dt = W.trustedTypes, Kt = dt ? dt.emptyScript : "", Jt = W.reactiveElementPolyfillSupport, I = (i, t) => i, et = { toAttribute(i, t) { switch (t) { case Boolean: - s = s ? Kt : null; + i = i ? Kt : null; break; case Object: case Array: - s = s == null ? s : JSON.stringify(s); + i = i == null ? i : JSON.stringify(i); } - return s; -}, fromAttribute(s, t) { - let e = s; + return i; +}, fromAttribute(i, t) { + let e = i; switch (t) { case Boolean: - e = s !== null; + e = i !== null; break; case Number: - e = s === null ? null : Number(s); + e = i === null ? null : Number(i); break; case Object: case Array: try { - e = JSON.parse(s); + e = JSON.parse(i); } catch { e = null; } } return e; -} }, It = (s, t) => !Ft(s, t), pt = { attribute: !0, type: String, converter: et, reflect: !1, useDefault: !1, hasChanged: It }; +} }, It = (i, t) => !Ft(i, t), pt = { attribute: !0, type: String, converter: et, reflect: !1, useDefault: !1, hasChanged: It }; Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), W.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); let E = class extends HTMLElement { static addInitializer(t) { @@ -74,18 +74,18 @@ let E = class extends HTMLElement { } static createProperty(t, e = pt) { 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) { - const n = /* @__PURE__ */ Symbol(), i = this.getPropertyDescriptor(t, n, e); - i !== void 0 && Qt(this.prototype, t, i); + const n = /* @__PURE__ */ Symbol(), s = this.getPropertyDescriptor(t, n, e); + s !== void 0 && Qt(this.prototype, t, s); } } static getPropertyDescriptor(t, e, n) { - const { get: i, set: r } = Wt(this.prototype, t) ?? { get() { + const { get: s, set: r } = Wt(this.prototype, t) ?? { get() { return this[e]; }, set(o) { this[e] = o; } }; - return { get: i, set(o) { - const l = i?.call(this); + return { get: s, set(o) { + const l = s?.call(this); r?.call(this, o), this.requestUpdate(t, l, n); }, configurable: !0, enumerable: !0 }; } @@ -101,17 +101,17 @@ let E = class extends HTMLElement { if (this.hasOwnProperty(I("finalized"))) return; if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(I("properties"))) { const e = this.properties, n = [...Zt(e), ...Gt(e)]; - for (const i of n) this.createProperty(i, e[i]); + for (const s of n) this.createProperty(s, e[s]); } const t = this[Symbol.metadata]; if (t !== null) { const e = litPropertyMetadata.get(t); - if (e !== void 0) for (const [n, i] of e) this.elementProperties.set(n, i); + if (e !== void 0) for (const [n, s] of e) this.elementProperties.set(n, s); } this._$Eh = /* @__PURE__ */ new Map(); for (const [e, n] of this.elementProperties) { - const i = this._$Eu(e, n); - i !== void 0 && this._$Eh.set(i, e); + const s = this._$Eu(e, n); + s !== void 0 && this._$Eh.set(s, e); } this.elementStyles = this.finalizeStyles(this.styles); } @@ -119,7 +119,7 @@ let E = class extends HTMLElement { const e = []; if (Array.isArray(t)) { const n = new Set(t.flat(1 / 0).reverse()); - for (const i of n) e.unshift(ct(i)); + for (const s of n) e.unshift(ct(s)); } else t !== void 0 && e.push(ct(t)); return e; } @@ -160,31 +160,31 @@ let E = class extends HTMLElement { this._$AK(t, n); } _$ET(t, e) { - const n = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, n); - if (i !== void 0 && n.reflect === !0) { + const n = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, n); + if (s !== void 0 && n.reflect === !0) { const r = (n.converter?.toAttribute !== void 0 ? n.converter : et).toAttribute(e, n.type); - this._$Em = t, r == null ? this.removeAttribute(i) : this.setAttribute(i, r), this._$Em = null; + this._$Em = t, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null; } } _$AK(t, e) { - const n = this.constructor, i = n._$Eh.get(t); - if (i !== void 0 && this._$Em !== i) { - const r = n.getPropertyOptions(i), o = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute !== void 0 ? r.converter : et; - this._$Em = i; + const n = this.constructor, s = n._$Eh.get(t); + if (s !== void 0 && this._$Em !== s) { + const r = n.getPropertyOptions(s), o = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute !== void 0 ? r.converter : et; + this._$Em = s; const l = o.fromAttribute(e, r.type); - this[i] = l ?? this._$Ej?.get(i) ?? l, this._$Em = null; + this[s] = l ?? this._$Ej?.get(s) ?? l, this._$Em = null; } } - requestUpdate(t, e, n, i = !1, r) { + requestUpdate(t, e, n, s = !1, r) { if (t !== void 0) { const o = this.constructor; - if (i === !1 && (r = this[t]), n ??= o.getPropertyOptions(t), !((n.hasChanged ?? It)(r, e) || n.useDefault && n.reflect && r === this._$Ej?.get(t) && !this.hasAttribute(o._$Eu(t, n)))) return; + if (s === !1 && (r = this[t]), n ??= o.getPropertyOptions(t), !((n.hasChanged ?? It)(r, e) || n.useDefault && n.reflect && r === this._$Ej?.get(t) && !this.hasAttribute(o._$Eu(t, n)))) return; this.C(t, e, n); } this.isUpdatePending === !1 && (this._$ES = this._$EP()); } - C(t, e, { useDefault: n, reflect: i, wrapped: r }, o) { - n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), r !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || n || (e = void 0), this._$AL.set(t, e)), i === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); + C(t, e, { useDefault: n, reflect: s, wrapped: r }, o) { + n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), r !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || n || (e = void 0), this._$AL.set(t, e)), s === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); } async _$EP() { this.isUpdatePending = !0; @@ -203,13 +203,13 @@ let E = class extends HTMLElement { if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { - for (const [i, r] of this._$Ep) this[i] = r; + for (const [s, r] of this._$Ep) this[s] = r; this._$Ep = void 0; } const n = this.constructor.elementProperties; - if (n.size > 0) for (const [i, r] of n) { - const { wrapped: o } = r, l = this[i]; - o !== !0 || this._$AL.has(i) || l === void 0 || this.C(i, void 0, r, l); + if (n.size > 0) for (const [s, r] of n) { + const { wrapped: o } = r, l = this[s]; + o !== !0 || this._$AL.has(s) || l === void 0 || this.C(s, void 0, r, l); } } let t = !1; @@ -247,28 +247,28 @@ let E = class extends HTMLElement { } }; E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[I("elementProperties")] = /* @__PURE__ */ new Map(), E[I("finalized")] = /* @__PURE__ */ new Map(), Jt?.({ ReactiveElement: E }), (W.reactiveElementVersions ??= []).push("2.1.2"); -const st = globalThis, ht = (s) => s, F = st.trustedTypes, ut = F ? F.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, Lt = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, Ut = "?" + $, Xt = `<${Ut}>`, S = document, L = () => S.createComment(""), U = (s) => s === null || typeof s != "object" && typeof s != "function", rt = Array.isArray, Yt = (s) => rt(s) || typeof s?.[Symbol.iterator] == "function", V = `[ +const st = globalThis, ht = (i) => i, F = st.trustedTypes, ut = F ? F.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Lt = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, Ut = "?" + $, Xt = `<${Ut}>`, S = document, L = () => S.createComment(""), U = (i) => i === null || typeof i != "object" && typeof i != "function", rt = Array.isArray, Yt = (i) => rt(i) || typeof i?.[Symbol.iterator] == "function", V = `[ \f\r]`, z = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ft = /-->/g, mt = />/g, q = RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`, "g"), gt = /'/g, _t = /"/g, Rt = /^(?:script|style|textarea|title)$/i, te = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), d = te(1), T = /* @__PURE__ */ Symbol.for("lit-noChange"), g = /* @__PURE__ */ Symbol.for("lit-nothing"), yt = /* @__PURE__ */ new WeakMap(), C = S.createTreeWalker(S, 129); -function Dt(s, t) { - if (!rt(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array"); +\f\r"'\`<>=]|("|')|))|$)`, "g"), gt = /'/g, _t = /"/g, Rt = /^(?:script|style|textarea|title)$/i, te = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), d = te(1), T = /* @__PURE__ */ Symbol.for("lit-noChange"), g = /* @__PURE__ */ Symbol.for("lit-nothing"), yt = /* @__PURE__ */ new WeakMap(), C = S.createTreeWalker(S, 129); +function jt(i, t) { + if (!rt(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array"); return ut !== void 0 ? ut.createHTML(t) : t; } -const ee = (s, t) => { - const e = s.length - 1, n = []; - let i, r = t === 2 ? "" : t === 3 ? "" : "", o = z; +const ee = (i, t) => { + const e = i.length - 1, n = []; + let s, r = t === 2 ? "" : t === 3 ? "" : "", o = z; for (let l = 0; l < e; l++) { - const a = s[l]; + const a = i[l]; let p, u, c = -1, f = 0; - for (; f < a.length && (o.lastIndex = f, u = o.exec(a), u !== null); ) f = o.lastIndex, o === z ? u[1] === "!--" ? o = ft : u[1] !== void 0 ? o = mt : u[2] !== void 0 ? (Rt.test(u[2]) && (i = RegExp("" ? (o = i ?? z, c = -1) : u[1] === void 0 ? c = -2 : (c = o.lastIndex - u[2].length, p = u[1], o = u[3] === void 0 ? q : u[3] === '"' ? _t : gt) : o === _t || o === gt ? o = q : o === ft || o === mt ? o = z : (o = q, i = void 0); - const h = o === q && s[l + 1].startsWith("/>") ? " " : ""; + for (; f < a.length && (o.lastIndex = f, u = o.exec(a), u !== null); ) f = o.lastIndex, o === z ? u[1] === "!--" ? o = ft : u[1] !== void 0 ? o = mt : u[2] !== void 0 ? (Rt.test(u[2]) && (s = RegExp("" ? (o = s ?? z, c = -1) : u[1] === void 0 ? c = -2 : (c = o.lastIndex - u[2].length, p = u[1], o = u[3] === void 0 ? q : u[3] === '"' ? _t : gt) : o === _t || o === gt ? o = q : o === ft || o === mt ? o = z : (o = q, s = void 0); + const h = o === q && i[l + 1].startsWith("/>") ? " " : ""; r += o === z ? a + Xt : c >= 0 ? (n.push(p), a.slice(0, c) + Lt + a.slice(c) + $ + h) : a + $ + (c === -2 ? l : h); } - return [Dt(s, r + (s[e] || "") + (t === 2 ? "" : t === 3 ? "" : "")), n]; + return [jt(i, r + (i[e] || "") + (t === 2 ? "" : t === 3 ? "" : "")), n]; }; class R { constructor({ strings: t, _$litType$: e }, n) { - let i; + let s; this.parts = []; let r = 0, o = 0; const l = t.length - 1, a = this.parts, [p, u] = ee(t, e); @@ -276,24 +276,24 @@ class R { const c = this.el.content.firstChild; c.replaceWith(...c.childNodes); } - for (; (i = C.nextNode()) !== null && a.length < l; ) { - if (i.nodeType === 1) { - if (i.hasAttributes()) for (const c of i.getAttributeNames()) if (c.endsWith(Lt)) { - const f = u[o++], h = i.getAttribute(c).split($), m = /([.?@])?(.*)/.exec(f); - a.push({ type: 1, index: r, name: m[2], strings: h, ctor: m[1] === "." ? ie : m[1] === "?" ? se : m[1] === "@" ? re : Z }), i.removeAttribute(c); - } else c.startsWith($) && (a.push({ type: 6, index: r }), i.removeAttribute(c)); - if (Rt.test(i.tagName)) { - const c = i.textContent.split($), f = c.length - 1; + for (; (s = C.nextNode()) !== null && a.length < l; ) { + if (s.nodeType === 1) { + if (s.hasAttributes()) for (const c of s.getAttributeNames()) if (c.endsWith(Lt)) { + const f = u[o++], h = s.getAttribute(c).split($), m = /([.?@])?(.*)/.exec(f); + a.push({ type: 1, index: r, name: m[2], strings: h, ctor: m[1] === "." ? ie : m[1] === "?" ? se : m[1] === "@" ? re : Z }), s.removeAttribute(c); + } else c.startsWith($) && (a.push({ type: 6, index: r }), s.removeAttribute(c)); + if (Rt.test(s.tagName)) { + const c = s.textContent.split($), f = c.length - 1; if (f > 0) { - i.textContent = F ? F.emptyScript : ""; - for (let h = 0; h < f; h++) i.append(c[h], L()), C.nextNode(), a.push({ type: 2, index: ++r }); - i.append(c[f], L()); + s.textContent = F ? F.emptyScript : ""; + for (let h = 0; h < f; h++) s.append(c[h], L()), C.nextNode(), a.push({ type: 2, index: ++r }); + s.append(c[f], L()); } } - } else if (i.nodeType === 8) if (i.data === Ut) a.push({ type: 2, index: r }); + } else if (s.nodeType === 8) if (s.data === Ut) a.push({ type: 2, index: r }); else { let c = -1; - for (; (c = i.data.indexOf($, c + 1)) !== -1; ) a.push({ type: 7, index: r }), c += $.length - 1; + for (; (c = s.data.indexOf($, c + 1)) !== -1; ) a.push({ type: 7, index: r }), c += $.length - 1; } r++; } @@ -303,11 +303,11 @@ class R { return n.innerHTML = t, n; } } -function N(s, t, e = s, n) { +function N(i, t, e = i, n) { if (t === T) return t; - let i = n !== void 0 ? e._$Co?.[n] : e._$Cl; + let s = n !== void 0 ? e._$Co?.[n] : e._$Cl; const r = U(t) ? void 0 : t._$litDirective$; - return i?.constructor !== r && (i?._$AO?.(!1), r === void 0 ? i = void 0 : (i = new r(s), i._$AT(s, e, n)), n !== void 0 ? (e._$Co ??= [])[n] = i : e._$Cl = i), i !== void 0 && (t = N(s, i._$AS(s, t.values), i, n)), t; + return s?.constructor !== r && (s?._$AO?.(!1), r === void 0 ? s = void 0 : (s = new r(i), s._$AT(i, e, n)), n !== void 0 ? (e._$Co ??= [])[n] = s : e._$Cl = s), s !== void 0 && (t = N(i, s._$AS(i, t.values), s, n)), t; } class ne { constructor(t, e) { @@ -320,8 +320,8 @@ class ne { return this._$AM._$AU; } u(t) { - const { el: { content: e }, parts: n } = this._$AD, i = (t?.creationScope ?? S).importNode(e, !0); - C.currentNode = i; + const { el: { content: e }, parts: n } = this._$AD, s = (t?.creationScope ?? S).importNode(e, !0); + C.currentNode = s; let r = C.nextNode(), o = 0, l = 0, a = n[0]; for (; a !== void 0; ) { if (o === a.index) { @@ -330,7 +330,7 @@ class ne { } o !== a?.index && (r = C.nextNode(), o++); } - return C.currentNode = S, i; + return C.currentNode = S, s; } p(t) { let e = 0; @@ -341,8 +341,8 @@ class O { get _$AU() { return this._$AM?._$AU ?? this._$Cv; } - constructor(t, e, n, i) { - this.type = 2, this._$AH = g, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = n, this.options = i, this._$Cv = i?.isConnected ?? !0; + constructor(t, e, n, s) { + this.type = 2, this._$AH = g, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = n, this.options = s, this._$Cv = s?.isConnected ?? !0; } get parentNode() { let t = this._$AA.parentNode; @@ -368,10 +368,10 @@ class O { this._$AH !== g && U(this._$AH) ? this._$AA.nextSibling.data = t : this.T(S.createTextNode(t)), this._$AH = t; } $(t) { - const { values: e, _$litType$: n } = t, i = typeof n == "number" ? this._$AC(t) : (n.el === void 0 && (n.el = R.createElement(Dt(n.h, n.h[0]), this.options)), n); - if (this._$AH?._$AD === i) this._$AH.p(e); + const { values: e, _$litType$: n } = t, s = typeof n == "number" ? this._$AC(t) : (n.el === void 0 && (n.el = R.createElement(jt(n.h, n.h[0]), this.options)), n); + if (this._$AH?._$AD === s) this._$AH.p(e); else { - const r = new ne(i, this), o = r.u(this.options); + const r = new ne(s, this), o = r.u(this.options); r.p(e), this.T(o), this._$AH = r; } } @@ -382,9 +382,9 @@ class O { k(t) { rt(this._$AH) || (this._$AH = [], this._$AR()); const e = this._$AH; - let n, i = 0; - for (const r of t) i === e.length ? e.push(n = new O(this.O(L()), this.O(L()), this, this.options)) : n = e[i], n._$AI(r), i++; - i < e.length && (this._$AR(n && n._$AB.nextSibling, i), e.length = i); + let n, s = 0; + for (const r of t) s === e.length ? e.push(n = new O(this.O(L()), this.O(L()), this, this.options)) : n = e[s], n._$AI(r), s++; + s < e.length && (this._$AR(n && n._$AB.nextSibling, s), e.length = s); } _$AR(t = this._$AA.nextSibling, e) { for (this._$AP?.(!1, !0, e); t !== this._$AB; ) { @@ -403,10 +403,10 @@ class Z { get _$AU() { return this._$AM._$AU; } - constructor(t, e, n, i, r) { - this.type = 1, this._$AH = g, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = r, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(new String()), this.strings = n) : this._$AH = g; + constructor(t, e, n, s, r) { + this.type = 1, this._$AH = g, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = r, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(new String()), this.strings = n) : this._$AH = g; } - _$AI(t, e = this, n, i) { + _$AI(t, e = this, n, s) { const r = this.strings; let o = !1; if (r === void 0) t = N(this, t, e, 0), o = !U(t) || t !== this._$AH && t !== T, o && (this._$AH = t); @@ -415,7 +415,7 @@ class Z { let a, p; for (t = r[0], a = 0; a < r.length - 1; a++) p = N(this, l[n + a], e, a), p === T && (p = this._$AH[a]), o ||= !U(p) || p !== this._$AH[a], p === g ? t = g : t !== g && (t += (p ?? "") + r[a + 1]), this._$AH[a] = p; } - o && !i && this.j(t); + o && !s && this.j(t); } j(t) { t === g ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? ""); @@ -438,13 +438,13 @@ class se extends Z { } } class re extends Z { - constructor(t, e, n, i, r) { - super(t, e, n, i, r), this.type = 5; + constructor(t, e, n, s, r) { + super(t, e, n, s, r), this.type = 5; } _$AI(t, e = this) { if ((t = N(this, t, e, 0) ?? g) === T) return; - const n = this._$AH, i = t === g && n !== g || t.capture !== n.capture || t.once !== n.once || t.passive !== n.passive, r = t !== g && (n === g || i); - i && this.element.removeEventListener(this.name, this, n), r && this.element.addEventListener(this.name, this, t), this._$AH = t; + const n = this._$AH, s = t === g && n !== g || t.capture !== n.capture || t.once !== n.once || t.passive !== n.passive, r = t !== g && (n === g || s); + s && this.element.removeEventListener(this.name, this, n), r && this.element.addEventListener(this.name, this, t), this._$AH = t; } handleEvent(t) { typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t); @@ -463,14 +463,14 @@ class oe { } const ae = { I: O }, le = st.litHtmlPolyfillSupport; le?.(R, O), (st.litHtmlVersions ??= []).push("3.3.3"); -const ce = (s, t, e) => { +const ce = (i, t, e) => { const n = e?.renderBefore ?? t; - let i = n._$litPart$; - if (i === void 0) { + let s = n._$litPart$; + if (s === void 0) { const r = e?.renderBefore ?? null; - n._$litPart$ = i = new O(t.insertBefore(L(), r), r, void 0, e ?? {}); + n._$litPart$ = s = new O(t.insertBefore(L(), r), r, void 0, e ?? {}); } - return i._$AI(s), i; + return s._$AI(i), s; }; const ot = globalThis; let A = class extends E { @@ -499,9 +499,9 @@ A._$litElement$ = !0, A.finalized = !0, ot.litElementHydrateSupport?.({ LitEleme const de = ot.litElementPolyfillSupport; de?.({ LitElement: A }); (ot.litElementVersions ??= []).push("4.2.2"); -const jt = ':host{--nq-p-parchment-top: #f0e4c7;--nq-p-parchment-bottom: #ddcca3;--nq-p-parchment: radial-gradient(ellipse at 25% 10%, rgba(255,255,255,.5), transparent 55%), radial-gradient(ellipse at 85% 90%, rgba(120,86,44,.28), transparent 60%), repeating-linear-gradient(93deg, rgba(150,115,70,.05) 0 2px, transparent 2px 6px), repeating-linear-gradient(2deg, rgba(150,115,70,.04) 0 3px, transparent 3px 7px), linear-gradient(var(--nq-p-parchment-top), var(--nq-p-parchment-bottom));--nq-p-vignette: inset 0 0 200px rgba(80,52,20,.35);--nq-p-card-open: linear-gradient(#fdf7e6, #f2e7c9);--nq-p-card-done: linear-gradient(#f0e8d3, #e6dcc2);--nq-p-card-panel: linear-gradient(#fcf6e6, #f1e6ca);--nq-p-card-border: rgba(120,88,48,.38);--nq-p-panel-border: rgba(92,62,26,.4);--nq-p-card-shadow: 0 3px 0 rgba(120,88,48,.2), inset 0 1px 0 rgba(255,255,255,.7);--nq-p-panel-shadow: 0 6px 0 rgba(92,62,26,.18), inset 0 2px 0 rgba(255,255,255,.7);--nq-p-frame-outer: 2px solid rgba(92,62,26,.45);--nq-p-frame-inner: 1px solid rgba(92,62,26,.28);--nq-p-rule: 2px solid rgba(92,62,26,.35);--nq-p-ink: #2b1f14;--nq-p-ink-secondary: #5c452a;--nq-p-ink-muted: #6f6455;--nq-p-ink-away: #4d4433;--nq-p-ink-late: #8f1526;--nq-brand-blue: #3B3AB8;--nq-brand-purple: #A035CC;--nq-brand-gradient: linear-gradient(135deg, var(--nq-brand-blue), var(--nq-brand-purple));--nq-p-icon-tile: var(--nq-brand-gradient);--nq-p-icon-tile-done: rgba(92,62,26,.16);--nq-p-crest: var(--nq-brand-gradient);--nq-p-crest-away: linear-gradient(135deg, #6b6b7a, #7a7286);--nq-p-seal: radial-gradient(circle at 35% 30%, #a8283a, #6d1322);--nq-p-seal-shadow: 0 4px 10px rgba(60,10,20,.4), inset 0 0 0 4px rgba(255,255,255,.14);--nq-p-seal-size: 78px;--nq-p-dock-bg: rgba(43,31,20,.9);--nq-p-dock-ink: #f7efdb;--nq-p-dock-ink-secondary: #d8c9a6;--nq-p-dock-divider: rgba(233,220,189,.3);--nq-p-dock-height: 84px;--nq-p-font-display: "Cinzel Decorative", Cinzel, serif;--nq-p-font-heading: Cinzel, serif;--nq-p-font-body: Nunito, system-ui, sans-serif;--nq-p-size-hero: 86px;--nq-p-size-wordmark: 66px;--nq-p-size-title: 56px;--nq-p-size-name: 48px;--nq-p-size-section: 32px;--nq-p-size-quest: 30px;--nq-p-size-body: 22px;--nq-p-size-label: 21px;--nq-p-track-label: .14em;--nq-p-track-kicker: .3em;--nq-p-quest-min-height: 116px;--nq-p-quest-gap: 24px;--nq-p-quest-pad: 22px;--nq-p-tile-size: 64px;--nq-p-button-height: 72px;--nq-p-button-min-width: 150px;--nq-p-confirm-button: 108px;--nq-p-radius-card: 12px;--nq-p-radius-panel: 20px;--nq-p-radius-pill: 9999px;--nq-p-page-inset: 62px;--nq-p-frame-inset: 26px;--nq-ease-out: cubic-bezier(0, 0, .2, 1);--nq-dur-micro: .12s;--nq-dur-base: .2s;--nq-dur-modal: .35s}'; -function at(s) { - window.customCards = window.customCards ?? [], window.customCards.push(s); +const Dt = ':host{--nq-p-parchment-top: #f0e4c7;--nq-p-parchment-bottom: #ddcca3;--nq-p-parchment: radial-gradient(ellipse at 25% 10%, rgba(255,255,255,.5), transparent 55%), radial-gradient(ellipse at 85% 90%, rgba(120,86,44,.28), transparent 60%), repeating-linear-gradient(93deg, rgba(150,115,70,.05) 0 2px, transparent 2px 6px), repeating-linear-gradient(2deg, rgba(150,115,70,.04) 0 3px, transparent 3px 7px), linear-gradient(var(--nq-p-parchment-top), var(--nq-p-parchment-bottom));--nq-p-vignette: inset 0 0 200px rgba(80,52,20,.35);--nq-p-card-open: linear-gradient(#fdf7e6, #f2e7c9);--nq-p-card-done: linear-gradient(#f0e8d3, #e6dcc2);--nq-p-card-panel: linear-gradient(#fcf6e6, #f1e6ca);--nq-p-card-border: rgba(120,88,48,.38);--nq-p-panel-border: rgba(92,62,26,.4);--nq-p-card-shadow: 0 3px 0 rgba(120,88,48,.2), inset 0 1px 0 rgba(255,255,255,.7);--nq-p-panel-shadow: 0 6px 0 rgba(92,62,26,.18), inset 0 2px 0 rgba(255,255,255,.7);--nq-p-frame-outer: 2px solid rgba(92,62,26,.45);--nq-p-frame-inner: 1px solid rgba(92,62,26,.28);--nq-p-rule: 2px solid rgba(92,62,26,.35);--nq-p-ink: #2b1f14;--nq-p-ink-secondary: #5c452a;--nq-p-ink-muted: #6f6455;--nq-p-ink-away: #4d4433;--nq-p-ink-late: #8f1526;--nq-brand-blue: #3B3AB8;--nq-brand-purple: #A035CC;--nq-brand-gradient: linear-gradient(135deg, var(--nq-brand-blue), var(--nq-brand-purple));--nq-p-icon-tile: var(--nq-brand-gradient);--nq-p-icon-tile-done: rgba(92,62,26,.16);--nq-p-crest: var(--nq-brand-gradient);--nq-p-crest-away: linear-gradient(135deg, #6b6b7a, #7a7286);--nq-p-seal: radial-gradient(circle at 35% 30%, #a8283a, #6d1322);--nq-p-seal-shadow: 0 4px 10px rgba(60,10,20,.4), inset 0 0 0 4px rgba(255,255,255,.14);--nq-p-seal-size: 78px;--nq-p-dock-bg: rgba(43,31,20,.9);--nq-p-dock-ink: #f7efdb;--nq-p-dock-ink-secondary: #d8c9a6;--nq-p-dock-divider: rgba(233,220,189,.3);--nq-p-dock-height: 84px;--nq-p-font-display: "Cinzel Decorative", Cinzel, serif;--nq-p-font-heading: Cinzel, serif;--nq-p-font-body: Nunito, system-ui, sans-serif;--nq-p-size-hero: 86px;--nq-p-size-wordmark: 66px;--nq-p-size-title: 56px;--nq-p-size-name: 48px;--nq-p-size-section: 32px;--nq-p-size-quest: 30px;--nq-p-size-body: 22px;--nq-p-size-label: 21px;--nq-p-track-label: .14em;--nq-p-track-kicker: .3em;--nq-p-quest-min-height: 116px;--nq-p-quest-gap: 24px;--nq-p-quest-pad: 22px;--nq-p-tile-size: 64px;--nq-p-button-height: 72px;--nq-p-button-min-width: 150px;--nq-p-confirm-button: 108px;--nq-p-radius-card: 12px;--nq-p-radius-panel: 20px;--nq-p-radius-pill: 9999px;--nq-p-page-inset: 62px;--nq-p-frame-inset: 26px;--nq-ease-out: cubic-bezier(0, 0, .2, 1);--nq-dur-micro: .12s;--nq-dur-base: .2s;--nq-dur-modal: .35s}'; +function at(i) { + window.customCards = window.customCards ?? [], window.customCards.push(i); } const pe = [ "nestquest_quest_completed", @@ -509,37 +509,37 @@ const pe = [ "nestquest_quest_missed", "nestquest_child_day_complete" ], bt = /* @__PURE__ */ new Map(); -function Q(s, t) { - const e = `${s ?? "local"}|${JSON.stringify(t)}`, n = bt.get(e); +function Q(i, t) { + const e = `${i ?? "local"}|${JSON.stringify(t)}`, n = bt.get(e); if (n) return n; - let i; + let s; try { - i = new Intl.DateTimeFormat("en-US", { + s = new Intl.DateTimeFormat("en-US", { ...t, - ...s ? { timeZone: s } : {} + ...i ? { timeZone: i } : {} }); } catch { - i = new Intl.DateTimeFormat("en-US", t); + s = new Intl.DateTimeFormat("en-US", t); } - return bt.set(e, i), i; + return bt.set(e, s), s; } -function he(s) { - const t = s?.config; +function he(i) { + const t = i?.config; if (!t || typeof t != "object") return; const e = t.time_zone; return typeof e == "string" && e.trim() ? e.trim() : void 0; } -function K(s, t) { - return `${Q(t, { weekday: "long" }).format(s)}, ${Q(t, { month: "short", day: "numeric" }).format(s)}`; +function K(i, t) { + return `${Q(t, { weekday: "long" }).format(i)}, ${Q(t, { month: "short", day: "numeric" }).format(i)}`; } -function ue(s, t) { +function ue(i, t) { return Q(t, { hour: "numeric", minute: "2-digit", hour12: !0 - }).format(s); + }).format(i); } const fe = { "clear-night": "Clear", @@ -574,25 +574,31 @@ const fe = { windy: "A blustery day", "windy-variant": "A blustery day" }; -function vt(s) { - return typeof s == "string" ? s.trim() : ""; +function vt(i) { + return typeof i == "string" ? i.trim() : ""; } -function J(s, t) { - if (s == null || s === "") +function J(i, t) { + if (i == null || i === "") return t; - const e = typeof s == "number" ? s : Number(s); + const e = typeof i == "number" ? i : Number(i); return Number.isFinite(e) ? e : t; } -function xt(s) { - return Number.isFinite(s) ? Math.min(100, Math.max(0, s)) : 0; +function ge(i) { + if (i === null || typeof i != "object" || Array.isArray(i)) + return ""; + const t = i.slug; + return typeof t == "string" ? t.trim() : ""; } -function wt(s) { - return Math.max(0, Math.round(s)); +function xt(i) { + return Number.isFinite(i) ? Math.min(100, Math.max(0, i)) : 0; } -function ge(s) { - return s.split(/[-_]+/).filter(Boolean).map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "); +function wt(i) { + return Math.max(0, Math.round(i)); } -function _e(s, t) { +function _e(i) { + return i.split(/[-_]+/).filter(Boolean).map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "); +} +function ye(i, t) { const e = Q(t, { year: "numeric", month: "2-digit", @@ -601,10 +607,10 @@ function _e(s, t) { minute: "2-digit", second: "2-digit", hourCycle: "h23" - }).formatToParts(new Date(s)), n = (r) => { + }).formatToParts(new Date(i)), n = (r) => { const o = e.find((l) => l.type === r); return o ? Number(o.value) : Number.NaN; - }, i = Date.UTC( + }, s = Date.UTC( n("year"), n("month") - 1, n("day"), @@ -612,32 +618,32 @@ function _e(s, t) { n("minute"), n("second") ); - return Number.isFinite(i) ? i - s : 0; + return Number.isFinite(s) ? s - i : 0; } -function ye(s, t) { - if (typeof s != "string") +function be(i, t) { + if (typeof i != "string") return null; - const e = s.split("-"); + const e = i.split("-"); if (e.length !== 3) return null; - const [n, i, r] = e.map((a) => Number(a)); - if (!n || !i || !r) + const [n, s, r] = e.map((a) => Number(a)); + if (!n || !s || !r) return null; if (!t) { - const a = new Date(n, i - 1, r); + const a = new Date(n, s - 1, r); return Number.isNaN(a.getTime()) ? null : a; } - const o = Date.UTC(n, i - 1, r), l = new Date(o - _e(o, t)); + const o = Date.UTC(n, s - 1, r), l = new Date(o - ye(o, t)); return Number.isNaN(l.getTime()) ? null : l; } -function be(s) { - const t = fe[s]; - return t || s.charAt(0).toUpperCase() + s.slice(1); +function ve(i) { + const t = fe[i]; + return t || i.charAt(0).toUpperCase() + i.slice(1); } -function ve(s, t) { - return me[s] ?? t; +function xe(i, t) { + return me[i] ?? t; } -const $t = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", xe = "polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%)", we = Pt` +const $t = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", we = "polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%)", $e = Pt` * { box-sizing: border-box; } @@ -709,7 +715,7 @@ const $t = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", xe = "polygon(50% justify-content: center; width: 34px; height: 34px; - clip-path: ${v(xe)}; + clip-path: ${v(we)}; background: var(--nq-brand-gradient); } @@ -1032,7 +1038,7 @@ const $t = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", xe = "polygon(50% font-weight: 800; line-height: 1; } -`, $e = d` -`, qe = d``, ke = d` -`, ke = d``, Ce = d` -`, Ce = d``, Ae = d` -`, Ae = d``, Se = d` `, qt = { - icon: Ce, + icon: Ae, headline: "NestQuest is not set up yet", body: "A parent needs to finish setting up NestQuest before the party can gather." -}, Se = { - icon: Ae, +}, Te = { + icon: Se, headline: "The records cannot be reached", body: "The party's records are quiet right now. NestQuest will return shortly." -}, Te = d` `; -class Ee extends A { +class Ne extends A { static properties = { hass: { attribute: !1 }, _config: { state: !0 }, _now: { state: !0 } }; - static styles = [v(jt), we]; + static styles = [v(Dt), $e]; hass; _config; _now = /* @__PURE__ */ new Date(); @@ -1143,16 +1149,16 @@ class Ee extends A { if (!t) return; this._subscribed = !0; - const e = ++this._subGeneration, n = (i) => { - i.then((r) => { + const e = ++this._subGeneration, n = (s) => { + s.then((r) => { this._subscribed && e === this._subGeneration ? this._unsubs.push(r) : r(); }).catch(() => { e === this._subGeneration && (this._unsubscribeLive(), this._armSubscribeRetry()); }); }; - for (const i of pe) + for (const s of pe) n( - t.subscribeEvents(() => this.requestUpdate(), i) + t.subscribeEvents(() => this.requestUpdate(), s) ); } _armSubscribeRetry() { @@ -1225,19 +1231,31 @@ class Ee extends A { const t = this._config.child_order; return Array.isArray(t) ? t.filter( (e) => typeof e == "string" && e.trim().length > 0 - ).map((e) => e.trim()) : []; + ).map((e) => e.trim()) : this._discoveredChildSlugs(); + } + /** Zero-config discovery (Feature 20): the ordered child roster the + * integration publishes on the household rollup + * (custom_components/nestquest/sensor.py — ``child_roster``, the + * snapshot's sort_order, then id), each entry carrying the slug the + * per-child entity ids are built from. Consulted only when the + * config has no child_order — explicit configuration wins. */ + _discoveredChildSlugs() { + const e = this._state( + "sensor.nestquest_household_quests_due_today" + )?.attributes?.child_roster; + return Array.isArray(e) ? e.map((n) => ge(n)).filter((n) => n.length > 0) : []; } _plates() { return this._childSlugs().map((t) => this._plate(t)); } _plate(t) { - const e = this._dueSensorResolution(t), n = this._state(`sensor.nestquest_${t}_quests_due_today`), i = this._state( + const e = this._dueSensorResolution(t), n = this._state(`sensor.nestquest_${t}_quests_due_today`), s = this._state( `sensor.nestquest_${t}_quests_completed_today` ), r = this._state( `sensor.nestquest_${t}_completion_pct_today` ), o = this._state( `binary_sensor.nestquest_${t}_present_today` - ), l = n?.attributes ?? {}, a = wt(J(n?.state, 0)), p = wt(J(i?.state, 0)), u = r ? J(r.state, Number.NaN) : Number.NaN, c = Number.isFinite(u) ? xt(u) : a > 0 ? xt(p / a * 100) : 0; + ), l = n?.attributes ?? {}, a = wt(J(n?.state, 0)), p = wt(J(s?.state, 0)), u = r ? J(r.state, Number.NaN) : Number.NaN, c = Number.isFinite(u) ? xt(u) : a > 0 ? xt(p / a * 100) : 0; let f = !0; const h = l.present; typeof h == "boolean" ? f = h : o && (f = String(o.state ?? "").trim().toLowerCase() === "on"); @@ -1249,11 +1267,11 @@ class Ee extends A { const G = o?.attributes?.child_name; typeof G == "string" && G.trim() && (m = G.trim()); } - m || (m = ge(t)); - const x = ye( + m || (m = _e(t)); + const x = be( o?.attributes?.next_present, this._timeZone() - ), D = x ? `Returns ${K(x, this._timeZone())}` : null; + ), j = x ? `Returns ${K(x, this._timeZone())}` : null; return { slug: t, name: m, @@ -1262,7 +1280,7 @@ class Ee extends A { completed: p, due: a, pct: c, - returns: D, + returns: j, unresolved: e }; } @@ -1279,7 +1297,7 @@ class Ee extends A { } _boardNotice() { const t = this._plates(); - return t.length === 0 ? qt : t.every((e) => e.unresolved !== null) ? t.some((e) => e.unresolved === "stale") ? Se : qt : null; + return t.length === 0 ? qt : t.every((e) => e.unresolved !== null) ? t.some((e) => e.unresolved === "stale") ? Te : qt : null; } _renderNotice(t) { return d` @@ -1302,7 +1320,7 @@ class Ee extends A { ${t.name} - ${ke} + ${Ce} Unknown — @@ -1322,7 +1340,7 @@ class Ee extends A { ${t.name} - ${$e} + ${qe} Home today @@ -1341,7 +1359,7 @@ class Ee extends A { ${t.name} - ${qe} + ${ke} On travels ${t.returns ?? "Returns —"} @@ -1363,9 +1381,9 @@ class Ee extends A { const n = String(e.state ?? "").trim(); if (!n || n === "unavailable" || n === "unknown") return null; - const i = e.attributes ?? {}; + const s = e.attributes ?? {}; let r = null, o = null; - const l = i.forecast; + const l = s.forecast; if (Array.isArray(l) && l.length > 0) { const a = l[0]; if (a && typeof a == "object") { @@ -1375,7 +1393,7 @@ class Ee extends A { } return { condition: n, - temperature: this._optionalNumber(i.temperature), + temperature: this._optionalNumber(s.temperature), high: r, low: o }; @@ -1396,11 +1414,11 @@ class Ee extends A { ${ue(this._now, this._timeZone())} `; - const e = be(t.condition), n = ve(t.condition, e), i = t.temperature === null ? g : d`${Math.round(t.temperature)}°`, r = t.high === null || t.low === null ? null : `${Math.round(t.high)}° / ${Math.round(t.low)}°`; + const e = ve(t.condition), n = xe(t.condition, e), s = t.temperature === null ? g : d`${Math.round(t.temperature)}°`, r = t.high === null || t.low === null ? null : `${Math.round(t.high)}° / ${Math.round(t.low)}°`; return d`
- ${Te} - ${i} + ${Ee} + ${s} ${r === null ? e : `${e} · ${r}`} @@ -1411,14 +1429,14 @@ class Ee extends A { `; } } -customElements.define("nestquest-party-board-card", Ee); +customElements.define("nestquest-party-board-card", Ne); at({ type: "nestquest-party-board-card", name: "NestQuest Party Board", description: "Kids' attract screen for present and away adventurers." }); -const Ne = { CHILD: 2 }, Me = (s) => (...t) => ({ _$litDirective$: s, values: t }); -let Oe = class { +const Me = { CHILD: 2 }, Oe = (i) => (...t) => ({ _$litDirective$: i, values: t }); +let ze = class { constructor(t) { } get _$AU() { @@ -1434,131 +1452,131 @@ let Oe = class { return this.render(...e); } }; -const { I: ze } = ae, kt = (s) => s, Ct = () => document.createComment(""), P = (s, t, e) => { - const n = s._$AA.parentNode, i = t === void 0 ? s._$AB : t._$AA; +const { I: Pe } = ae, kt = (i) => i, Ct = () => document.createComment(""), P = (i, t, e) => { + const n = i._$AA.parentNode, s = t === void 0 ? i._$AB : t._$AA; if (e === void 0) { - const r = n.insertBefore(Ct(), i), o = n.insertBefore(Ct(), i); - e = new ze(r, o, s, s.options); + const r = n.insertBefore(Ct(), s), o = n.insertBefore(Ct(), s); + e = new Pe(r, o, i, i.options); } else { - const r = e._$AB.nextSibling, o = e._$AM, l = o !== s; + const r = e._$AB.nextSibling, o = e._$AM, l = o !== i; if (l) { let a; - e._$AQ?.(s), e._$AM = s, e._$AP !== void 0 && (a = s._$AU) !== o._$AU && e._$AP(a); + e._$AQ?.(i), e._$AM = i, e._$AP !== void 0 && (a = i._$AU) !== o._$AU && e._$AP(a); } - if (r !== i || l) { + if (r !== s || l) { let a = e._$AA; for (; a !== r; ) { const p = kt(a).nextSibling; - kt(n).insertBefore(a, i), a = p; + kt(n).insertBefore(a, s), a = p; } } } return e; -}, k = (s, t, e = s) => (s._$AI(t, e), s), Pe = {}, Ie = (s, t = Pe) => s._$AH = t, Le = (s) => s._$AH, X = (s) => { - s._$AR(), s._$AA.remove(); +}, k = (i, t, e = i) => (i._$AI(t, e), i), Ie = {}, Le = (i, t = Ie) => i._$AH = t, Ue = (i) => i._$AH, X = (i) => { + i._$AR(), i._$AA.remove(); }; -const At = (s, t, e) => { +const At = (i, t, e) => { const n = /* @__PURE__ */ new Map(); - for (let i = t; i <= e; i++) n.set(s[i], i); + for (let s = t; s <= e; s++) n.set(i[s], s); return n; -}, St = Me(class extends Oe { - constructor(s) { - if (super(s), s.type !== Ne.CHILD) throw Error("repeat() can only be used in text expressions"); +}, St = Oe(class extends ze { + constructor(i) { + if (super(i), i.type !== Me.CHILD) throw Error("repeat() can only be used in text expressions"); } - dt(s, t, e) { + dt(i, t, e) { let n; e === void 0 ? e = t : t !== void 0 && (n = t); - const i = [], r = []; + const s = [], r = []; let o = 0; - for (const l of s) i[o] = n ? n(l, o) : o, r[o] = e(l, o), o++; - return { values: r, keys: i }; + for (const l of i) s[o] = n ? n(l, o) : o, r[o] = e(l, o), o++; + return { values: r, keys: s }; } - render(s, t, e) { - return this.dt(s, t, e).values; + render(i, t, e) { + return this.dt(i, t, e).values; } - update(s, [t, e, n]) { - const i = Le(s), { values: r, keys: o } = this.dt(t, e, n); - if (!Array.isArray(i)) return this.ut = o, r; + update(i, [t, e, n]) { + const s = Ue(i), { values: r, keys: o } = this.dt(t, e, n); + if (!Array.isArray(s)) return this.ut = o, r; const l = this.ut ??= [], a = []; - let p, u, c = 0, f = i.length - 1, h = 0, m = r.length - 1; - for (; c <= f && h <= m; ) if (i[c] === null) c++; - else if (i[f] === null) f--; - else if (l[c] === o[h]) a[h] = k(i[c], r[h]), c++, h++; - else if (l[f] === o[m]) a[m] = k(i[f], r[m]), f--, m--; - else if (l[c] === o[m]) a[m] = k(i[c], r[m]), P(s, a[m + 1], i[c]), c++, m--; - else if (l[f] === o[h]) a[h] = k(i[f], r[h]), P(s, i[c], i[f]), f--, h++; + let p, u, c = 0, f = s.length - 1, h = 0, m = r.length - 1; + for (; c <= f && h <= m; ) if (s[c] === null) c++; + else if (s[f] === null) f--; + else if (l[c] === o[h]) a[h] = k(s[c], r[h]), c++, h++; + else if (l[f] === o[m]) a[m] = k(s[f], r[m]), f--, m--; + else if (l[c] === o[m]) a[m] = k(s[c], r[m]), P(i, a[m + 1], s[c]), c++, m--; + else if (l[f] === o[h]) a[h] = k(s[f], r[h]), P(i, s[c], s[f]), f--, h++; else if (p === void 0 && (p = At(o, h, m), u = At(l, c, f)), p.has(l[c])) if (p.has(l[f])) { - const _ = u.get(o[h]), x = _ !== void 0 ? i[_] : null; + const _ = u.get(o[h]), x = _ !== void 0 ? s[_] : null; if (x === null) { - const D = P(s, i[c]); - k(D, r[h]), a[h] = D; - } else a[h] = k(x, r[h]), P(s, i[c], x), i[_] = null; + const j = P(i, s[c]); + k(j, r[h]), a[h] = j; + } else a[h] = k(x, r[h]), P(i, s[c], x), s[_] = null; h++; - } else X(i[f]), f--; - else X(i[c]), c++; + } else X(s[f]), f--; + else X(s[c]), c++; for (; h <= m; ) { - const _ = P(s, a[m + 1]); + const _ = P(i, a[m + 1]); k(_, r[h]), a[h++] = _; } for (; c <= f; ) { - const _ = i[c++]; + const _ = s[c++]; _ !== null && X(_); } - return this.ut = o, Ie(s, a), T; + return this.ut = o, Le(i, a), T; } -}), Ue = [ +}), Re = [ "nestquest_quest_completed", "nestquest_quest_uncompleted", "nestquest_quest_missed", "nestquest_child_day_complete" ], Tt = /* @__PURE__ */ new Map(); -function M(s, t) { - const e = `${s ?? "local"}|${JSON.stringify(t)}`, n = Tt.get(e); +function M(i, t) { + const e = `${i ?? "local"}|${JSON.stringify(t)}`, n = Tt.get(e); if (n) return n; - let i; + let s; try { - i = new Intl.DateTimeFormat("en-US", { + s = new Intl.DateTimeFormat("en-US", { ...t, - ...s ? { timeZone: s } : {} + ...i ? { timeZone: i } : {} }); } catch { - i = new Intl.DateTimeFormat("en-US", t); + s = new Intl.DateTimeFormat("en-US", t); } - return Tt.set(e, i), i; + return Tt.set(e, s), s; } -function Re(s) { - const t = s?.config; +function je(i) { + const t = i?.config; if (!t || typeof t != "object") return; const e = t.time_zone; return typeof e == "string" && e.trim() ? e.trim() : void 0; } -function j(s, t) { - return `${M(t, { weekday: "long" }).format(s)}, ${M(t, { month: "short", day: "numeric" }).format(s)}`; +function D(i, t) { + return `${M(t, { weekday: "long" }).format(i)}, ${M(t, { month: "short", day: "numeric" }).format(i)}`; } -function De(s, t) { - return M(t, { weekday: "long" }).format(s); +function De(i, t) { + return M(t, { weekday: "long" }).format(i); } -function je(s, t) { - const e = new Date(s); +function He(i, t) { + const e = new Date(i); return Number.isNaN(e.getTime()) ? "" : M(t, { hour: "numeric", minute: "2-digit", hour12: !0 }).format(e); } -function He(s, t) { +function Be(i, t) { return M(t, { hour: "numeric", minute: "2-digit", hour12: !0 - }).format(s); + }).format(i); } -function Be(s) { - if (!s) +function Fe(i) { + if (!i) return null; - const t = /^(\d{1,2}):(\d{2})$/.exec(s.trim()); + const t = /^(\d{1,2}):(\d{2})$/.exec(i.trim()); if (!t) return null; const e = Number(t[1]); @@ -1567,22 +1585,22 @@ function Be(s) { const n = e >= 12 ? "PM" : "AM"; return `${e % 12 === 0 ? 12 : e % 12}:${t[2]} ${n}`; } -function w(s) { - return typeof s == "string" ? s.trim() : ""; +function w(i) { + return typeof i == "string" ? i.trim() : ""; } -function y(s, t) { - if (s == null || s === "") +function y(i, t) { + if (i == null || i === "") return t; - const e = typeof s == "number" ? s : Number(s); + const e = typeof i == "number" ? i : Number(i); return Number.isFinite(e) ? e : t; } -function b(s) { - return Math.max(0, Math.round(s)); +function b(i) { + return Math.max(0, Math.round(i)); } -function Y(s) { - return s.split(/[-_]+/).filter(Boolean).map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "); +function Y(i) { + return i.split(/[-_]+/).filter(Boolean).map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "); } -function Fe(s, t) { +function Qe(i, t) { const e = M(t, { year: "numeric", month: "2-digit", @@ -1591,10 +1609,10 @@ function Fe(s, t) { minute: "2-digit", second: "2-digit", hourCycle: "h23" - }).formatToParts(new Date(s)), n = (r) => { + }).formatToParts(new Date(i)), n = (r) => { const o = e.find((l) => l.type === r); return o ? Number(o.value) : Number.NaN; - }, i = Date.UTC( + }, s = Date.UTC( n("year"), n("month") - 1, n("day"), @@ -1602,41 +1620,41 @@ function Fe(s, t) { n("minute"), n("second") ); - return Number.isFinite(i) ? i - s : 0; + return Number.isFinite(s) ? s - i : 0; } -function Et(s, t) { - if (typeof s != "string") +function Et(i, t) { + if (typeof i != "string") return null; - const e = s.split("-"); + const e = i.split("-"); if (e.length !== 3) return null; - const [n, i, r] = e.map((a) => Number(a)); - if (!n || !i || !r) + const [n, s, r] = e.map((a) => Number(a)); + if (!n || !s || !r) return null; if (!t) { - const a = new Date(n, i - 1, r); + const a = new Date(n, s - 1, r); return Number.isNaN(a.getTime()) ? null : a; } - const o = Date.UTC(n, i - 1, r), l = new Date(o - Fe(o, t)); + const o = Date.UTC(n, s - 1, r), l = new Date(o - Qe(o, t)); return Number.isNaN(l.getTime()) ? null : l; } -function Qe() { - const s = window.location.pathname.split("/").filter(Boolean); - return s.length > 0 ? s[s.length - 1].toLowerCase() : ""; +function We() { + const i = window.location.pathname.split("/").filter(Boolean); + return i.length > 0 ? i[i.length - 1].toLowerCase() : ""; } -function We(s) { - if (!s || typeof s != "object") +function Ze(i) { + if (!i || typeof i != "object") return null; - const t = s, e = w(t.state).toLowerCase(); + const t = i, e = w(t.state).toLowerCase(); if (e !== "open" && e !== "completed") return null; const n = y(t.id, 0); if (!n) return null; - const i = y(t.child_id, 0); + const s = y(t.child_id, 0); return { id: n, - child_id: i > 0 ? i : null, + child_id: s > 0 ? s : null, title: w(t.title) || "Quest", icon: w(t.icon) || null, window: w(t.window).toLowerCase(), @@ -1647,7 +1665,7 @@ function We(s) { on_time: t.on_time === !0 ? !0 : t.on_time === !1 ? !1 : null }; } -const Ze = { +const Ge = { "clear-night": "Clear", cloudy: "Cloudy", exceptional: "Clear", @@ -1663,7 +1681,7 @@ const Ze = { sunny: "Sunny", windy: "Windy", "windy-variant": "Windy" -}, Ge = { +}, Ve = { "clear-night": "Clear night skies", cloudy: "Grey skies today", exceptional: "A striking day", @@ -1680,14 +1698,14 @@ const Ze = { windy: "A blustery day", "windy-variant": "A blustery day" }; -function Ve(s) { - const t = Ze[s]; - return t || s.charAt(0).toUpperCase() + s.slice(1); +function Ke(i) { + const t = Ge[i]; + return t || i.charAt(0).toUpperCase() + i.slice(1); } -function Ke(s, t) { - return Ge[s] ?? t; +function Je(i, t) { + return Ve[i] ?? t; } -const Nt = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Je = "polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%)", Mt = [-9, 6, -4], Xe = Pt` +const Nt = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Xe = "polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%)", Mt = [-9, 6, -4], Ye = Pt` * { box-sizing: border-box; } @@ -1824,7 +1842,7 @@ const Nt = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Je = "polygon(50% justify-content: center; width: 44px; height: 44px; - clip-path: ${v(Je)}; + clip-path: ${v(Xe)}; background: var(--nq-brand-gradient); } @@ -2544,7 +2562,7 @@ const Nt = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Je = "polygon(50% aria-hidden="true" > -`, Ye = d``, tn = d` -`, tn = d``, en = d` -`, en = d``, nn = d` -`, nn = d``, sn = d` -`, sn = d``, rn = d` -`, rn = d``, on = d` -`, on = d``, an = d` -`, an = d``, ln = d` -`, ln = { - icon: sn, +`, cn = { + icon: rn, headline: "No adventurer chosen", body: "Open The Party and tap your crest to open your quest log." -}, cn = { - icon: rn, - headline: "NestQuest is not set up yet", - body: "A parent needs to finish setting up NestQuest." }, dn = { icon: on, + headline: "NestQuest is not set up yet", + body: "A parent needs to finish setting up NestQuest." +}, pn = { + icon: an, headline: "The records cannot be reached", body: "The party's records are quiet right now. NestQuest will return shortly." }, Ot = [ - { key: "morning", name: "Morning", range: "Until 11:59 AM", icon: tn }, + { key: "morning", name: "Morning", range: "Until 11:59 AM", icon: en }, { key: "afternoon", name: "Afternoon", range: "12:00–5:00 PM", icon: Ht }, - { key: "evening", name: "Evening", range: "5:00–9:00 PM", icon: en } + { key: "evening", name: "Evening", range: "5:00–9:00 PM", icon: nn } ]; -class pn extends A { +class hn extends A { static properties = { hass: { attribute: !1 }, _config: { state: !0 }, @@ -2695,7 +2713,7 @@ class pn extends A { _toast: { state: !0 }, _countdown: { state: !0 } }; - static styles = [v(jt), Xe]; + static styles = [v(Dt), Ye]; hass; _config; _now = /* @__PURE__ */ new Date(); @@ -2730,16 +2748,16 @@ class pn extends A { if (!t) return; this._subscribed = !0; - const e = ++this._subGeneration, n = (i) => { - i.then((r) => { + const e = ++this._subGeneration, n = (s) => { + s.then((r) => { this._subscribed && e === this._subGeneration ? this._unsubs.push(r) : r(); }).catch(() => { e === this._subGeneration && (this._unsubscribeLive(), this._armSubscribeRetry()); }); }; - for (const i of Ue) + for (const s of Re) n( - t.subscribeEvents(() => this.requestUpdate(), i) + t.subscribeEvents(() => this.requestUpdate(), s) ); } _armSubscribeRetry() { @@ -2790,18 +2808,18 @@ class pn extends A { _renderMain(t) { switch (t.kind) { case "no-adventurer": - return this._renderNotice(ln); - case "not-set-up": return this._renderNotice(cn); - case "unreachable": + case "not-set-up": return this._renderNotice(dn); + case "unreachable": + return this._renderNotice(pn); case "away": { const e = ["The quest log unlocks when they return."]; return t.returns && e.push(`Returns ${t.returns}`), d` ${this._renderHeader(t)}
- ${nn} + ${sn} ${t.name} is on travels ${e.map((n) => d`

${n}

`)}
@@ -2876,8 +2894,8 @@ class pn extends A { const n = this._childName(t) ?? Y(t); if (!this._childPresent(t)) return { kind: "away", name: n, returns: this._awayReturns(t) }; - const i = this._state(`binary_sensor.nestquest_${t}_all_done`); - if (i && String(i.state ?? "").trim().toLowerCase() === "on") + const s = this._state(`binary_sensor.nestquest_${t}_all_done`); + if (s && String(s.state ?? "").trim().toLowerCase() === "on") return { kind: "complete-day", name: n }; const r = this._state(`sensor.nestquest_${t}_quests_due_today`); return b(y(r?.state, 0)) === 0 ? { kind: "empty-day", name: n } : this._remaining() === 0 ? { kind: "complete-day", name: n } : { kind: "normal" }; @@ -2897,19 +2915,19 @@ class pn extends A { const n = this._state(`sensor.nestquest_${t}_quests_due_today`)?.attributes?.present; if (typeof n == "boolean") return n; - const i = this._state( + const s = this._state( `binary_sensor.nestquest_${t}_present_today` ); - return i ? String(i.state ?? "").trim().toLowerCase() === "on" : !0; + return s ? String(s.state ?? "").trim().toLowerCase() === "on" : !0; } _awayReturns(t) { const e = this._timeZone(), n = this._state( `binary_sensor.nestquest_${t}_present_today` - ), i = Et( + ), s = Et( n?.attributes?.next_present, e ); - return i ? j(i, e) : null; + return s ? D(s, e) : null; } _renderNotice(t) { return d` @@ -2923,14 +2941,14 @@ class pn extends A { `; } _timeZone() { - return Re(this.hass); + return je(this.hass); } _state(t) { const n = this.hass?.states?.[t]; return n && typeof n == "object" ? n : null; } _childSlug() { - return Qe(); + return We(); } _boardPath() { return w(this._config?.board_path).replace(/\/+$/, ""); @@ -2956,8 +2974,8 @@ class pn extends A { _childCounts(t) { const e = this._state(`sensor.nestquest_${t}_quests_due_today`), n = this._state( `sensor.nestquest_${t}_quests_completed_today` - ), i = b(y(e?.state, 0)), r = b(y(n?.state, 0)); - return { due: i, completed: r }; + ), s = b(y(e?.state, 0)), r = b(y(n?.state, 0)); + return { due: s, completed: r }; } _instances() { const t = this._childSlug(); @@ -2966,21 +2984,21 @@ class pn extends A { const e = this._state(`sensor.nestquest_${t}_quests_due_today`)?.attributes?.instances; if (!Array.isArray(e)) return []; - const n = e.map(We).filter((r) => r !== null); + const n = e.map(Ze).filter((r) => r !== null); if (this._optimistic.size === 0) return n; - let i = !1; + let s = !1; for (const r of n) { const o = this._optimistic.get(r.id); if (o !== void 0) { if (r.state === "completed") { - this._optimistic.delete(r.id), i = !0; + this._optimistic.delete(r.id), s = !0; continue; } r.state = "completed", r.overdue = !1, r.completed_at = o; } } - return i && (this._optimistic = new Map(this._optimistic)), n; + return s && (this._optimistic = new Map(this._optimistic)), n; } _remaining() { const t = this._childSlug(); @@ -2991,8 +3009,8 @@ class pn extends A { ); if (e) return b(y(e.state, 0)); - const { due: n, completed: i } = this._childCounts(t); - return b(n - i); + const { due: n, completed: s } = this._childCounts(t); + return b(n - s); } _partyCounts() { const t = this._state( @@ -3005,29 +3023,29 @@ class pn extends A { completed: b(y(e?.state, 0)), due: b(y(t?.state, 0)) }; - const n = this._childSlug(), { due: i, completed: r } = this._childCounts(n); - return { completed: r, due: i }; + const n = this._childSlug(), { due: s, completed: r } = this._childCounts(n); + return { completed: r, due: s }; } _completeStats() { const t = this._childCounts(this._childSlug()).completed, e = this._instances().filter( (r) => r.on_time === !0 - ).length, n = b(t - e), i = this._partyCounts(); + ).length, n = b(t - e), s = this._partyCounts(); return { claimed: t, onTime: e, late: n, - party: `${i.completed}/${i.due}` + party: `${s.completed}/${s.due}` }; } _completeSub(t) { - const e = j(this._now, this._timeZone()), { claimed: n, onTime: i, late: r } = this._completeStats(); - return n === 0 ? `${t} sealed the day on ${e}.` : r === 0 ? `${t} claimed every quest on ${e} — all on time.` : i === 0 ? `${t} claimed every quest on ${e} — all late.` : `${t} claimed every quest on ${e} — ${i} on time, ${r} late.`; + const e = D(this._now, this._timeZone()), { claimed: n, onTime: s, late: r } = this._completeStats(); + return n === 0 ? `${t} sealed the day on ${e}.` : r === 0 ? `${t} claimed every quest on ${e} — all on time.` : s === 0 ? `${t} claimed every quest on ${e} — all late.` : `${t} claimed every quest on ${e} — ${s} on time, ${r} late.`; } _otherChildren() { const t = this.hass?.states; if (!t) return []; - const e = this._childSlug(), n = this._timeZone(), i = []; + const e = this._childSlug(), n = this._timeZone(), s = []; for (const r of Object.keys(t)) { const o = /^sensor\.nestquest_(.+)_quests_due_today$/.exec(r); if (!o || o[1] === "household" || o[1] === e) @@ -3057,7 +3075,7 @@ class pn extends A { ); m = x ? De(x, n) : null; } - i.push({ + s.push({ slug: l, name: p, present: u, @@ -3066,10 +3084,10 @@ class pn extends A { returnsWeekday: m }); } - return i.sort((r, o) => r.name.localeCompare(o.name)); + return s.sort((r, o) => r.name.localeCompare(o.name)); } _renderHeader(t) { - const e = this._childSlug(), n = t.kind === "away", i = n ? t.name : this._childName(e) ?? (e ? Y(e) : null), { due: r, completed: o } = this._childCounts(e), l = this._remaining(), a = this._partyCounts(), p = i ? `${i}'s Quest Log` : "Quest Log", u = (i?.charAt(0) || "?").toUpperCase(); + const e = this._childSlug(), n = t.kind === "away", s = n ? t.name : this._childName(e) ?? (e ? Y(e) : null), { due: r, completed: o } = this._childCounts(e), l = this._remaining(), a = this._partyCounts(), p = s ? `${s}'s Quest Log` : "Quest Log", u = (s?.charAt(0) || "?").toUpperCase(); return d`
- ${i.length}/${e.length} + ${s.length}/${e.length}
${St( @@ -3147,7 +3165,7 @@ class pn extends A { (l) => this._renderQuest(l, !1, 0) )} ${St( - i, + s, (l) => l.id, (l, a) => this._renderQuest(l, !0, a) )} @@ -3158,7 +3176,7 @@ class pn extends A { } _renderQuest(t, e, n) { if (e) { - const o = Mt[n % Mt.length], l = t.completed_at ? je(t.completed_at, this._timeZone()) : ""; + const o = Mt[n % Mt.length], l = t.completed_at ? He(t.completed_at, this._timeZone()) : ""; return d`
@@ -3178,11 +3196,11 @@ class pn extends A {
`; } - const i = Be(t.due_time), r = t.overdue ? { - text: i ? `Overdue · due ${i}` : "Overdue", + const s = Fe(t.due_time), r = t.overdue ? { + text: s ? `Overdue · due ${s}` : "Overdue", late: !0 } : { - text: i ? `Due by ${i}` : "Due today", + text: s ? `Due by ${s}` : "Due today", late: !1 }; return d` @@ -3261,7 +3279,7 @@ class pn extends A { type="button" @click=${() => this._closeConfirm()} > - ${Ye} + ${tn} Not yet