@glasshome/widget-sdk 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +903 -899
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,32 +1,32 @@
1
- import { createSignal as L, createContext as pt, useContext as vt, createEffect as Y, untrack as dt, createMemo as A, splitProps as St, on as gt, Show as J } from "solid-js";
1
+ import { createSignal as j, createContext as ze, useContext as be, createEffect as Y, untrack as ge, createMemo as N, splitProps as De, on as me, Show as J } from "solid-js";
2
2
  import { z as X } from "zod";
3
- import { GridSizeSchema as lr, PublishBodySchema as cr, PublishConfirmSchema as ur, PublishRequestSchema as dr, WidgetManifestSchema as gr, formatSchemaError as mr, parseGridSize as fr, serializeGridSize as hr } from "./schemas.js";
4
- import { memo as _, effect as M, setStyleProperty as C, className as k, template as v, insert as h, style as et, createComponent as V, use as Ct, delegateEvents as Mt } from "solid-js/web";
5
- import { clsx as zt } from "clsx";
6
- import { twMerge as Dt } from "tailwind-merge";
7
- import { createElementSize as _t } from "@solid-primitives/resize-observer";
8
- import { createForm as At, zodForm as Nt, reset as Tt, setValue as Ot, getValue as Et } from "@modular-forms/solid";
9
- function pn(t) {
10
- const [e] = L(t);
11
- return e;
3
+ import { GridSizeSchema as mr, PublishBodySchema as fr, PublishConfirmSchema as hr, PublishRequestSchema as xr, WidgetManifestSchema as vr, formatSchemaError as br, parseGridSize as yr, serializeGridSize as wr } from "./schemas.js";
4
+ import { memo as _, effect as z, setStyleProperty as M, className as p, template as y, insert as h, style as te, createComponent as V, use as _e, delegateEvents as Ae } from "solid-js/web";
5
+ import { clsx as Ne } from "clsx";
6
+ import { twMerge as Oe } from "tailwind-merge";
7
+ import { createElementSize as Ee } from "@solid-primitives/resize-observer";
8
+ import { createForm as Te, zodForm as Ve, reset as We, setValue as Ie, getValue as Re } from "@modular-forms/solid";
9
+ function Dn(e) {
10
+ const [t] = j(e);
11
+ return t;
12
12
  }
13
- function bt(t) {
14
- return X.toJSONSchema(t, {
15
- override: (e) => {
16
- const n = X.globalRegistry.get(e.zodSchema);
17
- return n && typeof n == "object" && Object.keys(n).length > 0 ? { ...e.jsonSchema, ...n } : e.jsonSchema;
13
+ function ye(e) {
14
+ return X.toJSONSchema(e, {
15
+ override: (t) => {
16
+ const n = X.globalRegistry.get(t.zodSchema);
17
+ return n && typeof n == "object" && Object.keys(n).length > 0 ? { ...t.jsonSchema, ...n } : t.jsonSchema;
18
18
  }
19
19
  });
20
20
  }
21
- function Vt(t) {
21
+ function Ge(e) {
22
22
  try {
23
- return t.parse({});
23
+ return e.parse({});
24
24
  } catch {
25
25
  return {};
26
26
  }
27
27
  }
28
- function Sn(t) {
29
- return t.configSchema && (t.manifest.schema || (t.manifest.schema = bt(t.configSchema)), t.manifest.defaultConfig || (t.manifest.defaultConfig = Vt(t.configSchema))), t;
28
+ function _n(e) {
29
+ return e.configSchema && (e.manifest.schema || (e.manifest.schema = ye(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ge(e.configSchema))), e;
30
30
  }
31
31
  const F = {
32
32
  /** Background layer (gradients, images, glows) */
@@ -38,19 +38,19 @@ const F = {
38
38
  /** Action layer (buttons, edit controls) */
39
39
  ACTIONS: 30
40
40
  };
41
- function Cn(t) {
41
+ function An(e) {
42
42
  }
43
- const st = pt();
44
- function G() {
45
- const t = vt(st);
46
- if (!t)
43
+ const se = ze();
44
+ function H() {
45
+ const e = be(se);
46
+ if (!e)
47
47
  throw new Error("useWidgetContext must be used within a Widget component");
48
- return t;
48
+ return e;
49
49
  }
50
- function $(...t) {
51
- return Dt(zt(t));
50
+ function k(...e) {
51
+ return Oe(Ne(e));
52
52
  }
53
- const Wt = {
53
+ const He = {
54
54
  id: "classic-glass",
55
55
  name: "Classic Glass",
56
56
  description: "Default glassmorphism design with blur background and gradient",
@@ -78,7 +78,7 @@ const Wt = {
78
78
  hoverScale: 1.02,
79
79
  activeScale: 0.98
80
80
  }
81
- }, It = {
81
+ }, Be = {
82
82
  id: "minimal",
83
83
  name: "Minimal",
84
84
  description: "Clean, minimal design with no background effects",
@@ -107,7 +107,7 @@ const Wt = {
107
107
  active: !1,
108
108
  focus: !0
109
109
  }
110
- }, Rt = {
110
+ }, Le = {
111
111
  id: "compact-horizontal",
112
112
  name: "Compact Horizontal",
113
113
  description: "Horizontal layout for compact widgets",
@@ -135,33 +135,33 @@ const Wt = {
135
135
  hoverScale: 1.02,
136
136
  activeScale: 0.98
137
137
  }
138
- }, lt = {
139
- "classic-glass": Wt,
140
- minimal: It,
141
- "compact-horizontal": Rt
138
+ }, le = {
139
+ "classic-glass": He,
140
+ minimal: Be,
141
+ "compact-horizontal": Le
142
142
  };
143
- function Gt(t) {
144
- return lt[t];
143
+ function je(e) {
144
+ return le[e];
145
145
  }
146
- function Mn(t) {
147
- return t in lt;
146
+ function Nn(e) {
147
+ return e in le;
148
148
  }
149
- function zn() {
150
- return Object.keys(lt);
149
+ function On() {
150
+ return Object.keys(le);
151
151
  }
152
- function yt(t, e) {
153
- if (typeof t != "object" || t === null)
154
- return e;
155
- const n = { ...t };
156
- for (const i in e) {
157
- const r = e[i], a = t[i];
152
+ function we(e, t) {
153
+ if (typeof e != "object" || e === null)
154
+ return t;
155
+ const n = { ...e };
156
+ for (const i in t) {
157
+ const r = t[i], a = e[i];
158
158
  if (r !== void 0) {
159
159
  if (Array.isArray(r)) {
160
160
  n[i] = r;
161
161
  continue;
162
162
  }
163
163
  if (typeof r == "object" && r !== null && !Array.isArray(r)) {
164
- typeof a == "object" && a !== null ? n[i] = yt(a, r) : n[i] = r;
164
+ typeof a == "object" && a !== null ? n[i] = we(a, r) : n[i] = r;
165
165
  continue;
166
166
  }
167
167
  n[i] = r;
@@ -169,101 +169,101 @@ function yt(t, e) {
169
169
  }
170
170
  return n;
171
171
  }
172
- function Ht(t, e) {
173
- if (!(!t && !e))
174
- return t ? e ? {
175
- container: { ...t.container, ...e.container },
176
- class: e.class ?? t.class,
177
- cssVars: { ...t.cssVars, ...e.cssVars }
178
- } : t : e;
179
- }
180
- function Bt(t, e) {
181
- return e ?? t;
182
- }
183
- function Lt(t, e) {
184
- if (!(!t && !e))
185
- return t ? e ? {
186
- visible: { ...t.visible, ...e.visible },
187
- styles: yt(t.styles ?? {}, e.styles ?? {}),
188
- classNames: { ...t.classNames, ...e.classNames }
189
- } : t : e;
190
- }
191
- function jt(t, e) {
192
- if (!(!t && !e))
193
- return t ? e ? {
194
- background: e.background ?? t.background,
195
- overlay: e.overlay ?? t.overlay,
196
- decorations: e.decorations ?? t.decorations
197
- } : t : e;
198
- }
199
- function Pt(t, e) {
200
- if (!(!t && !e))
201
- return t ? e ? {
202
- hover: e.hover ?? t.hover,
203
- active: e.active ?? t.active,
204
- focus: e.focus ?? t.focus,
205
- hoverScale: e.hoverScale ?? t.hoverScale,
206
- activeScale: e.activeScale ?? t.activeScale
207
- } : t : e;
208
- }
209
- function ct(t, e) {
172
+ function Pe(e, t) {
173
+ if (!(!e && !t))
174
+ return e ? t ? {
175
+ container: { ...e.container, ...t.container },
176
+ class: t.class ?? e.class,
177
+ cssVars: { ...e.cssVars, ...t.cssVars }
178
+ } : e : t;
179
+ }
180
+ function Fe(e, t) {
181
+ return t ?? e;
182
+ }
183
+ function Ue(e, t) {
184
+ if (!(!e && !t))
185
+ return e ? t ? {
186
+ visible: { ...e.visible, ...t.visible },
187
+ styles: we(e.styles ?? {}, t.styles ?? {}),
188
+ classNames: { ...e.classNames, ...t.classNames }
189
+ } : e : t;
190
+ }
191
+ function Ye(e, t) {
192
+ if (!(!e && !t))
193
+ return e ? t ? {
194
+ background: t.background ?? e.background,
195
+ overlay: t.overlay ?? e.overlay,
196
+ decorations: t.decorations ?? e.decorations
197
+ } : e : t;
198
+ }
199
+ function Xe(e, t) {
200
+ if (!(!e && !t))
201
+ return e ? t ? {
202
+ hover: t.hover ?? e.hover,
203
+ active: t.active ?? e.active,
204
+ focus: t.focus ?? e.focus,
205
+ hoverScale: t.hoverScale ?? e.hoverScale,
206
+ activeScale: t.activeScale ?? e.activeScale
207
+ } : e : t;
208
+ }
209
+ function ce(e, t) {
210
210
  return {
211
- id: e.id ?? t.id,
212
- name: e.name ?? t.name,
213
- description: e.description ?? t.description,
214
- styles: Ht(t.styles, e.styles),
215
- layout: Bt(t.layout, e.layout),
216
- elements: Lt(t.elements, e.elements),
217
- plugins: jt(t.plugins, e.plugins),
218
- interactions: Pt(t.interactions, e.interactions),
219
- extends: e.extends ?? t.extends
211
+ id: t.id ?? e.id,
212
+ name: t.name ?? e.name,
213
+ description: t.description ?? e.description,
214
+ styles: Pe(e.styles, t.styles),
215
+ layout: Fe(e.layout, t.layout),
216
+ elements: Ue(e.elements, t.elements),
217
+ plugins: Ye(e.plugins, t.plugins),
218
+ interactions: Xe(e.interactions, t.interactions),
219
+ extends: t.extends ?? e.extends
220
220
  };
221
221
  }
222
- function Dn(t, e) {
222
+ function En(e, t) {
223
223
  return {
224
- ...e,
225
- extends: t
224
+ ...t,
225
+ extends: e
226
226
  };
227
227
  }
228
- function _n(...t) {
229
- if (t.length === 0)
228
+ function Tn(...e) {
229
+ if (e.length === 0)
230
230
  throw new Error("composeVariants requires at least one variant");
231
- return t.length === 1 ? t[0] : t.reduce((e, n) => ct(e, n));
231
+ return e.length === 1 ? e[0] : e.reduce((t, n) => ce(t, n));
232
232
  }
233
- function An(t, e) {
234
- return ct(t, { layout: e });
233
+ function Vn(e, t) {
234
+ return ce(e, { layout: t });
235
235
  }
236
- function Nn(t, e) {
237
- return ct(t, {
238
- styles: { cssVars: e }
236
+ function Wn(e, t) {
237
+ return ce(e, {
238
+ styles: { cssVars: t }
239
239
  });
240
240
  }
241
- function Tn(t = "column", e = "start", n = "start", i) {
241
+ function In(e = "column", t = "start", n = "start", i) {
242
242
  return {
243
243
  type: "flex",
244
- direction: t,
245
- align: e,
244
+ direction: e,
245
+ align: t,
246
246
  justify: n,
247
247
  ...i
248
248
  };
249
249
  }
250
- var Ft = /* @__PURE__ */ v("<div>"), Ut = /* @__PURE__ */ v('<div class="pointer-events-none absolute inset-0 opacity-40 blur-2xl">');
251
- function Yt(t) {
252
- const e = G(), n = () => e.orientation() === "vertical" ? `inset(${100 - t.value}% 0 0 0)` : `inset(0 ${100 - t.value}% 0 0)`, i = () => t.color ?? "rgb(59, 130, 246)";
253
- return [_(() => _(() => !!((t.glow ?? !1) && t.value > 0))() && (() => {
254
- var r = Ut();
255
- return M((a) => {
250
+ var Ke = /* @__PURE__ */ y("<div>"), qe = /* @__PURE__ */ y('<div class="pointer-events-none absolute inset-0 opacity-40 blur-2xl">');
251
+ function Je(e) {
252
+ const t = H(), n = () => t.orientation() === "vertical" ? `inset(${100 - e.value}% 0 0 0)` : `inset(0 ${100 - e.value}% 0 0)`, i = () => e.color ?? "rgb(59, 130, 246)";
253
+ return [_(() => _(() => !!((e.glow ?? !1) && e.value > 0))() && (() => {
254
+ var r = qe();
255
+ return z((a) => {
256
256
  var o = i(), s = F.BACKGROUND;
257
- return o !== a.e && C(r, "background", a.e = o), s !== a.t && C(r, "z-index", a.t = s), a;
257
+ return o !== a.e && M(r, "background", a.e = o), s !== a.t && M(r, "z-index", a.t = s), a;
258
258
  }, {
259
259
  e: void 0,
260
260
  t: void 0
261
261
  }), r;
262
262
  })()), (() => {
263
- var r = Ft();
264
- return M((a) => {
265
- var o = $("pointer-events-none absolute inset-0", t.isDragging ? "duration-0" : "transition-all duration-300 ease-out", t.class), s = i(), l = n(), m = t.opacity ?? 0.3, d = F.BACKGROUND;
266
- return o !== a.e && k(r, a.e = o), s !== a.t && C(r, "background", a.t = s), l !== a.a && C(r, "clip-path", a.a = l), m !== a.o && C(r, "opacity", a.o = m), d !== a.i && C(r, "z-index", a.i = d), a;
263
+ var r = Ke();
264
+ return z((a) => {
265
+ var o = k("pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), s = i(), l = n(), u = e.opacity ?? 0.3, c = F.BACKGROUND;
266
+ return o !== a.e && p(r, a.e = o), s !== a.t && M(r, "background", a.t = s), l !== a.a && M(r, "clip-path", a.a = l), u !== a.o && M(r, "opacity", a.o = u), c !== a.i && M(r, "z-index", a.i = c), a;
267
267
  }, {
268
268
  e: void 0,
269
269
  t: void 0,
@@ -278,17 +278,17 @@ const Z = {
278
278
  S2: { xs: 6, sm: 8, md: 10, lg: 12, xl: 14 },
279
279
  S3: { xs: 8, sm: 10, md: 12, lg: 14, xl: 16 },
280
280
  S4: { xs: 12, sm: 14, md: 16, lg: 18, xl: 20 }
281
- }, W = {
281
+ }, G = {
282
282
  /** Extra small spacing (4-8px) */
283
- S1: (t) => `${Z.S1[t]}px`,
283
+ S1: (e) => `${Z.S1[e]}px`,
284
284
  /** Small spacing (6-14px) - default for most layouts */
285
- S2: (t) => `${Z.S2[t]}px`,
285
+ S2: (e) => `${Z.S2[e]}px`,
286
286
  /** Medium spacing (8-16px) */
287
- S3: (t) => `${Z.S3[t]}px`,
287
+ S3: (e) => `${Z.S3[e]}px`,
288
288
  /** Large spacing (12-20px) */
289
- S4: (t) => `${Z.S4[t]}px`,
289
+ S4: (e) => `${Z.S4[e]}px`,
290
290
  /** Icon container size in pixels */
291
- icon: (t) => ({
291
+ icon: (e) => ({
292
292
  xs: 32,
293
293
  // 1x1, 1x2 widgets
294
294
  sm: 40,
@@ -299,9 +299,9 @@ const Z = {
299
299
  // 2x6, 3x6, 4x2 widgets
300
300
  xl: 56
301
301
  // 4x4 widgets
302
- })[t],
302
+ })[e],
303
303
  /** Icon stroke size for lucide icons */
304
- iconSize: (t) => ({
304
+ iconSize: (e) => ({
305
305
  xs: 18,
306
306
  // Smaller stroke for tiny widgets
307
307
  sm: 20,
@@ -312,9 +312,9 @@ const Z = {
312
312
  // Large widgets
313
313
  xl: 28
314
314
  // Extra large widgets
315
- })[t],
315
+ })[e],
316
316
  /** Spacing between icon and title */
317
- iconToTitle: (t) => ({
317
+ iconToTitle: (e) => ({
318
318
  xs: "8px",
319
319
  // Tight spacing for small widgets
320
320
  sm: "10px",
@@ -325,9 +325,9 @@ const Z = {
325
325
  // More breathing room
326
326
  xl: "16px"
327
327
  // Maximum spacing (@[400px]:mt-4 = 16px)
328
- })[t],
328
+ })[e],
329
329
  /** Container padding */
330
- container: (t) => ({
330
+ container: (e) => ({
331
331
  xs: "8px",
332
332
  // Minimal padding for tiny widgets
333
333
  sm: "16px",
@@ -336,8 +336,8 @@ const Z = {
336
336
  lg: "20px",
337
337
  // More padding for larger widgets
338
338
  xl: "20px"
339
- })[t]
340
- }, Xt = {
339
+ })[e]
340
+ }, Ze = {
341
341
  4: "gap-1",
342
342
  6: "gap-1.5",
343
343
  8: "gap-2",
@@ -348,25 +348,25 @@ const Z = {
348
348
  18: "gap-[18px]",
349
349
  20: "gap-5"
350
350
  };
351
- function Kt(t, e) {
352
- const n = Z[t][e];
353
- return Xt[n] || `gap-[${n}px]`;
351
+ function Qe(e, t) {
352
+ const n = Z[e][t];
353
+ return Ze[n] || `gap-[${n}px]`;
354
354
  }
355
- var qt = /* @__PURE__ */ v("<div>");
356
- function Jt(t) {
357
- const e = G();
355
+ var et = /* @__PURE__ */ y("<div>");
356
+ function tt(e) {
357
+ const t = H();
358
358
  return (() => {
359
- var n = qt();
360
- return h(n, () => t.children), M((i) => {
361
- var r = $(
359
+ var n = et();
360
+ return h(n, () => e.children), z((i) => {
361
+ var r = k(
362
362
  "relative flex h-full w-full overflow-hidden",
363
363
  // Ensure controls (ml-auto divs) are above other content
364
364
  "[&_div.ml-auto]:relative [&_div.ml-auto]:z-30",
365
- e.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
366
- Kt("S3", e.size()),
367
- t.class
368
- ), a = W.container(e.size()), o = F.CONTENT;
369
- return r !== i.e && k(n, i.e = r), a !== i.t && C(n, "padding", i.t = a), o !== i.a && C(n, "z-index", i.a = o), i;
365
+ t.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
366
+ Qe("S3", t.size()),
367
+ e.class
368
+ ), a = G.container(t.size()), o = F.CONTENT;
369
+ return r !== i.e && p(n, i.e = r), a !== i.t && M(n, "padding", i.t = a), o !== i.a && M(n, "z-index", i.a = o), i;
370
370
  }, {
371
371
  e: void 0,
372
372
  t: void 0,
@@ -374,9 +374,9 @@ function Jt(t) {
374
374
  }), n;
375
375
  })();
376
376
  }
377
- const j = {
377
+ const P = {
378
378
  /** Container base text sizing */
379
- container: (t) => ({
379
+ container: (e) => ({
380
380
  xs: "text-xs",
381
381
  // Smallest widgets
382
382
  sm: "text-sm",
@@ -387,9 +387,9 @@ const j = {
387
387
  // Large widgets
388
388
  xl: "text-lg"
389
389
  // Extra large widgets
390
- })[t],
390
+ })[e],
391
391
  /** Title text sizing (main heading) */
392
- title: (t) => ({
392
+ title: (e) => ({
393
393
  xs: "text-xs",
394
394
  // 12px - Very compact
395
395
  sm: "text-xs",
@@ -400,9 +400,9 @@ const j = {
400
400
  // 14px - Maintain size
401
401
  xl: "text-sm"
402
402
  // 14px - Don't go too large for secondary text
403
- })[t],
403
+ })[e],
404
404
  /** Subtitle/secondary text sizing */
405
- subtitle: (t) => ({
405
+ subtitle: (e) => ({
406
406
  xs: "text-xs",
407
407
  // 12px - Very compact
408
408
  sm: "text-sm",
@@ -413,9 +413,9 @@ const j = {
413
413
  // 14px - Maintain size
414
414
  xl: "text-base"
415
415
  // 14px - Don't go too large for secondary text
416
- })[t],
416
+ })[e],
417
417
  /** Value display text sizing (large numbers) */
418
- value: (t) => ({
418
+ value: (e) => ({
419
419
  xs: "text-lg",
420
420
  // 18px - Still readable on small widgets
421
421
  sm: "text-xl",
@@ -426,9 +426,9 @@ const j = {
426
426
  // 30px - Very prominent
427
427
  xl: "text-4xl"
428
428
  // 36px - Maximum impact
429
- })[t],
429
+ })[e],
430
430
  /** Badge text sizing (entity count badges) */
431
- badge: (t) => ({
431
+ badge: (e) => ({
432
432
  xs: "text-xs",
433
433
  // 12px - Compact badge
434
434
  sm: "text-xs",
@@ -439,9 +439,9 @@ const j = {
439
439
  // 14px - Slightly larger for readability
440
440
  xl: "text-sm"
441
441
  // 14px - Maximum badge size
442
- })[t],
442
+ })[e],
443
443
  /** Metric label text sizing */
444
- metricLabel: (t) => ({
444
+ metricLabel: (e) => ({
445
445
  xs: "text-xs",
446
446
  // 12px - Compact labels
447
447
  sm: "text-xs",
@@ -452,9 +452,9 @@ const j = {
452
452
  // 14px - More readable on large widgets
453
453
  xl: "text-sm"
454
454
  // 14px
455
- })[t],
455
+ })[e],
456
456
  /** Metric value text sizing */
457
- metricValue: (t) => ({
457
+ metricValue: (e) => ({
458
458
  xs: "text-sm",
459
459
  // 14px - Readable metric values
460
460
  sm: "text-sm",
@@ -465,17 +465,17 @@ const j = {
465
465
  // 16px - Slightly larger
466
466
  xl: "text-base"
467
467
  // 16px
468
- })[t],
468
+ })[e],
469
469
  /** Status text (same as subtitle but semantic) */
470
- status: (t) => ({
470
+ status: (e) => ({
471
471
  xs: "text-md",
472
472
  sm: "text-xl",
473
473
  md: "text-2xl",
474
474
  lg: "text-3xl",
475
475
  xl: "text-3xl"
476
- })[t],
476
+ })[e],
477
477
  /** Empty state message text */
478
- emptyState: (t) => ({
478
+ emptyState: (e) => ({
479
479
  xs: "text-xs",
480
480
  // 12px
481
481
  sm: "text-sm",
@@ -486,20 +486,20 @@ const j = {
486
486
  // 16px
487
487
  xl: "text-base"
488
488
  // 16px
489
- })[t]
489
+ })[e]
490
490
  };
491
- var Zt = /* @__PURE__ */ v("<div><div>"), Qt = /* @__PURE__ */ v("<div>"), te = /* @__PURE__ */ v("<h3>"), ee = /* @__PURE__ */ v("<p>"), ne = /* @__PURE__ */ v("<div class=mt-2>");
492
- function re(t) {
493
- const e = G(), n = () => e.contentLayout() === "horizontal";
491
+ var nt = /* @__PURE__ */ y("<div><div>"), rt = /* @__PURE__ */ y("<div>"), it = /* @__PURE__ */ y("<h3>"), at = /* @__PURE__ */ y("<p>"), ot = /* @__PURE__ */ y("<div class=mt-2>");
492
+ function st(e) {
493
+ const t = H(), n = () => t.contentLayout() === "horizontal";
494
494
  return (() => {
495
- var i = Zt(), r = i.firstChild;
495
+ var i = nt(), r = i.firstChild;
496
496
  return h(i, (() => {
497
- var a = _(() => !!t.icon);
497
+ var a = _(() => !!e.icon);
498
498
  return () => a() && (() => {
499
- var o = Qt();
500
- return h(o, () => t.icon), M((s) => {
501
- var l = $("flex items-center justify-center text-foreground/30", n() ? "shrink-0" : ""), m = `${W.icon(e.size())}px`, d = `${W.icon(e.size())}px`;
502
- return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "width", s.t = m), d !== s.a && C(o, "height", s.a = d), s;
499
+ var o = rt();
500
+ return h(o, () => e.icon), z((s) => {
501
+ var l = k("flex items-center justify-center text-foreground/30", n() ? "shrink-0" : ""), u = `${G.icon(t.size())}px`, c = `${G.icon(t.size())}px`;
502
+ return l !== s.e && p(o, s.e = l), u !== s.t && M(o, "width", s.t = u), c !== s.a && M(o, "height", s.a = c), s;
503
503
  }, {
504
504
  e: void 0,
505
505
  t: void 0,
@@ -507,38 +507,38 @@ function re(t) {
507
507
  }), o;
508
508
  })();
509
509
  })(), r), h(r, (() => {
510
- var a = _(() => !!(t.title ?? "No data"));
510
+ var a = _(() => !!(e.title ?? "No data"));
511
511
  return () => a() && (() => {
512
- var o = te();
513
- return h(o, () => t.title ?? "No data"), M((s) => {
514
- var l = $("font-semibold text-foreground/60", j.subtitle(e.size())), m = n() ? "100%" : "80%";
515
- return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "max-width", s.t = m), s;
512
+ var o = it();
513
+ return h(o, () => e.title ?? "No data"), z((s) => {
514
+ var l = k("font-semibold text-foreground/60", P.subtitle(t.size())), u = n() ? "100%" : "80%";
515
+ return l !== s.e && p(o, s.e = l), u !== s.t && M(o, "max-width", s.t = u), s;
516
516
  }, {
517
517
  e: void 0,
518
518
  t: void 0
519
519
  }), o;
520
520
  })();
521
521
  })(), null), h(r, (() => {
522
- var a = _(() => !!t.message);
522
+ var a = _(() => !!e.message);
523
523
  return () => a() && (() => {
524
- var o = ee();
525
- return h(o, () => t.message), M((s) => {
526
- var l = $("text-foreground/50", j.emptyState(e.size())), m = n() ? "100%" : "85%";
527
- return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "max-width", s.t = m), s;
524
+ var o = at();
525
+ return h(o, () => e.message), z((s) => {
526
+ var l = k("text-foreground/50", P.emptyState(t.size())), u = n() ? "100%" : "85%";
527
+ return l !== s.e && p(o, s.e = l), u !== s.t && M(o, "max-width", s.t = u), s;
528
528
  }, {
529
529
  e: void 0,
530
530
  t: void 0
531
531
  }), o;
532
532
  })();
533
533
  })(), null), h(r, (() => {
534
- var a = _(() => !!t.action);
534
+ var a = _(() => !!e.action);
535
535
  return () => a() && (() => {
536
- var o = ne();
537
- return h(o, () => t.action), o;
536
+ var o = ot();
537
+ return h(o, () => e.action), o;
538
538
  })();
539
- })(), null), M((a) => {
540
- var o = $("flex h-full w-full", n() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", t.class), s = W.S2(e.size()), l = W.container(e.size()), m = $("flex flex-col", n() ? "items-start text-left" : "items-center text-center"), d = W.S1(e.size());
541
- return o !== a.e && k(i, a.e = o), s !== a.t && C(i, "gap", a.t = s), l !== a.a && C(i, "padding", a.a = l), m !== a.o && k(r, a.o = m), d !== a.i && C(r, "gap", a.i = d), a;
539
+ })(), null), z((a) => {
540
+ var o = k("flex h-full w-full", n() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", e.class), s = G.S2(t.size()), l = G.container(t.size()), u = k("flex flex-col", n() ? "items-start text-left" : "items-center text-center"), c = G.S1(t.size());
541
+ return o !== a.e && p(i, a.e = o), s !== a.t && M(i, "gap", a.t = s), l !== a.a && M(i, "padding", a.a = l), u !== a.o && p(r, a.o = u), c !== a.i && M(r, "gap", a.i = c), a;
542
542
  }, {
543
543
  e: void 0,
544
544
  t: void 0,
@@ -548,49 +548,49 @@ function re(t) {
548
548
  }), i;
549
549
  })();
550
550
  }
551
- function ie(t) {
552
- const e = t.match(/hsl\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*\)/);
553
- return e ? { h: Number(e[1]), s: Number(e[2]), l: Number(e[3]) } : null;
551
+ function lt(e) {
552
+ const t = e.match(/hsl\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*\)/);
553
+ return t ? { h: Number(t[1]), s: Number(t[2]), l: Number(t[3]) } : null;
554
554
  }
555
- function ae(t) {
556
- const e = t.match(/rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)/);
557
- return e ? wt(Number(e[1]), Number(e[2]), Number(e[3])) : null;
555
+ function ct(e) {
556
+ const t = e.match(/rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)/);
557
+ return t ? $e(Number(t[1]), Number(t[2]), Number(t[3])) : null;
558
558
  }
559
- function oe(t) {
560
- const e = t.match(/^#([0-9a-f]{3,8})$/i);
561
- if (!e) return null;
562
- let n = e[1];
559
+ function ut(e) {
560
+ const t = e.match(/^#([0-9a-f]{3,8})$/i);
561
+ if (!t) return null;
562
+ let n = t[1];
563
563
  n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]);
564
564
  const i = Number.parseInt(n.slice(0, 2), 16), r = Number.parseInt(n.slice(2, 4), 16), a = Number.parseInt(n.slice(4, 6), 16);
565
- return wt(i, r, a);
565
+ return $e(i, r, a);
566
566
  }
567
- function wt(t, e, n) {
568
- t /= 255, e /= 255, n /= 255;
569
- const i = Math.max(t, e, n), r = Math.min(t, e, n), a = (i + r) / 2;
567
+ function $e(e, t, n) {
568
+ e /= 255, t /= 255, n /= 255;
569
+ const i = Math.max(e, t, n), r = Math.min(e, t, n), a = (i + r) / 2;
570
570
  if (i === r) return { h: 0, s: 0, l: a * 100 };
571
571
  const o = i - r, s = a > 0.5 ? o / (2 - i - r) : o / (i + r);
572
572
  let l = 0;
573
- return i === t ? l = ((e - n) / o + (e < n ? 6 : 0)) / 6 : i === e ? l = ((n - t) / o + 2) / 6 : l = ((t - e) / o + 4) / 6, { h: l * 360, s: s * 100, l: a * 100 };
573
+ return i === e ? l = ((t - n) / o + (t < n ? 6 : 0)) / 6 : i === t ? l = ((n - e) / o + 2) / 6 : l = ((e - t) / o + 4) / 6, { h: l * 360, s: s * 100, l: a * 100 };
574
574
  }
575
- function se(t) {
576
- return ie(t) ?? ae(t) ?? oe(t);
575
+ function dt(e) {
576
+ return lt(e) ?? ct(e) ?? ut(e);
577
577
  }
578
- function mt(t, e, n, i) {
579
- const r = Math.round(t), a = Math.round(Math.min(100, Math.max(0, e))), o = Math.round(Math.min(100, Math.max(0, n)));
578
+ function fe(e, t, n, i) {
579
+ const r = Math.round(e), a = Math.round(Math.min(100, Math.max(0, t))), o = Math.round(Math.min(100, Math.max(0, n)));
580
580
  return i !== void 0 && i < 1 ? `hsla(${r}, ${a}%, ${o}%, ${i})` : `hsl(${r}, ${a}%, ${o}%)`;
581
581
  }
582
- function le(t) {
583
- const e = se(t);
584
- if (!e) return null;
585
- const { h: n, s: i, l: r } = e;
582
+ function gt(e) {
583
+ const t = dt(e);
584
+ if (!t) return null;
585
+ const { h: n, s: i, l: r } = t;
586
586
  let a, o = Math.min(i + 10, 100);
587
587
  r < 25 ? (a = r + 12, o = Math.min(i + 15, 100)) : r < 40 ? a = Math.max(r - 8, 15) : a = Math.max(18, r * 0.3), i < 15 && (o = 10, a = Math.max(a, 20));
588
- const s = mt(n, o, a, 0.85), l = mt(n, Math.min(i, 90), Math.min(r, 55), 0.5);
588
+ const s = fe(n, o, a, 0.85), l = fe(n, Math.min(i, 90), Math.min(r, 55), 0.5);
589
589
  return { background: s, glow: l };
590
590
  }
591
- var ce = /* @__PURE__ */ v('<div><div class="flex items-center justify-center text-foreground">'), ft = /* @__PURE__ */ v("<div>");
592
- function ue(t) {
593
- const e = G(), n = () => t.dynamicColor ? le(t.dynamicColor) : null, i = () => !!n(), r = () => {
591
+ var mt = /* @__PURE__ */ y('<div><div class="flex items-center justify-center text-foreground">'), he = /* @__PURE__ */ y("<div>");
592
+ function ft(e) {
593
+ const t = H(), n = () => e.dynamicColor ? gt(e.dynamicColor) : null, i = () => !!n(), r = () => {
594
594
  const l = n();
595
595
  if (l)
596
596
  return {
@@ -604,61 +604,61 @@ function ue(t) {
604
604
  };
605
605
  }, o = () => {
606
606
  const l = {
607
- width: `${W.icon(e.size())}px`,
608
- height: `${W.icon(e.size())}px`,
607
+ width: `${G.icon(t.size())}px`,
608
+ height: `${G.icon(t.size())}px`,
609
609
  "border-radius": "var(--radius-sm, 12px)"
610
- }, m = r(), d = a();
611
- return m && Object.assign(l, m), d && Object.assign(l, d), l;
612
- }, s = (l, m, d) => {
613
- const x = {
614
- width: `${W.icon(e.size()) * 1.02}px`,
615
- height: `${W.icon(e.size()) * 1.02}px`,
610
+ }, u = r(), c = a();
611
+ return u && Object.assign(l, u), c && Object.assign(l, c), l;
612
+ }, s = (l, u, c) => {
613
+ const b = {
614
+ width: `${G.icon(t.size()) * 1.02}px`,
615
+ height: `${G.icon(t.size()) * 1.02}px`,
616
616
  "border-radius": "var(--radius-sm, 12px)",
617
- bottom: `${-W.icon(e.size()) * l}px`,
618
- right: `${-W.icon(e.size()) * (l * 0.71)}px`,
619
- "z-index": m,
620
- opacity: d
621
- }, p = r();
622
- return p && Object.assign(x, p), x;
617
+ bottom: `${-G.icon(t.size()) * l}px`,
618
+ right: `${-G.icon(t.size()) * (l * 0.71)}px`,
619
+ "z-index": u,
620
+ opacity: c
621
+ }, S = r();
622
+ return S && Object.assign(b, S), b;
623
623
  };
624
624
  return (() => {
625
- var l = ce(), m = l.firstChild;
625
+ var l = mt(), u = l.firstChild;
626
626
  return h(l, (() => {
627
- var d = _(() => (t.entityCount ?? 1) >= 2);
628
- return () => d() && (() => {
629
- var x = ft();
630
- return M((p) => {
631
- var c = $("absolute", !i() && (t.color ?? "bg-foreground/10")), u = s(0.14, -2, 0.45);
632
- return c !== p.e && k(x, p.e = c), p.t = et(x, u, p.t), p;
627
+ var c = _(() => (e.entityCount ?? 1) >= 2);
628
+ return () => c() && (() => {
629
+ var b = he();
630
+ return z((S) => {
631
+ var m = k("absolute", !i() && (e.color ?? "bg-foreground/10")), v = s(0.14, -2, 0.45);
632
+ return m !== S.e && p(b, S.e = m), S.t = te(b, v, S.t), S;
633
633
  }, {
634
634
  e: void 0,
635
635
  t: void 0
636
- }), x;
636
+ }), b;
637
637
  })();
638
- })(), m), h(l, (() => {
639
- var d = _(() => (t.entityCount ?? 1) >= 3);
640
- return () => d() && (() => {
641
- var x = ft();
642
- return M((p) => {
643
- var c = $("absolute", !i() && (t.color ?? "bg-foreground/10")), u = s(0.28, -3, 0.2);
644
- return c !== p.e && k(x, p.e = c), p.t = et(x, u, p.t), p;
638
+ })(), u), h(l, (() => {
639
+ var c = _(() => (e.entityCount ?? 1) >= 3);
640
+ return () => c() && (() => {
641
+ var b = he();
642
+ return z((S) => {
643
+ var m = k("absolute", !i() && (e.color ?? "bg-foreground/10")), v = s(0.28, -3, 0.2);
644
+ return m !== S.e && p(b, S.e = m), S.t = te(b, v, S.t), S;
645
645
  }, {
646
646
  e: void 0,
647
647
  t: void 0
648
- }), x;
648
+ }), b;
649
649
  })();
650
- })(), m), h(m, () => t.icon), M((d) => {
651
- var x = $(
650
+ })(), u), h(u, () => e.icon), z((c) => {
651
+ var b = k(
652
652
  "relative flex shrink-0 items-center justify-center transition-all",
653
653
  "pointer-events-none",
654
- t.dimmed && "opacity-50",
654
+ e.dimmed && "opacity-50",
655
655
  // Only apply Tailwind classes when not using dynamic colors
656
- !i() && t.glow && "shadow-[0_0_25px]",
657
- !i() && (t.color ?? "bg-foreground/10"),
658
- !i() && t.glow,
659
- t.class
660
- ), p = o(), c = `${W.iconSize(e.size())}px`;
661
- return x !== d.e && k(l, d.e = x), d.t = et(l, p, d.t), c !== d.a && C(m, "font-size", d.a = c), d;
656
+ !i() && e.glow && "shadow-[0_0_25px]",
657
+ !i() && (e.color ?? "bg-foreground/10"),
658
+ !i() && e.glow,
659
+ e.class
660
+ ), S = o(), m = `${G.iconSize(t.size())}px`;
661
+ return b !== c.e && p(l, c.e = b), c.t = te(l, S, c.t), m !== c.a && M(u, "font-size", c.a = m), c;
662
662
  }, {
663
663
  e: void 0,
664
664
  t: void 0,
@@ -666,36 +666,36 @@ function ue(t) {
666
666
  }), l;
667
667
  })();
668
668
  }
669
- var de = /* @__PURE__ */ v("<div>"), ge = /* @__PURE__ */ v("<div><div><span></span></div><div>"), me = /* @__PURE__ */ v("<span class=shrink-0>"), fe = /* @__PURE__ */ v('<span class="ml-1 text-foreground/70">');
670
- function he(t) {
671
- const e = G(), n = () => {
672
- const i = t.direction ?? "auto";
673
- return i === "auto" ? e.orientation() === "horizontal" ? "horizontal" : "vertical" : i;
669
+ var ht = /* @__PURE__ */ y("<div>"), xt = /* @__PURE__ */ y("<div><div><span></span></div><div>"), vt = /* @__PURE__ */ y("<span class=shrink-0>"), bt = /* @__PURE__ */ y('<span class="ml-1 text-foreground/70">');
670
+ function yt(e) {
671
+ const t = H(), n = () => {
672
+ const i = e.direction ?? "auto";
673
+ return i === "auto" ? t.orientation() === "horizontal" ? "horizontal" : "vertical" : i;
674
674
  };
675
675
  return (() => {
676
- var i = de();
677
- return h(i, () => t.children), M(() => k(i, $("flex", n() === "horizontal" ? "flex-row gap-4" : "flex-col gap-2", t.class))), i;
676
+ var i = ht();
677
+ return h(i, () => e.children), z(() => p(i, k("flex", n() === "horizontal" ? "flex-row gap-4" : "flex-col gap-2", e.class))), i;
678
678
  })();
679
679
  }
680
- function xe(t) {
681
- const e = G();
680
+ function wt(e) {
681
+ const t = H();
682
682
  return (() => {
683
- var n = ge(), i = n.firstChild, r = i.firstChild, a = i.nextSibling;
683
+ var n = xt(), i = n.firstChild, r = i.firstChild, a = i.nextSibling;
684
684
  return h(i, (() => {
685
- var o = _(() => !!t.icon);
685
+ var o = _(() => !!e.icon);
686
686
  return () => o() && (() => {
687
- var s = me();
688
- return h(s, () => t.icon), s;
687
+ var s = vt();
688
+ return h(s, () => e.icon), s;
689
689
  })();
690
- })(), r), h(r, () => t.label), h(a, () => t.value, null), h(a, (() => {
691
- var o = _(() => !!t.unit);
690
+ })(), r), h(r, () => e.label), h(a, () => e.value, null), h(a, (() => {
691
+ var o = _(() => !!e.unit);
692
692
  return () => o() && (() => {
693
- var s = fe();
694
- return h(s, () => t.unit), s;
693
+ var s = bt();
694
+ return h(s, () => e.unit), s;
695
695
  })();
696
- })(), null), M((o) => {
697
- var s = $("flex flex-col", t.dimmed && "opacity-50", t.class), l = W.S1(e.size()), m = $("flex items-center gap-1 text-foreground/60", j.metricLabel(e.size())), d = $("font-semibold text-foreground", j.metricValue(e.size()));
698
- return s !== o.e && k(n, o.e = s), l !== o.t && C(n, "gap", o.t = l), m !== o.a && k(i, o.a = m), d !== o.o && k(a, o.o = d), o;
696
+ })(), null), z((o) => {
697
+ var s = k("flex flex-col", e.dimmed && "opacity-50", e.class), l = G.S1(t.size()), u = k("flex items-center gap-1 text-foreground/60", P.metricLabel(t.size())), c = k("font-semibold text-foreground", P.metricValue(t.size()));
698
+ return s !== o.e && p(n, o.e = s), l !== o.t && M(n, "gap", o.t = l), u !== o.a && p(i, o.a = u), c !== o.o && p(a, o.o = c), o;
699
699
  }, {
700
700
  e: void 0,
701
701
  t: void 0,
@@ -704,47 +704,47 @@ function xe(t) {
704
704
  }), n;
705
705
  })();
706
706
  }
707
- const $t = he;
708
- $t.Item = xe;
709
- var ve = /* @__PURE__ */ v("<p>");
710
- function be(t) {
711
- const e = G();
707
+ const ke = yt;
708
+ ke.Item = wt;
709
+ var $t = /* @__PURE__ */ y("<p>");
710
+ function kt(e) {
711
+ const t = H();
712
712
  return (() => {
713
- var n = ve();
713
+ var n = $t();
714
714
  return h(n, (() => {
715
- var i = _(() => !!t.isUnavailable);
716
- return () => i() ? "Unavailable" : t.children;
717
- })()), M((i) => {
718
- var r = $("relative font-bold text-foreground", t.dimmed && "opacity-40", j.status(e.size()), t.class), a = F.ACTIONS;
719
- return r !== i.e && k(n, i.e = r), a !== i.t && C(n, "z-index", i.t = a), i;
715
+ var i = _(() => !!e.isUnavailable);
716
+ return () => i() ? "Unavailable" : e.children;
717
+ })()), z((i) => {
718
+ var r = k("relative font-bold text-foreground", e.dimmed && "opacity-40", P.status(t.size()), e.class), a = F.ACTIONS;
719
+ return r !== i.e && p(n, i.e = r), a !== i.t && M(n, "z-index", i.t = a), i;
720
720
  }, {
721
721
  e: void 0,
722
722
  t: void 0
723
723
  }), n;
724
724
  })();
725
725
  }
726
- var ye = /* @__PURE__ */ v("<p>");
727
- function we(t) {
728
- const e = G();
726
+ var pt = /* @__PURE__ */ y("<p>");
727
+ function St(e) {
728
+ const t = H();
729
729
  return (() => {
730
- var n = ye();
731
- return h(n, () => t.children), M(() => k(n, $("truncate font-medium text-foreground/80", t.dimmed && "text-foreground/50", j.subtitle(e.size()), t.class))), n;
730
+ var n = pt();
731
+ return h(n, () => e.children), z(() => p(n, k("truncate font-medium text-foreground/80", e.dimmed && "text-foreground/50", P.subtitle(t.size()), e.class))), n;
732
732
  })();
733
733
  }
734
- var $e = /* @__PURE__ */ v("<div><h3>"), ke = /* @__PURE__ */ v("<span>");
735
- function pe(t) {
736
- const e = G();
734
+ var Ct = /* @__PURE__ */ y("<div><h3>"), Mt = /* @__PURE__ */ y("<span>");
735
+ function zt(e) {
736
+ const t = H();
737
737
  return (() => {
738
- var n = $e(), i = n.firstChild;
739
- return h(i, () => t.children), h(n, (() => {
740
- var r = _(() => t.badge !== void 0 && t.badge > 0);
738
+ var n = Ct(), i = n.firstChild;
739
+ return h(i, () => e.children), h(n, (() => {
740
+ var r = _(() => e.badge !== void 0 && e.badge > 0);
741
741
  return () => r() && (() => {
742
- var a = ke();
743
- return h(a, () => t.badge), M(() => k(a, $("shrink-0 rounded-full bg-foreground/20 px-2 py-0.5 font-medium text-foreground", j.badge(e.size())))), a;
742
+ var a = Mt();
743
+ return h(a, () => e.badge), z(() => p(a, k("shrink-0 rounded-full bg-foreground/20 px-2 py-0.5 font-medium text-foreground", P.badge(t.size())))), a;
744
744
  })();
745
- })(), null), M((r) => {
746
- var a = $("relative flex items-center", t.class), o = W.S1(e.size()), s = F.ACTIONS, l = $("truncate text-foreground/60", j.title(e.size()));
747
- return a !== r.e && k(n, r.e = a), o !== r.t && C(n, "gap", r.t = o), s !== r.a && C(n, "z-index", r.a = s), l !== r.o && k(i, r.o = l), r;
745
+ })(), null), z((r) => {
746
+ var a = k("relative flex items-center", e.class), o = G.S1(t.size()), s = F.ACTIONS, l = k("truncate text-foreground/60", P.title(t.size()));
747
+ return a !== r.e && p(n, r.e = a), o !== r.t && M(n, "gap", r.t = o), s !== r.a && M(n, "z-index", r.a = s), l !== r.o && p(i, r.o = l), r;
748
748
  }, {
749
749
  e: void 0,
750
750
  t: void 0,
@@ -753,15 +753,15 @@ function pe(t) {
753
753
  }), n;
754
754
  })();
755
755
  }
756
- function On(t) {
756
+ function Rn(e) {
757
757
  return {
758
- icon: t.icon,
759
- title: t.title,
760
- message: t.message || `Configure this widget to add ${t.entityType || "an entity"}`
758
+ icon: e.icon,
759
+ title: e.title,
760
+ message: e.message || `Configure this widget to add ${e.entityType || "an entity"}`
761
761
  };
762
762
  }
763
- function Se(t, e = !1) {
764
- if (t.length === 0)
763
+ function Dt(e, t = !1) {
764
+ if (e.length === 0)
765
765
  return {
766
766
  isGroup: !1,
767
767
  state: "unknown",
@@ -774,28 +774,28 @@ function Se(t, e = !1) {
774
774
  totalCount: 0,
775
775
  description: "No entities"
776
776
  };
777
- const n = t.length > 1;
777
+ const n = e.length > 1;
778
778
  if (!n) {
779
- const z = t[0], S = z.state === "on", E = z.attributes?.brightness || 0, I = Math.round(E / 255 * 100);
779
+ const A = e[0], C = A.state === "on", E = A.attributes?.brightness || 0, T = Math.round(E / 255 * 100);
780
780
  return {
781
781
  isGroup: !1,
782
- state: z.state,
783
- isOn: S,
784
- isUnavailable: z.state === "unavailable",
782
+ state: A.state,
783
+ isOn: C,
784
+ isUnavailable: A.state === "unavailable",
785
785
  brightness: E,
786
- brightnessPercent: I,
787
- color: ht(z),
788
- onCount: S ? 1 : 0,
786
+ brightnessPercent: T,
787
+ color: xe(A),
788
+ onCount: C ? 1 : 0,
789
789
  totalCount: 1,
790
- description: S ? "On" : "Off"
790
+ description: C ? "On" : "Off"
791
791
  };
792
792
  }
793
793
  let i = 0, r = 0, a = 0, o = 0, s = 0, l = 0;
794
- const m = [];
795
- for (const z of t)
796
- switch (z.state) {
794
+ const u = [];
795
+ for (const A of e)
796
+ switch (A.state) {
797
797
  case "on":
798
- i++, z.attributes?.brightness !== void 0 && (s += z.attributes.brightness, l++), z.attributes?.rgb_color && m.push(z.attributes.rgb_color);
798
+ i++, A.attributes?.brightness !== void 0 && (s += A.attributes.brightness, l++), A.attributes?.rgb_color && u.push(A.attributes.rgb_color);
799
799
  break;
800
800
  case "off":
801
801
  r++;
@@ -807,32 +807,32 @@ function Se(t, e = !1) {
807
807
  o++;
808
808
  break;
809
809
  }
810
- const d = t.length, x = o === d, p = a + o === d, c = i > 0, u = i === d, b = r === d;
811
- let y, O;
812
- e ? x ? (y = "unavailable", O = !1) : a > 0 || o > 0 ? (y = "unknown", O = !1) : r > 0 ? (y = "off", O = !1) : (y = "on", O = !0) : x ? (y = "unavailable", O = !1) : p ? (y = "unknown", O = !1) : c ? (y = "on", O = !0) : (y = "off", O = !1);
813
- const P = l > 0 ? Math.round(s / l) : 0, w = Math.round(P / 255 * 100);
814
- let N;
815
- if (m.length > 0) {
816
- const z = Math.round(m.reduce((g, R) => g + R[0], 0) / m.length), S = Math.round(m.reduce((g, R) => g + R[1], 0) / m.length), E = Math.round(m.reduce((g, R) => g + R[2], 0) / m.length), I = P / 255;
817
- N = `rgb(${Math.round(z * I)}, ${Math.round(S * I)}, ${Math.round(E * I)})`;
810
+ const c = e.length, b = o === c, S = a + o === c, m = i > 0, v = i === c, W = r === c;
811
+ let O, x;
812
+ t ? b ? (O = "unavailable", x = !1) : a > 0 || o > 0 ? (O = "unknown", x = !1) : r > 0 ? (O = "off", x = !1) : (O = "on", x = !0) : b ? (O = "unavailable", x = !1) : S ? (O = "unknown", x = !1) : m ? (O = "on", x = !0) : (O = "off", x = !1);
813
+ const w = l > 0 ? Math.round(s / l) : 0, f = Math.round(w / 255 * 100);
814
+ let $;
815
+ if (u.length > 0) {
816
+ const A = Math.round(u.reduce((d, R) => d + R[0], 0) / u.length), C = Math.round(u.reduce((d, R) => d + R[1], 0) / u.length), E = Math.round(u.reduce((d, R) => d + R[2], 0) / u.length), T = w / 255;
817
+ $ = `rgb(${Math.round(A * T)}, ${Math.round(C * T)}, ${Math.round(E * T)})`;
818
818
  } else
819
- N = ht(t[0]);
820
- let T;
821
- return u ? T = "All on" : b ? T = "All off" : i > 0 ? T = `${i} of ${d} on` : T = "Off", {
819
+ $ = xe(e[0]);
820
+ let I;
821
+ return v ? I = "All on" : W ? I = "All off" : i > 0 ? I = `${i} of ${c} on` : I = "Off", {
822
822
  isGroup: n,
823
- state: y,
824
- isOn: O,
825
- isUnavailable: y === "unavailable",
826
- brightness: P,
827
- brightnessPercent: w,
828
- color: N,
823
+ state: O,
824
+ isOn: x,
825
+ isUnavailable: O === "unavailable",
826
+ brightness: w,
827
+ brightnessPercent: f,
828
+ color: $,
829
829
  onCount: i,
830
- totalCount: d,
831
- description: T
830
+ totalCount: c,
831
+ description: I
832
832
  };
833
833
  }
834
- function Ce(t, e = "mean", n = !0) {
835
- if (t.length === 0)
834
+ function _t(e, t = "mean", n = !0) {
835
+ if (e.length === 0)
836
836
  return {
837
837
  isGroup: !1,
838
838
  state: "unknown",
@@ -840,43 +840,43 @@ function Ce(t, e = "mean", n = !0) {
840
840
  isUnavailable: !0,
841
841
  description: "No entities"
842
842
  };
843
- const i = t.length > 1;
843
+ const i = e.length > 1;
844
844
  if (!i) {
845
- const c = t[0], u = Number.parseFloat(c.state);
846
- let b = c.state;
847
- return Number.isNaN(u) || (b = Number.isInteger(u) ? u.toString() : u.toFixed(1)), {
845
+ const m = e[0], v = Number.parseFloat(m.state);
846
+ let W = m.state;
847
+ return Number.isNaN(v) || (W = Number.isInteger(v) ? v.toString() : v.toFixed(1)), {
848
848
  isGroup: !1,
849
- state: b,
850
- numericValue: Number.isNaN(u) ? null : u,
851
- isUnavailable: c.state === "unavailable",
852
- unit: c.unitOfMeasurement ?? void 0,
853
- description: b
849
+ state: W,
850
+ numericValue: Number.isNaN(v) ? null : v,
851
+ isUnavailable: m.state === "unavailable",
852
+ unit: m.unitOfMeasurement ?? void 0,
853
+ description: W
854
854
  };
855
855
  }
856
856
  const r = [], a = [];
857
857
  let o = 0, s;
858
- for (const c of t) {
859
- if (!s && c.unitOfMeasurement && (s = c.unitOfMeasurement), c.state === "unavailable") {
858
+ for (const m of e) {
859
+ if (!s && m.unitOfMeasurement && (s = m.unitOfMeasurement), m.state === "unavailable") {
860
860
  o++, a.push({
861
- entityId: c.id,
861
+ entityId: m.id,
862
862
  value: "unavailable",
863
- friendly_name: c.friendlyName
863
+ friendly_name: m.friendlyName
864
864
  });
865
865
  continue;
866
866
  }
867
- const u = Number.parseFloat(c.state);
868
- isNaN(u) ? n || a.push({
869
- entityId: c.id,
870
- value: c.state,
871
- friendly_name: c.friendlyName
872
- }) : (r.push(u), a.push({
873
- entityId: c.id,
874
- value: u,
875
- friendly_name: c.friendlyName
867
+ const v = Number.parseFloat(m.state);
868
+ isNaN(v) ? n || a.push({
869
+ entityId: m.id,
870
+ value: m.state,
871
+ friendly_name: m.friendlyName
872
+ }) : (r.push(v), a.push({
873
+ entityId: m.id,
874
+ value: v,
875
+ friendly_name: m.friendlyName
876
876
  }));
877
877
  }
878
- const l = o === t.length, m = r.length === 0;
879
- if (l || m)
878
+ const l = o === e.length, u = r.length === 0;
879
+ if (l || u)
880
880
  return {
881
881
  isGroup: i,
882
882
  state: l ? "unavailable" : "unknown",
@@ -886,297 +886,297 @@ function Ce(t, e = "mean", n = !0) {
886
886
  description: l ? "Unavailable" : "No numeric values",
887
887
  memberValues: a
888
888
  };
889
- let d, x;
890
- switch (e) {
889
+ let c, b;
890
+ switch (t) {
891
891
  case "min":
892
- d = Math.min(...r), x = "Minimum";
892
+ c = Math.min(...r), b = "Minimum";
893
893
  break;
894
894
  case "max":
895
- d = Math.max(...r), x = "Maximum";
895
+ c = Math.max(...r), b = "Maximum";
896
896
  break;
897
897
  case "mean":
898
- d = r.reduce((c, u) => c + u, 0) / r.length, x = "Average";
898
+ c = r.reduce((m, v) => m + v, 0) / r.length, b = "Average";
899
899
  break;
900
900
  case "median": {
901
- const c = [...r].sort((b, y) => b - y), u = Math.floor(c.length / 2);
902
- d = c.length % 2 === 0 ? (c[u - 1] + c[u]) / 2 : c[u], x = "Median";
901
+ const m = [...r].sort((W, O) => W - O), v = Math.floor(m.length / 2);
902
+ c = m.length % 2 === 0 ? (m[v - 1] + m[v]) / 2 : m[v], b = "Median";
903
903
  break;
904
904
  }
905
905
  case "sum":
906
- d = r.reduce((c, u) => c + u, 0), x = "Sum";
906
+ c = r.reduce((m, v) => m + v, 0), b = "Sum";
907
907
  break;
908
908
  case "last":
909
- d = r[r.length - 1], x = "Latest";
909
+ c = r[r.length - 1], b = "Latest";
910
910
  break;
911
911
  case "range":
912
- d = Math.max(...r) - Math.min(...r), x = "Range";
912
+ c = Math.max(...r) - Math.min(...r), b = "Range";
913
913
  break;
914
914
  case "product":
915
- d = r.reduce((c, u) => c * u, 1), x = "Product";
915
+ c = r.reduce((m, v) => m * v, 1), b = "Product";
916
916
  break;
917
917
  case "std_dev": {
918
- const c = r.reduce((b, y) => b + y, 0) / r.length, u = r.reduce((b, y) => b + (y - c) ** 2, 0) / r.length;
919
- d = Math.sqrt(u), x = "Std Dev";
918
+ const m = r.reduce((W, O) => W + O, 0) / r.length, v = r.reduce((W, O) => W + (O - m) ** 2, 0) / r.length;
919
+ c = Math.sqrt(v), b = "Std Dev";
920
920
  break;
921
921
  }
922
922
  default:
923
- d = r.reduce((c, u) => c + u, 0) / r.length, x = "Average";
923
+ c = r.reduce((m, v) => m + v, 0) / r.length, b = "Average";
924
924
  }
925
- const p = Number.isInteger(d) ? d.toString() : d.toFixed(1);
925
+ const S = Number.isInteger(c) ? c.toString() : c.toFixed(1);
926
926
  return {
927
927
  isGroup: i,
928
- state: p,
929
- numericValue: d,
928
+ state: S,
929
+ numericValue: c,
930
930
  isUnavailable: !1,
931
931
  unit: s,
932
- description: `${x} of ${r.length}`,
932
+ description: `${b} of ${r.length}`,
933
933
  memberValues: a
934
934
  };
935
935
  }
936
- function ht(t) {
937
- if (t.state !== "on") return "rgb(100, 100, 100)";
938
- const n = (t.attributes?.brightness ?? 255) / 255;
939
- if (t.attributes?.rgb_color) {
940
- const [i, r, a] = t.attributes.rgb_color;
936
+ function xe(e) {
937
+ if (e.state !== "on") return "rgb(100, 100, 100)";
938
+ const n = (e.attributes?.brightness ?? 255) / 255;
939
+ if (e.attributes?.rgb_color) {
940
+ const [i, r, a] = e.attributes.rgb_color;
941
941
  return `rgb(${Math.round(i * n)}, ${Math.round(r * n)}, ${Math.round(a * n)})`;
942
942
  }
943
- if (t.attributes?.color_temp) {
944
- const r = 1e6 / t.attributes.color_temp / 100;
943
+ if (e.attributes?.color_temp) {
944
+ const r = 1e6 / e.attributes.color_temp / 100;
945
945
  let a, o, s;
946
946
  return r <= 66 ? (a = 255, o = r <= 19 ? 0 : 99.4708025861 * Math.log(r - 10) - 161.1195681661, s = r <= 19 ? 0 : r <= 66 ? 138.5177312231 * Math.log(r - 10) - 305.0447927307 : 255) : (a = 329.698727446 * (r - 60) ** -0.1332047592, o = 288.1221695283 * (r - 60) ** -0.0755148492, s = 255), a = Math.max(0, Math.min(255, a)) * n, o = Math.max(0, Math.min(255, o)) * n, s = Math.max(0, Math.min(255, s)) * n, `rgb(${Math.round(a)}, ${Math.round(o)}, ${Math.round(s)})`;
947
947
  }
948
948
  return `rgb(${Math.round(255 * n)}, ${Math.round(220 * n)}, ${Math.round(180 * n)})`;
949
949
  }
950
- function Me(t) {
951
- return t ? t.state !== "unavailable" && t.state !== "unknown" : !1;
950
+ function At(e) {
951
+ return e ? e.state !== "unavailable" && e.state !== "unknown" : !1;
952
952
  }
953
- function ze(t) {
954
- if (!t) return !1;
955
- if (["on", "open", "locked", "home", "playing", "active"].includes(t.state))
953
+ function Nt(e) {
954
+ if (!e) return !1;
955
+ if (["on", "open", "locked", "home", "playing", "active"].includes(e.state))
956
956
  return !0;
957
- if (t.domain === "sensor") {
958
- const e = Number.parseFloat(t.state);
959
- return !isNaN(e) && e > 0;
957
+ if (e.domain === "sensor") {
958
+ const t = Number.parseFloat(e.state);
959
+ return !isNaN(t) && t > 0;
960
960
  }
961
961
  return !1;
962
962
  }
963
- function En(t, e = "unknown") {
964
- return t?.state ?? e;
963
+ function Gn(e, t = "unknown") {
964
+ return e?.state ?? t;
965
965
  }
966
- function Vn(t, e, n) {
967
- return t?.attributes ? t.attributes[e] ?? n : n;
966
+ function Hn(e, t, n) {
967
+ return e?.attributes ? e.attributes[t] ?? n : n;
968
968
  }
969
- function Wn(t, e) {
970
- return t.filter((n) => n.state === e).length;
969
+ function Bn(e, t) {
970
+ return e.filter((n) => n.state === t).length;
971
971
  }
972
- function In(t) {
973
- return t.filter(Me).length;
972
+ function Ln(e) {
973
+ return e.filter(At).length;
974
974
  }
975
- function Rn(t) {
976
- return t.filter(ze).length;
975
+ function jn(e) {
976
+ return e.filter(Nt).length;
977
977
  }
978
- function Gn(t, e) {
979
- return t.length > 0 && t.every((n) => n.state === e);
978
+ function Pn(e, t) {
979
+ return e.length > 0 && e.every((n) => n.state === t);
980
980
  }
981
- function Hn(t, e) {
982
- return t.some((n) => n.state === e);
981
+ function Fn(e, t) {
982
+ return e.some((n) => n.state === t);
983
983
  }
984
- function De(t, e, n) {
984
+ function Ot(e, t, n) {
985
985
  const { decimals: i, scale: r = !0 } = n || {};
986
- if (typeof t == "string")
987
- return e ? `${t}${e}` : t;
988
- if (t == null || Number.isNaN(t))
989
- return e ? `--${e}` : "--";
990
- let a = t, o = e || "";
991
- r && e && (e === "W" || e === "kW" || e === "MW") && (t >= 1e6 ? (a = t / 1e6, o = "MW") : t >= 1e3 ? (a = t / 1e3, o = "kW") : o = "W"), r && e && (e === "B" || e === "KB" || e === "MB" || e === "GB") && (t >= 1073741824 ? (a = t / 1073741824, o = "GB") : t >= 1048576 ? (a = t / 1048576, o = "MB") : t >= 1024 ? (a = t / 1024, o = "KB") : o = "B");
986
+ if (typeof e == "string")
987
+ return t ? `${e}${t}` : e;
988
+ if (e == null || Number.isNaN(e))
989
+ return t ? `--${t}` : "--";
990
+ let a = e, o = t || "";
991
+ r && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (a = e / 1e6, o = "MW") : e >= 1e3 ? (a = e / 1e3, o = "kW") : o = "W"), r && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (a = e / 1073741824, o = "GB") : e >= 1048576 ? (a = e / 1048576, o = "MB") : e >= 1024 ? (a = e / 1024, o = "KB") : o = "B");
992
992
  let s;
993
- return i !== void 0 ? s = a.toFixed(i) : a !== t ? s = a.toFixed(1) : Number.isInteger(t) ? s = t.toString() : s = Number.parseFloat(t.toFixed(2)).toString(), o ? `${s}${o}` : s;
993
+ return i !== void 0 ? s = a.toFixed(i) : a !== e ? s = a.toFixed(1) : Number.isInteger(e) ? s = e.toString() : s = Number.parseFloat(e.toFixed(2)).toString(), o ? `${s}${o}` : s;
994
994
  }
995
- function _e(t, e) {
996
- return t == null || isNaN(t) ? null : e === "°C" ? t < 10 ? "Cold" : t < 18 ? "Cool" : t < 24 ? "Comfortable" : t < 28 ? "Warm" : "Hot" : e === "°F" ? t < 50 ? "Cold" : t < 64 ? "Cool" : t < 75 ? "Comfortable" : t < 82 ? "Warm" : "Hot" : e === "%" ? t < 20 ? "Very Low" : t < 40 ? "Low" : t < 60 ? "Medium" : t < 80 ? "High" : "Very High" : e === "ppm" ? t < 400 ? "Excellent" : t < 600 ? "Good" : t < 1e3 ? "Acceptable" : t < 1500 ? "Mediocre" : "Poor" : e === "lx" ? t < 50 ? "Dark" : t < 200 ? "Dim" : t < 500 ? "Moderate" : t < 1e3 ? "Bright" : "Very Bright" : e === "AQI" ? t <= 50 ? "Good" : t <= 100 ? "Moderate" : t <= 150 ? "Unhealthy for Sensitive" : t <= 200 ? "Unhealthy" : t <= 300 ? "Very Unhealthy" : "Hazardous" : e === "dB" ? t < 30 ? "Very Quiet" : t < 50 ? "Quiet" : t < 70 ? "Moderate" : t < 85 ? "Loud" : "Very Loud" : null;
995
+ function Et(e, t) {
996
+ 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;
997
997
  }
998
- var Ae = /* @__PURE__ */ v("<div><div>"), Ne = /* @__PURE__ */ v("<div>");
999
- function Te(t) {
1000
- const e = G();
998
+ var Tt = /* @__PURE__ */ y("<div><div>"), Vt = /* @__PURE__ */ y("<div>");
999
+ function Wt(e) {
1000
+ const t = H();
1001
1001
  return (() => {
1002
- var n = Ae(), i = n.firstChild;
1003
- return h(i, () => De(t.value, t.unit)), h(n, (() => {
1004
- var r = _(() => !!(t.interpret && typeof t.value == "number"));
1002
+ var n = Tt(), i = n.firstChild;
1003
+ return h(i, () => Ot(e.value, e.unit)), h(n, (() => {
1004
+ var r = _(() => !!(e.interpret && typeof e.value == "number"));
1005
1005
  return () => r() && (() => {
1006
- var a = Ne();
1007
- return h(a, () => _e(t.value, t.unit)), M((o) => {
1008
- var s = $("text-foreground/60", j.subtitle(e.size())), l = W.S1(e.size());
1009
- return s !== o.e && k(a, o.e = s), l !== o.t && C(a, "margin-top", o.t = l), o;
1006
+ var a = Vt();
1007
+ return h(a, () => Et(e.value, e.unit)), z((o) => {
1008
+ var s = k("text-foreground/60", P.subtitle(t.size())), l = G.S1(t.size());
1009
+ return s !== o.e && p(a, o.e = s), l !== o.t && M(a, "margin-top", o.t = l), o;
1010
1010
  }, {
1011
1011
  e: void 0,
1012
1012
  t: void 0
1013
1013
  }), a;
1014
1014
  })();
1015
- })(), null), M((r) => {
1016
- var a = $("flex flex-col", t.class), o = $("font-bold text-foreground", j.value(e.size()));
1017
- return a !== r.e && k(n, r.e = a), o !== r.t && k(i, r.t = o), r;
1015
+ })(), null), z((r) => {
1016
+ var a = k("flex flex-col", e.class), o = k("font-bold text-foreground", P.value(t.size()));
1017
+ return a !== r.e && p(n, r.e = a), o !== r.t && p(i, r.t = o), r;
1018
1018
  }, {
1019
1019
  e: void 0,
1020
1020
  t: void 0
1021
1021
  }), n;
1022
1022
  })();
1023
1023
  }
1024
- var Oe = /* @__PURE__ */ v('<div><div><div class="relative h-full w-full">'), Ee = /* @__PURE__ */ v('<div class="pointer-events-none absolute inset-0"><div>'), Ve = /* @__PURE__ */ v('<div class="pointer-events-none absolute inset-0 animate-pulse bg-blue-500/20">'), We = /* @__PURE__ */ v('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), Ie = /* @__PURE__ */ v('<div class="flex items-center justify-center text-white/30">'), Re = /* @__PURE__ */ v('<h3 class="font-semibold text-sm text-white/60">'), Ge = /* @__PURE__ */ v('<p class="text-white/50 text-xs">');
1025
- function He(t, e) {
1026
- const n = t * e;
1024
+ var It = /* @__PURE__ */ y('<div><div><div class="relative h-full w-full">'), Rt = /* @__PURE__ */ y('<div class="pointer-events-none absolute inset-0"><div>'), Gt = /* @__PURE__ */ y('<div class="pointer-events-none absolute inset-0 animate-pulse bg-blue-500/20">'), Ht = /* @__PURE__ */ y('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), Bt = /* @__PURE__ */ y('<div class="flex items-center justify-center text-white/30">'), Lt = /* @__PURE__ */ y('<h3 class="font-semibold text-sm text-white/60">'), jt = /* @__PURE__ */ y('<p class="text-white/50 text-xs">');
1025
+ function Pt(e, t) {
1026
+ const n = e * t;
1027
1027
  return n <= 2 ? "xs" : n <= 4 ? "sm" : n <= 8 ? "md" : n <= 18 ? "lg" : "xl";
1028
1028
  }
1029
- function Be(t, e) {
1030
- return t > e ? "horizontal" : e > t ? "vertical" : "square";
1029
+ function Ft(e, t) {
1030
+ return e > t ? "horizontal" : t > e ? "vertical" : "square";
1031
1031
  }
1032
- function Le(t, e) {
1033
- return e >= 150 ? "vertical" : t > e ? "horizontal" : e > t ? "vertical" : "square";
1032
+ function Ut(e, t) {
1033
+ return t >= 150 ? "vertical" : e > t ? "horizontal" : t > e ? "vertical" : "square";
1034
1034
  }
1035
- function je(t) {
1036
- let e;
1037
- const n = _t(() => e), i = 2, [r, a] = L(0), [o, s] = L(0);
1035
+ function Yt(e) {
1036
+ let t;
1037
+ const n = Ee(() => t), i = 2, [r, a] = j(0), [o, s] = j(0);
1038
1038
  Y(() => {
1039
- const w = Math.round(n.width ?? 0), N = Math.round(n.height ?? 0), T = dt(r), z = dt(o);
1040
- (Math.abs(w - T) > i || Math.abs(N - z) > i) && (a(w), s(N));
1039
+ const f = Math.round(n.width ?? 0), $ = Math.round(n.height ?? 0), I = ge(r), A = ge(o);
1040
+ (Math.abs(f - I) > i || Math.abs($ - A) > i) && (a(f), s($));
1041
1041
  });
1042
- const l = A(() => {
1043
- if (t.variant)
1044
- return typeof t.variant == "string" ? Gt(t.variant) : t.variant;
1045
- }), m = A(() => ({
1042
+ const l = N(() => {
1043
+ if (e.variant)
1044
+ return typeof e.variant == "string" ? je(e.variant) : e.variant;
1045
+ }), u = N(() => ({
1046
1046
  width: r(),
1047
1047
  height: o(),
1048
1048
  gridWidth: Math.max(1, Math.round(r() / 150)),
1049
1049
  gridHeight: Math.max(1, Math.round(o() / 75))
1050
1050
  }), void 0, {
1051
- equals: (w, N) => w.width === N.width && w.height === N.height && w.gridWidth === N.gridWidth && w.gridHeight === N.gridHeight
1052
- }), d = A(() => {
1053
- const w = m();
1054
- return He(w.gridWidth, w.gridHeight);
1055
- }), x = A(() => {
1056
- const w = m();
1057
- return Be(w.width, w.height);
1058
- }), p = A(() => {
1059
- const w = m();
1060
- return Le(w.width, w.height);
1061
- }), c = vt(st), u = c;
1062
- u?._isStub?.() && u._bridge && (Y(() => {
1063
- u._bridge.setSize(d());
1051
+ equals: (f, $) => f.width === $.width && f.height === $.height && f.gridWidth === $.gridWidth && f.gridHeight === $.gridHeight
1052
+ }), c = N(() => {
1053
+ const f = u();
1054
+ return Pt(f.gridWidth, f.gridHeight);
1055
+ }), b = N(() => {
1056
+ const f = u();
1057
+ return Ft(f.width, f.height);
1058
+ }), S = N(() => {
1059
+ const f = u();
1060
+ return Ut(f.width, f.height);
1061
+ }), m = be(se), v = m;
1062
+ v?._isStub?.() && v._bridge && (Y(() => {
1063
+ v._bridge.setSize(c());
1064
1064
  }), Y(() => {
1065
- u._bridge.setOrientation(x());
1065
+ v._bridge.setOrientation(b());
1066
1066
  }), Y(() => {
1067
- u._bridge.setContentLayout(p());
1067
+ v._bridge.setContentLayout(S());
1068
1068
  }), Y(() => {
1069
- u._bridge.setDimensions(m());
1069
+ v._bridge.setDimensions(u());
1070
1070
  }), Y(() => {
1071
- u._bridge.setIsStub(!1);
1071
+ v._bridge.setIsStub(!1);
1072
1072
  }));
1073
- const b = {
1074
- size: d,
1075
- orientation: x,
1076
- contentLayout: p,
1077
- dimensions: m,
1078
- isEditMode: () => t.isEditMode ?? !1,
1079
- updateConfig: c?.updateConfig ?? (() => {
1073
+ const W = {
1074
+ size: c,
1075
+ orientation: b,
1076
+ contentLayout: S,
1077
+ dimensions: u,
1078
+ isEditMode: () => e.isEditMode ?? !1,
1079
+ updateConfig: m?.updateConfig ?? (() => {
1080
1080
  })
1081
- }, y = "bg-gradient-to-br from-gray-500/20 to-gray-600/20", O = A(() => t.emptyState && !t.gradient ? y : t.gradient), P = A(() => ({
1081
+ }, O = "bg-gradient-to-br from-gray-500/20 to-gray-600/20", x = N(() => e.emptyState && !e.gradient ? O : e.gradient), w = N(() => ({
1082
1082
  "container-type": "size",
1083
1083
  "container-name": "widget",
1084
1084
  ...l()?.styles?.container,
1085
1085
  ...l()?.styles?.cssVars || {}
1086
1086
  }));
1087
- return V(st.Provider, {
1088
- value: b,
1087
+ return V(se.Provider, {
1088
+ value: W,
1089
1089
  get children() {
1090
- var w = Oe(), N = w.firstChild, T = N.firstChild, z = e;
1091
- return typeof z == "function" ? Ct(z, w) : e = w, h(N, (() => {
1092
- var S = _(() => !!t.backgroundGlow);
1093
- return () => S() && (() => {
1094
- var E = Ee(), I = E.firstChild;
1095
- return M((g) => {
1096
- var R = F.BACKGROUND, H = $("absolute inset-0 opacity-20 blur-2xl", t.backgroundGlow);
1097
- return R !== g.e && C(E, "z-index", g.e = R), H !== g.t && k(I, g.t = H), g;
1090
+ var f = It(), $ = f.firstChild, I = $.firstChild, A = t;
1091
+ return typeof A == "function" ? _e(A, f) : t = f, h($, (() => {
1092
+ var C = _(() => !!e.backgroundGlow);
1093
+ return () => C() && (() => {
1094
+ var E = Rt(), T = E.firstChild;
1095
+ return z((d) => {
1096
+ var R = F.BACKGROUND, B = k("absolute inset-0 opacity-20 blur-2xl", e.backgroundGlow);
1097
+ return R !== d.e && M(E, "z-index", d.e = R), B !== d.t && p(T, d.t = B), d;
1098
1098
  }, {
1099
1099
  e: void 0,
1100
1100
  t: void 0
1101
1101
  }), E;
1102
1102
  })();
1103
- })(), T), h(T, (() => {
1104
- var S = _(() => !!t.emptyState);
1105
- return () => S() ? V(Pe, {
1103
+ })(), I), h(I, (() => {
1104
+ var C = _(() => !!e.emptyState);
1105
+ return () => C() ? V(Xt, {
1106
1106
  get icon() {
1107
- return t.emptyState.icon;
1107
+ return e.emptyState.icon;
1108
1108
  },
1109
1109
  get title() {
1110
- return t.emptyState.title;
1110
+ return e.emptyState.title;
1111
1111
  },
1112
1112
  get message() {
1113
- return t.emptyState.message;
1113
+ return e.emptyState.message;
1114
1114
  }
1115
- }) : t.children;
1116
- })()), h(N, (() => {
1117
- var S = _(() => !!t.loading);
1118
- return () => S() && (() => {
1119
- var E = Ve();
1120
- return M((I) => C(E, "z-index", F.OVERLAY)), E;
1115
+ }) : e.children;
1116
+ })()), h($, (() => {
1117
+ var C = _(() => !!e.loading);
1118
+ return () => C() && (() => {
1119
+ var E = Gt();
1120
+ return z((T) => M(E, "z-index", F.OVERLAY)), E;
1121
1121
  })();
1122
- })(), null), M((S) => {
1123
- var E = $(
1122
+ })(), null), z((C) => {
1123
+ var E = k(
1124
1124
  "relative h-full w-full select-none rounded-xl border border-border/50",
1125
1125
  // Variant styles (lowest priority)
1126
1126
  l()?.styles?.class,
1127
1127
  // Custom class (highest priority)
1128
- t.class
1129
- ), I = P(), g = $(
1128
+ e.class
1129
+ ), T = w(), d = k(
1130
1130
  "relative h-full w-full overflow-hidden rounded-xl",
1131
1131
  // Gradient prop (overrides variant, auto-applied for empty state)
1132
- O()
1132
+ x()
1133
1133
  ), R = F.CONTENT;
1134
- return E !== S.e && k(w, S.e = E), S.t = et(w, I, S.t), g !== S.a && k(N, S.a = g), R !== S.o && C(T, "z-index", S.o = R), S;
1134
+ return E !== C.e && p(f, C.e = E), C.t = te(f, T, C.t), d !== C.a && p($, C.a = d), R !== C.o && M(I, "z-index", C.o = R), C;
1135
1135
  }, {
1136
1136
  e: void 0,
1137
1137
  t: void 0,
1138
1138
  a: void 0,
1139
1139
  o: void 0
1140
- }), w;
1140
+ }), f;
1141
1141
  }
1142
1142
  });
1143
1143
  }
1144
- function Pe(t) {
1144
+ function Xt(e) {
1145
1145
  return (() => {
1146
- var e = We();
1147
- return h(e, (() => {
1148
- var n = _(() => !!t.icon);
1146
+ var t = Ht();
1147
+ return h(t, (() => {
1148
+ var n = _(() => !!e.icon);
1149
1149
  return () => n() && (() => {
1150
- var i = Ie();
1151
- return h(i, () => t.icon), i;
1150
+ var i = Bt();
1151
+ return h(i, () => e.icon), i;
1152
1152
  })();
1153
- })(), null), h(e, (() => {
1154
- var n = _(() => !!t.title);
1153
+ })(), null), h(t, (() => {
1154
+ var n = _(() => !!e.title);
1155
1155
  return () => n() && (() => {
1156
- var i = Re();
1157
- return h(i, () => t.title), i;
1156
+ var i = Lt();
1157
+ return h(i, () => e.title), i;
1158
1158
  })();
1159
- })(), null), h(e, (() => {
1160
- var n = _(() => !!t.message);
1159
+ })(), null), h(t, (() => {
1160
+ var n = _(() => !!e.message);
1161
1161
  return () => n() && (() => {
1162
- var i = Ge();
1163
- return h(i, () => t.message), i;
1162
+ var i = jt();
1163
+ return h(i, () => e.message), i;
1164
1164
  })();
1165
- })(), null), e;
1165
+ })(), null), t;
1166
1166
  })();
1167
1167
  }
1168
- const U = je;
1169
- U.Content = Jt;
1170
- U.Icon = ue;
1171
- U.Title = pe;
1172
- U.Subtitle = we;
1173
- U.Status = be;
1174
- U.Value = Te;
1175
- U.Metrics = $t;
1176
- U.EmptyState = re;
1177
- U.SliderFill = Yt;
1178
- var Fe = /* @__PURE__ */ v("<div><div>");
1179
- const Ue = {
1168
+ const U = Yt;
1169
+ U.Content = tt;
1170
+ U.Icon = ft;
1171
+ U.Title = zt;
1172
+ U.Subtitle = St;
1173
+ U.Status = kt;
1174
+ U.Value = Wt;
1175
+ U.Metrics = ke;
1176
+ U.EmptyState = st;
1177
+ U.SliderFill = Je;
1178
+ var Kt = /* @__PURE__ */ y("<div><div>");
1179
+ const qt = {
1180
1180
  blue: "bg-blue-500/30",
1181
1181
  green: "bg-green-500/30",
1182
1182
  red: "bg-red-500/30",
@@ -1184,13 +1184,13 @@ const Ue = {
1184
1184
  purple: "bg-purple-500/30",
1185
1185
  gray: "bg-gray-500/30"
1186
1186
  };
1187
- function Bn(t) {
1188
- const e = () => Ue[t.color] ?? t.color;
1187
+ function Un(e) {
1188
+ const t = () => qt[e.color] ?? e.color;
1189
1189
  return (() => {
1190
- var n = Fe(), i = n.firstChild;
1191
- return M((r) => {
1192
- var a = $("pointer-events-none absolute inset-0", t.class), o = F.BACKGROUND, s = $("absolute inset-0 opacity-40 blur-3xl", e());
1193
- return a !== r.e && k(n, r.e = a), o !== r.t && C(n, "z-index", r.t = o), s !== r.a && k(i, r.a = s), r;
1190
+ var n = Kt(), i = n.firstChild;
1191
+ return z((r) => {
1192
+ var a = k("pointer-events-none absolute inset-0", e.class), o = F.BACKGROUND, s = k("absolute inset-0 opacity-40 blur-3xl", t());
1193
+ return a !== r.e && p(n, r.e = a), o !== r.t && M(n, "z-index", r.t = o), s !== r.a && p(i, r.a = s), r;
1194
1194
  }, {
1195
1195
  e: void 0,
1196
1196
  t: void 0,
@@ -1198,55 +1198,55 @@ function Bn(t) {
1198
1198
  }), n;
1199
1199
  })();
1200
1200
  }
1201
- var Ye = /* @__PURE__ */ v("<div>");
1202
- function Ln(t) {
1203
- const e = G(), n = () => {
1204
- const i = t.spacing ?? "S2";
1205
- return W[i](e.size());
1201
+ var Jt = /* @__PURE__ */ y("<div>");
1202
+ function Yn(e) {
1203
+ const t = H(), n = () => {
1204
+ const i = e.spacing ?? "S2";
1205
+ return G[i](t.size());
1206
1206
  };
1207
1207
  return (() => {
1208
- var i = Ye();
1209
- return h(i, () => t.children), M((r) => {
1210
- var a = $("flex flex-col", t.class), o = n();
1211
- return a !== r.e && k(i, r.e = a), o !== r.t && C(i, "gap", r.t = o), r;
1208
+ var i = Jt();
1209
+ return h(i, () => e.children), z((r) => {
1210
+ var a = k("flex flex-col", e.class), o = n();
1211
+ return a !== r.e && p(i, r.e = a), o !== r.t && M(i, "gap", r.t = o), r;
1212
1212
  }, {
1213
1213
  e: void 0,
1214
1214
  t: void 0
1215
1215
  }), i;
1216
1216
  })();
1217
1217
  }
1218
- var Xe = /* @__PURE__ */ v('<span class="inline-flex size-3.5 shrink-0 items-center">'), Ke = /* @__PURE__ */ v("<button type=button>"), qe = /* @__PURE__ */ v('<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">'), Je = /* @__PURE__ */ v('<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'), Ze = /* @__PURE__ */ v('<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>'), Qe = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), tn = /* @__PURE__ */ v('<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">'), en = /* @__PURE__ */ v('<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'), nn = /* @__PURE__ */ v('<div class="min-w-0 shrink-0">'), rn = /* @__PURE__ */ v('<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">'), an = /* @__PURE__ */ v('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), on = /* @__PURE__ */ v('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
1219
- function sn(t) {
1218
+ var Zt = /* @__PURE__ */ y('<span class="inline-flex size-3.5 shrink-0 items-center">'), Qt = /* @__PURE__ */ y("<button type=button>"), en = /* @__PURE__ */ y('<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">'), tn = /* @__PURE__ */ y('<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'), nn = /* @__PURE__ */ y('<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>'), rn = /* @__PURE__ */ y('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), an = /* @__PURE__ */ y('<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">'), on = /* @__PURE__ */ y('<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'), sn = /* @__PURE__ */ y('<div class="min-w-0 shrink-0">'), ln = /* @__PURE__ */ y('<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">'), cn = /* @__PURE__ */ y('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), un = /* @__PURE__ */ y('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
1219
+ function dn(e) {
1220
1220
  return (() => {
1221
- var e = Ke();
1222
- return e.$$click = () => t.onClick(), h(e, V(J, {
1221
+ var t = Qt();
1222
+ return t.$$click = () => e.onClick(), h(t, V(J, {
1223
1223
  get when() {
1224
- return t.isActive;
1224
+ return e.isActive;
1225
1225
  },
1226
1226
  get children() {
1227
- var n = Xe();
1228
- return h(n, () => t.icon), n;
1227
+ var n = Zt();
1228
+ return h(n, () => e.icon), n;
1229
1229
  }
1230
- }), null), h(e, () => t.label, null), M(() => k(e, $("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", t.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"))), e;
1230
+ }), null), h(t, () => e.label, null), z(() => p(t, k("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;
1231
1231
  })();
1232
1232
  }
1233
- function jn(t) {
1234
- const [e] = St(t, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), n = () => !!e.configSchema && !!e.config && !!e.onConfigSave && !!e.SchemaForm, [i, r] = L({}), [a, o] = L(null);
1235
- Y(gt(() => e.config, (g) => {
1236
- g && r({
1237
- ...g
1233
+ function Xn(e) {
1234
+ const [t] = De(e, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [i, r] = j({}), [a, o] = j(null);
1235
+ Y(me(() => t.config, (d) => {
1236
+ d && r({
1237
+ ...d
1238
1238
  });
1239
- })), Y(gt(() => e.configSchema, (g) => {
1240
- g && o(bt(g));
1239
+ })), Y(me(() => t.configSchema, (d) => {
1240
+ d && o(ye(d));
1241
1241
  }));
1242
- const s = () => n() && JSON.stringify(i()) !== JSON.stringify(e.config), l = (g) => {
1243
- !g && e.config && r({
1244
- ...e.config
1245
- }), e.onOpenChange(g);
1246
- }, m = () => {
1247
- e.onConfigSave?.(i());
1248
- }, [d, x] = L(e.defaultTab ?? "controls"), p = () => {
1249
- const g = e.maxWidth ?? "3xl";
1242
+ const s = () => n() && JSON.stringify(i()) !== JSON.stringify(t.config), l = (d) => {
1243
+ !d && t.config && r({
1244
+ ...t.config
1245
+ }), t.onOpenChange(d);
1246
+ }, u = () => {
1247
+ t.onConfigSave?.(i());
1248
+ }, [c, b] = j(t.defaultTab ?? "controls"), S = () => {
1249
+ const d = t.maxWidth ?? "3xl";
1250
1250
  return {
1251
1251
  sm: "max-w-sm",
1252
1252
  md: "max-w-md",
@@ -1255,15 +1255,15 @@ function jn(t) {
1255
1255
  "2xl": "max-w-2xl",
1256
1256
  "3xl": "max-w-3xl",
1257
1257
  "4xl": "max-w-4xl"
1258
- }[g];
1259
- }, c = () => {
1260
- if (e.tabs) return e.tabs;
1261
- const g = [];
1262
- return g.push({
1258
+ }[d];
1259
+ }, m = () => {
1260
+ if (t.tabs) return t.tabs;
1261
+ const d = [];
1262
+ return d.push({
1263
1263
  id: "edit",
1264
1264
  label: "Edit",
1265
- icon: qe(),
1266
- content: e.editContent ?? (n() && a() ? V(z, {
1265
+ icon: en(),
1266
+ content: t.editContent ?? (n() && a() ? V(A, {
1267
1267
  get schema() {
1268
1268
  return a();
1269
1269
  },
@@ -1271,125 +1271,125 @@ function jn(t) {
1271
1271
  return i();
1272
1272
  },
1273
1273
  onChange: r
1274
- }) : Je())
1275
- }), g.push({
1274
+ }) : tn())
1275
+ }), d.push({
1276
1276
  id: "controls",
1277
1277
  label: "Controls",
1278
- icon: Ze(),
1279
- content: e.controlsContent ?? Qe()
1280
- }), g.push({
1278
+ icon: nn(),
1279
+ content: t.controlsContent ?? rn()
1280
+ }), d.push({
1281
1281
  id: "debug",
1282
1282
  label: "Debug",
1283
- icon: tn(),
1284
- content: e.debugContent ?? en()
1285
- }), g;
1286
- }, u = async () => {
1287
- if (e.debugData !== void 0)
1283
+ icon: an(),
1284
+ content: t.debugContent ?? on()
1285
+ }), d;
1286
+ }, v = async () => {
1287
+ if (t.debugData !== void 0)
1288
1288
  try {
1289
- const g = typeof e.debugData == "string" ? e.debugData : JSON.stringify(e.debugData, null, 2);
1290
- await navigator.clipboard.writeText(g);
1289
+ const d = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
1290
+ await navigator.clipboard.writeText(d);
1291
1291
  } catch {
1292
1292
  }
1293
- }, b = () => {
1294
- const g = c();
1295
- return g.find((H) => H.id === d())?.content ?? g[0]?.content;
1296
- }, y = e.ResponsiveDialog, O = e.ResponsiveDialogContent, P = e.ResponsiveDialogHeader, w = e.ResponsiveDialogTitle, N = e.ResponsiveDialogDescription, T = e.Button, z = e.SchemaForm, S = (g) => n() ? l(g) : e.onOpenChange(g), E = () => n() ? s() : e.hasUnsavedChanges, I = () => n() ? m : e.onSave;
1297
- return V(y, {
1293
+ }, W = () => {
1294
+ const d = m();
1295
+ return d.find((B) => B.id === c())?.content ?? d[0]?.content;
1296
+ }, O = t.ResponsiveDialog, x = t.ResponsiveDialogContent, w = t.ResponsiveDialogHeader, f = t.ResponsiveDialogTitle, $ = t.ResponsiveDialogDescription, I = t.Button, A = t.SchemaForm, C = (d) => n() ? l(d) : t.onOpenChange(d), E = () => n() ? s() : t.hasUnsavedChanges, T = () => n() ? u : t.onSave;
1297
+ return V(O, {
1298
1298
  get open() {
1299
- return e.open;
1299
+ return t.open;
1300
1300
  },
1301
- onOpenChange: (g) => S(g),
1301
+ onOpenChange: (d) => C(d),
1302
1302
  get children() {
1303
- return V(O, {
1303
+ return V(x, {
1304
1304
  get class() {
1305
- return $(p(), e.class);
1305
+ return k(S(), t.class);
1306
1306
  },
1307
1307
  get children() {
1308
- return [V(P, {
1308
+ return [V(w, {
1309
1309
  class: "flex flex-row items-center justify-between gap-3",
1310
1310
  get children() {
1311
1311
  return [(() => {
1312
- var g = nn();
1313
- return h(g, V(w, {
1312
+ var d = sn();
1313
+ return h(d, V(f, {
1314
1314
  class: "truncate leading-tight",
1315
1315
  get children() {
1316
- return e.title;
1316
+ return t.title;
1317
1317
  }
1318
- }), null), h(g, V(N, {
1318
+ }), null), h(d, V($, {
1319
1319
  class: "sr-only",
1320
1320
  children: "Widget configuration dialog"
1321
- }), null), g;
1321
+ }), null), d;
1322
1322
  })(), (() => {
1323
- var g = rn(), R = g.firstChild;
1324
- return h(R, () => c().map((H) => V(sn, {
1323
+ var d = ln(), R = d.firstChild;
1324
+ return h(R, () => m().map((B) => V(dn, {
1325
1325
  get icon() {
1326
- return H.icon;
1326
+ return B.icon;
1327
1327
  },
1328
1328
  get label() {
1329
- return H.label;
1329
+ return B.label;
1330
1330
  },
1331
1331
  get isActive() {
1332
- return d() === H.id;
1332
+ return c() === B.id;
1333
1333
  },
1334
- onClick: () => x(H.id)
1335
- }))), h(g, V(J, {
1334
+ onClick: () => b(B.id)
1335
+ }))), h(d, V(J, {
1336
1336
  get when() {
1337
- return e.headerActions;
1337
+ return t.headerActions;
1338
1338
  },
1339
1339
  get children() {
1340
- return e.headerActions;
1340
+ return t.headerActions;
1341
1341
  }
1342
- }), null), g;
1342
+ }), null), d;
1343
1343
  })()];
1344
1344
  }
1345
1345
  }), (() => {
1346
- var g = an();
1347
- return h(g, b), g;
1346
+ var d = cn();
1347
+ return h(d, W), d;
1348
1348
  })(), V(J, {
1349
1349
  get when() {
1350
- return _(() => d() === "edit")() && (I() || e.onDelete) || d() === "debug" && e.debugData !== void 0;
1350
+ return _(() => c() === "edit")() && (T() || t.onDelete) || c() === "debug" && t.debugData !== void 0;
1351
1351
  },
1352
1352
  get children() {
1353
- var g = on();
1354
- return h(g, V(J, {
1353
+ var d = un();
1354
+ return h(d, V(J, {
1355
1355
  get when() {
1356
- return _(() => d() === "edit")() && e.onDelete;
1356
+ return _(() => c() === "edit")() && t.onDelete;
1357
1357
  },
1358
1358
  get children() {
1359
- return V(T, {
1359
+ return V(I, {
1360
1360
  size: "sm",
1361
1361
  variant: "destructive",
1362
- onClick: () => e.onDelete?.(),
1362
+ onClick: () => t.onDelete?.(),
1363
1363
  children: "Delete"
1364
1364
  });
1365
1365
  }
1366
- }), null), h(g, V(J, {
1366
+ }), null), h(d, V(J, {
1367
1367
  get when() {
1368
- return _(() => d() === "edit")() && I();
1368
+ return _(() => c() === "edit")() && T();
1369
1369
  },
1370
1370
  get children() {
1371
- return V(T, {
1371
+ return V(I, {
1372
1372
  size: "sm",
1373
1373
  get disabled() {
1374
1374
  return !E();
1375
1375
  },
1376
- onClick: () => I()?.(),
1376
+ onClick: () => T()?.(),
1377
1377
  children: "Save"
1378
1378
  });
1379
1379
  }
1380
- }), null), h(g, V(J, {
1380
+ }), null), h(d, V(J, {
1381
1381
  get when() {
1382
- return _(() => d() === "debug")() && e.debugData !== void 0;
1382
+ return _(() => c() === "debug")() && t.debugData !== void 0;
1383
1383
  },
1384
1384
  get children() {
1385
- return V(T, {
1385
+ return V(I, {
1386
1386
  size: "sm",
1387
1387
  variant: "outline",
1388
- onClick: u,
1388
+ onClick: v,
1389
1389
  children: "Copy"
1390
1390
  });
1391
1391
  }
1392
- }), null), g;
1392
+ }), null), d;
1393
1393
  }
1394
1394
  })];
1395
1395
  }
@@ -1397,80 +1397,80 @@ function jn(t) {
1397
1397
  }
1398
1398
  });
1399
1399
  }
1400
- Mt(["click"]);
1401
- const Q = 32, f = Q / 2, B = "white", nt = "rgba(0,0,0,0.4)", ut = 2, rt = 3;
1402
- function ln(t) {
1403
- return `url("data:image/svg+xml,${encodeURIComponent(t)}")`;
1400
+ Ae(["click"]);
1401
+ const Q = 32, g = Q / 2, L = "white", ne = "rgba(0,0,0,0.4)", ue = 2, re = 3;
1402
+ function gn(e) {
1403
+ return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
1404
1404
  }
1405
- function it(t) {
1406
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}">${t}</svg>`;
1405
+ function ie(e) {
1406
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}">${e}</svg>`;
1407
1407
  }
1408
- const cn = it(`
1408
+ const mn = ie(`
1409
1409
  <g transform="translate(6, 2)">
1410
1410
  <!-- shadow -->
1411
- <g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1411
+ <g stroke="${ne}" stroke-width="${re}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1412
1412
  <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"/>
1413
1413
  </g>
1414
1414
  <!-- main -->
1415
- <g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1415
+ <g stroke="${L}" stroke-width="${ue}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1416
1416
  <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"/>
1417
1417
  </g>
1418
1418
  </g>
1419
- `), un = it(`
1419
+ `), fn = ie(`
1420
1420
  <g>
1421
- <circle cx="${f}" cy="${f}" r="8" stroke="${nt}" stroke-width="${rt}" fill="none"/>
1422
- <circle cx="${f}" cy="${f}" r="8" stroke="${B}" stroke-width="1.5" fill="none"/>
1423
- <circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
1421
+ <circle cx="${g}" cy="${g}" r="8" stroke="${ne}" stroke-width="${re}" fill="none"/>
1422
+ <circle cx="${g}" cy="${g}" r="8" stroke="${L}" stroke-width="1.5" fill="none"/>
1423
+ <circle cx="${g}" cy="${g}" r="1.5" fill="${L}"/>
1424
1424
  </g>
1425
- `), dn = it(`
1425
+ `), hn = ie(`
1426
1426
  <g>
1427
1427
  <!-- shadow -->
1428
- <g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1429
- <line x1="6" y1="${f}" x2="26" y2="${f}"/>
1430
- <polyline points="10,${f - 4} 6,${f} 10,${f + 4}"/>
1431
- <polyline points="22,${f - 4} 26,${f} 22,${f + 4}"/>
1428
+ <g stroke="${ne}" stroke-width="${re}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1429
+ <line x1="6" y1="${g}" x2="26" y2="${g}"/>
1430
+ <polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
1431
+ <polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
1432
1432
  </g>
1433
1433
  <!-- main -->
1434
- <g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1435
- <line x1="6" y1="${f}" x2="26" y2="${f}"/>
1436
- <polyline points="10,${f - 4} 6,${f} 10,${f + 4}"/>
1437
- <polyline points="22,${f - 4} 26,${f} 22,${f + 4}"/>
1434
+ <g stroke="${L}" stroke-width="${ue}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1435
+ <line x1="6" y1="${g}" x2="26" y2="${g}"/>
1436
+ <polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
1437
+ <polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
1438
1438
  </g>
1439
1439
  <!-- center grip dots -->
1440
- <circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
1441
- <circle cx="${f - 5}" cy="${f}" r="1" fill="${B}" opacity="0.6"/>
1442
- <circle cx="${f + 5}" cy="${f}" r="1" fill="${B}" opacity="0.6"/>
1440
+ <circle cx="${g}" cy="${g}" r="1.5" fill="${L}"/>
1441
+ <circle cx="${g - 5}" cy="${g}" r="1" fill="${L}" opacity="0.6"/>
1442
+ <circle cx="${g + 5}" cy="${g}" r="1" fill="${L}" opacity="0.6"/>
1443
1443
  </g>
1444
- `), gn = it(`
1444
+ `), xn = ie(`
1445
1445
  <g>
1446
1446
  <!-- shadow -->
1447
- <g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1448
- <line x1="${f}" y1="6" x2="${f}" y2="26"/>
1449
- <polyline points="${f - 4},10 ${f},6 ${f + 4},10"/>
1450
- <polyline points="${f - 4},22 ${f},26 ${f + 4},22"/>
1447
+ <g stroke="${ne}" stroke-width="${re}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1448
+ <line x1="${g}" y1="6" x2="${g}" y2="26"/>
1449
+ <polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
1450
+ <polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
1451
1451
  </g>
1452
1452
  <!-- main -->
1453
- <g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1454
- <line x1="${f}" y1="6" x2="${f}" y2="26"/>
1455
- <polyline points="${f - 4},10 ${f},6 ${f + 4},10"/>
1456
- <polyline points="${f - 4},22 ${f},26 ${f + 4},22"/>
1453
+ <g stroke="${L}" stroke-width="${ue}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1454
+ <line x1="${g}" y1="6" x2="${g}" y2="26"/>
1455
+ <polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
1456
+ <polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
1457
1457
  </g>
1458
1458
  <!-- center grip dots -->
1459
- <circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
1460
- <circle cx="${f}" cy="${f - 5}" r="1" fill="${B}" opacity="0.6"/>
1461
- <circle cx="${f}" cy="${f + 5}" r="1" fill="${B}" opacity="0.6"/>
1459
+ <circle cx="${g}" cy="${g}" r="1.5" fill="${L}"/>
1460
+ <circle cx="${g}" cy="${g - 5}" r="1" fill="${L}" opacity="0.6"/>
1461
+ <circle cx="${g}" cy="${g + 5}" r="1" fill="${L}" opacity="0.6"/>
1462
1462
  </g>
1463
1463
  `);
1464
- function tt(t, e, n) {
1465
- return { css: `${ln(t)} ${e} ${n}, auto`, hotspotX: e, hotspotY: n };
1464
+ function ee(e, t, n) {
1465
+ return { css: `${gn(e)} ${t} ${n}, auto`, hotspotX: t, hotspotY: n };
1466
1466
  }
1467
1467
  const K = {
1468
- tap: tt(cn, 12, 4),
1469
- hold: tt(un, 16, 16),
1470
- slideHorizontal: tt(dn, f, f),
1471
- slideVertical: tt(gn, f, f)
1468
+ tap: ee(mn, 12, 4),
1469
+ hold: ee(fn, 16, 16),
1470
+ slideHorizontal: ee(hn, g, g),
1471
+ slideVertical: ee(xn, g, g)
1472
1472
  };
1473
- function Pn(t, e) {
1473
+ function Kn(e, t) {
1474
1474
  const n = {
1475
1475
  isDown: !1,
1476
1476
  startX: 0,
@@ -1484,132 +1484,136 @@ function Pn(t, e) {
1484
1484
  slideActivationTimer: null,
1485
1485
  lockedAxis: null,
1486
1486
  element: null
1487
- }, i = 10, r = 5, a = () => {
1487
+ };
1488
+ let i = null, r = null, a = null;
1489
+ function o(x) {
1490
+ x !== r && (a && a.disconnect(), a = new ResizeObserver((w) => {
1491
+ const f = w[0];
1492
+ if (f) {
1493
+ const $ = f.borderBoxSize?.[0];
1494
+ $ ? i = { width: $.inlineSize, height: $.blockSize } : i = { width: f.contentRect.width, height: f.contentRect.height };
1495
+ }
1496
+ }), r = x, a.observe(x), i = { width: x.clientWidth, height: x.clientHeight });
1497
+ }
1498
+ const s = 10, l = 5, u = () => {
1488
1499
  n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null), n.slideActivationTimer && (clearTimeout(n.slideActivationTimer), n.slideActivationTimer = null);
1489
- }, o = (c) => {
1490
- const b = t().slide;
1491
- if (b?.orientation === "horizontal") return "horizontal";
1492
- if (b?.orientation === "vertical") return "vertical";
1493
- if (c) {
1494
- const O = c.getBoundingClientRect();
1495
- return O.height > O.width ? "vertical" : "horizontal";
1496
- }
1497
- return (e?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
1498
- }, s = (c) => {
1499
- const u = t();
1500
- if (!(!u.tap && !u.hold && !u.slide)) {
1501
- if (c.preventDefault(), n.isDown = !0, n.element = c.currentTarget, n.startX = c.clientX, n.startY = c.clientY, n.currentX = c.clientX, n.currentY = c.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, c.currentTarget.setPointerCapture(c.pointerId), u.hold) {
1502
- const b = u.hold.delay ?? 300;
1500
+ }, c = (x) => {
1501
+ const f = e().slide;
1502
+ return f?.orientation === "horizontal" ? "horizontal" : f?.orientation === "vertical" ? "vertical" : x && (i || o(x), i) ? i.height > i.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
1503
+ }, b = (x) => {
1504
+ const w = e();
1505
+ if (!(!w.tap && !w.hold && !w.slide)) {
1506
+ if (x.preventDefault(), n.isDown = !0, n.element = x.currentTarget, o(n.element), n.startX = x.clientX, n.startY = x.clientY, n.currentX = x.clientX, n.currentY = x.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, x.currentTarget.setPointerCapture(x.pointerId), w.hold) {
1507
+ const f = w.hold.delay ?? 300;
1503
1508
  n.holdTimer = setTimeout(() => {
1504
- n.isDown && !n.hasMoved && (u.hold.action(), n.isDown = !1);
1505
- }, b);
1509
+ n.isDown && !n.hasMoved && (w.hold.action(), n.isDown = !1);
1510
+ }, f);
1506
1511
  }
1507
- if (u.slide) {
1508
- const b = u.slide.activationDelay ?? 0;
1509
- b > 0 ? n.slideActivationTimer = setTimeout(() => {
1512
+ if (w.slide) {
1513
+ const f = w.slide.activationDelay ?? 0;
1514
+ f > 0 ? n.slideActivationTimer = setTimeout(() => {
1510
1515
  n.slideActive = !0;
1511
- }, b) : n.slideActive = !0;
1516
+ }, f) : n.slideActive = !0;
1512
1517
  }
1513
1518
  }
1514
- }, l = (c) => {
1519
+ }, S = (x) => {
1515
1520
  if (!n.isDown) return;
1516
- const u = t();
1517
- n.currentX = c.clientX, n.currentY = c.clientY;
1518
- const b = n.currentX - n.startX, y = n.currentY - n.startY, O = Math.abs(b), P = Math.abs(y), w = Math.sqrt(b * b + y * y), N = c.currentTarget, T = o(N);
1519
- if (!n.lockedAxis && w > r && (O > P ? n.lockedAxis = "horizontal" : n.lockedAxis = "vertical", u.slide && n.lockedAxis !== T)) {
1520
- N.releasePointerCapture(c.pointerId), n.isDown = !1, n.slideActive = !1, a();
1521
+ const w = e();
1522
+ n.currentX = x.clientX, n.currentY = x.clientY;
1523
+ const f = n.currentX - n.startX, $ = n.currentY - n.startY, I = Math.abs(f), A = Math.abs($), C = Math.sqrt(f * f + $ * $), E = x.currentTarget, T = c(E);
1524
+ if (!n.lockedAxis && C > l && (I > A ? n.lockedAxis = "horizontal" : n.lockedAxis = "vertical", w.slide && n.lockedAxis !== T)) {
1525
+ E.releasePointerCapture(x.pointerId), n.isDown = !1, n.slideActive = !1, u();
1521
1526
  return;
1522
1527
  }
1523
- if (w > i && (n.hasMoved = !0, a()), u.slide && n.slideActive && n.hasMoved && n.lockedAxis === T) {
1524
- const z = u.slide.min ?? 0, S = u.slide.max ?? 100, E = S - z, I = T === "vertical" ? -y : b, g = T === "vertical" ? c.currentTarget.clientHeight : c.currentTarget.clientWidth, H = I / g * E, kt = Math.max(z, Math.min(S, u.slide.value + H));
1525
- u.slide.onChange(Math.round(kt)), n.startX = n.currentX, n.startY = n.currentY, c.preventDefault();
1528
+ if (C > s && (n.hasMoved = !0, u()), w.slide && n.slideActive && n.hasMoved && n.lockedAxis === T) {
1529
+ const d = w.slide.min ?? 0, R = w.slide.max ?? 100, B = R - d, pe = T === "vertical" ? -$ : f, de = i ?? { width: E.clientWidth, height: E.clientHeight }, Se = T === "vertical" ? de.height : de.width, Ce = pe / Se * B, Me = Math.max(d, Math.min(R, w.slide.value + Ce));
1530
+ w.slide.onChange(Math.round(Me)), n.startX = n.currentX, n.startY = n.currentY, x.preventDefault();
1526
1531
  }
1527
- }, m = (c) => {
1532
+ }, m = (x) => {
1528
1533
  if (!n.isDown) return;
1529
- const u = t(), b = u.hold?.delay ?? 300;
1530
- if (a(), u.tap && !n.hasMoved) {
1531
- const y = Date.now() - n.startTime;
1532
- n.isDown && y < b && u.tap();
1534
+ const w = e(), f = w.hold?.delay ?? 300;
1535
+ if (u(), w.tap && !n.hasMoved) {
1536
+ const $ = Date.now() - n.startTime;
1537
+ n.isDown && $ < f && w.tap();
1533
1538
  }
1534
- n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, c.currentTarget.releasePointerCapture(c.pointerId);
1535
- }, d = (c) => {
1536
- a(), n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, c.currentTarget.releasePointerCapture(c.pointerId);
1537
- }, x = (c) => {
1538
- const u = t();
1539
- if (u.slide) {
1540
- const b = u.slide.orientation;
1541
- if (b === "horizontal") return K.slideHorizontal.css;
1542
- if (b === "vertical") return K.slideVertical.css;
1543
- const y = c.getBoundingClientRect();
1544
- return y.height > y.width ? K.slideVertical.css : K.slideHorizontal.css;
1539
+ n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, x.currentTarget.releasePointerCapture(x.pointerId);
1540
+ }, v = (x) => {
1541
+ u(), n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, x.currentTarget.releasePointerCapture(x.pointerId);
1542
+ }, W = (x) => {
1543
+ const w = e();
1544
+ if (w.slide) {
1545
+ const f = w.slide.orientation;
1546
+ return f === "horizontal" ? K.slideHorizontal.css : f === "vertical" ? K.slideVertical.css : (i || o(x), i && i.height > i.width ? K.slideVertical.css : K.slideHorizontal.css);
1545
1547
  }
1546
- return u.tap ? K.tap.css : u.hold ? K.hold.css : "";
1548
+ return w.tap ? K.tap.css : w.hold ? K.hold.css : "";
1547
1549
  };
1548
1550
  return {
1549
- onPointerDown: s,
1550
- onPointerMove: l,
1551
+ onPointerDown: b,
1552
+ onPointerMove: S,
1551
1553
  onPointerUp: m,
1552
- onPointerCancel: d,
1553
- onPointerEnter: (c) => {
1554
- const u = c.currentTarget;
1555
- n.element = u, u.style.cursor = x(u);
1554
+ onPointerCancel: v,
1555
+ onPointerEnter: (x) => {
1556
+ const w = x.currentTarget;
1557
+ n.element = w, w.style.cursor = W(w);
1556
1558
  },
1557
- dispose: a
1559
+ dispose: () => {
1560
+ u(), a && (a.disconnect(), a = null), r = null, i = null;
1561
+ }
1558
1562
  };
1559
1563
  }
1560
- function Fn(t) {
1561
- return A(() => {
1562
- const e = t.entities();
1563
- if (e.length === 0) return;
1564
+ function qn(e) {
1565
+ return N(() => {
1566
+ const t = e.entities();
1567
+ if (t.length === 0) return;
1564
1568
  const n = {
1565
- widgetConfig: t.widgetConfig,
1566
- entities: e.map((i) => {
1569
+ widgetConfig: e.widgetConfig,
1570
+ entities: t.map((i) => {
1567
1571
  const r = {
1568
1572
  entity_id: i.id,
1569
1573
  state: i.state,
1570
1574
  domain: i.domain,
1571
1575
  friendly_name: i.friendlyName
1572
1576
  };
1573
- return t.customEntityFields ? {
1577
+ return e.customEntityFields ? {
1574
1578
  ...r,
1575
- ...t.customEntityFields(i)
1579
+ ...e.customEntityFields(i)
1576
1580
  } : r;
1577
1581
  })
1578
1582
  };
1579
- return t.additionalData && Object.assign(n, t.additionalData), n;
1583
+ return e.additionalData && Object.assign(n, e.additionalData), n;
1580
1584
  });
1581
1585
  }
1582
- function Un(t = {}) {
1583
- const [e, n] = L(!1), [i, r] = L(!1);
1586
+ function Jn(e = {}) {
1587
+ const [t, n] = j(!1), [i, r] = j(!1);
1584
1588
  return {
1585
1589
  save: async (s) => {
1586
- if (t.onSave) {
1590
+ if (e.onSave) {
1587
1591
  n(!0);
1588
1592
  try {
1589
- await t.onSave(s), t.onSaveSuccess?.();
1593
+ await e.onSave(s), e.onSaveSuccess?.();
1590
1594
  } finally {
1591
1595
  n(!1);
1592
1596
  }
1593
1597
  }
1594
1598
  },
1595
1599
  remove: async () => {
1596
- if (t.onDelete) {
1600
+ if (e.onDelete) {
1597
1601
  r(!0);
1598
1602
  try {
1599
- await t.onDelete(), t.onDeleteSuccess?.();
1603
+ await e.onDelete(), e.onDeleteSuccess?.();
1600
1604
  } finally {
1601
1605
  r(!1);
1602
1606
  }
1603
1607
  }
1604
1608
  },
1605
- isSaving: e,
1609
+ isSaving: t,
1606
1610
  isDeleting: i
1607
1611
  };
1608
1612
  }
1609
- function Yn(t = "edit") {
1610
- const [e, n] = L(!1), [i, r] = L(t);
1613
+ function Zn(e = "edit") {
1614
+ const [t, n] = j(!1), [i, r] = j(e);
1611
1615
  return {
1612
- showDialog: e,
1616
+ showDialog: t,
1613
1617
  setShowDialog: n,
1614
1618
  openDialog: () => n(!0),
1615
1619
  closeDialog: () => n(!1),
@@ -1617,33 +1621,33 @@ function Yn(t = "edit") {
1617
1621
  setActiveTab: r
1618
1622
  };
1619
1623
  }
1620
- function Xn(t) {
1621
- const e = A(() => t.entity() !== null), n = A(() => {
1622
- const r = t.entity();
1623
- return r ? t.calculateData(r) : null;
1624
- }), i = A(() => e() ? void 0 : t.emptyStateConfig);
1624
+ function Qn(e) {
1625
+ const t = N(() => e.entity() !== null), n = N(() => {
1626
+ const r = e.entity();
1627
+ return r ? e.calculateData(r) : null;
1628
+ }), i = N(() => t() ? void 0 : e.emptyStateConfig);
1625
1629
  return {
1626
- entity: t.entity,
1630
+ entity: e.entity,
1627
1631
  data: n,
1628
1632
  emptyState: i,
1629
- hasEntity: e
1633
+ hasEntity: t
1630
1634
  };
1631
1635
  }
1632
- function Kn(t) {
1633
- const e = t.minEntities ?? 1, n = A(() => t.entities().length), i = A(() => n() >= e), r = A(() => !i() || !t.calculateGroupData ? null : t.calculateGroupData(t.entities())), a = A(() => {
1636
+ function er(e) {
1637
+ const t = e.minEntities ?? 1, n = N(() => e.entities().length), i = N(() => n() >= t), r = N(() => !i() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = N(() => {
1634
1638
  if (!i()) return;
1635
- const s = t.aggregationMode?.();
1639
+ const s = e.aggregationMode?.();
1636
1640
  if (!s || s === "none") return;
1637
- const l = t.entities();
1641
+ const l = e.entities();
1638
1642
  if (s === "light" || s === "binary-sensor" || s === "switch")
1639
- return Se(l, t.allEntitiesMode);
1643
+ return Dt(l, e.allEntitiesMode);
1640
1644
  if (s === "sensor") {
1641
- const m = t.sensorGroupType?.() ?? "mean";
1642
- return Ce(l, m, !0);
1645
+ const u = e.sensorGroupType?.() ?? "mean";
1646
+ return _t(l, u, !0);
1643
1647
  }
1644
- }), o = A(() => i() ? void 0 : t.emptyStateConfig);
1648
+ }), o = N(() => i() ? void 0 : e.emptyStateConfig);
1645
1649
  return {
1646
- entities: t.entities,
1650
+ entities: e.entities,
1647
1651
  groupData: r,
1648
1652
  aggregatedData: a,
1649
1653
  emptyState: o,
@@ -1651,49 +1655,49 @@ function Kn(t) {
1651
1655
  count: n
1652
1656
  };
1653
1657
  }
1654
- function qn(t) {
1655
- const [e] = At({
1656
- validate: Nt(t.schema),
1657
- initialValues: t.initialValues
1658
- }), n = A(() => e.dirty), i = A(() => e.submitting);
1658
+ function tr(e) {
1659
+ const [t] = Te({
1660
+ validate: Ve(e.schema),
1661
+ initialValues: e.initialValues
1662
+ }), n = N(() => t.dirty), i = N(() => t.submitting);
1659
1663
  return {
1660
- form: e,
1664
+ form: t,
1661
1665
  isDirty: n,
1662
1666
  isSubmitting: i,
1663
1667
  handleSubmit: (a) => {
1664
- t.onSubmit?.(a);
1668
+ e.onSubmit?.(a);
1665
1669
  },
1666
- getValue: Et,
1667
- setValue: Ot,
1668
- reset: Tt
1670
+ getValue: Re,
1671
+ setValue: Ie,
1672
+ reset: We
1669
1673
  };
1670
1674
  }
1671
- const at = ["xs", "sm", "md", "lg", "xl"];
1672
- function Jn() {
1673
- const t = G(), e = A(() => at.indexOf(t.size())), n = A(() => {
1674
- const l = t.size();
1675
+ const ae = ["xs", "sm", "md", "lg", "xl"];
1676
+ function nr() {
1677
+ const e = H(), t = N(() => ae.indexOf(e.size())), n = N(() => {
1678
+ const l = e.size();
1675
1679
  return l === "xs" || l === "sm";
1676
- }), i = A(() => {
1677
- const l = t.size();
1680
+ }), i = N(() => {
1681
+ const l = e.size();
1678
1682
  return l === "lg" || l === "xl";
1679
- }), r = A(() => e() >= 2);
1683
+ }), r = N(() => t() >= 2);
1680
1684
  return {
1681
1685
  isCompact: n,
1682
1686
  isLarge: i,
1683
1687
  showDetail: r,
1684
- showOn: (l) => l.includes(t.size()),
1685
- hideOn: (l) => !l.includes(t.size()),
1688
+ showOn: (l) => l.includes(e.size()),
1689
+ hideOn: (l) => !l.includes(e.size()),
1686
1690
  matches: (l) => {
1687
- const m = l.trim();
1688
- if (m.endsWith("+")) {
1689
- const d = m.slice(0, -1), x = at.indexOf(d);
1690
- return x >= 0 && e() >= x;
1691
+ const u = l.trim();
1692
+ if (u.endsWith("+")) {
1693
+ const c = u.slice(0, -1), b = ae.indexOf(c);
1694
+ return b >= 0 && t() >= b;
1691
1695
  }
1692
- if (m.endsWith("-")) {
1693
- const d = m.slice(0, -1), x = at.indexOf(d);
1694
- return x >= 0 && e() <= x;
1696
+ if (u.endsWith("-")) {
1697
+ const c = u.slice(0, -1), b = ae.indexOf(c);
1698
+ return b >= 0 && t() <= b;
1695
1699
  }
1696
- return t.size() === m;
1700
+ return e.size() === u;
1697
1701
  }
1698
1702
  };
1699
1703
  }
@@ -1715,7 +1719,7 @@ const D = {
1715
1719
  sage: "bg-gradient-to-br from-lime-600/20 to-green-600/20",
1716
1720
  copper: "bg-gradient-to-br from-amber-600/20 to-amber-800/20",
1717
1721
  dusk: "bg-gradient-to-br from-blue-500/20 to-purple-600/20"
1718
- }, Zn = {
1722
+ }, rr = {
1719
1723
  ocean: "Ocean Breeze",
1720
1724
  sunset: "Sunset Glow",
1721
1725
  forest: "Forest Dawn",
@@ -1733,25 +1737,25 @@ const D = {
1733
1737
  sage: "Sage",
1734
1738
  copper: "Copper",
1735
1739
  dusk: "Dusk"
1736
- }, Qn = Object.keys(D);
1737
- function xt(t) {
1738
- const e = Object.keys(D);
1740
+ }, ir = Object.keys(D);
1741
+ function ve(e) {
1742
+ const t = Object.keys(D);
1739
1743
  let n = 0;
1740
- for (const r of t)
1744
+ for (const r of e)
1741
1745
  n = (n << 5) - n + r.charCodeAt(0), n = n & n;
1742
- const i = Math.abs(n) % e.length;
1743
- return e[i];
1746
+ const i = Math.abs(n) % t.length;
1747
+ return t[i];
1744
1748
  }
1745
- function tr(t, e) {
1746
- if (!t) {
1747
- const i = xt(e);
1749
+ function ar(e, t) {
1750
+ if (!e) {
1751
+ const i = ve(t);
1748
1752
  return D[i];
1749
1753
  }
1750
- if (typeof t == "string" && t in D)
1751
- return D[t];
1752
- if (typeof t == "string")
1753
- return t;
1754
- const n = xt(e);
1754
+ if (typeof e == "string" && e in D)
1755
+ return D[e];
1756
+ if (typeof e == "string")
1757
+ return e;
1758
+ const n = ve(t);
1755
1759
  return D[n];
1756
1760
  }
1757
1761
  const q = {
@@ -1925,116 +1929,116 @@ const q = {
1925
1929
  muted: "text-blue-400/60 dark:text-blue-300/60"
1926
1930
  }
1927
1931
  }
1928
- }, er = {
1932
+ }, or = {
1929
1933
  unavailable: q.steel,
1930
1934
  active: q.ocean,
1931
1935
  inactive: q.steel,
1932
1936
  success: q.forest,
1933
1937
  warning: q.ember,
1934
1938
  error: q.rose
1935
- }, nr = {
1939
+ }, sr = {
1936
1940
  /** Optional display name override (renders as text input) */
1937
1941
  title: () => X.string().optional().meta({ title: "Title", description: "Optional display name override" }),
1938
1942
  /** Multi-select entity picker for a HA domain */
1939
- entityIds: (t) => X.array(X.string()).default([]).meta({ domain: t, title: "Entities" }),
1943
+ entityIds: (e) => X.array(X.string()).default([]).meta({ domain: e, title: "Entities" }),
1940
1944
  /** Single-select entity picker for a HA domain */
1941
- singleEntity: (t) => X.array(X.string()).default([]).meta({ domain: t, title: "Entity", singleSelect: !0 }),
1945
+ singleEntity: (e) => X.array(X.string()).default([]).meta({ domain: e, title: "Entity", singleSelect: !0 }),
1942
1946
  /** Area picker dropdown */
1943
1947
  areaId: () => X.string().optional().meta({ formType: "area-picker", title: "Area" })
1944
1948
  };
1945
- let ot = null;
1946
- function mn() {
1947
- return ot || (ot = getComputedStyle(document.documentElement)), ot;
1949
+ let oe = null;
1950
+ function vn() {
1951
+ return oe || (oe = getComputedStyle(document.documentElement)), oe;
1948
1952
  }
1949
- function rr(t) {
1950
- const e = t.startsWith("--") ? t : `--${t}`;
1951
- return mn().getPropertyValue(e).trim();
1953
+ function lr(e) {
1954
+ const t = e.startsWith("--") ? e : `--${e}`;
1955
+ return vn().getPropertyValue(t).trim();
1952
1956
  }
1953
- function ir() {
1957
+ function cr() {
1954
1958
  return document.documentElement.classList.contains("dark");
1955
1959
  }
1956
- const fn = "0.3.3", hn = {
1957
- version: fn
1958
- }, ar = hn.version;
1960
+ const bn = "0.3.4", yn = {
1961
+ version: bn
1962
+ }, ur = yn.version;
1959
1963
  export {
1960
- Zn as GRADIENT_NAMES,
1964
+ rr as GRADIENT_NAMES,
1961
1965
  D as GRADIENT_PRESETS,
1962
- Qn as GRADIENT_PRESET_KEYS,
1963
- Bn as Glow,
1964
- lr as GridSizeSchema,
1965
- cr as PublishBodySchema,
1966
- ur as PublishConfirmSchema,
1967
- dr as PublishRequestSchema,
1968
- ar as SDK_VERSION,
1966
+ ir as GRADIENT_PRESET_KEYS,
1967
+ Un as Glow,
1968
+ mr as GridSizeSchema,
1969
+ fr as PublishBodySchema,
1970
+ hr as PublishConfirmSchema,
1971
+ xr as PublishRequestSchema,
1972
+ ur as SDK_VERSION,
1969
1973
  F as WIDGET_Z,
1970
1974
  U as Widget,
1971
- Jt as WidgetContent,
1972
- st as WidgetCtx,
1973
- jn as WidgetDialog,
1974
- re as WidgetEmptyState,
1975
- ue as WidgetIcon,
1976
- gr as WidgetManifestSchema,
1977
- $t as WidgetMetrics,
1978
- Yt as WidgetSliderFill,
1979
- Ln as WidgetStack,
1980
- be as WidgetStatus,
1981
- we as WidgetSubtitle,
1982
- pe as WidgetTitle,
1983
- Te as WidgetValue,
1984
- Gn as allEntitiesInState,
1985
- Hn as anyEntityInState,
1986
- Nn as applyCssVars,
1987
- An as applyLayout,
1988
- lt as builtInVariants,
1989
- Se as calculateLightGroup,
1990
- Ce as calculateSensorGroup,
1991
- Wt as classicGlass,
1992
- $ as cn,
1993
- Rt as compactHorizontal,
1994
- _n as composeVariants,
1995
- Rn as countActiveEntities,
1996
- In as countAvailableEntities,
1997
- Wn as countEntitiesByState,
1998
- On as createEmptyStateConfig,
1999
- pn as createEntity,
2000
- Tn as createFlexLayout,
2001
- Sn as defineWidget,
2002
- le as deriveAdaptiveIconColors,
2003
- Dn as extendVariant,
2004
- Vt as extractDefaults,
2005
- mr as formatSchemaError,
2006
- De as formatValue,
2007
- Gt as getBuiltInVariant,
2008
- zn as getBuiltInVariantIds,
2009
- Vn as getEntityAttribute,
2010
- En as getEntityState,
2011
- tr as getGradient,
2012
- xt as getGradientFromString,
2013
- Kt as getSpacingClass,
2014
- rr as getThemeToken,
1975
+ tt as WidgetContent,
1976
+ se as WidgetCtx,
1977
+ Xn as WidgetDialog,
1978
+ st as WidgetEmptyState,
1979
+ ft as WidgetIcon,
1980
+ vr as WidgetManifestSchema,
1981
+ ke as WidgetMetrics,
1982
+ Je as WidgetSliderFill,
1983
+ Yn as WidgetStack,
1984
+ kt as WidgetStatus,
1985
+ St as WidgetSubtitle,
1986
+ zt as WidgetTitle,
1987
+ Wt as WidgetValue,
1988
+ Pn as allEntitiesInState,
1989
+ Fn as anyEntityInState,
1990
+ Wn as applyCssVars,
1991
+ Vn as applyLayout,
1992
+ le as builtInVariants,
1993
+ Dt as calculateLightGroup,
1994
+ _t as calculateSensorGroup,
1995
+ He as classicGlass,
1996
+ k as cn,
1997
+ Le as compactHorizontal,
1998
+ Tn as composeVariants,
1999
+ jn as countActiveEntities,
2000
+ Ln as countAvailableEntities,
2001
+ Bn as countEntitiesByState,
2002
+ Rn as createEmptyStateConfig,
2003
+ Dn as createEntity,
2004
+ In as createFlexLayout,
2005
+ _n as defineWidget,
2006
+ gt as deriveAdaptiveIconColors,
2007
+ En as extendVariant,
2008
+ Ge as extractDefaults,
2009
+ br as formatSchemaError,
2010
+ Ot as formatValue,
2011
+ je as getBuiltInVariant,
2012
+ On as getBuiltInVariantIds,
2013
+ Hn as getEntityAttribute,
2014
+ Gn as getEntityState,
2015
+ ar as getGradient,
2016
+ ve as getGradientFromString,
2017
+ Qe as getSpacingClass,
2018
+ lr as getThemeToken,
2015
2019
  q as gradientColorPresets,
2016
- _e as interpretValue,
2017
- Mn as isBuiltInVariant,
2018
- ir as isDark,
2019
- ze as isEntityActive,
2020
- Me as isEntityAvailable,
2021
- ct as mergeVariants,
2022
- It as minimal,
2023
- fr as parseGridSize,
2024
- hr as serializeGridSize,
2025
- W as spacing,
2026
- er as stateColors,
2027
- bt as toFormSchema,
2028
- j as typography,
2029
- Fn as useDebugData,
2030
- Un as useWidgetConfig,
2031
- G as useWidgetContext,
2032
- Yn as useWidgetDialog,
2033
- Xn as useWidgetEntity,
2034
- Kn as useWidgetEntityGroup,
2035
- qn as useWidgetForm,
2036
- Pn as useWidgetGestures,
2037
- Jn as useWidgetResponsive,
2038
- Cn as warnIfStub,
2039
- nr as widgetFields
2020
+ Et as interpretValue,
2021
+ Nn as isBuiltInVariant,
2022
+ cr as isDark,
2023
+ Nt as isEntityActive,
2024
+ At as isEntityAvailable,
2025
+ ce as mergeVariants,
2026
+ Be as minimal,
2027
+ yr as parseGridSize,
2028
+ wr as serializeGridSize,
2029
+ G as spacing,
2030
+ or as stateColors,
2031
+ ye as toFormSchema,
2032
+ P as typography,
2033
+ qn as useDebugData,
2034
+ Jn as useWidgetConfig,
2035
+ H as useWidgetContext,
2036
+ Zn as useWidgetDialog,
2037
+ Qn as useWidgetEntity,
2038
+ er as useWidgetEntityGroup,
2039
+ tr as useWidgetForm,
2040
+ Kn as useWidgetGestures,
2041
+ nr as useWidgetResponsive,
2042
+ An as warnIfStub,
2043
+ sr as widgetFields
2040
2044
  };