aktion-runtime 0.5.1 → 0.5.2

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/aktion.js CHANGED
@@ -237,7 +237,7 @@ function Ua(t) {
237
237
  const f = a, h = i;
238
238
  l();
239
239
  let b = "";
240
- for (; r < t.length && yt(n() ?? ""); )
240
+ for (; r < t.length && vt(n() ?? ""); )
241
241
  b += l();
242
242
  s("BuiltinIdentifier", b, f, h);
243
243
  continue;
@@ -251,7 +251,7 @@ function Ua(t) {
251
251
  throw v.line = f, v.column = h, v;
252
252
  }
253
253
  let b = "";
254
- for (; r < t.length && yt(n() ?? ""); )
254
+ for (; r < t.length && vt(n() ?? ""); )
255
255
  b += l();
256
256
  s("StateIdentifier", b, f, h);
257
257
  continue;
@@ -259,7 +259,7 @@ function Ua(t) {
259
259
  if (Hr(c)) {
260
260
  const f = a, h = i;
261
261
  let b = "";
262
- for (; r < t.length && yt(n() ?? ""); )
262
+ for (; r < t.length && vt(n() ?? ""); )
263
263
  b += l();
264
264
  if (b === "js") {
265
265
  let y = 0;
@@ -359,7 +359,7 @@ function Ue(t) {
359
359
  function Hr(t) {
360
360
  return t >= "a" && t <= "z" || t >= "A" && t <= "Z" || t === "_";
361
361
  }
362
- function yt(t) {
362
+ function vt(t) {
363
363
  return Hr(t) || Ue(t);
364
364
  }
365
365
  function ge(t) {
@@ -819,18 +819,18 @@ function Yt(t) {
819
819
  return e;
820
820
  }
821
821
  function Jt(t) {
822
- let e = Lt(t);
822
+ let e = Rt(t);
823
823
  for (; t.peek().type === "Operator" && (t.peek().value === "*" || t.peek().value === "/" || t.peek().value === "%"); ) {
824
- const r = t.consume().value, a = Lt(t);
824
+ const r = t.consume().value, a = Rt(t);
825
825
  e = { kind: "Binary", operator: r, left: e, right: a };
826
826
  }
827
827
  return e;
828
828
  }
829
- function Lt(t) {
829
+ function Rt(t) {
830
830
  const e = t.peek();
831
831
  if (e.type === "Operator" && (e.value === "!" || e.value === "-")) {
832
832
  t.consume();
833
- const r = Lt(t);
833
+ const r = Rt(t);
834
834
  return { kind: "Unary", operator: e.value, argument: r };
835
835
  }
836
836
  return ai(t);
@@ -1357,14 +1357,14 @@ function pi(t, e) {
1357
1357
  ` };
1358
1358
  }
1359
1359
  case "delete": {
1360
- const a = xt(r, e.binding);
1360
+ const a = yt(r, e.binding);
1361
1361
  return a < 0 ? {
1362
1362
  programText: t,
1363
1363
  warning: `delta(delete): binding "${e.binding}" not found — op skipped`
1364
- } : { programText: wt(t, r, a, null) };
1364
+ } : { programText: xt(t, r, a, null) };
1365
1365
  }
1366
1366
  case "replace": {
1367
- const a = xt(r, e.binding);
1367
+ const a = yt(r, e.binding);
1368
1368
  return a < 0 ? {
1369
1369
  programText: t,
1370
1370
  warning: `delta(replace): binding "${e.binding}" not found — op skipped`
@@ -1372,11 +1372,11 @@ function pi(t, e) {
1372
1372
  programText: t,
1373
1373
  warning: `delta(replace): could not parse new source for "${e.binding}" — op skipped`
1374
1374
  } : {
1375
- programText: wt(t, r, a, `${e.binding} = ${e.source.trim()}`)
1375
+ programText: xt(t, r, a, `${e.binding} = ${e.source.trim()}`)
1376
1376
  };
1377
1377
  }
1378
1378
  case "append": {
1379
- const a = xt(r, e.binding);
1379
+ const a = yt(r, e.binding);
1380
1380
  if (a < 0)
1381
1381
  return {
1382
1382
  programText: t,
@@ -1395,11 +1395,11 @@ function pi(t, e) {
1395
1395
  warning: `delta(append): could not parse item "${er(e.item)}" — op skipped`
1396
1396
  };
1397
1397
  const l = i.expression.elements, c = `${e.binding} = [${[...l.map(ne), e.item.trim()].join(", ")}]`;
1398
- return { programText: wt(t, r, a, c) };
1398
+ return { programText: xt(t, r, a, c) };
1399
1399
  }
1400
1400
  }
1401
1401
  }
1402
- function xt(t, e) {
1402
+ function yt(t, e) {
1403
1403
  return t.statements.findIndex((r) => mi(r) === e);
1404
1404
  }
1405
1405
  function mi(t) {
@@ -1414,7 +1414,7 @@ function mi(t) {
1414
1414
  return null;
1415
1415
  }
1416
1416
  }
1417
- function wt(t, e, r, a) {
1417
+ function xt(t, e, r, a) {
1418
1418
  const i = t.split(`
1419
1419
  `), n = e.statements[r], s = e.statements[r + 1], l = (n.loc?.line ?? 1) - 1, c = s ? (s.loc?.line ?? i.length + 1) - 1 : i.length, u = i.slice(0, l), p = i.slice(c);
1420
1420
  return a === null ? [...u, ...p].join(`
@@ -2545,7 +2545,7 @@ const fe = (t, e) => {
2545
2545
  return e.setTime(e.getTime() + t * 864e5), e.toUTCString();
2546
2546
  }
2547
2547
  return null;
2548
- }, kt = (t = {}) => {
2548
+ }, wt = (t = {}) => {
2549
2549
  const e = [], r = Vi(t.expires);
2550
2550
  if (r && e.push(`expires=${r}`), typeof t.maxAge == "number" && Number.isFinite(t.maxAge) && e.push(`max-age=${Math.floor(t.maxAge)}`), e.push(`path=${t.path ?? "/"}`), t.domain && e.push(`domain=${t.domain}`), t.secure && e.push("secure"), t.sameSite) {
2551
2551
  const a = t.sameSite.charAt(0).toUpperCase() + t.sameSite.slice(1).toLowerCase();
@@ -2574,7 +2574,7 @@ const fe = (t, e) => {
2574
2574
  const a = Qe();
2575
2575
  if (!a) return !1;
2576
2576
  const i = encodeURIComponent(String(t)), n = encodeURIComponent(ea(e));
2577
- return a.cookie = `${i}=${n}${kt(r)}`, !0;
2577
+ return a.cookie = `${i}=${n}${wt(r)}`, !0;
2578
2578
  }, !1),
2579
2579
  get: (t) => fe(() => {
2580
2580
  const r = or()[String(t)];
@@ -2588,7 +2588,7 @@ const fe = (t, e) => {
2588
2588
  expires: /* @__PURE__ */ new Date(0),
2589
2589
  maxAge: 0
2590
2590
  };
2591
- return r.cookie = `${a}=${kt(i)}`, !0;
2591
+ return r.cookie = `${a}=${wt(i)}`, !0;
2592
2592
  }, !1),
2593
2593
  clear: () => fe(() => {
2594
2594
  const t = Qe();
@@ -2596,7 +2596,7 @@ const fe = (t, e) => {
2596
2596
  const e = or();
2597
2597
  for (const r of Object.keys(e)) {
2598
2598
  const a = encodeURIComponent(r);
2599
- t.cookie = `${a}=${kt({ expires: /* @__PURE__ */ new Date(0), maxAge: 0 })}`;
2599
+ t.cookie = `${a}=${wt({ expires: /* @__PURE__ */ new Date(0), maxAge: 0 })}`;
2600
2600
  }
2601
2601
  return !0;
2602
2602
  }, !1)
@@ -2661,7 +2661,7 @@ function Ie(t, e) {
2661
2661
  function tn(t, e) {
2662
2662
  for (const r of t.statements)
2663
2663
  if (r.kind === "Assignment" && r.isState) {
2664
- const a = rt(r.expression);
2664
+ const a = Et(r.expression);
2665
2665
  e.state.declare(r.identifier, a);
2666
2666
  }
2667
2667
  for (const r of t.statements) {
@@ -2684,9 +2684,9 @@ function tn(t, e) {
2684
2684
  }
2685
2685
  }
2686
2686
  for (const r of t.statements)
2687
- Et(r, e);
2687
+ Lt(r, e);
2688
2688
  }
2689
- function Et(t, e) {
2689
+ function Lt(t, e) {
2690
2690
  switch (t.kind) {
2691
2691
  case "ComponentDeclaration":
2692
2692
  e.componentDecls.set(t.name, t);
@@ -2744,20 +2744,20 @@ function ur(t, e, r, a) {
2744
2744
  n ? a.loopVars.set("params", i) : a.loopVars.delete("params");
2745
2745
  }
2746
2746
  }
2747
- function rt(t) {
2747
+ function Et(t) {
2748
2748
  switch (t.kind) {
2749
2749
  case "Literal":
2750
2750
  return t.value;
2751
2751
  case "Array": {
2752
2752
  const e = [];
2753
2753
  for (const r of t.elements)
2754
- r.kind !== "Spread" && e.push(rt(r));
2754
+ r.kind !== "Spread" && e.push(Et(r));
2755
2755
  return e;
2756
2756
  }
2757
2757
  case "Object": {
2758
2758
  const e = {};
2759
2759
  for (const r of t.properties)
2760
- r.spread || (e[r.key] = rt(r.value));
2760
+ r.spread || (e[r.key] = Et(r.value));
2761
2761
  return e;
2762
2762
  }
2763
2763
  case "Template":
@@ -2851,7 +2851,7 @@ function M(t, e) {
2851
2851
  case "For":
2852
2852
  return on(t, e);
2853
2853
  case "Block":
2854
- return Pe(t, e);
2854
+ return Pe(t, e, {});
2855
2855
  case "Lambda": {
2856
2856
  const r = t.params, a = t.body, i = e.stateAliases.map(
2857
2857
  (s) => new Map(s)
@@ -2909,7 +2909,7 @@ function M(t, e) {
2909
2909
  }
2910
2910
  }
2911
2911
  function an(t, e) {
2912
- return M(t.test, e) ? Pe(t.consequent, e) : t.alternate ? t.alternate.kind === "Block" ? Pe(t.alternate, e) : M(t.alternate, e) : null;
2912
+ return M(t.test, e) ? Pe(t.consequent, e, {}) : t.alternate ? t.alternate.kind === "Block" ? Pe(t.alternate, e, {}) : M(t.alternate, e) : null;
2913
2913
  }
2914
2914
  function nn(t, e) {
2915
2915
  const r = M(t.discriminant, e);
@@ -2934,7 +2934,7 @@ function on(t, e) {
2934
2934
  const h = g && typeof g == "object" ? g[f] : void 0;
2935
2935
  e.loopVars.set(f, h);
2936
2936
  }
2937
- a.push(Pe(t.body, e));
2937
+ a.push(Pe(t.body, e, {}));
2938
2938
  }
2939
2939
  } finally {
2940
2940
  i ? e.loopVars.set(t.item, n) : e.loopVars.delete(t.item), s && (l ? e.loopVars.set(s, c) : e.loopVars.delete(s));
@@ -2943,47 +2943,60 @@ function on(t, e) {
2943
2943
  }
2944
2944
  return a;
2945
2945
  }
2946
- function Pe(t, e) {
2947
- let r = null;
2948
- const a = [];
2949
- for (const i of t.body)
2950
- switch (i.kind) {
2946
+ function Pe(t, e, r) {
2947
+ let a = null;
2948
+ const i = [];
2949
+ for (const n of t.body)
2950
+ switch (n.kind) {
2951
2951
  case "ExpressionStatement":
2952
- r = M(i.expression, e);
2952
+ a = M(n.expression, e);
2953
2953
  continue;
2954
2954
  case "Assignment": {
2955
- const n = M(i.expression, e);
2956
- if (i.isState && i.identifier) {
2957
- const s = Ie(e, i.identifier);
2958
- e.state.set(s, n);
2959
- } else
2960
- e.loopVars.has(i.identifier) || a.push(i.identifier), e.loopVars.set(i.identifier, n);
2961
- r = n;
2955
+ if (n.isState && n.identifier) {
2956
+ const l = Ie(e, n.identifier);
2957
+ if (r.stateAsDeclaration) {
2958
+ if (e.state.has(l)) {
2959
+ a = e.state.get(l);
2960
+ continue;
2961
+ }
2962
+ const u = M(n.expression, e);
2963
+ e.state.declare(l, u), a = u;
2964
+ continue;
2965
+ }
2966
+ const c = M(n.expression, e);
2967
+ e.state.set(l, c), a = c;
2968
+ continue;
2969
+ }
2970
+ const s = M(n.expression, e);
2971
+ e.loopVars.has(n.identifier) || i.push(n.identifier), e.loopVars.set(n.identifier, s), a = s;
2962
2972
  continue;
2963
2973
  }
2964
2974
  case "Return":
2965
- return r = i.argument ? M(i.argument, e) : void 0, r;
2975
+ return a = n.argument ? M(n.argument, e) : void 0, a;
2966
2976
  case "EffectDeclaration": {
2967
- const n = e.componentEffectStack[e.componentEffectStack.length - 1];
2968
- n ? n.push(i) : Et(i, e);
2977
+ const s = e.componentEffectStack[e.componentEffectStack.length - 1];
2978
+ s ? s.push({
2979
+ decl: n,
2980
+ capturedAliases: e.stateAliases.map((l) => new Map(l))
2981
+ }) : Lt(n, e);
2969
2982
  continue;
2970
2983
  }
2971
2984
  case "ComponentDeclaration":
2972
2985
  case "ActionDeclaration":
2973
- Et(i, e);
2986
+ Lt(n, e);
2974
2987
  continue;
2975
2988
  case "Emit":
2976
2989
  case "Cleanup":
2977
2990
  case "Await":
2978
2991
  continue;
2979
2992
  }
2980
- for (const i of a) e.loopVars.delete(i);
2981
- return r;
2993
+ for (const n of i) e.loopVars.delete(n);
2994
+ return a;
2982
2995
  }
2983
2996
  function sn(t, e, r) {
2984
2997
  let a = t[0] ?? "";
2985
2998
  for (let i = 0; i < e.length; i += 1)
2986
- a += at(M(e[i], r)), a += t[i + 1] ?? "";
2999
+ a += rt(M(e[i], r)), a += t[i + 1] ?? "";
2987
3000
  return a;
2988
3001
  }
2989
3002
  function ln(t, e, r, a) {
@@ -3002,7 +3015,7 @@ function ln(t, e, r, a) {
3002
3015
  const i = M(e, a), n = M(r, a);
3003
3016
  switch (t) {
3004
3017
  case "+":
3005
- return typeof i == "string" || typeof n == "string" ? at(i) + at(n) : O(i) + O(n);
3018
+ return typeof i == "string" || typeof n == "string" ? rt(i) + rt(n) : O(i) + O(n);
3006
3019
  case "-":
3007
3020
  return O(i) - O(n);
3008
3021
  case "*":
@@ -3270,13 +3283,13 @@ function mn(t, e, r) {
3270
3283
  for (const u of a.body.body)
3271
3284
  if (u.kind === "Assignment" && u.isState) {
3272
3285
  const p = `${r}:${u.identifier}`;
3273
- l.set(u.identifier, p), e.state.declare(p, rt(u.expression));
3286
+ l.set(u.identifier, p);
3274
3287
  }
3275
3288
  e.stateAliases.push(l);
3276
3289
  const c = [];
3277
3290
  e.componentEffectStack.push(c);
3278
3291
  try {
3279
- return { value: Pe(a.body, e), effects: c };
3292
+ return { value: Pe(a.body, e, { stateAsDeclaration: !0 }), effects: c };
3280
3293
  } finally {
3281
3294
  e.componentEffectStack.pop(), e.stateAliases.pop();
3282
3295
  for (const u of s)
@@ -3311,7 +3324,7 @@ function ia(t, e, r) {
3311
3324
  }), r.loopVars.set(n.name, e[i]);
3312
3325
  }
3313
3326
  try {
3314
- return Pe(t.body, r);
3327
+ return Pe(t.body, r, {});
3315
3328
  } finally {
3316
3329
  for (const i of a)
3317
3330
  i.had ? r.loopVars.set(i.name, i.prev) : r.loopVars.delete(i.name);
@@ -3352,7 +3365,7 @@ function gn(t, e, r) {
3352
3365
  if (t === "Switch") {
3353
3366
  const n = e[0], s = e[1], l = e[2];
3354
3367
  if (!n || !s) return null;
3355
- const c = M(n, r), u = at(c);
3368
+ const c = M(n, r), u = rt(c);
3356
3369
  if (s.kind === "Object") {
3357
3370
  for (const p of s.properties)
3358
3371
  if (!p.spread && p.key === u)
@@ -3558,7 +3571,7 @@ function $n(t) {
3558
3571
  function Nn(t) {
3559
3572
  return typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
3560
3573
  }
3561
- function at(t) {
3574
+ function rt(t) {
3562
3575
  if (t == null) return "";
3563
3576
  if (typeof t == "string") return t;
3564
3577
  if (typeof t == "number" || typeof t == "boolean") return String(t);
@@ -3625,7 +3638,7 @@ function An(t, e) {
3625
3638
  return i == null ? "" : String(i);
3626
3639
  }) : t;
3627
3640
  }
3628
- const St = "::";
3641
+ const kt = "::";
3629
3642
  class Mn {
3630
3643
  constructor(e) {
3631
3644
  _(this, "mounted", /* @__PURE__ */ new Map());
@@ -3649,9 +3662,9 @@ class Mn {
3649
3662
  this.errors = [];
3650
3663
  const a = new Set(e.map((i) => i.name));
3651
3664
  for (const i of [...this.mounted.keys()])
3652
- i.includes(St) || a.has(i) || this.unmount(i);
3665
+ i.includes(kt) || a.has(i) || this.unmount(i);
3653
3666
  for (const i of e)
3654
- this.mounted.has(i.name) || this.mount(i.name, i, r);
3667
+ this.mounted.has(i.name) || this.mount(i.name, i, r, []);
3655
3668
  }
3656
3669
  /**
3657
3670
  * Mount per-instance effects discovered inside a `component { … }` body.
@@ -3660,12 +3673,12 @@ class Mn {
3660
3673
  * torn down. Effects belonging to other instances are untouched.
3661
3674
  */
3662
3675
  syncInstanceEffects(e, r, a) {
3663
- const i = `${e}${St}`, n = new Set(r.map((s) => `${i}${s.name}`));
3676
+ const i = `${e}${kt}`, n = new Set(r.map((s) => `${i}${s.decl.name}`));
3664
3677
  for (const s of [...this.mounted.keys()])
3665
3678
  s.startsWith(i) && (n.has(s) || this.unmount(s));
3666
3679
  for (const s of r) {
3667
- const l = `${i}${s.name}`;
3668
- this.mounted.has(l) || this.mount(l, s, a);
3680
+ const l = `${i}${s.decl.name}`;
3681
+ this.mounted.has(l) || this.mount(l, s.decl, a, s.capturedAliases);
3669
3682
  }
3670
3683
  }
3671
3684
  /**
@@ -3676,7 +3689,7 @@ class Mn {
3676
3689
  * component the user can see.
3677
3690
  */
3678
3691
  unmountInstance(e) {
3679
- const r = `${e}${St}`;
3692
+ const r = `${e}${kt}`;
3680
3693
  for (const a of [...this.mounted.keys()])
3681
3694
  a.startsWith(r) && this.unmount(a);
3682
3695
  }
@@ -3685,51 +3698,52 @@ class Mn {
3685
3698
  this.unmount(e);
3686
3699
  this.errors = [];
3687
3700
  }
3688
- mount(e, r, a) {
3689
- const i = {
3701
+ mount(e, r, a, i) {
3702
+ const n = {
3690
3703
  decl: r,
3691
3704
  cleanups: [],
3692
3705
  intervals: [],
3693
3706
  unsubscribers: [],
3694
- ctxRef: a
3707
+ ctxRef: a,
3708
+ capturedAliases: i
3695
3709
  };
3696
- this.mounted.set(e, i);
3697
- const s = Pn(() => {
3698
- for (const p of i.cleanups.splice(0))
3710
+ this.mounted.set(e, n);
3711
+ const l = Pn(() => {
3712
+ for (const m of n.cleanups.splice(0))
3699
3713
  try {
3700
- p();
3701
- } catch (m) {
3702
- hr(e, m);
3714
+ m();
3715
+ } catch (g) {
3716
+ hr(e, g);
3703
3717
  }
3704
3718
  try {
3705
- fr(r, a(), i, this.options);
3706
- } catch (p) {
3707
- console.error(`[aktion] effect "${e}" failed`, p);
3719
+ fr(r, a(), n, this.options);
3720
+ } catch (m) {
3721
+ console.error(`[aktion] effect "${e}" failed`, m);
3708
3722
  } finally {
3709
3723
  this.options.notify();
3710
3724
  }
3711
- }, r.rateLimit, i);
3712
- let l = !1, c = !1, u = !1;
3713
- for (const p of r.triggers)
3714
- switch (p.kind) {
3725
+ }, r.rateLimit, n);
3726
+ let c = !1, u = !1, p = !1;
3727
+ for (const m of r.triggers)
3728
+ switch (m.kind) {
3715
3729
  case "lifecycle":
3716
- p.name === "mount" && (l = !0), p.name === "unmount" && (c = !0);
3730
+ m.name === "mount" && (c = !0), m.name === "unmount" && (u = !0);
3717
3731
  break;
3718
3732
  case "every": {
3719
- u = !0;
3720
- const m = setInterval(s, p.intervalMs);
3721
- i.intervals.push(m);
3733
+ p = !0;
3734
+ const g = setInterval(l, m.intervalMs);
3735
+ n.intervals.push(g);
3722
3736
  break;
3723
3737
  }
3724
3738
  case "state": {
3725
- const m = p.name, g = this.options.state.subscribe((f) => {
3726
- f.has(m) && s();
3739
+ const g = m.name, f = this.options.state.subscribe((h) => {
3740
+ h.has(g) && l();
3727
3741
  });
3728
- i.unsubscribers.push(g);
3742
+ n.unsubscribers.push(f);
3729
3743
  break;
3730
3744
  }
3731
3745
  }
3732
- (r.triggers.length === 0 || l || !u && !c && r.triggers.every((p) => p.kind === "state")) && s();
3746
+ (r.triggers.length === 0 || c || !p && !u && r.triggers.every((m) => m.kind === "state")) && l();
3733
3747
  }
3734
3748
  unmount(e) {
3735
3749
  const r = this.mounted.get(e);
@@ -3781,8 +3795,21 @@ function Pn(t, e, r) {
3781
3795
  };
3782
3796
  }
3783
3797
  function fr(t, e, r, a) {
3784
- for (const i of t.body.body)
3785
- In(i, e, r, a);
3798
+ const i = r.capturedAliases.length > 0 ? e.stateAliases.slice() : null;
3799
+ if (i) {
3800
+ e.stateAliases.length = 0;
3801
+ for (const n of r.capturedAliases)
3802
+ e.stateAliases.push(new Map(n));
3803
+ }
3804
+ try {
3805
+ for (const n of t.body.body)
3806
+ In(n, e, r, a);
3807
+ } finally {
3808
+ if (i) {
3809
+ e.stateAliases.length = 0;
3810
+ for (const n of i) e.stateAliases.push(n);
3811
+ }
3812
+ }
3786
3813
  }
3787
3814
  function In(t, e, r, a) {
3788
3815
  switch (t.kind) {
@@ -4019,7 +4046,7 @@ function Q(t, e) {
4019
4046
  return !r || r.length > 64 || !Wn.test(r) ? e : r;
4020
4047
  }
4021
4048
  const Gn = /* @__PURE__ */ new Set(["http", "https", "mailto", "tel"]);
4022
- function ut(t, e = "#") {
4049
+ function ct(t, e = "#") {
4023
4050
  const r = d(t).trim();
4024
4051
  if (!r) return e;
4025
4052
  const a = r.replace(/[\u0000-\u001F\u007F]/g, "");
@@ -4411,16 +4438,16 @@ const mo = {
4411
4438
  for (const i of k(e.items)) a.append(r.renderNode(i));
4412
4439
  return a;
4413
4440
  }
4414
- }, it = (t) => Math.max(1, Math.min(We, Math.round(t)));
4415
- function Ct(t) {
4441
+ }, at = (t) => Math.max(1, Math.min(We, Math.round(t)));
4442
+ function St(t) {
4416
4443
  if (t == null || t === "") return 12;
4417
4444
  const e = String(t).trim();
4418
4445
  if (e.includes("/")) {
4419
4446
  const [r, a] = e.split("/"), i = Number(r), n = Number(a);
4420
4447
  if (Number.isFinite(i) && Number.isFinite(n) && n > 0)
4421
- return it(Math.round(We * i / n));
4448
+ return at(Math.round(We * i / n));
4422
4449
  }
4423
- return e === "auto" || e === "fit" || e === "auto-fit" || e === "full" || e === "100%" ? 12 : it(P(t, 12));
4450
+ return e === "auto" || e === "fit" || e === "auto-fit" || e === "full" || e === "100%" ? 12 : at(P(t, 12));
4424
4451
  }
4425
4452
  function fo(t) {
4426
4453
  const e = d(t.minChildWidth) || d(t.minItemWidth);
@@ -4436,7 +4463,7 @@ const ho = {
4436
4463
  { name: "spanAt", type: "object", optional: !0, description: "Responsive span map `{sm: 12, md: 6, lg: 4}`" }
4437
4464
  ],
4438
4465
  render: (t, e, r) => {
4439
- const a = Ct(e.span ?? 12), i = ce(e.spanAt), n = e.offset === void 0 || e.offset === null ? 0 : Math.max(0, Math.min(We - 1, Math.round(P(e.offset, 0)))), s = {
4466
+ const a = St(e.span ?? 12), i = ce(e.spanAt), n = e.offset === void 0 || e.offset === null ? 0 : Math.max(0, Math.min(We - 1, Math.round(P(e.offset, 0)))), s = {
4440
4467
  class: "rui-grid-item",
4441
4468
  "data-span": String(a)
4442
4469
  }, l = [`--rui-grid-item-span:${a}`];
@@ -4445,12 +4472,12 @@ const ho = {
4445
4472
  for (const u of ze) {
4446
4473
  const p = i.values[u];
4447
4474
  if (p !== void 0) {
4448
- const m = Ct(p);
4475
+ const m = St(p);
4449
4476
  l.push(`--rui-grid-item-span-${u}:${m}`);
4450
4477
  }
4451
4478
  }
4452
4479
  } else if (i.kind === "single" && i.value != null) {
4453
- const u = Ct(i.value);
4480
+ const u = St(i.value);
4454
4481
  l.push(`--rui-grid-item-span:${u}`), s["data-span"] = String(u);
4455
4482
  }
4456
4483
  s.style = l.join(";");
@@ -4510,7 +4537,7 @@ const ho = {
4510
4537
  }, p = [];
4511
4538
  let m = !1, g = !1;
4512
4539
  if (n.kind === "single") {
4513
- const v = n.value === null ? 0 : P(n.value, 0), y = v > 0 ? it(v) : 0;
4540
+ const v = n.value === null ? 0 : P(n.value, 0), y = v > 0 ? at(v) : 0;
4514
4541
  if (y === We ? m = !0 : y > 0 && (g = !0), y > 0) {
4515
4542
  u["data-columns"] = String(y);
4516
4543
  const x = d(e.minChildWidth) || d(e.minItemWidth);
@@ -4522,7 +4549,7 @@ const ho = {
4522
4549
  for (const v of ze) {
4523
4550
  const y = n.values[v];
4524
4551
  if (y === void 0) continue;
4525
- const x = it(P(y, 0));
4552
+ const x = at(P(y, 0));
4526
4553
  x === We ? m = !0 : x > 0 && (g = !0), p.push(`--rui-grid-cols-${v}:${x}`);
4527
4554
  }
4528
4555
  }
@@ -4626,10 +4653,10 @@ const xo = {
4626
4653
  g.target === n && u();
4627
4654
  }), n;
4628
4655
  }
4629
- }, So = ["solid", "regular", "brands"], dt = ["xs", "sm", "md", "lg", "xl"], Co = ["default", "neutral", "primary", "success", "warning", "danger", "info"];
4656
+ }, So = ["solid", "regular", "brands"], ut = ["xs", "sm", "md", "lg", "xl"], Co = ["default", "neutral", "primary", "success", "warning", "danger", "info"];
4630
4657
  function Ft(t, e = "md") {
4631
4658
  const r = d(t).trim().toLowerCase();
4632
- return r ? r === "small" ? "sm" : r === "normal" ? "md" : r === "large" ? "lg" : dt.includes(r) ? r : e : e;
4659
+ return r ? r === "small" ? "sm" : r === "normal" ? "md" : r === "large" ? "lg" : ut.includes(r) ? r : e : e;
4633
4660
  }
4634
4661
  const $o = {
4635
4662
  name: "Icon",
@@ -4742,7 +4769,7 @@ const Ro = {
4742
4769
  { name: "external", type: "boolean", optional: !0 }
4743
4770
  ],
4744
4771
  render: (t, e) => {
4745
- const r = C(e.external), a = ut(e.href, "#");
4772
+ const r = C(e.external), a = ct(e.href, "#");
4746
4773
  return o("a", {
4747
4774
  class: "rui-link",
4748
4775
  href: a,
@@ -4759,7 +4786,7 @@ const Ro = {
4759
4786
  { name: "label", type: "string", positional: !0 },
4760
4787
  { name: "tone", type: "string", optional: !0, enum: la, aliases: ["variant"], description: "Visual tone" },
4761
4788
  { name: "icon", type: "string", optional: !0, description: 'Optional Font Awesome icon name (e.g. "star")' },
4762
- { name: "size", type: "string", optional: !0, enum: dt }
4789
+ { name: "size", type: "string", optional: !0, enum: ut }
4763
4790
  ],
4764
4791
  render: (t, e) => {
4765
4792
  const r = d(e.tone, "neutral"), a = Ft(e.size, "md"), i = o("span", {
@@ -4777,7 +4804,7 @@ const Ro = {
4777
4804
  props: [
4778
4805
  { name: "labels", type: "string[]", positional: !0, description: "Array of badge labels" },
4779
4806
  { name: "tone", type: "string", optional: !0, enum: la, aliases: ["variant"] },
4780
- { name: "size", type: "string", optional: !0, enum: dt }
4807
+ { name: "size", type: "string", optional: !0, enum: ut }
4781
4808
  ],
4782
4809
  render: (t, e) => {
4783
4810
  const r = d(e.tone, "neutral"), a = Ft(e.size, "md"), i = o("div", { class: "rui-badge-list" });
@@ -5006,7 +5033,7 @@ const Wo = {
5006
5033
  name: "Spinner",
5007
5034
  description: "Indeterminate inline loader. Use for tiny loading states inside buttons, toolbars, table cells, or chat bubbles where `Skeleton` and `Progress(indeterminate=true)` are too heavy. Pass `label` to render an inline caption beside the spinner (also announced via `aria-label`).",
5008
5035
  props: [
5009
- { name: "size", type: "string", optional: !0, enum: dt, description: "Default `md`" },
5036
+ { name: "size", type: "string", optional: !0, enum: ut, description: "Default `md`" },
5010
5037
  { name: "label", type: "string", optional: !0, description: "Caption rendered beside the spinner (also announced)" },
5011
5038
  { name: "tone", type: "string", optional: !0, enum: Co, description: "Visual accent (default `primary`)" }
5012
5039
  ],
@@ -5904,7 +5931,7 @@ const os = {
5904
5931
  }), oe = o("span", { class: "rui-multiselect-option-check" }), ue = R(F ? "check" : "", { className: "rui-multiselect-option-check-icon" });
5905
5932
  ue && oe.append(ue), J.append(oe), J.append(o("span", { class: "rui-multiselect-option-label" }, [j.label])), J.onclick = (Le) => {
5906
5933
  if (Le.stopPropagation(), Y) return;
5907
- const be = F ? u.filter((ht) => ht !== j.value) : [...u, j.value];
5934
+ const be = F ? u.filter((ft) => ft !== j.value) : [...u, j.value];
5908
5935
  w(be);
5909
5936
  }, I.append(J);
5910
5937
  }
@@ -7088,14 +7115,14 @@ function hl(t, e) {
7088
7115
  return d(t);
7089
7116
  }
7090
7117
  }
7091
- const $t = [
7118
+ const Ct = [
7092
7119
  "var(--rui-chart-1, #6366f1)",
7093
7120
  "var(--rui-chart-2, #10b981)",
7094
7121
  "var(--rui-chart-3, #f59e0b)",
7095
7122
  "var(--rui-chart-4, #ef4444)",
7096
7123
  "var(--rui-chart-5, #06b6d4)",
7097
7124
  "var(--rui-chart-6, #8b5cf6)"
7098
- ], Me = (t) => $t[t % $t.length] ?? $t[0], bl = {
7125
+ ], Me = (t) => Ct[t % Ct.length] ?? Ct[0], bl = {
7099
7126
  name: "Series",
7100
7127
  description: "Named data series for charts. Used inside BarChart, LineChart, PieChart.",
7101
7128
  props: [
@@ -7646,7 +7673,7 @@ const _l = {
7646
7673
  for (const n of k(e.content)) i.append(r.renderNode(n));
7647
7674
  return a.append(i), a;
7648
7675
  }
7649
- }, Nt = {
7676
+ }, $t = {
7650
7677
  star: { full: "star", half: "star-half-stroke", empty: "regular:star" },
7651
7678
  heart: { full: "heart", half: "heart", empty: "regular:heart" },
7652
7679
  thumb: { full: "thumbs-up", half: "thumbs-up", empty: "regular:thumbs-up" },
@@ -7705,7 +7732,7 @@ const _l = {
7705
7732
  };
7706
7733
  function Dl(t) {
7707
7734
  const e = t.trim().toLowerCase();
7708
- return e ? Nt[e] ? Nt[e] : { full: e, half: e, empty: `regular:${e}` } : Nt.star;
7735
+ return e ? $t[e] ? $t[e] : { full: e, half: e, empty: `regular:${e}` } : $t.star;
7709
7736
  }
7710
7737
  const Fl = {
7711
7738
  name: "ProgressRing",
@@ -7956,7 +7983,7 @@ const wa = {
7956
7983
  { name: "icon", type: "string", optional: !0, description: "Optional Font Awesome icon name" }
7957
7984
  ],
7958
7985
  render: (t, e) => {
7959
- const r = o("li", { class: "rui-breadcrumb-item" }), a = d(e.label), i = d(e.href), n = i ? ut(i) : "", s = [], l = R(e.icon, { className: "rui-breadcrumb-icon" });
7986
+ const r = o("li", { class: "rui-breadcrumb-item" }), a = d(e.label), i = d(e.href), n = i ? ct(i) : "", s = [], l = R(e.icon, { className: "rui-breadcrumb-icon" });
7960
7987
  if (l && s.push(l), s.push(o("span", { class: "rui-breadcrumb-label" }, [a])), n)
7961
7988
  r.append(o("a", { class: "rui-breadcrumb-link", href: n }, s));
7962
7989
  else {
@@ -8078,7 +8105,7 @@ const ec = {
8078
8105
  { name: "external", type: "boolean", optional: !0 }
8079
8106
  ],
8080
8107
  render: (t, e, r) => {
8081
- const a = d(e.label), i = e.icon, n = C(e.active), s = d(e.to), l = ut(e.href, ""), c = C(e.external), u = s || l ? "a" : "button", p = o(u, {
8108
+ const a = d(e.label), i = e.icon, n = C(e.active), s = d(e.to), l = ct(e.href, ""), c = C(e.external), u = s || l ? "a" : "button", p = o(u, {
8082
8109
  class: "rui-navbar-item",
8083
8110
  type: u === "button" ? "button" : null,
8084
8111
  href: l || (s ? `#${s.startsWith("/") ? s : `/${s}`}` : null),
@@ -8140,7 +8167,7 @@ const ec = {
8140
8167
  e.set(!1), t.setAttribute("data-open", "false"), t.querySelector(".rui-dropdown-menu-trigger")?.setAttribute("aria-expanded", "false");
8141
8168
  }
8142
8169
  });
8143
- }, Tt = (t, e) => {
8170
+ }, Nt = (t, e) => {
8144
8171
  if (!t || typeof t != "object") return !1;
8145
8172
  const r = t;
8146
8173
  return r.__kind === "Component" && r.name === e;
@@ -8188,7 +8215,7 @@ const ec = {
8188
8215
  "aria-label": d(e.label) || null
8189
8216
  });
8190
8217
  for (const u of k(e.items)) {
8191
- if (Tt(u, "MenuItem")) {
8218
+ if (Nt(u, "MenuItem")) {
8192
8219
  const p = u.args ?? [], m = d(p[0]), g = p[1], f = p[2], h = d(p[3]), b = d(p[4], "default"), v = C(p[5]), y = o("button", {
8193
8220
  type: "button",
8194
8221
  class: "rui-menu-item",
@@ -8202,11 +8229,11 @@ const ec = {
8202
8229
  }), c.append(y);
8203
8230
  continue;
8204
8231
  }
8205
- if (Tt(u, "MenuSeparator")) {
8232
+ if (Nt(u, "MenuSeparator")) {
8206
8233
  c.append(o("div", { class: "rui-menu-separator", role: "separator" }));
8207
8234
  continue;
8208
8235
  }
8209
- if (Tt(u, "MenuLabel")) {
8236
+ if (Nt(u, "MenuLabel")) {
8210
8237
  const p = d((u.args ?? [])[0]);
8211
8238
  c.append(o("div", { class: "rui-menu-label" }, [p]));
8212
8239
  continue;
@@ -8420,7 +8447,7 @@ const dc = {
8420
8447
  J.append(ue);
8421
8448
  const be = o("tbody");
8422
8449
  J.append(be);
8423
- const ht = (L) => {
8450
+ const ft = (L) => {
8424
8451
  if (be.replaceChildren(), L.length === 0) {
8425
8452
  const q = o("tr"), H = (g ? 1 : 0) + Math.max(a.length, 1);
8426
8453
  q.append(o("td", {
@@ -8486,20 +8513,20 @@ const dc = {
8486
8513
  for (const K of ee) {
8487
8514
  const re = s(K), se = m.has(re), Ee = o("tr", { "data-selected": se ? "true" : null });
8488
8515
  if (g) {
8489
- const ve = o("td", { class: "rui-data-grid-cell-select" }), bt = o("input", {
8516
+ const ve = o("td", { class: "rui-data-grid-cell-select" }), ht = o("input", {
8490
8517
  type: "checkbox",
8491
8518
  class: "rui-data-grid-checkbox",
8492
8519
  checked: se ? "" : null
8493
8520
  });
8494
- ve.append(bt), Ee.append(ve);
8521
+ ve.append(ht), Ee.append(ve);
8495
8522
  }
8496
- a.forEach((ve, bt) => {
8497
- const _e = ve.values[K], vt = o("td", {
8523
+ a.forEach((ve, ht) => {
8524
+ const _e = ve.values[K], bt = o("td", {
8498
8525
  "data-format": ve.format,
8499
8526
  "data-align": ve.align || null,
8500
- "data-first": bt === 0 ? "true" : null
8527
+ "data-first": ht === 0 ? "true" : null
8501
8528
  });
8502
- _e !== null && typeof _e == "object" && _e.__kind === "Component" ? vt.append(r.renderNode(_e)) : vt.textContent = Xe(_e, ve.format), Ee.append(vt);
8529
+ _e !== null && typeof _e == "object" && _e.__kind === "Component" ? bt.append(r.renderNode(_e)) : bt.textContent = Xe(_e, ve.format), Ee.append(bt);
8503
8530
  }), G.append(Ee);
8504
8531
  }
8505
8532
  if (ee.length === 0) {
@@ -8511,7 +8538,7 @@ const dc = {
8511
8538
  }
8512
8539
  })(q);
8513
8540
  };
8514
- if (ht(I), Y.append(J), z.append(Y), $ > S) {
8541
+ if (ft(I), Y.append(J), z.append(Y), $ > S) {
8515
8542
  const L = o("div", { class: "rui-data-grid-footer" }), q = $ === 0 ? 0 : (A - 1) * S + 1, H = Math.min($, A * S);
8516
8543
  L.append(o("span", { class: "rui-data-grid-footer-summary" }, [
8517
8544
  $ === 0 ? "No results" : `Showing ${q}–${H} of ${$}`
@@ -8764,7 +8791,7 @@ const hc = {
8764
8791
  return a;
8765
8792
  }
8766
8793
  }, yc = /^(https?:|blob:|data:(audio|video)\/)/i;
8767
- function nt(t) {
8794
+ function it(t) {
8768
8795
  const e = d(t).trim();
8769
8796
  return e ? e.startsWith("/") || e.startsWith(".") ? e : e.startsWith("//") ? "" : yc.test(e) ? e : "" : "";
8770
8797
  }
@@ -8799,11 +8826,11 @@ const xc = {
8799
8826
  if (l.length > 0)
8800
8827
  for (const u of l) {
8801
8828
  if (!u || typeof u != "object") continue;
8802
- const p = u, m = nt(p.src);
8829
+ const p = u, m = it(p.src);
8803
8830
  m && s.append(o("source", { src: m, type: d(p.type) || null }));
8804
8831
  }
8805
8832
  else {
8806
- const u = nt(e.src);
8833
+ const u = it(e.src);
8807
8834
  u && s.setAttribute("src", u);
8808
8835
  }
8809
8836
  i.append(s), r.append(i);
@@ -8840,11 +8867,11 @@ const xc = {
8840
8867
  if (p.length > 0)
8841
8868
  for (const m of p) {
8842
8869
  if (!m || typeof m != "object") continue;
8843
- const g = m, f = nt(g.src);
8870
+ const g = m, f = it(g.src);
8844
8871
  f && u.append(o("source", { src: f, type: d(g.type) || null }));
8845
8872
  }
8846
8873
  else {
8847
- const m = nt(e.src);
8874
+ const m = it(e.src);
8848
8875
  m && u.setAttribute("src", m);
8849
8876
  }
8850
8877
  return r.append(u), r;
@@ -9431,21 +9458,21 @@ const Ec = {
9431
9458
  b && (u.value = b, u.dispatchEvent(new Event("input", { bubbles: !0 })));
9432
9459
  }), c.append(u, p), s.append(c, m), s;
9433
9460
  }
9434
- }, At = [
9461
+ }, Tt = [
9435
9462
  "var(--rui-chart-1, #6366f1)",
9436
9463
  "var(--rui-chart-2, #10b981)",
9437
9464
  "var(--rui-chart-3, #f59e0b)",
9438
9465
  "var(--rui-chart-4, #ef4444)",
9439
9466
  "var(--rui-chart-5, #06b6d4)",
9440
9467
  "var(--rui-chart-6, #8b5cf6)"
9441
- ], Se = (t) => At[t % At.length] ?? At[0];
9468
+ ], Se = (t) => Tt[t % Tt.length] ?? Tt[0];
9442
9469
  function _c(t) {
9443
9470
  return t.map((e, r) => {
9444
9471
  const a = e, i = d(a.args?.[0], `Series ${r + 1}`), n = k(a.args?.[1]).map((s) => P(s));
9445
9472
  return { name: i, values: n };
9446
9473
  });
9447
9474
  }
9448
- function pt(t, e) {
9475
+ function dt(t, e) {
9449
9476
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
9450
9477
  return r.setAttribute("viewBox", `0 0 ${t} ${e}`), r.setAttribute("class", "rui-chart-svg"), r.setAttribute("role", "img"), r;
9451
9478
  }
@@ -9481,7 +9508,7 @@ const jc = {
9481
9508
  class: "rui-gauge",
9482
9509
  "data-tone": s,
9483
9510
  "data-size": l
9484
- }), f = pt(c, u + p + 4), h = u, b = u, v = h - m, y = b, x = h + m, w = b;
9511
+ }), f = dt(c, u + p + 4), h = u, b = u, v = h - m, y = b, x = h + m, w = b;
9485
9512
  if (f.append(ie("path", {
9486
9513
  d: `M${v},${y} A${m},${m} 0 0 1 ${x},${w}`,
9487
9514
  fill: "none",
@@ -9550,7 +9577,7 @@ const Dc = {
9550
9577
  render: (t, e) => {
9551
9578
  const r = k(e.axes).map((f) => d(f)), a = _c(k(e.series)), i = Math.max(r.length, 3), n = o("div", { class: "rui-chart rui-radar-chart" });
9552
9579
  d(e.title) && n.append(o("div", { class: "rui-chart-title" }, [d(e.title)]));
9553
- const s = Math.max(1, P(e.max, a.flatMap((f) => f.values).reduce((f, h) => Math.max(f, h), 1))), l = 280, c = l / 2, u = l / 2, p = l / 2 - 24, m = pt(l, l), g = 4;
9580
+ const s = Math.max(1, P(e.max, a.flatMap((f) => f.values).reduce((f, h) => Math.max(f, h), 1))), l = 280, c = l / 2, u = l / 2, p = l / 2 - 24, m = dt(l, l), g = 4;
9554
9581
  for (let f = 1; f <= g; f += 1) {
9555
9582
  const h = p / g * f, b = [];
9556
9583
  for (let v = 0; v < i; v += 1) {
@@ -9631,7 +9658,7 @@ const Oc = {
9631
9658
  const i = 640, n = 280, s = { left: 50, right: 16, top: 16, bottom: 40 }, l = i - s.left - s.right, c = n - s.top - s.bottom, u = r.flatMap(($) => $.points);
9632
9659
  if (u.length === 0)
9633
9660
  return a.append(o("div", { class: "rui-chart-empty" }, ["No points"])), a;
9634
- const p = u.map(($) => $.x), m = u.map(($) => $.y), g = Math.min(...p), f = Math.max(...p), h = Math.min(...m), b = Math.max(...m), v = f - g || 1, y = b - h || 1, x = pt(i, n);
9661
+ const p = u.map(($) => $.x), m = u.map(($) => $.y), g = Math.min(...p), f = Math.max(...p), h = Math.min(...m), b = Math.max(...m), v = f - g || 1, y = b - h || 1, x = dt(i, n);
9635
9662
  if (Ca(x, s, l, c, b, h), x.append(ie("line", {
9636
9663
  x1: String(s.left),
9637
9664
  y1: String(s.top + c),
@@ -9707,7 +9734,7 @@ const Oc = {
9707
9734
  const a = o("div", { class: "rui-chart rui-histogram" });
9708
9735
  if (d(e.title) && a.append(o("div", { class: "rui-chart-title" }, [d(e.title)])), r.length === 0)
9709
9736
  return a.append(o("div", { class: "rui-chart-empty" }, ["No data"])), a;
9710
- const i = 640, n = 240, s = { left: 40, right: 12, top: 16, bottom: 50 }, l = i - s.left - s.right, c = n - s.top - s.bottom, u = Math.max(1, ...r.map((g) => g.count)), p = l / r.length, m = pt(i, n);
9737
+ const i = 640, n = 240, s = { left: 40, right: 12, top: 16, bottom: 50 }, l = i - s.left - s.right, c = n - s.top - s.bottom, u = Math.max(1, ...r.map((g) => g.count)), p = l / r.length, m = dt(i, n);
9711
9738
  return Ca(m, s, l, c, u), r.forEach((g, f) => {
9712
9739
  const h = s.left + f * p + p * 0.1, b = p * 0.8, v = g.count / u * c, y = s.top + c - v, x = ie("rect", {
9713
9740
  x: h.toFixed(1),
@@ -10675,7 +10702,7 @@ function $u(t) {
10675
10702
  return { value: r, label: r };
10676
10703
  }).filter((e) => e.label !== "");
10677
10704
  }
10678
- function mt(t) {
10705
+ function pt(t) {
10679
10706
  return k(t).filter(
10680
10707
  (e) => !!e && typeof e == "object" && !Array.isArray(e)
10681
10708
  );
@@ -10707,7 +10734,7 @@ function Na(t) {
10707
10734
  }).filter((e) => e.name !== "");
10708
10735
  }
10709
10736
  function Tu(t) {
10710
- return mt(t).map((e, r) => ({
10737
+ return pt(t).map((e, r) => ({
10711
10738
  id: d(e.id, `task-${r}`),
10712
10739
  label: d(e.label ?? e.name, `Task ${r + 1}`),
10713
10740
  start: d(e.start),
@@ -10882,7 +10909,7 @@ const Mu = {
10882
10909
  { name: "addLabel", type: "string", optional: !0 }
10883
10910
  ],
10884
10911
  render: (t, e, r) => {
10885
- const a = mt(e.items), i = Na(e.fields), n = o("div", { class: "rui-field-repeater" });
10912
+ const a = pt(e.items), i = Na(e.fields), n = o("div", { class: "rui-field-repeater" });
10886
10913
  if (a.forEach((s, l) => {
10887
10914
  const c = o("div", { class: "rui-field-repeater-row", "data-index": String(l) }), u = o("div", { class: "rui-field-repeater-grid" });
10888
10915
  for (const p of i) {
@@ -10957,7 +10984,7 @@ const Mu = {
10957
10984
  { name: "onChange", type: "callable", optional: !0, description: "Receives the next rule array" }
10958
10985
  ],
10959
10986
  render: (t, e, r) => {
10960
- const a = Na(e.fields), i = mt(e.value), n = t.argMeta?.[1]?.stateRef, s = o("div", { class: "rui-query-builder" }), l = (c) => {
10987
+ const a = Na(e.fields), i = pt(e.value), n = t.argMeta?.[1]?.stateRef, s = o("div", { class: "rui-query-builder" }), l = (c) => {
10961
10988
  s.replaceChildren(), c.forEach((p, m) => {
10962
10989
  const g = o("div", { class: "rui-query-builder-row", "data-index": String(m) }), f = o("select", { class: "rui-select rui-query-builder-field" });
10963
10990
  for (const y of a)
@@ -11115,7 +11142,7 @@ const Mu = {
11115
11142
  { name: "onOpen", type: "callable", optional: !0 }
11116
11143
  ],
11117
11144
  render: (t, e, r) => {
11118
- const a = Math.max(0, Math.floor(P(e.count, 0))), i = mt(e.items), n = r.useInstanceState("open", !1), s = n.get(), l = o("div", { class: "rui-notification-bell", "data-open": s ? "true" : "false" }), c = o("button", {
11145
+ const a = Math.max(0, Math.floor(P(e.count, 0))), i = pt(e.items), n = r.useInstanceState("open", !1), s = n.get(), l = o("div", { class: "rui-notification-bell", "data-open": s ? "true" : "false" }), c = o("button", {
11119
11146
  type: "button",
11120
11147
  class: "rui-notification-bell-trigger",
11121
11148
  "aria-expanded": s ? "true" : "false",
@@ -11842,7 +11869,7 @@ const Mu = {
11842
11869
  }
11843
11870
  ];
11844
11871
  hi(Ma);
11845
- const gt = {
11872
+ const mt = {
11846
11873
  root: "Stack",
11847
11874
  components: Ma,
11848
11875
  componentGroups: Ku
@@ -12000,7 +12027,7 @@ class Ju {
12000
12027
  this.options.onAssistantMessage?.(u);
12001
12028
  },
12002
12029
  openUrl: (u) => {
12003
- const p = ut(u, "#"), m = this.options.onOpenUrl;
12030
+ const p = ct(u, "#"), m = this.options.onOpenUrl;
12004
12031
  m ? m(p) : p !== "#" && typeof window < "u" && window.open(p, "_blank", "noopener,noreferrer");
12005
12032
  },
12006
12033
  bindState: (u, p, m) => {
@@ -12114,36 +12141,36 @@ function rd(t, e) {
12114
12141
  return;
12115
12142
  }
12116
12143
  if (t instanceof HTMLSelectElement && e instanceof HTMLSelectElement) {
12117
- !ot(t) && t.value !== e.value && (t.value = e.value);
12144
+ !nt(t) && t.value !== e.value && (t.value = e.value);
12118
12145
  return;
12119
12146
  }
12120
12147
  }
12121
12148
  function ad(t, e) {
12122
12149
  if (t.type === "checkbox" || t.type === "radio") {
12123
12150
  const a = e.hasAttribute("checked") || e.checked;
12124
- t.checked !== a && !ot(t) && (t.checked = a);
12151
+ t.checked !== a && !nt(t) && (t.checked = a);
12125
12152
  return;
12126
12153
  }
12127
12154
  const r = e.getAttribute("value") ?? e.value ?? "";
12128
- !ot(t) && t.value !== r && (t.value = r);
12155
+ !nt(t) && t.value !== r && (t.value = r);
12129
12156
  }
12130
12157
  function id(t, e) {
12131
12158
  const r = e.value ?? e.textContent ?? "";
12132
- !ot(t) && t.value !== r && (t.value = r);
12159
+ !nt(t) && t.value !== r && (t.value = r);
12133
12160
  }
12134
- function ot(t) {
12161
+ function nt(t) {
12135
12162
  const e = t.getRootNode();
12136
12163
  return e instanceof ShadowRoot || e instanceof Document ? e.activeElement === t : t.ownerDocument?.activeElement === t;
12137
12164
  }
12138
12165
  function Pa(t, e) {
12139
12166
  const r = /* @__PURE__ */ new Map();
12140
12167
  for (const i of Array.from(t.childNodes)) {
12141
- const n = Mt(i);
12168
+ const n = At(i);
12142
12169
  n && r.set(n, i);
12143
12170
  }
12144
12171
  let a = 0;
12145
12172
  for (const i of e) {
12146
- const n = t.childNodes[a] ?? null, s = Mt(i);
12173
+ const n = t.childNodes[a] ?? null, s = At(i);
12147
12174
  if (s && r.has(s)) {
12148
12175
  const c = r.get(s);
12149
12176
  r.delete(s), c !== n && t.insertBefore(c, n), _r(c, i), a += 1;
@@ -12153,7 +12180,7 @@ function Pa(t, e) {
12153
12180
  t.appendChild(i), a += 1;
12154
12181
  continue;
12155
12182
  }
12156
- const l = Mt(n);
12183
+ const l = At(n);
12157
12184
  if (l && (!s || l !== s)) {
12158
12185
  t.insertBefore(i, n), a += 1;
12159
12186
  continue;
@@ -12165,7 +12192,7 @@ function Pa(t, e) {
12165
12192
  t.removeChild(i);
12166
12193
  }
12167
12194
  }
12168
- function Mt(t) {
12195
+ function At(t) {
12169
12196
  if (t.nodeType !== Node.ELEMENT_NODE) return null;
12170
12197
  const e = t;
12171
12198
  if (e.id) return `#${e.id}`;
@@ -12510,7 +12537,7 @@ const nd = {
12510
12537
  ], sd = (t) => {
12511
12538
  const e = t.params.map((r) => r.required ? r.name : `${r.name}?`);
12512
12539
  return `@${t.name}(${e.join(", ")})`;
12513
- }, Pt = (t) => ({
12540
+ }, Mt = (t) => ({
12514
12541
  ...t,
12515
12542
  signature: sd(t)
12516
12543
  });
@@ -12518,14 +12545,14 @@ function Vt() {
12518
12545
  return [
12519
12546
  ...Object.keys(Qr).map((e) => {
12520
12547
  const r = nd[e];
12521
- return Pt(r ? { name: e, category: "data", ...r } : {
12548
+ return Mt(r ? { name: e, category: "data", ...r } : {
12522
12549
  name: e,
12523
12550
  category: "data",
12524
12551
  description: `Data helper: @${e}`,
12525
12552
  params: [{ name: "value", type: "any", required: !0 }]
12526
12553
  });
12527
12554
  }),
12528
- ...od.map(Pt)
12555
+ ...od.map(Mt)
12529
12556
  ];
12530
12557
  }
12531
12558
  function ld(t) {
@@ -12538,7 +12565,7 @@ function Ia(t, e = {}) {
12538
12565
  return e.mode === "chat" ? ud(t, e) : cd(t, e);
12539
12566
  }
12540
12567
  function Ip(t) {
12541
- return st(t);
12568
+ return ot(t);
12542
12569
  }
12543
12570
  function cd(t, e) {
12544
12571
  const r = (e.tools?.length ?? 0) > 0, a = {
@@ -13058,7 +13085,7 @@ function Md(t) {
13058
13085
  a.push(`### ${s.name}`);
13059
13086
  for (const l of s.components) {
13060
13087
  const c = r.get(l);
13061
- c && a.push(st(c));
13088
+ c && a.push(ot(c));
13062
13089
  }
13063
13090
  if (s.notes && s.notes.length > 0) {
13064
13091
  a.push("");
@@ -13069,7 +13096,7 @@ function Md(t) {
13069
13096
  const i = new Set(e.flatMap((s) => s.components)), n = t.components.filter((s) => !i.has(s.name));
13070
13097
  if (n.length > 0) {
13071
13098
  a.push("### Other");
13072
- for (const s of n) a.push(st(s));
13099
+ for (const s of n) a.push(ot(s));
13073
13100
  }
13074
13101
  return a.join(`
13075
13102
  `).trim();
@@ -13488,7 +13515,7 @@ function Dd(t) {
13488
13515
  ### ${i.name}`);
13489
13516
  for (const s of n) {
13490
13517
  const l = r.get(s);
13491
- l && a.push(st(l));
13518
+ l && a.push(ot(l));
13492
13519
  }
13493
13520
  }
13494
13521
  }
@@ -13499,8 +13526,8 @@ function Fd() {
13499
13526
  return '## Icons (Font Awesome)\n\nIcon-typed props (`icon`, `avatarSrc`, etc.) expect a Font Awesome name\nas a string — no `fa-` prefix, no emoji characters.\n\n- Format: `"name"` (defaults to the solid set), e.g. `"house"`,\n `"chart-line"`, `"star"`, `"circle-check"`.\n- Variants: prefix with `"regular:name"` (outline set) or\n `"brands:name"` (brand logos).\n- Render an icon inline anywhere a Node is expected with\n `Icon(name, variant?, size?)`.';
13500
13527
  }
13501
13528
  function Ud() {
13502
- const t = Vt(), e = t.filter((n) => n.category === "data"), r = t.filter((n) => n.category === "iteration"), a = e.map(lt).join(`
13503
- `), i = r.map(lt).join(`
13529
+ const t = Vt(), e = t.filter((n) => n.category === "data"), r = t.filter((n) => n.category === "iteration"), a = e.map(st).join(`
13530
+ `), i = r.map(st).join(`
13504
13531
  `);
13505
13532
  return `## Built-in \`@\`-functions
13506
13533
 
@@ -13631,7 +13658,7 @@ Before finishing, walk your output and verify:
13631
13658
  6. Tables are column-oriented; charts use numeric arrays (use array pluck
13632
13659
  like \`rows.value\` when needed).`;
13633
13660
  }
13634
- function st(t) {
13661
+ function ot(t) {
13635
13662
  const e = Jr(t), r = t.props.map((a) => {
13636
13663
  const i = a.enum ? a.enum.map((s) => `"${s}"`).join("|") : a.type, n = a === e && a.positional === !0 ? " (positional)" : "";
13637
13664
  return `${a.name}${a.optional ? "?" : ""}: ${i}${n}`;
@@ -13642,17 +13669,17 @@ function Gd(t) {
13642
13669
  const e = t.filter((i) => i.category === "data"), r = t.filter((i) => i.category === "iteration"), a = [];
13643
13670
  if (e.length > 0) {
13644
13671
  a.push("### Data helpers");
13645
- for (const i of e) a.push(lt(i));
13672
+ for (const i of e) a.push(st(i));
13646
13673
  a.push("");
13647
13674
  }
13648
13675
  if (r.length > 0) {
13649
13676
  a.push("### Iteration helpers");
13650
- for (const i of r) a.push(lt(i));
13677
+ for (const i of r) a.push(st(i));
13651
13678
  }
13652
13679
  return a.join(`
13653
13680
  `);
13654
13681
  }
13655
- function lt(t) {
13682
+ function st(t) {
13656
13683
  return `- \`${t.signature}\` — ${t.description}`;
13657
13684
  }
13658
13685
  function _t(t, e) {
@@ -14012,7 +14039,7 @@ const Yd = {
14012
14039
  glass: ip,
14013
14040
  brutalist: np,
14014
14041
  skyline: op
14015
- }, ft = {
14042
+ }, gt = {
14016
14043
  colorBg: "--rui-color-bg",
14017
14044
  colorBgSubtle: "--rui-color-bg-subtle",
14018
14045
  colorSurface: "--rui-color-surface",
@@ -14092,14 +14119,14 @@ function Br(t) {
14092
14119
  }
14093
14120
  function Dr(t, e) {
14094
14121
  const r = "tokens" in e ? e : { name: "custom", tokens: e };
14095
- for (const [a, i] of Object.entries(ft))
14122
+ for (const [a, i] of Object.entries(gt))
14096
14123
  t.style.setProperty(i, r.tokens[a]);
14097
14124
  t.setAttribute("data-rui-theme", r.name);
14098
14125
  }
14099
14126
  function sp(t, e) {
14100
14127
  const r = [];
14101
14128
  for (const a of Object.keys(e)) {
14102
- const i = ft[a];
14129
+ const i = gt[a];
14103
14130
  if (!i) continue;
14104
14131
  const n = e[a];
14105
14132
  typeof n != "string" || n === "" || (t.style.setProperty(i, n), r.push(a));
@@ -14108,7 +14135,7 @@ function sp(t, e) {
14108
14135
  }
14109
14136
  function lp(t, e) {
14110
14137
  for (const r of e) {
14111
- const a = ft[r];
14138
+ const a = gt[r];
14112
14139
  a && t.style.removeProperty(a);
14113
14140
  }
14114
14141
  }
@@ -14116,7 +14143,7 @@ function cp(t) {
14116
14143
  if (!t || typeof t != "object" || Array.isArray(t)) return {};
14117
14144
  const e = {};
14118
14145
  for (const [r, a] of Object.entries(t))
14119
- if (r in ft && a != null)
14146
+ if (r in gt && a != null)
14120
14147
  if (typeof a == "string") {
14121
14148
  if (a.trim() === "") continue;
14122
14149
  e[r] = a;
@@ -21660,7 +21687,7 @@ th[data-active="true"] .rui-data-grid-sort-icon { opacity: 1; }
21660
21687
  }
21661
21688
  .rui-lightbox-thumb img { display: block; width: 100%; height: auto; }
21662
21689
  .rui-lightbox-thumb:hover { border-color: var(--rui-color-primary); }
21663
- `, It = "theme", Fe = "streaming", zt = "response", Te = "showerrors", Ur = "route";
21690
+ `, Pt = "theme", Fe = "streaming", It = "response", Te = "showerrors", Ur = "route";
21664
21691
  function up(t) {
21665
21692
  const e = t.getPath(), r = { ...t.getParams() }, a = t.getActivePattern(), i = {};
21666
21693
  if (typeof window < "u" && window.location) {
@@ -21695,10 +21722,10 @@ function Or(t, e) {
21695
21722
  if (t[i] !== e[i]) return !1;
21696
21723
  return !0;
21697
21724
  }
21698
- let Rt = null, Ze = null;
21725
+ let zt = null, Ze = null;
21699
21726
  function pp() {
21700
21727
  if (Ze === !1) return null;
21701
- if (Rt) return Rt;
21728
+ if (zt) return zt;
21702
21729
  try {
21703
21730
  if (typeof CSSStyleSheet > "u" || !("replaceSync" in CSSStyleSheet.prototype) || // Some test environments (happy-dom) expose `CSSStyleSheet` but its
21704
21731
  // `replaceSync` is a no-op that doesn't propagate to adoption — keep
@@ -21706,17 +21733,17 @@ function pp() {
21706
21733
  typeof document > "u" || !("adoptedStyleSheets" in Document.prototype))
21707
21734
  return Ze = !1, null;
21708
21735
  const t = new CSSStyleSheet();
21709
- return t.replaceSync(La), Rt = t, Ze = !0, t;
21736
+ return t.replaceSync(La), zt = t, Ze = !0, t;
21710
21737
  } catch {
21711
21738
  return Ze = !1, null;
21712
21739
  }
21713
21740
  }
21714
- const ct = class ct extends HTMLElement {
21741
+ const lt = class lt extends HTMLElement {
21715
21742
  constructor() {
21716
21743
  super();
21717
21744
  _(this, "state", new Li());
21718
21745
  _(this, "router", new Ui());
21719
- _(this, "library", gt);
21746
+ _(this, "library", mt);
21720
21747
  _(this, "http", new _i());
21721
21748
  _(this, "i18n", new Tn());
21722
21749
  _(this, "effectRunner");
@@ -21815,15 +21842,15 @@ const ct = class ct extends HTMLElement {
21815
21842
  }
21816
21843
  static get observedAttributes() {
21817
21844
  return [
21818
- It,
21845
+ Pt,
21819
21846
  Fe,
21820
- zt,
21847
+ It,
21821
21848
  Te
21822
21849
  ];
21823
21850
  }
21824
21851
  connectedCallback() {
21825
21852
  jn(this.root), this.applyThemeFromAttribute(), this.startRouter(), this.attachPersistenceAdapter();
21826
- const r = this.getAttribute(zt);
21853
+ const r = this.getAttribute(It);
21827
21854
  if (r !== null && r !== "" && r !== this.currentResponse) {
21828
21855
  this.setResponse(r);
21829
21856
  return;
@@ -21841,7 +21868,7 @@ const ct = class ct extends HTMLElement {
21841
21868
  this.effectRunner.reset(), this.router.stop();
21842
21869
  }
21843
21870
  attributeChangedCallback(r, a, i) {
21844
- if (r === It && this.applyThemeFromAttribute(), r === Fe && (this.updateErrorBanner(), this.scheduleRender()), r === Te && this.updateErrorBanner(), r === zt) {
21871
+ if (r === Pt && this.applyThemeFromAttribute(), r === Fe && (this.updateErrorBanner(), this.scheduleRender()), r === Te && this.updateErrorBanner(), r === It) {
21845
21872
  const n = i ?? "";
21846
21873
  n !== this.currentResponse && this.setResponse(n);
21847
21874
  }
@@ -22005,7 +22032,7 @@ const ct = class ct extends HTMLElement {
22005
22032
  * without survival across reloads.
22006
22033
  */
22007
22034
  attachPersistenceAdapter() {
22008
- const r = typeof window < "u" ? window.localStorage : null, a = `rui:${ct.tagName}:${this.id || "default"}`, i = Ei(a, r ?? null);
22035
+ const r = typeof window < "u" ? window.localStorage : null, a = `rui:${lt.tagName}:${this.id || "default"}`, i = Ei(a, r ?? null);
22009
22036
  this.state.setPersistenceAdapter(i);
22010
22037
  }
22011
22038
  /**
@@ -22021,7 +22048,7 @@ const ct = class ct extends HTMLElement {
22021
22048
  })), this.scheduleRender();
22022
22049
  }
22023
22050
  applyThemeFromAttribute() {
22024
- const r = this.getAttribute(It);
22051
+ const r = this.getAttribute(Pt);
22025
22052
  Dr(this, Br(r)), this.scriptThemeKeys = [];
22026
22053
  }
22027
22054
  /**
@@ -22124,8 +22151,8 @@ const ct = class ct extends HTMLElement {
22124
22151
  this.errorEl.replaceChildren(r, a);
22125
22152
  }
22126
22153
  };
22127
- _(ct, "tagName", "aktion-app");
22128
- let He = ct;
22154
+ _(lt, "tagName", "aktion-app");
22155
+ let He = lt;
22129
22156
  function mp(t) {
22130
22157
  return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/([^A-Za-z0-9_-])/g, "\\$1");
22131
22158
  }
@@ -22310,7 +22337,7 @@ const vp = {
22310
22337
  for (const a of r.components) e.set(a, r.name);
22311
22338
  return e;
22312
22339
  };
22313
- function kp(t = gt) {
22340
+ function kp(t = mt) {
22314
22341
  const e = wp(t);
22315
22342
  return t.components.map((r) => ({
22316
22343
  name: r.name,
@@ -22520,7 +22547,7 @@ list = for u in $users { \${1:UserCard}(u) }`
22520
22547
  function $p() {
22521
22548
  return Cp;
22522
22549
  }
22523
- function zp(t = gt) {
22550
+ function zp(t = mt) {
22524
22551
  const e = kp(t), r = Vt();
22525
22552
  return {
22526
22553
  grammar: jt,
@@ -22639,7 +22666,7 @@ const Np = [
22639
22666
  "thumbtack"
22640
22667
  ];
22641
22668
  hp();
22642
- const Rp = Ia(gt);
22669
+ const Rp = Ia(mt);
22643
22670
  export {
22644
22671
  zn as ActionDeclRunner,
22645
22672
  He as AktionElement,
@@ -22665,7 +22692,7 @@ export {
22665
22692
  bp as createStreamTokenizer,
22666
22693
  tp as darkTheme,
22667
22694
  Qr as dataBuiltins,
22668
- gt as defaultLibrary,
22695
+ mt as defaultLibrary,
22669
22696
  vp as defaultTagMap,
22670
22697
  hp as defineElement,
22671
22698
  Ip as describeComponentSpec,