@glasshome/widget-sdk 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,25 +1,24 @@
1
- import { n as e, r as t, t as n } from "./tokens-CFl0mCx4.js";
2
- import { deprecate as r, deprecations as i, formatDeprecation as a } from "./deprecations.js";
3
- import { WidgetManifestSchema as o, formatSchemaError as s } from "./schemas.js";
4
- import { z as c, z as l } from "zod";
5
- import { getForecasts as u, getStream as d, getWebRtcClientConfig as f, hassMediaUrl as p, sendWebRtcCandidate as m, startWebRtcSession as h, state as g, trackEntityHistory as _, untrackEntityHistory as v } from "@glasshome/sync-layer";
6
- import { byDomain as ee, useArea as y, useCamera as b, useConnection as te, useCurrency as ne, useEntities as re, useEntity as x, useEntityHistory as ie, useEntityStatistics as ae, useForecast as oe, useHassConfig as se, useLocale as S, useService as ce, useStore as le, useTemperatureUnit as ue, useToggle as de, useTurnOff as fe, useTurnOn as pe, useUnitSystem as me } from "@glasshome/sync-layer/solid";
7
- import { Show as C, createContext as he, createEffect as w, createMemo as T, createSignal as E, on as ge, onCleanup as D, onMount as _e, splitProps as ve, untrack as ye, useContext as O } from "solid-js";
8
- import { addEventListener as k, className as A, createComponent as j, delegateEvents as be, effect as M, insert as N, memo as P, setStyleProperty as F, style as I, template as L, use as xe } from "solid-js/web";
9
- import { clsx as Se } from "clsx";
10
- import { twMerge as Ce } from "tailwind-merge";
11
- import { Badge as we, Button as Te, ColorSlider as Ee, ColorWheel as De, Input as Oe, Label as ke, ResponsiveDialog as Ae, ResponsiveDialogContent as je, ResponsiveDialogDescription as Me, ResponsiveDialogHeader as Ne, ResponsiveDialogTitle as Pe, SchemaForm as Fe, Select as Ie, SelectContent as Le, SelectItem as Re, SelectTrigger as ze, SelectValue as Be, Slider as Ve, Switch as He, parseColor as Ue } from "@glasshome/ui/solid";
1
+ import { deprecate as e, deprecations as t, formatDeprecation as n } from "./deprecations.js";
2
+ import { WidgetManifestSchema as r, formatSchemaError as i } from "./schemas.js";
3
+ import { z as a, z as o } from "zod";
4
+ import { getForecasts as s, getStream as c, getWebRtcClientConfig as l, hassMediaUrl as u, sendWebRtcCandidate as d, startWebRtcSession as f, state as p, trackEntityHistory as m, untrackEntityHistory as h } from "@glasshome/sync-layer";
5
+ import { byDomain as g, useArea as _, useCamera as v, useConnection as ee, useCurrency as y, useEntities as b, useEntity as te, useEntityHistory as ne, useEntityStatistics as re, useForecast as x, useHassConfig as ie, useLocale as ae, useService as oe, useStore as se, useTemperatureUnit as S, useToggle as ce, useTurnOff as le, useTurnOn as ue, useUnitSystem as de } from "@glasshome/sync-layer/solid";
6
+ import { Show as C, createContext as fe, createEffect as w, createMemo as T, createSignal as E, on as pe, onCleanup as D, onMount as me, splitProps as he, untrack as ge, useContext as O } from "solid-js";
7
+ import { addEventListener as k, className as A, createComponent as j, delegateEvents as _e, effect as M, insert as N, memo as P, setStyleProperty as F, style as ve, template as I, use as ye } from "solid-js/web";
8
+ import { clsx as be } from "clsx";
9
+ import { twMerge as xe } from "tailwind-merge";
10
+ import { Badge as Se, Button as Ce, ColorSlider as we, ColorWheel as Te, Input as Ee, Label as De, ResponsiveDialog as Oe, ResponsiveDialogContent as ke, ResponsiveDialogDescription as Ae, ResponsiveDialogHeader as je, ResponsiveDialogTitle as Me, SchemaForm as Ne, Select as Pe, SelectContent as Fe, SelectItem as Ie, SelectTrigger as Le, SelectValue as Re, Slider as ze, Switch as Be, parseColor as Ve } from "@glasshome/ui/solid";
12
11
  //#region src/framework/to-form-schema.ts
