@iyulab/u-widgets 0.4.1 → 0.5.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,8 +1,8 @@
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 ve } from "./formdown-BWJ6QGJs.js";
2
+ import { p as Nt, r as Ft } from "./formdown-BWJ6QGJs.js";
3
+ import { i as be } from "./infer-CNOiD2dS.js";
4
+ import { t as b, n as we } 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
7
  const ye = /* @__PURE__ */ new Set([
8
8
  "text",
@@ -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, xe = /* @__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 && (xe.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 && !ye.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
+ ve()(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 = _e(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 _e(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"], ke = /* @__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 ze(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 = ke.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 pe(e) {
301
326
  if (!e) return R;
302
327
  const t = e.toLowerCase();
303
328
  if (L.has(t)) return L.get(t);
@@ -307,18 +332,31 @@ 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, ue = (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) {
322
360
  return {
323
361
  value: e.value ?? 0,
324
362
  label: e.label,
@@ -331,39 +369,39 @@ function se(e) {
331
369
  description: e.description
332
370
  };
333
371
  }
334
- let q = class extends w {
372
+ let B = class extends y {
335
373
  constructor() {
336
374
  super(...arguments), this.spec = null;
337
375
  }
338
376
  render() {
339
- return this.spec?.data ? this.spec.widget === "stat-group" ? this.renderStatGroup() : this.renderMetric(se(this.spec.data)) : c;
377
+ return this.spec?.data ? this.spec.widget === "stat-group" ? this.renderStatGroup() : this.renderMetric(ne(this.spec.data)) : l;
340
378
  }
341
379
  renderStatGroup() {
342
380
  const e = this.spec.data;
343
381
  return Array.isArray(e) ? o`
344
382
  <div class="stat-group" part="stat-group">
345
- ${e.map((t) => this.renderMetric(se(t)))}
383
+ ${e.map((t) => this.renderMetric(ne(t)))}
346
384
  </div>
347
- ` : c;
385
+ ` : l;
348
386
  }
349
387
  renderMetric(e) {
350
388
  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
389
  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}
390
+ <div class="metric" part="metric" aria-label=${a ?? l}>
391
+ ${e.icon ? o`<div class="metric-icon" part="icon">${e.icon}</div>` : l}
392
+ ${e.label ? o`<div class="metric-label" part="label">${e.label}</div>` : l}
355
393
  <div class="metric-value" part="value">
356
394
  ${e.prefix ?? ""}${e.value}${e.unit ? o`<span class="metric-unit">${e.unit}</span>` : ""}${e.suffix ?? ""}
357
395
  </div>
358
396
  ${e.change != null ? o`<span class="metric-change" data-trend=${e.trend ?? "flat"} part="change"
359
397
  >${t} ${e.change > 0 ? "+" : ""}${e.change}%</span
360
- >` : c}
361
- ${e.description ? o`<div class="metric-description" part="description">${e.description}</div>` : c}
398
+ >` : l}
399
+ ${e.description ? o`<div class="metric-description" part="description">${e.description}</div>` : l}
362
400
  </div>
363
401
  `;
364
402
  }
365
403
  };
366
- q.styles = [b, y`
404
+ B.styles = [b, w`
367
405
  :host {
368
406
  display: block;
369
407
  font-family: system-ui, -apple-system, sans-serif;
@@ -463,23 +501,23 @@ q.styles = [b, y`
463
501
  }
464
502
  }
465
503
  `];
466
- pe([
504
+ ue([
467
505
  h({ type: Object })
468
- ], q.prototype, "spec", 2);
469
- q = pe([
506
+ ], B.prototype, "spec", 2);
507
+ B = ue([
470
508
  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;
509
+ ], B);
510
+ var Me = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, ge = (e, t, a, r) => {
511
+ for (var i = r > 1 ? void 0 : r ? Te(t, a) : t, s = e.length - 1, n; s >= 0; s--)
512
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
513
+ return r && i && Me(t, a, i), i;
476
514
  };
477
- const Te = {
515
+ const Ue = {
478
516
  min: 0,
479
517
  max: 100,
480
518
  unit: "",
481
519
  thresholds: []
482
- }, Fe = {
520
+ }, Re = {
483
521
  green: "#16a34a",
484
522
  yellow: "#eab308",
485
523
  orange: "#f97316",
@@ -487,30 +525,30 @@ const Te = {
487
525
  blue: "#2563eb",
488
526
  gray: "#6b7280"
489
527
  };
490
- function ne(e) {
491
- return Fe[e] ?? e;
528
+ function oe(e) {
529
+ return Re[e] ?? e;
492
530
  }
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}`;
531
+ function le(e, t, a, r, i) {
532
+ 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;
533
+ return `M ${d} ${c} A ${a} ${a} 0 ${f} 1 ${p} ${g}`;
496
534
  }
497
- let B = class extends w {
535
+ let W = class extends y {
498
536
  constructor() {
499
537
  super(...arguments), this.spec = null;
500
538
  }
501
539
  render() {
502
- return this.spec?.data ? this.spec.widget === "progress" ? this.renderProgress() : this.renderGauge() : c;
540
+ return this.spec?.data ? this.spec.widget === "progress" ? this.renderProgress() : this.renderGauge() : l;
503
541
  }
504
542
  getOptions() {
505
543
  const e = this.spec.options ?? {};
506
- return { ...Te, ...e };
544
+ return { ...Ue, ...e };
507
545
  }
508
546
  getValue() {
509
547
  const e = this.spec.data;
510
548
  return Number(e.value ?? 0);
511
549
  }
512
550
  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}`;
551
+ 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
552
  return o`
515
553
  <div class="gauge-container" part="gauge"
516
554
  role="meter"
@@ -523,36 +561,36 @@ let B = class extends w {
523
561
  <div class="gauge-wrapper">
524
562
  <div class="gauge-center">
525
563
  <div class="gauge-value" part="value">${t}</div>
526
- ${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : c}
564
+ ${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : l}
527
565
  </div>
528
566
  <svg class="gauge-svg" viewBox="0 0 200 195" role="presentation" aria-hidden="true">
529
567
  <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>
568
+ <path class="gauge-fill" d="${u ?? "M0 0"}" fill="none" stroke="${u ? i : "none"}" stroke-width="12" stroke-linecap="round"></path>
531
569
  </svg>
532
570
  </div>
533
571
  </div>
534
572
  `;
535
573
  }
536
574
  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";
575
+ 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
576
  return o`
539
577
  <div class="progress-container" part="progress"
540
578
  role="progressbar"
541
579
  aria-valuenow=${t}
542
580
  aria-valuemin=${0}
543
581
  aria-valuemax=${a}
544
- aria-label=${l}
582
+ aria-label=${d}
545
583
  >
546
584
  <div class="progress-bar-track">
547
585
  <div
548
586
  class="progress-bar-fill"
549
- style="width:${i}%; background:${n || "var(--u-widget-primary, #4f46e5)"}"
587
+ style="width:${r}%; background:${s || "var(--u-widget-primary, #4f46e5)"}"
550
588
  part="progress-fill"
551
589
  ></div>
552
590
  </div>
553
591
  <div class="progress-info">
554
- <span>${s}</span>
555
- <span>${Math.round(i)}%</span>
592
+ <span>${n}</span>
593
+ <span>${Math.round(r)}%</span>
556
594
  </div>
557
595
  </div>
558
596
  `;
@@ -563,13 +601,13 @@ let B = class extends w {
563
601
  }
564
602
  getThresholdColor(e, t) {
565
603
  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);
604
+ const a = [...t.thresholds].sort((r, i) => r.to - i.to);
605
+ for (const r of a)
606
+ if (e <= r.to) return oe(r.color);
607
+ return oe(a[a.length - 1].color);
570
608
  }
571
609
  };
572
- B.styles = [b, y`
610
+ W.styles = [b, w`
573
611
  :host {
574
612
  display: block;
575
613
  font-family: system-ui, -apple-system, sans-serif;
@@ -665,70 +703,70 @@ B.styles = [b, y`
665
703
  }
666
704
  }
667
705
  `];
668
- ue([
706
+ ge([
669
707
  h({ type: Object })
670
- ], B.prototype, "spec", 2);
671
- B = ue([
708
+ ], W.prototype, "spec", 2);
709
+ W = ge([
672
710
  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;
711
+ ], W);
712
+ var qe = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, C = (e, t, a, r) => {
713
+ for (var i = r > 1 ? void 0 : r ? Be(t, a) : t, s = e.length - 1, n; s >= 0; s--)
714
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
715
+ return r && i && qe(t, a, i), i;
678
716
  };
679
- let z = class extends w {
717
+ let z = class extends y {
680
718
  constructor() {
681
719
  super(...arguments), this.spec = null, this._sortField = null, this._sortDir = null, this._page = 0, this._searchQuery = "", this._focusedIdx = 0, this._onTableKeydown = (e) => {
682
720
  const a = e.target.closest("tr");
683
721
  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;
722
+ const r = a.parentElement;
723
+ if (!r) return;
724
+ const i = Array.from(r.querySelectorAll("tr")), s = i.indexOf(a);
725
+ let n = -1;
688
726
  switch (e.key) {
689
727
  case "ArrowDown":
690
- s = Math.min(n + 1, r.length - 1);
728
+ n = Math.min(s + 1, i.length - 1);
691
729
  break;
692
730
  case "ArrowUp":
693
- s = Math.max(n - 1, 0);
731
+ n = Math.max(s - 1, 0);
694
732
  break;
695
733
  case "Home":
696
- s = 0;
734
+ n = 0;
697
735
  break;
698
736
  case "End":
699
- s = r.length - 1;
737
+ n = i.length - 1;
700
738
  break;
701
739
  default:
702
740
  return;
703
741
  }
704
- e.preventDefault(), s !== n && s >= 0 && (this._focusedIdx = s, this.updateComplete.then(() => {
705
- this.shadowRoot?.querySelectorAll("tbody tr")?.[s]?.focus();
742
+ e.preventDefault(), n !== s && n >= 0 && (this._focusedIdx = n, this.updateComplete.then(() => {
743
+ this.shadowRoot?.querySelectorAll("tbody tr")?.[n]?.focus();
706
744
  }));
707
745
  }, this._onListKeydown = (e) => {
708
746
  const a = e.target.closest(".list-item");
709
747
  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;
748
+ const r = a.parentElement;
749
+ if (!r) return;
750
+ const i = Array.from(r.querySelectorAll(".list-item")), s = i.indexOf(a);
751
+ let n = -1;
714
752
  switch (e.key) {
715
753
  case "ArrowDown":
716
- s = Math.min(n + 1, r.length - 1);
754
+ n = Math.min(s + 1, i.length - 1);
717
755
  break;
718
756
  case "ArrowUp":
719
- s = Math.max(n - 1, 0);
757
+ n = Math.max(s - 1, 0);
720
758
  break;
721
759
  case "Home":
722
- s = 0;
760
+ n = 0;
723
761
  break;
724
762
  case "End":
725
- s = r.length - 1;
763
+ n = i.length - 1;
726
764
  break;
727
765
  default:
728
766
  return;
729
767
  }
730
- e.preventDefault(), s !== n && s >= 0 && (this._focusedIdx = s, this.updateComplete.then(() => {
731
- this.shadowRoot?.querySelectorAll(".list-item")?.[s]?.focus();
768
+ e.preventDefault(), n !== s && n >= 0 && (this._focusedIdx = n, this.updateComplete.then(() => {
769
+ this.shadowRoot?.querySelectorAll(".list-item")?.[n]?.focus();
732
770
  }));
733
771
  }, this._onSearch = (e) => {
734
772
  this._searchQuery = e.target.value, this._page = 0;
@@ -738,14 +776,14 @@ let z = class extends w {
738
776
  e.has("spec") && (this._sortField = null, this._sortDir = null, this._page = 0, this._searchQuery = "", this._focusedIdx = 0);
739
777
  }
740
778
  render() {
741
- return !this.spec?.data || !Array.isArray(this.spec.data) ? c : this.spec.widget === "list" ? this.renderList() : this.renderTable();
779
+ return !this.spec?.data || !Array.isArray(this.spec.data) ? l : this.spec.widget === "list" ? this.renderList() : this.renderTable();
742
780
  }
743
781
  get _locale() {
744
782
  const e = this.spec?.options?.locale;
745
- return de(typeof e == "string" ? e : void 0);
783
+ return pe(typeof e == "string" ? e : void 0);
746
784
  }
747
785
  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`
786
+ 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
787
  <div class="search-box" part="search">
750
788
  <input
751
789
  class="search-input"
@@ -756,14 +794,14 @@ let z = class extends w {
756
794
  @input=${this._onSearch}
757
795
  />
758
796
  </div>
759
- ` : c, m = s > 0 && d > 1 ? o`
797
+ ` : l, m = n > 0 && p > 1 ? o`
760
798
  <nav class="pagination" part="pagination" aria-label=${a.tablePagination}>
761
799
  <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>
800
+ <span aria-live="polite">${g + 1} / ${p}</span>
801
+ <button aria-label=${a.nextPage} ?disabled=${g >= p - 1} @click=${() => this._onPageChange(g + 1)}>${a.next}</button>
764
802
  </nav>
765
- ` : c;
766
- return o`<div class="table-container${n ? " compact" : ""}">
803
+ ` : l;
804
+ return o`<div class="table-container${s ? " compact" : ""}">
767
805
  ${u}
768
806
  <div class="table-wrapper" part="table">
769
807
  <table aria-label=${this.spec.title ?? a.dataTable}>
@@ -773,15 +811,15 @@ let z = class extends w {
773
811
  (v) => o`<th
774
812
  scope="col"
775
813
  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 ? ($) => {
814
+ ?data-sortable=${r}
815
+ tabindex=${r ? "0" : l}
816
+ @click=${r ? () => this._onSort(v.field) : void 0}
817
+ @keydown=${r ? ($) => {
780
818
  ($.key === "Enter" || $.key === " ") && ($.preventDefault(), this._onSort(v.field));
781
819
  } : void 0}
782
820
  aria-sort=${this._sortField === v.field && this._sortDir ? this._sortDir === "asc" ? "ascending" : "descending" : "none"}
783
821
  part="th"
784
- >${v.label ?? v.field}${this._sortField === v.field && this._sortDir ? o`<span class="sort-arrow">${this._sortDir === "asc" ? "▲" : "▼"}</span>` : c}</th>`
822
+ >${v.label ?? v.field}${this._sortField === v.field && this._sortDir ? o`<span class="sort-arrow">${this._sortDir === "asc" ? "▲" : "▼"}</span>` : l}</th>`
785
823
  )}
786
824
  </tr>
787
825
  </thead>
@@ -790,14 +828,14 @@ let z = class extends w {
790
828
  (v, $) => o`
791
829
  <tr part="tr"
792
830
  tabindex=${$ === this._focusedIdx ? "0" : "-1"}
793
- @click=${() => this._onRowClick(v, s > 0 ? g * s + $ : $)}
831
+ @click=${() => this._onRowClick(v, n > 0 ? g * n + $ : $)}
794
832
  @keydown=${(_) => {
795
- (_.key === "Enter" || _.key === " ") && (_.preventDefault(), this._onRowClick(v, s > 0 ? g * s + $ : $));
833
+ (_.key === "Enter" || _.key === " ") && (_.preventDefault(), this._onRowClick(v, n > 0 ? g * n + $ : $));
796
834
  }}
797
835
  >
798
836
  ${t.map(
799
837
  (_) => 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
838
+ >${ze(v[_.field], _.format, typeof this.spec.options?.locale == "string" ? this.spec.options.locale : void 0)}</td
801
839
  >`
802
840
  )}
803
841
  </tr>
@@ -815,9 +853,9 @@ let z = class extends w {
815
853
  });
816
854
  }
817
855
  filterData(e, t) {
818
- const a = this._searchQuery.toLowerCase(), i = t.map((r) => r.field);
856
+ const a = this._searchQuery.toLowerCase(), r = t.map((i) => i.field);
819
857
  return e.filter(
820
- (r) => i.some((n) => String(r[n] ?? "").toLowerCase().includes(a))
858
+ (i) => r.some((s) => String(i[s] ?? "").toLowerCase().includes(a))
821
859
  );
822
860
  }
823
861
  _onSort(e) {
@@ -825,41 +863,41 @@ let z = class extends w {
825
863
  }
826
864
  sortData(e) {
827
865
  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;
866
+ return [...e].sort((r, i) => {
867
+ const s = r[t], n = i[t];
868
+ if (s == null && n == null) return 0;
869
+ if (s == null) return 1;
870
+ if (n == null) return -1;
871
+ let d;
872
+ if (typeof s == "number" && typeof n == "number")
873
+ d = s - n;
836
874
  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));
875
+ const c = Number(s), p = Number(n);
876
+ d = String(s) !== "" && String(n) !== "" && !isNaN(c) && !isNaN(p) ? c - p : String(s).localeCompare(String(n));
839
877
  }
840
- return a === "asc" ? l : -l;
878
+ return a === "asc" ? d : -d;
841
879
  });
842
880
  }
843
881
  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;
882
+ 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
883
  return o`
846
884
  <div class="list-container${a ? " compact" : ""}" part="list" @keydown=${this._onListKeydown}>
847
885
  ${e.map(
848
- (d, g) => o`
886
+ (p, g) => o`
849
887
  <div class="list-item" part="list-item"
850
888
  tabindex=${g === this._focusedIdx ? "0" : "-1"}
851
- @click=${() => this._onRowClick(d, g)}
889
+ @click=${() => this._onRowClick(p, g)}
852
890
  @keydown=${(f) => {
853
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), this._onRowClick(d, g));
891
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), this._onRowClick(p, g));
854
892
  }}
855
893
  >
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}
894
+ ${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
895
  <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}
896
+ <div class="list-primary" part="primary">${p[r] ?? ""}</div>
897
+ ${i ? o`<div class="list-secondary" part="secondary">${p[i] ?? ""}</div>` : l}
860
898
  </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}
899
+ ${c && p[c] != null ? o`<span class="list-badge" part="badge">${p[c]}</span>` : l}
900
+ ${d && p[d] != null ? o`<div class="list-trailing" part="trailing">${p[d]}</div>` : l}
863
901
  </div>
864
902
  `
865
903
  )}
@@ -888,16 +926,16 @@ let z = class extends w {
888
926
  inferPrimaryKey(e) {
889
927
  if (e.length === 0) return "";
890
928
  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] ?? "";
929
+ for (const s of a)
930
+ if (t.includes(s)) return s;
931
+ const r = e[0];
932
+ return t.find((s) => typeof r[s] == "string") ?? t[0] ?? "";
895
933
  }
896
934
  getIconLetter(e) {
897
935
  return String(e ?? "").charAt(0).toUpperCase();
898
936
  }
899
937
  };
900
- z.styles = [b, y`
938
+ z.styles = [b, w`
901
939
  :host {
902
940
  display: block;
903
941
  font-family: system-ui, -apple-system, sans-serif;
@@ -1227,12 +1265,12 @@ C([
1227
1265
  z = C([
1228
1266
  x("u-table")
1229
1267
  ], 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;
1268
+ var We = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, V = (e, t, a, r) => {
1269
+ for (var i = r > 1 ? void 0 : r ? Ke(t, a) : t, s = e.length - 1, n; s >= 0; s--)
1270
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
1271
+ return r && i && We(t, a, i), i;
1234
1272
  };
1235
- let D = class extends w {
1273
+ let j = class extends y {
1236
1274
  constructor() {
1237
1275
  super(...arguments), this.spec = null, this._formData = {}, this._errors = {}, this._onFormSubmit = (e) => {
1238
1276
  e.preventDefault();
@@ -1254,14 +1292,14 @@ let D = class extends w {
1254
1292
  e.has("spec") && this.spec && (this._formData = { ...this.spec.data ?? {} }, this._errors = {});
1255
1293
  }
1256
1294
  render() {
1257
- return this.spec ? this.spec.widget === "confirm" ? this.renderConfirm() : this.renderForm() : c;
1295
+ return this.spec ? this.spec.widget === "confirm" ? this.renderConfirm() : this.renderForm() : l;
1258
1296
  }
1259
1297
  renderForm() {
1260
1298
  const e = this.spec.fields ?? [], t = this.spec.actions ?? [];
1261
1299
  return o`
1262
1300
  <form class="form-container" part="form" @submit=${this._onFormSubmit}>
1263
1301
  ${e.map((a) => this.renderField(a))}
1264
- ${t.length > 0 ? this.renderActions(t) : c}
1302
+ ${t.length > 0 ? this.renderActions(t) : l}
1265
1303
  </form>
1266
1304
  `;
1267
1305
  }
@@ -1269,76 +1307,76 @@ let D = class extends w {
1269
1307
  const e = this.spec.description, t = this.spec.actions ?? [];
1270
1308
  return o`
1271
1309
  <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}
1310
+ ${e ? o`<div class="confirm-description" part="description">${e}</div>` : l}
1311
+ ${t.length > 0 ? this.renderActions(t) : l}
1274
1312
  </div>
1275
1313
  `;
1276
1314
  }
1277
1315
  renderField(e) {
1278
- const t = this._formData[e.field], a = e.type ?? "text", i = this._errors[e.field], r = `err-${e.field}`;
1316
+ const t = this._formData[e.field], a = e.type ?? "text", r = this._errors[e.field], i = `err-${e.field}`;
1279
1317
  return o`
1280
1318
  <div class="field" part="field">
1281
1319
  ${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}
1320
+ >${e.label}${e.required ? o`<span class="required">*</span>` : l}</label
1321
+ >` : l}
1322
+ ${this.renderInput(e, a, t, r ? i : void 0)}
1323
+ ${r ? o`<div class="field-error" id=${i} role="alert" part="field-error">${r}</div>` : l}
1286
1324
  </div>
1287
1325
  `;
1288
1326
  }
1289
- renderInput(e, t, a, i) {
1290
- const r = !!this._errors[e.field];
1327
+ renderInput(e, t, a, r) {
1328
+ const i = !!this._errors[e.field];
1291
1329
  switch (t) {
1292
1330
  case "textarea":
1293
1331
  return o`<textarea
1294
1332
  id=${`input-${e.field}`}
1295
- class=${r ? "invalid" : ""}
1333
+ class=${i ? "invalid" : ""}
1296
1334
  .value=${String(a ?? "")}
1297
1335
  placeholder=${e.placeholder ?? ""}
1298
1336
  rows=${e.rows ?? 3}
1299
1337
  ?required=${e.required}
1300
1338
  minlength=${e.minLength ?? ""}
1301
1339
  maxlength=${e.maxLength ?? ""}
1302
- aria-invalid=${r ? "true" : "false"}
1303
- aria-describedby=${i ?? c}
1340
+ aria-invalid=${i ? "true" : "false"}
1341
+ aria-describedby=${r ?? l}
1304
1342
  ?aria-required=${e.required}
1305
- @input=${(n) => this._onChange(e.field, n.target.value)}
1343
+ @input=${(s) => this._onChange(e.field, s.target.value)}
1306
1344
  part="input"
1307
1345
  ></textarea>`;
1308
1346
  case "select":
1309
1347
  return o`<select
1310
1348
  id=${`input-${e.field}`}
1311
- class=${r ? "invalid" : ""}
1349
+ class=${i ? "invalid" : ""}
1312
1350
  .value=${String(a ?? "")}
1313
1351
  ?required=${e.required}
1314
- aria-invalid=${r ? "true" : "false"}
1315
- aria-describedby=${i ?? c}
1316
- @change=${(n) => this._onChange(e.field, n.target.value)}
1352
+ aria-invalid=${i ? "true" : "false"}
1353
+ aria-describedby=${r ?? l}
1354
+ @change=${(s) => this._onChange(e.field, s.target.value)}
1317
1355
  part="input"
1318
1356
  >
1319
1357
  <option value="">--</option>
1320
1358
  ${(e.options ?? []).map(
1321
- (n) => o`<option value=${n}>${n}</option>`
1359
+ (s) => o`<option value=${s}>${s}</option>`
1322
1360
  )}
1323
1361
  </select>`;
1324
1362
  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}>
1363
+ 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
1364
  ${(e.options ?? []).map(
1327
- (n) => o`
1365
+ (s) => o`
1328
1366
  <label>
1329
1367
  <input
1330
1368
  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] : [];
1369
+ value=${s}
1370
+ ?checked=${Array.isArray(a) && a.includes(s)}
1371
+ @change=${(n) => {
1372
+ const d = n.target.checked, c = Array.isArray(a) ? [...a] : [];
1335
1373
  this._onChange(
1336
1374
  e.field,
1337
- l ? [...p, n] : p.filter((d) => d !== n)
1375
+ d ? [...c, s] : c.filter((p) => p !== s)
1338
1376
  );
1339
1377
  }}
1340
1378
  />
1341
- ${n}
1379
+ ${s}
1342
1380
  </label>
1343
1381
  `
1344
1382
  )}
@@ -1353,8 +1391,8 @@ let D = class extends w {
1353
1391
  aria-label=${e.label ?? e.field}
1354
1392
  tabindex="0"
1355
1393
  @click=${() => this._onChange(e.field, !a)}
1356
- @keydown=${(n) => {
1357
- (n.key === " " || n.key === "Enter") && (n.preventDefault(), this._onChange(e.field, !a));
1394
+ @keydown=${(s) => {
1395
+ (s.key === " " || s.key === "Enter") && (s.preventDefault(), this._onChange(e.field, !a));
1358
1396
  }}
1359
1397
  part="toggle"
1360
1398
  >
@@ -1362,40 +1400,40 @@ let D = class extends w {
1362
1400
  </div>
1363
1401
  </div>`;
1364
1402
  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}>
1403
+ 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
1404
  ${(e.options ?? []).map(
1367
- (n) => o`
1405
+ (s) => o`
1368
1406
  <label>
1369
1407
  <input
1370
1408
  type="radio"
1371
1409
  name=${e.field}
1372
- value=${n}
1373
- ?checked=${a === n}
1374
- @change=${() => this._onChange(e.field, n)}
1410
+ value=${s}
1411
+ ?checked=${a === s}
1412
+ @change=${() => this._onChange(e.field, s)}
1375
1413
  />
1376
- ${n}
1414
+ ${s}
1377
1415
  </label>
1378
1416
  `
1379
1417
  )}
1380
1418
  </div>`;
1381
1419
  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}>
1420
+ 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
1421
  ${(e.options ?? []).map(
1384
- (n) => o`
1422
+ (s) => o`
1385
1423
  <label>
1386
1424
  <input
1387
1425
  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] : [];
1426
+ value=${s}
1427
+ ?checked=${Array.isArray(a) && a.includes(s)}
1428
+ @change=${(n) => {
1429
+ const d = n.target.checked, c = Array.isArray(a) ? [...a] : [];
1392
1430
  this._onChange(
1393
1431
  e.field,
1394
- l ? [...p, n] : p.filter((d) => d !== n)
1432
+ d ? [...c, s] : c.filter((p) => p !== s)
1395
1433
  );
1396
1434
  }}
1397
1435
  />
1398
- ${n}
1436
+ ${s}
1399
1437
  </label>
1400
1438
  `
1401
1439
  )}
@@ -1404,12 +1442,12 @@ let D = class extends w {
1404
1442
  return o`<input
1405
1443
  type=${t === "datetime" ? "datetime-local" : t}
1406
1444
  id=${`input-${e.field}`}
1407
- class=${r ? "invalid" : ""}
1445
+ class=${i ? "invalid" : ""}
1408
1446
  .value=${String(a ?? "")}
1409
1447
  placeholder=${e.placeholder ?? ""}
1410
1448
  ?required=${e.required}
1411
- aria-invalid=${r ? "true" : "false"}
1412
- aria-describedby=${i ?? c}
1449
+ aria-invalid=${i ? "true" : "false"}
1450
+ aria-describedby=${r ?? l}
1413
1451
  ?aria-required=${e.required}
1414
1452
  min=${e.min ?? ""}
1415
1453
  max=${e.max ?? ""}
@@ -1417,9 +1455,9 @@ let D = class extends w {
1417
1455
  minlength=${e.minLength ?? ""}
1418
1456
  maxlength=${e.maxLength ?? ""}
1419
1457
  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);
1458
+ @input=${(n) => {
1459
+ const d = n.target.value, c = (t === "number" || t === "range") && d !== "" ? Number(d) : d;
1460
+ this._onChange(e.field, c);
1423
1461
  }}
1424
1462
  part="input"
1425
1463
  />`;
@@ -1460,32 +1498,32 @@ let D = class extends w {
1460
1498
  }
1461
1499
  get _locale() {
1462
1500
  const e = this.spec?.options?.locale;
1463
- return de(typeof e == "string" ? e : void 0);
1501
+ return pe(typeof e == "string" ? e : void 0);
1464
1502
  }
1465
1503
  _validate() {
1466
1504
  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 });
1505
+ for (const r of e) {
1506
+ const i = this._formData[r.field], s = r.label ?? r.field;
1507
+ if (r.required && (i == null || i === "" || Array.isArray(i) && i.length === 0)) {
1508
+ t[r.field] = r.message ?? A(a.required, { label: s });
1471
1509
  continue;
1472
1510
  }
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 });
1511
+ if (!(i == null || i === "")) {
1512
+ 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) {
1513
+ t[r.field] = r.message ?? A(a.minLength, { label: s, min: r.minLength });
1476
1514
  continue;
1477
1515
  }
1478
- if (i.type === "email" && typeof r == "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)) {
1479
- t[i.field] = i.message ?? A(a.invalidEmail, { label: n });
1516
+ if (r.type === "email" && typeof i == "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)) {
1517
+ t[r.field] = r.message ?? A(a.invalidEmail, { label: s });
1480
1518
  continue;
1481
1519
  }
1482
- if (i.type === "url" && typeof r == "string" && !/^https?:\/\/.+/.test(r)) {
1483
- t[i.field] = i.message ?? A(a.invalidUrl, { label: n });
1520
+ if (r.type === "url" && typeof i == "string" && !/^https?:\/\/.+/.test(i)) {
1521
+ t[r.field] = r.message ?? A(a.invalidUrl, { label: s });
1484
1522
  continue;
1485
1523
  }
1486
- if (i.pattern && typeof r == "string")
1524
+ if (r.pattern && typeof i == "string")
1487
1525
  try {
1488
- new RegExp(i.pattern).test(r) || (t[i.field] = i.message ?? A(a.invalidPattern, { label: n }));
1526
+ new RegExp(r.pattern).test(i) || (t[r.field] = r.message ?? A(a.invalidPattern, { label: s }));
1489
1527
  } catch {
1490
1528
  }
1491
1529
  }
@@ -1524,7 +1562,7 @@ let D = class extends w {
1524
1562
  );
1525
1563
  }
1526
1564
  };
1527
- D.styles = [b, y`
1565
+ j.styles = [b, w`
1528
1566
  :host {
1529
1567
  display: block;
1530
1568
  font-family: system-ui, -apple-system, sans-serif;
@@ -1742,64 +1780,64 @@ D.styles = [b, y`
1742
1780
  }
1743
1781
  }
1744
1782
  `];
1745
- K([
1783
+ V([
1746
1784
  h({ type: Object })
1747
- ], D.prototype, "spec", 2);
1748
- K([
1785
+ ], j.prototype, "spec", 2);
1786
+ V([
1749
1787
  S()
1750
- ], D.prototype, "_formData", 2);
1751
- K([
1788
+ ], j.prototype, "_formData", 2);
1789
+ V([
1752
1790
  S()
1753
- ], D.prototype, "_errors", 2);
1754
- D = K([
1791
+ ], j.prototype, "_errors", 2);
1792
+ j = V([
1755
1793
  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;
1794
+ ], j);
1795
+ var He = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, Z = (e, t, a, r) => {
1796
+ for (var i = r > 1 ? void 0 : r ? Ve(t, a) : t, s = e.length - 1, n; s >= 0; s--)
1797
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
1798
+ return r && i && He(t, a, i), i;
1761
1799
  };
1762
- let I = class extends w {
1800
+ let I = class extends y {
1763
1801
  constructor() {
1764
1802
  super(...arguments), this.spec = null, this.theme = null;
1765
1803
  }
1766
1804
  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;
1805
+ if (!this.spec) return l;
1806
+ 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
1807
  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>`;
1808
+ 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
1809
  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>`;
1810
+ const n = this._gridColumns(t);
1811
+ 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
1812
  }
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>`;
1813
+ 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
1814
  }
1777
1815
  /** Compute grid-template-columns from options.widths or fallback to equal columns. */
1778
1816
  _gridColumns(e) {
1779
1817
  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";
1818
+ return !Array.isArray(a) || a.length === 0 ? `repeat(${e}, 1fr)` : a.map((r) => {
1819
+ if (r === "auto") return "auto";
1820
+ if (r === "stretch") return "1fr";
1821
+ const i = Number(r);
1822
+ return Number.isFinite(i) && i > 0 ? `${i}fr` : "1fr";
1785
1823
  }).join(" ");
1786
1824
  }
1787
1825
  _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>`;
1826
+ 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
1827
  if (e.collapsed) {
1790
- const p = e.title || "Details";
1828
+ const c = e.title || "Details";
1791
1829
  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>
1830
+ <details class="child-collapsed" part="child" style=${r || l}>
1831
+ <summary part="collapsed-summary">${c}</summary>
1832
+ <div class="collapsed-content">${n}</div>
1795
1833
  </details>
1796
1834
  `;
1797
1835
  }
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>`;
1836
+ const d = s ? "child child-card" : "child";
1837
+ return r ? o`<div class=${d} style=${r} part="child">${n}</div>` : o`<div class=${d} part="child">${n}</div>`;
1800
1838
  }
1801
1839
  };
1802
- I.styles = [b, y`
1840
+ I.styles = [b, w`
1803
1841
  :host {
1804
1842
  display: block;
1805
1843
  container: u-compose / inline-size;
@@ -1905,17 +1943,17 @@ Z([
1905
1943
  I = Z([
1906
1944
  x("u-compose")
1907
1945
  ], 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;
1946
+ var Ge = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, fe = (e, t, a, r) => {
1947
+ for (var i = r > 1 ? void 0 : r ? Xe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
1948
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
1949
+ return r && i && Ge(t, a, i), i;
1912
1950
  };
1913
- let W = class extends w {
1951
+ let K = class extends y {
1914
1952
  constructor() {
1915
1953
  super(...arguments), this.spec = null;
1916
1954
  }
1917
1955
  render() {
1918
- if (!this.spec) return c;
1956
+ if (!this.spec) return l;
1919
1957
  switch (this.spec.widget) {
1920
1958
  case "markdown":
1921
1959
  return this.renderMarkdown();
@@ -1924,30 +1962,30 @@ let W = class extends w {
1924
1962
  case "callout":
1925
1963
  return this.renderCallout();
1926
1964
  default:
1927
- return c;
1965
+ return l;
1928
1966
  }
1929
1967
  }
1930
1968
  renderMarkdown() {
1931
1969
  const e = this.spec.data, t = typeof e == "string" ? e : e?.content ?? "";
1932
1970
  return t ? o`<div class="markdown" part="markdown"
1933
1971
  .innerHTML=${this.parseMarkdown(t)}
1934
- ></div>` : c;
1972
+ ></div>` : l;
1935
1973
  }
1936
1974
  renderImage() {
1937
1975
  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;
1976
+ if (!e) return l;
1977
+ const t = String(e.src ?? ""), a = String(e.alt ?? ""), r = e.caption, i = this.sanitizeUrl(t);
1978
+ return i ? o`<div class="image-container" part="image">
1979
+ <img src=${i} alt=${a} loading="lazy" />
1980
+ ${r ? o`<div class="image-caption" part="caption">${r}</div>` : l}
1981
+ </div>` : l;
1944
1982
  }
1945
1983
  renderCallout() {
1946
1984
  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}
1985
+ if (!e) return l;
1986
+ 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";
1987
+ return o`<div class="callout callout-${s}" part="callout" role=${n ? "alert" : "note"} aria-live=${n ? "assertive" : "polite"}>
1988
+ ${r ? o`<div class="callout-title" part="callout-title">${r}</div>` : l}
1951
1989
  <div part="callout-message">${t}</div>
1952
1990
  </div>`;
1953
1991
  }
