@datarails-ai/dr-appspace-cli 0.12.58 → 0.12.59

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 (3) hide show
  1. package/README.md +18 -1
  2. package/dist/cli.js +1603 -538
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "@datarails-ai/dr-appspace-cli",
16
- version: "0.12.58",
16
+ version: "0.12.59",
17
17
  description: "Datarails App Space CLI \u2014 build, try, push and publish App Space apps",
18
18
  type: "module",
19
19
  engines: {
@@ -57,7 +57,7 @@ var package_default = {
57
57
  };
58
58
 
59
59
  // src/buildInfo.ts
60
- var BUILD_TIME = "2026-11-01T13:58:52.526Z";
60
+ var BUILD_TIME = "2026-11-01T16:37:34.766Z";
61
61
  function formatBuildTime(iso) {
62
62
  if (iso === "") return "";
63
63
  const d = new Date(iso);
@@ -754,13 +754,13 @@ async function requestDeviceCode(host, options) {
754
754
  body: body.toString(),
755
755
  signal: options?.signal
756
756
  });
757
- const text3 = await res.text();
757
+ const text4 = await res.text();
758
758
  if (!res.ok) {
759
- throw new Error(`device/code failed: ${res.status} ${text3.trim()}`);
759
+ throw new Error(`device/code failed: ${res.status} ${text4.trim()}`);
760
760
  }
761
761
  let raw;
762
762
  try {
763
- raw = JSON.parse(text3);
763
+ raw = JSON.parse(text4);
764
764
  } catch (err) {
765
765
  const msg = err instanceof Error ? err.message : String(err);
766
766
  throw new Error(`device/code parse: ${msg}`);
@@ -791,10 +791,10 @@ var defaultSleep = (ms, signal) => new Promise((resolve17, reject) => {
791
791
  { once: true }
792
792
  );
793
793
  });
794
- function parseTokenResponse(text3) {
794
+ function parseTokenResponse(text4) {
795
795
  let raw;
796
796
  try {
797
- raw = JSON.parse(text3);
797
+ raw = JSON.parse(text4);
798
798
  } catch (err) {
799
799
  const msg = err instanceof Error ? err.message : String(err);
800
800
  throw new Error(`token parse: ${msg}`);
@@ -812,10 +812,10 @@ function parseTokenResponse(text3) {
812
812
  }
813
813
  return tok;
814
814
  }
815
- function tryParseErrorCode(text3) {
815
+ function tryParseErrorCode(text4) {
816
816
  let raw;
817
817
  try {
818
- raw = JSON.parse(text3);
818
+ raw = JSON.parse(text4);
819
819
  } catch {
820
820
  return "";
821
821
  }
@@ -849,15 +849,15 @@ async function pollForToken(host, deviceCode, options = {}) {
849
849
  body: body.toString(),
850
850
  signal
851
851
  });
852
- const text3 = await res.text();
852
+ const text4 = await res.text();
853
853
  if (res.ok) {
854
- const tok = parseTokenResponse(text3);
854
+ const tok = parseTokenResponse(text4);
855
855
  if (!tok.sessionId || !tok.csrfToken) {
856
856
  throw new Error("token response missing session_id or csrf_token");
857
857
  }
858
858
  return tok;
859
859
  }
860
- const errCode = tryParseErrorCode(text3);
860
+ const errCode = tryParseErrorCode(text4);
861
861
  if (errCode === "authorization_pending" || errCode === "slow_down") {
862
862
  await sleep3(interval, signal);
863
863
  continue;
@@ -865,7 +865,7 @@ async function pollForToken(host, deviceCode, options = {}) {
865
865
  if (errCode) {
866
866
  throw new Error(`token error: ${errCode}`);
867
867
  }
868
- throw new Error(`token HTTP ${res.status}: ${text3.trim()}`);
868
+ throw new Error(`token HTTP ${res.status}: ${text4.trim()}`);
869
869
  }
870
870
  }
871
871
 
@@ -965,10 +965,10 @@ function decodeJwtExpiration(token) {
965
965
  }
966
966
  return new Date(exp * 1e3);
967
967
  }
968
- function parseTokenBody(text3, label) {
968
+ function parseTokenBody(text4, label) {
969
969
  let raw;
970
970
  try {
971
- raw = JSON.parse(text3);
971
+ raw = JSON.parse(text4);
972
972
  } catch (err) {
973
973
  throw new Error(`jwt ${label} parse: ${msgOf3(err)}`);
974
974
  }
@@ -994,11 +994,11 @@ async function mintJwt(host, sessionId, csrfToken, options) {
994
994
  body: "{}",
995
995
  signal: options?.signal
996
996
  });
997
- const text3 = await res.text();
997
+ const text4 = await res.text();
998
998
  if (!res.ok) {
999
- throw new Error(`jwt mint: HTTP ${res.status}: ${truncate(text3, TRUNCATE)}`);
999
+ throw new Error(`jwt mint: HTTP ${res.status}: ${truncate(text4, TRUNCATE)}`);
1000
1000
  }
1001
- const out = parseTokenBody(text3, "mint");
1001
+ const out = parseTokenBody(text4, "mint");
1002
1002
  if (out.access === "") {
1003
1003
  throw new Error("jwt mint: empty access token");
1004
1004
  }
@@ -1021,11 +1021,11 @@ async function refreshJwt(host, refreshToken, options) {
1021
1021
  body: JSON.stringify({ refresh: refreshToken }),
1022
1022
  signal: options?.signal
1023
1023
  });
1024
- const text3 = await res.text();
1024
+ const text4 = await res.text();
1025
1025
  if (!res.ok) {
1026
- throw new Error(`jwt refresh: HTTP ${res.status}: ${truncate(text3, TRUNCATE)}`);
1026
+ throw new Error(`jwt refresh: HTTP ${res.status}: ${truncate(text4, TRUNCATE)}`);
1027
1027
  }
1028
- const out = parseTokenBody(text3, "refresh");
1028
+ const out = parseTokenBody(text4, "refresh");
1029
1029
  if (out.access === "") {
1030
1030
  throw new Error("jwt refresh: empty access token");
1031
1031
  }
@@ -1045,11 +1045,11 @@ async function refreshExternalJwt(host, refreshToken, options) {
1045
1045
  body: JSON.stringify({ refresh: refreshToken }),
1046
1046
  signal: options?.signal
1047
1047
  });
1048
- const text3 = await res.text();
1048
+ const text4 = await res.text();
1049
1049
  if (!res.ok) {
1050
- throw new Error(`jwt external refresh: HTTP ${res.status}: ${truncate(text3, TRUNCATE)}`);
1050
+ throw new Error(`jwt external refresh: HTTP ${res.status}: ${truncate(text4, TRUNCATE)}`);
1051
1051
  }
1052
- const out = parseTokenBody(text3, "refresh");
1052
+ const out = parseTokenBody(text4, "refresh");
1053
1053
  if (out.access === "") {
1054
1054
  throw new Error("jwt external refresh: empty access token");
1055
1055
  }
@@ -1076,12 +1076,12 @@ async function loginAs(host, operatorAccessToken, userId, options) {
1076
1076
  body: JSON.stringify(body),
1077
1077
  signal: options?.signal
1078
1078
  });
1079
- const text3 = await res.text();
1079
+ const text4 = await res.text();
1080
1080
  if (!res.ok) {
1081
1081
  let code;
1082
1082
  let detail;
1083
1083
  try {
1084
- const parsed2 = JSON.parse(text3);
1084
+ const parsed2 = JSON.parse(text4);
1085
1085
  if (typeof parsed2["code"] === "string") code = parsed2["code"];
1086
1086
  if (typeof parsed2["detail"] === "string") detail = parsed2["detail"];
1087
1087
  } catch {
@@ -1089,12 +1089,12 @@ async function loginAs(host, operatorAccessToken, userId, options) {
1089
1089
  throw new LoginAsError(res.status, {
1090
1090
  code,
1091
1091
  detail,
1092
- body: truncate(text3, TRUNCATE)
1092
+ body: truncate(text4, TRUNCATE)
1093
1093
  });
1094
1094
  }
1095
1095
  let raw;
1096
1096
  try {
1097
- raw = JSON.parse(text3);
1097
+ raw = JSON.parse(text4);
1098
1098
  } catch (err) {
1099
1099
  throw new Error(`jwt loginas parse: ${msgOf3(err)}`);
1100
1100
  }
@@ -1137,11 +1137,11 @@ async function exchangeApiKey(host, apiKey, options) {
1137
1137
  headers: { Authorization: `Bearer ${key}`, Accept: "application/json" },
1138
1138
  signal: options?.signal
1139
1139
  });
1140
- const text3 = await res.text();
1140
+ const text4 = await res.text();
1141
1141
  if (!res.ok) {
1142
1142
  let code;
1143
1143
  try {
1144
- const value = JSON.parse(text3)["error"];
1144
+ const value = JSON.parse(text4)["error"];
1145
1145
  if (value === "invalid_key" || value === "exchange_unavailable") code = value;
1146
1146
  } catch {
1147
1147
  }
@@ -1151,7 +1151,7 @@ async function exchangeApiKey(host, apiKey, options) {
1151
1151
  }
1152
1152
  let raw;
1153
1153
  try {
1154
- raw = JSON.parse(text3);
1154
+ raw = JSON.parse(text4);
1155
1155
  } catch {
1156
1156
  throw new Error("api-key exchange parse: the response is not JSON");
1157
1157
  }
@@ -1801,16 +1801,16 @@ var AuthorizedClient = class _AuthorizedClient {
1801
1801
  body: fd,
1802
1802
  signal: options?.signal
1803
1803
  });
1804
- const text3 = await res.text();
1804
+ const text4 = await res.text();
1805
1805
  if (res.status === 401 || res.status === 403) {
1806
1806
  throw new SessionExpiredError(`POST ${path3} (HTTP ${res.status})`);
1807
1807
  }
1808
1808
  if (res.status < 200 || res.status >= 300) {
1809
- throw new Error(`POST ${path3}: HTTP ${res.status}: ${truncate2(text3, 200)}`);
1809
+ throw new Error(`POST ${path3}: HTTP ${res.status}: ${truncate2(text4, 200)}`);
1810
1810
  }
1811
- if (text3 === "" || text3 === '""') return null;
1811
+ if (text4 === "" || text4 === '""') return null;
1812
1812
  try {
1813
- return JSON.parse(text3);
1813
+ return JSON.parse(text4);
1814
1814
  } catch (err) {
1815
1815
  const msg = err instanceof Error ? err.message : String(err);
1816
1816
  throw new Error(`POST ${path3}: decode: ${msg}`);
@@ -1851,16 +1851,16 @@ var AuthorizedClient = class _AuthorizedClient {
1851
1851
  body: fd,
1852
1852
  signal: options?.signal
1853
1853
  });
1854
- const text3 = await res.text();
1854
+ const text4 = await res.text();
1855
1855
  if (res.status === 401 || res.status === 403) {
1856
1856
  throw new SessionExpiredError(`POST ${path3} (HTTP ${res.status})`);
1857
1857
  }
1858
1858
  if (res.status < 200 || res.status >= 300) {
1859
- throw new Error(`POST ${path3}: HTTP ${res.status}: ${truncate2(text3, 200)}`);
1859
+ throw new Error(`POST ${path3}: HTTP ${res.status}: ${truncate2(text4, 200)}`);
1860
1860
  }
1861
- if (text3 === "" || text3 === '""') return null;
1861
+ if (text4 === "" || text4 === '""') return null;
1862
1862
  try {
1863
- return JSON.parse(text3);
1863
+ return JSON.parse(text4);
1864
1864
  } catch (err) {
1865
1865
  const msg = err instanceof Error ? err.message : String(err);
1866
1866
  throw new Error(`POST ${path3}: decode: ${msg}`);
@@ -1909,16 +1909,16 @@ var AuthorizedClient = class _AuthorizedClient {
1909
1909
  body: fd,
1910
1910
  signal: options?.signal
1911
1911
  });
1912
- const text3 = await res.text();
1912
+ const text4 = await res.text();
1913
1913
  if (res.status === 401 || res.status === 403) {
1914
1914
  throw new SessionExpiredError(`POST ${path3} (HTTP ${res.status})`);
1915
1915
  }
1916
1916
  if (res.status < 200 || res.status >= 300) {
1917
- throw new Error(`POST ${path3}: HTTP ${res.status}: ${truncate2(text3, 200)}`);
1917
+ throw new Error(`POST ${path3}: HTTP ${res.status}: ${truncate2(text4, 200)}`);
1918
1918
  }
1919
- if (text3 === "" || text3 === '""') return null;
1919
+ if (text4 === "" || text4 === '""') return null;
1920
1920
  try {
1921
- return JSON.parse(text3);
1921
+ return JSON.parse(text4);
1922
1922
  } catch (err) {
1923
1923
  const msg = err instanceof Error ? err.message : String(err);
1924
1924
  throw new Error(`POST ${path3}: decode: ${msg}`);
@@ -1978,11 +1978,11 @@ var AuthorizedClient = class _AuthorizedClient {
1978
1978
  }
1979
1979
  }
1980
1980
  if (this.isAuthRejected(res)) {
1981
- const text4 = await res.text();
1981
+ const text5 = await res.text();
1982
1982
  if (refreshed || triedSessionOnly) {
1983
1983
  const attempted = refreshed ? "session-only retry and JWT refresh" : "session-only retry";
1984
1984
  throw new Error(
1985
- `${method} ${path3}: HTTP ${res.status} after ${attempted} (authenticated, but endpoint rejected \u2014 check permissions, tenant/org context, or body): ${truncate2(text4, 200)}`
1985
+ `${method} ${path3}: HTTP ${res.status} after ${attempted} (authenticated, but endpoint rejected \u2014 check permissions, tenant/org context, or body): ${truncate2(text5, 200)}`
1986
1986
  );
1987
1987
  }
1988
1988
  if (refreshErr !== void 0) {
@@ -1991,17 +1991,17 @@ var AuthorizedClient = class _AuthorizedClient {
1991
1991
  }
1992
1992
  throw new SessionExpiredError(`${method} ${path3} (HTTP ${res.status})`);
1993
1993
  }
1994
- const text3 = await res.text();
1994
+ const text4 = await res.text();
1995
1995
  if (res.status < 200 || res.status >= 300) {
1996
- throw new Error(`${method} ${path3}: HTTP ${res.status}: ${truncate2(text3, 200)}`);
1996
+ throw new Error(`${method} ${path3}: HTTP ${res.status}: ${truncate2(text4, 200)}`);
1997
1997
  }
1998
1998
  try {
1999
1999
  await this._store.touch(this._serverKey, this._email);
2000
2000
  } catch {
2001
2001
  }
2002
- if (text3 === "" || text3 === '""') return null;
2002
+ if (text4 === "" || text4 === '""') return null;
2003
2003
  try {
2004
- return JSON.parse(text3);
2004
+ return JSON.parse(text4);
2005
2005
  } catch (err) {
2006
2006
  const msg = err instanceof Error ? err.message : String(err);
2007
2007
  throw new Error(`${method} ${path3}: decode: ${msg}`);
@@ -3011,8 +3011,8 @@ async function connect(opts) {
3011
3011
  signal,
3012
3012
  ...init?.headers === void 0 ? {} : { headers: init.headers }
3013
3013
  });
3014
- const text3 = await res.text();
3015
- const lead = text3.trimStart().toLowerCase();
3014
+ const text4 = await res.text();
3015
+ const lead = text4.trimStart().toLowerCase();
3016
3016
  if (lead.startsWith("<!doctype html") || lead.startsWith("<html")) {
3017
3017
  throw new Error(
3018
3018
  `the request was intercepted before reaching App Space (HTTP ${res.status}, HTML page returned \u2014 likely the Cloudflare WAF). The CLI gzips UI bundles to avoid this; if you are calling the API yourself, send frontend_bundle_gz.`
@@ -3020,9 +3020,9 @@ async function connect(opts) {
3020
3020
  }
3021
3021
  let parsed2 = void 0;
3022
3022
  try {
3023
- parsed2 = text3 === "" ? void 0 : JSON.parse(text3);
3023
+ parsed2 = text4 === "" ? void 0 : JSON.parse(text4);
3024
3024
  } catch {
3025
- parsed2 = text3;
3025
+ parsed2 = text4;
3026
3026
  }
3027
3027
  if (!res.ok) {
3028
3028
  throw new AppSpaceHttpError(describeFailure(res.status, method, path3, parsed2), res.status, parsed2);
@@ -3593,8 +3593,8 @@ function describe(node, ctx) {
3593
3593
  const description = node["description"];
3594
3594
  return ctx.inBranch && typeof description === "string" ? ` \u2014 ${firstSentence(description)}` : "";
3595
3595
  }
3596
- function firstSentence(text3) {
3597
- let out = text3;
3596
+ function firstSentence(text4) {
3597
+ let out = text4;
3598
3598
  let start = 0;
3599
3599
  for (; ; ) {
3600
3600
  const end = out.indexOf(". ", start);
@@ -3608,9 +3608,9 @@ function firstSentence(text3) {
3608
3608
  }
3609
3609
  return truncate3(out);
3610
3610
  }
3611
- function truncate3(text3) {
3612
- const chars = [...text3];
3613
- if (chars.length <= MAX_HINT) return text3;
3611
+ function truncate3(text4) {
3612
+ const chars = [...text4];
3613
+ if (chars.length <= MAX_HINT) return text4;
3614
3614
  let cut3 = chars.slice(0, MAX_HINT - 1);
3615
3615
  const space = cut3.lastIndexOf(" ");
3616
3616
  if (space > Math.floor(MAX_HINT / 2)) cut3 = cut3.slice(0, space);
@@ -3793,9 +3793,9 @@ function walkFrom(base, clean) {
3793
3793
  }
3794
3794
  return resolved;
3795
3795
  }
3796
- function lineAt(text3, index) {
3796
+ function lineAt(text4, index) {
3797
3797
  let line2 = 1;
3798
- for (let i = 0; i < index && i < text3.length; i++) if (text3.charCodeAt(i) === 10) line2++;
3798
+ for (let i = 0; i < index && i < text4.length; i++) if (text4.charCodeAt(i) === 10) line2++;
3799
3799
  return line2;
3800
3800
  }
3801
3801
 
@@ -3926,8 +3926,8 @@ function parseAttrs(raw) {
3926
3926
  }
3927
3927
  return attrs;
3928
3928
  }
3929
- function loadsModule(pagePath, text3, pattern) {
3930
- const { elements } = parseHtml(text3);
3929
+ function loadsModule(pagePath, text4, pattern) {
3930
+ const { elements } = parseHtml(text4);
3931
3931
  return elements.some((el) => {
3932
3932
  if (el.tag !== "script" || el.attrs.src === void 0) return false;
3933
3933
  const target = resolveFromPlatformRoot(pagePath, el.attrs.src);
@@ -4103,11 +4103,11 @@ function parseDeclares(raw) {
4103
4103
  }
4104
4104
  var PAIR = /(["'])data-dr-([a-z][a-z-]*)\1\s*:\s*(["'])([^"'\\]*)\3/g;
4105
4105
  var REGEX_AFTER = /* @__PURE__ */ new Set(["", "(", ",", "=", ":", "[", "!", "&", "|", "?", ";", "+", "-", "*", "%", "~", "^", "<", ">"]);
4106
- function scanBundle(text3, { file, page }) {
4106
+ function scanBundle(text4, { file, page }) {
4107
4107
  const pairs = /* @__PURE__ */ new Map();
4108
- for (const match of text3.matchAll(PAIR)) pairs.set(match.index, { attr: match[2], value: match[4] });
4108
+ for (const match of text4.matchAll(PAIR)) pairs.set(match.index, { attr: match[2], value: match[4] });
4109
4109
  if (pairs.size === 0) return [];
4110
- const objects = groupByObject(text3, pairs);
4110
+ const objects = groupByObject(text4, pairs);
4111
4111
  const elements = [];
4112
4112
  for (const found of objects) {
4113
4113
  const attrs = {};
@@ -4148,21 +4148,21 @@ function scanBundle(text3, { file, page }) {
4148
4148
  }
4149
4149
  return elements;
4150
4150
  }
4151
- function groupByObject(text3, pairs) {
4151
+ function groupByObject(text4, pairs) {
4152
4152
  const byObject = /* @__PURE__ */ new Map();
4153
4153
  const stack = [];
4154
4154
  let previous = "";
4155
4155
  let i = 0;
4156
- while (i < text3.length) {
4157
- const ch = text3[i];
4158
- if (ch === "/" && text3[i + 1] === "/") {
4159
- const end = text3.indexOf("\n", i);
4160
- i = end === -1 ? text3.length : end + 1;
4156
+ while (i < text4.length) {
4157
+ const ch = text4[i];
4158
+ if (ch === "/" && text4[i + 1] === "/") {
4159
+ const end = text4.indexOf("\n", i);
4160
+ i = end === -1 ? text4.length : end + 1;
4161
4161
  continue;
4162
4162
  }
4163
- if (ch === "/" && text3[i + 1] === "*") {
4164
- const end = text3.indexOf("*/", i + 2);
4165
- i = end === -1 ? text3.length : end + 2;
4163
+ if (ch === "/" && text4[i + 1] === "*") {
4164
+ const end = text4.indexOf("*/", i + 2);
4165
+ i = end === -1 ? text4.length : end + 2;
4166
4166
  continue;
4167
4167
  }
4168
4168
  if (ch === '"' || ch === "'" || ch === "`") {
@@ -4172,12 +4172,12 @@ function groupByObject(text3, pairs) {
4172
4172
  if (!byObject.has(open2)) byObject.set(open2, []);
4173
4173
  byObject.get(open2).push(pair);
4174
4174
  }
4175
- i = endOfString(text3, i);
4175
+ i = endOfString(text4, i);
4176
4176
  previous = '"';
4177
4177
  continue;
4178
4178
  }
4179
4179
  if (ch === "/" && REGEX_AFTER.has(previous)) {
4180
- i = endOfRegex(text3, i);
4180
+ i = endOfRegex(text4, i);
4181
4181
  previous = "/";
4182
4182
  continue;
4183
4183
  }
@@ -4188,25 +4188,25 @@ function groupByObject(text3, pairs) {
4188
4188
  }
4189
4189
  return [...byObject.entries()].sort((a, b) => a[0] - b[0]).map(([, found]) => found);
4190
4190
  }
4191
- function endOfString(text3, start) {
4192
- const quote = text3[start];
4193
- for (let i = start + 1; i < text3.length; i += 1) {
4194
- if (text3[i] === "\\") i += 1;
4195
- else if (text3[i] === quote) return i + 1;
4191
+ function endOfString(text4, start) {
4192
+ const quote = text4[start];
4193
+ for (let i = start + 1; i < text4.length; i += 1) {
4194
+ if (text4[i] === "\\") i += 1;
4195
+ else if (text4[i] === quote) return i + 1;
4196
4196
  }
4197
- return text3.length;
4197
+ return text4.length;
4198
4198
  }
4199
- function endOfRegex(text3, start) {
4199
+ function endOfRegex(text4, start) {
4200
4200
  let inClass = false;
4201
- for (let i = start + 1; i < text3.length; i += 1) {
4202
- const ch = text3[i];
4201
+ for (let i = start + 1; i < text4.length; i += 1) {
4202
+ const ch = text4[i];
4203
4203
  if (ch === "\\") i += 1;
4204
4204
  else if (ch === "\n") return i;
4205
4205
  else if (ch === "[") inClass = true;
4206
4206
  else if (ch === "]") inClass = false;
4207
4207
  else if (ch === "/" && !inClass) return i + 1;
4208
4208
  }
4209
- return text3.length;
4209
+ return text4.length;
4210
4210
  }
4211
4211
 
4212
4212
  // ../flows/insights-builder/kit/contract/pySpec.mjs
@@ -4326,8 +4326,8 @@ function tokenize(src, d) {
4326
4326
  }
4327
4327
  const number = /^(?:0[xXbBoO][0-9a-fA-F_]+|(?:\d[\d_]*\.?[\d_]*|\.\d[\d_]*)(?:[eE][+-]?\d+)?)/.exec(src.slice(i, i + 40));
4328
4328
  if (number && /\d/.test(number[0])) {
4329
- const text3 = number[0].replace(/_/g, "");
4330
- push("number", Number(text3), i, i + number[0].length);
4329
+ const text4 = number[0].replace(/_/g, "");
4330
+ push("number", Number(text4), i, i + number[0].length);
4331
4331
  i += number[0].length;
4332
4332
  continue;
4333
4333
  }
@@ -4420,8 +4420,8 @@ function unescape(body) {
4420
4420
  }
4421
4421
  return out;
4422
4422
  }
4423
- function cut(text3, max = MAX_TEXT) {
4424
- const flat = String(text3).replace(/\s+/g, " ").trim();
4423
+ function cut(text4, max = MAX_TEXT) {
4424
+ const flat = String(text4).replace(/\s+/g, " ").trim();
4425
4425
  return flat.length > max ? flat.slice(0, max) : flat;
4426
4426
  }
4427
4427
  var Literals = class {
@@ -4558,7 +4558,7 @@ var Literals = class {
4558
4558
  return this.d.bare === "callable" ? { $callable: value } : { $unresolved: cut(value) };
4559
4559
  }
4560
4560
  parseString(index) {
4561
- let text3 = "";
4561
+ let text4 = "";
4562
4562
  let i = index;
4563
4563
  while (this.tokens[i]?.type === "string" || this.depth > 0 && this.tokens[i]?.type === "newline") {
4564
4564
  const token = this.tokens[i];
@@ -4569,10 +4569,10 @@ var Literals = class {
4569
4569
  }
4570
4570
  const piece = token.prefix.includes("f") ? this.interpolate(token) : token.value;
4571
4571
  if (piece === null) return null;
4572
- text3 += piece;
4572
+ text4 += piece;
4573
4573
  i += 1;
4574
4574
  }
4575
- return i === index ? null : { value: text3, next: i };
4575
+ return i === index ? null : { value: text4, next: i };
4576
4576
  }
4577
4577
  /**
4578
4578
  * An f-string whose fields are all plain constant names, substituted. A
@@ -4911,28 +4911,28 @@ var ALLOWED_CONTEXT = [
4911
4911
  var NUMBER = /^-?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
4912
4912
  var LITERAL_CONTEXT = new RegExp(`\\b(${ALLOWED_CONTEXT.join("|")})\\b["']?\\s*[:=(]?\\s*$`, "i");
4913
4913
  var CONTEXT = LITERAL_CONTEXT;
4914
- function findDataLiterals(text3) {
4914
+ function findDataLiterals(text4) {
4915
4915
  const found = [];
4916
- for (let i = 0; i < text3.length; i++) {
4917
- const open2 = text3[i];
4916
+ for (let i = 0; i < text4.length; i++) {
4917
+ const open2 = text4[i];
4918
4918
  if (open2 !== "[" && open2 !== "{") continue;
4919
- const close = closingIndex(text3, i);
4919
+ const close = closingIndex(text4, i);
4920
4920
  if (close === -1) continue;
4921
- const body = text3.slice(i + 1, close);
4921
+ const body = text4.slice(i + 1, close);
4922
4922
  const numbers = countNumbers(body);
4923
- if (numbers >= MIN_NUMBERS && !CONTEXT.test(text3.slice(Math.max(0, i - 60), i))) {
4924
- found.push({ line: lineAt(text3, i), numbers, sample: text3.slice(i, Math.min(close + 1, i + 60)) });
4923
+ if (numbers >= MIN_NUMBERS && !CONTEXT.test(text4.slice(Math.max(0, i - 60), i))) {
4924
+ found.push({ line: lineAt(text4, i), numbers, sample: text4.slice(i, Math.min(close + 1, i + 60)) });
4925
4925
  i = close;
4926
4926
  }
4927
4927
  }
4928
4928
  return found;
4929
4929
  }
4930
- function closingIndex(text3, start) {
4930
+ function closingIndex(text4, start) {
4931
4931
  const pairs = { "[": "]", "{": "}" };
4932
- const stack = [pairs[text3[start]]];
4932
+ const stack = [pairs[text4[start]]];
4933
4933
  let quote = null;
4934
- for (let i = start + 1; i < text3.length && i < start + 2e4; i++) {
4935
- const ch = text3[i];
4934
+ for (let i = start + 1; i < text4.length && i < start + 2e4; i++) {
4935
+ const ch = text4[i];
4936
4936
  if (quote) {
4937
4937
  if (ch === "\\") i++;
4938
4938
  else if (ch === quote) quote = null;
@@ -5008,9 +5008,9 @@ function writeSpec(data, { library = null, name = "SPEC", width = DEFAULT_WIDTH
5008
5008
  const constants = /* @__PURE__ */ new Map();
5009
5009
  const hoisted = hoist(table, [], constants, null);
5010
5010
  const callables = /* @__PURE__ */ new Set();
5011
- let text3 = null;
5011
+ let text4 = null;
5012
5012
  try {
5013
- text3 = `${name} = ${renderAssignment(hoisted, name, width, callables)}
5013
+ text4 = `${name} = ${renderAssignment(hoisted, name, width, callables)}
5014
5014
  `;
5015
5015
  } catch (error) {
5016
5016
  if (!(error instanceof WriteError)) throw error;
@@ -5033,7 +5033,7 @@ function writeSpec(data, { library = null, name = "SPEC", width = DEFAULT_WIDTH
5033
5033
  text: `${constant} = ${pyLiteral(held, { indent: 0, width, callables, pointer: `/${constant}` })}`
5034
5034
  }));
5035
5035
  const imports = callables.size === 0 ? [] : [`from ${library?.module ?? DEFAULT_LIBRARY_MODULE} import ${[...callables].sort().join(", ")}`];
5036
- const written = [...rows2.map((row) => row.text), text3].join("\n");
5036
+ const written = [...rows2.map((row) => row.text), text4].join("\n");
5037
5037
  for (const literal of findDataLiterals(written)) {
5038
5038
  problems.push({
5039
5039
  code: "data_literal",
@@ -5042,7 +5042,7 @@ function writeSpec(data, { library = null, name = "SPEC", width = DEFAULT_WIDTH
5042
5042
  });
5043
5043
  }
5044
5044
  if (problems.length > 0) return { text: null, imports: [], constants: [], problems };
5045
- return { text: text3, imports, constants: rows2, problems };
5045
+ return { text: text4, imports, constants: rows2, problems };
5046
5046
  }
5047
5047
  function writeModule({ docstring = null, imports = [], constants = [], tables = [], body = null } = {}) {
5048
5048
  const blocks = [];
@@ -5051,12 +5051,12 @@ function writeModule({ docstring = null, imports = [], constants = [], tables =
5051
5051
  if (constants.length > 0) blocks.push(constants.join("\n"));
5052
5052
  for (const table of tables) blocks.push(table.replace(/\n+$/, ""));
5053
5053
  if (body !== null) blocks.push(body.replace(/\n+$/, ""));
5054
- let text3 = "";
5054
+ let text4 = "";
5055
5055
  for (const [index, block] of blocks.entries()) {
5056
- if (index > 0) text3 += separator(blocks[index - 1], block);
5057
- text3 += block;
5056
+ if (index > 0) text4 += separator(blocks[index - 1], block);
5057
+ text4 += block;
5058
5058
  }
5059
- return `${text3}
5059
+ return `${text4}
5060
5060
  `;
5061
5061
  }
5062
5062
  function renderAssignment(value, name, width, callables) {
@@ -5174,10 +5174,10 @@ function pyNumber(value, ctx) {
5174
5174
  }
5175
5175
  return Number.isInteger(value) ? String(value) : String(value);
5176
5176
  }
5177
- function pyString(text3) {
5178
- const quote = text3.includes('"') && !text3.includes("'") ? "'" : '"';
5177
+ function pyString(text4) {
5178
+ const quote = text4.includes('"') && !text4.includes("'") ? "'" : '"';
5179
5179
  let out = quote;
5180
- for (const ch of text3) {
5180
+ for (const ch of text4) {
5181
5181
  if (ch === "\\") out += "\\\\";
5182
5182
  else if (ch === quote) out += `\\${ch}`;
5183
5183
  else if (ch === "\n") out += "\\n";
@@ -5235,8 +5235,8 @@ function constantName(path3, constants) {
5235
5235
  if (!constants.has(start)) return start;
5236
5236
  for (let n = 2; ; n += 1) if (!constants.has(`${start}_${n}`)) return `${start}_${n}`;
5237
5237
  }
5238
- function asDocstring(text3) {
5239
- const body = String(text3).replace(/\\/g, "\\\\").replace(/"""/g, '\\"\\"\\"').replace(/\s+$/, "");
5238
+ function asDocstring(text4) {
5239
+ const body = String(text4).replace(/\\/g, "\\\\").replace(/"""/g, '\\"\\"\\"').replace(/\s+$/, "");
5240
5240
  return body.includes("\n") ? `"""${body}
5241
5241
  """` : `"""${body}"""`;
5242
5242
  }
@@ -5418,8 +5418,8 @@ function transformFileProblems(data, extra) {
5418
5418
  for (const key of Object.keys(widgets).sort(natural2)) {
5419
5419
  const path3 = isPlainObject(widgets[key]) ? widgets[key].transform : void 0;
5420
5420
  if (typeof path3 !== "string" || !TRANSFORM_PATH.test(path3)) continue;
5421
- const text3 = files[path3];
5422
- if (typeof text3 !== "string") {
5421
+ const text4 = files[path3];
5422
+ if (typeof text4 !== "string") {
5423
5423
  problems.push({
5424
5424
  code: "transform_missing",
5425
5425
  where: `/data/widgets/${key}/transform`,
@@ -5429,14 +5429,14 @@ function transformFileProblems(data, extra) {
5429
5429
  }
5430
5430
  if (linted.has(path3)) continue;
5431
5431
  linted.add(path3);
5432
- for (const finding of lintTransform(text3)) {
5432
+ for (const finding of lintTransform(text4)) {
5433
5433
  problems.push({ code: "transform_forbidden", where: `${path3}:${finding.line}`, message: finding.message });
5434
5434
  }
5435
5435
  }
5436
5436
  return problems;
5437
5437
  }
5438
- function lintTransform(text3) {
5439
- const tokens = new Literals(String(text3 ?? ""), "py").tokens;
5438
+ function lintTransform(text4) {
5439
+ const tokens = new Literals(String(text4 ?? ""), "py").tokens;
5440
5440
  const findings = nameFindings(tokens);
5441
5441
  let defined = false;
5442
5442
  for (let i = 0; i < tokens.length; i += 1) {
@@ -5531,8 +5531,8 @@ function fieldExpressions(body) {
5531
5531
  }
5532
5532
  return fields;
5533
5533
  }
5534
- function findTransformLiterals(text3) {
5535
- const source = String(text3 ?? "");
5534
+ function findTransformLiterals(text4) {
5535
+ const source = String(text4 ?? "");
5536
5536
  const tokens = new Literals(source, "py").tokens;
5537
5537
  const found = [];
5538
5538
  const stack = [];
@@ -5723,8 +5723,8 @@ ${entries.map((entry) => ` ${entry},`).join("\n")}
5723
5723
  table
5724
5724
  ].join("\n");
5725
5725
  }
5726
- function pyText(text3) {
5727
- const value = String(text3);
5726
+ function pyText(text4) {
5727
+ const value = String(text4);
5728
5728
  let doubles = 0;
5729
5729
  let singles = 0;
5730
5730
  for (const ch of value) {
@@ -5749,7 +5749,7 @@ function readTransforms(source) {
5749
5749
  if (!literals.has(TRANSFORMS_TABLE)) return { found: false, texts: null, span: null, text: null };
5750
5750
  const value = literals.constant(TRANSFORMS_TABLE);
5751
5751
  const span = literals.constantSpan(TRANSFORMS_TABLE);
5752
- const readable = isPlainObject(value) && Object.entries(value).every(([path3, text3]) => TRANSFORM_PATH.test(path3) && typeof text3 === "string");
5752
+ const readable = isPlainObject(value) && Object.entries(value).every(([path3, text4]) => TRANSFORM_PATH.test(path3) && typeof text4 === "string");
5753
5753
  if (!readable) return { found: true, texts: null, span, text: literals.constantText(TRANSFORMS_TABLE) };
5754
5754
  const texts = {};
5755
5755
  for (const path3 of Object.keys(value).sort(natural2)) texts[path3] = value[path3];
@@ -5948,9 +5948,9 @@ function routesOf(manifest) {
5948
5948
  function themeSection(app) {
5949
5949
  const file = app.ui.find((entry) => entry.path === THEME_FILE);
5950
5950
  if (!file) return null;
5951
- const text3 = file.text.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
5951
+ const text4 = file.text.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
5952
5952
  const tokens = {};
5953
- for (const block of text3.matchAll(/(?::root|body\.dr-app-page)\s*\{([^}]*)\}/g)) {
5953
+ for (const block of text4.matchAll(/(?::root|body\.dr-app-page)\s*\{([^}]*)\}/g)) {
5954
5954
  for (const hit of block[1].matchAll(/(--dr-[a-z0-9-]+)\s*:\s*([^;]+);/g)) {
5955
5955
  if (hit[1] !== "--dr-app-theme") tokens[hit[1]] = hit[2].trim();
5956
5956
  }
@@ -6133,10 +6133,10 @@ function mountOf(page) {
6133
6133
  };
6134
6134
  }
6135
6135
  function embeddedContractOf(page) {
6136
- const text3 = contractBlockText(page?.text ?? "");
6137
- if (text3 === null) return null;
6136
+ const text4 = contractBlockText(page?.text ?? "");
6137
+ if (text4 === null) return null;
6138
6138
  try {
6139
- const embedded = JSON.parse(text3.replace(/<\\\//g, "</"));
6139
+ const embedded = JSON.parse(text4.replace(/<\\\//g, "</"));
6140
6140
  return isPlainObject(embedded) ? embedded : null;
6141
6141
  } catch {
6142
6142
  return null;
@@ -6168,10 +6168,10 @@ function cardSpecOf(element) {
6168
6168
  return element?.type === "widget" && typeof card === "string" && card !== "" ? card : null;
6169
6169
  }
6170
6170
  var RUNTIME_RENDERER = "runtime";
6171
- function navGates(text3, pagePath) {
6171
+ function navGates(text4, pagePath) {
6172
6172
  const out = /* @__PURE__ */ new Map();
6173
- if (typeof text3 !== "string") return out;
6174
- const tree = decodedTree(text3);
6173
+ if (typeof text4 !== "string") return out;
6174
+ const tree = decodedTree(text4);
6175
6175
  const base = pagePath.includes("/") ? pagePath.slice(0, pagePath.lastIndexOf("/") + 1) : "";
6176
6176
  for (const node of tree.nodes) {
6177
6177
  if (node.tag !== "a" || typeof node.attrs.href !== "string" || typeof node.attrs["data-dr-role"] !== "string") continue;
@@ -6187,8 +6187,8 @@ function navGates(text3, pagePath) {
6187
6187
  }
6188
6188
  return out;
6189
6189
  }
6190
- function isOwnedPage(text3) {
6191
- return typeof text3 === "string" && ownedIn(decodedTree(text3));
6190
+ function isOwnedPage(text4) {
6191
+ return typeof text4 === "string" && ownedIn(decodedTree(text4));
6192
6192
  }
6193
6193
  function ownedIn(tree) {
6194
6194
  const hasHead = tree.nodes.some((node) => node.tag === "head");
@@ -6305,7 +6305,7 @@ function numberAttr(node, name) {
6305
6305
  if (raw === "") return null;
6306
6306
  return Number.isFinite(Number(raw)) ? Number(raw) : raw;
6307
6307
  }
6308
- function propsOf(node, text3, tree) {
6308
+ function propsOf(node, text4, tree) {
6309
6309
  const props = {};
6310
6310
  for (const [name, value] of Object.entries(node.attrs)) {
6311
6311
  if (!name.startsWith(WIDGET_PREFIX)) continue;
@@ -6317,13 +6317,13 @@ function propsOf(node, text3, tree) {
6317
6317
  props.param = node.attrs[CONTROL_ATTR];
6318
6318
  props.control_kind = node.attrs[`${CONTROL_ATTR}-kind`] ?? null;
6319
6319
  for (const name of CONTROL_PROPS) if (name in node.attrs) props[name] = node.attrs[name];
6320
- const label = labelFor(node, text3, tree);
6320
+ const label = labelFor(node, text4, tree);
6321
6321
  if (label !== null) props.label = label;
6322
6322
  }
6323
6323
  if (node.tag === "a" && "href" in node.attrs) {
6324
6324
  props.href = node.attrs.href;
6325
6325
  props.current = node.attrs["aria-current"] === "page";
6326
- const label = textOf(text3, node);
6326
+ const label = textOf(text4, node);
6327
6327
  if (label) props.label = label;
6328
6328
  }
6329
6329
  if (COMPONENT_ATTR in node.attrs || FIELD_ATTR in node.attrs) {
@@ -6337,9 +6337,9 @@ function propsOf(node, text3, tree) {
6337
6337
  const inputType = inputTypeOf(node);
6338
6338
  if (inputType !== null) props.input_type = inputType;
6339
6339
  if ("required" in node.attrs) props.required = true;
6340
- if (node.tag === "select") props.options = optionsOf(node, text3, tree);
6340
+ if (node.tag === "select") props.options = optionsOf(node, text4, tree);
6341
6341
  if (props.label === void 0) {
6342
- const label = labelFor(node, text3, tree);
6342
+ const label = labelFor(node, text4, tree);
6343
6343
  if (label !== null) props.label = label;
6344
6344
  }
6345
6345
  }
@@ -6353,13 +6353,13 @@ function inputTypeOf(node) {
6353
6353
  if (node.tag === "input") return node.attrs.type ?? "text";
6354
6354
  return null;
6355
6355
  }
6356
- function optionsOf(node, text3, tree) {
6356
+ function optionsOf(node, text4, tree) {
6357
6357
  const options = [];
6358
6358
  const walk5 = (index) => {
6359
6359
  for (const child of tree.nodes[index].children) {
6360
6360
  const candidate = tree.nodes[child];
6361
6361
  if (candidate.tag === "option") {
6362
- if (!("disabled" in candidate.attrs)) options.push(candidate.attrs.value ?? textOf(text3, candidate));
6362
+ if (!("disabled" in candidate.attrs)) options.push(candidate.attrs.value ?? textOf(text4, candidate));
6363
6363
  } else walk5(child);
6364
6364
  }
6365
6365
  };
@@ -6369,15 +6369,15 @@ function optionsOf(node, text3, tree) {
6369
6369
  function splitList(value) {
6370
6370
  return String(value).split(/[\s,]+/).filter(Boolean);
6371
6371
  }
6372
- function labelFor(node, text3, tree) {
6372
+ function labelFor(node, text4, tree) {
6373
6373
  const id = node.attrs.id;
6374
6374
  if (!id) return node.attrs["aria-label"] ?? null;
6375
6375
  const label = tree.nodes.find((candidate) => candidate.tag === "label" && candidate.attrs.for === id);
6376
- return label ? textOf(text3, label) : node.attrs["aria-label"] ?? null;
6376
+ return label ? textOf(text4, label) : node.attrs["aria-label"] ?? null;
6377
6377
  }
6378
- function textOf(text3, node) {
6379
- const next = text3.indexOf("<", node.end);
6380
- return decodeEntities(text3.slice(node.end, next === -1 ? void 0 : next).replace(/\s+/g, " ").trim());
6378
+ function textOf(text4, node) {
6379
+ const next = text4.indexOf("<", node.end);
6380
+ return decodeEntities(text4.slice(node.end, next === -1 ? void 0 : next).replace(/\s+/g, " ").trim());
6381
6381
  }
6382
6382
  function slotsOf(node, tree) {
6383
6383
  if (!(WIDGET_ATTR in node.attrs)) return {};
@@ -6402,23 +6402,23 @@ function bindingOf(entry, node, spec) {
6402
6402
  if (entry.type === "control") return node.attrs[CONTROL_ATTR] || null;
6403
6403
  return null;
6404
6404
  }
6405
- function titleOf(tree, text3) {
6405
+ function titleOf(tree, text4) {
6406
6406
  const title = tree.nodes.find((node) => node.tag === "title");
6407
- return title ? textOf(text3, title) : null;
6407
+ return title ? textOf(text4, title) : null;
6408
6408
  }
6409
- function headerOf(tree, text3) {
6409
+ function headerOf(tree, text4) {
6410
6410
  const withClass = (name) => tree.nodes.find((node) => classesOf(node).includes(name));
6411
6411
  const title = withClass("dr-appbar__title");
6412
6412
  if (title) {
6413
6413
  const summary2 = withClass("dr-appbar__summary");
6414
- return { title: textOf(text3, title), summary: summary2 ? textOf(text3, summary2) || null : null };
6414
+ return { title: textOf(text4, title), summary: summary2 ? textOf(text4, summary2) || null : null };
6415
6415
  }
6416
6416
  const region = tree.nodes.find((node) => node.attrs[KIT_ATTR] === "header");
6417
6417
  if (!region) return null;
6418
6418
  const heading = firstTag(tree, region, "h1", true);
6419
6419
  if (!heading) return null;
6420
6420
  const summary = firstTag(tree, region, "p", true);
6421
- const out = { title: textOf(text3, heading), summary: summary ? textOf(text3, summary) || null : null };
6421
+ const out = { title: textOf(text4, heading), summary: summary ? textOf(text4, summary) || null : null };
6422
6422
  const actions = parseJsonAttr(region.attrs[HEADER_ACTIONS_ATTR]);
6423
6423
  if (Array.isArray(actions)) out.actions = actions;
6424
6424
  const from = region.attrs[TITLE_FROM_ATTR];
@@ -6452,16 +6452,16 @@ function navOf(tree, main2) {
6452
6452
  const source = nav?.attrs[NAV_COUNTS_ATTR] ?? main2?.attrs[NAV_COUNTS_ATTR];
6453
6453
  return source === void 0 || source === "" ? {} : { nav: { counts: { source } } };
6454
6454
  }
6455
- function sectionOf(node, text3, index) {
6456
- const title = textOf(text3, node);
6455
+ function sectionOf(node, text4, index) {
6456
+ const title = textOf(text4, node);
6457
6457
  return { id: node.attrs.id ?? slug(title) ?? `section_${index + 1}`, title };
6458
6458
  }
6459
- function wrappedSectionOf(tree, node, text3, index) {
6459
+ function wrappedSectionOf(tree, node, text4, index) {
6460
6460
  const heading = firstTag(tree, node, "h2");
6461
6461
  const id = node.attrs[SECTION_ATTR];
6462
- const out = { id: id === void 0 || id === "" ? `section_${index + 1}` : id, title: heading ? textOf(text3, heading) : "" };
6462
+ const out = { id: id === void 0 || id === "" ? `section_${index + 1}` : id, title: heading ? textOf(text4, heading) : "" };
6463
6463
  const subtitle = node.children.map((child) => tree.nodes[child]).find((child) => child.tag === "p");
6464
- if (subtitle) out.subtitle = textOf(text3, subtitle);
6464
+ if (subtitle) out.subtitle = textOf(text4, subtitle);
6465
6465
  for (const key of BAND_LOOK) {
6466
6466
  const value = node.attrs[`data-dr-${key}`];
6467
6467
  if (value !== void 0 && value !== "") out[key] = value;
@@ -6469,8 +6469,8 @@ function wrappedSectionOf(tree, node, text3, index) {
6469
6469
  return out;
6470
6470
  }
6471
6471
  var BAND_LOOK = ["layout", "surface", "aside"];
6472
- function slug(text3) {
6473
- const clean = String(text3 ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
6472
+ function slug(text4) {
6473
+ const clean = String(text4 ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
6474
6474
  return clean === "" ? null : clean;
6475
6475
  }
6476
6476
  function routeOf(manifest, path3) {
@@ -6823,9 +6823,9 @@ function readSources(handlers) {
6823
6823
  }
6824
6824
  const carried = literals.constant("TRANSFORMS");
6825
6825
  if (!isPlainObject(carried)) continue;
6826
- for (const [name, text3] of Object.entries(carried)) {
6826
+ for (const [name, text4] of Object.entries(carried)) {
6827
6827
  const path3 = table[name]?.transform;
6828
- if (typeof path3 === "string" && typeof text3 === "string" && !texts.has(path3)) texts.set(path3, text3);
6828
+ if (typeof path3 === "string" && typeof text4 === "string" && !texts.has(path3)) texts.set(path3, text4);
6829
6829
  }
6830
6830
  }
6831
6831
  const owned = [...texts.keys()].sort(natural3).map((path3) => ({ path: path3, text: texts.get(path3) }));
@@ -6850,9 +6850,9 @@ function specTransforms(handlers, spec, problems) {
6850
6850
  continue;
6851
6851
  }
6852
6852
  carried ??= /* @__PURE__ */ new Set();
6853
- for (const [path3, text3] of Object.entries(table.texts)) {
6853
+ for (const [path3, text4] of Object.entries(table.texts)) {
6854
6854
  carried.add(path3);
6855
- out.push({ path: path3, text: text3 });
6855
+ out.push({ path: path3, text: text4 });
6856
6856
  }
6857
6857
  }
6858
6858
  const unreadable = problems.some((problem6) => problem6.code === "transform_unreadable");
@@ -6991,8 +6991,8 @@ function backendSection(app, manifest, pages, elements) {
6991
6991
  };
6992
6992
  }
6993
6993
  function handlerVerbs(source) {
6994
- const text3 = typeof source === "string" ? source : "";
6995
- return DATA_VERBS.filter((verb) => TABLE_ONLY_VERBS.has(verb) ? callsOnTable(text3, verb) : new RegExp(`\\.\\s*${verb}\\s*\\(`).test(text3));
6994
+ const text4 = typeof source === "string" ? source : "";
6995
+ return DATA_VERBS.filter((verb) => TABLE_ONLY_VERBS.has(verb) ? callsOnTable(text4, verb) : new RegExp(`\\.\\s*${verb}\\s*\\(`).test(text4));
6996
6996
  }
6997
6997
  function callsOnTable(source, verb) {
6998
6998
  const holders = [TABLE_INLINE];
@@ -7015,9 +7015,9 @@ function signatureOk(source) {
7015
7015
  }
7016
7016
  return count >= 2;
7017
7017
  }
7018
- function isReferenced(name, text3) {
7018
+ function isReferenced(name, text4) {
7019
7019
  const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7020
- return new RegExp(`\\bcall\\(\\s*(['"\`])${escaped}\\1|/${escaped}(['"\`]|\\b)|(['"\`])${escaped}\\3`).test(text3);
7020
+ return new RegExp(`\\bcall\\(\\s*(['"\`])${escaped}\\1|/${escaped}(['"\`]|\\b)|(['"\`])${escaped}\\3`).test(text4);
7021
7021
  }
7022
7022
  function rolesOf(manifest) {
7023
7023
  const roles = Array.isArray(manifest.roles) ? manifest.roles : [];
@@ -7152,9 +7152,9 @@ function natural3(a, b) {
7152
7152
  var NAMED_ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
7153
7153
  var ENTITY = /&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z][a-zA-Z0-9]{1,31});/g;
7154
7154
  function decodeEntities(value) {
7155
- const text3 = String(value);
7156
- if (!text3.includes("&")) return text3;
7157
- return text3.replace(ENTITY, (whole, body) => {
7155
+ const text4 = String(value);
7156
+ if (!text4.includes("&")) return text4;
7157
+ return text4.replace(ENTITY, (whole, body) => {
7158
7158
  if (body[0] !== "#") return Object.prototype.hasOwnProperty.call(NAMED_ENTITIES, body) ? NAMED_ENTITIES[body] : whole;
7159
7159
  const code = body[1] === "x" || body[1] === "X" ? Number.parseInt(body.slice(2), 16) : Number.parseInt(body.slice(1), 10);
7160
7160
  if (!Number.isInteger(code) || code < 1 || code > 1114111 || code >= 55296 && code <= 57343) return whole;
@@ -8354,7 +8354,7 @@ function pyCode(source) {
8354
8354
  }
8355
8355
  return out;
8356
8356
  }
8357
- var reEscape = (text3) => text3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8357
+ var reEscape = (text4) => text4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8358
8358
  function pyPayloadReads(source) {
8359
8359
  const code = pyCode(String(source ?? ""));
8360
8360
  const signature = /^[ \t]*(?:async[ \t]+)?def[ \t]+handle[ \t]*\([ \t]*\w+[ \t]*,[ \t]*(\w+)/m.exec(code);
@@ -8424,24 +8424,24 @@ function jsCode(source) {
8424
8424
  }
8425
8425
  return out;
8426
8426
  }
8427
- function stringEnd(text3, i) {
8428
- const quote = text3[i];
8427
+ function stringEnd(text4, i) {
8428
+ const quote = text4[i];
8429
8429
  let j = i + 1;
8430
- while (j < text3.length && text3[j] !== quote) {
8431
- if (text3[j] === "\\") j++;
8432
- else if (quote !== "`" && text3[j] === "\n") break;
8430
+ while (j < text4.length && text4[j] !== quote) {
8431
+ if (text4[j] === "\\") j++;
8432
+ else if (quote !== "`" && text4[j] === "\n") break;
8433
8433
  j++;
8434
8434
  }
8435
- return Math.min(j + 1, text3.length);
8435
+ return Math.min(j + 1, text4.length);
8436
8436
  }
8437
- function closeOf(text3, i) {
8438
- const open2 = text3[i];
8437
+ function closeOf(text4, i) {
8438
+ const open2 = text4[i];
8439
8439
  const close = { "{": "}", "(": ")", "[": "]" }[open2];
8440
8440
  let depth = 0;
8441
- for (let j = i; j < text3.length; j++) {
8442
- const ch = text3[j];
8441
+ for (let j = i; j < text4.length; j++) {
8442
+ const ch = text4[j];
8443
8443
  if (ch === '"' || ch === "'" || ch === "`") {
8444
- j = stringEnd(text3, j) - 1;
8444
+ j = stringEnd(text4, j) - 1;
8445
8445
  continue;
8446
8446
  }
8447
8447
  if (ch === "{" || ch === "(" || ch === "[") depth++;
@@ -8452,12 +8452,12 @@ function closeOf(text3, i) {
8452
8452
  }
8453
8453
  return -1;
8454
8454
  }
8455
- function literalAt(text3, i) {
8456
- const quote = text3[i];
8455
+ function literalAt(text4, i) {
8456
+ const quote = text4[i];
8457
8457
  if (quote !== '"' && quote !== "'" && quote !== "`") return null;
8458
- const end = stringEnd(text3, i);
8459
- const body = text3.slice(i + 1, end - 1);
8460
- if (text3[end - 1] !== quote || quote === "`" && body.includes("${") || body.includes("\\")) return null;
8458
+ const end = stringEnd(text4, i);
8459
+ const body = text4.slice(i + 1, end - 1);
8460
+ if (text4[end - 1] !== quote || quote === "`" && body.includes("${") || body.includes("\\")) return null;
8461
8461
  return { value: body, end };
8462
8462
  }
8463
8463
  function objectKeys(body) {
@@ -8571,8 +8571,8 @@ function fieldOf(element) {
8571
8571
  if (INPUT_PARTS.has(element?.type) && named2(element.props?.props?.field)) return element.props.props.field;
8572
8572
  return null;
8573
8573
  }
8574
- function mentions(text3, name) {
8575
- return new RegExp(`(^|[^A-Za-z0-9_])${reEscape(name)}([^A-Za-z0-9_]|$)`).test(text3);
8574
+ function mentions(text4, name) {
8575
+ return new RegExp(`(^|[^A-Za-z0-9_])${reEscape(name)}([^A-Za-z0-9_]|$)`).test(text4);
8576
8576
  }
8577
8577
  function payloadProducers(contract, { moduleSource = () => void 0, pageSource = () => void 0 } = {}) {
8578
8578
  const elements = isPlainObject2(contract?.elements) ? contract.elements : {};
@@ -8697,13 +8697,13 @@ function payloadProducers(contract, { moduleSource = () => void 0, pageSource =
8697
8697
  }
8698
8698
  for (const page of Array.isArray(contract?.pages) ? contract.pages : []) {
8699
8699
  if (!named2(page?.path)) continue;
8700
- const text3 = pageSource(page.path);
8700
+ const text4 = pageSource(page.path);
8701
8701
  const unknown = { page: page.path, uid: null, what: "script", keys: null };
8702
- if (typeof text3 !== "string") {
8702
+ if (typeof text4 !== "string") {
8703
8703
  if (page.owned === true) add("*", unknown);
8704
8704
  continue;
8705
8705
  }
8706
- const code = page.owned === true ? [text3] : pageCode(text3, page.path, modules, pageSource);
8706
+ const code = page.owned === true ? [text4] : pageCode(text4, page.path, modules, pageSource);
8707
8707
  if (code === null) {
8708
8708
  add("*", unknown);
8709
8709
  continue;
@@ -8938,23 +8938,23 @@ function problem2(at, why, kind = "other") {
8938
8938
  function describe2(node, ctx) {
8939
8939
  return ctx.inBranch && isObject3(node) && typeof node.description === "string" ? ` \u2014 ${firstSentence2(node.description)}` : "";
8940
8940
  }
8941
- function firstSentence2(text3) {
8941
+ function firstSentence2(text4) {
8942
8942
  let start = 0;
8943
8943
  for (; ; ) {
8944
- const end = text3.indexOf(". ", start);
8944
+ const end = text4.indexOf(". ", start);
8945
8945
  if (end === -1) break;
8946
- const before = text3.slice(0, end);
8946
+ const before = text4.slice(0, end);
8947
8947
  if (!before.endsWith("e.g") && !before.endsWith("i.e")) {
8948
- text3 = text3.slice(0, end + 1);
8948
+ text4 = text4.slice(0, end + 1);
8949
8949
  break;
8950
8950
  }
8951
8951
  start = end + 2;
8952
8952
  }
8953
- return truncate4(text3);
8953
+ return truncate4(text4);
8954
8954
  }
8955
- function truncate4(text3) {
8956
- const chars = [...text3];
8957
- if (chars.length <= MAX_HINT2) return text3;
8955
+ function truncate4(text4) {
8956
+ const chars = [...text4];
8957
+ if (chars.length <= MAX_HINT2) return text4;
8958
8958
  let cut3 = chars.slice(0, MAX_HINT2 - 1);
8959
8959
  const space = cut3.lastIndexOf(" ");
8960
8960
  if (space > Math.floor(MAX_HINT2 / 2)) cut3 = cut3.slice(0, space);
@@ -9220,14 +9220,14 @@ function targetOf(href) {
9220
9220
  return `ui/${file}`;
9221
9221
  }
9222
9222
  function navLinks(html, { owned = false } = {}) {
9223
- const text3 = String(html ?? "");
9223
+ const text4 = String(html ?? "");
9224
9224
  const regions = [];
9225
- if (owned) regions.push(text3);
9225
+ if (owned) regions.push(text4);
9226
9226
  else {
9227
- for (const open2 of text3.matchAll(NAV_OPEN)) {
9227
+ for (const open2 of text4.matchAll(NAV_OPEN)) {
9228
9228
  const start = open2.index + open2[0].length;
9229
- const end = text3.indexOf("</nav>", start);
9230
- regions.push(text3.slice(start, end === -1 ? text3.length : end));
9229
+ const end = text4.indexOf("</nav>", start);
9230
+ regions.push(text4.slice(start, end === -1 ? text4.length : end));
9231
9231
  }
9232
9232
  }
9233
9233
  const out = [];
@@ -9239,7 +9239,7 @@ function navLinks(html, { owned = false } = {}) {
9239
9239
  }
9240
9240
  }
9241
9241
  if (owned) {
9242
- for (const link of moduleLinks(text3)) if (!out.some((one) => one.target === link.target && one.gate.length === 0)) out.push(link);
9242
+ for (const link of moduleLinks(text4)) if (!out.some((one) => one.target === link.target && one.gate.length === 0)) out.push(link);
9243
9243
  }
9244
9244
  return out;
9245
9245
  }
@@ -9514,7 +9514,7 @@ var REASON_KEYS = Object.freeze([
9514
9514
  ]);
9515
9515
  var REJECTS = /(?:==|!=|\bin\b)[^\n]*(['"])(?:reject|rejected|decline|declined|deny|denied)\1/i;
9516
9516
  function pyLines(source) {
9517
- const text3 = String(source ?? "").replace(/("""|''')[\s\S]*?\1/g, (block) => block.replace(/[^\n]/g, " ")).split("\n").map((line2) => {
9517
+ const text4 = String(source ?? "").replace(/("""|''')[\s\S]*?\1/g, (block) => block.replace(/[^\n]/g, " ")).split("\n").map((line2) => {
9518
9518
  let quote = null;
9519
9519
  for (let i = 0; i < line2.length; i++) {
9520
9520
  const ch = line2[i];
@@ -9526,7 +9526,7 @@ function pyLines(source) {
9526
9526
  }
9527
9527
  return line2;
9528
9528
  });
9529
- return text3;
9529
+ return text4;
9530
9530
  }
9531
9531
  var indentOf = (line2) => /^[ \t]*/.exec(line2)[0].replace(/\t/g, " ").length;
9532
9532
  var blank = (line2) => line2.trim() === "";
@@ -9599,7 +9599,7 @@ function unliftableRefusals(contract, { handlerSource = () => void 0 } = {}) {
9599
9599
  for (const key of REASON_KEYS) {
9600
9600
  if (!reads.optional.includes(key) && !reads.required.includes(key)) continue;
9601
9601
  const vars = reasonVars(lines, key);
9602
- const mentions3 = (text3) => new RegExp(`(['"])${key}\\1`).test(text3) || [...vars].some((v) => new RegExp(`\\b${v}\\b`).test(text3));
9602
+ const mentions3 = (text4) => new RegExp(`(['"])${key}\\1`).test(text4) || [...vars].some((v) => new RegExp(`\\b${v}\\b`).test(text4));
9603
9603
  const gates = lines.map((line2, i) => [line2, i]).filter(([line2]) => /^\s*if\b/.test(line2) && [...vars].some((v) => new RegExp(`\\bnot[ \\t]+\\(?[ \\t]*${v}\\b`).test(line2)));
9604
9604
  for (const [gate, gi] of gates) {
9605
9605
  const depth = indentOf(gate);
@@ -11787,40 +11787,40 @@ var FORMULA_NUMBERS_ALONE = "its figure can be a number it states rather than an
11787
11787
  var COMPARISONS = ["<=", ">=", "==", "!=", "<", ">"];
11788
11788
  var FormulaSyntax = class extends Error {
11789
11789
  };
11790
- function tokenize2(text3) {
11790
+ function tokenize2(text4) {
11791
11791
  const tokens = [];
11792
11792
  let at = 0;
11793
11793
  const isDigit = (c) => c >= "0" && c <= "9";
11794
11794
  const isStart = (c) => /[\p{L}_]/u.test(c);
11795
11795
  const isPart5 = (c) => /[\p{L}\p{N}_]/u.test(c);
11796
- while (at < text3.length) {
11797
- const c = text3[at];
11796
+ while (at < text4.length) {
11797
+ const c = text4[at];
11798
11798
  if (/\s/.test(c)) {
11799
11799
  at += 1;
11800
- } else if (COMPARISONS.slice(0, 4).includes(text3.slice(at, at + 2))) {
11801
- tokens.push(["op", text3.slice(at, at + 2)]);
11800
+ } else if (COMPARISONS.slice(0, 4).includes(text4.slice(at, at + 2))) {
11801
+ tokens.push(["op", text4.slice(at, at + 2)]);
11802
11802
  at += 2;
11803
11803
  } else if ("+-*/(),<>".includes(c)) {
11804
11804
  tokens.push(["op", c]);
11805
11805
  at += 1;
11806
11806
  } else if (isDigit(c) || c === ".") {
11807
11807
  const start = at;
11808
- while (at < text3.length && (isDigit(text3[at]) || text3[at] === ".")) at += 1;
11809
- const spelled = text3.slice(start, at);
11808
+ while (at < text4.length && (isDigit(text4[at]) || text4[at] === ".")) at += 1;
11809
+ const spelled = text4.slice(start, at);
11810
11810
  if ((spelled.match(/\./g) ?? []).length > 1 || spelled === ".") throw new FormulaSyntax();
11811
11811
  tokens.push(["num", Number(spelled)]);
11812
11812
  } else if (isStart(c)) {
11813
11813
  const start = at;
11814
- while (at < text3.length && isPart5(text3[at])) at += 1;
11815
- tokens.push(["name", text3.slice(start, at)]);
11814
+ while (at < text4.length && isPart5(text4[at])) at += 1;
11815
+ tokens.push(["name", text4.slice(start, at)]);
11816
11816
  } else {
11817
11817
  throw new FormulaSyntax();
11818
11818
  }
11819
11819
  }
11820
11820
  return tokens;
11821
11821
  }
11822
- function parseFormula(text3) {
11823
- const tokens = tokenize2(String(text3));
11822
+ function parseFormula(text4) {
11823
+ const tokens = tokenize2(String(text4));
11824
11824
  if (tokens.length === 0) throw new FormulaSyntax();
11825
11825
  const is = (at, op) => at < tokens.length && tokens[at][0] === "op" && tokens[at][1] === op;
11826
11826
  const isComparison = (at) => at < tokens.length && tokens[at][0] === "op" && COMPARISONS.includes(tokens[at][1]);
@@ -11916,10 +11916,10 @@ function takesAnOperand(node) {
11916
11916
  if (kind === "bin") return takesAnOperand(node[2]) || takesAnOperand(node[3]);
11917
11917
  if (kind === "fn") {
11918
11918
  const [, name, args] = node;
11919
- let figures = args;
11920
- if (name === "if") figures = args.slice(1);
11921
- else if (name === "abs" || name === "round") figures = args.slice(0, 1);
11922
- return figures.length > 0 && figures.every(takesAnOperand);
11919
+ let figures2 = args;
11920
+ if (name === "if") figures2 = args.slice(1);
11921
+ else if (name === "abs" || name === "round") figures2 = args.slice(0, 1);
11922
+ return figures2.length > 0 && figures2.every(takesAnOperand);
11923
11923
  }
11924
11924
  return false;
11925
11925
  }
@@ -11968,11 +11968,11 @@ function callProblems(name, args, note) {
11968
11968
  }
11969
11969
  }
11970
11970
  }
11971
- function formulaProblems(text3, operands) {
11972
- if (typeof text3 !== "string") return { tree: null, problems: ["the formula is not text"] };
11971
+ function formulaProblems(text4, operands) {
11972
+ if (typeof text4 !== "string") return { tree: null, problems: ["the formula is not text"] };
11973
11973
  let tree;
11974
11974
  try {
11975
- tree = parseFormula(text3);
11975
+ tree = parseFormula(text4);
11976
11976
  } catch (error) {
11977
11977
  if (!(error instanceof FormulaSyntax)) throw error;
11978
11978
  return {
@@ -12662,9 +12662,9 @@ function ownedReaders(pages, extra) {
12662
12662
  const known = /* @__PURE__ */ new Set();
12663
12663
  for (const page of Array.isArray(pages) ? pages : []) {
12664
12664
  if (page?.owned !== true || !named5(page.path)) continue;
12665
- const text3 = extra?.[page.path];
12666
- if (typeof text3 !== "string" || !isOwnedPage(text3)) continue;
12667
- const embedded = embeddedContractOf({ text: text3 });
12665
+ const text4 = extra?.[page.path];
12666
+ if (typeof text4 !== "string" || !isOwnedPage(text4)) continue;
12667
+ const embedded = embeddedContractOf({ text: text4 });
12668
12668
  if (embedded === null) continue;
12669
12669
  known.add(page.path);
12670
12670
  const elements = isPlainObject8(embedded.elements) ? embedded.elements : {};
@@ -13291,7 +13291,7 @@ function appIdProblems(app) {
13291
13291
  return appIdLengthProblems(id, isPlainObject8(app.data_model.tables) ? Object.keys(app.data_model.tables) : []);
13292
13292
  }
13293
13293
  function appIdLengthProblems(id, tables) {
13294
- const bytes = (text3) => new TextEncoder().encode(text3).length;
13294
+ const bytes = (text4) => new TextEncoder().encode(text4).length;
13295
13295
  const names = [...tables].sort();
13296
13296
  if (names.length === 0) return [];
13297
13297
  let longest = names[0];
@@ -13512,8 +13512,8 @@ function paramProblems(contract, sources) {
13512
13512
  return problems;
13513
13513
  }
13514
13514
  function numberFix(value, integer = false) {
13515
- const text3 = typeof value === "string" ? value.trim() : null;
13516
- const parsed2 = text3 !== null && text3 !== "" ? Number(text3) : NaN;
13515
+ const text4 = typeof value === "string" ? value.trim() : null;
13516
+ const parsed2 = text4 !== null && text4 !== "" ? Number(text4) : NaN;
13517
13517
  if (Number.isFinite(parsed2) && (!integer || Number.isInteger(parsed2))) return `write it as the number ${parsed2}, unquoted`;
13518
13518
  return `write ${integer ? "a whole number" : "a number"}, or leave the key out`;
13519
13519
  }
@@ -19871,8 +19871,8 @@ function planPages(skeleton) {
19871
19871
  };
19872
19872
  });
19873
19873
  }
19874
- function slug2(text3) {
19875
- return text3.trim().toLowerCase().replace(/^\/+|\/+$/g, "").replace(/\.html$/, "").replace(/[^a-z0-9_-]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
19874
+ function slug2(text4) {
19875
+ return text4.trim().toLowerCase().replace(/^\/+|\/+$/g, "").replace(/\.html$/, "").replace(/[^a-z0-9_-]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
19876
19876
  }
19877
19877
  function widgetIdFor(cardId, path3, planned, boundElsewhere, taken) {
19878
19878
  const candidate = planned.get(cardId) ?? cardId;
@@ -19976,12 +19976,12 @@ function readDraft(named13, problems) {
19976
19976
  problems.push(problem3("assemble-draft", at("transforms"), '"transforms" is not an object.', `Write it as {"transforms/<name>.py": "<the file's text>"}.`));
19977
19977
  } else {
19978
19978
  draft.transforms = {};
19979
- for (const [path3, text3] of Object.entries(transforms)) {
19979
+ for (const [path3, text4] of Object.entries(transforms)) {
19980
19980
  if (!TRANSFORM_PATH3.test(path3)) {
19981
19981
  problems.push(problem3("assemble-draft", at("transforms", path3), `${JSON.stringify(path3)} is not a transform file name.`, "Name it transforms/<name>.py \u2014 lowercase letters, digits and underscores, at most 64 of them, with the worker prefix (transforms/w3_revenue_ma.py)."));
19982
- } else if (typeof text3 !== "string" || text3.trim() === "") {
19982
+ } else if (typeof text4 !== "string" || text4.trim() === "") {
19983
19983
  problems.push(problem3("assemble-draft", at("transforms", path3), `${path3} holds no text.`, 'Give the whole file as one string: "def transform(rows, ctx, params):\\n ...".'));
19984
- } else draft.transforms[path3] = text3;
19984
+ } else draft.transforms[path3] = text4;
19985
19985
  }
19986
19986
  }
19987
19987
  }
@@ -20302,10 +20302,10 @@ function mergeTransforms(drafts, widgets, widgetIds, baseTexts, problems, did) {
20302
20302
  const out = {};
20303
20303
  const carriedBy = /* @__PURE__ */ new Map();
20304
20304
  for (const draft of drafts) {
20305
- for (const [path3, text3] of Object.entries(draft.transforms ?? {})) {
20305
+ for (const [path3, text4] of Object.entries(draft.transforms ?? {})) {
20306
20306
  const earlier = carriedBy.get(path3);
20307
20307
  if (earlier !== void 0) {
20308
- if (out[path3] !== text3) {
20308
+ if (out[path3] !== text4) {
20309
20309
  problems.push(
20310
20310
  problem3(
20311
20311
  "assemble-conflict",
@@ -20317,7 +20317,7 @@ function mergeTransforms(drafts, widgets, widgetIds, baseTexts, problems, did) {
20317
20317
  }
20318
20318
  continue;
20319
20319
  }
20320
- out[path3] = text3;
20320
+ out[path3] = text4;
20321
20321
  carriedBy.set(path3, draft.name);
20322
20322
  }
20323
20323
  }
@@ -20336,7 +20336,7 @@ function mergeTransforms(drafts, widgets, widgetIds, baseTexts, problems, did) {
20336
20336
  }
20337
20337
  }
20338
20338
  const mine = new Set(Object.values(widgetIds).flat());
20339
- for (const [path3, text3] of Object.entries(out)) {
20339
+ for (const [path3, text4] of Object.entries(out)) {
20340
20340
  const name = carriedBy.get(path3) ?? "a draft";
20341
20341
  const readers = Object.entries(widgets).filter(([, row]) => isObj(row) && row["transform"] === path3).map(([id]) => id);
20342
20342
  if (readers.length === 0) {
@@ -20351,7 +20351,7 @@ function mergeTransforms(drafts, widgets, widgetIds, baseTexts, problems, did) {
20351
20351
  continue;
20352
20352
  }
20353
20353
  const held = baseTexts[path3];
20354
- if (held === text3) continue;
20354
+ if (held === text4) continue;
20355
20355
  if (held === void 0) {
20356
20356
  did.push(`${name}: ${path3}, for ${readers.join(", ")}`);
20357
20357
  continue;
@@ -20377,14 +20377,14 @@ function ownedTextsOf(doc) {
20377
20377
  const out = {};
20378
20378
  for (const entry of Array.isArray(owned) ? owned : []) {
20379
20379
  if (!isObj(entry)) continue;
20380
- const { path: path3, text: text3 } = entry;
20381
- if (typeof path3 === "string" && TRANSFORM_PATH3.test(path3) && typeof text3 === "string") out[path3] = text3;
20380
+ const { path: path3, text: text4 } = entry;
20381
+ if (typeof path3 === "string" && TRANSFORM_PATH3.test(path3) && typeof text4 === "string") out[path3] = text4;
20382
20382
  }
20383
20383
  return out;
20384
20384
  }
20385
20385
  function transformFilesOf(files) {
20386
20386
  const out = {};
20387
- for (const [path3, text3] of Object.entries(files ?? {})) if (TRANSFORM_PATH3.test(path3) && typeof text3 === "string") out[path3] = text3;
20387
+ for (const [path3, text4] of Object.entries(files ?? {})) if (TRANSFORM_PATH3.test(path3) && typeof text4 === "string") out[path3] = text4;
20388
20388
  return out;
20389
20389
  }
20390
20390
  function controlElement(path3, control) {
@@ -20588,7 +20588,7 @@ function controlOfPart(element, page, path3) {
20588
20588
  if (name === null || !Array.isArray(page["params"])) return null;
20589
20589
  const param = page["params"].find((one) => isObj(one) && one["name"] === name);
20590
20590
  if (param === void 0) return null;
20591
- const text3 = (value) => typeof value === "number" && Number.isFinite(value) ? String(value) : void 0;
20591
+ const text4 = (value) => typeof value === "number" && Number.isFinite(value) ? String(value) : void 0;
20592
20592
  const props = { param: name };
20593
20593
  if (type === "toggle") {
20594
20594
  props["type"] = "checkbox";
@@ -20603,7 +20603,7 @@ function controlOfPart(element, page, path3) {
20603
20603
  ["step", "step"],
20604
20604
  ["value", "default"]
20605
20605
  ]) {
20606
- const value = text3(param[from]);
20606
+ const value = text4(param[from]);
20607
20607
  if (value !== void 0) props[key] = value;
20608
20608
  }
20609
20609
  }
@@ -21307,8 +21307,8 @@ function formatFigure(value, unit) {
21307
21307
  }
21308
21308
  function figure(value, unit) {
21309
21309
  if (typeof value !== "number" || !Number.isFinite(value)) return String(value);
21310
- const text3 = Number.isInteger(value) ? value.toLocaleString("en-US") : value.toLocaleString("en-US", { maximumFractionDigits: 2 });
21311
- return unit === "%" ? `${text3} %` : unit === "days" ? `${text3} days` : text3;
21310
+ const text4 = Number.isInteger(value) ? value.toLocaleString("en-US") : value.toLocaleString("en-US", { maximumFractionDigits: 2 });
21311
+ return unit === "%" ? `${text4} %` : unit === "days" ? `${text4} days` : text4;
21312
21312
  }
21313
21313
  function summarise2(payload) {
21314
21314
  if (typeof payload["error"] === "string") return `ERROR ${payload["error"]}`;
@@ -21417,13 +21417,13 @@ var HARNESS = [
21417
21417
  " except BaseException as exc:",
21418
21418
  ' answer({"ok": False, "type": type(exc).__name__, "message": str(exc)[:2000], "traceback": traceback.format_exc()[-20000:]})'
21419
21419
  ].join("\n");
21420
- function runTransformLocally(text3, path3, rows2, params, {
21420
+ function runTransformLocally(text4, path3, rows2, params, {
21421
21421
  python = "python3",
21422
21422
  timeoutMs = TRANSFORM_TIMEOUT_MS,
21423
21423
  answerBytes = ANSWER_BYTES
21424
21424
  } = {}) {
21425
21425
  const result = spawnSync(python, ["-I", "-c", HARNESS], {
21426
- input: JSON.stringify({ text: text3, path: path3, rows: rows2, params, calls: [...FORBIDDEN_CALLS2] }),
21426
+ input: JSON.stringify({ text: text4, path: path3, rows: rows2, params, calls: [...FORBIDDEN_CALLS2] }),
21427
21427
  // Not a boundary (see WHAT RUNS HERE), but nothing to hand over either:
21428
21428
  // no token or secret this process was started with, no project folder.
21429
21429
  env: runEnv(),
@@ -21493,8 +21493,8 @@ function printedLines(path3, printed) {
21493
21493
  function bounded(traceback) {
21494
21494
  const lines = traceback.replace(/\s+$/, "").split("\n").filter((line2) => !line2.startsWith(' File "<string>"'));
21495
21495
  const kept = lines.length > TRACEBACK_LINES ? [" \u2026", ...lines.slice(-TRACEBACK_LINES)] : lines;
21496
- const text3 = kept.join("\n");
21497
- return text3.length > TRACEBACK_CHARS ? `\u2026${text3.slice(-TRACEBACK_CHARS)}` : text3;
21496
+ const text4 = kept.join("\n");
21497
+ return text4.length > TRACEBACK_CHARS ? `\u2026${text4.slice(-TRACEBACK_CHARS)}` : text4;
21498
21498
  }
21499
21499
  function transformTextsFor(document, spec, shared = {}) {
21500
21500
  const carried = { ...shared, ...isObj2(document) && isObj2(document["transforms"]) ? document["transforms"] : {} };
@@ -21502,8 +21502,8 @@ function transformTextsFor(document, spec, shared = {}) {
21502
21502
  for (const row of Object.values(spec)) {
21503
21503
  const path3 = isObj2(row) ? row["transform"] : void 0;
21504
21504
  if (typeof path3 !== "string" || !TRANSFORM_PATH4.test(path3) || Object.hasOwn(out, path3)) continue;
21505
- const text3 = Object.hasOwn(carried, path3) ? carried[path3] : void 0;
21506
- if (typeof text3 === "string") out[path3] = text3;
21505
+ const text4 = Object.hasOwn(carried, path3) ? carried[path3] : void 0;
21506
+ if (typeof text4 === "string") out[path3] = text4;
21507
21507
  }
21508
21508
  return out;
21509
21509
  }
@@ -21524,15 +21524,15 @@ function planTransforms(spec, answers, texts) {
21524
21524
  };
21525
21525
  continue;
21526
21526
  }
21527
- const text3 = texts[path3];
21528
- if (text3 === void 0) {
21527
+ const text4 = texts[path3];
21528
+ if (text4 === void 0) {
21529
21529
  plan.failed[id] = {
21530
21530
  sentence: `${path3} was not run: preview runs only a transform the draft carries under "transforms", never a file from the folder, which may hold someone else's`,
21531
21531
  detail: [`to preview it, carry ${path3}'s text in a SPEC draft's "transforms"; or ship, and read the card after the push`]
21532
21532
  };
21533
21533
  continue;
21534
21534
  }
21535
- const lint = lintTransform2(text3);
21535
+ const lint = lintTransform2(text4);
21536
21536
  if (lint.length > 0) {
21537
21537
  plan.failed[id] = {
21538
21538
  sentence: `${path3} was not run: compile would refuse it (transform_forbidden)`,
@@ -21542,7 +21542,7 @@ function planTransforms(spec, answers, texts) {
21542
21542
  }
21543
21543
  const params = isObj2(meta["params_applied"]) ? meta["params_applied"] : defaultsOf(row["params"]);
21544
21544
  const input = Array.isArray(answer["rows"]) ? answer["rows"] : [];
21545
- const run = runTransformLocally(text3, path3, input, params);
21545
+ const run = runTransformLocally(text4, path3, input, params);
21546
21546
  if (!run.ok) {
21547
21547
  plan.failed[id] = {
21548
21548
  sentence: run.failure ?? `${path3} failed`,
@@ -21585,12 +21585,12 @@ function registerPreviewCommand(parent) {
21585
21585
  ).option("--payload <json>", 'The request to serve (default: {"op": "load"}).')
21586
21586
  )
21587
21587
  ).action(async (file, opts) => {
21588
- const text3 = await readFile6(file, "utf8").catch(() => {
21588
+ const text4 = await readFile6(file, "utf8").catch(() => {
21589
21589
  throw new Error(`cannot read ${file}`);
21590
21590
  });
21591
21591
  let document;
21592
21592
  try {
21593
- document = JSON.parse(text3);
21593
+ document = JSON.parse(text4);
21594
21594
  } catch {
21595
21595
  throw new Error(`${file} is not valid JSON`);
21596
21596
  }
@@ -21807,10 +21807,10 @@ function metricsTransport(client) {
21807
21807
  headers,
21808
21808
  ...body === void 0 ? {} : { body: JSON.stringify(body) }
21809
21809
  });
21810
- const text3 = res.body.toString("utf8");
21811
- let parsed2 = text3 === "" ? null : text3;
21810
+ const text4 = res.body.toString("utf8");
21811
+ let parsed2 = text4 === "" ? null : text4;
21812
21812
  try {
21813
- parsed2 = text3 === "" ? null : JSON.parse(text3);
21813
+ parsed2 = text4 === "" ? null : JSON.parse(text4);
21814
21814
  } catch {
21815
21815
  }
21816
21816
  return { status: res.status, body: parsed2 };
@@ -22941,7 +22941,7 @@ function sentUi(body) {
22941
22941
  const out = {};
22942
22942
  const plain = body["frontend_bundle"];
22943
22943
  if (typeof plain === "object" && plain !== null) {
22944
- for (const [path3, text3] of Object.entries(plain)) out[path3] = text3;
22944
+ for (const [path3, text4] of Object.entries(plain)) out[path3] = text4;
22945
22945
  }
22946
22946
  const gz = body["frontend_bundle_gz"];
22947
22947
  if (typeof gz === "object" && gz !== null) {
@@ -23105,13 +23105,13 @@ async function pushBody(dir, opts) {
23105
23105
  return { appId, body, handlers };
23106
23106
  }
23107
23107
  function chartsWithoutEcharts(files) {
23108
- const text3 = new Map(files.map((file) => [file.path, file.bytes.toString("utf8")]));
23108
+ const text4 = new Map(files.map((file) => [file.path, file.bytes.toString("utf8")]));
23109
23109
  const out = [];
23110
- for (const [path3, html] of text3) {
23110
+ for (const [path3, html] of text4) {
23111
23111
  if (!path3.endsWith(".html") || html.includes('echarts.min.js"></script>')) continue;
23112
23112
  const modules = new Set([...html.matchAll(/data-dr-module="([^"]+)"/g)].map((match) => match[1]));
23113
23113
  for (const module of [...modules].sort()) {
23114
- const source = text3.get(module);
23114
+ const source = text4.get(module);
23115
23115
  if (source !== void 0 && CHARTING_RE.test(source)) {
23116
23116
  out.push(`ui/${path3} loads no echarts, but ui/${module} names a chart; run \`app-space compile\` again so the page loads it`);
23117
23117
  }
@@ -23262,8 +23262,8 @@ async function recordedRenderer(dir) {
23262
23262
  return null;
23263
23263
  }
23264
23264
  }
23265
- function digestOf(text3) {
23266
- return createHash3("sha256").update(text3, "utf8").digest("hex");
23265
+ function digestOf(text4) {
23266
+ return createHash3("sha256").update(text4, "utf8").digest("hex");
23267
23267
  }
23268
23268
  async function recordedDigests(dir) {
23269
23269
  try {
@@ -23424,17 +23424,17 @@ async function writeOwnedFiles(dir, document, { force = false } = {}) {
23424
23424
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) continue;
23425
23425
  const entry = raw;
23426
23426
  const path3 = entry["path"];
23427
- const text3 = entry["text"];
23428
- if (typeof path3 !== "string" || typeof text3 !== "string" || !OWNED_TEXT_PATH.test(path3)) continue;
23427
+ const text4 = entry["text"];
23428
+ if (typeof path3 !== "string" || typeof text4 !== "string" || !OWNED_TEXT_PATH.test(path3)) continue;
23429
23429
  const full = join10(dir, path3);
23430
23430
  const existing = await readIfPresent(full);
23431
- if (existing === text3) continue;
23431
+ if (existing === text4) continue;
23432
23432
  if (existing !== void 0 && !force) {
23433
23433
  kept.push(path3);
23434
23434
  continue;
23435
23435
  }
23436
23436
  await mkdir4(dirname3(full), { recursive: true });
23437
- await writeFile5(full, text3);
23437
+ await writeFile5(full, text4);
23438
23438
  wrote.push(path3);
23439
23439
  }
23440
23440
  return { wrote: wrote.sort(), kept: kept.sort() };
@@ -23692,8 +23692,8 @@ function unchecked2(status, detail) {
23692
23692
  skipped: []
23693
23693
  };
23694
23694
  }
23695
- function firstLineOf(text3) {
23696
- const line2 = text3.split("\n")[0] ?? "";
23695
+ function firstLineOf(text4) {
23696
+ const line2 = text4.split("\n")[0] ?? "";
23697
23697
  return line2.length > 300 ? `${line2.slice(0, 299)}\u2026` : line2;
23698
23698
  }
23699
23699
  function fromRefusal(status, detail, contract) {
@@ -23772,13 +23772,13 @@ async function stage(dir, scratch, files) {
23772
23772
  filter: (source) => !/[\\/](node_modules|\.git)$/.test(source)
23773
23773
  });
23774
23774
  const root = resolve5(scratch);
23775
- for (const [path3, text3] of Object.entries(files)) {
23775
+ for (const [path3, text4] of Object.entries(files)) {
23776
23776
  const full = resolve5(root, path3);
23777
23777
  if (!full.startsWith(root + sep2)) {
23778
23778
  return `the package names a path outside its folder (${JSON.stringify(path3)})`;
23779
23779
  }
23780
23780
  await mkdir5(dirname4(full), { recursive: true });
23781
- await writeFile6(full, text3);
23781
+ await writeFile6(full, text4);
23782
23782
  }
23783
23783
  return null;
23784
23784
  }
@@ -23797,19 +23797,19 @@ function skip(why) {
23797
23797
  return { problems: [], skipped: [{ what: WHAT, why }] };
23798
23798
  }
23799
23799
  function parse(bytes) {
23800
- const text3 = bytes.toString("utf8");
23801
- if (text3 === "") return void 0;
23800
+ const text4 = bytes.toString("utf8");
23801
+ if (text4 === "") return void 0;
23802
23802
  try {
23803
- return JSON.parse(text3);
23803
+ return JSON.parse(text4);
23804
23804
  } catch {
23805
- return text3;
23805
+ return text4;
23806
23806
  }
23807
23807
  }
23808
23808
  function detailOf(body) {
23809
23809
  return isObj4(body) ? body["detail"] : void 0;
23810
23810
  }
23811
- function sentence(text3) {
23812
- return text3.endsWith(".") ? text3 : `${text3}.`;
23811
+ function sentence(text4) {
23812
+ return text4.endsWith(".") ? text4 : `${text4}.`;
23813
23813
  }
23814
23814
  function firstLine2(err) {
23815
23815
  return (err instanceof Error ? err.message : String(err)).split("\n")[0] ?? "";
@@ -24167,7 +24167,7 @@ function libraryOrderProblems(page, files = []) {
24167
24167
  const indexOf = (module) => elements.findIndex((el) => el.tag === "script" && el.attrs.src !== void 0 && RUNTIME_LIBRARIES.find((one) => one.module === module).pattern.test(resolveFromPlatformRoot(page.path, el.attrs.src) ?? ""));
24168
24168
  const inline = elements.filter((el) => el.tag === "script" && !("src" in el.attrs));
24169
24169
  const textOf3 = (el) => "src" in el.attrs ? files.find((file) => file.path === resolveInBundle(page.path, el.attrs.src))?.text : scripts[inline.indexOf(el)]?.text;
24170
- const calls = (text3) => typeof text3 === "string" && MOUNT_CALL.test(withoutRegexLiterals(executableText(text3)));
24170
+ const calls = (text4) => typeof text4 === "string" && MOUNT_CALL.test(withoutRegexLiterals(executableText(text4)));
24171
24171
  const runs = (el) => runsInPlace(el) || (el.attrs.type ?? "").trim().toLowerCase() === "module";
24172
24172
  const mounts = elements.filter((el) => el.tag === "script" && runs(el) && calls(textOf3(el)));
24173
24173
  const mountScript = mounts.find((el) => !runsAfterParsing(el));
@@ -24811,19 +24811,19 @@ function collectScripts(app, page, runtime = null) {
24811
24811
  }
24812
24812
  return scripts;
24813
24813
  }
24814
- function handlerDerivedNames(text3) {
24814
+ function handlerDerivedNames(text4) {
24815
24815
  const names = /* @__PURE__ */ new Set();
24816
24816
  const assigned = /(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*await\s+(?:call\(|[\w.$]*fetch\(|[\w.$]+\.json\()/g;
24817
24817
  const thenParam = /\.then\(\s*(?:async\s*)?\(?\s*([A-Za-z_$][\w$]*)/g;
24818
24818
  for (const re of [assigned, thenParam]) {
24819
24819
  let match;
24820
- while ((match = re.exec(text3)) !== null) names.add(match[1]);
24820
+ while ((match = re.exec(text4)) !== null) names.add(match[1]);
24821
24821
  }
24822
24822
  return names;
24823
24823
  }
24824
- function lineOffset(text3, index) {
24824
+ function lineOffset(text4, index) {
24825
24825
  let lines = 0;
24826
- for (let i = 0; i < index; i++) if (text3.charCodeAt(i) === 10) lines++;
24826
+ for (let i = 0; i < index; i++) if (text4.charCodeAt(i) === 10) lines++;
24827
24827
  return lines;
24828
24828
  }
24829
24829
  function checkControl(el, boxes, where2) {
@@ -24839,25 +24839,25 @@ function checkControl(el, boxes, where2) {
24839
24839
  }
24840
24840
  return [];
24841
24841
  }
24842
- function controlBoxes(text3) {
24842
+ function controlBoxes(text4) {
24843
24843
  const boxes = [];
24844
24844
  const open2 = new RegExp(`<([a-zA-Z][\\w-]*)([^>]*\\b${KIT_MARK}\\s*=\\s*["'](?:${[...CONTROL_BOXES].join("|")})["'][^>]*)>`, "g");
24845
24845
  let match;
24846
- while ((match = open2.exec(text3)) !== null) {
24847
- boxes.push([lineAt(text3, match.index), lineAt(text3, closingTag(text3, match[1].toLowerCase(), open2.lastIndex))]);
24846
+ while ((match = open2.exec(text4)) !== null) {
24847
+ boxes.push([lineAt(text4, match.index), lineAt(text4, closingTag(text4, match[1].toLowerCase(), open2.lastIndex))]);
24848
24848
  }
24849
24849
  return boxes;
24850
24850
  }
24851
- function closingTag(text3, tag, from) {
24851
+ function closingTag(text4, tag, from) {
24852
24852
  const re = new RegExp(`<(/?)${tag}\\b`, "gi");
24853
24853
  re.lastIndex = from;
24854
24854
  let depth = 1;
24855
24855
  let match;
24856
- while ((match = re.exec(text3)) !== null) {
24856
+ while ((match = re.exec(text4)) !== null) {
24857
24857
  depth += match[1] ? -1 : 1;
24858
24858
  if (depth === 0) return match.index;
24859
24859
  }
24860
- return text3.length;
24860
+ return text4.length;
24861
24861
  }
24862
24862
  function checkControls(page, controls, scriptText, handlerText) {
24863
24863
  const violations = [];
@@ -24934,8 +24934,8 @@ function checkHandlers(app, frontendText, cardHandlers = /* @__PURE__ */ new Set
24934
24934
  for (const literal of findDataLiterals(carried.texts === null ? handler.source : blanked(handler.source, carried.span))) {
24935
24935
  violations.push({ rule: "R1.3", where: `${where2}:${literal.line}`, message: `numeric data literal (${literal.numbers} numbers): ${literal.sample}` });
24936
24936
  }
24937
- for (const [path3, text3] of Object.entries(carried.texts ?? {})) {
24938
- for (const literal of findTransformLiterals(text3)) {
24937
+ for (const [path3, text4] of Object.entries(carried.texts ?? {})) {
24938
+ for (const literal of findTransformLiterals(text4)) {
24939
24939
  violations.push({
24940
24940
  rule: "R1.3",
24941
24941
  where: `${path3}:${literal.line}`,
@@ -25326,17 +25326,17 @@ function resolve6(token, overrides, seen = /* @__PURE__ */ new Set()) {
25326
25326
  }
25327
25327
  function rootTokens(css) {
25328
25328
  const out = /* @__PURE__ */ new Map();
25329
- const text3 = css.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
25330
- for (const block of text3.matchAll(/:root\s*\{([^}]*)\}/g)) {
25329
+ const text4 = css.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
25330
+ for (const block of text4.matchAll(/:root\s*\{([^}]*)\}/g)) {
25331
25331
  const offset = block.index + block[0].indexOf("{");
25332
25332
  for (const hit of block[1].matchAll(/(--dr-[a-z0-9-]+)\s*:\s*([^;]+);/g)) {
25333
- out.set(hit[1], { value: hit[2].trim(), line: lineOf(text3, offset + hit.index) });
25333
+ out.set(hit[1], { value: hit[2].trim(), line: lineOf(text4, offset + hit.index) });
25334
25334
  }
25335
25335
  }
25336
25336
  return out;
25337
25337
  }
25338
- function lineOf(text3, index) {
25339
- return text3.slice(0, index).split("\n").length;
25338
+ function lineOf(text4, index) {
25339
+ return text4.slice(0, index).split("\n").length;
25340
25340
  }
25341
25341
  function dedupe2(violations) {
25342
25342
  const seen = /* @__PURE__ */ new Set();
@@ -25348,17 +25348,17 @@ function dedupe2(violations) {
25348
25348
  });
25349
25349
  }
25350
25350
  function rgbOf2(value, over) {
25351
- const text3 = String(value || "").trim();
25351
+ const text4 = String(value || "").trim();
25352
25352
  let parts = null;
25353
25353
  let alpha = 1;
25354
- if (text3.startsWith("#")) {
25355
- let hex = text3.slice(1);
25354
+ if (text4.startsWith("#")) {
25355
+ let hex = text4.slice(1);
25356
25356
  if (hex.length === 3) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
25357
25357
  if (/^[0-9a-f]{6,8}$/i.test(hex)) {
25358
25358
  parts = [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16)];
25359
25359
  }
25360
25360
  } else {
25361
- const hit = /rgba?\(([^)]+)\)/.exec(text3);
25361
+ const hit = /rgba?\(([^)]+)\)/.exec(text4);
25362
25362
  if (hit) {
25363
25363
  const bits = hit[1].split(/[,/]/).map((bit) => parseFloat(bit));
25364
25364
  parts = [bits[0], bits[1], bits[2]];
@@ -25417,7 +25417,7 @@ function verify({ app: appRef, catalog, agent, describe: describe7, load }, { ex
25417
25417
  const liveness2 = checkLiveness(contract, load, {
25418
25418
  handlerWhere: app.handlers[0]?.file || app.handlersSource
25419
25419
  });
25420
- const figures = checkFigures(contract, {
25420
+ const figures2 = checkFigures(contract, {
25421
25421
  handlerWhere: app.handlers[0]?.file || app.handlersSource
25422
25422
  });
25423
25423
  const violations = [
@@ -25439,7 +25439,7 @@ function verify({ app: appRef, catalog, agent, describe: describe7, load }, { ex
25439
25439
  return {
25440
25440
  ok: violations.length === 0,
25441
25441
  violations,
25442
- warnings: figures.warnings.sort(byRuleThenWhere),
25442
+ warnings: figures2.warnings.sort(byRuleThenWhere),
25443
25443
  skipped,
25444
25444
  app: { id: appRef.id ?? app.manifest.id, version: appRef.version ?? null },
25445
25445
  kit: KIT.name,
@@ -25602,9 +25602,9 @@ function walkFrom2(base, clean) {
25602
25602
  }
25603
25603
  return resolved;
25604
25604
  }
25605
- function lineAt2(text3, index) {
25605
+ function lineAt2(text4, index) {
25606
25606
  let line2 = 1;
25607
- for (let i = 0; i < index && i < text3.length; i++) if (text3.charCodeAt(i) === 10) line2++;
25607
+ for (let i = 0; i < index && i < text4.length; i++) if (text4.charCodeAt(i) === 10) line2++;
25608
25608
  return line2;
25609
25609
  }
25610
25610
 
@@ -25836,11 +25836,11 @@ function parseDeclares2(raw) {
25836
25836
  }
25837
25837
  var PAIR2 = /(["'])data-dr-([a-z][a-z-]*)\1\s*:\s*(["'])([^"'\\]*)\3/g;
25838
25838
  var REGEX_AFTER2 = /* @__PURE__ */ new Set(["", "(", ",", "=", ":", "[", "!", "&", "|", "?", ";", "+", "-", "*", "%", "~", "^", "<", ">"]);
25839
- function scanBundle2(text3, { file, page }) {
25839
+ function scanBundle2(text4, { file, page }) {
25840
25840
  const pairs = /* @__PURE__ */ new Map();
25841
- for (const match of text3.matchAll(PAIR2)) pairs.set(match.index, { attr: match[2], value: match[4] });
25841
+ for (const match of text4.matchAll(PAIR2)) pairs.set(match.index, { attr: match[2], value: match[4] });
25842
25842
  if (pairs.size === 0) return [];
25843
- const objects = groupByObject2(text3, pairs);
25843
+ const objects = groupByObject2(text4, pairs);
25844
25844
  const elements = [];
25845
25845
  for (const found of objects) {
25846
25846
  const attrs = {};
@@ -25881,21 +25881,21 @@ function scanBundle2(text3, { file, page }) {
25881
25881
  }
25882
25882
  return elements;
25883
25883
  }
25884
- function groupByObject2(text3, pairs) {
25884
+ function groupByObject2(text4, pairs) {
25885
25885
  const byObject = /* @__PURE__ */ new Map();
25886
25886
  const stack = [];
25887
25887
  let previous = "";
25888
25888
  let i = 0;
25889
- while (i < text3.length) {
25890
- const ch = text3[i];
25891
- if (ch === "/" && text3[i + 1] === "/") {
25892
- const end = text3.indexOf("\n", i);
25893
- i = end === -1 ? text3.length : end + 1;
25889
+ while (i < text4.length) {
25890
+ const ch = text4[i];
25891
+ if (ch === "/" && text4[i + 1] === "/") {
25892
+ const end = text4.indexOf("\n", i);
25893
+ i = end === -1 ? text4.length : end + 1;
25894
25894
  continue;
25895
25895
  }
25896
- if (ch === "/" && text3[i + 1] === "*") {
25897
- const end = text3.indexOf("*/", i + 2);
25898
- i = end === -1 ? text3.length : end + 2;
25896
+ if (ch === "/" && text4[i + 1] === "*") {
25897
+ const end = text4.indexOf("*/", i + 2);
25898
+ i = end === -1 ? text4.length : end + 2;
25899
25899
  continue;
25900
25900
  }
25901
25901
  if (ch === '"' || ch === "'" || ch === "`") {
@@ -25905,12 +25905,12 @@ function groupByObject2(text3, pairs) {
25905
25905
  if (!byObject.has(open2)) byObject.set(open2, []);
25906
25906
  byObject.get(open2).push(pair);
25907
25907
  }
25908
- i = endOfString2(text3, i);
25908
+ i = endOfString2(text4, i);
25909
25909
  previous = '"';
25910
25910
  continue;
25911
25911
  }
25912
25912
  if (ch === "/" && REGEX_AFTER2.has(previous)) {
25913
- i = endOfRegex2(text3, i);
25913
+ i = endOfRegex2(text4, i);
25914
25914
  previous = "/";
25915
25915
  continue;
25916
25916
  }
@@ -25921,25 +25921,25 @@ function groupByObject2(text3, pairs) {
25921
25921
  }
25922
25922
  return [...byObject.entries()].sort((a, b) => a[0] - b[0]).map(([, found]) => found);
25923
25923
  }
25924
- function endOfString2(text3, start) {
25925
- const quote = text3[start];
25926
- for (let i = start + 1; i < text3.length; i += 1) {
25927
- if (text3[i] === "\\") i += 1;
25928
- else if (text3[i] === quote) return i + 1;
25924
+ function endOfString2(text4, start) {
25925
+ const quote = text4[start];
25926
+ for (let i = start + 1; i < text4.length; i += 1) {
25927
+ if (text4[i] === "\\") i += 1;
25928
+ else if (text4[i] === quote) return i + 1;
25929
25929
  }
25930
- return text3.length;
25930
+ return text4.length;
25931
25931
  }
25932
- function endOfRegex2(text3, start) {
25932
+ function endOfRegex2(text4, start) {
25933
25933
  let inClass = false;
25934
- for (let i = start + 1; i < text3.length; i += 1) {
25935
- const ch = text3[i];
25934
+ for (let i = start + 1; i < text4.length; i += 1) {
25935
+ const ch = text4[i];
25936
25936
  if (ch === "\\") i += 1;
25937
25937
  else if (ch === "\n") return i;
25938
25938
  else if (ch === "[") inClass = true;
25939
25939
  else if (ch === "]") inClass = false;
25940
25940
  else if (ch === "/" && !inClass) return i + 1;
25941
25941
  }
25942
- return text3.length;
25942
+ return text4.length;
25943
25943
  }
25944
25944
 
25945
25945
  // ../flows/appspace-builder/kit/contract/pySpec.mjs
@@ -26031,8 +26031,8 @@ function tokenize3(src, d) {
26031
26031
  }
26032
26032
  const number = /^(?:0[xXbBoO][0-9a-fA-F_]+|(?:\d[\d_]*\.?[\d_]*|\.\d[\d_]*)(?:[eE][+-]?\d+)?)/.exec(src.slice(i, i + 40));
26033
26033
  if (number && /\d/.test(number[0])) {
26034
- const text3 = number[0].replace(/_/g, "");
26035
- push("number", Number(text3), i, i + number[0].length);
26034
+ const text4 = number[0].replace(/_/g, "");
26035
+ push("number", Number(text4), i, i + number[0].length);
26036
26036
  i += number[0].length;
26037
26037
  continue;
26038
26038
  }
@@ -26125,8 +26125,8 @@ function unescape2(body) {
26125
26125
  }
26126
26126
  return out;
26127
26127
  }
26128
- function cut2(text3, max = MAX_TEXT2) {
26129
- const flat = String(text3).replace(/\s+/g, " ").trim();
26128
+ function cut2(text4, max = MAX_TEXT2) {
26129
+ const flat = String(text4).replace(/\s+/g, " ").trim();
26130
26130
  return flat.length > max ? flat.slice(0, max) : flat;
26131
26131
  }
26132
26132
  var Literals2 = class {
@@ -26263,7 +26263,7 @@ var Literals2 = class {
26263
26263
  return this.d.bare === "callable" ? { $callable: value } : { $unresolved: cut2(value) };
26264
26264
  }
26265
26265
  parseString(index) {
26266
- let text3 = "";
26266
+ let text4 = "";
26267
26267
  let i = index;
26268
26268
  while (this.tokens[i]?.type === "string" || this.depth > 0 && this.tokens[i]?.type === "newline") {
26269
26269
  const token = this.tokens[i];
@@ -26274,10 +26274,10 @@ var Literals2 = class {
26274
26274
  }
26275
26275
  const piece = token.prefix.includes("f") ? this.interpolate(token) : token.value;
26276
26276
  if (piece === null) return null;
26277
- text3 += piece;
26277
+ text4 += piece;
26278
26278
  i += 1;
26279
26279
  }
26280
- return i === index ? null : { value: text3, next: i };
26280
+ return i === index ? null : { value: text4, next: i };
26281
26281
  }
26282
26282
  /**
26283
26283
  * An f-string whose fields are all plain constant names, substituted. A
@@ -26622,7 +26622,7 @@ function readTransforms2(source) {
26622
26622
  if (!literals.has(TRANSFORMS_TABLE2)) return { found: false, texts: null, span: null, text: null };
26623
26623
  const value = literals.constant(TRANSFORMS_TABLE2);
26624
26624
  const span = literals.constantSpan(TRANSFORMS_TABLE2);
26625
- const readable = isPlainObject12(value) && Object.entries(value).every(([path3, text3]) => TRANSFORM_PATH5.test(path3) && typeof text3 === "string");
26625
+ const readable = isPlainObject12(value) && Object.entries(value).every(([path3, text4]) => TRANSFORM_PATH5.test(path3) && typeof text4 === "string");
26626
26626
  if (!readable) return { found: true, texts: null, span, text: literals.constantText(TRANSFORMS_TABLE2) };
26627
26627
  const texts = {};
26628
26628
  for (const path3 of Object.keys(value).sort(natural4)) texts[path3] = value[path3];
@@ -26818,9 +26818,9 @@ function routesOf3(manifest) {
26818
26818
  function themeSection2(app) {
26819
26819
  const file = app.ui.find((entry) => entry.path === THEME_FILE6);
26820
26820
  if (!file) return null;
26821
- const text3 = file.text.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
26821
+ const text4 = file.text.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
26822
26822
  const tokens = {};
26823
- for (const block of text3.matchAll(/(?::root|body\.dr-app-page)\s*\{([^}]*)\}/g)) {
26823
+ for (const block of text4.matchAll(/(?::root|body\.dr-app-page)\s*\{([^}]*)\}/g)) {
26824
26824
  for (const hit of block[1].matchAll(/(--dr-[a-z0-9-]+)\s*:\s*([^;]+);/g)) {
26825
26825
  if (hit[1] !== "--dr-app-theme") tokens[hit[1]] = hit[2].trim();
26826
26826
  }
@@ -27003,10 +27003,10 @@ function mountOf2(page) {
27003
27003
  };
27004
27004
  }
27005
27005
  function embeddedContractOf2(page) {
27006
- const text3 = contractBlockText2(page?.text ?? "");
27007
- if (text3 === null) return null;
27006
+ const text4 = contractBlockText2(page?.text ?? "");
27007
+ if (text4 === null) return null;
27008
27008
  try {
27009
- const embedded = JSON.parse(text3.replace(/<\\\//g, "</"));
27009
+ const embedded = JSON.parse(text4.replace(/<\\\//g, "</"));
27010
27010
  return isPlainObject12(embedded) ? embedded : null;
27011
27011
  } catch {
27012
27012
  return null;
@@ -27038,10 +27038,10 @@ function cardSpecOf2(element) {
27038
27038
  return element?.type === "widget" && typeof card === "string" && card !== "" ? card : null;
27039
27039
  }
27040
27040
  var RUNTIME_RENDERER4 = "runtime";
27041
- function navGates2(text3, pagePath) {
27041
+ function navGates2(text4, pagePath) {
27042
27042
  const out = /* @__PURE__ */ new Map();
27043
- if (typeof text3 !== "string") return out;
27044
- const tree = decodedTree2(text3);
27043
+ if (typeof text4 !== "string") return out;
27044
+ const tree = decodedTree2(text4);
27045
27045
  const base = pagePath.includes("/") ? pagePath.slice(0, pagePath.lastIndexOf("/") + 1) : "";
27046
27046
  for (const node of tree.nodes) {
27047
27047
  if (node.tag !== "a" || typeof node.attrs.href !== "string" || typeof node.attrs["data-dr-role"] !== "string") continue;
@@ -27172,7 +27172,7 @@ function numberAttr2(node, name) {
27172
27172
  if (raw === "") return null;
27173
27173
  return Number.isFinite(Number(raw)) ? Number(raw) : raw;
27174
27174
  }
27175
- function propsOf2(node, text3, tree) {
27175
+ function propsOf2(node, text4, tree) {
27176
27176
  const props = {};
27177
27177
  for (const [name, value] of Object.entries(node.attrs)) {
27178
27178
  if (!name.startsWith(WIDGET_PREFIX2)) continue;
@@ -27184,13 +27184,13 @@ function propsOf2(node, text3, tree) {
27184
27184
  props.param = node.attrs[CONTROL_ATTR2];
27185
27185
  props.control_kind = node.attrs[`${CONTROL_ATTR2}-kind`] ?? null;
27186
27186
  for (const name of CONTROL_PROPS2) if (name in node.attrs) props[name] = node.attrs[name];
27187
- const label = labelFor2(node, text3, tree);
27187
+ const label = labelFor2(node, text4, tree);
27188
27188
  if (label !== null) props.label = label;
27189
27189
  }
27190
27190
  if (node.tag === "a" && "href" in node.attrs) {
27191
27191
  props.href = node.attrs.href;
27192
27192
  props.current = node.attrs["aria-current"] === "page";
27193
- const label = textOf2(text3, node);
27193
+ const label = textOf2(text4, node);
27194
27194
  if (label) props.label = label;
27195
27195
  }
27196
27196
  if (COMPONENT_ATTR3 in node.attrs || FIELD_ATTR2 in node.attrs) {
@@ -27204,9 +27204,9 @@ function propsOf2(node, text3, tree) {
27204
27204
  const inputType = inputTypeOf2(node);
27205
27205
  if (inputType !== null) props.input_type = inputType;
27206
27206
  if ("required" in node.attrs) props.required = true;
27207
- if (node.tag === "select") props.options = optionsOf2(node, text3, tree);
27207
+ if (node.tag === "select") props.options = optionsOf2(node, text4, tree);
27208
27208
  if (props.label === void 0) {
27209
- const label = labelFor2(node, text3, tree);
27209
+ const label = labelFor2(node, text4, tree);
27210
27210
  if (label !== null) props.label = label;
27211
27211
  }
27212
27212
  }
@@ -27220,13 +27220,13 @@ function inputTypeOf2(node) {
27220
27220
  if (node.tag === "input") return node.attrs.type ?? "text";
27221
27221
  return null;
27222
27222
  }
27223
- function optionsOf2(node, text3, tree) {
27223
+ function optionsOf2(node, text4, tree) {
27224
27224
  const options = [];
27225
27225
  const walk5 = (index) => {
27226
27226
  for (const child of tree.nodes[index].children) {
27227
27227
  const candidate = tree.nodes[child];
27228
27228
  if (candidate.tag === "option") {
27229
- if (!("disabled" in candidate.attrs)) options.push(candidate.attrs.value ?? textOf2(text3, candidate));
27229
+ if (!("disabled" in candidate.attrs)) options.push(candidate.attrs.value ?? textOf2(text4, candidate));
27230
27230
  } else walk5(child);
27231
27231
  }
27232
27232
  };
@@ -27236,15 +27236,15 @@ function optionsOf2(node, text3, tree) {
27236
27236
  function splitList2(value) {
27237
27237
  return String(value).split(/[\s,]+/).filter(Boolean);
27238
27238
  }
27239
- function labelFor2(node, text3, tree) {
27239
+ function labelFor2(node, text4, tree) {
27240
27240
  const id = node.attrs.id;
27241
27241
  if (!id) return node.attrs["aria-label"] ?? null;
27242
27242
  const label = tree.nodes.find((candidate) => candidate.tag === "label" && candidate.attrs.for === id);
27243
- return label ? textOf2(text3, label) : node.attrs["aria-label"] ?? null;
27243
+ return label ? textOf2(text4, label) : node.attrs["aria-label"] ?? null;
27244
27244
  }
27245
- function textOf2(text3, node) {
27246
- const next = text3.indexOf("<", node.end);
27247
- return decodeEntities3(text3.slice(node.end, next === -1 ? void 0 : next).replace(/\s+/g, " ").trim());
27245
+ function textOf2(text4, node) {
27246
+ const next = text4.indexOf("<", node.end);
27247
+ return decodeEntities3(text4.slice(node.end, next === -1 ? void 0 : next).replace(/\s+/g, " ").trim());
27248
27248
  }
27249
27249
  function slotsOf2(node, tree) {
27250
27250
  if (!(WIDGET_ATTR2 in node.attrs)) return {};
@@ -27269,23 +27269,23 @@ function bindingOf2(entry, node, spec) {
27269
27269
  if (entry.type === "control") return node.attrs[CONTROL_ATTR2] || null;
27270
27270
  return null;
27271
27271
  }
27272
- function titleOf2(tree, text3) {
27272
+ function titleOf2(tree, text4) {
27273
27273
  const title = tree.nodes.find((node) => node.tag === "title");
27274
- return title ? textOf2(text3, title) : null;
27274
+ return title ? textOf2(text4, title) : null;
27275
27275
  }
27276
- function headerOf2(tree, text3) {
27276
+ function headerOf2(tree, text4) {
27277
27277
  const withClass = (name) => tree.nodes.find((node) => classesOf3(node).includes(name));
27278
27278
  const title = withClass("dr-appbar__title");
27279
27279
  if (title) {
27280
27280
  const summary2 = withClass("dr-appbar__summary");
27281
- return { title: textOf2(text3, title), summary: summary2 ? textOf2(text3, summary2) || null : null };
27281
+ return { title: textOf2(text4, title), summary: summary2 ? textOf2(text4, summary2) || null : null };
27282
27282
  }
27283
27283
  const region = tree.nodes.find((node) => node.attrs[KIT_ATTR2] === "header");
27284
27284
  if (!region) return null;
27285
27285
  const heading = firstTag2(tree, region, "h1", true);
27286
27286
  if (!heading) return null;
27287
27287
  const summary = firstTag2(tree, region, "p", true);
27288
- const out = { title: textOf2(text3, heading), summary: summary ? textOf2(text3, summary) || null : null };
27288
+ const out = { title: textOf2(text4, heading), summary: summary ? textOf2(text4, summary) || null : null };
27289
27289
  const actions = parseJsonAttr2(region.attrs[HEADER_ACTIONS_ATTR2]);
27290
27290
  if (Array.isArray(actions)) out.actions = actions;
27291
27291
  const from = region.attrs[TITLE_FROM_ATTR2];
@@ -27319,16 +27319,16 @@ function navOf2(tree, main2) {
27319
27319
  const source = nav?.attrs[NAV_COUNTS_ATTR2] ?? main2?.attrs[NAV_COUNTS_ATTR2];
27320
27320
  return source === void 0 || source === "" ? {} : { nav: { counts: { source } } };
27321
27321
  }
27322
- function sectionOf2(node, text3, index) {
27323
- const title = textOf2(text3, node);
27322
+ function sectionOf2(node, text4, index) {
27323
+ const title = textOf2(text4, node);
27324
27324
  return { id: node.attrs.id ?? slug3(title) ?? `section_${index + 1}`, title };
27325
27325
  }
27326
- function wrappedSectionOf2(tree, node, text3, index) {
27326
+ function wrappedSectionOf2(tree, node, text4, index) {
27327
27327
  const heading = firstTag2(tree, node, "h2");
27328
27328
  const id = node.attrs[SECTION_ATTR2];
27329
- const out = { id: id === void 0 || id === "" ? `section_${index + 1}` : id, title: heading ? textOf2(text3, heading) : "" };
27329
+ const out = { id: id === void 0 || id === "" ? `section_${index + 1}` : id, title: heading ? textOf2(text4, heading) : "" };
27330
27330
  const subtitle = node.children.map((child) => tree.nodes[child]).find((child) => child.tag === "p");
27331
- if (subtitle) out.subtitle = textOf2(text3, subtitle);
27331
+ if (subtitle) out.subtitle = textOf2(text4, subtitle);
27332
27332
  for (const key of BAND_LOOK4) {
27333
27333
  const value = node.attrs[`data-dr-${key}`];
27334
27334
  if (value !== void 0 && value !== "") out[key] = value;
@@ -27336,8 +27336,8 @@ function wrappedSectionOf2(tree, node, text3, index) {
27336
27336
  return out;
27337
27337
  }
27338
27338
  var BAND_LOOK4 = ["layout", "surface", "aside"];
27339
- function slug3(text3) {
27340
- const clean = String(text3 ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
27339
+ function slug3(text4) {
27340
+ const clean = String(text4 ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
27341
27341
  return clean === "" ? null : clean;
27342
27342
  }
27343
27343
  function routeOf4(manifest, path3) {
@@ -27679,9 +27679,9 @@ function readSources2(handlers) {
27679
27679
  }
27680
27680
  const carried = literals.constant("TRANSFORMS");
27681
27681
  if (!isPlainObject12(carried)) continue;
27682
- for (const [name, text3] of Object.entries(carried)) {
27682
+ for (const [name, text4] of Object.entries(carried)) {
27683
27683
  const path3 = table[name]?.transform;
27684
- if (typeof path3 === "string" && typeof text3 === "string" && !texts.has(path3)) texts.set(path3, text3);
27684
+ if (typeof path3 === "string" && typeof text4 === "string" && !texts.has(path3)) texts.set(path3, text4);
27685
27685
  }
27686
27686
  }
27687
27687
  const owned = [...texts.keys()].sort(natural5).map((path3) => ({ path: path3, text: texts.get(path3) }));
@@ -27706,9 +27706,9 @@ function specTransforms2(handlers, spec, problems) {
27706
27706
  continue;
27707
27707
  }
27708
27708
  carried ??= /* @__PURE__ */ new Set();
27709
- for (const [path3, text3] of Object.entries(table.texts)) {
27709
+ for (const [path3, text4] of Object.entries(table.texts)) {
27710
27710
  carried.add(path3);
27711
- out.push({ path: path3, text: text3 });
27711
+ out.push({ path: path3, text: text4 });
27712
27712
  }
27713
27713
  }
27714
27714
  const unreadable = problems.some((problem6) => problem6.code === "transform_unreadable");
@@ -27847,8 +27847,8 @@ function backendSection2(app, manifest, pages, elements) {
27847
27847
  };
27848
27848
  }
27849
27849
  function handlerVerbs2(source) {
27850
- const text3 = typeof source === "string" ? source : "";
27851
- return DATA_VERBS2.filter((verb) => TABLE_ONLY_VERBS2.has(verb) ? callsOnTable2(text3, verb) : new RegExp(`\\.\\s*${verb}\\s*\\(`).test(text3));
27850
+ const text4 = typeof source === "string" ? source : "";
27851
+ return DATA_VERBS2.filter((verb) => TABLE_ONLY_VERBS2.has(verb) ? callsOnTable2(text4, verb) : new RegExp(`\\.\\s*${verb}\\s*\\(`).test(text4));
27852
27852
  }
27853
27853
  function callsOnTable2(source, verb) {
27854
27854
  const holders = [TABLE_INLINE2];
@@ -27871,9 +27871,9 @@ function signatureOk2(source) {
27871
27871
  }
27872
27872
  return count >= 2;
27873
27873
  }
27874
- function isReferenced3(name, text3) {
27874
+ function isReferenced3(name, text4) {
27875
27875
  const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
27876
- return new RegExp(`\\bcall\\(\\s*(['"\`])${escaped}\\1|/${escaped}(['"\`]|\\b)|(['"\`])${escaped}\\3`).test(text3);
27876
+ return new RegExp(`\\bcall\\(\\s*(['"\`])${escaped}\\1|/${escaped}(['"\`]|\\b)|(['"\`])${escaped}\\3`).test(text4);
27877
27877
  }
27878
27878
  function rolesOf3(manifest) {
27879
27879
  const roles = Array.isArray(manifest.roles) ? manifest.roles : [];
@@ -28008,9 +28008,9 @@ function natural5(a, b) {
28008
28008
  var NAMED_ENTITIES2 = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
28009
28009
  var ENTITY2 = /&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z][a-zA-Z0-9]{1,31});/g;
28010
28010
  function decodeEntities3(value) {
28011
- const text3 = String(value);
28012
- if (!text3.includes("&")) return text3;
28013
- return text3.replace(ENTITY2, (whole, body) => {
28011
+ const text4 = String(value);
28012
+ if (!text4.includes("&")) return text4;
28013
+ return text4.replace(ENTITY2, (whole, body) => {
28014
28014
  if (body[0] !== "#") return Object.prototype.hasOwnProperty.call(NAMED_ENTITIES2, body) ? NAMED_ENTITIES2[body] : whole;
28015
28015
  const code = body[1] === "x" || body[1] === "X" ? Number.parseInt(body.slice(2), 16) : Number.parseInt(body.slice(1), 10);
28016
28016
  if (!Number.isInteger(code) || code < 1 || code > 1114111 || code >= 55296 && code <= 57343) return whole;
@@ -28065,23 +28065,23 @@ function problem5(at, why, kind = "other") {
28065
28065
  function describe4(node, ctx) {
28066
28066
  return ctx.inBranch && isObject6(node) && typeof node.description === "string" ? ` \u2014 ${firstSentence3(node.description)}` : "";
28067
28067
  }
28068
- function firstSentence3(text3) {
28068
+ function firstSentence3(text4) {
28069
28069
  let start = 0;
28070
28070
  for (; ; ) {
28071
- const end = text3.indexOf(". ", start);
28071
+ const end = text4.indexOf(". ", start);
28072
28072
  if (end === -1) break;
28073
- const before = text3.slice(0, end);
28073
+ const before = text4.slice(0, end);
28074
28074
  if (!before.endsWith("e.g") && !before.endsWith("i.e")) {
28075
- text3 = text3.slice(0, end + 1);
28075
+ text4 = text4.slice(0, end + 1);
28076
28076
  break;
28077
28077
  }
28078
28078
  start = end + 2;
28079
28079
  }
28080
- return truncate5(text3);
28080
+ return truncate5(text4);
28081
28081
  }
28082
- function truncate5(text3) {
28083
- const chars = [...text3];
28084
- if (chars.length <= MAX_HINT3) return text3;
28082
+ function truncate5(text4) {
28083
+ const chars = [...text4];
28084
+ if (chars.length <= MAX_HINT3) return text4;
28085
28085
  let cut3 = chars.slice(0, MAX_HINT3 - 1);
28086
28086
  const space = cut3.lastIndexOf(" ");
28087
28087
  if (space > Math.floor(MAX_HINT3 / 2)) cut3 = cut3.slice(0, space);
@@ -28309,7 +28309,7 @@ function pyCode2(source) {
28309
28309
  }
28310
28310
  return out;
28311
28311
  }
28312
- var reEscape2 = (text3) => text3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
28312
+ var reEscape2 = (text4) => text4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
28313
28313
  function pyPayloadReads2(source) {
28314
28314
  const code = pyCode2(String(source ?? ""));
28315
28315
  const signature = /^[ \t]*(?:async[ \t]+)?def[ \t]+handle[ \t]*\([ \t]*\w+[ \t]*,[ \t]*(\w+)/m.exec(code);
@@ -28379,24 +28379,24 @@ function jsCode2(source) {
28379
28379
  }
28380
28380
  return out;
28381
28381
  }
28382
- function stringEnd2(text3, i) {
28383
- const quote = text3[i];
28382
+ function stringEnd2(text4, i) {
28383
+ const quote = text4[i];
28384
28384
  let j = i + 1;
28385
- while (j < text3.length && text3[j] !== quote) {
28386
- if (text3[j] === "\\") j++;
28387
- else if (quote !== "`" && text3[j] === "\n") break;
28385
+ while (j < text4.length && text4[j] !== quote) {
28386
+ if (text4[j] === "\\") j++;
28387
+ else if (quote !== "`" && text4[j] === "\n") break;
28388
28388
  j++;
28389
28389
  }
28390
- return Math.min(j + 1, text3.length);
28390
+ return Math.min(j + 1, text4.length);
28391
28391
  }
28392
- function closeOf2(text3, i) {
28393
- const open2 = text3[i];
28392
+ function closeOf2(text4, i) {
28393
+ const open2 = text4[i];
28394
28394
  const close = { "{": "}", "(": ")", "[": "]" }[open2];
28395
28395
  let depth = 0;
28396
- for (let j = i; j < text3.length; j++) {
28397
- const ch = text3[j];
28396
+ for (let j = i; j < text4.length; j++) {
28397
+ const ch = text4[j];
28398
28398
  if (ch === '"' || ch === "'" || ch === "`") {
28399
- j = stringEnd2(text3, j) - 1;
28399
+ j = stringEnd2(text4, j) - 1;
28400
28400
  continue;
28401
28401
  }
28402
28402
  if (ch === "{" || ch === "(" || ch === "[") depth++;
@@ -28407,12 +28407,12 @@ function closeOf2(text3, i) {
28407
28407
  }
28408
28408
  return -1;
28409
28409
  }
28410
- function literalAt2(text3, i) {
28411
- const quote = text3[i];
28410
+ function literalAt2(text4, i) {
28411
+ const quote = text4[i];
28412
28412
  if (quote !== '"' && quote !== "'" && quote !== "`") return null;
28413
- const end = stringEnd2(text3, i);
28414
- const body = text3.slice(i + 1, end - 1);
28415
- if (text3[end - 1] !== quote || quote === "`" && body.includes("${") || body.includes("\\")) return null;
28413
+ const end = stringEnd2(text4, i);
28414
+ const body = text4.slice(i + 1, end - 1);
28415
+ if (text4[end - 1] !== quote || quote === "`" && body.includes("${") || body.includes("\\")) return null;
28416
28416
  return { value: body, end };
28417
28417
  }
28418
28418
  function objectKeys2(body) {
@@ -28526,8 +28526,8 @@ function fieldOf2(element) {
28526
28526
  if (INPUT_PARTS2.has(element?.type) && named8(element.props?.props?.field)) return element.props.props.field;
28527
28527
  return null;
28528
28528
  }
28529
- function mentions2(text3, name) {
28530
- return new RegExp(`(^|[^A-Za-z0-9_])${reEscape2(name)}([^A-Za-z0-9_]|$)`).test(text3);
28529
+ function mentions2(text4, name) {
28530
+ return new RegExp(`(^|[^A-Za-z0-9_])${reEscape2(name)}([^A-Za-z0-9_]|$)`).test(text4);
28531
28531
  }
28532
28532
  function payloadProducers2(contract, { moduleSource = () => void 0, pageSource = () => void 0 } = {}) {
28533
28533
  const elements = isPlainObject13(contract?.elements) ? contract.elements : {};
@@ -28652,13 +28652,13 @@ function payloadProducers2(contract, { moduleSource = () => void 0, pageSource =
28652
28652
  }
28653
28653
  for (const page of Array.isArray(contract?.pages) ? contract.pages : []) {
28654
28654
  if (!named8(page?.path)) continue;
28655
- const text3 = pageSource(page.path);
28655
+ const text4 = pageSource(page.path);
28656
28656
  const unknown = { page: page.path, uid: null, what: "script", keys: null };
28657
- if (typeof text3 !== "string") {
28657
+ if (typeof text4 !== "string") {
28658
28658
  if (page.owned === true) add("*", unknown);
28659
28659
  continue;
28660
28660
  }
28661
- const code = page.owned === true ? [text3] : pageCode2(text3, page.path, modules, pageSource);
28661
+ const code = page.owned === true ? [text4] : pageCode2(text4, page.path, modules, pageSource);
28662
28662
  if (code === null) {
28663
28663
  add("*", unknown);
28664
28664
  continue;
@@ -29490,18 +29490,18 @@ function unreadParams(contract, { moduleSource = () => void 0, handlerSource = (
29490
29490
  } else if (handlers[one]?.role === "custom" && !custom.includes(one)) custom.push(one);
29491
29491
  }
29492
29492
  if (element?.type === "custom" && named9(props.module)) {
29493
- const text3 = moduleSource(props.module);
29494
- if (typeof text3 === "string") modules.push(text3);
29493
+ const text4 = moduleSource(props.module);
29494
+ if (typeof text4 === "string") modules.push(text4);
29495
29495
  else unknown = true;
29496
29496
  }
29497
29497
  }
29498
29498
  if (unknown) continue;
29499
29499
  for (const name of namesOf(page)) {
29500
29500
  if (read.has(name)) continue;
29501
- if (modules.some((text3) => readsUiParam2(text3, name))) continue;
29501
+ if (modules.some((text4) => readsUiParam2(text4, name))) continue;
29502
29502
  if (custom.some((handler) => {
29503
- const text3 = handlerSource(handler);
29504
- return typeof text3 !== "string" || text3.includes(`"${name}"`) || text3.includes(`'${name}'`);
29503
+ const text4 = handlerSource(handler);
29504
+ return typeof text4 !== "string" || text4.includes(`"${name}"`) || text4.includes(`'${name}'`);
29505
29505
  })) {
29506
29506
  continue;
29507
29507
  }
@@ -30167,17 +30167,17 @@ function resolve11(token, overrides, seen = /* @__PURE__ */ new Set()) {
30167
30167
  }
30168
30168
  function rootTokens2(css) {
30169
30169
  const out = /* @__PURE__ */ new Map();
30170
- const text3 = css.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
30171
- for (const block of text3.matchAll(/:root\s*\{([^}]*)\}/g)) {
30170
+ const text4 = css.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
30171
+ for (const block of text4.matchAll(/:root\s*\{([^}]*)\}/g)) {
30172
30172
  const offset = block.index + block[0].indexOf("{");
30173
30173
  for (const hit of block[1].matchAll(/(--dr-[a-z0-9-]+)\s*:\s*([^;]+);/g)) {
30174
- out.set(hit[1], { value: hit[2].trim(), line: lineOf2(text3, offset + hit.index) });
30174
+ out.set(hit[1], { value: hit[2].trim(), line: lineOf2(text4, offset + hit.index) });
30175
30175
  }
30176
30176
  }
30177
30177
  return out;
30178
30178
  }
30179
- function lineOf2(text3, index) {
30180
- return text3.slice(0, index).split("\n").length;
30179
+ function lineOf2(text4, index) {
30180
+ return text4.slice(0, index).split("\n").length;
30181
30181
  }
30182
30182
  function dedupe3(violations) {
30183
30183
  const seen = /* @__PURE__ */ new Set();
@@ -30189,17 +30189,17 @@ function dedupe3(violations) {
30189
30189
  });
30190
30190
  }
30191
30191
  function rgbOf3(value, over) {
30192
- const text3 = String(value || "").trim();
30192
+ const text4 = String(value || "").trim();
30193
30193
  let parts = null;
30194
30194
  let alpha = 1;
30195
- if (text3.startsWith("#")) {
30196
- let hex = text3.slice(1);
30195
+ if (text4.startsWith("#")) {
30196
+ let hex = text4.slice(1);
30197
30197
  if (hex.length === 3) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
30198
30198
  if (/^[0-9a-f]{6,8}$/i.test(hex)) {
30199
30199
  parts = [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16)];
30200
30200
  }
30201
30201
  } else {
30202
- const hit = /rgba?\(([^)]+)\)/.exec(text3);
30202
+ const hit = /rgba?\(([^)]+)\)/.exec(text4);
30203
30203
  if (hit) {
30204
30204
  const bits = hit[1].split(/[,/]/).map((bit) => parseFloat(bit));
30205
30205
  parts = [bits[0], bits[1], bits[2]];
@@ -30609,14 +30609,14 @@ function targetOf2(href) {
30609
30609
  return `ui/${file}`;
30610
30610
  }
30611
30611
  function navLinks2(html, { owned = false } = {}) {
30612
- const text3 = String(html ?? "");
30612
+ const text4 = String(html ?? "");
30613
30613
  const regions = [];
30614
- if (owned) regions.push(text3);
30614
+ if (owned) regions.push(text4);
30615
30615
  else {
30616
- for (const open2 of text3.matchAll(NAV_OPEN2)) {
30616
+ for (const open2 of text4.matchAll(NAV_OPEN2)) {
30617
30617
  const start = open2.index + open2[0].length;
30618
- const end = text3.indexOf("</nav>", start);
30619
- regions.push(text3.slice(start, end === -1 ? text3.length : end));
30618
+ const end = text4.indexOf("</nav>", start);
30619
+ regions.push(text4.slice(start, end === -1 ? text4.length : end));
30620
30620
  }
30621
30621
  }
30622
30622
  const out = [];
@@ -30628,7 +30628,7 @@ function navLinks2(html, { owned = false } = {}) {
30628
30628
  }
30629
30629
  }
30630
30630
  if (owned) {
30631
- for (const link of moduleLinks2(text3)) if (!out.some((one) => one.target === link.target && one.gate.length === 0)) out.push(link);
30631
+ for (const link of moduleLinks2(text4)) if (!out.some((one) => one.target === link.target && one.gate.length === 0)) out.push(link);
30632
30632
  }
30633
30633
  return out;
30634
30634
  }
@@ -30903,7 +30903,7 @@ var REASON_KEYS2 = Object.freeze([
30903
30903
  ]);
30904
30904
  var REJECTS2 = /(?:==|!=|\bin\b)[^\n]*(['"])(?:reject|rejected|decline|declined|deny|denied)\1/i;
30905
30905
  function pyLines2(source) {
30906
- const text3 = String(source ?? "").replace(/("""|''')[\s\S]*?\1/g, (block) => block.replace(/[^\n]/g, " ")).split("\n").map((line2) => {
30906
+ const text4 = String(source ?? "").replace(/("""|''')[\s\S]*?\1/g, (block) => block.replace(/[^\n]/g, " ")).split("\n").map((line2) => {
30907
30907
  let quote = null;
30908
30908
  for (let i = 0; i < line2.length; i++) {
30909
30909
  const ch = line2[i];
@@ -30915,7 +30915,7 @@ function pyLines2(source) {
30915
30915
  }
30916
30916
  return line2;
30917
30917
  });
30918
- return text3;
30918
+ return text4;
30919
30919
  }
30920
30920
  var indentOf2 = (line2) => /^[ \t]*/.exec(line2)[0].replace(/\t/g, " ").length;
30921
30921
  var blank3 = (line2) => line2.trim() === "";
@@ -30988,7 +30988,7 @@ function unliftableRefusals2(contract, { handlerSource = () => void 0 } = {}) {
30988
30988
  for (const key of REASON_KEYS2) {
30989
30989
  if (!reads.optional.includes(key) && !reads.required.includes(key)) continue;
30990
30990
  const vars = reasonVars2(lines, key);
30991
- const mentions3 = (text3) => new RegExp(`(['"])${key}\\1`).test(text3) || [...vars].some((v) => new RegExp(`\\b${v}\\b`).test(text3));
30991
+ const mentions3 = (text4) => new RegExp(`(['"])${key}\\1`).test(text4) || [...vars].some((v) => new RegExp(`\\b${v}\\b`).test(text4));
30992
30992
  const gates = lines.map((line2, i) => [line2, i]).filter(([line2]) => /^\s*if\b/.test(line2) && [...vars].some((v) => new RegExp(`\\bnot[ \\t]+\\(?[ \\t]*${v}\\b`).test(line2)));
30993
30993
  for (const [gate, gi] of gates) {
30994
30994
  const depth = indentOf2(gate);
@@ -32197,8 +32197,8 @@ function sameScalar(want, got) {
32197
32197
  }
32198
32198
  function describeValue(value) {
32199
32199
  if (value === void 0) return "nothing";
32200
- const text3 = JSON.stringify(value) ?? "nothing";
32201
- return text3.length > 80 ? `${text3.slice(0, 77)}\u2026` : text3;
32200
+ const text4 = JSON.stringify(value) ?? "nothing";
32201
+ return text4.length > 80 ? `${text4.slice(0, 77)}\u2026` : text4;
32202
32202
  }
32203
32203
  function isPlain(value) {
32204
32204
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -32264,14 +32264,14 @@ async function loadContract(dir, opts) {
32264
32264
  record2.name = typeof app["name"] === "string" ? app["name"] : null;
32265
32265
  const headline = resolveExpectations(opts.expect, assembled.contract, assembled.widgetIds);
32266
32266
  const overlay = {};
32267
- for (const [path3, text3] of Object.entries(assembled.transforms)) {
32267
+ for (const [path3, text4] of Object.entries(assembled.transforms)) {
32268
32268
  if (!insideFolder(dir, path3)) throw new Error(`refusing to write the transform ${JSON.stringify(path3)} outside ${dir}.`);
32269
32269
  if (opts.check === true) {
32270
- overlay[path3] = text3;
32270
+ overlay[path3] = text4;
32271
32271
  continue;
32272
32272
  }
32273
32273
  await mkdir6(dirname7(join15(dir, path3)), { recursive: true });
32274
- await writeFile7(join15(dir, path3), text3);
32274
+ await writeFile7(join15(dir, path3), text4);
32275
32275
  (record2.transforms ??= []).push(path3);
32276
32276
  }
32277
32277
  if (opts.check !== true) {
@@ -32363,8 +32363,8 @@ async function compileFolder(dir, kind, contract, kit, overlay = {}) {
32363
32363
  const built = kind === "dashboard" && rendererOf2(contract) !== "runtime" ? compile(contract, { kit, extra }) : compileApp(contract, { kit, extra });
32364
32364
  if (Object.keys(built.files).length > 0) {
32365
32365
  for (const path3 of ownedPaths(contract)) {
32366
- const text3 = extra[path3];
32367
- if (built.files[path3] === void 0 && typeof text3 === "string") built.files[path3] = text3;
32366
+ const text4 = extra[path3];
32367
+ if (built.files[path3] === void 0 && typeof text4 === "string") built.files[path3] = text4;
32368
32368
  }
32369
32369
  }
32370
32370
  return built;
@@ -32420,23 +32420,23 @@ async function recordPulled(dir, contractWritten) {
32420
32420
  async function folderFiles(dir) {
32421
32421
  const out = {};
32422
32422
  for (const name of ["seed.json", "tests.json"]) {
32423
- const text3 = await readIfPresent(join15(dir, name));
32424
- if (text3 !== void 0) out[name] = text3;
32423
+ const text4 = await readIfPresent(join15(dir, name));
32424
+ if (text4 !== void 0) out[name] = text4;
32425
32425
  }
32426
32426
  for (const file of await readDirIfPresent(join15(dir, "handlers"))) {
32427
32427
  if (!file.endsWith(".py")) continue;
32428
- const text3 = await readIfPresent(join15(dir, "handlers", file));
32429
- if (text3 !== void 0) out[`handlers/${file}`] = text3;
32428
+ const text4 = await readIfPresent(join15(dir, "handlers", file));
32429
+ if (text4 !== void 0) out[`handlers/${file}`] = text4;
32430
32430
  }
32431
32431
  for (const file of await readDirIfPresent(join15(dir, "ui"))) {
32432
32432
  if (!file.endsWith(".html")) continue;
32433
- const text3 = await readIfPresent(join15(dir, "ui", file));
32434
- if (text3 !== void 0) out[`ui/${file}`] = text3;
32433
+ const text4 = await readIfPresent(join15(dir, "ui", file));
32434
+ if (text4 !== void 0) out[`ui/${file}`] = text4;
32435
32435
  }
32436
32436
  for (const file of await readDirIfPresent(join15(dir, "ui", "components"))) {
32437
32437
  if (!file.endsWith(".js")) continue;
32438
- const text3 = await readIfPresent(join15(dir, "ui", "components", file));
32439
- if (text3 !== void 0) out[`ui/components/${file}`] = text3;
32438
+ const text4 = await readIfPresent(join15(dir, "ui", "components", file));
32439
+ if (text4 !== void 0) out[`ui/components/${file}`] = text4;
32440
32440
  }
32441
32441
  return { ...out, ...await transformFiles(dir) };
32442
32442
  }
@@ -32444,8 +32444,8 @@ async function transformFiles(dir) {
32444
32444
  const out = {};
32445
32445
  for (const file of await readDirIfPresent(join15(dir, "transforms"))) {
32446
32446
  if (!file.endsWith(".py")) continue;
32447
- const text3 = await readIfPresent(join15(dir, "transforms", file));
32448
- if (text3 !== void 0) out[`transforms/${file}`] = text3;
32447
+ const text4 = await readIfPresent(join15(dir, "transforms", file));
32448
+ if (text4 !== void 0) out[`transforms/${file}`] = text4;
32449
32449
  }
32450
32450
  return out;
32451
32451
  }
@@ -32973,11 +32973,11 @@ var EJECTED_DOCSTRING = 'Ejected with app-space eject: this file is yours now, a
32973
32973
  function authorsDocstring(body) {
32974
32974
  return body.replace(/Generated by [^\n]*compile[\s\S]*?not this file\./, EJECTED_DOCSTRING);
32975
32975
  }
32976
- function literalEnd2(text3, open2) {
32976
+ function literalEnd2(text4, open2) {
32977
32977
  let depth = 0;
32978
32978
  let quote = null;
32979
- for (let i = open2; i < text3.length; i++) {
32980
- const c = text3[i];
32979
+ for (let i = open2; i < text4.length; i++) {
32980
+ const c = text4[i];
32981
32981
  if (quote !== null) {
32982
32982
  if (c === "\\") i++;
32983
32983
  else if (c === quote) quote = null;
@@ -33095,9 +33095,9 @@ function unservedAfter(path3, lost) {
33095
33095
  }
33096
33096
  function navGateOf(files, path3) {
33097
33097
  const gates = navGates;
33098
- for (const [file, text3] of Object.entries(files)) {
33098
+ for (const [file, text4] of Object.entries(files)) {
33099
33099
  if (file === path3 || !file.startsWith("ui/") || !file.endsWith(".html")) continue;
33100
- const role = gates(text3, file).get(path3);
33100
+ const role = gates(text4, file).get(path3);
33101
33101
  if (role !== void 0) return role;
33102
33102
  }
33103
33103
  return null;
@@ -33133,8 +33133,8 @@ async function ejectElement(dir, contract, uid) {
33133
33133
  const module = `components/${name}.js`;
33134
33134
  const path3 = `ui/${module}`;
33135
33135
  if (!insideFolder(dir, path3)) throw new Refused(`${JSON.stringify(path3)} is not a path inside ${dir}.`);
33136
- const text3 = templateFor(type, module, typeof props["id"] === "string" ? props["id"] : name);
33137
- await mayPlace(dir, path3, text3, []);
33136
+ const text4 = templateFor(type, module, typeof props["id"] === "string" ? props["id"] : name);
33137
+ await mayPlace(dir, path3, text4, []);
33138
33138
  const args = {};
33139
33139
  const kept = {};
33140
33140
  for (const [key, value] of Object.entries(props)) {
@@ -33145,7 +33145,7 @@ async function ejectElement(dir, contract, uid) {
33145
33145
  if (Object.keys(args).length > 0) kept["args"] = args;
33146
33146
  element["type"] = "custom";
33147
33147
  element["props"] = kept;
33148
- const wrote = await commit(dir, contract, path3, text3);
33148
+ const wrote = await commit(dir, contract, path3, text4);
33149
33149
  return { target: `element:${uid}`, wrote, said: `${type} ${uid} is yours now: a custom element drawn by ${path3}.` };
33150
33150
  }
33151
33151
  function moduleName(id, type, uid) {
@@ -33213,9 +33213,9 @@ function refusedLines(built) {
33213
33213
  if (Object.keys(built.files).length > 0 && refused.length === 0) return null;
33214
33214
  return (refused.length > 0 ? refused : built.problems).map((problem6) => ` [${problem6.code}] ${problem6.message}`).join("\n");
33215
33215
  }
33216
- async function mayPlace(dir, path3, text3, same5) {
33216
+ async function mayPlace(dir, path3, text4, same5) {
33217
33217
  const existing = await readIfPresent(join16(dir, path3));
33218
- if (existing === void 0 || existing === text3 || same5.includes(existing)) return;
33218
+ if (existing === void 0 || existing === text4 || same5.includes(existing)) return;
33219
33219
  if ((await ownedFiles(dir)).has(path3)) {
33220
33220
  const recorded = (await recordedDigests(dir))[path3];
33221
33221
  if (recorded === void 0 || recorded === digestOf(existing)) return;
@@ -33224,7 +33224,7 @@ async function mayPlace(dir, path3, text3, same5) {
33224
33224
  `${path3} already holds something other than what eject would write there. It is yours: move it aside first, or keep it and edit contract.json by hand.`
33225
33225
  );
33226
33226
  }
33227
- async function commit(dir, contract, path3, text3, check5) {
33227
+ async function commit(dir, contract, path3, text4, check5) {
33228
33228
  const invalid = validateContract(contract, NO_CATALOG).problems;
33229
33229
  if (invalid.length > 0) {
33230
33230
  throw new Refused(`after this eject contract.json would not validate, so eject leaves the folder as it was:
@@ -33232,7 +33232,7 @@ ${formatProblems(invalid)}`);
33232
33232
  }
33233
33233
  let built;
33234
33234
  try {
33235
- built = await compileFolder(dir, "app", contract, kit_default2, { [path3]: text3 });
33235
+ built = await compileFolder(dir, "app", contract, kit_default2, { [path3]: text4 });
33236
33236
  } catch (err) {
33237
33237
  throw new Refused(`after this eject contract.json would not compile (${err instanceof Error ? err.message : String(err)}).`);
33238
33238
  }
@@ -33244,10 +33244,10 @@ ${lines}
33244
33244
  }
33245
33245
  check5?.(built.files);
33246
33246
  const full = join16(dir, path3);
33247
- const wrote = await readIfPresent(full) === text3 ? [] : [path3];
33247
+ const wrote = await readIfPresent(full) === text4 ? [] : [path3];
33248
33248
  if (wrote.length > 0) {
33249
33249
  await mkdir7(dirname8(full), { recursive: true });
33250
- await writeFile8(full, text3);
33250
+ await writeFile8(full, text4);
33251
33251
  }
33252
33252
  await writeFile8(join16(dir, "contract.json"), JSON.stringify(contract, null, 2) + "\n");
33253
33253
  await recordAsInput(dir, path3);
@@ -33371,11 +33371,11 @@ import { readFile as readFile11, realpath } from "fs/promises";
33371
33371
  import { basename as basename2, extname, resolve as resolve14, sep as sep5 } from "path";
33372
33372
 
33373
33373
  // src/commands/appspace/_samplePdf.ts
33374
- function pdfString(text3) {
33375
- if (!/^[\x20-\x7e]*$/.test(text3)) {
33376
- throw new Error(`buildPdf takes printable ASCII only, and ${JSON.stringify(text3)} is not`);
33374
+ function pdfString(text4) {
33375
+ if (!/^[\x20-\x7e]*$/.test(text4)) {
33376
+ throw new Error(`buildPdf takes printable ASCII only, and ${JSON.stringify(text4)} is not`);
33377
33377
  }
33378
- return `(${text3.replace(/[\\()]/g, (c) => `\\${c}`)})`;
33378
+ return `(${text4.replace(/[\\()]/g, (c) => `\\${c}`)})`;
33379
33379
  }
33380
33380
  function buildPdf(lines) {
33381
33381
  const body = lines.map((line2, i) => `${i === 0 ? "" : "T* "}${pdfString(line2)} Tj`).join("\n");
@@ -33879,14 +33879,14 @@ function fileFor(field) {
33879
33879
  }
33880
33880
  var FORM_CONTROL_TAGS = /* @__PURE__ */ new Set(["input", "select", "textarea"]);
33881
33881
  function labelOf2(component) {
33882
- const cut3 = (text4) => text4.length <= 40 ? text4 : `${text4.slice(0, 39)}\u2026`;
33882
+ const cut3 = (text5) => text5.length <= 40 ? text5 : `${text5.slice(0, 39)}\u2026`;
33883
33883
  if (component.type === "form") {
33884
33884
  if (component.props.id !== void 0) return `the ${component.props.id} form`;
33885
33885
  if (component.props.entity !== void 0) return `the ${component.props.entity} form`;
33886
33886
  return `form #${String(component.n)}`;
33887
33887
  }
33888
- const text3 = (component.text ?? "").trim();
33889
- if (text3 !== "") return cut3(text3);
33888
+ const text4 = (component.text ?? "").trim();
33889
+ if (text4 !== "") return cut3(text4);
33890
33890
  return component.props.id ?? `${component.type} #${String(component.n)}`;
33891
33891
  }
33892
33892
  function controlFor(column) {
@@ -34412,9 +34412,9 @@ function installChartCapture(window, charts) {
34412
34412
  function numberOf(value) {
34413
34413
  if (typeof value === "number") return Number.isFinite(value) ? value : null;
34414
34414
  if (typeof value !== "string") return null;
34415
- const text3 = value.replace(/[,\s$]/g, "");
34416
- if (text3 === "" || /^[-+]?0[xob]/i.test(text3)) return null;
34417
- const n = Number(text3);
34415
+ const text4 = value.replace(/[,\s$]/g, "");
34416
+ if (text4 === "" || /^[-+]?0[xob]/i.test(text4)) return null;
34417
+ const n = Number(text4);
34418
34418
  return Number.isFinite(n) ? n : null;
34419
34419
  }
34420
34420
  var MONTH_NAME = "january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sept|sep|october|oct|november|nov|december|dec";
@@ -34435,8 +34435,8 @@ var DATE_LIKE = new RegExp(
34435
34435
  ].join("|"),
34436
34436
  "gi"
34437
34437
  );
34438
- function figuresIn(text3) {
34439
- const undated = text3.replace(DATE_LIKE, " ");
34438
+ function figuresIn(text4) {
34439
+ const undated = text4.replace(DATE_LIKE, " ");
34440
34440
  return (undated.match(/[-+]?\d[\d,]*(?:\.\d+)?/g) ?? []).map((one) => Number(one.replace(/,/g, "")));
34441
34441
  }
34442
34442
  function seriesNumbers(data) {
@@ -34488,8 +34488,8 @@ function drawnSnapshot(document, harvest, charts) {
34488
34488
  for (const component of harvest.components) {
34489
34489
  if (component.type !== "stat" || component.text === void 0) continue;
34490
34490
  if (out.has(component.n)) continue;
34491
- const figures = figuresIn(component.text);
34492
- if (figures.length > 0) add(component.n, [null, `figures=${JSON.stringify(figures)}`, figures]);
34491
+ const figures2 = figuresIn(component.text);
34492
+ if (figures2.length > 0) add(component.n, [null, `figures=${JSON.stringify(figures2)}`, figures2]);
34493
34493
  }
34494
34494
  for (const [node, chart] of charts) {
34495
34495
  if (node.isConnected === false) continue;
@@ -34500,10 +34500,10 @@ function drawnSnapshot(document, harvest, charts) {
34500
34500
  }
34501
34501
  function movedBetween(before, after, param, echoes = []) {
34502
34502
  const echoed = new Set(echoes.map(numberOf).filter((n) => n !== null));
34503
- const keep = (list3) => (list3 ?? []).flatMap(([field, what, figures]) => {
34503
+ const keep = (list3) => (list3 ?? []).flatMap(([field, what, figures2]) => {
34504
34504
  if (field === param) return [];
34505
- if (figures === void 0 || echoed.size === 0) return [what];
34506
- const answered = figures.filter((n) => !echoed.has(n));
34505
+ if (figures2 === void 0 || echoed.size === 0) return [what];
34506
+ const answered = figures2.filter((n) => !echoed.has(n));
34507
34507
  return answered.length === 0 ? [] : [`figures=${JSON.stringify(answered)}`];
34508
34508
  });
34509
34509
  const moved = [];
@@ -34536,8 +34536,8 @@ function nullTexts(document) {
34536
34536
  }
34537
34537
  return true;
34538
34538
  };
34539
- const look = (text3, context) => {
34540
- for (const match of text3.matchAll(NULL_LITERAL)) {
34539
+ const look = (text4, context) => {
34540
+ for (const match of text4.matchAll(NULL_LITERAL)) {
34541
34541
  if (out.length >= NULL_TEXT_LIMIT) return;
34542
34542
  const near = maskToken(context.replace(/\s+/g, " ").trim());
34543
34543
  out.push({ literal: match[0], near: near.length <= NULL_TEXT_CONTEXT ? near : `${near.slice(0, NULL_TEXT_CONTEXT - 1)}\u2026` });
@@ -34554,12 +34554,12 @@ function nullTexts(document) {
34554
34554
  if (parent === null) continue;
34555
34555
  own2.set(parent, (own2.get(parent) ?? "") + (node.nodeValue ?? ""));
34556
34556
  }
34557
- for (const [parent, text3] of own2) {
34557
+ for (const [parent, text4] of own2) {
34558
34558
  NULL_LITERAL.lastIndex = 0;
34559
- if (!NULL_LITERAL.test(text3)) continue;
34559
+ if (!NULL_LITERAL.test(text4)) continue;
34560
34560
  NULL_LITERAL.lastIndex = 0;
34561
34561
  if (!shown2(parent)) continue;
34562
- look(text3, parent.textContent ?? text3);
34562
+ look(text4, parent.textContent ?? text4);
34563
34563
  }
34564
34564
  for (const input of Array.from(body.querySelectorAll("input, textarea"))) {
34565
34565
  const control = input;
@@ -34659,9 +34659,9 @@ var COLUMN_NAME = /^[A-Za-z_][\w -]{0,63}$/;
34659
34659
  function numberLike(value) {
34660
34660
  if (typeof value === "number") return Number.isFinite(value);
34661
34661
  if (typeof value !== "string") return false;
34662
- const text3 = value.replace(/[,\s$]/g, "");
34663
- if (text3 === "" || /^[-+]?0[xob]/i.test(text3)) return false;
34664
- return Number.isFinite(Number(text3));
34662
+ const text4 = value.replace(/[,\s$]/g, "");
34663
+ if (text4 === "" || /^[-+]?0[xob]/i.test(text4)) return false;
34664
+ return Number.isFinite(Number(text4));
34665
34665
  }
34666
34666
  function rowKeys(rows2) {
34667
34667
  const keys2 = [];
@@ -34707,16 +34707,16 @@ function answerOf(res) {
34707
34707
  if (numeric.length > 0) out.numeric = numeric;
34708
34708
  }
34709
34709
  if (typeof error === "string" && error.trim() !== "") {
34710
- const text3 = error.trim();
34711
- out.error = text3.length <= ERROR_TEXT_LIMIT ? text3 : `${text3.slice(0, ERROR_TEXT_LIMIT - 1)}\u2026`;
34710
+ const text4 = error.trim();
34711
+ out.error = text4.length <= ERROR_TEXT_LIMIT ? text4 : `${text4.slice(0, ERROR_TEXT_LIMIT - 1)}\u2026`;
34712
34712
  }
34713
34713
  return out;
34714
34714
  }
34715
34715
  var TEXT_LIMIT = 80;
34716
34716
  function harvestText(el) {
34717
- const text3 = maskToken((el.textContent ?? "").replace(/\s+/g, " ").trim());
34718
- if (text3 === "") return void 0;
34719
- return text3.length <= TEXT_LIMIT ? text3 : `${text3.slice(0, TEXT_LIMIT - 1)}\u2026`;
34717
+ const text4 = maskToken((el.textContent ?? "").replace(/\s+/g, " ").trim());
34718
+ if (text4 === "") return void 0;
34719
+ return text4.length <= TEXT_LIMIT ? text4 : `${text4.slice(0, TEXT_LIMIT - 1)}\u2026`;
34720
34720
  }
34721
34721
  function harvestAlert(el, index) {
34722
34722
  const candidates = [
@@ -34727,9 +34727,9 @@ function harvestAlert(el, index) {
34727
34727
  let owner = alert;
34728
34728
  while (owner !== null && owner !== el && !index.has(owner)) owner = owner.parentElement;
34729
34729
  if (owner !== el) continue;
34730
- const text3 = maskToken((alert.textContent ?? "").replace(/\s+/g, " ").trim());
34731
- if (text3 === "") continue;
34732
- return text3.length <= ERROR_TEXT_LIMIT ? text3 : `${text3.slice(0, ERROR_TEXT_LIMIT - 1)}\u2026`;
34730
+ const text4 = maskToken((alert.textContent ?? "").replace(/\s+/g, " ").trim());
34731
+ if (text4 === "") continue;
34732
+ return text4.length <= ERROR_TEXT_LIMIT ? text4 : `${text4.slice(0, ERROR_TEXT_LIMIT - 1)}\u2026`;
34733
34733
  }
34734
34734
  return void 0;
34735
34735
  }
@@ -34798,8 +34798,8 @@ function harvestNodes(document) {
34798
34798
  tag: el.tagName.toLowerCase(),
34799
34799
  parent
34800
34800
  };
34801
- const text3 = harvestText(el);
34802
- if (text3 !== void 0) out.text = text3;
34801
+ const text4 = harvestText(el);
34802
+ if (text4 !== void 0) out.text = text4;
34803
34803
  const alert = harvestAlert(el, index);
34804
34804
  if (alert !== void 0) out.alert = alert;
34805
34805
  if (gatedByRole(el)) out.role_visible = drawn(el);
@@ -34903,8 +34903,8 @@ async function encodeMultipart(form, readBlob = defaultBlobReader) {
34903
34903
  unsupported: `the attached part (${name}) could not be read by this smoke check (${err instanceof Error ? err.message : String(err)}) \u2014 the request was not made.`
34904
34904
  };
34905
34905
  }
34906
- const text4 = bytes.toString("utf8");
34907
- if (!Buffer.from(text4, "utf8").equals(bytes)) {
34906
+ const text5 = bytes.toString("utf8");
34907
+ if (!Buffer.from(text5, "utf8").equals(bytes)) {
34908
34908
  return {
34909
34909
  unsupported: `the page attached a part (${name}) whose bytes are not text, and this smoke check carries a multipart body as text \u2014 the request was not made. Exercise that upload from the app itself.`
34910
34910
  };
@@ -34916,7 +34916,7 @@ async function encodeMultipart(form, readBlob = defaultBlobReader) {
34916
34916
  Content-Disposition: form-data; name="${escapeDispositionValue(name)}"; filename="${escapeDispositionValue(filename)}"\r
34917
34917
  Content-Type: ${mime.replace(/[\r\n]/g, "")}\r
34918
34918
  \r
34919
- ${text4}\r
34919
+ ${text5}\r
34920
34920
  `
34921
34921
  );
34922
34922
  continue;
@@ -34929,7 +34929,7 @@ ${String(value)}\r
34929
34929
  `
34930
34930
  );
34931
34931
  }
34932
- const text3 = `${parts.join("")}--${MULTIPART_BOUNDARY}--\r
34932
+ const text4 = `${parts.join("")}--${MULTIPART_BOUNDARY}--\r
34933
34933
  `;
34934
34934
  if (parts.some((part) => part.slice(part.indexOf("\r\n\r\n")).includes(MULTIPART_BOUNDARY))) {
34935
34935
  return {
@@ -34937,7 +34937,7 @@ ${String(value)}\r
34937
34937
  };
34938
34938
  }
34939
34939
  return {
34940
- text: text3,
34940
+ text: text4,
34941
34941
  contentType: `multipart/form-data; boundary=${MULTIPART_BOUNDARY}`
34942
34942
  };
34943
34943
  }
@@ -35673,6 +35673,996 @@ import { mkdir as mkdir8, mkdtemp as mkdtemp4, readFile as readFile12, readdir a
35673
35673
  import { createServer } from "http";
35674
35674
  import { tmpdir as tmpdir5 } from "os";
35675
35675
  import { delimiter, extname as extname2, join as join17, relative as relative3, resolve as resolve15, sep as sep6 } from "path";
35676
+
35677
+ // ../tests/vendor/fixtures/widgets/kpi.json
35678
+ var kpi_default = {
35679
+ kind: "kpi",
35680
+ label: "Revenue YTD",
35681
+ value: -1022e4,
35682
+ unit: "currency",
35683
+ account_type: "revenue",
35684
+ delta: {
35685
+ value: 2.7,
35686
+ direction: "up",
35687
+ unit: "%",
35688
+ against: "prior month"
35689
+ },
35690
+ spark: [
35691
+ -98e4,
35692
+ -101e4,
35693
+ -112e4,
35694
+ -99e4,
35695
+ -1105e3,
35696
+ -124e4,
35697
+ -119e4,
35698
+ -131e4,
35699
+ -1275e3
35700
+ ],
35701
+ meta: {
35702
+ v: 1,
35703
+ source: {
35704
+ kind: "metric",
35705
+ metric_id: 42,
35706
+ metric_name: "Revenue",
35707
+ url: null,
35708
+ read: "points",
35709
+ fetched_at: "2026-09-16T14:02:11Z",
35710
+ query: {
35711
+ call: "metric_series",
35712
+ metric_id: 42,
35713
+ scenarios: [
35714
+ "Actuals"
35715
+ ],
35716
+ scenario: null,
35717
+ date_start: "2026-01-01",
35718
+ date_end: "2026-09-16",
35719
+ aggregation_period: "month",
35720
+ aggregation_type: null,
35721
+ dimension_filters: {
35722
+ Entity: [
35723
+ "NCM-US"
35724
+ ]
35725
+ }
35726
+ }
35727
+ },
35728
+ account_type: "revenue",
35729
+ unit: "currency",
35730
+ filters_applied: {
35731
+ period: {
35732
+ start: "2026-01-01",
35733
+ end: "2026-09-16",
35734
+ grain: "month"
35735
+ },
35736
+ scenario: [
35737
+ "Actuals"
35738
+ ],
35739
+ dimensions: {
35740
+ Entity: [
35741
+ "NCM-US"
35742
+ ]
35743
+ }
35744
+ },
35745
+ filters_ignored: [],
35746
+ params_applied: {},
35747
+ fetched_at: "2026-09-16T14:02:11Z",
35748
+ row_count: 9,
35749
+ reads: 1
35750
+ }
35751
+ };
35752
+
35753
+ // ../tests/vendor/fixtures/widgets/series.json
35754
+ var series_default = {
35755
+ kind: "series",
35756
+ x: {
35757
+ type: "period",
35758
+ grain: "month",
35759
+ values: [
35760
+ "2026-01",
35761
+ "2026-02",
35762
+ "2026-03",
35763
+ "2026-04",
35764
+ "2026-05",
35765
+ "2026-06",
35766
+ "2026-07",
35767
+ "2026-08",
35768
+ "2026-09"
35769
+ ]
35770
+ },
35771
+ series: [
35772
+ {
35773
+ id: "actuals",
35774
+ label: "Actuals",
35775
+ scenario: "Actuals",
35776
+ values: [
35777
+ -98e4,
35778
+ -101e4,
35779
+ -112e4,
35780
+ -99e4,
35781
+ null,
35782
+ -124e4,
35783
+ -119e4,
35784
+ -131e4,
35785
+ -1275e3
35786
+ ],
35787
+ account_type: "revenue",
35788
+ style: {
35789
+ stack: null
35790
+ }
35791
+ },
35792
+ {
35793
+ id: "budget",
35794
+ label: "Budget",
35795
+ scenario: "Budget",
35796
+ values: [
35797
+ -1e6,
35798
+ -1e6,
35799
+ -1e6,
35800
+ -1e6,
35801
+ -1e6,
35802
+ -1e6,
35803
+ -1e6,
35804
+ -1e6,
35805
+ -1e6
35806
+ ],
35807
+ account_type: "revenue",
35808
+ style: {
35809
+ stack: null
35810
+ }
35811
+ }
35812
+ ],
35813
+ meta: {
35814
+ v: 1,
35815
+ source: {
35816
+ kind: "metric",
35817
+ metric_id: 42,
35818
+ metric_name: "Revenue",
35819
+ url: null,
35820
+ read: "points",
35821
+ fetched_at: "2026-09-16T14:02:11Z",
35822
+ query: {
35823
+ call: "metric_series",
35824
+ metric_id: 42,
35825
+ scenarios: [
35826
+ "Actuals",
35827
+ "Budget"
35828
+ ],
35829
+ scenario: null,
35830
+ date_start: "2026-01-01",
35831
+ date_end: "2026-09-16",
35832
+ aggregation_period: "month",
35833
+ aggregation_type: null,
35834
+ dimension_filters: {
35835
+ Entity: [
35836
+ "NCM-US"
35837
+ ]
35838
+ }
35839
+ }
35840
+ },
35841
+ account_type: "revenue",
35842
+ unit: "currency",
35843
+ filters_applied: {
35844
+ period: {
35845
+ start: "2026-01-01",
35846
+ end: "2026-09-16",
35847
+ grain: "month"
35848
+ },
35849
+ scenario: [
35850
+ "Actuals",
35851
+ "Budget"
35852
+ ],
35853
+ dimensions: {
35854
+ Entity: [
35855
+ "NCM-US"
35856
+ ]
35857
+ }
35858
+ },
35859
+ filters_ignored: [],
35860
+ params_applied: {},
35861
+ fetched_at: "2026-09-16T14:02:11Z",
35862
+ row_count: 9,
35863
+ reads: 1,
35864
+ drill: {
35865
+ dimensions: [
35866
+ "Entity",
35867
+ "Account"
35868
+ ],
35869
+ op: "drill",
35870
+ widget: "rev"
35871
+ }
35872
+ }
35873
+ };
35874
+
35875
+ // ../tests/vendor/fixtures/widgets/breakdown.json
35876
+ var breakdown_default = {
35877
+ kind: "breakdown",
35878
+ dimension: "Entity",
35879
+ items: [
35880
+ {
35881
+ label: "NCM-US",
35882
+ value: -12e5,
35883
+ share: 0.57
35884
+ },
35885
+ {
35886
+ label: "NCM-UK",
35887
+ value: -51e4,
35888
+ share: 0.24
35889
+ },
35890
+ {
35891
+ label: "NCM-IL",
35892
+ value: -225e3,
35893
+ share: 0.11
35894
+ }
35895
+ ],
35896
+ total: -2115e3,
35897
+ other_count: 3,
35898
+ other_value: -18e4,
35899
+ meta: {
35900
+ v: 1,
35901
+ source: {
35902
+ kind: "metric",
35903
+ metric_id: 42,
35904
+ metric_name: "Revenue",
35905
+ url: null,
35906
+ read: "rows",
35907
+ fetched_at: "2026-09-16T14:02:11Z",
35908
+ query: {
35909
+ call: "drill_down_business_metric",
35910
+ metric_ids: [
35911
+ 42
35912
+ ],
35913
+ date_start: "2026-01-01",
35914
+ date_end: "2026-09-16",
35915
+ dimension_filters: {
35916
+ Entity: [
35917
+ "NCM-US"
35918
+ ]
35919
+ }
35920
+ }
35921
+ },
35922
+ account_type: "revenue",
35923
+ unit: "currency",
35924
+ filters_applied: {
35925
+ period: {
35926
+ start: "2026-01-01",
35927
+ end: "2026-09-16",
35928
+ grain: "month"
35929
+ },
35930
+ scenario: [
35931
+ "Actuals"
35932
+ ],
35933
+ dimensions: {
35934
+ Entity: [
35935
+ "NCM-US"
35936
+ ]
35937
+ }
35938
+ },
35939
+ filters_ignored: [],
35940
+ params_applied: {},
35941
+ fetched_at: "2026-09-16T14:02:11Z",
35942
+ row_count: 6,
35943
+ reads: 1,
35944
+ drill: {
35945
+ dimensions: [
35946
+ "Entity",
35947
+ "Account"
35948
+ ],
35949
+ op: "drill",
35950
+ widget: "rev"
35951
+ }
35952
+ }
35953
+ };
35954
+
35955
+ // ../tests/vendor/fixtures/widgets/table.json
35956
+ var table_default = {
35957
+ kind: "table",
35958
+ columns: [
35959
+ {
35960
+ key: "period",
35961
+ label: "Month",
35962
+ align: "left"
35963
+ },
35964
+ {
35965
+ key: "actual",
35966
+ label: "Actual",
35967
+ account_type: "revenue",
35968
+ format: {
35969
+ fn: "currency",
35970
+ opts: {
35971
+ compact: true
35972
+ }
35973
+ }
35974
+ },
35975
+ {
35976
+ key: "budget",
35977
+ label: "Budget",
35978
+ account_type: "revenue",
35979
+ format: {
35980
+ fn: "currency",
35981
+ opts: {
35982
+ compact: true
35983
+ }
35984
+ }
35985
+ }
35986
+ ],
35987
+ rows: [
35988
+ {
35989
+ period: "2026-01",
35990
+ actual: -98e4,
35991
+ budget: -1e6
35992
+ },
35993
+ {
35994
+ period: "2026-02",
35995
+ actual: -101e4,
35996
+ budget: -1e6
35997
+ },
35998
+ {
35999
+ period: "2026-03",
36000
+ actual: -112e4,
36001
+ budget: -1e6
36002
+ }
36003
+ ],
36004
+ totals: {
36005
+ period: "Total",
36006
+ actual: -311e4,
36007
+ budget: -3e6
36008
+ },
36009
+ page: {
36010
+ offset: 0,
36011
+ limit: 200,
36012
+ total: 3
36013
+ },
36014
+ meta: {
36015
+ v: 1,
36016
+ source: {
36017
+ kind: "table",
36018
+ table_id: "7",
36019
+ table_alias: "gl",
36020
+ table_name: "GL",
36021
+ measure: {
36022
+ field: "net_balance_usd",
36023
+ agg: "SUM"
36024
+ },
36025
+ url: null,
36026
+ read: "aggregate",
36027
+ fetched_at: "2026-09-16T14:02:11Z",
36028
+ query: {
36029
+ call: "get_aliased_aggregated_data_with_polling",
36030
+ table_alias: "gl",
36031
+ dimensions: [
36032
+ "period",
36033
+ "scenario"
36034
+ ],
36035
+ metrics: [
36036
+ {
36037
+ field: "net_balance_usd",
36038
+ agg: "SUM"
36039
+ }
36040
+ ],
36041
+ filters: [
36042
+ {
36043
+ name: "type",
36044
+ values: [
36045
+ "Revenue"
36046
+ ]
36047
+ },
36048
+ {
36049
+ name: "Entity",
36050
+ values: [
36051
+ "NCM-US"
36052
+ ]
36053
+ }
36054
+ ],
36055
+ period_field: "period",
36056
+ period_is_date: false,
36057
+ select: null,
36058
+ limit: null,
36059
+ offset: null
36060
+ }
36061
+ },
36062
+ account_type: "revenue",
36063
+ unit: "currency",
36064
+ filters_applied: {
36065
+ period: {
36066
+ start: "2026-01-01",
36067
+ end: "2026-09-16",
36068
+ grain: "month"
36069
+ },
36070
+ scenario: [
36071
+ "Actuals"
36072
+ ],
36073
+ dimensions: {
36074
+ Entity: [
36075
+ "NCM-US"
36076
+ ]
36077
+ }
36078
+ },
36079
+ filters_ignored: [],
36080
+ params_applied: {},
36081
+ fetched_at: "2026-09-16T14:02:11Z",
36082
+ row_count: 9,
36083
+ reads: 1,
36084
+ drill: {
36085
+ dimensions: [
36086
+ "entity"
36087
+ ],
36088
+ op: "drill",
36089
+ widget: "ledger"
36090
+ }
36091
+ }
36092
+ };
36093
+
36094
+ // ../tests/vendor/fixtures/widgets/narrative.json
36095
+ var narrative_default = {
36096
+ kind: "narrative",
36097
+ mode: "computed",
36098
+ tag: "watch",
36099
+ headline: "Revenue is 12.5% below last month",
36100
+ sections: [
36101
+ {
36102
+ label: "What happened",
36103
+ text: "Revenue fell to",
36104
+ cites: [
36105
+ {
36106
+ widget: "rev",
36107
+ period: "2026-08 \u2192 2026-09",
36108
+ value: null
36109
+ }
36110
+ ]
36111
+ },
36112
+ {
36113
+ label: "Figure",
36114
+ text: -1275e3,
36115
+ figure: {
36116
+ widget: "rev",
36117
+ period: "2026-09",
36118
+ dimension: null,
36119
+ of: null,
36120
+ value: -1275e3
36121
+ }
36122
+ },
36123
+ {
36124
+ label: "Why it matters",
36125
+ text: "The drop is concentrated in NCM-US."
36126
+ },
36127
+ {
36128
+ label: "Investigate",
36129
+ text: "Drill Entity \u2192 Account for August."
36130
+ }
36131
+ ],
36132
+ about: [
36133
+ "rev",
36134
+ "rev_ytd"
36135
+ ],
36136
+ prompt: null,
36137
+ meta: {
36138
+ v: 1,
36139
+ source: {
36140
+ kind: "metric",
36141
+ metric_id: 42,
36142
+ metric_name: "Revenue",
36143
+ url: null,
36144
+ read: "points",
36145
+ fetched_at: "2026-09-16T14:02:11Z",
36146
+ query: {
36147
+ call: "metric_series",
36148
+ metric_id: 42,
36149
+ scenarios: [
36150
+ "Actuals"
36151
+ ],
36152
+ scenario: null,
36153
+ date_start: "2026-01-01",
36154
+ date_end: "2026-09-16",
36155
+ aggregation_period: "month",
36156
+ aggregation_type: null,
36157
+ dimension_filters: {
36158
+ Entity: [
36159
+ "NCM-US"
36160
+ ]
36161
+ }
36162
+ }
36163
+ },
36164
+ account_type: "revenue",
36165
+ unit: "currency",
36166
+ filters_applied: {
36167
+ period: {
36168
+ start: "2026-01-01",
36169
+ end: "2026-09-16",
36170
+ grain: "month"
36171
+ },
36172
+ scenario: [
36173
+ "Actuals"
36174
+ ],
36175
+ dimensions: {
36176
+ Entity: [
36177
+ "NCM-US"
36178
+ ]
36179
+ }
36180
+ },
36181
+ filters_ignored: [],
36182
+ params_applied: {},
36183
+ fetched_at: "2026-09-16T14:02:11Z",
36184
+ row_count: 9,
36185
+ reads: 1,
36186
+ builders: {
36187
+ narrate: "_narrate"
36188
+ }
36189
+ }
36190
+ };
36191
+
36192
+ // ../tests/vendor/fixtures/widgets/narrative-agent.json
36193
+ var narrative_agent_default = {
36194
+ kind: "narrative",
36195
+ mode: "agent",
36196
+ tag: null,
36197
+ headline: null,
36198
+ sections: [],
36199
+ about: [
36200
+ "rev",
36201
+ "rev_ytd"
36202
+ ],
36203
+ prompt: "Summarise revenue against budget for the selected period, in three sentences.",
36204
+ meta: {
36205
+ v: 1,
36206
+ source: {
36207
+ kind: "metric",
36208
+ metric_id: 42,
36209
+ metric_name: "Revenue",
36210
+ url: null,
36211
+ read: null,
36212
+ fetched_at: null,
36213
+ query: null
36214
+ },
36215
+ account_type: "revenue",
36216
+ unit: "currency",
36217
+ filters_applied: {
36218
+ period: {
36219
+ start: "2026-01-01",
36220
+ end: "2026-09-16",
36221
+ grain: "month"
36222
+ },
36223
+ scenario: [
36224
+ "Actuals"
36225
+ ],
36226
+ dimensions: {
36227
+ Entity: [
36228
+ "NCM-US"
36229
+ ]
36230
+ }
36231
+ },
36232
+ filters_ignored: [],
36233
+ params_applied: {},
36234
+ fetched_at: "2026-09-16T14:02:11Z",
36235
+ row_count: 0,
36236
+ reads: 0
36237
+ }
36238
+ };
36239
+
36240
+ // ../tests/vendor/fixtures/widgets/ohlc.json
36241
+ var ohlc_default = {
36242
+ kind: "ohlc",
36243
+ x: {
36244
+ type: "period",
36245
+ grain: "month",
36246
+ values: [
36247
+ "2026-01",
36248
+ "2026-02",
36249
+ "2026-03",
36250
+ "2026-04"
36251
+ ]
36252
+ },
36253
+ candles: [
36254
+ [
36255
+ 100,
36256
+ 104.5,
36257
+ 98.2,
36258
+ 106
36259
+ ],
36260
+ [
36261
+ 104.5,
36262
+ 101,
36263
+ 99.5,
36264
+ 107.2
36265
+ ],
36266
+ [
36267
+ 101,
36268
+ 108.3,
36269
+ 100.4,
36270
+ 109
36271
+ ],
36272
+ [
36273
+ 108.3,
36274
+ 107.1,
36275
+ 103,
36276
+ 110.5
36277
+ ]
36278
+ ],
36279
+ volume: [
36280
+ 1200,
36281
+ 980,
36282
+ 1430,
36283
+ 1110
36284
+ ],
36285
+ meta: {
36286
+ v: 1,
36287
+ source: {
36288
+ kind: "table",
36289
+ table_id: "12",
36290
+ table_alias: "fx_rates",
36291
+ table_name: "FX Rates",
36292
+ measure: {
36293
+ field: "rate",
36294
+ agg: "OHLC"
36295
+ },
36296
+ url: null,
36297
+ read: "raw",
36298
+ fetched_at: "2026-09-16T14:02:11Z",
36299
+ query: {
36300
+ call: "get_aliased_table_data",
36301
+ table_alias: "fx_rates",
36302
+ dimensions: null,
36303
+ metrics: null,
36304
+ filters: [
36305
+ {
36306
+ name: "Entity",
36307
+ values: [
36308
+ "NCM-US"
36309
+ ]
36310
+ }
36311
+ ],
36312
+ period_field: "period",
36313
+ period_is_date: false,
36314
+ select: [
36315
+ "period",
36316
+ "rate_open",
36317
+ "rate_close",
36318
+ "rate_low",
36319
+ "rate_high",
36320
+ "volume"
36321
+ ],
36322
+ limit: 200,
36323
+ offset: 0
36324
+ }
36325
+ },
36326
+ account_type: null,
36327
+ unit: null,
36328
+ filters_applied: {
36329
+ period: {
36330
+ start: "2026-01-01",
36331
+ end: "2026-09-16",
36332
+ grain: "month"
36333
+ },
36334
+ scenario: [
36335
+ "Actuals"
36336
+ ],
36337
+ dimensions: {
36338
+ Entity: [
36339
+ "NCM-US"
36340
+ ]
36341
+ }
36342
+ },
36343
+ filters_ignored: [],
36344
+ params_applied: {},
36345
+ fetched_at: "2026-09-16T14:02:11Z",
36346
+ row_count: 9,
36347
+ reads: 1
36348
+ }
36349
+ };
36350
+
36351
+ // ../tests/vendor/fixtures/widgets/scatter.json
36352
+ var scatter_default = {
36353
+ kind: "scatter",
36354
+ axes: {
36355
+ x: {
36356
+ label: "Spend",
36357
+ unit: "currency"
36358
+ },
36359
+ y: {
36360
+ label: "Revenue",
36361
+ unit: "currency"
36362
+ },
36363
+ size: {
36364
+ label: "Headcount",
36365
+ unit: "count"
36366
+ }
36367
+ },
36368
+ points: [
36369
+ {
36370
+ label: "NCM-US",
36371
+ x: 42e4,
36372
+ y: -12e5,
36373
+ size: 48,
36374
+ group: "Americas"
36375
+ },
36376
+ {
36377
+ label: "NCM-UK",
36378
+ x: 19e4,
36379
+ y: -51e4,
36380
+ size: 21,
36381
+ group: "EMEA"
36382
+ },
36383
+ {
36384
+ label: "NCM-IL",
36385
+ x: 95e3,
36386
+ y: -225e3,
36387
+ size: 12,
36388
+ group: "EMEA"
36389
+ }
36390
+ ],
36391
+ meta: {
36392
+ v: 1,
36393
+ source: {
36394
+ kind: "metric",
36395
+ metric_id: 42,
36396
+ metric_name: "Revenue",
36397
+ url: null,
36398
+ read: "rows",
36399
+ fetched_at: "2026-09-16T14:02:11Z",
36400
+ query: {
36401
+ call: "drill_down_business_metric",
36402
+ metric_ids: [
36403
+ 42
36404
+ ],
36405
+ date_start: "2026-01-01",
36406
+ date_end: "2026-09-16",
36407
+ dimension_filters: {
36408
+ Entity: [
36409
+ "NCM-US"
36410
+ ]
36411
+ }
36412
+ }
36413
+ },
36414
+ account_type: "revenue",
36415
+ unit: "currency",
36416
+ filters_applied: {
36417
+ period: {
36418
+ start: "2026-01-01",
36419
+ end: "2026-09-16",
36420
+ grain: "month"
36421
+ },
36422
+ scenario: [
36423
+ "Actuals"
36424
+ ],
36425
+ dimensions: {
36426
+ Entity: [
36427
+ "NCM-US"
36428
+ ]
36429
+ }
36430
+ },
36431
+ filters_ignored: [],
36432
+ params_applied: {},
36433
+ fetched_at: "2026-09-16T14:02:11Z",
36434
+ row_count: 3,
36435
+ reads: 1,
36436
+ drill: {
36437
+ dimensions: [
36438
+ "Entity"
36439
+ ],
36440
+ op: "drill",
36441
+ widget: "spend_vs_rev"
36442
+ }
36443
+ }
36444
+ };
36445
+
36446
+ // ../tests/vendor/fixtures/widgets/catalog-response.json
36447
+ var catalog_response_default = {
36448
+ v: 1,
36449
+ dimensions: [
36450
+ {
36451
+ name: "Entity",
36452
+ values: [
36453
+ "NCM-US",
36454
+ "NCM-UK",
36455
+ "NCM-IL"
36456
+ ],
36457
+ truncated: false
36458
+ },
36459
+ {
36460
+ name: "Account",
36461
+ values: [
36462
+ "4000 Sales",
36463
+ "4100 Services"
36464
+ ],
36465
+ truncated: false
36466
+ }
36467
+ ],
36468
+ scenarios: [
36469
+ "Actuals",
36470
+ "Budget"
36471
+ ],
36472
+ period: {
36473
+ min: "2024-01",
36474
+ max: "2026-09"
36475
+ }
36476
+ };
36477
+
36478
+ // src/commands/appspace/_samples.ts
36479
+ var TEMPLATES = {
36480
+ series: series_default,
36481
+ breakdown: breakdown_default,
36482
+ kpi: kpi_default,
36483
+ table: table_default,
36484
+ ohlc: ohlc_default,
36485
+ scatter: scatter_default,
36486
+ narrative: narrative_default
36487
+ };
36488
+ var KIND_READS5 = {
36489
+ line: "series",
36490
+ area: "series",
36491
+ bar: "series",
36492
+ stacked: "series",
36493
+ // dr-app-widgets' finance kinds (`src/kinds/index.ts` VARIANTS), first read;
36494
+ // a walkthrough is the bridge month by month, which a series draws.
36495
+ waterfall: "breakdown",
36496
+ "waterfall-breakdown": "breakdown",
36497
+ "waterfall-walkthrough": "series",
36498
+ heatmap: "series",
36499
+ combo: "series",
36500
+ "stacked-percent": "series",
36501
+ gauge: "kpi",
36502
+ pie: "breakdown",
36503
+ donut: "breakdown",
36504
+ hbar: "breakdown",
36505
+ kpi: "kpi",
36506
+ candle: "ohlc",
36507
+ bubble: "scatter",
36508
+ table: "table",
36509
+ narrative: "narrative"
36510
+ };
36511
+ function payloadKindOf(kind) {
36512
+ if (typeof kind !== "string" || kind === "") return null;
36513
+ if (Object.prototype.hasOwnProperty.call(TEMPLATES, kind)) return kind;
36514
+ return KIND_READS5[kind] ?? KIND_READS5[kind.split("-")[0]] ?? null;
36515
+ }
36516
+ var isObject8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
36517
+ var text3 = (value) => typeof value === "string" && value.trim() !== "" ? value : null;
36518
+ function samplePlan(contract) {
36519
+ const plan = { dashboards: /* @__PURE__ */ new Map(), widgets: /* @__PURE__ */ new Map(), scenarios: [] };
36520
+ if (!isObject8(contract)) return plan;
36521
+ const data = isObject8(contract.data) ? contract.data : {};
36522
+ const declared = isObject8(data.widgets) ? data.widgets : {};
36523
+ const page = isObject8(data.page) ? data.page : {};
36524
+ plan.scenarios = Array.isArray(page.scenarios) ? page.scenarios.filter((s) => typeof s === "string") : [];
36525
+ const mounts = /* @__PURE__ */ new Set();
36526
+ for (const p of Array.isArray(contract.pages) ? contract.pages : []) {
36527
+ const handler = isObject8(p) && isObject8(p.mount) ? text3(p.mount.handler) : null;
36528
+ if (handler !== null) mounts.add(handler);
36529
+ }
36530
+ const elements = isObject8(contract.elements) ? contract.elements : {};
36531
+ const titles = /* @__PURE__ */ new Map();
36532
+ for (const el of Object.values(elements)) {
36533
+ if (!isObject8(el) || el.type !== "widget" || !isObject8(el.props)) continue;
36534
+ const frame2 = isObject8(el.card) ? el.card : {};
36535
+ const title = text3(frame2.title) ?? text3(el.props.title) ?? text3(el.props.label);
36536
+ const id = text3(el.props.card) ?? text3(el.props.id) ?? text3(el.id);
36537
+ if (title !== null && id !== null && !titles.has(id)) titles.set(id, title);
36538
+ }
36539
+ for (const handler of mounts) {
36540
+ const cards = /* @__PURE__ */ new Map();
36541
+ for (const [id, spec] of Object.entries(declared)) {
36542
+ if (!isObject8(spec)) continue;
36543
+ const kind = payloadKindOf(spec.kind);
36544
+ if (kind === null) continue;
36545
+ cards.set(id, { kind, title: titles.get(id) ?? null, accountType: text3(spec.account_type), agent: spec.mode === "agent" });
36546
+ }
36547
+ if (cards.size > 0) plan.dashboards.set(handler, cards);
36548
+ }
36549
+ for (const el of Object.values(elements)) {
36550
+ if (!isObject8(el) || el.type !== "widget" || !isObject8(el.props)) continue;
36551
+ const props = el.props;
36552
+ const source = text3(props.source);
36553
+ if (source === null || mounts.has(source) || plan.widgets.has(source)) continue;
36554
+ const kind = payloadKindOf(props.kind);
36555
+ if (kind === null) continue;
36556
+ const frame2 = isObject8(el.card) ? el.card : {};
36557
+ const title = text3(frame2.title) ?? text3(props.title) ?? text3(props.label);
36558
+ plan.widgets.set(source, { kind, title, accountType: text3(props.account_type), agent: false });
36559
+ }
36560
+ return plan;
36561
+ }
36562
+ function markupPlan(files) {
36563
+ const plan = { dashboards: /* @__PURE__ */ new Map(), widgets: /* @__PURE__ */ new Map(), scenarios: [] };
36564
+ let handler = null;
36565
+ const cards = /* @__PURE__ */ new Map();
36566
+ for (const [path3, body] of Object.entries(files)) {
36567
+ const source = body.toString();
36568
+ if (/\.m?js$/i.test(path3) || /\.html?$/i.test(path3)) {
36569
+ if (handler === null && /drWidgets\.mount\(/.test(source)) {
36570
+ const named13 = /\bhandler:\s*['"]([\w-]+)['"]/.exec(source);
36571
+ const constant = /\bhandler:\s*([A-Z_][A-Z0-9_]*)/.exec(source);
36572
+ const value = constant === null ? null : new RegExp(`\\b${constant[1]}\\s*=\\s*['"]([\\w-]+)['"]`).exec(source);
36573
+ handler = named13?.[1] ?? value?.[1] ?? null;
36574
+ }
36575
+ }
36576
+ if (!/\.html?$/i.test(path3)) continue;
36577
+ for (const tag of source.match(/<[a-z][^>]*\bdata-dr-widget="[^"]+"[^>]*>/gi) ?? []) {
36578
+ const attr3 = (name) => new RegExp(`\\b${name}="([^"]*)"`).exec(tag)?.[1] ?? null;
36579
+ const id = attr3("data-dr-widget");
36580
+ const kind = payloadKindOf(attr3("data-dr-widget-kind"));
36581
+ if (id === null || kind === null || cards.has(id)) continue;
36582
+ cards.set(id, { kind, title: attr3("data-dr-widget-title"), accountType: null, agent: false });
36583
+ }
36584
+ }
36585
+ if (handler !== null && cards.size > 0) plan.dashboards.set(handler, cards);
36586
+ return plan;
36587
+ }
36588
+ function scaleOf(seed) {
36589
+ let hash = 2166136261;
36590
+ for (let i = 0; i < seed.length; i++) {
36591
+ hash ^= seed.charCodeAt(i);
36592
+ hash = Math.imul(hash, 16777619) >>> 0;
36593
+ }
36594
+ return 0.6 + hash % 1e3 / 1e3;
36595
+ }
36596
+ var CREDIT = /* @__PURE__ */ new Set(["revenue", "income", "liability", "equity"]);
36597
+ var SIGNED = /^(value|values|spark|total|other_value|actual|budget|forecast|variance|text)$/;
36598
+ var UNSIGNED = /^(candles|volume|x|y|size)$/;
36599
+ function figures(value, factor, sign, key = "") {
36600
+ if (typeof value === "number") {
36601
+ if (UNSIGNED.test(key)) return Math.round(value * factor);
36602
+ if (!SIGNED.test(key)) return value;
36603
+ const scaled = Math.round(value * factor);
36604
+ return sign === null ? scaled : sign * Math.abs(scaled);
36605
+ }
36606
+ if (Array.isArray(value)) {
36607
+ const filled = value.map((item, i) => {
36608
+ if (item !== null || !/^(values|spark)$/.test(key)) return item;
36609
+ const near = [value[i - 1], value[i + 1]].filter((n) => typeof n === "number");
36610
+ return near.length === 0 ? item : near.reduce((a, b) => a + b, 0) / near.length;
36611
+ });
36612
+ return filled.map((item) => figures(item, factor, sign, key));
36613
+ }
36614
+ if (isObject8(value)) {
36615
+ return Object.fromEntries(
36616
+ Object.entries(value).map(([k, v]) => [k, k === "meta" || k === "delta" || k === "share" ? v : figures(v, factor, sign, k)])
36617
+ );
36618
+ }
36619
+ return value;
36620
+ }
36621
+ function samplePayload(id, card) {
36622
+ const template = card.kind === "narrative" && card.agent ? narrative_agent_default : TEMPLATES[card.kind];
36623
+ const copy = JSON.parse(JSON.stringify(template));
36624
+ const sign = card.accountType === null ? null : CREDIT.has(card.accountType) ? -1 : 1;
36625
+ const out = figures(copy, scaleOf(id), sign);
36626
+ if (card.accountType !== null) {
36627
+ if ("account_type" in out) out.account_type = card.accountType;
36628
+ if (isObject8(out.meta) && "account_type" in out.meta) out.meta = { ...out.meta, account_type: card.accountType };
36629
+ for (const series of Array.isArray(out.series) ? out.series : []) {
36630
+ if (isObject8(series) && "account_type" in series) series.account_type = card.accountType;
36631
+ }
36632
+ for (const column of Array.isArray(out.columns) ? out.columns : []) {
36633
+ if (isObject8(column) && "account_type" in column) column.account_type = card.accountType;
36634
+ }
36635
+ }
36636
+ if (card.kind === "kpi" && card.title !== null) out.label = card.title;
36637
+ if (isObject8(out.meta)) {
36638
+ out.meta = { ...out.meta, filters_ignored: [] };
36639
+ }
36640
+ return out;
36641
+ }
36642
+ function sampleCatalog(plan) {
36643
+ const catalog = JSON.parse(JSON.stringify(catalog_response_default));
36644
+ if (plan.scenarios.length > 0) catalog.scenarios = [...plan.scenarios];
36645
+ return catalog;
36646
+ }
36647
+ function sampleAnswer(plan, handler, body) {
36648
+ const cards = plan.dashboards.get(handler);
36649
+ if (cards !== void 0) {
36650
+ const op = isObject8(body) ? body.op : void 0;
36651
+ if (op === "catalog") return sampleCatalog(plan);
36652
+ if (op !== "load" || !isObject8(body)) return void 0;
36653
+ const asked = Array.isArray(body.widgets) ? body.widgets.filter((w) => typeof w === "string") : [];
36654
+ const widgets = {};
36655
+ for (const id of asked) {
36656
+ const card2 = cards.get(id);
36657
+ if (card2 !== void 0) widgets[id] = samplePayload(id, card2);
36658
+ }
36659
+ return { v: 1, widgets, filters_applied: isObject8(body.filters) ? body.filters : {}, fetched_at: "2026-09-30T09:00:00Z" };
36660
+ }
36661
+ const card = plan.widgets.get(handler);
36662
+ return card === void 0 ? void 0 : samplePayload(handler, card);
36663
+ }
36664
+
36665
+ // src/commands/appspace/_screenshot.ts
35676
36666
  var SHOT_TIMEOUT_MS = 6e4;
35677
36667
  var SHOT_BUDGET_MS = 18e4;
35678
36668
  var SHOT_CONCURRENCY = 4;
@@ -35690,7 +36680,10 @@ var CHROME_APP_PATHS = [
35690
36680
  "/usr/bin/google-chrome",
35691
36681
  "/usr/bin/google-chrome-stable",
35692
36682
  "/usr/bin/chromium",
35693
- "/usr/bin/chromium-browser"
36683
+ "/usr/bin/chromium-browser",
36684
+ // The managed build sandbox (DEV-1, checked 2026-10-29): Playwright's
36685
+ // Chromium, linked here, with nothing on PATH.
36686
+ "/opt/google/chrome/chrome"
35694
36687
  ];
35695
36688
  var CHROME_NAMES = ["google-chrome", "chromium", "chrome"];
35696
36689
  function isFile(path3) {
@@ -35834,6 +36827,19 @@ function fixtureAnswers(cases) {
35834
36827
  }
35835
36828
  return out;
35836
36829
  }
36830
+ function pageContract(files, pages) {
36831
+ for (const entry of [...pages, ...Object.keys(files).filter((path3) => !pages.includes(path3))]) {
36832
+ const body = files[entry];
36833
+ if (body === void 0 || !/\.html?$/i.test(entry)) continue;
36834
+ const block = contractBlockText(body.toString());
36835
+ if (block === null) continue;
36836
+ try {
36837
+ return JSON.parse(block);
36838
+ } catch {
36839
+ }
36840
+ }
36841
+ return null;
36842
+ }
35837
36843
  var TYPES = {
35838
36844
  ".html": "text/html; charset=utf-8",
35839
36845
  ".htm": "text/html; charset=utf-8",
@@ -35912,7 +36918,7 @@ var Shelf = class {
35912
36918
  }
35913
36919
  };
35914
36920
  var MEASURE_BODY = 'var d=document.documentElement,b=document.body||d,extra=0;document.querySelectorAll("*").forEach(function(e){var s=getComputedStyle(e).overflowY;if((s==="auto"||s==="scroll")&&e.scrollHeight>e.clientHeight)extra=Math.max(extra,e.scrollHeight-e.clientHeight)});var h=Math.max(d.scrollHeight,b.scrollHeight,innerHeight+extra);var m=document.createElement("meta");m.id="dr-shot-height";m.content=String(h);document.head.appendChild(m);';
35915
- var LOOK_BODY = 'var R=[],vw=innerWidth,D=document.documentElement,N={};function nth(k){N[k]=(N[k]||0)+1;return N[k]}function tx(e){return (e.innerText||e.textContent||"").trim().replace(/\\s+/g," ").slice(0,80)}function vis(e){var r=e.getBoundingClientRect(),s=getComputedStyle(e);return r.width>0&&r.height>0&&s.visibility!=="hidden"&&s.display!=="none"}function own(e){return [].some.call(e.childNodes,function(n){return n.nodeType===3&&n.textContent.trim()!==""})}function ownW(e){var r=e.getBoundingClientRect(),x=r.left+e.clientLeft,m=0;[].forEach.call(e.childNodes,function(n){if(n.nodeType!==3||n.textContent.trim()==="")return;var g=document.createRange();g.selectNodeContents(n);m=Math.max(m,g.getBoundingClientRect().right-x)});return Math.ceil(m)}function rgb(c){var m=/rgba?\\(([^)]+)\\)/.exec(c);if(!m)return null;var p=m[1].split(/[\\s,\\/]+/).filter(Boolean).map(Number);return p.length>=3&&p.slice(0,3).every(isFinite)?[p[0],p[1],p[2],p.length>3&&isFinite(p[3])?p[3]:1]:null}function lum(c){return [c[0],c[1],c[2]].map(function(v){v/=255;return v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4)}).reduce(function(a,v,i){return a+v*[.2126,.7152,.0722][i]},0)}function bgOf(e){for(var p=e;p&&p.nodeType===1;p=p.parentElement){var s=getComputedStyle(p);if(s.backgroundImage!=="none")return null;var c=rgb(s.backgroundColor);if(c&&c[3]>=1)return c}return [255,255,255,1]}var all=[].filter.call(document.querySelectorAll("body *"),vis),pairs={};all.forEach(function(e){if(!own(e))return;var s=getComputedStyle(e);if(e.clientWidth>2&&e.clientHeight>2){var need=e.children.length===0?e.scrollWidth:ownW(e);if(need>e.clientWidth+1&&(s.textOverflow==="ellipsis"||s.overflowX==="hidden"||s.overflowX==="clip"))R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientWidth,needs:need});else if(s.webkitLineClamp&&s.webkitLineClamp!=="none"&&e.scrollHeight>e.clientHeight+1)R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientHeight,needs:e.scrollHeight,lines:true})}var f=rgb(s.color),b=bgOf(e);if(!f||!b)return;var a=f[3],fc=[f[0]*a+b[0]*(1-a),f[1]*a+b[1]*(1-a),f[2]*a+b[2]*(1-a)],L1=lum(fc),L2=lum(b),cr=(Math.max(L1,L2)+.05)/(Math.min(L1,L2)+.05),px=parseFloat(s.fontSize),big=px>=24||(px>=18.66&&Number(s.fontWeight)>=700);if(cr<(big?3:4.5)){var k=s.color+"|"+b.join(",");if(pairs[k])pairs[k].count++;else{pairs[k]={rule:"low-contrast",text:tx(e),ratio:Math.round(cr*100)/100,color:s.color,background:"rgb("+b.slice(0,3).join(", ")+")",count:1};R.push(pairs[k])}}});if(D.scrollWidth>vw+1)R.push({rule:"page-overflow",text:"",right:D.scrollWidth,viewport:vw});var off=0;all.forEach(function(e){if(off>=5)return;var r=e.getBoundingClientRect(),s=getComputedStyle(e);if(r.right<=vw+1||s.position==="fixed")return;var p=e.parentElement;if(p&&p!==document.body&&p!==D&&p.getBoundingClientRect().right>vw+1)return;for(var q=p;q&&q!==document.body&&q!==D;q=q.parentElement){if(getComputedStyle(q).overflowX!=="visible")return}off++;R.push({rule:"page-overflow",text:tx(e),n:nth("o|"+tx(e)),right:Math.round(r.right),viewport:vw})});document.querySelectorAll(".dr-app-band").forEach(function(b){if(!vis(b))return;var cs=[].filter.call(b.querySelectorAll(".dr-app-cell"),function(c){return vis(c)&&c.closest(".dr-app-band")===b});var hd=b.querySelector(".dr-app-band-head"),name=hd?tx(hd):"";if(cs.length===0){if(hd)R.push({rule:"empty-band",band:name});return}if(cs.length<2)return;if((b.getAttribute("data-dr-layout")||"grid")==="grid"&&cs.reduce(function(a,c){return a+(Number(c.getAttribute("data-dr-span"))||12)},0)<12*' + String(BAND_FILL_MIN) + ")return;var top=cs[0].getBoundingClientRect().top;if(!cs.every(function(c){return Math.abs(c.getBoundingClientRect().top-top)<2}))return;var w=cs.reduce(function(a,c){return a+c.getBoundingClientRect().width},0),bw=b.getBoundingClientRect().width;if(bw>0&&w<bw*" + String(BAND_FILL_MIN) + ')R.push({rule:"band-underfilled",band:name,filled:Math.round(100*w/bw),tiles:cs.length,tileWidth:Math.round(cs[0].getBoundingClientRect().width),bandWidth:Math.round(bw)})});var lv=all.filter(function(e){return e.children.length===0&&own(e)}).slice(0,400);for(var i=0;i<lv.length;i++)for(var j=i+1;j<lv.length;j++){var x=lv[i].getBoundingClientRect(),y=lv[j].getBoundingClientRect();if(Math.min(x.right,y.right)-Math.max(x.left,y.left)>4&&Math.min(x.bottom,y.bottom)-Math.max(x.top,y.top)>4)R.push({rule:"text-overlap",a:tx(lv[i]),b:tx(lv[j])})}var lm=document.createElement("meta");lm.id="dr-shot-look";lm.content=encodeURIComponent(JSON.stringify(R));document.head.appendChild(lm);';
36921
+ var LOOK_BODY = 'var R=[],vw=innerWidth,D=document.documentElement,N={};function nth(k){N[k]=(N[k]||0)+1;return N[k]}function tx(e){return (e.innerText||e.textContent||"").trim().replace(/\\s+/g," ").slice(0,80)}function shown(e){for(var p=e;p&&p.nodeType===1;p=p.parentElement){if(getComputedStyle(p).opacity==="0")return false}return true}function vis(e){var r=e.getBoundingClientRect(),s=getComputedStyle(e);return r.width>0&&r.height>0&&s.visibility!=="hidden"&&s.display!=="none"&&shown(e)}function own(e){return [].some.call(e.childNodes,function(n){return n.nodeType===3&&n.textContent.trim()!==""})}function ownW(e){var r=e.getBoundingClientRect(),x=r.left+e.clientLeft,m=0;[].forEach.call(e.childNodes,function(n){if(n.nodeType!==3||n.textContent.trim()==="")return;var g=document.createRange();g.selectNodeContents(n);m=Math.max(m,g.getBoundingClientRect().right-x)});return Math.ceil(m)}function rgb(c){var m=/rgba?\\(([^)]+)\\)/.exec(c);if(!m)return null;var p=m[1].split(/[\\s,\\/]+/).filter(Boolean).map(Number);return p.length>=3&&p.slice(0,3).every(isFinite)?[p[0],p[1],p[2],p.length>3&&isFinite(p[3])?p[3]:1]:null}function lum(c){return [c[0],c[1],c[2]].map(function(v){v/=255;return v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4)}).reduce(function(a,v,i){return a+v*[.2126,.7152,.0722][i]},0)}function bgOf(e){for(var p=e;p&&p.nodeType===1;p=p.parentElement){var s=getComputedStyle(p);if(s.backgroundImage!=="none")return null;var c=rgb(s.backgroundColor);if(c&&c[3]>=1)return c}return [255,255,255,1]}var all=[].filter.call(document.querySelectorAll("body *"),vis),pairs={};all.forEach(function(e){if(!own(e))return;var s=getComputedStyle(e);if(e.clientWidth>2&&e.clientHeight>2){var need=e.children.length===0?e.scrollWidth:ownW(e);if(need>e.clientWidth+1&&(s.textOverflow==="ellipsis"||s.overflowX==="hidden"||s.overflowX==="clip"))R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientWidth,needs:need});else if(s.webkitLineClamp&&s.webkitLineClamp!=="none"&&e.scrollHeight>e.clientHeight+1)R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientHeight,needs:e.scrollHeight,lines:true})}var f=rgb(s.color),b=bgOf(e);if(!f||!b)return;var a=f[3],fc=[f[0]*a+b[0]*(1-a),f[1]*a+b[1]*(1-a),f[2]*a+b[2]*(1-a)],L1=lum(fc),L2=lum(b),cr=(Math.max(L1,L2)+.05)/(Math.min(L1,L2)+.05),px=parseFloat(s.fontSize),big=px>=24||(px>=18.66&&Number(s.fontWeight)>=700);if(cr<(big?3:4.5)){var k=s.color+"|"+b.join(",");if(pairs[k])pairs[k].count++;else{pairs[k]={rule:"low-contrast",text:tx(e),ratio:Math.round(cr*100)/100,color:s.color,background:"rgb("+b.slice(0,3).join(", ")+")",count:1};R.push(pairs[k])}}});if(D.scrollWidth>vw+1)R.push({rule:"page-overflow",text:"",right:D.scrollWidth,viewport:vw});var off=0;all.forEach(function(e){if(off>=5)return;var r=e.getBoundingClientRect(),s=getComputedStyle(e);if(r.right<=vw+1||s.position==="fixed")return;var p=e.parentElement;if(p&&p!==document.body&&p!==D&&p.getBoundingClientRect().right>vw+1)return;for(var q=p;q&&q!==document.body&&q!==D;q=q.parentElement){if(getComputedStyle(q).overflowX!=="visible")return}off++;R.push({rule:"page-overflow",text:tx(e),n:nth("o|"+tx(e)),right:Math.round(r.right),viewport:vw})});document.querySelectorAll(".dr-app-band").forEach(function(b){if(!vis(b))return;var cs=[].filter.call(b.querySelectorAll(".dr-app-cell"),function(c){return vis(c)&&c.closest(".dr-app-band")===b});var hd=b.querySelector(".dr-app-band-head"),name=hd?tx(hd):"";if(cs.length===0){if(hd)R.push({rule:"empty-band",band:name});return}if(cs.length<2)return;if((b.getAttribute("data-dr-layout")||"grid")==="grid"&&cs.reduce(function(a,c){return a+(Number(c.getAttribute("data-dr-span"))||12)},0)<12*' + String(BAND_FILL_MIN) + ")return;var top=cs[0].getBoundingClientRect().top;if(!cs.every(function(c){return Math.abs(c.getBoundingClientRect().top-top)<2}))return;var w=cs.reduce(function(a,c){return a+c.getBoundingClientRect().width},0),bw=b.getBoundingClientRect().width;if(bw>0&&w<bw*" + String(BAND_FILL_MIN) + ')R.push({rule:"band-underfilled",band:name,filled:Math.round(100*w/bw),tiles:cs.length,tileWidth:Math.round(cs[0].getBoundingClientRect().width),bandWidth:Math.round(bw)})});var lv=all.filter(function(e){return e.children.length===0&&own(e)}).slice(0,400);for(var i=0;i<lv.length;i++)for(var j=i+1;j<lv.length;j++){var x=lv[i].getBoundingClientRect(),y=lv[j].getBoundingClientRect();if(Math.min(x.right,y.right)-Math.max(x.left,y.left)>4&&Math.min(x.bottom,y.bottom)-Math.max(x.top,y.top)>4)R.push({rule:"text-overlap",a:tx(lv[i]),b:tx(lv[j])})}var lm=document.createElement("meta");lm.id="dr-shot-look";lm.content=encodeURIComponent(JSON.stringify(R));document.head.appendChild(lm);';
35916
36922
  function probeScript(shot) {
35917
36923
  const body = (shot.measure === true ? MEASURE_BODY : "") + (shot.look === true ? LOOK_BODY : "");
35918
36924
  return `<script>addEventListener("load",function(){setTimeout(function(){${body}},3000)})</script>`;
@@ -35945,6 +36951,26 @@ function send(res, status, type, body) {
35945
36951
  function sendJson(res, status, value) {
35946
36952
  send(res, status, "application/json", JSON.stringify(value));
35947
36953
  }
36954
+ var BODY_MAX = 256 * 1024;
36955
+ function readBody(req) {
36956
+ return new Promise((done) => {
36957
+ const chunks = [];
36958
+ let size2 = 0;
36959
+ req.on("data", (chunk) => {
36960
+ size2 += chunk.length;
36961
+ if (size2 <= BODY_MAX) chunks.push(chunk);
36962
+ });
36963
+ req.on("end", () => {
36964
+ if (size2 > BODY_MAX) return done(null);
36965
+ try {
36966
+ done(JSON.parse(Buffer.concat(chunks).toString("utf8")));
36967
+ } catch {
36968
+ done(null);
36969
+ }
36970
+ });
36971
+ req.on("error", () => done(null));
36972
+ });
36973
+ }
35948
36974
  function drain(req) {
35949
36975
  return new Promise((done) => {
35950
36976
  req.on("data", () => void 0);
@@ -35958,7 +36984,7 @@ async function startStubServer(opts) {
35958
36984
  const logOf = (id) => {
35959
36985
  let log = logs.get(id);
35960
36986
  if (log === void 0) {
35961
- log = { called: [], answered: [], noFixture: [], refused: [] };
36987
+ log = { called: [], answered: [], noFixture: [], sampled: [], refused: [] };
35962
36988
  logs.set(id, log);
35963
36989
  }
35964
36990
  return log;
@@ -36007,8 +37033,11 @@ async function startStubServer(opts) {
36007
37033
  return send(res, 200, type, body);
36008
37034
  }
36009
37035
  if (req.method === "POST" && /^[^/]+$/.test(inApp)) {
36010
- await drain(req);
36011
- if (inApp === "uploads") return sendJson(res, 200, { upload: "screenshot-stub" });
37036
+ if (inApp === "uploads") {
37037
+ await drain(req);
37038
+ return sendJson(res, 200, { upload: "screenshot-stub" });
37039
+ }
37040
+ const body = await readBody(req);
36012
37041
  const log = logOf(id);
36013
37042
  note(log.called, inApp);
36014
37043
  const access = accessFor(opts.manifest, shot.role, opts.allowedByRole?.[shot.role], opts.sources ?? []);
@@ -36017,6 +37046,15 @@ async function startStubServer(opts) {
36017
37046
  return sendJson(res, 403, { detail: `role ${shot.role} may not call ${inApp}` });
36018
37047
  }
36019
37048
  const answer = opts.answers.get(inApp);
37049
+ if (answer?.from === "expect") {
37050
+ note(log.answered, inApp);
37051
+ return sendJson(res, 200, answer.body);
37052
+ }
37053
+ const sample = opts.samples === void 0 ? void 0 : sampleAnswer(opts.samples, inApp, body);
37054
+ if (sample !== void 0) {
37055
+ note(log.sampled, inApp);
37056
+ return sendJson(res, 200, sample);
37057
+ }
36020
37058
  if (answer === void 0) {
36021
37059
  note(log.noFixture, inApp);
36022
37060
  return sendJson(res, 200, []);
@@ -36046,7 +37084,13 @@ async function startStubServer(opts) {
36046
37084
  },
36047
37085
  calls: (id) => {
36048
37086
  const log = logOf(id);
36049
- return { called: [...log.called], answered: [...log.answered], noFixture: [...log.noFixture], refused: [...log.refused] };
37087
+ return {
37088
+ called: [...log.called],
37089
+ answered: [...log.answered],
37090
+ noFixture: [...log.noFixture],
37091
+ sampled: [...log.sampled],
37092
+ refused: [...log.refused]
37093
+ };
36050
37094
  },
36051
37095
  close: () => new Promise((done) => {
36052
37096
  server.closeAllConnections?.();
@@ -36066,9 +37110,15 @@ function killGroup(child) {
36066
37110
  }
36067
37111
  }
36068
37112
  var sleep2 = (ms) => new Promise((done) => setTimeout(done, ms));
37113
+ function asRoot(getuid = process.getuid?.bind(process) ?? null) {
37114
+ return getuid !== null && getuid() === 0;
37115
+ }
36069
37116
  async function runChrome(run) {
36070
37117
  const profile = await mkdtemp4(join17(tmpdir5(), "dr-appspace-shot-"));
36071
37118
  const args = [
37119
+ // Chrome will not start as root without it, and a container's shell is
37120
+ // root (the managed build sandbox). Elsewhere its own sandbox stays on.
37121
+ ...asRoot() ? ["--no-sandbox"] : [],
36072
37122
  "--headless=new",
36073
37123
  "--disable-gpu",
36074
37124
  "--hide-scrollbars",
@@ -36156,6 +37206,9 @@ async function runScreenshots(opts) {
36156
37206
  const look = opts.look !== false;
36157
37207
  await mkdir8(opts.outDir, { recursive: true });
36158
37208
  const answers = fixtureAnswers(opts.cases);
37209
+ const sample = opts.sample !== false;
37210
+ const contract = sample ? pageContract(opts.files, opts.pages) : null;
37211
+ const samples = !sample ? void 0 : contract === null ? markupPlan(opts.files) : samplePlan(contract);
36159
37212
  const shelf2 = new Shelf(opts.shelf, opts.fetchImpl);
36160
37213
  const stub = await startStubServer({
36161
37214
  appId: opts.appId,
@@ -36164,6 +37217,7 @@ async function runScreenshots(opts) {
36164
37217
  ...opts.allowedByRole === void 0 ? {} : { allowedByRole: opts.allowedByRole },
36165
37218
  ...opts.sources === void 0 ? {} : { sources: opts.sources },
36166
37219
  answers,
37220
+ ...samples === void 0 ? {} : { samples },
36167
37221
  shelf: shelf2
36168
37222
  });
36169
37223
  const plan = [];
@@ -36271,6 +37325,7 @@ async function runScreenshots(opts) {
36271
37325
  ms: now() - t0,
36272
37326
  handlersStubbed: calls.answered,
36273
37327
  handlersWithoutFixture: calls.noFixture,
37328
+ ...sample ? { handlersSampled: calls.sampled } : {},
36274
37329
  handlersRefused: calls.refused
36275
37330
  };
36276
37331
  if (!result.ok) {
@@ -36318,6 +37373,7 @@ async function runScreenshots(opts) {
36318
37373
  createdAt: new Date(started).toISOString(),
36319
37374
  ms: now() - started,
36320
37375
  look,
37376
+ sample,
36321
37377
  shots
36322
37378
  };
36323
37379
  await writeFile9(join17(opts.outDir, "index.json"), JSON.stringify(index, null, 2) + "\n");
@@ -36363,6 +37419,11 @@ screenshots \u2192 ${outDir} (${String(written)} of ${String(index.shots.length
36363
37419
  out += line2(head);
36364
37420
  for (const row of rows2) out += line2(row);
36365
37421
  const noFixture = [...new Set(index.shots.flatMap((shot) => shot.handlersWithoutFixture))].sort();
37422
+ const sampled = [...new Set(index.shots.flatMap((shot) => shot.handlersSampled ?? []))].sort();
37423
+ if (sampled.length > 0) {
37424
+ out += ` sample data (not the tenant's figures): ${sampled.join(", ")}
37425
+ `;
37426
+ }
36366
37427
  if (noFixture.length > 0) {
36367
37428
  out += ` no tests.json fixture (answered []): ${noFixture.join(", ")}
36368
37429
  `;
@@ -36784,18 +37845,18 @@ function unreadParams2(contract, { moduleSource = () => void 0, handlerSource =
36784
37845
  } else if (handlers[one]?.role === "custom" && !custom.includes(one)) custom.push(one);
36785
37846
  }
36786
37847
  if (element?.type === "custom" && named12(props.module)) {
36787
- const text3 = moduleSource(props.module);
36788
- if (typeof text3 === "string") modules.push(text3);
37848
+ const text4 = moduleSource(props.module);
37849
+ if (typeof text4 === "string") modules.push(text4);
36789
37850
  else unknown = true;
36790
37851
  }
36791
37852
  }
36792
37853
  if (unknown) continue;
36793
37854
  for (const name of namesOf2(page)) {
36794
37855
  if (read.has(name)) continue;
36795
- if (modules.some((text3) => readsUiParam(text3, name))) continue;
37856
+ if (modules.some((text4) => readsUiParam(text4, name))) continue;
36796
37857
  if (custom.some((handler) => {
36797
- const text3 = handlerSource(handler);
36798
- return typeof text3 !== "string" || text3.includes(`"${name}"`) || text3.includes(`'${name}'`);
37858
+ const text4 = handlerSource(handler);
37859
+ return typeof text4 !== "string" || text4.includes(`"${name}"`) || text4.includes(`'${name}'`);
36799
37860
  })) {
36800
37861
  continue;
36801
37862
  }
@@ -37379,9 +38440,9 @@ function partFindings(runs) {
37379
38440
  return true;
37380
38441
  };
37381
38442
  const alert = component.alert ?? "";
37382
- const text3 = component.text ?? "";
38443
+ const text4 = component.text ?? "";
37383
38444
  const failedPrefix = `${type} failed:`;
37384
- const failed = alert.startsWith(failedPrefix) ? alert : text3.startsWith(failedPrefix) ? text3 : null;
38445
+ const failed = alert.startsWith(failedPrefix) ? alert : text4.startsWith(failedPrefix) ? text4 : null;
37385
38446
  if (failed !== null) {
37386
38447
  if (once("part-failed")) {
37387
38448
  const error = failed.slice(failedPrefix.length).trim() || "it threw";
@@ -37395,7 +38456,7 @@ function partFindings(runs) {
37395
38456
  }
37396
38457
  continue;
37397
38458
  }
37398
- const undefinedSentence = [NO_COMPONENTS, NO_PART(type)].find((sentence3) => alert.startsWith(sentence3) || text3.startsWith(sentence3));
38459
+ const undefinedSentence = [NO_COMPONENTS, NO_PART(type)].find((sentence3) => alert.startsWith(sentence3) || text4.startsWith(sentence3));
37399
38460
  if (undefinedSentence !== void 0) {
37400
38461
  if (once("part-undefined")) {
37401
38462
  out.push({
@@ -37437,7 +38498,7 @@ function partFindings(runs) {
37437
38498
  if (entry?.reads?.as !== "rows" || typeof source !== "string" || source === "") continue;
37438
38499
  const typed = component.props.props ?? {};
37439
38500
  const sentence2 = typeof typed["empty_text"] === "string" && typed["empty_text"] !== "" ? String(typed["empty_text"]) : entry.empty ?? "Nothing to show.";
37440
- if (!text3.includes(sentence2)) continue;
38501
+ if (!text4.includes(sentence2)) continue;
37441
38502
  const answered = loadAnswers(run, source).map((call) => call.rows).find((rows2) => rows2 !== void 0 && rows2 > 0);
37442
38503
  if (answered === void 0) continue;
37443
38504
  if (!once("part-empty")) continue;
@@ -37451,12 +38512,12 @@ function partFindings(runs) {
37451
38512
  }
37452
38513
  return out;
37453
38514
  }
37454
- function linesOf(text3) {
37455
- if (typeof text3 !== "string" || text3 === "") return 0;
37456
- return text3.replace(/\n$/, "").split("\n").length;
38515
+ function linesOf(text4) {
38516
+ if (typeof text4 !== "string" || text4 === "") return 0;
38517
+ return text4.replace(/\n$/, "").split("\n").length;
37457
38518
  }
37458
- function nonBlankLinesOf(text3) {
37459
- return text3.split("\n").filter((line2) => line2.trim() !== "").length;
38519
+ function nonBlankLinesOf(text4) {
38520
+ return text4.split("\n").filter((line2) => line2.trim() !== "").length;
37460
38521
  }
37461
38522
  var PY_ESCAPES = { n: "\n", r: "\r", t: " ", "\\": "\\", "'": "'", '"': '"', "0": "\0" };
37462
38523
  function pyStringAt(code, at) {
@@ -37529,8 +38590,8 @@ function transformFiles2(contract, handlerCode) {
37529
38590
  for (const name of Object.keys(sources).sort()) {
37530
38591
  const path3 = sources[name]?.transform;
37531
38592
  if (typeof path3 !== "string" || path3 === "") continue;
37532
- const text3 = Object.prototype.hasOwnProperty.call(bySource, name) ? bySource[name] : void 0;
37533
- if (files.get(path3) === void 0) files.set(path3, text3);
38593
+ const text4 = Object.prototype.hasOwnProperty.call(bySource, name) ? bySource[name] : void 0;
38594
+ if (files.get(path3) === void 0) files.set(path3, text4);
37534
38595
  }
37535
38596
  return files;
37536
38597
  }
@@ -37571,7 +38632,7 @@ function partsSummary(contract, bundle, handlerCode) {
37571
38632
  if (isAppContract3(contract)) {
37572
38633
  const files = transformFiles2(contract, handlerCode);
37573
38634
  let lines = 0;
37574
- for (const text3 of files.values()) if (text3 !== void 0) lines += nonBlankLinesOf(text3);
38635
+ for (const text4 of files.values()) if (text4 !== void 0) lines += nonBlankLinesOf(text4);
37575
38636
  summary.transforms = { count: files.size, lines };
37576
38637
  }
37577
38638
  return summary;
@@ -38880,6 +39941,9 @@ function registerTestCommand(parent) {
38880
39941
  ).option("--width <px>", "With --screenshot: the window width.", "1400").option("--height <px>", "With --screenshot: the window height.", "900").option("--full", "With --screenshot: grow the window to the page\u2019s full height (one extra load per picture).").option(
38881
39942
  "--no-look",
38882
39943
  "With --screenshot: skip the look load (one more load per picture that reports text cut short, an underfilled band and content past the window edge as look-* warnings)."
39944
+ ).option(
39945
+ "--no-sample",
39946
+ "With --screenshot: answer data cards with tests.json or [] only, not with sample payloads of their kind (a dashboard\u2019s cards, an app\u2019s widget elements)."
38883
39947
  ).option(
38884
39948
  "--shelf <path>",
38885
39949
  "With --screenshot: serve vendor/ and ui-kit/ from this dr-app-space checkout instead of the server the app is pushed to (for offline use)."
@@ -39085,6 +40149,7 @@ function registerTestCommand(parent) {
39085
40149
  height: shotSize.height,
39086
40150
  full: opts.full === true,
39087
40151
  look: opts.look !== false,
40152
+ sample: opts.sample !== false,
39088
40153
  budgetMs: shotSize.budget
39089
40154
  });
39090
40155
  shots = { index, outDir };
@@ -39194,14 +40259,14 @@ async function readPayloadOption(raw, read = (path3) => readFile14(path3, "utf8"
39194
40259
  if (raw.startsWith("@")) {
39195
40260
  const path3 = raw.slice(1);
39196
40261
  if (path3 === "") throw new Error("--payload @ names no file; write --payload @./payload.json.");
39197
- let text3;
40262
+ let text4;
39198
40263
  try {
39199
- text3 = await read(path3);
40264
+ text4 = await read(path3);
39200
40265
  } catch {
39201
40266
  throw new Error(`--payload @${path3}: no such file.`);
39202
40267
  }
39203
40268
  try {
39204
- return JSON.parse(text3);
40269
+ return JSON.parse(text4);
39205
40270
  } catch {
39206
40271
  throw new Error(`--payload @${path3}: the file is not valid JSON.`);
39207
40272
  }