@wix/himalaya-cli 0.1760.0 → 0.1761.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/cli.mjs +880 -717
  2. package/guides/one-app-section-mappings.md +6 -7
  3. package/guides/one-app-to-himi-app.md +3 -3
  4. package/package.json +2 -2
  5. package/templates/beauty-salon/recipes/programs-participant-carousel.json +257 -0
  6. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +7 -4
  7. package/templates/branded-lite/recipes/programs-participant-carousel.json +257 -0
  8. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +7 -4
  9. package/templates/community-club/recipes/programs-participant-carousel.json +257 -0
  10. package/templates/community-club/tier5-src/_shared/programs-section.ts +7 -4
  11. package/templates/events-meetups/recipes/programs-participant-carousel.json +257 -0
  12. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +7 -4
  13. package/templates/gym-fitness/recipes/programs-participant-carousel.json +257 -0
  14. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +7 -4
  15. package/templates/nonprofit-cause/recipes/programs-participant-carousel.json +257 -0
  16. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +7 -4
  17. package/templates/podcast-creator/recipes/programs-participant-carousel.json +257 -0
  18. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +7 -4
  19. package/templates/portfolio-creative/recipes/programs-participant-carousel.json +257 -0
  20. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +7 -4
  21. package/templates/restaurant/recipes/programs-participant-carousel.json +257 -0
  22. package/templates/restaurant/tier5-src/_shared/programs-section.ts +7 -4
  23. package/templates/retail-store/recipes/programs-participant-carousel.json +257 -0
  24. package/templates/retail-store/tier5-src/_shared/programs-section.ts +7 -4
  25. package/templates/yoga-studio/recipes/programs-participant-carousel.json +257 -0
  26. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +7 -4