@@ -1959,14 +1997,14 @@ let W = class extends w {
1959
1997
  let t = this.escapeHtml(e);
1960
1998
  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
1999
  /^(\|.+\|)\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("");
2000
+ (a, r, i, s) => {
2001
+ 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(`
2002
+ `).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
2003
  return `<table><thead><tr>${g}</tr></thead><tbody>${f}</tbody></table>`;
1966
2004
  }
1967
2005
  ), 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
2006
  /\[([^\]]+)\]\(([^)]+)\)/g,
1969
- (a, i, r) => `<a href="${this.sanitizeUrl(r)}" target="_blank" rel="noopener">${i}</a>`
2007
+ (a, r, i) => `<a href="${this.sanitizeUrl(i)}" target="_blank" rel="noopener">${r}</a>`
1970
2008
  ), 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
2009
  `), t;
1972
2010
  }
@@ -1978,7 +2016,7 @@ let W = class extends w {
1978
2016
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1979
2017
  }
1980
2018
  };
1981
- W.styles = [b, y`
2019
+ K.styles = [b, w`
1982
2020
  :host {
1983
2021
  display: block;
1984
2022
  font-family: system-ui, -apple-system, sans-serif;
@@ -2155,38 +2193,38 @@ W.styles = [b, y`
2155
2193
  }
