@malloy-publisher/sdk 0.9.16 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{RenderedResult-5hOs5XnV.cjs.js → RenderedResult-B5f4qOjp.cjs.js} +1 -1
  2. package/dist/{RenderedResult-DxmHGZNQ.es.js → RenderedResult-vf6tu8tf.es.js} +2 -2
  3. package/dist/{ServerProvider-D7neZcTk.es.js → ServerProvider-B6RLAbgV.es.js} +48 -24
  4. package/dist/builder/index.cjs.js +17 -17
  5. package/dist/builder/index.es.js +278 -266
  6. package/dist/client/api.d.ts +64 -28
  7. package/dist/client/index.es.js +1 -1
  8. package/dist/components/ReportBuilder/TextTileBody.d.ts +9 -2
  9. package/dist/components/legacy/malloynb/CellRunnerView.d.ts +6 -6
  10. package/dist/hooks/useSettled.d.ts +5 -8
  11. package/dist/hooks/useSettledDraft.d.ts +33 -0
  12. package/dist/index.cjs.js +10 -10
  13. package/dist/index.es.js +3769 -3779
  14. package/dist/useCompiledDocument-C995sQ3j.cjs.js +142 -0
  15. package/dist/{useCompiledDocument-CaYP_OYG.es.js → useCompiledDocument-CLbTFtsJ.es.js} +5449 -5294
  16. package/dist/utils/malloyLiteral.d.ts +2 -0
  17. package/package.json +11 -16
  18. package/src/components/ReportBuilder/BuilderGrid.tsx +1 -0
  19. package/src/components/ReportBuilder/TextTileBody.tsx +24 -4
  20. package/src/components/ReportBuilder/placement.spec.ts +27 -0
  21. package/src/components/ReportBuilder/placement.ts +8 -4
  22. package/src/components/given/GivenInput.spec.tsx +447 -2
  23. package/src/components/given/GivenInput.tsx +192 -80
  24. package/src/components/given/GivensPanel.spec.tsx +59 -0
  25. package/src/components/given/GivensPanel.tsx +14 -2
  26. package/src/components/legacy/malloynb/CellRunnerView.tsx +6 -6
  27. package/src/hooks/useDimensionFilters.ts +1 -35
  28. package/src/hooks/useDimensionFiltersQuery.ts +2 -36
  29. package/src/hooks/useDimensionalFilterRangeData.ts +1 -35
  30. package/src/hooks/useGivensState.spec.ts +106 -1
  31. package/src/hooks/useGivensState.ts +48 -13
  32. package/src/hooks/useSettled.ts +5 -8
  33. package/src/hooks/useSettledDraft.ts +127 -0
  34. package/src/utils/malloyLiteral.spec.ts +12 -1
  35. package/src/utils/malloyLiteral.ts +32 -0
  36. package/vite.config.ts +0 -2
  37. package/.eslintrc +0 -36
  38. package/dist/components/DOMElement/DOMElement.d.ts +0 -5
  39. package/dist/components/DOMElement/index.d.ts +0 -1
  40. package/dist/components/Package/FileTreeView.d.ts +0 -9
  41. package/dist/useCompiledDocument-zYEfLogf.cjs.js +0 -142
  42. package/src/components/DOMElement/DOMElement.tsx +0 -22
  43. package/src/components/DOMElement/index.ts +0 -4
  44. package/src/components/Package/FileTreeView.tsx +0 -244
@@ -1,18 +1,18 @@
1
1
  import { jsx as _, jsxs as L, Fragment as Fe } from "react/jsx-runtime";
2
- import { M as lp, h as cp, i as di, P as Oa, j as Wi, G as bt, k as ui, n as wt, o as at, r as lt, p as gn, C as zi, E as Ca, q as Ni, A as $o, S as dp, s as up, t as Da, V as fp, u as hp, v as pp, w as gp, x as mp, y as vp, z as yp, B as bp, F as dd, H as wp, I as xp, J as dn, U as _p, K as On, L as kp, l as ud, N as Ma, O as Sp, Q as $p, R as Nn, W as jl, X as es, Y as nr, Z as fd, _ as Ep, $ as Tp, a0 as hd, a1 as Hl, a2 as to, a3 as pd, a4 as Op, a5 as Cp, a6 as gd, a7 as Dp, a8 as Mp, a9 as _s, aa as ks, ab as Ip, ac as Ss, ad as Ap, ae as md, af as Pp, ag as Rp, ah as Lp, ai as Wp, aj as zp, ak as rn, al as Np, am as $s, an as Fp, ao as Bp, ap as jp, aq as vd, ar as Hp, as as Gp, at as qp, au as Up, av as Kp, aw as Vp, ax as Yp, ay as Xp, az as Qp, aA as Ia, aB as Zp, aC as Jp, aD as eg, aE as tg, aF as ng, aG as rg, aH as Es, aI as Gl, aJ as og, aK as ig, aL as sg, aM as ag, aN as lg, aO as cg, aP as dg, aQ as yd, aR as bd, aS as wd, aT as ug, aU as xd, aV as fg, aW as hg, aX as pg, aY as gg, aZ as mg, a_ as vg, a$ as yg, b0 as bg, b1 as wg, b2 as xg, b3 as _g, b4 as kg, b5 as Sg, b6 as $g, b7 as Eg } from "../useCompiledDocument-CaYP_OYG.es.js";
3
- import { b8 as g_, b9 as m_, ba as v_, bb as y_, bc as b_, bd as w_, be as x_, bf as __, bg as k_, bh as S_, bi as $_ } from "../useCompiledDocument-CaYP_OYG.es.js";
2
+ import { M as lp, h as cp, i as di, P as Oa, j as Wi, G as bt, k as ui, n as wt, o as at, r as lt, p as gn, C as zi, E as Ca, q as Ni, A as $o, S as dp, s as up, t as Da, V as fp, u as hp, v as pp, w as gp, x as mp, y as vp, z as yp, B as bp, F as dd, H as wp, I as xp, J as dn, U as _p, K as On, L as kp, l as ud, N as Ma, O as Sp, Q as $p, R as Nn, W as jl, X as es, Y as nr, Z as fd, _ as Ep, $ as Tp, a0 as hd, a1 as Hl, a2 as to, a3 as pd, a4 as Op, a5 as Cp, a6 as gd, a7 as Dp, a8 as Mp, a9 as _s, aa as ks, ab as Ip, ac as Ss, ad as Ap, ae as md, af as Pp, ag as Rp, ah as Lp, ai as Wp, aj as zp, ak as rn, al as Np, am as $s, an as Fp, ao as Bp, ap as jp, aq as vd, ar as Hp, as as Gp, at as qp, au as Up, av as Kp, aw as Vp, ax as Yp, ay as Xp, az as Qp, aA as Ia, aB as Zp, aC as Jp, aD as eg, aE as tg, aF as ng, aG as rg, aH as Es, aI as Gl, aJ as og, aK as ig, aL as sg, aM as ag, aN as lg, aO as cg, aP as dg, aQ as yd, aR as bd, aS as wd, aT as ug, aU as xd, aV as fg, aW as hg, aX as pg, aY as gg, aZ as mg, a_ as vg, a$ as yg, b0 as bg, b1 as wg, b2 as xg, b3 as _g, b4 as kg, b5 as Sg, b6 as $g, b7 as Eg } from "../useCompiledDocument-CLbTFtsJ.es.js";
3
+ import { b8 as g_, b9 as m_, ba as v_, bb as y_, bc as b_, bd as w_, be as x_, bf as __, bg as k_, bh as S_, bi as $_ } from "../useCompiledDocument-CLbTFtsJ.es.js";
4
4
  import { Tooltip as Lt, ButtonBase as _d, Box as H, Menu as rr, MenuItem as it, Stack as yt, Button as Ne, Divider as lr, IconButton as Dn, Typography as we, TextField as on, ToggleButtonGroup as kd, ToggleButton as Ts, Switch as Tg, Checkbox as Os, ListItemText as Kt, Collapse as Og, Autocomplete as Cg, ListItemIcon as Sd, InputBase as $d, SvgIcon as Dg, useMediaQuery as Ed, Alert as vt } from "@mui/material";
5
5
  import { useState as j, useRef as q, useEffect as re, useMemo as V, createElement as Mg, useLayoutEffect as fi, useCallback as le, useInsertionEffect as Ig, createContext as Td, memo as Ag, forwardRef as Pg, startTransition as Rg, useImperativeHandle as Lg, useContext as Od, useId as Wg } from "react";
6
- import { b8 as Xe, bd as Aa, b9 as Pa } from "../ServerProvider-D7neZcTk.es.js";
6
+ import { b8 as Xe, bd as Aa, b9 as Pa } from "../ServerProvider-B6RLAbgV.es.js";
7
7
  import { i as Cs, a as Cd, m as zg, b as Ng, t as Fg, c as Dd, s as Bg, d as jg, e as Md, f as Ra, g as Hg, A as Gg, h as qg, r as Ug, j as Id, k as ql, l as La } from "../text-entry-YKJZbRPo.es.js";
8
8
  import { flushSync as Kg } from "react-dom";
9
9
  import { useQueries as Vg, useQueryClient as Yg } from "@tanstack/react-query";
10
- const Pe = (e) => e.kind === "text", he = (e) => e.kind !== "text", Ar = (e) => he(e) ? e.label ?? e.name : e.name, kt = (e) => e.declaration.kind === "query" ? e.name : `${e.source} -> ${e.name}`, gr = (e) => e.declaration.kind === "inherited" || e.declaration.kind === "query", me = (e) => Pe(e) ? `text.${e.name}` : e.declaration.kind === "query" ? (
10
+ const Me = (e) => e.kind === "text", he = (e) => e.kind !== "text", Ar = (e) => he(e) ? e.label ?? e.name : e.name, kt = (e) => e.declaration.kind === "query" ? e.name : `${e.source} -> ${e.name}`, gr = (e) => e.declaration.kind === "inherited" || e.declaration.kind === "query", me = (e) => Me(e) ? `text.${e.name}` : e.declaration.kind === "query" ? (
11
11
  // `query` is a Malloy keyword, so no source can carry this prefix.
12
12
  `query.${e.name}`
13
13
  ) : `${e.source}.${e.name}`, Ul = ".malloy-big-value, .malloy-table", Xg = (e) => e.querySelector(Ul) !== null && ![...e.querySelectorAll(".malloy-chart")].some(
14
14
  (t) => t.closest(Ul) === null
15
- ), hi = (e, t) => Pe(e) ? lp : t && Xg(t) ? cp : di, fo = (e) => e.rowspan ?? Oa[Pe(e) ? "text" : "query"];
15
+ ), hi = (e, t) => Me(e) ? lp : t && Xg(t) ? cp : di, fo = (e) => e.rowspan ?? Oa[Me(e) ? "text" : "query"];
16
16
  function un(e, t) {
17
17
  if (e.row === void 0 || e.col === void 0) return;
18
18
  const n = Math.min(e.colspan ?? 1, t);
@@ -90,14 +90,12 @@ function Rd(e, t, n, r) {
90
90
  const { break: l, ...u } = i, c = i.colspan ?? Math.max(
91
91
  1,
92
92
  Math.round((a.width + bt) / (r + bt))
93
- ), d = Pd(a.left, a.top, c, n, r), f = Math.round(
94
- (a.top + a.height + bt) / Ad
95
- );
93
+ ), d = Pd(a.left, a.top, c, n, r), f = (a.top + a.height + bt) / Ad, h = Me(i) ? Math.ceil(f - 0.02) : Math.round(f);
96
94
  return {
97
95
  ...u,
98
96
  ...d,
99
97
  colspan: c,
100
- rowspan: i.rowspan ?? Math.max(hi(i), f - d.row + 1)
98
+ rowspan: i.rowspan ?? Math.max(hi(i), h - d.row + 1)
101
99
  };
102
100
  });
103
101
  return Xt(o, n);
@@ -156,7 +154,7 @@ function Vl(e, t, n, r, o) {
156
154
  }
157
155
  const Wd = (e, t) => e?.col === void 0 ? t : Math.max(1, t - e.col + 1);
158
156
  function tm(e) {
159
- return Pe(e) || e.rowspan === void 0 ? e : Wi(e.chart) && e.chart !== "big_value" && e.rowspan < di ? { ...e, rowspan: di } : e;
157
+ return Me(e) || e.rowspan === void 0 ? e : Wi(e.chart) && e.chart !== "big_value" && e.rowspan < di ? { ...e, rowspan: di } : e;
160
158
  }
