Fix quest log parseIsoDate RangeError from invalid hour option

This commit is contained in:
2026-09-20 12:57:23 -04:00
parent bc04b45a66
commit 0dde7b886e
2 changed files with 100 additions and 72 deletions
@@ -24,7 +24,7 @@ const b = (i) => new Nt(typeof i == "string" ? i : i + "", void 0, tt), Tt = (i,
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.");
})(s) + i[r + 1], i[0]);
return new Nt(e, i, tt);
}, Dt = (i, t) => {
}, It = (i, t) => {
if (Y) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
else for (const e of t) {
const n = document.createElement("style"), s = L.litNonce;
@@ -35,7 +35,7 @@ const b = (i) => new Nt(typeof i == "string" ? i : i + "", void 0, tt), Tt = (i,
for (const n of t.cssRules) e += n.cssText;
return b(e);
})(i) : i;
const { is: Ht, defineProperty: jt, getOwnPropertyDescriptor: Lt, getOwnPropertyNames: Rt, getOwnPropertySymbols: Bt, getPrototypeOf: Ft } = Object, F = globalThis, at = F.trustedTypes, Qt = at ? at.emptyScript : "", Wt = F.reactiveElementPolyfillSupport, I = (i, t) => i, X = { toAttribute(i, t) {
const { is: Ht, defineProperty: jt, getOwnPropertyDescriptor: Lt, getOwnPropertyNames: Rt, getOwnPropertySymbols: Bt, getPrototypeOf: Ft } = Object, F = globalThis, at = F.trustedTypes, Qt = at ? at.emptyScript : "", Wt = F.reactiveElementPolyfillSupport, U = (i, t) => i, X = { toAttribute(i, t) {
switch (t) {
case Boolean:
i = i ? Qt : null;
@@ -93,13 +93,13 @@ let T = class extends HTMLElement {
return this.elementProperties.get(t) ?? lt;
}
static _$Ei() {
if (this.hasOwnProperty(I("elementProperties"))) return;
if (this.hasOwnProperty(U("elementProperties"))) return;
const t = Ft(this);
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
}
static finalize() {
if (this.hasOwnProperty(I("finalized"))) return;
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(I("properties"))) {
if (this.hasOwnProperty(U("finalized"))) return;
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) {
const e = this.properties, n = [...Rt(e), ...Bt(e)];
for (const s of n) this.createProperty(s, e[s]);
}
@@ -146,7 +146,7 @@ let T = class extends HTMLElement {
}
createRenderRoot() {
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return Dt(t, this.constructor.elementStyles), t;
return It(t, this.constructor.elementStyles), t;
}
connectedCallback() {
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t) => t.hostConnected?.());
@@ -246,11 +246,11 @@ let T = class extends HTMLElement {
firstUpdated(t) {
}
};
T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[I("elementProperties")] = /* @__PURE__ */ new Map(), T[I("finalized")] = /* @__PURE__ */ new Map(), Wt?.({ ReactiveElement: T }), (F.reactiveElementVersions ??= []).push("2.1.2");
const et = globalThis, dt = (i) => i, R = et.trustedTypes, pt = R ? R.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Mt = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, Pt = "?" + x, Zt = `<${Pt}>`, S = document, U = () => S.createComment(""), D = (i) => i === null || typeof i != "object" && typeof i != "function", nt = Array.isArray, Vt = (i) => nt(i) || typeof i?.[Symbol.iterator] == "function", W = `[
T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[U("elementProperties")] = /* @__PURE__ */ new Map(), T[U("finalized")] = /* @__PURE__ */ new Map(), Wt?.({ ReactiveElement: T }), (F.reactiveElementVersions ??= []).push("2.1.2");
const et = globalThis, dt = (i) => i, R = et.trustedTypes, pt = R ? R.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Mt = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, Pt = "?" + x, Zt = `<${Pt}>`, S = document, D = () => S.createComment(""), I = (i) => i === null || typeof i != "object" && typeof i != "function", nt = Array.isArray, Vt = (i) => nt(i) || typeof i?.[Symbol.iterator] == "function", W = `[
\f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ct = /-->/g, ht = />/g, q = RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`, "g"), ut = /'/g, ft = /"/g, Ot = /^(?:script|style|textarea|title)$/i, Kt = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), g = Kt(1), E = /* @__PURE__ */ Symbol.for("lit-noChange"), m = /* @__PURE__ */ Symbol.for("lit-nothing"), mt = /* @__PURE__ */ new WeakMap(), A = S.createTreeWalker(S, 129);
function It(i, t) {
function Ut(i, t) {
if (!nt(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
return pt !== void 0 ? pt.createHTML(t) : t;
}
@@ -264,7 +264,7 @@ const Jt = (i, t) => {
const c = o === q && i[l + 1].startsWith("/>") ? " " : "";
r += o === P ? a + Zt : d >= 0 ? (n.push(p), a.slice(0, d) + Mt + a.slice(d) + x + c) : a + x + (d === -2 ? l : c);
}
return [It(i, r + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), n];
return [Ut(i, r + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), n];
};
class H {
constructor({ strings: t, _$litType$: e }, n) {
@@ -286,8 +286,8 @@ class H {
const d = s.textContent.split(x), h = d.length - 1;
if (h > 0) {
s.textContent = R ? R.emptyScript : "";
for (let c = 0; c < h; c++) s.append(d[c], U()), A.nextNode(), a.push({ type: 2, index: ++r });
s.append(d[h], U());
for (let c = 0; c < h; c++) s.append(d[c], D()), A.nextNode(), a.push({ type: 2, index: ++r });
s.append(d[h], D());
}
}
} else if (s.nodeType === 8) if (s.data === Pt) a.push({ type: 2, index: r });
@@ -306,7 +306,7 @@ class H {
function z(i, t, e = i, n) {
if (t === E) return t;
let s = n !== void 0 ? e._$Co?.[n] : e._$Cl;
const r = D(t) ? void 0 : t._$litDirective$;
const r = I(t) ? void 0 : t._$litDirective$;
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 = z(i, s._$AS(i, t.values), s, n)), t;
}
class Gt {
@@ -356,7 +356,7 @@ class M {
return this._$AB;
}
_$AI(t, e = this) {
t = z(this, t, e), D(t) ? t === m || t == null || t === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : t !== this._$AH && t !== E && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Vt(t) ? this.k(t) : this._(t);
t = z(this, t, e), I(t) ? t === m || t == null || t === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : t !== this._$AH && t !== E && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Vt(t) ? this.k(t) : this._(t);
}
O(t) {
return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -365,10 +365,10 @@ class M {
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
}
_(t) {
this._$AH !== m && D(this._$AH) ? this._$AA.nextSibling.data = t : this.T(S.createTextNode(t)), this._$AH = t;
this._$AH !== m && I(this._$AH) ? this._$AA.nextSibling.data = t : this.T(S.createTextNode(t)), this._$AH = t;
}
$(t) {
const { values: e, _$litType$: n } = t, s = typeof n == "number" ? this._$AC(t) : (n.el === void 0 && (n.el = H.createElement(It(n.h, n.h[0]), this.options)), n);
const { values: e, _$litType$: n } = t, s = typeof n == "number" ? this._$AC(t) : (n.el === void 0 && (n.el = H.createElement(Ut(n.h, n.h[0]), this.options)), n);
if (this._$AH?._$AD === s) this._$AH.p(e);
else {
const r = new Gt(s, this), o = r.u(this.options);
@@ -383,7 +383,7 @@ class M {
nt(this._$AH) || (this._$AH = [], this._$AR());
const e = this._$AH;
let n, s = 0;
for (const r of t) s === e.length ? e.push(n = new M(this.O(U()), this.O(U()), this, this.options)) : n = e[s], n._$AI(r), s++;
for (const r of t) s === e.length ? e.push(n = new M(this.O(D()), this.O(D()), 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) {
@@ -409,11 +409,11 @@ class Q {
_$AI(t, e = this, n, s) {
const r = this.strings;
let o = !1;
if (r === void 0) t = z(this, t, e, 0), o = !D(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
if (r === void 0) t = z(this, t, e, 0), o = !I(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
else {
const l = t;
let a, p;
for (t = r[0], a = 0; a < r.length - 1; a++) p = z(this, l[n + a], e, a), p === E && (p = this._$AH[a]), o ||= !D(p) || p !== this._$AH[a], p === m ? t = m : t !== m && (t += (p ?? "") + r[a + 1]), this._$AH[a] = p;
for (t = r[0], a = 0; a < r.length - 1; a++) p = z(this, l[n + a], e, a), p === E && (p = this._$AH[a]), o ||= !I(p) || p !== this._$AH[a], p === m ? t = m : t !== m && (t += (p ?? "") + r[a + 1]), this._$AH[a] = p;
}
o && !s && this.j(t);
}
@@ -468,7 +468,7 @@ const se = (i, t, e) => {
let s = n._$litPart$;
if (s === void 0) {
const r = e?.renderBefore ?? null;
n._$litPart$ = s = new M(t.insertBefore(U(), r), r, void 0, e ?? {});
n._$litPart$ = s = new M(t.insertBefore(D(), r), r, void 0, e ?? {});
}
return s._$AI(i), s;
};
@@ -499,7 +499,7 @@ C._$litElement$ = !0, C.finalized = !0, it.litElementHydrateSupport?.({ LitEleme
const re = it.litElementPolyfillSupport;
re?.({ LitElement: C });
(it.litElementVersions ??= []).push("4.2.2");
const Ut = ':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-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}';
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-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 st(i) {
window.customCards = window.customCards ?? [], window.customCards.push(i);
}
@@ -1015,7 +1015,7 @@ class ve extends C {
_config: { state: !0 },
_now: { state: !0 }
};
static styles = [b(Ut), ge];
static styles = [b(Dt), ge];
hass;
_config;
_now = /* @__PURE__ */ new Date();
@@ -1379,36 +1379,48 @@ function At(i) {
return i.split(/[-_]+/).filter(Boolean).map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
}
function Me(i, t) {
const e = j(t, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hourCycle: "h23"
}).formatToParts(new Date(i)), n = (r) => {
const o = e.find((l) => l.type === r);
return o ? Number(o.value) : Number.NaN;
}, s = Date.UTC(
n("year"),
n("month") - 1,
n("day"),
n("hour"),
n("minute"),
n("second")
);
return Number.isFinite(s) ? s - i : 0;
}
function Pe(i, t) {
if (typeof i != "string")
return null;
const e = i.split("-");
if (e.length !== 3)
return null;
const [n, s, r] = e.map((l) => Number(l));
const [n, s, r] = e.map((a) => Number(a));
if (!n || !s || !r)
return null;
if (!t) {
const l = new Date(n, s - 1, r);
return Number.isNaN(l.getTime()) ? null : l;
const a = new Date(n, s - 1, r);
return Number.isNaN(a.getTime()) ? null : a;
}
const o = new Date(
j(t, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "12",
minute: "2-digit",
hour12: !1,
timeZone: "UTC"
}).format(new Date(Date.UTC(n, s - 1, r)))
);
return Number.isNaN(o.getTime()) ? null : o;
const o = Date.UTC(n, s - 1, r), l = new Date(o - Me(o, t));
return Number.isNaN(l.getTime()) ? null : l;
}
function Pe() {
function Oe() {
const i = window.location.pathname.split("/").filter(Boolean);
return i.length > 0 ? i[i.length - 1].toLowerCase() : "";
}
function Oe(i) {
function Ue(i) {
if (!i || typeof i != "object")
return null;
const t = i, e = k(t.state).toLowerCase();
@@ -1426,7 +1438,7 @@ function Oe(i) {
completed_at: k(t.completed_at) || null
} : null;
}
const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Ie = "polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%)", St = [-9, 6, -4], Ue = Tt`
const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", De = "polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%)", St = [-9, 6, -4], Ie = Tt`
* {
box-sizing: border-box;
}
@@ -1559,7 +1571,7 @@ const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Ie = "polygon(50%
justify-content: center;
width: 44px;
height: 44px;
clip-path: ${b(Ie)};
clip-path: ${b(De)};
background: var(--nq-brand-gradient);
}
@@ -2003,7 +2015,7 @@ const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Ie = "polygon(50%
aria-hidden="true"
>
<path d="M20 6 9 17l-5-5"></path>
</svg>`, De = g`<svg
</svg>`, He = g`<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
@@ -2026,7 +2038,7 @@ const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Ie = "polygon(50%
<polygon
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26"
></polygon>
</svg>`, He = g`<svg
</svg>`, je = g`<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
@@ -2043,7 +2055,7 @@ const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Ie = "polygon(50%
<path d="M22 22H2"></path>
<path d="m8 6 4-4 4 4"></path>
<path d="M16 18a4 4 0 0 0-8 0"></path>
</svg>`, je = g`<svg
</svg>`, Le = g`<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
@@ -2061,7 +2073,7 @@ const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Ie = "polygon(50%
<path d="M20 12h2"></path>
<path d="m6.34 17.66-1.41 1.41"></path>
<path d="m19.07 4.93-1.41 1.41"></path>
</svg>`, Le = g`<svg
</svg>`, Re = g`<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
@@ -2072,18 +2084,18 @@ const Ct = "polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%)", Ie = "polygon(50%
>
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path>
</svg>`, Et = [
{ key: "morning", name: "Morning", range: "Until 11:59 AM", icon: He },
{ key: "afternoon", name: "Afternoon", range: "12:00–5:00 PM", icon: je },
{ key: "evening", name: "Evening", range: "5:00–9:00 PM", icon: Le }
{ key: "morning", name: "Morning", range: "Until 11:59 AM", icon: je },
{ key: "afternoon", name: "Afternoon", range: "12:00–5:00 PM", icon: Le },
{ key: "evening", name: "Evening", range: "5:00–9:00 PM", icon: Re }
];
class Re extends C {
class Be extends C {
static properties = {
hass: { attribute: !1 },
_config: { state: !0 },
_now: { state: !0 },
_confirm: { state: !0 }
};
static styles = [b(Ut), Ue];
static styles = [b(Dt), Ie];
hass;
_config;
_now = /* @__PURE__ */ new Date();
@@ -2128,7 +2140,7 @@ class Re extends C {
return n && typeof n == "object" ? n : null;
}
_childSlug() {
return Pe();
return Oe();
}
_boardPath() {
return k(this._config?.board_path).replace(/\/+$/, "");
@@ -2158,7 +2170,7 @@ class Re extends C {
if (!t)
return [];
const e = this._state(`sensor.nestquest_${t}_quests_due_today`)?.attributes?.instances;
return Array.isArray(e) ? e.map(Oe).filter((n) => n !== null) : [];
return Array.isArray(e) ? e.map(Ue).filter((n) => n !== null) : [];
}
_remaining() {
const t = this._childSlug();
@@ -2214,7 +2226,7 @@ class Re extends C {
if (!u) {
const _ = this._state(
`binary_sensor.nestquest_${l}_present_today`
), v = Me(
), v = Pe(
_?.attributes?.next_present,
n
);
@@ -2402,7 +2414,7 @@ class Re extends C {
type="button"
@click=${() => this._closeConfirm()}
>
${De}
${He}
<span>Not yet</span>
</button>
<button
@@ -2454,19 +2466,19 @@ class Re extends C {
this._armIdle(), this._confirm !== null && this._armConfirmTimer();
};
}
customElements.define("nestquest-quest-log-card", Re);
customElements.define("nestquest-quest-log-card", Be);
st({
type: "nestquest-quest-log-card",
name: "NestQuest Quest Log",
description: "One child's daily quests, grouped by window."
});
const Be = ":host{--nq-brand-blue: #3B3AB8;--nq-brand-purple: #A035CC;--nq-brand-gradient: linear-gradient(135deg, var(--nq-brand-blue), var(--nq-brand-purple));--nq-brand-gradient-h: linear-gradient(90deg, var(--nq-brand-blue), var(--nq-brand-purple));--nq-a-page: #F4F4F6;--nq-a-surface: #FFFFFF;--nq-a-surface-subtle: #FAFAFA;--nq-a-selected: #EBEBF8;--nq-a-border: #E4E4EA;--nq-a-divider: #EDEDF1;--nq-a-ink: #18181D;--nq-a-ink-secondary: #52525E;--nq-a-ink-tertiary: #70707E;--nq-a-success: #15803D;--nq-a-danger: #DC2626;--nq-a-danger-strong: #B91C1C;--nq-a-danger-bg: #FEE2E2;--nq-a-warning-ink: #92400E;--nq-a-warning-ink-2: #78350F;--nq-a-warning-bg: #FEF3C7;--nq-a-warning-border: rgba(217,119,6,.35);--nq-a-info-bg: #DBEAFE;--nq-a-info-ink: #1E3A8A;--nq-a-info-icon: #1D4ED8;--nq-a-reversal: #7D28A0;--nq-a-font: Nunito, system-ui, sans-serif;--nq-a-size-screen: 24px;--nq-a-size-hero: 32px;--nq-a-size-card-title: 19px;--nq-a-size-stat: 22px;--nq-a-size-row: 13.5px;--nq-a-size-meta: 11px;--nq-a-size-label: 10px;--nq-a-track-label: .1em;--nq-a-density-page-pad: 14px 16px 92px;--nq-a-density-gap: 10px;--nq-a-density-card-pad: 13px;--nq-a-density-row-pad: 11px 13px;--nq-a-density-radius: 8px;--nq-a-density-shadow: none;--nq-a-tabbar-height: 70px;--nq-a-tap-min: 44px;--nq-a-radius-pill: 9999px;--nq-a-radius-sheet: 20px 20px 0 0;--nq-a-sheet-shadow: 0 -8px 28px rgba(9,9,11,.18);--nq-a-progress-height: 6px;--nq-ease-out: cubic-bezier(0, 0, .2, 1);--nq-dur-micro: .12s;--nq-dur-base: .2s;--nq-dur-modal: .35s}";
class Fe extends C {
const Fe = ":host{--nq-brand-blue: #3B3AB8;--nq-brand-purple: #A035CC;--nq-brand-gradient: linear-gradient(135deg, var(--nq-brand-blue), var(--nq-brand-purple));--nq-brand-gradient-h: linear-gradient(90deg, var(--nq-brand-blue), var(--nq-brand-purple));--nq-a-page: #F4F4F6;--nq-a-surface: #FFFFFF;--nq-a-surface-subtle: #FAFAFA;--nq-a-selected: #EBEBF8;--nq-a-border: #E4E4EA;--nq-a-divider: #EDEDF1;--nq-a-ink: #18181D;--nq-a-ink-secondary: #52525E;--nq-a-ink-tertiary: #70707E;--nq-a-success: #15803D;--nq-a-danger: #DC2626;--nq-a-danger-strong: #B91C1C;--nq-a-danger-bg: #FEE2E2;--nq-a-warning-ink: #92400E;--nq-a-warning-ink-2: #78350F;--nq-a-warning-bg: #FEF3C7;--nq-a-warning-border: rgba(217,119,6,.35);--nq-a-info-bg: #DBEAFE;--nq-a-info-ink: #1E3A8A;--nq-a-info-icon: #1D4ED8;--nq-a-reversal: #7D28A0;--nq-a-font: Nunito, system-ui, sans-serif;--nq-a-size-screen: 24px;--nq-a-size-hero: 32px;--nq-a-size-card-title: 19px;--nq-a-size-stat: 22px;--nq-a-size-row: 13.5px;--nq-a-size-meta: 11px;--nq-a-size-label: 10px;--nq-a-track-label: .1em;--nq-a-density-page-pad: 14px 16px 92px;--nq-a-density-gap: 10px;--nq-a-density-card-pad: 13px;--nq-a-density-row-pad: 11px 13px;--nq-a-density-radius: 8px;--nq-a-density-shadow: none;--nq-a-tabbar-height: 70px;--nq-a-tap-min: 44px;--nq-a-radius-pill: 9999px;--nq-a-radius-sheet: 20px 20px 0 0;--nq-a-sheet-shadow: 0 -8px 28px rgba(9,9,11,.18);--nq-a-progress-height: 6px;--nq-ease-out: cubic-bezier(0, 0, .2, 1);--nq-dur-micro: .12s;--nq-dur-base: .2s;--nq-dur-modal: .35s}";
class Qe extends C {
static properties = {
hass: { attribute: !1 },
_config: { state: !0 }
};
static styles = [b(Be)];
static styles = [b(Fe)];
hass;
_config;
setConfig(t) {
@@ -2481,14 +2493,14 @@ class Fe extends C {
return g`<div>NestQuest Admin</div>`;
}
}
customElements.define("nestquest-admin-card", Fe);
customElements.define("nestquest-admin-card", Qe);
st({
type: "nestquest-admin-card",
name: "NestQuest Admin",
description: "Parent phone view for today, tasks, schedule, and history."
});
const Qe = "/nestquest-static/nestquest-fonts.css";
const We = "/nestquest-static/nestquest-fonts.css";
if (!document.querySelector('link[data-nq-fonts=""]')) {
const i = document.createElement("link");
i.rel = "stylesheet", i.href = Qe, i.dataset.nqFonts = "", document.head.appendChild(i);
i.rel = "stylesheet", i.href = We, i.dataset.nqFonts = "", document.head.appendChild(i);
}
+27 -11
View File
@@ -132,6 +132,31 @@ function titleCaseSlug(slug: string): string {
.join(" ");
}
function zoneOffsetMs(instant: number, timeZone: string): number {
const parts = zonedFormatter(timeZone, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hourCycle: "h23",
}).formatToParts(new Date(instant));
const read = (type: Intl.DateTimeFormatPartTypes): number => {
const part = parts.find((entry) => entry.type === type);
return part ? Number(part.value) : Number.NaN;
};
const asUtc = Date.UTC(
read("year"),
read("month") - 1,
read("day"),
read("hour"),
read("minute"),
read("second")
);
return Number.isFinite(asUtc) ? asUtc - instant : 0;
}
function parseIsoDate(value: unknown, timeZone?: string): Date | null {
if (typeof value !== "string") {
return null;
@@ -148,17 +173,8 @@ function parseIsoDate(value: unknown, timeZone?: string): Date | null {
const local = new Date(year, month - 1, day);
return Number.isNaN(local.getTime()) ? null : local;
}
const date = new Date(
zonedFormatter(timeZone, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "12",
minute: "2-digit",
hour12: false,
timeZone: "UTC",
}).format(new Date(Date.UTC(year, month - 1, day)))
);
const utcMs = Date.UTC(year, month - 1, day);
const date = new Date(utcMs - zoneOffsetMs(utcMs, timeZone));
return Number.isNaN(date.getTime()) ? null : date;
}