2156
2194
  }
2157
2195
  `];
2158
- ge([
2196
+ fe([
2159
2197
  h({ type: Object })
2160
- ], W.prototype, "spec", 2);
2161
- W = ge([
2198
+ ], K.prototype, "spec", 2);
2199
+ K = fe([
2162
2200
  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;
2201
+ ], K);
2202
+ var Je = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, he = (e, t, a, r) => {
2203
+ for (var i = r > 1 ? void 0 : r ? Ye(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2204
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2205
+ return r && i && Je(t, a, i), i;
2168
2206
  };
2169
- let H = class extends w {
2207
+ let H = class extends y {
2170
2208
  constructor() {
2171
2209
  super(...arguments), this.spec = null;
2172
2210
  }
2173
2211
  render() {
2174
- if (!this.spec) return c;
2212
+ if (!this.spec) return l;
2175
2213
  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)` : "";
2214
+ if (e.length === 0) return l;
2215
+ 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
2216
  return o`
2179
2217
  <div
2180
2218
  class=${`kv-${a === "grid" ? "grid" : a === "horizontal" ? "horizontal" : "vertical"}`}
2181
- style=${r}
2219
+ style=${i}
2182
2220
  part="kv"
2183
2221
  role="list"
2184
2222
  aria-label=${this.spec.title ?? "Key-value pairs"}
2185
2223
  >
2186
- ${e.map(([n, s]) => o`
2224
+ ${e.map(([s, n]) => o`
2187
2225
  <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>
2226
+ <span class="kv-key" part="kv-key">${s}</span>
2227
+ <span class="kv-value" part="kv-value">${String(n)}</span>
2190
2228
  </div>
2191
2229
  `)}