13
- function We(e) {
14
- return l.toJSONSchema(e, { override: (e) => {
15
- let t = l.globalRegistry.get(e.zodSchema);
12
+ function He(e) {
13
+ return o.toJSONSchema(e, { override: (e) => {
14
+ let t = o.globalRegistry.get(e.zodSchema);
16
15
  return t && typeof t == "object" && Object.keys(t).length > 0 ? {
17
16
  ...e.jsonSchema,
18
17
  ...t
19
18
  } : e.jsonSchema;
20
19
  } });
21
20
  }
22
- function Ge(e) {
21
+ function Ue(e) {
23
22
  try {
24
23
  return e.parse({});
25
24
  } catch {
@@ -28,39 +27,47 @@ function Ge(e) {
28
27
  }
29
28
  //#endregion
30
29
  //#region src/define-widget.ts
31
- function Ke(e) {
32
- return e.configSchema && (e.manifest.schema || (e.manifest.schema = We(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ge(e.configSchema))), e;
30
+ function We(e) {
31
+ return e.configSchema && (e.manifest.schema || (e.manifest.schema = He(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ue(e.configSchema))), e;
32
+ }
33
+ //#endregion
34
+ //#region src/framework/hooks/use-widget-context.ts
35
+ var L = fe();
36
+ function Ge() {
37
+ let e = O(L);
38
+ if (!e) throw Error("useWidgetContext must be used within a Widget component");
39
+ return e;
33
40
  }
34
41
  //#endregion
35
42
  //#region src/framework/hooks/use-service.ts
36
- function qe(e) {
43
+ function Ke(e) {
37
44
  let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
38
45
  if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
39
46
  return n;
40
47
  }
41
48
  function R(e, t) {
42
- return (n, r = {}) => e(qe(n), t, r, { entity_id: n });
49
+ return (n, r = {}) => e(Ke(n), t, r, { entity_id: n });
50
+ }
51
+ function qe() {
52
+ let e = O(L)?.callService;
53
+ return e ? {
54
+ callService: e,
55
+ turnOn: R(e, "turn_on"),
56
+ turnOff: R(e, "turn_off"),
57
+ toggle: R(e, "toggle")
58
+ } : oe();
43
59
  }
44
60
  function Je() {
45
- let t = O(e)?.callService;
46
- return t ? {
47
- callService: t,
48
- turnOn: R(t, "turn_on"),
49
- turnOff: R(t, "turn_off"),
50
- toggle: R(t, "toggle")
51
- } : ce();
61
+ let e = O(L)?.callService;
62
+ return e ? R(e, "turn_on") : ue();
52
63
  }
53
64
  function Ye() {
54
- let t = O(e)?.callService;
55
- return t ? R(t, "turn_on") : pe();
65
+ let e = O(L)?.callService;
66
+ return e ? R(e, "turn_off") : le();
56
67
  }
57
68
  function Xe() {
58
- let t = O(e)?.callService;
59
- return t ? R(t, "turn_off") : fe();
60
- }
61
- function Ze() {
62
- let t = O(e)?.callService;
63
- return t ? R(t, "toggle") : de();
69
+ let e = O(L)?.callService;
70
+ return e ? R(e, "toggle") : ce();
64
71
  }
65
72
  //#endregion
66
73
  //#region src/framework/design-system/z-index.ts
@@ -69,18 +76,41 @@ var z = {
69
76
  CONTENT: 10,
70
77
  OVERLAY: 20,
71
78
  ACTIONS: 30
72
- }, Qe = he();
73
- function $e() {
74
- let e = O(Qe);
79
+ }, Ze = fe();
80
+ function Qe() {
81
+ let e = O(Ze);
75
82
  if (!e) throw Error("useWidgetDimensions must be called inside <Widget>: move the call into a component rendered within <Widget> (the top-level widget scope only sees the host stub).");
76
83
  return e;
77
84
  }
78
85
  //#endregion
86
+ //#region src/framework/theming/tokens.css?raw
87
+ var $e = "/* Authoritative SDK CSS contract. Injected once on first Widget mount\n * via framework/theming/tokens.ts.\n *\n * All widget-internal visual scale is driven from CSS custom properties +\n * container queries on the `.glasshome-widget` shell (`container-type: size`).\n * No JS classifier, no size tier enum.\n */\n\n:root {\n --tone-success: oklch(0.70 0.18 145);\n --tone-warning: oklch(0.80 0.17 75);\n --tone-danger: oklch(0.64 0.22 27);\n --tone-info: oklch(0.66 0.20 245);\n --tone-neutral: oklch(0.65 0.02 250);\n --tone-accent: oklch(0.74 0.18 60);\n\n --widget-grad-strength: 1;\n --widget-glow-default: 0.4;\n --widget-border-highlight: oklch(0.98 0 0 / 0.4);\n}\n\n.dark {\n --tone-success: oklch(0.74 0.18 145);\n --tone-warning: oklch(0.82 0.17 75);\n --tone-danger: oklch(0.68 0.22 27);\n --tone-info: oklch(0.70 0.20 245);\n --tone-neutral: oklch(0.69 0.02 250);\n --tone-accent: oklch(0.78 0.18 60);\n\n --widget-grad-strength: 1.1;\n --widget-glow-default: 0.5;\n --widget-border-highlight: oklch(1 0 0 / 0.08);\n}\n\n@property --widget-color {\n syntax: \"<color>\";\n inherits: true;\n initial-value: oklch(0.65 0.02 250);\n}\n\n/* === Widget shell ===\n * Fluid scale tokens — tied to the shell's own container box (cqb=height, cqi=width).\n * Icon/pad/gap track HEIGHT (cqb) not the shortest side: two widgets of equal\n * height match regardless of width (a 2×2 and a 4×2 get the same icon). cqmin\n * starved portrait tiles by pinning the icon to the narrow width. Tune\n * multipliers / clamps to adjust density. */\n.glasshome-widget {\n --widget-color: var(--tone-neutral);\n --widget-glow-strength: var(--widget-glow-default);\n\n --widget-icon-box: clamp(44px, 25cqb, 58px);\n --widget-icon-glyph: clamp(24px, 14cqb, 33px);\n --widget-pad: clamp(8px, 3.5cqb, 22px);\n --widget-gap: clamp(6px, 2cqb, 14px);\n --widget-title-size: clamp(12px, 2cqi, 18px);\n --widget-subtitle: clamp(12px, 2.5cqi, 20px);\n --widget-status-size: clamp(14px, 5cqi, 36px);\n --widget-value-size: clamp(18px, 7cqi, 48px);\n --widget-badge-size: clamp(11px, 1.6cqi, 14px);\n}\n\n/* Shell material. Two channels, both host/variant-driven:\n * - `--widget-backdrop`: the live backdrop filter (the shared glass recipe is\n * blur + saturate, matching ui's CARD_BLUR). Default none — a variant opts\n * in (classic-glass), and a performant-blur host disables it via override\n * sheet when it paints a precomputed frost instead.\n * - `--glass-frost`: one full background layer (image + position / size +\n * repeat) composited at the BOTTOM, under the accent gradient — the same\n * frost slot ui's `.glass` formula ends its background list with. Unset →\n * none. A performant-blur host sets it per shell with the viewport-aligned\n * slice of its pre-blurred bitmap. */\n.glasshome-widget {\n background:\n var(--widget-gradient,\n linear-gradient(135deg,\n color-mix(in oklch, var(--widget-color) calc(22% * var(--widget-grad-strength)), transparent),\n color-mix(in oklch, var(--widget-color-to, var(--widget-color)) calc(11% * var(--widget-grad-strength)), transparent)\n )\n ),\n var(--glass-frost, none);\n backdrop-filter: var(--widget-backdrop, none);\n -webkit-backdrop-filter: var(--widget-backdrop, none);\n box-shadow: inset 0 1px 0 var(--widget-border-highlight);\n}\n\n/* === Slot: content layout === */\n/* Default: column. Flip to row only on wide-and-short widgets (matches the\n * old contentLayout heuristic: aspect > 1 AND height < 150px). */\n.glasshome-widget-content {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n padding: var(--widget-pad);\n gap: var(--widget-gap);\n overflow: hidden;\n}\n@container widget (min-aspect-ratio: 1) and (max-height: 149px) {\n .glasshome-widget-content {\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n }\n}\n\n/* === Compact 1×1 ===\n * Small in BOTH axes → stack the tile: icon on top, label + status centered\n * under it. Icon stays moderate (not a hero) so the text keeps room. Wide\n * tiles (2×1) fail the width test and keep the row layout above. Placed after\n * the row-flip so it wins. */\n@container widget (max-width: 189px) and (max-height: 189px) {\n .glasshome-widget-content {\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: clamp(4px, 2.5cqmin, 8px);\n }\n .glasshome-widget-content > * { align-items: center; text-align: center; }\n .glasshome-widget-icon {\n --widget-icon-box: clamp(36px, 30cqmin, 56px);\n --widget-icon-glyph: clamp(20px, 17cqmin, 32px);\n }\n .glasshome-widget-title { font-size: clamp(11px, 6cqmin, 14px); max-width: 100%; }\n .glasshome-widget-status,\n .glasshome-widget-value { font-size: clamp(13px, 7cqmin, 17px); }\n .glasshome-widget-content [class*=\"ml-auto\"] { margin-left: 0 !important; }\n}\n.glasshome-widget-content [class*=\"ml-auto\"] {\n position: relative;\n z-index: 30;\n}\n\n/* === Slot: icon === */\n.glasshome-widget-icon {\n width: var(--widget-icon-box);\n height: var(--widget-icon-box);\n border-radius: var(--radius-sm, 12px);\n background: var(--widget-icon-color, var(--widget-color));\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);\n color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);\n}\n.glasshome-widget-icon-glyph {\n font-size: var(--widget-icon-glyph);\n line-height: 1;\n}\n.glasshome-widget-icon-stack {\n position: absolute;\n width: 102%;\n height: 102%;\n border-radius: var(--radius-sm, 12px);\n}\n.glasshome-widget-icon-stack-2 { bottom: -14%; right: -10%; opacity: 0.45; z-index: -2; }\n.glasshome-widget-icon-stack-3 { bottom: -28%; right: -20%; opacity: 0.20; z-index: -3; }\n\n/* === Slot: text === */\n.glasshome-widget-title {\n font-size: var(--widget-title-size);\n line-height: 1.2;\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.glasshome-widget-subtitle {\n font-size: var(--widget-subtitle);\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n}\n.glasshome-widget-status {\n font-size: var(--widget-status-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.1;\n}\n.glasshome-widget-value {\n font-size: var(--widget-value-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.05;\n}\n.glasshome-widget-badge {\n font-size: var(--widget-badge-size);\n font-weight: 500;\n padding: 0.125rem 0.5rem;\n border-radius: 9999px;\n background: color-mix(in oklch, var(--color-foreground, currentColor) 20%, transparent);\n color: var(--color-foreground, currentColor);\n}\n\n.glasshome-widget-loading {\n background: color-mix(in oklch, var(--widget-color) 20%, transparent);\n}\n\n/* === Slider fill ===\n * Value flows in via --widget-fill-value (0-100). Vertical orientation auto-\n * detected via container query. */\n.glasshome-widget-slider-fill {\n --widget-fill-value: 0;\n background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);\n clip-path: inset(0 calc((100 - var(--widget-fill-value)) * 1%) 0 0);\n}\n@container widget (max-aspect-ratio: 1) {\n .glasshome-widget-slider-fill {\n clip-path: inset(calc((100 - var(--widget-fill-value)) * 1%) 0 0 0);\n }\n}\n", et = !1, B, tt = /* @__PURE__ */ new WeakSet();
88
+ function nt() {
89
+ return B || (B = new CSSStyleSheet(), B.replaceSync($e.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), B;
90
+ }
91
+ function rt(e) {
92
+ if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
93
+ if (tt.has(e)) return;
94
+ let t = nt();
95
+ e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), tt.add(e);
96
+ return;
97
+ }
98
+ if (et) return;
99
+ let t = e ?? (typeof document > "u" ? void 0 : document);
100
+ if (!t) return;
101
+ if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
102
+ et = !0;
103
+ return;
104
+ }
105
+ let n = t.createElement("style");
106
+ n.setAttribute("data-glasshome-tokens", ""), n.textContent = $e, t.head.appendChild(n), et = !0;
107
+ }
108
+ //#endregion
79
109
  //#region src/framework/utils/cn.ts
80
- function B(...e) {
81
- return Ce(Se(e));
110
+ function V(...e) {
111
+ return xe(be(e));
82
112
  }
83
- var et = {
113
+ var it = {
84
114
  "classic-glass": {
85
115
  id: "classic-glass",
86
116
  name: "Classic Glass",
@@ -162,22 +192,22 @@ var et = {
162
192
  }
163
193
  }
164
194
  };
165
- function tt(e) {
166
- return et[e];
195
+ function at(e) {
196
+ return it[e];
167
197
  }
168
198
  //#endregion
169
199
  //#region src/framework/backgrounds/WidgetSliderFill.tsx
170
- var nt = /*#__PURE__*/ L("<div>");
171
- function rt(e) {
200
+ var ot = /*#__PURE__*/ I("<div>");
201
+ function st(e) {
172
202
  return (() => {
173
- var t = nt();
203
+ var t = ot();
174
204
  return M((n) => {
175
- var r = B("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
205
+ var r = V("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
176
206
  "--widget-fill-value": e.value,
177
207
  "z-index": z.BACKGROUND,
178
208
  ...e.color ? { "--widget-icon-color": e.color } : {}
179
209
  };
180
- return r !== n.e && A(t, n.e = r), n.t = I(t, i, n.t), n;
210
+ return r !== n.e && A(t, n.e = r), n.t = ve(t, i, n.t), n;
181
211
  }, {
182
212
  e: void 0,
183
213
  t: void 0
@@ -186,37 +216,37 @@ function rt(e) {
186
216
  }
187
217
  //#endregion
188
218
  //#region src/framework/components/WidgetContent.tsx
189
- var it = /*#__PURE__*/ L("<div>");
190
- function at(e) {
219
+ var ct = /*#__PURE__*/ I("<div>");
220
+ function lt(e) {
191
221
  return (() => {
192
- var t = it();
193
- return N(t, () => e.children), M(() => A(t, B("glasshome-widget-content", e.class))), t;
222
+ var t = ct();
223
+ return N(t, () => e.children), M(() => A(t, V("glasshome-widget-content", e.class))), t;
194
224
  })();
195
225
  }
196
226
  //#endregion
197
227
  //#region src/framework/components/WidgetIcon.tsx
198
- var ot = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), st = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), ct = /*#__PURE__*/ L("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
199
- function lt(e) {
228
+ var ut = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), dt = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), ft = /*#__PURE__*/ I("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
229
+ function pt(e) {
200
230
  let t = () => e.entityCount ?? 1;
201
231
  return (() => {
202
- var n = ct(), r = n.firstChild;
232
+ var n = ft(), r = n.firstChild;
203
233
  return N(n, j(C, {
204
234
  get when() {
205
235
  return t() >= 2;
206
236
  },
207
237
  get children() {
208
- return ot();
238
+ return ut();
209
239
  }
210
240
  }), r), N(n, j(C, {
211
241
  get when() {
212
242
  return t() >= 3;
213
243
  },
214
244
  get children() {
215
- return st();
245
+ return dt();
216
246
  }
217
247
  }), r), N(r, () => e.icon), M((t) => {
218
- var r = B("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), i = e.color ? { "--widget-icon-color": e.color } : void 0;
219
- return r !== t.e && A(n, t.e = r), t.t = I(n, i, t.t), t;
248
+ var r = V("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), i = e.color ? { "--widget-icon-color": e.color } : void 0;
249
+ return r !== t.e && A(n, t.e = r), t.t = ve(n, i, t.t), t;
220
250
  }, {
221
251
  e: void 0,
222
252
  t: void 0
@@ -225,15 +255,15 @@ function lt(e) {
225
255
  }
226
256
  //#endregion
227
257
  //#region src/framework/components/WidgetStatus.tsx
228
- var ut = /*#__PURE__*/ L("<p>");
229
- function dt(e) {
258
+ var mt = /*#__PURE__*/ I("<p>");
259
+ function ht(e) {
230
260
  return (() => {
231
- var t = ut();
261
+ var t = mt();
232
262
  return N(t, (() => {
233
263
  var t = P(() => !!e.isUnavailable);
234
264
  return () => t() ? "Unavailable" : e.children;
235
265
  })()), M((n) => {
236
- var r = B("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = z.ACTIONS;
266
+ var r = V("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = z.ACTIONS;
237
267
  return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
238
268
  }, {
239
269
  e: void 0,
@@ -243,20 +273,20 @@ function dt(e) {
243
273
  }
244
274
  //#endregion
245
275
  //#region src/framework/components/WidgetTitle.tsx
246
- var ft = /*#__PURE__*/ L("<span class=\"glasshome-widget-badge shrink-0\">"), pt = /*#__PURE__*/ L("<div><h3 class=glasshome-widget-title>");
247
- function mt(e) {
276
+ var gt = /*#__PURE__*/ I("<span class=\"glasshome-widget-badge shrink-0\">"), _t = /*#__PURE__*/ I("<div><h3 class=glasshome-widget-title>");
277
+ function vt(e) {
248
278
  return (() => {
249
- var t = pt(), n = t.firstChild;
279
+ var t = _t(), n = t.firstChild;
250
280
  return N(n, () => e.children), N(t, j(C, {
251
281
  get when() {
252
282
  return P(() => e.badge !== void 0)() && e.badge > 0;
253
283
  },
254
284
  get children() {
255
- var t = ft();
285
+ var t = gt();
256
286
  return N(t, () => e.badge), t;
257
287
  }
258
288
  }), null), M((n) => {
259
- var r = B("relative flex items-center gap-2", e.class), i = z.ACTIONS;
289
+ var r = V("relative flex items-center gap-2", e.class), i = z.ACTIONS;
260
290
  return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
261
291
  }, {
262
292
  e: void 0,
@@ -266,7 +296,7 @@ function mt(e) {
266
296
  }
267
297
  //#endregion
268
298
  //#region src/framework/utils/entity-aggregation.ts
269
- function ht(e, t = !1) {
299
+ function yt(e, t = !1) {
270
300
  if (e.length === 0) return {
271
301
  isGroup: !1,
272
302
  state: "unknown",
@@ -289,7 +319,7 @@ function ht(e, t = !1) {
289
319
  isUnavailable: t.state === "unavailable",
290
320
  brightness: r,
291
321
  brightnessPercent: i,
292
- color: vt(t),
322
+ color: St(t),
293
323
  onCount: +!!n,
294
324
  totalCount: 1,
295
325
  description: n ? "On" : "Off"
@@ -301,7 +331,7 @@ function ht(e, t = !1) {
301
331
  if (r++, t.attributes?.brightness !== void 0 && (s += t.attributes.brightness, c++), t.attributes?.rgb_color) l.push(t.attributes.rgb_color);
302
332
  else if (t.attributes?.hs_color) {
303
333
  let [e, n] = t.attributes.hs_color;
304
- l.push(_t(e, n));
334
+ l.push(xt(e, n));
305
335
  }
306
336
  break;
307
337
  case "off":
@@ -318,7 +348,7 @@ function ht(e, t = !1) {
318
348
  if (l.length > 0) {
319
349
  let e = Math.round(l.reduce((e, t) => e + t[0], 0) / l.length), t = Math.round(l.reduce((e, t) => e + t[1], 0) / l.length), n = Math.round(l.reduce((e, t) => e + t[2], 0) / l.length), r = v / 255;
320
350
  y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
321
- } else y = vt(e[0]);
351
+ } else y = St(e[0]);
322
352
  let b;
323
353
  return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
324
354
  isGroup: n,
@@ -333,7 +363,7 @@ function ht(e, t = !1) {
333
363
  description: b
334
364
  };
335
365
  }
336
- function gt(e, t = "mean", n = !0) {
366
+ function bt(e, t = "mean", n = !0) {
337
367
  if (e.length === 0) return {
338
368
  isGroup: !1,
339
369
  state: "unknown",
@@ -429,7 +459,7 @@ function gt(e, t = "mean", n = !0) {
429
459
  memberValues: a
430
460
  };
431
461
  }
432
- function _t(e, t) {
462
+ function xt(e, t) {
433
463
  let n = t / 100, r = n * (1 - Math.abs(e / 60 % 2 - 1)), i = 1 - n, a = 0, o = 0, s = 0;
434
464
  return e < 60 ? [a, o] = [n, r] : e < 120 ? [a, o] = [r, n] : e < 180 ? [o, s] = [n, r] : e < 240 ? [o, s] = [r, n] : e < 300 ? [a, s] = [r, n] : [a, s] = [n, r], [
435
465
  (a + i) * 255,
@@ -437,7 +467,7 @@ function _t(e, t) {
437
467
  (s + i) * 255
438
468
  ];
439
469
  }
440
- function vt(e) {
470
+ function St(e) {
441
471
  if (e.state !== "on") return "rgb(100, 100, 100)";
442
472
  let t = (e.attributes?.brightness ?? 255) / 255;
443
473
  if (e.attributes?.rgb_color) {
@@ -445,7 +475,7 @@ function vt(e) {
445
475
  return `rgb(${Math.round(n * t)}, ${Math.round(r * t)}, ${Math.round(i * t)})`;
446
476
  }
447
477
  if (e.attributes?.hs_color) {
448
- let [n, r] = e.attributes.hs_color, [i, a, o] = _t(n, r);
478
+ let [n, r] = e.attributes.hs_color, [i, a, o] = xt(n, r);
449
479
  return `rgb(${Math.round(i * t)}, ${Math.round(a * t)}, ${Math.round(o * t)})`;
450
480
  }
451
481
  if (e.attributes?.color_temp) {
@@ -456,7 +486,7 @@ function vt(e) {
456
486
  }
457
487
  //#endregion
458
488
  //#region src/framework/utils/entity-state.ts
459
- function yt(e) {
489
+ function Ct(e) {
460
490
  if (!e) return !1;
461
491
  if ([
462
492
  "on",
@@ -472,15 +502,15 @@ function yt(e) {
472
502
  }
473
503
  return !1;
474
504
  }
475
- function bt(e, t, n) {
505
+ function wt(e, t, n) {
476
506
  return e?.attributes ? e.attributes[t] ?? n : n;
477
507
  }
478
- function xt(e) {
479
- return e.filter(yt).length;
508
+ function Tt(e) {
509
+ return e.filter(Ct).length;
480
510
  }
481
511
  //#endregion
482
512
  //#region src/framework/utils/format-value.ts
483
- function St(e, t, n) {
513
+ function Et(e, t, n) {
484
514
  let { decimals: r, scale: i = !0 } = n || {};
485
515
  if (typeof e == "string") return t ? `${e}${t}` : e;
486
516
  if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
@@ -491,41 +521,41 @@ function St(e, t, n) {
491
521
  }
492
522
  //#endregion
493
523
  //#region src/framework/utils/interpret-value.ts
494
- function Ct(e, t) {
524
+ function Dt(e, t) {
495
525
  return e == null || isNaN(e) ? null : t === "°C" ? e < 10 ? "Cold" : e < 18 ? "Cool" : e < 24 ? "Comfortable" : e < 28 ? "Warm" : "Hot" : t === "°F" ? e < 50 ? "Cold" : e < 64 ? "Cool" : e < 75 ? "Comfortable" : e < 82 ? "Warm" : "Hot" : t === "%" ? e < 20 ? "Very Low" : e < 40 ? "Low" : e < 60 ? "Medium" : e < 80 ? "High" : "Very High" : t === "ppm" ? e < 400 ? "Excellent" : e < 600 ? "Good" : e < 1e3 ? "Acceptable" : e < 1500 ? "Mediocre" : "Poor" : t === "lx" ? e < 50 ? "Dark" : e < 200 ? "Dim" : e < 500 ? "Moderate" : e < 1e3 ? "Bright" : "Very Bright" : t === "AQI" ? e <= 50 ? "Good" : e <= 100 ? "Moderate" : e <= 150 ? "Unhealthy for Sensitive" : e <= 200 ? "Unhealthy" : e <= 300 ? "Very Unhealthy" : "Hazardous" : t === "dB" ? e < 30 ? "Very Quiet" : e < 50 ? "Quiet" : e < 70 ? "Moderate" : e < 85 ? "Loud" : "Very Loud" : null;
496
526
  }
497
527
  //#endregion
498
528
  //#region src/framework/components/WidgetValue.tsx
499
- var wt = /*#__PURE__*/ L("<div class=glasshome-widget-subtitle>"), Tt = /*#__PURE__*/ L("<div><div class=glasshome-widget-value>");
500
- function Et(e) {
529
+ var Ot = /*#__PURE__*/ I("<div class=glasshome-widget-subtitle>"), kt = /*#__PURE__*/ I("<div><div class=glasshome-widget-value>");
530
+ function At(e) {
501
531
  return (() => {
502
- var t = Tt(), n = t.firstChild;
503
- return N(n, () => St(e.value, e.unit)), N(t, j(C, {
532
+ var t = kt(), n = t.firstChild;
533
+ return N(n, () => Et(e.value, e.unit)), N(t, j(C, {
504
534
  get when() {
505
535
  return P(() => !!e.interpret)() && typeof e.value == "number";
506
536
  },
507
537
  get children() {
508
- var t = wt();
509
- return N(t, () => Ct(e.value, e.unit)), t;
538
+ var t = Ot();
539
+ return N(t, () => Dt(e.value, e.unit)), t;
510
540
  }
511
- }), null), M(() => A(t, B("flex flex-col", e.class))), t;
541
+ }), null), M(() => A(t, V("flex flex-col", e.class))), t;
512
542
  })();
513
543
  }
514
544
  //#endregion
515
545
  //#region src/framework/core/Widget.tsx
516
- var Dt = /*#__PURE__*/ L("<div><div class=\"relative h-full w-full\">"), Ot = /*#__PURE__*/ L("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), kt = /*#__PURE__*/ L("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), At = /*#__PURE__*/ L("<div class=\"flex items-center justify-center text-white/30\">"), jt = /*#__PURE__*/ L("<h3 class=\"font-semibold text-sm text-white/60\">"), Mt = /*#__PURE__*/ L("<p class=\"text-white/50 text-xs\">");
517
- function Nt(t) {
518
- let i = O(e), [a, o] = E(), [s, c] = E({
546
+ var jt = /*#__PURE__*/ I("<div><div class=\"relative h-full w-full\">"), Mt = /*#__PURE__*/ I("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), Nt = /*#__PURE__*/ I("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), Pt = /*#__PURE__*/ I("<div class=\"flex items-center justify-center text-white/30\">"), Ft = /*#__PURE__*/ I("<h3 class=\"font-semibold text-sm text-white/60\">"), It = /*#__PURE__*/ I("<p class=\"text-white/50 text-xs\">");
547
+ function Lt(t) {
548
+ let n = O(L), [r, i] = E(), [a, o] = E({
519
549
  width: 0,
520
550
  height: 0
521
551
  });
522
552
  w(() => {
523
- let e = a();
553
+ let e = r();
524
554
  if (!e) return;
525
555
  let t = new ResizeObserver(([e]) => {
526
556
  if (!e) return;
527
557
  let t = e.borderBoxSize?.[0];
528
- c(t ? {
558
+ o(t ? {
529
559
  width: t.inlineSize,
530
560
  height: t.blockSize
531
561
  } : {
@@ -534,50 +564,50 @@ function Nt(t) {
534
564
  });
535
565
  });
536
566
  t.observe(e), D(() => t.disconnect());
537
- }), _e(() => {
538
- let e = a()?.getRootNode();
539
- n(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
567
+ }), me(() => {
568
+ let e = r()?.getRootNode();
569
+ rt(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
540
570
  });
541
- let l = {
542
- updateConfig: i?.updateConfig ?? (() => {}),
543
- registerDialogOpener: i?.registerDialogOpener,
544
- callService: i?.callService,
545
- dimensions: r(() => s(), "ctx.dimensions")
546
- }, u = T(() => {
547
- if (t.variant) return typeof t.variant == "string" ? tt(t.variant) : t.variant;
548
- }), d = T(() => ({
571
+ let s = {
572
+ updateConfig: n?.updateConfig ?? (() => {}),
573
+ registerDialogOpener: n?.registerDialogOpener,
574
+ callService: n?.callService,
575
+ dimensions: e(() => a(), "ctx.dimensions")
576
+ }, c = T(() => {
577
+ if (t.variant) return typeof t.variant == "string" ? at(t.variant) : t.variant;
578
+ }), l = T(() => ({
549
579
  "container-type": "size",
550
580
  "container-name": "widget",
551
581
  "touch-action": t.gestures && !t.isEditMode ? t.gestures.touchAction() : void 0,
552
- ...u()?.styles?.container,
553
- ...u()?.styles?.cssVars || {},
582
+ ...c()?.styles?.container,
583
+ ...c()?.styles?.cssVars || {},
554
584
  ...t.tone ? { "--widget-color": `var(--tone-${t.tone})` } : {},
555
585
  ...t.color ? { "--widget-color": t.color } : {},
556
586
  ...t.colorTo ? { "--widget-color-to": t.colorTo } : {},
557
587
  ...t.gradient ? { "--widget-gradient": t.gradient } : {}
558
- })), f = () => !!t.gestures && !t.isEditMode, p = (e) => {
559
- f() && t.gestures?.onPointerEnter(e);
588
+ })), u = () => !!t.gestures && !t.isEditMode, d = (e) => {
589
+ u() && t.gestures?.onPointerEnter(e);
590
+ }, f = (e) => {
591
+ u() && t.gestures?.onPointerDown(e);
592
+ }, p = (e) => {
593
+ u() && t.gestures?.onPointerMove(e);
560
594
  }, m = (e) => {
561
- f() && t.gestures?.onPointerDown(e);
595
+ u() && t.gestures?.onPointerUp(e);
562
596
  }, h = (e) => {
563
- f() && t.gestures?.onPointerMove(e);
564
- }, g = (e) => {
565
- f() && t.gestures?.onPointerUp(e);
566
- }, _ = (e) => {
567
- f() && t.gestures?.onPointerCancel(e);
597
+ u() && t.gestures?.onPointerCancel(e);
568
598
  };
569
- return j(e.Provider, {
570
- value: l,
599
+ return j(L.Provider, {
600
+ value: s,
571
601
  get children() {
572
- return j(Qe.Provider, {
573
- value: s,
602
+ return j(Ze.Provider, {
603
+ value: a,
574
604
  get children() {
575
- var e = Dt(), n = e.firstChild;
576
- return k(e, "pointercancel", _), k(e, "pointerup", g), k(e, "pointermove", h), k(e, "pointerdown", m), k(e, "pointerenter", p), xe((e) => {
577
- o(e), t.gestures?.bindElement(e);
605
+ var e = jt(), n = e.firstChild;
606
+ return k(e, "pointercancel", h), k(e, "pointerup", m), k(e, "pointermove", p), k(e, "pointerdown", f), k(e, "pointerenter", d), ye((e) => {
607
+ i(e), t.gestures?.bindElement(e);
578
608
  }, e), N(n, (() => {
579
609
  var e = P(() => !!t.emptyState);
580
- return () => e() ? j(Pt, {
610
+ return () => e() ? j(Rt, {
581
611
  get icon() {
582
612
  return t.emptyState.icon;
583
613
  },
@@ -591,12 +621,12 @@ function Nt(t) {
591
621
  })()), N(e, (() => {
592
622
  var e = P(() => !!t.loading);
593
623
  return () => e() && (() => {
594
- var e = Ot();
624
+ var e = Mt();
595
625
  return M((t) => F(e, "z-index", z.OVERLAY)), e;
596
626
  })();
597
627
  })(), null), M((r) => {
598
- var i = B("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", u()?.styles?.class, t.class), a = d(), o = z.CONTENT;
599
- return i !== r.e && A(e, r.e = i), r.t = I(e, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
628
+ var i = V("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", c()?.styles?.class, t.class), a = l(), o = z.CONTENT;
629
+ return i !== r.e && A(e, r.e = i), r.t = ve(e, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
600
630
  }, {
601
631
  e: void 0,
602
632
  t: void 0,
@@ -607,76 +637,76 @@ function Nt(t) {
607
637
  }
608
638
  });
609
639
  }
610
- function Pt(e) {
640
+ function Rt(e) {
611
641
  return (() => {
612
- var t = kt();
642
+ var t = Nt();
613
643
  return N(t, (() => {
614
644
  var t = P(() => !!e.icon);
615
645
  return () => t() && (() => {
616
- var t = At();
646
+ var t = Pt();
617
647
  return N(t, () => e.icon), t;
618
648
  })();
619
649
  })(), null), N(t, (() => {
620
650
  var t = P(() => !!e.title);
621
651
  return () => t() && (() => {
622
- var t = jt();
652
+ var t = Ft();
623
653
  return N(t, () => e.title), t;
624
654
  })();
625
655
  })(), null), N(t, (() => {
626
656
  var t = P(() => !!e.message);
627
657
  return () => t() && (() => {
628
- var t = Mt();
658
+ var t = It();
629
659
  return N(t, () => e.message), t;
630
660
  })();
631
661
  })(), null), t;
632
662
  })();
633
663
  }
634
- var V = Nt;
635
- V.Content = at, V.Icon = lt, V.Title = mt, V.Status = dt, V.Value = Et, V.SliderFill = rt;
664
+ var H = Lt;
665
+ H.Content = lt, H.Icon = pt, H.Title = vt, H.Status = ht, H.Value = At, H.SliderFill = st;
636
666
  //#endregion
637
667
  //#region src/framework/dialogs/validate-config.ts
638
- function Ft(e) {
668
+ function zt(e) {
639
669
  let t = "";
640
670
  for (let n of e) t += typeof n == "number" ? `[${n}]` : t ? `.${String(n)}` : String(n);
641
671
  return t;
642
672
  }
643
- function It(e, t) {
673
+ function Bt(e, t) {
644
674
  let n = e.safeParse(t);
645
675
  return n.success ? null : n.error.issues.map((e) => {
646
- let t = Ft(e.path);
676
+ let t = zt(e.path);
647
677
  return t ? `${t}: ${e.message}` : e.message;
648
678
  });
649
679
  }
650
680
  //#endregion
651
681
  //#region src/framework/dialogs/WidgetDialog.tsx
652
- var Lt = /*#__PURE__*/ L("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), Rt = /*#__PURE__*/ L("<button type=button>"), zt = /*#__PURE__*/ L("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"></path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\">"), Bt = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No edit options available"), Vt = /*#__PURE__*/ L("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>"), Ht = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), Ut = /*#__PURE__*/ L("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"m8 2 1.88 1.88\"></path><path d=\"M14.12 3.88 16 2\"></path><path d=\"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1\"></path><path d=\"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6\"></path><path d=\"M12 20v-9\"></path><path d=\"M6.53 9C4.6 8.8 3 7.1 3 5\"></path><path d=\"M6 13H2\"></path><path d=\"M3 21c0-2.1 1.7-3.9 3.8-4\"></path><path d=\"M20.97 5c0 2.1-1.6 3.8-3.5 4\"></path><path d=\"M22 13h-4\"></path><path d=\"M17.2 17c2.1.1 3.8 1.9 3.8 4\">"), Wt = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No debug information available"), Gt = /*#__PURE__*/ L("<div class=\"min-w-0 shrink-0\">"), Kt = /*#__PURE__*/ L("<div class=\"flex items-center gap-2\"><div class=\"flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5\">"), qt = /*#__PURE__*/ L("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), Jt = /*#__PURE__*/ L("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
653
- function Yt(e) {
682
+ var Vt = /*#__PURE__*/ I("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), Ht = /*#__PURE__*/ I("<button type=button>"), Ut = /*#__PURE__*/ I("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"></path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\">"), Wt = /*#__PURE__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No edit options available"), Gt = /*#__PURE__*/ I("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>"), Kt = /*#__PURE__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), qt = /*#__PURE__*/ I("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"m8 2 1.88 1.88\"></path><path d=\"M14.12 3.88 16 2\"></path><path d=\"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1\"></path><path d=\"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6\"></path><path d=\"M12 20v-9\"></path><path d=\"M6.53 9C4.6 8.8 3 7.1 3 5\"></path><path d=\"M6 13H2\"></path><path d=\"M3 21c0-2.1 1.7-3.9 3.8-4\"></path><path d=\"M20.97 5c0 2.1-1.6 3.8-3.5 4\"></path><path d=\"M22 13h-4\"></path><path d=\"M17.2 17c2.1.1 3.8 1.9 3.8 4\">"), Jt = /*#__PURE__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No debug information available"), Yt = /*#__PURE__*/ I("<div class=\"min-w-0 shrink-0\">"), Xt = /*#__PURE__*/ I("<div class=\"flex items-center gap-2\"><div class=\"flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5\">"), Zt = /*#__PURE__*/ I("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), Qt = /*#__PURE__*/ I("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
683
+ function $t(e) {
654
684
  return (() => {
655
- var t = Rt();
685
+ var t = Ht();
656
686
  return t.$$click = () => e.onClick(), N(t, j(C, {
657
687
  get when() {
658
688
  return e.isActive;
659
689
  },
660
690
  get children() {
661
- var t = Lt();
691
+ var t = Vt();
662
692
  return N(t, () => e.icon), t;
663
693
  }
664
- }), null), N(t, () => e.label, null), M(() => A(t, B("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
694
+ }), null), N(t, () => e.label, null), M(() => A(t, V("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
665
695
  })();
666
696
  }
667
- function Xt(e) {
668
- let [t] = ve(e, /* @__PURE__ */ "open.onOpenChange.title.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.Button.SchemaForm".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = E({}), [a, o] = E(null), [s, c] = E([]);
669
- w(ge(() => t.config, (e) => {
697
+ function en(e) {
698
+ let [t] = he(e, /* @__PURE__ */ "open.onOpenChange.title.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.Button.SchemaForm".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = E({}), [a, o] = E(null), [s, c] = E([]);
699
+ w(pe(() => t.config, (e) => {
670
700
  e && i({ ...e });
671
- })), w(ge(() => t.configSchema, (e) => {
672
- e && o(We(e));
701
+ })), w(pe(() => t.configSchema, (e) => {
702
+ e && o(He(e));
673
703
  }));
674
704
  let l = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), u = (e) => {
675
705
  !e && t.config && (i({ ...t.config }), c([])), t.onOpenChange(e);
676
706
  }, d = () => {
677
707
  let e = t.configSchema;
678
708
  if (e) {
679
- let t = It(e, r());
709
+ let t = Bt(e, r());
680
710
  if (t) {
681
711
  c(t);
682
712
  return;
@@ -699,30 +729,30 @@ function Xt(e) {
699
729
  return e.push({
700
730
  id: "edit",
701
731
  label: "Edit",
702
- icon: zt(),
732
+ icon: Ut(),
703
733
  content: t.editContent ?? (() => {
704
734
  let e = n() ? a() : void 0;
705
735
  return e ? j(ie, {
706
736
  schema: e,
707
737
  get data() {
708
- return ye(r);
738
+ return ge(r);
709
739
  },
710
740
  onChange: i,
711
741
  get errors() {
712
742
  return s();
713
743
  }
714
- }) : Bt();
744
+ }) : Wt();
715
745
  })()
716
746
  }), e.push({
717
747
  id: "controls",
718
748
  label: "Controls",
719
- icon: Vt(),
720
- content: t.controlsContent ?? Ht()
749
+ icon: Gt(),
750
+ content: t.controlsContent ?? Kt()
721
751
  }), e.push({
722
752
  id: "debug",
723
753
  label: "Debug",
724
- icon: Ut(),
725
- content: t.debugContent ?? Wt()
754
+ icon: qt(),
755
+ content: t.debugContent ?? Jt()
726
756
  }), e;
727
757
  }, v = async () => {
728
758
  if (t.debugData !== void 0) try {
@@ -732,7 +762,7 @@ function Xt(e) {
732
762
  }, ee = () => {
733
763
  let e = ae();
734
764
  return e.find((e) => e.id === m())?.content ?? e[0]?.content;
735
- }, y = t.ResponsiveDialog, b = t.ResponsiveDialogContent, te = t.ResponsiveDialogHeader, ne = t.ResponsiveDialogTitle, re = t.ResponsiveDialogDescription, x = t.Button, ie = t.SchemaForm, ae = T(ge([
765
+ }, y = t.ResponsiveDialog, b = t.ResponsiveDialogContent, te = t.ResponsiveDialogHeader, ne = t.ResponsiveDialogTitle, re = t.ResponsiveDialogDescription, x = t.Button, ie = t.SchemaForm, ae = T(pe([
736
766
  () => t.open,
737
767
  a,
738
768
  () => t.config,
@@ -746,7 +776,7 @@ function Xt(e) {
746
776
  get children() {
747
777
  return j(b, {
748
778
  get class() {
749
- return B(g(), "px-0", t.class);
779
+ return V(g(), "px-0", t.class);
750
780
  },
751
781
  get children() {
752
782
  return [
@@ -754,7 +784,7 @@ function Xt(e) {
754
784
  class: "flex flex-row items-center justify-between gap-3 px-6",
755
785
  get children() {
756
786
  return [(() => {
757
- var e = Gt();
787
+ var e = Yt();
758
788
  return N(e, j(ne, {
759
789
  class: "truncate leading-tight",
760
790
  get children() {
@@ -765,8 +795,8 @@ function Xt(e) {
765
795
  children: "Widget configuration dialog"
766
796
  }), null), e;
767
797
  })(), (() => {
768
- var e = Kt(), n = e.firstChild;
769
- return N(n, () => ae().map((e) => j(Yt, {
798
+ var e = Xt(), n = e.firstChild;
799
+ return N(n, () => ae().map((e) => j($t, {
770
800
  get icon() {
771
801
  return e.icon;
772
802
  },
@@ -789,7 +819,7 @@ function Xt(e) {
789
819
  }
790
820
  }),
791
821
  (() => {
792
- var e = qt();
822
+ var e = Zt();
793
823
  return N(e, ee), e;
794
824
  })(),
795
825
  j(C, {
@@ -797,7 +827,7 @@ function Xt(e) {
797
827
  return P(() => m() === "edit")() && (S() || t.onDelete) || m() === "debug" && t.debugData !== void 0;
798
828
  },
799
829
  get children() {
800
- var e = Jt();
830
+ var e = Qt();
801
831
  return N(e, j(C, {
802
832
  get when() {
803
833
  return P(() => m() === "edit")() && t.onDelete;
@@ -845,10 +875,10 @@ function Xt(e) {
845
875
  }
846
876
  });
847
877
  }
848
- be(["click"]);
878
+ _e(["click"]);
849
879
  //#endregion
850
880
  //#region src/framework/hooks/use-intersection-pause.ts
851
- function Zt(e) {
881
+ function tn(e) {
852
882
  if (typeof IntersectionObserver > "u") return () => !1;
853
883
  let [t, n] = E(!1), r = new IntersectionObserver((e) => {
854
884
  let t = e[0];
@@ -861,46 +891,46 @@ function Zt(e) {
861
891
  }
862
892
  //#endregion
863
893
  //#region src/framework/hooks/use-reduced-motion.ts
864
- function Qt() {
894
+ function nn() {
865
895
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
866
896
  let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = E(e.matches), r = (e) => n(e.matches);
867
897
  return e.addEventListener("change", r), D(() => e.removeEventListener("change", r)), t;
868
898
  }
869
899
  //#endregion
870
900
  //#region src/framework/hooks/use-widget-dialog.ts
871
- function $t(t = "controls") {
872
- let [n, r] = E(!1), [i, a] = E(t), o = (e) => {
873
- a(e ?? t), r(!0);
874
- }, s = O(e);
875
- return s?.registerDialogOpener?.(o), D(() => s?.registerDialogOpener?.(null)), {
876
- showDialog: n,
877
- setShowDialog: r,
878
- openDialog: o,
879
- closeDialog: () => r(!1),
880
- activeTab: i,
881
- setActiveTab: a,
901
+ function rn(e = "controls") {
902
+ let [t, n] = E(!1), [r, i] = E(e), a = (t) => {
903
+ i(t ?? e), n(!0);
904
+ }, o = O(L);
905
+ return o?.registerDialogOpener?.(a), D(() => o?.registerDialogOpener?.(null)), {
906
+ showDialog: t,
907
+ setShowDialog: n,
908
+ openDialog: a,
909
+ closeDialog: () => n(!1),
910
+ activeTab: r,
911
+ setActiveTab: i,
882
912
  dialogProps: {
883
913
  get open() {
884
- return n();
914
+ return t();
885
915
  },
886
- onOpenChange: r,
916
+ onOpenChange: n,
887
917
  get activeTab() {
888
- return i();
918
+ return r();
889
919
  },
890
- onActiveTabChange: a
920
+ onActiveTabChange: i
891
921
  }
892
922
  };
893
923
  }
894
924
  //#endregion
895
925
  //#region src/framework/hooks/use-widget-entity-group.ts
896
- function en(e) {
926
+ function an(e) {
897
927
  let t = e.minEntities ?? 1, n = T(() => e.entities().length), r = T(() => n() >= t), i = T(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = T(() => {
898
928
  if (!r()) return;
899
929
  let t = e.aggregationMode?.();
900
930
  if (!t || t === "none") return;
901
931
  let n = e.entities();
902
- if (t === "light" || t === "binary-sensor" || t === "switch") return ht(n, e.allEntitiesMode);
903
- if (t === "sensor") return gt(n, e.sensorGroupType?.() ?? "mean", !0);
932
+ if (t === "light" || t === "binary-sensor" || t === "switch") return yt(n, e.allEntitiesMode);
933
+ if (t === "sensor") return bt(n, e.sensorGroupType?.() ?? "mean", !0);
904
934
  }), o = T(() => r() ? void 0 : e.emptyStateConfig);
905
935
  return {
906
936
  entities: e.entities,
@@ -913,142 +943,142 @@ function en(e) {
913
943
  }
914
944
  //#endregion
915
945
  //#region src/framework/gestures/cursors.ts
916
- var H = 32, U = H / 2, W = "white", G = "rgba(0,0,0,0.4)", K = 2, q = 3;
917
- function tn(e) {
946
+ var U = 32, W = U / 2, G = "white", K = "rgba(0,0,0,0.4)", q = 2, J = 3;
947
+ function on(e) {
918
948
  return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
919
949
  }
920
- function J(e) {
921
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${H}" height="${H}" viewBox="0 0 ${H} ${H}">${e}</svg>`;
950
+ function Y(e) {
951
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${U}" height="${U}" viewBox="0 0 ${U} ${U}">${e}</svg>`;
922
952
  }
923
- var nn = J(`
953
+ var sn = Y(`
924
954
  <g transform="translate(6, 2)">
925
955
  <!-- shadow -->
926
- <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
956
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
927
957
  <path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
928
958
  </g>
929
959
  <!-- main -->
930
- <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
960
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
931
961
  <path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
932
962
  </g>
933
963
  </g>
934
- `), rn = J(`
964
+ `), cn = Y(`
935
965
  <g>
936
- <circle cx="${U}" cy="${U}" r="8" stroke="${G}" stroke-width="${q}" fill="none"/>
937
- <circle cx="${U}" cy="${U}" r="8" stroke="${W}" stroke-width="1.5" fill="none"/>
938
- <circle cx="${U}" cy="${U}" r="1.5" fill="${W}"/>
966
+ <circle cx="${W}" cy="${W}" r="8" stroke="${K}" stroke-width="${J}" fill="none"/>
967
+ <circle cx="${W}" cy="${W}" r="8" stroke="${G}" stroke-width="1.5" fill="none"/>
968
+ <circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
939
969
  </g>
940
- `), an = J(`
970
+ `), ln = Y(`
941
971
  <g>
942
972
  <!-- shadow -->
943
- <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
944
- <line x1="6" y1="${U}" x2="26" y2="${U}"/>
945
- <polyline points="10,12 6,${U} 10,20"/>
946
- <polyline points="22,12 26,${U} 22,20"/>
973
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
974
+ <line x1="6" y1="${W}" x2="26" y2="${W}"/>
975
+ <polyline points="10,12 6,${W} 10,20"/>
976
+ <polyline points="22,12 26,${W} 22,20"/>
947
977
  </g>
948
978
  <!-- main -->
949
- <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
950
- <line x1="6" y1="${U}" x2="26" y2="${U}"/>
951
- <polyline points="10,12 6,${U} 10,20"/>
952
- <polyline points="22,12 26,${U} 22,20"/>
979
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
980
+ <line x1="6" y1="${W}" x2="26" y2="${W}"/>
981
+ <polyline points="10,12 6,${W} 10,20"/>
982
+ <polyline points="22,12 26,${W} 22,20"/>
953
983
  </g>
954
984
  <!-- center grip dots -->
955
- <circle cx="${U}" cy="${U}" r="1.5" fill="${W}"/>
956
- <circle cx="11" cy="${U}" r="1" fill="${W}" opacity="0.6"/>
957
- <circle cx="21" cy="${U}" r="1" fill="${W}" opacity="0.6"/>
985
+ <circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
986
+ <circle cx="11" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
987
+ <circle cx="21" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
958
988
  </g>
959
- `), on = J(`
989
+ `), un = Y(`
960
990
  <g>
961
991
  <!-- shadow -->
962
- <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
963
- <line x1="${U}" y1="6" x2="${U}" y2="26"/>
964
- <polyline points="12,10 ${U},6 20,10"/>
965
- <polyline points="12,22 ${U},26 20,22"/>
992
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
993
+ <line x1="${W}" y1="6" x2="${W}" y2="26"/>
994
+ <polyline points="12,10 ${W},6 20,10"/>
995
+ <polyline points="12,22 ${W},26 20,22"/>
966
996
  </g>
967
997
  <!-- main -->
968
- <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
969
- <line x1="${U}" y1="6" x2="${U}" y2="26"/>
970
- <polyline points="12,10 ${U},6 20,10"/>
971
- <polyline points="12,22 ${U},26 20,22"/>
998
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
999
+ <line x1="${W}" y1="6" x2="${W}" y2="26"/>
1000
+ <polyline points="12,10 ${W},6 20,10"/>
1001
+ <polyline points="12,22 ${W},26 20,22"/>
972
1002
  </g>
973
1003
  <!-- center grip dots -->
974
- <circle cx="${U}" cy="${U}" r="1.5" fill="${W}"/>
975
- <circle cx="${U}" cy="11" r="1" fill="${W}" opacity="0.6"/>
976
- <circle cx="${U}" cy="21" r="1" fill="${W}" opacity="0.6"/>
1004
+ <circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
1005
+ <circle cx="${W}" cy="11" r="1" fill="${G}" opacity="0.6"/>
1006
+ <circle cx="${W}" cy="21" r="1" fill="${G}" opacity="0.6"/>
977
1007
  </g>
978
- `), sn = J(`
1008
+ `), dn = Y(`
979
1009
  <g>
980
1010
  <!-- shadow -->
981
- <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
982
- <line x1="7" y1="${U}" x2="25" y2="${U}"/>
983
- <line x1="${U}" y1="7" x2="${U}" y2="25"/>
984
- <polyline points="11,13 7,${U} 11,19"/>
985
- <polyline points="21,13 25,${U} 21,19"/>
986
- <polyline points="13,11 ${U},7 19,11"/>
987
- <polyline points="13,21 ${U},25 19,21"/>
1011
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1012
+ <line x1="7" y1="${W}" x2="25" y2="${W}"/>
1013
+ <line x1="${W}" y1="7" x2="${W}" y2="25"/>
1014
+ <polyline points="11,13 7,${W} 11,19"/>
1015
+ <polyline points="21,13 25,${W} 21,19"/>
1016
+ <polyline points="13,11 ${W},7 19,11"/>
1017
+ <polyline points="13,21 ${W},25 19,21"/>
988
1018
  </g>
989
1019
  <!-- main -->
990
- <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
991
- <line x1="7" y1="${U}" x2="25" y2="${U}"/>
992
- <line x1="${U}" y1="7" x2="${U}" y2="25"/>
993
- <polyline points="11,13 7,${U} 11,19"/>
994
- <polyline points="21,13 25,${U} 21,19"/>
995
- <polyline points="13,11 ${U},7 19,11"/>
996
- <polyline points="13,21 ${U},25 19,21"/>
1020
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1021
+ <line x1="7" y1="${W}" x2="25" y2="${W}"/>
1022
+ <line x1="${W}" y1="7" x2="${W}" y2="25"/>
1023
+ <polyline points="11,13 7,${W} 11,19"/>
1024
+ <polyline points="21,13 25,${W} 21,19"/>
1025
+ <polyline points="13,11 ${W},7 19,11"/>
1026
+ <polyline points="13,21 ${W},25 19,21"/>
997
1027
  </g>
998
1028
  <!-- center dot -->
999
- <circle cx="${U}" cy="${U}" r="2" fill="${W}"/>
1029
+ <circle cx="${W}" cy="${W}" r="2" fill="${G}"/>
1000
1030
  </g>
1001
1031
  `);
1002
- function Y(e, t, n) {
1032
+ function X(e, t, n) {
1003
1033
  return {
1004
- css: `${tn(e)} ${t} ${n}, auto`,
1034
+ css: `${on(e)} ${t} ${n}, auto`,
1005
1035
  hotspotX: t,
1006
1036
  hotspotY: n
1007
1037
  };
1008
1038
  }
1009
- var X = {
1010
- tap: Y(nn, 12, 4),
1011
- hold: Y(rn, 16, 16),
1012
- slideHorizontal: Y(an, U, U),
1013
- slideVertical: Y(on, U, U),
1014
- slideAuto: Y(sn, U, U)
1039
+ var Z = {
1040
+ tap: X(sn, 12, 4),
1041
+ hold: X(cn, 16, 16),
1042
+ slideHorizontal: X(ln, W, W),
1043
+ slideVertical: X(un, W, W),
1044
+ slideAuto: X(dn, W, W)
1015
1045
  };
1016
1046
  //#endregion
1017
1047
  //#region src/framework/gestures/haptics.ts
1018
- function cn() {
1048
+ function fn() {
1019
1049
  if (typeof window > "u") return null;
1020
1050
  let e = window;
1021
1051
  return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
1022
1052
  }
1023
- function ln(e) {
1053
+ function pn(e) {
1024
1054
  if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
1025
1055
  navigator.vibrate(e);
1026
1056
  } catch {}
1027
1057
  }
1028
- var un = {
1058
+ var mn = {
1029
1059
  tick() {
1030
- let e = cn();
1060
+ let e = fn();
1031
1061
  if (e) {
1032
1062
  e.impact({ style: "Light" }).catch(() => {});
1033
1063
  return;
1034
1064
  }
1035
- ln(8);
1065
+ pn(8);
1036
1066
  },
1037
1067
  bump() {
1038
- let e = cn();
1068
+ let e = fn();
1039
1069
  if (e) {
1040
1070
  e.impact({ style: "Medium" }).catch(() => {});
1041
1071
  return;
1042
1072
  }
1043
- ln(20);
1073
+ pn(20);
1044
1074
  },
1045
1075
  pulse() {
1046
- let e = cn();
1076
+ let e = fn();
1047
1077
  if (e) {
1048
1078
  e.impact({ style: "Heavy" }).catch(() => {});
1049
1079
  return;
1050
1080
  }
1051
- ln([
1081
+ pn([
1052
1082
  0,
1053
1083
  15,
1054
1084
  40,
@@ -1058,7 +1088,7 @@ var un = {
1058
1088
  };
1059
1089
  //#endregion
1060
1090
  //#region src/framework/gestures/use-widget-gestures.ts
1061
- function dn(e, t) {
1091
+ function hn(e, t) {
1062
1092
  let n = {
1063
1093
  isDown: !1,
1064
1094
  isTouch: !1,
@@ -1101,7 +1131,7 @@ function dn(e, t) {
1101
1131
  if (n.isDown = !0, n.isTouch = t.pointerType === "touch", n.element = t.currentTarget, c(n.element), n.startX = t.clientX, n.startY = t.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, r.hold) {
1102
1132
  let e = r.hold.delay ?? 300;
1103
1133
  n.holdTimer = setTimeout(() => {
1104
- n.holdTimer = null, !(!n.isDown || n.hasMoved) && (un.bump(), r.hold?.action(), n.isDown = !1);
1134
+ n.holdTimer = null, !(!n.isDown || n.hasMoved) && (mn.bump(), r.hold?.action(), n.isDown = !1);
1105
1135
  }, e);
1106
1136
  }
1107
1137
  if (!n.isTouch && r.slide) try {
@@ -1138,9 +1168,9 @@ function dn(e, t) {
1138
1168
  let n = e();
1139
1169
  if (n.slide) {
1140
1170
  let e = n.slide.orientation;
1141
- return e === "horizontal" ? X.slideHorizontal.css : e === "vertical" ? X.slideVertical.css : (r || c(t), r && r.height > r.width ? X.slideVertical.css : X.slideHorizontal.css);
1171
+ return e === "horizontal" ? Z.slideHorizontal.css : e === "vertical" ? Z.slideVertical.css : (r || c(t), r && r.height > r.width ? Z.slideVertical.css : Z.slideHorizontal.css);
1142
1172
  }
1143
- return n.tap ? X.tap.css : n.hold ? X.hold.css : "";
1173
+ return n.tap ? Z.tap.css : n.hold ? Z.hold.css : "";
1144
1174
  };
1145
1175
  return {
1146
1176
  onPointerDown: f,
@@ -1169,7 +1199,7 @@ function dn(e, t) {
1169
1199
  }
1170
1200
  //#endregion
1171
1201
  //#region src/framework/theming/svg-colors.ts
1172
- var fn = {
1202
+ var gn = {
1173
1203
  solar: "oklch(0.74 0.18 60)",
1174
1204
  grid: "oklch(0.62 0.12 245)",
1175
1205
  battery: "oklch(0.70 0.18 145)",
@@ -1178,88 +1208,88 @@ var fn = {
1178
1208
  positive: "oklch(0.70 0.14 160)",
1179
1209
  negative: "oklch(0.64 0.22 27)"
1180
1210
  };
1181
- function pn(e) {
1211
+ function _n(e) {
1182
1212
  return {
1183
1213
  fill: `color-mix(in oklch, ${e} 20%, transparent)`,
1184
1214
  stroke: e,
1185
1215
  solid: e
1186
1216
  };
1187
1217
  }
1188
- var mn = Object.fromEntries(Object.entries(fn).map(([e, t]) => [e, pn(t)])), hn = l.enum([
1218
+ var vn = Object.fromEntries(Object.entries(gn).map(([e, t]) => [e, _n(t)])), yn = o.enum([
1189
1219
  "success",
1190
1220
  "warning",
1191
1221
  "danger",
1192
1222
  "info",
1193
1223
  "neutral",
1194
1224
  "accent"
1195
- ]), gn = {
1196
- title: r(() => l.string().optional().meta({
1225
+ ]), bn = {
1226
+ title: e(() => o.string().optional().meta({
1197
1227
  title: "Title",
1198
1228
  description: "Optional display name override"
1199
1229
  }), "widgetFields.title"),
1200
- entityIds: r((e, t) => l.array(l.string()).default([]).meta({
1230
+ entityIds: e((e, t) => o.array(o.string()).default([]).meta({
1201
1231
  domain: e,
1202
1232
  title: "Entities",
1203
1233
  ...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
1204
1234
  }), "widgetFields.entityIds"),
1205
- singleEntity: r((e, t) => l.array(l.string()).default([]).meta({
1235
+ singleEntity: e((e, t) => o.array(o.string()).default([]).meta({
1206
1236
  domain: e,
1207
1237
  title: "Entity",
1208
1238
  singleSelect: !0,
1209
1239
  ...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
1210
1240
  }), "widgetFields.singleEntity"),
1211
- areaId: r(() => l.string().optional().meta({
1241
+ areaId: e(() => o.string().optional().meta({
1212
1242
  formType: "area-picker",
1213
1243
  title: "Area"
1214
1244
  }), "widgetFields.areaId")
1215
- }, _n = 24;
1216
- function Z(e) {
1245
+ }, xn = 24;
1246
+ function Q(e) {
1217
1247
  let t = {};
1218
1248
  for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
1219
1249
  return t;
1220
1250
  }
1221
- function vn() {
1222
- return l.string().optional().meta({
1251
+ function Sn() {
1252
+ return o.string().optional().meta({
1223
1253
  title: "Title",
1224
1254
  description: "Optional display name override"
1225
1255
  });
1226
1256
  }
1227
- function yn(e) {
1228
- return (e.default === void 0 ? l.string().optional() : l.string().default(e.default)).meta(Z({
1257
+ function Cn(e) {
1258
+ return (e.default === void 0 ? o.string().optional() : o.string().default(e.default)).meta(Q({
1229
1259
  title: e.title,
1230
1260
  description: e.description
1231
1261
  }));
1232
1262
  }
1233
- function bn(e) {
1234
- let t = l.number();
1235
- return e.min !== void 0 && (t = t.min(e.min)), e.max !== void 0 && (t = t.max(e.max)), (e.default === void 0 ? t.optional() : t.default(e.default)).meta(Z({
1263
+ function wn(e) {
1264
+ let t = o.number();
1265
+ return e.min !== void 0 && (t = t.min(e.min)), e.max !== void 0 && (t = t.max(e.max)), (e.default === void 0 ? t.optional() : t.default(e.default)).meta(Q({
1236
1266
  title: e.title,
1237
1267
  description: e.description
1238
1268
  }));
1239
1269
  }
1240
- function xn(e) {
1241
- return l.boolean().default(e.default ?? !1).meta(Z({
1270
+ function Tn(e) {
1271
+ return o.boolean().default(e.default ?? !1).meta(Q({
1242
1272
  title: e.title,
1243
1273
  description: e.description
1244
1274
  }));
1245
1275
  }
1246
- function Sn(e, t) {
1247
- let n = l.enum(e);
1248
- return (t.default === void 0 ? n.optional() : n.default(t.default)).meta(Z({
1276
+ function En(e, t) {
1277
+ let n = o.enum(e);
1278
+ return (t.default === void 0 ? n.optional() : n.default(t.default)).meta(Q({
1249
1279
  title: t.title,
1250
1280
  description: t.description
1251
1281
  }));
1252
1282
  }
1253
- function Cn(e, t) {
1254
- return l.array(l.string()).default([]).meta(Z({
1283
+ function Dn(e, t) {
1284
+ return o.array(o.string()).default([]).meta(Q({
1255
1285
  domain: e,
1256
1286
  title: t?.title ?? "Entities",
1257
1287
  description: t?.description,
1258
1288
  deviceClass: t?.deviceClass
1259
1289
  }));
1260
1290
  }
1261
- function wn(e, t) {
1262
- return l.array(l.string()).default([]).meta(Z({
1291
+ function On(e, t) {
1292
+ return o.array(o.string()).default([]).meta(Q({
1263
1293
  domain: e,
1264
1294
  title: t?.title ?? "Entity",
1265
1295
  description: t?.description,
@@ -1267,49 +1297,49 @@ function wn(e, t) {
1267
1297
  singleSelect: !0
1268
1298
  }));
1269
1299
  }
1270
- function Tn(e) {
1271
- return l.string().optional().meta({
1300
+ function kn(e) {
1301
+ return o.string().optional().meta({
1272
1302
  formType: "area-picker",
1273
1303
  title: e?.title ?? "Area"
1274
1304
  });
1275
1305
  }
1276
- function En(e) {
1277
- let t = l.string().meta({
1306
+ function An(e) {
1307
+ let t = o.string().meta({
1278
1308
  formType: "icon-picker",
1279
1309
  title: e?.title ?? "Icon"
1280
1310
  });
1281
1311
  return e?.default === void 0 ? t.optional() : t.default(e.default);
1282
1312
  }
1283
- function Dn(e) {
1284
- return l.array(l.string()).default([]).meta(Z({
1313
+ function jn(e) {
1314
+ return o.array(o.string()).default([]).meta(Q({
1285
1315
  title: e.title,
1286
1316
  description: e.description
1287
1317
  }));
1288
1318
  }
1289
- function On(e, t) {
1290
- let n = l.object(e);
1291
- return n.default(Ge(n)).meta({ title: t.title });
1319
+ function Mn(e, t) {
1320
+ let n = o.object(e);
1321
+ return n.default(Ue(n)).meta({ title: t.title });
1292
1322
  }
1293
- function Q(e) {
1323
+ function Nn(e) {
1294
1324
  return e.def;
1295
1325
  }
1296
1326
  function $(e) {
1297
- if (l.globalRegistry.get(e)?.formType === "list") return !0;
1298
- let t = Q(e);
1327
+ if (o.globalRegistry.get(e)?.formType === "list") return !0;
1328
+ let t = Nn(e);
1299
1329
  return t.shape ? Object.values(t.shape).some($) : t.options ? t.options.some($) : t.element ? $(t.element) : t.innerType ? $(t.innerType) : !1;
1300
1330
  }
1301
- function kn(e) {
1302
- let t = e, n = Q(t).innerType;
1303
- for (; n;) t = n, n = Q(t).innerType;
1331
+ function Pn(e) {
1332
+ let t = e, n = Nn(t).innerType;
1333
+ for (; n;) t = n, n = Nn(t).innerType;
1304
1334
  return t;
1305
1335
  }
1306
- function An(e) {
1307
- let t = Q(kn(e));
1336
+ function Fn(e) {
1337
+ let t = Nn(Pn(e));
1308
1338
  if (t.shape) return new Set(Object.keys(t.shape));
1309
1339
  if (t.options) {
1310
1340
  let e = [];
1311
1341
  for (let n of t.options) {
1312
- let t = An(n);
1342
+ let t = Fn(n);
1313
1343
  if (!t) return null;
1314
1344
  e.push(t);
1315
1345
  }
@@ -1321,7 +1351,7 @@ function An(e) {
1321
1351
  }
1322
1352
  return null;
1323
1353
  }
1324
- function jn(e, t, n) {
1354
+ function In(e, t, n) {
1325
1355
  let r = { [t]: n };
1326
1356
  try {
1327
1357
  return e.parse(r);
@@ -1329,14 +1359,14 @@ function jn(e, t, n) {
1329
1359
  return r;
1330
1360
  }
1331
1361
  }
1332
- function Mn(e, t) {
1362
+ function Ln(e, t) {
1333
1363
  if (!Number.isInteger(t.max) || t.max < 1) throw Error(`field.list: max must be a positive integer, got ${t.max}`);
1334
- if (t.max > _n) throw Error(`field.list: max ${t.max} exceeds the ceiling of ${_n}`);
1364
+ if (t.max > xn) throw Error(`field.list: max ${t.max} exceeds the ceiling of ${xn}`);
1335
1365
  if (t.min !== void 0 && (!Number.isInteger(t.min) || t.min < 0 || t.min > t.max)) throw Error(`field.list: min must be an integer between 0 and max, got ${t.min}`);
1336
1366
  if ($(e)) throw Error("field.list: a list item cannot contain another field.list (depth 1 only)");
1337
- if (t.labelField !== void 0 && !An(e)?.has(t.labelField)) throw Error(`field.list: labelField "${t.labelField}" must name a field present in every item`);
1338
- let n = l.array(e);
1339
- return t.min !== void 0 && (n = n.min(t.min)), n = n.max(t.max), n.default([]).meta(Z({
1367
+ if (t.labelField !== void 0 && !Fn(e)?.has(t.labelField)) throw Error(`field.list: labelField "${t.labelField}" must name a field present in every item`);
1368
+ let n = o.array(e);
1369
+ return t.min !== void 0 && (n = n.min(t.min)), n = n.max(t.max), n.default([]).meta(Q({
1340
1370
  formType: "list",
1341
1371
  title: t.title,
1342
1372
  description: t.description,
@@ -1344,7 +1374,7 @@ function Mn(e, t) {
1344
1374
  labelField: t.labelField
1345
1375
  }));
1346
1376
  }
1347
- function Nn(e, t, n) {
1377
+ function Rn(e, t, n) {
1348
1378
  let r = Object.keys(t)[0];
1349
1379
  if (r === void 0) throw Error("field.variants: at least one variant is required");
1350
1380
  if (n.shared && e in n.shared) throw Error(`field.variants: shared fields cannot redefine the discriminator "${e}"`);
@@ -1352,12 +1382,12 @@ function Nn(e, t, n) {
1352
1382
  if (n.labels) {
1353
1383
  for (let e of Object.keys(n.labels)) if (!(e in t)) throw Error(`field.variants: labels names unknown variant "${e}"`);
1354
1384
  }
1355
- let i = Object.entries(t).map(([t, r]) => l.object({
1385
+ let i = Object.entries(t).map(([t, r]) => o.object({
1356
1386
  ...n.shared ?? {},
1357
1387
  ...r,
1358
- [e]: l.literal(t)
1359
- })), a = l.discriminatedUnion(e, i), o = i[0];
1360
- return a.default(o ? jn(o, e, r) : {}).meta(Z({
1388
+ [e]: o.literal(t)
1389
+ })), a = o.discriminatedUnion(e, i), s = i[0];
1390
+ return a.default(s ? In(s, e, r) : {}).meta(Q({
1361
1391
  formType: "variants",
1362
1392
  discriminator: e,
1363
1393
  title: n.title,
@@ -1365,27 +1395,27 @@ function Nn(e, t, n) {
1365
1395
  labels: n.labels
1366
1396
  }));
1367
1397
  }
1368
- var Pn = {
1369
- title: vn,
1370
- text: yn,
1371
- number: bn,
1372
- toggle: xn,
1373
- choice: Sn,
1374
- entities: Cn,
1375
- entity: wn,
1376
- area: Tn,
1377
- icon: En,
1378
- stringList: Dn,
1379
- group: On,
1380
- list: Mn,
1381
- variants: Nn
1398
+ var zn = {
1399
+ title: Sn,
1400
+ text: Cn,
1401
+ number: wn,
1402
+ toggle: Tn,
1403
+ choice: En,
1404
+ entities: Dn,
1405
+ entity: On,
1406
+ area: kn,
1407
+ icon: An,
1408
+ stringList: jn,
1409
+ group: Mn,
1410
+ list: Ln,
1411
+ variants: Rn
1382
1412
  };
1383
- function Fn(e) {
1384
- return l.object(e);
1413
+ function Bn(e) {
1414
+ return o.object(e);
1385
1415
  }
1386
1416
  //#endregion
1387
1417
  //#region src/shared/spline.ts
1388
- function In(e) {
1418
+ function Vn(e) {
1389
1419
  if (e.length < 2) return "";
1390
1420
  let t = e[0], n = e[1];
1391
1421
  if (!t || !n) return "";
@@ -1412,14 +1442,14 @@ function In(e) {
1412
1442
  }
1413
1443
  //#endregion
1414
1444
  //#region src/theme.ts
1415
- function Ln() {
1445
+ function Hn() {
1416
1446
  return document.documentElement.classList.contains("dark");
1417
1447
  }
1418
1448
  //#endregion
1419
1449
  //#region src/version.ts
1420
- var Rn = {
1450
+ var Un = {
1421
1451
  name: "@glasshome/widget-sdk",
1422
- version: "1.9.0",
1452
+ version: "1.9.1",
1423
1453
  description: "SDK for building GlassHome dashboard widgets with SolidJS",
1424
1454
  keywords: [
1425
1455
  "glasshome",
@@ -1470,13 +1500,13 @@ var Rn = {
1470
1500
  "tailwind-sources.css"
1471
1501
  ],
1472
1502
  scripts: {
1473
- build: "vite build && tsc",
1503
+ build: "vite build && tsc && bun scripts/check-host-singleton.ts",
1474
1504
  dev: "vite build --watch",
1475
1505
  test: "bun test",
1476
1506
  "typecheck:test": "tsc --noEmit -p tsconfig.test.json"
1477
1507
  },
1478
1508
  peerDependencies: {
1479
- "@glasshome/sync-layer": "0.5.0",
1509
+ "@glasshome/sync-layer": "0.6.0",
1480
1510
  "@glasshome/ui": "1.3.0",
1481
1511
  "solid-js": "^1.9.11"
1482
1512
  },
@@ -1509,4 +1539,4 @@ var Rn = {
1509
1539
  engines: { node: ">=18" }
1510
1540
  }.version;
1511
1541
  //#endregion
1512
- export { we as Badge, Te as Button, Ee as ColorSlider, De as ColorWheel, Oe as Input, ke as Label, Ae as ResponsiveDialog, je as ResponsiveDialogContent, Me as ResponsiveDialogDescription, Ne as ResponsiveDialogHeader, Pe as ResponsiveDialogTitle, Rn as SDK_VERSION, Fe as SchemaForm, Ie as Select, Le as SelectContent, Re as SelectItem, ze as SelectTrigger, Be as SelectValue, Ve as Slider, He as Switch, hn as ToneSchema, V as Widget, at as WidgetContent, e as WidgetCtx, Xt as WidgetDialog, lt as WidgetIcon, o as WidgetManifestSchema, Qe as WidgetSizeCtx, rt as WidgetSliderFill, dt as WidgetStatus, mt as WidgetTitle, Et as WidgetValue, ee as byDomain, ht as calculateLightGroup, gt as calculateSensorGroup, xt as countActiveEntities, Fn as defineConfig, Ke as defineWidget, i as deprecations, Pn as field, a as formatDeprecation, s as formatSchemaError, bt as getEntityAttribute, u as getForecasts, d as getStream, f as getWebRtcClientConfig, p as hassMediaUrl, n as injectTokens, Ln as isDark, yt as isEntityActive, In as monotoneCubicPath, Ue as parseColor, m as sendWebRtcCandidate, h as startWebRtcSession, g as state, mn as svgColors, _ as trackEntityHistory, v as untrackEntityHistory, y as useArea, b as useCamera, te as useConnection, ne as useCurrency, re as useEntities, x as useEntity, ie as useEntityHistory, ae as useEntityStatistics, oe as useForecast, se as useHassConfig, Zt as useIntersectionPause, S as useLocale, Qt as useReducedMotion, Je as useService, le as useStore, ue as useTemperatureUnit, Ze as useToggle, Xe as useTurnOff, Ye as useTurnOn, me as useUnitSystem, t as useWidgetContext, $t as useWidgetDialog, $e as useWidgetDimensions, en as useWidgetEntityGroup, dn as useWidgetGestures, gn as widgetFields, c as z };
1542
+ export { Se as Badge, Ce as Button, we as ColorSlider, Te as ColorWheel, Ee as Input, De as Label, Oe as ResponsiveDialog, ke as ResponsiveDialogContent, Ae as ResponsiveDialogDescription, je as ResponsiveDialogHeader, Me as ResponsiveDialogTitle, Un as SDK_VERSION, Ne as SchemaForm, Pe as Select, Fe as SelectContent, Ie as SelectItem, Le as SelectTrigger, Re as SelectValue, ze as Slider, Be as Switch, yn as ToneSchema, H as Widget, lt as WidgetContent, L as WidgetCtx, en as WidgetDialog, pt as WidgetIcon, r as WidgetManifestSchema, Ze as WidgetSizeCtx, st as WidgetSliderFill, ht as WidgetStatus, vt as WidgetTitle, At as WidgetValue, g as byDomain, yt as calculateLightGroup, bt as calculateSensorGroup, Tt as countActiveEntities, Bn as defineConfig, We as defineWidget, t as deprecations, zn as field, n as formatDeprecation, i as formatSchemaError, wt as getEntityAttribute, s as getForecasts, c as getStream, l as getWebRtcClientConfig, u as hassMediaUrl, rt as injectTokens, Hn as isDark, Ct as isEntityActive, Vn as monotoneCubicPath, Ve as parseColor, d as sendWebRtcCandidate, f as startWebRtcSession, p as state, vn as svgColors, m as trackEntityHistory, h as untrackEntityHistory, _ as useArea, v as useCamera, ee as useConnection, y as useCurrency, b as useEntities, te as useEntity, ne as useEntityHistory, re as useEntityStatistics, x as useForecast, ie as useHassConfig, tn as useIntersectionPause, ae as useLocale, nn as useReducedMotion, qe as useService, se as useStore, S as useTemperatureUnit, Xe as useToggle, Ye as useTurnOff, Je as useTurnOn, de as useUnitSystem, Ge as useWidgetContext, rn as useWidgetDialog, Qe as useWidgetDimensions, an as useWidgetEntityGroup, hn as useWidgetGestures, bn as widgetFields, a as z };