@iyulab/u-widgets 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/u-widgets.js CHANGED
@@ -1,10 +1,10 @@
1
- import { g as me } from "./formdown-BWJ6QGJs.js";
2
- import { p as Ot, r as Pt } from "./formdown-BWJ6QGJs.js";
3
- import { i as ve } from "./infer-CNOiD2dS.js";
4
- import { t as b, n as be } from "./tokens-x1kDxgG8.js";
5
- import { css as y, LitElement as w, nothing as c, html as o } from "lit";
1
+ import { g as be } from "./formdown-BWJ6QGJs.js";
2
+ import { p as Nt, r as Ft } from "./formdown-BWJ6QGJs.js";
3
+ import { i as we } from "./infer-CNOiD2dS.js";
4
+ import { t as b, n as ye } from "./tokens-x1kDxgG8.js";
5
+ import { css as w, LitElement as y, nothing as l, html as o } from "lit";
6
6
  import { property as h, customElement as x, state as S } from "lit/decorators.js";
7
- const ye = /* @__PURE__ */ new Set([
7
+ const xe = /* @__PURE__ */ new Set([
8
8
  "text",
9
9
  "email",
10
10
  "password",
@@ -21,7 +21,7 @@ const ye = /* @__PURE__ */ new Set([
21
21
  "range",
22
22
  "radio",
23
23
  "checkbox"
24
- ]), ae = 10, we = /* @__PURE__ */ new Set([
24
+ ]), ie = 10, $e = /* @__PURE__ */ new Set([
25
25
  "stat-group",
26
26
  "table",
27
27
  "list",
@@ -38,113 +38,138 @@ const ye = /* @__PURE__ */ new Set([
38
38
  "chart.funnel",
39
39
  "chart.waterfall",
40
40
  "chart.treemap"
41
- ]), xe = /* @__PURE__ */ new Set(["metric", "gauge", "progress", "header", "code", "rating", "video"]);
42
- function Q(e, t = 0) {
43
- const a = [], i = [];
44
- if (t > ae)
45
- return { valid: !1, errors: ["compose children exceed maximum nesting depth (" + ae + ")"], warnings: i };
41
+ ]), _e = /* @__PURE__ */ new Set(["metric", "gauge", "progress", "header", "code", "rating", "video"]);
42
+ function Y(e, t = 0) {
43
+ const a = [], r = [];
44
+ if (t > ie)
45
+ return { valid: !1, errors: ["compose children exceed maximum nesting depth (" + ie + ")"], warnings: r };
46
46
  if (e == null || typeof e != "object")
47
- return { valid: !1, errors: ["Spec must be a non-null object"], warnings: i };
48
- const r = e;
49
- if (typeof r.widget != "string" || r.widget.length === 0)
50
- return a.push('Required field "widget" must be a non-empty string'), { valid: !1, errors: a, warnings: i };
51
- const n = r.widget;
52
- if (r.type !== void 0 && r.type !== "u-widget" && a.push('"type" must be "u-widget" if specified'), r.fields !== void 0 && r.formdown !== void 0 && a.push('"fields" and "formdown" are mutually exclusive'), r.data !== void 0 && (we.has(n) && !Array.isArray(r.data) && a.push(`"${n}" expects "data" to be an array, got ${typeof r.data}`), xe.has(n) && (Array.isArray(r.data) || typeof r.data != "object") && a.push(`"${n}" expects "data" to be an object, got ${Array.isArray(r.data) ? "array" : typeof r.data}`)), n === "compose") {
53
- if (!Array.isArray(r.children))
47
+ return { valid: !1, errors: ["Spec must be a non-null object"], warnings: r };
48
+ const i = e;
49
+ if (typeof i.widget != "string" || i.widget.length === 0)
50
+ return a.push('Required field "widget" must be a non-empty string'), { valid: !1, errors: a, warnings: r };
51
+ const s = i.widget;
52
+ if (i.type !== void 0 && i.type !== "u-widget" && a.push('"type" must be "u-widget" if specified'), i.fields !== void 0 && i.formdown !== void 0 && a.push('"fields" and "formdown" are mutually exclusive'), i.data !== void 0 && ($e.has(s) && !Array.isArray(i.data) && a.push(`"${s}" expects "data" to be an array, got ${typeof i.data}`), _e.has(s) && (Array.isArray(i.data) || typeof i.data != "object") && a.push(`"${s}" expects "data" to be an object, got ${Array.isArray(i.data) ? "array" : typeof i.data}`)), s === "compose") {
53
+ if (!Array.isArray(i.children))
54
54
  a.push('"compose" widget requires a "children" array');
55
55
  else
56
- for (let s = 0; s < r.children.length; s++) {
57
- const l = r.children[s];
58
- if (l == null || typeof l != "object" || typeof l.widget != "string")
59
- a.push(`children[${s}] must be an object with a "widget" field`);
56
+ for (let n = 0; n < i.children.length; n++) {
57
+ const d = i.children[n];
58
+ if (d == null || typeof d != "object" || typeof d.widget != "string")
59
+ a.push(`children[${n}] must be an object with a "widget" field`);
60
60
  else {
61
- const p = Q(l, t + 1);
62
- p.valid || a.push(...p.errors.map((d) => `children[${s}]: ${d}`)), i.push(...p.warnings.map((d) => `children[${s}]: ${d}`));
61
+ const c = Y(d, t + 1);
62
+ c.valid || a.push(...c.errors.map((p) => `children[${n}]: ${p}`)), r.push(...c.warnings.map((p) => `children[${n}]: ${p}`));
63
63
  }
64
64
  }
65
- if (r.layout !== void 0) {
66
- const s = ["stack", "row", "grid"];
67
- s.includes(r.layout) || a.push(`"layout" must be one of: ${s.join(", ")}`);
65
+ if (i.layout !== void 0) {
66
+ const n = ["stack", "row", "grid"];
67
+ n.includes(i.layout) || a.push(`"layout" must be one of: ${n.join(", ")}`);
68
68
  }
69
69
  }
70
- if (Array.isArray(r.fields))
71
- for (let s = 0; s < r.fields.length; s++) {
72
- const l = r.fields[s];
73
- l == null || typeof l != "object" || typeof l.field != "string" ? a.push(`fields[${s}] must have a "field" string property`) : l.type != null && !ye.has(l.type) && i.push(`fields[${s}].type "${l.type}" is not a recognized field type`);
70
+ if (Array.isArray(i.fields))
71
+ for (let n = 0; n < i.fields.length; n++) {
72
+ const d = i.fields[n];
73
+ d == null || typeof d != "object" || typeof d.field != "string" ? a.push(`fields[${n}] must have a "field" string property`) : d.type != null && !xe.has(d.type) && r.push(`fields[${n}].type "${d.type}" is not a recognized field type`);
74
74
  }
75
- if (typeof r.formdown == "string" && r.formdown.length > 0 && !r.fields)
75
+ if (typeof i.formdown == "string" && i.formdown.length > 0 && !i.fields)
76
76
  try {
77
- me()(r.formdown);
77
+ be()(i.formdown);
78
78
  } catch {
79
- i.push("formdown string could not be parsed — check syntax");
80
- }
81
- if (Array.isArray(r.actions))
82
- for (let s = 0; s < r.actions.length; s++) {
83
- const l = r.actions[s];
84
- (l == null || typeof l != "object" || typeof l.label != "string" || typeof l.action != "string") && a.push(`actions[${s}] must have "label" and "action" string properties`);
85
- }
86
- if (r.mapping && typeof r.mapping == "object" && r.data) {
87
- const s = r.mapping, l = $e(r.data);
88
- if (l)
89
- for (const p of ["x", "y", "label", "value", "color", "size", "axis", "primary", "secondary", "icon", "avatar", "trailing"]) {
90
- const d = s[p];
91
- if (typeof d == "string" && !l.has(d) && i.push(`mapping.${p} references "${d}" which is not found in data keys [${[...l].join(", ")}]`), Array.isArray(d))
92
- for (const g of d)
93
- typeof g == "string" && !l.has(g) && i.push(`mapping.${p} references "${g}" which is not found in data keys [${[...l].join(", ")}]`);
79
+ r.push("formdown string could not be parsed — check syntax");
80
+ }
81
+ if (Array.isArray(i.actions))
82
+ for (let n = 0; n < i.actions.length; n++) {
83
+ const d = i.actions[n];
84
+ (d == null || typeof d != "object" || typeof d.label != "string" || typeof d.action != "string") && a.push(`actions[${n}] must have "label" and "action" string properties`);
85
+ }
86
+ if (i.mapping && typeof i.mapping == "object" && i.data) {
87
+ const n = i.mapping, d = ke(i.data);
88
+ if (d)
89
+ for (const c of ["x", "y", "label", "value", "color", "size", "axis", "primary", "secondary", "icon", "avatar", "trailing"]) {
90
+ const p = n[c];
91
+ if (typeof p == "string" && !d.has(p) && r.push(`mapping.${c} references "${p}" which is not found in data keys [${[...d].join(", ")}]`), Array.isArray(p))
92
+ for (const g of p)
93
+ typeof g == "string" && !d.has(g) && r.push(`mapping.${c} references "${g}" which is not found in data keys [${[...d].join(", ")}]`);
94
94
  }
95
95
  }
96
- return { valid: a.length === 0, errors: a, warnings: i };
96
+ return { valid: a.length === 0, errors: a, warnings: r };
97
97
  }
98
- function $e(e) {
98
+ function ke(e) {
99
99
  if (Array.isArray(e) && e.length > 0 && e[0] && typeof e[0] == "object")
100
100
  return new Set(Object.keys(e[0]));
101
101
  if (e && typeof e == "object" && !Array.isArray(e))
102
102
  return new Set(Object.keys(e));
103
103
  }
104
- function St(e) {
105
- return Q(e).valid;
104
+ function Dt(e) {
105
+ return Y(e).valid;
106
106
  }
107
- const ie = ["B", "KB", "MB", "GB", "TB"];
108
- function _e(e, t, a) {
107
+ const se = ["B", "KB", "MB", "GB", "TB"], ze = /* @__PURE__ */ new Set([
108
+ "KRW",
109
+ "JPY",
110
+ "VND",
111
+ "IDR",
112
+ "BIF",
113
+ "CLP",
114
+ "GNF",
115
+ "ISK",
116
+ "KMF",
117
+ "MGA",
118
+ "PYG",
119
+ "RWF",
120
+ "UGX",
121
+ "UYI",
122
+ "VUV",
123
+ "XAF",
124
+ "XOF",
125
+ "XPF"
126
+ ]);
127
+ function pe(e, t, a) {
109
128
  if (e == null) return "";
110
- const [i, r] = t?.split(":") ?? [];
111
- switch (i) {
129
+ const [r, i] = t?.split(":") ?? [];
130
+ switch (r) {
112
131
  case "number":
113
- return ke(e, a);
132
+ return Se(e, a);
114
133
  case "currency":
115
- return ze(e, r, a);
134
+ return Ae(e, i, a);
116
135
  case "percent":
117
- return Se(e, a);
136
+ return Ce(e, a);
118
137
  case "date":
119
- return Ae(e, a);
138
+ return De(e, a);
120
139
  case "datetime":
121
- return Ce(e, a);
140
+ return je(e, a);
122
141
  case "bytes":
123
- return je(e);
142
+ return Oe(e);
124
143
  default:
125
144
  return String(e);
126
145
  }
127
146
  }
128
- function ke(e, t) {
147
+ function Se(e, t) {
129
148
  const a = Number(e);
130
149
  return isNaN(a) ? String(e) : new Intl.NumberFormat(t).format(a);
131
150
  }
132
- function ze(e, t, a) {
133
- const i = Number(e);
134
- if (isNaN(i)) return String(e);
151
+ function Ae(e, t, a) {
152
+ const r = Number(e);
153
+ if (isNaN(r)) return String(e);
154
+ const i = t || "USD";
135
155
  try {
156
+ const s = ze.has(i.toUpperCase());
136
157
  return new Intl.NumberFormat(a, {
137
158
  style: "currency",
138
- currency: t || "USD"
139
- }).format(i);
159
+ currency: i,
160
+ ...s && {
161
+ minimumFractionDigits: 0,
162
+ maximumFractionDigits: 0
163
+ }
164
+ }).format(r);
140
165
  } catch {
141
166
  return new Intl.NumberFormat(a, {
142
167
  style: "currency",
143
168
  currency: "USD"
144
- }).format(i);
169
+ }).format(r);
145
170
  }
146
171
  }
147
- function Se(e, t) {
172
+ function Ce(e, t) {
148
173
  const a = Number(e);
149
174
  if (isNaN(a)) return String(e);
150
175
  if (t)
@@ -157,7 +182,7 @@ function Se(e, t) {
157
182
  }
158
183
  return a + "%";
159
184
  }
160
- function Ae(e, t) {
185
+ function De(e, t) {
161
186
  if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}/.test(e)) {
162
187
  if (t)
163
188
  try {
@@ -174,7 +199,7 @@ function Ae(e, t) {
174
199
  }
175
200
  return String(e);
176
201
  }
177
- function Ce(e, t) {
202
+ function je(e, t) {
178
203
  if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}/.test(e)) {
179
204
  if (t)
180
205
  try {
@@ -193,16 +218,16 @@ function Ce(e, t) {
193
218
  }
194
219
  return String(e);
195
220
  }
196
- function je(e) {
221
+ function Oe(e) {
197
222
  const t = Number(e);
198
223
  if (isNaN(t)) return String(e);
199
224
  const a = t < 0 ? "-" : "";
200
- let i = Math.abs(t), r = 0;
201
- for (; i >= 1024 && r < ie.length - 1; )
202
- i /= 1024, r++;
203
- return a + (r === 0 ? i : i.toFixed(1)) + " " + ie[r];
225
+ let r = Math.abs(t), i = 0;
226
+ for (; r >= 1024 && i < se.length - 1; )
227
+ r /= 1024, i++;
228
+ return a + (i === 0 ? r : r.toFixed(1)) + " " + se[i];
204
229
  }
205
- const De = [
230
+ const Pe = [
206
231
  "chart.bar",
207
232
  "chart.line",
208
233
  "chart.area",
@@ -238,40 +263,40 @@ const De = [
238
263
  "divider",
239
264
  "header"
240
265
  ];
241
- function Oe(e) {
266
+ function Ee(e) {
242
267
  if (!e) return;
243
268
  const t = e.toLowerCase();
244
- let a, i = 1 / 0;
245
- for (const n of De) {
246
- const s = Pe(t, n);
247
- s < i && (i = s, a = n);
269
+ let a, r = 1 / 0;
270
+ for (const s of Pe) {
271
+ const n = Le(t, s);
272
+ n < r && (r = n, a = s);
248
273
  }
249
- const r = Math.min(3, Math.floor(t.length / 2));
250
- if (i <= r && i > 0)
274
+ const i = Math.min(3, Math.floor(t.length / 2));
275
+ if (r <= i && r > 0)
251
276
  return a;
252
277
  }
253
- function Pe(e, t) {
254
- const a = e.length, i = t.length;
255
- if (a === 0) return i;
256
- if (i === 0) return a;
257
- const r = new Array(i + 1);
258
- for (let n = 0; n <= i; n++) r[n] = n;
259
- for (let n = 1; n <= a; n++) {
260
- let s = n - 1;
261
- r[0] = n;
262
- for (let l = 1; l <= i; l++) {
263
- const p = e[n - 1] === t[l - 1] ? 0 : 1, d = Math.min(
264
- r[l] + 1,
278
+ function Le(e, t) {
279
+ const a = e.length, r = t.length;
280
+ if (a === 0) return r;
281
+ if (r === 0) return a;
282
+ const i = new Array(r + 1);
283
+ for (let s = 0; s <= r; s++) i[s] = s;
284
+ for (let s = 1; s <= a; s++) {
285
+ let n = s - 1;
286
+ i[0] = s;
287
+ for (let d = 1; d <= r; d++) {
288
+ const c = e[s - 1] === t[d - 1] ? 0 : 1, p = Math.min(
289
+ i[d] + 1,
265
290
  // deletion
266
- r[l - 1] + 1,
291
+ i[d - 1] + 1,
267
292
  // insertion
268
- s + p
293
+ n + c
269
294
  // substitution
270
295
  );
271
- s = r[l], r[l] = d;
296
+ n = i[d], i[d] = p;
272
297
  }
273
298
  }
274
- return r[i];
299
+ return i[r];
275
300
  }
276
301
  const R = {
277
302
  // UI chrome
@@ -294,10 +319,10 @@ const R = {
294
319
  invalidUrl: "{label} must be a valid URL",
295
320
  invalidPattern: "{label} format is invalid"
296
321
  }, L = /* @__PURE__ */ new Map();
297
- function At(e, t) {
322
+ function jt(e, t) {
298
323
  L.set(e.toLowerCase(), { ...R, ...t });
299
324
  }
300
- function de(e) {
325
+ function ue(e) {
301
326
  if (!e) return R;
302
327
  const t = e.toLowerCase();
303
328
  if (L.has(t)) return L.get(t);
@@ -307,20 +332,34 @@ function de(e) {
307
332
  function A(e, t) {
308
333
  return e.replace(
309
334
  /\{(\w+)\}/g,
310
- (a, i) => t[i] != null ? String(t[i]) : `{${i}}`
335
+ (a, r) => t[r] != null ? String(t[r]) : `{${r}}`
311
336
  );
312
337
  }
313
- function Ct() {
338
+ function Ot() {
314
339
  return { ...R };
315
340
  }
316
- var Ee = Object.defineProperty, Le = Object.getOwnPropertyDescriptor, pe = (e, t, a, i) => {
317
- for (var r = i > 1 ? void 0 : i ? Le(t, a) : t, n = e.length - 1, s; n >= 0; n--)
318
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
319
- return i && r && Ee(t, a, r), r;
341
+ let q;
342
+ function Pt(e) {
343
+ q = e;
344
+ }
345
+ function Et() {
346
+ return q;
347
+ }
348
+ function Ie(e) {
349
+ if (e) return e;
350
+ if (q) return q;
351
+ if (typeof document < "u" && document.documentElement?.lang)
352
+ return document.documentElement.lang;
353
+ }
354
+ var Ne = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, ge = (e, t, a, r) => {
355
+ for (var i = r > 1 ? void 0 : r ? Fe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
356
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
357
+ return r && i && Ne(t, a, i), i;
320
358
  };
321
- function se(e) {
359
+ function ne(e, t) {
360
+ const a = e.value, r = e.format;
322
361
  return {
323
- value: e.value ?? 0,
362
+ value: r ? pe(a, r, t) : a ?? 0,
324
363
  label: e.label,
325
364
  unit: e.unit,
326
365
  prefix: e.prefix,
@@ -328,42 +367,46 @@ function se(e) {
328
367
  change: e.change,
329
368
  trend: e.trend,
330
369
  icon: e.icon,
331
- description: e.description
370
+ description: e.description,
371
+ format: e.format,
372
+ variant: e.variant
332
373
  };
333
374
  }
334
- let q = class extends w {
375
+ let B = class extends y {
335
376
  constructor() {
336
377
  super(...arguments), this.spec = null;
337
378
  }
338
379
  render() {
339
- return this.spec?.data ? this.spec.widget === "stat-group" ? this.renderStatGroup() : this.renderMetric(se(this.spec.data)) : c;
380
+ if (!this.spec?.data) return l;
381
+ const e = this.spec.options?.locale;
382
+ return this.spec.widget === "stat-group" ? this.renderStatGroup(e) : this.renderMetric(ne(this.spec.data, e));
340
383
  }
341
- renderStatGroup() {
342
- const e = this.spec.data;
343
- return Array.isArray(e) ? o`
384
+ renderStatGroup(e) {
385
+ const t = this.spec.data;
386
+ return Array.isArray(t) ? o`
344
387
  <div class="stat-group" part="stat-group">
345
- ${e.map((t) => this.renderMetric(se(t)))}
388
+ ${t.map((a) => this.renderMetric(ne(a, e)))}
346
389
  </div>
347
- ` : c;
390
+ ` : l;
348
391
  }
349
392
  renderMetric(e) {
350
393
  const t = e.trend === "up" ? "↑" : e.trend === "down" ? "↓" : e.trend === "flat" ? "→" : "", a = e.label ? `${e.label}: ${e.prefix ?? ""}${e.value}${e.unit ?? ""}${e.suffix ?? ""}` : void 0;
351
394
  return o`
352
- <div class="metric" part="metric" aria-label=${a ?? c}>
353
- ${e.icon ? o`<div class="metric-icon" part="icon">${e.icon}</div>` : c}
354
- ${e.label ? o`<div class="metric-label" part="label">${e.label}</div>` : c}
395
+ <div class="metric" part="metric" aria-label=${a ?? l} data-variant=${e.variant ?? l}>
396
+ ${e.icon ? o`<div class="metric-icon" part="icon">${e.icon}</div>` : l}
397
+ ${e.label ? o`<div class="metric-label" part="label">${e.label}</div>` : l}
355
398
  <div class="metric-value" part="value">
356
399
  ${e.prefix ?? ""}${e.value}${e.unit ? o`<span class="metric-unit">${e.unit}</span>` : ""}${e.suffix ?? ""}
357
400
  </div>
358
401
  ${e.change != null ? o`<span class="metric-change" data-trend=${e.trend ?? "flat"} part="change"
359
402
  >${t} ${e.change > 0 ? "+" : ""}${e.change}%</span
360
- >` : c}
361
- ${e.description ? o`<div class="metric-description" part="description">${e.description}</div>` : c}
403
+ >` : l}
404
+ ${e.description ? o`<div class="metric-description" part="description">${e.description}</div>` : l}
362
405
  </div>
363
406
  `;
364
407
  }
365
408
  };
366
- q.styles = [b, y`
409
+ B.styles = [b, w`
367
410
  :host {
368
411
  display: block;
369
412
  font-family: system-ui, -apple-system, sans-serif;
@@ -426,6 +469,12 @@ q.styles = [b, y`
426
469
  .metric-icon { font-size: 1.25rem; line-height: 1; margin-bottom: 2px; }
427
470
  .metric-description { font-size: 0.75rem; color: var(--u-widget-text-secondary, #64748b); margin-top: 2px; line-height: 1.3; }
428
471
 
472
+ /* ── variant colors ── */
473
+ .metric[data-variant="success"] .metric-value { color: var(--u-widget-positive, #16a34a); }
474
+ .metric[data-variant="danger"] .metric-value { color: var(--u-widget-negative, #dc2626); }
475
+ .metric[data-variant="warning"] .metric-value { color: var(--u-widget-warning, #d97706); }
476
+ .metric[data-variant="info"] .metric-value { color: var(--u-widget-info, #2563eb); }
477
+
429
478
  /* ── stat-group ── */
430
479
  .stat-group {
431
480
  display: flex;
@@ -463,23 +512,23 @@ q.styles = [b, y`
463
512
  }
464
513
  }
465
514
  `];
466
- pe([
515
+ ge([
467
516
  h({ type: Object })
468
- ], q.prototype, "spec", 2);
469
- q = pe([
517
+ ], B.prototype, "spec", 2);
518
+ B = ge([
470
519
  x("u-metric")
471
- ], q);
472
- var Ie = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, ue = (e, t, a, i) => {
473
- for (var r = i > 1 ? void 0 : i ? Ne(t, a) : t, n = e.length - 1, s; n >= 0; n--)
474
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
475
- return i && r && Ie(t, a, r), r;
520
+ ], B);
521
+ var Me = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, fe = (e, t, a, r) => {
522
+ for (var i = r > 1 ? void 0 : r ? Te(t, a) : t, s = e.length - 1, n; s >= 0; s--)
523
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
524
+ return r && i && Me(t, a, i), i;
476
525
  };
477
- const Te = {
526
+ const Ue = {
478
527
  min: 0,
479
528
  max: 100,
480
529
  unit: "",
481
530
  thresholds: []
482
- }, Fe = {
531
+ }, Re = {
483
532
  green: "#16a34a",
484
533
  yellow: "#eab308",
485
534
  orange: "#f97316",
@@ -487,30 +536,30 @@ const Te = {
487
536
  blue: "#2563eb",
488
537
  gray: "#6b7280"
489
538
  };
490
- function ne(e) {
491
- return Fe[e] ?? e;
539
+ function oe(e) {
540
+ return Re[e] ?? e;
492
541
  }
493
- function oe(e, t, a, i, r) {
494
- const n = (i - 90) * Math.PI / 180, s = (r - 90) * Math.PI / 180, l = e + a * Math.cos(n), p = t + a * Math.sin(n), d = e + a * Math.cos(s), g = t + a * Math.sin(s), f = r - i > 180 ? 1 : 0;
495
- return `M ${l} ${p} A ${a} ${a} 0 ${f} 1 ${d} ${g}`;
542
+ function le(e, t, a, r, i) {
543
+ const s = (r - 90) * Math.PI / 180, n = (i - 90) * Math.PI / 180, d = e + a * Math.cos(s), c = t + a * Math.sin(s), p = e + a * Math.cos(n), g = t + a * Math.sin(n), f = i - r > 180 ? 1 : 0;
544
+ return `M ${d} ${c} A ${a} ${a} 0 ${f} 1 ${p} ${g}`;
496
545
  }
497
- let B = class extends w {
546
+ let W = class extends y {
498
547
  constructor() {
499
548
  super(...arguments), this.spec = null;
500
549
  }
501
550
  render() {
502
- return this.spec?.data ? this.spec.widget === "progress" ? this.renderProgress() : this.renderGauge() : c;
551
+ return this.spec?.data ? this.spec.widget === "progress" ? this.renderProgress() : this.renderGauge() : l;
503
552
  }
504
553
  getOptions() {
505
554
  const e = this.spec.options ?? {};
506
- return { ...Te, ...e };
555
+ return { ...Ue, ...e };
507
556
  }
508
557
  getValue() {
509
558
  const e = this.spec.data;
510
559
  return Number(e.value ?? 0);
511
560
  }
512
561
  renderGauge() {
513
- const e = this.getOptions(), t = this.getValue(), a = e.max - e.min, i = a > 0 ? Math.max(0, Math.min(1, (t - e.min) / a)) : 0, r = this.getThresholdColor(t, e), n = 100, s = 100, l = 80, p = 150, d = 240, g = p + d * i, f = oe(n, s, l, p, p + d), u = i > 0 ? oe(n, s, l, p, g) : null, m = typeof this.spec.title == "string" ? this.spec.title : "Gauge", v = `${t}${e.unit}`;
562
+ const e = this.getOptions(), t = this.getValue(), a = e.max - e.min, r = a > 0 ? Math.max(0, Math.min(1, (t - e.min) / a)) : 0, i = this.getThresholdColor(t, e), s = 100, n = 100, d = 80, c = 150, p = 240, g = c + p * r, f = le(s, n, d, c, c + p), u = r > 0 ? le(s, n, d, c, g) : null, m = typeof this.spec.title == "string" ? this.spec.title : "Gauge", v = `${t}${e.unit}`;
514
563
  return o`
515
564
  <div class="gauge-container" part="gauge"
516
565
  role="meter"
@@ -523,36 +572,36 @@ let B = class extends w {
523
572
  <div class="gauge-wrapper">
524
573
  <div class="gauge-center">
525
574
  <div class="gauge-value" part="value">${t}</div>
526
- ${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : c}
575
+ ${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : l}
527
576
  </div>
528
577
  <svg class="gauge-svg" viewBox="0 0 200 195" role="presentation" aria-hidden="true">
529
578
  <path class="gauge-track" d="${f}" fill="none" stroke-width="12" stroke-linecap="round"></path>
530
- <path class="gauge-fill" d="${u ?? "M0 0"}" fill="none" stroke="${u ? r : "none"}" stroke-width="12" stroke-linecap="round"></path>
579
+ <path class="gauge-fill" d="${u ?? "M0 0"}" fill="none" stroke="${u ? i : "none"}" stroke-width="12" stroke-linecap="round"></path>
531
580
  </svg>
532
581
  </div>
533
582
  </div>
534
583
  `;
535
584
  }
536
585
  renderProgress() {
537
- const e = this.spec.data, t = Number(e.value ?? 0), a = Number(e.max ?? this.spec.options?.max ?? 100), i = a > 0 ? Math.max(0, Math.min(100, t / a * 100)) : 0, r = this.getOptions(), n = this.getThresholdColor(t, r), s = this.formatLabel(t, i), l = typeof this.spec.title == "string" ? this.spec.title : "Progress";
586
+ const e = this.spec.data, t = Number(e.value ?? 0), a = Number(e.max ?? this.spec.options?.max ?? 100), r = a > 0 ? Math.max(0, Math.min(100, t / a * 100)) : 0, i = this.getOptions(), s = this.getThresholdColor(t, i), n = this.formatLabel(t, r), d = typeof this.spec.title == "string" ? this.spec.title : "Progress";
538
587
  return o`
539
588
  <div class="progress-container" part="progress"
540
589
  role="progressbar"
541
590
  aria-valuenow=${t}
542
591
  aria-valuemin=${0}
543
592
  aria-valuemax=${a}
544
- aria-label=${l}
593
+ aria-label=${d}
545
594
  >
546
595
  <div class="progress-bar-track">
547
596
  <div
548
597
  class="progress-bar-fill"
549
- style="width:${i}%; background:${n || "var(--u-widget-primary, #4f46e5)"}"
598
+ style="width:${r}%; background:${s || "var(--u-widget-primary, #4f46e5)"}"
550
599
  part="progress-fill"
551
600
  ></div>
552
601
  </div>
553
602
  <div class="progress-info">
554
- <span>${s}</span>
555
- <span>${Math.round(i)}%</span>
603
+ <span>${n}</span>
604
+ <span>${Math.round(r)}%</span>
556
605
  </div>
557
606
  </div>
558
607
  `;
@@ -563,13 +612,13 @@ let B = class extends w {
563
612
  }
564
613
  getThresholdColor(e, t) {
565
614
  if (!t.thresholds?.length) return "var(--u-widget-primary, #4f46e5)";
566
- const a = [...t.thresholds].sort((i, r) => i.to - r.to);
567
- for (const i of a)
568
- if (e <= i.to) return ne(i.color);
569
- return ne(a[a.length - 1].color);
615
+ const a = [...t.thresholds].sort((r, i) => r.to - i.to);
616
+ for (const r of a)
617
+ if (e <= r.to) return oe(r.color);
618
+ return oe(a[a.length - 1].color);
570
619
  }
571
620
  };
572
- B.styles = [b, y`
621
+ W.styles = [b, w`
573
622
  :host {
574
623
  display: block;
575
624
  font-family: system-ui, -apple-system, sans-serif;
@@ -665,70 +714,70 @@ B.styles = [b, y`
665
714
  }
666
715
  }
667
716
  `];
668
- ue([
717
+ fe([
669
718
  h({ type: Object })
670
- ], B.prototype, "spec", 2);
671
- B = ue([
719
+ ], W.prototype, "spec", 2);
720
+ W = fe([
672
721
  x("u-gauge")
673
- ], B);
674
- var Me = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, C = (e, t, a, i) => {
675
- for (var r = i > 1 ? void 0 : i ? Ue(t, a) : t, n = e.length - 1, s; n >= 0; n--)
676
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
677
- return i && r && Me(t, a, r), r;
722
+ ], W);
723
+ var qe = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, C = (e, t, a, r) => {
724
+ for (var i = r > 1 ? void 0 : r ? Be(t, a) : t, s = e.length - 1, n; s >= 0; s--)
725
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
726
+ return r && i && qe(t, a, i), i;
678
727
  };
679
- let z = class extends w {
728
+ let z = class extends y {
680
729
  constructor() {
681
730
  super(...arguments), this.spec = null, this._sortField = null, this._sortDir = null, this._page = 0, this._searchQuery = "", this._focusedIdx = 0, this._onTableKeydown = (e) => {
682
731
  const a = e.target.closest("tr");
683
732
  if (!a) return;
684
- const i = a.parentElement;
685
- if (!i) return;
686
- const r = Array.from(i.querySelectorAll("tr")), n = r.indexOf(a);
687
- let s = -1;
733
+ const r = a.parentElement;
734
+ if (!r) return;
735
+ const i = Array.from(r.querySelectorAll("tr")), s = i.indexOf(a);
736
+ let n = -1;
688
737
  switch (e.key) {
689
738
  case "ArrowDown":
690
- s = Math.min(n + 1, r.length - 1);
739
+ n = Math.min(s + 1, i.length - 1);
691
740
  break;
692
741
  case "ArrowUp":
693
- s = Math.max(n - 1, 0);
742
+ n = Math.max(s - 1, 0);
694
743
  break;
695
744
  case "Home":
696
- s = 0;
745
+ n = 0;
697
746
  break;
698
747
  case "End":
699
- s = r.length - 1;
748
+ n = i.length - 1;
700
749
  break;
701
750
  default:
702
751
  return;
703
752
  }
704
- e.preventDefault(), s !== n && s >= 0 && (this._focusedIdx = s, this.updateComplete.then(() => {
705
- this.shadowRoot?.querySelectorAll("tbody tr")?.[s]?.focus();
753
+ e.preventDefault(), n !== s && n >= 0 && (this._focusedIdx = n, this.updateComplete.then(() => {
754
+ this.shadowRoot?.querySelectorAll("tbody tr")?.[n]?.focus();
706
755
  }));
707
756
  }, this._onListKeydown = (e) => {
708
757
  const a = e.target.closest(".list-item");
709
758
  if (!a) return;
710
- const i = a.parentElement;
711
- if (!i) return;
712
- const r = Array.from(i.querySelectorAll(".list-item")), n = r.indexOf(a);
713
- let s = -1;
759
+ const r = a.parentElement;
760
+ if (!r) return;
761
+ const i = Array.from(r.querySelectorAll(".list-item")), s = i.indexOf(a);
762
+ let n = -1;
714
763
  switch (e.key) {
715
764
  case "ArrowDown":
716
- s = Math.min(n + 1, r.length - 1);
765
+ n = Math.min(s + 1, i.length - 1);
717
766
  break;
718
767
  case "ArrowUp":
719
- s = Math.max(n - 1, 0);
768
+ n = Math.max(s - 1, 0);
720
769
  break;
721
770
  case "Home":
722
- s = 0;
771
+ n = 0;
723
772
  break;
724
773
  case "End":
725
- s = r.length - 1;
774
+ n = i.length - 1;
726
775
  break;
727
776
  default:
728
777
  return;
729
778
  }
730
- e.preventDefault(), s !== n && s >= 0 && (this._focusedIdx = s, this.updateComplete.then(() => {
731
- this.shadowRoot?.querySelectorAll(".list-item")?.[s]?.focus();
779
+ e.preventDefault(), n !== s && n >= 0 && (this._focusedIdx = n, this.updateComplete.then(() => {
780
+ this.shadowRoot?.querySelectorAll(".list-item")?.[n]?.focus();
732
781
  }));
733
782
  }, this._onSearch = (e) => {
734
783
  this._searchQuery = e.target.value, this._page = 0;
@@ -738,14 +787,14 @@ let z = class extends w {
738
787
  e.has("spec") && (this._sortField = null, this._sortDir = null, this._page = 0, this._searchQuery = "", this._focusedIdx = 0);
739
788
  }
740
789
  render() {
741
- return !this.spec?.data || !Array.isArray(this.spec.data) ? c : this.spec.widget === "list" ? this.renderList() : this.renderTable();
790
+ return !this.spec?.data || !Array.isArray(this.spec.data) ? l : this.spec.widget === "list" ? this.renderList() : this.renderTable();
742
791
  }
743
792
  get _locale() {
744
793
  const e = this.spec?.options?.locale;
745
- return de(typeof e == "string" ? e : void 0);
794
+ return ue(typeof e == "string" ? e : void 0);
746
795
  }
747
796
  renderTable() {
748
- const e = this.spec.data, t = this.getColumns(e), a = this._locale, i = this.spec.options?.sortable !== !1, r = !!this.spec.options?.searchable, n = !!this.spec.options?.compact, s = Number(this.spec.options?.pageSize) || 0, l = this._searchQuery ? this.filterData(e, t) : e, p = this._sortField && this._sortDir ? this.sortData(l) : l, d = s > 0 ? Math.max(1, Math.ceil(p.length / s)) : 1, g = Math.min(this._page, d - 1), f = s > 0 ? p.slice(g * s, (g + 1) * s) : p, u = r ? o`
797
+ const e = this.spec.data, t = this.getColumns(e), a = this._locale, r = this.spec.options?.sortable !== !1, i = !!this.spec.options?.searchable, s = !!this.spec.options?.compact, n = Number(this.spec.options?.pageSize) || 0, d = this._searchQuery ? this.filterData(e, t) : e, c = this._sortField && this._sortDir ? this.sortData(d) : d, p = n > 0 ? Math.max(1, Math.ceil(c.length / n)) : 1, g = Math.min(this._page, p - 1), f = n > 0 ? c.slice(g * n, (g + 1) * n) : c, u = i ? o`
749
798
  <div class="search-box" part="search">
750
799
  <input
751
800
  class="search-input"
@@ -756,14 +805,14 @@ let z = class extends w {
756
805
  @input=${this._onSearch}
757
806
  />
758
807
  </div>
759
- ` : c, m = s > 0 && d > 1 ? o`
808
+ ` : l, m = n > 0 && p > 1 ? o`
760
809
  <nav class="pagination" part="pagination" aria-label=${a.tablePagination}>
761
810
  <button aria-label=${a.previousPage} ?disabled=${g === 0} @click=${() => this._onPageChange(g - 1)}>${a.prev}</button>
762
- <span aria-live="polite">${g + 1} / ${d}</span>
763
- <button aria-label=${a.nextPage} ?disabled=${g >= d - 1} @click=${() => this._onPageChange(g + 1)}>${a.next}</button>
811
+ <span aria-live="polite">${g + 1} / ${p}</span>
812
+ <button aria-label=${a.nextPage} ?disabled=${g >= p - 1} @click=${() => this._onPageChange(g + 1)}>${a.next}</button>
764
813
  </nav>
765
- ` : c;
766
- return o`<div class="table-container${n ? " compact" : ""}">
814
+ ` : l;
815
+ return o`<div class="table-container${s ? " compact" : ""}">
767
816
  ${u}
768
817
  <div class="table-wrapper" part="table">
769
818
  <table aria-label=${this.spec.title ?? a.dataTable}>
@@ -773,15 +822,15 @@ let z = class extends w {
773
822
  (v) => o`<th
774
823
  scope="col"
775
824
  data-align=${v.align ?? "left"}
776
- ?data-sortable=${i}
777
- tabindex=${i ? "0" : c}
778
- @click=${i ? () => this._onSort(v.field) : void 0}
779
- @keydown=${i ? ($) => {
825
+ ?data-sortable=${r}
826
+ tabindex=${r ? "0" : l}
827
+ @click=${r ? () => this._onSort(v.field) : void 0}
828
+ @keydown=${r ? ($) => {
780
829
  ($.key === "Enter" || $.key === " ") && ($.preventDefault(), this._onSort(v.field));
781
830
  } : void 0}
782
831
  aria-sort=${this._sortField === v.field && this._sortDir ? this._sortDir === "asc" ? "ascending" : "descending" : "none"}
783
832
  part="th"
784
- >${v.label ?? v.field}${this._sortField === v.field && this._sortDir ? o`<span class="sort-arrow">${this._sortDir === "asc" ? "▲" : "▼"}</span>` : c}</th>`
833
+ >${v.label ?? v.field}${this._sortField === v.field && this._sortDir ? o`<span class="sort-arrow">${this._sortDir === "asc" ? "▲" : "▼"}</span>` : l}</th>`
785
834
  )}
786
835
  </tr>
787
836
  </thead>
@@ -790,14 +839,14 @@ let z = class extends w {
790
839
  (v, $) => o`
791
840
  <tr part="tr"
792
841
  tabindex=${$ === this._focusedIdx ? "0" : "-1"}
793
- @click=${() => this._onRowClick(v, s > 0 ? g * s + $ : $)}
842
+ @click=${() => this._onRowClick(v, n > 0 ? g * n + $ : $)}
794
843
  @keydown=${(_) => {
795
- (_.key === "Enter" || _.key === " ") && (_.preventDefault(), this._onRowClick(v, s > 0 ? g * s + $ : $));
844
+ (_.key === "Enter" || _.key === " ") && (_.preventDefault(), this._onRowClick(v, n > 0 ? g * n + $ : $));
796
845
  }}
797
846
  >
798
847
  ${t.map(
799
848
  (_) => o`<td data-align=${_.align ?? "left"} part="td"
800
- >${_e(v[_.field], _.format, typeof this.spec.options?.locale == "string" ? this.spec.options.locale : void 0)}</td
849
+ >${pe(v[_.field], _.format, typeof this.spec.options?.locale == "string" ? this.spec.options.locale : void 0)}</td
801
850
  >`
802
851
  )}
803
852
  </tr>
@@ -815,9 +864,9 @@ let z = class extends w {
815
864
  });
816
865
  }
817
866
  filterData(e, t) {
818
- const a = this._searchQuery.toLowerCase(), i = t.map((r) => r.field);
867
+ const a = this._searchQuery.toLowerCase(), r = t.map((i) => i.field);
819
868
  return e.filter(
820
- (r) => i.some((n) => String(r[n] ?? "").toLowerCase().includes(a))
869
+ (i) => r.some((s) => String(i[s] ?? "").toLowerCase().includes(a))
821
870
  );
822
871
  }
823
872
  _onSort(e) {
@@ -825,41 +874,41 @@ let z = class extends w {
825
874
  }
826
875
  sortData(e) {
827
876
  const t = this._sortField, a = this._sortDir;
828
- return [...e].sort((i, r) => {
829
- const n = i[t], s = r[t];
830
- if (n == null && s == null) return 0;
831
- if (n == null) return 1;
832
- if (s == null) return -1;
833
- let l;
834
- if (typeof n == "number" && typeof s == "number")
835
- l = n - s;
877
+ return [...e].sort((r, i) => {
878
+ const s = r[t], n = i[t];
879
+ if (s == null && n == null) return 0;
880
+ if (s == null) return 1;
881
+ if (n == null) return -1;
882
+ let d;
883
+ if (typeof s == "number" && typeof n == "number")
884
+ d = s - n;
836
885
  else {
837
- const p = Number(n), d = Number(s);
838
- l = String(n) !== "" && String(s) !== "" && !isNaN(p) && !isNaN(d) ? p - d : String(n).localeCompare(String(s));
886
+ const c = Number(s), p = Number(n);
887
+ d = String(s) !== "" && String(n) !== "" && !isNaN(c) && !isNaN(p) ? c - p : String(s).localeCompare(String(n));
839
888
  }
840
- return a === "asc" ? l : -l;
889
+ return a === "asc" ? d : -d;
841
890
  });
842
891
  }
843
892
  renderList() {
844
- const e = this.spec.data, t = this.spec.mapping, a = !!this.spec.options?.compact, i = t?.primary ?? this.inferPrimaryKey(e), r = t?.secondary, n = t?.icon, s = t?.avatar, l = t?.trailing, p = t?.badge;
893
+ const e = this.spec.data, t = this.spec.mapping, a = !!this.spec.options?.compact, r = t?.primary ?? this.inferPrimaryKey(e), i = t?.secondary, s = t?.icon, n = t?.avatar, d = t?.trailing, c = t?.badge;
845
894
  return o`
846
895
  <div class="list-container${a ? " compact" : ""}" part="list" @keydown=${this._onListKeydown}>
847
896
  ${e.map(
848
- (d, g) => o`
897
+ (p, g) => o`
849
898
  <div class="list-item" part="list-item"
850
899
  tabindex=${g === this._focusedIdx ? "0" : "-1"}
851
- @click=${() => this._onRowClick(d, g)}
900
+ @click=${() => this._onRowClick(p, g)}
852
901
  @keydown=${(f) => {
853
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), this._onRowClick(d, g));
902
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), this._onRowClick(p, g));
854
903
  }}
855
904
  >
856
- ${s && d[s] ? o`<img class="list-avatar" src=${String(d[s])} alt="" part="avatar" />` : n ? o`<div class="list-icon" part="icon">${this.getIconLetter(d[n])}</div>` : c}
905
+ ${n && p[n] ? o`<img class="list-avatar" src=${String(p[n])} alt="" part="avatar" />` : s ? o`<div class="list-icon" part="icon">${this.getIconLetter(p[s])}</div>` : l}
857
906
  <div class="list-content">
858
- <div class="list-primary" part="primary">${d[i] ?? ""}</div>
859
- ${r ? o`<div class="list-secondary" part="secondary">${d[r] ?? ""}</div>` : c}
907
+ <div class="list-primary" part="primary">${p[r] ?? ""}</div>
908
+ ${i ? o`<div class="list-secondary" part="secondary">${p[i] ?? ""}</div>` : l}
860
909
  </div>
861
- ${p && d[p] != null ? o`<span class="list-badge" part="badge">${d[p]}</span>` : c}
862
- ${l && d[l] != null ? o`<div class="list-trailing" part="trailing">${d[l]}</div>` : c}
910
+ ${c && p[c] != null ? o`<span class="list-badge" part="badge">${p[c]}</span>` : l}
911
+ ${d && p[d] != null ? o`<div class="list-trailing" part="trailing">${p[d]}</div>` : l}
863
912
  </div>
864
913
  `
865
914
  )}
@@ -888,16 +937,16 @@ let z = class extends w {
888
937
  inferPrimaryKey(e) {
889
938
  if (e.length === 0) return "";
890
939
  const t = Object.keys(e[0]), a = ["name", "title", "label", "id", "key"];
891
- for (const n of a)
892
- if (t.includes(n)) return n;
893
- const i = e[0];
894
- return t.find((n) => typeof i[n] == "string") ?? t[0] ?? "";
940
+ for (const s of a)
941
+ if (t.includes(s)) return s;
942
+ const r = e[0];
943
+ return t.find((s) => typeof r[s] == "string") ?? t[0] ?? "";
895
944
  }
896
945
  getIconLetter(e) {
897
946
  return String(e ?? "").charAt(0).toUpperCase();
898
947
  }
899
948
  };
900
- z.styles = [b, y`
949
+ z.styles = [b, w`
901
950
  :host {
902
951
  display: block;
903
952
  font-family: system-ui, -apple-system, sans-serif;
@@ -1227,12 +1276,12 @@ C([
1227
1276
  z = C([
1228
1277
  x("u-table")
1229
1278
  ], z);
1230
- var Re = Object.defineProperty, qe = Object.getOwnPropertyDescriptor, K = (e, t, a, i) => {
1231
- for (var r = i > 1 ? void 0 : i ? qe(t, a) : t, n = e.length - 1, s; n >= 0; n--)
1232
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
1233
- return i && r && Re(t, a, r), r;
1279
+ var We = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, V = (e, t, a, r) => {
1280
+ for (var i = r > 1 ? void 0 : r ? Ke(t, a) : t, s = e.length - 1, n; s >= 0; s--)
1281
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
1282
+ return r && i && We(t, a, i), i;
1234
1283
  };
1235
- let D = class extends w {
1284
+ let j = class extends y {
1236
1285
  constructor() {
1237
1286
  super(...arguments), this.spec = null, this._formData = {}, this._errors = {}, this._onFormSubmit = (e) => {
1238
1287
  e.preventDefault();
@@ -1254,14 +1303,14 @@ let D = class extends w {
1254
1303
  e.has("spec") && this.spec && (this._formData = { ...this.spec.data ?? {} }, this._errors = {});
1255
1304
  }
1256
1305
  render() {
1257
- return this.spec ? this.spec.widget === "confirm" ? this.renderConfirm() : this.renderForm() : c;
1306
+ return this.spec ? this.spec.widget === "confirm" ? this.renderConfirm() : this.renderForm() : l;
1258
1307
  }
1259
1308
  renderForm() {
1260
1309
  const e = this.spec.fields ?? [], t = this.spec.actions ?? [];
1261
1310
  return o`
1262
1311
  <form class="form-container" part="form" @submit=${this._onFormSubmit}>
1263
1312
  ${e.map((a) => this.renderField(a))}
1264
- ${t.length > 0 ? this.renderActions(t) : c}
1313
+ ${t.length > 0 ? this.renderActions(t) : l}
1265
1314
  </form>
1266
1315
  `;
1267
1316
  }
@@ -1269,76 +1318,76 @@ let D = class extends w {
1269
1318
  const e = this.spec.description, t = this.spec.actions ?? [];
1270
1319
  return o`
1271
1320
  <div class="confirm-container" part="confirm" @keydown=${this._onConfirmKeydown}>
1272
- ${e ? o`<div class="confirm-description" part="description">${e}</div>` : c}
1273
- ${t.length > 0 ? this.renderActions(t) : c}
1321
+ ${e ? o`<div class="confirm-description" part="description">${e}</div>` : l}
1322
+ ${t.length > 0 ? this.renderActions(t) : l}
1274
1323
  </div>
1275
1324
  `;
1276
1325
  }
1277
1326
  renderField(e) {
1278
- const t = this._formData[e.field], a = e.type ?? "text", i = this._errors[e.field], r = `err-${e.field}`;
1327
+ const t = this._formData[e.field], a = e.type ?? "text", r = this._errors[e.field], i = `err-${e.field}`;
1279
1328
  return o`
1280
1329
  <div class="field" part="field">
1281
1330
  ${e.label ? o`<label class="field-label" for=${`input-${e.field}`} part="label"
1282
- >${e.label}${e.required ? o`<span class="required">*</span>` : c}</label
1283
- >` : c}
1284
- ${this.renderInput(e, a, t, i ? r : void 0)}
1285
- ${i ? o`<div class="field-error" id=${r} role="alert" part="field-error">${i}</div>` : c}
1331
+ >${e.label}${e.required ? o`<span class="required">*</span>` : l}</label
1332
+ >` : l}
1333
+ ${this.renderInput(e, a, t, r ? i : void 0)}
1334
+ ${r ? o`<div class="field-error" id=${i} role="alert" part="field-error">${r}</div>` : l}
1286
1335
  </div>
1287
1336
  `;
1288
1337
  }
1289
- renderInput(e, t, a, i) {
1290
- const r = !!this._errors[e.field];
1338
+ renderInput(e, t, a, r) {
1339
+ const i = !!this._errors[e.field];
1291
1340
  switch (t) {
1292
1341
  case "textarea":
1293
1342
  return o`<textarea
1294
1343
  id=${`input-${e.field}`}
1295
- class=${r ? "invalid" : ""}
1344
+ class=${i ? "invalid" : ""}
1296
1345
  .value=${String(a ?? "")}
1297
1346
  placeholder=${e.placeholder ?? ""}
1298
1347
  rows=${e.rows ?? 3}
1299
1348
  ?required=${e.required}
1300
1349
  minlength=${e.minLength ?? ""}
1301
1350
  maxlength=${e.maxLength ?? ""}
1302
- aria-invalid=${r ? "true" : "false"}
1303
- aria-describedby=${i ?? c}
1351
+ aria-invalid=${i ? "true" : "false"}
1352
+ aria-describedby=${r ?? l}
1304
1353
  ?aria-required=${e.required}
1305
- @input=${(n) => this._onChange(e.field, n.target.value)}
1354
+ @input=${(s) => this._onChange(e.field, s.target.value)}
1306
1355
  part="input"
1307
1356
  ></textarea>`;
1308
1357
  case "select":
1309
1358
  return o`<select
1310
1359
  id=${`input-${e.field}`}
1311
- class=${r ? "invalid" : ""}
1360
+ class=${i ? "invalid" : ""}
1312
1361
  .value=${String(a ?? "")}
1313
1362
  ?required=${e.required}
1314
- aria-invalid=${r ? "true" : "false"}
1315
- aria-describedby=${i ?? c}
1316
- @change=${(n) => this._onChange(e.field, n.target.value)}
1363
+ aria-invalid=${i ? "true" : "false"}
1364
+ aria-describedby=${r ?? l}
1365
+ @change=${(s) => this._onChange(e.field, s.target.value)}
1317
1366
  part="input"
1318
1367
  >
1319
1368
  <option value="">--</option>
1320
1369
  ${(e.options ?? []).map(
1321
- (n) => o`<option value=${n}>${n}</option>`
1370
+ (s) => o`<option value=${s}>${s}</option>`
1322
1371
  )}
1323
1372
  </select>`;
1324
1373
  case "multiselect":
1325
- return o`<div class="multiselect-group" part="multiselect-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${r ? "true" : "false"} aria-describedby=${i ?? c}>
1374
+ return o`<div class="multiselect-group" part="multiselect-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${i ? "true" : "false"} aria-describedby=${r ?? l}>
1326
1375
  ${(e.options ?? []).map(
1327
- (n) => o`
1376
+ (s) => o`
1328
1377
  <label>
1329
1378
  <input
1330
1379
  type="checkbox"
1331
- value=${n}
1332
- ?checked=${Array.isArray(a) && a.includes(n)}
1333
- @change=${(s) => {
1334
- const l = s.target.checked, p = Array.isArray(a) ? [...a] : [];
1380
+ value=${s}
1381
+ ?checked=${Array.isArray(a) && a.includes(s)}
1382
+ @change=${(n) => {
1383
+ const d = n.target.checked, c = Array.isArray(a) ? [...a] : [];
1335
1384
  this._onChange(
1336
1385
  e.field,
1337
- l ? [...p, n] : p.filter((d) => d !== n)
1386
+ d ? [...c, s] : c.filter((p) => p !== s)
1338
1387
  );
1339
1388
  }}
1340
1389
  />
1341
- ${n}
1390
+ ${s}
1342
1391
  </label>
1343
1392
  `
1344
1393
  )}
@@ -1353,8 +1402,8 @@ let D = class extends w {
1353
1402
  aria-label=${e.label ?? e.field}
1354
1403
  tabindex="0"
1355
1404
  @click=${() => this._onChange(e.field, !a)}
1356
- @keydown=${(n) => {
1357
- (n.key === " " || n.key === "Enter") && (n.preventDefault(), this._onChange(e.field, !a));
1405
+ @keydown=${(s) => {
1406
+ (s.key === " " || s.key === "Enter") && (s.preventDefault(), this._onChange(e.field, !a));
1358
1407
  }}
1359
1408
  part="toggle"
1360
1409
  >
@@ -1362,40 +1411,40 @@ let D = class extends w {
1362
1411
  </div>
1363
1412
  </div>`;
1364
1413
  case "radio":
1365
- return o`<div class="radio-group" part="radio-group" role="radiogroup" aria-label=${e.label ?? e.field} aria-invalid=${r ? "true" : "false"} aria-describedby=${i ?? c}>
1414
+ return o`<div class="radio-group" part="radio-group" role="radiogroup" aria-label=${e.label ?? e.field} aria-invalid=${i ? "true" : "false"} aria-describedby=${r ?? l}>
1366
1415
  ${(e.options ?? []).map(
1367
- (n) => o`
1416
+ (s) => o`
1368
1417
  <label>
1369
1418
  <input
1370
1419
  type="radio"
1371
1420
  name=${e.field}
1372
- value=${n}
1373
- ?checked=${a === n}
1374
- @change=${() => this._onChange(e.field, n)}
1421
+ value=${s}
1422
+ ?checked=${a === s}
1423
+ @change=${() => this._onChange(e.field, s)}
1375
1424
  />
1376
- ${n}
1425
+ ${s}
1377
1426
  </label>
1378
1427
  `
1379
1428
  )}
1380
1429
  </div>`;
1381
1430
  case "checkbox":
1382
- return o`<div class="checkbox-group" part="checkbox-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${r ? "true" : "false"} aria-describedby=${i ?? c}>
1431
+ return o`<div class="checkbox-group" part="checkbox-group" role="group" aria-label=${e.label ?? e.field} aria-invalid=${i ? "true" : "false"} aria-describedby=${r ?? l}>
1383
1432
  ${(e.options ?? []).map(
1384
- (n) => o`
1433
+ (s) => o`
1385
1434
  <label>
1386
1435
  <input
1387
1436
  type="checkbox"
1388
- value=${n}
1389
- ?checked=${Array.isArray(a) && a.includes(n)}
1390
- @change=${(s) => {
1391
- const l = s.target.checked, p = Array.isArray(a) ? [...a] : [];
1437
+ value=${s}
1438
+ ?checked=${Array.isArray(a) && a.includes(s)}
1439
+ @change=${(n) => {
1440
+ const d = n.target.checked, c = Array.isArray(a) ? [...a] : [];
1392
1441
  this._onChange(
1393
1442
  e.field,
1394
- l ? [...p, n] : p.filter((d) => d !== n)
1443
+ d ? [...c, s] : c.filter((p) => p !== s)
1395
1444
  );
1396
1445
  }}
1397
1446
  />
1398
- ${n}
1447
+ ${s}
1399
1448
  </label>
1400
1449
  `
1401
1450
  )}
@@ -1404,12 +1453,12 @@ let D = class extends w {
1404
1453
  return o`<input
1405
1454
  type=${t === "datetime" ? "datetime-local" : t}
1406
1455
  id=${`input-${e.field}`}
1407
- class=${r ? "invalid" : ""}
1456
+ class=${i ? "invalid" : ""}
1408
1457
  .value=${String(a ?? "")}
1409
1458
  placeholder=${e.placeholder ?? ""}
1410
1459
  ?required=${e.required}
1411
- aria-invalid=${r ? "true" : "false"}
1412
- aria-describedby=${i ?? c}
1460
+ aria-invalid=${i ? "true" : "false"}
1461
+ aria-describedby=${r ?? l}
1413
1462
  ?aria-required=${e.required}
1414
1463
  min=${e.min ?? ""}
1415
1464
  max=${e.max ?? ""}
@@ -1417,9 +1466,9 @@ let D = class extends w {
1417
1466
  minlength=${e.minLength ?? ""}
1418
1467
  maxlength=${e.maxLength ?? ""}
1419
1468
  pattern=${e.pattern ?? ""}
1420
- @input=${(s) => {
1421
- const l = s.target.value, p = (t === "number" || t === "range") && l !== "" ? Number(l) : l;
1422
- this._onChange(e.field, p);
1469
+ @input=${(n) => {
1470
+ const d = n.target.value, c = (t === "number" || t === "range") && d !== "" ? Number(d) : d;
1471
+ this._onChange(e.field, c);
1423
1472
  }}
1424
1473
  part="input"
1425
1474
  />`;
@@ -1460,32 +1509,32 @@ let D = class extends w {
1460
1509
  }
1461
1510
  get _locale() {
1462
1511
  const e = this.spec?.options?.locale;
1463
- return de(typeof e == "string" ? e : void 0);
1512
+ return ue(typeof e == "string" ? e : void 0);
1464
1513
  }
1465
1514
  _validate() {
1466
1515
  const e = this.spec?.fields ?? [], t = {}, a = this._locale;
1467
- for (const i of e) {
1468
- const r = this._formData[i.field], n = i.label ?? i.field;
1469
- if (i.required && (r == null || r === "" || Array.isArray(r) && r.length === 0)) {
1470
- t[i.field] = i.message ?? A(a.required, { label: n });
1516
+ for (const r of e) {
1517
+ const i = this._formData[r.field], s = r.label ?? r.field;
1518
+ if (r.required && (i == null || i === "" || Array.isArray(i) && i.length === 0)) {
1519
+ t[r.field] = r.message ?? A(a.required, { label: s });
1471
1520
  continue;
1472
1521
  }
1473
- if (!(r == null || r === "")) {
1474
- if (i.maxLength != null && typeof r == "string" && r.length > i.maxLength && (t[i.field] = i.message ?? A(a.maxLength, { label: n, max: i.maxLength })), i.min != null && typeof r == "number" && r < Number(i.min) && (t[i.field] = i.message ?? A(a.minValue, { label: n, min: i.min })), i.max != null && typeof r == "number" && r > Number(i.max) && (t[i.field] = i.message ?? A(a.maxValue, { label: n, max: i.max })), i.minLength != null && typeof r == "string" && r.length < i.minLength) {
1475
- t[i.field] = i.message ?? A(a.minLength, { label: n, min: i.minLength });
1522
+ if (!(i == null || i === "")) {
1523
+ if (r.maxLength != null && typeof i == "string" && i.length > r.maxLength && (t[r.field] = r.message ?? A(a.maxLength, { label: s, max: r.maxLength })), r.min != null && typeof i == "number" && i < Number(r.min) && (t[r.field] = r.message ?? A(a.minValue, { label: s, min: r.min })), r.max != null && typeof i == "number" && i > Number(r.max) && (t[r.field] = r.message ?? A(a.maxValue, { label: s, max: r.max })), r.minLength != null && typeof i == "string" && i.length < r.minLength) {
1524
+ t[r.field] = r.message ?? A(a.minLength, { label: s, min: r.minLength });
1476
1525
  continue;
1477
1526
  }
1478
- if (i.type === "email" && typeof r == "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)) {
1479
- t[i.field] = i.message ?? A(a.invalidEmail, { label: n });
1527
+ if (r.type === "email" && typeof i == "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)) {
1528
+ t[r.field] = r.message ?? A(a.invalidEmail, { label: s });
1480
1529
  continue;
1481
1530
  }
1482
- if (i.type === "url" && typeof r == "string" && !/^https?:\/\/.+/.test(r)) {
1483
- t[i.field] = i.message ?? A(a.invalidUrl, { label: n });
1531
+ if (r.type === "url" && typeof i == "string" && !/^https?:\/\/.+/.test(i)) {
1532
+ t[r.field] = r.message ?? A(a.invalidUrl, { label: s });
1484
1533
  continue;
1485
1534
  }
1486
- if (i.pattern && typeof r == "string")
1535
+ if (r.pattern && typeof i == "string")
1487
1536
  try {
1488
- new RegExp(i.pattern).test(r) || (t[i.field] = i.message ?? A(a.invalidPattern, { label: n }));
1537
+ new RegExp(r.pattern).test(i) || (t[r.field] = r.message ?? A(a.invalidPattern, { label: s }));
1489
1538
  } catch {
1490
1539
  }
1491
1540
  }
@@ -1524,7 +1573,7 @@ let D = class extends w {
1524
1573
  );
1525
1574
  }
1526
1575
  };
1527
- D.styles = [b, y`
1576
+ j.styles = [b, w`
1528
1577
  :host {
1529
1578
  display: block;
1530
1579
  font-family: system-ui, -apple-system, sans-serif;
@@ -1742,64 +1791,64 @@ D.styles = [b, y`
1742
1791
  }
1743
1792
  }
1744
1793
  `];
1745
- K([
1794
+ V([
1746
1795
  h({ type: Object })
1747
- ], D.prototype, "spec", 2);
1748
- K([
1796
+ ], j.prototype, "spec", 2);
1797
+ V([
1749
1798
  S()
1750
- ], D.prototype, "_formData", 2);
1751
- K([
1799
+ ], j.prototype, "_formData", 2);
1800
+ V([
1752
1801
  S()
1753
- ], D.prototype, "_errors", 2);
1754
- D = K([
1802
+ ], j.prototype, "_errors", 2);
1803
+ j = V([
1755
1804
  x("u-form")
1756
- ], D);
1757
- var Be = Object.defineProperty, We = Object.getOwnPropertyDescriptor, Z = (e, t, a, i) => {
1758
- for (var r = i > 1 ? void 0 : i ? We(t, a) : t, n = e.length - 1, s; n >= 0; n--)
1759
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
1760
- return i && r && Be(t, a, r), r;
1805
+ ], j);
1806
+ var He = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, Z = (e, t, a, r) => {
1807
+ for (var i = r > 1 ? void 0 : r ? Ve(t, a) : t, s = e.length - 1, n; s >= 0; s--)
1808
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
1809
+ return r && i && He(t, a, i), i;
1761
1810
  };
1762
- let I = class extends w {
1811
+ let I = class extends y {
1763
1812
  constructor() {
1764
1813
  super(...arguments), this.spec = null, this.theme = null;
1765
1814
  }
1766
1815
  render() {
1767
- if (!this.spec) return c;
1768
- const e = this.spec.layout ?? "stack", t = this.spec.columns ?? 2, a = this.spec.children ?? [], i = this.spec.title, r = a.map((s) => this._child(s)), n = i ? "region" : void 0;
1816
+ if (!this.spec) return l;
1817
+ const e = this.spec.layout ?? "stack", t = this.spec.columns ?? 2, a = this.spec.children ?? [], r = this.spec.title, i = a.map((n) => this._child(n)), s = r ? "region" : void 0;
1769
1818
  if (e === "row")
1770
- return o`<div class="compose-container" part="compose" role=${n ?? c} aria-label=${i ?? c}>${i ? o`<div class="compose-title" part="title">${i}</div>` : c}<div class="layout-row" part="layout">${r}</div></div>`;
1819
+ return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-row" part="layout">${i}</div></div>`;
1771
1820
  if (e === "grid") {
1772
- const s = this._gridColumns(t);
1773
- return o`<div class="compose-container" part="compose" role=${n ?? c} aria-label=${i ?? c}>${i ? o`<div class="compose-title" part="title">${i}</div>` : c}<div class="layout-grid" part="layout" style="grid-template-columns: ${s}">${r}</div></div>`;
1821
+ const n = this._gridColumns(t);
1822
+ return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-grid" part="layout" style="grid-template-columns: ${n}">${i}</div></div>`;
1774
1823
  }
1775
- return o`<div class="compose-container" part="compose" role=${n ?? c} aria-label=${i ?? c}>${i ? o`<div class="compose-title" part="title">${i}</div>` : c}<div class="layout-stack" part="layout">${r}</div></div>`;
1824
+ return o`<div class="compose-container" part="compose" role=${s ?? l} aria-label=${r ?? l}>${r ? o`<div class="compose-title" part="title">${r}</div>` : l}<div class="layout-stack" part="layout">${i}</div></div>`;
1776
1825
  }
1777
1826
  /** Compute grid-template-columns from options.widths or fallback to equal columns. */
1778
1827
  _gridColumns(e) {
1779
1828
  const a = (this.spec?.options ?? {}).widths;
1780
- return !Array.isArray(a) || a.length === 0 ? `repeat(${e}, 1fr)` : a.map((i) => {
1781
- if (i === "auto") return "auto";
1782
- if (i === "stretch") return "1fr";
1783
- const r = Number(i);
1784
- return Number.isFinite(r) && r > 0 ? `${r}fr` : "1fr";
1829
+ return !Array.isArray(a) || a.length === 0 ? `repeat(${e}, 1fr)` : a.map((r) => {
1830
+ if (r === "auto") return "auto";
1831
+ if (r === "stretch") return "1fr";
1832
+ const i = Number(r);
1833
+ return Number.isFinite(i) && i > 0 ? `${i}fr` : "1fr";
1785
1834
  }).join(" ");
1786
1835
  }
1787
1836
  _child(e) {
1788
- const t = this.theme, a = e.span ? Math.max(1, Math.floor(Number(e.span) || 1)) : 0, i = a > 1 ? `grid-column: span ${a}` : "", n = !!(this.spec?.options ?? {}).card, s = o`<u-widget .spec=${e} theme=${t ?? c}></u-widget>`;
1837
+ const t = this.theme, a = e.span ? Math.max(1, Math.floor(Number(e.span) || 1)) : 0, r = a > 1 ? `grid-column: span ${a}` : "", s = !!(this.spec?.options ?? {}).card, n = o`<u-widget .spec=${e} theme=${t ?? l}></u-widget>`;
1789
1838
  if (e.collapsed) {
1790
- const p = e.title || "Details";
1839
+ const c = e.title || "Details";
1791
1840
  return o`
1792
- <details class="child-collapsed" part="child" style=${i || c}>
1793
- <summary part="collapsed-summary">${p}</summary>
1794
- <div class="collapsed-content">${s}</div>
1841
+ <details class="child-collapsed" part="child" style=${r || l}>
1842
+ <summary part="collapsed-summary">${c}</summary>
1843
+ <div class="collapsed-content">${n}</div>
1795
1844
  </details>
1796
1845
  `;
1797
1846
  }
1798
- const l = n ? "child child-card" : "child";
1799
- return i ? o`<div class=${l} style=${i} part="child">${s}</div>` : o`<div class=${l} part="child">${s}</div>`;
1847
+ const d = s ? "child child-card" : "child";
1848
+ return r ? o`<div class=${d} style=${r} part="child">${n}</div>` : o`<div class=${d} part="child">${n}</div>`;
1800
1849
  }
1801
1850
  };
1802
- I.styles = [b, y`
1851
+ I.styles = [b, w`
1803
1852
  :host {
1804
1853
  display: block;
1805
1854
  container: u-compose / inline-size;
@@ -1905,17 +1954,17 @@ Z([
1905
1954
  I = Z([
1906
1955
  x("u-compose")
1907
1956
  ], I);
1908
- var He = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, ge = (e, t, a, i) => {
1909
- for (var r = i > 1 ? void 0 : i ? Ke(t, a) : t, n = e.length - 1, s; n >= 0; n--)
1910
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
1911
- return i && r && He(t, a, r), r;
1957
+ var Ge = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, he = (e, t, a, r) => {
1958
+ for (var i = r > 1 ? void 0 : r ? Xe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
1959
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
1960
+ return r && i && Ge(t, a, i), i;
1912
1961
  };
1913
- let W = class extends w {
1962
+ let K = class extends y {
1914
1963
  constructor() {
1915
1964
  super(...arguments), this.spec = null;
1916
1965
  }
1917
1966
  render() {
1918
- if (!this.spec) return c;
1967
+ if (!this.spec) return l;
1919
1968
  switch (this.spec.widget) {
1920
1969
  case "markdown":
1921
1970
  return this.renderMarkdown();
@@ -1924,30 +1973,30 @@ let W = class extends w {
1924
1973
  case "callout":
1925
1974
  return this.renderCallout();
1926
1975
  default:
1927
- return c;
1976
+ return l;
1928
1977
  }
1929
1978
  }
1930
1979
  renderMarkdown() {
1931
1980
  const e = this.spec.data, t = typeof e == "string" ? e : e?.content ?? "";
1932
1981
  return t ? o`<div class="markdown" part="markdown"
1933
1982
  .innerHTML=${this.parseMarkdown(t)}
1934
- ></div>` : c;
1983
+ ></div>` : l;
1935
1984
  }
1936
1985
  renderImage() {
1937
1986
  const e = this.spec.data;
1938
- if (!e) return c;
1939
- const t = String(e.src ?? ""), a = String(e.alt ?? ""), i = e.caption, r = this.sanitizeUrl(t);
1940
- return r ? o`<div class="image-container" part="image">
1941
- <img src=${r} alt=${a} loading="lazy" />
1942
- ${i ? o`<div class="image-caption" part="caption">${i}</div>` : c}
1943
- </div>` : c;
1987
+ if (!e) return l;
1988
+ const t = String(e.src ?? ""), a = String(e.alt ?? ""), r = e.caption, i = this.sanitizeUrl(t);
1989
+ return i ? o`<div class="image-container" part="image">
1990
+ <img src=${i} alt=${a} loading="lazy" />
1991
+ ${r ? o`<div class="image-caption" part="caption">${r}</div>` : l}
1992
+ </div>` : l;
1944
1993
  }
1945
1994
  renderCallout() {
1946
1995
  const e = this.spec.data;
1947
- if (!e) return c;
1948
- const t = String(e.message ?? ""), a = String(e.level ?? "info"), i = e.title, n = ["info", "warning", "error", "success"].includes(a) ? a : "info", s = n === "warning" || n === "error";
1949
- return o`<div class="callout callout-${n}" part="callout" role=${s ? "alert" : "note"} aria-live=${s ? "assertive" : "polite"}>
1950
- ${i ? o`<div class="callout-title" part="callout-title">${i}</div>` : c}
1996
+ if (!e) return l;
1997
+ const t = String(e.message ?? ""), a = String(e.level ?? "info"), r = e.title, s = ["info", "warning", "error", "success"].includes(a) ? a : "info", n = s === "warning" || s === "error";
1998
+ return o`<div class="callout callout-${s}" part="callout" role=${n ? "alert" : "note"} aria-live=${n ? "assertive" : "polite"}>
1999
+ ${r ? o`<div class="callout-title" part="callout-title">${r}</div>` : l}
1951
2000
  <div part="callout-message">${t}</div>
1952
2001
  </div>`;
1953
2002
  }
@@ -1959,14 +2008,14 @@ let W = class extends w {
1959
2008
  let t = this.escapeHtml(e);
1960
2009
  return t = t.replace(/^#### (.+)$/gm, "<h4>$1</h4>"), t = t.replace(/^### (.+)$/gm, "<h3>$1</h3>"), t = t.replace(/^## (.+)$/gm, "<h2>$1</h2>"), t = t.replace(/^# (.+)$/gm, "<h1>$1</h1>"), t = t.replace(/^---$/gm, "<hr>"), t = t.replace(/```[\s\S]*?```/g, (a) => `<pre><code>${a.slice(3, -3).replace(/^\w*\n/, "")}</code></pre>`), t = t.replace(
1961
2010
  /^(\|.+\|)\n(\|[\s:|-]+\|)\n((?:\|.+\|\n?)+)/gm,
1962
- (a, i, r, n) => {
1963
- const s = (u) => u.split("|").slice(1, -1).map((m) => m.trim()), l = s(i), p = s(r).map((u) => u.startsWith(":") && u.endsWith(":") ? "center" : u.endsWith(":") ? "right" : "left"), d = n.trim().split(`
1964
- `).map(s), g = l.map((u, m) => `<th scope="col" style="text-align:${p[m] ?? "left"}">${u}</th>`).join(""), f = d.map((u) => "<tr>" + u.map((m, v) => `<td style="text-align:${p[v] ?? "left"}">${m}</td>`).join("") + "</tr>").join("");
2011
+ (a, r, i, s) => {
2012
+ const n = (u) => u.split("|").slice(1, -1).map((m) => m.trim()), d = n(r), c = n(i).map((u) => u.startsWith(":") && u.endsWith(":") ? "center" : u.endsWith(":") ? "right" : "left"), p = s.trim().split(`
2013
+ `).map(n), g = d.map((u, m) => `<th scope="col" style="text-align:${c[m] ?? "left"}">${u}</th>`).join(""), f = p.map((u) => "<tr>" + u.map((m, v) => `<td style="text-align:${c[v] ?? "left"}">${m}</td>`).join("") + "</tr>").join("");
1965
2014
  return `<table><thead><tr>${g}</tr></thead><tbody>${f}</tbody></table>`;
1966
2015
  }
1967
2016
  ), t = t.replace(/`([^`]+)`/g, "<code>$1</code>"), t = t.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>"), t = t.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), t = t.replace(/\*(.+?)\*/g, "<em>$1</em>"), t = t.replace(
1968
2017
  /\[([^\]]+)\]\(([^)]+)\)/g,
1969
- (a, i, r) => `<a href="${this.sanitizeUrl(r)}" target="_blank" rel="noopener">${i}</a>`
2018
+ (a, r, i) => `<a href="${this.sanitizeUrl(i)}" target="_blank" rel="noopener">${r}</a>`
1970
2019
  ), t = t.replace(/^&gt; (.+)$/gm, "<blockquote>$1</blockquote>"), t = t.replace(/^\d+\. (.+)$/gm, "<li data-ol>$1</li>"), t = t.replace(/(<li data-ol>.*<\/li>\n?)+/g, (a) => `<ol>${a.replace(/ data-ol/g, "")}</ol>`), t = t.replace(/^- (.+)$/gm, "<li>$1</li>"), t = t.replace(/(<li>.*<\/li>\n?)+/g, "<ul>$&</ul>"), t = t.replace(/\n\n+/g, "</p><p>"), !t.startsWith("<h") && !t.startsWith("<ul") && !t.startsWith("<ol") && !t.startsWith("<pre") && !t.startsWith("<blockquote") && !t.startsWith("<hr") && (t = `<p>${t}</p>`), t = t.replace(/<pre>[\s\S]*?<\/pre>/g, (a) => a.replace(/\n/g, "\0NL\0")), t = t.replace(/\n/g, "<br>"), t = t.replace(/\x00NL\x00/g, `
1971
2020
  `), t;
1972
2021
  }
@@ -1978,7 +2027,7 @@ let W = class extends w {
1978
2027
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1979
2028
  }
1980
2029
  };
1981
- W.styles = [b, y`
2030
+ K.styles = [b, w`
1982
2031
  :host {
1983
2032
  display: block;
1984
2033
  font-family: system-ui, -apple-system, sans-serif;
@@ -2155,38 +2204,38 @@ W.styles = [b, y`
2155
2204
  }
2156
2205
  }
2157
2206
  `];
2158
- ge([
2207
+ he([
2159
2208
  h({ type: Object })
2160
- ], W.prototype, "spec", 2);
2161
- W = ge([
2209
+ ], K.prototype, "spec", 2);
2210
+ K = he([
2162
2211
  x("u-content")
2163
- ], W);
2164
- var Ve = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, fe = (e, t, a, i) => {
2165
- for (var r = i > 1 ? void 0 : i ? Ge(t, a) : t, n = e.length - 1, s; n >= 0; n--)
2166
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
2167
- return i && r && Ve(t, a, r), r;
2212
+ ], K);
2213
+ var Je = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, me = (e, t, a, r) => {
2214
+ for (var i = r > 1 ? void 0 : r ? Ye(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2215
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2216
+ return r && i && Je(t, a, i), i;
2168
2217
  };
2169
- let H = class extends w {
2218
+ let H = class extends y {
2170
2219
  constructor() {
2171
2220
  super(...arguments), this.spec = null;
2172
2221
  }
2173
2222
  render() {
2174
- if (!this.spec) return c;
2223
+ if (!this.spec) return l;
2175
2224
  const e = this._extractPairs();
2176
- if (e.length === 0) return c;
2177
- const t = this.spec.options ?? {}, a = String(t.layout ?? "vertical"), i = Number(t.columns ?? 2), r = a === "grid" ? `grid-template-columns: repeat(${i}, 1fr)` : "";
2225
+ if (e.length === 0) return l;
2226
+ const t = this.spec.options ?? {}, a = String(t.layout ?? "vertical"), r = Number(t.columns ?? 2), i = a === "grid" ? `grid-template-columns: repeat(${r}, 1fr)` : "";
2178
2227
  return o`
2179
2228
  <div
2180
2229
  class=${`kv-${a === "grid" ? "grid" : a === "horizontal" ? "horizontal" : "vertical"}`}
2181
- style=${r}
2230
+ style=${i}
2182
2231
  part="kv"
2183
2232
  role="list"
2184
2233
  aria-label=${this.spec.title ?? "Key-value pairs"}
2185
2234
  >
2186
- ${e.map(([n, s]) => o`
2235
+ ${e.map(([s, n]) => o`
2187
2236
  <div class="kv-pair" part="kv-pair" role="listitem">
2188
- <span class="kv-key" part="kv-key">${n}</span>
2189
- <span class="kv-value" part="kv-value">${String(s)}</span>
2237
+ <span class="kv-key" part="kv-key">${s}</span>
2238
+ <span class="kv-value" part="kv-value">${String(n)}</span>
2190
2239
  </div>
2191
2240
  `)}
2192
2241
  </div>
@@ -2197,7 +2246,7 @@ let H = class extends w {
2197
2246
  return e ? Array.isArray(e) ? e.filter((t) => t != null && typeof t == "object" && "key" in t && "value" in t).map((t) => [String(t.key), t.value]) : typeof e == "object" ? Object.entries(e) : [] : [];
2198
2247
  }
2199
2248
  };
2200
- H.styles = [b, y`
2249
+ H.styles = [b, w`
2201
2250
  :host {
2202
2251
  display: block;
2203
2252
  font-family: system-ui, -apple-system, sans-serif;
@@ -2291,18 +2340,18 @@ H.styles = [b, y`
2291
2340
  }
2292
2341
  }
2293
2342
  `];
2294
- fe([
2343
+ me([
2295
2344
  h({ type: Object })
2296
2345
  ], H.prototype, "spec", 2);
2297
- H = fe([
2346
+ H = me([
2298
2347
  x("u-kv")
2299
2348
  ], H);
2300
- var Je = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, V = (e, t, a, i) => {
2301
- for (var r = i > 1 ? void 0 : i ? Qe(t, a) : t, n = e.length - 1, s; n >= 0; n--)
2302
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
2303
- return i && r && Je(t, a, r), r;
2349
+ var Ze = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, G = (e, t, a, r) => {
2350
+ for (var i = r > 1 ? void 0 : r ? Qe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2351
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2352
+ return r && i && Ze(t, a, i), i;
2304
2353
  };
2305
- const Ze = {
2354
+ const et = {
2306
2355
  javascript: ["//", ["/*", "*/"]],
2307
2356
  typescript: ["//", ["/*", "*/"]],
2308
2357
  python: ["#"],
@@ -2314,7 +2363,7 @@ const Ze = {
2314
2363
  bash: ["#"],
2315
2364
  css: [void 0, ["/*", "*/"]],
2316
2365
  html: [void 0, ["<!--", "-->"]]
2317
- }, Xe = {
2366
+ }, tt = {
2318
2367
  javascript: "async await break case catch class const continue default delete do else export extends false finally for from function if import in instanceof let new null of return static super switch this throw true try typeof undefined var void while with yield",
2319
2368
  typescript: "abstract any as async await boolean break case catch class const continue declare default delete do else enum export extends false finally for from function if implements import in instanceof interface is keyof let namespace never new null number of override private protected public readonly return static string super switch this throw true try type typeof undefined var void while with yield",
2320
2369
  python: "False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield",
@@ -2324,7 +2373,7 @@ const Ze = {
2324
2373
  rust: "as async await break const continue crate dyn else enum extern false fn for if impl in let loop match mod move mut pub ref return self static struct super trait true type unsafe use where while",
2325
2374
  sql: "ALL ALTER AND AS ASC BETWEEN BY CASE CREATE DELETE DESC DISTINCT DROP ELSE END EXISTS FALSE FROM GROUP HAVING IF IN INDEX INSERT INTO IS JOIN LEFT LIKE LIMIT NOT NULL ON OR ORDER PRIMARY SELECT SET TABLE THEN TRUE UNION UPDATE VALUES WHERE",
2326
2375
  bash: "break case do done elif else esac fi for function if in local read return select then until while"
2327
- }, Ye = {
2376
+ }, rt = {
2328
2377
  js: "javascript",
2329
2378
  ts: "typescript",
2330
2379
  py: "python",
@@ -2343,138 +2392,138 @@ const Ze = {
2343
2392
  jsonc: "json",
2344
2393
  psql: "sql",
2345
2394
  mysql: "sql"
2346
- }, le = /* @__PURE__ */ new Map();
2347
- function et(e) {
2348
- let t = le.get(e);
2395
+ }, ce = /* @__PURE__ */ new Map();
2396
+ function at(e) {
2397
+ let t = ce.get(e);
2349
2398
  if (!t) {
2350
- const a = Xe[e] || "";
2351
- t = a ? new Set(a.split(" ")) : /* @__PURE__ */ new Set(), le.set(e, t);
2399
+ const a = tt[e] || "";
2400
+ t = a ? new Set(a.split(" ")) : /* @__PURE__ */ new Set(), ce.set(e, t);
2352
2401
  }
2353
2402
  return t;
2354
2403
  }
2355
2404
  function k(e) {
2356
2405
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2357
2406
  }
2358
- function j(e, t) {
2407
+ function D(e, t) {
2359
2408
  const a = k(e);
2360
2409
  return a.includes(`
2361
2410
  `) ? a.split(`
2362
- `).map((i) => `<span class="hl-${t}">${i}</span>`).join(`
2411
+ `).map((r) => `<span class="hl-${t}">${r}</span>`).join(`
2363
2412
  `) : `<span class="hl-${t}">${a}</span>`;
2364
2413
  }
2365
- function he(e, t, a) {
2366
- let i = t + 1;
2367
- for (; i < e.length; ) {
2368
- if (e[i] === "\\") {
2369
- i += 2;
2414
+ function ve(e, t, a) {
2415
+ let r = t + 1;
2416
+ for (; r < e.length; ) {
2417
+ if (e[r] === "\\") {
2418
+ r += 2;
2370
2419
  continue;
2371
2420
  }
2372
- if (e[i] === a) return i + 1;
2373
- if (a !== "`" && e[i] === `
2374
- `) return i;
2375
- i++;
2421
+ if (e[r] === a) return r + 1;
2422
+ if (a !== "`" && e[r] === `
2423
+ `) return r;
2424
+ r++;
2376
2425
  }
2377
2426
  return e.length;
2378
2427
  }
2379
- function tt(e, t) {
2428
+ function it(e, t) {
2380
2429
  if (!t) return k(e);
2381
- const a = Ye[t] || t;
2382
- if (a === "json") return rt(e);
2383
- const i = et(a), r = Ze[a], n = r?.[0], s = r?.[1], l = a === "javascript" || a === "typescript";
2384
- let p = "", d = 0;
2430
+ const a = rt[t] || t;
2431
+ if (a === "json") return st(e);
2432
+ const r = at(a), i = et[a], s = i?.[0], n = i?.[1], d = a === "javascript" || a === "typescript";
2433
+ let c = "", p = 0;
2385
2434
  const g = e.length;
2386
- for (; d < g; ) {
2387
- if (s && e.startsWith(s[0], d)) {
2388
- const u = e.indexOf(s[1], d + s[0].length), m = u === -1 ? e.slice(d) : e.slice(d, u + s[1].length);
2389
- p += j(m, "c"), d += m.length;
2435
+ for (; p < g; ) {
2436
+ if (n && e.startsWith(n[0], p)) {
2437
+ const u = e.indexOf(n[1], p + n[0].length), m = u === -1 ? e.slice(p) : e.slice(p, u + n[1].length);
2438
+ c += D(m, "c"), p += m.length;
2390
2439
  continue;
2391
2440
  }
2392
- if (n && e.startsWith(n, d)) {
2441
+ if (s && e.startsWith(s, p)) {
2393
2442
  const u = e.indexOf(`
2394
- `, d), m = u === -1 ? e.slice(d) : e.slice(d, u);
2395
- p += j(m, "c"), d += m.length;
2443
+ `, p), m = u === -1 ? e.slice(p) : e.slice(p, u);
2444
+ c += D(m, "c"), p += m.length;
2396
2445
  continue;
2397
2446
  }
2398
- const f = e[d];
2399
- if (f === '"' || f === "'" || f === "`" && l) {
2400
- const u = he(e, d, f);
2401
- p += j(e.slice(d, u), "s"), d = u;
2447
+ const f = e[p];
2448
+ if (f === '"' || f === "'" || f === "`" && d) {
2449
+ const u = ve(e, p, f);
2450
+ c += D(e.slice(p, u), "s"), p = u;
2402
2451
  continue;
2403
2452
  }
2404
- if (/\d/.test(f) && (d === 0 || !/[a-zA-Z_$]/.test(e[d - 1]))) {
2405
- let u = d + 1;
2453
+ if (/\d/.test(f) && (p === 0 || !/[a-zA-Z_$]/.test(e[p - 1]))) {
2454
+ let u = p + 1;
2406
2455
  for (; u < g && /[0-9a-fA-FxXoObBeE._]/.test(e[u]); ) u++;
2407
- p += j(e.slice(d, u), "n"), d = u;
2456
+ c += D(e.slice(p, u), "n"), p = u;
2408
2457
  continue;
2409
2458
  }
2410
2459
  if (/[a-zA-Z_$]/.test(f)) {
2411
- let u = d + 1;
2460
+ let u = p + 1;
2412
2461
  for (; u < g && /[a-zA-Z0-9_$]/.test(e[u]); ) u++;
2413
- const m = e.slice(d, u);
2414
- p += i.has(m) ? `<span class="hl-k">${k(m)}</span>` : k(m), d = u;
2462
+ const m = e.slice(p, u);
2463
+ c += r.has(m) ? `<span class="hl-k">${k(m)}</span>` : k(m), p = u;
2415
2464
  continue;
2416
2465
  }
2417
- if (a === "html" && f === "<" && d + 1 < g && /[a-zA-Z/!]/.test(e[d + 1])) {
2418
- const u = e.indexOf(">", d);
2466
+ if (a === "html" && f === "<" && p + 1 < g && /[a-zA-Z/!]/.test(e[p + 1])) {
2467
+ const u = e.indexOf(">", p);
2419
2468
  if (u !== -1) {
2420
- p += `<span class="hl-k">${k(e.slice(d, u + 1))}</span>`, d = u + 1;
2469
+ c += `<span class="hl-k">${k(e.slice(p, u + 1))}</span>`, p = u + 1;
2421
2470
  continue;
2422
2471
  }
2423
2472
  }
2424
2473
  if (a === "css" && /[a-z-]/.test(f)) {
2425
- let u = d + 1;
2474
+ let u = p + 1;
2426
2475
  for (; u < g && /[a-z-]/.test(e[u]); ) u++;
2427
- const m = e.slice(d, u);
2428
- e.slice(u).trimStart()[0] === ":" ? p += `<span class="hl-k">${k(m)}</span>` : p += k(m), d = u;
2476
+ const m = e.slice(p, u);
2477
+ e.slice(u).trimStart()[0] === ":" ? c += `<span class="hl-k">${k(m)}</span>` : c += k(m), p = u;
2429
2478
  continue;
2430
2479
  }
2431
- p += k(f), d++;
2480
+ c += k(f), p++;
2432
2481
  }
2433
- return p;
2482
+ return c;
2434
2483
  }
2435
- function rt(e) {
2484
+ function st(e) {
2436
2485
  let t = "", a = 0;
2437
- const i = e.length;
2438
- for (; a < i; ) {
2439
- const r = e[a];
2440
- if (r === '"') {
2441
- const s = he(e, a, '"'), l = e.slice(a, s), p = e.slice(s).trimStart();
2442
- t += j(l, p[0] === ":" ? "k" : "s"), a = s;
2486
+ const r = e.length;
2487
+ for (; a < r; ) {
2488
+ const i = e[a];
2489
+ if (i === '"') {
2490
+ const n = ve(e, a, '"'), d = e.slice(a, n), c = e.slice(n).trimStart();
2491
+ t += D(d, c[0] === ":" ? "k" : "s"), a = n;
2443
2492
  continue;
2444
2493
  }
2445
- if (/[\d-]/.test(r) && (a === 0 || /[\s,:\[{]/.test(e[a - 1]))) {
2446
- let s = a + 1;
2447
- for (; s < i && /[0-9.eE+\-]/.test(e[s]); ) s++;
2448
- t += j(e.slice(a, s), "n"), a = s;
2494
+ if (/[\d-]/.test(i) && (a === 0 || /[\s,:\[{]/.test(e[a - 1]))) {
2495
+ let n = a + 1;
2496
+ for (; n < r && /[0-9.eE+\-]/.test(e[n]); ) n++;
2497
+ t += D(e.slice(a, n), "n"), a = n;
2449
2498
  continue;
2450
2499
  }
2451
- let n = !1;
2452
- for (const s of ["true", "false", "null"])
2453
- if (e.startsWith(s, a)) {
2454
- t += `<span class="hl-k">${s}</span>`, a += s.length, n = !0;
2500
+ let s = !1;
2501
+ for (const n of ["true", "false", "null"])
2502
+ if (e.startsWith(n, a)) {
2503
+ t += `<span class="hl-k">${n}</span>`, a += n.length, s = !0;
2455
2504
  break;
2456
2505
  }
2457
- n || (t += k(r), a++);
2506
+ s || (t += k(i), a++);
2458
2507
  }
2459
2508
  return t;
2460
2509
  }
2461
- let O = class extends w {
2510
+ let O = class extends y {
2462
2511
  constructor() {
2463
2512
  super(...arguments), this.spec = null, this.theme = null, this._copied = !1;
2464
2513
  }
2465
2514
  render() {
2466
- if (!this.spec) return c;
2515
+ if (!this.spec) return l;
2467
2516
  const e = this.spec.data;
2468
- if (!e) return c;
2517
+ if (!e) return l;
2469
2518
  const t = String(e.content ?? "");
2470
- if (!t) return c;
2471
- const a = String(e.language ?? "").toLowerCase(), i = this.spec.options ?? {}, r = i.lineNumbers !== !1, n = !!(i.wrap ?? !1), s = i.maxHeight ? String(i.maxHeight) : void 0, l = new Set(
2472
- Array.isArray(i.highlight) ? i.highlight : []
2473
- ), g = tt(t, a).split(`
2519
+ if (!t) return l;
2520
+ const a = String(e.language ?? "").toLowerCase(), r = this.spec.options ?? {}, i = r.lineNumbers !== !1, s = !!(r.wrap ?? !1), n = r.maxHeight ? String(r.maxHeight) : void 0, d = new Set(
2521
+ Array.isArray(r.highlight) ? r.highlight : []
2522
+ ), g = it(t, a).split(`
2474
2523
  `).map((u, m) => {
2475
- const v = m + 1, $ = l.has(v) ? " line-hl" : "", _ = r ? `<span class="line-no">${v}</span>` : "";
2524
+ const v = m + 1, $ = d.has(v) ? " line-hl" : "", _ = i ? `<span class="line-no">${v}</span>` : "";
2476
2525
  return `<span class="line${$}">${_}${u || " "}</span>`;
2477
- }).join(""), f = s ? `max-height: ${s}` : "";
2526
+ }).join(""), f = n ? `max-height: ${n}` : "";
2478
2527
  return o`
2479
2528
  <div class="code-block" part="code">
2480
2529
  <div class="code-header" part="code-header">
@@ -2487,7 +2536,7 @@ let O = class extends w {
2487
2536
  >${this._copied ? "Copied!" : "Copy"}</button>
2488
2537
  </div>
2489
2538
  <div class="code-body" part="code-body" style=${f}>
2490
- <pre data-wrap=${String(n)}><code .innerHTML=${g}></code></pre>
2539
+ <pre data-wrap=${String(s)}><code .innerHTML=${g}></code></pre>
2491
2540
  </div>
2492
2541
  </div>
2493
2542
  `;
@@ -2505,7 +2554,7 @@ let O = class extends w {
2505
2554
  }
2506
2555
  }
2507
2556
  };
2508
- O.styles = [b, y`
2557
+ O.styles = [b, w`
2509
2558
  :host {
2510
2559
  display: block;
2511
2560
  font-family: system-ui, -apple-system, sans-serif;
@@ -2608,54 +2657,54 @@ O.styles = [b, y`
2608
2657
  .line-no { width: 2.5ch; margin-right: 1ch; }
2609
2658
  }
2610
2659
  `];
2611
- V([
2660
+ G([
2612
2661
  h({ type: Object })
2613
2662
  ], O.prototype, "spec", 2);
2614
- V([
2663
+ G([
2615
2664
  h({ type: String, reflect: !0 })
2616
2665
  ], O.prototype, "theme", 2);
2617
- V([
2666
+ G([
2618
2667
  S()
2619
2668
  ], O.prototype, "_copied", 2);
2620
- O = V([
2669
+ O = G([
2621
2670
  x("u-code")
2622
2671
  ], O);
2623
- var at = Object.defineProperty, it = Object.getOwnPropertyDescriptor, X = (e, t, a, i) => {
2624
- for (var r = i > 1 ? void 0 : i ? it(t, a) : t, n = e.length - 1, s; n >= 0; n--)
2625
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
2626
- return i && r && at(t, a, r), r;
2672
+ var nt = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, Q = (e, t, a, r) => {
2673
+ for (var i = r > 1 ? void 0 : r ? ot(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2674
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2675
+ return r && i && nt(t, a, i), i;
2627
2676
  };
2628
- let N = class extends w {
2677
+ let N = class extends y {
2629
2678
  constructor() {
2630
2679
  super(...arguments), this.spec = null, this.theme = null;
2631
2680
  }
2632
2681
  render() {
2633
- if (!this.spec) return c;
2682
+ if (!this.spec) return l;
2634
2683
  const e = this._extractItems();
2635
- if (e.length === 0) return c;
2636
- const t = this.spec.options ?? {}, a = !!(t.compact ?? !1), i = t.numbered !== !1;
2684
+ if (e.length === 0) return l;
2685
+ const t = this.spec.options ?? {}, a = !!(t.compact ?? !1), r = t.numbered !== !1;
2637
2686
  return o`
2638
2687
  <div class="citations" part="citations" ?data-compact=${a} role="list" aria-label=${this.spec.title ?? "Citations"}>
2639
- ${e.map((r, n) => this._renderItem(r, n, i))}
2688
+ ${e.map((i, s) => this._renderItem(i, s, r))}
2640
2689
  </div>
2641
2690
  `;
2642
2691
  }
2643
2692
  _renderItem(e, t, a) {
2644
- const i = !!e.url, r = e.url ? this._extractDomain(e.url) : void 0;
2693
+ const r = !!e.url, i = e.url ? this._extractDomain(e.url) : void 0;
2645
2694
  return o`
2646
2695
  <div
2647
2696
  class="cite-item"
2648
2697
  part="cite-item"
2649
2698
  role="listitem"
2650
- ?data-link=${i}
2651
- @click=${i ? () => this._handleClick(e) : void 0}
2699
+ ?data-link=${r}
2700
+ @click=${r ? () => this._handleClick(e) : void 0}
2652
2701
  >
2653
- ${a ? o`<span class="cite-num" part="cite-num">${t + 1}</span>` : c}
2702
+ ${a ? o`<span class="cite-num" part="cite-num">${t + 1}</span>` : l}
2654
2703
  <div class="cite-body">
2655
2704
  <div class="cite-title" part="cite-title">${e.title}</div>
2656
- ${r ? o`<div class="cite-url" part="cite-url">${r}</div>` : c}
2657
- ${e.snippet ? o`<div class="cite-snippet" part="cite-snippet">${e.snippet}</div>` : c}
2658
- ${e.source ? o`<div class="cite-source" part="cite-source">${e.source}</div>` : c}
2705
+ ${i ? o`<div class="cite-url" part="cite-url">${i}</div>` : l}
2706
+ ${e.snippet ? o`<div class="cite-snippet" part="cite-snippet">${e.snippet}</div>` : l}
2707
+ ${e.source ? o`<div class="cite-source" part="cite-source">${e.source}</div>` : l}
2659
2708
  </div>
2660
2709
  </div>
2661
2710
  `;
@@ -2679,7 +2728,11 @@ let N = class extends w {
2679
2728
  }
2680
2729
  _extractDomain(e) {
2681
2730
  try {
2682
- return new URL(e).hostname;
2731
+ const t = new URL(e).hostname;
2732
+ if (t === "localhost" || /^\d+\.\d+\.\d+\.\d+$/.test(t))
2733
+ return t;
2734
+ const r = t.replace(/^www\./, "").split("."), i = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]);
2735
+ return r.length >= 3 && i.has(r[r.length - 2]) ? r.slice(-3).join(".") : r.slice(-2).join(".");
2683
2736
  } catch {
2684
2737
  return e;
2685
2738
  }
@@ -2708,7 +2761,7 @@ let N = class extends w {
2708
2761
  return [];
2709
2762
  }
2710
2763
  };
2711
- N.styles = [b, y`
2764
+ N.styles = [b, w`
2712
2765
  :host {
2713
2766
  display: block;
2714
2767
  font-family: system-ui, -apple-system, sans-serif;
@@ -2805,21 +2858,21 @@ N.styles = [b, y`
2805
2858
  .cite-snippet { font-size: 0.75rem; }
2806
2859
  }
2807
2860
  `];
2808
- X([
2861
+ Q([
2809
2862
  h({ type: Object })
2810
2863
  ], N.prototype, "spec", 2);
2811
- X([
2864
+ Q([
2812
2865
  h({ type: String, reflect: !0 })
2813
2866
  ], N.prototype, "theme", 2);
2814
- N = X([
2867
+ N = Q([
2815
2868
  x("u-citation")
2816
2869
  ], N);
2817
- var st = Object.defineProperty, nt = Object.getOwnPropertyDescriptor, Y = (e, t, a, i) => {
2818
- for (var r = i > 1 ? void 0 : i ? nt(t, a) : t, n = e.length - 1, s; n >= 0; n--)
2819
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
2820
- return i && r && st(t, a, r), r;
2870
+ var lt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, ee = (e, t, a, r) => {
2871
+ for (var i = r > 1 ? void 0 : r ? ct(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2872
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2873
+ return r && i && lt(t, a, i), i;
2821
2874
  };
2822
- const ot = /* @__PURE__ */ new Set(["info", "success", "warning", "error", "neutral"]), lt = {
2875
+ const dt = /* @__PURE__ */ new Set(["info", "success", "warning", "error", "neutral"]), pt = {
2823
2876
  info: "●",
2824
2877
  // ●
2825
2878
  success: "✓",
@@ -2831,18 +2884,18 @@ const ot = /* @__PURE__ */ new Set(["info", "success", "warning", "error", "neut
2831
2884
  neutral: "○"
2832
2885
  // ○
2833
2886
  };
2834
- let T = class extends w {
2887
+ let F = class extends y {
2835
2888
  constructor() {
2836
2889
  super(...arguments), this.spec = null, this.theme = null;
2837
2890
  }
2838
2891
  render() {
2839
- if (!this.spec) return c;
2892
+ if (!this.spec) return l;
2840
2893
  const e = this._extractItems();
2841
- return e.length === 0 ? c : o`
2894
+ return e.length === 0 ? l : o`
2842
2895
  <div class="status-list" part="status" role="list" aria-label=${this.spec.title ?? "Status"}>
2843
2896
  ${e.map((t) => o`
2844
2897
  <div class="status-item" part="status-item" role="listitem" data-level=${t.level}>
2845
- <span class="status-icon" part="status-icon" aria-hidden="true">${lt[t.level]}</span>
2898
+ <span class="status-icon" part="status-icon" aria-hidden="true">${pt[t.level]}</span>
2846
2899
  <span class="status-label" part="status-label">${t.label}</span>
2847
2900
  <span class="status-value" part="status-value">${t.value}</span>
2848
2901
  </div>
@@ -2873,10 +2926,10 @@ let T = class extends w {
2873
2926
  }
2874
2927
  _resolveLevel(e) {
2875
2928
  const t = String(e ?? "info");
2876
- return ot.has(t) ? t : "info";
2929
+ return dt.has(t) ? t : "info";
2877
2930
  }
2878
2931
  };
2879
- T.styles = [b, y`
2932
+ F.styles = [b, w`
2880
2933
  :host {
2881
2934
  display: block;
2882
2935
  font-family: system-ui, -apple-system, sans-serif;
@@ -2941,22 +2994,22 @@ T.styles = [b, y`
2941
2994
  .status-item { font-size: 0.8125rem; }
2942
2995
  }
2943
2996
  `];
2944
- Y([
2997
+ ee([
2945
2998
  h({ type: Object })
2946
- ], T.prototype, "spec", 2);
2947
- Y([
2999
+ ], F.prototype, "spec", 2);
3000
+ ee([
2948
3001
  h({ type: String, reflect: !0 })
2949
- ], T.prototype, "theme", 2);
2950
- T = Y([
3002
+ ], F.prototype, "theme", 2);
3003
+ F = ee([
2951
3004
  x("u-status")
2952
- ], T);
2953
- var ct = Object.defineProperty, dt = Object.getOwnPropertyDescriptor, ee = (e, t, a, i) => {
2954
- for (var r = i > 1 ? void 0 : i ? dt(t, a) : t, n = e.length - 1, s; n >= 0; n--)
2955
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
2956
- return i && r && ct(t, a, r), r;
3005
+ ], F);
3006
+ var ut = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, te = (e, t, a, r) => {
3007
+ for (var i = r > 1 ? void 0 : r ? gt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3008
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3009
+ return r && i && ut(t, a, i), i;
2957
3010
  };
2958
- const pt = /* @__PURE__ */ new Set(["done", "active", "pending", "error"]);
2959
- function ce(e, t) {
3011
+ const ft = /* @__PURE__ */ new Set(["done", "active", "pending", "error"]);
3012
+ function de(e, t) {
2960
3013
  if (t) return o`<span class="step-icon-text">${t}</span>`;
2961
3014
  switch (e) {
2962
3015
  case "done":
@@ -2969,16 +3022,16 @@ function ce(e, t) {
2969
3022
  return o`<svg class="step-svg" viewBox="0 0 16 16" fill="currentColor"><path d="M4.47 4.47a.75.75 0 0 1 1.06 0L8 6.94l2.47-2.47a.75.75 0 1 1 1.06 1.06L9.06 8l2.47 2.47a.75.75 0 1 1-1.06 1.06L8 9.06l-2.47 2.47a.75.75 0 0 1-1.06-1.06L6.94 8 4.47 5.53a.75.75 0 0 1 0-1.06Z"/></svg>`;
2970
3023
  }
2971
3024
  }
2972
- let F = class extends w {
3025
+ let M = class extends y {
2973
3026
  constructor() {
2974
3027
  super(...arguments), this.spec = null, this.theme = null;
2975
3028
  }
2976
3029
  render() {
2977
- if (!this.spec) return c;
3030
+ if (!this.spec) return l;
2978
3031
  const e = this._extractItems();
2979
- if (e.length === 0) return c;
2980
- const t = this.spec.options ?? {}, a = String(t.layout ?? "vertical"), i = !!(t.compact ?? !1);
2981
- return a === "horizontal" ? this._renderHorizontal(e, i) : this._renderVertical(e, i);
3032
+ if (e.length === 0) return l;
3033
+ const t = this.spec.options ?? {}, a = String(t.layout ?? "vertical"), r = !!(t.compact ?? !1);
3034
+ return a === "horizontal" ? this._renderHorizontal(e, r) : this._renderVertical(e, r);
2982
3035
  }
2983
3036
  _renderVertical(e, t) {
2984
3037
  return o`
@@ -2987,12 +3040,12 @@ let F = class extends w {
2987
3040
  ${e.map((a) => o`
2988
3041
  <div class="step-v" part="step" role="listitem" data-status=${a.status}>
2989
3042
  <div class="step-track">
2990
- <span class="step-icon" part="step-icon" aria-hidden="true">${ce(a.status, a.icon)}</span>
3043
+ <span class="step-icon" part="step-icon" aria-hidden="true">${de(a.status, a.icon)}</span>
2991
3044
  <div class="step-line"></div>
2992
3045
  </div>
2993
3046
  <div class="step-body">
2994
3047
  <div class="step-label" part="step-label">${a.label}</div>
2995
- ${a.description ? o`<div class="step-desc" part="step-desc">${a.description}</div>` : c}
3048
+ ${a.description ? o`<div class="step-desc" part="step-desc">${a.description}</div>` : l}
2996
3049
  </div>
2997
3050
  </div>
2998
3051
  `)}
@@ -3003,14 +3056,14 @@ let F = class extends w {
3003
3056
  return o`
3004
3057
  <div class="steps-horizontal" part="steps" ?data-compact=${t}
3005
3058
  role="list" aria-label=${this.spec?.title ?? "Steps"}>
3006
- ${e.map((a, i) => {
3007
- const r = i > 0 && e[i - 1].status === "done", n = a.status === "done";
3059
+ ${e.map((a, r) => {
3060
+ const i = r > 0 && e[r - 1].status === "done", s = a.status === "done";
3008
3061
  return o`
3009
3062
  <div class="step-h" part="step" role="listitem" data-status=${a.status}>
3010
3063
  <div class="step-h-top">
3011
- <div class="step-h-line" ?data-done=${r}></div>
3012
- <span class="step-icon" part="step-icon" aria-hidden="true">${ce(a.status, a.icon)}</span>
3013
- <div class="step-h-line" ?data-done=${n}></div>
3064
+ <div class="step-h-line" ?data-done=${i}></div>
3065
+ <span class="step-icon" part="step-icon" aria-hidden="true">${de(a.status, a.icon)}</span>
3066
+ <div class="step-h-line" ?data-done=${s}></div>
3014
3067
  </div>
3015
3068
  <div class="step-label" part="step-label">${a.label}</div>
3016
3069
  </div>
@@ -3032,10 +3085,10 @@ let F = class extends w {
3032
3085
  }
3033
3086
  _resolveStatus(e) {
3034
3087
  const t = String(e ?? "pending");
3035
- return pt.has(t) ? t : "pending";
3088
+ return ft.has(t) ? t : "pending";
3036
3089
  }
3037
3090
  };
3038
- F.styles = [b, y`
3091
+ M.styles = [b, w`
3039
3092
  :host {
3040
3093
  display: block;
3041
3094
  font-family: system-ui, -apple-system, sans-serif;
@@ -3267,21 +3320,21 @@ F.styles = [b, y`
3267
3320
  }
3268
3321
  }
3269
3322
  `];
3270
- ee([
3323
+ te([
3271
3324
  h({ type: Object })
3272
- ], F.prototype, "spec", 2);
3273
- ee([
3325
+ ], M.prototype, "spec", 2);
3326
+ te([
3274
3327
  h({ type: String, reflect: !0 })
3275
- ], F.prototype, "theme", 2);
3276
- F = ee([
3328
+ ], M.prototype, "theme", 2);
3329
+ M = te([
3277
3330
  x("u-steps")
3278
- ], F);
3279
- var ut = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, G = (e, t, a, i) => {
3280
- for (var r = i > 1 ? void 0 : i ? gt(t, a) : t, n = e.length - 1, s; n >= 0; n--)
3281
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
3282
- return i && r && ut(t, a, r), r;
3331
+ ], M);
3332
+ var ht = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, X = (e, t, a, r) => {
3333
+ for (var i = r > 1 ? void 0 : r ? mt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3334
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3335
+ return r && i && ht(t, a, i), i;
3283
3336
  };
3284
- const ft = {
3337
+ const vt = {
3285
3338
  star: ["☆", "★", "★"],
3286
3339
  // ☆, ★, ★
3287
3340
  heart: ["♡", "♥", "♥"],
@@ -3289,44 +3342,44 @@ const ft = {
3289
3342
  thumb: ["👍", "👍", "👍"]
3290
3343
  // 👍
3291
3344
  };
3292
- let P = class extends w {
3345
+ let P = class extends y {
3293
3346
  constructor() {
3294
3347
  super(...arguments), this.spec = null, this.theme = null, this._hoverIdx = -1;
3295
3348
  }
3296
3349
  render() {
3297
- if (!this.spec) return c;
3298
- const e = this.spec.data ?? {}, t = this.spec.options ?? {}, a = typeof e.value == "number" ? e.value : 0, i = typeof t.max == "number" ? t.max : typeof e.max == "number" ? e.max : 5, r = !!(t.interactive ?? !1), n = this._resolveIcon(t.icon), s = typeof t.label == "string" ? t.label : void 0, l = typeof e.count == "number" ? e.count : void 0, p = ft[n], d = this._hoverIdx >= 0 ? this._hoverIdx + 1 : a;
3350
+ if (!this.spec) return l;
3351
+ const e = this.spec.data ?? {}, t = this.spec.options ?? {}, a = typeof e.value == "number" ? e.value : 0, r = typeof t.max == "number" ? t.max : typeof e.max == "number" ? e.max : 5, i = !!(t.interactive ?? !1), s = this._resolveIcon(t.icon), n = typeof t.label == "string" ? t.label : void 0, d = typeof e.count == "number" ? e.count : void 0, c = vt[s], p = this._hoverIdx >= 0 ? this._hoverIdx + 1 : a;
3299
3352
  return o`
3300
- <div class="rating" part="rating" role=${r ? "radiogroup" : "img"}
3301
- aria-label=${this.spec.title ?? s ?? `Rating: ${a} out of ${i}`}>
3302
- ${s ? o`<span class="rating-label" part="rating-label">${s}</span>` : c}
3353
+ <div class="rating" part="rating" role=${i ? "radiogroup" : "img"}
3354
+ aria-label=${this.spec.title ?? n ?? `Rating: ${a} out of ${r}`}>
3355
+ ${n ? o`<span class="rating-label" part="rating-label">${n}</span>` : l}
3303
3356
  <div class="rating-icons" part="rating-icons"
3304
- @mouseleave=${r ? () => {
3357
+ @mouseleave=${i ? () => {
3305
3358
  this._hoverIdx = -1;
3306
3359
  } : void 0}>
3307
- ${Array.from({ length: i }, (g, f) => this._renderIcon(f, d, p, n, r))}
3360
+ ${Array.from({ length: r }, (g, f) => this._renderIcon(f, p, c, s, i))}
3308
3361
  </div>
3309
- ${!r && a > 0 ? o`<span class="rating-value" part="rating-value">${a}</span>` : c}
3310
- ${l != null ? o`<span class="rating-count" part="rating-count">(${l})</span>` : c}
3362
+ ${!i && a > 0 ? o`<span class="rating-value" part="rating-value">${a}</span>` : l}
3363
+ ${d != null ? o`<span class="rating-count" part="rating-count">(${d})</span>` : l}
3311
3364
  </div>
3312
3365
  `;
3313
3366
  }
3314
- _renderIcon(e, t, a, i, r) {
3315
- const n = e + 1, s = r && this._hoverIdx >= 0 && n <= this._hoverIdx + 1;
3316
- let l;
3317
- s || n <= Math.floor(t) ? l = "full" : n === Math.ceil(t) && t % 1 >= 0.25 && t % 1 < 0.75 ? l = i === "thumb" ? t % 1 >= 0.5 ? "full" : "empty" : "half" : l = "empty";
3318
- const p = l === "half" ? a[0] : l === "full" ? a[2] : a[0];
3319
- return l === "half" ? o`
3367
+ _renderIcon(e, t, a, r, i) {
3368
+ const s = e + 1, n = i && this._hoverIdx >= 0 && s <= this._hoverIdx + 1;
3369
+ let d;
3370
+ n || s <= Math.floor(t) ? d = "full" : s === Math.ceil(t) && t % 1 >= 0.25 && t % 1 < 0.75 ? d = r === "thumb" ? t % 1 >= 0.5 ? "full" : "empty" : "half" : d = "empty";
3371
+ const c = d === "half" ? a[0] : d === "full" ? a[2] : a[0];
3372
+ return d === "half" ? o`
3320
3373
  <span class="rating-icon rating-icon-half"
3321
- data-state="half" data-icon=${i}
3322
- ?data-interactive=${r}
3323
- ?data-preview=${s}
3324
- role=${r ? "radio" : "presentation"}
3325
- aria-label=${r ? `${n}` : c}
3326
- @mouseenter=${r ? () => {
3374
+ data-state="half" data-icon=${r}
3375
+ ?data-interactive=${i}
3376
+ ?data-preview=${n}
3377
+ role=${i ? "radio" : "presentation"}
3378
+ aria-label=${i ? `${s}` : l}
3379
+ @mouseenter=${i ? () => {
3327
3380
  this._hoverIdx = e;
3328
3381
  } : void 0}
3329
- @click=${r ? () => this._select(n) : void 0}>
3382
+ @click=${i ? () => this._select(s) : void 0}>
3330
3383
  <span aria-hidden="true">${a[0]}</span>
3331
3384
  <span class="half-overlay" aria-hidden="true">
3332
3385
  <span style="color: inherit">${a[2]}</span>
@@ -3334,17 +3387,17 @@ let P = class extends w {
3334
3387
  </span>
3335
3388
  ` : o`
3336
3389
  <span class="rating-icon"
3337
- data-state=${l} data-icon=${i}
3338
- ?data-interactive=${r}
3339
- ?data-preview=${s}
3340
- role=${r ? "radio" : "presentation"}
3341
- aria-label=${r ? `${n}` : c}
3342
- aria-checked=${r ? String(l === "full" && !s) : c}
3343
- @mouseenter=${r ? () => {
3390
+ data-state=${d} data-icon=${r}
3391
+ ?data-interactive=${i}
3392
+ ?data-preview=${n}
3393
+ role=${i ? "radio" : "presentation"}
3394
+ aria-label=${i ? `${s}` : l}
3395
+ aria-checked=${i ? String(d === "full" && !n) : l}
3396
+ @mouseenter=${i ? () => {
3344
3397
  this._hoverIdx = e;
3345
3398
  } : void 0}
3346
- @click=${r ? () => this._select(n) : void 0}>
3347
- <span aria-hidden="true">${p}</span>
3399
+ @click=${i ? () => this._select(s) : void 0}>
3400
+ <span aria-hidden="true">${c}</span>
3348
3401
  </span>
3349
3402
  `;
3350
3403
  }
@@ -3367,7 +3420,7 @@ let P = class extends w {
3367
3420
  return t === "heart" || t === "thumb" ? t : "star";
3368
3421
  }
3369
3422
  };
3370
- P.styles = [b, y`
3423
+ P.styles = [b, w`
3371
3424
  :host {
3372
3425
  display: block;
3373
3426
  font-family: system-ui, -apple-system, sans-serif;
@@ -3473,49 +3526,49 @@ P.styles = [b, y`
3473
3526
  .rating-value { font-size: 0.8125rem; }
3474
3527
  }
3475
3528
  `];
3476
- G([
3529
+ X([
3477
3530
  h({ type: Object })
3478
3531
  ], P.prototype, "spec", 2);
3479
- G([
3532
+ X([
3480
3533
  h({ type: String, reflect: !0 })
3481
3534
  ], P.prototype, "theme", 2);
3482
- G([
3535
+ X([
3483
3536
  S()
3484
3537
  ], P.prototype, "_hoverIdx", 2);
3485
- P = G([
3538
+ P = X([
3486
3539
  x("u-rating")
3487
3540
  ], P);
3488
- var ht = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, te = (e, t, a, i) => {
3489
- for (var r = i > 1 ? void 0 : i ? mt(t, a) : t, n = e.length - 1, s; n >= 0; n--)
3490
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
3491
- return i && r && ht(t, a, r), r;
3541
+ var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, re = (e, t, a, r) => {
3542
+ for (var i = r > 1 ? void 0 : r ? wt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3543
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3544
+ return r && i && bt(t, a, i), i;
3492
3545
  };
3493
- let M = class extends w {
3546
+ let T = class extends y {
3494
3547
  constructor() {
3495
3548
  super(...arguments), this.spec = null, this.theme = null;
3496
3549
  }
3497
3550
  render() {
3498
- if (!this.spec) return c;
3551
+ if (!this.spec) return l;
3499
3552
  const e = this.spec.data;
3500
- if (!e) return c;
3553
+ if (!e) return l;
3501
3554
  const t = String(e.src ?? ""), a = this._sanitizeUrl(t);
3502
- if (!a) return c;
3503
- const i = e.poster ? this._sanitizeUrl(String(e.poster)) : void 0, r = String(e.alt ?? ""), n = e.caption, s = this.spec.options ?? {}, l = s.controls !== !1, p = s.autoplay === !0, d = s.loop === !0, g = s.muted === !0 || p;
3555
+ if (!a) return l;
3556
+ const r = e.poster ? this._sanitizeUrl(String(e.poster)) : void 0, i = String(e.alt ?? ""), s = e.caption, n = this.spec.options ?? {}, d = n.controls !== !1, c = n.autoplay === !0, p = n.loop === !0, g = n.muted === !0 || c;
3504
3557
  return o`
3505
3558
  <div class="video-container" part="video">
3506
3559
  <video
3507
3560
  src=${a}
3508
- poster=${i ?? c}
3509
- aria-label=${r || c}
3510
- ?controls=${l}
3511
- ?autoplay=${p}
3512
- ?loop=${d}
3561
+ poster=${r ?? l}
3562
+ aria-label=${i || l}
3563
+ ?controls=${d}
3564
+ ?autoplay=${c}
3565
+ ?loop=${p}
3513
3566
  ?muted=${g}
3514
3567
  playsinline
3515
3568
  preload="metadata"
3516
3569
  part="video-element"
3517
3570
  ></video>
3518
- ${n ? o`<div class="video-caption" part="caption">${n}</div>` : c}
3571
+ ${s ? o`<div class="video-caption" part="caption">${s}</div>` : l}
3519
3572
  </div>
3520
3573
  `;
3521
3574
  }
@@ -3524,7 +3577,7 @@ let M = class extends w {
3524
3577
  return /^(javascript|data|vbscript):/i.test(t) ? "" : e;
3525
3578
  }
3526
3579
  };
3527
- M.styles = [b, y`
3580
+ T.styles = [b, w`
3528
3581
  :host {
3529
3582
  display: block;
3530
3583
  font-family: system-ui, -apple-system, sans-serif;
@@ -3558,53 +3611,53 @@ M.styles = [b, y`
3558
3611
  }
3559
3612
  }
3560
3613
  `];
3561
- te([
3614
+ re([
3562
3615
  h({ type: Object })
3563
- ], M.prototype, "spec", 2);
3564
- te([
3616
+ ], T.prototype, "spec", 2);
3617
+ re([
3565
3618
  h({ type: String, reflect: !0 })
3566
- ], M.prototype, "theme", 2);
3567
- M = te([
3619
+ ], T.prototype, "theme", 2);
3620
+ T = re([
3568
3621
  x("u-video")
3569
- ], M);
3570
- var vt = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, re = (e, t, a, i) => {
3571
- for (var r = i > 1 ? void 0 : i ? bt(t, a) : t, n = e.length - 1, s; n >= 0; n--)
3572
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
3573
- return i && r && vt(t, a, r), r;
3622
+ ], T);
3623
+ var yt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, ae = (e, t, a, r) => {
3624
+ for (var i = r > 1 ? void 0 : r ? xt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3625
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3626
+ return r && i && yt(t, a, i), i;
3574
3627
  };
3575
- let U = class extends w {
3628
+ let U = class extends y {
3576
3629
  constructor() {
3577
3630
  super(...arguments), this.spec = null, this.theme = null;
3578
3631
  }
3579
3632
  render() {
3580
- if (!this.spec) return c;
3633
+ if (!this.spec) return l;
3581
3634
  const e = this.spec.data;
3582
- if (!Array.isArray(e)) return c;
3583
- const t = e.filter((p) => p && typeof p.src == "string" && p.src).map((p) => ({
3584
- src: this._sanitizeUrl(String(p.src)),
3585
- alt: p.alt ? String(p.alt) : void 0,
3586
- caption: p.caption ? String(p.caption) : void 0
3587
- })).filter((p) => p.src);
3588
- if (t.length === 0) return c;
3589
- const a = this.spec.options ?? {}, i = Number(a.columns) || 0, r = String(a.aspectRatio ?? "auto"), n = i > 0 ? `repeat(${i}, 1fr)` : "repeat(auto-fill, minmax(150px, 1fr))", s = r !== "auto" ? `aspect-ratio: ${r.replace(":", "/")};` : "", l = this.spec.title;
3635
+ if (!Array.isArray(e)) return l;
3636
+ const t = e.filter((c) => c && typeof c.src == "string" && c.src).map((c) => ({
3637
+ src: this._sanitizeUrl(String(c.src)),
3638
+ alt: c.alt ? String(c.alt) : void 0,
3639
+ caption: c.caption ? String(c.caption) : void 0
3640
+ })).filter((c) => c.src);
3641
+ if (t.length === 0) return l;
3642
+ const a = this.spec.options ?? {}, r = Number(a.columns) || 0, i = String(a.aspectRatio ?? "auto"), s = r > 0 ? `repeat(${r}, 1fr)` : "repeat(auto-fill, minmax(150px, 1fr))", n = i !== "auto" ? `aspect-ratio: ${i.replace(":", "/")};` : "", d = this.spec.title;
3590
3643
  return o`
3591
3644
  <div class="gallery-grid" part="gallery" role="list"
3592
- aria-label=${l ?? "Gallery"}
3593
- style="grid-template-columns: ${n}">
3594
- ${t.map((p) => this._renderItem(p, s))}
3645
+ aria-label=${d ?? "Gallery"}
3646
+ style="grid-template-columns: ${s}">
3647
+ ${t.map((c) => this._renderItem(c, n))}
3595
3648
  </div>
3596
3649
  `;
3597
3650
  }
3598
3651
  _renderItem(e, t) {
3599
3652
  return o`
3600
- <figure class="gallery-item" part="gallery-item" role="listitem" style=${t || c}>
3653
+ <figure class="gallery-item" part="gallery-item" role="listitem" style=${t || l}>
3601
3654
  <img
3602
3655
  src=${e.src}
3603
3656
  alt=${e.alt ?? ""}
3604
3657
  loading="lazy"
3605
3658
  part="gallery-image"
3606
3659
  />
3607
- ${e.caption ? o`<figcaption class="gallery-caption" part="gallery-caption">${e.caption}</figcaption>` : c}
3660
+ ${e.caption ? o`<figcaption class="gallery-caption" part="gallery-caption">${e.caption}</figcaption>` : l}
3608
3661
  </figure>
3609
3662
  `;
3610
3663
  }
@@ -3613,7 +3666,7 @@ let U = class extends w {
3613
3666
  return /^(javascript|data|vbscript):/i.test(t) ? "" : e;
3614
3667
  }
3615
3668
  };
3616
- U.styles = [b, y`
3669
+ U.styles = [b, w`
3617
3670
  :host {
3618
3671
  display: block;
3619
3672
  font-family: system-ui, -apple-system, sans-serif;
@@ -3651,21 +3704,21 @@ U.styles = [b, y`
3651
3704
  }
3652
3705
  }
3653
3706
  `];
3654
- re([
3707
+ ae([
3655
3708
  h({ type: Object })
3656
3709
  ], U.prototype, "spec", 2);
3657
- re([
3710
+ ae([
3658
3711
  h({ type: String, reflect: !0 })
3659
3712
  ], U.prototype, "theme", 2);
3660
- U = re([
3713
+ U = ae([
3661
3714
  x("u-gallery")
3662
3715
  ], U);
3663
- var yt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, J = (e, t, a, i) => {
3664
- for (var r = i > 1 ? void 0 : i ? wt(t, a) : t, n = e.length - 1, s; n >= 0; n--)
3665
- (s = e[n]) && (r = (i ? s(t, a, r) : s(r)) || r);
3666
- return i && r && yt(t, a, r), r;
3716
+ var $t = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, J = (e, t, a, r) => {
3717
+ for (var i = r > 1 ? void 0 : r ? _t(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3718
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3719
+ return r && i && $t(t, a, i), i;
3667
3720
  };
3668
- let E = class extends w {
3721
+ let E = class extends y {
3669
3722
  constructor() {
3670
3723
  super(...arguments), this.spec = null, this.theme = null, this.locale = null, this._handleInternalEvent = (e) => {
3671
3724
  e.stopPropagation(), this.dispatchEvent(
@@ -3686,134 +3739,135 @@ let E = class extends w {
3686
3739
  render() {
3687
3740
  if (!this.spec)
3688
3741
  return o`<slot></slot>`;
3689
- const e = Q(this.spec);
3742
+ const e = Y(this.spec);
3690
3743
  if (!e.valid)
3691
3744
  return this.renderError(e.errors);
3692
- const t = be(this.spec);
3745
+ const t = ye(this.spec);
3693
3746
  return this.renderWidget(t);
3694
3747
  }
3695
3748
  renderWidget(e) {
3696
- const t = e.widget, a = e.mapping ?? ve(t, e.data);
3697
- let i = a ? { ...e, mapping: a } : e;
3698
- this.locale && !i.options?.locale && (i = {
3699
- ...i,
3700
- options: { ...i.options, locale: this.locale }
3749
+ const t = e.widget, a = e.mapping ?? we(t, e.data);
3750
+ let r = a ? { ...e, mapping: a } : e;
3751
+ const i = Ie(this.locale);
3752
+ i && !r.options?.locale && (r = {
3753
+ ...r,
3754
+ options: { ...r.options, locale: i }
3701
3755
  });
3702
- const r = this.theme, s = t === "form" || t === "confirm" || t === "actions" ? [] : i.actions ?? [];
3703
- let l;
3756
+ const s = this.theme, d = t === "form" || t === "confirm" || t === "actions" ? [] : r.actions ?? [];
3757
+ let c;
3704
3758
  switch (t) {
3705
3759
  case "metric":
3706
3760
  case "stat-group":
3707
- l = o`<u-metric .spec=${i} theme=${r ?? c}></u-metric>`;
3761
+ c = o`<u-metric .spec=${r} theme=${s ?? l}></u-metric>`;
3708
3762
  break;
3709
3763
  case "gauge":
3710
3764
  case "progress":
3711
- l = o`<u-gauge .spec=${i} theme=${r ?? c}></u-gauge>`;
3765
+ c = o`<u-gauge .spec=${r} theme=${s ?? l}></u-gauge>`;
3712
3766
  break;
3713
3767
  case "table":
3714
3768
  case "list":
3715
- l = o`<u-table .spec=${i} theme=${r ?? c}></u-table>`;
3769
+ c = o`<u-table .spec=${r} theme=${s ?? l}></u-table>`;
3716
3770
  break;
3717
3771
  case "form":
3718
3772
  case "confirm":
3719
- l = o`<u-form .spec=${i} theme=${r ?? c}></u-form>`;
3773
+ c = o`<u-form .spec=${r} theme=${s ?? l}></u-form>`;
3720
3774
  break;
3721
3775
  case "compose":
3722
- l = o`<u-compose .spec=${i} theme=${r ?? c}></u-compose>`;
3776
+ c = o`<u-compose .spec=${r} theme=${s ?? l}></u-compose>`;
3723
3777
  break;
3724
3778
  case "markdown":
3725
3779
  case "image":
3726
3780
  case "callout":
3727
- l = o`<u-content .spec=${i} theme=${r ?? c}></u-content>`;
3781
+ c = o`<u-content .spec=${r} theme=${s ?? l}></u-content>`;
3728
3782
  break;
3729
3783
  case "kv":
3730
- l = o`<u-kv .spec=${i} theme=${r ?? c}></u-kv>`;
3784
+ c = o`<u-kv .spec=${r} theme=${s ?? l}></u-kv>`;
3731
3785
  break;
3732
3786
  case "code":
3733
- l = o`<u-code .spec=${i} theme=${r ?? c}></u-code>`;
3787
+ c = o`<u-code .spec=${r} theme=${s ?? l}></u-code>`;
3734
3788
  break;
3735
3789
  case "citation":
3736
- l = o`<u-citation .spec=${i} theme=${r ?? c}></u-citation>`;
3790
+ c = o`<u-citation .spec=${r} theme=${s ?? l}></u-citation>`;
3737
3791
  break;
3738
3792
  case "status":
3739
- l = o`<u-status .spec=${i} theme=${r ?? c}></u-status>`;
3793
+ c = o`<u-status .spec=${r} theme=${s ?? l}></u-status>`;
3740
3794
  break;
3741
3795
  case "steps":
3742
- l = o`<u-steps .spec=${i} theme=${r ?? c}></u-steps>`;
3796
+ c = o`<u-steps .spec=${r} theme=${s ?? l}></u-steps>`;
3743
3797
  break;
3744
3798
  case "rating":
3745
- l = o`<u-rating .spec=${i} theme=${r ?? c}></u-rating>`;
3799
+ c = o`<u-rating .spec=${r} theme=${s ?? l}></u-rating>`;
3746
3800
  break;
3747
3801
  case "video":
3748
- l = o`<u-video .spec=${i} theme=${r ?? c}></u-video>`;
3802
+ c = o`<u-video .spec=${r} theme=${s ?? l}></u-video>`;
3749
3803
  break;
3750
3804
  case "gallery":
3751
- l = o`<u-gallery .spec=${i} theme=${r ?? c}></u-gallery>`;
3805
+ c = o`<u-gallery .spec=${r} theme=${s ?? l}></u-gallery>`;
3752
3806
  break;
3753
3807
  case "actions":
3754
- l = this.renderActionsWidget(i);
3808
+ c = this.renderActionsWidget(r);
3755
3809
  break;
3756
3810
  case "divider":
3757
- l = this.renderDivider(i);
3811
+ c = this.renderDivider(r);
3758
3812
  break;
3759
3813
  case "header":
3760
- l = this.renderHeader(i);
3814
+ c = this.renderHeader(r);
3761
3815
  break;
3762
3816
  default:
3763
3817
  if (t.startsWith("chart.") && customElements.get("u-chart")) {
3764
- l = o`<u-chart .spec=${i} theme=${r ?? c}></u-chart>`;
3818
+ c = o`<u-chart .spec=${r} theme=${s ?? l}></u-chart>`;
3765
3819
  break;
3766
3820
  }
3767
- return this.renderFallback(i);
3821
+ return this.renderFallback(r);
3768
3822
  }
3769
- if (!!i.options?.card && (l = o`<div class="card-container" part="card">${l}</div>`), s.length > 0) {
3770
- const d = s.map((g) => o`
3823
+ if (!!r.options?.card && (c = o`<div class="card-container" part="card">${c}</div>`), d.length > 0) {
3824
+ const g = d.map((f) => o`
3771
3825
  <button
3772
- data-style=${g.style ?? "default"}
3773
- ?disabled=${g.disabled}
3774
- @click=${() => this._dispatchAction(i, g)}
3826
+ data-style=${f.style ?? "default"}
3827
+ ?disabled=${f.disabled}
3828
+ @click=${() => this._dispatchAction(r, f)}
3775
3829
  part="action-btn"
3776
- >${g.label}</button>
3830
+ >${f.label}</button>
3777
3831
  `);
3778
- return o`<div part="widget-container">${l}<div class="global-actions" part="actions">${d}</div></div>`;
3832
+ return o`<div part="widget-container">${c}<div class="global-actions" part="actions">${g}</div></div>`;
3779
3833
  }
3780
- return l;
3834
+ return c;
3781
3835
  }
3782
3836
  /** Render standalone "actions" widget — a group of action buttons. */
3783
3837
  renderActionsWidget(e) {
3784
3838
  const t = e.actions ?? [];
3785
- if (t.length === 0) return c;
3786
- const a = e.options ?? {}, i = String(a.layout ?? "wrap");
3839
+ if (t.length === 0) return l;
3840
+ const a = e.options ?? {}, r = String(a.layout ?? "wrap");
3787
3841
  return o`
3788
- <div class="actions-widget" data-layout=${i} part="actions" role="group" aria-label=${e.title ?? "Actions"}>
3789
- ${t.map((r) => o`
3842
+ <div class="actions-widget" data-layout=${r} part="actions" role="group" aria-label=${e.title ?? "Actions"}>
3843
+ ${t.map((i) => o`
3790
3844
  <button
3791
- data-style=${r.style ?? "default"}
3792
- ?disabled=${r.disabled}
3793
- @click=${() => this._dispatchAction(e, r)}
3845
+ data-style=${i.style ?? "default"}
3846
+ ?disabled=${i.disabled}
3847
+ @click=${() => this._dispatchAction(e, i)}
3794
3848
  part="action-btn"
3795
- >${r.label}</button>
3849
+ >${i.label}</button>
3796
3850
  `)}
3797
3851
  </div>
3798
3852
  `;
3799
3853
  }
3800
3854
  /** Render inline divider widget. */
3801
3855
  renderDivider(e) {
3802
- const t = e.options ?? {}, a = t.label, i = String(t.spacing ?? "default");
3856
+ const t = e.options ?? {}, a = t.label, r = String(t.spacing ?? "default");
3803
3857
  return o`
3804
- <div class="divider divider-spacing-${i}" part="divider" role="separator">
3805
- ${a ?? c}
3858
+ <div class="divider divider-spacing-${r}" part="divider" role="separator">
3859
+ ${a ?? l}
3806
3860
  </div>
3807
3861
  `;
3808
3862
  }
3809
3863
  /** Render inline header widget. */
3810
3864
  renderHeader(e) {
3811
- const t = e.data, a = String(t?.text ?? e.title ?? ""), i = String(t?.level ?? "2");
3865
+ const t = e.data, a = String(t?.text ?? e.title ?? ""), r = String(t?.level ?? "2");
3812
3866
  return a ? o`
3813
- <div class="header-widget" data-level=${i} part="header" role="heading" aria-level=${i}>
3867
+ <div class="header-widget" data-level=${r} part="header" role="heading" aria-level=${r}>
3814
3868
  ${a}
3815
3869
  </div>
3816
- ` : c;
3870
+ ` : l;
3817
3871
  }
3818
3872
  /** Dispatch an action event from the global action bar or actions widget. */
3819
3873
  _dispatchAction(e, t) {
@@ -3836,7 +3890,7 @@ let E = class extends w {
3836
3890
  );
3837
3891
  }
3838
3892
  renderFallback(e) {
3839
- const t = Oe(e.widget);
3893
+ const t = Ee(e.widget);
3840
3894
  return o`
3841
3895
  <div class="fallback-card" part="fallback">
3842
3896
  <div class="fallback-label">${e.title ?? `Unknown widget: ${e.widget}`}</div>
@@ -3861,7 +3915,7 @@ let E = class extends w {
3861
3915
  };
3862
3916
  E.styles = [
3863
3917
  b,
3864
- y`
3918
+ w`
3865
3919
  :host {
3866
3920
  display: block;
3867
3921
  container: u-widget / inline-size;
@@ -4057,17 +4111,20 @@ E = J([
4057
4111
  export {
4058
4112
  E as UWidget,
4059
4113
  A as formatTemplate,
4060
- _e as formatValue,
4061
- Ct as getDefaultLocale,
4062
- me as getFormdownParser,
4063
- de as getLocaleStrings,
4064
- ve as infer,
4065
- St as isWidgetSpec,
4066
- be as normalize,
4067
- Ot as parseFormdown,
4068
- Pt as registerFormdownParser,
4069
- At as registerLocale,
4070
- Oe as suggestWidget,
4071
- Q as validate
4114
+ pe as formatValue,
4115
+ Ot as getDefaultLocale,
4116
+ Et as getEffectiveLocale,
4117
+ be as getFormdownParser,
4118
+ ue as getLocaleStrings,
4119
+ we as infer,
4120
+ Dt as isWidgetSpec,
4121
+ ye as normalize,
4122
+ Nt as parseFormdown,
4123
+ Ft as registerFormdownParser,
4124
+ jt as registerLocale,
4125
+ Ie as resolveLocale,
4126
+ Pt as setDefaultLocale,
4127
+ Ee as suggestWidget,
4128
+ Y as validate
4072
4129
  };
4073
4130
  //# sourceMappingURL=u-widgets.js.map