2192
2230
  </div>
@@ -2197,7 +2235,7 @@ let H = class extends w {
2197
2235
  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
2236
  }
2199
2237
  };
2200
- H.styles = [b, y`
2238
+ H.styles = [b, w`
2201
2239
  :host {
2202
2240
  display: block;
2203
2241
  font-family: system-ui, -apple-system, sans-serif;
@@ -2291,18 +2329,18 @@ H.styles = [b, y`
2291
2329
  }
2292
2330
  }
2293
2331
  `];
2294
- fe([
2332
+ he([
2295
2333
  h({ type: Object })
2296
2334
  ], H.prototype, "spec", 2);
2297
- H = fe([
2335
+ H = he([
2298
2336
  x("u-kv")
2299
2337
  ], 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;
2338
+ var Ze = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, G = (e, t, a, r) => {
2339
+ for (var i = r > 1 ? void 0 : r ? Qe(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2340
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2341
+ return r && i && Ze(t, a, i), i;
2304
2342
  };
2305
- const Ze = {
2343
+ const et = {
2306
2344
  javascript: ["//", ["/*", "*/"]],
2307
2345
  typescript: ["//", ["/*", "*/"]],
2308
2346
  python: ["#"],
@@ -2314,7 +2352,7 @@ const Ze = {
2314
2352
  bash: ["#"],
2315
2353
  css: [void 0, ["/*", "*/"]],
2316
2354
  html: [void 0, ["<!--", "-->"]]
2317
- }, Xe = {
2355
+ }, tt = {
2318
2356
  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
2357
  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
2358
  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 +2362,7 @@ const Ze = {
2324
2362
  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
2363
  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
2364
  bash: "break case do done elif else esac fi for function if in local read return select then until while"
2327
- }, Ye = {
2365
+ }, rt = {
2328
2366
  js: "javascript",
2329
2367
  ts: "typescript",
2330
2368
  py: "python",
@@ -2343,138 +2381,138 @@ const Ze = {
2343
2381
  jsonc: "json",
2344
2382
  psql: "sql",
2345
2383
  mysql: "sql"
2346
- }, le = /* @__PURE__ */ new Map();
2347
- function et(e) {
2348
- let t = le.get(e);
2384
+ }, ce = /* @__PURE__ */ new Map();
2385
+ function at(e) {
2386
+ let t = ce.get(e);
2349
2387
  if (!t) {
2350
- const a = Xe[e] || "";
2351
- t = a ? new Set(a.split(" ")) : /* @__PURE__ */ new Set(), le.set(e, t);
2388
+ const a = tt[e] || "";
2389
+ t = a ? new Set(a.split(" ")) : /* @__PURE__ */ new Set(), ce.set(e, t);
2352
2390
  }
2353
2391
  return t;
2354
2392
  }
2355
2393
  function k(e) {
2356
2394
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2357
2395
  }
2358
- function j(e, t) {
2396
+ function D(e, t) {
2359
2397
  const a = k(e);
2360
2398
  return a.includes(`
2361
2399
  `) ? a.split(`
2362
- `).map((i) => `<span class="hl-${t}">${i}</span>`).join(`
2400
+ `).map((r) => `<span class="hl-${t}">${r}</span>`).join(`
2363
2401
  `) : `<span class="hl-${t}">${a}</span>`;
2364
2402
  }
2365
- function he(e, t, a) {
2366
- let i = t + 1;
2367
- for (; i < e.length; ) {
2368
- if (e[i] === "\\") {
2369
- i += 2;
2403
+ function me(e, t, a) {
2404
+ let r = t + 1;
2405
+ for (; r < e.length; ) {
2406
+ if (e[r] === "\\") {
2407
+ r += 2;
2370
2408
  continue;
2371
2409
  }
2372
- if (e[i] === a) return i + 1;
2373
- if (a !== "`" && e[i] === `
2374
- `) return i;
2375
- i++;
2410
+ if (e[r] === a) return r + 1;
2411
+ if (a !== "`" && e[r] === `
2412
+ `) return r;
2413
+ r++;
2376
2414
  }
2377
2415
  return e.length;
2378
2416
  }
2379
- function tt(e, t) {
2417
+ function it(e, t) {
2380
2418
  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;
2419
+ const a = rt[t] || t;
2420
+ if (a === "json") return st(e);
2421
+ const r = at(a), i = et[a], s = i?.[0], n = i?.[1], d = a === "javascript" || a === "typescript";
2422
+ let c = "", p = 0;
2385
2423
  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;
2424
+ for (; p < g; ) {
2425
+ if (n && e.startsWith(n[0], p)) {
2426
+ const u = e.indexOf(n[1], p + n[0].length), m = u === -1 ? e.slice(p) : e.slice(p, u + n[1].length);
2427
+ c += D(m, "c"), p += m.length;
2390
2428
  continue;
2391
2429
  }
2392
- if (n && e.startsWith(n, d)) {
2430
+ if (s && e.startsWith(s, p)) {
2393
2431
  const u = e.indexOf(`
2394
- `, d), m = u === -1 ? e.slice(d) : e.slice(d, u);
2395
- p += j(m, "c"), d += m.length;
2432
+ `, p), m = u === -1 ? e.slice(p) : e.slice(p, u);
2433
+ c += D(m, "c"), p += m.length;
2396
2434
  continue;
2397
2435
  }
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;
2436
+ const f = e[p];
2437
+ if (f === '"' || f === "'" || f === "`" && d) {
2438
+ const u = me(e, p, f);
2439
+ c += D(e.slice(p, u), "s"), p = u;
2402
2440
  continue;
2403
2441
  }
2404
- if (/\d/.test(f) && (d === 0 || !/[a-zA-Z_$]/.test(e[d - 1]))) {
2405
- let u = d + 1;
2442
+ if (/\d/.test(f) && (p === 0 || !/[a-zA-Z_$]/.test(e[p - 1]))) {
2443
+ let u = p + 1;
2406
2444
  for (; u < g && /[0-9a-fA-FxXoObBeE._]/.test(e[u]); ) u++;
2407
- p += j(e.slice(d, u), "n"), d = u;
2445
+ c += D(e.slice(p, u), "n"), p = u;
2408
2446
  continue;
2409
2447
  }
2410
2448
  if (/[a-zA-Z_$]/.test(f)) {
2411
- let u = d + 1;
2449
+ let u = p + 1;
2412
2450
  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;
2451
+ const m = e.slice(p, u);
2452
+ c += r.has(m) ? `<span class="hl-k">${k(m)}</span>` : k(m), p = u;
2415
2453
  continue;
2416
2454
  }
2417
- if (a === "html" && f === "<" && d + 1 < g && /[a-zA-Z/!]/.test(e[d + 1])) {
2418
- const u = e.indexOf(">", d);
2455
+ if (a === "html" && f === "<" && p + 1 < g && /[a-zA-Z/!]/.test(e[p + 1])) {
2456
+ const u = e.indexOf(">", p);
2419
2457
  if (u !== -1) {
2420
- p += `<span class="hl-k">${k(e.slice(d, u + 1))}</span>`, d = u + 1;
2458
+ c += `<span class="hl-k">${k(e.slice(p, u + 1))}</span>`, p = u + 1;
2421
2459
  continue;
2422
2460
  }
2423
2461
  }
2424
2462
  if (a === "css" && /[a-z-]/.test(f)) {
2425
- let u = d + 1;
2463
+ let u = p + 1;
2426
2464
  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;
2465
+ const m = e.slice(p, u);
2466
+ e.slice(u).trimStart()[0] === ":" ? c += `<span class="hl-k">${k(m)}</span>` : c += k(m), p = u;
2429
2467
  continue;
2430
2468
  }
2431
- p += k(f), d++;
2469
+ c += k(f), p++;
2432
2470
  }
2433
- return p;
2471
+ return c;
2434
2472
  }
2435
- function rt(e) {
2473
+ function st(e) {
2436
2474
  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;
2475
+ const r = e.length;
2476
+ for (; a < r; ) {
2477
+ const i = e[a];
2478
+ if (i === '"') {
2479
+ const n = me(e, a, '"'), d = e.slice(a, n), c = e.slice(n).trimStart();
2480
+ t += D(d, c[0] === ":" ? "k" : "s"), a = n;
2443
2481
  continue;
2444
2482
  }
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;
2483
+ if (/[\d-]/.test(i) && (a === 0 || /[\s,:\[{]/.test(e[a - 1]))) {
2484
+ let n = a + 1;
2485
+ for (; n < r && /[0-9.eE+\-]/.test(e[n]); ) n++;
2486
+ t += D(e.slice(a, n), "n"), a = n;
2449
2487
  continue;
2450
2488
  }
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;
2489
+ let s = !1;
2490
+ for (const n of ["true", "false", "null"])
2491
+ if (e.startsWith(n, a)) {
2492
+ t += `<span class="hl-k">${n}</span>`, a += n.length, s = !0;
2455
2493
  break;
2456
2494
  }
2457
- n || (t += k(r), a++);
2495
+ s || (t += k(i), a++);
2458
2496
  }
2459
2497
  return t;
2460
2498
  }
2461
- let O = class extends w {
2499
+ let O = class extends y {
2462
2500
  constructor() {
2463
2501
  super(...arguments), this.spec = null, this.theme = null, this._copied = !1;
2464
2502
  }
2465
2503
  render() {
2466
- if (!this.spec) return c;
2504
+ if (!this.spec) return l;
2467
2505
  const e = this.spec.data;
2468
- if (!e) return c;
2506
+ if (!e) return l;
2469
2507
  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(`
2508
+ if (!t) return l;
2509
+ 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(
2510
+ Array.isArray(r.highlight) ? r.highlight : []
2511
+ ), g = it(t, a).split(`
2474
2512
  `).map((u, m) => {
2475
- const v = m + 1, $ = l.has(v) ? " line-hl" : "", _ = r ? `<span class="line-no">${v}</span>` : "";
2513
+ const v = m + 1, $ = d.has(v) ? " line-hl" : "", _ = i ? `<span class="line-no">${v}</span>` : "";
2476
2514
  return `<span class="line${$}">${_}${u || " "}</span>`;
2477
- }).join(""), f = s ? `max-height: ${s}` : "";
2515
+ }).join(""), f = n ? `max-height: ${n}` : "";
2478
2516
  return o`
2479
2517
  <div class="code-block" part="code">
2480
2518
  <div class="code-header" part="code-header">
@@ -2487,7 +2525,7 @@ let O = class extends w {
2487
2525
  >${this._copied ? "Copied!" : "Copy"}</button>
2488
2526
  </div>
2489
2527
  <div class="code-body" part="code-body" style=${f}>
2490
- <pre data-wrap=${String(n)}><code .innerHTML=${g}></code></pre>
2528
+ <pre data-wrap=${String(s)}><code .innerHTML=${g}></code></pre>
2491
2529
  </div>
2492
2530
  </div>
2493
2531
  `;
@@ -2505,7 +2543,7 @@ let O = class extends w {
2505
2543
  }
2506
2544
  }
2507
2545
  };
2508
- O.styles = [b, y`
2546
+ O.styles = [b, w`
2509
2547
  :host {
2510
2548
  display: block;
2511
2549
  font-family: system-ui, -apple-system, sans-serif;
@@ -2608,54 +2646,54 @@ O.styles = [b, y`
2608
2646
  .line-no { width: 2.5ch; margin-right: 1ch; }
2609
2647
  }
2610
2648
  `];
2611
- V([
2649
+ G([
2612
2650
  h({ type: Object })
2613
2651
  ], O.prototype, "spec", 2);
2614
- V([
2652
+ G([
2615
2653
  h({ type: String, reflect: !0 })
2616
2654
  ], O.prototype, "theme", 2);
2617
- V([
2655
+ G([
2618
2656
  S()
2619
2657
  ], O.prototype, "_copied", 2);
2620
- O = V([
2658
+ O = G([
2621
2659
  x("u-code")
2622
2660
  ], 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;
2661
+ var nt = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, Q = (e, t, a, r) => {
2662
+ for (var i = r > 1 ? void 0 : r ? ot(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2663
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2664
+ return r && i && nt(t, a, i), i;
2627
2665
  };
2628
- let N = class extends w {
2666
+ let N = class extends y {
2629
2667
  constructor() {
2630
2668
  super(...arguments), this.spec = null, this.theme = null;
2631
2669
  }
2632
2670
  render() {
2633
- if (!this.spec) return c;
2671
+ if (!this.spec) return l;
2634
2672
  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;
2673
+ if (e.length === 0) return l;
2674
+ const t = this.spec.options ?? {}, a = !!(t.compact ?? !1), r = t.numbered !== !1;
2637
2675
  return o`
2638
2676
  <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))}
2677
+ ${e.map((i, s) => this._renderItem(i, s, r))}
2640
2678
  </div>
2641
2679
  `;
2642
2680
  }
2643
2681
  _renderItem(e, t, a) {
2644
- const i = !!e.url, r = e.url ? this._extractDomain(e.url) : void 0;
2682
+ const r = !!e.url, i = e.url ? this._extractDomain(e.url) : void 0;
2645
2683
  return o`
2646
2684
  <div
2647
2685
  class="cite-item"
2648
2686
  part="cite-item"
2649
2687
  role="listitem"
2650
- ?data-link=${i}
2651
- @click=${i ? () => this._handleClick(e) : void 0}
2688
+ ?data-link=${r}
2689
+ @click=${r ? () => this._handleClick(e) : void 0}
2652
2690
  >
2653
- ${a ? o`<span class="cite-num" part="cite-num">${t + 1}</span>` : c}
2691
+ ${a ? o`<span class="cite-num" part="cite-num">${t + 1}</span>` : l}
2654
2692
  <div class="cite-body">
2655
2693
  <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}
2694
+ ${i ? o`<div class="cite-url" part="cite-url">${i}</div>` : l}
2695
+ ${e.snippet ? o`<div class="cite-snippet" part="cite-snippet">${e.snippet}</div>` : l}
2696
+ ${e.source ? o`<div class="cite-source" part="cite-source">${e.source}</div>` : l}
2659
2697
  </div>
2660
2698
  </div>
2661
2699
  `;
@@ -2679,7 +2717,11 @@ let N = class extends w {
2679
2717
  }
2680
2718
  _extractDomain(e) {
2681
2719
  try {
2682
- return new URL(e).hostname;
2720
+ const t = new URL(e).hostname;
2721
+ if (t === "localhost" || /^\d+\.\d+\.\d+\.\d+$/.test(t))
2722
+ return t;
2723
+ const r = t.replace(/^www\./, "").split("."), i = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]);
2724
+ return r.length >= 3 && i.has(r[r.length - 2]) ? r.slice(-3).join(".") : r.slice(-2).join(".");
2683
2725
  } catch {
2684
2726
  return e;
2685
2727
  }
@@ -2708,7 +2750,7 @@ let N = class extends w {
2708
2750
  return [];
2709
2751
  }
2710
2752
  };
2711
- N.styles = [b, y`
2753
+ N.styles = [b, w`
2712
2754
  :host {
2713
2755
  display: block;
2714
2756
  font-family: system-ui, -apple-system, sans-serif;
@@ -2805,21 +2847,21 @@ N.styles = [b, y`
2805
2847
  .cite-snippet { font-size: 0.75rem; }
2806
2848
  }
2807
2849
  `];
2808
- X([
2850
+ Q([
2809
2851
  h({ type: Object })
2810
2852
  ], N.prototype, "spec", 2);
2811
- X([
2853
+ Q([
2812
2854
  h({ type: String, reflect: !0 })
2813
2855
  ], N.prototype, "theme", 2);
2814
- N = X([
2856
+ N = Q([
2815
2857
  x("u-citation")
2816
2858
  ], 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;
2859
+ var lt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, ee = (e, t, a, r) => {
2860
+ for (var i = r > 1 ? void 0 : r ? ct(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2861
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2862
+ return r && i && lt(t, a, i), i;
2821
2863
  };
2822
- const ot = /* @__PURE__ */ new Set(["info", "success", "warning", "error", "neutral"]), lt = {
2864
+ const dt = /* @__PURE__ */ new Set(["info", "success", "warning", "error", "neutral"]), pt = {
2823
2865
  info: "●",
2824
2866
  // ●
2825
2867
  success: "✓",
@@ -2831,18 +2873,18 @@ const ot = /* @__PURE__ */ new Set(["info", "success", "warning", "error", "neut
2831
2873
  neutral: "○"
2832
2874
  // ○
2833
2875
  };
2834
- let T = class extends w {
2876
+ let F = class extends y {
2835
2877
  constructor() {
2836
2878
  super(...arguments), this.spec = null, this.theme = null;
2837
2879
  }
2838
2880
  render() {
2839
- if (!this.spec) return c;
2881
+ if (!this.spec) return l;
2840
2882
  const e = this._extractItems();
2841
- return e.length === 0 ? c : o`
2883
+ return e.length === 0 ? l : o`
2842
2884
  <div class="status-list" part="status" role="list" aria-label=${this.spec.title ?? "Status"}>
2843
2885
  ${e.map((t) => o`
2844
2886
  <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>
2887
+ <span class="status-icon" part="status-icon" aria-hidden="true">${pt[t.level]}</span>
2846
2888
  <span class="status-label" part="status-label">${t.label}</span>
2847
2889
  <span class="status-value" part="status-value">${t.value}</span>
2848
2890
  </div>
@@ -2873,10 +2915,10 @@ let T = class extends w {
2873
2915
  }
2874
2916
  _resolveLevel(e) {
2875
2917
  const t = String(e ?? "info");
2876
- return ot.has(t) ? t : "info";
2918
+ return dt.has(t) ? t : "info";
2877
2919
  }
2878
2920
  };
2879
- T.styles = [b, y`
2921
+ F.styles = [b, w`
2880
2922
  :host {
2881
2923
  display: block;
2882
2924
  font-family: system-ui, -apple-system, sans-serif;
@@ -2941,22 +2983,22 @@ T.styles = [b, y`
2941
2983
  .status-item { font-size: 0.8125rem; }
2942
2984
  }
2943
2985
  `];
2944
- Y([
2986
+ ee([
2945
2987
  h({ type: Object })
2946
- ], T.prototype, "spec", 2);
2947
- Y([
2988
+ ], F.prototype, "spec", 2);
2989
+ ee([
2948
2990
  h({ type: String, reflect: !0 })
2949
- ], T.prototype, "theme", 2);
2950
- T = Y([
2991
+ ], F.prototype, "theme", 2);
2992
+ F = ee([
2951
2993
  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;
2994
+ ], F);
2995
+ var ut = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, te = (e, t, a, r) => {
2996
+ for (var i = r > 1 ? void 0 : r ? gt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
2997
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
2998
+ return r && i && ut(t, a, i), i;
2957
2999
  };
2958
- const pt = /* @__PURE__ */ new Set(["done", "active", "pending", "error"]);
2959
- function ce(e, t) {
3000
+ const ft = /* @__PURE__ */ new Set(["done", "active", "pending", "error"]);
3001
+ function de(e, t) {
2960
3002
  if (t) return o`<span class="step-icon-text">${t}</span>`;
2961
3003
  switch (e) {
2962
3004
  case "done":
@@ -2969,16 +3011,16 @@ function ce(e, t) {
2969
3011
  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
3012
  }
2971
3013
  }
2972
- let F = class extends w {
3014
+ let M = class extends y {
2973
3015
  constructor() {
2974
3016
  super(...arguments), this.spec = null, this.theme = null;
2975
3017
  }
2976
3018
  render() {
2977
- if (!this.spec) return c;
3019
+ if (!this.spec) return l;
2978
3020
  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);
3021
+ if (e.length === 0) return l;
3022
+ const t = this.spec.options ?? {}, a = String(t.layout ?? "vertical"), r = !!(t.compact ?? !1);
3023
+ return a === "horizontal" ? this._renderHorizontal(e, r) : this._renderVertical(e, r);
2982
3024
  }
2983
3025
  _renderVertical(e, t) {
2984
3026
  return o`
@@ -2987,12 +3029,12 @@ let F = class extends w {
2987
3029
  ${e.map((a) => o`
2988
3030
  <div class="step-v" part="step" role="listitem" data-status=${a.status}>
2989
3031
  <div class="step-track">
2990
- <span class="step-icon" part="step-icon" aria-hidden="true">${ce(a.status, a.icon)}</span>
3032
+ <span class="step-icon" part="step-icon" aria-hidden="true">${de(a.status, a.icon)}</span>
2991
3033
  <div class="step-line"></div>
2992
3034
  </div>
2993
3035
  <div class="step-body">
2994
3036
  <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}
3037
+ ${a.description ? o`<div class="step-desc" part="step-desc">${a.description}</div>` : l}
2996
3038
  </div>
2997
3039
  </div>
2998
3040
  `)}
@@ -3003,14 +3045,14 @@ let F = class extends w {
3003
3045
  return o`
3004
3046
  <div class="steps-horizontal" part="steps" ?data-compact=${t}
3005
3047
  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";
3048
+ ${e.map((a, r) => {
3049
+ const i = r > 0 && e[r - 1].status === "done", s = a.status === "done";
3008
3050
  return o`
3009
3051
  <div class="step-h" part="step" role="listitem" data-status=${a.status}>
3010
3052
  <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>
3053
+ <div class="step-h-line" ?data-done=${i}></div>
3054
+ <span class="step-icon" part="step-icon" aria-hidden="true">${de(a.status, a.icon)}</span>
3055
+ <div class="step-h-line" ?data-done=${s}></div>
3014
3056
  </div>
3015
3057
  <div class="step-label" part="step-label">${a.label}</div>
3016
3058
  </div>
@@ -3032,10 +3074,10 @@ let F = class extends w {
3032
3074
  }
3033
3075
  _resolveStatus(e) {
3034
3076
  const t = String(e ?? "pending");
3035
- return pt.has(t) ? t : "pending";
3077
+ return ft.has(t) ? t : "pending";
3036
3078
  }
3037
3079
  };
3038
- F.styles = [b, y`
3080
+ M.styles = [b, w`
3039
3081
  :host {
3040
3082
  display: block;
3041
3083
  font-family: system-ui, -apple-system, sans-serif;
@@ -3267,21 +3309,21 @@ F.styles = [b, y`
3267
3309
  }
3268
3310
  }
3269
3311
  `];
3270
- ee([
3312
+ te([
3271
3313
  h({ type: Object })
3272
- ], F.prototype, "spec", 2);
3273
- ee([
3314
+ ], M.prototype, "spec", 2);
3315
+ te([
3274
3316
  h({ type: String, reflect: !0 })
3275
- ], F.prototype, "theme", 2);
3276
- F = ee([
3317
+ ], M.prototype, "theme", 2);
3318
+ M = te([
3277
3319
  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;
3320
+ ], M);
3321
+ var ht = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, X = (e, t, a, r) => {
3322
+ for (var i = r > 1 ? void 0 : r ? mt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3323
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3324
+ return r && i && ht(t, a, i), i;
3283
3325
  };
3284
- const ft = {
3326
+ const vt = {
3285
3327
  star: ["☆", "★", "★"],
3286
3328
  // ☆, ★, ★
3287
3329
  heart: ["♡", "♥", "♥"],
@@ -3289,44 +3331,44 @@ const ft = {
3289
3331
  thumb: ["👍", "👍", "👍"]
3290
3332
  // 👍
3291
3333
  };
3292
- let P = class extends w {
3334
+ let P = class extends y {
3293
3335
  constructor() {
3294
3336
  super(...arguments), this.spec = null, this.theme = null, this._hoverIdx = -1;
3295
3337
  }
3296
3338
  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;
3339
+ if (!this.spec) return l;
3340
+ 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
3341
  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}
3342
+ <div class="rating" part="rating" role=${i ? "radiogroup" : "img"}
3343
+ aria-label=${this.spec.title ?? n ?? `Rating: ${a} out of ${r}`}>
3344
+ ${n ? o`<span class="rating-label" part="rating-label">${n}</span>` : l}
3303
3345
  <div class="rating-icons" part="rating-icons"
3304
- @mouseleave=${r ? () => {
3346
+ @mouseleave=${i ? () => {
3305
3347
  this._hoverIdx = -1;
3306
3348
  } : void 0}>
3307
- ${Array.from({ length: i }, (g, f) => this._renderIcon(f, d, p, n, r))}
3349
+ ${Array.from({ length: r }, (g, f) => this._renderIcon(f, p, c, s, i))}
3308
3350
  </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}
3351
+ ${!i && a > 0 ? o`<span class="rating-value" part="rating-value">${a}</span>` : l}
3352
+ ${d != null ? o`<span class="rating-count" part="rating-count">(${d})</span>` : l}
3311
3353
  </div>
3312
3354
  `;
3313
3355
  }
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`
3356
+ _renderIcon(e, t, a, r, i) {
3357
+ const s = e + 1, n = i && this._hoverIdx >= 0 && s <= this._hoverIdx + 1;
3358
+ let d;
3359
+ 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";
3360
+ const c = d === "half" ? a[0] : d === "full" ? a[2] : a[0];
3361
+ return d === "half" ? o`
3320
3362
  <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 ? () => {
3363
+ data-state="half" data-icon=${r}
3364
+ ?data-interactive=${i}
3365
+ ?data-preview=${n}
3366
+ role=${i ? "radio" : "presentation"}
3367
+ aria-label=${i ? `${s}` : l}
3368
+ @mouseenter=${i ? () => {
3327
3369
  this._hoverIdx = e;
3328
3370
  } : void 0}
3329
- @click=${r ? () => this._select(n) : void 0}>
3371
+ @click=${i ? () => this._select(s) : void 0}>
3330
3372
  <span aria-hidden="true">${a[0]}</span>
3331
3373
  <span class="half-overlay" aria-hidden="true">
3332
3374
  <span style="color: inherit">${a[2]}</span>
@@ -3334,17 +3376,17 @@ let P = class extends w {
3334
3376
  </span>
3335
3377
  ` : o`
3336
3378
  <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 ? () => {
3379
+ data-state=${d} data-icon=${r}
3380
+ ?data-interactive=${i}
3381
+ ?data-preview=${n}
3382
+ role=${i ? "radio" : "presentation"}
3383
+ aria-label=${i ? `${s}` : l}
3384
+ aria-checked=${i ? String(d === "full" && !n) : l}
3385
+ @mouseenter=${i ? () => {
3344
3386
  this._hoverIdx = e;
3345
3387
  } : void 0}
3346
- @click=${r ? () => this._select(n) : void 0}>
3347
- <span aria-hidden="true">${p}</span>
3388
+ @click=${i ? () => this._select(s) : void 0}>
3389
+ <span aria-hidden="true">${c}</span>
3348
3390
  </span>
3349
3391
  `;
3350
3392
  }
@@ -3367,7 +3409,7 @@ let P = class extends w {
3367
3409
  return t === "heart" || t === "thumb" ? t : "star";
3368
3410
  }
3369
3411
  };
3370
- P.styles = [b, y`
3412
+ P.styles = [b, w`
3371
3413
  :host {
3372
3414
  display: block;
3373
3415
  font-family: system-ui, -apple-system, sans-serif;
@@ -3473,49 +3515,49 @@ P.styles = [b, y`
3473
3515
  .rating-value { font-size: 0.8125rem; }
3474
3516
  }
3475
3517
  `];
3476
- G([
3518
+ X([
3477
3519
  h({ type: Object })
3478
3520
  ], P.prototype, "spec", 2);
3479
- G([
3521
+ X([
3480
3522
  h({ type: String, reflect: !0 })
3481
3523
  ], P.prototype, "theme", 2);
3482
- G([
3524
+ X([
3483
3525
  S()
3484
3526
  ], P.prototype, "_hoverIdx", 2);
3485
- P = G([
3527
+ P = X([
3486
3528
  x("u-rating")
3487
3529
  ], 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;
3530
+ var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, re = (e, t, a, r) => {
3531
+ for (var i = r > 1 ? void 0 : r ? wt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3532
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3533
+ return r && i && bt(t, a, i), i;
3492
3534
  };
3493
- let M = class extends w {
3535
+ let T = class extends y {
3494
3536
  constructor() {
3495
3537
  super(...arguments), this.spec = null, this.theme = null;
3496
3538
  }
3497
3539
  render() {
3498
- if (!this.spec) return c;
3540
+ if (!this.spec) return l;
3499
3541
  const e = this.spec.data;
3500
- if (!e) return c;
3542
+ if (!e) return l;
3501
3543
  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;
3544
+ if (!a) return l;
3545
+ 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
3546
  return o`
3505
3547
  <div class="video-container" part="video">
3506
3548
  <video
3507
3549
  src=${a}
3508
- poster=${i ?? c}
3509
- aria-label=${r || c}
3510
- ?controls=${l}
3511
- ?autoplay=${p}
3512
- ?loop=${d}
3550
+ poster=${r ?? l}
3551
+ aria-label=${i || l}
3552
+ ?controls=${d}
3553
+ ?autoplay=${c}
3554
+ ?loop=${p}
3513
3555
  ?muted=${g}
3514
3556
  playsinline
3515
3557
  preload="metadata"
3516
3558
  part="video-element"
3517
3559
  ></video>
3518
- ${n ? o`<div class="video-caption" part="caption">${n}</div>` : c}
3560
+ ${s ? o`<div class="video-caption" part="caption">${s}</div>` : l}
3519
3561
  </div>
3520
3562
  `;
3521
3563
  }
@@ -3524,7 +3566,7 @@ let M = class extends w {
3524
3566
  return /^(javascript|data|vbscript):/i.test(t) ? "" : e;
3525
3567
  }
3526
3568
  };
3527
- M.styles = [b, y`
3569
+ T.styles = [b, w`
3528
3570
  :host {
3529
3571
  display: block;
3530
3572
  font-family: system-ui, -apple-system, sans-serif;
@@ -3558,53 +3600,53 @@ M.styles = [b, y`
3558
3600
  }
3559
3601
  }
3560
3602
  `];
3561
- te([
3603
+ re([
3562
3604
  h({ type: Object })
3563
- ], M.prototype, "spec", 2);
3564
- te([
3605
+ ], T.prototype, "spec", 2);
3606
+ re([
3565
3607
  h({ type: String, reflect: !0 })
3566
- ], M.prototype, "theme", 2);
3567
- M = te([
3608
+ ], T.prototype, "theme", 2);
3609
+ T = re([
3568
3610
  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;
3611
+ ], T);
3612
+ var yt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, ae = (e, t, a, r) => {
3613
+ for (var i = r > 1 ? void 0 : r ? xt(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3614
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3615
+ return r && i && yt(t, a, i), i;
3574
3616
  };
3575
- let U = class extends w {
3617
+ let U = class extends y {
3576
3618
  constructor() {
3577
3619
  super(...arguments), this.spec = null, this.theme = null;
3578
3620
  }
3579
3621
  render() {
3580
- if (!this.spec) return c;
3622
+ if (!this.spec) return l;
3581
3623
  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;
3624
+ if (!Array.isArray(e)) return l;
3625
+ const t = e.filter((c) => c && typeof c.src == "string" && c.src).map((c) => ({
3626
+ src: this._sanitizeUrl(String(c.src)),
3627
+ alt: c.alt ? String(c.alt) : void 0,
3628
+ caption: c.caption ? String(c.caption) : void 0
3629
+ })).filter((c) => c.src);
3630
+ if (t.length === 0) return l;
3631
+ 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
3632
  return o`
3591
3633
  <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))}
3634
+ aria-label=${d ?? "Gallery"}
3635
+ style="grid-template-columns: ${s}">
3636
+ ${t.map((c) => this._renderItem(c, n))}
3595
3637
  </div>
3596
3638
  `;
3597
3639
  }
3598
3640
  _renderItem(e, t) {
3599
3641
  return o`
3600
- <figure class="gallery-item" part="gallery-item" role="listitem" style=${t || c}>
3642
+ <figure class="gallery-item" part="gallery-item" role="listitem" style=${t || l}>
3601
3643
  <img
3602
3644
  src=${e.src}
3603
3645
  alt=${e.alt ?? ""}
3604
3646
  loading="lazy"
3605
3647
  part="gallery-image"
3606
3648
  />
3607
- ${e.caption ? o`<figcaption class="gallery-caption" part="gallery-caption">${e.caption}</figcaption>` : c}
3649
+ ${e.caption ? o`<figcaption class="gallery-caption" part="gallery-caption">${e.caption}</figcaption>` : l}
3608
3650
  </figure>
3609
3651
  `;
3610
3652
  }
@@ -3613,7 +3655,7 @@ let U = class extends w {
3613
3655
  return /^(javascript|data|vbscript):/i.test(t) ? "" : e;
3614
3656
  }
3615
3657
  };
3616
- U.styles = [b, y`
3658
+ U.styles = [b, w`
3617
3659
  :host {
3618
3660
  display: block;
3619
3661
  font-family: system-ui, -apple-system, sans-serif;
@@ -3651,21 +3693,21 @@ U.styles = [b, y`
3651
3693
  }
3652
3694
  }
3653
3695
  `];
3654
- re([
3696
+ ae([
3655
3697
  h({ type: Object })
3656
3698
  ], U.prototype, "spec", 2);
3657
- re([
3699
+ ae([
3658
3700
  h({ type: String, reflect: !0 })
3659
3701
  ], U.prototype, "theme", 2);
3660
- U = re([
3702
+ U = ae([
3661
3703
  x("u-gallery")
3662
3704
  ], 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;
3705
+ var $t = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, J = (e, t, a, r) => {
3706
+ for (var i = r > 1 ? void 0 : r ? _t(t, a) : t, s = e.length - 1, n; s >= 0; s--)
3707
+ (n = e[s]) && (i = (r ? n(t, a, i) : n(i)) || i);
3708
+ return r && i && $t(t, a, i), i;
3667
3709
  };
3668
- let E = class extends w {
3710
+ let E = class extends y {
3669
3711
  constructor() {
3670
3712
  super(...arguments), this.spec = null, this.theme = null, this.locale = null, this._handleInternalEvent = (e) => {
3671
3713
  e.stopPropagation(), this.dispatchEvent(
@@ -3686,134 +3728,135 @@ let E = class extends w {
3686
3728
  render() {
3687
3729
  if (!this.spec)
3688
3730
  return o`<slot></slot>`;
3689
- const e = Q(this.spec);
3731
+ const e = Y(this.spec);
3690
3732
  if (!e.valid)
3691
3733
  return this.renderError(e.errors);
3692
- const t = be(this.spec);
3734
+ const t = we(this.spec);
3693
3735
  return this.renderWidget(t);
3694
3736
  }
3695
3737
  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 }
3738
+ const t = e.widget, a = e.mapping ?? be(t, e.data);
3739
+ let r = a ? { ...e, mapping: a } : e;
3740
+ const i = Ie(this.locale);
3741
+ i && !r.options?.locale && (r = {
3742
+ ...r,
3743
+ options: { ...r.options, locale: i }
3701
3744
  });
3702
- const r = this.theme, s = t === "form" || t === "confirm" || t === "actions" ? [] : i.actions ?? [];
3703
- let l;
3745
+ const s = this.theme, d = t === "form" || t === "confirm" || t === "actions" ? [] : r.actions ?? [];
3746
+ let c;
3704
3747
  switch (t) {
3705
3748
  case "metric":
3706
3749
  case "stat-group":
3707
- l = o`<u-metric .spec=${i} theme=${r ?? c}></u-metric>`;
3750
+ c = o`<u-metric .spec=${r} theme=${s ?? l}></u-metric>`;
3708
3751
  break;
3709
3752
  case "gauge":
3710
3753
  case "progress":
3711
- l = o`<u-gauge .spec=${i} theme=${r ?? c}></u-gauge>`;
3754
+ c = o`<u-gauge .spec=${r} theme=${s ?? l}></u-gauge>`;
3712
3755
  break;
3713
3756
  case "table":
3714
3757
  case "list":
3715
- l = o`<u-table .spec=${i} theme=${r ?? c}></u-table>`;
3758
+ c = o`<u-table .spec=${r} theme=${s ?? l}></u-table>`;
3716
3759
  break;
3717
3760
  case "form":
3718
3761
  case "confirm":
3719
- l = o`<u-form .spec=${i} theme=${r ?? c}></u-form>`;
3762
+ c = o`<u-form .spec=${r} theme=${s ?? l}></u-form>`;
3720
3763
  break;
3721
3764
  case "compose":
3722
- l = o`<u-compose .spec=${i} theme=${r ?? c}></u-compose>`;
3765
+ c = o`<u-compose .spec=${r} theme=${s ?? l}></u-compose>`;
3723
3766
  break;
3724
3767
  case "markdown":
3725
3768
  case "image":
3726
3769
  case "callout":
3727
- l = o`<u-content .spec=${i} theme=${r ?? c}></u-content>`;
3770
+ c = o`<u-content .spec=${r} theme=${s ?? l}></u-content>`;
3728
3771
  break;
3729
3772
  case "kv":
3730
- l = o`<u-kv .spec=${i} theme=${r ?? c}></u-kv>`;
3773
+ c = o`<u-kv .spec=${r} theme=${s ?? l}></u-kv>`;
3731
3774
  break;
3732
3775
  case "code":
3733
- l = o`<u-code .spec=${i} theme=${r ?? c}></u-code>`;
3776
+ c = o`<u-code .spec=${r} theme=${s ?? l}></u-code>`;
3734
3777
  break;
3735
3778
  case "citation":
3736
- l = o`<u-citation .spec=${i} theme=${r ?? c}></u-citation>`;
3779
+ c = o`<u-citation .spec=${r} theme=${s ?? l}></u-citation>`;
3737
3780
  break;
3738
3781
  case "status":
3739
- l = o`<u-status .spec=${i} theme=${r ?? c}></u-status>`;
3782
+ c = o`<u-status .spec=${r} theme=${s ?? l}></u-status>`;
3740
3783
  break;
3741
3784
  case "steps":
3742
- l = o`<u-steps .spec=${i} theme=${r ?? c}></u-steps>`;
3785
+ c = o`<u-steps .spec=${r} theme=${s ?? l}></u-steps>`;
3743
3786
  break;
3744
3787
  case "rating":
3745
- l = o`<u-rating .spec=${i} theme=${r ?? c}></u-rating>`;
3788
+ c = o`<u-rating .spec=${r} theme=${s ?? l}></u-rating>`;
3746
3789
  break;
3747
3790
  case "video":
3748
- l = o`<u-video .spec=${i} theme=${r ?? c}></u-video>`;
3791
+ c = o`<u-video .spec=${r} theme=${s ?? l}></u-video>`;
3749
3792
  break;
3750
3793
  case "gallery":
3751
- l = o`<u-gallery .spec=${i} theme=${r ?? c}></u-gallery>`;
3794
+ c = o`<u-gallery .spec=${r} theme=${s ?? l}></u-gallery>`;
3752
3795
  break;
3753
3796
  case "actions":
3754
- l = this.renderActionsWidget(i);
3797
+ c = this.renderActionsWidget(r);
3755
3798
  break;
3756
3799
  case "divider":
3757
- l = this.renderDivider(i);
3800
+ c = this.renderDivider(r);
3758
3801
  break;
3759
3802
  case "header":
3760
- l = this.renderHeader(i);
3803
+ c = this.renderHeader(r);
3761
3804
  break;
3762
3805
  default:
3763
3806
  if (t.startsWith("chart.") && customElements.get("u-chart")) {
3764
- l = o`<u-chart .spec=${i} theme=${r ?? c}></u-chart>`;
3807
+ c = o`<u-chart .spec=${r} theme=${s ?? l}></u-chart>`;
3765
3808
  break;
3766
3809
  }
3767
- return this.renderFallback(i);
3810
+ return this.renderFallback(r);
3768
3811
  }
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`
3812
+ if (!!r.options?.card && (c = o`<div class="card-container" part="card">${c}</div>`), d.length > 0) {
3813
+ const g = d.map((f) => o`
3771
3814
  <button
3772
- data-style=${g.style ?? "default"}
3773
- ?disabled=${g.disabled}
3774
- @click=${() => this._dispatchAction(i, g)}
3815
+ data-style=${f.style ?? "default"}
3816
+ ?disabled=${f.disabled}
3817
+ @click=${() => this._dispatchAction(r, f)}
3775
3818
  part="action-btn"
3776
- >${g.label}</button>
3819
+ >${f.label}</button>
3777
3820
  `);
3778
- return o`<div part="widget-container">${l}<div class="global-actions" part="actions">${d}</div></div>`;
3821
+ return o`<div part="widget-container">${c}<div class="global-actions" part="actions">${g}</div></div>`;
3779
3822
  }
3780
- return l;
3823
+ return c;
3781
3824
  }
3782
3825
  /** Render standalone "actions" widget — a group of action buttons. */
3783
3826
  renderActionsWidget(e) {
3784
3827
  const t = e.actions ?? [];
3785
- if (t.length === 0) return c;
3786
- const a = e.options ?? {}, i = String(a.layout ?? "wrap");
3828
+ if (t.length === 0) return l;
3829
+ const a = e.options ?? {}, r = String(a.layout ?? "wrap");
3787
3830
  return o`
3788
- <div class="actions-widget" data-layout=${i} part="actions" role="group" aria-label=${e.title ?? "Actions"}>
3789
- ${t.map((r) => o`
3831
+ <div class="actions-widget" data-layout=${r} part="actions" role="group" aria-label=${e.title ?? "Actions"}>
3832
+ ${t.map((i) => o`
3790
3833
  <button
3791
- data-style=${r.style ?? "default"}
3792
- ?disabled=${r.disabled}
3793
- @click=${() => this._dispatchAction(e, r)}
3834
+ data-style=${i.style ?? "default"}
3835
+ ?disabled=${i.disabled}
3836
+ @click=${() => this._dispatchAction(e, i)}
3794
3837
  part="action-btn"
3795
- >${r.label}</button>
3838
+ >${i.label}</button>
3796
3839
  `)}
3797
3840
  </div>
3798
3841
  `;
3799
3842
  }
3800
3843
  /** Render inline divider widget. */
3801
3844
  renderDivider(e) {
3802
- const t = e.options ?? {}, a = t.label, i = String(t.spacing ?? "default");
3845
+ const t = e.options ?? {}, a = t.label, r = String(t.spacing ?? "default");
3803
3846
  return o`
3804
- <div class="divider divider-spacing-${i}" part="divider" role="separator">
3805
- ${a ?? c}
3847
+ <div class="divider divider-spacing-${r}" part="divider" role="separator">
3848
+ ${a ?? l}
3806
3849
  </div>
3807
3850
  `;
3808
3851
  }
3809
3852
  /** Render inline header widget. */
3810
3853
  renderHeader(e) {
3811
- const t = e.data, a = String(t?.text ?? e.title ?? ""), i = String(t?.level ?? "2");
3854
+ const t = e.data, a = String(t?.text ?? e.title ?? ""), r = String(t?.level ?? "2");
3812
3855
  return a ? o`
3813
- <div class="header-widget" data-level=${i} part="header" role="heading" aria-level=${i}>
3856
+ <div class="header-widget" data-level=${r} part="header" role="heading" aria-level=${r}>
3814
3857
  ${a}
3815
3858
  </div>
3816
- ` : c;
3859
+ ` : l;
3817
3860
  }
3818
3861
  /** Dispatch an action event from the global action bar or actions widget. */
3819
3862
  _dispatchAction(e, t) {
@@ -3836,7 +3879,7 @@ let E = class extends w {
3836
3879
  );
3837
3880
  }
3838
3881
  renderFallback(e) {
3839
- const t = Oe(e.widget);
3882
+ const t = Ee(e.widget);
3840
3883
  return o`
3841
3884
  <div class="fallback-card" part="fallback">
3842
3885
  <div class="fallback-label">${e.title ?? `Unknown widget: ${e.widget}`}</div>
@@ -3861,7 +3904,7 @@ let E = class extends w {
3861
3904
  };
3862
3905
  E.styles = [
3863
3906
  b,
3864
- y`
3907
+ w`
3865
3908
  :host {
3866
3909
  display: block;
3867
3910
  container: u-widget / inline-size;
@@ -4057,17 +4100,20 @@ E = J([
4057
4100
  export {
4058
4101
  E as UWidget,
4059
4102
  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
4103
+ ze as formatValue,
4104
+ Ot as getDefaultLocale,
4105
+ Et as getEffectiveLocale,
4106
+ ve as getFormdownParser,
4107
+ pe as getLocaleStrings,
4108
+ be as infer,
4109
+ Dt as isWidgetSpec,
4110
+ we as normalize,
4111
+ Nt as parseFormdown,
4112
+ Ft as registerFormdownParser,
4113
+ jt as registerLocale,
4114
+ Ie as resolveLocale,
4115
+ Pt as setDefaultLocale,
4116
+ Ee as suggestWidget,
4117
+ Y as validate
4072
4118
  };
4073
4119
  //# sourceMappingURL=u-widgets.js.map