161
159
  const zd = wt(/* @__PURE__ */ _("path", {
162
160
  d: "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z"
@@ -694,7 +692,7 @@ function lm({
694
692
  }, [e]);
695
693
  const A = $ ? [$.source.name, $.view.name].filter((M) => !Cs(M)).map(
696
694
  (M) => `"${M}" is not a plain Malloy name, so a tile cannot be written for it.`
697
- )[0] : void 0, I = $ !== void 0 && A === void 0, R = $ ? Ql($.view) : "", B = p !== "default" && $ ? {
695
+ )[0] : void 0, I = $ !== void 0 && A === void 0, P = $ ? Ql($.view) : "", B = p !== "default" && $ ? {
698
696
  chart: p,
699
697
  chartCarried: $.view.chart ? [$.view.chart] : []
700
698
  } : {}, N = (M = $) => {
@@ -844,7 +842,7 @@ function lm({
844
842
  base: $.source.name,
845
843
  modelPath: $.source.modelPath,
846
844
  view: $.view.name,
847
- label: w.trim() || R,
845
+ label: w.trim() || P,
848
846
  ...p !== "default" ? B : {},
849
847
  givens: $.source.givens
850
848
  }) }) : /* @__PURE__ */ L(
@@ -879,7 +877,7 @@ function lm({
879
877
  {
880
878
  size: "small",
881
879
  label: "Title",
882
- placeholder: R,
880
+ placeholder: P,
883
881
  value: w,
884
882
  onChange: (M) => y(M.target.value),
885
883
  InputLabelProps: { shrink: !0 },
@@ -1561,10 +1559,10 @@ function Cm({
1561
1559
  ), I = V(
1562
1560
  () => p.trim() ? km(p.trim(), A) : "",
1563
1561
  [p, A]
1564
- ), R = c.kind === "existing" ? n ?? r.find((D) => D.name === c.name) : I ? {
1562
+ ), P = c.kind === "existing" ? n ?? r.find((D) => D.name === c.name) : I ? {
1565
1563
  name: I,
1566
1564
  type: Wr({ name: I, label: f, kind: v, field: p }).type
1567
- } : void 0, B = R?.type !== void 0 && !R.type.startsWith("filter<"), N = x.find((D) => D.include)?.op ?? yi(R?.type), Q = (D, W) => {
1565
+ } : void 0, B = P?.type !== void 0 && !P.type.startsWith("filter<"), N = x.find((D) => D.include)?.op ?? yi(P?.type), Q = (D, W) => {
1568
1566
  E(!0), b(
1569
1567
  (K) => K.map((Z, Te) => Te === D ? { ...Z, ...W } : Z)
1570
1568
  );
@@ -1579,10 +1577,10 @@ function Cm({
1579
1577
  E(!0), d({ kind: "existing", name: D.name }), m(D.field ?? ""), F(D.type);
1580
1578
  }, O = (D) => {
1581
1579
  E(!0), g(D), F(Wr({ name: "X", label: f, kind: D, field: p }).type);
1582
- }, P = t.tiles.map(Rs), U = P.filter(Boolean).length, G = x.filter((D, W) => D.include && P[W]).length, Y = t.tiles.filter(
1583
- (D, W) => (x[W]?.include ?? !1) && P[W] && he(D)
1580
+ }, R = t.tiles.map(Rs), U = R.filter(Boolean).length, G = x.filter((D, W) => D.include && R[W]).length, Y = t.tiles.filter(
1581
+ (D, W) => (x[W]?.include ?? !1) && R[W] && he(D)
1584
1582
  ), oe = Y.length > 0 ? Y : t.tiles.filter(
1585
- (D, W) => P[W] && he(D)
1583
+ (D, W) => R[W] && he(D)
1586
1584
  ), _e = V(() => {
1587
1585
  const D = /* @__PURE__ */ new Map();
1588
1586
  let W = !1;
@@ -1606,7 +1604,7 @@ function Cm({
1606
1604
  E(!0), b(
1607
1605
  (W) => W.map((K, Z) => ({
1608
1606
  ...K,
1609
- include: D && P[Z]
1607
+ include: D && R[Z]
1610
1608
  }))
1611
1609
  );
1612
1610
  }, Re = V(
@@ -1617,16 +1615,16 @@ function Cm({
1617
1615
  const K = i?.(W)?.find((Z) => Z.name === D.trim());
1618
1616
  if (K?.type) return K.type;
1619
1617
  }
1620
- }, xe = (D) => ro(R?.type, D.type), Ve = (D, W) => {
1618
+ }, xe = (D) => ro(P?.type, D.type), Ve = (D, W) => {
1621
1619
  if (D.trim() === "") return "Pick the field this filter compares.";
1622
1620
  const K = W ? i?.(W) : void 0;
1623
1621
  if (!K) return;
1624
1622
  const Z = K.find((Te) => Te.name === D.trim());
1625
1623
  if (!Z)
1626
1624
  return `Not a field of ${W ? $(W) : "the tiles' source"}.`;
1627
- if (Z.type && !ro(R?.type, Z.type))
1625
+ if (Z.type && !ro(P?.type, Z.type))
1628
1626
  return `${D.trim()} is ${Ps(Z.type)}; this filter compares ${Ps(
1629
- R?.type?.replace(/^filter<(.+)>$/, "$1")
1627
+ P?.type?.replace(/^filter<(.+)>$/, "$1")
1630
1628
  )}.`;
1631
1629
  }, ee = (D) => {
1632
1630
  if (E(!0), m(D), u || c.kind !== "new") return;
@@ -1641,19 +1639,19 @@ function Cm({
1641
1639
  const W = t.tiles[D];
1642
1640
  return W && he(W) ? W : void 0;
1643
1641
  }, Ee = Re.map(
1644
- (D, W) => D.include && P[W] ? Ve(D.field, tt(W)) : void 0
1645
- ), ge = Ee.every((D) => D === void 0), Me = T ? Ee : Ee.map(() => {
1646
- }), Be = T && !S && G > 0 ? Y.map((D) => Ve(p, D)).find(Boolean) : void 0, de = R !== void 0 && ge && (c.kind === "existing" || p.trim() !== "" && I !== ""), Qe = () => {
1647
- if (!(!R || !de))
1642
+ (D, W) => D.include && R[W] ? Ve(D.field, tt(W)) : void 0
1643
+ ), ge = Ee.every((D) => D === void 0), Ie = T ? Ee : Ee.map(() => {
1644
+ }), Be = T && !S && G > 0 ? Y.map((D) => Ve(p, D)).find(Boolean) : void 0, de = P !== void 0 && ge && (c.kind === "existing" || p.trim() !== "" && I !== ""), Qe = () => {
1645
+ if (!(!P || !de))
1648
1646
  if (c.kind === "new")
1649
1647
  s(
1650
- R.name,
1648
+ P.name,
1651
1649
  Re,
1652
1650
  Wr({
1653
- name: R.name,
1651
+ name: P.name,
1654
1652
  // Untyped, the label is what the placeholder promised — `Status`
1655
1653
  // for `$STATUS` — not the shouted name.
1656
- label: f.trim() || Ls(R.name),
1654
+ label: f.trim() || Ls(P.name),
1657
1655
  kind: v,
1658
1656
  field: p.trim(),
1659
1657
  ...$e ? { source: $e } : {},
@@ -1663,12 +1661,12 @@ function Cm({
1663
1661
  else if (n?.origin === "dashboard" && n.local) {
1664
1662
  const D = f.trim(), W = D !== (n.local.label ?? "");
1665
1663
  s(
1666
- R.name,
1664
+ P.name,
1667
1665
  Re,
1668
1666
  W ? { ...n.local, ...D ? { label: D } : {} } : void 0
1669
1667
  );
1670
1668
  } else
1671
- s(R.name, Re);
1669
+ s(P.name, Re);
1672
1670
  }, nt = u && l.origin === "model";
1673
1671
  return {
1674
1672
  editing: u,
@@ -1687,21 +1685,21 @@ function Cm({
1687
1685
  perTile: S,
1688
1686
  setPerTile: k,
1689
1687
  newName: I,
1690
- target: R,
1688
+ target: P,
1691
1689
  valueTyped: B,
1692
1690
  commonOp: N,
1693
1691
  setRow: Q,
1694
1692
  setCommonOp: M,
1695
1693
  pickExisting: C,
1696
1694
  pickKind: O,
1697
- bindable: P,
1695
+ bindable: R,
1698
1696
  bindableCount: U,
1699
1697
  included: G,
1700
1698
  commonFields: _e,
1701
1699
  setAll: se,
1702
1700
  accepts: xe,
1703
1701
  pickField: ee,
1704
- rowProblems: Me,
1702
+ rowProblems: Ie,
1705
1703
  commonProblem: Be,
1706
1704
  canApply: de,
1707
1705
  apply: Qe
@@ -1804,7 +1802,7 @@ function Mm({
1804
1802
  newName: $,
1805
1803
  target: A,
1806
1804
  valueTyped: I,
1807
- commonOp: R,
1805
+ commonOp: P,
1808
1806
  setRow: B,
1809
1807
  setCommonOp: N,
1810
1808
  pickExisting: Q,
@@ -1812,7 +1810,7 @@ function Mm({
1812
1810
  bindable: F,
1813
1811
  bindableCount: C,
1814
1812
  included: O,
1815
- commonFields: P,
1813
+ commonFields: R,
1816
1814
  setAll: U,
1817
1815
  accepts: G,
1818
1816
  pickField: Y,
@@ -1836,7 +1834,7 @@ function Mm({
1836
1834
  }, [tt]), re(() => {
1837
1835
  T && ee(!0);
1838
1836
  }, [T]);
1839
- const ge = P?.find((D) => D.name === b.trim())?.type, Me = (D) => {
1837
+ const ge = R?.find((D) => D.name === b.trim())?.type, Ie = (D) => {
1840
1838
  if (!ge) return;
1841
1839
  const W = Wr({
1842
1840
  name: "X",
@@ -1981,7 +1979,7 @@ function Mm({
1981
1979
  {
1982
1980
  value: b,
1983
1981
  onChange: Y,
1984
- fields: P,
1982
+ fields: R,
1985
1983
  accepts: G,
1986
1984
  label: "Field",
1987
1985
  ariaLabel: "Field to filter",
@@ -2006,7 +2004,7 @@ function Mm({
2006
2004
  ]
2007
2005
  }
2008
2006
  ),
2009
- I && !T && nt(R, N, "Comparison"),
2007
+ I && !T && nt(P, N, "Comparison"),
2010
2008
  !d && v.kind === "new" && /* @__PURE__ */ L(H, { children: [
2011
2009
  /* @__PURE__ */ _(Jl, { children: "Control" }),
2012
2010
  /* @__PURE__ */ _(
@@ -2023,7 +2021,7 @@ function Mm({
2023
2021
  gap: 1
2024
2022
  },
2025
2023
  children: Sm.map((D) => {
2026
- const W = D.kind === p, K = Me(D.kind);
2024
+ const W = D.kind === p, K = Ie(D.kind);
2027
2025
  return /* @__PURE__ */ _(
2028
2026
  Lt,
2029
2027
  {
@@ -2443,20 +2441,20 @@ function Nm({
2443
2441
  S ? x.current = t && he(t) ? t.chart : void 0 : w(void 0);
2444
2442
  }, [S]);
2445
2443
  const k = y?.chart ?? "default", T = Bd(a, k, l), E = y ? y.declaration.kind === "query" ? zm : p ? y.chart === "custom" ? Pm(y.chartLines) : void 0 : Wm : void 0, $ = (C) => m((O) => {
2446
- const P = x.current;
2447
- C === (P ?? "default") ? (P === void 0 ? delete O.chart : O.chart = P, delete O.chartCarried) : (O.chart = C, a ? O.chartCarried = a.chart ? [a.chart] : [] : delete O.chartCarried);
2448
- }), A = p ? o ? void 0 : "Its source declares no dimension a click could filter by." : void 0, I = k === "default" ? a?.chart : k, R = I !== void 0 && Rm.has(I) ? Lm : void 0, B = (C) => (O) => w({ kind: C, anchor: O.currentTarget }), N = E ?? (I === void 0 || !Fm.has(I) ? "Only a bar, line, scatter or bar and line chart has a color to set." : void 0), Q = Array.from(
2444
+ const R = x.current;
2445
+ C === (R ?? "default") ? (R === void 0 ? delete O.chart : O.chart = R, delete O.chartCarried) : (O.chart = C, a ? O.chartCarried = a.chart ? [a.chart] : [] : delete O.chartCarried);
2446
+ }), A = p ? o ? void 0 : "Its source declares no dimension a click could filter by." : void 0, I = k === "default" ? a?.chart : k, P = I !== void 0 && Rm.has(I) ? Lm : void 0, B = (C) => (O) => w({ kind: C, anchor: O.currentTarget }), N = E ?? (I === void 0 || !Fm.has(I) ? "Only a bar, line, scatter or bar and line chart has a color to set." : void 0), Q = Array.from(
2449
2447
  new Set(
2450
2448
  u.series.map(dd).filter((C) => C !== void 0)
2451
2449
  )
2452
2450
  ).slice(0, 8), M = (C) => m((O) => {
2453
2451
  C === void 0 ? delete O.color : O.color = C.toLowerCase();
2454
- }), F = (C, O, P) => /* @__PURE__ */ L(Fe, { children: [
2452
+ }), F = (C, O, R) => /* @__PURE__ */ L(Fe, { children: [
2455
2453
  /* @__PURE__ */ _(
2456
2454
  Kt,
2457
2455
  {
2458
2456
  primary: C,
2459
- ...P ? { secondary: P } : {},
2457
+ ...R ? { secondary: R } : {},
2460
2458
  secondaryTypographyProps: {
2461
2459
  sx: { whiteSpace: "normal", maxWidth: 240 }
2462
2460
  }
@@ -2558,7 +2556,7 @@ function Nm({
2558
2556
  children: F(
2559
2557
  "Clickable cells…",
2560
2558
  void 0,
2561
- A ?? R
2559
+ A ?? P
2562
2560
  )
2563
2561
  }
2564
2562
  ),
@@ -2728,8 +2726,8 @@ function Nm({
2728
2726
  value: y?.color ?? Bm(u.series[0]),
2729
2727
  onChange: (C) => {
2730
2728
  const O = C.target.value;
2731
- wp(O) && h((P) => {
2732
- he(P) && (P.color = O.toLowerCase());
2729
+ wp(O) && h((R) => {
2730
+ he(R) && (R.color = O.toLowerCase());
2733
2731
  });
2734
2732
  },
2735
2733
  style: {
@@ -6225,19 +6223,19 @@ Rf = function() {
6225
6223
  };
6226
6224
  let { width: E, height: $, top: A, left: I } = k;
6227
6225
  S && (E = E / T.x, $ = $ / T.y);
6228
- const R = new vy(m), B = qt(v), {
6226
+ const P = new vy(m), B = qt(v), {
6229
6227
  transition: N,
6230
6228
  translate: Q,
6231
6229
  boxSizing: M,
6232
6230
  paddingBlockStart: F,
6233
6231
  paddingBlockEnd: C,
6234
6232
  paddingInlineStart: O,
6235
- paddingInlineEnd: P,
6233
+ paddingInlineEnd: R,
6236
6234
  borderInlineStartWidth: U,
6237
6235
  borderInlineEndWidth: G,
6238
6236
  borderBlockStartWidth: Y,
6239
6237
  borderBlockEndWidth: oe
6240
- } = B, _e = N.split(",").filter((ie) => !/^\s*(transform|translate|scale)\b/.test(ie)).join(","), $e = Ki(B), se = B.transform, Re = y === "clone", be = M === "content-box", xe = be ? parseInt(O) + parseInt(P) + parseInt(U) + parseInt(G) : 0, Ve = be ? parseInt(F) + parseInt(C) + parseInt(Y) + parseInt(oe) : 0, ee = y !== "move" && !this.overlay ? Hy(f, Re ? "clone" : "hidden") : null, tt = ue(
6238
+ } = B, _e = N.split(",").filter((ie) => !/^\s*(transform|translate|scale)\b/.test(ie)).join(","), $e = Ki(B), se = B.transform, Re = y === "clone", be = M === "content-box", xe = be ? parseInt(O) + parseInt(R) + parseInt(U) + parseInt(G) : 0, Ve = be ? parseInt(F) + parseInt(C) + parseInt(Y) + parseInt(oe) : 0, ee = y !== "move" && !this.overlay ? Hy(f, Re ? "clone" : "hidden") : null, tt = ue(
6241
6239
  () => bo(l.dragOperation.activatorEvent)
6242
6240
  );
6243
6241
  if (!p.translate) {
@@ -6255,9 +6253,9 @@ Rf = function() {
6255
6253
  y: (ie.y - Ze * x.scaleY - x.y) / ($ * x.scaleY)
6256
6254
  };
6257
6255
  }
6258
- const { transformOrigin: Ee } = p, ge = A * x.scaleY + x.y, Me = I * x.scaleX + x.x;
6256
+ const { transformOrigin: Ee } = p, ge = A * x.scaleY + x.y, Ie = I * x.scaleX + x.x;
6259
6257
  if (!p.coordinates && (p.coordinates = {
6260
- x: Me,
6258
+ x: Ie,
6261
6259
  y: ge
6262
6260
  }, T.x !== 1 || T.y !== 1)) {
6263
6261
  const { scaleX: ie, scaleY: ce } = b, { x: Ze, y: At } = Ee;
@@ -6265,7 +6263,7 @@ Rf = function() {
6265
6263
  }
6266
6264
  p.dimensions || (p.dimensions = { width: E, height: $ }), p.frameTransform || (p.frameTransform = x);
6267
6265
  const Be = {
6268
- x: p.coordinates.x - Me,
6266
+ x: p.coordinates.x - Ie,
6269
6267
  y: p.coordinates.y - ge
6270
6268
  }, de = {
6271
6269
  width: (p.dimensions.width * p.frameTransform.scaleX - E * x.scaleX) * Ee.x,
@@ -6279,7 +6277,7 @@ Rf = function() {
6279
6277
  };
6280
6278
  m.setAttribute(Ft, "true");
6281
6279
  const D = ue(() => c.transform), W = (i = p.translate) != null ? i : { x: 0, y: 0 }, K = D.x * x.scaleX + W.x, Z = D.y * x.scaleY + W.y, Te = af();
6282
- R.set(
6280
+ P.set(
6283
6281
  {
6284
6282
  width: E - xe,
6285
6283
  height: $ - Ve,
@@ -6307,7 +6305,7 @@ Rf = function() {
6307
6305
  widthOffset: xe,
6308
6306
  heightOffset: Ve,
6309
6307
  delta: Qe,
6310
- styles: R,
6308
+ styles: P,
6311
6309
  dragOperation: c,
6312
6310
  getTranslate: () => a.current.translate,
6313
6311
  getElementMutationObserver: () => Se,
@@ -6338,7 +6336,7 @@ Rf = function() {
6338
6336
  Se?.disconnect(), Et?.disconnect(), J.disconnect(), He.removeEventListener("resize", xt), ta(m) && (m.removeEventListener(
6339
6337
  "beforetoggle",
6340
6338
  wc
6341
- ), m.removeAttribute("popover")), m.removeAttribute(Ft), R.reset();
6339
+ ), m.removeAttribute("popover")), m.removeAttribute(Ft), P.reset();
6342
6340
  const ie = () => {
6343
6341
  var ce;
6344
6342
  if (z && aa(v)) {
@@ -6351,7 +6349,7 @@ Rf = function() {
6351
6349
  ee && (!At && Ze || ee.parentElement !== m.parentElement) && m.isConnected && ee.replaceWith(m), ee?.remove();
6352
6350
  };
6353
6351
  m === this.overlay ? setTimeout(ie, 0) : ie();
6354
- }, Ie = u?.dropAnimation, Oe = this, mn = Eo(
6352
+ }, Ae = u?.dropAnimation, Oe = this, mn = Eo(
6355
6353
  // Update transform on move
6356
6354
  () => {
6357
6355
  var ie, ce, Ze;
@@ -6364,7 +6362,7 @@ Rf = function() {
6364
6362
  var Ir;
6365
6363
  return (Ir = c.shape) == null ? void 0 : Ir.current;
6366
6364
  }), Mr = u?.keyboardTransition, Bl = tt && !ve && Mr !== null ? `${(ce = Mr?.duration) != null ? ce : 250}ms ${(Ze = Mr?.easing) != null ? Ze : "cubic-bezier(0.25, 1, 0.5, 1)"}` : "0ms linear";
6367
- if (R.set(
6365
+ if (P.set(
6368
6366
  {
6369
6367
  transition: _e ? `${_e}, translate ${Bl}` : `translate ${Bl}`,
6370
6368
  translate: `${zn.x}px ${zn.y}px 0`
@@ -6387,7 +6385,7 @@ Rf = function() {
6387
6385
  function() {
6388
6386
  if (c.status.dropped) {
6389
6387
  this.dispose(), f.status = "dropping";
6390
- const ie = g?.dropAnimation !== void 0 ? g.dropAnimation : Oe.dropAnimation !== void 0 ? Oe.dropAnimation : Ie;
6388
+ const ie = g?.dropAnimation !== void 0 ? g.dropAnimation : Oe.dropAnimation !== void 0 ? Oe.dropAnimation : Ae;
6391
6389
  let ce = a.current.translate;
6392
6390
  const Ze = ce != null;
6393
6391
  if (!ce && v !== m && (ce = { x: 0, y: 0 }), !ce || ie === null) {
@@ -6404,7 +6402,7 @@ Rf = function() {
6404
6402
  moved: Ze,
6405
6403
  transition: N,
6406
6404
  alignment: f.alignment,
6407
- styles: R,
6405
+ styles: P,
6408
6406
  animation: ie ?? void 0,
6409
6407
  getElementMutationObserver: () => Se,
6410
6408
  cleanup: ae,
@@ -7336,33 +7334,33 @@ function $b(e) {
7336
7334
  k.renderer = T;
7337
7335
  const A = [
7338
7336
  $.addEventListener("beforedragstart", (I) => {
7339
- const R = y.current;
7340
- R && E(() => R(I, k));
7337
+ const P = y.current;
7338
+ P && E(() => P(I, k));
7341
7339
  }),
7342
7340
  $.addEventListener(
7343
7341
  "dragstart",
7344
7342
  (I) => {
7345
- var R;
7346
- return (R = p.current) == null ? void 0 : R.call(p, I, k);
7343
+ var P;
7344
+ return (P = p.current) == null ? void 0 : P.call(p, I, k);
7347
7345
  }
7348
7346
  ),
7349
7347
  $.addEventListener("dragover", (I) => {
7350
- const R = m.current;
7351
- R && E(() => R(I, k));
7348
+ const P = m.current;
7349
+ P && E(() => P(I, k));
7352
7350
  }),
7353
7351
  $.addEventListener("dragmove", (I) => {
7354
- const R = x.current;
7355
- R && E(() => R(I, k));
7352
+ const P = x.current;
7353
+ P && E(() => P(I, k));
7356
7354
  }),
7357
7355
  $.addEventListener("dragend", (I) => {
7358
- const R = b.current;
7359
- R && E(() => R(I, k));
7356
+ const P = b.current;
7357
+ P && E(() => P(I, k));
7360
7358
  }),
7361
7359
  $.addEventListener(
7362
7360
  "collision",
7363
7361
  (I) => {
7364
- var R;
7365
- return (R = S.current) == null ? void 0 : R.call(S, I, k);
7362
+ var P;
7363
+ return (P = S.current) == null ? void 0 : P.call(S, I, k);
7366
7364
  }
7367
7365
  )
7368
7366
  ];
@@ -7802,11 +7800,11 @@ var Ho = 10, Jb = class extends ct {
7802
7800
  } = b.sortable, A = m !== T || x !== E, I = A ? $ : S?.element;
7803
7801
  if (!I) return;
7804
7802
  mf(I);
7805
- const R = new Bt(I);
7806
- if (!R)
7803
+ const P = new Bt(I);
7804
+ if (!P)
7807
7805
  return;
7808
7806
  const B = jt.delta(
7809
- R,
7807
+ P,
7810
7808
  jt.from(k.current.boundingRectangle),
7811
7809
  b.alignment
7812
7810
  );
@@ -8561,7 +8559,7 @@ function $0({ active: e }) {
8561
8559
  }
8562
8560
  const Oh = (e) => e.ok === !1, Ye = (e, ...t) => t.every(
8563
8561
  (n) => typeof e?.[n] == "function"
8564
- ), Or = (e) => e !== void 0 && e.ruleIndex !== void 0 && (e.childCount ?? 0) > 0, Ae = {
8562
+ ), Or = (e) => e !== void 0 && e.ruleIndex !== void 0 && (e.childCount ?? 0) > 0, Pe = {
8565
8563
  sourceDefinition: (e) => Ye(e, "sourceNameDef", "isDefine", "sqExplore"),
8566
8564
  exploreQueryDef: (e) => Ye(e, "exploreQueryNameDef", "isDefine", "vExpr"),
8567
8565
  defExploreQuery: (e) => Ye(e, "VIEW", "subQueryDefList"),
@@ -8702,9 +8700,9 @@ function So(e, t) {
8702
8700
  }
8703
8701
  const Ue = (e, t) => e[t]?.call(e), pn = (e, t) => e[t]?.call(e) ?? [];
8704
8702
  function C0(e, t) {
8705
- if (!Ae.compare(t) || (t.childCount ?? 0) !== 3) return;
8703
+ if (!Pe.compare(t) || (t.childCount ?? 0) !== 3) return;
8706
8704
  const n = t.getChild(2);
8707
- if (!Ae.givenRef(n)) return;
8705
+ if (!Pe.givenRef(n)) return;
8708
8706
  const r = e.text_(t.getChild(0)), o = e.text_(t.getChild(1)), i = e.text_(n) ?? "";
8709
8707
  if (!(r === void 0 || o === void 0))
8710
8708
  return { field: r, op: o.trim(), given: i.replace(/^\$/, "") };
@@ -8716,7 +8714,7 @@ function Mh(e, t) {
8716
8714
  for (const i of r ? pn(r, "fieldExpr") : []) {
8717
8715
  const s = e.positioned(i);
8718
8716
  if (!s) continue;
8719
- const a = Ro(i, Ae.givenRef).map((l) => e.text_(l)).filter((l) => l !== void 0).map((l) => l.replace(/^\$/, ""));
8717
+ const a = Ro(i, Pe.givenRef).map((l) => e.text_(l)).filter((l) => l !== void 0).map((l) => l.replace(/^\$/, ""));
8720
8718
  o.push({ ...s, givens: a, binding: C0(e, i) });
8721
8719
  }
8722
8720
  return { ...n, clauses: o };
@@ -8725,11 +8723,11 @@ function xa(e, t) {
8725
8723
  const n = e.span(t);
8726
8724
  if (!n) return;
8727
8725
  const r = [], o = [];
8728
- for (const u of So(t, Ae.queryStatement)) {
8726
+ for (const u of So(t, Pe.queryStatement)) {
8729
8727
  const c = e.positioned(u);
8730
8728
  c && r.push(c);
8731
8729
  const d = Ue(u, "whereStatement");
8732
- if (d && Ae.whereStatement(d)) {
8730
+ if (d && Pe.whereStatement(d)) {
8733
8731
  const f = Mh(e, d);
8734
8732
  f && o.push(f);
8735
8733
  }
@@ -8750,14 +8748,14 @@ function Wl(e, t, n) {
8750
8748
  function D0(e, t) {
8751
8749
  const n = Ue(t, "segExpr");
8752
8750
  if (!n) return { kind: "unsupported", why: "an unreadable expression" };
8753
- const r = Ae.vArrow(t);
8754
- if (Ae.segOps(n)) {
8751
+ const r = Pe.vArrow(t);
8752
+ if (Pe.segOps(n)) {
8755
8753
  const o = Ue(n, "queryProperties"), i = o && xa(e, o);
8756
8754
  return i ? { kind: "inline", stage: i, ...r ? { pipeline: !0 } : {} } : { kind: "unsupported", why: "an unreadable body" };
8757
8755
  }
8758
8756
  if (r)
8759
8757
  return { kind: "unsupported", why: "a `->` pipeline from a named view" };
8760
- if (Ae.segField(n)) {
8758
+ if (Pe.segField(n)) {
8761
8759
  const o = e.span(n);
8762
8760
  return o ? {
8763
8761
  kind: "reference",
@@ -8765,18 +8763,18 @@ function D0(e, t) {
8765
8763
  fromSpan: o
8766
8764
  } : { kind: "unsupported", why: "an unreadable name" };
8767
8765
  }
8768
- if (Ae.segRefine(n)) {
8766
+ if (Pe.segRefine(n)) {
8769
8767
  const o = pn(n, "segExpr"), i = o[0], s = o[o.length - 1];
8770
8768
  let a = i;
8771
- for (; Ae.segRefine(a); ) {
8769
+ for (; Pe.segRefine(a); ) {
8772
8770
  const f = pn(a, "segExpr");
8773
- if (f.some((h) => Ae.segOps(h) || Ae.segParen(h)))
8771
+ if (f.some((h) => Pe.segOps(h) || Pe.segParen(h)))
8774
8772
  return { kind: "unsupported", why: "a chained refinement" };
8775
8773
  a = f[0];
8776
8774
  }
8777
- if (a && Ae.segParen(a))
8775
+ if (a && Pe.segParen(a))
8778
8776
  return { kind: "unsupported", why: "a parenthesized expression" };
8779
- if (!a || !Ae.segField(a))
8777
+ if (!a || !Pe.segField(a))
8780
8778
  return {
8781
8779
  kind: "unsupported",
8782
8780
  why: "a `{ … } + { … }` compound refinement"
@@ -8784,7 +8782,7 @@ function D0(e, t) {
8784
8782
  const l = e.span(i);
8785
8783
  if (!l || !s)
8786
8784
  return { kind: "unsupported", why: "an unreadable refinement" };
8787
- if (!Ae.segOps(s)) {
8785
+ if (!Pe.segOps(s)) {
8788
8786
  const f = e.span(n);
8789
8787
  return f ? {
8790
8788
  kind: "reference",
@@ -8799,10 +8797,10 @@ function D0(e, t) {
8799
8797
  }
8800
8798
  function M0(e, t) {
8801
8799
  const n = [];
8802
- for (const r of So(t, Ae.defExploreQuery)) {
8800
+ for (const r of So(t, Pe.defExploreQuery)) {
8803
8801
  const o = e.span(r), i = Ue(r, "subQueryDefList");
8804
8802
  if (!o || !i) continue;
8805
- const s = pn(i, "exploreQueryDef").filter(Ae.exploreQueryDef), a = e.terminal(Ue(r, "VIEW"));
8803
+ const s = pn(i, "exploreQueryDef").filter(Pe.exploreQueryDef), a = e.terminal(Ue(r, "VIEW"));
8806
8804
  for (const l of s) {
8807
8805
  const u = e.span(l), c = Ue(l, "exploreQueryNameDef"), d = e.text_(c), f = Ue(l, "vExpr");
8808
8806
  !u || !d || !f || n.push({
@@ -8820,7 +8818,7 @@ function M0(e, t) {
8820
8818
  }
8821
8819
  function I0(e, t) {
8822
8820
  const n = [];
8823
- for (const r of So(t, Ae.defDimension)) {
8821
+ for (const r of So(t, Pe.defDimension)) {
8824
8822
  const o = e.span(r), i = Ue(r, "defList");
8825
8823
  if (!o || !i) continue;
8826
8824
  const s = e.terminal(Ue(r, "DIMENSION"));
@@ -8840,15 +8838,15 @@ function I0(e, t) {
8840
8838
  }
8841
8839
  function A0(e, t) {
8842
8840
  const n = [];
8843
- for (const r of Ro(t, Ae.sourceDefinition)) {
8841
+ for (const r of Ro(t, Pe.sourceDefinition)) {
8844
8842
  const o = e.span(r), i = e.text_(Ue(r, "sourceNameDef")), s = Ue(r, "sqExplore");
8845
8843
  if (!o || !i || !s) continue;
8846
- const a = e.span(s), l = a ? e.text.slice(a.start, a.end) : "", u = (/^\s*(`[^`]*`|[A-Za-z_][A-Za-z0-9_.]*)/.exec(l)?.[1] ?? "").trim(), c = So(s, Ae.exploreProperties)[0], d = c && xa(e, c), f = {
8844
+ const a = e.span(s), l = a ? e.text.slice(a.start, a.end) : "", u = (/^\s*(`[^`]*`|[A-Za-z_][A-Za-z0-9_.]*)/.exec(l)?.[1] ?? "").trim(), c = So(s, Pe.exploreProperties)[0], d = c && xa(e, c), f = {
8847
8845
  start: e.lineStarts[e.line(o.start)],
8848
8846
  end: o.end
8849
8847
  }, h = [];
8850
8848
  if (c)
8851
- for (const v of So(c, Ae.whereStatement)) {
8849
+ for (const v of So(c, Pe.whereStatement)) {
8852
8850
  const g = Mh(e, v);
8853
8851
  g && h.push(g);
8854
8852
  }
@@ -8868,7 +8866,7 @@ function A0(e, t) {
8868
8866
  }
8869
8867
  function P0(e, t) {
8870
8868
  const n = [];
8871
- for (const r of Ro(t, Ae.givenStatement)) {
8869
+ for (const r of Ro(t, Pe.givenStatement)) {
8872
8870
  const o = e.terminal(Ue(r, "GIVEN")), i = Ue(r, "givenDefList"), s = o ? e.line(o.start) : void 0;
8873
8871
  for (const a of i ? pn(i, "givenDef") : []) {
8874
8872
  const l = e.span(a), u = e.span(Ue(a, "givenNameDef")), c = u && e.text.slice(u.start, u.end);
@@ -8889,7 +8887,7 @@ function P0(e, t) {
8889
8887
  }
8890
8888
  function R0(e, t) {
8891
8889
  const n = [];
8892
- for (const r of Ro(t, Ae.importStatement)) {
8890
+ for (const r of Ro(t, Pe.importStatement)) {
8893
8891
  const o = e.span(r), i = e.text_(Ue(r, "importURL"));
8894
8892
  if (!o || i === void 0) continue;
8895
8893
  const s = Ue(r, "importSelect"), a = s ? pn(s, "importItem").map((l) => e.text_(l)).filter((l) => l !== void 0).map((l) => l.trim()) : void 0;
@@ -9435,7 +9433,7 @@ async function J0(e) {
9435
9433
  ok: !1,
9436
9434
  reason: `The tile \`${k}\` is neither a quoted \`source -> view\` expression nor a \`${E} { kind=text }\` entry, which are the only forms the builder can lay out.`
9437
9435
  };
9438
- if (y.some((P) => Pe(P) && P.name === E))
9436
+ if (y.some((R) => Me(R) && R.name === E))
9439
9437
  return {
9440
9438
  ok: !1,
9441
9439
  reason: `Two text tiles are named \`${E}\`, so the builder cannot tell them apart.`
@@ -9443,7 +9441,7 @@ async function J0(e) {
9443
9441
  y.push({
9444
9442
  kind: "text",
9445
9443
  name: E,
9446
- markdown: o.textBlocks.find((P) => P.name === E)?.body ?? "",
9444
+ markdown: o.textBlocks.find((R) => R.name === E)?.body ?? "",
9447
9445
  ...Lr({}, vs(C))
9448
9446
  });
9449
9447
  continue;
@@ -9461,11 +9459,11 @@ async function J0(e) {
9461
9459
  ok: !1,
9462
9460
  reason: `The tile \`${$}\` is neither a \`source -> view\` expression nor the name of a query, which are the forms the builder can lay out.`
9463
9461
  };
9464
- const { source: R, view: B } = I, N = w.get(R)?.get(B);
9462
+ const { source: P, view: B } = I, N = w.get(P)?.get(B);
9465
9463
  if (N === void 0) {
9466
9464
  y.push({
9467
9465
  name: B,
9468
- source: R,
9466
+ source: P,
9469
9467
  declaration: { kind: "inherited" },
9470
9468
  ...Lr({}, A)
9471
9469
  });
@@ -9475,7 +9473,7 @@ async function J0(e) {
9475
9473
  if (M === void 0) {
9476
9474
  y.push({
9477
9475
  name: B,
9478
- source: R,
9476
+ source: P,
9479
9477
  declaration: {
9480
9478
  kind: "opaque",
9481
9479
  why: N.body.kind === "unsupported" ? N.body.why : "unreadable"
@@ -9492,7 +9490,7 @@ async function J0(e) {
9492
9490
  );
9493
9491
  y.push({
9494
9492
  name: B,
9495
- source: R,
9493
+ source: P,
9496
9494
  declaration: M,
9497
9495
  ...F ? { filters: F } : {},
9498
9496
  ...Q?.text("label") ? { label: Q.text("label") } : {},
@@ -9608,7 +9606,7 @@ function Uc(e) {
9608
9606
  const t = (r) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(r) ? r : Wt(r);
9609
9607
  return `# drill { to=${e.to.length === 1 ? t(e.to[0]) : `[${e.to.map(Wt).join(", ")}]`}${e.given ? ` given=${e.given}` : ""} }`;
9610
9608
  }
9611
- const Ri = (e) => `${e.source}.${e.name}`, Wt = (e) => `"${e.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`, $a = (e) => Pe(e) ? De(["text", e.name]) : De([e.name, e.source, e.declaration]), pt = $a, Kc = (e) => De(e.tiles.map(pt));
9609
+ const Ri = (e) => `${e.source}.${e.name}`, Wt = (e) => `"${e.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`, $a = (e) => Me(e) ? De(["text", e.name]) : De([e.name, e.source, e.declaration]), pt = $a, Kc = (e) => De(e.tiles.map(pt));
9612
9610
  function iw(e, t, n) {
9613
9611
  const r = new Set(e.tiles.map(pt)), o = new Set(t.tiles.map(pt)), i = e.tiles.filter((h) => !o.has(pt(h))), s = t.tiles.filter((h) => !r.has(pt(h))), l = i.length > 0 || s.length > 0 || Kc(e) !== Kc(t);
9614
9612
  for (const h of s)
@@ -9684,7 +9682,7 @@ function Bh(e) {
9684
9682
  function Yc(e, t) {
9685
9683
  const n = aw(e);
9686
9684
  if (t === void 0) {
9687
- const c = Pe(e) ? e.name : `"${kt(e)}"`, d = [...Pe(e) ? ["kind=text"] : [], ...n];
9685
+ const c = Me(e) ? e.name : `"${kt(e)}"`, d = [...Me(e) ? ["kind=text"] : [], ...n];
9688
9686
  return d.length > 0 ? `${c} { ${d.join(" ")} }` : c;
9689
9687
  }
9690
9688
  const r = Bh(t), o = r.indexOf("{");
@@ -9752,7 +9750,7 @@ function lw(e) {
9752
9750
  }
9753
9751
  const g = o.tiles.map((p) => {
9754
9752
  const m = !s.has(pt(p)), x = v.get(
9755
- Pe(p) ? `text.${p.name}` : p.declaration.kind === "query" ? `query.${p.name}` : `${p.source}->${p.name}`
9753
+ Me(p) ? `text.${p.name}` : p.declaration.kind === "query" ? `query.${p.name}` : `${p.source}->${p.name}`
9756
9754
  );
9757
9755
  if (x === void 0) return m ? Yc(p) : void 0;
9758
9756
  const b = u.get(pt(p));
@@ -9922,14 +9920,14 @@ function fw(e) {
9922
9920
  text: ""
9923
9921
  });
9924
9922
  for (let N = w.line; N <= b; N++) d.add(N);
9925
- const $ = Math.min(w.line, ...x), A = w.blockHeader ?? $, I = (t[b + 1] ?? "x").trim() === "", R = A === 0 || t[A - 1].trim() === "", B = w.blockHeader === void 0 || ![...c.values()].some(
9923
+ const $ = Math.min(w.line, ...x), A = w.blockHeader ?? $, I = (t[b + 1] ?? "x").trim() === "", P = A === 0 || t[A - 1].trim() === "", B = w.blockHeader === void 0 || ![...c.values()].some(
9926
9924
  (N) => N.blockHeader === w.blockHeader && N.line > w.line && u.has(
9927
9925
  [...c.entries()].find(
9928
9926
  ([, Q]) => Q === N
9929
9927
  )?.[0] ?? ""
9930
9928
  )
9931
9929
  );
9932
- I && R && B && !d.has(b + 1) && (s.push({ ...n(b + 1), text: "" }), d.add(b + 1));
9930
+ I && P && B && !d.has(b + 1) && (s.push({ ...n(b + 1), text: "" }), d.add(b + 1));
9933
9931
  continue;
9934
9932
  }
9935
9933
  const S = r(w.line), k = Gc(g), E = g.type !== v.type || g.default !== v.default ? w.blockHeader === void 0 ? qc(g) : `${g.name} :: ${g.type} is ${g.default}` : t.slice(w.line, b + 1).join(`
@@ -10079,7 +10077,7 @@ function pw(e) {
10079
10077
  function gw(e) {
10080
10078
  const { lines: t, wholeLine: n, removedTiles: r, edits: o, parsed: i } = e;
10081
10079
  for (const s of r) {
10082
- if (Pe(s) || gr(s)) continue;
10080
+ if (Me(s) || gr(s)) continue;
10083
10081
  const a = Hh(e, s);
10084
10082
  if (!a)
10085
10083
  return {
@@ -10117,7 +10115,7 @@ function mw(e) {
10117
10115
  parsed: l
10118
10116
  } = e, u = /* @__PURE__ */ new Map();
10119
10117
  for (const f of o) {
10120
- if (Pe(f)) continue;
10118
+ if (Me(f)) continue;
10121
10119
  const h = u.get(f.source) ?? [];
10122
10120
  h.push(f), u.set(f.source, h);
10123
10121
  }
@@ -10197,7 +10195,7 @@ function vw(e) {
10197
10195
  const { lines: t, starts: n, wholeLine: r, indentOf: o, current: i, next: s, edits: a, parsed: l } = e, u = new Map(i.tiles.map((c) => [pt(c), c]));
10198
10196
  for (const c of s.tiles) {
10199
10197
  const d = u.get(pt(c));
10200
- if (d === void 0 || Pe(c) || Pe(d)) continue;
10198
+ if (d === void 0 || Me(c) || Me(d)) continue;
10201
10199
  const f = Ea(d, c), h = De(Vc(Li(d))) !== De(Vc(Li(c)));
10202
10200
  if (!h && !f) continue;
10203
10201
  if (c.declaration.kind === "inherited") {
@@ -10224,13 +10222,13 @@ function vw(e) {
10224
10222
  y.map((A) => [ai(A) ?? A, A])
10225
10223
  ), m = /* @__PURE__ */ new Set(), x = zh(c.chart), b = Qc(d) !== Qc(c);
10226
10224
  if (b) {
10227
- const A = g.filter((B) => jl(B.text)), I = g.filter((B) => es(B.text)), R = d.chart === "custom" ? g.filter(
10225
+ const A = g.filter((B) => jl(B.text)), I = g.filter((B) => es(B.text)), P = d.chart === "custom" ? g.filter(
10228
10226
  (B) => es(B.text) || jl(B.text)
10229
10227
  ) : A.length > 0 ? A : I.length > 1 ? I : [];
10230
- if (R.length > 0)
10228
+ if (P.length > 0)
10231
10229
  return {
10232
10230
  ok: !1,
10233
- reason: `\`${c.source} -> ${c.name}\` has a chart line the builder does not model (${R.map((B) => B.text).join(" and ")}), so its chart cannot be changed here.`
10231
+ reason: `\`${c.source} -> ${c.name}\` has a chart line the builder does not model (${P.map((B) => B.text).join(" and ")}), so its chart cannot be changed here.`
10234
10232
  };
10235
10233
  }
10236
10234
  let S = !1;
@@ -10249,12 +10247,12 @@ function vw(e) {
10249
10247
  f && a.push({ ...r(A.line), text: "" });
10250
10248
  continue;
10251
10249
  }
10252
- const R = p.get(I);
10253
- if (R === void 0) {
10250
+ const P = p.get(I);
10251
+ if (P === void 0) {
10254
10252
  a.push({ ...r(A.line), text: "" });
10255
10253
  continue;
10256
10254
  }
10257
- m.add(I), R !== A.text && a.push({ ...r(A.line), text: `${w}${R}
10255
+ m.add(I), P !== A.text && a.push({ ...r(A.line), text: `${w}${P}
10258
10256
  ` });
10259
10257
  }
10260
10258
  const k = y.filter((A) => !m.has(ai(A) ?? A));
@@ -10330,8 +10328,8 @@ ${e.markdown === "" ? "" : `${e.markdown}
10330
10328
  `;
10331
10329
  function ww(e) {
10332
10330
  const { sourceText: t, lines: n, wholeLine: r, current: o, next: i, parsed: s, edits: a } = e, l = new Map(
10333
- o.tiles.filter(Pe).map((h) => [h.name, h])
10334
- ), u = i.tiles.filter(Pe), c = (h) => s.textBlocks.find((v) => v.name === h), d = new Set(u.map((h) => h.name));
10331
+ o.tiles.filter(Me).map((h) => [h.name, h])
10332
+ ), u = i.tiles.filter(Me), c = (h) => s.textBlocks.find((v) => v.name === h), d = new Set(u.map((h) => h.name));
10335
10333
  for (const h of l.keys()) {
10336
10334
  const v = d.has(h) ? void 0 : c(h);
10337
10335
  if (!v) continue;
@@ -10402,10 +10400,10 @@ function xw(e, t) {
10402
10400
  const r = /* @__PURE__ */ new Set();
10403
10401
  for (const s of t.tiles) {
10404
10402
  const a = n.get(pt(s));
10405
- if (Pe(s)) {
10403
+ if (Me(s)) {
10406
10404
  const d = bw(
10407
10405
  s,
10408
- a && Pe(a) ? a : void 0,
10406
+ a && Me(a) ? a : void 0,
10409
10407
  r
10410
10408
  );
10411
10409
  if (d) return d;
@@ -10665,7 +10663,7 @@ async function Jc(e, t, n) {
10665
10663
  }
10666
10664
  const g = (p) => {
10667
10665
  const { drills: m, localGivens: x, description: b, ...S } = p, k = p.tiles.map((T) => {
10668
- if (Pe(T)) return T;
10666
+ if (Me(T)) return T;
10669
10667
  if (T.filters?.length) return Li(T);
10670
10668
  const { filters: E, ...$ } = T;
10671
10669
  return Li($);
@@ -10841,20 +10839,33 @@ function Kh({
10841
10839
  const Ew = "Write markdown: # heading, **bold**, - list";
10842
10840
  function Tw({
10843
10841
  tile: e,
10844
- onChange: t
10842
+ sized: t = !1,
10843
+ onChange: n
10845
10844
  }) {
10846
- return (
10847
- // Overflow shown: the open editor's ring and hint stand a few pixels
10848
- // outside the prose, which a clipping frame cut off.
10845
+ const r = (
10846
+ // Overflow shown on the frame itself: the open editor's ring and hint stand a few
10847
+ // pixels outside the prose, which a clipping frame cut off.
10849
10848
  /* @__PURE__ */ _(hd, { sx: { overflow: "visible" }, children: /* @__PURE__ */ _(
10850
10849
  Kh,
10851
10850
  {
10852
10851
  markdown: e.markdown,
10853
10852
  placeholder: Ew,
10854
- onCommit: t
10853
+ onCommit: n
10855
10854
  }
10856
10855
  ) })
10857
10856
  );
10857
+ return t ? (
10858
+ // The scroller sits outside the frame, with the ring's few pixels of room folded in,
10859
+ // so the ring still shows and the prose still stops at the tile's edge.
10860
+ /* @__PURE__ */ _(
10861
+ H,
10862
+ {
10863
+ "data-testid": "text-tile-scroller",
10864
+ sx: { minHeight: 0, overflow: "auto", p: "4px", m: "-4px" },
10865
+ children: r
10866
+ }
10867
+ )
10868
+ ) : r;
10858
10869
  }
10859
10870
  var Ow = Object.defineProperty, Cw = Object.defineProperties, Dw = Object.getOwnPropertyDescriptors, ed = Object.getOwnPropertySymbols, Mw = Object.prototype.hasOwnProperty, Iw = Object.prototype.propertyIsEnumerable, td = (e, t, n) => t in e ? Ow(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Gn = (e, t) => {
10860
10871
  for (var n in t || (t = {}))
@@ -11171,23 +11182,23 @@ function Fw({
11171
11182
  const p = w.base[w.index];
11172
11183
  if (!p) return;
11173
11184
  const x = pi(y.width, t) + bt, b = g.clientX - y.left, S = g.clientY - y.top, k = g.currentTarget.parentElement?.getBoundingClientRect(), T = k?.top ?? w.top, E = k?.left ?? w.left, { min: $ } = w, A = w.shape;
11174
- let { row: I, col: R, colspan: B, rowspan: N } = A;
11175
- if (w.placed && R !== void 0 && I !== void 0) {
11176
- const M = w.from, F = M.col ?? R, C = F + M.colspan - 1, O = M.row ?? I, P = M.rowspan ?? fo(p), U = O + P - 1;
11185
+ let { row: I, col: P, colspan: B, rowspan: N } = A;
11186
+ if (w.placed && P !== void 0 && I !== void 0) {
11187
+ const M = w.from, F = M.col ?? P, C = F + M.colspan - 1, O = M.row ?? I, R = M.rowspan ?? fo(p), U = O + R - 1;
11177
11188
  if (w.edges.e) {
11178
11189
  const G = Math.round((b + bt) / x);
11179
- B = Math.min(Math.max(G, F), t) - F + 1, R = F;
11190
+ B = Math.min(Math.max(G, F), t) - F + 1, P = F;
11180
11191
  }
11181
11192
  if (w.edges.w) {
11182
11193
  const G = Math.round(b / x) + 1;
11183
- R = Math.min(Math.max(G, 1), C), B = C - R + 1;
11194
+ P = Math.min(Math.max(G, 1), C), B = C - P + 1;
11184
11195
  }
11185
11196
  if (w.edges.s) {
11186
11197
  const G = w.edges.n ? y.top + (O - 1) * nd : T;
11187
11198
  N = Hl(g.clientY - G, $), I = O;
11188
11199
  }
11189
11200
  if (w.edges.n) {
11190
- const G = Math.round(S / nd) + 1, Y = Math.min($, P);
11201
+ const G = Math.round(S / nd) + 1, Y = Math.min($, R);
11191
11202
  I = Math.max(
11192
11203
  1,
11193
11204
  Math.min(
@@ -11210,7 +11221,7 @@ function Fw({
11210
11221
  }
11211
11222
  const Q = {
11212
11223
  ...I !== void 0 ? { row: I } : {},
11213
- ...R !== void 0 ? { col: R } : {},
11224
+ ...P !== void 0 ? { col: P } : {},
11214
11225
  colspan: B,
11215
11226
  rowspan: N
11216
11227
  };
@@ -11369,7 +11380,7 @@ function jw({
11369
11380
  inset: i ? gd : 0
11370
11381
  }
11371
11382
  ),
11372
- !Pe(e) && /* @__PURE__ */ _(
11383
+ !Me(e) && /* @__PURE__ */ _(
11373
11384
  Dn,
11374
11385
  {
11375
11386
  className: "builder-affordance",
@@ -11798,11 +11809,11 @@ function Xw({
11798
11809
  const { dragging: m, preview: x, onDragStart: b, onDragMove: S, onDragOver: k, onDragEnd: T } = t, { columns: E } = a, $ = n.drag, A = (C) => C.colspan === void 0 ? { ...C, colspan: s } : C, I = ($ !== void 0 ? (() => {
11799
11810
  const C = $.placedHere ? $.base : e.document.tiles;
11800
11811
  if (!C[$.index]) return C;
11801
- const P = C.map(
11812
+ const R = C.map(
11802
11813
  (U, G) => G === $.index ? Qh(U, $.shape, $.edges, $.placed) : U
11803
11814
  );
11804
- return $.placed ? Xt(P, E, $.index) : P;
11805
- })() : x ?? e.document.tiles).map(A), R = dn(I), B = m || $ !== void 0, N = !B && R && o && u !== void 0, Q = e.document.tiles.length === 0, M = B && !R ? Hb(I, E) : I.map(ph), F = (C) => Qw(C, Fi(C), y);
11815
+ return $.placed ? Xt(R, E, $.index) : R;
11816
+ })() : x ?? e.document.tiles).map(A), P = dn(I), B = m || $ !== void 0, N = !B && P && o && u !== void 0, Q = e.document.tiles.length === 0, M = B && !P ? Hb(I, E) : I.map(ph), F = (C) => Qw(C, Fi(C), y);
11806
11817
  return /* @__PURE__ */ L(Fe, { children: [
11807
11818
  /* @__PURE__ */ L(
11808
11819
  $b,
@@ -11818,7 +11829,7 @@ function Xw({
11818
11829
  a.widths && (B || N) && /* @__PURE__ */ _(qw, { columns: E, faint: !B }),
11819
11830
  $ !== void 0 && !$.placed ? ($.edges.s || $.edges.n) && /* @__PURE__ */ _(id, { top: $.guideTop }) : (
11820
11831
  // Placed, a move snaps to rows as well as columns.
11821
- R && (B || N) && /* @__PURE__ */ _(id, { top: 0, faint: !B })
11832
+ P && (B || N) && /* @__PURE__ */ _(id, { top: 0, faint: !B })
11822
11833
  ),
11823
11834
  /* @__PURE__ */ _(
11824
11835
  Ip,
@@ -11831,18 +11842,18 @@ function Xw({
11831
11842
  renderTile: (C) => {
11832
11843
  if (C.kind === "gap")
11833
11844
  return /* @__PURE__ */ _(Gw, { after: C.after });
11834
- const { tile: O, index: P } = C;
11845
+ const { tile: O, index: R } = C;
11835
11846
  return /* @__PURE__ */ _(
11836
11847
  jw,
11837
11848
  {
11838
11849
  tile: O,
11839
- index: P,
11840
- selected: P === u,
11850
+ index: R,
11851
+ selected: R === u,
11841
11852
  flash: me(O) === c,
11842
- menuOpen: d === P,
11843
- bare: Pe(O),
11844
- ...a.insertBetween && l && P < e.document.tiles.length - 1 ? {
11845
- onInsertAfter: () => w(P + 1)
11853
+ menuOpen: d === R,
11854
+ bare: Me(O),
11855
+ ...a.insertBetween && l && R < e.document.tiles.length - 1 ? {
11856
+ onInsertAfter: () => w(R + 1)
11846
11857
  } : {},
11847
11858
  fixed: !o,
11848
11859
  ...a.widths ? {
@@ -11851,10 +11862,10 @@ function Xw({
11851
11862
  // need the grid drawn as a grid.
11852
11863
  all: o,
11853
11864
  right: o,
11854
- start: (U, G) => n.start(U, P, G),
11865
+ start: (U, G) => n.start(U, R, G),
11855
11866
  move: n.move,
11856
11867
  end: n.end,
11857
- ...$?.index === P ? { label: Bw($, E) } : {}
11868
+ ...$?.index === R ? { label: Bw($, E) } : {}
11858
11869
  }
11859
11870
  } : {},
11860
11871
  ...a.widths && o ? {
@@ -11864,17 +11875,17 @@ function Xw({
11864
11875
  max: Wd(O, E),
11865
11876
  onStep: (U) => {
11866
11877
  U !== (O.colspan ?? 1) && e.update((G) => {
11867
- if (!Number.isInteger(P) || P < 0)
11878
+ if (!Number.isInteger(R) || R < 0)
11868
11879
  return;
11869
- const Y = G.tiles[P];
11870
- Y && (G.tiles[P] = Ss(
11880
+ const Y = G.tiles[R];
11881
+ Y && (G.tiles[R] = Ss(
11871
11882
  Y,
11872
11883
  U,
11873
11884
  E,
11874
11885
  s
11875
11886
  )), G.tiles = r(
11876
11887
  G.tiles,
11877
- P
11888
+ R
11878
11889
  );
11879
11890
  });
11880
11891
  }
@@ -11886,26 +11897,27 @@ function Xw({
11886
11897
  min: hi(O),
11887
11898
  minFor: (U) => hi(O, U),
11888
11899
  onStep: (U) => e.update((G) => {
11889
- if (!Number.isInteger(P) || P < 0)
11900
+ if (!Number.isInteger(R) || R < 0)
11890
11901
  return;
11891
- const Y = G.tiles[P];
11902
+ const Y = G.tiles[R];
11892
11903
  Y && (U === void 0 ? delete Y.rowspan : Y.rowspan = U, G.tiles = r(
11893
11904
  G.tiles,
11894
- P
11905
+ R
11895
11906
  ));
11896
11907
  })
11897
11908
  }
11898
11909
  } : {},
11899
- onSelect: () => f(P),
11900
- onOpenMenu: (U) => h(U, P),
11901
- onRemove: () => v(P),
11910
+ onSelect: () => f(R),
11911
+ onOpenMenu: (U) => h(U, R),
11912
+ onRemove: () => v(R),
11902
11913
  ...g ? { removeBlocked: g } : {},
11903
- children: Pe(O) ? /* @__PURE__ */ _(
11914
+ children: Me(O) ? /* @__PURE__ */ _(
11904
11915
  Tw,
11905
11916
  {
11906
11917
  tile: O,
11918
+ sized: O.rowspan !== void 0 || P,
11907
11919
  onChange: (U) => y(me(O), (G) => {
11908
- Pe(G) && (G.markdown = U);
11920
+ Me(G) && (G.markdown = U);
11909
11921
  })
11910
11922
  }
11911
11923
  ) : p ? p(O, F(O), "card") : /* @__PURE__ */ _(
@@ -12455,7 +12467,7 @@ function ax({
12455
12467
  const I = le(() => {
12456
12468
  const M = () => A.current();
12457
12469
  return u ? u(M) : M();
12458
- }, [u]), R = sx({
12470
+ }, [u]), P = sx({
12459
12471
  dirty: p,
12460
12472
  saving: d,
12461
12473
  canSave: !!t,
@@ -12472,9 +12484,9 @@ function ax({
12472
12484
  ...t ? { save: I } : {},
12473
12485
  // Paused by the exit dialog, or by the builder itself (an edge
12474
12486
  // dragged, whose release would write over a mid-drag undo).
12475
- paused: R.dialog.open || c.paused === !0
12487
+ paused: P.dialog.open || c.paused === !0
12476
12488
  }),
12477
- [c, e, t, I, R.dialog.open]
12489
+ [c, e, t, I, P.dialog.open]
12478
12490
  )
12479
12491
  );
12480
12492
  const B = !!t && !d && e.canUndoSave, N = e.lastSave, Q = {
@@ -12486,14 +12498,14 @@ function ax({
12486
12498
  saving: d,
12487
12499
  saveButton: g,
12488
12500
  ...t ? { onSave: I } : {},
12489
- ...r ? { onExit: R.requestExit } : {}
12501
+ ...r ? { onExit: P.requestExit } : {}
12490
12502
  };
12491
12503
  return {
12492
12504
  saving: d,
12493
12505
  save: I,
12494
- exitGuard: R,
12506
+ exitGuard: P,
12495
12507
  /** Write the edits, then leave; absent unless the host can be left (`onExit`). */
12496
- ...r ? { done: R.saveAndExit } : {},
12508
+ ...r ? { done: P.saveAndExit } : {},
12497
12509
  /** Write the file back as it was before the last save, and put the edits back unsaved. */
12498
12510
  undoSave: E,
12499
12511
  canUndoSave: B,
@@ -12699,11 +12711,11 @@ function hx(e) {
12699
12711
  const m = q(!1), [x, b] = j(!1), S = (O) => {
12700
12712
  m.current = O, b(O);
12701
12713
  }, [k, T] = j(void 0), E = le((O) => {
12702
- c(void 0), s((P) => {
12703
- const U = structuredClone(P.stack[P.index]);
12704
- if (O(U), JSON.stringify(U) === JSON.stringify(P.stack[P.index]))
12705
- return P;
12706
- const Y = [...P.stack.slice(0, P.index + 1), U].slice(-100);
12714
+ c(void 0), s((R) => {
12715
+ const U = structuredClone(R.stack[R.index]);
12716
+ if (O(U), JSON.stringify(U) === JSON.stringify(R.stack[R.index]))
12717
+ return R;
12718
+ const Y = [...R.stack.slice(0, R.index + 1), U].slice(-100);
12707
12719
  return { stack: Y, index: Y.length - 1 };
12708
12720
  });
12709
12721
  }, []), $ = le(() => {
@@ -12715,9 +12727,9 @@ function hx(e) {
12715
12727
  (O) => O.index < O.stack.length - 1 ? { ...O, index: O.index + 1 } : O
12716
12728
  );
12717
12729
  }, []), I = le(
12718
- async (O, P) => {
12730
+ async (O, R) => {
12719
12731
  try {
12720
- return await t(O, P);
12732
+ return await t(O, R);
12721
12733
  } catch (U) {
12722
12734
  return {
12723
12735
  ok: !1,
@@ -12726,7 +12738,7 @@ function hx(e) {
12726
12738
  }
12727
12739
  },
12728
12740
  [t]
12729
- ), R = le(async () => {
12741
+ ), P = le(async () => {
12730
12742
  if (m.current)
12731
12743
  return { ok: !1, reason: "A save is still being written." };
12732
12744
  const O = {
@@ -12735,7 +12747,7 @@ function hx(e) {
12735
12747
  history: p.current,
12736
12748
  replacing: h,
12737
12749
  unwritten: g
12738
- }, P = o?.(d, y) ?? !1, U = r?.(d, y) ?? !1;
12750
+ }, R = o?.(d, y) ?? !1, U = r?.(d, y) ?? !1;
12739
12751
  S(!0);
12740
12752
  try {
12741
12753
  const G = await I(a, y);
@@ -12748,9 +12760,9 @@ function hx(e) {
12748
12760
  return c(_e), { ok: !1, reason: _e };
12749
12761
  }
12750
12762
  l(G.source), f(y), v(void 0), w(!1);
12751
- const Y = P ? { stack: [y], index: 0 } : O.history;
12763
+ const Y = R ? { stack: [y], index: 0 } : O.history;
12752
12764
  return s(
12753
- (oe) => oe === O.history ? Y : P ? { stack: [oe.stack[oe.index]], index: 0 } : oe
12765
+ (oe) => oe === O.history ? Y : R ? { stack: [oe.stack[oe.index]], index: 0 } : oe
12754
12766
  ), T(
12755
12767
  n ? {
12756
12768
  before: O,
@@ -12759,7 +12771,7 @@ function hx(e) {
12759
12771
  before: h ?? a,
12760
12772
  after: G.source,
12761
12773
  structural: U,
12762
- clearsHistory: P
12774
+ clearsHistory: R
12763
12775
  }
12764
12776
  } : void 0
12765
12777
  ), c(void 0), { ok: !0 };
@@ -12788,13 +12800,13 @@ function hx(e) {
12788
12800
  purpose: "undo",
12789
12801
  document: O.saved
12790
12802
  });
12791
- } catch (P) {
12792
- const U = `Could not undo the save: ${P instanceof Error ? P.message : String(P)}`;
12803
+ } catch (R) {
12804
+ const U = `Could not undo the save: ${R instanceof Error ? R.message : String(R)}`;
12793
12805
  return c(U), { ok: !1, reason: U };
12794
12806
  } finally {
12795
12807
  S(!1);
12796
12808
  }
12797
- return l(O.source), f(O.saved), v(O.replacing), w(O.unwritten || O.replacing !== void 0), s((P) => P === k.after ? O.history : P), T(void 0), c(void 0), { ok: !0 };
12809
+ return l(O.source), f(O.saved), v(O.replacing), w(O.unwritten || O.replacing !== void 0), s((R) => R === k.after ? O.history : R), T(void 0), c(void 0), { ok: !0 };
12798
12810
  }, [n, k]), N = V(
12799
12811
  () => g || JSON.stringify(y) !== JSON.stringify(d),
12800
12812
  [y, d, g]
@@ -12820,7 +12832,7 @@ function hx(e) {
12820
12832
  update: E,
12821
12833
  undo: $,
12822
12834
  redo: A,
12823
- save: R,
12835
+ save: P,
12824
12836
  preview: C,
12825
12837
  structural: Q,
12826
12838
  clearsHistory: M,
@@ -12896,7 +12908,7 @@ function vx({
12896
12908
  }, g = () => y(c), w = () => y(void 0), y = (b) => {
12897
12909
  u(!1), e.update((S) => {
12898
12910
  const k = new Set(
12899
- S.tiles.filter(Pe).map((E) => E.name)
12911
+ S.tiles.filter(Me).map((E) => E.name)
12900
12912
  );
12901
12913
  let T = 1;
12902
12914
  for (; k.has(`text_${T}`); ) T++;
@@ -13031,14 +13043,14 @@ function ip({
13031
13043
  ...p ? { visibleSources: p } : {}
13032
13044
  }), $ = jp(T, E, e), A = q(null), {
13033
13045
  selected: I,
13034
- descriptionSelected: R,
13046
+ descriptionSelected: P,
13035
13047
  selectTile: B,
13036
13048
  deselectTile: N,
13037
13049
  selectDescription: Q,
13038
13050
  clearSelection: M,
13039
13051
  flash: F,
13040
13052
  stepEditor: C
13041
- } = ox({ editor: E, gridBox: A }), O = vd(E.document.layout, E.document.columns), { columns: P } = O, U = y?.split("/").at(-1)?.replace(/\.malloy$/, ""), G = Ed("(min-width:900px)", {
13053
+ } = ox({ editor: E, gridBox: A }), O = vd(E.document.layout, E.document.columns), { columns: R } = O, U = y?.split("/").at(-1)?.replace(/\.malloy$/, ""), G = Ed("(min-width:900px)", {
13042
13054
  defaultMatches: !0,
13043
13055
  noSsr: !0
13044
13056
  }), Y = !O.widths || G, oe = Lw({
@@ -13047,34 +13059,34 @@ function ip({
13047
13059
  ae.tiles = X;
13048
13060
  }),
13049
13061
  onLanded: B,
13050
- ...O.widths && G ? { placement: { columns: P, gridBox: A } } : {}
13062
+ ...O.widths && G ? { placement: { columns: R, gridBox: A } } : {}
13051
13063
  }), _e = (X, ae) => {
13052
13064
  if (E.update((Oe) => {
13053
13065
  Oe.tiles = X;
13054
13066
  }), ae === void 0) return;
13055
- const Ie = X.findIndex((Oe) => me(Oe) === ae);
13056
- Ie >= 0 && B(Ie);
13067
+ const Ae = X.findIndex((Oe) => me(Oe) === ae);
13068
+ Ae >= 0 && B(Ae);
13057
13069
  }, $e = O.widths, se = le(
13058
- (X, ae) => $e && dn(X) ? Xt(X, P, ae) : X,
13059
- [$e, P]
13060
- ), { dragging: Re } = oe, be = Hp(A, P), xe = V(
13070
+ (X, ae) => $e && dn(X) ? Xt(X, R, ae) : X,
13071
+ [$e, R]
13072
+ ), { dragging: Re } = oe, be = Hp(A, R), xe = V(
13061
13073
  () => E.document.tiles.map(
13062
13074
  (X) => X.colspan === void 0 ? { ...X, colspan: be } : X
13063
13075
  ),
13064
13076
  [E.document.tiles, be]
13065
13077
  ), Ve = Fw({
13066
13078
  tiles: xe,
13067
- columns: P,
13079
+ columns: R,
13068
13080
  gridBox: A,
13069
13081
  onStart: B,
13070
- commit: ({ index: X, edges: ae, shape: Ie, placed: Oe, placedAll: mn }) => {
13082
+ commit: ({ index: X, edges: ae, shape: Ae, placed: Oe, placedAll: mn }) => {
13071
13083
  const ie = mn ?? E.document.tiles, ce = ie[X];
13072
13084
  if (!ce) return;
13073
- let Ze = Qh(ce, Ie, ae, Oe);
13074
- (ae.e || ae.w) && (Ze = Ss(Ze, Ie.colspan, P, be));
13085
+ let Ze = Qh(ce, Ae, ae, Oe);
13086
+ (ae.e || ae.w) && (Ze = Ss(Ze, Ae.colspan, R, be));
13075
13087
  const At = ie.map((Dr, Wn) => Wn === X ? Ze : Dr);
13076
13088
  _e(
13077
- Oe ? Jn(Xt(At, P, X)) : At,
13089
+ Oe ? Jn(Xt(At, R, X)) : At,
13078
13090
  me(ce)
13079
13091
  );
13080
13092
  }
@@ -13085,12 +13097,12 @@ function ip({
13085
13097
  textHeld: p !== void 0,
13086
13098
  selectTile: B,
13087
13099
  deselectTile: N
13088
- }), { menu: tt, addingTile: Ee, openAdd: ge } = ee, Me = fx({
13100
+ }), { menu: tt, addingTile: Ee, openAdd: ge } = ee, Ie = fx({
13089
13101
  editor: E,
13090
13102
  opened: t,
13091
13103
  givens: u,
13092
13104
  catalog: c
13093
- }), { filterDialog: Be, setFilterDialog: de } = Me, [Qe, nt] = j(
13105
+ }), { filterDialog: Be, setFilterDialog: de } = Ie, [Qe, nt] = j(
13094
13106
  void 0
13095
13107
  ), { draftDirty: D, openDraft: W, prepare: K } = mx({
13096
13108
  editorDirty: E.dirty
@@ -13110,22 +13122,22 @@ function ip({
13110
13122
  move: (X, ae) => {
13111
13123
  if (Re || I === void 0 || !O.widths || !Y)
13112
13124
  return !1;
13113
- const Ie = E.document.tiles[I];
13114
- if (!Ie || Ie.row === void 0 || Ie.col === void 0)
13125
+ const Ae = E.document.tiles[I];
13126
+ if (!Ae || Ae.row === void 0 || Ae.col === void 0)
13115
13127
  return !1;
13116
13128
  const Oe = Vl(
13117
13129
  E.document.tiles,
13118
13130
  I,
13119
13131
  X,
13120
13132
  ae,
13121
- P
13133
+ R
13122
13134
  );
13123
13135
  if (Oe.every((ce, Ze) => ce === E.document.tiles[Ze]))
13124
13136
  return !0;
13125
- const mn = me(Ie);
13137
+ const mn = me(Ae);
13126
13138
  E.update((ce) => {
13127
13139
  ce.tiles = Jn(
13128
- Vl(ce.tiles, I, X, ae, P)
13140
+ Vl(ce.tiles, I, X, ae, R)
13129
13141
  );
13130
13142
  });
13131
13143
  const ie = Jn(Oe).findIndex(
@@ -13138,16 +13150,16 @@ function ip({
13138
13150
  return;
13139
13151
  const ae = E.document.tiles[I];
13140
13152
  if (!ae) return;
13141
- const Ie = Gp(
13153
+ const Ae = Gp(
13142
13154
  ae.colspan ?? be,
13143
13155
  X,
13144
- Wd(ae, P)
13156
+ Wd(ae, R)
13145
13157
  );
13146
- Ie !== (ae.colspan ?? be) && E.update((Oe) => {
13158
+ Ae !== (ae.colspan ?? be) && E.update((Oe) => {
13147
13159
  Oe.tiles[I] = Ss(
13148
13160
  Oe.tiles[I],
13149
- Ie,
13150
- P,
13161
+ Ae,
13162
+ R,
13151
13163
  be
13152
13164
  ), Oe.tiles = se(Oe.tiles, I);
13153
13165
  });
@@ -13166,7 +13178,7 @@ function ip({
13166
13178
  Qe,
13167
13179
  M,
13168
13180
  I,
13169
- P,
13181
+ R,
13170
13182
  O,
13171
13183
  Re
13172
13184
  ]
@@ -13200,9 +13212,9 @@ function ip({
13200
13212
  ...J ? { restored: J } : {},
13201
13213
  ...J && !J.pending ? { dismissRestored: $.dismissRestored } : {}
13202
13214
  }, He = E.document.tiles, xt = I !== void 0 && He[I] ? me(He[I]) : void 0, ve = O.widths && Y && dn(He) ? {
13203
- ...Zg(He, P) ? {
13215
+ ...Zg(He, R) ? {
13204
13216
  pack: () => _e(
13205
- Jn(Ld(He, P)),
13217
+ Jn(Ld(He, R)),
13206
13218
  xt
13207
13219
  )
13208
13220
  } : {},
@@ -13268,25 +13280,25 @@ function ip({
13268
13280
  editor: E,
13269
13281
  documentSlug: U,
13270
13282
  actions: dt,
13271
- descriptionSelected: R,
13283
+ descriptionSelected: P,
13272
13284
  selectDescription: Q
13273
13285
  }
13274
13286
  ),
13275
13287
  controls: Et ? void 0 : /* @__PURE__ */ _(
13276
13288
  nx,
13277
13289
  {
13278
- controls: Me.controlList,
13279
- unknownFieldsOf: Me.unknownFieldsOf,
13290
+ controls: Ie.controlList,
13291
+ unknownFieldsOf: Ie.unknownFieldsOf,
13280
13292
  onEdit: (X) => de({ control: X }),
13281
13293
  onAdd: () => de({}),
13282
13294
  ...m ? { addDisabledReason: m } : {},
13283
- onRemove: Me.dropControl,
13295
+ onRemove: Ie.dropControl,
13284
13296
  ...x ? { fixedFilters: x } : {},
13285
13297
  ...b ? { onOpenModel: b } : {},
13286
13298
  ...E.document.startingGivens ? { startingValues: E.document.startingGivens } : {},
13287
- onStartingValue: (X, ae) => E.update((Ie) => {
13288
- const Oe = { ...Ie.startingGivens ?? {} };
13289
- ae === void 0 ? delete Oe[X] : Oe[X] = ae, Object.keys(Oe).length > 0 ? Ie.startingGivens = Oe : delete Ie.startingGivens;
13299
+ onStartingValue: (X, ae) => E.update((Ae) => {
13300
+ const Oe = { ...Ae.startingGivens ?? {} };
13301
+ ae === void 0 ? delete Oe[X] : Oe[X] = ae, Object.keys(Oe).length > 0 ? Ae.startingGivens = Oe : delete Ae.startingGivens;
13290
13302
  }),
13291
13303
  children: l
13292
13304
  }
@@ -13383,9 +13395,9 @@ function ip({
13383
13395
  {
13384
13396
  editor: E,
13385
13397
  catalog: c,
13386
- columns: P,
13398
+ columns: R,
13387
13399
  dashboards: f,
13388
- bindings: Me,
13400
+ bindings: Ie,
13389
13401
  tiles: ee,
13390
13402
  drillSource: Qe,
13391
13403
  setDrillSource: nt,
@@ -13892,33 +13904,33 @@ function Ix({
13892
13904
  ...e?.givens ? { givens: e.givens } : {}
13893
13905
  },
13894
13906
  { enabled: e !== void 0 && $.text !== void 0 }
13895
- ), I = A.data?.document, R = e ? A.isSuccess ? I?.manifest ?? Mx : void 0 : S, B = e ? A.isSuccess : k, N = e ? A.isError || $.problem !== void 0 : T, Q = e ? eg(I?.cells) : void 0, M = (A.data?.result.problems ?? []).filter(
13907
+ ), I = A.data?.document, P = e ? A.isSuccess ? I?.manifest ?? Mx : void 0 : S, B = e ? A.isSuccess : k, N = e ? A.isError || $.problem !== void 0 : T, Q = e ? eg(I?.cells) : void 0, M = (A.data?.result.problems ?? []).filter(
13896
13908
  (z) => z.severity === "error"
13897
13909
  ), F = V(
13898
13910
  () => new Set(e?.hiddenGivens ?? []),
13899
13911
  [e]
13900
13912
  ), C = e?.givens, O = V(
13901
13913
  () => new Set(
13902
- (R?.tiles ?? []).flatMap(
13914
+ (P?.tiles ?? []).flatMap(
13903
13915
  (z) => z.restricted && z.query ? [Ut(z.query)] : []
13904
13916
  )
13905
13917
  ),
13906
- [R]
13907
- ), { reports: P, settled: U } = tg(
13918
+ [P]
13919
+ ), { reports: R, settled: U } = tg(
13908
13920
  t,
13909
13921
  n,
13910
13922
  i
13911
13923
  ), G = V(
13912
- () => P.map((z) => z.path).filter(
13924
+ () => R.map((z) => z.path).filter(
13913
13925
  (z) => !!z && z !== r && z.endsWith(".malloy")
13914
13926
  ).map((z) => z.replace(/\.malloy$/, "")),
13915
- [P, r]
13927
+ [R, r]
13916
13928
  ), Y = Dx({
13917
13929
  environmentName: t,
13918
13930
  packageName: n,
13919
13931
  ...i !== void 0 ? { versionId: i } : {},
13920
13932
  modelPath: r,
13921
- reports: P,
13933
+ reports: R,
13922
13934
  reportsSettled: U
13923
13935
  }), oe = V(
13924
13936
  () => e ? (Y?.sources ?? []).filter(
@@ -13945,11 +13957,11 @@ function Ix({
13945
13957
  }),
13946
13958
  [l, g]
13947
13959
  ), xe = V(
13948
- () => (R?.givens ?? []).filter(
13960
+ () => (P?.givens ?? []).filter(
13949
13961
  // Only a document held as text hides a `#(secure)` given's control; a saved file's givens show as before.
13950
13962
  (z) => !(e && z.secure === !0) && !(z.name !== void 0 && F.has(z.name))
13951
13963
  ),
13952
- [R, F, e]
13964
+ [P, F, e]
13953
13965
  ), Ve = V(
13954
13966
  () => /* @__PURE__ */ new Set([
13955
13967
  ...xe.map((z) => z.name).filter((z) => z !== void 0),
@@ -13959,25 +13971,25 @@ function Ix({
13959
13971
  [xe, C]
13960
13972
  ), ee = V(
13961
13973
  () => new Map(
13962
- (R?.tiles ?? []).flatMap(
13974
+ (P?.tiles ?? []).flatMap(
13963
13975
  (z) => z.kind !== "text" && z.query && z.givenNames ? [[Ut(z.query), z.givenNames]] : []
13964
13976
  )
13965
13977
  ),
13966
- [R]
13978
+ [P]
13967
13979
  ), tt = V(
13968
13980
  () => new Map(
13969
- (R?.tiles ?? []).flatMap(
13981
+ (P?.tiles ?? []).flatMap(
13970
13982
  (z) => z.kind !== "text" && z.query && z.label ? [[Ut(z.query), z.label]] : []
13971
13983
  )
13972
13984
  ),
13973
- [R]
13985
+ [P]
13974
13986
  ), Ee = V(
13975
13987
  () => Sx(se, s.document, ee),
13976
13988
  [se, s.document, ee]
13977
13989
  ), ge = V(
13978
13990
  () => kx(se, xe, Ee, ee),
13979
13991
  [se, xe, Ee, ee]
13980
- ), Me = V(() => {
13992
+ ), Ie = V(() => {
13981
13993
  const z = new Set(
13982
13994
  se.tiles.flatMap(
13983
13995
  (ve) => he(ve) ? (ve.filters ?? []).map((dt) => dt.given) : []
@@ -14001,13 +14013,13 @@ function Ix({
14001
14013
  }, [se, Ee, e, r]), { declaredTypes: Be, applied: de, panel: Qe } = ng({
14002
14014
  specs: ge,
14003
14015
  loaded: B,
14004
- startingValues: R?.startingGivens,
14016
+ startingValues: P?.startingGivens,
14005
14017
  // Keyed by path: two reports may share a basename.
14006
14018
  documentKey: `${t}/${n}/${o ?? ""}/${r}/edit`,
14007
- autorun: R?.autorun !== !1,
14019
+ autorun: P?.autorun !== !1,
14008
14020
  environmentName: t,
14009
14021
  packageName: n,
14010
- modelPath: e ? E : R?.path,
14022
+ modelPath: e ? E : P?.path,
14011
14023
  versionId: i,
14012
14024
  documentName: r,
14013
14025
  ...Q !== void 0 ? { preamble: Q } : {},
@@ -14099,11 +14111,11 @@ function Ix({
14099
14111
  declaredTypes: Be,
14100
14112
  givenNames: X.givenNames,
14101
14113
  ...(() => {
14102
- const Ie = ig(
14114
+ const Ae = ig(
14103
14115
  nt,
14104
14116
  X.reads ?? X.givenNames
14105
14117
  );
14106
- return Ie.length > 0 ? { waitingFor: sg(Ie) } : {};
14118
+ return Ae.length > 0 ? { waitingFor: sg(Ae) } : {};
14107
14119
  })(),
14108
14120
  ignoredFilters: og(X.reads, ge),
14109
14121
  height: J.rowspan !== void 0 || dn(se.tiles) ? pd(
@@ -14195,7 +14207,7 @@ function Ix({
14195
14207
  } : {},
14196
14208
  source: s.source,
14197
14209
  document: s.document,
14198
- fixedFilters: Me,
14210
+ fixedFilters: Ie,
14199
14211
  ...e?.takenGivenNames ? { takenGivenNames: e.takenGivenNames } : {},
14200
14212
  renderTile: Se,
14201
14213
  renderViewPreview: Et,
@@ -14351,23 +14363,23 @@ function Bx({
14351
14363
  }) {
14352
14364
  const g = q({ path: a, layout: l });
14353
14365
  g.current = { path: a, layout: l };
14354
- const w = q((ge, Me) => {
14366
+ const w = q((ge, Ie) => {
14355
14367
  try {
14356
14368
  v.current?.(
14357
14369
  ug(ge, {
14358
14370
  ...g.current,
14359
- ...Me ? { layout: Me } : {}
14371
+ ...Ie ? { layout: Ie } : {}
14360
14372
  })
14361
14373
  );
14362
14374
  } catch {
14363
14375
  }
14364
14376
  }), y = e?.authoritative === !0, p = y && r !== void 0, [m, x] = j(void 0), b = (y || m === !0) && t !== void 0, [S, k] = j(void 0), [T, E] = j(
14365
14377
  d ? Nx : void 0
14366
- ), $ = q(void 0), A = q(void 0), [I, R] = j(void 0), B = q(i);
14378
+ ), $ = q(void 0), A = q(void 0), [I, P] = j(void 0), B = q(i);
14367
14379
  B.current = i;
14368
14380
  const N = I !== void 0 && I.onFetch === i ? I.text : o, Q = q(N);
14369
14381
  Q.current = N;
14370
- const M = b ? t : N, [F, C] = j(!1), [O, P] = j(void 0), [U, G] = j(void 0), Y = M !== void 0 && M !== U, oe = S?.source, $e = Y && (F || !y && t !== void 0 && oe === t && t !== N) && oe !== void 0 && M !== O, se = $e ? oe : Y ? M : oe ?? M, Re = $e ? M : void 0, be = q(oe);
14382
+ const M = b ? t : N, [F, C] = j(!1), [O, R] = j(void 0), [U, G] = j(void 0), Y = M !== void 0 && M !== U, oe = S?.source, $e = Y && (F || !y && t !== void 0 && oe === t && t !== N) && oe !== void 0 && M !== O, se = $e ? oe : Y ? M : oe ?? M, Re = $e ? M : void 0, be = q(oe);
14371
14383
  be.current = oe;
14372
14384
  const xe = q(M);
14373
14385
  xe.current = M;
@@ -14375,7 +14387,7 @@ function Bx({
14375
14387
  Ve.current = b ? y ? "record" : "draft" : "package", re(() => {
14376
14388
  if (se === void 0 || !n || p || se === be.current) return;
14377
14389
  let ge = !1;
14378
- const Me = Q.current, Be = xe.current;
14390
+ const Ie = Q.current, Be = xe.current;
14379
14391
  return zx(se).then((de) => {
14380
14392
  if (!ge) {
14381
14393
  if (de.ok === !1) {
@@ -14386,10 +14398,10 @@ function Bx({
14386
14398
  });
14387
14399
  return;
14388
14400
  }
14389
- E(void 0), $.current = void 0, A.current = Me, R(void 0), P(void 0), G(Be), k((Qe) => ({
14401
+ E(void 0), $.current = void 0, A.current = Ie, P(void 0), R(void 0), G(Be), k((Qe) => ({
14390
14402
  source: se,
14391
14403
  document: de.document,
14392
- ...Me !== void 0 ? { packageText: Me } : {},
14404
+ ...Ie !== void 0 ? { packageText: Ie } : {},
14393
14405
  generation: (Qe?.generation ?? 0) + 1
14394
14406
  })), w.current(
14395
14407
  {
@@ -14452,16 +14464,16 @@ function Bx({
14452
14464
  openError: T,
14453
14465
  savedHashRef: $,
14454
14466
  packageBaseRef: A,
14455
- setWrote: R,
14467
+ setWrote: P,
14456
14468
  fetchedAtRef: B,
14457
14469
  setDirty: C,
14458
14470
  setSeen: G,
14459
14471
  held: Re,
14460
14472
  choose: (ge) => {
14461
- h.current = rn(), P(ge ? t : N), x(ge);
14473
+ h.current = rn(), R(ge ? t : N), x(ge);
14462
14474
  },
14463
14475
  acceptHeld: () => {
14464
- h.current = rn(), P(Re);
14476
+ h.current = rn(), R(Re);
14465
14477
  }
14466
14478
  };
14467
14479
  }
@@ -14501,8 +14513,8 @@ function jx({
14501
14513
  ),
14502
14514
  [t, o, i, s]
14503
14515
  ), E = T(n), $ = le(
14504
- async (O, P = n) => {
14505
- const U = T(P);
14516
+ async (O, R = n) => {
14517
+ const U = T(R);
14506
14518
  if (!e || !U)
14507
14519
  throw new Error(
14508
14520
  "This host keeps no documents, so there is nowhere to save."
@@ -14522,13 +14534,13 @@ function jx({
14522
14534
  ]
14523
14535
  ), [A, I] = j(
14524
14536
  void 0
14525
- ), R = le(
14537
+ ), P = le(
14526
14538
  async (O) => {
14527
- const P = await fg(
14539
+ const R = await fg(
14528
14540
  b.current,
14529
14541
  S.current
14530
14542
  );
14531
- if (P === void 0)
14543
+ if (R === void 0)
14532
14544
  throw new Error("The package file is still loading; try again.");
14533
14545
  const U = [
14534
14546
  "dashboard-editor-model",
@@ -14545,7 +14557,7 @@ function jx({
14545
14557
  packageName: i,
14546
14558
  modelPath: s,
14547
14559
  source: O,
14548
- expectedHash: P,
14560
+ expectedHash: R,
14549
14561
  // A refused write usually means the file moved: fetching it offers the reader that version instead of re-saving against a base the server keeps rejecting.
14550
14562
  invalidateOnError: [U],
14551
14563
  afterWrite: async (G) => {
@@ -14605,7 +14617,7 @@ function jx({
14605
14617
  readFailed: f !== void 0
14606
14618
  });
14607
14619
  return {
14608
- save: F === "storage" ? $ : F === "package" ? R : void 0,
14620
+ save: F === "storage" ? $ : F === "package" ? P : void 0,
14609
14621
  savesTo: Q,
14610
14622
  writer: F,
14611
14623
  pinnedPackageSave: M,
@@ -14633,8 +14645,8 @@ function sp(e) {
14633
14645
  namesBoth: p
14634
14646
  } = yg(e), x = ("resourceUri" in e ? e.dashboard : e.dashboardName) ?? bg(u) ?? "", b = "report", { apiClients: S, mutable: k, isLoadingStatus: T, server: E } = Pa(), $ = Yg(), A = q(rn()), I = q(t);
14635
14647
  I.current = t;
14636
- const R = q(r);
14637
- R.current = r;
14648
+ const P = q(r);
14649
+ P.current = r;
14638
14650
  const B = wg()?.documentStorage, N = u ?? Eg(l ?? "dashboard", x), Q = /\.malloynb$/i.test(N) || h && /\.malloynb$/i.test(x), M = Ia({
14639
14651
  queryKey: [
14640
14652
  "dashboard-editor-model",
@@ -14656,7 +14668,7 @@ function sp(e) {
14656
14668
  }), F = M.data?.data?.sourceText, {
14657
14669
  workspace: C,
14658
14670
  draft: O,
14659
- setDraft: P,
14671
+ setDraft: R,
14660
14672
  draftChecked: U,
14661
14673
  offered: G,
14662
14674
  setOffered: Y,
@@ -14680,7 +14692,7 @@ function sp(e) {
14680
14692
  savedHashRef: tt,
14681
14693
  packageBaseRef: Ee,
14682
14694
  setWrote: ge,
14683
- fetchedAtRef: Me,
14695
+ fetchedAtRef: Ie,
14684
14696
  setDirty: Be,
14685
14697
  setSeen: de,
14686
14698
  held: Qe,
@@ -14727,13 +14739,13 @@ function sp(e) {
14727
14739
  resume: se,
14728
14740
  setResume: Re,
14729
14741
  setOpened: Ve,
14730
- setDraft: P,
14742
+ setDraft: R,
14731
14743
  setOffered: Y,
14732
14744
  setSeen: de,
14733
14745
  setWrote: ge,
14734
14746
  savedHashRef: tt,
14735
14747
  packageBaseRef: Ee,
14736
- fetchedAtRef: Me
14748
+ fetchedAtRef: Ie
14737
14749
  }), z = C?.name, J = le(
14738
14750
  (ie) => {
14739
14751
  I.current?.(xg(ie, z));
@@ -14749,7 +14761,7 @@ function sp(e) {
14749
14761
  }, [je, M.error, N, f]);
14750
14762
  const xt = le(
14751
14763
  (ie, ce) => {
14752
- Be(ie), R.current?.(ce);
14764
+ Be(ie), P.current?.(ce);
14753
14765
  },
14754
14766
  [Be]
14755
14767
  ), ve = !c && M.data?.data && F !== void 0 && xe?.source === F ? M.data.data : void 0, dt = a ? _g({