package/dist/cli.mjs CHANGED
@@ -29264,8 +29264,8 @@ async function loadAllowedComponents(appDir3) {
29264
29264
  const modPath = resolve20(appDir3, "components.ts");
29265
29265
  if (!existsSync20(modPath)) return void 0;
29266
29266
  try {
29267
- const { pathToFileURL: pathToFileURL12 } = await import("node:url");
29268
- const mod = await import(pathToFileURL12(modPath).href);
29267
+ const { pathToFileURL: pathToFileURL13 } = await import("node:url");
29268
+ const mod = await import(pathToFileURL13(modPath).href);
29269
29269
  for (const value2 of Object.values(mod)) {
29270
29270
  if (value2 instanceof Set) return value2;
29271
29271
  }
@@ -40018,7 +40018,6 @@ function resolveIdiom(tokens2, ctx = {}) {
40018
40018
  var IDIOM_CONTEXTS, UNSAFE_KEYS;
40019
40019
  var init_idiom = __esm({
40020
40020
  "../../core/ts/src/idiom.ts"() {
40021
- "use strict";
40022
40021
  init_define_HHP_CATALOG();
40023
40022
  IDIOM_CONTEXTS = {
40024
40023
  ios: { native: ["ios"] },
@@ -56966,7 +56965,7 @@ var init_pdf = __esm({
56966
56965
  var defineProperty = Object.defineProperty;
56967
56966
  var stringSlice = uncurryThis("".slice);
56968
56967
  var replace3 = uncurryThis("".replace);
56969
- var join207 = uncurryThis([].join);
56968
+ var join208 = uncurryThis([].join);
56970
56969
  var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
56971
56970
  return defineProperty(function() {
56972
56971
  }, "length", { value: 8 }).length !== 8;
@@ -56993,7 +56992,7 @@ var init_pdf = __esm({
56993
56992
  }
56994
56993
  var state = enforceInternalState(value2);
56995
56994
  if (!hasOwn(state, "source")) {
56996
- state.source = join207(TEMPLATE, typeof name == "string" ? name : "");
56995
+ state.source = join208(TEMPLATE, typeof name == "string" ? name : "");
56997
56996
  }
56998
56997
  return value2;
56999
56998
  };
@@ -59516,7 +59515,7 @@ var init_pdf = __esm({
59516
59515
  var charAt = uncurryThis("".charAt);
59517
59516
  var Uint8Array2 = globalThis2.Uint8Array;
59518
59517
  var $Array = globalThis2.Array;
59519
- var join207 = uncurryThis([].join);
59518
+ var join208 = uncurryThis([].join);
59520
59519
  var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
59521
59520
  try {
59522
59521
  var target = new Uint8Array2();
@@ -59562,7 +59561,7 @@ var init_pdf = __esm({
59562
59561
  result[written++] = "=";
59563
59562
  }
59564
59563
  }
59565
- return join207(result, "");
59564
+ return join208(result, "");
59566
59565
  }
59567
59566
  });
59568
59567
  },
@@ -59574,7 +59573,7 @@ var init_pdf = __esm({
59574
59573
  var anUint8Array = __webpack_require__3(4154);
59575
59574
  var notDetached = __webpack_require__3(5169);
59576
59575
  var numberToString2 = uncurryThis(1.1.toString);
59577
- var join207 = uncurryThis([].join);
59576
+ var join208 = uncurryThis([].join);
59578
59577
  var $Array = Array;
59579
59578
  var Uint8Array2 = globalThis2.Uint8Array;
59580
59579
  var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
@@ -59594,7 +59593,7 @@ var init_pdf = __esm({
59594
59593
  var hex2 = numberToString2(this[i2], 16);
59595
59594
  result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
59596
59595
  }
59597
- return join207(result, "");
59596
+ return join208(result, "");
59598
59597
  }
59599
59598
  });
59600
59599
  },
@@ -158907,8 +158906,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
158907
158906
  }
158908
158907
  async function appId(dir) {
158909
158908
  try {
158910
- const { readFileSync: readFileSync188 } = await import("node:fs");
158911
- const m2 = JSON.parse(readFileSync188(join42(dir, "himalaya.content.json"), "utf8"));
158909
+ const { readFileSync: readFileSync189 } = await import("node:fs");
158910
+ const m2 = JSON.parse(readFileSync189(join42(dir, "himalaya.content.json"), "utf8"));
158912
158911
  if (m2.name) return m2.name;
158913
158912
  } catch {
158914
158913
  }
@@ -226808,9 +226807,9 @@ var init_commands = __esm({
226808
226807
  summary: "Jobs in the state directory",
226809
226808
  async run(inv) {
226810
226809
  const { FileJobStore: FileJobStore2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
226811
- const { join: join207 } = await import("node:path");
226810
+ const { join: join208 } = await import("node:path");
226812
226811
  const runner2 = await inv.ctx.runner();
226813
- const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(join207(inv.ctx.stateDir, "jobs")).list();
226812
+ const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(join208(inv.ctx.stateDir, "jobs")).list();
226814
226813
  inv.print(jobs.map((j2) => ({ id: j2.id, action: j2.action, status: j2.status, actor: j2.actor, issuerId: accountKey(j2.account), created: j2.history[0]?.at })), ["id", "action", "status", "actor", "issuerId", "created"]);
226815
226814
  }
226816
226815
  },
@@ -238935,12 +238934,12 @@ __export(input_evidence_isolation_exports, {
238935
238934
  runInputEvidenceChild: () => runInputEvidenceChild
238936
238935
  });
238937
238936
  async function installInputEvidenceIsolation(dir) {
238938
- const { lstatSync: lstatSync41, readdirSync: readdirSync63 } = await import("node:fs");
238939
- const { join: join207 } = await import("node:path");
238937
+ const { lstatSync: lstatSync41, readdirSync: readdirSync64 } = await import("node:fs");
238938
+ const { join: join208 } = await import("node:path");
238940
238939
  const check = (path2) => {
238941
238940
  const stat10 = lstatSync41(path2);
238942
238941
  if (stat10.isSymbolicLink()) throw new Error("input evidence requires a content tree without symlinks");
238943
- if (stat10.isDirectory()) for (const name of readdirSync63(path2)) check(join207(path2, name));
238942
+ if (stat10.isDirectory()) for (const name of readdirSync64(path2)) check(join208(path2, name));
238944
238943
  };
238945
238944
  check(dir);
238946
238945
  const { requireBuildConfinement: requireBuildConfinement2 } = await Promise.resolve().then(() => (init_build_lib(), build_lib_exports));
@@ -239009,9 +239008,9 @@ async function runInputEvidenceChild(ctx) {
239009
239008
  }
239010
239009
  }
239011
239010
  async function inputEvidenceSourceArchiveHash(dir) {
239012
- const { createHash: createHash97 } = await import("node:crypto");
239011
+ const { createHash: createHash98 } = await import("node:crypto");
239013
239012
  const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
239014
- return createHash97("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
239013
+ return createHash98("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
239015
239014
  }
239016
239015
  var init_input_evidence_isolation = __esm({
239017
239016
  "src/input-evidence-isolation.ts"() {
@@ -246388,6 +246387,176 @@ var init_ring_pins = __esm({
246388
246387
  }
246389
246388
  });
246390
246389
 
246390
+ // ../../packages/serve/src/preview-assets-format.ts
246391
+ function hasPreviewBlobMagic(blob) {
246392
+ if (blob.length < PREVIEW_BLOB_MAGIC.length) return false;
246393
+ for (let i2 = 0; i2 < PREVIEW_BLOB_MAGIC.length; i2++) {
246394
+ if (blob[i2] !== PREVIEW_BLOB_MAGIC[i2]) return false;
246395
+ }
246396
+ return true;
246397
+ }
246398
+ function assemblePreviewAssets(blob, manifest2) {
246399
+ if (!hasPreviewBlobMagic(blob)) return /* @__PURE__ */ new Map();
246400
+ const map2 = /* @__PURE__ */ new Map();
246401
+ for (const entry of manifest2) {
246402
+ map2.set(entry.key, {
246403
+ contentType: entry.contentType,
246404
+ bytes: blob.subarray(entry.offset, entry.offset + entry.length)
246405
+ });
246406
+ }
246407
+ return map2;
246408
+ }
246409
+ var PREVIEW_BLOB_MAGIC, PREVIEW_BLOB_HEADER_SIZE;
246410
+ var init_preview_assets_format = __esm({
246411
+ "../../packages/serve/src/preview-assets-format.ts"() {
246412
+ init_define_HHP_CATALOG();
246413
+ PREVIEW_BLOB_MAGIC = [137, 72, 73, 77, 73, 0, 13, 10];
246414
+ PREVIEW_BLOB_HEADER_SIZE = PREVIEW_BLOB_MAGIC.length;
246415
+ }
246416
+ });
246417
+
246418
+ // src/preview-embed-cache.ts
246419
+ import { spawnSync as spawnSync11 } from "node:child_process";
246420
+ import { createHash as createHash79 } from "node:crypto";
246421
+ import { existsSync as existsSync119, mkdirSync as mkdirSync56, readdirSync as readdirSync55, readFileSync as readFileSync141, renameSync as renameSync21, rmSync as rmSync33, writeFileSync as writeFileSync54 } from "node:fs";
246422
+ import { join as join155 } from "node:path";
246423
+ import { pathToFileURL as pathToFileURL9 } from "node:url";
246424
+ function appWebTrees(repoRoot2) {
246425
+ const r3 = spawnSync11("git", ["ls-tree", "-r", "-d", "HEAD", "apps"], { cwd: repoRoot2, encoding: "utf8", maxBuffer: 1 << 26 });
246426
+ if (r3.status !== 0) return null;
246427
+ const out2 = [];
246428
+ for (const line of r3.stdout.split("\n")) {
246429
+ const tab = line.indexOf(" ");
246430
+ if (tab < 0) continue;
246431
+ const path2 = line.slice(tab + 1);
246432
+ const parts = path2.split("/");
246433
+ if (parts.length === 3 && parts[0] === "apps" && parts[2] === "web") out2.push(`${line.slice(0, tab).split(" ")[2]} ${path2}`);
246434
+ }
246435
+ return out2;
246436
+ }
246437
+ function previewEmbedMode(env = process.env) {
246438
+ const v2 = env[PREVIEW_EMBED_MODE_ENV];
246439
+ return v2 === "refresh" || v2 === "committed" ? v2 : "auto";
246440
+ }
246441
+ function previewEmbedKey(repoRoot2) {
246442
+ const r3 = spawnSync11("git", ["rev-parse", ...PREVIEW_EMBED_KEY_ROOTS.map((p2) => `HEAD:${p2}`)], { cwd: repoRoot2, encoding: "utf8" });
246443
+ if (r3.status !== 0) return null;
246444
+ const ids2 = r3.stdout.trim().split("\n");
246445
+ if (ids2.length !== PREVIEW_EMBED_KEY_ROOTS.length) return null;
246446
+ const webs = appWebTrees(repoRoot2);
246447
+ if (!webs) return null;
246448
+ return createHash79("sha256").update([...ids2, ...webs].join("\n")).digest("hex").slice(0, 24);
246449
+ }
246450
+ function entriesWithContentTypes(manifest2, lib) {
246451
+ return lib.manifestEntries(manifest2).map((e2) => {
246452
+ const ext = e2.key.slice(e2.key.lastIndexOf("."));
246453
+ return { ...e2, contentType: lib.PREVIEW_ASSET_CONTENT_TYPES[ext] ?? "application/octet-stream" };
246454
+ });
246455
+ }
246456
+ async function importRepoScript(repoRoot2, rel2) {
246457
+ return await import(pathToFileURL9(join155(repoRoot2, rel2)).href);
246458
+ }
246459
+ function previewEmbedRootsClean(repoRoot2) {
246460
+ const r3 = spawnSync11("git", ["status", "--porcelain", "--", ...PREVIEW_EMBED_KEY_ROOTS, PREVIEW_EMBED_APP_WEB_PATHSPEC], { cwd: repoRoot2, encoding: "utf8" });
246461
+ return r3.status === 0 && r3.stdout.trim() === "";
246462
+ }
246463
+ function readCached(dir, key4) {
246464
+ const file2 = join155(dir, `${key4}${ENTRY_SUFFIX}`);
246465
+ if (!existsSync119(file2)) return null;
246466
+ try {
246467
+ const raw = readFileSync141(file2);
246468
+ const len = raw.readUInt32BE(0);
246469
+ const entries = JSON.parse(raw.subarray(4, 4 + len).toString("utf8"));
246470
+ const blob = raw.subarray(4 + len);
246471
+ const assets = assemblePreviewAssets(new Uint8Array(blob.buffer, blob.byteOffset, blob.byteLength), entries);
246472
+ return assets.size > 0 && assets.has("index.html") ? assets : null;
246473
+ } catch {
246474
+ return null;
246475
+ }
246476
+ }
246477
+ function writeCached(dir, key4, entries, blob) {
246478
+ mkdirSync56(dir, { recursive: true });
246479
+ const json9 = Buffer.from(JSON.stringify(entries), "utf8");
246480
+ const header2 = Buffer.alloc(4);
246481
+ header2.writeUInt32BE(json9.length, 0);
246482
+ const tmp = join155(dir, `.${key4}.${process.pid}${ENTRY_SUFFIX}`);
246483
+ writeFileSync54(tmp, Buffer.concat([header2, json9, blob]));
246484
+ renameSync21(tmp, join155(dir, `${key4}${ENTRY_SUFFIX}`));
246485
+ for (const f2 of readdirSync55(dir)) {
246486
+ if (f2 !== `${key4}${ENTRY_SUFFIX}` && !f2.startsWith(".")) rmSync33(join155(dir, f2), { force: true });
246487
+ }
246488
+ }
246489
+ async function freshPreviewAssets(repoRoot2, deps = {}) {
246490
+ const mode = deps.mode ?? previewEmbedMode();
246491
+ const log = deps.log ?? ((line) => process.stderr.write(`${line}
246492
+ `));
246493
+ if (mode === "committed") return null;
246494
+ const key4 = (deps.key ?? previewEmbedKey)(repoRoot2);
246495
+ if (!key4) {
246496
+ log("[himi run] could not key the web-host build from git \u2014 serving the committed /preview embed, which may be older than this checkout");
246497
+ return null;
246498
+ }
246499
+ const dir = join155(repoRoot2, PREVIEW_EMBED_CACHE_REL);
246500
+ if (mode !== "refresh") {
246501
+ const cached3 = readCached(dir, key4);
246502
+ if (cached3) return cached3;
246503
+ }
246504
+ log("[himi run] building the web host from this checkout (once per change to core/, packages/ or stdlib/, ~30s)\u2026");
246505
+ const build3 = deps.build ?? (async () => {
246506
+ const mod = await importRepoScript(repoRoot2, "packages/serve/scripts/preview-embed-fresh.mjs");
246507
+ return mod.buildPreviewEmbedPair();
246508
+ });
246509
+ const parse11 = deps.parse ?? (async (manifest2) => {
246510
+ const mod = await importRepoScript(repoRoot2, "packages/serve/scripts/preview-embed-lib.mjs");
246511
+ return entriesWithContentTypes(manifest2, mod);
246512
+ });
246513
+ let built;
246514
+ try {
246515
+ built = await build3();
246516
+ } catch (err) {
246517
+ built = { ok: false, reason: err.message };
246518
+ }
246519
+ if (!built.ok || !built.manifest || !built.blob) {
246520
+ log(`[himi run] could not build the web host (${built.reason ?? "no pair"}) \u2014 serving the committed /preview embed, which may be older than this checkout`);
246521
+ return null;
246522
+ }
246523
+ let entries;
246524
+ try {
246525
+ entries = await parse11(built.manifest);
246526
+ } catch (err) {
246527
+ log(`[himi run] could not read the built web host's manifest (${err.message}) \u2014 serving the committed /preview embed`);
246528
+ return null;
246529
+ }
246530
+ const blob = built.blob;
246531
+ const assets = assemblePreviewAssets(new Uint8Array(blob.buffer, blob.byteOffset, blob.byteLength), entries);
246532
+ if (assets.size === 0 || !assets.has("index.html")) {
246533
+ log("[himi run] the web-host build produced no usable assets \u2014 serving the committed /preview embed");
246534
+ return null;
246535
+ }
246536
+ if (!(deps.clean ?? previewEmbedRootsClean)(repoRoot2)) {
246537
+ log("[himi run] built from uncommitted changes under core/, packages/ or stdlib/ \u2014 serving it without caching");
246538
+ return assets;
246539
+ }
246540
+ try {
246541
+ writeCached(dir, key4, entries, blob);
246542
+ } catch (err) {
246543
+ log(`[himi run] built the web host but could not cache it (${err.message}); the next run builds again`);
246544
+ }
246545
+ return assets;
246546
+ }
246547
+ var PREVIEW_EMBED_MODE_ENV, PREVIEW_EMBED_KEY_ROOTS, PREVIEW_EMBED_APP_WEB_PATHSPEC, PREVIEW_EMBED_CACHE_REL, ENTRY_SUFFIX;
246548
+ var init_preview_embed_cache = __esm({
246549
+ "src/preview-embed-cache.ts"() {
246550
+ init_define_HHP_CATALOG();
246551
+ init_preview_assets_format();
246552
+ PREVIEW_EMBED_MODE_ENV = "HIMI_PREVIEW_EMBED";
246553
+ PREVIEW_EMBED_KEY_ROOTS = ["core", "packages", "stdlib", "package.json", "yarn.lock"];
246554
+ PREVIEW_EMBED_APP_WEB_PATHSPEC = ":(glob)apps/*/web/**";
246555
+ PREVIEW_EMBED_CACHE_REL = "node_modules/.cache/himi-preview-embed";
246556
+ ENTRY_SUFFIX = ".pair";
246557
+ }
246558
+ });
246559
+
246391
246560
  // ../../core/serve-runtime/src/pinned-read.ts
246392
246561
  async function checkPinnedRead(input) {
246393
246562
  const { secret, token, app: app2, releaseId, screenId, authorizePreview, authorizeFollow } = input;
@@ -248789,34 +248958,6 @@ var init_wix_client_id = __esm({
248789
248958
  }
248790
248959
  });
248791
248960
 
248792
- // ../../packages/serve/src/preview-assets-format.ts
248793
- function hasPreviewBlobMagic(blob) {
248794
- if (blob.length < PREVIEW_BLOB_MAGIC.length) return false;
248795
- for (let i2 = 0; i2 < PREVIEW_BLOB_MAGIC.length; i2++) {
248796
- if (blob[i2] !== PREVIEW_BLOB_MAGIC[i2]) return false;
248797
- }
248798
- return true;
248799
- }
248800
- function assemblePreviewAssets(blob, manifest2) {
248801
- if (!hasPreviewBlobMagic(blob)) return /* @__PURE__ */ new Map();
248802
- const map2 = /* @__PURE__ */ new Map();
248803
- for (const entry of manifest2) {
248804
- map2.set(entry.key, {
248805
- contentType: entry.contentType,
248806
- bytes: blob.subarray(entry.offset, entry.offset + entry.length)
248807
- });
248808
- }
248809
- return map2;
248810
- }
248811
- var PREVIEW_BLOB_MAGIC, PREVIEW_BLOB_HEADER_SIZE;
248812
- var init_preview_assets_format = __esm({
248813
- "../../packages/serve/src/preview-assets-format.ts"() {
248814
- init_define_HHP_CATALOG();
248815
- PREVIEW_BLOB_MAGIC = [137, 72, 73, 77, 73, 0, 13, 10];
248816
- PREVIEW_BLOB_HEADER_SIZE = PREVIEW_BLOB_MAGIC.length;
248817
- }
248818
- });
248819
-
248820
248961
  // ../../packages/serve/src/preview-assets.generated.ts
248821
248962
  var preview_assets_generated_exports = {};
248822
248963
  __export(preview_assets_generated_exports, {
@@ -248896,9 +249037,9 @@ __export(run_exports, {
248896
249037
  runPackage: () => runPackage,
248897
249038
  withoutProdServe: () => withoutProdServe
248898
249039
  });
248899
- import { cpSync as cpSync2, existsSync as existsSync119, mkdirSync as mkdirSync56, mkdtempSync as mkdtempSync10, readFileSync as readFileSync141, rmSync as rmSync33, statSync as statSync43 } from "node:fs";
249040
+ import { cpSync as cpSync2, existsSync as existsSync120, mkdirSync as mkdirSync57, mkdtempSync as mkdtempSync10, readFileSync as readFileSync142, rmSync as rmSync34, statSync as statSync43 } from "node:fs";
248900
249041
  import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir11 } from "node:os";
248901
- import { dirname as dirname70, join as join155 } from "node:path";
249042
+ import { dirname as dirname70, join as join156 } from "node:path";
248902
249043
  import { fileURLToPath as fileURLToPath36 } from "node:url";
248903
249044
  function makePackageRunHandler(opts) {
248904
249045
  const store = new FileReleaseStore(opts.releaseRoot);
@@ -248928,9 +249069,9 @@ async function fetchBytes(url) {
248928
249069
  }
248929
249070
  async function resolvePackage(source2, workDir) {
248930
249071
  const isUrl2 = /^https?:\/\//i.test(source2);
248931
- if (!isUrl2 && existsSync119(source2) && statSync43(source2).isDirectory()) {
248932
- const appDirManifest = join155(source2, "release-manifest.json");
248933
- if (existsSync119(appDirManifest)) {
249072
+ if (!isUrl2 && existsSync120(source2) && statSync43(source2).isDirectory()) {
249073
+ const appDirManifest = join156(source2, "release-manifest.json");
249074
+ if (existsSync120(appDirManifest)) {
248934
249075
  const opened2 = openPackageDir(source2);
248935
249076
  if (!opened2.validation.ok) {
248936
249077
  throw new Error(`package is not valid:
@@ -248939,11 +249080,11 @@ async function resolvePackage(source2, workDir) {
248939
249080
  const app3 = opened2.header?.app ?? opened2.manifest?.app;
248940
249081
  if (!app3) throw new Error(`${source2} has no app id (no himi-package.json and no manifest.app)`);
248941
249082
  if (!isSafeAppId(app3)) throw new Error(`${source2} declares an unsafe app id ${JSON.stringify(app3)} \u2014 refusing to open it`);
248942
- const root2 = workDir ?? mkdtempSync10(join155(tmpdir11(), "himi-run-"));
248943
- const target = join155(root2, app3);
248944
- if (join155(source2) !== target) {
248945
- mkdirSync56(root2, { recursive: true });
248946
- rmSync33(target, { recursive: true, force: true });
249083
+ const root2 = workDir ?? mkdtempSync10(join156(tmpdir11(), "himi-run-"));
249084
+ const target = join156(root2, app3);
249085
+ if (join156(source2) !== target) {
249086
+ mkdirSync57(root2, { recursive: true });
249087
+ rmSync34(target, { recursive: true, force: true });
248947
249088
  cpSync2(source2, target, { recursive: true });
248948
249089
  }
248949
249090
  return {
@@ -248958,12 +249099,12 @@ async function resolvePackage(source2, workDir) {
248958
249099
  }
248959
249100
  throw new Error(`${source2} is a directory but has no release-manifest.json \u2014 is it a package?`);
248960
249101
  }
248961
- const bytes2 = isUrl2 ? await fetchBytes(source2) : readFileSync141(source2);
248962
- const root = workDir ?? mkdtempSync10(join155(tmpdir11(), "himi-run-"));
249102
+ const bytes2 = isUrl2 ? await fetchBytes(source2) : readFileSync142(source2);
249103
+ const root = workDir ?? mkdtempSync10(join156(tmpdir11(), "himi-run-"));
248963
249104
  const { app: app2, appDir: appDir3 } = unpackTo(bytes2, root);
248964
249105
  const opened = openPackageDir(appDir3);
248965
249106
  if (!opened.validation.ok) {
248966
- rmSync33(workDir ? appDir3 : root, { recursive: true, force: true });
249107
+ rmSync34(workDir ? appDir3 : root, { recursive: true, force: true });
248967
249108
  throw new Error(`package is not valid:
248968
249109
  ${opened.validation.errors.join("\n ")}`);
248969
249110
  }
@@ -248977,19 +249118,24 @@ async function resolvePackage(source2, workDir) {
248977
249118
  warnings: opened.validation.warnings
248978
249119
  };
248979
249120
  }
248980
- async function loadPreviewAssets() {
249121
+ async function loadPreviewAssets(deps = {}) {
248981
249122
  try {
248982
- const mod = await Promise.resolve().then(() => (init_preview_assets_generated(), preview_assets_generated_exports));
248983
249123
  const here = dirname70(fileURLToPath36(import.meta.url));
249124
+ const published = join156(here, "preview-assets.generated.bin");
249125
+ const repoRoot2 = join156(here, "../../..");
249126
+ if (!existsSync120(published) && existsSync120(join156(repoRoot2, "packages/serve/scripts/preview-embed-fresh.mjs"))) {
249127
+ const fresh = await (deps.fresh ?? freshPreviewAssets)(repoRoot2);
249128
+ if (fresh) return fresh;
249129
+ }
249130
+ const mod = await Promise.resolve().then(() => (init_preview_assets_generated(), preview_assets_generated_exports));
248984
249131
  const candidates = [
248985
- join155(here, "preview-assets.generated.bin"),
248986
- // published: copied next to the bundled CLI
248987
- join155(here, "../../../packages/serve/src/preview-assets.generated.bin")
248988
- // in-repo checkout
249132
+ published,
249133
+ join156(here, "../../../packages/serve/src/preview-assets.generated.bin")
249134
+ // in-repo checkout (fallback)
248989
249135
  ];
248990
249136
  for (const path2 of candidates) {
248991
- if (!existsSync119(path2)) continue;
248992
- const blob = readFileSync141(path2);
249137
+ if (!existsSync120(path2)) continue;
249138
+ const blob = readFileSync142(path2);
248993
249139
  return mod.assemblePreviewAssetsFromBlob(new Uint8Array(blob.buffer, blob.byteOffset, blob.byteLength));
248994
249140
  }
248995
249141
  return /* @__PURE__ */ new Map();
@@ -249037,7 +249183,7 @@ async function runPackage(source2, opts = {}) {
249037
249183
  const resolved3 = await resolvePackage(source2, opts.workDir);
249038
249184
  const assets = opts.assets ?? (opts.spa ? /* @__PURE__ */ new Map() : await loadPreviewAssets());
249039
249185
  if (!opts.spa && assets.size === 0) {
249040
- if (resolved3.temp) rmSync33(resolved3.temp, { recursive: true, force: true });
249186
+ if (resolved3.temp) rmSync34(resolved3.temp, { recursive: true, force: true });
249041
249187
  throw new Error(NO_SPA_MESSAGE);
249042
249188
  }
249043
249189
  const plane = makePackageRunHandler({
@@ -249075,7 +249221,7 @@ async function runPackage(source2, opts = {}) {
249075
249221
  lanBound = (await listen(lanServer, port, lanHost)).address;
249076
249222
  } catch (e2) {
249077
249223
  await closeServer(server);
249078
- if (resolved3.temp) rmSync33(resolved3.temp, { recursive: true, force: true });
249224
+ if (resolved3.temp) rmSync34(resolved3.temp, { recursive: true, force: true });
249079
249225
  throw new Error(`himi run --lan could not listen on ${lanHost}:${port} (${e2.message}); drop --lan, or pass --port for a free one`);
249080
249226
  }
249081
249227
  bound2.push(lanBound);
@@ -249097,7 +249243,7 @@ async function runPackage(source2, opts = {}) {
249097
249243
  warnings: resolved3.warnings,
249098
249244
  close: async () => {
249099
249245
  await Promise.all(servers.map(closeServer));
249100
- if (resolved3.temp) rmSync33(resolved3.temp, { recursive: true, force: true });
249246
+ if (resolved3.temp) rmSync34(resolved3.temp, { recursive: true, force: true });
249101
249247
  }
249102
249248
  };
249103
249249
  }
@@ -249106,6 +249252,7 @@ var init_run2 = __esm({
249106
249252
  "src/run.ts"() {
249107
249253
  init_define_HHP_CATALOG();
249108
249254
  init_open_url();
249255
+ init_preview_embed_cache();
249109
249256
  init_file_store();
249110
249257
  init_run_handler();
249111
249258
  init_node_adapter();
@@ -249129,8 +249276,8 @@ __export(run_browser_exports, {
249129
249276
  runInBrowser: () => runInBrowser
249130
249277
  });
249131
249278
  import { createServer as createServer8 } from "node:http";
249132
- import { existsSync as existsSync120, readFileSync as readFileSync142 } from "node:fs";
249133
- import { spawnSync as spawnSync11 } from "node:child_process";
249279
+ import { existsSync as existsSync121, readFileSync as readFileSync143 } from "node:fs";
249280
+ import { spawnSync as spawnSync12 } from "node:child_process";
249134
249281
  import { dirname as dirname71, resolve as resolve100 } from "node:path";
249135
249282
  import { fileURLToPath as fileURLToPath37 } from "node:url";
249136
249283
  function stagedDir() {
@@ -249138,12 +249285,12 @@ function stagedDir() {
249138
249285
  }
249139
249286
  function browserPlaneDir(where) {
249140
249287
  if (where.out) return resolve100(where.out);
249141
- if (!existsSync120(resolve100(where.repo, ...STAGE_SCRIPT))) return resolve100(where.here, "browser-plane");
249288
+ if (!existsSync121(resolve100(where.repo, ...STAGE_SCRIPT))) return resolve100(where.here, "browser-plane");
249142
249289
  return resolve100(where.repo, "packages", "serve", "dist", "browser-plane");
249143
249290
  }
249144
249291
  function stagedDeferred() {
249145
249292
  try {
249146
- const { files, deferred } = JSON.parse(readFileSync142(resolve100(stagedDir(), "assets.json"), "utf8"));
249293
+ const { files, deferred } = JSON.parse(readFileSync143(resolve100(stagedDir(), "assets.json"), "utf8"));
249147
249294
  if (!Array.isArray(deferred)) return null;
249148
249295
  return files.map((f2) => f2.name).filter((n2) => DEFERRED.test(n2));
249149
249296
  } catch {
@@ -249155,16 +249302,16 @@ function isServed(name) {
249155
249302
  }
249156
249303
  function missingStaged() {
249157
249304
  const deferred = stagedDeferred();
249158
- const missing4 = [...SERVED, ...deferred ?? []].filter((f2) => !existsSync120(resolve100(stagedDir(), f2)));
249305
+ const missing4 = [...SERVED, ...deferred ?? []].filter((f2) => !existsSync121(resolve100(stagedDir(), f2)));
249159
249306
  if (!deferred) missing4.push("assets.json");
249160
249307
  return missing4.sort();
249161
249308
  }
249162
249309
  function ensureBrowserPlaneStaged() {
249163
249310
  if (missingStaged().length === 0) return { ok: true, detail: "already staged" };
249164
- if (!existsSync120(resolve100(REPO5, ...STAGE_SCRIPT))) {
249311
+ if (!existsSync121(resolve100(REPO5, ...STAGE_SCRIPT))) {
249165
249312
  return { ok: false, detail: `this install has no browser plane (missing ${missingStaged().join(", ")}); reinstall @wix/himalaya-cli, or run \`himi run\` without --browser` };
249166
249313
  }
249167
- const r3 = spawnSync11(process.execPath, [resolve100(REPO5, "core/serve/scripts/stage-browser-plane.mjs")], {
249314
+ const r3 = spawnSync12(process.execPath, [resolve100(REPO5, "core/serve/scripts/stage-browser-plane.mjs")], {
249168
249315
  cwd: REPO5,
249169
249316
  encoding: "utf8"
249170
249317
  });
@@ -249250,7 +249397,7 @@ async function runInBrowser(releaseRoot, app2, header2, opts = {}) {
249250
249397
  }
249251
249398
  const name = path2 === "/" || path2 === "/index.html" ? "host.html" : path2.slice(1);
249252
249399
  if (isServed(name)) {
249253
- if (!existsSync120(resolve100(stagedDir(), name))) {
249400
+ if (!existsSync121(resolve100(stagedDir(), name))) {
249254
249401
  const restaged = ensureBrowserPlaneStaged();
249255
249402
  if (!restaged.ok) {
249256
249403
  res.writeHead(503, { "content-type": "application/json" });
@@ -249260,7 +249407,7 @@ async function runInBrowser(releaseRoot, app2, header2, opts = {}) {
249260
249407
  }
249261
249408
  let bytes2;
249262
249409
  try {
249263
- bytes2 = readFileSync142(resolve100(stagedDir(), name));
249410
+ bytes2 = readFileSync143(resolve100(stagedDir(), name));
249264
249411
  } catch (e2) {
249265
249412
  res.writeHead(503, { "content-type": "application/json" });
249266
249413
  res.end(JSON.stringify({ error: "browser_plane_unstaged", file: name, detail: String(e2) }));
@@ -249316,14 +249463,14 @@ var hhp_preview_exports = {};
249316
249463
  __export(hhp_preview_exports, {
249317
249464
  hhpPreviewResponse: () => hhpPreviewResponse
249318
249465
  });
249319
- import { existsSync as existsSync121, readFileSync as readFileSync143 } from "node:fs";
249320
- import { join as join156 } from "node:path";
249466
+ import { existsSync as existsSync122, readFileSync as readFileSync144 } from "node:fs";
249467
+ import { join as join157 } from "node:path";
249321
249468
  function hhpPreviewResponse(root, request2) {
249322
- if (new URL(request2.url).pathname !== "/__himi/hhp-preview" || !existsSync121(join156(root, "hhp.json"))) return null;
249469
+ if (new URL(request2.url).pathname !== "/__himi/hhp-preview" || !existsSync122(join157(root, "hhp.json"))) return null;
249323
249470
  if (request2.method !== "GET") return new Response(null, { status: 405 });
249324
249471
  try {
249325
249472
  const file2 = localPath(root, ".himi/hhp-preview.json");
249326
- const authored2 = existsSync121(file2) ? JSON.parse(readFileSync143(file2, "utf8")) : {};
249473
+ const authored2 = existsSync122(file2) ? JSON.parse(readFileSync144(file2, "utf8")) : {};
249327
249474
  if (authored2.mockCapabilities && (!Array.isArray(authored2.mockCapabilities) || authored2.mockCapabilities.some((v2) => typeof v2 !== "string"))) throw new Error("mockCapabilities must be a string array.");
249328
249475
  const fixtures = authored2.fixtures ?? {};
249329
249476
  if (typeof fixtures !== "object" || Array.isArray(fixtures) || fixtures === null) throw new Error("fixtures must be an object.");
@@ -249429,7 +249576,7 @@ __export(store_google_keys_exports, {
249429
249576
  runStoreGoogleKeys: () => runStoreGoogleKeys
249430
249577
  });
249431
249578
  import { readFile as readFile21 } from "node:fs/promises";
249432
- import { join as join159, resolve as resolve101 } from "node:path";
249579
+ import { join as join160, resolve as resolve101 } from "node:path";
249433
249580
  function fail8(io2, code2, error, extra = {}) {
249434
249581
  io2.error(JSON.stringify({ ok: false, code: code2, error: scrubSecretShapes(error).slice(0, 600), ...extra }));
249435
249582
  return code2 === "invalid_usage" ? 2 : 1;
@@ -249458,7 +249605,7 @@ async function runStoreGoogleKeys(pos, flags, io2, deps = {}) {
249458
249605
  if (problem) throw new Refused(problem);
249459
249606
  const tooOld2 = storeNodeRefusal(deps.nodeVersion);
249460
249607
  if (tooOld2) return fail8(io2, "node_too_old", tooOld2.replace("App Store submission", "Google Play signing from himi"));
249461
- const out3 = text17(flags.out) ? resolve101(cwd, text17(flags.out)) : join159(deps.stateDir ?? (await Promise.resolve().then(() => (init_dist2(), dist_exports2))).gplayStateDir(env), "keys", `${packageName}.p12`);
249608
+ const out3 = text17(flags.out) ? resolve101(cwd, text17(flags.out)) : join160(deps.stateDir ?? (await Promise.resolve().then(() => (init_dist2(), dist_exports2))).gplayStateDir(env), "keys", `${packageName}.p12`);
249462
249609
  const commonName = text17(flags.name);
249463
249610
  const gplay3 = await (deps.gplay ?? (() => Promise.resolve().then(() => (init_dist(), dist_exports))))();
249464
249611
  const made = await gplay3.generateUploadKey({ out: out3, packageName, ...alias2 ? { alias: alias2 } : {}, ...commonName ? { commonName } : {} });
@@ -249538,9 +249685,9 @@ __export(store_handoff_exports, {
249538
249685
  runStoreHandoff: () => runStoreHandoff,
249539
249686
  sendHandoff: () => sendHandoff
249540
249687
  });
249541
- import { lstatSync as lstatSync36, renameSync as renameSync22, rmSync as rmSync35, writeFileSync as writeFileSync54 } from "node:fs";
249688
+ import { lstatSync as lstatSync36, renameSync as renameSync23, rmSync as rmSync36, writeFileSync as writeFileSync55 } from "node:fs";
249542
249689
  import { readFile as readFile22 } from "node:fs/promises";
249543
- import { join as join160, resolve as resolve102 } from "node:path";
249690
+ import { join as join161, resolve as resolve102 } from "node:path";
249544
249691
  import { createInterface as createInterface3 } from "node:readline/promises";
249545
249692
  function fail9(io2, code2, error, extra = {}) {
249546
249693
  io2.error(JSON.stringify({ ok: false, code: code2, error, ...extra }));
@@ -249700,7 +249847,7 @@ function buildHandoffBundle(state, o2) {
249700
249847
  async function readAscState(rt2, ctx) {
249701
249848
  const ports = ctx.jobPorts();
249702
249849
  const jobs = await ports.store.list();
249703
- const batches = await new rt2.jobs.FileBatchStore(join160(ctx.stateDir, "batches")).list();
249850
+ const batches = await new rt2.jobs.FileBatchStore(join161(ctx.stateDir, "batches")).list();
249704
249851
  let log = "";
249705
249852
  try {
249706
249853
  log = await readFile22(ports.audit.path, "utf8");
@@ -249807,11 +249954,11 @@ async function runStoreHandoff(pos, flags, io2, deps = {}) {
249807
249954
  if (isLink2) return fail9(io2, "invalid_usage", `--out ${path2} is a symbolic link; name a plain file`);
249808
249955
  const tmp = `${path2}.${process.pid}.tmp`;
249809
249956
  try {
249810
- writeFileSync54(tmp, `${JSON.stringify(bundle, null, 2)}
249957
+ writeFileSync55(tmp, `${JSON.stringify(bundle, null, 2)}
249811
249958
  `, { mode: 384, flag: "wx" });
249812
- renameSync22(tmp, path2);
249959
+ renameSync23(tmp, path2);
249813
249960
  } catch (e2) {
249814
- rmSync35(tmp, { force: true });
249961
+ rmSync36(tmp, { force: true });
249815
249962
  throw e2;
249816
249963
  }
249817
249964
  io2.log(JSON.stringify({ ok: true, out: path2, ...summary2, ...app2 && site ? { app: app2, site } : {}, uploaded: false }));
@@ -250119,8 +250266,8 @@ __export(store_relops_google_exports, {
250119
250266
  });
250120
250267
  import { createInterface as createInterface4 } from "node:readline/promises";
250121
250268
  import { readFile as readFile23 } from "node:fs/promises";
250122
- import { existsSync as existsSync123 } from "node:fs";
250123
- import { join as join161, resolve as resolve103 } from "node:path";
250269
+ import { existsSync as existsSync124 } from "node:fs";
250270
+ import { join as join162, resolve as resolve103 } from "node:path";
250124
250271
  import { userInfo as userInfo4 } from "node:os";
250125
250272
  function fail11(io2, code2, error, extra = {}) {
250126
250273
  io2.error(JSON.stringify({ ok: false, code: code2, error: scrubSecretShapes(error).slice(0, 600), ...extra }));
@@ -250152,8 +250299,8 @@ async function defaultGoogleHost(env, io2) {
250152
250299
  const stateDir2 = jobs.gplayStateDir(env);
250153
250300
  const choice = env.GPLAY_CREDENTIAL_STORE ?? (process.platform === "darwin" ? "keychain" : "file");
250154
250301
  if (choice !== "keychain" && choice !== "file") throw new UsageError7(`GPLAY_CREDENTIAL_STORE must be file or keychain (got "${choice}")`);
250155
- const store = choice === "keychain" ? new api4.KeychainCredentialStore() : new api4.FileCredentialStore(join161(stateDir2, "credentials.json"));
250156
- const profileDir = env.GPLAY_CONSOLE_PROFILE ?? join161(stateDir2, "console-profile");
250302
+ const store = choice === "keychain" ? new api4.KeychainCredentialStore() : new api4.FileCredentialStore(join162(stateDir2, "credentials.json"));
250303
+ const profileDir = env.GPLAY_CONSOLE_PROFILE ?? join162(stateDir2, "console-profile");
250157
250304
  return {
250158
250305
  stateDir: stateDir2,
250159
250306
  store,
@@ -250198,7 +250345,7 @@ async function googleOf(deps, env, io2) {
250198
250345
  const googleFor = host.googleFor ?? jobs.googleClientsFor({
250199
250346
  stateDir: host.stateDir,
250200
250347
  store: host.store,
250201
- ...o2.console ? { console: { profileDir: env.GPLAY_CONSOLE_PROFILE ?? join161(host.stateDir, "console-profile"), ...env.GPLAY_CHROME ? { chromePath: env.GPLAY_CHROME } : {} } } : {}
250348
+ ...o2.console ? { console: { profileDir: env.GPLAY_CONSOLE_PROFILE ?? join162(host.stateDir, "console-profile"), ...env.GPLAY_CHROME ? { chromePath: env.GPLAY_CHROME } : {} } } : {}
250202
250349
  });
250203
250350
  return new engine.JobRunner({
250204
250351
  account: account2,
@@ -250222,7 +250369,7 @@ async function knownDeveloper(stateDir2, given, packageName) {
250222
250369
  if (recorded && DEVELOPER_RE2.test(recorded)) return recorded;
250223
250370
  }
250224
250371
  try {
250225
- const record5 = JSON.parse(await readFile23(join161(stateDir2, "console.json"), "utf8"));
250372
+ const record5 = JSON.parse(await readFile23(join162(stateDir2, "console.json"), "utf8"));
250226
250373
  const ids2 = Array.isArray(record5.developerIds) ? record5.developerIds.filter((d2) => typeof d2 === "string" && DEVELOPER_RE2.test(d2)) : [];
250227
250374
  return ids2.length === 1 ? ids2[0] : void 0;
250228
250375
  } catch {
@@ -250363,7 +250510,7 @@ async function savePackage(c2, packageName, saved) {
250363
250510
  async function signIn2(c2, o2 = {}, saved) {
250364
250511
  const host = c2.google.host;
250365
250512
  const signedIn = !!await host.store.load();
250366
- const profile = existsSync123(join161(host.stateDir, "console.json")) || !!c2.env.GPLAY_CONSOLE_PROFILE;
250513
+ const profile = existsSync124(join162(host.stateDir, "console.json")) || !!c2.env.GPLAY_CONSOLE_PROFILE;
250367
250514
  if (signedIn && (!o2.console || profile || host.googleFor)) return {};
250368
250515
  c2.io.error("Signing in to Google: your browser opens Google's sign-in, then Play Console.");
250369
250516
  const r3 = await host.connect();
@@ -251860,7 +252007,7 @@ var init_wix_payments_contract = __esm({
251860
252007
  });
251861
252008
 
251862
252009
  // ../store-release/register-bundle.ts
251863
- import { readFileSync as readFileSync148 } from "node:fs";
252010
+ import { readFileSync as readFileSync149 } from "node:fs";
251864
252011
  import { createPrivateKey as createPrivateKey9, sign as sign5 } from "node:crypto";
251865
252012
  function b64url5(b3) {
251866
252013
  return Buffer.from(b3).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -251915,7 +252062,7 @@ async function enableSignInWithApple(opts) {
251915
252062
  function ascEnvJwt() {
251916
252063
  const env = requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
251917
252064
  assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
251918
- return ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync148(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
252065
+ return ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync149(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
251919
252066
  }
251920
252067
  async function registerBundleId2(opts) {
251921
252068
  const res = await ascFetch("/v1/bundleIds", { jwt: opts.jwt ?? ascEnvJwt() }, bundleIdBody(opts.identifier, opts.name));
@@ -251943,7 +252090,7 @@ async function main() {
251943
252090
  }
251944
252091
  const ni2 = rest.indexOf("--name");
251945
252092
  const name = ni2 >= 0 ? rest[ni2 + 1] : cfg.app ?? app2;
251946
- const yml = readFileSync148(iosProjectYml(app2), "utf8");
252093
+ const yml = readFileSync149(iosProjectYml(app2), "utf8");
251947
252094
  const jwt = ascEnvJwt();
251948
252095
  for (const { id, label: label4 } of [{ id: identifier2, label: name }, ...embeddedBundles(yml).map((b3) => ({
251949
252096
  id: embeddedBundleId(identifier2, b3),
@@ -252773,7 +252920,7 @@ var init_iap_catalog_api = __esm({
252773
252920
  });
252774
252921
 
252775
252922
  // ../store-release/iap-manifest.ts
252776
- import { createHash as createHash80 } from "node:crypto";
252923
+ import { createHash as createHash81 } from "node:crypto";
252777
252924
  function readTarget(reader, value2) {
252778
252925
  const obj16 = reader.object(value2, "target", TARGET_KEYS);
252779
252926
  return {
@@ -252919,7 +253066,7 @@ function canonicalJson4(value2) {
252919
253066
  return JSON.stringify(sortKeys(value2));
252920
253067
  }
252921
253068
  function sha256Digest(value2) {
252922
- return `sha256:${createHash80("sha256").update(canonicalJson4(value2)).digest("hex")}`;
253069
+ return `sha256:${createHash81("sha256").update(canonicalJson4(value2)).digest("hex")}`;
252923
253070
  }
252924
253071
  function manifestDigest(manifest2) {
252925
253072
  return sha256Digest(manifest2);
@@ -253279,7 +253426,7 @@ var init_screenshot_display_types = __esm({
253279
253426
  });
253280
253427
 
253281
253428
  // ../store-release/iap-review-screenshot.ts
253282
- import { createHash as createHash81 } from "node:crypto";
253429
+ import { createHash as createHash82 } from "node:crypto";
253283
253430
  import { basename as basename39, resolve as resolve106 } from "node:path";
253284
253431
  function pngSize2(bytes2) {
253285
253432
  const signed = PNG_SIGNATURE.every((b3, i2) => bytes2[i2] === b3);
@@ -253298,7 +253445,7 @@ function readImageSize(bytes2) {
253298
253445
  return pngSize2(buffer) ?? jpegSize(buffer);
253299
253446
  }
253300
253447
  function md5Hex2(bytes2) {
253301
- return createHash81("md5").update(bytes2).digest("hex");
253448
+ return createHash82("md5").update(bytes2).digest("hex");
253302
253449
  }
253303
253450
  function isAppStoreScreenshotSize(file2) {
253304
253451
  return displayTypeForSize(file2.width, file2.height) !== null;
@@ -254209,19 +254356,19 @@ __export(credential_profile_exports, {
254209
254356
  profilePath: () => profilePath,
254210
254357
  resolveStoreCredentials: () => resolveStoreCredentials
254211
254358
  });
254212
- import { existsSync as existsSync124, readFileSync as readFileSync149 } from "node:fs";
254359
+ import { existsSync as existsSync125, readFileSync as readFileSync150 } from "node:fs";
254213
254360
  import { homedir as homedir18 } from "node:os";
254214
- import { join as join162 } from "node:path";
254361
+ import { join as join163 } from "node:path";
254215
254362
  function credentialsDir(home2 = homedir18()) {
254216
- return join162(home2, ".himalaya", "store-credentials");
254363
+ return join163(home2, ".himalaya", "store-credentials");
254217
254364
  }
254218
254365
  function profilePath(name, home2 = homedir18()) {
254219
254366
  if (!PROFILE_NAME2.test(name)) {
254220
254367
  throw new Error(
254221
- `credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join162(credentialsDir(home2), "<name>.json")}; it is never a path.`
254368
+ `credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join163(credentialsDir(home2), "<name>.json")}; it is never a path.`
254222
254369
  );
254223
254370
  }
254224
- return join162(credentialsDir(home2), `${name}.json`);
254371
+ return join163(credentialsDir(home2), `${name}.json`);
254225
254372
  }
254226
254373
  function parseProfile2(text30, label4) {
254227
254374
  let doc;
@@ -254252,8 +254399,8 @@ function resolveStoreCredentials(opts) {
254252
254399
  const { app: app2, cfg } = opts;
254253
254400
  const env = opts.env ?? process.env;
254254
254401
  const home2 = opts.home ?? homedir18();
254255
- const read2 = opts.readProfile ?? ((p2) => readFileSync149(p2, "utf8"));
254256
- const exists2 = opts.profileExists ?? existsSync124;
254402
+ const read2 = opts.readProfile ?? ((p2) => readFileSync150(p2, "utf8"));
254403
+ const exists2 = opts.profileExists ?? existsSync125;
254257
254404
  const ios = cfg.ios ?? {};
254258
254405
  const adopted = "adopted" in opts ? opts.adopted : appAdoptedIdentity(app2);
254259
254406
  const flagName = opts.profileFlag?.trim();
@@ -254323,11 +254470,11 @@ var init_credential_profile = __esm({
254323
254470
  });
254324
254471
 
254325
254472
  // ../store-release/iap-credentials.ts
254326
- import { createHash as createHash82 } from "node:crypto";
254327
- import { existsSync as existsSync125, readFileSync as readFileSync150, realpathSync as realpathSync20 } from "node:fs";
254473
+ import { createHash as createHash83 } from "node:crypto";
254474
+ import { existsSync as existsSync126, readFileSync as readFileSync151, realpathSync as realpathSync20 } from "node:fs";
254328
254475
  import { homedir as homedir19 } from "node:os";
254329
254476
  function accountFingerprint(keyId, issuerId) {
254330
- return `sha256:${createHash82("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
254477
+ return `sha256:${createHash83("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
254331
254478
  }
254332
254479
  function requireExplicitProfile(profileFlag, target) {
254333
254480
  const profile = profileFlag?.trim();
@@ -254361,7 +254508,7 @@ function canonicalKeyPath(path2, profile, realpath3) {
254361
254508
  function resolveIapCredentials(options2) {
254362
254509
  const { target } = options2;
254363
254510
  const home2 = options2.home ?? homedir19();
254364
- const readFile25 = options2.readFile ?? ((p2) => readFileSync150(p2, "utf8"));
254511
+ const readFile25 = options2.readFile ?? ((p2) => readFileSync151(p2, "utf8"));
254365
254512
  const realpath3 = options2.realpath ?? realpathSync20;
254366
254513
  const profile = requireExplicitProfile(options2.profileFlag, target);
254367
254514
  const creds = resolveStoreCredentials({
@@ -254371,7 +254518,7 @@ function resolveIapCredentials(options2) {
254371
254518
  env: {},
254372
254519
  home: home2,
254373
254520
  readProfile: readFile25,
254374
- profileExists: options2.exists ?? existsSync125
254521
+ profileExists: options2.exists ?? existsSync126
254375
254522
  });
254376
254523
  assertCredentialOutsideRepo(`credential profile "${profile}"`, realpath3(profilePath(profile, home2)));
254377
254524
  assertCredentialOutsideRepo(`credential profile "${profile}" ascKeyPath`, canonicalKeyPath(creds.ascKeyPath, profile, realpath3));
@@ -254399,7 +254546,7 @@ var init_iap_credentials = __esm({
254399
254546
  });
254400
254547
 
254401
254548
  // ../store-release/iap-draft.ts
254402
- import { createHash as createHash83 } from "node:crypto";
254549
+ import { createHash as createHash84 } from "node:crypto";
254403
254550
  function fit(text30, max) {
254404
254551
  const chars = [...text30];
254405
254552
  return chars.length <= max ? text30 : `${chars.slice(0, max - 1).join("").trimEnd()}${ELLIPSIS}`;
@@ -254555,7 +254702,7 @@ var init_iap_draft = __esm({
254555
254702
  TIER_DESCRIPTION = "Unlocks one item in the app";
254556
254703
  ELLIPSIS = "\u2026";
254557
254704
  entityKey = (entityType, entityId) => `${entityType}:${entityId}`;
254558
- sha4 = (text30) => createHash83("sha256").update(text30).digest("hex");
254705
+ sha4 = (text30) => createHash84("sha256").update(text30).digest("hex");
254559
254706
  ENTITIES3 = { "&amp;": "&", "&nbsp;": " ", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" };
254560
254707
  MAX_SUFFIX = 24;
254561
254708
  ReferenceNames = class {
@@ -254677,8 +254824,8 @@ var init_redact = __esm({
254677
254824
  });
254678
254825
 
254679
254826
  // src/iap-config-edit.ts
254680
- import { existsSync as existsSync126, readFileSync as readFileSync151 } from "node:fs";
254681
- import { basename as basename40, join as join163 } from "node:path";
254827
+ import { existsSync as existsSync127, readFileSync as readFileSync152 } from "node:fs";
254828
+ import { basename as basename40, join as join164 } from "node:path";
254682
254829
  import ts23 from "typescript";
254683
254830
  function bindPurchasesAppInConfig(source2, options2) {
254684
254831
  const fileName = options2.fileName ?? "config.ts";
@@ -254757,16 +254904,16 @@ function capabilityFinding(app2, fileName) {
254757
254904
  }
254758
254905
  function withStoreBundle(dir, options2) {
254759
254906
  if (options2.storeBundleId) return options2;
254760
- const path2 = join163(dir, "store", "store.config.yaml");
254761
- if (!existsSync126(path2)) return options2;
254762
- const storeBundleId = parseStoreConfig(readFileSync151(path2, "utf8")).ios?.bundleId;
254907
+ const path2 = join164(dir, "store", "store.config.yaml");
254908
+ if (!existsSync127(path2)) return options2;
254909
+ const storeBundleId = parseStoreConfig(readFileSync152(path2, "utf8")).ios?.bundleId;
254763
254910
  return storeBundleId ? { ...options2, storeBundleId } : options2;
254764
254911
  }
254765
254912
  function previewIapConfigEdit(dir, options2) {
254766
254913
  const path2 = configEntry(dir);
254767
254914
  if (!path2) return void 0;
254768
254915
  if (isSymlink2(path2)) return { path: path2, changed: false, applied: [], conflicts: [], instructions: [`${basename40(path2)} is a symlink, so it would not be edited: add the purchases app in the file it points to.`] };
254769
- const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync151(path2, "utf8"), { ...withStoreBundle(dir, options2), fileName: basename40(path2) });
254916
+ const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync152(path2, "utf8"), { ...withStoreBundle(dir, options2), fileName: basename40(path2) });
254770
254917
  return { path: path2, changed, applied, conflicts, instructions };
254771
254918
  }
254772
254919
  async function applyIapConfigEdit(dir, options2, validate5) {
@@ -254775,7 +254922,7 @@ async function applyIapConfigEdit(dir, options2, validate5) {
254775
254922
  const fileName = basename40(path2);
254776
254923
  const refuse9 = (why) => ({ path: path2, changed: false, applied: [], conflicts: [], instructions: [why] });
254777
254924
  if (isSymlink2(path2)) return refuse9(`${fileName} is a symlink, so it was not edited: add the purchases app in the file it points to.`);
254778
- const original = readFileSync151(path2, "utf8");
254925
+ const original = readFileSync152(path2, "utf8");
254779
254926
  const edit = bindPurchasesAppInConfig(original, { ...withStoreBundle(dir, options2), fileName });
254780
254927
  const { applied, conflicts, instructions } = edit;
254781
254928
  if (!edit.changed) return { path: path2, changed: false, applied, conflicts, instructions };
@@ -255455,7 +255602,7 @@ var init_store_iap_connect = __esm({
255455
255602
  });
255456
255603
 
255457
255604
  // src/store-iap-screenshots.ts
255458
- import { dirname as dirname72, join as join164, relative as relative32 } from "node:path";
255605
+ import { dirname as dirname72, join as join165, relative as relative32 } from "node:path";
255459
255606
  function purchaseScreensFor(item2) {
255460
255607
  const screen = item2.wix && PURCHASE_SCREENS[item2.wix.entityType];
255461
255608
  if (!screen || !item2.wix) return [];
@@ -255577,7 +255724,7 @@ async function shoot(selected, run4, outDir) {
255577
255724
  const found = await renderPurchaseScreen(selected, run4);
255578
255725
  if ("skipped" in found) return { ...selected.report, skipped: found.skipped };
255579
255726
  const report9 = { ...selected.report, screenId: found.screenId };
255580
- const path2 = join164(outDir, `${selected.item.productId}.png`);
255727
+ const path2 = join165(outDir, `${selected.item.productId}.png`);
255581
255728
  try {
255582
255729
  run4.writeBytes(path2, await run4.renderer.capture(found.html, run4.contentDir));
255583
255730
  } catch (e2) {
@@ -255595,7 +255742,7 @@ function manifestWithScreenshots(text30, shot) {
255595
255742
  `;
255596
255743
  }
255597
255744
  async function takeReviewScreenshots(run4) {
255598
- const outDir = run4.outDir ?? join164(dirname72(run4.manifestPath), DEFAULT_OUT_DIR);
255745
+ const outDir = run4.outDir ?? join165(dirname72(run4.manifestPath), DEFAULT_OUT_DIR);
255599
255746
  const items = unknownOnlyIds(run4);
255600
255747
  const shot = /* @__PURE__ */ new Map();
255601
255748
  try {
@@ -255633,9 +255780,9 @@ var init_store_iap_screenshots = __esm({
255633
255780
  });
255634
255781
 
255635
255782
  // src/store-iap-screenshot-render.ts
255636
- import { existsSync as existsSync127, mkdtempSync as mkdtempSync12, readFileSync as readFileSync152, rmSync as rmSync36 } from "node:fs";
255783
+ import { existsSync as existsSync128, mkdtempSync as mkdtempSync12, readFileSync as readFileSync153, rmSync as rmSync37 } from "node:fs";
255637
255784
  import { tmpdir as tmpdir13 } from "node:os";
255638
- import { join as join165 } from "node:path";
255785
+ import { join as join166 } from "node:path";
255639
255786
  function renderProblems(render3, entityId) {
255640
255787
  const problems = (render3.liveErrors ?? []).map((e2) => `${e2.service}: ${e2.message}`);
255641
255788
  const ofItem = (call) => call.toLowerCase().includes(entityId.toLowerCase());
@@ -255677,7 +255824,7 @@ function createReviewScreenRenderer() {
255677
255824
  async render({ contentDir: contentDir2, screenId, input, host, entityId }) {
255678
255825
  const { buildReleaseFromContent: buildReleaseFromContent2 } = await Promise.resolve().then(() => (init_build3(), build_exports2));
255679
255826
  const tier5Dir = await workerBundles(contentDir2);
255680
- const out2 = mkdtempSync12(join165(tmpdir13(), "himi-iap-shot-"));
255827
+ const out2 = mkdtempSync12(join166(tmpdir13(), "himi-iap-shot-"));
255681
255828
  try {
255682
255829
  const outcome = await buildReleaseFromContent2(contentDir2, out2, {
255683
255830
  ...tier5Dir ? { tier5Dir } : {},
@@ -255690,13 +255837,13 @@ function createReviewScreenRenderer() {
255690
255837
  if (!render3.renderable || !render3.html) throw new Error(render3.reason ?? `${screenId} is not an SDUI screen`);
255691
255838
  return { html: render3.html, problems: renderProblems(render3, entityId), state: render3.serviceState ?? {} };
255692
255839
  } finally {
255693
- rmSync36(out2, { recursive: true, force: true });
255840
+ rmSync37(out2, { recursive: true, force: true });
255694
255841
  }
255695
255842
  },
255696
255843
  async capture(html, contentDir2) {
255697
255844
  const { pngPageHtml: pngPageHtml2, stabilizePngPage: stabilizePngPage2 } = await Promise.resolve().then(() => (init_render_descriptor(), render_descriptor_exports));
255698
- const tokensPath = join165(contentDir2, "tokens.json");
255699
- const tokens2 = existsSync127(tokensPath) ? JSON.parse(readFileSync152(tokensPath, "utf8")) : null;
255845
+ const tokensPath = join166(contentDir2, "tokens.json");
255846
+ const tokens2 = existsSync128(tokensPath) ? JSON.parse(readFileSync153(tokensPath, "utf8")) : null;
255700
255847
  const { width, height, scale } = REVIEW_SCREENSHOT_FRAME;
255701
255848
  const page = await (await (browser ??= launch())).newPage({ viewport: { width, height }, deviceScaleFactor: scale, colorScheme: "light" });
255702
255849
  try {
@@ -255781,9 +255928,9 @@ __export(store_iap_exports, {
255781
255928
  });
255782
255929
  import { execFileSync as execFileSync10 } from "node:child_process";
255783
255930
  import { randomUUID as randomUUID17 } from "node:crypto";
255784
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync57, readFileSync as readFileSync153, realpathSync as realpathSync21, renameSync as renameSync23, rmSync as rmSync37, writeFileSync as writeFileSync55 } from "node:fs";
255931
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync58, readFileSync as readFileSync154, realpathSync as realpathSync21, renameSync as renameSync24, rmSync as rmSync38, writeFileSync as writeFileSync56 } from "node:fs";
255785
255932
  import { homedir as homedir20, hostname as hostname7 } from "node:os";
255786
- import { dirname as dirname73, join as join166, resolve as resolve107 } from "node:path";
255933
+ import { dirname as dirname73, join as join167, resolve as resolve107 } from "node:path";
255787
255934
  function scrubDeep(value2, scrub) {
255788
255935
  if (typeof value2 === "string") return scrub(value2);
255789
255936
  if (Array.isArray(value2)) return value2.map((v2) => scrubDeep(v2, scrub));
@@ -256448,10 +256595,10 @@ async function screenshotsCommand(flags, deps, out2) {
256448
256595
  return report9.complete ? 0 : 1;
256449
256596
  }
256450
256597
  function writeBinaryFile(path2, bytes2) {
256451
- mkdirSync57(dirname73(path2), { recursive: true });
256598
+ mkdirSync58(dirname73(path2), { recursive: true });
256452
256599
  const partial = `${path2}.${process.pid}.partial`;
256453
- writeFileSync55(partial, bytes2);
256454
- renameSync23(partial, path2);
256600
+ writeFileSync56(partial, bytes2);
256601
+ renameSync24(partial, path2);
256455
256602
  }
256456
256603
  async function runStoreIap(pos, flags, io2, deps) {
256457
256604
  const out2 = new CommandOutput(io2, flags.json === true);
@@ -256481,17 +256628,17 @@ function fileJournal(path2) {
256481
256628
  }
256482
256629
  function readLockSummary(path2) {
256483
256630
  try {
256484
- const { pid, host, at: at2 } = JSON.parse(readFileSync153(path2, "utf8"));
256631
+ const { pid, host, at: at2 } = JSON.parse(readFileSync154(path2, "utf8"));
256485
256632
  return `pid ${pid} on ${host} since ${at2}`;
256486
256633
  } catch {
256487
256634
  return "unreadable lock";
256488
256635
  }
256489
256636
  }
256490
256637
  function acquireApplyLock(dir, appleAppId) {
256491
- const path2 = join166(dir, "apply.lock");
256638
+ const path2 = join167(dir, "apply.lock");
256492
256639
  const stamp = JSON.stringify({ pid: process.pid, host: hostname7(), at: (/* @__PURE__ */ new Date()).toISOString(), token: randomUUID17() });
256493
256640
  try {
256494
- writeFileSync55(path2, stamp, { flag: "wx", mode: 384 });
256641
+ writeFileSync56(path2, stamp, { flag: "wx", mode: 384 });
256495
256642
  } catch (e2) {
256496
256643
  if (e2.code !== "EEXIST") throw e2;
256497
256644
  throw new Error(
@@ -256501,16 +256648,16 @@ function acquireApplyLock(dir, appleAppId) {
256501
256648
  return () => {
256502
256649
  let current = "";
256503
256650
  try {
256504
- current = readFileSync153(path2, "utf8");
256651
+ current = readFileSync154(path2, "utf8");
256505
256652
  } catch {
256506
256653
  return;
256507
256654
  }
256508
- if (current === stamp) rmSync37(path2, { force: true });
256655
+ if (current === stamp) rmSync38(path2, { force: true });
256509
256656
  };
256510
256657
  }
256511
256658
  function stateDir(appleAppId) {
256512
- const dir = join166(homedir20(), ".himalaya", "store-iap", appleAppId);
256513
- mkdirSync57(dir, { recursive: true, mode: 448 });
256659
+ const dir = join167(homedir20(), ".himalaya", "store-iap", appleAppId);
256660
+ mkdirSync58(dir, { recursive: true, mode: 448 });
256514
256661
  return dir;
256515
256662
  }
256516
256663
  async function confirmOnTerminal(question) {
@@ -256525,8 +256672,8 @@ async function confirmOnTerminal(question) {
256525
256672
  }
256526
256673
  function defaultStoreIapDeps() {
256527
256674
  return {
256528
- readFile: (path2) => readFileSync153(path2, "utf8"),
256529
- readBytes: (path2) => readFileSync153(path2),
256675
+ readFile: (path2) => readFileSync154(path2, "utf8"),
256676
+ readBytes: (path2) => readFileSync154(path2),
256530
256677
  readBuildIapBinding: (path2) => JSON.parse(execFileSync10("plutil", ["-convert", "json", "-o", "-", resolve107(path2)], { encoding: "utf8" })),
256531
256678
  visitorTransport: async (clientId, siteId) => {
256532
256679
  const [{ mintVisitorToken: mintVisitorToken2 }, { visitorTransportFrom: visitorTransportFrom2 }] = await Promise.all([Promise.resolve().then(() => (init_visitor_auth(), visitor_auth_exports)), Promise.resolve().then(() => (init_rest(), rest_exports))]);
@@ -256535,7 +256682,7 @@ function defaultStoreIapDeps() {
256535
256682
  writeFileAtomic,
256536
256683
  resolveCredentials: ({ profileFlag, target }) => resolveIapCredentials({ profileFlag, target }),
256537
256684
  createApi: (key4) => createIapApi(createAscClient2({ key: key4 })),
256538
- openJournal: (appleAppId) => fileJournal(join166(stateDir(appleAppId), "journal.jsonl")),
256685
+ openJournal: (appleAppId) => fileJournal(join167(stateDir(appleAppId), "journal.jsonl")),
256539
256686
  acquireLock: (appleAppId) => acquireApplyLock(stateDir(appleAppId), appleAppId),
256540
256687
  canPrompt: () => process.stdin.isTTY === true,
256541
256688
  wixTransport: (siteId) => ownerTransport(siteId),
@@ -257036,9 +257183,9 @@ __export(preflight_app_exports, {
257036
257183
  profileAccount: () => profileAccount,
257037
257184
  readXcconfigVars: () => readXcconfigVars
257038
257185
  });
257039
- import { readFileSync as readFileSync154, existsSync as existsSync128, readdirSync as readdirSync56, statSync as statSync44 } from "node:fs";
257040
- import { createHash as createHash84 } from "node:crypto";
257041
- import { dirname as dirname74, join as join167 } from "node:path";
257186
+ import { readFileSync as readFileSync155, existsSync as existsSync129, readdirSync as readdirSync57, statSync as statSync44 } from "node:fs";
257187
+ import { createHash as createHash85 } from "node:crypto";
257188
+ import { dirname as dirname74, join as join168 } from "node:path";
257042
257189
  function analyze(projectYml, storeConfig, icon, account2, adopted) {
257043
257190
  const f2 = [];
257044
257191
  const has = (re2, s5) => re2.test(s5);
@@ -257179,12 +257326,12 @@ function readXcconfigVars(iosDir, projectYml) {
257179
257326
  const vars = {};
257180
257327
  const seen = /* @__PURE__ */ new Set();
257181
257328
  const read2 = (path2) => {
257182
- if (seen.has(path2) || !existsSync128(path2)) return;
257329
+ if (seen.has(path2) || !existsSync129(path2)) return;
257183
257330
  seen.add(path2);
257184
- for (const raw of readFileSync154(path2, "utf8").split("\n")) {
257331
+ for (const raw of readFileSync155(path2, "utf8").split("\n")) {
257185
257332
  const inc = /^\s*#include\??\s+"([^"]+)"/.exec(raw);
257186
257333
  if (inc) {
257187
- read2(join167(dirname74(path2), inc[1]));
257334
+ read2(join168(dirname74(path2), inc[1]));
257188
257335
  continue;
257189
257336
  }
257190
257337
  const line = raw.replace(/\/\/.*$/, "");
@@ -257192,7 +257339,7 @@ function readXcconfigVars(iosDir, projectYml) {
257192
257339
  if (kv) vars[kv[1]] = expandVars(kv[2], vars);
257193
257340
  }
257194
257341
  };
257195
- for (const m2 of projectYml.matchAll(/^\s*Release:\s*["']?([^"'\s]+\.xcconfig)["']?\s*$/gm)) read2(join167(iosDir, m2[1]));
257342
+ for (const m2 of projectYml.matchAll(/^\s*Release:\s*["']?([^"'\s]+\.xcconfig)["']?\s*$/gm)) read2(join168(iosDir, m2[1]));
257196
257343
  return vars;
257197
257344
  }
257198
257345
  function profileAccount(app2, storeConfig, opts = {}) {
@@ -257208,15 +257355,15 @@ function profileAccount(app2, storeConfig, opts = {}) {
257208
257355
  }
257209
257356
  }
257210
257357
  async function preflightApp(app2, opts = {}) {
257211
- const projectYml = existsSync128(iosProjectYml(app2)) ? readFileSync154(iosProjectYml(app2), "utf8") : "";
257212
- const storeConfig = existsSync128(storeConfigPath(app2)) ? readFileSync154(storeConfigPath(app2), "utf8") : "";
257358
+ const projectYml = existsSync129(iosProjectYml(app2)) ? readFileSync155(iosProjectYml(app2), "utf8") : "";
257359
+ const storeConfig = existsSync129(storeConfigPath(app2)) ? readFileSync155(storeConfigPath(app2), "utf8") : "";
257213
257360
  const adopted = appAdoptedIdentity(app2);
257214
- const identity = projectYml ? analyzeStoreIdentity(projectYml, storeConfig, readXcconfigVars(join167(appDir(app2), "ios"), projectYml), adopted) : [];
257361
+ const identity = projectYml ? analyzeStoreIdentity(projectYml, storeConfig, readXcconfigVars(join168(appDir(app2), "ios"), projectYml), adopted) : [];
257215
257362
  if (!storeConfig) return [{ level: "error", message: `no apps/${app2}/store/store.config.yaml \u2014 run /setup-store-signing first.` }, ...identity];
257216
257363
  const findings = analyze(
257217
257364
  projectYml,
257218
257365
  storeConfig,
257219
- await appIconState(join167(appDir(app2), "ios")),
257366
+ await appIconState(join168(appDir(app2), "ios")),
257220
257367
  profileAccount(app2, storeConfig, opts),
257221
257368
  adopted
257222
257369
  );
@@ -257247,18 +257394,18 @@ function analyzeSubmissionRecord(appLevel, review, opts) {
257247
257394
  return f2;
257248
257395
  }
257249
257396
  function appLevelMetadataFiles(app2, locale = "en-US") {
257250
- const root = join167(storeDir(app2), "metadata");
257397
+ const root = join168(storeDir(app2), "metadata");
257251
257398
  const out2 = /* @__PURE__ */ new Set();
257252
- if (existsSync128(root)) {
257253
- for (const n2 of readdirSync56(root)) if (n2.endsWith(".txt")) out2.add(n2);
257399
+ if (existsSync129(root)) {
257400
+ for (const n2 of readdirSync57(root)) if (n2.endsWith(".txt")) out2.add(n2);
257254
257401
  }
257255
- if (existsSync128(join167(root, locale, "privacy_url.txt"))) out2.add("privacy_url.txt");
257402
+ if (existsSync129(join168(root, locale, "privacy_url.txt"))) out2.add("privacy_url.txt");
257256
257403
  return out2;
257257
257404
  }
257258
257405
  function reviewInfoFiles(app2) {
257259
- const dir = join167(storeDir(app2), "review_information");
257260
- if (!existsSync128(dir)) return /* @__PURE__ */ new Set();
257261
- return new Set(readdirSync56(dir).filter((n2) => n2.endsWith(".txt")));
257406
+ const dir = join168(storeDir(app2), "review_information");
257407
+ if (!existsSync129(dir)) return /* @__PURE__ */ new Set();
257408
+ return new Set(readdirSync57(dir).filter((n2) => n2.endsWith(".txt")));
257262
257409
  }
257263
257410
  function isValidAppStoreSize(w2, h2) {
257264
257411
  return APP_STORE_SIZES.some(([a3, b3]) => w2 === a3 && h2 === b3 || w2 === b3 && h2 === a3);
@@ -257367,12 +257514,12 @@ function analyzePlayListing(assets) {
257367
257514
  return f2;
257368
257515
  }
257369
257516
  function playListingAssets(app2, locale = "en-US") {
257370
- const dir = join167(storeDir(app2), "play", locale, "images");
257517
+ const dir = join168(storeDir(app2), "play", locale, "images");
257371
257518
  const read2 = (names2) => {
257372
257519
  for (const name of names2) {
257373
- const p2 = join167(dir, name);
257520
+ const p2 = join168(dir, name);
257374
257521
  try {
257375
- if (statSync44(p2).isFile()) return { name, bytes: readFileSync154(p2) };
257522
+ if (statSync44(p2).isFile()) return { name, bytes: readFileSync155(p2) };
257376
257523
  } catch {
257377
257524
  }
257378
257525
  }
@@ -257403,26 +257550,26 @@ function analyzeListing(metaFiles, shots) {
257403
257550
  return f2;
257404
257551
  }
257405
257552
  function metadataFilesPresent(app2, locale = "en-US") {
257406
- const dir = join167(storeDir(app2), "metadata", locale);
257407
- if (!existsSync128(dir)) return /* @__PURE__ */ new Set();
257408
- return new Set(readdirSync56(dir).filter((n2) => n2.endsWith(".txt")));
257553
+ const dir = join168(storeDir(app2), "metadata", locale);
257554
+ if (!existsSync129(dir)) return /* @__PURE__ */ new Set();
257555
+ return new Set(readdirSync57(dir).filter((n2) => n2.endsWith(".txt")));
257409
257556
  }
257410
257557
  function listScreenshots(app2, locale = "en-US") {
257411
257558
  const out2 = [];
257412
- const flat2 = join167(storeDir(app2), "screenshots", locale);
257413
- if (existsSync128(flat2)) {
257414
- for (const png of readdirSync56(flat2).filter((n2) => n2.endsWith(".png"))) {
257415
- const sz = pngSize3(readFileSync154(join167(flat2, png)));
257559
+ const flat2 = join168(storeDir(app2), "screenshots", locale);
257560
+ if (existsSync129(flat2)) {
257561
+ for (const png of readdirSync57(flat2).filter((n2) => n2.endsWith(".png"))) {
257562
+ const sz = pngSize3(readFileSync155(join168(flat2, png)));
257416
257563
  if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
257417
257564
  }
257418
257565
  }
257419
- const legacy = join167(storeDir(app2), "metadata", locale, "screenshots");
257420
- if (existsSync128(legacy)) {
257421
- for (const deviceDir of readdirSync56(legacy)) {
257422
- const d2 = join167(legacy, deviceDir);
257566
+ const legacy = join168(storeDir(app2), "metadata", locale, "screenshots");
257567
+ if (existsSync129(legacy)) {
257568
+ for (const deviceDir of readdirSync57(legacy)) {
257569
+ const d2 = join168(legacy, deviceDir);
257423
257570
  if (!statSync44(d2).isDirectory()) continue;
257424
- for (const png of readdirSync56(d2).filter((n2) => n2.endsWith(".png"))) {
257425
- const sz = pngSize3(readFileSync154(join167(d2, png)));
257571
+ for (const png of readdirSync57(d2).filter((n2) => n2.endsWith(".png"))) {
257572
+ const sz = pngSize3(readFileSync155(join168(d2, png)));
257426
257573
  if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
257427
257574
  }
257428
257575
  }
@@ -257430,13 +257577,13 @@ function listScreenshots(app2, locale = "en-US") {
257430
257577
  return out2;
257431
257578
  }
257432
257579
  function placeholderHashes2() {
257433
- const templateIos = join167(appDir("_template"), "ios");
257434
- if (!existsSync128(templateIos)) return [LEGACY_PLACEHOLDER_SHA2562];
257435
- for (const target of readdirSync56(templateIos)) {
257436
- const p2 = join167(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
257580
+ const templateIos = join168(appDir("_template"), "ios");
257581
+ if (!existsSync129(templateIos)) return [LEGACY_PLACEHOLDER_SHA2562];
257582
+ for (const target of readdirSync57(templateIos)) {
257583
+ const p2 = join168(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
257437
257584
  try {
257438
257585
  if (!statSync44(p2).isFile()) continue;
257439
- return [LEGACY_PLACEHOLDER_SHA2562, createHash84("sha256").update(readFileSync154(p2)).digest("hex")];
257586
+ return [LEGACY_PLACEHOLDER_SHA2562, createHash85("sha256").update(readFileSync155(p2)).digest("hex")];
257440
257587
  } catch {
257441
257588
  }
257442
257589
  }
@@ -257467,13 +257614,13 @@ async function pixelIssues(bytes2) {
257467
257614
  }
257468
257615
  }
257469
257616
  async function appIconState(iosDir) {
257470
- if (!existsSync128(iosDir)) return { exists: false, isPlaceholder: false, storeIssues: [] };
257471
- for (const target of readdirSync56(iosDir)) {
257472
- const p2 = join167(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
257617
+ if (!existsSync129(iosDir)) return { exists: false, isPlaceholder: false, storeIssues: [] };
257618
+ for (const target of readdirSync57(iosDir)) {
257619
+ const p2 = join168(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
257473
257620
  try {
257474
257621
  if (!statSync44(p2).isFile()) continue;
257475
- const bytes2 = readFileSync154(p2);
257476
- const hash3 = createHash84("sha256").update(bytes2).digest("hex");
257622
+ const bytes2 = readFileSync155(p2);
257623
+ const hash3 = createHash85("sha256").update(bytes2).digest("hex");
257477
257624
  const pixels = await pixelIssues(bytes2);
257478
257625
  return {
257479
257626
  exists: true,
@@ -257545,7 +257692,7 @@ __export(asc_status_exports, {
257545
257692
  ascStatus: () => ascStatus,
257546
257693
  buildVerdict: () => buildVerdict
257547
257694
  });
257548
- import { readFileSync as readFileSync155 } from "node:fs";
257695
+ import { readFileSync as readFileSync156 } from "node:fs";
257549
257696
  function buildVerdict(builds) {
257550
257697
  if (!builds.length) {
257551
257698
  return "NO builds registered \u2014 if you uploaded recently and it's been >15 min, the binary was REJECTED IN PROCESSING (reason is email-only; run validate-binary.ts / scan-purpose-strings.ts to reproduce it).";
@@ -257559,7 +257706,7 @@ function buildVerdict(builds) {
257559
257706
  function client3(creds) {
257560
257707
  const env = creds ?? requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
257561
257708
  assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
257562
- const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync155(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
257709
+ const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync156(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
257563
257710
  return async (path2) => {
257564
257711
  const r3 = await fetch(`${ASC}${path2}`, { headers: { Authorization: `Bearer ${jwt}` } });
257565
257712
  return { status: r3.status, json: await r3.json().catch(() => ({})) };
@@ -258048,7 +258195,7 @@ __export(secrets_exports, {
258048
258195
  runRemoteSecretsCommand: () => runRemoteSecretsCommand,
258049
258196
  runSecretsCommand: () => runSecretsCommand
258050
258197
  });
258051
- import { readFileSync as readFileSync158 } from "node:fs";
258198
+ import { readFileSync as readFileSync159 } from "node:fs";
258052
258199
  function environment(value2) {
258053
258200
  if (value2 === "preview" || value2 === "production") return value2;
258054
258201
  throw new Error("--environment must be preview or production");
@@ -258079,7 +258226,7 @@ async function runSecretsCommand(operation, flags, io2, options2 = {}) {
258079
258226
  io2.log(JSON.stringify(await vault.list({ app: app2, environment: env })));
258080
258227
  return 0;
258081
258228
  }
258082
- const value2 = options2.readValue ? options2.readValue() : readFileSync158(0, "utf8").replace(/\r?\n$/, "");
258229
+ const value2 = options2.readValue ? options2.readValue() : readFileSync159(0, "utf8").replace(/\r?\n$/, "");
258083
258230
  if (operation === "set") await vault.set({ app: app2, environment: env, name, value: value2 });
258084
258231
  else if (operation === "rotate") await vault.rotate({ app: app2, environment: env, name, value: value2 });
258085
258232
  else throw new Error(`unknown secrets operation ${operation}`);
@@ -258108,7 +258255,7 @@ async function runRemoteSecretsCommand(operation, flags, io2, options2) {
258108
258255
  }
258109
258256
  let body;
258110
258257
  if (operation !== "list") {
258111
- const value2 = options2.readValue ? options2.readValue() : readFileSync158(0, "utf8").replace(/\r?\n$/, "");
258258
+ const value2 = options2.readValue ? options2.readValue() : readFileSync159(0, "utf8").replace(/\r?\n$/, "");
258112
258259
  body = JSON.stringify({ value: value2 });
258113
258260
  }
258114
258261
  const response = await (options2.fetchImpl ?? fetch)(url, { method: operation === "list" ? "GET" : operation === "set" ? "PUT" : "POST", headers: headers2, body });
@@ -258300,7 +258447,7 @@ var init_site_member = __esm({
258300
258447
  });
258301
258448
 
258302
258449
  // src/notify-ping-all.ts
258303
- import { createHash as createHash86 } from "node:crypto";
258450
+ import { createHash as createHash87 } from "node:crypto";
258304
258451
  async function listApprovedMembers(input) {
258305
258452
  const first = await scanMembers(input);
258306
258453
  const second = await scanMembers(input);
@@ -258354,7 +258501,7 @@ async function scanMembers(input) {
258354
258501
  }
258355
258502
  }
258356
258503
  function campaignRequestId(campaignId, memberId) {
258357
- const bytes2 = createHash86("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
258504
+ const bytes2 = createHash87("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
258358
258505
  bytes2[6] = bytes2[6] & 15 | 80;
258359
258506
  bytes2[8] = bytes2[8] & 63 | 128;
258360
258507
  const hex2 = bytes2.toString("hex");
@@ -258611,15 +258758,15 @@ __export(notify_exports, {
258611
258758
  runNotify: () => runNotify,
258612
258759
  saveAdminSession: () => saveAdminSession
258613
258760
  });
258614
- import { chmodSync as chmodSync6, mkdirSync as mkdirSync58, readFileSync as readFileSync161, writeFileSync as writeFileSync57 } from "node:fs";
258761
+ import { chmodSync as chmodSync6, mkdirSync as mkdirSync59, readFileSync as readFileSync162, writeFileSync as writeFileSync58 } from "node:fs";
258615
258762
  import { homedir as homedir21 } from "node:os";
258616
- import { dirname as dirname76, join as join172 } from "node:path";
258763
+ import { dirname as dirname76, join as join173 } from "node:path";
258617
258764
  function defaultSessionsPath() {
258618
- return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join172(homedir21(), ".himalaya", "admin-sessions.json");
258765
+ return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join173(homedir21(), ".himalaya", "admin-sessions.json");
258619
258766
  }
258620
258767
  function loadSessionsFile(path2 = defaultSessionsPath()) {
258621
258768
  try {
258622
- return JSON.parse(readFileSync161(path2, "utf8"));
258769
+ return JSON.parse(readFileSync162(path2, "utf8"));
258623
258770
  } catch {
258624
258771
  return {};
258625
258772
  }
@@ -258627,8 +258774,8 @@ function loadSessionsFile(path2 = defaultSessionsPath()) {
258627
258774
  function saveAdminSession(adminUrl, session, path2 = defaultSessionsPath()) {
258628
258775
  const file2 = loadSessionsFile(path2);
258629
258776
  file2.sessions = { ...file2.sessions, [adminUrl]: session };
258630
- mkdirSync58(dirname76(path2), { recursive: true, mode: 448 });
258631
- writeFileSync57(path2, JSON.stringify(file2, null, 2) + "\n", { mode: 384 });
258777
+ mkdirSync59(dirname76(path2), { recursive: true, mode: 448 });
258778
+ writeFileSync58(path2, JSON.stringify(file2, null, 2) + "\n", { mode: 384 });
258632
258779
  try {
258633
258780
  chmodSync6(dirname76(path2), 448);
258634
258781
  chmodSync6(path2, 384);
@@ -258923,9 +259070,9 @@ __export(auth_gate_copy_exports, {
258923
259070
  scanProse: () => scanProse,
258924
259071
  scanThrownMessages: () => scanThrownMessages
258925
259072
  });
258926
- import { createHash as createHash87 } from "node:crypto";
258927
- import { existsSync as existsSync132, readdirSync as readdirSync57, readFileSync as readFileSync162, writeFileSync as writeFileSync58 } from "node:fs";
258928
- import { dirname as dirname77, join as join173, relative as relative33, resolve as resolve110 } from "node:path";
259073
+ import { createHash as createHash88 } from "node:crypto";
259074
+ import { existsSync as existsSync133, readdirSync as readdirSync58, readFileSync as readFileSync163, writeFileSync as writeFileSync59 } from "node:fs";
259075
+ import { dirname as dirname77, join as join174, relative as relative33, resolve as resolve110 } from "node:path";
258929
259076
  import { fileURLToPath as fileURLToPath38 } from "node:url";
258930
259077
  function discoverMessageSources() {
258931
259078
  const roots2 = [
@@ -258937,15 +259084,15 @@ function discoverMessageSources() {
258937
259084
  ];
258938
259085
  const out2 = [];
258939
259086
  const visit = (rel2) => {
258940
- const abs = join173(REPO_ROOT8, rel2);
258941
- if (!existsSync132(abs)) return;
258942
- for (const name of readdirSync57(abs, { withFileTypes: true })) {
259087
+ const abs = join174(REPO_ROOT8, rel2);
259088
+ if (!existsSync133(abs)) return;
259089
+ for (const name of readdirSync58(abs, { withFileTypes: true })) {
258943
259090
  const child3 = `${rel2}/${name.name}`;
258944
259091
  if (name.isDirectory()) {
258945
259092
  if (/^(?:test|tests|Tests|androidTest|build|node_modules|\.build)$/.test(name.name)) continue;
258946
259093
  visit(child3);
258947
259094
  } else if (/\.(?:swift|kt)$/.test(name.name) && !GATE_SOURCES.includes(child3)) {
258948
- if (MESSAGE_FILE.test(readFileSync162(join173(REPO_ROOT8, child3), "utf8"))) out2.push(child3);
259095
+ if (MESSAGE_FILE.test(readFileSync163(join174(REPO_ROOT8, child3), "utf8"))) out2.push(child3);
258949
259096
  }
258950
259097
  }
258951
259098
  };
@@ -258953,7 +259100,7 @@ function discoverMessageSources() {
258953
259100
  return out2.sort();
258954
259101
  }
258955
259102
  function loadTable(path2 = TABLE_PATH) {
258956
- const raw = JSON.parse(readFileSync162(path2, "utf8"));
259103
+ const raw = JSON.parse(readFileSync163(path2, "utf8"));
258957
259104
  const out2 = {};
258958
259105
  for (const [k3, v2] of Object.entries(raw)) {
258959
259106
  if (k3.startsWith("_")) continue;
@@ -258994,7 +259141,7 @@ ${rows}
258994
259141
  `;
258995
259142
  }
258996
259143
  function rowId(key4) {
258997
- return "n_" + createHash87("sha1").update("auth-gate:" + key4).digest("hex").slice(0, 12);
259144
+ return "n_" + createHash88("sha1").update("auth-gate:" + key4).digest("hex").slice(0, 12);
258998
259145
  }
258999
259146
  function injectGateRows(catalog4, table = loadTable()) {
259000
259147
  const prior = catalog4.messages ?? {};
@@ -259018,31 +259165,31 @@ function injectGateRows(catalog4, table = loadTable()) {
259018
259165
  return { ...catalog4, messages: sorted3 };
259019
259166
  }
259020
259167
  function appSourceCatalogs() {
259021
- const appsDir = join173(REPO_ROOT8, "apps");
259022
- return readdirSync57(appsDir).sort().map((app2) => join173(appsDir, app2, "l10n", "en.json")).filter((p2) => existsSync132(p2));
259168
+ const appsDir = join174(REPO_ROOT8, "apps");
259169
+ return readdirSync58(appsDir).sort().map((app2) => join174(appsDir, app2, "l10n", "en.json")).filter((p2) => existsSync133(p2));
259023
259170
  }
259024
259171
  function nativeKeysPath(appDir3) {
259025
- return join173(appDir3, "l10n", "native-keys.json");
259172
+ return join174(appDir3, "l10n", "native-keys.json");
259026
259173
  }
259027
259174
  function loadNativeKeys(appDir3) {
259028
259175
  const p2 = nativeKeysPath(appDir3);
259029
- if (!existsSync132(p2)) return void 0;
259030
- const raw = JSON.parse(readFileSync162(p2, "utf8"));
259176
+ if (!existsSync133(p2)) return void 0;
259177
+ const raw = JSON.parse(readFileSync163(p2, "utf8"));
259031
259178
  if (!Array.isArray(raw.keys) || raw.keys.some((k3) => typeof k3 !== "string")) {
259032
259179
  throw new Error(`${p2}: expected { "keys": string[] }`);
259033
259180
  }
259034
259181
  return raw.keys;
259035
259182
  }
259036
259183
  function loadAppTable(appDir3) {
259037
- const p2 = join173(appDir3, "strings", "en.json");
259038
- if (!existsSync132(p2)) return {};
259039
- const raw = JSON.parse(readFileSync162(p2, "utf8"));
259184
+ const p2 = join174(appDir3, "strings", "en.json");
259185
+ if (!existsSync133(p2)) return {};
259186
+ const raw = JSON.parse(readFileSync163(p2, "utf8"));
259040
259187
  const out2 = {};
259041
259188
  for (const [k3, v2] of Object.entries(raw)) if (!k3.startsWith("_") && typeof v2 === "string") out2[k3] = v2;
259042
259189
  return out2;
259043
259190
  }
259044
259191
  function nativeRowId(key4) {
259045
- return "n_" + createHash87("sha1").update("app-native:" + key4).digest("hex").slice(0, 12);
259192
+ return "n_" + createHash88("sha1").update("app-native:" + key4).digest("hex").slice(0, 12);
259046
259193
  }
259047
259194
  function injectNativeRows(catalog4, table, keys2) {
259048
259195
  const prior = catalog4.messages ?? {};
@@ -259225,14 +259372,14 @@ function looksLikeCopy(text30) {
259225
259372
  return /^[A-Z][a-z]/.test(t2);
259226
259373
  }
259227
259374
  function loadAllow(section3, path2 = ALLOW_PATH) {
259228
- const raw = JSON.parse(readFileSync162(path2, "utf8"));
259375
+ const raw = JSON.parse(readFileSync163(path2, "utf8"));
259229
259376
  const list5 = raw[section3] ?? [];
259230
259377
  for (const e2 of list5) {
259231
259378
  if (!e2.file || !e2.text || !e2.reason) throw new Error(`allowlist entry missing file/text/reason: ${JSON.stringify(e2)}`);
259232
259379
  }
259233
259380
  return list5;
259234
259381
  }
259235
- function scanProse(files, allow = [], read2 = (rel2) => readFileSync162(join173(REPO_ROOT8, rel2), "utf8")) {
259382
+ function scanProse(files, allow = [], read2 = (rel2) => readFileSync163(join174(REPO_ROOT8, rel2), "utf8")) {
259236
259383
  const hits = [];
259237
259384
  const usedAllow = /* @__PURE__ */ new Set();
259238
259385
  for (const file2 of files) {
@@ -259251,17 +259398,17 @@ function scanProse(files, allow = [], read2 = (rel2) => readFileSync162(join173(
259251
259398
  }
259252
259399
  function expectedOutputs(table = loadTable()) {
259253
259400
  const out2 = [
259254
- { path: join173(REPO_ROOT8, "stdlib/flows/auth/src/copy.generated.ts"), content: "// Generated by tools/l10n/auth-gate-copy.ts. Do not edit.\nexport default " + JSON.stringify(table, null, 2) + " as const;\n" },
259401
+ { path: join174(REPO_ROOT8, "stdlib/flows/auth/src/copy.generated.ts"), content: "// Generated by tools/l10n/auth-gate-copy.ts. Do not edit.\nexport default " + JSON.stringify(table, null, 2) + " as const;\n" },
259255
259402
  { path: SWIFT_OUT, content: renderSwift(table) },
259256
259403
  { path: KOTLIN_OUT, content: renderKotlin(table) }
259257
259404
  ];
259258
259405
  for (const p2 of appSourceCatalogs()) {
259259
- const committed = JSON.parse(readFileSync162(p2, "utf8"));
259406
+ const committed = JSON.parse(readFileSync163(p2, "utf8"));
259260
259407
  out2.push({ path: p2, content: serializeCatalog(injectAllNativeRows(committed, dirname77(dirname77(p2)), table)) });
259261
259408
  }
259262
259409
  return out2;
259263
259410
  }
259264
- function scanThrownMessages(files, read2 = (rel2) => readFileSync162(join173(REPO_ROOT8, rel2), "utf8")) {
259411
+ function scanThrownMessages(files, read2 = (rel2) => readFileSync163(join174(REPO_ROOT8, rel2), "utf8")) {
259265
259412
  const out2 = [];
259266
259413
  for (const file2 of files) {
259267
259414
  const src = read2(file2);
@@ -259282,12 +259429,12 @@ var init_auth_gate_copy = __esm({
259282
259429
  init_define_HHP_CATALOG();
259283
259430
  HERE5 = dirname77(fileURLToPath38(import.meta.url));
259284
259431
  REPO_ROOT8 = resolve110(HERE5, "../..");
259285
- TABLE_PATH = join173(REPO_ROOT8, "core/runtime/l10n/auth-gate/en.json");
259286
- SWIFT_OUT = join173(
259432
+ TABLE_PATH = join174(REPO_ROOT8, "core/runtime/l10n/auth-gate/en.json");
259433
+ SWIFT_OUT = join174(
259287
259434
  REPO_ROOT8,
259288
259435
  "core/runtime/ios/HimalayaCore/Sources/HimalayaCore/AuthGateCopyDefaults.generated.swift"
259289
259436
  );
259290
- KOTLIN_OUT = join173(
259437
+ KOTLIN_OUT = join174(
259291
259438
  REPO_ROOT8,
259292
259439
  "core/runtime/android/io/himalaya/core/src/main/kotlin/io/himalaya/core/AuthGateCopyDefaults.generated.kt"
259293
259440
  );
@@ -259350,18 +259497,18 @@ var init_auth_gate_copy = __esm({
259350
259497
  "setRequestProperty"
259351
259498
  ]);
259352
259499
  LOG_LEVELS = /* @__PURE__ */ new Set(["d", "i", "w", "e", "v"]);
259353
- ALLOW_PATH = join173(HERE5, "auth-gate-copy.allow.json");
259500
+ ALLOW_PATH = join174(HERE5, "auth-gate-copy.allow.json");
259354
259501
  if (false) main();
259355
259502
  MESSAGE_SITE = /NativeAuthError\.|NativeAuthException\(|BiometricException\(|\.retrieve\(|reason:|message:|\bcase\s+\.[A-Za-z]+[^:\n]*:\s*return\s+(?:m\.isEmpty\s*\?\s*)?"/;
259356
259503
  }
259357
259504
  });
259358
259505
 
259359
259506
  // ../l10n/extract.ts
259360
- import { resolve as resolve111, join as join174, relative as relative34, dirname as dirname78 } from "node:path";
259361
- import { createHash as createHash88 } from "node:crypto";
259507
+ import { resolve as resolve111, join as join175, relative as relative34, dirname as dirname78 } from "node:path";
259508
+ import { createHash as createHash89 } from "node:crypto";
259362
259509
  import { fileURLToPath as fileURLToPath39 } from "node:url";
259363
259510
  function keyOf3(source2) {
259364
- return "h_" + createHash88("sha1").update(source2).digest("hex").slice(0, 12);
259511
+ return "h_" + createHash89("sha1").update(source2).digest("hex").slice(0, 12);
259365
259512
  }
259366
259513
  var ROOT8;
259367
259514
  var init_extract = __esm({
@@ -259742,8 +259889,8 @@ __export(base44_adopt_exports, {
259742
259889
  renderAdoptModule: () => renderAdoptModule,
259743
259890
  runBase44Adopt: () => runBase44Adopt
259744
259891
  });
259745
- import { existsSync as existsSync134, readFileSync as readFileSync164, writeFileSync as writeFileSync60 } from "node:fs";
259746
- import { join as join176, resolve as resolve113 } from "node:path";
259892
+ import { existsSync as existsSync135, readFileSync as readFileSync165, writeFileSync as writeFileSync61 } from "node:fs";
259893
+ import { join as join177, resolve as resolve113 } from "node:path";
259747
259894
  function prop(entity, key4) {
259748
259895
  const props2 = entity.schema?.properties;
259749
259896
  const p2 = props2 && typeof props2 === "object" ? props2[key4] : void 0;
@@ -259834,10 +259981,10 @@ function renderAdoptModule(r3, source2 = ".himi/base44-book/book.json") {
259834
259981
  }
259835
259982
  function runBase44Adopt(opts) {
259836
259983
  const bookDir = resolve113(opts.cwd, opts.book ?? ".himi/base44-book");
259837
- const bookPath = join176(bookDir, "book.json");
259984
+ const bookPath = join177(bookDir, "book.json");
259838
259985
  let book;
259839
259986
  try {
259840
- book = JSON.parse(readFileSync164(bookPath, "utf8"));
259987
+ book = JSON.parse(readFileSync165(bookPath, "utf8"));
259841
259988
  if (!book || typeof book !== "object" || !Array.isArray(book.entities)) throw new Error("not a Base44 app book (no entities[])");
259842
259989
  } catch (e2) {
259843
259990
  throw new AdoptError("book_unreadable", `could not read ${bookPath}: ${e2.message}. Run \`himi base44 analyze --app-id <id>\` first.`);
@@ -259847,14 +259994,14 @@ function runBase44Adopt(opts) {
259847
259994
  throw new AdoptError("unknown_entity", `--entities names ${unknown.map((n2) => `"${n2}"`).join(", ")}, which the book does not have`, 2, { known: book.entities.map((e2) => e2.name) });
259848
259995
  }
259849
259996
  const result = adoptFromBook(book, { only: opts.only, app: opts.app });
259850
- const module = renderAdoptModule(result, opts.book ? join176(opts.book, "book.json") : void 0);
259997
+ const module = renderAdoptModule(result, opts.book ? join177(opts.book, "book.json") : void 0);
259851
259998
  const issues = validateBase44Entities({ entities: result.entities, functions: result.functions }, opts.app);
259852
259999
  if (opts.write === void 0 || opts.write === false || issues.some((i2) => i2.severity === "error")) return { result, module, issues };
259853
- const target = typeof opts.write === "string" ? resolve113(opts.cwd, opts.write) : join176(opts.cwd, ADOPT_MODULE_FILENAME);
259854
- if (existsSync134(target)) {
260000
+ const target = typeof opts.write === "string" ? resolve113(opts.cwd, opts.write) : join177(opts.cwd, ADOPT_MODULE_FILENAME);
260001
+ if (existsSync135(target)) {
259855
260002
  throw new AdoptError("adopt_target_exists", `${target} already exists \u2014 adopt never overwrites. Delete or rename it, or pass --write <other path>.`, 1, { path: target });
259856
260003
  }
259857
- writeFileSync60(target, module);
260004
+ writeFileSync61(target, module);
259858
260005
  return { result, module, issues, written: target };
259859
260006
  }
259860
260007
  var ADOPT_MODULE_FILENAME, TYPES, FORMATS2, BUILTINS, ENTITY_NAME2, AdoptError;
@@ -260101,9 +260248,9 @@ __export(generate_exports, {
260101
260248
  withHeader: () => withHeader,
260102
260249
  writeGenerated: () => writeGenerated2
260103
260250
  });
260104
- import { createHash as createHash89 } from "node:crypto";
260105
- import { existsSync as existsSync135, mkdirSync as mkdirSync60, readdirSync as readdirSync59, readFileSync as readFileSync165, writeFileSync as writeFileSync61 } from "node:fs";
260106
- import { dirname as dirname80, join as join177 } from "node:path";
260251
+ import { createHash as createHash90 } from "node:crypto";
260252
+ import { existsSync as existsSync136, mkdirSync as mkdirSync61, readdirSync as readdirSync60, readFileSync as readFileSync166, writeFileSync as writeFileSync62 } from "node:fs";
260253
+ import { dirname as dirname80, join as join178 } from "node:path";
260107
260254
  function withHeader(body) {
260108
260255
  return `${GENERATED_HEADER}${sha2568(body)}
260109
260256
  ${body}`;
@@ -260226,19 +260373,19 @@ function renderAll(sp) {
260226
260373
  function writeGenerated2(dir, files, opts = {}) {
260227
260374
  const out2 = [];
260228
260375
  for (const f2 of files) {
260229
- const abs = join177(dir, f2.path);
260376
+ const abs = join178(dir, f2.path);
260230
260377
  const next = withHeader(f2.body);
260231
260378
  let outcome;
260232
- if (!existsSync135(abs)) outcome = "written";
260379
+ if (!existsSync136(abs)) outcome = "written";
260233
260380
  else {
260234
- const cur = readFileSync165(abs, "utf8");
260381
+ const cur = readFileSync166(abs, "utf8");
260235
260382
  if (cur === next) outcome = "unchanged";
260236
260383
  else if (isEdited(cur) && !opts.force) outcome = "skipped-edited";
260237
260384
  else outcome = "written";
260238
260385
  }
260239
260386
  if (outcome === "written" && !opts.dryRun) {
260240
- mkdirSync60(dirname80(abs), { recursive: true });
260241
- writeFileSync61(abs, next);
260387
+ mkdirSync61(dirname80(abs), { recursive: true });
260388
+ writeFileSync62(abs, next);
260242
260389
  }
260243
260390
  out2.push({ path: f2.path, outcome });
260244
260391
  }
@@ -260247,16 +260394,16 @@ function writeGenerated2(dir, files, opts = {}) {
260247
260394
  function orphanedFiles(dir, current) {
260248
260395
  const keep = new Set(current.map((f2) => f2.path));
260249
260396
  const found = [];
260250
- const t5 = join177(dir, "tier5-src");
260251
- if (!existsSync135(t5)) return found;
260252
- const candidates = readdirSync59(t5).filter((d2) => d2.startsWith("b44-")).map((d2) => `tier5-src/${d2}/index.ts`);
260253
- const shared = join177(t5, "_shared");
260254
- if (existsSync135(shared)) {
260255
- for (const f2 of readdirSync59(shared)) if (/^b44-.*-plan\.ts$/.test(f2)) candidates.push(`tier5-src/_shared/${f2}`);
260397
+ const t5 = join178(dir, "tier5-src");
260398
+ if (!existsSync136(t5)) return found;
260399
+ const candidates = readdirSync60(t5).filter((d2) => d2.startsWith("b44-")).map((d2) => `tier5-src/${d2}/index.ts`);
260400
+ const shared = join178(t5, "_shared");
260401
+ if (existsSync136(shared)) {
260402
+ for (const f2 of readdirSync60(shared)) if (/^b44-.*-plan\.ts$/.test(f2)) candidates.push(`tier5-src/_shared/${f2}`);
260256
260403
  }
260257
260404
  for (const rel2 of candidates.sort()) {
260258
- if (keep.has(rel2) || !existsSync135(join177(dir, rel2))) continue;
260259
- if (readFileSync165(join177(dir, rel2), "utf8").startsWith(GENERATED_HEADER)) found.push(rel2);
260405
+ if (keep.has(rel2) || !existsSync136(join178(dir, rel2))) continue;
260406
+ if (readFileSync166(join178(dir, rel2), "utf8").startsWith(GENERATED_HEADER)) found.push(rel2);
260260
260407
  }
260261
260408
  return found;
260262
260409
  }
@@ -260268,7 +260415,7 @@ var init_generate = __esm({
260268
260415
  GENERATED_HEADER = "// @generated by himi base44 screens \u2014 sha256:";
260269
260416
  HEADER_RE = /^\/\/ @generated by himi base44 screens — sha256:([0-9a-f]{64})\n/;
260270
260417
  ENGINE_FILES = ["tier5-src/_shared/entity-list.ts", "tier5-src/_shared/entity-detail.ts", "tier5-src/_shared/entity-plan.ts", "dev/entity-screens.ts"];
260271
- sha2568 = (s5) => createHash89("sha256").update(s5).digest("hex");
260418
+ sha2568 = (s5) => createHash90("sha256").update(s5).digest("hex");
260272
260419
  planFile = (p2) => `${p2.ids.bundleDetail}-plan`;
260273
260420
  ident = (p2) => `plan_${p2.ids.detail.replace(/^b44_/, "")}`;
260274
260421
  json8 = (v2) => JSON.stringify(v2, null, 2);
@@ -260295,20 +260442,20 @@ __export(base44_auth_exports, {
260295
260442
  usableBase44Auth: () => usableBase44Auth,
260296
260443
  writeBase44Session: () => writeBase44Session
260297
260444
  });
260298
- import { chmodSync as chmodSync7, existsSync as existsSync136, mkdirSync as mkdirSync61, readFileSync as readFileSync166, rmSync as rmSync39, writeFileSync as writeFileSync62 } from "node:fs";
260445
+ import { chmodSync as chmodSync7, existsSync as existsSync137, mkdirSync as mkdirSync62, readFileSync as readFileSync167, rmSync as rmSync40, writeFileSync as writeFileSync63 } from "node:fs";
260299
260446
  import { homedir as homedir22 } from "node:os";
260300
- import { dirname as dirname81, join as join178 } from "node:path";
260447
+ import { dirname as dirname81, join as join179 } from "node:path";
260301
260448
  function base44ApiBase(env = process.env) {
260302
260449
  return (env.BASE44_API_URL?.trim() || "https://app.base44.com").replace(/\/+$/, "");
260303
260450
  }
260304
260451
  function base44SessionPath(home2 = homedir22()) {
260305
- return join178(home2, ".himi", "base44", "session.json");
260452
+ return join179(home2, ".himi", "base44", "session.json");
260306
260453
  }
260307
260454
  function readBase44Session(home2) {
260308
260455
  const p2 = base44SessionPath(home2);
260309
- if (!existsSync136(p2)) return void 0;
260456
+ if (!existsSync137(p2)) return void 0;
260310
260457
  try {
260311
- const s5 = JSON.parse(readFileSync166(p2, "utf8"));
260458
+ const s5 = JSON.parse(readFileSync167(p2, "utf8"));
260312
260459
  return typeof s5.accessToken === "string" && s5.accessToken ? s5 : void 0;
260313
260460
  } catch {
260314
260461
  return void 0;
@@ -260316,16 +260463,16 @@ function readBase44Session(home2) {
260316
260463
  }
260317
260464
  function writeBase44Session(session, home2) {
260318
260465
  const p2 = base44SessionPath(home2);
260319
- mkdirSync61(dirname81(p2), { recursive: true, mode: 448 });
260320
- writeFileSync62(p2, `${JSON.stringify(session, null, 2)}
260466
+ mkdirSync62(dirname81(p2), { recursive: true, mode: 448 });
260467
+ writeFileSync63(p2, `${JSON.stringify(session, null, 2)}
260321
260468
  `, { mode: 384 });
260322
260469
  chmodSync7(p2, 384);
260323
260470
  return p2;
260324
260471
  }
260325
260472
  function deleteBase44Session(home2) {
260326
260473
  const p2 = base44SessionPath(home2);
260327
- if (!existsSync136(p2)) return false;
260328
- rmSync39(p2, { force: true });
260474
+ if (!existsSync137(p2)) return false;
260475
+ rmSync40(p2, { force: true });
260329
260476
  return true;
260330
260477
  }
260331
260478
  function jwtClaims(token) {
@@ -260426,9 +260573,9 @@ function hasBase44WriteScope(auth) {
260426
260573
  return scopes.includes("apps:write");
260427
260574
  }
260428
260575
  function importBase44CliSession(home2 = homedir22(), env = process.env) {
260429
- const src = join178(home2, ".base44", "auth", "auth.json");
260430
- if (!existsSync136(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
260431
- const a3 = JSON.parse(readFileSync166(src, "utf8"));
260576
+ const src = join179(home2, ".base44", "auth", "auth.json");
260577
+ if (!existsSync137(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
260578
+ const a3 = JSON.parse(readFileSync167(src, "utf8"));
260432
260579
  if (typeof a3.accessToken !== "string" || !a3.accessToken) throw new Error(`${src} holds no access token`);
260433
260580
  const session = {
260434
260581
  accessToken: a3.accessToken,
@@ -260527,14 +260674,14 @@ __export(seed_exports, {
260527
260674
  seedBase44Entities: () => seedBase44Entities,
260528
260675
  writeBase44SeedRows: () => writeBase44SeedRows
260529
260676
  });
260530
- import { existsSync as existsSync137, readFileSync as readFileSync167, writeFileSync as writeFileSync63 } from "node:fs";
260531
- import { join as join179 } from "node:path";
260677
+ import { existsSync as existsSync138, readFileSync as readFileSync168, writeFileSync as writeFileSync64 } from "node:fs";
260678
+ import { join as join180 } from "node:path";
260532
260679
  function readBase44SeedFile(dir) {
260533
- const file2 = join179(dir, BASE44_SEED_FILE);
260534
- if (!existsSync137(file2)) return {};
260680
+ const file2 = join180(dir, BASE44_SEED_FILE);
260681
+ if (!existsSync138(file2)) return {};
260535
260682
  let parsed;
260536
260683
  try {
260537
- parsed = JSON.parse(readFileSync167(file2, "utf8"));
260684
+ parsed = JSON.parse(readFileSync168(file2, "utf8"));
260538
260685
  } catch (e2) {
260539
260686
  throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Fix or delete it.`);
260540
260687
  }
@@ -260685,16 +260832,16 @@ function placeholder2(f2, i2) {
260685
260832
  }
260686
260833
  function writeBase44SeedRows(opts) {
260687
260834
  const { dir, app: app2, count: count3 = 8 } = opts;
260688
- const path2 = join179(dir, BASE44_SEED_FILE);
260835
+ const path2 = join180(dir, BASE44_SEED_FILE);
260689
260836
  const owned = opts.entities.filter((s5) => !!s5 && typeof s5 === "object" && isOwnedEntity(s5) && (!opts.only || opts.only.includes(physicalEntityName(s5, app2)) || opts.only.includes(s5.name ?? "")));
260690
260837
  if (!owned.length) {
260691
260838
  return { ok: false, path: path2, entities: {}, agentPrompt: "", next: [], note: opts.only ? `--only ${opts.only.join(",")} matched no owned entity` : `no owned Base44 entities declared \u2014 add one with \`name\` (physically ${base44Prefix(app2)}<Name>). Adopted entities are never seeded.` };
260692
260839
  }
260693
260840
  let existing = {};
260694
- if (existsSync137(path2)) {
260841
+ if (existsSync138(path2)) {
260695
260842
  let parsed;
260696
260843
  try {
260697
- parsed = JSON.parse(readFileSync167(path2, "utf8"));
260844
+ parsed = JSON.parse(readFileSync168(path2, "utf8"));
260698
260845
  } catch (e2) {
260699
260846
  throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Refusing to regenerate, because overwriting it would discard the rows already in it.`);
260700
260847
  }
@@ -260712,7 +260859,7 @@ function writeBase44SeedRows(opts) {
260712
260859
  existing[name] = Array.from({ length: count3 }, (_2, i2) => Object.fromEntries((spec.fields ?? []).map((f2) => [f2.key, placeholder2(f2, i2)])));
260713
260860
  entities[name] = count3;
260714
260861
  }
260715
- writeFileSync63(path2, `${JSON.stringify(existing, null, 2)}
260862
+ writeFileSync64(path2, `${JSON.stringify(existing, null, 2)}
260716
260863
  `);
260717
260864
  const seedable = owned.filter((s5) => (s5.fields ?? []).length);
260718
260865
  if (!seedable.length) {
@@ -261048,16 +261195,16 @@ __export(functions_exports2, {
261048
261195
  markerContent: () => markerContent,
261049
261196
  readFunctionSource: () => readFunctionSource
261050
261197
  });
261051
- import { existsSync as existsSync138, lstatSync as lstatSync38 } from "node:fs";
261052
- import { join as join180 } from "node:path";
261198
+ import { existsSync as existsSync139, lstatSync as lstatSync38 } from "node:fs";
261199
+ import { join as join181 } from "node:path";
261053
261200
  function markerContent(app2) {
261054
261201
  return `${JSON.stringify({ app: app2, by: "himi" })}
261055
261202
  `;
261056
261203
  }
261057
261204
  function readFunctionSource(appDir3, name, app2) {
261058
261205
  const rel2 = `base44/functions/${name}/`;
261059
- const folder = join180(appDir3, "base44", "functions", name);
261060
- if (!existsSync138(folder) || !lstatSync38(folder).isDirectory()) throw new FunctionSourceError("function_source_missing", `no source folder at ${rel2}`);
261206
+ const folder = join181(appDir3, "base44", "functions", name);
261207
+ if (!existsSync139(folder) || !lstatSync38(folder).isDirectory()) throw new FunctionSourceError("function_source_missing", `no source folder at ${rel2}`);
261061
261208
  const { entries, skipped } = collectAppSource(folder);
261062
261209
  if (skipped.length) throw new FunctionSourceError("function_source_unsafe", `${rel2} holds paths himi will not upload (symlinks or denied names): ${skipped.join(", ")} \u2014 remove them`);
261063
261210
  const secrets = secretFindings(entries);
@@ -261398,15 +261545,15 @@ __export(apply_exports, {
261398
261545
  createBase44Entities: () => createBase44Entities,
261399
261546
  fileLedger: () => fileLedger
261400
261547
  });
261401
- import { existsSync as existsSync139, readFileSync as readFileSync168, writeFileSync as writeFileSync64 } from "node:fs";
261402
- import { join as join181 } from "node:path";
261548
+ import { existsSync as existsSync140, readFileSync as readFileSync169, writeFileSync as writeFileSync65 } from "node:fs";
261549
+ import { join as join182 } from "node:path";
261403
261550
  function fileLedger(dir, appId3) {
261404
- const path2 = join181(dir, LEDGER_FILE2);
261551
+ const path2 = join182(dir, LEDGER_FILE2);
261405
261552
  const load5 = () => {
261406
- if (!existsSync139(path2)) return {};
261553
+ if (!existsSync140(path2)) return {};
261407
261554
  let v2;
261408
261555
  try {
261409
- v2 = JSON.parse(readFileSync168(path2, "utf8"));
261556
+ v2 = JSON.parse(readFileSync169(path2, "utf8"));
261410
261557
  } catch (e2) {
261411
261558
  throw new LedgerError(`${LEDGER_FILE2} is not valid JSON (${e2.message}) \u2014 fix it (a merge conflict?) rather than let himi rewrite it`);
261412
261559
  }
@@ -261419,7 +261566,7 @@ function fileLedger(dir, appId3) {
261419
261566
  return Array.isArray(v2) ? v2.filter((x2) => typeof x2 === "string") : [];
261420
261567
  },
261421
261568
  write: (names2) => {
261422
- writeFileSync64(path2, `${JSON.stringify({ ...load5(), [appId3]: [...names2].sort() }, null, 2)}
261569
+ writeFileSync65(path2, `${JSON.stringify({ ...load5(), [appId3]: [...names2].sort() }, null, 2)}
261423
261570
  `);
261424
261571
  }
261425
261572
  };
@@ -262058,11 +262205,11 @@ var init_analyze = __esm({
262058
262205
  });
262059
262206
 
262060
262207
  // src/base44-analyze/write-artifacts.ts
262061
- import { existsSync as existsSync140, mkdirSync as mkdirSync62, readFileSync as readFileSync169, rmSync as rmSync40, writeFileSync as writeFileSync65 } from "node:fs";
262062
- import { dirname as dirname82, join as join182, resolve as resolve114, sep as sep32 } from "node:path";
262208
+ import { existsSync as existsSync141, mkdirSync as mkdirSync63, readFileSync as readFileSync170, rmSync as rmSync41, writeFileSync as writeFileSync66 } from "node:fs";
262209
+ import { dirname as dirname82, join as join183, resolve as resolve114, sep as sep32 } from "node:path";
262063
262210
  function isBookFolder(dir) {
262064
262211
  try {
262065
- return JSON.parse(readFileSync169(join182(dir, "book.json"), "utf8")).kind === "base44-app-book";
262212
+ return JSON.parse(readFileSync170(join183(dir, "book.json"), "utf8")).kind === "base44-app-book";
262066
262213
  } catch {
262067
262214
  return false;
262068
262215
  }
@@ -262149,27 +262296,27 @@ function writeBase44Book(result, outDir, opts = {}) {
262149
262296
  const md = renderBookMd(book);
262150
262297
  assertNoSecrets(json9);
262151
262298
  assertNoSecrets(md);
262152
- const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) => existsSync140(join182(out2, n2)));
262299
+ const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) => existsSync141(join183(out2, n2)));
262153
262300
  if (owned.length) {
262154
262301
  if (!isBookFolder(out2)) throw new Error(`refusing to write the app book into ${out2}: it already has ${owned.join(", ")} that ${owned.length === 1 ? "is" : "are"} not from an app book \u2014 pick an empty --out`);
262155
- for (const d2 of ["source", "screenshots"]) rmSync40(join182(out2, d2), { recursive: true, force: true });
262302
+ for (const d2 of ["source", "screenshots"]) rmSync41(join183(out2, d2), { recursive: true, force: true });
262156
262303
  }
262157
- mkdirSync62(out2, { recursive: true });
262158
- writeFileSync65(join182(out2, "book.json"), json9);
262159
- writeFileSync65(join182(out2, "BOOK.md"), md);
262304
+ mkdirSync63(out2, { recursive: true });
262305
+ writeFileSync66(join183(out2, "book.json"), json9);
262306
+ writeFileSync66(join183(out2, "BOOK.md"), md);
262160
262307
  files.push("book.json", "BOOK.md");
262161
262308
  for (const s5 of shots) {
262162
- mkdirSync62(join182(out2, "screenshots"), { recursive: true });
262163
- writeFileSync65(join182(out2, "screenshots", s5.filename), s5.bytes);
262309
+ mkdirSync63(join183(out2, "screenshots"), { recursive: true });
262310
+ writeFileSync66(join183(out2, "screenshots", s5.filename), s5.bytes);
262164
262311
  files.push(`screenshots/${s5.filename}`);
262165
262312
  }
262166
- const sourceRoot = join182(out2, "source");
262313
+ const sourceRoot = join183(out2, "source");
262167
262314
  for (const f2 of result.sourceFiles) {
262168
262315
  if (!safeRel(f2.path)) continue;
262169
- const dest = join182(sourceRoot, ...f2.path.split("/"));
262316
+ const dest = join183(sourceRoot, ...f2.path.split("/"));
262170
262317
  if (!dest.startsWith(sourceRoot + sep32)) continue;
262171
- mkdirSync62(dirname82(dest), { recursive: true });
262172
- writeFileSync65(dest, f2.bytes);
262318
+ mkdirSync63(dirname82(dest), { recursive: true });
262319
+ writeFileSync66(dest, f2.bytes);
262173
262320
  }
262174
262321
  if (result.sourceFiles.length) files.push(`source/ (${result.sourceFiles.length} files)`);
262175
262322
  return { outDir: out2, files };
@@ -265715,9 +265862,9 @@ __export(cli_exports, {
265715
265862
  systemTar: () => systemTar
265716
265863
  });
265717
265864
  import { execFile as execFile7 } from "node:child_process";
265718
- import { mkdirSync as mkdirSync63, mkdtempSync as mkdtempSync13, rmSync as rmSync41, writeFileSync as writeFileSync66 } from "node:fs";
265865
+ import { mkdirSync as mkdirSync64, mkdtempSync as mkdtempSync13, rmSync as rmSync42, writeFileSync as writeFileSync67 } from "node:fs";
265719
265866
  import { tmpdir as tmpdir14 } from "node:os";
265720
- import { join as join183, resolve as resolve115 } from "node:path";
265867
+ import { join as join184, resolve as resolve115 } from "node:path";
265721
265868
  import { promisify as promisify2 } from "node:util";
265722
265869
  function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
265723
265870
  return async (appId3) => {
@@ -265730,13 +265877,13 @@ function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
265730
265877
  }
265731
265878
  const bytes2 = await readCapped(res, MAX_TARBALL_BYTES);
265732
265879
  if (!bytes2) throw new Error(`project download is over the ${MAX_TARBALL_BYTES}-byte cap`);
265733
- const root = mkdtempSync13(join183(tmpdir14(), "himi-base44-"));
265734
- const cleanup = () => rmSync41(root, { recursive: true, force: true });
265880
+ const root = mkdtempSync13(join184(tmpdir14(), "himi-base44-"));
265881
+ const cleanup = () => rmSync42(root, { recursive: true, force: true });
265735
265882
  try {
265736
- const archive = join183(root, "project.tar");
265737
- const dir = join183(root, "project");
265738
- writeFileSync66(archive, bytes2);
265739
- mkdirSync63(dir);
265883
+ const archive = join184(root, "project.tar");
265884
+ const dir = join184(root, "project");
265885
+ writeFileSync67(archive, bytes2);
265886
+ mkdirSync64(dir);
265740
265887
  await extract(archive, dir);
265741
265888
  return { dir, cleanup };
265742
265889
  } catch (e2) {
@@ -266394,7 +266541,7 @@ var init_one_app_page = __esm({
266394
266541
  });
266395
266542
 
266396
266543
  // src/one-app/pages.ts
266397
- import { createHash as createHash90 } from "node:crypto";
266544
+ import { createHash as createHash91 } from "node:crypto";
266398
266545
  function oneAppPagePlacements(raw) {
266399
266546
  const sections2 = object14(raw.sections);
266400
266547
  const placements = [];
@@ -266456,7 +266603,7 @@ var init_pages = __esm({
266456
266603
  init_errors4();
266457
266604
  object14 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
266458
266605
  pointer = (s5) => s5.replaceAll("~", "~0").replaceAll("/", "~1");
266459
- hash2 = (s5) => createHash90("sha256").update(s5).digest("hex");
266606
+ hash2 = (s5) => createHash91("sha256").update(s5).digest("hex");
266460
266607
  ONE_APP_PAGES_BASE = "https://apps.wix.com/social-content/api/v1/pages/";
266461
266608
  }
266462
266609
  });
@@ -266469,7 +266616,7 @@ __export(collect_exports, {
266469
266616
  resolveSourceLocale: () => resolveSourceLocale,
266470
266617
  sourceMemberChat: () => sourceMemberChat
266471
266618
  });
266472
- import { createHash as createHash91 } from "node:crypto";
266619
+ import { createHash as createHash92 } from "node:crypto";
266473
266620
  function isObject3(value2) {
266474
266621
  return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
266475
266622
  }
@@ -266585,7 +266732,7 @@ function semanticFingerprint(structure) {
266585
266732
  }
266586
266733
  return JSON.stringify(value2);
266587
266734
  };
266588
- return createHash91("sha256").update(canonical9(structure, true)).digest("hex");
266735
+ return createHash92("sha256").update(canonical9(structure, true)).digest("hex");
266589
266736
  }
266590
266737
  async function collectOneApp(input, deps = {}) {
266591
266738
  const locale = resolveSourceLocale(input.locale);
@@ -267049,8 +267196,8 @@ var init_invite_plan = __esm({
267049
267196
  });
267050
267197
 
267051
267198
  // src/one-app/header-badges-cli.ts
267052
- import { existsSync as existsSync142, readFileSync as readFileSync170, rmSync as rmSync42, statSync as statSync47, writeFileSync as writeFileSync67 } from "node:fs";
267053
- import { join as join185, resolve as resolve117 } from "node:path";
267199
+ import { existsSync as existsSync143, readFileSync as readFileSync171, rmSync as rmSync43, statSync as statSync47, writeFileSync as writeFileSync68 } from "node:fs";
267200
+ import { join as join186, resolve as resolve117 } from "node:path";
267054
267201
  function parseArgs4(args) {
267055
267202
  let evidenceDir;
267056
267203
  let contentDir2;
@@ -267076,9 +267223,9 @@ function parseArgs4(args) {
267076
267223
  return { evidenceDir: resolve117(evidenceDir), contentDir: resolve117(contentDir2), dryRun };
267077
267224
  }
267078
267225
  function contentScreens(contentDir2) {
267079
- const path2 = join185(contentDir2, "himalaya.content.json");
267080
- if (!existsSync142(path2)) throw new Error("himalaya.content.json not found: --content must be a Himi content package");
267081
- const parsed = JSON.parse(readFileSync170(path2, "utf8"));
267226
+ const path2 = join186(contentDir2, "himalaya.content.json");
267227
+ if (!existsSync143(path2)) throw new Error("himalaya.content.json not found: --content must be a Himi content package");
267228
+ const parsed = JSON.parse(readFileSync171(path2, "utf8"));
267082
267229
  return new Set(Object.keys(parsed.screens ?? {}));
267083
267230
  }
267084
267231
  function mapCoverage(evidenceDir, contentDir2, plan, bound2, dryRun) {
@@ -267107,7 +267254,7 @@ function mapCoverage(evidenceDir, contentDir2, plan, bound2, dryRun) {
267107
267254
  mapped++;
267108
267255
  } else conflicts.push(`${source2.buttonId ?? source2.source}: already mapped to ${row2.target.screenId}/${row2.target.controlId ?? "?"}, not ${target.screenId}/${target.controlId}`);
267109
267256
  }
267110
- if (mapped && !dryRun) writeFileSync67(join185(resolve117(contentDir2), COVERAGE_FILE), JSON.stringify(coverage2, null, 2) + "\n");
267257
+ if (mapped && !dryRun) writeFileSync68(join186(resolve117(contentDir2), COVERAGE_FILE), JSON.stringify(coverage2, null, 2) + "\n");
267111
267258
  return { mapped, kept, conflicts };
267112
267259
  }
267113
267260
  function report4(io2, ok5, body) {
@@ -267145,12 +267292,12 @@ async function runOneAppHeaderBadges(args, io2) {
267145
267292
  note: plan.unmapped.length ? "No bell, chat or cart badge was found; the unmapped badge buttons still need an authored counter or an explicit decision." : unverified.length ? `No badge was found, and the ${unverified.join(" and ")} runtime view was not collected: whether the source header has a bell, chat or cart badge is unverified. Nothing was changed.` : "The source header has no badges, so nothing was changed."
267146
267293
  });
267147
267294
  }
267148
- const configPath = join185(options2.contentDir, "config.ts");
267295
+ const configPath = join186(options2.contentDir, "config.ts");
267149
267296
  let screens;
267150
267297
  let configText;
267151
267298
  try {
267152
267299
  if (!statSync47(configPath).isFile()) throw new Error("config.ts is not a file.");
267153
- configText = readFileSync170(configPath, "utf8");
267300
+ configText = readFileSync171(configPath, "utf8");
267154
267301
  screens = contentScreens(options2.contentDir);
267155
267302
  } catch (error) {
267156
267303
  return report4(io2, false, { code: "config_uninspectable", error: error instanceof Error ? error.message : String(error), ...common2 });
@@ -267165,8 +267312,8 @@ async function runOneAppHeaderBadges(args, io2) {
267165
267312
  if (!bindable.length) {
267166
267313
  return report4(io2, true, { status: "nothing_to_bind", headerBadges: [], skipped, ...common2 });
267167
267314
  }
267168
- const workerSource = join185(options2.contentDir, "tier5-src", HEADER_BADGES_BUNDLE, "index.ts");
267169
- if (!existsSync142(workerSource)) {
267315
+ const workerSource = join186(options2.contentDir, "tier5-src", HEADER_BADGES_BUNDLE, "index.ts");
267316
+ if (!existsSync143(workerSource)) {
267170
267317
  return report4(io2, false, {
267171
267318
  code: "worker_missing",
267172
267319
  headerBadges: bindable,
@@ -267187,23 +267334,23 @@ async function runOneAppHeaderBadges(args, io2) {
267187
267334
  snippet: patch.snippet
267188
267335
  });
267189
267336
  }
267190
- const ledgerPath = join185(resolve117(options2.contentDir), COVERAGE_FILE);
267337
+ const ledgerPath = join186(resolve117(options2.contentDir), COVERAGE_FILE);
267191
267338
  let ledgerBefore = null;
267192
267339
  let coverage2;
267193
267340
  try {
267194
- ledgerBefore = existsSync142(ledgerPath) ? readFileSync170(ledgerPath) : null;
267341
+ ledgerBefore = existsSync143(ledgerPath) ? readFileSync171(ledgerPath) : null;
267195
267342
  coverage2 = mapCoverage(options2.evidenceDir, options2.contentDir, plan, bindable, options2.dryRun);
267196
267343
  } catch (error) {
267197
267344
  return report4(io2, false, { code: "evidence_invalid", error: error instanceof Error ? error.message : String(error), headerBadges: bindable });
267198
267345
  }
267199
267346
  if (patch.status === "written" && !options2.dryRun) {
267200
267347
  try {
267201
- writeFileSync67(configPath, patch.text, "utf8");
267348
+ writeFileSync68(configPath, patch.text, "utf8");
267202
267349
  } catch (error) {
267203
267350
  let restored = "the coverage ledger was put back as it was";
267204
267351
  try {
267205
- if (ledgerBefore === null) rmSync42(ledgerPath, { force: true });
267206
- else writeFileSync67(ledgerPath, ledgerBefore);
267352
+ if (ledgerBefore === null) rmSync43(ledgerPath, { force: true });
267353
+ else writeFileSync68(ledgerPath, ledgerBefore);
267207
267354
  } catch (restoreError) {
267208
267355
  restored = `the coverage ledger could NOT be restored (${restoreError instanceof Error ? restoreError.message : String(restoreError)}): run \`himi one-app coverage sync\` and check its top-bar rows`;
267209
267356
  }
@@ -267239,8 +267386,8 @@ var init_header_badges_cli = __esm({
267239
267386
  });
267240
267387
 
267241
267388
  // src/one-app/recipes.ts
267242
- import { existsSync as existsSync143, readFileSync as readFileSync171 } from "node:fs";
267243
- import { join as join186 } from "node:path";
267389
+ import { existsSync as existsSync144, readFileSync as readFileSync172 } from "node:fs";
267390
+ import { join as join187 } from "node:path";
267244
267391
  function readRecipe(contentDir2, name, values) {
267245
267392
  return readParts(contentDir2, name, values, "node");
267246
267393
  }
@@ -267249,13 +267396,13 @@ function readRecipeNodes(contentDir2, name, values) {
267249
267396
  }
267250
267397
  function readParts(contentDir2, name, values, key4) {
267251
267398
  if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new RecipeError(`"${name}" is not a recipe name`);
267252
- const path2 = join186(contentDir2, "recipes", `${name}.json`);
267253
- if (!existsSync143(path2)) {
267399
+ const path2 = join187(contentDir2, "recipes", `${name}.json`);
267400
+ if (!existsSync144(path2)) {
267254
267401
  throw new RecipeError(`recipes/${name}.json is missing: this scaffold does not ship that recipe, so the section keeps its title and a See All link.`);
267255
267402
  }
267256
267403
  let file2;
267257
267404
  try {
267258
- file2 = JSON.parse(readFileSync171(path2, "utf8"));
267405
+ file2 = JSON.parse(readFileSync172(path2, "utf8"));
267259
267406
  } catch {
267260
267407
  throw new RecipeError(`recipes/${name}.json is not valid JSON`);
267261
267408
  }
@@ -268245,7 +268392,23 @@ var init_generate2 = __esm({
268245
268392
  return vstack(`${id}.box`, children2, 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
268246
268393
  },
268247
268394
  progallery_carousel_section: (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, "progallery_carousel_section", NO_INLINE_SECTION),
268248
- achievements_participant_carousel_section: (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, "achievements_participant_carousel_section", NO_INLINE_SECTION),
268395
+ // The member's own programs as a carousel: signed in only (a visitor, an empty list and a failed read all hide the whole section,
268396
+ // title included), the source's default of 5 cards unless it authors `extraProps.limit`, each card with the member's progress.
268397
+ achievements_participant_carousel_section: (id, s5, st2, index, ctx, sectionId) => {
268398
+ if (!ctx.hasScreen("himi_program")) return ctx.unsupported(sectionId, "achievements_participant_carousel_section", "this scaffold has no himi_program screen for a card to open");
268399
+ const limit = countOf2(obj10(s5.extraProps).limit ?? obj10(st2.extraProps).limit ?? st2.limit);
268400
+ const svc = ctx.uses("programs", `programs${index}`, {
268401
+ layout: "carousel",
268402
+ participating: true,
268403
+ showDuration: st2.isDurationVisible !== false,
268404
+ showParticipants: st2.isParticipantsVisible !== false,
268405
+ ...limit !== void 0 ? { limit } : {}
268406
+ });
268407
+ const heading = s5.showTitle === true ? str16(s5.title).trim() : "";
268408
+ const section3 = ctx.recipe("programs-participant-carousel", { svc, id, detailScreen: "himi_program", memberProgramsScreen: "himi_member_programs", ctaLabel: "Programs I joined", heading });
268409
+ const children2 = [heading && ctx.hasScreen("himi_member_programs") ? section3 : withoutNode(section3, `${id}.cta`)];
268410
+ return vstack(`${id}.box`, children2, 0, { onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
268411
+ },
268249
268412
  groups_cards_section: (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, "groups_cards_section", NO_INLINE_SECTION),
268250
268413
  newBlog_search_section: (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, "newBlog_search_section", NO_INLINE_SECTION),
268251
268414
  ...Object.fromEntries(["upcoming_bookings_section", "memberships_packages_section", "platform_paid_plans_section"].map((type2) => [type2, (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, type2, NO_INLINE_SECTION)])),
@@ -268439,10 +268602,10 @@ __export(validate_identity_exports, {
268439
268602
  ricosTexts: () => ricosTexts,
268440
268603
  runOneAppIdentityValidation: () => runOneAppIdentityValidation
268441
268604
  });
268442
- import { createHash as createHash92 } from "node:crypto";
268443
- import { existsSync as existsSync144, readFileSync as readFileSync172, writeFileSync as writeFileSync68 } from "node:fs";
268605
+ import { createHash as createHash93 } from "node:crypto";
268606
+ import { existsSync as existsSync145, readFileSync as readFileSync173, writeFileSync as writeFileSync69 } from "node:fs";
268444
268607
  import ts24 from "typescript";
268445
- import { join as join187, resolve as resolve118 } from "node:path";
268608
+ import { join as join188, resolve as resolve118 } from "node:path";
268446
268609
  function ricosTexts(documentJson) {
268447
268610
  let root;
268448
268611
  try {
@@ -268526,8 +268689,8 @@ function fixAppName(configSource, slug, displayName3) {
268526
268689
  }
268527
268690
  function sourceIdentity(evidenceDir) {
268528
268691
  const { manifest: manifest2, raw } = verifiedEvidence(evidenceDir);
268529
- const bytes2 = readFileSync172(join187(evidenceDir, "business-context.json"));
268530
- const hash3 = createHash92("sha256").update(bytes2).digest("hex");
268692
+ const bytes2 = readFileSync173(join188(evidenceDir, "business-context.json"));
268693
+ const hash3 = createHash93("sha256").update(bytes2).digest("hex");
268531
268694
  if (obj11(manifest2.sha256)["business-context.json"] !== hash3) throw Error("business-context.json differs from the collected evidence.");
268532
268695
  const name = obj11(JSON.parse(bytes2.toString("utf8"))).displayName;
268533
268696
  if (typeof name !== "string" || !name.trim()) throw Error("The collected business display name is unavailable; recollect the source identity.");
@@ -268545,10 +268708,10 @@ function sourceIdentity(evidenceDir) {
268545
268708
  const settings = obj11(obj11(value2).settings);
268546
268709
  for (const key4 of ["title", "subtitle", "label", "text", "description"]) copy(settings[key4]);
268547
268710
  }
268548
- const pagesPath = join187(evidenceDir, "pages-content.json");
268549
- if (existsSync144(pagesPath)) {
268550
- const pagesBytes = readFileSync172(pagesPath);
268551
- if (obj11(manifest2.sha256)["pages-content.json"] !== createHash92("sha256").update(pagesBytes).digest("hex")) throw Error("pages-content.json differs from the collected evidence.");
268711
+ const pagesPath = join188(evidenceDir, "pages-content.json");
268712
+ if (existsSync145(pagesPath)) {
268713
+ const pagesBytes = readFileSync173(pagesPath);
268714
+ if (obj11(manifest2.sha256)["pages-content.json"] !== createHash93("sha256").update(pagesBytes).digest("hex")) throw Error("pages-content.json differs from the collected evidence.");
268552
268715
  for (const document2 of obj11(JSON.parse(pagesBytes.toString("utf8"))).documents ?? []) authoredText.push(...ricosTexts(obj11(obj11(document2).page).documentJson));
268553
268716
  }
268554
268717
  return { displayName: name, authoredText };
@@ -268591,13 +268754,13 @@ async function runOneAppIdentityValidation(args, io2) {
268591
268754
  const content = resolve118(values.get("--content"));
268592
268755
  const slug = readContentManifest(content)?.name;
268593
268756
  if (!isValidAppId(slug)) throw Error("A technical app slug is required in himalaya.content.json.");
268594
- const configPath = join187(content, "config.ts");
268757
+ const configPath = join188(content, "config.ts");
268595
268758
  let appName2;
268596
- if (existsSync144(configPath)) {
268597
- const correction = fixAppName(readFileSync172(configPath, "utf8"), slug, identity.displayName);
268759
+ if (existsSync145(configPath)) {
268760
+ const correction = fixAppName(readFileSync173(configPath, "utf8"), slug, identity.displayName);
268598
268761
  if (correction) {
268599
268762
  if (fix) {
268600
- writeFileSync68(configPath, correction.fixed, "utf8");
268763
+ writeFileSync69(configPath, correction.fixed, "utf8");
268601
268764
  appName2 = { current: correction.current, fixed: true };
268602
268765
  } else appName2 = { current: correction.current };
268603
268766
  }
@@ -268653,14 +268816,14 @@ var init_validate_identity = __esm({
268653
268816
  });
268654
268817
 
268655
268818
  // src/one-app/invite-flow.ts
268656
- import { existsSync as existsSync145, lstatSync as lstatSync39, readFileSync as readFileSync173, readdirSync as readdirSync60 } from "node:fs";
268657
- import { join as join188 } from "node:path";
268819
+ import { existsSync as existsSync146, lstatSync as lstatSync39, readFileSync as readFileSync174, readdirSync as readdirSync61 } from "node:fs";
268820
+ import { join as join189 } from "node:path";
268658
268821
  import ts25 from "typescript";
268659
268822
  function assertNoSymlink(dir, rel2) {
268660
268823
  let current = dir;
268661
268824
  for (const part5 of rel2.split("/")) {
268662
- current = join188(current, part5);
268663
- if (existsSync145(current) && lstatSync39(current).isSymbolicLink()) throw new Error(`${rel2} goes through a symlink (${part5}): refusing to read or write it`);
268825
+ current = join189(current, part5);
268826
+ if (existsSync146(current) && lstatSync39(current).isSymbolicLink()) throw new Error(`${rel2} goes through a symlink (${part5}): refusing to read or write it`);
268664
268827
  }
268665
268828
  }
268666
268829
  function inviteScreenDescriptor() {
@@ -268714,14 +268877,14 @@ function inviteNavMount(businessId) {
268714
268877
  ].join("\n");
268715
268878
  }
268716
268879
  function l10nFiles(dir) {
268717
- const l10n = join188(dir, "l10n");
268718
- return existsSync145(l10n) ? readdirSync60(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : [];
268880
+ const l10n = join189(dir, "l10n");
268881
+ return existsSync146(l10n) ? readdirSync61(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : [];
268719
268882
  }
268720
268883
  function translateShareLabel(dir) {
268721
- const l10n = join188(dir, "l10n"), written = [];
268884
+ const l10n = join189(dir, "l10n"), written = [];
268722
268885
  for (const file2 of l10nFiles(dir)) {
268723
268886
  const locale = file2.replace(/\.json$/, ""), translation = INVITE_SHARE_TRANSLATIONS[locale];
268724
- const next = translation ? withTranslationRow(readFileSync173(join188(l10n, file2), "utf8"), { source: INVITE_SHARE_LABEL, key: INVITE_SHARE_KEY }, translation) : void 0;
268887
+ const next = translation ? withTranslationRow(readFileSync174(join189(l10n, file2), "utf8"), { source: INVITE_SHARE_LABEL, key: INVITE_SHARE_KEY }, translation) : void 0;
268725
268888
  if (next === void 0) continue;
268726
268889
  writeNoFollow(dir, `l10n/${file2}`, next);
268727
268890
  written.push(locale);
@@ -268786,8 +268949,8 @@ function provisionInviteFlow(dir, facts, dryRun = false) {
268786
268949
  const navRel = navName && BUNDLE_NAME.test(navName) ? `tier5-src/${navName}/index.ts` : void 0;
268787
268950
  const workerRel = `tier5-src/${INVITE_BUNDLE}/index.ts`;
268788
268951
  for (const rel2 of [workerRel, "config.ts", "dev/index.ts", ...navRel ? [navRel] : []]) assertNoSymlink(dir, rel2);
268789
- const navSource = navRel && existsSync145(join188(dir, navRel)) ? readFileSync173(join188(dir, navRel), "utf8") : void 0;
268790
- const workerExists = existsSync145(join188(dir, workerRel));
268952
+ const navSource = navRel && existsSync146(join189(dir, navRel)) ? readFileSync174(join189(dir, navRel), "utf8") : void 0;
268953
+ const workerExists = existsSync146(join189(dir, workerRel));
268791
268954
  const mounted = navSource?.includes(NAV_MARKER) === true;
268792
268955
  const nav = navRel && navSource !== void 0 ? { rel: navRel, text: mounted ? navSource : `${navSource.replace(/\s*$/, "\n")}${inviteNavMount(businessId)}` } : void 0;
268793
268956
  const wrote = ["dev/index.ts", "config.ts", ...workerExists ? [] : [workerRel], ...nav && !mounted ? [nav.rel] : []];
@@ -268795,7 +268958,7 @@ function provisionInviteFlow(dir, facts, dryRun = false) {
268795
268958
  for (const file2 of l10nFiles(dir)) assertNoSymlink(dir, `l10n/${file2}`);
268796
268959
  if (!workerExists) writeNoFollow(dir, workerRel, inviteWorkerSource(businessId));
268797
268960
  if (nav && !mounted) writeNoFollow(dir, nav.rel, nav.text);
268798
- const config = readFileSync173(join188(dir, "config.ts"), "utf8");
268961
+ const config = readFileSync174(join189(dir, "config.ts"), "utf8");
268799
268962
  const next = nav ? withNavCapabilities(config) : void 0;
268800
268963
  if (next !== void 0 && next !== config) writeNoFollow(dir, "config.ts", next);
268801
268964
  for (const locale of translateShareLabel(dir)) wrote.push(`l10n/${locale}.json`);
@@ -268833,8 +268996,8 @@ var init_invite_flow = __esm({
268833
268996
  });
268834
268997
 
268835
268998
  // src/one-app/provision.ts
268836
- import { existsSync as existsSync146, readdirSync as readdirSync61, readFileSync as readFileSync174, writeFileSync as writeFileSync69 } from "node:fs";
268837
- import { join as join189, resolve as resolve119 } from "node:path";
268999
+ import { existsSync as existsSync147, readdirSync as readdirSync62, readFileSync as readFileSync175, writeFileSync as writeFileSync70 } from "node:fs";
269000
+ import { join as join190, resolve as resolve119 } from "node:path";
268838
269001
  import ts26 from "typescript";
268839
269002
  function rootOnAppear2(descriptor) {
268840
269003
  const modifiers = obj12(obj12(descriptor.payload).modifiers);
@@ -268865,20 +269028,20 @@ function nativeTabBar(configSource) {
268865
269028
  ${" ".repeat(indent)}"presentation": "native",${configSource.slice(at2)}` };
268866
269029
  }
268867
269030
  function provisionTabBar(dir, dryRun = false) {
268868
- const configPath = join189(dir, "config.ts");
268869
- const result = existsSync146(configPath) ? nativeTabBar(readFileSync174(configPath, "utf8")) : void 0;
269031
+ const configPath = join190(dir, "config.ts");
269032
+ const result = existsSync147(configPath) ? nativeTabBar(readFileSync175(configPath, "utf8")) : void 0;
268870
269033
  if (!result) return { status: "absent" };
268871
269034
  if (!result.fixed) return { status: "unchanged", presentation: result.presentation };
268872
- if (!dryRun) writeFileSync69(configPath, result.fixed, "utf8");
269035
+ if (!dryRun) writeFileSync70(configPath, result.fixed, "utf8");
268873
269036
  return { status: "set", presentation: "native" };
268874
269037
  }
268875
269038
  function provisionSiteBinding(dir, binding2, dryRun = false) {
268876
- const configPath = join189(dir, "config.ts");
268877
- if (!existsSync146(configPath)) return { status: "absent", reason: "no config.ts" };
269039
+ const configPath = join190(dir, "config.ts");
269040
+ if (!existsSync147(configPath)) return { status: "absent", reason: "no config.ts" };
268878
269041
  if (!binding2.metaSiteId || !GUID2.test(binding2.metaSiteId) || !binding2.siteUrl) {
268879
269042
  return { status: "unverified", reason: "the collection has no verified source site id and URL; the auth is left as it is" };
268880
269043
  }
268881
- const source2 = readFileSync174(configPath, "utf8");
269044
+ const source2 = readFileSync175(configPath, "utf8");
268882
269045
  const file2 = ts26.createSourceFile("config.ts", source2, ts26.ScriptTarget.Latest, true, ts26.ScriptKind.TS);
268883
269046
  let argument;
268884
269047
  const visit = (node3) => {
@@ -268910,7 +269073,7 @@ ${indent}${indent}siteUrl: ${JSON.stringify(binding2.siteUrl)},
268910
269073
  ${indent}${indent}bootAsVisitor: true,
268911
269074
  ${indent}${indent}preserveVisitorOnSignOut: true,
268912
269075
  ${indent}}`;
268913
- if (!dryRun) writeFileSync69(configPath, `${source2.slice(0, argument.getStart(file2))}${literal3}${source2.slice(argument.getEnd())}`, "utf8");
269076
+ if (!dryRun) writeFileSync70(configPath, `${source2.slice(0, argument.getStart(file2))}${literal3}${source2.slice(argument.getEnd())}`, "utf8");
268914
269077
  return { status: "set" };
268915
269078
  }
268916
269079
  function inboxEntriesInConfig(configSource) {
@@ -268976,7 +269139,7 @@ function provisionChatTarget(dir, memberChat, dryRun = false) {
268976
269139
  if (!config.sites.length && !screens.length) return { status: "absent", reason: "config.ts has no top-bar chat action yet; run `himi one-app header-badges`, then provision again" };
268977
269140
  if (!doors.length) return { status: "unchanged" };
268978
269141
  if (!dryRun) {
268979
- if (config.fixed) writeFileSync69(join189(dir, "config.ts"), config.fixed, "utf8");
269142
+ if (config.fixed) writeFileSync70(join190(dir, "config.ts"), config.fixed, "utf8");
268980
269143
  for (const id of screens) {
268981
269144
  const route = parseApp(readAppSources(dir).dev, readAppSources(dir).config).routes.find((r3) => r3.kind === "screen" && r3.label === id);
268982
269145
  const descriptor = parseEntry(readAppSources(dir).dev.slice(route.lineStart, route.end), id);
@@ -269020,12 +269183,12 @@ function provisionScreenNames(dir, displayName3, dryRun = false) {
269020
269183
  }
269021
269184
  function provisionAppName(dir, displayName3, dryRun = false) {
269022
269185
  const slug = readContentManifest(dir)?.name;
269023
- const configPath = join189(dir, "config.ts");
269186
+ const configPath = join190(dir, "config.ts");
269024
269187
  if (!displayName3?.trim()) return { status: "unverified", reason: "the collection has no business display name; config.ts keeps its name" };
269025
- if (typeof slug !== "string" || !existsSync146(configPath)) return { status: "unverified", reason: "no app slug in himalaya.content.json or no config.ts to rename" };
269026
- const correction = fixAppName(readFileSync174(configPath, "utf8"), slug, displayName3);
269188
+ if (typeof slug !== "string" || !existsSync147(configPath)) return { status: "unverified", reason: "no app slug in himalaya.content.json or no config.ts to rename" };
269189
+ const correction = fixAppName(readFileSync175(configPath, "utf8"), slug, displayName3);
269027
269190
  if (!correction) return { status: "unchanged" };
269028
- if (!dryRun) writeFileSync69(configPath, correction.fixed, "utf8");
269191
+ if (!dryRun) writeFileSync70(configPath, correction.fixed, "utf8");
269029
269192
  return { status: "set", from: correction.current, to: displayName3.trim() };
269030
269193
  }
269031
269194
  function readEntry(dir, screenId) {
@@ -269058,19 +269221,19 @@ function applyScreenParams(dir, screenId, params, dryRun = false, remove = []) {
269058
269221
  return "set";
269059
269222
  }
269060
269223
  function provisionInviteDrawer(dir, showsInvite, dryRun = false, flowPlanned = false) {
269061
- const configPath = join189(dir, "config.ts");
269062
- if (!existsSync146(configPath)) return { status: "absent", reason: "no config.ts to add the Invite row to" };
269063
- const result = applyInviteDrawer(readFileSync174(configPath, "utf8"), showsInvite, flowPlanned);
269224
+ const configPath = join190(dir, "config.ts");
269225
+ if (!existsSync147(configPath)) return { status: "absent", reason: "no config.ts to add the Invite row to" };
269226
+ const result = applyInviteDrawer(readFileSync175(configPath, "utf8"), showsInvite, flowPlanned);
269064
269227
  const translated2 = [];
269065
269228
  if (result.rowPresent) {
269066
- const l10n = join189(dir, "l10n");
269067
- for (const file2 of existsSync146(l10n) ? readdirSync61(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : []) {
269068
- const next = withInviteTranslation(readFileSync174(join189(l10n, file2), "utf8"), file2.replace(/\.json$/, ""));
269229
+ const l10n = join190(dir, "l10n");
269230
+ for (const file2 of existsSync147(l10n) ? readdirSync62(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : []) {
269231
+ const next = withInviteTranslation(readFileSync175(join190(l10n, file2), "utf8"), file2.replace(/\.json$/, ""));
269069
269232
  if (next === void 0) continue;
269070
269233
  translated2.push(file2.replace(/\.json$/, ""));
269071
- if (!dryRun) writeFileSync69(join189(l10n, file2), next, "utf8");
269234
+ if (!dryRun) writeFileSync70(join190(l10n, file2), next, "utf8");
269072
269235
  }
269073
- if (result.status === "set" && !dryRun) writeFileSync69(configPath, result.text, "utf8");
269236
+ if (result.status === "set" && !dryRun) writeFileSync70(configPath, result.text, "utf8");
269074
269237
  }
269075
269238
  return { status: result.status, ...result.reason ? { reason: result.reason } : {}, ...translated2.length ? { translated: translated2 } : {} };
269076
269239
  }
@@ -269204,8 +269367,8 @@ var init_provision = __esm({
269204
269367
  });
269205
269368
 
269206
269369
  // src/one-app/apply-navigation.ts
269207
- import { existsSync as existsSync147, readFileSync as readFileSync175 } from "node:fs";
269208
- import { join as join190 } from "node:path";
269370
+ import { existsSync as existsSync148, readFileSync as readFileSync176 } from "node:fs";
269371
+ import { join as join191 } from "node:path";
269209
269372
  import ts27 from "typescript";
269210
269373
  function pagesWithoutScreen(plan, planned2) {
269211
269374
  const have = new Map((plan.pages ?? []).map((page) => [page.layoutItemId, page]));
@@ -269304,7 +269467,7 @@ function stringOf(node3) {
269304
269467
  }
269305
269468
  function definedScreens(contentDir2) {
269306
269469
  try {
269307
- const manifest2 = JSON.parse(readFileSync175(join190(contentDir2, "himalaya.content.json"), "utf8"));
269470
+ const manifest2 = JSON.parse(readFileSync176(join191(contentDir2, "himalaya.content.json"), "utf8"));
269308
269471
  return new Set(Object.keys(manifest2.screens ?? {}));
269309
269472
  } catch {
269310
269473
  return void 0;
@@ -269340,10 +269503,10 @@ async function runOneAppApplyNavigation(args, io2) {
269340
269503
  return 2;
269341
269504
  }
269342
269505
  const contentDir2 = options2.contentDir;
269343
- const tabsPath = options2.tabs ?? tabsFileOf(join190(options2.evidenceDir, "gen", "screens.json"));
269506
+ const tabsPath = options2.tabs ?? tabsFileOf(join191(options2.evidenceDir, "gen", "screens.json"));
269344
269507
  let plan;
269345
269508
  try {
269346
- plan = JSON.parse(readFileSync175(tabsPath, "utf8"));
269509
+ plan = JSON.parse(readFileSync176(tabsPath, "utf8"));
269347
269510
  if (plan.version !== 1 || !Array.isArray(plan.tabs) || !Array.isArray(plan.moreRows)) throw new Error("not a generated tabs file");
269348
269511
  } catch {
269349
269512
  return report6(io2, false, { code: "tabs_unavailable", error: `${tabsPath} is missing or unreadable: run \`himi one-app generate\` first, and \`himi template screens --upsert\` with its screens.` });
@@ -269379,9 +269542,9 @@ async function runOneAppApplyNavigation(args, io2) {
269379
269542
  error: "A tab opens a screen this app does not define. Write the generated screens first (`himi template screens --upsert --from .himi/one-app/gen/screens.json`) and keep any template screen a tab opens; no tab is written for a screen that is not there."
269380
269543
  });
269381
269544
  }
269382
- const configPath = join190(contentDir2, "config.ts");
269383
- if (!existsSync147(configPath)) return report6(io2, false, { code: "content_invalid", error: `${configPath} not found.` });
269384
- const edit = applyNavigationToConfig(readFileSync175(configPath, "utf8"), plan);
269545
+ const configPath = join191(contentDir2, "config.ts");
269546
+ if (!existsSync148(configPath)) return report6(io2, false, { code: "content_invalid", error: `${configPath} not found.` });
269547
+ const edit = applyNavigationToConfig(readFileSync176(configPath, "utf8"), plan);
269385
269548
  if (edit.status === "kept") return report6(io2, false, { code: "config_unwritable", error: edit.reason, tabs: plan.tabs });
269386
269549
  if (edit.status === "set" && !options2.dryRun) writeFileAtomic(configPath, edit.source);
269387
269550
  const icons = plan.tabs.filter((tab) => tab.layoutItemId !== "(more)").map((tab) => ({ tab: tab.label, source: tab.icon ?? null, ...tabIcon(tab.icon) }));
@@ -269442,8 +269605,8 @@ var init_apply_navigation = __esm({
269442
269605
  });
269443
269606
 
269444
269607
  // src/one-app/starter-keep-list.ts
269445
- import { existsSync as existsSync148, readFileSync as readFileSync176, writeFileSync as writeFileSync70 } from "node:fs";
269446
- import { join as join191 } from "node:path";
269608
+ import { existsSync as existsSync149, readFileSync as readFileSync177, writeFileSync as writeFileSync71 } from "node:fs";
269609
+ import { join as join192 } from "node:path";
269447
269610
  import ts28 from "typescript";
269448
269611
  function screensOpenedBy(node3, found = /* @__PURE__ */ new Set()) {
269449
269612
  if (Array.isArray(node3)) {
@@ -269479,7 +269642,7 @@ function seedKeepList(facts) {
269479
269642
  }
269480
269643
  function loadStarter(dir) {
269481
269644
  try {
269482
- const dev = readFileSync176(join191(dir, "dev", "index.ts"), "utf8"), config = readFileSync176(join191(dir, "config.ts"), "utf8");
269645
+ const dev = readFileSync177(join192(dir, "dev", "index.ts"), "utf8"), config = readFileSync177(join192(dir, "config.ts"), "utf8");
269483
269646
  const workers = listWorkers(dir);
269484
269647
  return { sources: { dev, config, workerDirs: workers.dirs, workerFiles: workers.files }, app: parseApp(dev, config), moduleTargets: /* @__PURE__ */ new Map() };
269485
269648
  } catch (error) {
@@ -269672,19 +269835,19 @@ function workerOpenedScreens(dir, workerSources) {
269672
269835
  return runtimeTargets(starter, workerSources).map((id) => ({ id, why: MODULE_NOTE }));
269673
269836
  }
269674
269837
  function writeStarterKeepList(contentDir2, facts) {
269675
- const path2 = join191(contentDir2, "SPEC.md");
269676
- const created = !existsSync148(path2);
269838
+ const path2 = join192(contentDir2, "SPEC.md");
269839
+ const created = !existsSync149(path2);
269677
269840
  const starter = loadStarter(contentDir2);
269678
269841
  const template = facts.template.flatMap((id) => facts.generated.includes(id) || !starter ? [id] : routeLabel(starter.app, id) ?? []);
269679
269842
  const seed2 = [...seedKeepList({ ...facts, template }), ...workerOpenedScreens(contentDir2, facts.workers ?? [])];
269680
269843
  const excluded2 = closureExcludes(facts.storefront);
269681
269844
  const wanted = new Set(seed2.map((row2) => row2.id));
269682
- const pruned = created ? { text: SPEC_TEMPLATE, dropped: [] } : dropSelfWrittenRows(readFileSync176(path2, "utf8"), new Set(excluded2.filter((id) => !wanted.has(id))));
269845
+ const pruned = created ? { text: SPEC_TEMPLATE, dropped: [] } : dropSelfWrittenRows(readFileSync177(path2, "utf8"), new Set(excluded2.filter((id) => !wanted.has(id))));
269683
269846
  const spec = pruned.text;
269684
269847
  const existing = specScreens(spec), mine = selfWrittenRows(spec);
269685
269848
  const closure = closeOverTrim(contentDir2, [...seed2.map((row2) => row2.id), ...existing.filter((id) => !mine.has(id))], facts.generated, existing, excluded2);
269686
269849
  const { text: text30, added } = mergeCatalogue(spec, [...seed2, ...closure]);
269687
- if (created || added.length || pruned.dropped.length) writeFileSync70(path2, text30, "utf8");
269850
+ if (created || added.length || pruned.dropped.length) writeFileSync71(path2, text30, "utf8");
269688
269851
  return { path: path2, created, added, closure };
269689
269852
  }
269690
269853
  var MODULE_NOTE, ACCOUNT_CORE, CATALOGUE_ID, WORKER_OPEN2, TABLE_LIMIT, maskComments, HEADER4, tableRow, SELF_NOTE;
@@ -269710,15 +269873,15 @@ var init_starter_keep_list = __esm({
269710
269873
  });
269711
269874
 
269712
269875
  // src/one-app/generate-cli.ts
269713
- import { existsSync as existsSync149, mkdirSync as mkdirSync64, readdirSync as readdirSync62, readFileSync as readFileSync177, rmSync as rmSync43, writeFileSync as writeFileSync71 } from "node:fs";
269714
- import { dirname as dirname83, join as join192, resolve as resolve120 } from "node:path";
269876
+ import { existsSync as existsSync150, mkdirSync as mkdirSync65, readdirSync as readdirSync63, readFileSync as readFileSync178, rmSync as rmSync44, writeFileSync as writeFileSync72 } from "node:fs";
269877
+ import { dirname as dirname83, join as join193, resolve as resolve120 } from "node:path";
269715
269878
  function removeStaleGeneratedWorkers(contentDir2, current) {
269716
- const root = join192(contentDir2, "tier5-src");
269717
- if (!existsSync149(root)) return;
269718
- for (const name of readdirSync62(root)) {
269879
+ const root = join193(contentDir2, "tier5-src");
269880
+ if (!existsSync150(root)) return;
269881
+ for (const name of readdirSync63(root)) {
269719
269882
  if (current.has(name) || name === "_shared") continue;
269720
- const index = join192(root, name, "index.ts");
269721
- if (existsSync149(index) && readFileSync177(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync43(join192(root, name), { recursive: true, force: true });
269883
+ const index = join193(root, name, "index.ts");
269884
+ if (existsSync150(index) && readFileSync178(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync44(join193(root, name), { recursive: true, force: true });
269722
269885
  }
269723
269886
  }
269724
269887
  function parseArgs5(args) {
@@ -269740,11 +269903,11 @@ function parseArgs5(args) {
269740
269903
  }
269741
269904
  }
269742
269905
  if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
269743
- return { evidenceDir: resolve120(evidenceDir), contentDir: resolve120(contentDir2), out: resolve120(out2 ?? join192(evidenceDir, "gen", "screens.json")) };
269906
+ return { evidenceDir: resolve120(evidenceDir), contentDir: resolve120(contentDir2), out: resolve120(out2 ?? join193(evidenceDir, "gen", "screens.json")) };
269744
269907
  }
269745
269908
  function claimedHome(out2) {
269746
269909
  try {
269747
- return JSON.parse(readFileSync177(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
269910
+ return JSON.parse(readFileSync178(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
269748
269911
  } catch {
269749
269912
  return false;
269750
269913
  }
@@ -269752,7 +269915,7 @@ function claimedHome(out2) {
269752
269915
  function previousOutput(out2) {
269753
269916
  const keys2 = (path2) => {
269754
269917
  try {
269755
- const value2 = JSON.parse(readFileSync177(path2, "utf8"));
269918
+ const value2 = JSON.parse(readFileSync178(path2, "utf8"));
269756
269919
  return Array.isArray(value2) ? value2.filter((v2) => typeof v2 === "string") : value2 && typeof value2 === "object" ? Object.keys(value2) : [];
269757
269920
  } catch {
269758
269921
  return [];
@@ -269790,7 +269953,7 @@ async function runOneAppGenerate(args, io2) {
269790
269953
  }
269791
269954
  const fetchedAt = (() => {
269792
269955
  try {
269793
- const m2 = JSON.parse(readFileSync177(join192(options2.evidenceDir, "manifest.json"), "utf8"));
269956
+ const m2 = JSON.parse(readFileSync178(join193(options2.evidenceDir, "manifest.json"), "utf8"));
269794
269957
  return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
269795
269958
  } catch {
269796
269959
  return void 0;
@@ -269800,7 +269963,7 @@ async function runOneAppGenerate(args, io2) {
269800
269963
  let homeScreenId;
269801
269964
  const previousIds = previousOutput(options2.out);
269802
269965
  try {
269803
- const manifest2 = JSON.parse(readFileSync177(join192(options2.contentDir, "himalaya.content.json"), "utf8"));
269966
+ const manifest2 = JSON.parse(readFileSync178(join193(options2.contentDir, "himalaya.content.json"), "utf8"));
269804
269967
  taken2 = new Set(Object.keys(manifest2.screens ?? {}));
269805
269968
  if (taken2.has(TEMPLATE_HOME_SCREEN) && (!previousIds.includes(TEMPLATE_HOME_SCREEN) || claimedHome(options2.out))) homeScreenId = TEMPLATE_HOME_SCREEN;
269806
269969
  for (const id of previousIds) taken2.delete(id);
@@ -269809,24 +269972,24 @@ async function runOneAppGenerate(args, io2) {
269809
269972
  }
269810
269973
  let result;
269811
269974
  try {
269812
- result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken2, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync149(join192(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
269975
+ result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken2, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync150(join193(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
269813
269976
  } catch (error) {
269814
269977
  if (error instanceof RecipeError) return report7(io2, false, { code: "recipe_unavailable", error: error.message });
269815
269978
  throw error;
269816
269979
  }
269817
269980
  try {
269818
- mkdirSync64(dirname83(options2.out), { recursive: true });
269819
- writeFileSync71(options2.out, JSON.stringify(result.screens, null, 2) + "\n", "utf8");
269820
- writeFileSync71(idsFile(options2.out), JSON.stringify([.../* @__PURE__ */ new Set([...previousIds, ...Object.keys(result.screens)])].sort()) + "\n", "utf8");
269821
- if (homeScreenId) writeFileSync71(homeFile(options2.out), JSON.stringify({ homeScreenId }) + "\n", "utf8");
269981
+ mkdirSync65(dirname83(options2.out), { recursive: true });
269982
+ writeFileSync72(options2.out, JSON.stringify(result.screens, null, 2) + "\n", "utf8");
269983
+ writeFileSync72(idsFile(options2.out), JSON.stringify([.../* @__PURE__ */ new Set([...previousIds, ...Object.keys(result.screens)])].sort()) + "\n", "utf8");
269984
+ if (homeScreenId) writeFileSync72(homeFile(options2.out), JSON.stringify({ homeScreenId }) + "\n", "utf8");
269822
269985
  const tabsPath = tabsFileOf(options2.out);
269823
269986
  const tabs = tabsFile(result, navigation);
269824
- if (tabs) writeFileSync71(tabsPath, JSON.stringify(tabs, null, 2) + "\n", "utf8");
269825
- else rmSync43(tabsPath, { force: true });
269987
+ if (tabs) writeFileSync72(tabsPath, JSON.stringify(tabs, null, 2) + "\n", "utf8");
269988
+ else rmSync44(tabsPath, { force: true });
269826
269989
  for (const worker of Object.values(result.workers)) {
269827
- const dir = join192(options2.contentDir, "tier5-src", worker.bundle);
269828
- mkdirSync64(dir, { recursive: true });
269829
- writeFileSync71(join192(dir, "index.ts"), worker.source, "utf8");
269990
+ const dir = join193(options2.contentDir, "tier5-src", worker.bundle);
269991
+ mkdirSync65(dir, { recursive: true });
269992
+ writeFileSync72(join193(dir, "index.ts"), worker.source, "utf8");
269830
269993
  }
269831
269994
  removeStaleGeneratedWorkers(options2.contentDir, new Set(Object.values(result.workers).map((w2) => w2.bundle)));
269832
269995
  } catch (error) {
@@ -269868,7 +270031,7 @@ async function runOneAppGenerate(args, io2) {
269868
270031
  }
269869
270032
  let keepList;
269870
270033
  try {
269871
- const manifest2 = JSON.parse(readFileSync177(join192(options2.evidenceDir, "manifest.json"), "utf8"));
270034
+ const manifest2 = JSON.parse(readFileSync178(join193(options2.evidenceDir, "manifest.json"), "utf8"));
269872
270035
  const badgePlan = readHashedEvidenceJson(options2.evidenceDir, "header-badge-plan.json");
269873
270036
  const generated = Object.keys(result.screens);
269874
270037
  const routed = result.routes.flatMap((route) => route.kind === "template" && route.screenId ? [route.screenId] : []);
@@ -269921,7 +270084,7 @@ var init_generate_cli = __esm({
269921
270084
 
269922
270085
  // src/one-app/access.ts
269923
270086
  import ts29 from "typescript";
269924
- import { createHash as createHash93 } from "node:crypto";
270087
+ import { createHash as createHash94 } from "node:crypto";
269925
270088
  function gateKey(layoutItemId) {
269926
270089
  let out2 = "g_";
269927
270090
  for (const char of layoutItemId.toLowerCase()) out2 += char >= "a" && char <= "z" || char >= "0" && char <= "9" ? char : "_";
@@ -269980,7 +270143,7 @@ function planAccess(raw, screens, previous = []) {
269980
270143
  for (const gate of gates.filter((item2) => !written.has(item2.layoutItemId))) byKey.set(gate.key, [...byKey.get(gate.key) ?? [], gate]);
269981
270144
  for (const [key4, group] of byKey) {
269982
270145
  if (group.length < 2 && !writtenKeys.has(key4)) continue;
269983
- for (const gate of group) gate.key = `${key4}_${createHash93("sha256").update(gate.layoutItemId).digest("hex").slice(0, 10)}`;
270146
+ for (const gate of group) gate.key = `${key4}_${createHash94("sha256").update(gate.layoutItemId).digest("hex").slice(0, 10)}`;
269984
270147
  warnings.push(`layout items ${group.map((gate) => gate.layoutItemId).join(", ")} normalize to a gate key another page has: each gets a hash suffix`);
269985
270148
  }
269986
270149
  if (new Set(gates.map((gate) => gate.key)).size !== gates.length) throw new Error("two layout items still share a gate key after the hash suffix: rename one in the source");
@@ -270393,9 +270556,9 @@ ${indent}`);
270393
270556
  });
270394
270557
 
270395
270558
  // src/one-app/access-cli.ts
270396
- import { createHash as createHash94 } from "node:crypto";
270397
- import { existsSync as existsSync150, readFileSync as readFileSync178, rmSync as rmSync44, statSync as statSync48, writeFileSync as writeFileSync72 } from "node:fs";
270398
- import { join as join193, resolve as resolve121 } from "node:path";
270559
+ import { createHash as createHash95 } from "node:crypto";
270560
+ import { existsSync as existsSync151, readFileSync as readFileSync179, rmSync as rmSync45, statSync as statSync48, writeFileSync as writeFileSync73 } from "node:fs";
270561
+ import { join as join194, resolve as resolve121 } from "node:path";
270399
270562
  function parseArgs6(args) {
270400
270563
  let evidenceDir;
270401
270564
  let contentDir2;
@@ -270466,7 +270629,7 @@ function parseArgs6(args) {
270466
270629
  if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
270467
270630
  if (dryRun && check) throw new Error("--dry-run and --check are different modes: pass one.");
270468
270631
  if (screensFile) {
270469
- const parsed = JSON.parse(readFileSync178(resolve121(screensFile), "utf8"));
270632
+ const parsed = JSON.parse(readFileSync179(resolve121(screensFile), "utf8"));
270470
270633
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("--screens-file must hold a JSON object of layoutItemId: screenId.");
270471
270634
  for (const [key4, item2] of Object.entries(parsed)) {
270472
270635
  if (typeof item2 !== "string" || !item2) throw new Error(`--screens-file: ${key4} must map to a screen id.`);
@@ -270483,7 +270646,7 @@ function report8(io2, ok5, body) {
270483
270646
  function businessTitleOf(evidenceDir, given) {
270484
270647
  if (given) return given;
270485
270648
  try {
270486
- const context = JSON.parse(readFileSync178(join193(evidenceDir, "business-context.json"), "utf8"));
270649
+ const context = JSON.parse(readFileSync179(join194(evidenceDir, "business-context.json"), "utf8"));
270487
270650
  if (typeof context.displayName === "string" && context.displayName.trim()) return context.displayName.trim();
270488
270651
  } catch {
270489
270652
  }
@@ -270526,11 +270689,11 @@ function mapCoverage2(options2, plan, raw) {
270526
270689
  return { mapped, kept, conflicts, text: mapped ? JSON.stringify(coverage2, null, 2) + "\n" : void 0 };
270527
270690
  }
270528
270691
  function recordedLoginPolicy(evidenceDir) {
270529
- const manifest2 = JSON.parse(readFileSync178(join193(evidenceDir, "manifest.json"), "utf8"));
270692
+ const manifest2 = JSON.parse(readFileSync179(join194(evidenceDir, "manifest.json"), "utf8"));
270530
270693
  const expected = manifest2.sha256?.["access-policy.json"];
270531
270694
  if (expected === void 0) return void 0;
270532
- const bytes2 = readFileSync178(join193(evidenceDir, "access-policy.json"));
270533
- if (createHash94("sha256").update(bytes2).digest("hex") !== expected) throw new Error("access-policy.json does not match the hash recorded in manifest.json.");
270695
+ const bytes2 = readFileSync179(join194(evidenceDir, "access-policy.json"));
270696
+ if (createHash95("sha256").update(bytes2).digest("hex") !== expected) throw new Error("access-policy.json does not match the hash recorded in manifest.json.");
270534
270697
  const value2 = JSON.parse(bytes2.toString("utf8")).visitorModeEnabled;
270535
270698
  return typeof value2 === "boolean" ? value2 : void 0;
270536
270699
  }
@@ -270555,8 +270718,8 @@ async function runOneAppAccess(args, io2) {
270555
270718
  let unverifiedPlatforms;
270556
270719
  let raw;
270557
270720
  let recorded;
270558
- const tablePath = join193(options2.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
270559
- const tableBefore = existsSync150(tablePath) ? readFileSync178(tablePath, "utf8") : void 0;
270721
+ const tablePath = join194(options2.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
270722
+ const tableBefore = existsSync151(tablePath) ? readFileSync179(tablePath, "utf8") : void 0;
270560
270723
  const writtenGates = tableBefore === void 0 ? [] : tableGates(tableBefore);
270561
270724
  const written = writtenGates ?? [];
270562
270725
  try {
@@ -270571,16 +270734,16 @@ async function runOneAppAccess(args, io2) {
270571
270734
  }
270572
270735
  const common2 = { unmapped: plan.unmapped, warnings: plan.warnings, ...unverifiedPlatforms.length ? { unverifiedPlatforms } : {} };
270573
270736
  const decision = loginWallOf(options2, recorded);
270574
- const configPath = join193(options2.contentDir, "config.ts");
270575
- const screensPath = join193(options2.contentDir, "dev", "index.ts");
270576
- const enginePath = join193(options2.contentDir, "tier5-src", "_shared", "access-gates.ts");
270577
- const workerPath = join193(options2.contentDir, "tier5-src", ACCESS_NAV_BUNDLE, "index.ts");
270737
+ const configPath = join194(options2.contentDir, "config.ts");
270738
+ const screensPath = join194(options2.contentDir, "dev", "index.ts");
270739
+ const enginePath = join194(options2.contentDir, "tier5-src", "_shared", "access-gates.ts");
270740
+ const workerPath = join194(options2.contentDir, "tier5-src", ACCESS_NAV_BUNDLE, "index.ts");
270578
270741
  let configText;
270579
270742
  let screensText;
270580
270743
  try {
270581
270744
  for (const path2 of [configPath, screensPath]) if (!statSync48(path2).isFile()) throw new Error(`${path2} is not a file.`);
270582
- configText = readFileSync178(configPath, "utf8");
270583
- screensText = readFileSync178(screensPath, "utf8");
270745
+ configText = readFileSync179(configPath, "utf8");
270746
+ screensText = readFileSync179(screensPath, "utf8");
270584
270747
  } catch (error) {
270585
270748
  return report8(io2, false, { code: "app_uninspectable", error: `${errorText(error)} --content must be a Himi content package with config.ts and dev/index.ts.`, ...common2 });
270586
270749
  }
@@ -270613,7 +270776,7 @@ async function runOneAppAccess(args, io2) {
270613
270776
  error: `A locked page is mapped to another screen than the app carries: ${moved.map((m2) => `${m2.layoutItemId} was ${m2.from}, now ${m2.to}`).join("; ")}. The old screen is still wrapped in its lock: restore its original payload (the screen inside the lock's open case) and remove its gate by hand, or keep the earlier mapping.`
270614
270777
  });
270615
270778
  }
270616
- if (hasGates && (!existsSync150(enginePath) || !existsSync150(workerPath))) {
270779
+ if (hasGates && (!existsSync151(enginePath) || !existsSync151(workerPath))) {
270617
270780
  return report8(io2, false, {
270618
270781
  code: "access_engine_missing",
270619
270782
  gates: plan.gates,
@@ -270704,25 +270867,25 @@ async function runOneAppAccess(args, io2) {
270704
270867
  return outOfSync.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync, ...summary2, error: "The app does not carry the source's locked pages and login requirement as they are now: run `himi one-app access` without --check." }) : plan.unmapped.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync: [], ...summary2, error: "A locked page has no Himi screen yet, so the app does not carry it: map it with --screen and run `himi one-app access`." }) : report8(io2, true, { status: "in_sync", ...summary2 });
270705
270868
  }
270706
270869
  if (!options2.dryRun) {
270707
- const ledgerPath = join193(options2.contentDir, COVERAGE_FILE);
270870
+ const ledgerPath = join194(options2.contentDir, COVERAGE_FILE);
270708
270871
  const writes = [
270709
270872
  ...hasGates ? [{ path: tablePath, before: tableBefore, after: table }] : [],
270710
270873
  { path: configPath, before: configText, after: nextConfig },
270711
270874
  ...screensEdit?.status === "written" ? [{ path: screensPath, before: screensText, after: screensEdit.text }] : [],
270712
- ...coverage2.text ? [{ path: ledgerPath, before: existsSync150(ledgerPath) ? readFileSync178(ledgerPath, "utf8") : void 0, after: coverage2.text }] : []
270875
+ ...coverage2.text ? [{ path: ledgerPath, before: existsSync151(ledgerPath) ? readFileSync179(ledgerPath, "utf8") : void 0, after: coverage2.text }] : []
270713
270876
  ].filter((write3) => write3.before !== write3.after);
270714
270877
  const done = [];
270715
270878
  try {
270716
270879
  for (const write3 of writes) {
270717
270880
  done.push(write3);
270718
- writeFileSync72(write3.path, write3.after, "utf8");
270881
+ writeFileSync73(write3.path, write3.after, "utf8");
270719
270882
  }
270720
270883
  } catch (error) {
270721
270884
  const failed3 = [];
270722
270885
  for (const write3 of done.reverse()) {
270723
270886
  try {
270724
- if (write3.before === void 0) rmSync44(write3.path, { force: true });
270725
- else if (!existsSync150(write3.path) || readFileSync178(write3.path, "utf8") !== write3.before) writeFileSync72(write3.path, write3.before, "utf8");
270887
+ if (write3.before === void 0) rmSync45(write3.path, { force: true });
270888
+ else if (!existsSync151(write3.path) || readFileSync179(write3.path, "utf8") !== write3.before) writeFileSync73(write3.path, write3.before, "utf8");
270726
270889
  } catch {
270727
270890
  failed3.push(write3.path);
270728
270891
  }
@@ -270798,8 +270961,8 @@ var init_access_policy = __esm({
270798
270961
  });
270799
270962
 
270800
270963
  // src/one-app/payment-review.ts
270801
- import { readFileSync as readFileSync179 } from "node:fs";
270802
- import { join as join194, resolve as resolve122 } from "node:path";
270964
+ import { readFileSync as readFileSync180 } from "node:fs";
270965
+ import { join as join195, resolve as resolve122 } from "node:path";
270803
270966
  function preservesUnverifiedFlow(flow) {
270804
270967
  const checkout = obj14(flow.checkout);
270805
270968
  return flow.payment === "online-paid" && obj14(flow.readiness).state === "unverified" && checkout.state === "supported" && text28(checkout.evidence) && (flow.decision === void 0 || obj14(flow.decision).action === "proceed");
@@ -270888,7 +271051,7 @@ function runPaymentReview(args, io2) {
270888
271051
  const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
270889
271052
  const metaSiteId = obj14(manifest2.source).metaSiteId;
270890
271053
  if (typeof metaSiteId !== "string") throw Error("Missing site binding");
270891
- const review = JSON.parse(readFileSync179(join194(evidenceDir, "payment-review.json"), "utf8"));
271054
+ const review = JSON.parse(readFileSync180(join195(evidenceDir, "payment-review.json"), "utf8"));
270892
271055
  const issues = paymentReviewIssues(review, metaSiteId);
270893
271056
  if (issues.length) return fail16("payment_decision_required", issues, 1);
270894
271057
  const warnings = obj14(review).flows.map(obj14).filter(preservesUnverifiedFlow).map((flow) => ({
@@ -271141,10 +271304,10 @@ __export(cli_exports2, {
271141
271304
  ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
271142
271305
  runOneAppCommand: () => runOneAppCommand
271143
271306
  });
271144
- import { closeSync as closeSync14, constants as constants13, lstatSync as lstatSync40, mkdirSync as mkdirSync65, openSync as openSync13, readFileSync as readFileSync180, realpathSync as realpathSync23, writeFileSync as writeFileSync73 } from "node:fs";
271145
- import { createHash as createHash95 } from "node:crypto";
271307
+ import { closeSync as closeSync14, constants as constants13, lstatSync as lstatSync40, mkdirSync as mkdirSync66, openSync as openSync13, readFileSync as readFileSync181, realpathSync as realpathSync23, writeFileSync as writeFileSync74 } from "node:fs";
271308
+ import { createHash as createHash96 } from "node:crypto";
271146
271309
  import { isIP as isIP2 } from "node:net";
271147
- import { dirname as dirname84, join as join195, parse as parse10, resolve as resolve123 } from "node:path";
271310
+ import { dirname as dirname84, join as join196, parse as parse10, resolve as resolve123 } from "node:path";
271148
271311
  function nativeSiteHost(host) {
271149
271312
  if (isIP2(host.startsWith("[") ? host.slice(1, -1) : host)) return true;
271150
271313
  const labels = host.replace(/\.$/, "").split(".");
@@ -271215,7 +271378,7 @@ function readOptions(argv, cwd, commandIncluded) {
271215
271378
  const file2 = resolve123(cwd, flags["prompt-file"]);
271216
271379
  const stat10 = lstatSync40(file2);
271217
271380
  if (!stat10.isFile() || stat10.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
271218
- prompt2 = readFileSync180(file2, "utf8");
271381
+ prompt2 = readFileSync181(file2, "utf8");
271219
271382
  } catch {
271220
271383
  throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
271221
271384
  }
@@ -271231,7 +271394,7 @@ function readOptions(argv, cwd, commandIncluded) {
271231
271394
  throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
271232
271395
  }
271233
271396
  const parentDir = resolve123(cwd, flags.dir ?? ".");
271234
- const workspace = join195(parentDir, name);
271397
+ const workspace = join196(parentDir, name);
271235
271398
  assertSafeParents(parentDir);
271236
271399
  if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
271237
271400
  return { metaSiteId, appInstance, locale, languages, prompt: prompt2, name, parentDir, workspace, target, topTabs };
@@ -271266,7 +271429,7 @@ function assertSafeParents(path2) {
271266
271429
  function writePrivate(path2, contents, append) {
271267
271430
  const fd = openSync13(path2, constants13.O_WRONLY | constants13.O_CREAT | constants13.O_NOFOLLOW | (append ? constants13.O_APPEND : constants13.O_EXCL), 384);
271268
271431
  try {
271269
- writeFileSync73(fd, contents, { encoding: "utf8" });
271432
+ writeFileSync74(fd, contents, { encoding: "utf8" });
271270
271433
  } finally {
271271
271434
  closeSync14(fd);
271272
271435
  }
@@ -271353,7 +271516,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
271353
271516
  const hashes = {};
271354
271517
  const diskWrite = deps.writeFile ?? writePrivate;
271355
271518
  const put = (name, content) => {
271356
- const path2 = join195(evidenceDir, name);
271519
+ const path2 = join196(evidenceDir, name);
271357
271520
  try {
271358
271521
  assertSafeParents(evidenceDir);
271359
271522
  diskWrite(path2, content, false);
@@ -271361,7 +271524,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
271361
271524
  throw new OneAppError("artifact_write_failed", "Could not save the migration evidence. Existing files were kept.", { stage });
271362
271525
  }
271363
271526
  artifacts[name] = path2;
271364
- hashes[name] = createHash95("sha256").update(content).digest("hex");
271527
+ hashes[name] = createHash96("sha256").update(content).digest("hex");
271365
271528
  return path2;
271366
271529
  };
271367
271530
  const progress = (nextStage) => {
@@ -271369,7 +271532,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
271369
271532
  if (!evidenceDir) return;
271370
271533
  try {
271371
271534
  assertSafeParents(evidenceDir);
271372
- diskWrite(join195(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
271535
+ diskWrite(join196(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
271373
271536
  } catch {
271374
271537
  throw new OneAppError("artifact_write_failed", "Could not record migration progress. Existing files were kept.", { stage });
271375
271538
  }
@@ -271386,12 +271549,12 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
271386
271549
  }
271387
271550
  stage = "input";
271388
271551
  try {
271389
- mkdirSync65(options2.parentDir, { recursive: true, mode: 448 });
271552
+ mkdirSync66(options2.parentDir, { recursive: true, mode: 448 });
271390
271553
  assertSafeParents(options2.parentDir);
271391
- mkdirSync65(options2.workspace, { mode: 448 });
271554
+ mkdirSync66(options2.workspace, { mode: 448 });
271392
271555
  if (realpathSync23(options2.workspace) !== options2.workspace) throw new Error("destination changed");
271393
- evidenceDir = join195(options2.workspace, ".himi", "one-app");
271394
- mkdirSync65(evidenceDir, { recursive: true, mode: 448 });
271556
+ evidenceDir = join196(options2.workspace, ".himi", "one-app");
271557
+ mkdirSync66(evidenceDir, { recursive: true, mode: 448 });
271395
271558
  } catch (error) {
271396
271559
  if (error.code === "EEXIST") {
271397
271560
  throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
@@ -273613,15 +273776,15 @@ var init_analyze2 = __esm({
273613
273776
  });
273614
273777
 
273615
273778
  // src/site-analyze/site-pages-apply.ts
273616
- import { existsSync as existsSync151, readFileSync as readFileSync181 } from "node:fs";
273617
- import { join as join196 } from "node:path";
273779
+ import { existsSync as existsSync152, readFileSync as readFileSync182 } from "node:fs";
273780
+ import { join as join197 } from "node:path";
273618
273781
  import ts30 from "typescript";
273619
273782
  function packageScreenIds(dir) {
273620
- const dev = join196(dir, "dev", "index.ts");
273621
- const config = join196(dir, "config.ts");
273622
- if (!existsSync151(dev) || !existsSync151(config)) return void 0;
273783
+ const dev = join197(dir, "dev", "index.ts");
273784
+ const config = join197(dir, "config.ts");
273785
+ if (!existsSync152(dev) || !existsSync152(config)) return void 0;
273623
273786
  try {
273624
- const app2 = parseApp(readFileSync181(dev, "utf8"), readFileSync181(config, "utf8"));
273787
+ const app2 = parseApp(readFileSync182(dev, "utf8"), readFileSync182(config, "utf8"));
273625
273788
  return new Set(app2.routes.filter((r3) => r3.kind === "screen").map((r3) => r3.label));
273626
273789
  } catch {
273627
273790
  return void 0;
@@ -273670,12 +273833,12 @@ ${indent}`);
273670
273833
  }
273671
273834
  function applySitePagesToPackage(dir, site, opts = {}) {
273672
273835
  const none = (refused2) => ({ added: [], replaced: [], removed: [], rows: [], wrote: [], refused: refused2 });
273673
- const devPath = join196(dir, "dev", "index.ts");
273674
- const configPath = join196(dir, "config.ts");
273675
- if (!existsSync151(devPath) || !existsSync151(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
273836
+ const devPath = join197(dir, "dev", "index.ts");
273837
+ const configPath = join197(dir, "config.ts");
273838
+ if (!existsSync152(devPath) || !existsSync152(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
273676
273839
  let existing;
273677
273840
  try {
273678
- const app2 = parseApp(readFileSync181(devPath, "utf8"), readFileSync181(configPath, "utf8"));
273841
+ const app2 = parseApp(readFileSync182(devPath, "utf8"), readFileSync182(configPath, "utf8"));
273679
273842
  existing = app2.routes.filter((r3) => r3.kind === "screen" && isWebsiteScreenId(r3.label)).map((r3) => r3.label);
273680
273843
  } catch (e2) {
273681
273844
  return none(`the package is not in the plain-JSON shape \`himi init\` writes, which this step edits (${e2.message})`);
@@ -273685,21 +273848,21 @@ function applySitePagesToPackage(dir, site, opts = {}) {
273685
273848
  const removed = existing.filter((id) => !wanted.includes(id));
273686
273849
  const added = wanted.filter((id) => !existing.includes(id));
273687
273850
  const replaced = wanted.filter((id) => existing.includes(id));
273688
- const probe2 = spliceWebsiteDrawer(readFileSync181(configPath, "utf8"), site);
273851
+ const probe2 = spliceWebsiteDrawer(readFileSync182(configPath, "utf8"), site);
273689
273852
  if ("refused" in probe2) return none(probe2.refused);
273690
273853
  if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
273691
- const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync151(join196(dir, rel2)) ? readFileSync181(join196(dir, rel2), "utf8") : void 0]));
273854
+ const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync152(join197(dir, rel2)) ? readFileSync182(join197(dir, rel2), "utf8") : void 0]));
273692
273855
  try {
273693
273856
  if (removed.length) removeScreens(dir, removed);
273694
273857
  if (wanted.length) upsertScreens(dir, screens);
273695
- const spliced = spliceWebsiteDrawer(readFileSync181(configPath, "utf8"), site);
273858
+ const spliced = spliceWebsiteDrawer(readFileSync182(configPath, "utf8"), site);
273696
273859
  if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
273697
- if (spliced.source !== readFileSync181(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
273860
+ if (spliced.source !== readFileSync182(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
273698
273861
  } catch (e2) {
273699
- for (const [rel2, text30] of before) if (text30 !== void 0 && readFileSync181(join196(dir, rel2), "utf8") !== text30) writeFileAtomic(join196(dir, rel2), text30);
273862
+ for (const [rel2, text30] of before) if (text30 !== void 0 && readFileSync182(join197(dir, rel2), "utf8") !== text30) writeFileAtomic(join197(dir, rel2), text30);
273700
273863
  return none(`stopped and restored every file: ${e2.message}`);
273701
273864
  }
273702
- const wrote = [...before].filter(([rel2, text30]) => text30 !== void 0 && readFileSync181(join196(dir, rel2), "utf8") !== text30).map(([rel2]) => join196(dir, rel2));
273865
+ const wrote = [...before].filter(([rel2, text30]) => text30 !== void 0 && readFileSync182(join197(dir, rel2), "utf8") !== text30).map(([rel2]) => join197(dir, rel2));
273703
273866
  return { added, replaced, removed, rows: probe2.rows, wrote };
273704
273867
  }
273705
273868
  var ANCHOR_ROWS;
@@ -273728,9 +273891,9 @@ var init_customer_build = __esm({
273728
273891
  });
273729
273892
 
273730
273893
  // src/site-analyze/apply.ts
273731
- import { existsSync as existsSync152, readFileSync as readFileSync182, writeFileSync as writeFileSync74, copyFileSync as copyFileSync2, mkdirSync as mkdirSync66, realpathSync as realpathSync24, statSync as statSync49 } from "node:fs";
273732
- import { dirname as dirname85, isAbsolute as isAbsolute18, join as join197, resolve as resolve124, sep as sep33 } from "node:path";
273733
- import { spawnSync as spawnSync12 } from "node:child_process";
273894
+ import { existsSync as existsSync153, readFileSync as readFileSync183, writeFileSync as writeFileSync75, copyFileSync as copyFileSync2, mkdirSync as mkdirSync67, realpathSync as realpathSync24, statSync as statSync49 } from "node:fs";
273895
+ import { dirname as dirname85, isAbsolute as isAbsolute18, join as join198, resolve as resolve124, sep as sep33 } from "node:path";
273896
+ import { spawnSync as spawnSync13 } from "node:child_process";
273734
273897
  function inRepoBakeRefusal(repoRoot2, shell) {
273735
273898
  if (isBrandable(repoRoot2, shell)) return null;
273736
273899
  const alias2 = shellAliasOf(shell);
@@ -274026,16 +274189,16 @@ function sameKnownSite(previous, next) {
274026
274189
  }
274027
274190
  function buildMergedContract(options2) {
274028
274191
  const { appDir: appDir3, packageDir, overlay } = options2;
274029
- const committedPath = join197(appDir3, "provisioning.json");
274030
- if (!existsSync152(committedPath)) {
274192
+ const committedPath = join198(appDir3, "provisioning.json");
274193
+ if (!existsSync153(committedPath)) {
274031
274194
  throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
274032
274195
  }
274033
- const committed = JSON.parse(readFileSync182(committedPath, "utf8"));
274034
- const previousPath = join197(appDir3, LOCAL_CONTRACT_REL);
274196
+ const committed = JSON.parse(readFileSync183(committedPath, "utf8"));
274197
+ const previousPath = join198(appDir3, LOCAL_CONTRACT_REL);
274035
274198
  let evidenceOverlay = overlay;
274036
- if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync152(previousPath)) {
274199
+ if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync153(previousPath)) {
274037
274200
  try {
274038
- const previous = JSON.parse(readFileSync182(previousPath, "utf8"));
274201
+ const previous = JSON.parse(readFileSync183(previousPath, "utf8"));
274039
274202
  if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
274040
274203
  evidenceOverlay = {
274041
274204
  ...overlay,
@@ -274048,9 +274211,9 @@ function buildMergedContract(options2) {
274048
274211
  }
274049
274212
  }
274050
274213
  let keepSite = options2.keepSite === true;
274051
- if (!keepSite && options2.sitePageHost && existsSync152(previousPath)) {
274214
+ if (!keepSite && options2.sitePageHost && existsSync153(previousPath)) {
274052
274215
  try {
274053
- const carried = websiteSiteToCarry(JSON.parse(readFileSync182(previousPath, "utf8")), overlay);
274216
+ const carried = websiteSiteToCarry(JSON.parse(readFileSync183(previousPath, "utf8")), overlay);
274054
274217
  if (carried) {
274055
274218
  evidenceOverlay = { ...evidenceOverlay, site: carried };
274056
274219
  keepSite = true;
@@ -274069,8 +274232,8 @@ function buildMergedContract(options2) {
274069
274232
  };
274070
274233
  const stage = (fromRel, toRel) => {
274071
274234
  const from = contained(packageDir, fromRel);
274072
- const to2 = contained(join197(appDir3, STAGED), toRel.slice(STAGED.length + 1));
274073
- if (!from || !to2 || !existsSync152(from)) return void 0;
274235
+ const to2 = contained(join198(appDir3, STAGED), toRel.slice(STAGED.length + 1));
274236
+ if (!from || !to2 || !existsSync153(from)) return void 0;
274074
274237
  let real;
274075
274238
  let realRoot;
274076
274239
  try {
@@ -274082,7 +274245,7 @@ function buildMergedContract(options2) {
274082
274245
  if (!real.startsWith(realRoot + sep33)) return void 0;
274083
274246
  try {
274084
274247
  if (!statSync49(real).isFile()) return void 0;
274085
- mkdirSync66(dirname85(to2), { recursive: true });
274248
+ mkdirSync67(dirname85(to2), { recursive: true });
274086
274249
  copyFileSync2(real, to2);
274087
274250
  } catch {
274088
274251
  return void 0;
@@ -274092,11 +274255,11 @@ function buildMergedContract(options2) {
274092
274255
  };
274093
274256
  const icon = stage("media/icon.png", `${STAGED}/icon.png`);
274094
274257
  if (icon) branding.appIconPath = icon;
274095
- const facesPath = join197(packageDir, "media/fonts/faces.json");
274096
- if (existsSync152(facesPath)) {
274258
+ const facesPath = join198(packageDir, "media/fonts/faces.json");
274259
+ if (existsSync153(facesPath)) {
274097
274260
  let faces = [];
274098
274261
  try {
274099
- const parsed = JSON.parse(readFileSync182(facesPath, "utf8"));
274262
+ const parsed = JSON.parse(readFileSync183(facesPath, "utf8"));
274100
274263
  faces = Array.isArray(parsed) ? parsed : [];
274101
274264
  } catch {
274102
274265
  faces = [];
@@ -274117,11 +274280,11 @@ function buildMergedContract(options2) {
274117
274280
  merged.branding = branding;
274118
274281
  const body = `${JSON.stringify(merged, null, 2)}
274119
274282
  `;
274120
- const path2 = join197(packageDir, "provisioning.contract.json");
274121
- writeFileSync74(path2, body);
274122
- const localPath2 = join197(appDir3, LOCAL_CONTRACT_REL);
274123
- mkdirSync66(dirname85(localPath2), { recursive: true });
274124
- writeFileSync74(localPath2, body);
274283
+ const path2 = join198(packageDir, "provisioning.contract.json");
274284
+ writeFileSync75(path2, body);
274285
+ const localPath2 = join198(appDir3, LOCAL_CONTRACT_REL);
274286
+ mkdirSync67(dirname85(localPath2), { recursive: true });
274287
+ writeFileSync75(localPath2, body);
274125
274288
  staged.push(localPath2);
274126
274289
  return { path: path2, staged };
274127
274290
  }
@@ -274154,10 +274317,10 @@ function catalogTypography(overlay, template) {
274154
274317
  function staticFaqFor(overlay, overlayPath) {
274155
274318
  const own6 = overlay.faq;
274156
274319
  if (own6 !== void 0) return deriveStaticFaq(own6);
274157
- const bookPath = join197(dirname85(resolve124(overlayPath)), "book.json");
274158
- if (!existsSync152(bookPath)) return void 0;
274320
+ const bookPath = join198(dirname85(resolve124(overlayPath)), "book.json");
274321
+ if (!existsSync153(bookPath)) return void 0;
274159
274322
  try {
274160
- const book = JSON.parse(readFileSync182(bookPath, "utf8"));
274323
+ const book = JSON.parse(readFileSync183(bookPath, "utf8"));
274161
274324
  const copy = book?.copy;
274162
274325
  if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
274163
274326
  const pairs2 = deriveStaticFaq(copy.faq);
@@ -274171,10 +274334,10 @@ function staticGalleriesFor(overlay, overlayPath) {
274171
274334
  if (overlay.galleries !== void 0) return deriveStaticGalleries(
274172
274335
  overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
274173
274336
  );
274174
- const bookPath = join197(dirname85(resolve124(overlayPath)), "book.json");
274175
- if (!existsSync152(bookPath)) return void 0;
274337
+ const bookPath = join198(dirname85(resolve124(overlayPath)), "book.json");
274338
+ if (!existsSync153(bookPath)) return void 0;
274176
274339
  try {
274177
- const book = JSON.parse(readFileSync182(bookPath, "utf8"));
274340
+ const book = JSON.parse(readFileSync183(bookPath, "utf8"));
274178
274341
  if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
274179
274342
  const galleries = deriveStaticGalleries(book.look.pages);
274180
274343
  return galleries.length || book.look.complete === true ? galleries : void 0;
@@ -274188,12 +274351,12 @@ async function applyOverlays(input) {
274188
274351
  assertKnownShell(shell);
274189
274352
  const pagesRefusal = input.sitePages ? sitePagesTargetRefusal({ cwd, shell }) : void 0;
274190
274353
  if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
274191
- const overlay = JSON.parse(readFileSync182(input.overlayPath, "utf8"));
274354
+ const overlay = JSON.parse(readFileSync183(input.overlayPath, "utf8"));
274192
274355
  const sitePages = input.sitePages === true;
274193
274356
  const plan = input.sitePagesPlan;
274194
274357
  const planNote = sitePages && plan ? plan.notes[0] : void 0;
274195
274358
  const sitePagesOut = (screens) => sitePages && plan ? { sitePages: { site: plan.site, native: plan.native, skipped: plan.skipped, ...screens ? { screens } : {} } } : {};
274196
- const tokens2 = JSON.parse(readFileSync182(input.tokensPath, "utf8"));
274359
+ const tokens2 = JSON.parse(readFileSync183(input.tokensPath, "utf8"));
274197
274360
  const faq = staticFaqFor(overlay, input.overlayPath);
274198
274361
  if (faq !== void 0) overlay.faq = faq;
274199
274362
  const galleries = staticGalleriesFor(overlay, input.overlayPath);
@@ -274207,15 +274370,15 @@ async function applyOverlays(input) {
274207
274370
  if (repoRoot2) {
274208
274371
  const bakeRefusal = inRepoBakeRefusal(repoRoot2, shell);
274209
274372
  if (bakeRefusal) throw Object.assign(new Error(bakeRefusal), { exit: 2, code: APPLY_SHELL_CANNOT_BAKE });
274210
- const appDir3 = join197(repoRoot2, shellAppDir(shell));
274211
- assertOverlayNamesSite(join197(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
274373
+ const appDir3 = join198(repoRoot2, shellAppDir(shell));
274374
+ assertOverlayNamesSite(join198(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
274212
274375
  const packageDir = dirname85(resolve124(input.overlayPath));
274213
274376
  if (input.dryRun) {
274214
274377
  return {
274215
274378
  mode: "dry",
274216
274379
  target: "in-repo",
274217
274380
  wrote: [],
274218
- wouldWrite: [join197(packageDir, "provisioning.contract.json"), join197(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
274381
+ wouldWrite: [join198(packageDir, "provisioning.contract.json"), join198(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
274219
274382
  note: [planNote, "dry run: nothing written \u2014 without --dry-run this merges the contract and runs prepare:customer"].filter(Boolean).join(" \xB7 "),
274220
274383
  ...sitePagesOut()
274221
274384
  };
@@ -274224,7 +274387,7 @@ async function applyOverlays(input) {
274224
274387
  const { path: contract, staged } = buildMergedContract({ appDir: appDir3, packageDir, overlay, keepSite: sitePages, sitePageHost: isSitePageHost(shell), notes: mergeNotes });
274225
274388
  const mergeNote = mergeNotes.length ? ` \xB7 ${mergeNotes.join(" \xB7 ")}` : "";
274226
274389
  wrote.push(...staged);
274227
- const r3 = spawnSync12("npm", ["run", "prepare:customer", "--", "--contract", contract], {
274390
+ const r3 = spawnSync13("npm", ["run", "prepare:customer", "--", "--contract", contract], {
274228
274391
  cwd: appDir3,
274229
274392
  encoding: "utf8"
274230
274393
  });
@@ -274244,7 +274407,7 @@ async function applyOverlays(input) {
274244
274407
  note: `${planNote ? `${planNote} \xB7 ` : ""}prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}${mergeNote}`
274245
274408
  };
274246
274409
  }
274247
- const pkgProv = join197(cwd, "provisioning.json");
274410
+ const pkgProv = join198(cwd, "provisioning.json");
274248
274411
  assertNotCommitted(pkgProv, input.forbiddenProvisioning);
274249
274412
  assertOverlayNamesSite(pkgProv, overlay, "this content package", "");
274250
274413
  if (input.dryRun) {
@@ -274257,16 +274420,16 @@ async function applyOverlays(input) {
274257
274420
  wrote: [],
274258
274421
  wouldWrite: [
274259
274422
  pkgProv,
274260
- ...existsSync152(join197(cwd, "tokens.json")) && (tokens2.colors || tokens2.typography) ? [join197(cwd, "tokens.json")] : [],
274261
- ...existsSync152(join197(cwd, "dev/index.ts")) ? [join197(cwd, "dev/index.ts")] : [],
274262
- ...touchesPackage ? [join197(cwd, "config.ts"), join197(cwd, "himalaya.content.json")] : [],
274263
- ...input.iconPath && existsSync152(input.iconPath) ? [join197(cwd, "icon.png")] : []
274423
+ ...existsSync153(join198(cwd, "tokens.json")) && (tokens2.colors || tokens2.typography) ? [join198(cwd, "tokens.json")] : [],
274424
+ ...existsSync153(join198(cwd, "dev/index.ts")) ? [join198(cwd, "dev/index.ts")] : [],
274425
+ ...touchesPackage ? [join198(cwd, "config.ts"), join198(cwd, "himalaya.content.json")] : [],
274426
+ ...input.iconPath && existsSync153(input.iconPath) ? [join198(cwd, "icon.png")] : []
274264
274427
  ],
274265
274428
  note: [planNote, pages2?.refused ? `website pages not added: ${pages2.refused}` : void 0, "dry run: nothing written"].filter(Boolean).join(" \xB7 "),
274266
274429
  ...sitePagesOut(screens)
274267
274430
  };
274268
274431
  }
274269
- const contentPath = join197(cwd, "himalaya.content.json");
274432
+ const contentPath = join198(cwd, "himalaya.content.json");
274270
274433
  const syncViewNames = (before, after) => {
274271
274434
  const content = readContentManifest(cwd);
274272
274435
  if (!content) return;
@@ -274280,8 +274443,8 @@ async function applyOverlays(input) {
274280
274443
  const recordSite = sitePages && !pagesRefused;
274281
274444
  let packageFaq = faq;
274282
274445
  let packageGalleries = galleries;
274283
- if (existsSync152(pkgProv)) {
274284
- const cur = JSON.parse(readFileSync182(pkgProv, "utf8"));
274446
+ if (existsSync153(pkgProv)) {
274447
+ const cur = JSON.parse(readFileSync183(pkgProv, "utf8"));
274285
274448
  if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
274286
274449
  const merged = deepMerge4(cur, overlay);
274287
274450
  if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
@@ -274303,20 +274466,20 @@ async function applyOverlays(input) {
274303
274466
  syncViewNames(cur.site, merged.site);
274304
274467
  }
274305
274468
  dropMemberBindingsForWebSite(merged);
274306
- writeFileSync74(pkgProv, JSON.stringify(merged, null, 2) + "\n");
274469
+ writeFileSync75(pkgProv, JSON.stringify(merged, null, 2) + "\n");
274307
274470
  wrote.push(pkgProv);
274308
274471
  } else {
274309
274472
  if (!sitePages) syncViewNames(void 0, overlay.site);
274310
274473
  const { site: _unrecorded, ...withoutSite } = overlay;
274311
- writeFileSync74(pkgProv, JSON.stringify(sitePages && !recordSite ? withoutSite : overlay, null, 2) + "\n");
274474
+ writeFileSync75(pkgProv, JSON.stringify(sitePages && !recordSite ? withoutSite : overlay, null, 2) + "\n");
274312
274475
  wrote.push(pkgProv);
274313
274476
  }
274314
274477
  if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
274315
274478
  overlay.installedVerticals.push("galleries");
274316
274479
  }
274317
- const pkgTokens = join197(cwd, "tokens.json");
274318
- if (existsSync152(pkgTokens) && (tokens2.colors || tokens2.typography)) {
274319
- const cur = JSON.parse(readFileSync182(pkgTokens, "utf8"));
274480
+ const pkgTokens = join198(cwd, "tokens.json");
274481
+ if (existsSync153(pkgTokens) && (tokens2.colors || tokens2.typography)) {
274482
+ const cur = JSON.parse(readFileSync183(pkgTokens, "utf8"));
274320
274483
  let tokensIn = tokens2;
274321
274484
  if (tokens2.typography) {
274322
274485
  const fonts = catalogTypography(tokens2.typography, cur.typography);
@@ -274337,13 +274500,13 @@ async function applyOverlays(input) {
274337
274500
  if (primary && glow && typeof glow.color === "string") glow.color = primary;
274338
274501
  stripBrandFromIdiom(merged);
274339
274502
  }
274340
- writeFileSync74(pkgTokens, JSON.stringify(merged, null, 2) + "\n");
274503
+ writeFileSync75(pkgTokens, JSON.stringify(merged, null, 2) + "\n");
274341
274504
  wrote.push(pkgTokens);
274342
274505
  }
274343
274506
  const homeAction = homeRefreshActionId(shell);
274344
- const homeSrc = join197(cwd, "dev/index.ts");
274345
- if (homeAction && existsSync152(homeSrc)) {
274346
- const prev = readFileSync182(homeSrc, "utf8");
274507
+ const homeSrc = join198(cwd, "dev/index.ts");
274508
+ if (homeAction && existsSync153(homeSrc)) {
274509
+ const prev = readFileSync183(homeSrc, "utf8");
274347
274510
  const patched = patchBrandParams(prev, overlay, homeAction);
274348
274511
  let next = patched.src;
274349
274512
  if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
@@ -274371,7 +274534,7 @@ async function applyOverlays(input) {
274371
274534
  }
274372
274535
  }
274373
274536
  if (next !== prev) {
274374
- writeFileSync74(homeSrc, next);
274537
+ writeFileSync75(homeSrc, next);
274375
274538
  wrote.push(homeSrc);
274376
274539
  }
274377
274540
  if (patched.unparsed) {
@@ -274386,13 +274549,13 @@ async function applyOverlays(input) {
274386
274549
  if (pages2.refused) notes.push(`website pages not added: ${pages2.refused}`);
274387
274550
  else pageScreens = { added: pages2.added, replaced: pages2.replaced, removed: pages2.removed, rows: pages2.rows };
274388
274551
  }
274389
- if (!input.iconPath || !existsSync152(input.iconPath)) {
274552
+ if (!input.iconPath || !existsSync153(input.iconPath)) {
274390
274553
  const book = input.iconPath ? dirname85(dirname85(resolve124(input.iconPath))) : void 0;
274391
274554
  notes.push(
274392
274555
  book ? `no icon installed \u2014 ${siteLogoAbsence(book).hint}` : "no icon installed and no business book to say why \u2014 `himi icon generate` draws one from the accent, or `himi icon set <file.png>` installs the customer's own mark"
274393
274556
  );
274394
274557
  }
274395
- if (input.iconPath && existsSync152(input.iconPath)) {
274558
+ if (input.iconPath && existsSync153(input.iconPath)) {
274396
274559
  try {
274397
274560
  const installed3 = await installIcon(cwd, input.iconPath, { derivePlay: true });
274398
274561
  wrote.push(...installed3.wrote);
@@ -275473,7 +275636,7 @@ __export(cli_exports3, {
275473
275636
  sitePagesRefusal: () => sitePagesRefusal,
275474
275637
  targetIsSiteShell: () => targetIsSiteShell
275475
275638
  });
275476
- import { existsSync as existsSync153, readFileSync as readFileSync183 } from "node:fs";
275639
+ import { existsSync as existsSync154, readFileSync as readFileSync184 } from "node:fs";
275477
275640
  import { isDeepStrictEqual } from "node:util";
275478
275641
  import { resolve as resolve125 } from "node:path";
275479
275642
  function sitePagesRefusal(opts) {
@@ -275570,15 +275733,15 @@ async function runSiteAnalyze(opts) {
275570
275733
  const prevOverlayPath = resolve125(outDir, "provisioning.overlay.json");
275571
275734
  const readSite = (path2) => {
275572
275735
  try {
275573
- return JSON.parse(readFileSync183(path2, "utf8")).site;
275736
+ return JSON.parse(readFileSync184(path2, "utf8")).site;
275574
275737
  } catch {
275575
275738
  return void 0;
275576
275739
  }
275577
275740
  };
275578
- const overlaySite = existsSync153(prevOverlayPath) ? readSite(prevOverlayPath) : void 0;
275741
+ const overlaySite = existsSync154(prevOverlayPath) ? readSite(prevOverlayPath) : void 0;
275579
275742
  const packagePath = resolve125(cwd, "provisioning.json");
275580
275743
  const target = siteShellTarget({ cwd, shell: opts.shell });
275581
- const packageSite = target.where === "off-repo" && target.manifest === packagePath && existsSync153(packagePath) ? readSite(packagePath) : void 0;
275744
+ const packageSite = target.where === "off-repo" && target.manifest === packagePath && existsSync154(packagePath) ? readSite(packagePath) : void 0;
275582
275745
  const asBlock = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
275583
275746
  const pkgBlock = asBlock(packageSite);
275584
275747
  const overlayBlock = asBlock(overlaySite);
@@ -275642,7 +275805,7 @@ async function runSiteAnalyze(opts) {
275642
275805
  }
275643
275806
  const previousOverlay = resolve125(outDir, "provisioning.overlay.json");
275644
275807
  carryOverGoals(
275645
- existsSync153(previousOverlay) ? readFileSync183(previousOverlay, "utf8") : void 0,
275808
+ existsSync154(previousOverlay) ? readFileSync184(previousOverlay, "utf8") : void 0,
275646
275809
  result.provisioningOverlay
275647
275810
  );
275648
275811
  const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
@@ -275705,7 +275868,7 @@ async function runSiteFunctionCli(opts) {
275705
275868
  let source2;
275706
275869
  if (opts.sourcePath) {
275707
275870
  const p2 = resolve125(opts.cwd ?? process.cwd(), opts.sourcePath);
275708
- source2 = readFileSync183(p2, "utf8");
275871
+ source2 = readFileSync184(p2, "utf8");
275709
275872
  }
275710
275873
  let body;
275711
275874
  if (opts.bodyRaw != null) {
@@ -275733,9 +275896,9 @@ async function runSiteFunctionCli(opts) {
275733
275896
  });
275734
275897
  }
275735
275898
  function base44BookRoutes(bookPath, siteUrl) {
275736
- if (!existsSync153(bookPath)) return void 0;
275899
+ if (!existsSync154(bookPath)) return void 0;
275737
275900
  try {
275738
- const book = JSON.parse(readFileSync183(bookPath, "utf8"));
275901
+ const book = JSON.parse(readFileSync184(bookPath, "utf8"));
275739
275902
  if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
275740
275903
  const host = (u2) => {
275741
275904
  try {
@@ -275907,7 +276070,7 @@ __export(site_create_exports, {
275907
276070
  runSiteList: () => runSiteList,
275908
276071
  writeProvisioningBinding: () => writeProvisioningBinding
275909
276072
  });
275910
- import { existsSync as existsSync154, readFileSync as readFileSync184, writeFileSync as writeFileSync75 } from "node:fs";
276073
+ import { existsSync as existsSync155, readFileSync as readFileSync185, writeFileSync as writeFileSync76 } from "node:fs";
275911
276074
  import { resolve as resolvePath4 } from "node:path";
275912
276075
  function oauthClientName(projectName) {
275913
276076
  return `${projectName} client`;
@@ -276056,7 +276219,7 @@ async function runSiteCreate(opts) {
276056
276219
  if (!wantOauthApp) return { ...base2, nextSteps: nextSteps(metaSiteId) };
276057
276220
  return { ...base2, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
276058
276221
  }
276059
- function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync154, readFileSync: readFileSync184, writeFileSync: writeFileSync75 }) {
276222
+ function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync155, readFileSync: readFileSync185, writeFileSync: writeFileSync76 }) {
276060
276223
  const msid = binding2.siteId;
276061
276224
  const path2 = resolvePath4(target);
276062
276225
  const committed = committedShellProvisioning(path2);
@@ -276862,7 +277025,7 @@ __export(check_report_exports, {
276862
277025
  sendCheckResult: () => sendCheckResult,
276863
277026
  takeCheckReportTarget: () => takeCheckReportTarget
276864
277027
  });
276865
- import { createHash as createHash96, randomUUID as randomUUID20 } from "node:crypto";
277028
+ import { createHash as createHash97, randomUUID as randomUUID20 } from "node:crypto";
276866
277029
  import { request as httpRequest2 } from "node:http";
276867
277030
  import { createConnection } from "node:net";
276868
277031
  import { isAbsolute as isAbsolute19, relative as relative36, resolve as resolve126 } from "node:path";
@@ -277034,7 +277197,7 @@ function errorFindings(run4, mode) {
277034
277197
  if (mode === "functions") {
277035
277198
  return envelope.functions.map(record4).filter((f2) => f2.ok === false).map((f2) => ({
277036
277199
  // Stable per function, in the HimiReport id alphabet: the name may hold anything.
277037
- id: `test:functions:${createHash96("sha256").update(text29(f2.name) ?? "").digest("hex").slice(0, 12)}`,
277200
+ id: `test:functions:${createHash97("sha256").update(text29(f2.name) ?? "").digest("hex").slice(0, 12)}`,
277038
277201
  severity: "error",
277039
277202
  message: `function "${text29(f2.name) ?? "?"}" (${text29(f2.method) ?? "?"} ${text29(f2.path) ?? "?"}) answered HTTP ${String(f2.status)}`
277040
277203
  }));
@@ -277365,26 +277528,26 @@ __export(capture_exports, {
277365
277528
  nativeNotConfigured: () => nativeNotConfigured,
277366
277529
  variantWidth: () => variantWidth
277367
277530
  });
277368
- import { existsSync as existsSync155, mkdirSync as mkdirSync67, rmSync as rmSync45, writeFileSync as writeFileSync76 } from "node:fs";
277369
- import { join as join198 } from "node:path";
277370
- import { pathToFileURL as pathToFileURL11 } from "node:url";
277531
+ import { existsSync as existsSync156, mkdirSync as mkdirSync68, rmSync as rmSync46, writeFileSync as writeFileSync77 } from "node:fs";
277532
+ import { join as join199 } from "node:path";
277533
+ import { pathToFileURL as pathToFileURL12 } from "node:url";
277371
277534
  function variantWidth(variant) {
277372
277535
  return variant === "tablet" ? renderDeviceWidths().tablet : PHONE_WIDTH;
277373
277536
  }
277374
277537
  function frameFile(outDir, screen, variant, surface) {
277375
- mkdirSync67(outDir, { recursive: true });
277376
- return join198(outDir, `${screen}.${variant}.${surface}.png`);
277538
+ mkdirSync68(outDir, { recursive: true });
277539
+ return join199(outDir, `${screen}.${variant}.${surface}.png`);
277377
277540
  }
277378
277541
  async function captureMockup(root, screen, entry, variant, outDir, session) {
277379
277542
  if (!entry.mockup) throw new MockupMissingError(`screen ${screen} declares no mockup in hhp.json`);
277380
277543
  const file2 = localPath(root, entry.mockup);
277381
- if (!existsSync155(file2)) throw new MockupMissingError(`screen ${screen}: mockup ${entry.mockup} does not exist`);
277544
+ if (!existsSync156(file2)) throw new MockupMissingError(`screen ${screen}: mockup ${entry.mockup} does not exist`);
277382
277545
  const own6 = session ?? new MockupSession();
277383
277546
  try {
277384
277547
  const png = await own6.shoot(file2, variant);
277385
277548
  const noReference = variant === "dark" && !await own6.stylesDark(file2);
277386
277549
  const out2 = frameFile(outDir, screen, variant, "mockup");
277387
- writeFileSync76(out2, png);
277550
+ writeFileSync77(out2, png);
277388
277551
  return { surface: "mockup", screen, variant, file: out2, ...noReference ? { noReference: true } : {} };
277389
277552
  } finally {
277390
277553
  if (!session) await own6.close();
@@ -277410,7 +277573,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
277410
277573
  const built = await buildContentBundles2(root, { resolution: resolutionFlag2({}) });
277411
277574
  const out2 = /* @__PURE__ */ new Map();
277412
277575
  if (built.compileErrors.length) return compileFailureFrames(built.compileErrors, screens, variant);
277413
- const scratch = join198(outDir, `.build-${variant}`);
277576
+ const scratch = join199(outDir, `.build-${variant}`);
277414
277577
  try {
277415
277578
  const outcome = await buildReleaseFromContent2(root, scratch, {
277416
277579
  ...built.built.length || built.compileErrors.length ? { tier5Dir: bundleOutDir2(root) } : {},
@@ -277429,7 +277592,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
277429
277592
  const r3 = (outcome.renders ?? []).find((x2) => x2.screenId === screen);
277430
277593
  if (r3?.pngBase64) {
277431
277594
  const file2 = frameFile(outDir, screen, variant, "web");
277432
- writeFileSync76(file2, Buffer.from(r3.pngBase64, "base64"));
277595
+ writeFileSync77(file2, Buffer.from(r3.pngBase64, "base64"));
277433
277596
  out2.set(screen, { surface: "web", screen, variant, file: file2 });
277434
277597
  } else {
277435
277598
  const reason = !r3 ? "screen did not build" : r3.pngUnavailable ? "no Playwright Chromium for the web PNG" : r3.reason ?? "web render produced no PNG";
@@ -277437,7 +277600,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
277437
277600
  }
277438
277601
  }
277439
277602
  } finally {
277440
- rmSync45(scratch, { recursive: true, force: true });
277603
+ rmSync46(scratch, { recursive: true, force: true });
277441
277604
  }
277442
277605
  return out2;
277443
277606
  }
@@ -277472,7 +277635,7 @@ var init_capture = __esm({
277472
277635
  const page = await (await this.browser()).newPage({ viewport: { width: variantWidth(variant), height: 900 }, colorScheme: scheme, reducedMotion: "reduce" });
277473
277636
  try {
277474
277637
  if (opts.stable) await page.route("**/*", (route) => ["image", "media", "font"].includes(route.request().resourceType()) ? route.abort() : route.continue());
277475
- await page.goto(pathToFileURL11(file2).href, { waitUntil: "load", timeout: 6e4 });
277638
+ await page.goto(pathToFileURL12(file2).href, { waitUntil: "load", timeout: 6e4 });
277476
277639
  await page.waitForLoadState("networkidle", { timeout: 15e3 }).catch(() => {
277477
277640
  });
277478
277641
  if (variant === "rtl") await page.evaluate(() => {
@@ -277517,9 +277680,9 @@ var init_capture = __esm({
277517
277680
 
277518
277681
  // src/fidelity/judge.ts
277519
277682
  import { spawn as spawn10 } from "node:child_process";
277520
- import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync14, readFileSync as readFileSync185, rmSync as rmSync46 } from "node:fs";
277683
+ import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync14, readFileSync as readFileSync186, rmSync as rmSync47 } from "node:fs";
277521
277684
  import { tmpdir as tmpdir15 } from "node:os";
277522
- import { basename as basename42, dirname as dirname86, join as join199, resolve as resolve127 } from "node:path";
277685
+ import { basename as basename42, dirname as dirname86, join as join200, resolve as resolve127 } from "node:path";
277523
277686
  import { fileURLToPath as fileURLToPath40 } from "node:url";
277524
277687
  function parseVerdict(value2, captured) {
277525
277688
  const v2 = value2;
@@ -277559,8 +277722,8 @@ async function judgeStrip(strip4, screen, variant, opts = {}) {
277559
277722
  const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
277560
277723
  let prompt2, schema2;
277561
277724
  try {
277562
- prompt2 = readFileSync185(resolve127(judgeDir, "JUDGE.md"), "utf8");
277563
- schema2 = readFileSync185(resolve127(judgeDir, "verdict.schema.json"), "utf8");
277725
+ prompt2 = readFileSync186(resolve127(judgeDir, "JUDGE.md"), "utf8");
277726
+ schema2 = readFileSync186(resolve127(judgeDir, "verdict.schema.json"), "utf8");
277564
277727
  } catch (e2) {
277565
277728
  return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
277566
277729
  }
@@ -277569,15 +277732,15 @@ async function judgeStrip(strip4, screen, variant, opts = {}) {
277569
277732
  "",
277570
277733
  `Screen \`${screen}\`, variant \`${variant}\`. Read the strip image at ./${basename42(strip4)} and judge it.`
277571
277734
  ].join("\n");
277572
- const cwd = mkdtempSync14(join199(tmpdir15(), "himi-fidelity-judge-"));
277735
+ const cwd = mkdtempSync14(join200(tmpdir15(), "himi-fidelity-judge-"));
277573
277736
  let r3;
277574
277737
  try {
277575
- copyFileSync3(strip4, join199(cwd, basename42(strip4)));
277738
+ copyFileSync3(strip4, join200(cwd, basename42(strip4)));
277576
277739
  r3 = await run4("claude", judgeArgs(schema2), { cwd, input, timeoutMs });
277577
277740
  } catch (e2) {
277578
277741
  return cannotTell(`the judge could not be prepared: ${e2.message}`);
277579
277742
  } finally {
277580
- rmSync46(cwd, { recursive: true, force: true });
277743
+ rmSync47(cwd, { recursive: true, force: true });
277581
277744
  }
277582
277745
  if (r3.error?.code === "ENOENT") return cannotTell("the `claude` CLI is not installed, so no judge ran");
277583
277746
  if (r3.error) return cannotTell(`the judge could not start: ${r3.error.message}`);
@@ -277630,8 +277793,8 @@ var init_judge = __esm({
277630
277793
 
277631
277794
  // src/fidelity/score.ts
277632
277795
  import { spawn as spawn11 } from "node:child_process";
277633
- import { mkdtempSync as mkdtempSync15, rmSync as rmSync47 } from "node:fs";
277634
- import { join as join200 } from "node:path";
277796
+ import { mkdtempSync as mkdtempSync15, rmSync as rmSync48 } from "node:fs";
277797
+ import { join as join201 } from "node:path";
277635
277798
  import { tmpdir as tmpdir16 } from "node:os";
277636
277799
  function viewportHeight(width) {
277637
277800
  return Math.round(width * 2.165);
@@ -277653,10 +277816,10 @@ async function scorePair(aFile, bFile, opts = {}) {
277653
277816
  const sizes = await Promise.all([aFile, bFile].map(async (f2) => (await magick(run4, ["identify", "-format", "%w %h", f2])).split(" ").map(Number)));
277654
277817
  const width = Math.min(sizes[0][0], sizes[1][0]);
277655
277818
  const height = Math.min(...sizes.map(([w2, h2]) => Math.round(h2 * width / w2)), viewportHeight(width));
277656
- const dir = mkdtempSync15(join200(tmpdir16(), "himi-fidelity-score-"));
277819
+ const dir = mkdtempSync15(join201(tmpdir16(), "himi-fidelity-score-"));
277657
277820
  try {
277658
277821
  const norm3 = await Promise.all([aFile, bFile].map(async (f2, i2) => {
277659
- const out2 = join200(dir, `${i2}.png`);
277822
+ const out2 = join201(dir, `${i2}.png`);
277660
277823
  const mask = opts.mask ?? { top: 0, bottom: 0 };
277661
277824
  const draw = [
277662
277825
  ...mask.top > 0 ? ["-draw", `rectangle 0,0 ${width},${mask.top - 1}`] : [],
@@ -277678,7 +277841,7 @@ async function scorePair(aFile, bFile, opts = {}) {
277678
277841
  }
277679
277842
  return { a: a3, b: b3, global: global2, worstTile };
277680
277843
  } finally {
277681
- rmSync47(dir, { recursive: true, force: true });
277844
+ rmSync48(dir, { recursive: true, force: true });
277682
277845
  }
277683
277846
  }
277684
277847
  var runProcess;
@@ -277697,8 +277860,8 @@ var init_score = __esm({
277697
277860
  });
277698
277861
 
277699
277862
  // ../visual-proof/evidence.mjs
277700
- import { existsSync as existsSync156, rmSync as rmSync48 } from "node:fs";
277701
- function resolveCaptionFont({ exists: exists2 = existsSync156, env = process.env } = {}) {
277863
+ import { existsSync as existsSync157, rmSync as rmSync49 } from "node:fs";
277864
+ function resolveCaptionFont({ exists: exists2 = existsSync157, env = process.env } = {}) {
277702
277865
  if (env?.VISUAL_PROOF_FONT) return env.VISUAL_PROOF_FONT;
277703
277866
  return CAPTION_FONT_CANDIDATES.find((p2) => exists2(p2)) ?? null;
277704
277867
  }
@@ -277731,8 +277894,8 @@ var init_evidence = __esm({
277731
277894
  });
277732
277895
 
277733
277896
  // src/fidelity/strip.ts
277734
- import { mkdtempSync as mkdtempSync16, rmSync as rmSync49 } from "node:fs";
277735
- import { join as join201 } from "node:path";
277897
+ import { mkdtempSync as mkdtempSync16, rmSync as rmSync50 } from "node:fs";
277898
+ import { join as join202 } from "node:path";
277736
277899
  import { tmpdir as tmpdir17 } from "node:os";
277737
277900
  async function buildStrip(frames, out2, opts = {}) {
277738
277901
  const run4 = opts.run ?? runProcess;
@@ -277741,7 +277904,7 @@ async function buildStrip(frames, out2, opts = {}) {
277741
277904
  const { pointsize, strip: strip4 } = labelMetrics(width);
277742
277905
  const font = resolveCaptionFont();
277743
277906
  const fontArgs = font ? ["-font", font] : [];
277744
- const dir = mkdtempSync16(join201(tmpdir17(), "himi-fidelity-strip-"));
277907
+ const dir = mkdtempSync16(join202(tmpdir17(), "himi-fidelity-strip-"));
277745
277908
  const magick2 = async (args) => {
277746
277909
  const r3 = await run4("magick", args);
277747
277910
  if (r3.code !== 0) throw new Error(`magick failed building the strip: ${r3.stderr.trim() || `exit ${r3.code}`}`);
@@ -277751,7 +277914,7 @@ async function buildStrip(frames, out2, opts = {}) {
277751
277914
  for (const surface of STRIP_ORDER) {
277752
277915
  const frame = frames.find((f2) => f2.surface === surface);
277753
277916
  if (!frame) continue;
277754
- const pane = join201(dir, `${surface}.png`);
277917
+ const pane = join202(dir, `${surface}.png`);
277755
277918
  const body = frame.file ? [frame.file, "-alpha", "remove", "-resize", `${width}x`, "-crop", `${width}x${height}+0+0`, "+repage", "-background", "white", "-gravity", "north", "-extent", `${width}x${height}`] : ["-size", `${width}x${height}`, "xc:#d9d9d9", ...fontArgs, "-fill", "#333", "-pointsize", String(Math.round(pointsize * 0.8)), "-gravity", "center", "-annotate", "+0+0", `skipped: ${frame.skipped?.reason ?? "no capture"}`];
277756
277919
  const label4 = `${surface.toUpperCase()}${frame.noReference ? " (no reference)" : ""}`;
277757
277920
  await magick2([...body, "-gravity", "north", "-background", "#111", "-splice", `0x${strip4}`, ...fontArgs, "-fill", "white", "-pointsize", String(pointsize), "-annotate", "+0+4", label4, pane]);
@@ -277761,7 +277924,7 @@ async function buildStrip(frames, out2, opts = {}) {
277761
277924
  await magick2([...panes.flatMap((p2, i2) => i2 ? ["(", "-size", `${STRIP_GUTTER}x${height + strip4}`, "xc:white", ")", p2] : [p2]), "+append", out2]);
277762
277925
  return out2;
277763
277926
  } finally {
277764
- rmSync49(dir, { recursive: true, force: true });
277927
+ rmSync50(dir, { recursive: true, force: true });
277765
277928
  }
277766
277929
  }
277767
277930
  var STRIP_ORDER, STRIP_GUTTER;
@@ -277787,8 +277950,8 @@ __export(run_exports2, {
277787
277950
  runId: () => runId,
277788
277951
  unlinkableScreens: () => unlinkableScreens
277789
277952
  });
277790
- import { mkdirSync as mkdirSync68, writeFileSync as writeFileSync77 } from "node:fs";
277791
- import { basename as basename43, join as join202 } from "node:path";
277953
+ import { mkdirSync as mkdirSync69, writeFileSync as writeFileSync78 } from "node:fs";
277954
+ import { basename as basename43, join as join203 } from "node:path";
277792
277955
  function unlinkableScreens(config, screens, home2) {
277793
277956
  const navigation = config?.navigation;
277794
277957
  const linkables = Array.isArray(navigation?.linkableScreens) ? navigation.linkableScreens : [];
@@ -277847,9 +278010,9 @@ async function runFidelity(root, opts = {}) {
277847
278010
  if (unknown.length) throw Object.assign(new Error(`unknown screen(s): ${unknown.join(", ")}`), { code: "fidelity_unknown_screen" });
277848
278011
  const variants = opts.variants?.length ? opts.variants : VARIANTS;
277849
278012
  const run4 = opts.run ?? runId();
277850
- const dir = join202(opts.outRoot ?? join202(root, ".himi", "fidelity"), run4);
277851
- const framesDir = join202(dir, "frames");
277852
- mkdirSync68(framesDir, { recursive: true });
278013
+ const dir = join203(opts.outRoot ?? join203(root, ".himi", "fidelity"), run4);
278014
+ const framesDir = join203(dir, "frames");
278015
+ mkdirSync69(framesDir, { recursive: true });
277853
278016
  const session = opts.capture?.mockup ? void 0 : new MockupSession();
277854
278017
  const mockup = opts.capture?.mockup ?? ((r3, s5, e2, v2, o2) => captureMockup(r3, s5, e2, v2, o2, session));
277855
278018
  const web4 = opts.capture?.web ?? captureWebVariant;
@@ -277899,7 +278062,7 @@ async function runFidelity(root, opts = {}) {
277899
278062
  let stripFile;
277900
278063
  let verdict;
277901
278064
  const judged2 = frames.filter((f2) => !f2.noReference);
277902
- const stripPath2 = join202(dir, `${screen}.${variant}.strip.png`);
278065
+ const stripPath2 = join203(dir, `${screen}.${variant}.strip.png`);
277903
278066
  if (!w2?.file || judged2.filter((f2) => f2.file).length < 2) {
277904
278067
  if (frames.some((f2) => f2.file)) stripFile = await strip4(frames, stripPath2);
277905
278068
  verdict = skippedJudge(!w2?.file ? "no web render, and web is the reference for both design and parity" : frames.some((f2) => f2.noReference) ? `the mockup does not style ${variant}, and there is no native pane to compare with web` : "fewer than two captured panes, so there is nothing to compare");
@@ -277923,7 +278086,7 @@ async function runFidelity(root, opts = {}) {
277923
278086
  await native?.restore?.();
277924
278087
  }
277925
278088
  const report9 = { app: basename43(root), run: run4, dir, rows, status: worst(rows) };
277926
- writeFileSync77(join202(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
278089
+ writeFileSync78(join203(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
277927
278090
  return report9;
277928
278091
  }
277929
278092
  function prCommentBody(report9) {
@@ -277984,8 +278147,8 @@ __export(native_exports, {
277984
278147
  screenLink: () => screenLink
277985
278148
  });
277986
278149
  import { spawn as spawn12 } from "node:child_process";
277987
- import { readFileSync as readFileSync186, writeFileSync as writeFileSync78 } from "node:fs";
277988
- import { join as join203 } from "node:path";
278150
+ import { readFileSync as readFileSync187, writeFileSync as writeFileSync79 } from "node:fs";
278151
+ import { join as join204 } from "node:path";
277989
278152
  function resumedPackages(dumpsys) {
277990
278153
  const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
277991
278154
  if (!lines2.length) return void 0;
@@ -278040,7 +278203,7 @@ function nativeCapture(devices, opts) {
278040
278203
  return r3;
278041
278204
  };
278042
278205
  const gone = /* @__PURE__ */ new Set();
278043
- const read2 = opts.readFile ?? ((p2) => readFileSync186(p2));
278206
+ const read2 = opts.readFile ?? ((p2) => readFileSync187(p2));
278044
278207
  const sleep4 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
278045
278208
  const settleMs = opts.settleMs ?? 1e3;
278046
278209
  const maxWaitMs = opts.maxWaitMs ?? 3e4;
@@ -278132,7 +278295,7 @@ function nativeCapture(devices, opts) {
278132
278295
  const container = await run4("xcrun", ["simctl", "get_app_container", id, iosBundle, "app"]);
278133
278296
  let compiled = "";
278134
278297
  if (container.code === 0) {
278135
- const plist = await run4("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-", join203(container.stdout.toString().trim(), "Info.plist")]);
278298
+ const plist = await run4("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-", join204(container.stdout.toString().trim(), "Info.plist")]);
278136
278299
  if (plist.code === 0) compiled = plist.stdout.toString().trim();
278137
278300
  }
278138
278301
  const rebuild = `HIMALAYA_API_BASE_URL_INFO=${opts.serveOrigin}`;
@@ -278147,7 +278310,7 @@ function nativeCapture(devices, opts) {
278147
278310
  }
278148
278311
  const r3 = await run4("adb", ["-s", id, "exec-out", "screencap", "-p"]);
278149
278312
  if (r3.code !== 0) throw new Error(`adb -s ${id} exec-out screencap -p exited ${r3.code}`);
278150
- writeFileSync78(file2, r3.stdout);
278313
+ writeFileSync79(file2, r3.stdout);
278151
278314
  return r3.stdout;
278152
278315
  }
278153
278316
  async function notInFront(platform, id) {
@@ -278203,7 +278366,7 @@ function nativeCapture(devices, opts) {
278203
278366
  }
278204
278367
  await apply2(platform, id, variant);
278205
278368
  await open6(platform, id, `himi://app/${encodeURIComponent(picker)}`);
278206
- const file2 = join203(outDir, `${screen}.${variant}.${platform}.png`);
278369
+ const file2 = join204(outDir, `${screen}.${variant}.${platform}.png`);
278207
278370
  const pickerFrame = (await settle2(platform, id, file2)).frame;
278208
278371
  await open6(platform, id, screenLink(opts.appId, screen, entry, opts.release));
278209
278372
  const { unsettled } = await settle2(platform, id, file2, pickerFrame);
@@ -278304,15 +278467,15 @@ __export(serve_exports, {
278304
278467
  releaseProblem: () => releaseProblem,
278305
278468
  serveWorkingCopy: () => serveWorkingCopy
278306
278469
  });
278307
- import { copyFileSync as copyFileSync4, existsSync as existsSync157, mkdirSync as mkdirSync69, mkdtempSync as mkdtempSync17, rmSync as rmSync50 } from "node:fs";
278470
+ import { copyFileSync as copyFileSync4, existsSync as existsSync158, mkdirSync as mkdirSync70, mkdtempSync as mkdtempSync17, rmSync as rmSync51 } from "node:fs";
278308
278471
  import { tmpdir as tmpdir18 } from "node:os";
278309
- import { join as join204 } from "node:path";
278472
+ import { join as join205 } from "node:path";
278310
278473
  function copyFreshBundles(built, outDir, into) {
278311
- mkdirSync69(into, { recursive: true });
278474
+ mkdirSync70(into, { recursive: true });
278312
278475
  for (const name of built) {
278313
278476
  for (const file2 of [`${name}.bundle.js`, `${name}.bundle.js.map`]) {
278314
- const from = join204(outDir, file2);
278315
- if (existsSync157(from)) copyFileSync4(from, join204(into, file2));
278477
+ const from = join205(outDir, file2);
278478
+ if (existsSync158(from)) copyFileSync4(from, join205(into, file2));
278316
278479
  }
278317
278480
  }
278318
278481
  }
@@ -278328,8 +278491,8 @@ async function serveWorkingCopy(dir, port) {
278328
278491
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2 } = await loadAuthoring();
278329
278492
  const bundles = await buildContentBundles2(dir, {});
278330
278493
  if (bundles.compileErrors.length) throw new Error(`the content package's workers do not compile (${bundles.compileErrors.length} error(s)); run \`himi build\` to see them`);
278331
- const temp = mkdtempSync17(join204(tmpdir18(), "himi-fidelity-serve-"));
278332
- const cleanup = () => rmSync50(temp, { recursive: true, force: true });
278494
+ const temp = mkdtempSync17(join205(tmpdir18(), "himi-fidelity-serve-"));
278495
+ const cleanup = () => rmSync51(temp, { recursive: true, force: true });
278333
278496
  const onSignal = () => {
278334
278497
  cleanup();
278335
278498
  process.exit(130);
@@ -278337,12 +278500,12 @@ async function serveWorkingCopy(dir, port) {
278337
278500
  process.once("SIGINT", onSignal);
278338
278501
  process.once("SIGTERM", onSignal);
278339
278502
  try {
278340
- const tier5Dir = bundles.built.length > 0 ? join204(temp, ".tier5") : void 0;
278503
+ const tier5Dir = bundles.built.length > 0 ? join205(temp, ".tier5") : void 0;
278341
278504
  if (tier5Dir) copyFreshBundles(bundles.built, bundles.outDir, tier5Dir);
278342
278505
  const outcome = await buildReleaseFromContent2(dir, temp, { ...tier5Dir ? { tier5Dir } : {}, ...RUN_CONTENT_BUILD });
278343
278506
  const unservable = releaseProblem(outcome);
278344
278507
  if (unservable) throw new Error(unservable);
278345
- const served = await runPackage(join204(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
278508
+ const served = await runPackage(join205(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
278346
278509
  return { origin: served.origin, close: async () => {
278347
278510
  await served.close();
278348
278511
  cleanup();
@@ -278395,8 +278558,8 @@ __export(fidelity_exports, {
278395
278558
  himalayaRepoRoot: () => himalayaRepoRoot
278396
278559
  });
278397
278560
  import { execFileSync as execFileSync12 } from "node:child_process";
278398
- import { existsSync as existsSync158, realpathSync as realpathSync25 } from "node:fs";
278399
- import { join as join205, relative as relative37, sep as sep34 } from "node:path";
278561
+ import { existsSync as existsSync159, realpathSync as realpathSync25 } from "node:fs";
278562
+ import { join as join206, relative as relative37, sep as sep34 } from "node:path";
278400
278563
  function himalayaRepoRoot(dir) {
278401
278564
  let top;
278402
278565
  try {
@@ -278404,7 +278567,7 @@ function himalayaRepoRoot(dir) {
278404
278567
  } catch {
278405
278568
  return null;
278406
278569
  }
278407
- if (!existsSync158(join205(top, "tools/judges/fidelity/JUDGE.md"))) return null;
278570
+ if (!existsSync159(join206(top, "tools/judges/fidelity/JUDGE.md"))) return null;
278408
278571
  const rel2 = relative37(realpathSync25(top), realpathSync25(dir));
278409
278572
  return rel2.startsWith(`..${sep34}`) || rel2 === ".." ? null : top;
278410
278573
  }
@@ -278414,7 +278577,7 @@ function fidelityEnvelope(report9) {
278414
278577
  async function fidelityCommand(ctx) {
278415
278578
  const { io: io2, flags, print } = ctx;
278416
278579
  const dir = contentDir(flags);
278417
- if (!existsSync158(dir)) {
278580
+ if (!existsSync159(dir)) {
278418
278581
  io2.error(failure2("fidelity_bad_flag", `content dir ${dir} does not exist`));
278419
278582
  return 2;
278420
278583
  }
@@ -278437,7 +278600,7 @@ async function fidelityCommand(ctx) {
278437
278600
  return 2;
278438
278601
  }
278439
278602
  const { runFidelity: runFidelity2, prCommentBody: prCommentBody2 } = await Promise.resolve().then(() => (init_run3(), run_exports2));
278440
- const judgeDir = join205(repo, "tools/judges/fidelity");
278603
+ const judgeDir = join206(repo, "tools/judges/fidelity");
278441
278604
  const deviceFlags = { ios: "ios", android: "android", iosTablet: "ios-tablet", androidTablet: "android-tablet" };
278442
278605
  const bare = Object.values(deviceFlags).filter((f2) => flags[f2] !== void 0 && !str3(flags[f2]));
278443
278606
  if (bare.length) {
@@ -278543,7 +278706,7 @@ async function fidelityCommand(ctx) {
278543
278706
  else {
278544
278707
  for (const r3 of report9.rows) io2.log(`${r3.status.padEnd(4)} ${r3.screen}/${r3.variant} design=${r3.judge.design} parity=${r3.judge.parity}${r3.reasons.length ? ` \u2014 ${r3.reasons[0]}` : ""}`);
278545
278708
  io2.log(`
278546
- ${report9.status.toUpperCase()} \u2014 report: ${join205(report9.dir, "report.json")}`);
278709
+ ${report9.status.toUpperCase()} \u2014 report: ${join206(report9.dir, "report.json")}`);
278547
278710
  }
278548
278711
  return report9.status === "fail" ? 1 : 0;
278549
278712
  }
@@ -278632,9 +278795,9 @@ async function publishSizeCommand(ctx) {
278632
278795
  return fail16("build_failed", "publish-size requires the contained authoring runtime; host-realm overrides are unavailable");
278633
278796
  }
278634
278797
  const dir = contentDir2(flags);
278635
- const { existsSync: existsSync160 } = await import("node:fs");
278636
- const { join: join207 } = await import("node:path");
278637
- if (!existsSync160(join207(dir, "dev", "index.ts"))) return fail16("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
278798
+ const { existsSync: existsSync161 } = await import("node:fs");
278799
+ const { join: join208 } = await import("node:path");
278800
+ if (!existsSync161(join208(dir, "dev", "index.ts"))) return fail16("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
278638
278801
  const declared = await appId3(dir);
278639
278802
  const app2 = typeof flags.app === "string" ? flags.app : declared;
278640
278803
  if (!isValidAppId(app2)) return fail16("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app: app2 }, 2);
@@ -278746,8 +278909,8 @@ __export(ext_impl_exports, {
278746
278909
  addExtensionToConfigSource: () => addExtensionToConfigSource,
278747
278910
  runExt: () => runExt
278748
278911
  });
278749
- import { existsSync as existsSync159, mkdirSync as mkdirSync70, readFileSync as readFileSync187, writeFileSync as writeFileSync79 } from "node:fs";
278750
- import { join as join206 } from "node:path";
278912
+ import { existsSync as existsSync160, mkdirSync as mkdirSync71, readFileSync as readFileSync188, writeFileSync as writeFileSync80 } from "node:fs";
278913
+ import { join as join207 } from "node:path";
278751
278914
  import ts32 from "typescript";
278752
278915
  async function runExt(ctx) {
278753
278916
  const { pos, flags, io: io2, print } = ctx;
@@ -278778,8 +278941,8 @@ async function runExt(ctx) {
278778
278941
  hint: `run \`himi capabilities ${catalogId}\` for how to use it, or pass --force to create the extension anyway`
278779
278942
  }, 2);
278780
278943
  }
278781
- const configPath = join206(dir, "config.ts");
278782
- if (!existsSync159(configPath)) return fail16("extensions_config_missing", `no config.ts in ${dir}; run this inside a content package (or pass --content)`);
278944
+ const configPath = join207(dir, "config.ts");
278945
+ if (!existsSync160(configPath)) return fail16("extensions_config_missing", `no config.ts in ${dir}; run this inside a content package (or pass --content)`);
278783
278946
  const declared = declaredExtensions(dir);
278784
278947
  if (declared.kind === "opaque") {
278785
278948
  return fail16("extensions_config_opaque", "config.ts `extensions` is not a literal array of names, so it cannot be edited safely; add the name to it by hand", { extension: name });
@@ -278787,8 +278950,8 @@ async function runExt(ctx) {
278787
278950
  if (!declared.names.includes(name) && declared.names.length >= MAX_EXTENSIONS) {
278788
278951
  return fail16("extension_limit", `an app may declare at most ${MAX_EXTENSIONS} extensions`, { limit: MAX_EXTENSIONS });
278789
278952
  }
278790
- const extDir = join206(dir, EXTENSIONS_DIR, name);
278791
- if (existsSync159(extDir)) return fail16("extension_exists", `${EXTENSIONS_DIR}/${name}/ already exists`, { extension: name });
278953
+ const extDir = join207(dir, EXTENSIONS_DIR, name);
278954
+ if (existsSync160(extDir)) return fail16("extension_exists", `${EXTENSIONS_DIR}/${name}/ already exists`, { extension: name });
278792
278955
  const views2 = [str3(flags.views), str3(flags.view)].filter(Boolean).flatMap((v2) => v2.split(",")).map((v2) => v2.trim()).filter(Boolean);
278793
278956
  const badView = views2.find((v2) => !isValidViewName(v2) || CORE_TYPE_NAMES.has(v2));
278794
278957
  if (badView) {
@@ -278797,9 +278960,9 @@ async function runExt(ctx) {
278797
278960
  const pascal2 = pascalName(name);
278798
278961
  const files = [];
278799
278962
  const put = (rel2, text30) => {
278800
- const path2 = join206(extDir, rel2);
278801
- mkdirSync70(join206(path2, ".."), { recursive: true });
278802
- writeFileSync79(path2, text30, { flag: "wx" });
278963
+ const path2 = join207(extDir, rel2);
278964
+ mkdirSync71(join207(path2, ".."), { recursive: true });
278965
+ writeFileSync80(path2, text30, { flag: "wx" });
278803
278966
  files.push(`${EXTENSIONS_DIR}/${name}/${rel2}`);
278804
278967
  };
278805
278968
  put(EXTENSION_MANIFEST, `${JSON.stringify({
@@ -278855,9 +279018,9 @@ async function runExt(ctx) {
278855
279018
  return 0;
278856
279019
  }
278857
279020
  function loadModelFor(extDir) {
278858
- const parsed = parseExtensionManifest(JSON.parse(readFileSync187(join206(extDir, EXTENSION_MANIFEST), "utf8")));
279021
+ const parsed = parseExtensionManifest(JSON.parse(readFileSync188(join207(extDir, EXTENSION_MANIFEST), "utf8")));
278859
279022
  if (!parsed.ok) return { ok: false, message: parsed.problems.map((p2) => p2.message).join("; ") };
278860
- const iface = parseExtensionInterface(readFileSync187(join206(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
279023
+ const iface = parseExtensionInterface(readFileSync188(join207(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
278861
279024
  if (!iface.ok) return { ok: false, message: iface.problems.map((p2) => p2.message).join("; ") };
278862
279025
  return { ok: true, model: iface.model };
278863
279026
  }
@@ -278885,7 +279048,7 @@ function declaredExtensionsNode(app2) {
278885
279048
  return void 0;
278886
279049
  }
278887
279050
  function addToConfig(configPath, name) {
278888
- writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync187(configPath, "utf8"), name));
279051
+ writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync188(configPath, "utf8"), name));
278889
279052
  }
278890
279053
  function listExtensions(dir, print) {
278891
279054
  const prepared = prepareExtensions(dir, { write: false });
@@ -279018,7 +279181,7 @@ init_define_HHP_CATALOG();
279018
279181
  init_client();
279019
279182
  init_config();
279020
279183
  import { AsyncLocalStorage as AsyncLocalStorage4 } from "node:async_hooks";
279021
- import { rmSync as rmSync51 } from "node:fs";
279184
+ import { rmSync as rmSync52 } from "node:fs";
279022
279185
  import { spawn as spawn13 } from "node:child_process";
279023
279186
  import { homedir as homedir23 } from "node:os";
279024
279187
  import { resolve as resolve128 } from "node:path";
@@ -281317,12 +281480,12 @@ async function ejectCommand(ctx) {
281317
281480
  print({ ok: false, error: "eject needs a module", hint: `one of: ${EJECTABLE2.join(", ")}` });
281318
281481
  return 2;
281319
281482
  }
281320
- const { readdirSync: readdirSync63, existsSync: fileExists } = await import("node:fs");
281483
+ const { readdirSync: readdirSync64, existsSync: fileExists } = await import("node:fs");
281321
281484
  const { join: pathJoin3 } = await import("node:path");
281322
281485
  const targets = [];
281323
281486
  const t5 = pathJoin3(dir, "tier5-src");
281324
281487
  if (fileExists(t5)) {
281325
- for (const d2 of readdirSync63(t5, { withFileTypes: true })) {
281488
+ for (const d2 of readdirSync64(t5, { withFileTypes: true })) {
281326
281489
  if (d2.isDirectory()) targets.push(pathJoin3(t5, d2.name, "index.ts"));
281327
281490
  }
281328
281491
  }
@@ -281800,8 +281963,8 @@ async function studioCommand(ctx) {
281800
281963
  const { html, plan } = buildReel2(dir);
281801
281964
  mkdirSync51(dirname66(out2), { recursive: true });
281802
281965
  writeFileSync47(out2, html);
281803
- const { pathToFileURL: pathToFileURL12 } = await import("node:url");
281804
- const url2 = pathToFileURL12(out2).href;
281966
+ const { pathToFileURL: pathToFileURL13 } = await import("node:url");
281967
+ const url2 = pathToFileURL13(out2).href;
281805
281968
  const open7 = flags["no-open"] !== true;
281806
281969
  if (open7) {
281807
281970
  const { openUrl: openUrl3 } = await Promise.resolve().then(() => (init_open_url(), open_url_exports));
@@ -283013,8 +283176,8 @@ function pushAuthHint(status2, token, target, hasOwnerIssuer = true) {
283013
283176
  }
283014
283177
  async function contentVisibility(dir) {
283015
283178
  try {
283016
- const { readFileSync: readFileSync188 } = await import("node:fs");
283017
- const m2 = JSON.parse(readFileSync188(join153(dir, "himalaya.content.json"), "utf8"));
283179
+ const { readFileSync: readFileSync189 } = await import("node:fs");
283180
+ const m2 = JSON.parse(readFileSync189(join153(dir, "himalaya.content.json"), "utf8"));
283018
283181
  if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
283019
283182
  } catch {
283020
283183
  }
@@ -284192,9 +284355,9 @@ async function shareCommand(ctx) {
284192
284355
 
284193
284356
  // src/commands/run.ts
284194
284357
  init_define_HHP_CATALOG();
284195
- import { mkdtempSync as mkdtempSync11, readFileSync as readFileSync144, rmSync as rmSync34, renameSync as renameSync21, cpSync as cpSync3 } from "node:fs";
284358
+ import { mkdtempSync as mkdtempSync11, readFileSync as readFileSync145, rmSync as rmSync35, renameSync as renameSync22, cpSync as cpSync3 } from "node:fs";
284196
284359
  import { tmpdir as tmpdir12 } from "node:os";
284197
- import { join as join157 } from "node:path";
284360
+ import { join as join158 } from "node:path";
284198
284361
  init_cli_shared();
284199
284362
  async function runPackageCommand(ctx) {
284200
284363
  const { io: io2, pos, flags, print } = ctx;
@@ -284267,11 +284430,11 @@ async function runPackageCommand(ctx) {
284267
284430
  const app2 = await appId(dir2);
284268
284431
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
284269
284432
  const bres = await buildContentBundles2(dir2, { resolution: resolutionFlag(flags) });
284270
- temp = mkdtempSync11(join157(tmpdir12(), "himi-run-build-"));
284433
+ temp = mkdtempSync11(join158(tmpdir12(), "himi-run-build-"));
284271
284434
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
284272
284435
  const initial = await buildReleaseFromContent2(dir2, temp, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir2) } : {}, ...RUN_CONTENT_BUILD2 });
284273
284436
  servedMissing = initial.missingBundles;
284274
- source2 = join157(temp, app2);
284437
+ source2 = join158(temp, app2);
284275
284438
  }
284276
284439
  const chromeArg = str3(flags.chrome) ?? "preview";
284277
284440
  if (chromeArg !== "preview" && chromeArg !== "app") {
@@ -284310,7 +284473,7 @@ async function runPackageCommand(ctx) {
284310
284473
  if (!recordKit) return;
284311
284474
  startedAt = (/* @__PURE__ */ new Date()).toISOString();
284312
284475
  const failure3 = record5(served2, { ok: true, at: startedAt });
284313
- if (!recorded) io2.error(JSON.stringify({ run: "run_record_skipped", message: `${failure3 ?? `${join157(dir, ".himi")} is not a real directory`}, so the build board will not frame this preview.` }));
284476
+ if (!recorded) io2.error(JSON.stringify({ run: "run_record_skipped", message: `${failure3 ?? `${join158(dir, ".himi")} is not a real directory`}, so the build board will not frame this preview.` }));
284314
284477
  await refreshBoard();
284315
284478
  };
284316
284479
  const retract = async () => {
@@ -284346,7 +284509,7 @@ async function runPackageCommand(ctx) {
284346
284509
  const watchKit = watch2 ? await Promise.resolve().then(() => (init_run_watch(), run_watch_exports)) : null;
284347
284510
  const hhpPreviewRoute = watch2 ? (await Promise.resolve().then(() => (init_hhp_preview(), hhp_preview_exports))).hhpPreviewResponse : null;
284348
284511
  const bus = watchKit ? new watchKit.ReloadBus() : void 0;
284349
- if (watch2) served = mkdtempSync11(join157(tmpdir12(), "himi-run-served-"));
284512
+ if (watch2) served = mkdtempSync11(join158(tmpdir12(), "himi-run-served-"));
284350
284513
  const running = await runPackage2(source2, {
284351
284514
  port,
284352
284515
  chrome: chromeArg,
@@ -284375,8 +284538,8 @@ async function runPackageCommand(ctx) {
284375
284538
  await announce(running);
284376
284539
  if (watchKit && bus) {
284377
284540
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
284378
- const live4 = join157(running.releaseRoot, running.app);
284379
- const manifestOf = (tree) => JSON.parse(readFileSync144(join157(tree, "release-manifest.json"), "utf8"));
284541
+ const live4 = join158(running.releaseRoot, running.app);
284542
+ const manifestOf = (tree) => JSON.parse(readFileSync145(join158(tree, "release-manifest.json"), "utf8"));
284380
284543
  let current = manifestOf(live4);
284381
284544
  const failed3 = async (message5) => {
284382
284545
  if (stopping) return;
@@ -284387,7 +284550,7 @@ async function runPackageCommand(ctx) {
284387
284550
  };
284388
284551
  rebuild = watchKit.serialize(async () => {
284389
284552
  const t0 = Date.now();
284390
- const next = mkdtempSync11(join157(tmpdir12(), "himi-run-build-"));
284553
+ const next = mkdtempSync11(join158(tmpdir12(), "himi-run-build-"));
284391
284554
  try {
284392
284555
  const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
284393
284556
  if (bres.compileErrors.length) {
@@ -284404,18 +284567,18 @@ async function runPackageCommand(ctx) {
284404
284567
  return;
284405
284568
  }
284406
284569
  if (stopping) return;
284407
- const fresh = manifestOf(join157(next, running.app));
284570
+ const fresh = manifestOf(join158(next, running.app));
284408
284571
  const diff = watchKit.diffReleases(current, fresh);
284409
284572
  const { describeChanges: describeChanges2, headline: headline2 } = await Promise.resolve().then(() => (init_build_changes(), build_changes_exports));
284410
- const changes = describeChanges2(live4, join157(next, running.app), diff);
284573
+ const changes = describeChanges2(live4, join158(next, running.app), diff);
284411
284574
  const retired = `${live4}.retired-${Date.now()}`;
284412
- renameSync21(live4, retired);
284575
+ renameSync22(live4, retired);
284413
284576
  try {
284414
- renameSync21(join157(next, running.app), live4);
284577
+ renameSync22(join158(next, running.app), live4);
284415
284578
  } catch {
284416
- cpSync3(join157(next, running.app), live4, { recursive: true });
284579
+ cpSync3(join158(next, running.app), live4, { recursive: true });
284417
284580
  }
284418
- rmSync34(retired, { recursive: true, force: true });
284581
+ rmSync35(retired, { recursive: true, force: true });
284419
284582
  current = fresh;
284420
284583
  servedMissing = outcome.missingBundles;
284421
284584
  for (const [event, data] of watchKit.reloadEvents(diff)) bus.publish(event, data);
@@ -284425,7 +284588,7 @@ async function runPackageCommand(ctx) {
284425
284588
  } catch (e2) {
284426
284589
  await failed3(e2.message.split("\n")[0]);
284427
284590
  } finally {
284428
- rmSync34(next, { recursive: true, force: true });
284591
+ rmSync35(next, { recursive: true, force: true });
284429
284592
  }
284430
284593
  });
284431
284594
  watcher2 = watchKit.watchContent(dir, () => {
@@ -284497,9 +284660,9 @@ async function runPackageCommand(ctx) {
284497
284660
  } finally {
284498
284661
  dropEarlySignals?.();
284499
284662
  dropInitRecord?.();
284500
- if (temp) rmSync34(temp, { recursive: true, force: true });
284501
- if (served) rmSync34(served, { recursive: true, force: true });
284502
- if (browserCopy) rmSync34(browserCopy, { recursive: true, force: true });
284663
+ if (temp) rmSync35(temp, { recursive: true, force: true });
284664
+ if (served) rmSync35(served, { recursive: true, force: true });
284665
+ if (browserCopy) rmSync35(browserCopy, { recursive: true, force: true });
284503
284666
  }
284504
284667
  }
284505
284668
 
@@ -284618,8 +284781,8 @@ init_define_HHP_CATALOG();
284618
284781
  init_preview_surfaces();
284619
284782
  init_surface_lint();
284620
284783
  init_cli_shared();
284621
- import { readFileSync as readFileSync145, readdirSync as readdirSync55 } from "node:fs";
284622
- import { join as join158 } from "node:path";
284784
+ import { readFileSync as readFileSync146, readdirSync as readdirSync56 } from "node:fs";
284785
+ import { join as join159 } from "node:path";
284623
284786
  var PRODUCED_HINTS = {
284624
284787
  "not-measured": "widget production was not measured \u2014 `--measure-widgets` evaluates this package's built bundles (it RUNS their code), or ask a running app: GET /v1/widgets. `himi validate --strict` fails a package whose declared widget does not produce.",
284625
284788
  unbuilt: "this package has no dist/bundles, so there is nothing to measure \u2014 run `himi build` first. A package with no Tier-5 bundle can declare no widget at all.",
@@ -284640,7 +284803,7 @@ async function producedWidgetFamilies(dir) {
284640
284803
  }
284641
284804
  const outDir = tier5Dir.bundleOutDir(dir);
284642
284805
  try {
284643
- readdirSync55(outDir);
284806
+ readdirSync56(outDir);
284644
284807
  } catch {
284645
284808
  return { families: void 0, source: "unbuilt" };
284646
284809
  }
@@ -284651,7 +284814,7 @@ async function producedWidgetFamilies(dir) {
284651
284814
  let js2;
284652
284815
  for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
284653
284816
  try {
284654
- js2 = readFileSync145(join158(outDir, candidate), "utf8");
284817
+ js2 = readFileSync146(join159(outDir, candidate), "utf8");
284655
284818
  break;
284656
284819
  } catch {
284657
284820
  }
@@ -285182,8 +285345,8 @@ async function promoteCommand2(ctx) {
285182
285345
  init_define_HHP_CATALOG();
285183
285346
  init_lint_report();
285184
285347
  init_cli_shared();
285185
- import { readFileSync as readFileSync146, existsSync as existsSync122 } from "node:fs";
285186
- import { createHash as createHash79 } from "node:crypto";
285348
+ import { readFileSync as readFileSync147, existsSync as existsSync123 } from "node:fs";
285349
+ import { createHash as createHash80 } from "node:crypto";
285187
285350
  var PATCH_HELP = `himi patch \u2014 change ONE item of a published app, from a raw file, on a machine
285188
285351
  that does not have the content package.
285189
285352
 
@@ -285261,7 +285424,7 @@ async function patchCommand(ctx) {
285261
285424
  io2.error(JSON.stringify({ error: `patch ${kind} needs --file`, usage: PATCH_USAGE }));
285262
285425
  return 2;
285263
285426
  }
285264
- if (!existsSync122(file2)) {
285427
+ if (!existsSync123(file2)) {
285265
285428
  io2.error(JSON.stringify({ error: `no such file: ${file2}` }));
285266
285429
  return 2;
285267
285430
  }
@@ -285317,7 +285480,7 @@ async function patchCommand(ctx) {
285317
285480
  lintNote: "`himi patch` sends a raw file. Nothing here built or linted your app \u2014 `himi push --only <selector>` is the same edit with the full lint gate in front of it."
285318
285481
  };
285319
285482
  if (kind === "tokens" || kind === "app-config") {
285320
- const body = readFileSync146(file2, "utf8");
285483
+ const body = readFileSync147(file2, "utf8");
285321
285484
  const patch2 = kind === "tokens" ? { tokens: body } : { appConfig: body };
285322
285485
  return runReleasePatch({
285323
285486
  ...common2,
@@ -285332,7 +285495,7 @@ async function patchCommand(ctx) {
285332
285495
  io2.error(JSON.stringify({ error: "patch screen needs a <screenId>", usage: PATCH_USAGE }));
285333
285496
  return 2;
285334
285497
  }
285335
- const descriptor = readFileSync146(file2, "utf8");
285498
+ const descriptor = readFileSync147(file2, "utf8");
285336
285499
  let parsed;
285337
285500
  try {
285338
285501
  parsed = JSON.parse(descriptor);
@@ -285389,8 +285552,8 @@ async function patchCommand(ctx) {
285389
285552
  extra: { kind, screen: id, file: { path: file2, bytes: Buffer.byteLength(descriptor, "utf8") } }
285390
285553
  });
285391
285554
  }
285392
- const bytes2 = readFileSync146(file2);
285393
- const sha5 = createHash79("sha256").update(bytes2).digest("hex");
285555
+ const bytes2 = readFileSync147(file2);
285556
+ const sha5 = createHash80("sha256").update(bytes2).digest("hex");
285394
285557
  const forScreens = (str3(flags["for-screen"]) ?? "").split(",").map((s5) => s5.trim()).filter(Boolean);
285395
285558
  if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
285396
285559
  io2.error(JSON.stringify({ ok: false, error: "no_rebind_takes_no_value", message: "--no-rebind is a switch and takes no value; pass it bare.", usage: PATCH_USAGE }));
@@ -285476,7 +285639,7 @@ async function patchCommand(ctx) {
285476
285639
  // src/commands/flags.ts
285477
285640
  init_define_HHP_CATALOG();
285478
285641
  init_cli_shared();
285479
- import { readFileSync as readFileSync147 } from "node:fs";
285642
+ import { readFileSync as readFileSync148 } from "node:fs";
285480
285643
  var GIT_FLAG_STORE_NOTE = "the plane accepted the write but is not serving it. Operational flags live in the app's git-committed flags.json (RFC 0013), so a control plane with no checkout \u2014 a hosted pod \u2014 writes to a filesystem that is not read back and is lost on restart. Commit the change to the app's flags.json, or point this command at a control plane that has the repo.";
285481
285644
  function servesAll(served, asked) {
285482
285645
  const stable = (v2) => JSON.stringify(v2, (_k, x2) => x2 && typeof x2 === "object" && !Array.isArray(x2) ? Object.fromEntries(Object.entries(x2).sort(([a3], [b3]) => a3.localeCompare(b3))) : x2);
@@ -285539,7 +285702,7 @@ async function flagsCommand(ctx) {
285539
285702
  }
285540
285703
  let def2;
285541
285704
  try {
285542
- const parsed = JSON.parse(arg2.startsWith("@") ? readFileSync147(arg2.slice(1), "utf8") : arg2);
285705
+ const parsed = JSON.parse(arg2.startsWith("@") ? readFileSync148(arg2.slice(1), "utf8") : arg2);
285543
285706
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
285544
285707
  io2.error(JSON.stringify({ error: "invalid_definition", problems: [`--definition must be a JSON object, got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`] }));
285545
285708
  return 2;
@@ -285880,8 +286043,8 @@ async function testflightCommand(ctx) {
285880
286043
 
285881
286044
  // src/commands/dist.ts
285882
286045
  init_define_HHP_CATALOG();
285883
- import { existsSync as existsSync129, readFileSync as readFileSync156 } from "node:fs";
285884
- import { join as join168 } from "node:path";
286046
+ import { existsSync as existsSync130, readFileSync as readFileSync157 } from "node:fs";
286047
+ import { join as join169 } from "node:path";
285885
286048
  init_wix_owner();
285886
286049
  init_cli_shared();
285887
286050
  function isCiEnvironment(env = process.env) {
@@ -285948,7 +286111,7 @@ async function distCommand(ctx) {
285948
286111
  const rememberLastDist = async (jobs2) => {
285949
286112
  try {
285950
286113
  const dir = contentDir(flags);
285951
- if (!existsSync129(join168(dir, "himalaya.content.json"))) return;
286114
+ if (!existsSync130(join169(dir, "himalaya.content.json"))) return;
285952
286115
  const { lastDistFromJob: lastDistFromJob2, writeLastDist: writeLastDist2 } = await Promise.resolve().then(() => (init_capabilities(), capabilities_exports));
285953
286116
  const own6 = await appId(dir);
285954
286117
  for (const job of jobs2) {
@@ -286247,7 +286410,7 @@ ${label4}`);
286247
286410
  }
286248
286411
  {
286249
286412
  const distDir = contentDir(flags);
286250
- if (str3(flags["app-icon-url"]) === void 0 && existsSync129(join168(distDir, "himalaya.content.json"))) {
286413
+ if (str3(flags["app-icon-url"]) === void 0 && existsSync130(join169(distDir, "himalaya.content.json"))) {
286251
286414
  const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
286252
286415
  const errors = issues.filter((i2) => i2.severity === "error");
286253
286416
  for (const i2 of issues.filter((i3) => i3.severity === "warning")) {
@@ -286268,7 +286431,7 @@ ${label4}`);
286268
286431
  const googleServicesPath = str3(flags["google-services"]);
286269
286432
  if (googleServicesPath) {
286270
286433
  try {
286271
- googleServicesJson = readFileSync156(googleServicesPath, "utf8");
286434
+ googleServicesJson = readFileSync157(googleServicesPath, "utf8");
286272
286435
  } catch {
286273
286436
  print({
286274
286437
  ok: false,
@@ -286477,7 +286640,7 @@ ${label4}`);
286477
286640
  // src/commands/login.ts
286478
286641
  init_define_HHP_CATALOG();
286479
286642
  init_config();
286480
- import { readFileSync as readFileSync157 } from "node:fs";
286643
+ import { readFileSync as readFileSync158 } from "node:fs";
286481
286644
  init_browser_login();
286482
286645
  init_wix_owner();
286483
286646
  init_owner_claim();
@@ -286945,7 +287108,7 @@ async function loginCommand(ctx) {
286945
287108
  if (flags["wix-token-stdin"]) {
286946
287109
  let piped = "";
286947
287110
  try {
286948
- piped = (ctx.deps.readStdin ?? (() => readFileSync157(0, "utf8")))().trim();
287111
+ piped = (ctx.deps.readStdin ?? (() => readFileSync158(0, "utf8")))().trim();
286949
287112
  } catch {
286950
287113
  }
286951
287114
  if (!piped) {
@@ -287105,7 +287268,7 @@ async function loginCommand(ctx) {
287105
287268
  const dpxPath = dpxSessionTokenPath();
287106
287269
  let dpx;
287107
287270
  try {
287108
- dpx = readFileSync157(dpxPath, "utf8").trim();
287271
+ dpx = readFileSync158(dpxPath, "utf8").trim();
287109
287272
  } catch {
287110
287273
  io2.error(JSON.stringify({ error: `no dpx session at ${dpxPath} \u2014 run \`dpx auth login\` then \`dpx auth token > ${dpxPath}\` (dpx 2.x keeps its own state in ~/.dpx/auth.json and does NOT write the legacy session file), or omit --dpx` }));
287111
287274
  return 1;
@@ -287482,7 +287645,7 @@ async function upgradeCommand(ctx) {
287482
287645
  init_define_HHP_CATALOG();
287483
287646
  init_config();
287484
287647
  import { statSync as statSync45, accessSync as accessSync5, constants as constants11 } from "node:fs";
287485
- import { join as join169 } from "node:path";
287648
+ import { join as join170 } from "node:path";
287486
287649
  init_wix_owner();
287487
287650
  init_owner_claim();
287488
287651
  init_self_update();
@@ -287551,7 +287714,7 @@ function executableOnPath(name, env = process.env) {
287551
287714
  const suffixes = process.platform === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
287552
287715
  for (const dir of entries) {
287553
287716
  for (const suffix of suffixes) {
287554
- const candidate = join169(dir, `${name}${suffix}`);
287717
+ const candidate = join170(dir, `${name}${suffix}`);
287555
287718
  try {
287556
287719
  if (!statSync45(candidate).isFile()) continue;
287557
287720
  if (process.platform !== "win32") accessSync5(candidate, constants11.X_OK);
@@ -287768,8 +287931,8 @@ ${report9.ok ? "OK \u2014 data + serve plane reachable." : typeof report9.hint =
287768
287931
  init_define_HHP_CATALOG();
287769
287932
  init_guides();
287770
287933
  init_cli_shared();
287771
- import { existsSync as existsSync130 } from "node:fs";
287772
- import { join as join170, resolve as resolve108 } from "node:path";
287934
+ import { existsSync as existsSync131 } from "node:fs";
287935
+ import { join as join171, resolve as resolve108 } from "node:path";
287773
287936
  async function runGuideCommand(command, pos, flags, io2, print) {
287774
287937
  const { referenceCache: referenceCache2, referenceIdentity: referenceIdentity2 } = await Promise.resolve().then(() => (init_guides(), guides_exports));
287775
287938
  const cache4 = referenceCache2();
@@ -288037,7 +288200,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
288037
288200
  ...res.removed.length ? { removed: res.removed, note: "older copies at the app root, moved to .himi/legacy-agent-files/ (a backup, in case one became app code) \u2014 the current ones live in .agents/skills/himalaya/" } : {},
288038
288201
  // In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
288039
288202
  // hash is shared with the repo gates and deliberately exempts nothing but its own metadata).
288040
- ...existsSync130(join170(dir, ".himi", "attestations", "latest.json")) ? { next: "if `himi push` then refuses the attestation as stale, re-run `himi test` \u2014 in a git checkout this refresh changed the tree it covered" } : {},
288203
+ ...existsSync131(join171(dir, ".himi", "attestations", "latest.json")) ? { next: "if `himi push` then refuses the attestation as stale, re-run `himi test` \u2014 in a git checkout this refresh changed the tree it covered" } : {},
288041
288204
  ...res.skipped.length ? { skipped: res.skipped } : {},
288042
288205
  portalUrl: idx.portalUrl
288043
288206
  });
@@ -288067,7 +288230,7 @@ async function guideCommand(ctx) {
288067
288230
 
288068
288231
  // src/commands/secrets.ts
288069
288232
  init_define_HHP_CATALOG();
288070
- import { readFileSync as readFileSync159 } from "node:fs";
288233
+ import { readFileSync as readFileSync160 } from "node:fs";
288071
288234
  init_cli_shared();
288072
288235
  async function secretsCommand(ctx) {
288073
288236
  const { io: io2, pos, flags } = ctx;
@@ -288088,7 +288251,7 @@ async function secretsCommand(ctx) {
288088
288251
  const path2 = dpxSessionTokenPath();
288089
288252
  let raw;
288090
288253
  try {
288091
- raw = readFileSync159(path2, "utf8");
288254
+ raw = readFileSync160(path2, "utf8");
288092
288255
  } catch {
288093
288256
  io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
288094
288257
  return 1;
@@ -288111,8 +288274,8 @@ init_schema2();
288111
288274
  init_define_HHP_CATALOG();
288112
288275
  init_cms_schema();
288113
288276
  init_wix_owner();
288114
- import { existsSync as existsSync131, readFileSync as readFileSync160, writeFileSync as writeFileSync56 } from "node:fs";
288115
- import { join as join171 } from "node:path";
288277
+ import { existsSync as existsSync132, readFileSync as readFileSync161, writeFileSync as writeFileSync57 } from "node:fs";
288278
+ import { join as join172 } from "node:path";
288116
288279
  var FOREIGN_DETAIL_LIMIT = 25;
288117
288280
  var MAX_COLLECTION_PAGES = 40;
288118
288281
  async function listCollections(call) {
@@ -288632,11 +288795,11 @@ async function seedCms(opts) {
288632
288795
  return report9;
288633
288796
  }
288634
288797
  function readSeedFile(dir) {
288635
- const file2 = join171(dir, "cms-seed.json");
288636
- if (!existsSync131(file2)) return {};
288798
+ const file2 = join172(dir, "cms-seed.json");
288799
+ if (!existsSync132(file2)) return {};
288637
288800
  let parsed;
288638
288801
  try {
288639
- parsed = JSON.parse(readFileSync160(file2, "utf8"));
288802
+ parsed = JSON.parse(readFileSync161(file2, "utf8"));
288640
288803
  } catch (e2) {
288641
288804
  throw new Error(`cms-seed.json is not valid JSON (${e2.message}). Fix or delete it.`);
288642
288805
  }
@@ -288682,7 +288845,7 @@ function placeholder(type2, key4, i2) {
288682
288845
  }
288683
288846
  async function writeSeedRows(opts) {
288684
288847
  const { app: app2, cms, dir, count: count3 = 8 } = opts;
288685
- const file2 = join171(dir, "cms-seed.json");
288848
+ const file2 = join172(dir, "cms-seed.json");
288686
288849
  const owned = (cms?.collections ?? []).filter((s5) => s5.id?.startsWith(namespacePrefix(app2)));
288687
288850
  if (!owned.length) {
288688
288851
  return {
@@ -288695,10 +288858,10 @@ async function writeSeedRows(opts) {
288695
288858
  };
288696
288859
  }
288697
288860
  let existing = {};
288698
- if (existsSync131(file2)) {
288861
+ if (existsSync132(file2)) {
288699
288862
  let parsed;
288700
288863
  try {
288701
- parsed = JSON.parse(readFileSync160(file2, "utf8"));
288864
+ parsed = JSON.parse(readFileSync161(file2, "utf8"));
288702
288865
  } catch (e2) {
288703
288866
  throw new Error(
288704
288867
  `cms-seed.json is not valid JSON (${e2.message}). Refusing to regenerate, because overwriting it would discard the rows already in it. Fix the JSON, or delete the file if you want a fresh set.`
@@ -288717,7 +288880,7 @@ async function writeSeedRows(opts) {
288717
288880
  );
288718
288881
  collections2[spec.id] = count3;
288719
288882
  }
288720
- writeFileSync56(file2, `${JSON.stringify(existing, null, 2)}
288883
+ writeFileSync57(file2, `${JSON.stringify(existing, null, 2)}
288721
288884
  `);
288722
288885
  const schema2 = owned.map(
288723
288886
  (s5) => ` ${s5.id} \u2014 "${s5.displayName}" (title field: ${s5.displayField})
@@ -288751,7 +288914,7 @@ ${s5.fields.map((f2) => ` ${f2.key} (${f2.type})`).join("\n")}`
288751
288914
  }
288752
288915
 
288753
288916
  // src/data.ts
288754
- import { createHash as createHash85 } from "node:crypto";
288917
+ import { createHash as createHash86 } from "node:crypto";
288755
288918
  async function planData(options2) {
288756
288919
  const kv = [];
288757
288920
  for (const spec of options2.data?.kv ?? []) {
@@ -288810,7 +288973,7 @@ var HttpDataKvAdminProvider = class {
288810
288973
  url.searchParams.set("site", scope3.siteId);
288811
288974
  url.searchParams.set("environment", scope3.environment);
288812
288975
  const serialized = body === void 0 ? void 0 : JSON.stringify(body);
288813
- const idempotencyKey = serialized === void 0 ? void 0 : createHash85("sha256").update(`${scope3.app}\0${scope3.siteId}\0${scope3.environment}\0${method}\0${name}\0${serialized}`).digest("hex");
288976
+ const idempotencyKey = serialized === void 0 ? void 0 : createHash86("sha256").update(`${scope3.app}\0${scope3.siteId}\0${scope3.environment}\0${method}\0${name}\0${serialized}`).digest("hex");
288814
288977
  const response = await this.fetchImpl(url, { method, headers: { authorization: `Bearer ${this.token}`, "content-type": "application/json", ...idempotencyKey ? { "idempotency-key": idempotencyKey } : {} }, ...serialized === void 0 ? {} : { body: serialized } });
288815
288978
  if (response.status === 404 && method === "GET") return { exists: false };
288816
288979
  if (!response.ok) throw new Error(`data admin ${method} failed (${response.status}): ${(await response.text()).slice(0, 256)}`);
@@ -289022,20 +289185,20 @@ import { randomBytes as randomBytes24 } from "node:crypto";
289022
289185
  import {
289023
289186
  closeSync as closeSync13,
289024
289187
  constants as constants12,
289025
- existsSync as existsSync133,
289188
+ existsSync as existsSync134,
289026
289189
  fstatSync as fstatSync4,
289027
289190
  lstatSync as lstatSync37,
289028
- mkdirSync as mkdirSync59,
289191
+ mkdirSync as mkdirSync60,
289029
289192
  openSync as openSync12,
289030
- readFileSync as readFileSync163,
289031
- readdirSync as readdirSync58,
289193
+ readFileSync as readFileSync164,
289194
+ readdirSync as readdirSync59,
289032
289195
  realpathSync as realpathSync22,
289033
- renameSync as renameSync24,
289034
- rmSync as rmSync38,
289196
+ renameSync as renameSync25,
289197
+ rmSync as rmSync39,
289035
289198
  statSync as statSync46,
289036
- writeFileSync as writeFileSync59
289199
+ writeFileSync as writeFileSync60
289037
289200
  } from "node:fs";
289038
- import { basename as basename41, dirname as dirname79, join as join175, relative as relative35, resolve as resolve112 } from "node:path";
289201
+ import { basename as basename41, dirname as dirname79, join as join176, relative as relative35, resolve as resolve112 } from "node:path";
289039
289202
  var L10N_USAGE = "usage: himi l10n import --format oneapp <dir> (--app <slug> | --content <app dir>) [--locales en,he] [--source en] [--overwrite] [--json]";
289040
289203
  var MESSAGES_FILE = /^messages_(.+)\.json$/;
289041
289204
  var UnsafePath = class extends Error {
@@ -289048,14 +289211,14 @@ function readRegularFile(path2) {
289048
289211
  const fd = openSync12(path2, constants12.O_RDONLY | (constants12.O_NOFOLLOW ?? 0));
289049
289212
  try {
289050
289213
  if (!fstatSync4(fd).isFile()) throw new Error(`${path2} is not a regular file`);
289051
- return readFileSync163(fd);
289214
+ return readFileSync164(fd);
289052
289215
  } finally {
289053
289216
  closeSync13(fd);
289054
289217
  }
289055
289218
  }
289056
289219
  function unsafeDestination(appDir3, tags) {
289057
- const l10nDir = join175(appDir3, "l10n");
289058
- for (const path2 of [l10nDir, ...tags.map((t2) => join175(l10nDir, `${t2}.json`))]) {
289220
+ const l10nDir = join176(appDir3, "l10n");
289221
+ for (const path2 of [l10nDir, ...tags.map((t2) => join176(l10nDir, `${t2}.json`))]) {
289059
289222
  try {
289060
289223
  if (lstatSync37(path2).isSymbolicLink()) return `${relative35(process.cwd(), path2)} is a symbolic link`;
289061
289224
  } catch (e2) {
@@ -289066,12 +289229,12 @@ function unsafeDestination(appDir3, tags) {
289066
289229
  return void 0;
289067
289230
  }
289068
289231
  function writeCatalog(path2, text30) {
289069
- const tmp = join175(dirname79(path2), `.${basename41(path2)}.${process.pid}.${randomBytes24(4).toString("hex")}.tmp`);
289232
+ const tmp = join176(dirname79(path2), `.${basename41(path2)}.${process.pid}.${randomBytes24(4).toString("hex")}.tmp`);
289070
289233
  try {
289071
- writeFileSync59(tmp, text30, { encoding: "utf8", flag: "wx" });
289072
- renameSync24(tmp, path2);
289234
+ writeFileSync60(tmp, text30, { encoding: "utf8", flag: "wx" });
289235
+ renameSync25(tmp, path2);
289073
289236
  } catch (e2) {
289074
- rmSync38(tmp, { force: true });
289237
+ rmSync39(tmp, { force: true });
289075
289238
  throw e2;
289076
289239
  }
289077
289240
  }
@@ -289109,7 +289272,7 @@ async function l10nCommand(ctx) {
289109
289272
  return fail16("app_not_found", { error: `--app ${slug}: an app slug, not a path`, hint: "pass --content <app dir> to target a directory" }, 2);
289110
289273
  }
289111
289274
  const dir = resolve112("apps", slug);
289112
- if (!existsSync133(join175(dir, "config.ts")) && !existsSync133(join175(dir, "config.js")) && !existsSync133(join175(dir, "config.mjs"))) {
289275
+ if (!existsSync134(join176(dir, "config.ts")) && !existsSync134(join176(dir, "config.js")) && !existsSync134(join176(dir, "config.mjs"))) {
289113
289276
  return fail16("app_not_found", { error: `--app ${slug}: no apps/${slug}/config.ts under ${process.cwd()}`, hint: "run from the repo root, or pass --content <app dir>" }, 2);
289114
289277
  }
289115
289278
  appDir3 = dir;
@@ -289118,19 +289281,19 @@ async function l10nCommand(ctx) {
289118
289281
  return fail16("invalid_usage", { error: "name the app: --app <slug> (in a checkout) or --content <app dir>" }, 2);
289119
289282
  }
289120
289283
  const messagesDir = resolve112(dirArg);
289121
- if (!existsSync133(messagesDir) || !statSync46(messagesDir).isDirectory()) {
289284
+ if (!existsSync134(messagesDir) || !statSync46(messagesDir).isDirectory()) {
289122
289285
  return fail16("messages_dir_not_found", { error: `${dirArg} is not a directory`, dir: messagesDir }, 1);
289123
289286
  }
289124
289287
  const fileByTag = /* @__PURE__ */ new Map();
289125
289288
  let names2;
289126
289289
  try {
289127
- names2 = readdirSync58(messagesDir).sort();
289290
+ names2 = readdirSync59(messagesDir).sort();
289128
289291
  } catch (e2) {
289129
289292
  return fail16("messages_unreadable", { error: `${dirArg} cannot be listed: ${e2.message}`, dir: messagesDir }, 1);
289130
289293
  }
289131
289294
  for (const name of names2) {
289132
289295
  const m2 = MESSAGES_FILE.exec(name);
289133
- if (m2) fileByTag.set(m2[1], join175(messagesDir, name));
289296
+ if (m2) fileByTag.set(m2[1], join176(messagesDir, name));
289134
289297
  }
289135
289298
  if (fileByTag.size === 0) {
289136
289299
  return fail16("no_messages_found", { error: `no messages_<locale>.json files in ${dirArg}`, dir: messagesDir }, 1);
@@ -289192,14 +289355,14 @@ async function l10nCommand(ctx) {
289192
289355
  try {
289193
289356
  unsafe2 = unsafeDestination(appDir3, requested);
289194
289357
  } catch (e2) {
289195
- return fail16("catalog_write_failed", { error: `cannot inspect ${relative35(process.cwd(), join175(appDir3, "l10n"))}: ${e2.message}`, written: [] }, 1);
289358
+ return fail16("catalog_write_failed", { error: `cannot inspect ${relative35(process.cwd(), join176(appDir3, "l10n"))}: ${e2.message}`, written: [] }, 1);
289196
289359
  }
289197
289360
  if (unsafe2 !== void 0) {
289198
289361
  return fail16("unsafe_path", { error: `${unsafe2} \u2014 the import does not read or write through links`, hint: "replace the link with a real directory/file inside the app, then re-run" }, 1);
289199
289362
  }
289200
289363
  for (const tag of requested) {
289201
- const path2 = join175(appDir3, "l10n", `${tag}.json`);
289202
- if (!existsSync133(path2)) continue;
289364
+ const path2 = join176(appDir3, "l10n", `${tag}.json`);
289365
+ if (!existsSync134(path2)) continue;
289203
289366
  try {
289204
289367
  const parsed = JSON.parse(readRegularFile(path2).toString("utf8"));
289205
289368
  if (!parsed || typeof parsed !== "object" || !parsed.messages || typeof parsed.messages !== "object") throw new Error("no messages object");
@@ -289260,7 +289423,7 @@ async function l10nCommand(ctx) {
289260
289423
  if (catalogs.en && checkoutRoot !== void 0) {
289261
289424
  try {
289262
289425
  const { injectAllNativeRows: injectAllNativeRows2, loadTable: loadTable2 } = await Promise.resolve().then(() => (init_auth_gate_copy(), auth_gate_copy_exports));
289263
- const table = loadTable2(join175(checkoutRoot, "core", "runtime", "l10n", "auth-gate", "en.json"));
289426
+ const table = loadTable2(join176(checkoutRoot, "core", "runtime", "l10n", "auth-gate", "en.json"));
289264
289427
  catalogs.en = injectAllNativeRows2(catalogs.en, appDir3, table);
289265
289428
  } catch (e2) {
289266
289429
  warnings.push({ warning: "native_rows_not_injected", error: `could not add the native login-gate rows to en.json (${e2.message}) \u2014 run \`npm run l10n:auth-gate\`` });
@@ -289268,14 +289431,14 @@ async function l10nCommand(ctx) {
289268
289431
  }
289269
289432
  const written = [];
289270
289433
  try {
289271
- mkdirSync59(join175(appDir3, "l10n"), { recursive: true });
289434
+ mkdirSync60(join176(appDir3, "l10n"), { recursive: true });
289272
289435
  const swapped = unsafeDestination(appDir3, requested);
289273
- const l10nReal = realpathSync22(join175(appDir3, "l10n"));
289274
- if (swapped !== void 0 || l10nReal !== join175(realpathSync22(appDir3), "l10n")) {
289275
- throw new UnsafePath(swapped ?? `${join175(appDir3, "l10n")} resolves outside the app`);
289436
+ const l10nReal = realpathSync22(join176(appDir3, "l10n"));
289437
+ if (swapped !== void 0 || l10nReal !== join176(realpathSync22(appDir3), "l10n")) {
289438
+ throw new UnsafePath(swapped ?? `${join176(appDir3, "l10n")} resolves outside the app`);
289276
289439
  }
289277
289440
  for (const tag of requested) {
289278
- const path2 = join175(appDir3, "l10n", `${tag}.json`);
289441
+ const path2 = join176(appDir3, "l10n", `${tag}.json`);
289279
289442
  writeCatalog(path2, JSON.stringify(catalogs[tag], null, 2) + "\n");
289280
289443
  written.push({ tag, path: relative35(process.cwd(), path2), count: Object.keys(catalogs[tag].messages).length });
289281
289444
  }
@@ -289316,8 +289479,8 @@ async function l10nCommand(ctx) {
289316
289479
  // src/commands/base44.ts
289317
289480
  init_define_HHP_CATALOG();
289318
289481
  init_cli_shared();
289319
- import { existsSync as existsSync141 } from "node:fs";
289320
- import { join as join184, resolve as resolve116 } from "node:path";
289482
+ import { existsSync as existsSync142 } from "node:fs";
289483
+ import { join as join185, resolve as resolve116 } from "node:path";
289321
289484
  async function base44Command(ctx) {
289322
289485
  const { io: io2, pos, flags, print } = ctx;
289323
289486
  if (pos[1] === "auth-check") {
@@ -289388,7 +289551,7 @@ async function base44Command(ctx) {
289388
289551
  return 1;
289389
289552
  };
289390
289553
  const gen = await Promise.resolve().then(() => (init_generate(), generate_exports));
289391
- const missing4 = gen.ENGINE_FILES.filter((f2) => !existsSync141(join184(dir, f2)));
289554
+ const missing4 = gen.ENGINE_FILES.filter((f2) => !existsSync142(join185(dir, f2)));
289392
289555
  if (missing4.length) {
289393
289556
  return fail16("content_dir_not_base44_starter", `${dir} is not a base44-starter content package: the generated screens import a shared engine it does not have (${missing4.join(", ")})`, { missing: missing4, hint: "scaffold one with `himi init <name> --template base44-starter --base44-app-id <id>`" });
289394
289557
  }
@@ -289474,7 +289637,7 @@ async function base44Command(ctx) {
289474
289637
  if (!provisioning || str3(flags.content) !== void 0 || !slug) return contentDir(flags);
289475
289638
  if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return void 0;
289476
289639
  const dir = resolve116("apps", slug);
289477
- return existsSync141(join184(dir, "config.ts")) || existsSync141(join184(dir, "config.mjs")) ? dir : void 0;
289640
+ return existsSync142(join185(dir, "config.ts")) || existsSync142(join185(dir, "config.mjs")) ? dir : void 0;
289478
289641
  };
289479
289642
  if (sub === "entities" || sub === "functions") {
289480
289643
  if (sub === "entities" && !["query", "create", "seed"].includes(pos[2] ?? "")) {
@@ -290041,7 +290204,7 @@ async function run2(argv, io2 = defaultIO, deps = {}) {
290041
290204
  } finally {
290042
290205
  if (watchSignals) unwatch();
290043
290206
  for (const dir of scratch) try {
290044
- rmSync51(dir, { recursive: true, force: true });
290207
+ rmSync52(dir, { recursive: true, force: true });
290045
290208
  } catch {
290046
290209
  }
290047
290210
  }