@wix/himalaya-cli 0.1853.0 → 0.1854.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -4449,6 +4449,7 @@ var init_himi_package = __esm({
4449
4449
  var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
4450
4450
  var init_icon_catalog_generated = __esm({
4451
4451
  "../../core/ts/src/icon-catalog.generated.ts"() {
4452
+ "use strict";
4452
4453
  init_define_HHP_CATALOG();
4453
4454
  ICON_VIEW_BOX = 24;
4454
4455
  ICON_STROKE_WIDTH = 2;
@@ -13560,10 +13561,10 @@ var init_preview = __esm({
13560
13561
  }
13561
13562
  },
13562
13563
  kill: (pid, signal) => process.kill(pid, signal),
13563
- portFree: (port) => new Promise((resolve134) => {
13564
+ portFree: (port) => new Promise((resolve135) => {
13564
13565
  const s5 = createServer();
13565
- s5.once("error", () => resolve134(false));
13566
- s5.listen(port, "127.0.0.1", () => s5.close(() => resolve134(true)));
13566
+ s5.once("error", () => resolve135(false));
13567
+ s5.listen(port, "127.0.0.1", () => s5.close(() => resolve135(true)));
13567
13568
  }),
13568
13569
  sleep: (ms2) => new Promise((r3) => setTimeout(r3, ms2)),
13569
13570
  servingIdentity: async (origin) => {
@@ -23100,11 +23101,11 @@ async function bootBundleWorker(bundleJs, opts) {
23100
23101
  }
23101
23102
  message5 = typeof asJson2 === "string" ? asJson2 : String(raw);
23102
23103
  } else message5 = String(raw);
23103
- const failed3 = { ...prev, _error: message5 };
23104
- if (prev.status === "loading") failed3.status = "error";
23105
- if (prev.loading === true) failed3.loading = false;
23106
- if (typeof prev.error === "string") failed3.error = message5;
23107
- def2.state = failed3;
23104
+ const failed2 = { ...prev, _error: message5 };
23105
+ if (prev.status === "loading") failed2.status = "error";
23106
+ if (prev.loading === true) failed2.loading = false;
23107
+ if (typeof prev.error === "string") failed2.error = message5;
23108
+ def2.state = failed2;
23108
23109
  };
23109
23110
  const runAction = async (def2, label4, fn2, args) => {
23110
23111
  let timer;
@@ -28160,7 +28161,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
28160
28161
  const w2 = ensureWorker();
28161
28162
  const id = nextId++;
28162
28163
  const himalaya = sandbox.himalaya;
28163
- return new Promise((resolve134, reject) => {
28164
+ return new Promise((resolve135, reject) => {
28164
28165
  const onMessage = async (msg) => {
28165
28166
  if (msg.want) {
28166
28167
  await handleWant(msg.want, opts, "boot");
@@ -28220,7 +28221,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
28220
28221
  }
28221
28222
  };
28222
28223
  }
28223
- resolve134(result);
28224
+ resolve135(result);
28224
28225
  };
28225
28226
  failInFlight = (e2) => {
28226
28227
  w2.off("message", onMessage);
@@ -28266,7 +28267,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
28266
28267
  }
28267
28268
  async function runDispatch(w2, sessionId, service, action, argsJson, timeoutMs, opts, online) {
28268
28269
  const id = nextId++;
28269
- return new Promise((resolve134, reject) => {
28270
+ return new Promise((resolve135, reject) => {
28270
28271
  const onMessage = async (msg) => {
28271
28272
  if (msg.want) {
28272
28273
  await handleWant(msg.want, opts, "dispatch");
@@ -28280,7 +28281,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
28280
28281
  return;
28281
28282
  }
28282
28283
  try {
28283
- resolve134(msg.actions ? parseWithNonFinite(msg.actions) : []);
28284
+ resolve135(msg.actions ? parseWithNonFinite(msg.actions) : []);
28284
28285
  } catch (e2) {
28285
28286
  reject(new Error(`the guest dispatch results were unreadable: ${e2?.message ?? String(e2)}`));
28286
28287
  }
@@ -28306,13 +28307,13 @@ function createQuickJsWorkerRealm(options2 = {}) {
28306
28307
  async warm() {
28307
28308
  const w2 = ensureWorker();
28308
28309
  const id = nextId++;
28309
- await new Promise((resolve134, reject) => {
28310
+ await new Promise((resolve135, reject) => {
28310
28311
  const onMessage = (msg) => {
28311
28312
  if (msg.id !== id) return;
28312
28313
  w2.off("message", onMessage);
28313
28314
  failInFlight = null;
28314
28315
  if (msg.error) reject(new Error(msg.error));
28315
- else resolve134();
28316
+ else resolve135();
28316
28317
  };
28317
28318
  failInFlight = (e2) => {
28318
28319
  w2.off("message", onMessage);
@@ -29675,7 +29676,7 @@ function literalTargets(bundleJs, ts34) {
29675
29676
  ts34.forEachChild(node3, declarations);
29676
29677
  };
29677
29678
  declarations(file2);
29678
- const resolve134 = (node3) => {
29679
+ const resolve135 = (node3) => {
29679
29680
  if (callable(node3)) return node3;
29680
29681
  if (node3 && ts34.isIdentifier(node3)) {
29681
29682
  const symbol = symbols.get(node3.text);
@@ -29789,7 +29790,7 @@ function literalTargets(bundleJs, ts34) {
29789
29790
  const actions = object16(initializer(property3(object16(node3.arguments[1]), "actions")));
29790
29791
  for (const member of actions?.properties ?? []) {
29791
29792
  const action = name(member.name);
29792
- const fn2 = ts34.isMethodDeclaration(member) ? member : resolve134(ts34.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
29793
+ const fn2 = ts34.isMethodDeclaration(member) ? member : resolve135(ts34.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
29793
29794
  if (!action || !fn2?.body) continue;
29794
29795
  const targets = [];
29795
29796
  const target = (expr) => {
@@ -41156,9 +41157,9 @@ async function offRepoFontBytes(plan, opts = {}) {
41156
41157
  out2.hostProvided.push(r3.family);
41157
41158
  continue;
41158
41159
  }
41159
- const failed3 = r3.faces.find((f2) => !f2.got.ok);
41160
- if (failed3 && !failed3.got.ok) {
41161
- out2.unavailable.push({ family: r3.family, reason: failed3.got.reason });
41160
+ const failed2 = r3.faces.find((f2) => !f2.got.ok);
41161
+ if (failed2 && !failed2.got.ok) {
41162
+ out2.unavailable.push({ family: r3.family, reason: failed2.got.reason });
41162
41163
  continue;
41163
41164
  }
41164
41165
  out2.ready.push({
@@ -41847,7 +41848,7 @@ async function injectRequest(listener, request2) {
41847
41848
  req.headers.host ??= url.host;
41848
41849
  if (body && body.length > 0) req.push(body);
41849
41850
  req.push(null);
41850
- return await new Promise((resolve134, reject) => {
41851
+ return await new Promise((resolve135, reject) => {
41851
41852
  const streamed = () => {
41852
41853
  queueMicrotask(() => {
41853
41854
  req.emit("close");
@@ -41863,7 +41864,7 @@ async function injectRequest(listener, request2) {
41863
41864
  else headers2.set(name, value2);
41864
41865
  }
41865
41866
  const bodyless = out2.status === 204 || out2.status === 304 || request2.method === "HEAD";
41866
- resolve134(new Response(bodyless ? null : out2.body, { status: out2.status, headers: headers2 }));
41867
+ resolve135(new Response(bodyless ? null : out2.body, { status: out2.status, headers: headers2 }));
41867
41868
  }, streamed);
41868
41869
  res.on("inject-error", reject);
41869
41870
  try {
@@ -42995,6 +42996,7 @@ function shouldRevealError(args) {
42995
42996
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
42996
42997
  var init_validation = __esm({
42997
42998
  "../../core/ts/src/validation.ts"() {
42999
+ "use strict";
42998
43000
  init_define_HHP_CATALOG();
42999
43001
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
43000
43002
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -46187,12 +46189,12 @@ function finalizeRecording(key4, rec) {
46187
46189
  if (rec.finalize) return rec.finalize;
46188
46190
  rec.finalize = (async () => {
46189
46191
  clearTimeout(rec.autoStop);
46190
- await new Promise((resolve134) => {
46192
+ await new Promise((resolve135) => {
46191
46193
  let done = false;
46192
46194
  const finish3 = () => {
46193
46195
  if (!done) {
46194
46196
  done = true;
46195
- resolve134();
46197
+ resolve135();
46196
46198
  }
46197
46199
  };
46198
46200
  rec.child.once("close", finish3);
@@ -46304,7 +46306,7 @@ var init_preview2 = __esm({
46304
46306
  DEVICE_LIST_TIMEOUT_MS = 5e3;
46305
46307
  defaultRunner = {
46306
46308
  capture(cmd, args, timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS) {
46307
- return new Promise((resolve134, reject) => {
46309
+ return new Promise((resolve135, reject) => {
46308
46310
  const child3 = spawn2(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
46309
46311
  const out2 = [];
46310
46312
  const err = [];
@@ -46326,7 +46328,7 @@ var init_preview2 = __esm({
46326
46328
  child3.stderr.on("data", (b3) => err.push(b3));
46327
46329
  child3.on("error", (e2) => settle3(reject, e2));
46328
46330
  child3.on("close", (code3) => {
46329
- if (code3 === 0) settle3(resolve134, Buffer.concat(out2));
46331
+ if (code3 === 0) settle3(resolve135, Buffer.concat(out2));
46330
46332
  else settle3(reject, new Error(`${cmd} exited ${code3}: ${Buffer.concat(err).toString("utf8")}`));
46331
46333
  });
46332
46334
  });
@@ -48093,10 +48095,10 @@ function ImagePreviewScope({ node: node3, ctx, render: render3 }) {
48093
48095
  if (!item2) return null;
48094
48096
  for (let attempt2 = 0; attempt2 < 3; attempt2++) {
48095
48097
  for (const step of item2.revealSteps ?? []) collections2.current.get(imagePreviewPresentationKey(step.id, step.rows))?.(step.index);
48096
- await new Promise((resolve134) => {
48098
+ await new Promise((resolve135) => {
48097
48099
  const view = root.ownerDocument.defaultView;
48098
- if (view?.requestAnimationFrame) view.requestAnimationFrame(() => resolve134());
48099
- else setTimeout(resolve134, 0);
48100
+ if (view?.requestAnimationFrame) view.requestAnimationFrame(() => resolve135());
48101
+ else setTimeout(resolve135, 0);
48100
48102
  });
48101
48103
  const tile = find2(position);
48102
48104
  if (tile) {
@@ -48184,18 +48186,18 @@ function installImageNetworkReturns(doc = typeof document === "undefined" ? void
48184
48186
  const view = doc?.defaultView;
48185
48187
  if (!doc || !view || installed.has(doc)) return;
48186
48188
  installed.add(doc);
48187
- const failed3 = /* @__PURE__ */ new WeakSet();
48189
+ const failed2 = /* @__PURE__ */ new WeakSet();
48188
48190
  const tries = /* @__PURE__ */ new WeakMap();
48189
48191
  let wasOffline = view.navigator?.onLine === false;
48190
48192
  let timer;
48191
48193
  const image = (event) => event.target instanceof view.HTMLImageElement ? event.target : void 0;
48192
48194
  doc.addEventListener("error", (event) => {
48193
48195
  const img = image(event);
48194
- if (img) failed3.add(img);
48196
+ if (img) failed2.add(img);
48195
48197
  }, true);
48196
48198
  doc.addEventListener("load", (event) => {
48197
48199
  const img = image(event);
48198
- if (img) failed3.delete(img);
48200
+ if (img) failed2.delete(img);
48199
48201
  }, true);
48200
48202
  const stop2 = () => {
48201
48203
  if (timer !== void 0) view.clearTimeout(timer);
@@ -48216,8 +48218,8 @@ function installImageNetworkReturns(doc = typeof document === "undefined" ? void
48216
48218
  function wake() {
48217
48219
  view.dispatchEvent(new view.Event(RETURNED));
48218
48220
  for (const img of Array.from(doc.querySelectorAll("img"))) {
48219
- if (!failed3.has(img)) continue;
48220
- failed3.delete(img);
48221
+ if (!failed2.has(img)) continue;
48222
+ failed2.delete(img);
48221
48223
  const source2 = img.getAttribute("src") ?? "";
48222
48224
  const tried = tries.get(img);
48223
48225
  const count3 = tried?.source === source2 ? tried.count : 0;
@@ -48229,23 +48231,23 @@ function installImageNetworkReturns(doc = typeof document === "undefined" ? void
48229
48231
  }
48230
48232
  }
48231
48233
  }
48232
- function useReloadOnNetworkReturn(failed3, reload) {
48234
+ function useReloadOnNetworkReturn(failed2, reload) {
48233
48235
  const latest = React3.useRef(reload);
48234
48236
  latest.current = reload;
48235
48237
  const tries = React3.useRef();
48236
48238
  React3.useEffect(() => {
48237
48239
  const view = typeof window === "undefined" ? void 0 : window;
48238
- if (!failed3 || !view) return;
48240
+ if (!failed2 || !view) return;
48239
48241
  installImageNetworkReturns(view.document);
48240
48242
  const returned = () => {
48241
- const count3 = tries.current?.source === failed3 ? tries.current.count : 0;
48243
+ const count3 = tries.current?.source === failed2 ? tries.current.count : 0;
48242
48244
  if (count3 >= LIMIT) return;
48243
- tries.current = { source: failed3, count: count3 + 1 };
48245
+ tries.current = { source: failed2, count: count3 + 1 };
48244
48246
  latest.current();
48245
48247
  };
48246
48248
  view.addEventListener(RETURNED, returned);
48247
48249
  return () => view.removeEventListener(RETURNED, returned);
48248
- }, [failed3]);
48250
+ }, [failed2]);
48249
48251
  }
48250
48252
  var LIMIT, RETURNED, installed;
48251
48253
  var init_image_network_returns = __esm({
@@ -48304,8 +48306,8 @@ function useImageSource(url, box) {
48304
48306
  React4.useEffect(() => {
48305
48307
  if (!url || !load6 || policy !== "ownerScoped" || !adapter) return;
48306
48308
  const controller = new AbortController();
48307
- const settle3 = (next, failed3 = false) => {
48308
- if (!controller.signal.aborted) setResolved({ source: url, adapter, url: next, failed: failed3 });
48309
+ const settle3 = (next, failed2 = false) => {
48310
+ if (!controller.signal.aborted) setResolved({ source: url, adapter, url: next, failed: failed2 });
48309
48311
  };
48310
48312
  adapter.load(load6, controller.signal).then((next) => settle3(next), () => settle3(null, true));
48311
48313
  return () => controller.abort();
@@ -49777,8 +49779,8 @@ var init_SnackbarBubble = __esm({
49777
49779
  const size = SNACKBAR_LIMITS.imageSize;
49778
49780
  const resolved3 = useImageSource(url, { width: size, height: size, mode: "fill" });
49779
49781
  const sources = useResponsiveImage(resolved3.url, size, size, "fill");
49780
- const [failed3, setFailed] = React9.useState(null);
49781
- if (!resolved3.url || failed3 === resolved3.url) return null;
49782
+ const [failed2, setFailed] = React9.useState(null);
49783
+ if (!resolved3.url || failed2 === resolved3.url) return null;
49782
49784
  return /* @__PURE__ */ jsx5(
49783
49785
  "img",
49784
49786
  {
@@ -51366,10 +51368,10 @@ function fullscreenEntry(doc, host, video) {
51366
51368
  function canEnterFullscreen(doc, host, video) {
51367
51369
  return fullscreenEntry(doc, host, video) !== void 0;
51368
51370
  }
51369
- function sameClip(loaded2, next, failed3) {
51371
+ function sameClip(loaded2, next, failed2) {
51370
51372
  if (!loaded2?.url || !next.url) return false;
51371
51373
  if (loaded2.url === next.url) return true;
51372
- if (failed3 || !loaded2.id || loaded2.id !== next.id) return false;
51374
+ if (failed2 || !loaded2.id || loaded2.id !== next.id) return false;
51373
51375
  const strip4 = (raw) => {
51374
51376
  try {
51375
51377
  const u2 = new URL(raw);
@@ -51999,14 +52001,14 @@ function createRicosHostSession(o2) {
51999
52001
  let baseline = null, lastContent = null;
52000
52002
  let dirtyTimer = null;
52001
52003
  const flushes = /* @__PURE__ */ new Map();
52002
- const unavailable = (r3) => {
52004
+ const unavailable2 = (r3) => {
52003
52005
  if (state.unavailable || disposed) return;
52004
52006
  state.unavailable = r3;
52005
52007
  t2.clearTimeout(readyTimer);
52006
52008
  o2.onUnavailable(r3);
52007
52009
  };
52008
52010
  const readyTimer = t2.setTimeout(() => {
52009
- if (!state.ready) unavailable("timeout");
52011
+ if (!state.ready) unavailable2("timeout");
52010
52012
  }, o2.readyTimeoutMs ?? RICOS_HOST_DEFAULTS.readyTimeoutMs);
52011
52013
  const sendInit = () => {
52012
52014
  initSent = true;
@@ -52100,7 +52102,7 @@ function createRicosHostSession(o2) {
52100
52102
  if (!m2.focused) void session.flush();
52101
52103
  return;
52102
52104
  case "error":
52103
- if (isFatalPageError(m2.code)) unavailable("engine");
52105
+ if (isFatalPageError(m2.code)) unavailable2("engine");
52104
52106
  return;
52105
52107
  }
52106
52108
  },
@@ -52155,12 +52157,12 @@ function createRicosHostSession(o2) {
52155
52157
  flush() {
52156
52158
  if (!state.ready || state.unavailable || disposed) return Promise.resolve(null);
52157
52159
  const requestId2 = newId();
52158
- return new Promise((resolve134) => {
52160
+ return new Promise((resolve135) => {
52159
52161
  const timer = t2.setTimeout(() => {
52160
52162
  flushes.delete(requestId2);
52161
- resolve134(null);
52163
+ resolve135(null);
52162
52164
  }, flushMs);
52163
- flushes.set(requestId2, { resolve: resolve134, timer });
52165
+ flushes.set(requestId2, { resolve: resolve135, timer });
52164
52166
  o2.send({ v: 1, type: "requestContent", requestId: requestId2 });
52165
52167
  });
52166
52168
  },
@@ -52177,7 +52179,7 @@ function createRicosHostSession(o2) {
52177
52179
  if (state.ready) o2.send({ v: 1, type: "blur" });
52178
52180
  },
52179
52181
  markMissing() {
52180
- if (!state.ready) unavailable("missing");
52182
+ if (!state.ready) unavailable2("missing");
52181
52183
  },
52182
52184
  dispose() {
52183
52185
  disposed = true;
@@ -52220,7 +52222,7 @@ async function runRicosImageUpload(o2) {
52220
52222
  };
52221
52223
  session.insertMediaPlaceholder(requestId2);
52222
52224
  try {
52223
- const entry = await new Promise((resolve134) => {
52225
+ const entry = await new Promise((resolve135) => {
52224
52226
  let done = false;
52225
52227
  let unsub = () => {
52226
52228
  };
@@ -52229,7 +52231,7 @@ async function runRicosImageUpload(o2) {
52229
52231
  done = true;
52230
52232
  t2.clearTimeout(timer);
52231
52233
  queueMicrotask(() => unsub());
52232
- resolve134(v2);
52234
+ resolve135(v2);
52233
52235
  };
52234
52236
  const timer = t2.setTimeout(() => finish3(null), o2.timeoutMs ?? RICOS_UPLOAD_TIMEOUT_MS);
52235
52237
  unsub = deps.subscribe(`${svc}.uploads.${requestId2}`, (v2) => {
@@ -52794,9 +52796,9 @@ var init_presigned_upload_policy = __esm({
52794
52796
  function mediaFieldName(label4) {
52795
52797
  return typeof label4 === "string" && label4.trim() !== "" ? label4 : MEDIA_FIELD_DEFAULT_LABEL;
52796
52798
  }
52797
- function mediaFieldState(uploading, hasPhoto, failed3 = false) {
52799
+ function mediaFieldState(uploading, hasPhoto, failed2 = false) {
52798
52800
  if (uploading) return "Uploading";
52799
- if (failed3) return MEDIA_FIELD_UPLOAD_FAILED;
52801
+ if (failed2) return MEDIA_FIELD_UPLOAD_FAILED;
52800
52802
  return hasPhoto ? "Photo added" : void 0;
52801
52803
  }
52802
52804
  function mediaFieldServicePath(valuePath) {
@@ -52826,10 +52828,10 @@ async function runMediaFieldUpload(o2) {
52826
52828
  }, o2.timeoutMs ?? MEDIA_FIELD_UPLOAD_TIMEOUT_MS);
52827
52829
  const bounded2 = (p2) => {
52828
52830
  if (expired) return Promise.reject(new Deadline());
52829
- return new Promise((resolve134, reject) => {
52831
+ return new Promise((resolve135, reject) => {
52830
52832
  const stop2 = () => reject(new Deadline());
52831
52833
  onExpire.push(stop2);
52832
- p2.then(resolve134, reject).finally(() => {
52834
+ p2.then(resolve135, reject).finally(() => {
52833
52835
  onExpire = onExpire.filter((f2) => f2 !== stop2);
52834
52836
  });
52835
52837
  });
@@ -52852,7 +52854,7 @@ async function runMediaFieldUpload(o2) {
52852
52854
  const before = deps.value(urlPath);
52853
52855
  let uploadUrl;
52854
52856
  try {
52855
- uploadUrl = await bounded2(new Promise((resolve134, reject) => {
52857
+ uploadUrl = await bounded2(new Promise((resolve135, reject) => {
52856
52858
  let done = false;
52857
52859
  let unsub = () => {
52858
52860
  };
@@ -52860,7 +52862,7 @@ async function runMediaFieldUpload(o2) {
52860
52862
  if (done || typeof v2 !== "string" || v2 === "" || v2 === before) return;
52861
52863
  done = true;
52862
52864
  queueMicrotask(() => unsub());
52863
- resolve134(v2);
52865
+ resolve135(v2);
52864
52866
  });
52865
52867
  onExpire.push(() => {
52866
52868
  if (!done) {
@@ -52875,7 +52877,7 @@ async function runMediaFieldUpload(o2) {
52875
52877
  if (typeof now === "string" && now !== "" && now !== before) {
52876
52878
  done = true;
52877
52879
  queueMicrotask(() => unsub());
52878
- resolve134(now);
52880
+ resolve135(now);
52879
52881
  return;
52880
52882
  }
52881
52883
  }
@@ -55962,7 +55964,7 @@ async function fetchData(url, type2 = "text") {
55962
55964
  }
55963
55965
  return response.text();
55964
55966
  }
55965
- return new Promise((resolve134, reject) => {
55967
+ return new Promise((resolve135, reject) => {
55966
55968
  const request2 = new XMLHttpRequest();
55967
55969
  request2.open("GET", url, true);
55968
55970
  request2.responseType = type2 === "bytes" ? "arraybuffer" : type2;
@@ -55973,14 +55975,14 @@ async function fetchData(url, type2 = "text") {
55973
55975
  if (request2.status === 200 || request2.status === 0) {
55974
55976
  switch (type2) {
55975
55977
  case "bytes":
55976
- resolve134(new Uint8Array(request2.response));
55978
+ resolve135(new Uint8Array(request2.response));
55977
55979
  return;
55978
55980
  case "blob":
55979
55981
  case "json":
55980
- resolve134(request2.response);
55982
+ resolve135(request2.response);
55981
55983
  return;
55982
55984
  }
55983
- resolve134(request2.responseText);
55985
+ resolve135(request2.responseText);
55984
55986
  return;
55985
55987
  }
55986
55988
  reject(new Error(request2.statusText));
@@ -58985,13 +58987,13 @@ var init_pdf = __esm({
58985
58987
  var aCallable = __webpack_require__3(9306);
58986
58988
  var $TypeError = TypeError;
58987
58989
  var PromiseCapability = function(C2) {
58988
- var resolve134, reject;
58990
+ var resolve135, reject;
58989
58991
  this.promise = new C2(function($$resolve, $$reject) {
58990
- if (resolve134 !== void 0 || reject !== void 0) throw new $TypeError("Bad Promise constructor");
58991
- resolve134 = $$resolve;
58992
+ if (resolve135 !== void 0 || reject !== void 0) throw new $TypeError("Bad Promise constructor");
58993
+ resolve135 = $$resolve;
58992
58994
  reject = $$reject;
58993
58995
  });
58994
- this.resolve = aCallable(resolve134);
58996
+ this.resolve = aCallable(resolve135);
58995
58997
  this.reject = aCallable(reject);
58996
58998
  };
58997
58999
  module.exports.f = function(C2) {
@@ -59359,8 +59361,8 @@ var init_pdf = __esm({
59359
59361
  anObject(C2);
59360
59362
  if (isObject6(x2) && x2.constructor === C2) return x2;
59361
59363
  var promiseCapability = newPromiseCapability.f(C2);
59362
- var resolve134 = promiseCapability.resolve;
59363
- resolve134(x2);
59364
+ var resolve135 = promiseCapability.resolve;
59365
+ resolve135(x2);
59364
59366
  return promiseCapability.promise;
59365
59367
  };
59366
59368
  },
@@ -63214,11 +63216,11 @@ var init_pdf = __esm({
63214
63216
  const mustRemoveAspectRatioPromise = _ImageManager._isSVGFittingCanvas;
63215
63217
  const fileReader = new FileReader();
63216
63218
  const imageElement = new Image();
63217
- const imagePromise = new Promise((resolve134, reject) => {
63219
+ const imagePromise = new Promise((resolve135, reject) => {
63218
63220
  imageElement.onload = () => {
63219
63221
  data.bitmap = imageElement;
63220
63222
  data.isSvg = true;
63221
- resolve134();
63223
+ resolve135();
63222
63224
  };
63223
63225
  fileReader.onload = async () => {
63224
63226
  const url = data.svgUrl = fileReader.result;
@@ -63904,13 +63906,13 @@ var init_pdf = __esm({
63904
63906
  return;
63905
63907
  }
63906
63908
  const {
63907
- resolve: resolve134,
63909
+ resolve: resolve135,
63908
63910
  promise
63909
63911
  } = Promise.withResolvers();
63910
63912
  const onEditorsRendered = (evt) => {
63911
63913
  if (evt.pageNumber === pageNumber2) {
63912
63914
  this._eventBus.off("editorsrendered", onEditorsRendered);
63913
- resolve134();
63915
+ resolve135();
63914
63916
  }
63915
63917
  };
63916
63918
  this._eventBus.on("editorsrendered", onEditorsRendered, internalOpt);
@@ -68948,8 +68950,8 @@ var init_pdf = __esm({
68948
68950
  if (this.isSyncFontLoadingSupported) {
68949
68951
  return;
68950
68952
  }
68951
- await new Promise((resolve134) => {
68952
- const request2 = this._queueLoadingCallback(resolve134);
68953
+ await new Promise((resolve135) => {
68954
+ const request2 = this._queueLoadingCallback(resolve135);
68953
68955
  this._prepareFontLoadEvent(font, request2);
68954
68956
  });
68955
68957
  }
@@ -85989,7 +85991,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
85989
85991
  input.type = "file";
85990
85992
  input.accept = SupportedImageMimeTypes.join(",");
85991
85993
  const signal = this._uiManager._signal;
85992
- this.#bitmapPromise = new Promise((resolve134) => {
85994
+ this.#bitmapPromise = new Promise((resolve135) => {
85993
85995
  input.addEventListener("change", async () => {
85994
85996
  if (!input.files || input.files.length === 0) {
85995
85997
  this.remove();
@@ -86004,13 +86006,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
86004
86006
  });
86005
86007
  this.#getBitmapFetched(data);
86006
86008
  }
86007
- resolve134();
86009
+ resolve135();
86008
86010
  }, {
86009
86011
  signal
86010
86012
  });
86011
86013
  input.addEventListener("cancel", () => {
86012
86014
  this.remove();
86013
- resolve134();
86015
+ resolve135();
86014
86016
  }, {
86015
86017
  signal
86016
86018
  });
@@ -136281,14 +136283,14 @@ function PdfDocument({ src, nativeSrc, title, height, startPage, zoomPercent, st
136281
136283
  const [pages2, setPages] = React21.useState(0);
136282
136284
  const [failedRequest, setFailedRequest] = React21.useState(null);
136283
136285
  const request2 = JSON.stringify([src, zoomPercent]);
136284
- const failed3 = failedRequest === request2;
136286
+ const failed2 = failedRequest === request2;
136285
136287
  const containerRef = React21.useRef(null);
136286
136288
  const frameRef = React21.useRef(null);
136287
136289
  const startPageRef = React21.useRef(startPage);
136288
136290
  startPageRef.current = startPage;
136289
136291
  React21.useEffect(() => {
136290
- if (failed3) onFallback?.();
136291
- }, [failed3, onFallback]);
136292
+ if (failed2) onFallback?.();
136293
+ }, [failed2, onFallback]);
136292
136294
  React21.useEffect(() => {
136293
136295
  const frame2 = frameRef.current;
136294
136296
  const page = Math.min(pages2, Math.max(1, Math.floor(startPage ?? 1) || 1));
@@ -136340,7 +136342,7 @@ function PdfDocument({ src, nativeSrc, title, height, startPage, zoomPercent, st
136340
136342
  // PDF pages need their own scroll viewport so every page remains reachable.
136341
136343
  overflow: "auto"
136342
136344
  };
136343
- if (failed3) {
136345
+ if (failed2) {
136344
136346
  return /* @__PURE__ */ jsx14("object", { "data-himalaya-pdf": "native-fallback", "data-himalaya-pdf-zoom": zoomPercent ?? 100, data: nativeSrc, type: "application/pdf", "aria-label": title, style: frame });
136345
136347
  }
136346
136348
  return /* @__PURE__ */ jsxs11("div", { ref: frameRef, "data-himalaya-pdf": "canvas-document", "data-himalaya-pdf-src": src, "data-himalaya-pdf-zoom": zoomPercent ?? 100, "data-himalaya-pdf-start-page": startPage ?? 1, "data-himalaya-pdf-native-src": nativeSrc, role: "group", "aria-label": title, "aria-busy": pages2 === 0, style: frame, children: [
@@ -140597,14 +140599,14 @@ var init_renderNode = __esm({
140597
140599
  const fallbackBound = useBoundValue(ctx, fallbackPathStr ? String(props2.fallbackTextPath) : "");
140598
140600
  const fallbackText = typeof fallbackBound === "string" ? fallbackBound : "";
140599
140601
  const [uploading, setUploading] = React22.useState(false);
140600
- const [failed3, setFailed] = React22.useState(false);
140602
+ const [failed2, setFailed] = React22.useState(false);
140601
140603
  const fileRef2 = React22.useRef(null);
140602
140604
  const previewRef = React22.useRef(null);
140603
140605
  const [localPreview, setLocalPreview] = React22.useState("");
140604
140606
  const uploadService = typeof props2.uploadService === "string" ? props2.uploadService : "";
140605
140607
  const resolvedLabel = asText2(resolveScalarStatic(props2.label, ctx));
140606
140608
  const name = mediaFieldName(resolvedLabel);
140607
- const state = mediaFieldState(uploading, imageUrl !== "", failed3);
140609
+ const state = mediaFieldState(uploading, imageUrl !== "", failed2);
140608
140610
  const open6 = () => {
140609
140611
  if (!uploading) fileRef2.current?.click();
140610
140612
  };
@@ -140697,7 +140699,7 @@ var init_renderNode = __esm({
140697
140699
  /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: 4, alignItems: "flex-start" }, children: [
140698
140700
  heading ? /* @__PURE__ */ jsx15("span", { style: { fontFamily: fontStack(f2.family, ctx.idiom), fontWeight: f2.weight, fontSize: f2.remSize, color: C2("textSecondary", "#6B7280") }, children: heading }) : null,
140699
140701
  /* @__PURE__ */ jsx15("span", { style: { fontSize: pxToRem(13), color: accentTextColor(ctx) }, children: caption }),
140700
- failed3 ? /* @__PURE__ */ jsx15("span", { "data-media-upload-error": "true", style: { fontSize: pxToRem(13), color: C2("danger", "#E62214") }, children: MEDIA_FIELD_UPLOAD_FAILED }) : null
140702
+ failed2 ? /* @__PURE__ */ jsx15("span", { "data-media-upload-error": "true", style: { fontSize: pxToRem(13), color: C2("danger", "#E62214") }, children: MEDIA_FIELD_UPLOAD_FAILED }) : null
140701
140703
  ] })
140702
140704
  ] }) : /* @__PURE__ */ jsxs12(Fragment5, { children: [
140703
140705
  assetSrc ? /* @__PURE__ */ jsx15("img", { src: assetSrc, alt: "", "aria-hidden": "true", style: { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", display: "block" } }) : /* @__PURE__ */ jsxs12("div", { "aria-hidden": "true", style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 8, color: accentTextColor(ctx) }, children: [
@@ -140705,7 +140707,7 @@ var init_renderNode = __esm({
140705
140707
  /* @__PURE__ */ jsx15("span", { style: { fontFamily: fontStack(f2.family, ctx.idiom), fontWeight: f2.weight, fontSize: f2.remSize }, children: name })
140706
140708
  ] }),
140707
140709
  uploading ? /* @__PURE__ */ jsx15("div", { "aria-hidden": "true", "data-media-uploading": "true", style: { position: "absolute", inset: 0, background: "rgba(0,0,0,0.35)" } }) : null,
140708
- failed3 && !uploading ? /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", "data-media-upload-error": "true", style: { position: "absolute", left: 8, right: 8, bottom: 8, textAlign: "center", fontSize: pxToRem(13), color: C2("danger", "#E62214") }, children: MEDIA_FIELD_UPLOAD_FAILED }) : null
140710
+ failed2 && !uploading ? /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", "data-media-upload-error": "true", style: { position: "absolute", left: 8, right: 8, bottom: 8, textAlign: "center", fontSize: pxToRem(13), color: C2("danger", "#E62214") }, children: MEDIA_FIELD_UPLOAD_FAILED }) : null
140709
140711
  ] })
140710
140712
  ]
140711
140713
  }
@@ -141585,10 +141587,10 @@ var init_renderNode = __esm({
141585
141587
  });
141586
141588
  FormView = withExtras("FormView", ({ props: props2, ctx: inputCtx, wrap }) => {
141587
141589
  const needsWorker = hasWorkerFormSubmit(props2.submitButton);
141588
- const unavailable = needsWorker && inputCtx.formReadiness === "unavailable";
141590
+ const unavailable2 = needsWorker && inputCtx.formReadiness === "unavailable";
141589
141591
  const refreshing = needsWorker && inputCtx.formReadiness === "refreshing";
141590
- const waiting = needsWorker && !unavailable && (refreshing || inputCtx.formReadiness === "pending" || inputCtx.formReadiness === void 0 && inputCtx.workerReady === false);
141591
- const ctx = waiting || unavailable ? { ...inputCtx, onAction: null } : inputCtx;
141592
+ const waiting = needsWorker && !unavailable2 && (refreshing || inputCtx.formReadiness === "pending" || inputCtx.formReadiness === void 0 && inputCtx.workerReady === false);
141593
+ const ctx = waiting || unavailable2 ? { ...inputCtx, onAction: null } : inputCtx;
141592
141594
  const bagRef = React22.useRef(null);
141593
141595
  if (!bagRef.current) bagRef.current = createFormBag();
141594
141596
  const bag = bagRef.current;
@@ -141612,15 +141614,15 @@ var init_renderNode = __esm({
141612
141614
  };
141613
141615
  const submitNode = React22.useMemo(() => {
141614
141616
  const node3 = props2.submitButton;
141615
- if (!node3 || valid3 && !waiting && !unavailable) return node3;
141617
+ if (!node3 || valid3 && !waiting && !unavailable2) return node3;
141616
141618
  if (node3.body) return { ...node3, body: { ...node3.body, props: { ...node3.body.props ?? {}, disabled: true } } };
141617
141619
  return { ...node3, props: { ...node3.props ?? {}, disabled: true } };
141618
- }, [props2.submitButton, valid3, waiting, unavailable]);
141620
+ }, [props2.submitButton, valid3, waiting, unavailable2]);
141619
141621
  return /* @__PURE__ */ jsxs12("div", { "aria-busy": waiting || void 0, style: { display: "flex", flexDirection: "column", gap: 14, width: "100%", ...wrap }, children: [
141620
141622
  waiting && /* @__PURE__ */ jsx15("span", { role: "status", children: refreshing ? "Refreshing form\u2026" : "Loading form\u2026" }),
141621
- unavailable && /* @__PURE__ */ jsx15("span", { role: "status", children: "Form unavailable. Please try again." }),
141623
+ unavailable2 && /* @__PURE__ */ jsx15("span", { role: "status", children: "Form unavailable. Please try again." }),
141622
141624
  /* @__PURE__ */ jsxs12(FormValuesContext.Provider, { value: bag, children: [
141623
- /* @__PURE__ */ jsx15("fieldset", { disabled: waiting || unavailable, style: { display: waiting && !refreshing ? "none" : "contents", border: 0, padding: 0, margin: 0, minWidth: 0 }, children: kids2(props2.fields, ctx) }),
141625
+ /* @__PURE__ */ jsx15("fieldset", { disabled: waiting || unavailable2, style: { display: waiting && !refreshing ? "none" : "contents", border: 0, padding: 0, margin: 0, minWidth: 0 }, children: kids2(props2.fields, ctx) }),
141624
141626
  submitNode && renderNode(submitNode, submitCtx)
141625
141627
  ] })
141626
141628
  ] });
@@ -147911,13 +147913,13 @@ __export(render_descriptor_exports, {
147911
147913
  stabilizePngPage: () => stabilizePngPage,
147912
147914
  withRetry: () => withRetry
147913
147915
  });
147914
- function a11ySemantics(type2, props2, modifiers, ancestorHidden, resolve134) {
147916
+ function a11ySemantics(type2, props2, modifiers, ancestorHidden, resolve135) {
147915
147917
  if (!A11Y_MODIFIER_KEYS.some((k3) => modifiers[k3] !== void 0)) return void 0;
147916
147918
  const literal3 = (v2) => typeof v2 === "string" && v2.trim() !== "" && !isDynamicValue(v2) ? v2 : void 0;
147917
147919
  const spoken = (v2) => {
147918
147920
  const lit = literal3(v2);
147919
- if (lit !== void 0 || !resolve134 || typeof v2 !== "string" || !isDynamicValue(v2)) return lit;
147920
- const r3 = resolve134(v2);
147921
+ if (lit !== void 0 || !resolve135 || typeof v2 !== "string" || !isDynamicValue(v2)) return lit;
147922
+ const r3 = resolve135(v2);
147921
147923
  if (r3 === v2) return void 0;
147922
147924
  return typeof r3 === "string" && r3.trim() !== "" ? r3 : typeof r3 === "number" ? String(r3) : void 0;
147923
147925
  };
@@ -147931,7 +147933,7 @@ function a11ySemantics(type2, props2, modifiers, ancestorHidden, resolve134) {
147931
147933
  if (name !== void 0 && exposure === "exposed") out2.name = name;
147932
147934
  const hint = spoken(modifiers.accessibilityHint);
147933
147935
  if (hint !== void 0) out2.hint = hint;
147934
- const value2 = spoken(modifiers.accessibilityValue) ?? controlState(role, props2, resolve134);
147936
+ const value2 = spoken(modifiers.accessibilityValue) ?? controlState(role, props2, resolve135);
147935
147937
  if (value2 !== void 0) out2.value = value2;
147936
147938
  if (typeof modifiers.headingLevel === "number") out2.headingLevel = modifiers.headingLevel;
147937
147939
  if (exposure !== "exposed") out2.exposure = exposure;
@@ -147952,13 +147954,13 @@ function a11ySemantics(type2, props2, modifiers, ancestorHidden, resolve134) {
147952
147954
  }
147953
147955
  return out2;
147954
147956
  }
147955
- function controlState(role, props2, resolve134) {
147957
+ function controlState(role, props2, resolve135) {
147956
147958
  if (role !== "toggle" && role !== "checkbox" && role !== "radio") return void 0;
147957
147959
  if (role === "checkbox" && props2.indeterminate === true) return "mixed";
147958
147960
  const binding2 = typeof props2.valuePath === "string" ? props2.valuePath : typeof props2.value === "string" && isDynamicValue(props2.value) ? props2.value : void 0;
147959
147961
  let on4;
147960
147962
  if (binding2 !== void 0) {
147961
- const v2 = resolve134 ? resolve134(binding2) : void 0;
147963
+ const v2 = resolve135 ? resolve135(binding2) : void 0;
147962
147964
  if (v2 === true || v2 === 1 || v2 === "true" || v2 === "1") on4 = true;
147963
147965
  else if (v2 === false || v2 === 0 || v2 === "false" || v2 === "0") on4 = false;
147964
147966
  else return void 0;
@@ -148573,7 +148575,7 @@ async function stabilizePngPage(page, scheme) {
148573
148575
  const browser = globalThis;
148574
148576
  browser.document.documentElement.style.colorScheme = selected;
148575
148577
  await browser.document.fonts?.ready;
148576
- await new Promise((resolve134) => browser.requestAnimationFrame(() => browser.requestAnimationFrame(() => resolve134())));
148578
+ await new Promise((resolve135) => browser.requestAnimationFrame(() => browser.requestAnimationFrame(() => resolve135())));
148577
148579
  }, scheme);
148578
148580
  }
148579
148581
  function setPngEgress(start2) {
@@ -148780,7 +148782,7 @@ async function resolveEgress(host, port, allow = allowedOrigins) {
148780
148782
  return addrs.every((a3) => isPublicAddress(a3.address)) ? addrs : null;
148781
148783
  }
148782
148784
  function connectFirst(addrs, port, track2) {
148783
- return new Promise((resolve134, reject) => {
148785
+ return new Promise((resolve135, reject) => {
148784
148786
  const tryAt = (i2) => {
148785
148787
  if (i2 >= addrs.length) return reject(new Error("no address answered"));
148786
148788
  const s5 = net.connect({ host: addrs[i2].address, family: addrs[i2].family, port });
@@ -148794,7 +148796,7 @@ function connectFirst(addrs, port, track2) {
148794
148796
  s5.once("connect", () => {
148795
148797
  s5.off("error", onFail);
148796
148798
  s5.setTimeout(0);
148797
- resolve134(s5);
148799
+ resolve135(s5);
148798
148800
  });
148799
148801
  };
148800
148802
  tryAt(0);
@@ -148900,16 +148902,16 @@ async function startEgressProxy() {
148900
148902
  upstream.pipe(socket);
148901
148903
  socket.pipe(upstream);
148902
148904
  });
148903
- await new Promise((resolve134, reject) => {
148905
+ await new Promise((resolve135, reject) => {
148904
148906
  server.once("error", reject);
148905
- server.listen(0, "127.0.0.1", () => resolve134());
148907
+ server.listen(0, "127.0.0.1", () => resolve135());
148906
148908
  });
148907
148909
  const { port } = server.address();
148908
148910
  return {
148909
148911
  url: `http://127.0.0.1:${port}`,
148910
148912
  blocked: blocked2,
148911
- close: () => new Promise((resolve134) => {
148912
- server.close(() => resolve134());
148913
+ close: () => new Promise((resolve135) => {
148914
+ server.close(() => resolve135());
148913
148915
  for (const s5 of sockets) s5.destroy();
148914
148916
  server.closeAllConnections?.();
148915
148917
  })
@@ -151530,14 +151532,14 @@ async function pipeWebWixStream(upstream, res, signal, recordStream) {
151530
151532
  const chunk2 = await reader.read();
151531
151533
  if (chunk2.done) break;
151532
151534
  if (chunk2.value && !res.write(chunk2.value)) {
151533
- await new Promise((resolve134) => {
151535
+ await new Promise((resolve135) => {
151534
151536
  let settled = false;
151535
151537
  const finish3 = () => {
151536
151538
  if (settled) return;
151537
151539
  settled = true;
151538
151540
  res.off("drain", finish3);
151539
151541
  res.off("close", finish3);
151540
- resolve134();
151542
+ resolve135();
151541
151543
  };
151542
151544
  if (res.destroyed || !res.writable) finish3();
151543
151545
  else {
@@ -151625,7 +151627,7 @@ async function handleWebWix(req, res, state) {
151625
151627
  }
151626
151628
  if (match) {
151627
151629
  const mocked = match.rule.response;
151628
- if (mocked.delayMs) await new Promise((resolve134) => setTimeout(resolve134, mocked.delayMs));
151630
+ if (mocked.delayMs) await new Promise((resolve135) => setTimeout(resolve135, mocked.delayMs));
151629
151631
  const payload = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
151630
151632
  recordStream("mock", mocked.status, match.rule.id, mocked.headers);
151631
151633
  res.statusCode = mocked.status;
@@ -151910,7 +151912,7 @@ async function handleWebWix(req, res, state) {
151910
151912
  }
151911
151913
  if (match) {
151912
151914
  const mocked = match.rule.response;
151913
- if (mocked.delayMs) await new Promise((resolve134) => setTimeout(resolve134, mocked.delayMs));
151915
+ if (mocked.delayMs) await new Promise((resolve135) => setTimeout(resolve135, mocked.delayMs));
151914
151916
  const responseBody = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
151915
151917
  record5("mock", mocked.status, responseBody, match.rule.id, mocked.headers);
151916
151918
  return reply(200, { status: mocked.status, body: responseBody ?? "" });
@@ -155337,12 +155339,12 @@ var init_query = __esm({
155337
155339
  });
155338
155340
 
155339
155341
  // ../../core/dev-server/src/crawl-input.ts
155340
- function resolved2(v2, resolve134) {
155341
- if (typeof v2 === "string") return v2.startsWith("$service:") ? resolve134(v2) : v2;
155342
+ function resolved2(v2, resolve135) {
155343
+ if (typeof v2 === "string") return v2.startsWith("$service:") ? resolve135(v2) : v2;
155342
155344
  if (Array.isArray(v2)) {
155343
155345
  const out2 = v2.flatMap((el2) => {
155344
155346
  if (typeof el2 !== "string" || !el2.startsWith("$service:")) return [el2];
155345
- const r3 = resolve134(el2);
155347
+ const r3 = resolve135(el2);
155346
155348
  return Array.isArray(r3) ? r3 : [r3];
155347
155349
  });
155348
155350
  return out2;
@@ -155356,9 +155358,9 @@ function hasRowBinding(props2) {
155356
155358
  return itemToken(v2) || Array.isArray(v2) && v2.some(itemToken);
155357
155359
  });
155358
155360
  }
155359
- function declaredOptionIds(props2, resolve134) {
155361
+ function declaredOptionIds(props2, resolve135) {
155360
155362
  const literal3 = props2.options ?? props2.tabs ?? props2.chips;
155361
- const bound2 = props2.optionsPath !== void 0 ? resolved2(props2.optionsPath, resolve134) : void 0;
155363
+ const bound2 = props2.optionsPath !== void 0 ? resolved2(props2.optionsPath, resolve135) : void 0;
155362
155364
  const raw = Array.isArray(bound2) ? bound2 : literal3;
155363
155365
  if (!Array.isArray(raw)) return [];
155364
155366
  const out2 = [];
@@ -155401,24 +155403,24 @@ function seedTokens(state, limit = 48) {
155401
155403
  walk5(state, 0);
155402
155404
  return out2;
155403
155405
  }
155404
- function synthesizeInput(control, resolve134, tokens2) {
155406
+ function synthesizeInput(control, resolve135, tokens2) {
155405
155407
  const id = `${control.type}.${control.callback}`;
155406
155408
  const row2 = SYNTHESIZED_CONTROLS[id];
155407
155409
  if (!row2) return null;
155408
155410
  const props2 = control.props;
155409
155411
  if (hasRowBinding(props2)) return null;
155410
155412
  if (row2.from === "declared-options") {
155411
- const ids2 = declaredOptionIds(props2, resolve134);
155413
+ const ids2 = declaredOptionIds(props2, resolve135);
155412
155414
  if (!ids2.length) return null;
155413
155415
  if (row2.encoding === "string-array") {
155414
- const currentRaw2 = resolved2(props2.selectedIds, resolve134);
155416
+ const currentRaw2 = resolved2(props2.selectedIds, resolve135);
155415
155417
  const current3 = (Array.isArray(currentRaw2) ? currentRaw2 : []).filter((x2) => typeof x2 === "string");
155416
155418
  const pick7 = ids2.find((o2) => !current3.includes(o2));
155417
155419
  if (pick7 === void 0) return null;
155418
155420
  const value2 = props2.multiSelect === true ? [...current3, pick7] : [pick7];
155419
155421
  return { key: row2.key, value: value2, from: row2.from, current: current3, control: id };
155420
155422
  }
155421
- const currentRaw = resolved2(props2.selectedId, resolve134);
155423
+ const currentRaw = resolved2(props2.selectedId, resolve135);
155422
155424
  const current2 = typeof currentRaw === "string" ? currentRaw : void 0;
155423
155425
  const pick6 = ids2.find((o2) => o2 !== current2);
155424
155426
  if (pick6 === void 0) return null;
@@ -155426,7 +155428,7 @@ function synthesizeInput(control, resolve134, tokens2) {
155426
155428
  }
155427
155429
  if (!acceptsWords(props2) || !acceptsWords(control.wrapper ?? {})) return null;
155428
155430
  const binding2 = typeof props2.valuePath === "string" ? props2.valuePath : typeof props2.value === "string" && props2.value.startsWith("$service:") ? props2.value : void 0;
155429
- const bound2 = binding2 === void 0 ? void 0 : resolve134(binding2);
155431
+ const bound2 = binding2 === void 0 ? void 0 : resolve135(binding2);
155430
155432
  const literal3 = typeof props2.value === "string" && !props2.value.startsWith("$") ? props2.value : void 0;
155431
155433
  const current = typeof bound2 === "string" ? bound2 : typeof bound2 === "number" ? String(bound2) : literal3 ?? "";
155432
155434
  const max = typeof props2.maxLength === "number" && props2.maxLength > 0 ? props2.maxLength : void 0;
@@ -159219,14 +159221,14 @@ function countingWixCall(base2) {
159219
159221
  let returned = 0;
159220
159222
  let empty2 = 0;
159221
159223
  let refused2 = 0;
159222
- const failed3 = [];
159224
+ const failed2 = [];
159223
159225
  return {
159224
159226
  call: async (method, path2, body) => {
159225
159227
  let out2;
159226
159228
  try {
159227
159229
  out2 = await base2(method, path2, body);
159228
159230
  } catch (e2) {
159229
- failed3.push(`${String(method).toUpperCase()} ${String(path2).split("?")[0]}`);
159231
+ failed2.push(`${String(method).toUpperCase()} ${String(path2).split("?")[0]}`);
159230
159232
  if (/^HTTP (401|403)\b/.test(e2?.message ?? "")) refused2 += 1;
159231
159233
  throw e2;
159232
159234
  }
@@ -159237,7 +159239,7 @@ function countingWixCall(base2) {
159237
159239
  returned: () => returned,
159238
159240
  empty: () => empty2,
159239
159241
  refused: () => refused2,
159240
- failed: () => [...failed3]
159242
+ failed: () => [...failed2]
159241
159243
  };
159242
159244
  }
159243
159245
  function countingHostAnswers(host) {
@@ -159288,7 +159290,7 @@ async function liveRenderServices(bundleJs, opts) {
159288
159290
  return loadBundleServicesLive(bundleJs, liveBootOptions(opts, bus));
159289
159291
  }
159290
159292
  async function settleUnawaitedWork() {
159291
- for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((resolve134) => setTimeout(resolve134, 0));
159293
+ for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((resolve135) => setTimeout(resolve135, 0));
159292
159294
  }
159293
159295
  async function loadAndSettle(bundleJs, options2) {
159294
159296
  const w2 = await bootBundleWorker(bundleJs, options2);
@@ -162532,8 +162534,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
162532
162534
  }
162533
162535
  async function appId(dir) {
162534
162536
  try {
162535
- const { readFileSync: readFileSync196 } = await import("node:fs");
162536
- const m2 = JSON.parse(readFileSync196(join42(dir, "himalaya.content.json"), "utf8"));
162537
+ const { readFileSync: readFileSync197 } = await import("node:fs");
162538
+ const m2 = JSON.parse(readFileSync197(join42(dir, "himalaya.content.json"), "utf8"));
162537
162539
  if (m2.name) return m2.name;
162538
162540
  } catch {
162539
162541
  }
@@ -162822,17 +162824,17 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
162822
162824
  };
162823
162825
  }
162824
162826
  function execNpmConfig(file2, args, options2) {
162825
- return new Promise((resolve134, reject) => {
162826
- execFile(file2, args, { ...options2, windowsHide: true }, (error, stdout) => error ? reject(error) : resolve134(String(stdout)));
162827
+ return new Promise((resolve135, reject) => {
162828
+ execFile(file2, args, { ...options2, windowsHide: true }, (error, stdout) => error ? reject(error) : resolve135(String(stdout)));
162827
162829
  });
162828
162830
  }
162829
162831
  async function scopedRegistryBefore(lookup4, deadline, onTimeout) {
162830
162832
  let cancel = () => {
162831
162833
  };
162832
- const expired = new Promise((resolve134) => {
162834
+ const expired = new Promise((resolve135) => {
162833
162835
  const timer = setTimeout(() => {
162834
162836
  onTimeout?.();
162835
- resolve134(void 0);
162837
+ resolve135(void 0);
162836
162838
  }, Math.max(0, deadline - Date.now()));
162837
162839
  cancel = () => clearTimeout(timer);
162838
162840
  });
@@ -163583,7 +163585,7 @@ async function mintToken(args, label4, cacheKey, spawnImpl) {
163583
163585
  tokenCache.set(cacheKey, fromEnv);
163584
163586
  return fromEnv;
163585
163587
  }
163586
- const token = await new Promise((resolve134, reject) => {
163588
+ const token = await new Promise((resolve135, reject) => {
163587
163589
  let child3;
163588
163590
  try {
163589
163591
  child3 = spawnImpl("wix", [...args]);
@@ -163614,12 +163616,12 @@ async function mintToken(args, label4, cacheKey, spawnImpl) {
163614
163616
  child3.stdout?.on("data", (d2) => {
163615
163617
  out2 += String(d2);
163616
163618
  const m2 = out2.match(TOKEN_RE);
163617
- if (m2) done(() => resolve134(m2[0]));
163619
+ if (m2) done(() => resolve135(m2[0]));
163618
163620
  });
163619
163621
  child3.stderr?.on("data", (d2) => {
163620
163622
  out2 += String(d2);
163621
163623
  const m2 = out2.match(TOKEN_RE);
163622
- if (m2) done(() => resolve134(m2[0]));
163624
+ if (m2) done(() => resolve135(m2[0]));
163623
163625
  });
163624
163626
  child3.on("error", (e2) => done(() => reject(spawnFailure(label4, e2))));
163625
163627
  child3.on("exit", (code3) => done(() => reject(new WixTokenError(
@@ -174641,10 +174643,10 @@ function assertPublicSiteUrl(raw) {
174641
174643
  if (refusal2) throw new Error(refusal2);
174642
174644
  }
174643
174645
  function resolveAll(hostname8) {
174644
- return new Promise((resolve134, reject) => {
174646
+ return new Promise((resolve135, reject) => {
174645
174647
  dnsLookup(hostname8, { all: true, verbatim: true }, (err, addresses) => {
174646
174648
  if (err) reject(err);
174647
- else resolve134(addresses);
174649
+ else resolve135(addresses);
174648
174650
  });
174649
174651
  });
174650
174652
  }
@@ -174652,13 +174654,13 @@ function withAbort(start2, signal, what) {
174652
174654
  if (signal?.aborted) return Promise.reject(new Error(`${what} aborted`));
174653
174655
  const work = start2();
174654
174656
  if (!signal) return work;
174655
- return new Promise((resolve134, reject) => {
174657
+ return new Promise((resolve135, reject) => {
174656
174658
  const onAbort = () => reject(new Error(`${what} aborted`));
174657
174659
  signal.addEventListener("abort", onAbort, { once: true });
174658
- work.then(resolve134, reject).finally(() => signal.removeEventListener("abort", onAbort));
174660
+ work.then(resolve135, reject).finally(() => signal.removeEventListener("abort", onAbort));
174659
174661
  });
174660
174662
  }
174661
- async function pinAddress(url, resolve134 = resolveAll, signal) {
174663
+ async function pinAddress(url, resolve135 = resolveAll, signal) {
174662
174664
  const host = url.hostname.replace(/^\[|\]$/g, "");
174663
174665
  if (ipv4Octets(host)) {
174664
174666
  if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
@@ -174668,7 +174670,7 @@ async function pinAddress(url, resolve134 = resolveAll, signal) {
174668
174670
  if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
174669
174671
  return { address: host, family: 6 };
174670
174672
  }
174671
- const addresses = await withAbort(() => resolve134(host), signal, `${host} lookup`);
174673
+ const addresses = await withAbort(() => resolve135(host), signal, `${host} lookup`);
174672
174674
  if (!addresses.length) throw new Error(`${host} resolved to no address`);
174673
174675
  const blocked2 = addresses.filter((a3) => isBlockedAddress(a3.address)).map((a3) => a3.address);
174674
174676
  if (blocked2.length) throw new Error(`${host} resolves to a blocked address (${blocked2.join(", ")})`);
@@ -174708,7 +174710,7 @@ function copyIncomingHeaders(headers2) {
174708
174710
  return out2;
174709
174711
  }
174710
174712
  function requestOnce(url, pinned, init) {
174711
- return new Promise((resolve134, reject) => {
174713
+ return new Promise((resolve135, reject) => {
174712
174714
  const headers2 = { host: url.host, "accept-encoding": "identity" };
174713
174715
  new Headers(init.headers ?? {}).forEach((value2, key4) => {
174714
174716
  if (key4.toLowerCase() !== "host") headers2[key4] = value2;
@@ -174738,7 +174740,7 @@ function requestOnce(url, pinned, init) {
174738
174740
  reject(err);
174739
174741
  return;
174740
174742
  }
174741
- resolve134(new Response(body, { status: status2, statusText: res.statusMessage ?? "", headers: out2 }));
174743
+ resolve135(new Response(body, { status: status2, statusText: res.statusMessage ?? "", headers: out2 }));
174742
174744
  }
174743
174745
  );
174744
174746
  req.on("error", reject);
@@ -177213,22 +177215,22 @@ import { dirname as dirname36, join as join50 } from "node:path";
177213
177215
  function noPlaywrightRemedy(platform = process.platform) {
177214
177216
  return NO_PLAYWRIGHT_STEPS.join(platform === "win32" ? "\n" : " && ");
177215
177217
  }
177216
- function playwrightCliPath(resolve134) {
177218
+ function playwrightCliPath(resolve135) {
177217
177219
  try {
177218
- return join50(dirname36(resolve134("playwright/package.json")), "cli.js");
177220
+ return join50(dirname36(resolve135("playwright/package.json")), "cli.js");
177219
177221
  } catch {
177220
177222
  return void 0;
177221
177223
  }
177222
177224
  }
177223
- function playwrightInstallCommand(resolve134 = createRequire4(import.meta.url).resolve, platform = process.platform) {
177224
- const cli = playwrightCliPath(resolve134);
177225
+ function playwrightInstallCommand(resolve135 = createRequire4(import.meta.url).resolve, platform = process.platform) {
177226
+ const cli = playwrightCliPath(resolve135);
177225
177227
  if (!cli) return noPlaywrightRemedy(platform);
177226
177228
  if (platform === "win32") return `node "${cli}" install chromium`;
177227
177229
  return `node '${cli.replace(/'/g, "'\\''")}' install chromium`;
177228
177230
  }
177229
177231
  function browserReadiness(deps = {}) {
177230
177232
  const require2 = createRequire4(import.meta.url);
177231
- const resolve134 = deps.resolve ?? require2.resolve;
177233
+ const resolve135 = deps.resolve ?? require2.resolve;
177232
177234
  const platform = deps.platform ?? process.platform;
177233
177235
  const exists2 = deps.exists ?? existsSync58;
177234
177236
  const readVersion = deps.readVersion ?? ((path2) => {
@@ -177241,7 +177243,7 @@ function browserReadiness(deps = {}) {
177241
177243
  const chromiumPath = deps.chromiumPath ?? (() => require2("playwright").chromium.executablePath());
177242
177244
  let pkg;
177243
177245
  try {
177244
- pkg = resolve134("playwright/package.json");
177246
+ pkg = resolve135("playwright/package.json");
177245
177247
  } catch {
177246
177248
  return { ready: false, playwright: { installed: false }, chromium: { installed: false }, code: "browser_unavailable", fix: noPlaywrightRemedy(platform), fixSteps: [...NO_PLAYWRIGHT_STEPS] };
177247
177249
  }
@@ -177261,8 +177263,8 @@ function browserReadiness(deps = {}) {
177261
177263
  playwright,
177262
177264
  chromium: { installed: false, ...executablePath ? { executablePath } : {} },
177263
177265
  code: "browser_unavailable",
177264
- fix: playwrightInstallCommand(resolve134, platform),
177265
- fixSteps: [playwrightInstallCommand(resolve134, platform)]
177266
+ fix: playwrightInstallCommand(resolve135, platform),
177267
+ fixSteps: [playwrightInstallCommand(resolve135, platform)]
177266
177268
  };
177267
177269
  }
177268
177270
  function installChromium(deps = {}) {
@@ -179333,6 +179335,28 @@ var init_push_setup_apple_credentials = __esm({
179333
179335
  }
179334
179336
  });
179335
179337
 
179338
+ // ../../core/serve-control/src/setup/types.ts
179339
+ var PUSH_SETUP_STAGES, PUSH_SETUP_LEASE_MS;
179340
+ var init_types3 = __esm({
179341
+ "../../core/serve-control/src/setup/types.ts"() {
179342
+ init_define_HHP_CATALOG();
179343
+ PUSH_SETUP_STAGES = [
179344
+ "read_branded_record",
179345
+ "create_branded_record",
179346
+ "configure_branded_record",
179347
+ "migrate_branded_record",
179348
+ "write_build_secrets",
179349
+ "create_app_store_secrets",
179350
+ "save_push_credentials",
179351
+ "read_back_ping",
179352
+ // Android Google sign-in, after push setup has made the Firebase app.
179353
+ "write_certificate_fingerprint",
179354
+ "sync_android_client"
179355
+ ];
179356
+ PUSH_SETUP_LEASE_MS = 5 * 6e4;
179357
+ }
179358
+ });
179359
+
179336
179360
  // src/notify-errors.ts
179337
179361
  var NOTIFY_FAILURE_CODES, notifyCode, login, tokenFrom, repair, NOTIFY_HINTS;
179338
179362
  var init_notify_errors = __esm({
@@ -179654,7 +179678,9 @@ function renderPushStatus(http3, refresh = false) {
179654
179678
  note: "Backend setup is separate from building the app, device registration and notification delivery."
179655
179679
  };
179656
179680
  }
179657
- function report(http3, flags, io2, dir, config, withSignIn = false) {
179681
+ function report(http3, flags, io2, dir, config, detail = {}) {
179682
+ const { withSignIn = false, withSteps = false } = detail;
179683
+ const steps = withSteps ? obj2(http3.body?.steps) : {};
179658
179684
  const status2 = renderPushStatus(http3, flags.refresh === true);
179659
179685
  const result = config && !config.pushOn ? { ...status2, ok: false, error: status2.error ?? (config.rolledBack ? "config_edit_rolled_back" : "config_push_not_on") } : status2;
179660
179686
  const local = readPushOnboarding(dir).push;
@@ -179662,7 +179688,8 @@ function report(http3, flags, io2, dir, config, withSignIn = false) {
179662
179688
  ...result,
179663
179689
  ...local ? { localOnboarding: "deferred" } : {},
179664
179690
  ...config ? { config } : {},
179665
- ...withSignIn ? { signIn: renderSignInStatus(http3) } : {}
179691
+ ...withSignIn ? { signIn: renderSignInStatus(http3) } : {},
179692
+ ...withSteps && Object.keys(steps).length ? { steps } : {}
179666
179693
  }, null, 2));
179667
179694
  return result.ok ? 0 : 1;
179668
179695
  }
@@ -179826,7 +179853,7 @@ async function runNotifySetup(pos, flags, io2, deps = {}) {
179826
179853
  input.app = ownership.slug;
179827
179854
  const common2 = { target, wixToken, previewTag, fetchImpl: deps.fetchImpl };
179828
179855
  const readStatus2 = (live4 = false) => pushSetupRequest({ ...common2, operation: "status", query: { app: input.app, site: input.site, ...live4 ? { verify: "live" } : {} } });
179829
- if (operation === "status") return report(await readStatus2(flags.refresh === true), flags, io2, dir, void 0, deps.withSignIn === true);
179856
+ if (operation === "status") return report(await readStatus2(flags.refresh === true), flags, io2, dir, void 0, { withSignIn: deps.withSignIn === true, withSteps: deps.withSteps === true });
179830
179857
  const previous = await readStatus2();
179831
179858
  if (!previous.ok || !STATES.has(String(previous.body?.state))) return report(previous, flags, io2, dir);
179832
179859
  if (String(previous.body?.error ?? "").startsWith("apple_provisioning_outcome_unknown")) return refuse4(io2, "apple_provisioning_outcome_unknown", "Inspect the previous Apple operation before retrying.", 1);
@@ -179873,6 +179900,7 @@ var init_notify_setup = __esm({
179873
179900
  init_define_HHP_CATALOG();
179874
179901
  init_push_setup();
179875
179902
  init_push_setup_apple_credentials();
179903
+ init_types3();
179876
179904
  init_owner_claim();
179877
179905
  init_hosted_owner();
179878
179906
  init_notify_errors();
@@ -179884,7 +179912,7 @@ var init_notify_setup = __esm({
179884
179912
  CHECK_STATES = /* @__PURE__ */ new Set(["verified", "missing", "mismatch", "unknown", "not_checked", "not_required"]);
179885
179913
  SOCIAL_CHECKS = ["appleConnection", "appleCapability", "googleIos", "googleAndroid", "androidSha1"];
179886
179914
  CODE = /^[a-z][a-z0-9_]{0,63}$/;
179887
- STAGES = /* @__PURE__ */ new Set(["create_branded_app", "configure_branded_app", "write_build_secrets", "create_app_store_secrets", "save_push_credentials", "read_back_ping"]);
179915
+ STAGES = new Set(PUSH_SETUP_STAGES);
179888
179916
  ERROR_CODES = /* @__PURE__ */ new Set(["forbidden_site", "forbidden_cross_tenant", "unauthorized", "push_setup_unconfigured", "push_setup_unavailable", "already_running", "apple_provisioning_outcome_unknown", "ping_verification_unavailable", "bundle_id_changed", "site_already_claimed", "read_build_secrets_grant_missing"]);
179889
179917
  PROMPTS = {
179890
179918
  site: "Wix site ID (metaSiteId)",
@@ -181333,8 +181361,8 @@ function watchFlagConflict(opts) {
181333
181361
  return null;
181334
181362
  }
181335
181363
  function rebuildBlocker(outcome, servedMissing) {
181336
- const failed3 = outcome.failedToBuild[0];
181337
- if (failed3) return `${failed3.screenId}: ${failed3.error.split("\n")[0]}`;
181364
+ const failed2 = outcome.failedToBuild[0];
181365
+ if (failed2) return `${failed2.screenId}: ${failed2.error.split("\n")[0]}`;
181338
181366
  const had = new Set(servedMissing.map((m2) => `${m2.screen}\0${m2.bundle}`));
181339
181367
  const lost2 = outcome.missingBundles.find((m2) => !had.has(`${m2.screen}\0${m2.bundle}`));
181340
181368
  if (lost2) return `${lost2.screen}: its worker bundle "${lost2.bundle}" is referenced but was not built`;
@@ -184739,14 +184767,14 @@ function parseSocialSignInConfig(configTs) {
184739
184767
  if (!configTs.includes("socialSignIn")) return {};
184740
184768
  const file2 = ts17.createSourceFile("config.ts", configTs, ts17.ScriptTarget.Latest, false, ts17.ScriptKind.TS);
184741
184769
  const consts = collectConsts(file2);
184742
- const resolve134 = (e2, depth = 0) => {
184770
+ const resolve135 = (e2, depth = 0) => {
184743
184771
  while (e2 && (ts17.isAsExpression(e2) || ts17.isSatisfiesExpression(e2) || ts17.isParenthesizedExpression(e2))) e2 = e2.expression;
184744
- return e2 && ts17.isIdentifier(e2) && depth < 8 ? resolve134(consts.get(e2.text), depth + 1) : e2;
184772
+ return e2 && ts17.isIdentifier(e2) && depth < 8 ? resolve135(consts.get(e2.text), depth + 1) : e2;
184745
184773
  };
184746
184774
  const objectProp = (o2, name) => {
184747
184775
  const p2 = o2.properties.filter((x2) => propName5(x2) === name).pop();
184748
184776
  if (!p2) return void 0;
184749
- return resolve134(ts17.isPropertyAssignment(p2) ? p2.initializer : ts17.isShorthandPropertyAssignment(p2) ? p2.name : void 0);
184777
+ return resolve135(ts17.isPropertyAssignment(p2) ? p2.initializer : ts17.isShorthandPropertyAssignment(p2) ? p2.name : void 0);
184750
184778
  };
184751
184779
  const literal3 = (o2, name) => {
184752
184780
  const v2 = objectProp(o2, name);
@@ -184755,7 +184783,7 @@ function parseSocialSignInConfig(configTs) {
184755
184783
  let found = {};
184756
184784
  const visit = (node3) => {
184757
184785
  if ((ts17.isPropertyAssignment(node3) || ts17.isShorthandPropertyAssignment(node3)) && propName5(node3) === "socialSignIn") {
184758
- const block = resolve134(ts17.isPropertyAssignment(node3) ? node3.initializer : node3.name);
184786
+ const block = resolve135(ts17.isPropertyAssignment(node3) ? node3.initializer : node3.name);
184759
184787
  if (block && ts17.isObjectLiteralExpression(block)) {
184760
184788
  const google = objectProp(block, "google");
184761
184789
  found = google && ts17.isObjectLiteralExpression(google) ? { google: definedOnly({ iosClientId: literal3(google, "iosClientId"), serverClientId: literal3(google, "serverClientId") }) } : {};
@@ -190722,14 +190750,14 @@ function legacyImportSourceKinds(configTs) {
190722
190750
  ts18.forEachChild(node3, collect2);
190723
190751
  };
190724
190752
  collect2(file2);
190725
- const resolve134 = (e2, depth = 0) => {
190753
+ const resolve135 = (e2, depth = 0) => {
190726
190754
  while (e2 && (ts18.isAsExpression(e2) || ts18.isSatisfiesExpression(e2) || ts18.isParenthesizedExpression(e2))) e2 = e2.expression;
190727
- return e2 && ts18.isIdentifier(e2) && depth < 8 ? resolve134(consts.get(e2.text), depth + 1) : e2;
190755
+ return e2 && ts18.isIdentifier(e2) && depth < 8 ? resolve135(consts.get(e2.text), depth + 1) : e2;
190728
190756
  };
190729
- const valueOf2 = (p2) => !p2 ? void 0 : ts18.isPropertyAssignment(p2) ? resolve134(p2.initializer) : ts18.isShorthandPropertyAssignment(p2) ? resolve134(p2.name) : void 0;
190757
+ const valueOf2 = (p2) => !p2 ? void 0 : ts18.isPropertyAssignment(p2) ? resolve135(p2.initializer) : ts18.isShorthandPropertyAssignment(p2) ? resolve135(p2.name) : void 0;
190730
190758
  const props2 = (o2, depth = 0) => o2.properties.flatMap((p2) => {
190731
190759
  if (!ts18.isSpreadAssignment(p2)) return [p2];
190732
- const inner = resolve134(p2.expression);
190760
+ const inner = resolve135(p2.expression);
190733
190761
  return inner && ts18.isObjectLiteralExpression(inner) && depth < 8 ? props2(inner, depth + 1) : [];
190734
190762
  });
190735
190763
  const prop2 = (o2, name) => props2(o2).filter((p2) => nameOf2(p2) === name).pop();
@@ -190741,11 +190769,11 @@ function legacyImportSourceKinds(configTs) {
190741
190769
  if (sources && ts18.isArrayLiteralExpression(sources)) {
190742
190770
  const flat2 = (els, depth = 0) => els.flatMap((x2) => {
190743
190771
  if (!ts18.isSpreadElement(x2)) return [x2];
190744
- const arr3 = resolve134(x2.expression);
190772
+ const arr3 = resolve135(x2.expression);
190745
190773
  return arr3 && ts18.isArrayLiteralExpression(arr3) && depth < 8 ? flat2(arr3.elements, depth + 1) : [];
190746
190774
  });
190747
190775
  for (const raw of flat2(sources.elements)) {
190748
- const el2 = resolve134(raw);
190776
+ const el2 = resolve135(raw);
190749
190777
  if (!el2 || !ts18.isObjectLiteralExpression(el2)) continue;
190750
190778
  const kind = valueOf2(prop2(el2, "kind"));
190751
190779
  if (kind && ts18.isStringLiteralLike(kind)) kinds.add(kind.text);
@@ -195150,7 +195178,7 @@ function commitChange(repo, base2, branch, rel2, body) {
195150
195178
  return validationDiffHash(repo);
195151
195179
  }
195152
195180
  function runSelfTest() {
195153
- let failed3 = 0;
195181
+ let failed2 = 0;
195154
195182
  for (const testCase of SELF_TEST_CASES) {
195155
195183
  let ok5 = false;
195156
195184
  let thrown = null;
@@ -195164,12 +195192,12 @@ function runSelfTest() {
195164
195192
  `);
195165
195193
  continue;
195166
195194
  }
195167
- failed3++;
195195
+ failed2++;
195168
195196
  process.stderr.write(` \u2717 ${testCase.name}
195169
195197
  ${thrown ?? testCase.reason}
195170
195198
  `);
195171
195199
  }
195172
- return failed3;
195200
+ return failed2;
195173
195201
  }
195174
195202
  var VALIDATION_METADATA, SELF_TEST_CASES;
195175
195203
  var init_diff_hash = __esm({
@@ -195250,10 +195278,10 @@ var init_diff_hash = __esm({
195250
195278
  if (process.argv[1] && basename23(process.argv[1]) === "diff-hash.mjs" && import.meta.url === pathToFileURL7(process.argv[1]).href) {
195251
195279
  if (process.argv.slice(2).includes("--self-test")) {
195252
195280
  process.stdout.write("\u25B8 diff-hash --self-test: proving the identity can change, and can hold\n");
195253
- const failed3 = runSelfTest();
195254
- if (failed3) {
195281
+ const failed2 = runSelfTest();
195282
+ if (failed2) {
195255
195283
  process.stderr.write(
195256
- `\u2717 diff-hash self-test FAILED (${failed3} case(s)) \u2014 the evidence record's diff identity cannot be trusted
195284
+ `\u2717 diff-hash self-test FAILED (${failed2} case(s)) \u2014 the evidence record's diff identity cannot be trusted
195257
195285
  `
195258
195286
  );
195259
195287
  process.exit(1);
@@ -196533,7 +196561,7 @@ async function pinnedFetch2(url, init, addresses, maxResponseBytes) {
196533
196561
  const headers2 = Object.fromEntries(new Headers(init.headers).entries());
196534
196562
  const request2 = url.protocol === "https:" ? httpsRequest2 : httpRequest;
196535
196563
  const hostname8 = url.hostname.replace(/^\[|\]$/g, "");
196536
- return await new Promise((resolve134, reject) => {
196564
+ return await new Promise((resolve135, reject) => {
196537
196565
  let settled = false;
196538
196566
  const finish3 = (fn2) => {
196539
196567
  if (settled) return;
@@ -196570,7 +196598,7 @@ async function pinnedFetch2(url, init, addresses, maxResponseBytes) {
196570
196598
  }
196571
196599
  const responseHeaders = new Headers();
196572
196600
  for (const [key4, value2] of Object.entries(response.headers)) if (value2 !== void 0) responseHeaders.set(key4, Array.isArray(value2) ? value2.join(", ") : value2);
196573
- resolve134(new Response(bytes2, { status: response.statusCode, statusText: response.statusMessage, headers: responseHeaders }));
196601
+ resolve135(new Response(bytes2, { status: response.statusCode, statusText: response.statusMessage, headers: responseHeaders }));
196574
196602
  }));
196575
196603
  });
196576
196604
  req.once("error", (error) => finish3(() => reject(error)));
@@ -196871,7 +196899,7 @@ function createLocalTestSandbox() {
196871
196899
  }
196872
196900
  })();
196873
196901
  `;
196874
- return await new Promise((resolve134, reject) => {
196902
+ return await new Promise((resolve135, reject) => {
196875
196903
  const { port1, port2 } = new MessageChannel2();
196876
196904
  const serializableContext = {
196877
196905
  auth: context.auth,
@@ -196947,7 +196975,7 @@ function createLocalTestSandbox() {
196947
196975
  timer = setTimeout(() => finish3(() => reject(new SandboxError("timeout", `execution exceeded ${limits.timeoutMs}ms`))), Math.max(1, limits.timeoutMs));
196948
196976
  return;
196949
196977
  }
196950
- if (message5.ok) finish3(() => resolve134({ value: message5.value, durationMs: Date.now() - started }));
196978
+ if (message5.ok) finish3(() => resolve135({ value: message5.value, durationMs: Date.now() - started }));
196951
196979
  else finish3(() => reject(new SandboxError("execution_failed", message5.message ?? "handler failed")));
196952
196980
  });
196953
196981
  worker.once("error", (error) => finish3(() => reject(new SandboxError("execution_failed", error.message))));
@@ -199012,12 +199040,12 @@ function createLoginSession(deps) {
199012
199040
  current = pending2;
199013
199041
  const out2 = [];
199014
199042
  const err = [];
199015
- return new Promise((resolve134) => {
199043
+ return new Promise((resolve135) => {
199016
199044
  let answered3 = false;
199017
199045
  const answer = () => {
199018
199046
  if (answered3) return;
199019
199047
  answered3 = true;
199020
- resolve134(current);
199048
+ resolve135(current);
199021
199049
  };
199022
199050
  let child3;
199023
199051
  try {
@@ -199529,7 +199557,7 @@ function relaunchWithoutSystemCa(deps = {}, plan = planSystemCaRelaunch({
199529
199557
  const kill = deps.kill ?? ((s5) => process.kill(process.pid, s5));
199530
199558
  const on4 = deps.on ?? ((s5, h2) => void process.on(s5, h2));
199531
199559
  const off = deps.off ?? ((s5, h2) => void process.off(s5, h2));
199532
- return new Promise((resolve134) => {
199560
+ return new Promise((resolve135) => {
199533
199561
  const child3 = start2(plan);
199534
199562
  const handlers = FORWARDED.map((signal) => {
199535
199563
  const handler = () => void child3.kill(signal);
@@ -199543,7 +199571,7 @@ function relaunchWithoutSystemCa(deps = {}, plan = planSystemCaRelaunch({
199543
199571
  if (spawned)
199544
199572
  return;
199545
199573
  detach();
199546
- resolve134();
199574
+ resolve135();
199547
199575
  });
199548
199576
  child3.once("exit", (code3, signal) => {
199549
199577
  detach();
@@ -199891,7 +199919,7 @@ var init_lock = __esm({
199891
199919
  await rm(guard, { recursive: true, force: true });
199892
199920
  if (attempt2 > 200)
199893
199921
  throw new Error(`lock ${lockName(key4)} guard is busy`);
199894
- await new Promise((resolve134) => setTimeout(resolve134, 5));
199922
+ await new Promise((resolve135) => setTimeout(resolve135, 5));
199895
199923
  }
199896
199924
  }
199897
199925
  try {
@@ -200120,7 +200148,7 @@ var init_transport = __esm({
200120
200148
  this.baseUrl = checkBaseUrl(options2.baseUrl);
200121
200149
  this.fetchImpl = options2.fetch ?? ((input, init) => globalThis.fetch(input, init));
200122
200150
  this.now = options2.now ?? Date.now;
200123
- this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2)));
200151
+ this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
200124
200152
  this.random = options2.random ?? Math.random;
200125
200153
  this.retry = { ...DEFAULT_RETRY, ...options2.retry };
200126
200154
  this.readOnly = options2.readOnly ?? { enabled: false, source: "" };
@@ -200886,7 +200914,7 @@ async function loginWithOAuthClient(options2) {
200886
200914
  const challenge = createHash46("sha256").update(verifier2).digest("base64url");
200887
200915
  const state = randomBytes5(16).toString("hex");
200888
200916
  let redirect = "";
200889
- const code3 = await new Promise((resolve134, reject) => {
200917
+ const code3 = await new Promise((resolve135, reject) => {
200890
200918
  const finish3 = (error, value2) => {
200891
200919
  clearTimeout(timer);
200892
200920
  options2.signal?.removeEventListener("abort", onAbort);
@@ -200895,7 +200923,7 @@ async function loginWithOAuthClient(options2) {
200895
200923
  if (error)
200896
200924
  reject(error);
200897
200925
  else
200898
- resolve134(value2);
200926
+ resolve135(value2);
200899
200927
  };
200900
200928
  const server = createServer4((req, res) => {
200901
200929
  const url = new URL(req.url ?? "/", "http://127.0.0.1");
@@ -200988,7 +201016,7 @@ var init_auth2 = __esm({
200988
201016
  return { token: body.access_token, expiresAt: now() + (typeof body.expires_in === "number" ? body.expires_in : 3600) * 1e3 };
200989
201017
  }
200990
201018
  };
200991
- execCommand = (command, args, options2 = {}) => new Promise((resolve134, reject) => {
201019
+ execCommand = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
200992
201020
  const child3 = spawn7(command, args, { stdio: options2.inherit ? "inherit" : ["pipe", "pipe", "pipe"], env: options2.env });
200993
201021
  let stdout = "";
200994
201022
  let stderr = "";
@@ -200997,7 +201025,7 @@ var init_auth2 = __esm({
200997
201025
  child3.stdin?.on("error", () => void 0);
200998
201026
  child3.stdin?.end(options2.input ?? "");
200999
201027
  child3.on("error", reject);
201000
- child3.on("close", (code3) => resolve134({ code: code3 ?? 1, stdout, stderr }));
201028
+ child3.on("close", (code3) => resolve135({ code: code3 ?? 1, stdout, stderr }));
201001
201029
  });
201002
201030
  GOOGLE_OAUTH_HOSTS = /* @__PURE__ */ new Set(["accounts.google.com", HOSTS.oauth]);
201003
201031
  FileCredentialStore = class {
@@ -202319,10 +202347,10 @@ async function connectGoogle(opts) {
202319
202347
  let consoleNote;
202320
202348
  const pending2 = openConsole(opts.console.launch, { reauth: opts.console.reauth, waitMs: opts.waitMs, notify: opts.notify }, opts.consoleIo);
202321
202349
  let abort;
202322
- const aborted = new Promise((resolve134) => {
202323
- abort = () => resolve134("aborted");
202350
+ const aborted = new Promise((resolve135) => {
202351
+ abort = () => resolve135("aborted");
202324
202352
  if (opts.signal?.aborted)
202325
- resolve134("aborted");
202353
+ resolve135("aborted");
202326
202354
  else
202327
202355
  opts.signal?.addEventListener("abort", abort, { once: true });
202328
202356
  });
@@ -213462,7 +213490,7 @@ var init_transport2 = __esm({
213462
213490
  }
213463
213491
  async acquire() {
213464
213492
  if (this.active >= this.size)
213465
- await new Promise((resolve134) => this.waiting.push(resolve134));
213493
+ await new Promise((resolve135) => this.waiting.push(resolve135));
213466
213494
  this.active++;
213467
213495
  return () => {
213468
213496
  this.active--;
@@ -213499,7 +213527,7 @@ var init_transport2 = __esm({
213499
213527
  this.origin = base2.origin;
213500
213528
  this.fetchImpl = options2.fetch ?? ((input, init) => globalThis.fetch(input, init));
213501
213529
  this.now = options2.now ?? Date.now;
213502
- this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2)));
213530
+ this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
213503
213531
  this.random = options2.random ?? Math.random;
213504
213532
  this.retry = { ...DEFAULT_RETRY, ...options2.retry };
213505
213533
  this.readOnly = options2.readOnly ?? { enabled: false, source: "" };
@@ -214465,7 +214493,7 @@ var init_rate_budget = __esm({
214465
214493
  constructor(options2 = { ...APPLE_HOURLY_BUDGET }) {
214466
214494
  this.options = options2;
214467
214495
  this.now = options2.now ?? Date.now;
214468
- this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2)));
214496
+ this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
214469
214497
  }
214470
214498
  take(issuerId, cost = 1) {
214471
214499
  if (cost > this.options.capacity)
@@ -214515,11 +214543,11 @@ var init_run = __esm({
214515
214543
  "../../node_modules/@wix/asc-core/dist/providers/run.js"() {
214516
214544
  init_define_HHP_CATALOG();
214517
214545
  ({ execFile: execFile2 } = __ascBuiltin037);
214518
- runQuiet = (command, args, options2 = {}) => new Promise((resolve134, reject) => {
214546
+ runQuiet = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
214519
214547
  const child3 = execFile2(command, args, { encoding: "utf8", maxBuffer: 64 * 1024 * 1024, windowsHide: true, timeout: 12e4 }, (e2, stdout, stderr) => {
214520
214548
  if (e2)
214521
214549
  return reject(Object.assign(new Error(`${command} failed`), { code: e2.code ?? e2.code, hadStderr: Boolean(stderr?.trim()) }));
214522
- resolve134(options2.stderr ? `${stdout}${stderr}` : stdout);
214550
+ resolve135(options2.stderr ? `${stdout}${stderr}` : stdout);
214523
214551
  });
214524
214552
  child3.stdin?.on("error", () => void 0);
214525
214553
  child3.stdin?.end(options2.input ?? "");
@@ -214948,8 +214976,8 @@ var init_keychain = __esm({
214948
214976
  init_jwt();
214949
214977
  init_credentials();
214950
214978
  ({ execFile: execFile3 } = __ascBuiltin039);
214951
- runSecurity = (command, args, options2 = {}) => new Promise((resolve134, reject) => {
214952
- const child3 = execFile3(command, args, { encoding: "utf8", maxBuffer: 256 * 1024 * 1024 }, (error, stdout) => error ? reject(error) : resolve134(stdout));
214979
+ runSecurity = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
214980
+ const child3 = execFile3(command, args, { encoding: "utf8", maxBuffer: 256 * 1024 * 1024 }, (error, stdout) => error ? reject(error) : resolve135(stdout));
214953
214981
  if (options2.input !== void 0)
214954
214982
  child3.stdin?.end(options2.input);
214955
214983
  });
@@ -215751,7 +215779,7 @@ var init_session_lock = __esm({
215751
215779
  GUARD_STALE_MS = 1e4;
215752
215780
  unusable = (dir, e2) => new SessionLockError(`could not lock the web session under ${dir} (${code(e2) ?? "error"}); fix or remove that directory and retry`);
215753
215781
  code = (e2) => e2?.code;
215754
- sleep3 = (ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2));
215782
+ sleep3 = (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2));
215755
215783
  baseName = (key4) => `session-${createHash60("sha256").update(key4).digest("hex")}`;
215756
215784
  isStale3 = ({ holder, ageMs }, staleMs) => ageMs > staleMs || Number.isInteger(holder.pid) && holder.host === hostname4() && !isAlive(holder.pid);
215757
215785
  isPartSet = (p2) => typeof p2?.id === "string" && /^[0-9a-f]+$/.test(p2.id) && Number.isInteger(p2.count) && p2.count >= 1 && p2.count <= 1e3;
@@ -215806,7 +215834,7 @@ var init_pacing = __esm({
215806
215834
  now;
215807
215835
  sleep;
215808
215836
  next = 0;
215809
- constructor(intervalMs, now = Date.now, sleep4 = (ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2))) {
215837
+ constructor(intervalMs, now = Date.now, sleep4 = (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))) {
215810
215838
  this.intervalMs = intervalMs;
215811
215839
  this.now = now;
215812
215840
  this.sleep = sleep4;
@@ -216178,8 +216206,8 @@ var init_session = __esm({
216178
216206
  async delete() {
216179
216207
  }
216180
216208
  };
216181
- runCommand = (command, args, options2 = {}) => new Promise((resolve134, reject) => {
216182
- const child3 = execFile4(command, args, { encoding: "utf8" }, (e2, out2) => e2 ? reject(Object.assign(new Error("the command failed"), { code: e2.code })) : resolve134(out2));
216209
+ runCommand = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
216210
+ const child3 = execFile4(command, args, { encoding: "utf8" }, (e2, out2) => e2 ? reject(Object.assign(new Error("the command failed"), { code: e2.code })) : resolve135(out2));
216183
216211
  child3.stdin?.on("error", () => void 0);
216184
216212
  child3.stdin?.end(options2.input ?? "");
216185
216213
  });
@@ -216371,10 +216399,10 @@ var init_session = __esm({
216371
216399
  byId2.set(set3.id, { id: set3.id, count: Math.max(set3.count, byId2.get(set3.id)?.count ?? 0) });
216372
216400
  const left = [];
216373
216401
  for (const set3 of byId2.values()) {
216374
- let failed3 = false;
216402
+ let failed2 = false;
216375
216403
  for (let n2 = 0; n2 < set3.count; n2++)
216376
- await this.remove(this.chunkAccount(appleId, set3.id, n2)).catch(() => void (failed3 = true));
216377
- if (failed3)
216404
+ await this.remove(this.chunkAccount(appleId, set3.id, n2)).catch(() => void (failed2 = true));
216405
+ if (failed2)
216378
216406
  left.push(set3);
216379
216407
  }
216380
216408
  return left;
@@ -216435,11 +216463,11 @@ function newSigninBackoff(error, now) {
216435
216463
  };
216436
216464
  }
216437
216465
  function signinBackoffUntil(record5, now) {
216438
- const failed3 = Date.parse(record5.failedAt ?? "");
216466
+ const failed2 = Date.parse(record5.failedAt ?? "");
216439
216467
  const until = Date.parse(record5.notBefore ?? "");
216440
- if (Number.isNaN(failed3) || Number.isNaN(until) || failed3 > now)
216468
+ if (Number.isNaN(failed2) || Number.isNaN(until) || failed2 > now)
216441
216469
  return void 0;
216442
- const capped = Math.min(until, failed3 + MAX_SIGNIN_BACKOFF_MS);
216470
+ const capped = Math.min(until, failed2 + MAX_SIGNIN_BACKOFF_MS);
216443
216471
  return now < capped ? capped : void 0;
216444
216472
  }
216445
216473
  var createHash62, randomBytes15, chmod4, mkdir17, readFile17, rename7, rm9, writeFile13, join120, DEFAULT_SIGNIN_BACKOFF_MS, MAX_SIGNIN_BACKOFF_MS, VERSION, newer, SigninBackoffStore;
@@ -219398,13 +219426,13 @@ var init_iris = __esm({
219398
219426
  await this.ensureTeam();
219399
219427
  const url = new URL(path2, this.options.developerBase ?? this.options.ascBase ?? DEVELOPER);
219400
219428
  const where = `${method} ${url.pathname}`;
219401
- const failed3 = (why, kind = init.write ? "uncertain" : "network") => new AscError(kind, `${where} ${why}${kind === "uncertain" ? " \u2014 it may have reached Apple; re-read before retrying" : ""}`);
219429
+ const failed2 = (why, kind = init.write ? "uncertain" : "network") => new AscError(kind, `${where} ${why}${kind === "uncertain" ? " \u2014 it may have reached Apple; re-read before retrying" : ""}`);
219402
219430
  const scrub = (e2) => scrubSecrets(e2.message, this.jar.cookies.map((c2) => c2.value));
219403
219431
  let res;
219404
219432
  try {
219405
219433
  res = await this.send(url, { method, headers: { ...init.headers, Cookie: this.jar.header(url) }, ...init.body !== void 0 ? { body: init.body } : {}, redirect: "manual" });
219406
219434
  } catch (e2) {
219407
- throw failed3(`failed before a response: ${scrub(e2)}`);
219435
+ throw failed2(`failed before a response: ${scrub(e2)}`);
219408
219436
  }
219409
219437
  this.absorb(url, res.headers);
219410
219438
  const location = res.headers.get("location") ?? "";
@@ -219421,7 +219449,7 @@ var init_iris = __esm({
219421
219449
  } else
219422
219450
  text32 = await res.text();
219423
219451
  } catch (e2) {
219424
- throw failed3(`\u2192 ${res.status}, but the response could not be read: ${scrub(e2)}`);
219452
+ throw failed2(`\u2192 ${res.status}, but the response could not be read: ${scrub(e2)}`);
219425
219453
  }
219426
219454
  return { status: res.status, headers: res.headers, text: text32, ...bytes2 ? { bytes: bytes2 } : {} };
219427
219455
  }
@@ -220295,7 +220323,7 @@ var init_util4 = __esm({
220295
220323
  init_define_HHP_CATALOG();
220296
220324
  init_dist3();
220297
220325
  ({ createHash: createHash63 } = __ascBuiltin045);
220298
- realClock = { now: Date.now, sleep: (ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2)) };
220326
+ realClock = { now: Date.now, sleep: (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)) };
220299
220327
  md5 = (bytes2) => createHash63("md5").update(bytes2).digest("hex");
220300
220328
  }
220301
220329
  });
@@ -220768,7 +220796,7 @@ var init_review = __esm({
220768
220796
  */
220769
220797
  async waitUntilDone(appRef2, options2 = {}) {
220770
220798
  const now = options2.now ?? Date.now;
220771
- const sleep4 = options2.sleep ?? ((ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2)));
220799
+ const sleep4 = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
220772
220800
  const interval = options2.intervalMs ?? 6e4;
220773
220801
  const deadline = now() + (options2.timeoutMs ?? 30 * 6e4);
220774
220802
  for (; ; ) {
@@ -223810,11 +223838,11 @@ var init_validate2 = __esm({
223810
223838
  for (const set3 of flatList((await this.t.list(`/v1/appStoreVersionLocalizations/${loc.id}/appPreviewSets`)).data)) {
223811
223839
  const previews = flatList((await this.t.list(`/v1/appPreviewSets/${set3.id}/appPreviews`)).data);
223812
223840
  const states = previews.map((p2) => [p2.fileName, p2.videoDeliveryState?.state ?? p2.assetDeliveryState?.state, p2.assetDeliveryState?.state]);
223813
- const failed3 = states.filter(([, video, asset]) => video === "FAILED" || asset === "FAILED").map(([name]) => name);
223841
+ const failed2 = states.filter(([, video, asset]) => video === "FAILED" || asset === "FAILED").map(([name]) => name);
223814
223842
  const waiting = states.filter(([, video, asset]) => video !== "FAILED" && asset !== "FAILED" && video !== "COMPLETE").map(([name]) => name);
223815
223843
  const base2 = { locale: loc.locale, field: "previews", resourceType: "appPreviewSet", resourceId: set3.id };
223816
- if (failed3.length)
223817
- checks.push({ ...base2, id: "readiness.previews.failed", severity: "error", message: `${loc.locale} ${set3.previewType} holds ${failed3.length} preview(s) that failed processing: ${failed3.join(", ")}`, remediation: "Replace them: asc-node previews apply" });
223844
+ if (failed2.length)
223845
+ checks.push({ ...base2, id: "readiness.previews.failed", severity: "error", message: `${loc.locale} ${set3.previewType} holds ${failed2.length} preview(s) that failed processing: ${failed2.join(", ")}`, remediation: "Replace them: asc-node previews apply" });
223818
223846
  if (waiting.length)
223819
223847
  checks.push({ ...base2, id: "readiness.previews.processing", severity: "warning", message: `${loc.locale} ${set3.previewType} holds ${waiting.length} preview(s) that have not finished processing: ${waiting.join(", ")}`, remediation: "Wait for them to finish, then validate again; if one stays there, replace it: asc-node previews apply" });
223820
223848
  }
@@ -223858,9 +223886,9 @@ var init_validate2 = __esm({
223858
223886
  checks.push({ id: "readiness.required.description", severity: "error", locale: loc.locale, field: "description", resourceType: "appStoreVersionLocalization", resourceId: loc.id, message: `the ${loc.locale} description is empty`, remediation: "Write the description: asc-node metadata apply" });
223859
223887
  const sets = flatList((await this.t.list(`/v1/appStoreVersionLocalizations/${loc.id}/appScreenshotSets`)).data);
223860
223888
  for (const set3 of sets) {
223861
- const failed3 = flatList((await this.t.list(`/v1/appScreenshotSets/${set3.id}/appScreenshots`)).data).filter((s5) => s5.assetDeliveryState?.state === "FAILED").length;
223862
- if (failed3)
223863
- checks.push({ id: "readiness.screenshots.failed", severity: "error", locale: loc.locale, field: "screenshots", resourceType: "appScreenshotSet", resourceId: set3.id, message: `${loc.locale} ${set3.screenshotDisplayType} holds ${failed3} screenshot(s) that failed processing`, remediation: "Delete or replace them: asc-node screenshots apply" });
223889
+ const failed2 = flatList((await this.t.list(`/v1/appScreenshotSets/${set3.id}/appScreenshots`)).data).filter((s5) => s5.assetDeliveryState?.state === "FAILED").length;
223890
+ if (failed2)
223891
+ checks.push({ id: "readiness.screenshots.failed", severity: "error", locale: loc.locale, field: "screenshots", resourceType: "appScreenshotSet", resourceId: set3.id, message: `${loc.locale} ${set3.screenshotDisplayType} holds ${failed2} screenshot(s) that failed processing`, remediation: "Delete or replace them: asc-node screenshots apply" });
223864
223892
  }
223865
223893
  const isPrimary2 = !app2.primaryLocale || loc.locale.toLowerCase() === app2.primaryLocale.toLowerCase();
223866
223894
  sawIphone ||= sets.some((s5) => s5.screenshotDisplayType.startsWith("APP_IPHONE_"));
@@ -225000,13 +225028,13 @@ var init_actions_release = __esm({
225000
225028
  const existing = attempts.find((u2) => u2.state?.state !== "FAILED");
225001
225029
  if (existing?.state?.state === "COMPLETE")
225002
225030
  return noop("buildUploads", `build ${buildNumber} already uploaded`);
225003
- const failed3 = attempts.filter((u2) => u2.state?.state === "FAILED");
225031
+ const failed2 = attempts.filter((u2) => u2.state?.state === "FAILED");
225004
225032
  return {
225005
225033
  changes: [{ op: existing ? "update" : "create", resource: "buildUploads", id: existing?.id, summary: existing ? `resume upload ${existing.id} (${existing.state?.state})` : `upload ${p2.ipa.path} as ${version5} (${buildNumber})` }],
225006
225034
  sideEffects: [
225007
225035
  "the build number is used up for this version even if processing fails",
225008
225036
  ...ipaNotes(ipa),
225009
- ...failed3.length && !existing ? [`an earlier upload of this build (${failed3.map((u2) => u2.id).join(", ")}) is FAILED; it is not reused: a new upload is made, and Apple says if the number is used up`] : []
225037
+ ...failed2.length && !existing ? [`an earlier upload of this build (${failed2.map((u2) => u2.id).join(", ")}) is FAILED; it is not reused: a new upload is made, and Apple says if the number is used up`] : []
225010
225038
  ],
225011
225039
  facts: { existing: existing?.id ?? null, state: existing?.state?.state ?? null, supportsIpad: ipa.supportsIpad, version: version5, buildNumber }
225012
225040
  };
@@ -226752,16 +226780,16 @@ var init_actions_team = __esm({
226752
226780
  async apply({ api: api4 }, _p, plan) {
226753
226781
  const steps = plan.facts.steps;
226754
226782
  const done = [];
226755
- const failed3 = [];
226783
+ const failed2 = [];
226756
226784
  const errors = [];
226757
226785
  await Promise.all(steps.map((s5) => api4.availability.setTerritory(s5.id, s5.change).then(() => void done.push(s5.territory), (e2) => {
226758
226786
  errors.push(e2);
226759
- failed3.push(`${s5.territory}: ${e2.message.split("\n")[0]}`);
226787
+ failed2.push(`${s5.territory}: ${e2.message.split("\n")[0]}`);
226760
226788
  })));
226761
- if (failed3.length && !done.length)
226789
+ if (failed2.length && !done.length)
226762
226790
  throw errors[0];
226763
- if (failed3.length)
226764
- throw new AscError("uncertain", `changed ${done.sort().join(", ")}; not confirmed: ${failed3.join("; ")} \u2014 re-plan to see what Apple holds`);
226791
+ if (failed2.length)
226792
+ throw new AscError("uncertain", `changed ${done.sort().join(", ")}; not confirmed: ${failed2.join("; ")} \u2014 re-plan to see what Apple holds`);
226765
226793
  return { ids: steps.map((s5) => s5.id), detail: `${steps.length} territor${steps.length === 1 ? "y" : "ies"} changed: ${steps.map(stepText).join("; ")}` };
226766
226794
  },
226767
226795
  async verify({ api: api4 }, p2, plan) {
@@ -230758,9 +230786,9 @@ async function takeDownload(keys2, target, recovery, said) {
230758
230786
  throw e2;
230759
230787
  }
230760
230788
  if (e2 instanceof KeyDownloadUnusableError) {
230761
- const failed3 = recovery.keep(e2.takeRaw());
230762
- if (failed3)
230763
- throw new AscError("server", `${said}, but ${e2.message}, and keeping its raw bytes in ${recovery.path} failed (${failed3}); that file may be partial: inspect it (it is 0600), and if it holds no key, ${revoke}`);
230789
+ const failed2 = recovery.keep(e2.takeRaw());
230790
+ if (failed2)
230791
+ throw new AscError("server", `${said}, but ${e2.message}, and keeping its raw bytes in ${recovery.path} failed (${failed2}); that file may be partial: inspect it (it is 0600), and if it holds no key, ${revoke}`);
230764
230792
  throw new AscError("server", `${said}, but ${e2.message}. Apple may count that as its one download, so the raw bytes are kept, unprinted, in ${recovery.path} (0600): inspect that file before anything else; if it holds no key, ${revoke}`);
230765
230793
  }
230766
230794
  if (e2 instanceof WebAuthError) {
@@ -230777,10 +230805,10 @@ async function takeDownload(keys2, target, recovery, said) {
230777
230805
  try {
230778
230806
  file2.write(pem);
230779
230807
  } catch (e2) {
230780
- const failed3 = recovery.keep(Buffer.from(pem, "utf8"));
230808
+ const failed2 = recovery.keep(Buffer.from(pem, "utf8"));
230781
230809
  const removed = file2.release();
230782
230810
  const partial = removed ? "the partial file was removed" : `the partial file ${file2.path} could not be removed: delete it`;
230783
- throw new AscError("server", `${said} and downloaded, but writing ${file2.path} failed (${e2.code ?? "write error"}); ${partial}; ${failed3 ? `keeping it in ${recovery.path} failed too (${failed3}), so the private key is lost: ${revoke}` : `the private key is in ${recovery.path} (0600) instead: move it to ${file2.path}`}`);
230811
+ throw new AscError("server", `${said} and downloaded, but writing ${file2.path} failed (${e2.code ?? "write error"}); ${partial}; ${failed2 ? `keeping it in ${recovery.path} failed too (${failed2}), so the private key is lost: ${revoke}` : `the private key is in ${recovery.path} (0600) instead: move it to ${file2.path}`}`);
230784
230812
  }
230785
230813
  recovery.discard();
230786
230814
  return file2.path;
@@ -232493,9 +232521,9 @@ var init_messages_code = __esm({
232493
232521
  }
232494
232522
  };
232495
232523
  isPrivacyError = (message5) => ["unable to open database file", "authorization denied", "operation not permitted", "not authorized", "permission denied"].some((m2) => message5.toLowerCase().includes(m2));
232496
- systemSqliteQuery = (db, sql) => new Promise((resolve134, reject) => {
232524
+ systemSqliteQuery = (db, sql) => new Promise((resolve135, reject) => {
232497
232525
  const uri = `${pathToFileURL8(db).href}?mode=ro`;
232498
- execFile5(SYSTEM_SQLITE, ["-readonly", "-batch", "-noheader", "-list", "-separator", "|", "-cmd", ".timeout 2000", uri, sql], { encoding: "utf8", maxBuffer: 32 * 1024 * 1024 }, (e2, out2, err) => e2 ? reject(new Error(err?.trim() || `sqlite3 failed (exit ${String(e2.code ?? "?")})`)) : resolve134(out2));
232526
+ execFile5(SYSTEM_SQLITE, ["-readonly", "-batch", "-noheader", "-list", "-separator", "|", "-cmd", ".timeout 2000", uri, sql], { encoding: "utf8", maxBuffer: 32 * 1024 * 1024 }, (e2, out2, err) => e2 ? reject(new Error(err?.trim() || `sqlite3 failed (exit ${String(e2.code ?? "?")})`)) : resolve135(out2));
232499
232527
  });
232500
232528
  }
232501
232529
  });
@@ -233059,7 +233087,7 @@ function sameOriginPost(req, origin) {
233059
233087
  return (sent === void 0 || sent === "null") && req.headers["sec-fetch-site"] === "same-origin";
233060
233088
  }
233061
233089
  function readBody3(req) {
233062
- return new Promise((resolve134, reject) => {
233090
+ return new Promise((resolve135, reject) => {
233063
233091
  const chunks = [];
233064
233092
  let size = 0;
233065
233093
  req.on("data", (c2) => {
@@ -233070,7 +233098,7 @@ function readBody3(req) {
233070
233098
  }
233071
233099
  chunks.push(c2);
233072
233100
  });
233073
- req.on("end", () => resolve134(Buffer.concat(chunks).toString("utf8")));
233101
+ req.on("end", () => resolve135(Buffer.concat(chunks).toString("utf8")));
233074
233102
  req.on("error", reject);
233075
233103
  });
233076
233104
  }
@@ -233082,21 +233110,21 @@ async function startConnectServer(opts) {
233082
233110
  const prefix = `/c/${token}`;
233083
233111
  const startedAt = now();
233084
233112
  let settle3;
233085
- const done = new Promise((resolve134) => {
233086
- settle3 = resolve134;
233113
+ const done = new Promise((resolve135) => {
233114
+ settle3 = resolve135;
233087
233115
  });
233088
233116
  let closed;
233089
233117
  let hostHeader = "";
233090
233118
  let origin = "";
233091
- const send2 = (res, status2, html = "", page = true, extra = {}) => new Promise((resolve134) => {
233119
+ const send2 = (res, status2, html = "", page = true, extra = {}) => new Promise((resolve135) => {
233092
233120
  if (res.destroyed || res.socket === null || res.socket.destroyed) {
233093
- resolve134();
233121
+ resolve135();
233094
233122
  return;
233095
233123
  }
233096
- res.once("error", () => resolve134());
233124
+ res.once("error", () => resolve135());
233097
233125
  res.writeHead(status2, { ...page ? PAGE_HEADERS : { "Content-Type": "text/plain; charset=utf-8", "Cache-Control": "no-store" }, ...extra });
233098
- res.once("close", () => resolve134());
233099
- res.end(html, () => resolve134());
233126
+ res.once("close", () => resolve135());
233127
+ res.end(html, () => resolve135());
233100
233128
  });
233101
233129
  let busy2 = false;
233102
233130
  let consumed = false;
@@ -233183,11 +233211,11 @@ async function startConnectServer(opts) {
233183
233211
  }
233184
233212
  })();
233185
233213
  });
233186
- await new Promise((resolve134, reject) => {
233214
+ await new Promise((resolve135, reject) => {
233187
233215
  server.once("error", reject);
233188
233216
  server.listen(0, "127.0.0.1", () => {
233189
233217
  server.off("error", reject);
233190
- resolve134();
233218
+ resolve135();
233191
233219
  });
233192
233220
  });
233193
233221
  const port = server.address().port;
@@ -233214,12 +233242,12 @@ async function startConnectServer(opts) {
233214
233242
  timer.unref();
233215
233243
  function close() {
233216
233244
  closing = true;
233217
- closed ??= new Promise((resolve134) => {
233245
+ closed ??= new Promise((resolve135) => {
233218
233246
  clearTimeout(timer);
233219
233247
  if (grace)
233220
233248
  clearTimeout(grace);
233221
233249
  settle3("expired");
233222
- server.close(() => resolve134());
233250
+ server.close(() => resolve135());
233223
233251
  server.closeAllConnections();
233224
233252
  });
233225
233253
  return closed;
@@ -233237,8 +233265,8 @@ async function startConnectServer(opts) {
233237
233265
  if (maxWaitMs === void 0 || !inflight)
233238
233266
  return drained;
233239
233267
  let cap2;
233240
- const late = new Promise((resolve134) => {
233241
- cap2 = setTimeout(() => resolve134(false), maxWaitMs);
233268
+ const late = new Promise((resolve135) => {
233269
+ cap2 = setTimeout(() => resolve135(false), maxWaitMs);
233242
233270
  cap2.unref();
233243
233271
  });
233244
233272
  try {
@@ -233314,11 +233342,11 @@ function startAttempt(input) {
233314
233342
  stop2.abort();
233315
233343
  take()?.reject(new Cancelled());
233316
233344
  },
233317
- next: () => new Promise((resolve134) => {
233345
+ next: () => new Promise((resolve135) => {
233318
233346
  if (attempt2.outcome || attempt2.prompt)
233319
- resolve134();
233347
+ resolve135();
233320
233348
  else
233321
- wake = resolve134;
233349
+ wake = resolve135;
233322
233350
  })
233323
233351
  };
233324
233352
  attempt2.settled = signIn({
@@ -233329,10 +233357,10 @@ function startAttempt(input) {
233329
233357
  twoFactorMethod: input.sms ? "sms" : "auto",
233330
233358
  ...input.sms && input.phoneId !== void 0 ? { phoneId: input.phoneId } : {},
233331
233359
  previous: input.previous,
233332
- twoFactorCode: (prompt2) => new Promise((resolve134, reject) => {
233360
+ twoFactorCode: (prompt2) => new Promise((resolve135, reject) => {
233333
233361
  if (stop2.signal.aborted)
233334
233362
  return reject(new Cancelled());
233335
- pending2 = { resolve: resolve134, reject };
233363
+ pending2 = { resolve: resolve135, reject };
233336
233364
  attempt2.prompt = prompt2;
233337
233365
  changed();
233338
233366
  })
@@ -233605,10 +233633,10 @@ async function runConnectFlow(opts) {
233605
233633
  await Promise.all([...live4].map((a3) => a3.settled));
233606
233634
  };
233607
233635
  let cancelled = false;
233608
- const stopped = new Promise((resolve134) => {
233636
+ const stopped = new Promise((resolve135) => {
233609
233637
  const stop2 = () => {
233610
233638
  cancelled = true;
233611
- resolve134();
233639
+ resolve135();
233612
233640
  };
233613
233641
  if (opts.signal?.aborted)
233614
233642
  stop2();
@@ -235499,7 +235527,7 @@ import * as __ascBuiltin142 from "node:os";
235499
235527
  import * as __ascBuiltin222 from "node:path";
235500
235528
  import * as __ascBuiltin38 from "node:fs";
235501
235529
  function runForCode(command, env, requestedAt) {
235502
- return new Promise((resolve134, reject) => execFile6("/bin/sh", ["-c", command], { encoding: "utf8", timeout: 5 * 6e4, env: { ...env, ASC_WEB_2FA_CODE_REQUESTED_AT: requestedAt.toISOString() } }, (e2, out2, err) => e2 ? reject(new Error(codeCommandFailure(e2.code, err))) : resolve134(out2.trim())));
235530
+ return new Promise((resolve135, reject) => execFile6("/bin/sh", ["-c", command], { encoding: "utf8", timeout: 5 * 6e4, env: { ...env, ASC_WEB_2FA_CODE_REQUESTED_AT: requestedAt.toISOString() } }, (e2, out2, err) => e2 ? reject(new Error(codeCommandFailure(e2.code, err))) : resolve135(out2.trim())));
235503
235531
  }
235504
235532
  function codeCommandFailure(exit, stderr) {
235505
235533
  const line = (stderr ?? "").split(/\r?\n/).map((l3) => l3.trim()).filter(Boolean).pop() ?? "";
@@ -236854,16 +236882,16 @@ var init_commands_agreements = __esm({
236854
236882
  ]);
236855
236883
  const notRead = [];
236856
236884
  const failures = [];
236857
- const failed3 = (source2, e2) => {
236885
+ const failed2 = (source2, e2) => {
236858
236886
  notRead.push({ source: source2, error: e2.message });
236859
236887
  failures.push(e2);
236860
236888
  };
236861
236889
  if (portal.status === "rejected")
236862
- failed3("developer portal agreements", portal.reason);
236890
+ failed2("developer portal agreements", portal.reason);
236863
236891
  if (banner.status === "rejected")
236864
- failed3("App Store Connect agreement banner", banner.reason);
236892
+ failed2("App Store Connect agreement banner", banner.reason);
236865
236893
  if (business.status === "rejected")
236866
- failed3("App Store Connect Business agreements", business.reason);
236894
+ failed2("App Store Connect Business agreements", business.reason);
236867
236895
  const contractMessages = banner.status === "fulfilled" ? banner.value : [];
236868
236896
  const waiting = (business.status === "fulfilled" ? business.value : []).filter(needsAction).map((b3) => ({ name: b3.contractDisplayName ?? b3.contractId, contract: b3.contractId, status: b3.status, inEffect: b3.isInEffect, ...b3.availableNewContractConfigId ? { newConfiguration: b3.availableNewContractConfigId } : {} }));
236869
236897
  const all = portal.status === "fulfilled" ? portal.value.all : [];
@@ -237231,10 +237259,10 @@ var init_commands_team = __esm({
237231
237259
  options: { app: { type: "string" }, available: { type: "string", multiple: true }, unavailable: { type: "string", multiple: true }, "pre-orders-off": { type: "boolean" }, ...writeOptions },
237232
237260
  async run(inv) {
237233
237261
  const available = list2(inv, "available", true);
237234
- const unavailable = list2(inv, "unavailable", true);
237235
- if (!available.length && !unavailable.length && !inv.opts["pre-orders-off"])
237262
+ const unavailable2 = list2(inv, "unavailable", true);
237263
+ if (!available.length && !unavailable2.length && !inv.opts["pre-orders-off"])
237236
237264
  throw new UsageError("pass --available, --unavailable or --pre-orders-off");
237237
- return write2(inv, "app.availability", { appId: await appId2(inv), ...available.length ? { available } : {}, ...unavailable.length ? { unavailable } : {}, ...inv.opts["pre-orders-off"] ? { preOrdersOff: true } : {} });
237265
+ return write2(inv, "app.availability", { appId: await appId2(inv), ...available.length ? { available } : {}, ...unavailable2.length ? { unavailable: unavailable2 } : {}, ...inv.opts["pre-orders-off"] ? { preOrdersOff: true } : {} });
237238
237266
  }
237239
237267
  },
237240
237268
  // ---- Users --------------------------------------------------------------------------------
@@ -238307,7 +238335,7 @@ async function startCallback(timeoutMs) {
238307
238335
  const path2 = `/callback/${b64url3(randomBytes18(16))}`;
238308
238336
  let expected;
238309
238337
  let settle3;
238310
- const result = new Promise((resolve134, reject) => settle3 = { resolve: resolve134, reject });
238338
+ const result = new Promise((resolve135, reject) => settle3 = { resolve: resolve135, reject });
238311
238339
  result.catch(() => {
238312
238340
  });
238313
238341
  const page = (status2, text32) => ({ status: status2, body: `<!doctype html><meta charset="utf-8"><title>asc-node</title><p>${text32}</p>` });
@@ -238334,7 +238362,7 @@ async function startCallback(timeoutMs) {
238334
238362
  send2(page(200, "Signed in. You can close this tab and go back to the terminal."));
238335
238363
  settle3.resolve(code3);
238336
238364
  });
238337
- await new Promise((resolve134) => server.listen(0, "127.0.0.1", resolve134));
238365
+ await new Promise((resolve135) => server.listen(0, "127.0.0.1", resolve135));
238338
238366
  const port = server.address().port;
238339
238367
  const timer = setTimeout(() => settle3.reject(new AscError("auth", `sign-in to the worker's gateway was not finished within ${Math.round(timeoutMs / 1e3)}s`)), timeoutMs);
238340
238368
  timer.unref?.();
@@ -238343,7 +238371,7 @@ async function startCallback(timeoutMs) {
238343
238371
  code: (state) => (expected = state, result),
238344
238372
  close: () => {
238345
238373
  clearTimeout(timer);
238346
- return new Promise((resolve134) => (server.closeAllConnections(), server.close(() => resolve134())));
238374
+ return new Promise((resolve135) => (server.closeAllConnections(), server.close(() => resolve135())));
238347
238375
  }
238348
238376
  };
238349
238377
  }
@@ -238782,7 +238810,7 @@ var init_context = __esm({
238782
238810
  onRequest: options2.onRequest
238783
238811
  });
238784
238812
  const pollMs = Number(this.io.env.ASC_POLL_MS) || void 0;
238785
- return new AscApi(transport, { pollMs, mediaTimeoutMs: resolveMediaTimeoutMs(this.io.env), clock: { now: this.io.now ?? Date.now, sleep: this.io.sleep ?? ((ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2))) } });
238813
+ return new AscApi(transport, { pollMs, mediaTimeoutMs: resolveMediaTimeoutMs(this.io.env), clock: { now: this.io.now ?? Date.now, sleep: this.io.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))) } });
238786
238814
  }
238787
238815
  async api(options2 = {}) {
238788
238816
  if (this.worker)
@@ -243434,7 +243462,7 @@ var init_store_android = __esm({
243434
243462
  }
243435
243463
  }
243436
243464
  const planned2 = jobs.filter((j2) => j2.status === "planned");
243437
- const failed3 = jobs.filter((j2) => j2.status === "planFailed");
243465
+ const failed2 = jobs.filter((j2) => j2.status === "planFailed");
243438
243466
  const complete = !todo(steps).length && !fromRecord?.stale;
243439
243467
  return ok2({
243440
243468
  platform: "android",
@@ -243447,7 +243475,7 @@ var init_store_android = __esm({
243447
243475
  jobs,
243448
243476
  complete,
243449
243477
  ...fromRecord ? fromRecord.view : {},
243450
- next: !todo(steps).length ? `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${nothingLeft(fromRecord)}` : `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${planned2.length ? `Show the person each job's changes and plan hash. store_apply (platform android, jobId, planHash, confirm: true) applies one job, asking the person to approve it; apply them in the order listed, then call store_plan again. ` : ""}${failed3.length ? `${failed3.length} job(s) could not be planned (see their error). ` : ""}Steps with owner: true are not planned here; who says who does them and how.`
243478
+ next: !todo(steps).length ? `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${nothingLeft(fromRecord)}` : `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${planned2.length ? `Show the person each job's changes and plan hash. store_apply (platform android, jobId, planHash, confirm: true) applies one job, asking the person to approve it; apply them in the order listed, then call store_plan again. ` : ""}${failed2.length ? `${failed2.length} job(s) could not be planned (see their error). ` : ""}Steps with owner: true are not planned here; who says who does them and how.`
243451
243479
  });
243452
243480
  },
243453
243481
  async apply(google, ctx, a3, call, ref) {
@@ -243883,8 +243911,8 @@ async function appleStatus(a3, base2, host) {
243883
243911
  }
243884
243912
  } else
243885
243913
  out2.unknown.push("medical device: unknown \u2014 needs a web session", "App Privacy: unknown \u2014 needs a web session");
243886
- const failed3 = Object.keys(out2.errors);
243887
- const incomplete = failed3.length || out2.unknown.length ? `This status is incomplete: ${[...failed3.map((k3) => `${k3} could not be read`), ...out2.unknown.map((u2) => u2.replace(/: unknown — (.*)$/s, " unknown ($1)"))].join("; ")}. ` : "";
243914
+ const failed2 = Object.keys(out2.errors);
243915
+ const incomplete = failed2.length || out2.unknown.length ? `This status is incomplete: ${[...failed2.map((k3) => `${k3} could not be read`), ...out2.unknown.map((u2) => u2.replace(/: unknown — (.*)$/s, " unknown ($1)"))].join("; ")}. ` : "";
243888
243916
  out2.complete = !incomplete;
243889
243917
  out2.next = `${incomplete}${out2.unknown.some((u2) => /needs a web session/.test(u2)) ? "Call store_connect so the person signs in; then store_status can read the medical device answer and App Privacy." : out2.gaps.length ? "store_plan plans what it can of these; the rest needs the person (or the app's facts)." : incomplete ? "Nothing that could be read blocks a submission; look at errors before relying on it." : "Nothing blocks a submission: store_plan plans it."}`;
243890
243918
  return recorded(ok2(out2));
@@ -243910,14 +243938,14 @@ async function applePlan(a3, base2, host) {
243910
243938
  if (!plan.lines.length)
243911
243939
  return ok2({ batch: null, ...view, ...fromRecord?.read && plan.complete && !fromRecord.stale ? { next: `${lead}Per the record (${fromRecord.ages}) and the steps planned live, ${plan.next.charAt(0).toLowerCase()}${plan.next.slice(1)}` } : {} });
243912
243940
  const { batch, files, session } = await planOrdered(ctx, plan.lines, appleId);
243913
- const failed3 = batch.items.filter((i2) => i2.status === "planFailed");
243941
+ const failed2 = batch.items.filter((i2) => i2.status === "planFailed");
243914
243942
  return ok2({
243915
243943
  batch: batch.id,
243916
243944
  planHash: batch.planHash,
243917
243945
  ordered: true,
243918
243946
  lines: linesView(batch),
243919
243947
  ...view,
243920
- ...failed3.length ? { next: `${lead}A line could not be planned (${failed3.map((i2) => `${i2.key}: ${i2.error}`).join("; ")}); fix it and call store_plan again. Do not apply this batch.` } : {},
243948
+ ...failed2.length ? { next: `${lead}A line could not be planned (${failed2.map((i2) => `${i2.key}: ${i2.error}`).join("; ")}); fix it and call store_plan again. Do not apply this batch.` } : {},
243921
243949
  ...files.length || factFiles.length ? { files: [...factFiles.map((f2) => ({ line: "facts", ...f2 })), ...files] } : {},
243922
243950
  ...session ? { webSession: { appleId: session.appleId, team: session.teamName ?? session.team } } : {}
243923
243951
  });
@@ -244084,9 +244112,9 @@ A submission can take more than one batch: after store_apply, call store_plan ag
244084
244112
  const lineProfile = planned2.items.find((i2) => i2.account?.profile)?.account.profile;
244085
244113
  if (!a3.profile && lineProfile)
244086
244114
  ctx = withArgs(base2, { profile: lineProfile, appleId: a3.appleId });
244087
- const failed3 = planned2.ordered ? planned2.items.filter((i2) => i2.status === "planFailed") : [];
244088
- if (failed3.length)
244089
- throw new AscError("invalid", `batch ${a3.batchId} has lines that could not be planned, so nothing was asked or applied: ${failed3.map((i2) => `${i2.key}: ${i2.error}`).join("; ")}. Call store_plan again`);
244115
+ const failed2 = planned2.ordered ? planned2.items.filter((i2) => i2.status === "planFailed") : [];
244116
+ if (failed2.length)
244117
+ throw new AscError("invalid", `batch ${a3.batchId} has lines that could not be planned, so nothing was asked or applied: ${failed2.map((i2) => `${i2.key}: ${i2.error}`).join("; ")}. Call store_plan again`);
244090
244118
  const batch = await applyBatchAsking(ctx, { batchId: a3.batchId, planHash: a3.planHash }, call);
244091
244119
  const was = new Map(planned2.items.map((i2) => [i2.key, i2.status]));
244092
244120
  const verified2 = host.record ? batch.items.filter((i2) => i2.status === "verified" && was.get(i2.key) !== "verified" && i2.jobId).map((i2) => i2.jobId) : [];
@@ -244170,9 +244198,9 @@ A submission can take more than one batch: after store_apply, call store_plan ag
244170
244198
  { key: "resubmit", action: "submission.submit", params: { appId: app2.id } }
244171
244199
  ];
244172
244200
  const { batch, files } = await planOrdered(ctx, lines2, a3.appleId);
244173
- const failed3 = batch.items.filter((i2) => i2.status === "planFailed");
244174
- if (failed3.length)
244175
- throw new AscError("invalid", `the reply batch could not be planned, so nothing was asked or sent: ${failed3.map((i2) => `${i2.action}: ${i2.error}`).join("; ")}`);
244201
+ const failed2 = batch.items.filter((i2) => i2.status === "planFailed");
244202
+ if (failed2.length)
244203
+ throw new AscError("invalid", `the reply batch could not be planned, so nothing was asked or sent: ${failed2.map((i2) => `${i2.action}: ${i2.error}`).join("; ")}`);
244176
244204
  if (batch.items.every((i2) => i2.status === "noop"))
244177
244205
  return ok2({ ...batchReport(batch), lines: linesView(batch), next: "The reply was already sent and the app is already submitted: nothing to do." });
244178
244206
  const sendsReply = batch.items[0].status === "planned";
@@ -244598,6 +244626,115 @@ var init_store_iap_purchases = __esm({
244598
244626
  }
244599
244627
  });
244600
244628
 
244629
+ // src/iap-setup/snapshot.ts
244630
+ async function readIapSetup(api4) {
244631
+ return { apps: await api4.listApps() };
244632
+ }
244633
+ function appForBundle(snapshot4, bundleId) {
244634
+ return snapshot4.apps.find((app2) => app2.bundleId === bundleId);
244635
+ }
244636
+ var init_snapshot = __esm({
244637
+ "src/iap-setup/snapshot.ts"() {
244638
+ init_define_HHP_CATALOG();
244639
+ }
244640
+ });
244641
+
244642
+ // src/iap-setup/step.ts
244643
+ function failedStep(what, error) {
244644
+ return { state: "failed", code: "request_failed", detail: `could not ${what}: ${error instanceof Error ? error.message : String(error)}` };
244645
+ }
244646
+ var init_step = __esm({
244647
+ "src/iap-setup/step.ts"() {
244648
+ init_define_HHP_CATALOG();
244649
+ }
244650
+ });
244651
+
244652
+ // src/iap-setup/purchases-app.ts
244653
+ function checkPurchasesApp(input, snapshot4) {
244654
+ const app2 = appForBundle(snapshot4, input.bundleId);
244655
+ return app2 ? { state: "ready", detail: `purchases app ${app2.id}` } : { state: "missing", code: "no_purchases_app", detail: `no purchases app for ${input.bundleId} on this site` };
244656
+ }
244657
+ async function applyPurchasesApp(api4, input, options2) {
244658
+ const { bundleId, name, site } = input;
244659
+ const existing = appForBundle(options2.snapshot ?? await readIapSetup(api4), bundleId);
244660
+ if (existing) return { app: existing, step: { state: "reused", detail: `purchases app ${existing.id} for ${bundleId} on site ${site}` } };
244661
+ if (!options2.apply) return { step: { state: "planned", detail: `register ${bundleId} on site ${site}` } };
244662
+ try {
244663
+ const app2 = await api4.registerApp({ name, bundleId });
244664
+ return { app: app2, step: { state: "done", detail: `registered purchases app ${app2.id} for ${bundleId} on site ${site}` } };
244665
+ } catch (error) {
244666
+ if (refusalCode(error) !== "ALREADY_EXISTS") return { step: failedStep("register the app", error) };
244667
+ let apps;
244668
+ try {
244669
+ apps = await api4.listApps();
244670
+ } catch (rereadError) {
244671
+ return { step: failedStep("re-read the site's purchases apps after the bundle was reported registered", rereadError) };
244672
+ }
244673
+ const raced = apps.find((app2) => app2.bundleId === bundleId);
244674
+ if (raced) return { app: raced, step: { state: "reused", detail: `purchases app ${raced.id} for ${bundleId} on site ${site}` } };
244675
+ return {
244676
+ step: {
244677
+ state: "conflict",
244678
+ code: "bundle_registered_elsewhere",
244679
+ detail: `${bundleId} is already registered to another app, on another site (this site has none for it). A bundle id belongs to one purchases app platform-wide; only the owner of that registration can remove it. Nothing was changed.`
244680
+ }
244681
+ };
244682
+ }
244683
+ }
244684
+ var init_purchases_app = __esm({
244685
+ "src/iap-setup/purchases-app.ts"() {
244686
+ init_define_HHP_CATALOG();
244687
+ init_store_iap_purchases();
244688
+ init_snapshot();
244689
+ init_step();
244690
+ }
244691
+ });
244692
+
244693
+ // src/iap-setup/iap-key.ts
244694
+ function checkIapKey(input, snapshot4) {
244695
+ const app2 = appForBundle(snapshot4, input.bundleId);
244696
+ if (!app2) return { state: "missing", code: "no_purchases_app", detail: "no purchases app to hold the key" };
244697
+ return app2.privateKeyStored ? { state: "ready" } : { state: "missing", code: "apple_key_missing", detail: "the purchases app has no In-App Purchase key" };
244698
+ }
244699
+ async function keepIapKey(deps, app2, apply2) {
244700
+ if (app2.privateKeyStored) return { state: "reused", detail: "an In-App Purchase key is already stored" };
244701
+ if (!deps.appleKey) return iapKeyPlan(deps);
244702
+ if (!apply2) return iapKeyPlan(deps);
244703
+ try {
244704
+ await deps.api.setAppleCredentials(app2.id, deps.appleKey);
244705
+ return { state: "done", detail: "stored the In-App Purchase key" };
244706
+ } catch (error) {
244707
+ return failedStep("store the In-App Purchase key", error);
244708
+ }
244709
+ }
244710
+ function iapKeyPlan(deps) {
244711
+ if (!deps.appleKey && deps.serverKeyOnly) return {
244712
+ state: "blocked",
244713
+ code: "apple_key_missing",
244714
+ detail: "The purchases app has no In-App Purchase key. Run himi store apple-keys setup --app <slug> --site <metaSiteId> --bundle-id <id> --iap-key <AuthKey.p8> --iap-key-id <id> --iap-issuer-id <issuer> --yes, then rerun connect. An App Store Connect API key cannot replace this credential."
244715
+ };
244716
+ return deps.appleKey ? { state: "planned", detail: "store the In-App Purchase key" } : {
244717
+ state: "blocked",
244718
+ code: "apple_key_missing",
244719
+ detail: "no In-App Purchase key: create one in App Store Connect \u2192 Users and Access \u2192 Integrations \u2192 In-App Purchase, then run himi store apple-keys setup with --iap-key <AuthKey.p8> --iap-key-id <key id> --iap-issuer-id <issuer>, or rerun legacy connect with its key flags (an App Store Connect API key is rejected)."
244720
+ };
244721
+ }
244722
+ async function replaceIapKey(api4, app2, key4) {
244723
+ await api4.setAppleCredentials(app2.id, key4);
244724
+ }
244725
+ async function confirmIapKey(api4, bundleId) {
244726
+ const confirmed = appForBundle(await readIapSetup(api4), bundleId);
244727
+ if (!confirmed?.privateKeyStored) throw new Error("IAP key not confirmed");
244728
+ return confirmed;
244729
+ }
244730
+ var init_iap_key = __esm({
244731
+ "src/iap-setup/iap-key.ts"() {
244732
+ init_define_HHP_CATALOG();
244733
+ init_snapshot();
244734
+ init_step();
244735
+ }
244736
+ });
244737
+
244601
244738
  // src/apple-keys.ts
244602
244739
  var apple_keys_exports = {};
244603
244740
  __export(apple_keys_exports, {
@@ -244673,7 +244810,7 @@ async function runAppleKeys(pos, flags, io2, deps = {}) {
244673
244810
  if (ascKey && iapKey && publicKeyBytes(ascKey.key).equals(publicKeyBytes(iapKey.key))) throw new UsageError2("ASC and In-App Purchase require separate keys.");
244674
244811
  let asc = { present: null, state: "not_checked" };
244675
244812
  let iap = { present: null, state: "not_checked" };
244676
- let failed3 = false;
244813
+ let failed2 = false;
244677
244814
  if (ascKey || !setup) {
244678
244815
  try {
244679
244816
  asc = await ascKeyRequest(owner.session, { app: app2, site, ...ascKey && !dryRun ? { key: ascKey } : {} }, deps.fetchImpl ?? fetch);
@@ -244683,40 +244820,36 @@ async function runAppleKeys(pos, flags, io2, deps = {}) {
244683
244820
  }
244684
244821
  } catch {
244685
244822
  asc = { present: null, state: "unavailable" };
244686
- failed3 = true;
244823
+ failed2 = true;
244687
244824
  }
244688
244825
  }
244689
244826
  let purchasesAppId = null;
244690
244827
  if (iapKey || !setup) {
244691
244828
  try {
244692
244829
  const api4 = createPurchasesOwnerApi((deps.purchases ?? ((id) => ownerTransport(id, (url, init) => (deps.fetchImpl ?? fetch)(url, { ...init, redirect: "error" }), void 0, userSiteToken)))(site));
244693
- let purchasesApp = (await api4.listApps()).find((candidate) => candidate.bundleId === bundleId);
244830
+ const snapshot4 = await readIapSetup(api4);
244831
+ let purchasesApp = appForBundle(snapshot4, bundleId);
244694
244832
  if (iapKey && !dryRun) {
244695
244833
  if (!purchasesApp) {
244696
- try {
244697
- purchasesApp = await api4.registerApp({ name: text15(flags["display-name"]) ?? app2, bundleId });
244698
- completed.push("purchases_app");
244699
- } catch (error) {
244700
- if (refusalCode(error) !== "ALREADY_EXISTS") throw error;
244701
- purchasesApp = (await api4.listApps()).find((candidate) => candidate.bundleId === bundleId);
244702
- if (!purchasesApp) throw error;
244703
- }
244834
+ const registered = await applyPurchasesApp(api4, { site, bundleId, name: text15(flags["display-name"]) ?? app2 }, { apply: true, snapshot: snapshot4 });
244835
+ if (!registered.app) throw new Error(registered.step.detail);
244836
+ if (registered.step.state === "done") completed.push("purchases_app");
244837
+ purchasesApp = registered.app;
244704
244838
  }
244705
244839
  purchasesAppId = purchasesApp.id;
244706
- await api4.setAppleCredentials(purchasesApp.id, { keyId: iapKey.keyId, issuerId: iapKey.issuerId, privateKey: iapKey.key });
244840
+ await replaceIapKey(api4, purchasesApp, { keyId: iapKey.keyId, issuerId: iapKey.issuerId, privateKey: iapKey.key });
244707
244841
  completed.push("iap");
244708
- purchasesApp = (await api4.listApps()).find((candidate) => candidate.bundleId === bundleId);
244709
- if (!purchasesApp?.privateKeyStored) throw new Error("IAP key not confirmed");
244842
+ purchasesApp = await confirmIapKey(api4, bundleId);
244710
244843
  }
244711
244844
  iap = { present: purchasesApp?.privateKeyStored === true };
244712
244845
  purchasesAppId = purchasesApp?.id ?? null;
244713
244846
  } catch {
244714
244847
  iap = { present: null, state: "unavailable" };
244715
- failed3 = true;
244848
+ failed2 = true;
244716
244849
  }
244717
244850
  }
244718
244851
  const result = {
244719
- ok: !failed3,
244852
+ ok: !failed2,
244720
244853
  app: app2,
244721
244854
  site,
244722
244855
  bundleId,
@@ -244724,12 +244857,12 @@ async function runAppleKeys(pos, flags, io2, deps = {}) {
244724
244857
  iap,
244725
244858
  ready: asc.present === true && iap.present === true,
244726
244859
  purchasesAppId,
244727
- ...failed3 ? { code: "apple_keys_failed", hint: "Read apple-keys status before retrying; completed writes remain stored." } : {},
244860
+ ...failed2 ? { code: "apple_keys_failed", hint: "Read apple-keys status before retrying; completed writes remain stored." } : {},
244728
244861
  ...dryRun ? { dryRun: true, planned: [...ascKey ? ["asc"] : [], ...iapKey ? ["iap"] : []] } : {},
244729
244862
  completed
244730
244863
  };
244731
- (failed3 ? io2.error : io2.log)(JSON.stringify(result));
244732
- return failed3 ? 1 : 0;
244864
+ (failed2 ? io2.error : io2.log)(JSON.stringify(result));
244865
+ return failed2 ? 1 : 0;
244733
244866
  } catch (error) {
244734
244867
  const usage2 = error instanceof UsageError2;
244735
244868
  io2.error(JSON.stringify({
@@ -244747,6 +244880,9 @@ var init_apple_keys = __esm({
244747
244880
  init_define_HHP_CATALOG();
244748
244881
  init_hosted_owner();
244749
244882
  init_store_iap_purchases();
244883
+ init_snapshot();
244884
+ init_purchases_app();
244885
+ init_iap_key();
244750
244886
  init_wix_owner();
244751
244887
  init_preflight();
244752
244888
  init_push_setup_apple_credentials();
@@ -246173,8 +246309,8 @@ function track(p2) {
246173
246309
  void p2.then(() => busy.delete(p2), () => busy.delete(p2));
246174
246310
  }
246175
246311
  function queueStoreRecordSync(app2, fold2, run4) {
246176
- return new Promise((resolve134, reject) => {
246177
- const waiter = { resolve: resolve134, reject };
246312
+ return new Promise((resolve135, reject) => {
246313
+ const waiter = { resolve: resolve135, reject };
246178
246314
  const queue = syncQueues.get(app2);
246179
246315
  if (queue) {
246180
246316
  const waiting = queue.slice(1).find((e2) => e2.fold === fold2);
@@ -246758,9 +246894,9 @@ async function startMcpServer(opts) {
246758
246894
  root: deps.defaultDir,
246759
246895
  currentRoot: () => rootDir || opts.workspace || process.cwd()
246760
246896
  });
246761
- const closed = new Promise((resolve134) => {
246762
- stdin.once("end", resolve134);
246763
- stdin.once("close", resolve134);
246897
+ const closed = new Promise((resolve135) => {
246898
+ stdin.once("end", resolve135);
246899
+ stdin.once("close", resolve135);
246764
246900
  });
246765
246901
  const handle = serveStdio(
246766
246902
  () => {
@@ -246968,8 +247104,8 @@ __export(input_evidence_isolation_exports, {
246968
247104
  });
246969
247105
  async function installInputEvidenceIsolation(dir) {
246970
247106
  const { lstatSync: lstatSync44, readdirSync: readdirSync68, readlinkSync: readlinkSync4, realpathSync: realpathSync27 } = await import("node:fs");
246971
- const { dirname: dirname92, isAbsolute: isAbsolute23, join: join215, relative: relative40, resolve: resolve134, sep: sep37 } = await import("node:path");
246972
- const root = resolve134(dir);
247107
+ const { dirname: dirname92, isAbsolute: isAbsolute23, join: join215, relative: relative40, resolve: resolve135, sep: sep37 } = await import("node:path");
247108
+ const root = resolve135(dir);
246973
247109
  const privateDir = join215(root, ".himi");
246974
247110
  const privateReal = join215(realpathSync27(root), ".himi") + sep37;
246975
247111
  const within2 = (base2, path2) => {
@@ -246982,12 +247118,12 @@ async function installInputEvidenceIsolation(dir) {
246982
247118
  if (path2 === recording) {
246983
247119
  const link4 = readlinkSync4(path2);
246984
247120
  if (isAbsolute23(link4)) return false;
246985
- const target = resolve134(dirname92(path2), link4);
247121
+ const target = resolve135(dirname92(path2), link4);
246986
247122
  if (!within2(privateDir, target)) return false;
246987
247123
  if (realpathSync27(path2) !== join215(realpathSync27(root), relative40(root, target))) return false;
246988
247124
  return lstatSync44(target).isFile();
246989
247125
  }
246990
- return within2(privateDir, resolve134(path2)) && realpathSync27(path2).startsWith(privateReal);
247126
+ return within2(privateDir, resolve135(path2)) && realpathSync27(path2).startsWith(privateReal);
246991
247127
  } catch {
246992
247128
  return false;
246993
247129
  }
@@ -247026,7 +247162,7 @@ async function runInputEvidenceChild(ctx) {
247026
247162
  log: line => process.stdout.write(line + '\\n'),
247027
247163
  error: line => process.stderr.write(line + '\\n')
247028
247164
  });`;
247029
- const result = await new Promise((resolve134) => {
247165
+ const result = await new Promise((resolve135) => {
247030
247166
  const child3 = execFile8(process.execPath, [
247031
247167
  ...entry.pathname.endsWith(".ts") ? ["--import", import.meta.resolve("tsx")] : [],
247032
247168
  "--input-type=module",
@@ -247038,7 +247174,7 @@ async function runInputEvidenceChild(ctx) {
247038
247174
  process.removeListener("exit", stop2);
247039
247175
  process.removeListener("SIGTERM", terminate);
247040
247176
  process.removeListener("SIGINT", interrupt);
247041
- resolve134({ code: error ? typeof error.code === "number" ? error.code : 1 : 0, stdout, stderr });
247177
+ resolve135({ code: error ? typeof error.code === "number" ? error.code : 1 : 0, stdout, stderr });
247042
247178
  });
247043
247179
  const stop2 = () => {
247044
247180
  child3.kill();
@@ -247502,10 +247638,10 @@ function collectSdkModules(files, resolveSubpath) {
247502
247638
  for (const source2 of Object.values(files)) visit(source2);
247503
247639
  return { modules, unsupported: unsupported2 };
247504
247640
  }
247505
- function sdkSubpathReader(resolve134) {
247641
+ function sdkSubpathReader(resolve135) {
247506
247642
  return (sub) => {
247507
247643
  try {
247508
- return readFileSync131(resolve134(`@wix/himalaya/${sub}`), "utf8");
247644
+ return readFileSync131(resolve135(`@wix/himalaya/${sub}`), "utf8");
247509
247645
  } catch {
247510
247646
  return null;
247511
247647
  }
@@ -247583,7 +247719,7 @@ async function runBrowserAuthoring(opts) {
247583
247719
  const token = mintToken2(payload);
247584
247720
  const unusable2 = await probeAuthoringPage(opts.authoringBase, opts.fetchImpl, opts.probeTimeoutMs);
247585
247721
  if (unusable2) throw new Error(unusable2);
247586
- return await new Promise((resolve134, reject) => {
247722
+ return await new Promise((resolve135, reject) => {
247587
247723
  let settled = false;
247588
247724
  let url = "";
247589
247725
  const server = createServer6();
@@ -247635,7 +247771,7 @@ async function runBrowserAuthoring(opts) {
247635
247771
  }
247636
247772
  res.writeHead(200, { "content-type": "text/plain" }).end("ok");
247637
247773
  const report9 = body.result;
247638
- finish3(() => resolve134({ report: report9, url }));
247774
+ finish3(() => resolve135({ report: report9, url }));
247639
247775
  })();
247640
247776
  });
247641
247777
  server.on("error", (e2) => finish3(() => reject(e2)));
@@ -248342,12 +248478,17 @@ function appObject(source2) {
248342
248478
  const argument = call?.arguments[0];
248343
248479
  return argument && ts19.isObjectLiteralExpression(argument) ? argument : void 0;
248344
248480
  }
248481
+ function appMayBeOverridden(app2) {
248482
+ const literal3 = findProperty(app2, "app");
248483
+ const after = literal3 ? app2.properties.slice(app2.properties.indexOf(literal3) + 1) : app2.properties;
248484
+ return after.some((property3) => ts19.isSpreadAssignment(property3) || ts19.isComputedPropertyName(property3.name) || propName6(property3.name) === "app");
248485
+ }
248345
248486
  function declaresNewApp(configText) {
248346
248487
  const source2 = ts19.createSourceFile("config.ts", configText, ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
248347
248488
  const app2 = appObject(source2);
248348
248489
  const block = app2 && findProperty(app2, "app");
248349
248490
  const declared = block && ts19.isObjectLiteralExpression(block.initializer) ? findProperty(block.initializer, "newApp") : void 0;
248350
- return declared?.initializer.kind === ts19.SyntaxKind.TrueKeyword;
248491
+ return declared?.initializer.kind === ts19.SyntaxKind.TrueKeyword && !appMayBeOverridden(app2);
248351
248492
  }
248352
248493
  function avatarNavWorkerOf(configText) {
248353
248494
  const source2 = ts19.createSourceFile("config.ts", configText, ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
@@ -249826,6 +249967,28 @@ function applyScreens(source2, gates, context) {
249826
249967
  const text32 = applyEdits(afterRows, edits);
249827
249968
  return { status: text32 === source2 ? "unchanged" : "written", text: text32, wrapped, rows, missing: missing4 };
249828
249969
  }
249970
+ function newAppEdit(file2, app2) {
249971
+ const appProperty = findProperty(app2, "app");
249972
+ const appBlock = objectValue(appProperty);
249973
+ if (appProperty && !appBlock || appMayBeOverridden(app2)) return { kind: "not_literal" };
249974
+ const declared = appBlock && findProperty(appBlock, "newApp");
249975
+ if (declared) return { kind: declared.initializer.kind === ts23.SyntaxKind.TrueKeyword ? "declared" : "declared_false" };
249976
+ if (appBlock) return { kind: "missing", edit: { start: appBlock.getStart() + 1, end: appBlock.getStart() + 1, replacement: `
249977
+ ${" ".repeat(Math.max(2, file2.getLineAndCharacterOfPosition(appBlock.getStart()).character + 2))}"newApp": true,` } };
249978
+ const first = app2.properties[0];
249979
+ const indent = " ".repeat(first ? file2.getLineAndCharacterOfPosition(first.getStart()).character : 2);
249980
+ return { kind: "missing", edit: { start: app2.getStart() + 1, end: app2.getStart() + 1, replacement: `
249981
+ ${indent}"app": { "newApp": true },` } };
249982
+ }
249983
+ function declareNewApp(configText) {
249984
+ const file2 = parse5("config.ts", configText);
249985
+ const app2 = file2 && appObject(file2);
249986
+ if (!file2 || !app2) return { status: "manual", text: configText, reason: "config.ts has no literal defineApp({...}) to declare `app.newApp` in" };
249987
+ const found = newAppEdit(file2, app2);
249988
+ if (found.kind === "not_literal") return { status: "manual", text: configText, reason: NEW_APP_NOT_LITERAL };
249989
+ if (found.kind !== "missing") return { status: "unchanged", text: configText };
249990
+ return { status: "written", text: applyEdits(configText, [found.edit]) };
249991
+ }
249829
249992
  function navMembersNamed(file2) {
249830
249993
  const members2 = /* @__PURE__ */ new Set();
249831
249994
  const member = new RegExp(`(?:^|[:.])${NAV_SERVICE}\\.([A-Za-z0-9_]+)`, "g");
@@ -249881,21 +250044,12 @@ ${indent}"navLogicBundle": ${indented(headerBadgesBundleRef(ACCESS_NAV_BUNDLE),
249881
250044
  }
249882
250045
  }
249883
250046
  if (gates.length) {
249884
- const appProperty = findProperty(app2, "app");
249885
- const appBlock = objectValue(appProperty);
249886
- const declared = appBlock && findProperty(appBlock, "newApp");
249887
- if (appProperty && !appBlock) conflicts.push("`app` in config.ts is not an object literal, so `newApp` cannot be added to it safely");
249888
- else if (declared?.initializer.kind !== ts23.SyntaxKind.TrueKeyword) {
249889
- if (declared) conflicts.push("`app.newApp` is declared but not `true`: the page locks need app services, which an app that already shipped older binaries cannot use yet");
249890
- else if (!options2.newApp) return { ...refuse10(NEW_APP_REASON), needsNewApp: true };
249891
- else if (appBlock) edits.push({ start: appBlock.getStart() + 1, end: appBlock.getStart() + 1, replacement: `
249892
- ${" ".repeat(Math.max(2, file2.getLineAndCharacterOfPosition(appBlock.getStart()).character + 2))}"newApp": true,` });
249893
- else {
249894
- const first = app2.properties[0];
249895
- const indent = " ".repeat(first ? file2.getLineAndCharacterOfPosition(first.getStart()).character : 2);
249896
- edits.push({ start: app2.getStart() + 1, end: app2.getStart() + 1, replacement: `
249897
- ${indent}"app": { "newApp": true },` });
249898
- }
250047
+ const newApp = newAppEdit(file2, app2);
250048
+ if (newApp.kind === "not_literal") conflicts.push(NEW_APP_NOT_LITERAL);
250049
+ else if (newApp.kind === "declared_false") conflicts.push("`app.newApp` is declared but not `true`: the page locks need app services, which an app that already shipped older binaries cannot use yet");
250050
+ else if (newApp.kind === "missing") {
250051
+ if (!options2.newApp) return { ...refuse10(NEW_APP_REASON), needsNewApp: true };
250052
+ edits.push(newApp.edit);
249899
250053
  }
249900
250054
  }
249901
250055
  const kind = stringValue2(findProperty(navigation, "navKind")?.initializer) ?? "";
@@ -250081,7 +250235,7 @@ function renderGateTable(gates) {
250081
250235
  ""
250082
250236
  ].join("\n");
250083
250237
  }
250084
- var obj10, text18, strings2, mayHide, STOCK_COPY, node, SIGN_IN_SCREEN, CHAT_SCREEN, PLANS_SCREEN, slotPrefix, accessStatePath, accessRowHiddenPath, accessHiddenPath, slice, stringValue2, objectValue, PAYLOAD_KEYS, indented, LOGIN_HELPER, LOGIN_GATE_SCREEN, sameStatement, loginHelperSource, NEW_APP_REASON;
250238
+ var obj10, text18, strings2, mayHide, STOCK_COPY, node, SIGN_IN_SCREEN, CHAT_SCREEN, PLANS_SCREEN, slotPrefix, accessStatePath, accessRowHiddenPath, accessHiddenPath, slice, stringValue2, objectValue, PAYLOAD_KEYS, indented, LOGIN_HELPER, LOGIN_GATE_SCREEN, sameStatement, loginHelperSource, NEW_APP_NOT_LITERAL, NEW_APP_REASON;
250085
250239
  var init_access = __esm({
250086
250240
  "src/one-app/access.ts"() {
250087
250241
  init_define_HHP_CATALOG();
@@ -250120,6 +250274,7 @@ ${indent}`);
250120
250274
  LOGIN_GATE_SCREEN = "himi_sign_in";
250121
250275
  sameStatement = (a3, b3) => a3.replace(/\s+/g, " ").trim() === b3.replace(/\s+/g, " ").trim();
250122
250276
  loginHelperSource = (gateScreenId) => `const ${LOGIN_HELPER} = <T extends { config?: Record<string, unknown> }>(auth: T): T => ({ ...auth, config: { ${gateScreenId ? `gateScreenId: ${JSON.stringify(gateScreenId)}, ` : ""}...auth.config, required: true } });`;
250277
+ NEW_APP_NOT_LITERAL = "`app` in config.ts is not an object literal, or defineApp has a spread, shorthand, duplicate or computed key written after it that can set `app` at runtime, so `newApp` cannot be declared or relied on safely";
250123
250278
  NEW_APP_REASON = "Page locks read app-level state through app services (`$app:`), which an app may use only when it has never shipped a binary older than the first one with app services (1.9.0). If this migrated app is new, pass --new-app and it declares `app: { newApp: true }`. If it has already shipped, locks must wait for the enforced runtime floor.";
250124
250279
  }
250125
250280
  });
@@ -250455,19 +250610,19 @@ async function runOneAppAccess(args, io2) {
250455
250610
  writeFileSync54(write3.path, write3.after, "utf8");
250456
250611
  }
250457
250612
  } catch (error) {
250458
- const failed3 = [];
250613
+ const failed2 = [];
250459
250614
  for (const write3 of done.reverse()) {
250460
250615
  try {
250461
250616
  if (write3.before === void 0) rmSync31(write3.path, { force: true });
250462
250617
  else if (!existsSync114(write3.path) || readFileSync135(write3.path, "utf8") !== write3.before) writeFileSync54(write3.path, write3.before, "utf8");
250463
250618
  } catch {
250464
- failed3.push(write3.path);
250619
+ failed2.push(write3.path);
250465
250620
  }
250466
250621
  }
250467
250622
  return report3(io2, false, {
250468
250623
  code: "app_uninspectable",
250469
250624
  ...summary2,
250470
- error: `${errorText(error)}; ${failed3.length ? `these files could NOT be restored: ${failed3.join(", ")}` : "the files written so far were put back as they were"}.`
250625
+ error: `${errorText(error)}; ${failed2.length ? `these files could NOT be restored: ${failed2.join(", ")}` : "the files written so far were put back as they were"}.`
250471
250626
  });
250472
250627
  }
250473
250628
  }
@@ -251501,9 +251656,9 @@ function readVerifiedEvidence(evidenceDir, { runtime = "required" } = {}) {
251501
251656
  const manifest2 = readJson12(join150(evidenceDir, "manifest.json"));
251502
251657
  if (manifest2.workflow !== "one-app-to-himi-app") throw new Error("manifest.json is not for the one-app-to-himi-app workflow.");
251503
251658
  if (manifest2.stage !== "collected") throw new Error('manifest.json must have stage "collected".');
251504
- const unavailable = (Array.isArray(manifest2.warnings) ? manifest2.warnings : []).map(object11).filter((warning) => warning?.code === "runtime_context_unavailable" && (warning.platform === "ios" || warning.platform === "android"));
251505
- if (unavailable.length && runtime === "required") {
251506
- throw new Error(`Platform top-bar behavior is unverified: ${unavailable.map((warning) => warning.platform).join(", ")} runtime context unavailable.`);
251659
+ const unavailable2 = (Array.isArray(manifest2.warnings) ? manifest2.warnings : []).map(object11).filter((warning) => warning?.code === "runtime_context_unavailable" && (warning.platform === "ios" || warning.platform === "android"));
251660
+ if (unavailable2.length && runtime === "required") {
251661
+ throw new Error(`Platform top-bar behavior is unverified: ${unavailable2.map((warning) => warning.platform).join(", ")} runtime context unavailable.`);
251507
251662
  }
251508
251663
  const rawPath = join150(evidenceDir, "raw-structure.json");
251509
251664
  const rawBytes = readFileSync138(rawPath);
@@ -259453,8 +259608,8 @@ async function applyInvite(c2, plan, consentId) {
259453
259608
  const seat = c2.p.seat;
259454
259609
  const host = c2.google.host;
259455
259610
  if (plan.savePackage) {
259456
- const failed3 = await savePackage(c2, plan.packageName, { consentId });
259457
- if (failed3 !== void 0) return { code: failed3 };
259611
+ const failed2 = await savePackage(c2, plan.packageName, { consentId });
259612
+ if (failed2 !== void 0) return { code: failed2 };
259458
259613
  }
259459
259614
  const already = { consentId, ...plan.savePackage ? { packageName: plan.packageName } : {} };
259460
259615
  const { note, extra: savedExtra } = savedNote(already);
@@ -259692,8 +259847,8 @@ async function createApp3(c2) {
259692
259847
  if (!agreed) return fail11(io2, "consent_declined", "not confirmed; no app was created and no declaration was accepted", { packageName: pkg.packageName });
259693
259848
  const ownerApprovalId = `local-${c2.now().getTime()}`;
259694
259849
  if (pkg.save) {
259695
- const failed3 = await savePackage(c2, pkg.packageName);
259696
- if (failed3 !== void 0) return failed3;
259850
+ const failed2 = await savePackage(c2, pkg.packageName);
259851
+ if (failed2 !== void 0) return failed2;
259697
259852
  }
259698
259853
  const already = pkg.save ? { packageName: pkg.packageName } : {};
259699
259854
  const { note, extra: savedExtra } = savedNote(already);
@@ -260661,10 +260816,10 @@ async function run3(c2) {
260661
260816
  job = await approveAndApply(runner2, job, c2.person, c2.actor, c2.now);
260662
260817
  }
260663
260818
  } catch (e2) {
260664
- const failed3 = e2 instanceof JobFailure || e2 instanceof ReadyRefusal ? e2.job : e2.job;
260665
- const upgraded = upgradedRefusal(io2, p2, `${e2.message ?? ""} ${failed3?.error ?? ""}`, { ...base2, ...failed3 ? { jobId: failed3.id, status: failed3.status } : {} });
260819
+ const failed2 = e2 instanceof JobFailure || e2 instanceof ReadyRefusal ? e2.job : e2.job;
260820
+ const upgraded = upgradedRefusal(io2, p2, `${e2.message ?? ""} ${failed2?.error ?? ""}`, { ...base2, ...failed2 ? { jobId: failed2.id, status: failed2.status } : {} });
260666
260821
  if (upgraded !== void 0) return upgraded;
260667
- return fail13(io2, "job_failed", e2.message ?? String(e2), { ...base2, ...readyOut, ...failed3 ? { jobId: failed3.id, status: failed3.status, next: `gplay-node jobs show ${failed3.id}` } : {} });
260822
+ return fail13(io2, "job_failed", e2.message ?? String(e2), { ...base2, ...readyOut, ...failed2 ? { jobId: failed2.id, status: failed2.status, next: `gplay-node jobs show ${failed2.id}` } : {} });
260668
260823
  }
260669
260824
  if (job && job.status !== "verified") {
260670
260825
  const upgraded = upgradedRefusal(io2, p2, String(job.error ?? ""), { ...base2, jobId: job.id, status: job.status });
@@ -260694,12 +260849,12 @@ async function run3(c2) {
260694
260849
  }
260695
260850
  }
260696
260851
  } catch (e2) {
260697
- const failed3 = e2 instanceof ReadyRefusal || e2 instanceof JobFailure ? e2.job : e2.job;
260852
+ const failed2 = e2 instanceof ReadyRefusal || e2 instanceof JobFailure ? e2.job : e2.job;
260698
260853
  return fail13(
260699
260854
  io2,
260700
260855
  "job_failed",
260701
260856
  `the pool group is ${adding ? "on" : "off"} the track, but readying it stopped: ${e2.message ?? String(e2)}`,
260702
- { ...base2, groups: after, ...readyOut, ...failed3 ? { jobId: failed3.id, status: failed3.status, next: `gplay-node jobs show ${failed3.id}` } : {} }
260857
+ { ...base2, groups: after, ...readyOut, ...failed2 ? { jobId: failed2.id, status: failed2.status, next: `gplay-node jobs show ${failed2.id}` } : {} }
260703
260858
  );
260704
260859
  }
260705
260860
  }
@@ -261388,7 +261543,7 @@ var init_iap_client = __esm({
261388
261543
  this.options = options2;
261389
261544
  this.fetchImpl = options2.fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
261390
261545
  this.now = options2.now ?? Date.now;
261391
- this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2)));
261546
+ this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
261392
261547
  }
261393
261548
  fetchImpl;
261394
261549
  now;
@@ -261799,8 +261954,8 @@ async function probe(id, read2, failure4) {
261799
261954
  return { id, ...failure4 };
261800
261955
  }
261801
261956
  }
261802
- async function optionalCheck(id, read2, unavailable) {
261803
- return read2 ? probe(id, read2, blocked("setup_read_failed", `Could not read ${id}; check owner permissions and retry.`)) : { id, ...unavailable };
261957
+ async function optionalCheck(id, read2, unavailable2) {
261958
+ return read2 ? probe(id, read2, blocked("setup_read_failed", `Could not read ${id}; check owner permissions and retry.`)) : { id, ...unavailable2 };
261804
261959
  }
261805
261960
  function mappingCheck(item2, mappings) {
261806
261961
  const rule = item2.wix && APPLE_PROVISIONING_RULES[item2.wix.entityType];
@@ -263381,8 +263536,8 @@ async function runOps(run4, ops, context, manifest2) {
263381
263536
  return steps;
263382
263537
  }
263383
263538
  function outcomeOf(ops, steps, unmet) {
263384
- const failed3 = steps.some((s5) => s5.state === "failed");
263385
- if (failed3) return steps.some((s5) => s5.state === "done" || s5.state === "reconciled") ? "partial" : "failed";
263539
+ const failed2 = steps.some((s5) => s5.state === "failed");
263540
+ if (failed2) return steps.some((s5) => s5.state === "done" || s5.state === "reconciled") ? "partial" : "failed";
263386
263541
  if (unmet.length) return "partial";
263387
263542
  if (ops.some((op) => op.kind === "createProduct")) return "created";
263388
263543
  return ops.length ? "updated" : "reused";
@@ -264542,6 +264697,41 @@ var init_store_iap_catalog = __esm({
264542
264697
  }
264543
264698
  });
264544
264699
 
264700
+ // src/iap-setup/payment-provider.ts
264701
+ function checkPaymentProvider() {
264702
+ return { state: "unverified", code: "provider_check_unavailable", detail: "wix-iap has no read-only provider-readiness method" };
264703
+ }
264704
+ async function connectPaymentProvider(provider, appId3, apply2) {
264705
+ if (provider && !apply2) {
264706
+ return {
264707
+ state: "unverified",
264708
+ detail: "whether the appleIAP payment provider is connected cannot be read (wix-iap has no read-only provider-readiness method), so applying sends ConnectProviderAccount again"
264709
+ };
264710
+ }
264711
+ if (!provider || !apply2) return paymentProviderPlan(provider);
264712
+ try {
264713
+ const { connected } = await provider.connect(appId3);
264714
+ return connected ? { state: "done", detail: "the appleIAP payment provider is connected on the site" } : { state: "blocked", code: "provider_not_connected", detail: "wix-iap answered, but the appleIAP provider account is not connected" };
264715
+ } catch (error) {
264716
+ const e2 = error;
264717
+ if (e2?.status === 404 && !e2.body?.details?.applicationError?.code) return paymentProviderPlan(null);
264718
+ return failedStep("connect the appleIAP provider", error);
264719
+ }
264720
+ }
264721
+ function paymentProviderPlan(provider) {
264722
+ return provider ? { state: "planned", detail: "connect the appleIAP payment provider through wix-iap" } : {
264723
+ state: "blocked",
264724
+ code: "provider_route_unavailable",
264725
+ detail: "the appleIAP provider is connected through Serve's IAP routes (wix-iap ConnectProviderAccount), and this Serve target has none."
264726
+ };
264727
+ }
264728
+ var init_payment_provider = __esm({
264729
+ "src/iap-setup/payment-provider.ts"() {
264730
+ init_define_HHP_CATALOG();
264731
+ init_step();
264732
+ }
264733
+ });
264734
+
264545
264735
  // src/store-iap-connect.ts
264546
264736
  async function planCheck(items, deps) {
264547
264737
  const rules = deps.saleRules ?? APPLE_PROVISIONING_RULES;
@@ -264568,95 +264758,21 @@ async function connectIap(manifest2, deps, options2) {
264568
264758
  };
264569
264759
  };
264570
264760
  const plans = await planCheck(manifest2.items, deps);
264571
- const found = await findOrRegister(deps.api, manifest2, options2.apply);
264761
+ const found = await applyPurchasesApp(deps.api, { site: target.wixSiteId, bundleId: target.bundleId, name: target.himiApp }, { apply: options2.apply });
264572
264762
  if (!found.app) {
264573
264763
  const skipped = found.step.state === "planned" ? planned : noApp;
264574
264764
  return report9(found.step, null, {
264575
- credentials: found.step.state === "planned" ? credentialsPlan(deps) : skipped("the app is not registered"),
264576
- provider: found.step.state === "planned" ? providerPlan(deps.provider) : skipped("the app is not registered"),
264765
+ credentials: found.step.state === "planned" ? iapKeyPlan(deps) : skipped("the app is not registered"),
264766
+ provider: found.step.state === "planned" ? paymentProviderPlan(deps.provider) : skipped("the app is not registered"),
264577
264767
  mappings: manifest2.items.map((item2) => mappingWithoutApp(item2, found.step.state === "planned", plans, deps.saleRules))
264578
264768
  });
264579
264769
  }
264580
264770
  const { app: app2 } = found;
264581
- const credentials = await storeKey(deps, app2, options2.apply);
264582
- const provider = await connectProvider(deps.provider, app2.id, options2.apply);
264771
+ const credentials = await keepIapKey(deps, app2, options2.apply);
264772
+ const provider = await connectPaymentProvider(deps.provider, app2.id, options2.apply);
264583
264773
  const mappings = await mapItems(deps.catalog, app2.id, manifest2.items, options2.apply, plans, deps.saleRules);
264584
264774
  return report9(found.step, app2.id, { credentials, provider, mappings });
264585
264775
  }
264586
- async function findOrRegister(api4, manifest2, apply2) {
264587
- const { bundleId, himiApp, wixSiteId } = manifest2.target;
264588
- const existing = (await api4.listApps()).find((app2) => app2.bundleId === bundleId);
264589
- if (existing) return { app: existing, step: { state: "reused", detail: `purchases app ${existing.id} for ${bundleId} on site ${wixSiteId}` } };
264590
- if (!apply2) return { step: { state: "planned", detail: `register ${bundleId} on site ${wixSiteId}` } };
264591
- try {
264592
- const app2 = await api4.registerApp({ name: himiApp, bundleId });
264593
- return { app: app2, step: { state: "done", detail: `registered purchases app ${app2.id} for ${bundleId} on site ${wixSiteId}` } };
264594
- } catch (error) {
264595
- if (refusalCode(error) !== "ALREADY_EXISTS") return { step: failed("register the app", error) };
264596
- let apps;
264597
- try {
264598
- apps = await api4.listApps();
264599
- } catch (rereadError) {
264600
- return { step: failed("re-read the site's purchases apps after the bundle was reported registered", rereadError) };
264601
- }
264602
- const raced = apps.find((app2) => app2.bundleId === bundleId);
264603
- if (raced) return { app: raced, step: { state: "reused", detail: `purchases app ${raced.id} for ${bundleId} on site ${wixSiteId}` } };
264604
- return {
264605
- step: {
264606
- state: "conflict",
264607
- code: "bundle_registered_elsewhere",
264608
- detail: `${bundleId} is already registered to another app, on another site (this site has none for it). A bundle id belongs to one purchases app platform-wide; only the owner of that registration can remove it. Nothing was changed.`
264609
- }
264610
- };
264611
- }
264612
- }
264613
- async function storeKey(deps, app2, apply2) {
264614
- if (app2.privateKeyStored) return { state: "reused", detail: "an In-App Purchase key is already stored" };
264615
- if (!deps.appleKey) return credentialsPlan(deps);
264616
- if (!apply2) return credentialsPlan(deps);
264617
- try {
264618
- await deps.api.setAppleCredentials(app2.id, deps.appleKey);
264619
- return { state: "done", detail: "stored the In-App Purchase key" };
264620
- } catch (error) {
264621
- return failed("store the In-App Purchase key", error);
264622
- }
264623
- }
264624
- function credentialsPlan(deps) {
264625
- if (!deps.appleKey && deps.serverKeyOnly) return {
264626
- state: "blocked",
264627
- code: "apple_key_missing",
264628
- detail: "The purchases app has no In-App Purchase key. Run himi store apple-keys setup --app <slug> --site <metaSiteId> --bundle-id <id> --iap-key <AuthKey.p8> --iap-key-id <id> --iap-issuer-id <issuer> --yes, then rerun connect. An App Store Connect API key cannot replace this credential."
264629
- };
264630
- return deps.appleKey ? { state: "planned", detail: "store the In-App Purchase key" } : {
264631
- state: "blocked",
264632
- code: "apple_key_missing",
264633
- detail: "no In-App Purchase key: create one in App Store Connect \u2192 Users and Access \u2192 Integrations \u2192 In-App Purchase, then run himi store apple-keys setup with --iap-key <AuthKey.p8> --iap-key-id <key id> --iap-issuer-id <issuer>, or rerun legacy connect with its key flags (an App Store Connect API key is rejected)."
264634
- };
264635
- }
264636
- async function connectProvider(provider, appId3, apply2) {
264637
- if (provider && !apply2) {
264638
- return {
264639
- state: "unverified",
264640
- detail: "whether the appleIAP payment provider is connected cannot be read (wix-iap has no read-only provider-readiness method), so applying sends ConnectProviderAccount again"
264641
- };
264642
- }
264643
- if (!provider || !apply2) return providerPlan(provider);
264644
- try {
264645
- const { connected } = await provider.connect(appId3);
264646
- return connected ? { state: "done", detail: "the appleIAP payment provider is connected on the site" } : { state: "blocked", code: "provider_not_connected", detail: "wix-iap answered, but the appleIAP provider account is not connected" };
264647
- } catch (error) {
264648
- const e2 = error;
264649
- if (e2?.status === 404 && !e2.body?.details?.applicationError?.code) return providerPlan(null);
264650
- return failed("connect the appleIAP provider", error);
264651
- }
264652
- }
264653
- function providerPlan(provider) {
264654
- return provider ? { state: "planned", detail: "connect the appleIAP payment provider through wix-iap" } : {
264655
- state: "blocked",
264656
- code: "provider_route_unavailable",
264657
- detail: "the appleIAP provider is connected through Serve's IAP routes (wix-iap ConnectProviderAccount), and this Serve target has none."
264658
- };
264659
- }
264660
264776
  async function mapItems(api4, appId3, items, apply2, plans, rules = APPLE_PROVISIONING_RULES) {
264661
264777
  let catalog4;
264662
264778
  try {
@@ -264664,7 +264780,7 @@ async function mapItems(api4, appId3, items, apply2, plans, rules = APPLE_PROVIS
264664
264780
  } catch (error) {
264665
264781
  return items.map((item2) => {
264666
264782
  const target = mappingTarget(item2, plans, rules);
264667
- return "skip" in target ? target.skip : { ...target, ...failed("read the app's catalog", error) };
264783
+ return "skip" in target ? target.skip : { ...target, ...failedStep("read the app's catalog", error) };
264668
264784
  });
264669
264785
  }
264670
264786
  const steps = [];
@@ -264684,7 +264800,7 @@ async function mapItems(api4, appId3, items, apply2, plans, rules = APPLE_PROVIS
264684
264800
  steps.push({ ...target, state: "done", detail: `mapped ${target.appProductId} \u2192 ${target.storeProductId}` });
264685
264801
  } catch (error) {
264686
264802
  const now = await api4.listProducts(appId3).catch(() => catalog4);
264687
- steps.push(decide2(now, target) ?? (refusalCode(error) === "STORE_PRODUCT_ID_IN_USE" ? { ...target, state: "conflict", code: "sku_in_use", detail: `${target.storeProductId} is already in use; nothing was changed` } : { ...target, ...failed("map the item", error) }));
264803
+ steps.push(decide2(now, target) ?? (refusalCode(error) === "STORE_PRODUCT_ID_IN_USE" ? { ...target, state: "conflict", code: "sku_in_use", detail: `${target.storeProductId} is already in use; nothing was changed` } : { ...target, ...failedStep("map the item", error) }));
264688
264804
  }
264689
264805
  }
264690
264806
  return steps;
@@ -264759,15 +264875,16 @@ function planned(detail) {
264759
264875
  function noApp(why) {
264760
264876
  return { state: "skipped", code: "no_purchases_app", detail: `${why}, so this step did not run` };
264761
264877
  }
264762
- function failed(what, error) {
264763
- return { state: "failed", code: "request_failed", detail: `could not ${what}: ${error instanceof Error ? error.message : String(error)}` };
264764
- }
264765
264878
  var PRODUCT_TYPE, DIFF_BUCKET;
264766
264879
  var init_store_iap_connect = __esm({
264767
264880
  "src/store-iap-connect.ts"() {
264768
264881
  init_define_HHP_CATALOG();
264769
264882
  init_wix_payments_contract();
264770
264883
  init_store_iap_purchases();
264884
+ init_step();
264885
+ init_purchases_app();
264886
+ init_iap_key();
264887
+ init_payment_provider();
264771
264888
  PRODUCT_TYPE = { nonConsumable: "NON_CONSUMABLE", consumable: "CONSUMABLE" };
264772
264889
  DIFF_BUCKET = {
264773
264890
  reused: "inPlace",
@@ -264967,9 +265084,9 @@ import { join as join176 } from "node:path";
264967
265084
  function renderProblems(render3, entityId) {
264968
265085
  const problems = (render3.liveErrors ?? []).map((e2) => `${e2.service}: ${e2.message}`);
264969
265086
  const ofItem = (call) => call.toLowerCase().includes(entityId.toLowerCase());
264970
- const failed3 = (render3.liveFailed ?? []).filter(ofItem);
265087
+ const failed2 = (render3.liveFailed ?? []).filter(ofItem);
264971
265088
  const attempted = (render3.liveCalls ?? []).filter(ofItem).length;
264972
- if (failed3.length > 0 && attempted <= failed3.length) problems.push(`reading the item failed (${failed3[0]}), so the screen could not show it`);
265089
+ if (failed2.length > 0 && attempted <= failed2.length) problems.push(`reading the item failed (${failed2[0]}), so the screen could not show it`);
264973
265090
  return problems;
264974
265091
  }
264975
265092
  function workerBundleDir(result, dir) {
@@ -265875,7 +265992,7 @@ function defaultStoreIapDeps() {
265875
265992
  profileTeam: (profile) => resolveStoreCredentials({ app: profile, cfg: {}, profileFlag: profile, env: {} }).team,
265876
265993
  confirm: confirmOnTerminal,
265877
265994
  now: () => /* @__PURE__ */ new Date(),
265878
- sleep: (ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2))
265995
+ sleep: (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))
265879
265996
  };
265880
265997
  }
265881
265998
  var STORE_IAP_USAGE, SUMMARY_THRESHOLD, SUMMARY_DETAIL_LIMIT, UsageError10, CommandOutput, pad, DECISION_ORDER, OUTCOME_ORDER, COMPLETE, DRAFT_MODES, TERRITORY_CODE, LOCALE_CODE, GRID_UNAVAILABLE_NOTE, KeyError, CredentialsError, writesPlanned, COMMANDS4;
@@ -267050,7 +267167,7 @@ async function browserLogin2(opts) {
267050
267167
  const log = opts.log ?? (() => {
267051
267168
  });
267052
267169
  const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS6;
267053
- return await new Promise((resolve134, reject) => {
267170
+ return await new Promise((resolve135, reject) => {
267054
267171
  let settled = false;
267055
267172
  let loginUrl = "";
267056
267173
  const server = createServer9();
@@ -267121,7 +267238,7 @@ async function browserLogin2(opts) {
267121
267238
  res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", connection: "close" }).end(closePage(opts.doneTitle ?? "Signed in to himi"));
267122
267239
  const extra = {};
267123
267240
  for (const [k3, v2] of params) if (k3 !== "token" && k3 !== "state") extra[k3] = v2;
267124
- finish3(() => resolve134({ token, loginUrl, extra }));
267241
+ finish3(() => resolve135({ token, loginUrl, extra }));
267125
267242
  });
267126
267243
  });
267127
267244
  server.on("error", (err) => finish3(() => reject(err)));
@@ -267945,7 +268062,7 @@ async function runAllMembers(args) {
267945
268062
  const result = await sendCampaign({
267946
268063
  recipients,
267947
268064
  campaignId: requestId2,
267948
- wait: deps.wait ?? ((ms2) => new Promise((resolve134) => setTimeout(resolve134, ms2))),
268065
+ wait: deps.wait ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))),
267949
268066
  onProgress: (completed) => {
267950
268067
  if (completed % 10 === 0 || completed === recipients.length) {
267951
268068
  io2.log(JSON.stringify({ ok: true, state: "progress", campaignId: requestId2, completed, recipients: recipients.length }));
@@ -268330,6 +268447,121 @@ var init_notify = __esm({
268330
268447
  }
268331
268448
  });
268332
268449
 
268450
+ // src/setup-checks.ts
268451
+ function failure(refusal2) {
268452
+ if (!refusal2) return { ok: false, code: "setup_status_unreadable" };
268453
+ const error = text28(refusal2.error) ?? "setup_check_failed";
268454
+ const code3 = text28(refusal2.code) ?? error;
268455
+ return { ok: false, error, code: code3, ...text28(refusal2.hint) ? { hint: refusal2.hint } : {} };
268456
+ }
268457
+ function pushSection(result) {
268458
+ const { signIn: _signIn, steps: _steps, ...push } = result;
268459
+ if (push.ok === true) return { ...push, ok: true };
268460
+ const code3 = text28(push.code) ?? text28(push.error) ?? (text28(push.state) ? `push_${push.state}` : "push_not_ready");
268461
+ return { ...push, ok: false, code: code3 };
268462
+ }
268463
+ function signInSection(signIn3) {
268464
+ const ready = [signIn3.appleReady, signIn3.googleIosReady, signIn3.googleAndroidReady];
268465
+ const ok5 = ready.includes(false) ? false : ready.every((v2) => v2 === true) ? true : null;
268466
+ return { ok: ok5, ...signIn3 };
268467
+ }
268468
+ function stepsSection(raw, vocabulary) {
268469
+ const steps = Object.fromEntries(Object.entries(raw).filter(([id]) => STEP_ID.test(id)).map(([id, value2]) => [id, stepLine(obj14(value2) ?? {}, vocabulary)]));
268470
+ const states = Object.values(steps).map((s5) => s5.state);
268471
+ const ok5 = states.some((s5) => vocabulary.failing.has(s5)) ? false : states.some((s5) => s5 === "unknown" || vocabulary.unverified.has(s5)) ? null : true;
268472
+ return { ok: ok5, steps };
268473
+ }
268474
+ function stepLine(step, vocabulary) {
268475
+ const state = typeof step.state === "string" && vocabulary.states.has(step.state) ? step.state : "unknown";
268476
+ return {
268477
+ state,
268478
+ ...text28(step.failedStage) && CODE2.test(step.failedStage) ? { failedStage: step.failedStage } : {},
268479
+ ...text28(step.code) && CODE2.test(step.code) ? { code: step.code } : {},
268480
+ ...text28(step.error) ? { error: step.error } : {},
268481
+ ...text28(step.detail) ? { detail: step.detail } : {}
268482
+ };
268483
+ }
268484
+ function stepsIn(steps, areas) {
268485
+ return Object.fromEntries(Object.entries(steps).filter(([id]) => (STEP_AREAS[id] ?? ["push"]).some((a3) => areas.includes(a3))));
268486
+ }
268487
+ var AREAS, obj14, text28, SERVER_STEPS, IAP_SETUP_STEPS, STEP_ID, CODE2, STEP_AREAS, pushStatus, SETUP_CHECKS;
268488
+ var init_setup_checks = __esm({
268489
+ "src/setup-checks.ts"() {
268490
+ init_define_HHP_CATALOG();
268491
+ AREAS = ["push", "signin", "iap"];
268492
+ obj14 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
268493
+ text28 = (v2) => typeof v2 === "string" && v2.length > 0 ? v2 : void 0;
268494
+ SERVER_STEPS = {
268495
+ states: /* @__PURE__ */ new Set(["not_configured", "provisioning", "ready", "needs_attention", "not_required"]),
268496
+ failing: /* @__PURE__ */ new Set(["needs_attention"]),
268497
+ unverified: /* @__PURE__ */ new Set(["provisioning"])
268498
+ };
268499
+ IAP_SETUP_STEPS = {
268500
+ states: /* @__PURE__ */ new Set(["ready", "missing", "unverified", "unavailable", "not_checked"]),
268501
+ failing: /* @__PURE__ */ new Set(["missing", "unavailable"]),
268502
+ unverified: /* @__PURE__ */ new Set(["unverified", "not_checked"])
268503
+ };
268504
+ STEP_ID = /^[a-z][a-z-]{0,39}$/;
268505
+ CODE2 = /^[a-z][a-z0-9_]{0,63}$/;
268506
+ STEP_AREAS = {
268507
+ "app-identity": ["push", "signin"],
268508
+ apns: ["push"],
268509
+ "apple-signing": ["push"],
268510
+ firebase: ["push"],
268511
+ "ping-readback": ["push"],
268512
+ "android-signin": ["signin"]
268513
+ };
268514
+ pushStatus = (ctx) => ctx.read("pushStatus", { json: true });
268515
+ SETUP_CHECKS = [
268516
+ {
268517
+ name: "push",
268518
+ areas: ["push"],
268519
+ async run(ctx) {
268520
+ const { result, refusal: refusal2 } = await pushStatus(ctx) ?? {};
268521
+ return result ? pushSection(result) : failure(refusal2);
268522
+ }
268523
+ },
268524
+ {
268525
+ name: "signIn",
268526
+ areas: ["signin"],
268527
+ async run(ctx) {
268528
+ const { result, refusal: refusal2 } = await pushStatus(ctx) ?? {};
268529
+ const signIn3 = obj14(result?.signIn);
268530
+ return signIn3 ? signInSection(signIn3) : failure(result ? { error: text28(result.error) ?? "sign_in_status_missing" } : refusal2);
268531
+ }
268532
+ },
268533
+ {
268534
+ name: "steps",
268535
+ areas: ["push", "signin"],
268536
+ async run(ctx) {
268537
+ const steps = obj14((await pushStatus(ctx))?.result?.steps);
268538
+ return steps ? stepsSection(stepsIn(steps, ctx.areas), SERVER_STEPS) : void 0;
268539
+ }
268540
+ },
268541
+ {
268542
+ name: "iap",
268543
+ areas: ["iap"],
268544
+ async run(ctx) {
268545
+ const manifest2 = text28(ctx.flags["iap-manifest"]);
268546
+ if (!manifest2) return { ok: null, state: "not_checked", code: "iap_manifest_missing", fix: "Pass --iap-manifest <file> (and --catalog-route <path>) to check IAP." };
268547
+ const { result, refusal: refusal2 } = await ctx.read("iapCheck", { manifest: manifest2, json: true }) ?? {};
268548
+ return result && typeof result.ok === "boolean" ? { ...result, ok: result.ok } : failure(refusal2);
268549
+ }
268550
+ },
268551
+ {
268552
+ name: "iapSetup",
268553
+ areas: ["iap"],
268554
+ async run(ctx) {
268555
+ const read2 = await ctx.read("iapSetup", { json: true });
268556
+ if (!read2) return void 0;
268557
+ const steps = obj14(read2.result?.steps);
268558
+ return steps ? stepsSection(steps, IAP_SETUP_STEPS) : failure(read2.refusal);
268559
+ }
268560
+ }
268561
+ ];
268562
+ }
268563
+ });
268564
+
268333
268565
  // src/setup-check.ts
268334
268566
  var setup_check_exports = {};
268335
268567
  __export(setup_check_exports, {
@@ -268348,24 +268580,17 @@ async function capture(run4) {
268348
268580
  await run4({ log: (s5) => out2.push(s5), error: (s5) => err.push(s5) });
268349
268581
  const result = parse9(out2.join("\n")) ?? out2.map(parse9).filter(Boolean).at(-1);
268350
268582
  const refusal2 = err.map(parse9).filter((row2) => Boolean(row2) && row2.event === void 0).at(-1);
268351
- return { result, refusal: refusal2 };
268583
+ return { ...result ? { result } : {}, ...refusal2 ? { refusal: refusal2 } : {} };
268352
268584
  }
268353
- function failure(refusal2) {
268354
- if (!refusal2) return { ok: false, code: "setup_status_unreadable" };
268355
- const error = text28(refusal2.error) ?? "setup_check_failed";
268356
- const code3 = text28(refusal2.code) ?? error;
268357
- return { ok: false, error, code: code3, ...text28(refusal2.hint) ? { hint: refusal2.hint } : {} };
268358
- }
268359
- function pushSection(result) {
268360
- const { signIn: _2, ...push } = result;
268361
- if (push.ok === true) return { ...push, ok: true };
268362
- const code3 = text28(push.code) ?? text28(push.error) ?? (text28(push.state) ? `push_${push.state}` : "push_not_ready");
268363
- return { ...push, ok: false, code: code3 };
268364
- }
268365
- function signInSection(signIn3) {
268366
- const ready = [signIn3.appleReady, signIn3.googleIosReady, signIn3.googleAndroidReady];
268367
- const ok5 = ready.includes(false) ? false : ready.every((v2) => v2 === true) ? true : null;
268368
- return { ok: ok5, ...signIn3 };
268585
+ function sourceReader(flags, deps) {
268586
+ const cache4 = /* @__PURE__ */ new Map();
268587
+ return (source2, extra = {}) => {
268588
+ const run4 = deps[source2];
268589
+ if (!run4) return Promise.resolve(void 0);
268590
+ const key4 = `${source2}:${JSON.stringify(extra)}`;
268591
+ if (!cache4.has(key4)) cache4.set(key4, capture((io2) => run4({ ...flags, ...extra }, io2)));
268592
+ return cache4.get(key4);
268593
+ };
268369
268594
  }
268370
268595
  function areasFrom(flags) {
268371
268596
  const only = text28(flags.only);
@@ -268379,32 +268604,20 @@ function refuse9(io2, code3, error) {
268379
268604
  io2.error(JSON.stringify({ ok: false, error, code: code3 }));
268380
268605
  return 2;
268381
268606
  }
268382
- async function runSetupCheck(flags, io2, deps) {
268607
+ async function runSetupCheck(flags, io2, deps, checks = SETUP_CHECKS) {
268383
268608
  for (const name of ["only", "iap-manifest"]) {
268384
268609
  if (flags[name] !== void 0 && !text28(flags[name])) return refuse9(io2, "missing_flag_value", `--${name} needs a value`);
268385
268610
  }
268386
268611
  const areas = areasFrom(flags);
268387
268612
  if (!Array.isArray(areas)) return refuse9(io2, areas.code, areas.error);
268388
- const manifest2 = text28(flags["iap-manifest"]);
268389
- if (text28(flags.only) && areas.includes("iap") && !manifest2) {
268613
+ if (text28(flags.only) && areas.includes("iap") && !text28(flags["iap-manifest"])) {
268390
268614
  return refuse9(io2, "iap_manifest_required", "--only iap needs --iap-manifest <file>");
268391
268615
  }
268616
+ const read2 = sourceReader(flags, deps);
268392
268617
  const report9 = {};
268393
- if (areas.includes("push") || areas.includes("signin")) {
268394
- const { result, refusal: refusal2 } = await capture((sub) => deps.pushStatus({ ...flags, json: true }, sub));
268395
- const signIn3 = obj14(result?.signIn);
268396
- if (areas.includes("push")) {
268397
- if (result) report9.push = pushSection(result);
268398
- else report9.push = failure(refusal2);
268399
- }
268400
- if (areas.includes("signin")) report9.signIn = signIn3 ? signInSection(signIn3) : failure(result ? { error: text28(result.error) ?? "sign_in_status_missing" } : refusal2);
268401
- }
268402
- if (areas.includes("iap")) {
268403
- if (!manifest2) report9.iap = { ok: null, state: "not_checked", code: "iap_manifest_missing", fix: "Pass --iap-manifest <file> (and --catalog-route <path>) to check IAP." };
268404
- else {
268405
- const { result, refusal: refusal2 } = await capture((sub) => deps.iapCheck({ ...flags, manifest: manifest2, json: true }, sub));
268406
- report9.iap = result && typeof result.ok === "boolean" ? { ...result, ok: result.ok } : failure(refusal2);
268407
- }
268618
+ for (const check of checks.filter((c2) => c2.areas.some((a3) => areas.includes(a3)))) {
268619
+ const section3 = await check.run({ flags, areas, read: read2 });
268620
+ if (section3) report9[check.name] = section3;
268408
268621
  }
268409
268622
  const sections2 = Object.entries(report9);
268410
268623
  const ok5 = sections2.every(([, s5]) => s5.ok !== false);
@@ -268412,13 +268625,110 @@ async function runSetupCheck(flags, io2, deps) {
268412
268625
  io2.log(JSON.stringify({ ok: ok5, ...unverified.length ? { unverified } : {}, ...report9 }, null, 2));
268413
268626
  return ok5 ? 0 : 1;
268414
268627
  }
268415
- var AREAS, obj14, text28;
268416
268628
  var init_setup_check = __esm({
268417
268629
  "src/setup-check.ts"() {
268418
268630
  init_define_HHP_CATALOG();
268419
- AREAS = ["push", "signin", "iap"];
268420
- obj14 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
268421
- text28 = (v2) => typeof v2 === "string" && v2.length > 0 ? v2 : void 0;
268631
+ init_setup_checks();
268632
+ }
268633
+ });
268634
+
268635
+ // src/iap-setup/check.ts
268636
+ var check_exports = {};
268637
+ __export(check_exports, {
268638
+ runIapSetupCheck: () => runIapSetupCheck
268639
+ });
268640
+ import { readFileSync as readFileSync173 } from "node:fs";
268641
+ import { resolve as resolve117 } from "node:path";
268642
+ async function runIapSetupCheck(flags, io2, deps = {}) {
268643
+ const target = identityFrom(flags, deps);
268644
+ if ("refused" in target) {
268645
+ io2.error(JSON.stringify({ ok: false, code: target.refused, error: target.refused, hint: target.hint }));
268646
+ return 2;
268647
+ }
268648
+ const owner = await (deps.session ?? hostedOwnerSession)(flags);
268649
+ if (!owner.ok) {
268650
+ io2.error(JSON.stringify({ ok: false, code: "owner_session_unavailable", error: owner.error, ...owner.hint ? { hint: owner.hint } : {} }));
268651
+ return owner.exit;
268652
+ }
268653
+ const identity = { ...target, app: await (deps.resolveApp ?? ownedSlug(deps))(owner.session, target.app) };
268654
+ const snapshot4 = await readSnapshot(identity.site, deps);
268655
+ const steps = {
268656
+ "asc-key": await ascKeyCheck(owner.session, identity, deps),
268657
+ "purchases-app": snapshot4 ? checkPurchasesApp({ ...identity, name: identity.app }, snapshot4) : unavailable(),
268658
+ "iap-key": snapshot4 ? checkIapKey(identity, snapshot4) : unavailable(),
268659
+ "payment-provider": checkPaymentProvider()
268660
+ };
268661
+ io2.log(JSON.stringify({ ok: true, app: identity.app, site: identity.site, bundleId: identity.bundleId, steps }));
268662
+ return 0;
268663
+ }
268664
+ function identityFrom(flags, deps) {
268665
+ const input = (deps.inputs ?? inputsFromContent)(flags);
268666
+ const manifestPath = typeof flags["iap-manifest"] === "string" && flags["iap-manifest"] ? flags["iap-manifest"] : void 0;
268667
+ let manifest2;
268668
+ if (manifestPath) {
268669
+ try {
268670
+ manifest2 = (deps.manifestTarget ?? readManifestTarget)(manifestPath);
268671
+ } catch {
268672
+ return { refused: "iap_manifest_unreadable", hint: `Could not read the IAP manifest at ${manifestPath}.` };
268673
+ }
268674
+ }
268675
+ const bundleFlag = typeof flags["bundle-id"] === "string" && flags["bundle-id"] ? flags["bundle-id"] : void 0;
268676
+ const app2 = input.app ?? manifest2?.himiApp;
268677
+ const site = manifest2?.wixSiteId ?? input.site;
268678
+ const bundleId = manifest2?.bundleId ?? bundleFlag ?? input.bundleId;
268679
+ if (!app2 || !site || !bundleId) {
268680
+ return { refused: "iap_setup_identity_missing", hint: "Run it from the app's content folder (--content <dir>), or pass --app, --site and --bundle-id, or --iap-manifest <file>." };
268681
+ }
268682
+ return { app: app2, site, bundleId };
268683
+ }
268684
+ function readManifestTarget(path2) {
268685
+ return parseIapManifest(readFileSync173(path2, "utf8"), path2).target;
268686
+ }
268687
+ function ownedSlug(deps) {
268688
+ return async (session, app2) => {
268689
+ const verdict = await verifyAppOwnership({ ownerIssue: session.ownerIssue, controlToken: session.controlToken, declaredName: app2, ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {} });
268690
+ return verdict.state === "owned" ? verdict.slug : app2;
268691
+ };
268692
+ }
268693
+ function inputsFromContent(flags) {
268694
+ const dir = resolve117(typeof flags.content === "string" && flags.content ? flags.content : process.cwd());
268695
+ return mergePushInputs(pushInputsFromContent(dir), flags);
268696
+ }
268697
+ async function readSnapshot(site, deps) {
268698
+ const fetchImpl = deps.fetchImpl ?? fetch;
268699
+ const transport = (deps.purchases ?? ((id) => ownerTransport(id, (url, init) => fetchImpl(url, { ...init, redirect: "error" }), void 0, userSiteToken)))(site);
268700
+ try {
268701
+ return await readIapSetup(createPurchasesOwnerApi(transport));
268702
+ } catch {
268703
+ return null;
268704
+ }
268705
+ }
268706
+ async function ascKeyCheck(session, identity, deps) {
268707
+ const status2 = deps.ascStatus ?? ((s5, input) => ascKeyRequest(s5, input, deps.fetchImpl ?? fetch));
268708
+ try {
268709
+ const asc = await status2(session, { app: identity.app, site: identity.site });
268710
+ return asc.present ? { state: "ready", ...asc.keyId ? { detail: `key ${asc.keyId}` } : {} } : { state: "missing", code: "asc_key_missing", detail: "no App Store Connect key on the site" };
268711
+ } catch {
268712
+ return unavailable();
268713
+ }
268714
+ }
268715
+ function unavailable() {
268716
+ return { state: "unavailable", code: "read_failed" };
268717
+ }
268718
+ var init_check2 = __esm({
268719
+ "src/iap-setup/check.ts"() {
268720
+ init_define_HHP_CATALOG();
268721
+ init_iap_manifest();
268722
+ init_apple_keys();
268723
+ init_hosted_owner();
268724
+ init_owner_claim();
268725
+ init_push_onboarding();
268726
+ init_store_iap_purchases();
268727
+ init_wix_owner();
268728
+ init_iap_key();
268729
+ init_payment_provider();
268730
+ init_purchases_app();
268731
+ init_snapshot();
268422
268732
  }
268423
268733
  });
268424
268734
 
@@ -268921,16 +269231,16 @@ __export(runtime_copy_exports, {
268921
269231
  rowId: () => rowId
268922
269232
  });
268923
269233
  import { createHash as createHash93 } from "node:crypto";
268924
- import { existsSync as existsSync143, readFileSync as readFileSync173, writeFileSync as writeFileSync66 } from "node:fs";
269234
+ import { existsSync as existsSync143, readFileSync as readFileSync174, writeFileSync as writeFileSync66 } from "node:fs";
268925
269235
  import { readdirSync as readdirSync63 } from "node:fs";
268926
- import { dirname as dirname81, join as join184, relative as relative34, resolve as resolve117 } from "node:path";
269236
+ import { dirname as dirname81, join as join184, relative as relative34, resolve as resolve118 } from "node:path";
268927
269237
  import { fileURLToPath as fileURLToPath41 } from "node:url";
268928
269238
  function appSourceCatalogs() {
268929
269239
  const appsDir = join184(REPO_ROOT8, "apps");
268930
269240
  return readdirSync63(appsDir).sort().map((app2) => join184(appsDir, app2, "l10n", "en.json")).filter((p2) => existsSync143(p2));
268931
269241
  }
268932
269242
  function loadTable(path2 = TABLE_PATH) {
268933
- const raw = JSON.parse(readFileSync173(path2, "utf8"));
269243
+ const raw = JSON.parse(readFileSync174(path2, "utf8"));
268934
269244
  const out2 = {};
268935
269245
  for (const [k3, v2] of Object.entries(raw)) {
268936
269246
  if (k3.startsWith("_")) continue;
@@ -269013,7 +269323,7 @@ function expectedOutputs(table = loadTable()) {
269013
269323
  { path: TS_OUT, content: renderTs(table) }
269014
269324
  ];
269015
269325
  for (const p2 of appSourceCatalogs()) {
269016
- out2.push({ path: p2, content: JSON.stringify(injectRuntimeRows(JSON.parse(readFileSync173(p2, "utf8")), table), null, 2) + "\n" });
269326
+ out2.push({ path: p2, content: JSON.stringify(injectRuntimeRows(JSON.parse(readFileSync174(p2, "utf8")), table), null, 2) + "\n" });
269017
269327
  }
269018
269328
  return out2;
269019
269329
  }
@@ -269021,7 +269331,7 @@ var REPO_ROOT8, TABLE_PATH, SWIFT_OUT, KOTLIN_OUT, TS_OUT, HEADER3, RUNTIME_KIND
269021
269331
  var init_runtime_copy = __esm({
269022
269332
  "../l10n/runtime-copy.ts"() {
269023
269333
  init_define_HHP_CATALOG();
269024
- REPO_ROOT8 = resolve117(dirname81(fileURLToPath41(import.meta.url)), "../..");
269334
+ REPO_ROOT8 = resolve118(dirname81(fileURLToPath41(import.meta.url)), "../..");
269025
269335
  TABLE_PATH = join184(REPO_ROOT8, "core/runtime/l10n/runtime/en.json");
269026
269336
  SWIFT_OUT = join184(REPO_ROOT8, "core/runtime/ios/HimalayaCore/Sources/HimalayaCore/RuntimeCopyDefaults.generated.swift");
269027
269337
  KOTLIN_OUT = join184(REPO_ROOT8, "core/runtime/android/io/himalaya/core/src/main/kotlin/io/himalaya/core/RuntimeCopyDefaults.generated.kt");
@@ -269069,8 +269379,8 @@ __export(auth_gate_copy_exports, {
269069
269379
  scanThrownMessages: () => scanThrownMessages
269070
269380
  });
269071
269381
  import { createHash as createHash94 } from "node:crypto";
269072
- import { existsSync as existsSync144, readdirSync as readdirSync64, readFileSync as readFileSync174, writeFileSync as writeFileSync67 } from "node:fs";
269073
- import { dirname as dirname82, join as join185, relative as relative35, resolve as resolve118 } from "node:path";
269382
+ import { existsSync as existsSync144, readdirSync as readdirSync64, readFileSync as readFileSync175, writeFileSync as writeFileSync67 } from "node:fs";
269383
+ import { dirname as dirname82, join as join185, relative as relative35, resolve as resolve119 } from "node:path";
269074
269384
  import { fileURLToPath as fileURLToPath42 } from "node:url";
269075
269385
  function discoverMessageSources() {
269076
269386
  const roots2 = [
@@ -269090,7 +269400,7 @@ function discoverMessageSources() {
269090
269400
  if (/^(?:test|tests|Tests|androidTest|build|node_modules|\.build)$/.test(name.name)) continue;
269091
269401
  visit(child3);
269092
269402
  } else if (/\.(?:swift|kt)$/.test(name.name) && !GATE_SOURCES.includes(child3)) {
269093
- if (MESSAGE_FILE.test(readFileSync174(join185(REPO_ROOT9, child3), "utf8"))) out2.push(child3);
269403
+ if (MESSAGE_FILE.test(readFileSync175(join185(REPO_ROOT9, child3), "utf8"))) out2.push(child3);
269094
269404
  }
269095
269405
  }
269096
269406
  };
@@ -269098,7 +269408,7 @@ function discoverMessageSources() {
269098
269408
  return out2.sort();
269099
269409
  }
269100
269410
  function loadTable2(path2 = TABLE_PATH2) {
269101
- const raw = JSON.parse(readFileSync174(path2, "utf8"));
269411
+ const raw = JSON.parse(readFileSync175(path2, "utf8"));
269102
269412
  const out2 = {};
269103
269413
  for (const [k3, v2] of Object.entries(raw)) {
269104
269414
  if (k3.startsWith("_")) continue;
@@ -269172,7 +269482,7 @@ function nativeKeysPath(appDir3) {
269172
269482
  function loadNativeKeys(appDir3) {
269173
269483
  const p2 = nativeKeysPath(appDir3);
269174
269484
  if (!existsSync144(p2)) return void 0;
269175
- const raw = JSON.parse(readFileSync174(p2, "utf8"));
269485
+ const raw = JSON.parse(readFileSync175(p2, "utf8"));
269176
269486
  if (!Array.isArray(raw.keys) || raw.keys.some((k3) => typeof k3 !== "string")) {
269177
269487
  throw new Error(`${p2}: expected { "keys": string[] }`);
269178
269488
  }
@@ -269181,7 +269491,7 @@ function loadNativeKeys(appDir3) {
269181
269491
  function loadAppTable(appDir3) {
269182
269492
  const p2 = join185(appDir3, "strings", "en.json");
269183
269493
  if (!existsSync144(p2)) return {};
269184
- const raw = JSON.parse(readFileSync174(p2, "utf8"));
269494
+ const raw = JSON.parse(readFileSync175(p2, "utf8"));
269185
269495
  const out2 = {};
269186
269496
  for (const [k3, v2] of Object.entries(raw)) if (!k3.startsWith("_") && typeof v2 === "string") out2[k3] = v2;
269187
269497
  return out2;
@@ -269239,14 +269549,14 @@ function innermostCallee(before) {
269239
269549
  return m2?.[1].replace(/\s+/g, "");
269240
269550
  }
269241
269551
  function loadAllow(section3, path2 = ALLOW_PATH) {
269242
- const raw = JSON.parse(readFileSync174(path2, "utf8"));
269552
+ const raw = JSON.parse(readFileSync175(path2, "utf8"));
269243
269553
  const list5 = raw[section3] ?? [];
269244
269554
  for (const e2 of list5) {
269245
269555
  if (!e2.file || !e2.text || !e2.reason) throw new Error(`allowlist entry missing file/text/reason: ${JSON.stringify(e2)}`);
269246
269556
  }
269247
269557
  return list5;
269248
269558
  }
269249
- function scanProse(files, allow = [], read2 = (rel2) => readFileSync174(join185(REPO_ROOT9, rel2), "utf8")) {
269559
+ function scanProse(files, allow = [], read2 = (rel2) => readFileSync175(join185(REPO_ROOT9, rel2), "utf8")) {
269250
269560
  const hits = [];
269251
269561
  const usedAllow = /* @__PURE__ */ new Set();
269252
269562
  for (const file2 of files) {
@@ -269275,12 +269585,12 @@ function expectedOutputs2(table = loadTable2()) {
269275
269585
  { path: KOTLIN_OUT2, content: renderKotlin2(table) }
269276
269586
  ];
269277
269587
  for (const p2 of appSourceCatalogs2()) {
269278
- const committed = JSON.parse(readFileSync174(p2, "utf8"));
269588
+ const committed = JSON.parse(readFileSync175(p2, "utf8"));
269279
269589
  out2.push({ path: p2, content: serializeCatalog(injectAllNativeRows(committed, dirname82(dirname82(p2)), table)) });
269280
269590
  }
269281
269591
  return out2;
269282
269592
  }
269283
- function scanThrownMessages(files, read2 = (rel2) => readFileSync174(join185(REPO_ROOT9, rel2), "utf8")) {
269593
+ function scanThrownMessages(files, read2 = (rel2) => readFileSync175(join185(REPO_ROOT9, rel2), "utf8")) {
269284
269594
  const out2 = [];
269285
269595
  for (const file2 of files) {
269286
269596
  const src = read2(file2);
@@ -269304,7 +269614,7 @@ var init_auth_gate_copy = __esm({
269304
269614
  init_governs();
269305
269615
  init_runtime_copy();
269306
269616
  HERE5 = dirname82(fileURLToPath42(import.meta.url));
269307
- REPO_ROOT9 = resolve118(HERE5, "../..");
269617
+ REPO_ROOT9 = resolve119(HERE5, "../..");
269308
269618
  TABLE_PATH2 = join185(REPO_ROOT9, "core/runtime/l10n/auth-gate/en.json");
269309
269619
  SWIFT_OUT2 = join185(
269310
269620
  REPO_ROOT9,
@@ -269347,7 +269657,7 @@ var init_auth_gate_copy = __esm({
269347
269657
  });
269348
269658
 
269349
269659
  // ../l10n/extract.ts
269350
- import { resolve as resolve119, join as join186, relative as relative36, dirname as dirname83 } from "node:path";
269660
+ import { resolve as resolve120, join as join186, relative as relative36, dirname as dirname83 } from "node:path";
269351
269661
  import { createHash as createHash95 } from "node:crypto";
269352
269662
  import { fileURLToPath as fileURLToPath43 } from "node:url";
269353
269663
  function keyOf3(source2) {
@@ -269361,7 +269671,7 @@ var init_extract = __esm({
269361
269671
  init_bindings();
269362
269672
  init_auth_gate_copy();
269363
269673
  init_runtime_copy();
269364
- ROOT8 = resolve119(fileURLToPath43(new URL("../..", import.meta.url)));
269674
+ ROOT8 = resolve120(fileURLToPath43(new URL("../..", import.meta.url)));
269365
269675
  if (false) {
269366
269676
  void main();
269367
269677
  }
@@ -269733,8 +270043,8 @@ __export(base44_adopt_exports, {
269733
270043
  renderAdoptModule: () => renderAdoptModule,
269734
270044
  runBase44Adopt: () => runBase44Adopt
269735
270045
  });
269736
- import { existsSync as existsSync146, readFileSync as readFileSync176, writeFileSync as writeFileSync69 } from "node:fs";
269737
- import { join as join188, resolve as resolve121 } from "node:path";
270046
+ import { existsSync as existsSync146, readFileSync as readFileSync177, writeFileSync as writeFileSync69 } from "node:fs";
270047
+ import { join as join188, resolve as resolve122 } from "node:path";
269738
270048
  function prop(entity, key4) {
269739
270049
  const props2 = entity.schema?.properties;
269740
270050
  const p2 = props2 && typeof props2 === "object" ? props2[key4] : void 0;
@@ -269824,11 +270134,11 @@ function renderAdoptModule(r3, source2 = ".himi/base44-book/book.json") {
269824
270134
  ].join("\n");
269825
270135
  }
269826
270136
  function runBase44Adopt(opts) {
269827
- const bookDir = resolve121(opts.cwd, opts.book ?? ".himi/base44-book");
270137
+ const bookDir = resolve122(opts.cwd, opts.book ?? ".himi/base44-book");
269828
270138
  const bookPath = join188(bookDir, "book.json");
269829
270139
  let book;
269830
270140
  try {
269831
- book = JSON.parse(readFileSync176(bookPath, "utf8"));
270141
+ book = JSON.parse(readFileSync177(bookPath, "utf8"));
269832
270142
  if (!book || typeof book !== "object" || !Array.isArray(book.entities)) throw new Error("not a Base44 app book (no entities[])");
269833
270143
  } catch (e2) {
269834
270144
  throw new AdoptError("book_unreadable", `could not read ${bookPath}: ${e2.message}. Run \`himi base44 analyze --app-id <id>\` first.`);
@@ -269841,7 +270151,7 @@ function runBase44Adopt(opts) {
269841
270151
  const module = renderAdoptModule(result, opts.book ? join188(opts.book, "book.json") : void 0);
269842
270152
  const issues = validateBase44Entities({ entities: result.entities, functions: result.functions }, opts.app);
269843
270153
  if (opts.write === void 0 || opts.write === false || issues.some((i2) => i2.severity === "error")) return { result, module, issues };
269844
- const target = typeof opts.write === "string" ? resolve121(opts.cwd, opts.write) : join188(opts.cwd, ADOPT_MODULE_FILENAME);
270154
+ const target = typeof opts.write === "string" ? resolve122(opts.cwd, opts.write) : join188(opts.cwd, ADOPT_MODULE_FILENAME);
269845
270155
  if (existsSync146(target)) {
269846
270156
  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 });
269847
270157
  }
@@ -270093,7 +270403,7 @@ __export(generate_exports, {
270093
270403
  writeGenerated: () => writeGenerated2
270094
270404
  });
270095
270405
  import { createHash as createHash96 } from "node:crypto";
270096
- import { existsSync as existsSync147, mkdirSync as mkdirSync63, readdirSync as readdirSync66, readFileSync as readFileSync177, writeFileSync as writeFileSync70 } from "node:fs";
270406
+ import { existsSync as existsSync147, mkdirSync as mkdirSync63, readdirSync as readdirSync66, readFileSync as readFileSync178, writeFileSync as writeFileSync70 } from "node:fs";
270097
270407
  import { dirname as dirname85, join as join189 } from "node:path";
270098
270408
  function withHeader(body) {
270099
270409
  return `${GENERATED_HEADER}${sha2568(body)}
@@ -270222,7 +270532,7 @@ function writeGenerated2(dir, files, opts = {}) {
270222
270532
  let outcome;
270223
270533
  if (!existsSync147(abs)) outcome = "written";
270224
270534
  else {
270225
- const cur = readFileSync177(abs, "utf8");
270535
+ const cur = readFileSync178(abs, "utf8");
270226
270536
  if (cur === next) outcome = "unchanged";
270227
270537
  else if (isEdited(cur) && !opts.force) outcome = "skipped-edited";
270228
270538
  else outcome = "written";
@@ -270247,7 +270557,7 @@ function orphanedFiles(dir, current) {
270247
270557
  }
270248
270558
  for (const rel2 of candidates.sort()) {
270249
270559
  if (keep.has(rel2) || !existsSync147(join189(dir, rel2))) continue;
270250
- if (readFileSync177(join189(dir, rel2), "utf8").startsWith(GENERATED_HEADER)) found.push(rel2);
270560
+ if (readFileSync178(join189(dir, rel2), "utf8").startsWith(GENERATED_HEADER)) found.push(rel2);
270251
270561
  }
270252
270562
  return found;
270253
270563
  }
@@ -270286,7 +270596,7 @@ __export(base44_auth_exports, {
270286
270596
  usableBase44Auth: () => usableBase44Auth,
270287
270597
  writeBase44Session: () => writeBase44Session
270288
270598
  });
270289
- import { chmodSync as chmodSync7, existsSync as existsSync148, mkdirSync as mkdirSync64, readFileSync as readFileSync178, rmSync as rmSync44, writeFileSync as writeFileSync71 } from "node:fs";
270599
+ import { chmodSync as chmodSync7, existsSync as existsSync148, mkdirSync as mkdirSync64, readFileSync as readFileSync179, rmSync as rmSync44, writeFileSync as writeFileSync71 } from "node:fs";
270290
270600
  import { homedir as homedir22 } from "node:os";
270291
270601
  import { dirname as dirname86, join as join190 } from "node:path";
270292
270602
  function base44ApiBase(env = process.env) {
@@ -270299,7 +270609,7 @@ function readBase44Session(home2) {
270299
270609
  const p2 = base44SessionPath(home2);
270300
270610
  if (!existsSync148(p2)) return void 0;
270301
270611
  try {
270302
- const s5 = JSON.parse(readFileSync178(p2, "utf8"));
270612
+ const s5 = JSON.parse(readFileSync179(p2, "utf8"));
270303
270613
  return typeof s5.accessToken === "string" && s5.accessToken ? s5 : void 0;
270304
270614
  } catch {
270305
270615
  return void 0;
@@ -270419,7 +270729,7 @@ function hasBase44WriteScope(auth) {
270419
270729
  function importBase44CliSession(home2 = homedir22(), env = process.env) {
270420
270730
  const src = join190(home2, ".base44", "auth", "auth.json");
270421
270731
  if (!existsSync148(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
270422
- const a3 = JSON.parse(readFileSync178(src, "utf8"));
270732
+ const a3 = JSON.parse(readFileSync179(src, "utf8"));
270423
270733
  if (typeof a3.accessToken !== "string" || !a3.accessToken) throw new Error(`${src} holds no access token`);
270424
270734
  const session = {
270425
270735
  accessToken: a3.accessToken,
@@ -270518,14 +270828,14 @@ __export(seed_exports, {
270518
270828
  seedBase44Entities: () => seedBase44Entities,
270519
270829
  writeBase44SeedRows: () => writeBase44SeedRows
270520
270830
  });
270521
- import { existsSync as existsSync149, readFileSync as readFileSync179, writeFileSync as writeFileSync72 } from "node:fs";
270831
+ import { existsSync as existsSync149, readFileSync as readFileSync180, writeFileSync as writeFileSync72 } from "node:fs";
270522
270832
  import { join as join191 } from "node:path";
270523
270833
  function readBase44SeedFile(dir) {
270524
270834
  const file2 = join191(dir, BASE44_SEED_FILE);
270525
270835
  if (!existsSync149(file2)) return {};
270526
270836
  let parsed;
270527
270837
  try {
270528
- parsed = JSON.parse(readFileSync179(file2, "utf8"));
270838
+ parsed = JSON.parse(readFileSync180(file2, "utf8"));
270529
270839
  } catch (e2) {
270530
270840
  throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Fix or delete it.`);
270531
270841
  }
@@ -270685,7 +270995,7 @@ function writeBase44SeedRows(opts) {
270685
270995
  if (existsSync149(path2)) {
270686
270996
  let parsed;
270687
270997
  try {
270688
- parsed = JSON.parse(readFileSync179(path2, "utf8"));
270998
+ parsed = JSON.parse(readFileSync180(path2, "utf8"));
270689
270999
  } catch (e2) {
270690
271000
  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.`);
270691
271001
  }
@@ -271372,7 +271682,7 @@ async function readEntitySnapshot(appId3, deps) {
271372
271682
  }
271373
271683
  }
271374
271684
  var JSON_FILE2;
271375
- var init_snapshot = __esm({
271685
+ var init_snapshot2 = __esm({
271376
271686
  "src/base44-provision/snapshot.ts"() {
271377
271687
  init_define_HHP_CATALOG();
271378
271688
  init_app_source();
@@ -271389,7 +271699,7 @@ __export(apply_exports2, {
271389
271699
  createBase44Entities: () => createBase44Entities,
271390
271700
  fileLedger: () => fileLedger
271391
271701
  });
271392
- import { existsSync as existsSync151, readFileSync as readFileSync180, writeFileSync as writeFileSync73 } from "node:fs";
271702
+ import { existsSync as existsSync151, readFileSync as readFileSync181, writeFileSync as writeFileSync73 } from "node:fs";
271393
271703
  import { join as join193 } from "node:path";
271394
271704
  function fileLedger(dir, appId3) {
271395
271705
  const path2 = join193(dir, LEDGER_FILE2);
@@ -271397,7 +271707,7 @@ function fileLedger(dir, appId3) {
271397
271707
  if (!existsSync151(path2)) return {};
271398
271708
  let v2;
271399
271709
  try {
271400
- v2 = JSON.parse(readFileSync180(path2, "utf8"));
271710
+ v2 = JSON.parse(readFileSync181(path2, "utf8"));
271401
271711
  } catch (e2) {
271402
271712
  throw new LedgerError(`${LEDGER_FILE2} is not valid JSON (${e2.message}) \u2014 fix it (a merge conflict?) rather than let himi rewrite it`);
271403
271713
  }
@@ -271500,7 +271810,7 @@ var init_apply3 = __esm({
271500
271810
  init_base44_schema();
271501
271811
  init_http3();
271502
271812
  init_plan6();
271503
- init_snapshot();
271813
+ init_snapshot2();
271504
271814
  LEDGER_FILE2 = "base44-provisioned.json";
271505
271815
  LedgerError = class extends Error {
271506
271816
  };
@@ -271946,7 +272256,7 @@ var init_visitor = __esm({
271946
272256
 
271947
272257
  // src/base44-analyze/types.ts
271948
272258
  var BASE44_BOOK_SCHEMA_VERSION, DEFAULT_SAMPLE_ROWS;
271949
- var init_types3 = __esm({
272259
+ var init_types4 = __esm({
271950
272260
  "src/base44-analyze/types.ts"() {
271951
272261
  init_define_HHP_CATALOG();
271952
272262
  BASE44_BOOK_SCHEMA_VERSION = 1;
@@ -272041,7 +272351,7 @@ var init_analyze = __esm({
272041
272351
  init_owner();
272042
272352
  init_redact();
272043
272353
  init_visitor();
272044
- init_types3();
272354
+ init_types4();
272045
272355
  Base44InputError = class extends Error {
272046
272356
  exit = 2;
272047
272357
  };
@@ -272049,11 +272359,11 @@ var init_analyze = __esm({
272049
272359
  });
272050
272360
 
272051
272361
  // src/base44-analyze/write-artifacts.ts
272052
- import { existsSync as existsSync152, mkdirSync as mkdirSync65, readFileSync as readFileSync181, rmSync as rmSync45, writeFileSync as writeFileSync74 } from "node:fs";
272053
- import { dirname as dirname87, join as join194, resolve as resolve122, sep as sep34 } from "node:path";
272362
+ import { existsSync as existsSync152, mkdirSync as mkdirSync65, readFileSync as readFileSync182, rmSync as rmSync45, writeFileSync as writeFileSync74 } from "node:fs";
272363
+ import { dirname as dirname87, join as join194, resolve as resolve123, sep as sep34 } from "node:path";
272054
272364
  function isBookFolder(dir) {
272055
272365
  try {
272056
- return JSON.parse(readFileSync181(join194(dir, "book.json"), "utf8")).kind === "base44-app-book";
272366
+ return JSON.parse(readFileSync182(join194(dir, "book.json"), "utf8")).kind === "base44-app-book";
272057
272367
  } catch {
272058
272368
  return false;
272059
272369
  }
@@ -272127,7 +272437,7 @@ function renderBookMd(book) {
272127
272437
  return L2.join("\n");
272128
272438
  }
272129
272439
  function writeBase44Book(result, outDir, opts = {}) {
272130
- const out2 = resolve122(outDir);
272440
+ const out2 = resolve123(outDir);
272131
272441
  const book = result.book;
272132
272442
  const files = [];
272133
272443
  const shots = (opts.screenshots ?? []).filter((s5) => safeRel(s5.filename) && !s5.filename.includes("/"));
@@ -273032,10 +273342,10 @@ function permuteDomain(domain, allowSpecialUseDomain) {
273032
273342
  }
273033
273343
  function createPromiseCallback(cb) {
273034
273344
  let callback;
273035
- let resolve134;
273345
+ let resolve135;
273036
273346
  let reject;
273037
273347
  const promise = new Promise((_resolve, _reject) => {
273038
- resolve134 = _resolve;
273348
+ resolve135 = _resolve;
273039
273349
  reject = _reject;
273040
273350
  });
273041
273351
  if (typeof cb === "function") {
@@ -273051,7 +273361,7 @@ function createPromiseCallback(cb) {
273051
273361
  callback = (err, result) => {
273052
273362
  try {
273053
273363
  if (err) reject(err);
273054
- else resolve134(result);
273364
+ else resolve135(result);
273055
273365
  } catch (e2) {
273056
273366
  reject(e2 instanceof Error ? e2 : new Error());
273057
273367
  }
@@ -275708,7 +276018,7 @@ __export(cli_exports, {
275708
276018
  import { execFile as execFile7 } from "node:child_process";
275709
276019
  import { mkdirSync as mkdirSync66, mkdtempSync as mkdtempSync14, rmSync as rmSync46, writeFileSync as writeFileSync75 } from "node:fs";
275710
276020
  import { tmpdir as tmpdir15 } from "node:os";
275711
- import { join as join195, resolve as resolve123 } from "node:path";
276021
+ import { join as join195, resolve as resolve124 } from "node:path";
275712
276022
  import { promisify as promisify2 } from "node:util";
275713
276023
  function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
275714
276024
  return async (appId3) => {
@@ -275763,7 +276073,7 @@ async function runBase44Analyze(opts) {
275763
276073
  now: opts.now ?? (() => /* @__PURE__ */ new Date())
275764
276074
  };
275765
276075
  const result = await analyzeBase44({ url: opts.url, appId: opts.appId, sample: opts.sample }, ports);
275766
- const written = writeBase44Book(result, resolve123(opts.cwd ?? process.cwd(), opts.outDir ?? ".himi/base44-book"), { screenshots });
276076
+ const written = writeBase44Book(result, resolve124(opts.cwd ?? process.cwd(), opts.outDir ?? ".himi/base44-book"), { screenshots });
275767
276077
  return { ok: true, out: written.outDir, files: written.files, mode: result.book.mode, gaps: result.book.gaps, book: result.book };
275768
276078
  }
275769
276079
  var MAX_TARBALL_BYTES, systemTar;
@@ -277095,8 +277405,8 @@ var init_invite_plan = __esm({
277095
277405
  });
277096
277406
 
277097
277407
  // src/one-app/header-badges-cli.ts
277098
- import { existsSync as existsSync154, lstatSync as lstatSync42, readFileSync as readFileSync182, rmSync as rmSync47, statSync as statSync52, writeFileSync as writeFileSync76 } from "node:fs";
277099
- import { join as join197, resolve as resolve125 } from "node:path";
277408
+ import { existsSync as existsSync154, lstatSync as lstatSync42, readFileSync as readFileSync183, rmSync as rmSync47, statSync as statSync52, writeFileSync as writeFileSync76 } from "node:fs";
277409
+ import { join as join197, resolve as resolve126 } from "node:path";
277100
277410
  function guestSignInParams(contentDir2) {
277101
277411
  const profile = screenLoadParams(contentDir2, PROFILE_AVATAR_ITEM.onTap.params.screenId) ?? {};
277102
277412
  const text32 = (key4) => typeof profile[key4] === "string" ? profile[key4] : "";
@@ -277108,12 +277418,17 @@ function parseArgs5(args) {
277108
277418
  let evidenceDir;
277109
277419
  let contentDir2;
277110
277420
  let dryRun = false;
277421
+ let notNewApp = false;
277111
277422
  for (let i2 = 0; i2 < args.length; i2++) {
277112
277423
  const arg2 = args[i2];
277113
277424
  if (arg2 === "--dry-run") {
277114
277425
  dryRun = true;
277115
277426
  continue;
277116
277427
  }
277428
+ if (arg2 === "--not-new-app") {
277429
+ notNewApp = true;
277430
+ continue;
277431
+ }
277117
277432
  if (arg2 !== "--evidence-dir" && arg2 !== "--content") throw new Error(`Unknown option: ${arg2}`);
277118
277433
  const value2 = args[++i2];
277119
277434
  if (!value2 || value2.startsWith("--")) throw new Error(`${arg2} requires a directory path.`);
@@ -277126,12 +277441,12 @@ function parseArgs5(args) {
277126
277441
  }
277127
277442
  }
277128
277443
  if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
277129
- return { evidenceDir: resolve125(evidenceDir), contentDir: resolve125(contentDir2), dryRun };
277444
+ return { evidenceDir: resolve126(evidenceDir), contentDir: resolve126(contentDir2), dryRun, notNewApp };
277130
277445
  }
277131
277446
  function contentScreens(contentDir2) {
277132
277447
  const path2 = join197(contentDir2, "himalaya.content.json");
277133
277448
  if (!existsSync154(path2)) throw new Error("himalaya.content.json not found: --content must be a Himi content package");
277134
- const parsed = JSON.parse(readFileSync182(path2, "utf8"));
277449
+ const parsed = JSON.parse(readFileSync183(path2, "utf8"));
277135
277450
  return new Set(Object.keys(parsed.screens ?? {}));
277136
277451
  }
277137
277452
  function mapCoverage2(evidenceDir, contentDir2, plan, bound2, dryRun) {
@@ -277160,7 +277475,7 @@ function mapCoverage2(evidenceDir, contentDir2, plan, bound2, dryRun) {
277160
277475
  mapped++;
277161
277476
  } else conflicts.push(`${source2.buttonId ?? source2.source}: already mapped to ${row2.target.screenId}/${row2.target.controlId ?? "?"}, not ${target.screenId}/${target.controlId}`);
277162
277477
  }
277163
- if (mapped && !dryRun) writeFileSync76(join197(resolve125(contentDir2), COVERAGE_FILE), JSON.stringify(coverage2, null, 2) + "\n");
277478
+ if (mapped && !dryRun) writeFileSync76(join197(resolve126(contentDir2), COVERAGE_FILE), JSON.stringify(coverage2, null, 2) + "\n");
277164
277479
  return { mapped, kept, conflicts };
277165
277480
  }
277166
277481
  function report6(io2, ok5, body) {
@@ -277194,13 +277509,18 @@ async function runOneAppHeaderBadges(args, io2) {
277194
277509
  let configLinked = false;
277195
277510
  try {
277196
277511
  configLinked = lstatSync42(configPath).isSymbolicLink();
277197
- if (!configLinked && statSync52(configPath).isFile()) configText = readFileSync182(configPath, "utf8");
277512
+ if (!configLinked && statSync52(configPath).isFile()) configText = readFileSync183(configPath, "utf8");
277198
277513
  } catch {
277199
277514
  }
277200
- const newApp = declaresNewApp(configText);
277515
+ const declaration2 = options2.notNewApp || !configText ? void 0 : declareNewApp(configText);
277516
+ const declaredNow = declaration2?.status === "written";
277517
+ if (declaredNow) configText = declaration2.text;
277518
+ const newApp = !options2.notNewApp && declaresNewApp(configText);
277519
+ const notNewReason = options2.notNewApp ? "--not-new-app was passed" : declaration2?.status === "manual" ? declaration2.reason : "config.ts declares `app.newApp` as not true";
277520
+ const nextStep2 = declaration2?.status === "manual" ? "Make `app` a plain object literal with `newApp: true` in it, and remove any spread, shorthand or computed key written after it that could set `app`; then run this command again." : "If it is new, set `app: { newApp: true }` in config.ts (or drop `--not-new-app`) and run this command again.";
277201
277521
  const avatar = {
277202
277522
  avatar: newApp ? hasProfileAvatar(configText) ? "present" : "not_written" : "skipped_not_new_app",
277203
- ...newApp ? {} : { avatarNote: "No profile avatar was written: the app is not declared new. If it is new, add `app: { newApp: true }` to config.ts (`himi one-app access --new-app` writes it) and run this command again." }
277523
+ ...newApp ? {} : { avatarNote: `No profile avatar was written: the app is not treated as new (${notNewReason}). ${nextStep2}` }
277204
277524
  };
277205
277525
  const common2 = { sources: plan.sources, unmapped: plan.unmapped, warnings: plan.warnings, ...unverified.length ? { unverifiedPlatforms: unverified } : {}, ...avatar };
277206
277526
  if (!plan.counters.length && !newApp) {
@@ -277240,7 +277560,7 @@ async function runOneAppHeaderBadges(args, io2) {
277240
277560
  error: `tier5-src/${worker}/index.ts is missing: this app was scaffolded before that worker shipped. Re-scaffold from the current branded-lite template, or copy that worker and the _shared files it imports.`
277241
277561
  });
277242
277562
  }
277243
- if (newApp && !(servesMemberAvatar(readFileSync182(workerSource, "utf8")) && existsSync154(join197(options2.contentDir, AVATAR_HELPER)))) {
277563
+ if (newApp && !(servesMemberAvatar(readFileSync183(workerSource, "utf8")) && existsSync154(join197(options2.contentDir, AVATAR_HELPER)))) {
277244
277564
  return report6(io2, false, {
277245
277565
  code: "worker_missing",
277246
277566
  headerBadges: bindable,
@@ -277250,6 +277570,10 @@ async function runOneAppHeaderBadges(args, io2) {
277250
277570
  });
277251
277571
  }
277252
277572
  const patch = patchConfig(configText, bindable, { avatar: newApp });
277573
+ if (declaredNow && patch.status === "unchanged") {
277574
+ patch.status = "written";
277575
+ patch.text = configText;
277576
+ }
277253
277577
  if (patch.status === "manual") {
277254
277578
  return report6(io2, false, {
277255
277579
  code: "config_needs_manual_merge",
@@ -277277,11 +277601,11 @@ async function runOneAppHeaderBadges(args, io2) {
277277
277601
  return report6(io2, false, { code: "content_invalid", headerBadges: bindable, skipped, ...common2, error: `The Profile screen could not be edited: ${error instanceof Error ? error.message : String(error)}` });
277278
277602
  }
277279
277603
  }
277280
- const ledgerPath = join197(resolve125(options2.contentDir), COVERAGE_FILE);
277604
+ const ledgerPath = join197(resolve126(options2.contentDir), COVERAGE_FILE);
277281
277605
  let ledgerBefore = null;
277282
277606
  let coverage2;
277283
277607
  try {
277284
- ledgerBefore = existsSync154(ledgerPath) ? readFileSync182(ledgerPath) : null;
277608
+ ledgerBefore = existsSync154(ledgerPath) ? readFileSync183(ledgerPath) : null;
277285
277609
  coverage2 = bindable.length ? mapCoverage2(options2.evidenceDir, options2.contentDir, plan, bindable, options2.dryRun) : void 0;
277286
277610
  } catch (error) {
277287
277611
  return report6(io2, false, { code: "evidence_invalid", error: error instanceof Error ? error.message : String(error), headerBadges: bindable });
@@ -277335,6 +277659,7 @@ async function runOneAppHeaderBadges(args, io2) {
277335
277659
  ...common2.avatar === "not_written" ? { avatar: written ?? "present" } : {},
277336
277660
  // The trailing actions that opened Account, dropped from navigation.topBarDefault.actions because the avatar is the profile entry now.
277337
277661
  // A screen's own bar (dev/index.ts) is not edited: `validate-topbar` names each one left there.
277662
+ ...declaredNow ? { newApp: options2.dryRun ? "would_declare" : "declared" } : {},
277338
277663
  ...newApp ? { removedProfileActions: patch.removedProfileActions ?? [] } : {},
277339
277664
  next: "Map each source screen to its Himi screen (the `route` rows of ONE-APP-COVERAGE.json), then run `himi one-app validate-topbar` against the same evidence and content."
277340
277665
  });
@@ -277348,17 +277673,18 @@ var init_header_badges_cli = __esm({
277348
277673
  init_storefront();
277349
277674
  init_provision();
277350
277675
  init_template_adopt();
277676
+ init_access();
277351
277677
  init_header_badges();
277352
277678
  PROFILE_PAGES_PARAMS = { showPages: "1", signInOnAppear: "1" };
277353
277679
  VISITOR_ONLY_PROFILE_PARAMS = { showPages: "1" };
277354
277680
  GUEST_SIGN_IN_SCREENS = [HEADER_BADGE_SPEC.notifications.screenId, INBOX_SCREEN];
277355
277681
  AVATAR_HELPER = "tier5-src/_shared/nav-member-avatar.ts";
277356
- HEADER_BADGES_USAGE = "himi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]";
277682
+ HEADER_BADGES_USAGE = "himi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--not-new-app] [--dry-run]";
277357
277683
  }
277358
277684
  });
277359
277685
 
277360
277686
  // src/one-app/recipes.ts
277361
- import { existsSync as existsSync155, readFileSync as readFileSync183 } from "node:fs";
277687
+ import { existsSync as existsSync155, readFileSync as readFileSync184 } from "node:fs";
277362
277688
  import { join as join198 } from "node:path";
277363
277689
  function readRecipe(contentDir2, name, values) {
277364
277690
  return readParts(contentDir2, name, values, "node");
@@ -277374,7 +277700,7 @@ function readParts(contentDir2, name, values, key4) {
277374
277700
  }
277375
277701
  let file2;
277376
277702
  try {
277377
- file2 = JSON.parse(readFileSync183(path2, "utf8"));
277703
+ file2 = JSON.parse(readFileSync184(path2, "utf8"));
277378
277704
  } catch {
277379
277705
  throw new RecipeError(`recipes/${name}.json is not valid JSON`);
277380
277706
  }
@@ -278167,14 +278493,14 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
278167
278493
  const screenOf = new Map(out2.routes.filter((r3) => r3.screenId).map((r3) => [r3.layoutItemId, r3.screenId]));
278168
278494
  const taken2 = /* @__PURE__ */ new Set();
278169
278495
  const tabOfScreen = new Map((hasTabBar ? out2.tabs : []).map((tab) => [tab.screenId, tabIdFor(tab, taken2)]));
278170
- const resolve134 = (value2) => {
278496
+ const resolve135 = (value2) => {
278171
278497
  const [named3, fallback, siblingType] = value2.slice(ROUTE_PLACEHOLDER.length).split("|");
278172
278498
  const source2 = named3 && !screenOf.has(named3) && !pageOfScreen.has(named3) ? slugs.get(named3) ?? named3 : named3;
278173
278499
  const page = source2 && !fellBack.has(`${source2}|${siblingType}`) ? screenOf.get(source2) ?? screenOf.get(pageOfScreen.get(source2) ?? "") : void 0;
278174
278500
  return page || fallback || "";
278175
278501
  };
278176
278502
  const retarget = (tap) => {
278177
- const target = resolve134(str16(obj15(tap.params).screenId));
278503
+ const target = resolve135(str16(obj15(tap.params).screenId));
278178
278504
  const tab = tabOfScreen.get(target);
278179
278505
  const carries = Object.keys(obj15(tap.params)).some((key4) => key4 !== "screenId");
278180
278506
  return tab && !carries ? { actionId: "himi.tab", params: { tab } } : { ...tap, params: { ...obj15(tap.params), screenId: target } };
@@ -278183,12 +278509,12 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
278183
278509
  const isDeadButton = (v2) => {
278184
278510
  const body = obj15(obj15(v2).body);
278185
278511
  const action = obj15(body.props).action;
278186
- return body.type === "Button" && isPlaceholderTap(action) && !resolve134(str16(obj15(obj15(action).params).screenId));
278512
+ return body.type === "Button" && isPlaceholderTap(action) && !resolve135(str16(obj15(obj15(action).params).screenId));
278187
278513
  };
278188
278514
  const DEAD = Symbol("dead");
278189
278515
  let stats = { forum: 0, other: 0 };
278190
278516
  const walk5 = (value2, dropped) => {
278191
- if (typeof value2 === "string" && value2.startsWith(ROUTE_PLACEHOLDER)) return resolve134(value2);
278517
+ if (typeof value2 === "string" && value2.startsWith(ROUTE_PLACEHOLDER)) return resolve135(value2);
278192
278518
  if (Array.isArray(value2)) return value2.map((v2) => walk5(v2, dropped)).filter((v2) => v2 !== DEAD);
278193
278519
  if (value2 && typeof value2 === "object") {
278194
278520
  if (isDeadButton(value2)) {
@@ -278199,7 +278525,7 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
278199
278525
  else stats.other++;
278200
278526
  return DEAD;
278201
278527
  }
278202
- const next = Object.fromEntries(Object.entries(value2).filter(([, v2]) => !(isPlaceholderTap(v2) && !resolve134(str16(obj15(obj15(v2).params).screenId)))).map(([k3, v2]) => [k3, isPlaceholderTap(v2) ? retarget(v2) : walk5(v2, dropped)]));
278528
+ const next = Object.fromEntries(Object.entries(value2).filter(([, v2]) => !(isPlaceholderTap(v2) && !resolve135(str16(obj15(obj15(v2).params).screenId)))).map(([k3, v2]) => [k3, isPlaceholderTap(v2) ? retarget(v2) : walk5(v2, dropped)]));
278203
278529
  const type2 = obj15(obj15(value2).body).type;
278204
278530
  const before = obj15(obj15(obj15(value2).body).props).children, after = obj15(obj15(next.body).props).children;
278205
278531
  if ((type2 === "VStack" || type2 === "HStack") && Array.isArray(before) && before.length && Array.isArray(after) && !after.length) return DEAD;
@@ -279293,7 +279619,7 @@ var init_generate2 = __esm({
279293
279619
  });
279294
279620
 
279295
279621
  // src/one-app/apply-navigation.ts
279296
- import { existsSync as existsSync156, readFileSync as readFileSync184 } from "node:fs";
279622
+ import { existsSync as existsSync156, readFileSync as readFileSync185 } from "node:fs";
279297
279623
  import { join as join199 } from "node:path";
279298
279624
  import ts29 from "typescript";
279299
279625
  function pagesWithoutScreen(plan, planned2) {
@@ -279396,7 +279722,7 @@ function stringOf2(node3) {
279396
279722
  }
279397
279723
  function definedScreens(contentDir2) {
279398
279724
  try {
279399
- const manifest2 = JSON.parse(readFileSync184(join199(contentDir2, "himalaya.content.json"), "utf8"));
279725
+ const manifest2 = JSON.parse(readFileSync185(join199(contentDir2, "himalaya.content.json"), "utf8"));
279400
279726
  return new Set(Object.keys(manifest2.screens ?? {}));
279401
279727
  } catch {
279402
279728
  return void 0;
@@ -279435,7 +279761,7 @@ async function runOneAppApplyNavigation(args, io2) {
279435
279761
  const tabsPath = options2.tabs ?? tabsFileOf(join199(options2.evidenceDir, "gen", "screens.json"));
279436
279762
  let plan;
279437
279763
  try {
279438
- plan = JSON.parse(readFileSync184(tabsPath, "utf8"));
279764
+ plan = JSON.parse(readFileSync185(tabsPath, "utf8"));
279439
279765
  if (plan.version !== 1 || !Array.isArray(plan.tabs) || !Array.isArray(plan.moreRows)) throw new Error("not a generated tabs file");
279440
279766
  } catch {
279441
279767
  return report7(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.` });
@@ -279473,7 +279799,7 @@ async function runOneAppApplyNavigation(args, io2) {
279473
279799
  }
279474
279800
  const configPath = join199(contentDir2, "config.ts");
279475
279801
  if (!existsSync156(configPath)) return report7(io2, false, { code: "content_invalid", error: `${configPath} not found.` });
279476
- const edit = applyNavigationToConfig(readFileSync184(configPath, "utf8"), plan);
279802
+ const edit = applyNavigationToConfig(readFileSync185(configPath, "utf8"), plan);
279477
279803
  if (edit.status === "kept") return report7(io2, false, { code: "config_unwritable", error: edit.reason, tabs: plan.tabs });
279478
279804
  if (edit.status === "set" && !options2.dryRun) writeFileAtomic(configPath, edit.source);
279479
279805
  const icons = plan.tabs.filter((tab) => tab.layoutItemId !== "(more)").map((tab) => ({ tab: tab.label, source: tab.icon ?? null, ...tabIcon(tab.icon, tab.pageIcon) }));
@@ -279564,7 +279890,7 @@ var init_bookings = __esm({
279564
279890
  });
279565
279891
 
279566
279892
  // src/one-app/starter-keep-list.ts
279567
- import { existsSync as existsSync157, readFileSync as readFileSync185, writeFileSync as writeFileSync77 } from "node:fs";
279893
+ import { existsSync as existsSync157, readFileSync as readFileSync186, writeFileSync as writeFileSync77 } from "node:fs";
279568
279894
  import { join as join200 } from "node:path";
279569
279895
  import ts30 from "typescript";
279570
279896
  function screensOpenedBy(node3, found = /* @__PURE__ */ new Set()) {
@@ -279601,7 +279927,7 @@ function seedKeepList(facts) {
279601
279927
  }
279602
279928
  function loadStarter(dir) {
279603
279929
  try {
279604
- const dev = readFileSync185(join200(dir, "dev", "index.ts"), "utf8"), config = readFileSync185(join200(dir, "config.ts"), "utf8");
279930
+ const dev = readFileSync186(join200(dir, "dev", "index.ts"), "utf8"), config = readFileSync186(join200(dir, "config.ts"), "utf8");
279605
279931
  const workers = listWorkers(dir);
279606
279932
  return { sources: { dev, config, workerDirs: workers.dirs, workerFiles: workers.files }, app: parseApp(dev, config), moduleTargets: /* @__PURE__ */ new Map() };
279607
279933
  } catch (error) {
@@ -279803,7 +280129,7 @@ function writeStarterKeepList(contentDir2, facts) {
279803
280129
  const seed2 = [...seedKeepList({ ...facts, template }), ...workerOpenedScreens(contentDir2, facts.workers ?? [])];
279804
280130
  const excluded2 = [...closureExcludes(facts.storefront), ...bookingsClosureExcludes(facts.bookings)];
279805
280131
  const wanted = new Set(seed2.map((row2) => row2.id));
279806
- const pruned = created ? { text: SPEC_TEMPLATE, dropped: [] } : dropSelfWrittenRows(readFileSync185(path2, "utf8"), new Set(excluded2.filter((id) => !wanted.has(id))));
280132
+ const pruned = created ? { text: SPEC_TEMPLATE, dropped: [] } : dropSelfWrittenRows(readFileSync186(path2, "utf8"), new Set(excluded2.filter((id) => !wanted.has(id))));
279807
280133
  const spec = pruned.text;
279808
280134
  const existing = specScreens(spec), mine = selfWrittenRows(spec);
279809
280135
  const closure = closeOverTrim(contentDir2, [...seed2.map((row2) => row2.id), ...existing.filter((id) => !mine.has(id))], facts.generated, existing, excluded2);
@@ -279837,15 +280163,15 @@ var init_starter_keep_list = __esm({
279837
280163
  });
279838
280164
 
279839
280165
  // src/one-app/generate-cli.ts
279840
- import { existsSync as existsSync158, mkdirSync as mkdirSync67, readdirSync as readdirSync67, readFileSync as readFileSync186, rmSync as rmSync48, writeFileSync as writeFileSync78 } from "node:fs";
279841
- import { dirname as dirname88, join as join201, resolve as resolve126 } from "node:path";
280166
+ import { existsSync as existsSync158, mkdirSync as mkdirSync67, readdirSync as readdirSync67, readFileSync as readFileSync187, rmSync as rmSync48, writeFileSync as writeFileSync78 } from "node:fs";
280167
+ import { dirname as dirname88, join as join201, resolve as resolve127 } from "node:path";
279842
280168
  function removeStaleGeneratedWorkers(contentDir2, current) {
279843
280169
  const root = join201(contentDir2, "tier5-src");
279844
280170
  if (!existsSync158(root)) return;
279845
280171
  for (const name of readdirSync67(root)) {
279846
280172
  if (current.has(name) || name === "_shared") continue;
279847
280173
  const index = join201(root, name, "index.ts");
279848
- if (existsSync158(index) && readFileSync186(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync48(join201(root, name), { recursive: true, force: true });
280174
+ if (existsSync158(index) && readFileSync187(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync48(join201(root, name), { recursive: true, force: true });
279849
280175
  }
279850
280176
  }
279851
280177
  function parseArgs6(args) {
@@ -279867,11 +280193,11 @@ function parseArgs6(args) {
279867
280193
  }
279868
280194
  }
279869
280195
  if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
279870
- return { evidenceDir: resolve126(evidenceDir), contentDir: resolve126(contentDir2), out: resolve126(out2 ?? join201(evidenceDir, "gen", "screens.json")) };
280196
+ return { evidenceDir: resolve127(evidenceDir), contentDir: resolve127(contentDir2), out: resolve127(out2 ?? join201(evidenceDir, "gen", "screens.json")) };
279871
280197
  }
279872
280198
  function claimedHome(out2) {
279873
280199
  try {
279874
- return JSON.parse(readFileSync186(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
280200
+ return JSON.parse(readFileSync187(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
279875
280201
  } catch {
279876
280202
  return false;
279877
280203
  }
@@ -279879,7 +280205,7 @@ function claimedHome(out2) {
279879
280205
  function previousOutput(out2) {
279880
280206
  const keys2 = (path2) => {
279881
280207
  try {
279882
- const value2 = JSON.parse(readFileSync186(path2, "utf8"));
280208
+ const value2 = JSON.parse(readFileSync187(path2, "utf8"));
279883
280209
  return Array.isArray(value2) ? value2.filter((v2) => typeof v2 === "string") : value2 && typeof value2 === "object" ? Object.keys(value2) : [];
279884
280210
  } catch {
279885
280211
  return [];
@@ -279917,7 +280243,7 @@ async function runOneAppGenerate(args, io2) {
279917
280243
  }
279918
280244
  const fetchedAt = (() => {
279919
280245
  try {
279920
- const m2 = JSON.parse(readFileSync186(join201(options2.evidenceDir, "manifest.json"), "utf8"));
280246
+ const m2 = JSON.parse(readFileSync187(join201(options2.evidenceDir, "manifest.json"), "utf8"));
279921
280247
  return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
279922
280248
  } catch {
279923
280249
  return void 0;
@@ -279927,7 +280253,7 @@ async function runOneAppGenerate(args, io2) {
279927
280253
  let homeScreenId;
279928
280254
  const previousIds = previousOutput(options2.out);
279929
280255
  try {
279930
- const manifest2 = JSON.parse(readFileSync186(join201(options2.contentDir, "himalaya.content.json"), "utf8"));
280256
+ const manifest2 = JSON.parse(readFileSync187(join201(options2.contentDir, "himalaya.content.json"), "utf8"));
279931
280257
  taken2 = new Set(Object.keys(manifest2.screens ?? {}));
279932
280258
  if (taken2.has(TEMPLATE_HOME_SCREEN) && (!previousIds.includes(TEMPLATE_HOME_SCREEN) || claimedHome(options2.out))) homeScreenId = TEMPLATE_HOME_SCREEN;
279933
280259
  for (const id of previousIds) taken2.delete(id);
@@ -280004,7 +280330,7 @@ async function runOneAppGenerate(args, io2) {
280004
280330
  const lockWarnings = locks.status !== "carried" ? [] : coverage2.status === "skipped" ? [`the coverage ledger does not carry the page locks yet: ${coverage2.reason}`] : recordPageLockRows(options2.evidenceDir, options2.contentDir, locks.plan, raw);
280005
280331
  let keepList;
280006
280332
  try {
280007
- const manifest2 = JSON.parse(readFileSync186(join201(options2.evidenceDir, "manifest.json"), "utf8"));
280333
+ const manifest2 = JSON.parse(readFileSync187(join201(options2.evidenceDir, "manifest.json"), "utf8"));
280008
280334
  const badgePlan = readHashedEvidenceJson(options2.evidenceDir, "header-badge-plan.json");
280009
280335
  const generated = Object.keys(result.screens);
280010
280336
  const routed = result.routes.flatMap((route) => route.kind === "template" && route.screenId ? [route.screenId] : []);
@@ -280102,8 +280428,8 @@ var init_access_policy = __esm({
280102
280428
  });
280103
280429
 
280104
280430
  // src/one-app/payment-review.ts
280105
- import { readFileSync as readFileSync187 } from "node:fs";
280106
- import { join as join202, resolve as resolve127 } from "node:path";
280431
+ import { readFileSync as readFileSync188 } from "node:fs";
280432
+ import { join as join202, resolve as resolve128 } from "node:path";
280107
280433
  function preservesUnverifiedFlow(flow) {
280108
280434
  const checkout = obj16(flow.checkout);
280109
280435
  return flow.payment === "online-paid" && obj16(flow.readiness).state === "unverified" && checkout.state === "supported" && text30(checkout.evidence) && (flow.decision === void 0 || obj16(flow.decision).action === "proceed");
@@ -280185,14 +280511,14 @@ function runPaymentReview(args, io2) {
280185
280511
  for (let i2 = 0; i2 < args.length; i2++) {
280186
280512
  if (args[i2] === "--json" || args[i2] === "--skip-version-check") continue;
280187
280513
  if (args[i2] !== "--evidence-dir" || evidenceDir || !args[i2 + 1] || args[i2 + 1].startsWith("--")) return fail16("invalid_usage", ["Pass --evidence-dir once."], 2);
280188
- evidenceDir = resolve127(args[++i2]);
280514
+ evidenceDir = resolve128(args[++i2]);
280189
280515
  }
280190
280516
  if (!evidenceDir) return fail16("invalid_usage", ["Pass --evidence-dir."], 2);
280191
280517
  try {
280192
280518
  const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
280193
280519
  const metaSiteId = obj16(manifest2.source).metaSiteId;
280194
280520
  if (typeof metaSiteId !== "string") throw Error("Missing site binding");
280195
- const review = JSON.parse(readFileSync187(join202(evidenceDir, "payment-review.json"), "utf8"));
280521
+ const review = JSON.parse(readFileSync188(join202(evidenceDir, "payment-review.json"), "utf8"));
280196
280522
  const issues = paymentReviewIssues(review, metaSiteId);
280197
280523
  if (issues.length) return fail16("payment_decision_required", issues, 1);
280198
280524
  const warnings = obj16(review).flows.map(obj16).filter(preservesUnverifiedFlow).map((flow) => ({
@@ -280445,10 +280771,10 @@ __export(cli_exports2, {
280445
280771
  ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
280446
280772
  runOneAppCommand: () => runOneAppCommand
280447
280773
  });
280448
- import { closeSync as closeSync15, constants as constants13, lstatSync as lstatSync43, mkdirSync as mkdirSync68, openSync as openSync14, readFileSync as readFileSync188, realpathSync as realpathSync24, writeFileSync as writeFileSync79 } from "node:fs";
280774
+ import { closeSync as closeSync15, constants as constants13, lstatSync as lstatSync43, mkdirSync as mkdirSync68, openSync as openSync14, readFileSync as readFileSync189, realpathSync as realpathSync24, writeFileSync as writeFileSync79 } from "node:fs";
280449
280775
  import { createHash as createHash99 } from "node:crypto";
280450
280776
  import { isIP as isIP2 } from "node:net";
280451
- import { dirname as dirname89, join as join203, parse as parse11, resolve as resolve128 } from "node:path";
280777
+ import { dirname as dirname89, join as join203, parse as parse11, resolve as resolve129 } from "node:path";
280452
280778
  function nativeSiteHost(host) {
280453
280779
  if (isIP2(host.startsWith("[") ? host.slice(1, -1) : host)) return true;
280454
280780
  const labels = host.replace(/\.$/, "").split(".");
@@ -280516,10 +280842,10 @@ function readOptions(argv, cwd, commandIncluded) {
280516
280842
  let prompt2 = flags.prompt ?? "";
280517
280843
  if (flags["prompt-file"] !== void 0) {
280518
280844
  try {
280519
- const file2 = resolve128(cwd, flags["prompt-file"]);
280845
+ const file2 = resolve129(cwd, flags["prompt-file"]);
280520
280846
  const stat10 = lstatSync43(file2);
280521
280847
  if (!stat10.isFile() || stat10.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
280522
- prompt2 = readFileSync188(file2, "utf8");
280848
+ prompt2 = readFileSync189(file2, "utf8");
280523
280849
  } catch {
280524
280850
  throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
280525
280851
  }
@@ -280534,7 +280860,7 @@ function readOptions(argv, cwd, commandIncluded) {
280534
280860
  if (flags.dir !== void 0 && !flags.dir.trim()) {
280535
280861
  throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
280536
280862
  }
280537
- const parentDir = resolve128(cwd, flags.dir ?? ".");
280863
+ const parentDir = resolve129(cwd, flags.dir ?? ".");
280538
280864
  const workspace = join203(parentDir, name);
280539
280865
  assertSafeParents(parentDir);
280540
280866
  if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
@@ -280859,7 +281185,7 @@ var init_cli2 = __esm({
280859
281185
  init_version2();
280860
281186
  init_migration_context();
280861
281187
  init_site_language();
280862
- ONE_APP_USAGE = "himi one-app migrate --msid <uuid> [--app-instance branded|free] [--locale <tag>] [--languages <tag,tag>] [--prompt <text> | --prompt-file <file>] [--name <slug>] [--dir <parent>] [--target bo] [--top-tabs bottom-tabs|keep] [--json]\nhimi one-app validate-topbar --evidence-dir <.himi/one-app> --content <app-dir> [--json]\nhimi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]\nhimi one-app generate --evidence-dir <.himi/one-app> --content <app-dir> [--out <screens.json>]\n" + APPLY_NAVIGATION_USAGE + "\nhimi one-app provision --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]\n" + ACCESS_USAGE + "\nhimi one-app validate-design --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix] [--record --release-hash <sha256>]\nhimi one-app coverage init|sync|check|verify --evidence-dir <.himi/one-app> --content <app-dir> [--release-hash <sha256>] (verify only: [--stage publish|pre-publish])\nhimi one-app validate-identity --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix]\n" + PAYMENT_REVIEW_USAGE;
281188
+ ONE_APP_USAGE = "himi one-app migrate --msid <uuid> [--app-instance branded|free] [--locale <tag>] [--languages <tag,tag>] [--prompt <text> | --prompt-file <file>] [--name <slug>] [--dir <parent>] [--target bo] [--top-tabs bottom-tabs|keep] [--json]\nhimi one-app validate-topbar --evidence-dir <.himi/one-app> --content <app-dir> [--json]\nhimi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--not-new-app] [--dry-run]\nhimi one-app generate --evidence-dir <.himi/one-app> --content <app-dir> [--out <screens.json>]\n" + APPLY_NAVIGATION_USAGE + "\nhimi one-app provision --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]\n" + ACCESS_USAGE + "\nhimi one-app validate-design --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix] [--record --release-hash <sha256>]\nhimi one-app coverage init|sync|check|verify --evidence-dir <.himi/one-app> --content <app-dir> [--release-hash <sha256>] (verify only: [--stage publish|pre-publish])\nhimi one-app validate-identity --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix]\n" + PAYMENT_REVIEW_USAGE;
280863
281189
  UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
280864
281190
  SLUG2 = /^[a-z0-9][a-z0-9-]{0,62}$/;
280865
281191
  VALUE_FLAGS = /* @__PURE__ */ new Set(["msid", "app-instance", "locale", "languages", "prompt", "prompt-file", "name", "dir", "target", "top-tabs"]);
@@ -282824,7 +283150,7 @@ var init_analyze2 = __esm({
282824
283150
  });
282825
283151
 
282826
283152
  // src/site-analyze/site-pages-apply.ts
282827
- import { existsSync as existsSync159, readFileSync as readFileSync189 } from "node:fs";
283153
+ import { existsSync as existsSync159, readFileSync as readFileSync190 } from "node:fs";
282828
283154
  import { join as join204 } from "node:path";
282829
283155
  import ts31 from "typescript";
282830
283156
  function packageScreenIds(dir) {
@@ -282832,7 +283158,7 @@ function packageScreenIds(dir) {
282832
283158
  const config = join204(dir, "config.ts");
282833
283159
  if (!existsSync159(dev) || !existsSync159(config)) return void 0;
282834
283160
  try {
282835
- const app2 = parseApp(readFileSync189(dev, "utf8"), readFileSync189(config, "utf8"));
283161
+ const app2 = parseApp(readFileSync190(dev, "utf8"), readFileSync190(config, "utf8"));
282836
283162
  return new Set(app2.routes.filter((r3) => r3.kind === "screen").map((r3) => r3.label));
282837
283163
  } catch {
282838
283164
  return void 0;
@@ -282886,7 +283212,7 @@ function applySitePagesToPackage(dir, site, opts = {}) {
282886
283212
  if (!existsSync159(devPath) || !existsSync159(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
282887
283213
  let existing;
282888
283214
  try {
282889
- const app2 = parseApp(readFileSync189(devPath, "utf8"), readFileSync189(configPath, "utf8"));
283215
+ const app2 = parseApp(readFileSync190(devPath, "utf8"), readFileSync190(configPath, "utf8"));
282890
283216
  existing = app2.routes.filter((r3) => r3.kind === "screen" && isWebsiteScreenId(r3.label)).map((r3) => r3.label);
282891
283217
  } catch (e2) {
282892
283218
  return none(`the package is not in the plain-JSON shape \`himi init\` writes, which this step edits (${e2.message})`);
@@ -282896,21 +283222,21 @@ function applySitePagesToPackage(dir, site, opts = {}) {
282896
283222
  const removed = existing.filter((id) => !wanted.includes(id));
282897
283223
  const added = wanted.filter((id) => !existing.includes(id));
282898
283224
  const replaced = wanted.filter((id) => existing.includes(id));
282899
- const probe2 = spliceWebsiteDrawer(readFileSync189(configPath, "utf8"), site);
283225
+ const probe2 = spliceWebsiteDrawer(readFileSync190(configPath, "utf8"), site);
282900
283226
  if ("refused" in probe2) return none(probe2.refused);
282901
283227
  if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
282902
- const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync159(join204(dir, rel2)) ? readFileSync189(join204(dir, rel2), "utf8") : void 0]));
283228
+ const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync159(join204(dir, rel2)) ? readFileSync190(join204(dir, rel2), "utf8") : void 0]));
282903
283229
  try {
282904
283230
  if (removed.length) removeScreens(dir, removed);
282905
283231
  if (wanted.length) upsertScreens(dir, screens);
282906
- const spliced = spliceWebsiteDrawer(readFileSync189(configPath, "utf8"), site);
283232
+ const spliced = spliceWebsiteDrawer(readFileSync190(configPath, "utf8"), site);
282907
283233
  if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
282908
- if (spliced.source !== readFileSync189(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
283234
+ if (spliced.source !== readFileSync190(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
282909
283235
  } catch (e2) {
282910
- for (const [rel2, text32] of before) if (text32 !== void 0 && readFileSync189(join204(dir, rel2), "utf8") !== text32) writeFileAtomic(join204(dir, rel2), text32);
283236
+ for (const [rel2, text32] of before) if (text32 !== void 0 && readFileSync190(join204(dir, rel2), "utf8") !== text32) writeFileAtomic(join204(dir, rel2), text32);
282911
283237
  return none(`stopped and restored every file: ${e2.message}`);
282912
283238
  }
282913
- const wrote = [...before].filter(([rel2, text32]) => text32 !== void 0 && readFileSync189(join204(dir, rel2), "utf8") !== text32).map(([rel2]) => join204(dir, rel2));
283239
+ const wrote = [...before].filter(([rel2, text32]) => text32 !== void 0 && readFileSync190(join204(dir, rel2), "utf8") !== text32).map(([rel2]) => join204(dir, rel2));
282914
283240
  return { added, replaced, removed, rows: probe2.rows, wrote };
282915
283241
  }
282916
283242
  var ANCHOR_ROWS;
@@ -282939,8 +283265,8 @@ var init_customer_build = __esm({
282939
283265
  });
282940
283266
 
282941
283267
  // src/site-analyze/apply.ts
282942
- import { existsSync as existsSync160, readFileSync as readFileSync190, writeFileSync as writeFileSync80, copyFileSync as copyFileSync3, mkdirSync as mkdirSync69, realpathSync as realpathSync25, statSync as statSync53 } from "node:fs";
282943
- import { dirname as dirname90, isAbsolute as isAbsolute21, join as join205, resolve as resolve129, sep as sep35 } from "node:path";
283268
+ import { existsSync as existsSync160, readFileSync as readFileSync191, writeFileSync as writeFileSync80, copyFileSync as copyFileSync3, mkdirSync as mkdirSync69, realpathSync as realpathSync25, statSync as statSync53 } from "node:fs";
283269
+ import { dirname as dirname90, isAbsolute as isAbsolute21, join as join205, resolve as resolve130, sep as sep35 } from "node:path";
282944
283270
  import { spawnSync as spawnSync13 } from "node:child_process";
282945
283271
  function inRepoBakeRefusal(repoRoot2, shell) {
282946
283272
  if (isBrandable(repoRoot2, shell)) return null;
@@ -282974,7 +283300,7 @@ function unpairedRedirectNote(overlay) {
282974
283300
  return `no OAuth redirect paired with client ${overlay.wix.clientId} \u2014 the app (and prepare:customer) will refuse to start until one is set. Register it with \`himi site client ensure --site ${overlay.siteId?.trim() || "<msid>"} --redirect-uri <uri> --yes\`, then re-run analyze with \`--redirect-uri <uri>\` (or export HIMI_BRANDED_LITE_WIX_REDIRECT_URI)`;
282975
283301
  }
282976
283302
  function posix4(p2) {
282977
- return resolve129(p2).replace(/\\/g, "/");
283303
+ return resolve130(p2).replace(/\\/g, "/");
282978
283304
  }
282979
283305
  function committedShellProvisioning(path2) {
282980
283306
  return committedShellFor(posix4(path2));
@@ -283011,7 +283337,7 @@ function assertNotCommitted(path2, forbidden2) {
283011
283337
  `refusing to overwrite committed ${committedProvisioningPath(committed)} \u2014 use prepare:customer --contract`
283012
283338
  );
283013
283339
  }
283014
- if (forbidden2 && resolve129(path2) === resolve129(forbidden2)) {
283340
+ if (forbidden2 && resolve130(path2) === resolve130(forbidden2)) {
283015
283341
  const named3 = committedShellProvisioning(forbidden2);
283016
283342
  throw new Error(
283017
283343
  `refusing to overwrite committed ${named3 ? committedProvisioningPath(named3) : forbidden2} \u2014 pass a content-package provisioning.json or use prepare:customer --contract`
@@ -283241,12 +283567,12 @@ function buildMergedContract(options2) {
283241
283567
  if (!existsSync160(committedPath)) {
283242
283568
  throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
283243
283569
  }
283244
- const committed = JSON.parse(readFileSync190(committedPath, "utf8"));
283570
+ const committed = JSON.parse(readFileSync191(committedPath, "utf8"));
283245
283571
  const previousPath = join205(appDir3, LOCAL_CONTRACT_REL);
283246
283572
  let evidenceOverlay = overlay;
283247
283573
  if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync160(previousPath)) {
283248
283574
  try {
283249
- const previous = JSON.parse(readFileSync190(previousPath, "utf8"));
283575
+ const previous = JSON.parse(readFileSync191(previousPath, "utf8"));
283250
283576
  if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
283251
283577
  evidenceOverlay = {
283252
283578
  ...overlay,
@@ -283261,7 +283587,7 @@ function buildMergedContract(options2) {
283261
283587
  let keepSite = options2.keepSite === true;
283262
283588
  if (!keepSite && options2.sitePageHost && existsSync160(previousPath)) {
283263
283589
  try {
283264
- const carried = websiteSiteToCarry(JSON.parse(readFileSync190(previousPath, "utf8")), overlay);
283590
+ const carried = websiteSiteToCarry(JSON.parse(readFileSync191(previousPath, "utf8")), overlay);
283265
283591
  if (carried) {
283266
283592
  evidenceOverlay = { ...evidenceOverlay, site: carried };
283267
283593
  keepSite = true;
@@ -283275,8 +283601,8 @@ function buildMergedContract(options2) {
283275
283601
  const staged = [];
283276
283602
  const contained = (root, rel2) => {
283277
283603
  if (isAbsolute21(rel2)) return void 0;
283278
- const full = resolve129(root, rel2);
283279
- return full.startsWith(resolve129(root) + sep35) ? full : void 0;
283604
+ const full = resolve130(root, rel2);
283605
+ return full.startsWith(resolve130(root) + sep35) ? full : void 0;
283280
283606
  };
283281
283607
  const stage = (fromRel, toRel) => {
283282
283608
  const from = contained(packageDir, fromRel);
@@ -283307,7 +283633,7 @@ function buildMergedContract(options2) {
283307
283633
  if (existsSync160(facesPath)) {
283308
283634
  let faces = [];
283309
283635
  try {
283310
- const parsed = JSON.parse(readFileSync190(facesPath, "utf8"));
283636
+ const parsed = JSON.parse(readFileSync191(facesPath, "utf8"));
283311
283637
  faces = Array.isArray(parsed) ? parsed : [];
283312
283638
  } catch {
283313
283639
  faces = [];
@@ -283365,10 +283691,10 @@ function catalogTypography(overlay, template) {
283365
283691
  function staticFaqFor(overlay, overlayPath) {
283366
283692
  const own6 = overlay.faq;
283367
283693
  if (own6 !== void 0) return deriveStaticFaq(own6);
283368
- const bookPath = join205(dirname90(resolve129(overlayPath)), "book.json");
283694
+ const bookPath = join205(dirname90(resolve130(overlayPath)), "book.json");
283369
283695
  if (!existsSync160(bookPath)) return void 0;
283370
283696
  try {
283371
- const book = JSON.parse(readFileSync190(bookPath, "utf8"));
283697
+ const book = JSON.parse(readFileSync191(bookPath, "utf8"));
283372
283698
  const copy = book?.copy;
283373
283699
  if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
283374
283700
  const pairs2 = deriveStaticFaq(copy.faq);
@@ -283382,10 +283708,10 @@ function staticGalleriesFor(overlay, overlayPath) {
283382
283708
  if (overlay.galleries !== void 0) return deriveStaticGalleries(
283383
283709
  overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
283384
283710
  );
283385
- const bookPath = join205(dirname90(resolve129(overlayPath)), "book.json");
283711
+ const bookPath = join205(dirname90(resolve130(overlayPath)), "book.json");
283386
283712
  if (!existsSync160(bookPath)) return void 0;
283387
283713
  try {
283388
- const book = JSON.parse(readFileSync190(bookPath, "utf8"));
283714
+ const book = JSON.parse(readFileSync191(bookPath, "utf8"));
283389
283715
  if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
283390
283716
  const galleries = deriveStaticGalleries(book.look.pages);
283391
283717
  return galleries.length || book.look.complete === true ? galleries : void 0;
@@ -283394,17 +283720,17 @@ function staticGalleriesFor(overlay, overlayPath) {
283394
283720
  }
283395
283721
  }
283396
283722
  async function applyOverlays(input) {
283397
- const cwd = resolve129(input.cwd);
283723
+ const cwd = resolve130(input.cwd);
283398
283724
  const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
283399
283725
  assertKnownShell(shell);
283400
283726
  const pagesRefusal = input.sitePages ? sitePagesTargetRefusal({ cwd, shell }) : void 0;
283401
283727
  if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
283402
- const overlay = JSON.parse(readFileSync190(input.overlayPath, "utf8"));
283728
+ const overlay = JSON.parse(readFileSync191(input.overlayPath, "utf8"));
283403
283729
  const sitePages = input.sitePages === true;
283404
283730
  const plan = input.sitePagesPlan;
283405
283731
  const planNote = sitePages && plan ? plan.notes[0] : void 0;
283406
283732
  const sitePagesOut = (screens) => sitePages && plan ? { sitePages: { site: plan.site, native: plan.native, skipped: plan.skipped, ...screens ? { screens } : {} } } : {};
283407
- const tokens2 = JSON.parse(readFileSync190(input.tokensPath, "utf8"));
283733
+ const tokens2 = JSON.parse(readFileSync191(input.tokensPath, "utf8"));
283408
283734
  const faq = staticFaqFor(overlay, input.overlayPath);
283409
283735
  if (faq !== void 0) overlay.faq = faq;
283410
283736
  const galleries = staticGalleriesFor(overlay, input.overlayPath);
@@ -283420,7 +283746,7 @@ async function applyOverlays(input) {
283420
283746
  if (bakeRefusal) throw Object.assign(new Error(bakeRefusal), { exit: 2, code: APPLY_SHELL_CANNOT_BAKE });
283421
283747
  const appDir3 = join205(repoRoot2, shellAppDir(shell));
283422
283748
  assertOverlayNamesSite(join205(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
283423
- const packageDir = dirname90(resolve129(input.overlayPath));
283749
+ const packageDir = dirname90(resolve130(input.overlayPath));
283424
283750
  if (input.dryRun) {
283425
283751
  return {
283426
283752
  mode: "dry",
@@ -283492,7 +283818,7 @@ async function applyOverlays(input) {
283492
283818
  let packageFaq = faq;
283493
283819
  let packageGalleries = galleries;
283494
283820
  if (existsSync160(pkgProv)) {
283495
- const cur = JSON.parse(readFileSync190(pkgProv, "utf8"));
283821
+ const cur = JSON.parse(readFileSync191(pkgProv, "utf8"));
283496
283822
  if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
283497
283823
  const merged = deepMerge4(cur, overlay);
283498
283824
  if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
@@ -283527,7 +283853,7 @@ async function applyOverlays(input) {
283527
283853
  }
283528
283854
  const pkgTokens = join205(cwd, "tokens.json");
283529
283855
  if (existsSync160(pkgTokens) && (tokens2.colors || tokens2.typography)) {
283530
- const cur = JSON.parse(readFileSync190(pkgTokens, "utf8"));
283856
+ const cur = JSON.parse(readFileSync191(pkgTokens, "utf8"));
283531
283857
  let tokensIn = tokens2;
283532
283858
  if (tokens2.typography) {
283533
283859
  const fonts = catalogTypography(tokens2.typography, cur.typography);
@@ -283554,7 +283880,7 @@ async function applyOverlays(input) {
283554
283880
  const homeAction = homeRefreshActionId(shell);
283555
283881
  const homeSrc = join205(cwd, "dev/index.ts");
283556
283882
  if (homeAction && existsSync160(homeSrc)) {
283557
- const prev = readFileSync190(homeSrc, "utf8");
283883
+ const prev = readFileSync191(homeSrc, "utf8");
283558
283884
  const patched = patchBrandParams(prev, overlay, homeAction);
283559
283885
  let next = patched.src;
283560
283886
  if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
@@ -283598,7 +283924,7 @@ async function applyOverlays(input) {
283598
283924
  else pageScreens = { added: pages2.added, replaced: pages2.replaced, removed: pages2.removed, rows: pages2.rows };
283599
283925
  }
283600
283926
  if (!input.iconPath || !existsSync160(input.iconPath)) {
283601
- const book = input.iconPath ? dirname90(dirname90(resolve129(input.iconPath))) : void 0;
283927
+ const book = input.iconPath ? dirname90(dirname90(resolve130(input.iconPath))) : void 0;
283602
283928
  notes.push(
283603
283929
  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"
283604
283930
  );
@@ -284356,13 +284682,13 @@ __export(cli_exports3, {
284356
284682
  sitePagesRefusal: () => sitePagesRefusal,
284357
284683
  targetIsSiteShell: () => targetIsSiteShell
284358
284684
  });
284359
- import { existsSync as existsSync161, readFileSync as readFileSync191 } from "node:fs";
284685
+ import { existsSync as existsSync161, readFileSync as readFileSync192 } from "node:fs";
284360
284686
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
284361
- import { resolve as resolve130 } from "node:path";
284687
+ import { resolve as resolve131 } from "node:path";
284362
284688
  function sitePagesRefusal(opts) {
284363
284689
  const shell = opts.shell ?? DEFAULT_BRANDABLE_SHELL;
284364
284690
  if (opts.sitePages && SHELL_NAMES.includes(shell)) {
284365
- const refusal2 = sitePagesTargetRefusal({ cwd: resolve130(opts.cwd ?? process.cwd()), shell });
284691
+ const refusal2 = sitePagesTargetRefusal({ cwd: resolve131(opts.cwd ?? process.cwd()), shell });
284366
284692
  if (refusal2) return refusal2;
284367
284693
  }
284368
284694
  if (opts.dryRun && !(opts.apply && opts.sitePages)) return { code: DRY_RUN_NEEDS_SITE_PAGES, error: DRY_RUN_NEEDS_SITE_PAGES_MESSAGE };
@@ -284370,7 +284696,7 @@ function sitePagesRefusal(opts) {
284370
284696
  }
284371
284697
  function targetIsSiteShell(opts) {
284372
284698
  if (opts.shell !== void 0 && !SHELL_NAMES.includes(opts.shell)) return false;
284373
- return siteShellTarget({ cwd: resolve130(opts.cwd ?? process.cwd()), shell: opts.shell }).siteShell;
284699
+ return siteShellTarget({ cwd: resolve131(opts.cwd ?? process.cwd()), shell: opts.shell }).siteShell;
284374
284700
  }
284375
284701
  function applyNeedsClient(shell, cwd) {
284376
284702
  if (shell !== void 0 && !SHELL_NAMES.includes(shell)) return true;
@@ -284396,7 +284722,7 @@ async function mobileAppAuthFor(ownerAuth, deps = {}) {
284396
284722
  }
284397
284723
  async function runSiteAnalyze(opts) {
284398
284724
  if (opts.shell !== void 0) assertKnownShell(opts.shell);
284399
- const cwd = resolve130(opts.cwd ?? process.cwd());
284725
+ const cwd = resolve131(opts.cwd ?? process.cwd());
284400
284726
  const pagesRefusal = sitePagesRefusal({ ...opts, cwd });
284401
284727
  if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
284402
284728
  if (opts.apply) {
@@ -284412,7 +284738,7 @@ async function runSiteAnalyze(opts) {
284412
284738
  const fetchImpl = opts.fetchImpl ?? fetch;
284413
284739
  const assetFetch = assetFetchFor(opts);
284414
284740
  const siteFetch = guardedSiteFetch;
284415
- const outDir = resolve130(cwd, opts.outDir ?? ".himi/business-book");
284741
+ const outDir = resolve131(cwd, opts.outDir ?? ".himi/business-book");
284416
284742
  let ownerAuth;
284417
284743
  let msid;
284418
284744
  const ownerSite = ownerSiteFor(opts);
@@ -284442,7 +284768,7 @@ async function runSiteAnalyze(opts) {
284442
284768
  if (siteShell) {
284443
284769
  try {
284444
284770
  const kind = siteKindForOrigin(result.book.input.siteUrl, { wix: wixConfirmsOrigin(result.book, result.book.input.siteUrl) });
284445
- const book = kind === "base44" ? base44BookRoutes(resolve130(cwd, ".himi/base44-book/book.json"), result.book.input.siteUrl) : void 0;
284771
+ const book = kind === "base44" ? base44BookRoutes(resolve131(cwd, ".himi/base44-book/book.json"), result.book.input.siteUrl) : void 0;
284446
284772
  const routes = book?.routes;
284447
284773
  if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
284448
284774
  const derived2 = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
@@ -284450,16 +284776,16 @@ async function runSiteAnalyze(opts) {
284450
284776
  delete result.provisioningOverlay.wix;
284451
284777
  derived2.notes.push("wix binding: left out \u2014 a web site is visitor-only, so the client id is not used.");
284452
284778
  }
284453
- const prevOverlayPath = resolve130(outDir, "provisioning.overlay.json");
284779
+ const prevOverlayPath = resolve131(outDir, "provisioning.overlay.json");
284454
284780
  const readSite = (path2) => {
284455
284781
  try {
284456
- return JSON.parse(readFileSync191(path2, "utf8")).site;
284782
+ return JSON.parse(readFileSync192(path2, "utf8")).site;
284457
284783
  } catch {
284458
284784
  return void 0;
284459
284785
  }
284460
284786
  };
284461
284787
  const overlaySite = existsSync161(prevOverlayPath) ? readSite(prevOverlayPath) : void 0;
284462
- const packagePath = resolve130(cwd, "provisioning.json");
284788
+ const packagePath = resolve131(cwd, "provisioning.json");
284463
284789
  const target = siteShellTarget({ cwd, shell: opts.shell });
284464
284790
  const packageSite = target.where === "off-repo" && target.manifest === packagePath && existsSync161(packagePath) ? readSite(packagePath) : void 0;
284465
284791
  const asBlock = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
@@ -284523,9 +284849,9 @@ async function runSiteAnalyze(opts) {
284523
284849
  ];
284524
284850
  }
284525
284851
  }
284526
- const previousOverlay = resolve130(outDir, "provisioning.overlay.json");
284852
+ const previousOverlay = resolve131(outDir, "provisioning.overlay.json");
284527
284853
  carryOverGoals(
284528
- existsSync161(previousOverlay) ? readFileSync191(previousOverlay, "utf8") : void 0,
284854
+ existsSync161(previousOverlay) ? readFileSync192(previousOverlay, "utf8") : void 0,
284529
284855
  result.provisioningOverlay
284530
284856
  );
284531
284857
  const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
@@ -284544,9 +284870,9 @@ async function runSiteAnalyze(opts) {
284544
284870
  if (opts.apply) {
284545
284871
  applied = await applyOverlays({
284546
284872
  cwd,
284547
- overlayPath: resolve130(outDir, "provisioning.overlay.json"),
284548
- tokensPath: resolve130(outDir, "tokens.overlay.json"),
284549
- iconPath: resolve130(outDir, "media/icon.png"),
284873
+ overlayPath: resolve131(outDir, "provisioning.overlay.json"),
284874
+ tokensPath: resolve131(outDir, "tokens.overlay.json"),
284875
+ iconPath: resolve131(outDir, "media/icon.png"),
284550
284876
  shell: opts.shell,
284551
284877
  sitePages: opts.sitePages === true,
284552
284878
  sitePagesPlan,
@@ -284587,8 +284913,8 @@ async function runSiteFunctionCli(opts) {
284587
284913
  const token = opts.token ?? await siteToken(msid);
284588
284914
  let source2;
284589
284915
  if (opts.sourcePath) {
284590
- const p2 = resolve130(opts.cwd ?? process.cwd(), opts.sourcePath);
284591
- source2 = readFileSync191(p2, "utf8");
284916
+ const p2 = resolve131(opts.cwd ?? process.cwd(), opts.sourcePath);
284917
+ source2 = readFileSync192(p2, "utf8");
284592
284918
  }
284593
284919
  let body;
284594
284920
  if (opts.bodyRaw != null) {
@@ -284618,7 +284944,7 @@ async function runSiteFunctionCli(opts) {
284618
284944
  function base44BookRoutes(bookPath, siteUrl) {
284619
284945
  if (!existsSync161(bookPath)) return void 0;
284620
284946
  try {
284621
- const book = JSON.parse(readFileSync191(bookPath, "utf8"));
284947
+ const book = JSON.parse(readFileSync192(bookPath, "utf8"));
284622
284948
  if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
284623
284949
  const host = (u2) => {
284624
284950
  try {
@@ -284672,7 +284998,7 @@ async function accountToken2(spawnImpl = spawn9) {
284672
284998
  cached2 = fromEnv;
284673
284999
  return fromEnv;
284674
285000
  }
284675
- const token = await new Promise((resolve134, reject) => {
285001
+ const token = await new Promise((resolve135, reject) => {
284676
285002
  let child3;
284677
285003
  try {
284678
285004
  child3 = spawnImpl("wix", ["token"]);
@@ -284701,7 +285027,7 @@ async function accountToken2(spawnImpl = spawn9) {
284701
285027
  const scan = (d2) => {
284702
285028
  out2 += String(d2);
284703
285029
  const m2 = out2.match(TOKEN_RE2);
284704
- if (m2) done(() => resolve134(m2[0]));
285030
+ if (m2) done(() => resolve135(m2[0]));
284705
285031
  };
284706
285032
  child3.stdout?.on("data", scan);
284707
285033
  child3.stderr?.on("data", scan);
@@ -284790,7 +285116,7 @@ __export(site_create_exports, {
284790
285116
  runSiteList: () => runSiteList,
284791
285117
  writeProvisioningBinding: () => writeProvisioningBinding
284792
285118
  });
284793
- import { existsSync as existsSync162, readFileSync as readFileSync192, writeFileSync as writeFileSync81 } from "node:fs";
285119
+ import { existsSync as existsSync162, readFileSync as readFileSync193, writeFileSync as writeFileSync81 } from "node:fs";
284794
285120
  import { resolve as resolvePath4 } from "node:path";
284795
285121
  function oauthClientName(projectName) {
284796
285122
  return `${projectName} client`;
@@ -284939,7 +285265,7 @@ async function runSiteCreate(opts) {
284939
285265
  if (!wantOauthApp) return { ...base2, nextSteps: nextSteps(metaSiteId) };
284940
285266
  return { ...base2, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
284941
285267
  }
284942
- function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync162, readFileSync: readFileSync192, writeFileSync: writeFileSync81 }) {
285268
+ function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync162, readFileSync: readFileSync193, writeFileSync: writeFileSync81 }) {
284943
285269
  const msid = binding2.siteId;
284944
285270
  const path2 = resolvePath4(target);
284945
285271
  const committed = committedShellProvisioning(path2);
@@ -285550,7 +285876,7 @@ async function collectSiteContext(opts) {
285550
285876
  visitorToken = await mintVisitorToken(fetcher, opts.clientId);
285551
285877
  visitorAuth = { status: "ok" };
285552
285878
  } catch (e2) {
285553
- visitorAuth = failed2(e2);
285879
+ visitorAuth = failed(e2);
285554
285880
  }
285555
285881
  }
285556
285882
  const visitor = visitorToken ? makeTransport(fetcher, { token: visitorToken, msid: opts.siteId }) : void 0;
@@ -285567,7 +285893,7 @@ async function collectSiteContext(opts) {
285567
285893
  currency: identity2.locale.currency
285568
285894
  } };
285569
285895
  } catch (e2) {
285570
- return failed2(e2);
285896
+ return failed(e2);
285571
285897
  }
285572
285898
  };
285573
285899
  const cmsRead = async () => {
@@ -285580,7 +285906,7 @@ async function collectSiteContext(opts) {
285580
285906
  return data;
285581
285907
  } catch (e2) {
285582
285908
  const code3 = e2 instanceof WixApiError2 ? e2.body?.details?.applicationError?.code : void 0;
285583
- failure4 = code3 === "WDE0110" ? { status: "unavailable", httpStatus: 400 } : failed2(e2);
285909
+ failure4 = code3 === "WDE0110" ? { status: "unavailable", httpStatus: 400 } : failed(e2);
285584
285910
  throw e2;
285585
285911
  }
285586
285912
  } : void 0;
@@ -285602,7 +285928,7 @@ async function collectSiteContext(opts) {
285602
285928
  try {
285603
285929
  return await owner(method, path2, body);
285604
285930
  } catch (e2) {
285605
- readFailure = failed2(e2);
285931
+ readFailure = failed(e2);
285606
285932
  throw e2;
285607
285933
  }
285608
285934
  };
@@ -285647,7 +285973,7 @@ async function collectSiteContext(opts) {
285647
285973
  truncated: files.length > selected.size || [...selected.values()].some((f2) => f2.sourceTruncated)
285648
285974
  };
285649
285975
  } catch (e2) {
285650
- return { ...failed2(e2), files: [], sourceIncluded: false };
285976
+ return { ...failed(e2), files: [], sourceIncluded: false };
285651
285977
  }
285652
285978
  };
285653
285979
  const [identity, cms, velo, probes] = await Promise.all([
@@ -285658,7 +285984,7 @@ async function collectSiteContext(opts) {
285658
285984
  ]);
285659
285985
  const probeRead = (p2, available, auth) => {
285660
285986
  if (!available) return auth;
285661
- if (p2.httpStatus) return { ...failed2(new WixApiError2(p2.httpStatus, "", "", null)), count: p2.count };
285987
+ if (p2.httpStatus) return { ...failed(new WixApiError2(p2.httpStatus, "", "", null)), count: p2.count };
285662
285988
  return { status: p2.status === "ok" || p2.status === "empty" ? p2.status : "error", count: p2.count };
285663
285989
  };
285664
285990
  return {
@@ -285674,7 +286000,7 @@ async function collectSiteContext(opts) {
285674
286000
  }))
285675
286001
  };
285676
286002
  }
285677
- var responseKeys, definitions, reads2, failed2;
286003
+ var responseKeys, definitions, reads2, failed;
285678
286004
  var init_context2 = __esm({
285679
286005
  "src/site-analyze/context.ts"() {
285680
286006
  init_define_HHP_CATALOG();
@@ -285711,7 +286037,7 @@ var init_context2 = __esm({
285711
286037
  ...OWNER_VELO_PROBES.map((p2) => `${p2.method} ${p2.path}`),
285712
286038
  ...definitions.flatMap((p2) => [p2, ...p2.fallbacks ?? []].map((a3) => `${a3.method} ${a3.path}`))
285713
286039
  ]);
285714
- failed2 = (e2) => {
286040
+ failed = (e2) => {
285715
286041
  const httpStatus = e2 instanceof WixApiError2 ? e2.status : void 0;
285716
286042
  return { status: httpStatus === 401 ? "unauthorized" : httpStatus === 403 ? "forbidden" : httpStatus === 404 || httpStatus === 428 ? "unavailable" : "error", ...httpStatus ? { httpStatus } : {} };
285717
286043
  };
@@ -285748,7 +286074,7 @@ __export(check_report_exports, {
285748
286074
  import { createHash as createHash100, randomUUID as randomUUID20 } from "node:crypto";
285749
286075
  import { request as httpRequest2 } from "node:http";
285750
286076
  import { createConnection } from "node:net";
285751
- import { isAbsolute as isAbsolute22, relative as relative38, resolve as resolve131 } from "node:path";
286077
+ import { isAbsolute as isAbsolute22, relative as relative38, resolve as resolve132 } from "node:path";
285752
286078
  function credentialValue(value2) {
285753
286079
  const v2 = value2.trim();
285754
286080
  if (!v2 || /^(?:[01]|true|false|yes|no|on|off|null|none|undefined)$/i.test(v2)) return null;
@@ -285840,7 +286166,7 @@ function boundedText(value2, secrets) {
285840
286166
  return clean3.length <= MAX_TEXT4 ? clean3 : `${clean3.slice(0, MAX_TEXT4 - 1)}\u2026`;
285841
286167
  }
285842
286168
  function contentRelative(file2, contentDir2) {
285843
- const rel2 = isAbsolute22(file2) ? relative38(resolve131(contentDir2), file2) : file2;
286169
+ const rel2 = isAbsolute22(file2) ? relative38(resolve132(contentDir2), file2) : file2;
285844
286170
  const normal = rel2.split(/[\\/]+/).filter((part5) => part5 && part5 !== ".");
285845
286171
  if (!normal.length || isAbsolute22(rel2) || normal.includes("..")) return void 0;
285846
286172
  const joined = normal.join("/");
@@ -286325,9 +286651,9 @@ var init_capture = __esm({
286325
286651
 
286326
286652
  // src/fidelity/judge.ts
286327
286653
  import { spawn as spawn10 } from "node:child_process";
286328
- import { copyFileSync as copyFileSync4, mkdtempSync as mkdtempSync15, readFileSync as readFileSync193, rmSync as rmSync50 } from "node:fs";
286654
+ import { copyFileSync as copyFileSync4, mkdtempSync as mkdtempSync15, readFileSync as readFileSync194, rmSync as rmSync50 } from "node:fs";
286329
286655
  import { tmpdir as tmpdir16 } from "node:os";
286330
- import { basename as basename42, dirname as dirname91, join as join207, resolve as resolve132 } from "node:path";
286656
+ import { basename as basename42, dirname as dirname91, join as join207, resolve as resolve133 } from "node:path";
286331
286657
  import { fileURLToPath as fileURLToPath44 } from "node:url";
286332
286658
  function parseVerdict(value2, captured) {
286333
286659
  const v2 = value2;
@@ -286367,8 +286693,8 @@ async function judgeStrip(strip4, screen, variant, opts = {}) {
286367
286693
  const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
286368
286694
  let prompt2, schema2;
286369
286695
  try {
286370
- prompt2 = readFileSync193(resolve132(judgeDir, "JUDGE.md"), "utf8");
286371
- schema2 = readFileSync193(resolve132(judgeDir, "verdict.schema.json"), "utf8");
286696
+ prompt2 = readFileSync194(resolve133(judgeDir, "JUDGE.md"), "utf8");
286697
+ schema2 = readFileSync194(resolve133(judgeDir, "verdict.schema.json"), "utf8");
286372
286698
  } catch (e2) {
286373
286699
  return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
286374
286700
  }
@@ -286403,7 +286729,7 @@ var SOURCE_JUDGE_DIR, JUDGE_MODEL, spawnProcess, cannotTell, SEVERITY, worse, VE
286403
286729
  var init_judge = __esm({
286404
286730
  "src/fidelity/judge.ts"() {
286405
286731
  init_define_HHP_CATALOG();
286406
- SOURCE_JUDGE_DIR = resolve132(dirname91(fileURLToPath44(import.meta.url)), "../../../judges/fidelity");
286732
+ SOURCE_JUDGE_DIR = resolve133(dirname91(fileURLToPath44(import.meta.url)), "../../../judges/fidelity");
286407
286733
  JUDGE_MODEL = "claude-sonnet-5-5";
286408
286734
  spawnProcess = (cmd, args, { cwd, input, timeoutMs }) => new Promise((done) => {
286409
286735
  let stdout = "", stderr = "", timedOut = false;
@@ -286501,13 +286827,13 @@ var runProcess;
286501
286827
  var init_score = __esm({
286502
286828
  "src/fidelity/score.ts"() {
286503
286829
  init_define_HHP_CATALOG();
286504
- runProcess = (cmd, args) => new Promise((resolve134, reject) => {
286830
+ runProcess = (cmd, args) => new Promise((resolve135, reject) => {
286505
286831
  const child3 = spawn11(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
286506
286832
  let stdout = "", stderr = "";
286507
286833
  child3.stdout.on("data", (d2) => stdout += d2);
286508
286834
  child3.stderr.on("data", (d2) => stderr += d2);
286509
286835
  child3.on("error", reject);
286510
- child3.on("close", (code3) => resolve134({ code: code3 ?? 1, stdout, stderr }));
286836
+ child3.on("close", (code3) => resolve135({ code: code3 ?? 1, stdout, stderr }));
286511
286837
  });
286512
286838
  }
286513
286839
  });
@@ -286800,7 +287126,7 @@ __export(native_exports, {
286800
287126
  screenLink: () => screenLink
286801
287127
  });
286802
287128
  import { spawn as spawn12 } from "node:child_process";
286803
- import { readFileSync as readFileSync194, writeFileSync as writeFileSync84 } from "node:fs";
287129
+ import { readFileSync as readFileSync195, writeFileSync as writeFileSync84 } from "node:fs";
286804
287130
  import { join as join211 } from "node:path";
286805
287131
  function resumedPackages(dumpsys) {
286806
287132
  const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
@@ -286812,22 +287138,22 @@ function focusedWindow(dumpsys) {
286812
287138
  return m2?.[1]?.trim();
286813
287139
  }
286814
287140
  function runWithTimeout(cmd, args, timeoutMs) {
286815
- return new Promise((resolve134) => {
287141
+ return new Promise((resolve135) => {
286816
287142
  const child3 = spawn12(cmd, args, { stdio: ["ignore", "pipe", "ignore"] });
286817
287143
  const chunks = [];
286818
287144
  const timer = setTimeout(() => {
286819
287145
  child3.kill("SIGKILL");
286820
287146
  child3.stdout.destroy();
286821
- resolve134({ code: 124, stdout: Buffer.concat(chunks), timedOut: true });
287147
+ resolve135({ code: 124, stdout: Buffer.concat(chunks), timedOut: true });
286822
287148
  }, timeoutMs);
286823
287149
  child3.stdout.on("data", (c2) => chunks.push(c2));
286824
287150
  child3.on("error", () => {
286825
287151
  clearTimeout(timer);
286826
- resolve134({ code: 127, stdout: Buffer.alloc(0) });
287152
+ resolve135({ code: 127, stdout: Buffer.alloc(0) });
286827
287153
  });
286828
287154
  child3.on("close", (code3) => {
286829
287155
  clearTimeout(timer);
286830
- resolve134({ code: code3 ?? 1, stdout: Buffer.concat(chunks) });
287156
+ resolve135({ code: code3 ?? 1, stdout: Buffer.concat(chunks) });
286831
287157
  });
286832
287158
  });
286833
287159
  }
@@ -286856,7 +287182,7 @@ function nativeCapture(devices, opts) {
286856
287182
  return r3;
286857
287183
  };
286858
287184
  const gone = /* @__PURE__ */ new Set();
286859
- const read2 = opts.readFile ?? ((p2) => readFileSync194(p2));
287185
+ const read2 = opts.readFile ?? ((p2) => readFileSync195(p2));
286860
287186
  const sleep4 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
286861
287187
  const settleMs = opts.settleMs ?? 1e3;
286862
287188
  const maxWaitMs = opts.maxWaitMs ?? 3e4;
@@ -287417,7 +287743,7 @@ async function publishSizeCommand(ctx) {
287417
287743
  log: line => process.stdout.write(line + '\\n'),
287418
287744
  error: line => process.stderr.write(line + '\\n')
287419
287745
  });`;
287420
- const result = await new Promise((resolve134) => {
287746
+ const result = await new Promise((resolve135) => {
287421
287747
  execFile8(process.execPath, [
287422
287748
  ...entry.pathname.endsWith(".ts") ? ["--import", import.meta.resolve("tsx")] : [],
287423
287749
  "--input-type=module",
@@ -287426,7 +287752,7 @@ async function publishSizeCommand(ctx) {
287426
287752
  JSON.stringify(ctx.argv),
287427
287753
  entry.href
287428
287754
  ], { env: { ...process.env, HIMI_PUBLISH_SIZE_WORKER: "1" }, maxBuffer: 4 * 1024 * 1024 }, (error, stdout, stderr) => {
287429
- resolve134({ code: error ? typeof error.code === "number" ? error.code : 1 : 0, stdout, stderr });
287755
+ resolve135({ code: error ? typeof error.code === "number" ? error.code : 1 : 0, stdout, stderr });
287430
287756
  });
287431
287757
  });
287432
287758
  try {
@@ -287578,7 +287904,7 @@ __export(ext_impl_exports, {
287578
287904
  addExtensionToConfigSource: () => addExtensionToConfigSource,
287579
287905
  runExt: () => runExt
287580
287906
  });
287581
- import { existsSync as existsSync167, mkdirSync as mkdirSync73, readFileSync as readFileSync195, writeFileSync as writeFileSync85 } from "node:fs";
287907
+ import { existsSync as existsSync167, mkdirSync as mkdirSync73, readFileSync as readFileSync196, writeFileSync as writeFileSync85 } from "node:fs";
287582
287908
  import { join as join214 } from "node:path";
287583
287909
  import ts33 from "typescript";
287584
287910
  async function runExt(ctx) {
@@ -287687,9 +288013,9 @@ async function runExt(ctx) {
287687
288013
  return 0;
287688
288014
  }
287689
288015
  function loadModelFor(extDir) {
287690
- const parsed = parseExtensionManifest(JSON.parse(readFileSync195(join214(extDir, EXTENSION_MANIFEST), "utf8")));
288016
+ const parsed = parseExtensionManifest(JSON.parse(readFileSync196(join214(extDir, EXTENSION_MANIFEST), "utf8")));
287691
288017
  if (!parsed.ok) return { ok: false, message: parsed.problems.map((p2) => p2.message).join("; ") };
287692
- const iface = parseExtensionInterface(readFileSync195(join214(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
288018
+ const iface = parseExtensionInterface(readFileSync196(join214(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
287693
288019
  if (!iface.ok) return { ok: false, message: iface.problems.map((p2) => p2.message).join("; ") };
287694
288020
  return { ok: true, model: iface.model };
287695
288021
  }
@@ -287717,7 +288043,7 @@ function declaredExtensionsNode(app2) {
287717
288043
  return void 0;
287718
288044
  }
287719
288045
  function addToConfig(configPath, name) {
287720
- writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync195(configPath, "utf8"), name));
288046
+ writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync196(configPath, "utf8"), name));
287721
288047
  }
287722
288048
  function listExtensions(dir, print) {
287723
288049
  const prepared = prepareExtensions(dir, { write: false });
@@ -287853,7 +288179,7 @@ import { AsyncLocalStorage as AsyncLocalStorage4 } from "node:async_hooks";
287853
288179
  import { rmSync as rmSync55 } from "node:fs";
287854
288180
  import { spawn as spawn13 } from "node:child_process";
287855
288181
  import { homedir as homedir23 } from "node:os";
287856
- import { resolve as resolve133 } from "node:path";
288182
+ import { resolve as resolve134 } from "node:path";
287857
288183
  import { fileURLToPath as fileURLToPath45 } from "node:url";
287858
288184
 
287859
288185
  // src/cli-flags.ts
@@ -289084,7 +289410,7 @@ var COMMANDS = [
289084
289410
  { name: "logout", summary: "remove the stored control token for a target", required: "[--target <t>]" },
289085
289411
  { name: "connector", summary: "personal access tokens for the hosted MCP connector (Wix Native App Builder), for an AI tool that cannot sign in with OAuth (e.g. Base44's builder): `token create` opens a Wix sign-in page and prints a long-lived token once, to paste into the tool as `Authorization: Bearer <token>`; `token list` / `token revoke <id>` manage them with the `himi login --browser` token. The token can only build and publish DRAFTS.", required: "token create [--name <n>] [--days <1-90>] [--no-open] | token list | token revoke <id> [--target <t>]" },
289086
289412
  { name: "notify", summary: "Hosted --all-members requires --yes for a live send; --dry-run checks ownership/readiness and counts approved recipients without sending. `setup` optionally configures Branded/Ping from local customer key files (`--platforms android` for an Android-only app: no Apple key); `status --refresh` reads live backend readiness. Setup may be deferred while building. These use serve-control and require owner plus Wix account authentication. `send`, `tokens`, `doctor`: send a REAL push notification to registered devices (RFC 0036 WS5) \u2014 APNs .p8 over HTTP/2 for iOS, FCM v1 for Android. `send` targets one device (--token / --device <registry id>) or fans out to the whole app (--all), reporting a per-device result; a token the provider says is uninstalled (APNs 410 Unregistered / FCM UNREGISTERED) is auto-disabled, while a merely wrong one (BadDeviceToken \u2014 usually a sandbox/production mismatch) is recorded and left enabled. `tokens` lists the registry. `doctor` reports which credentials resolve and which sender each platform picks. Talks to the admin-server via --admin-url/HIMALAYA_ADMIN_URL, authenticated with --admin-session/HIMALAYA_ADMIN_SESSION. `send --provider ping` is the hosted alternative: the serve plane sends to one site member (--member-email) or all approved members (--all-members) through Ping as Himalaya, with owner login instead of provider keys, and reports acceptance, never delivery. NOT `himi push`, which publishes a release.", required: "setup|status [--content <dir>] [--target <t>] [--platforms ios|android|ios,android] [--refresh] [--yes] [--no-push-setup] | send --provider ping [--content <dir>] [--app <a>] [--site <msid>] (--member-email <email> | --all-members (--dry-run | --yes)) --title <s> [--body <s>] --link <url> [--request-id <uuid>] [--dry-run] [--json] | send|tokens|doctor [--app <a>] [--token <t> | --device <id> | --all] [--title <s>] [--body <s>] [--link <url>] [--platform ios|android] [--badge <n>] [--channel <id>] [--silent] [--dry-run] [--json]" },
289087
- { name: "setup", summary: "`check`: one readiness report for an app's backend setup \u2014 `push` (the same check as `himi notify status`), `signIn` (member Apple, Google iOS and Google Android sign-in, read from the site's Branded record) and `iap` (the same check as `himi store iap check`, run only with --iap-manifest; without it the section is `not_checked`). Each section has `ok`: true when ready, false when something is missing or wrong (with a `code` and a fix), null when it could not be verified \u2014 listed under `unverified`, never counted as ready. The top-level `ok` is false when any section is false; exit 0 when ok, 1 when not, 2 for bad input (`invalid_setup_area`, `iap_manifest_required`). `--only push,signin,iap` limits it to those areas; `--refresh` reads live backend readiness. Read-only. Needs owner plus Wix account authentication, like `notify status`.", required: "check [--content <dir>] [--target <t>] [--refresh] [--only push,signin,iap] [--iap-manifest <file> --catalog-route <path> [--purchases-app <id>] [--plist <Info.plist>]]" },
289413
+ { name: "setup", summary: "`check`: one readiness report for an app's backend setup \u2014 `push` (the same check as `himi notify status`), `signIn` (member Apple, Google iOS and Google Android sign-in, read from the site's Branded record) `iap` (the same check as `himi store iap check`, run only with --iap-manifest; without it the section is `not_checked`), `steps` (each server setup step \u2014 app-identity, apns, apple-signing, firebase, android-signin, ping-readback \u2014 with its state and last error; false only when a step needs attention) and `iapSetup` (the IAP setup steps \u2014 asc-key, purchases-app, iap-key, payment-provider \u2014 read without a manifest; the provider stays unverified because nothing can read it). The table of every step is in `himi docs push-cli-onboarding`. Each section has `ok`: true when ready, false when something is missing or wrong (with a `code` and a fix), null when it could not be verified \u2014 listed under `unverified`, never counted as ready. The top-level `ok` is false when any section is false; exit 0 when ok, 1 when not, 2 for bad input (`invalid_setup_area`, `iap_manifest_required`). `--only push,signin,iap` limits it to those areas; `--refresh` reads live backend readiness. Read-only. Needs owner plus Wix account authentication, like `notify status`.", required: "check [--content <dir>] [--target <t>] [--refresh] [--only push,signin,iap] [--iap-manifest <file> --catalog-route <path> [--purchases-app <id>] [--plist <Info.plist>]]" },
289088
289414
  { name: "signing", summary: "READ-ONLY App Store Connect inventory for customer BYO TestFlight readiness. `inspect` lists whether the bundle id, distribution certificate, IOS_APP_STORE profile, and ASC app record exist for --bundle-id / --team-id using a local ASC .p8 (flags or ASC_KEY_* env). Never uploads or mutates Apple resources. Optional --cert-file/--profile-file classify on-disk material.", required: "inspect --bundle-id <id> --team-id <id> --asc-key-file <path> --asc-key-id <id> --asc-issuer-id <id> [--cert-file <p12> --cert-password <pw> --profile-file <mobileprovision>] [--json]" },
289089
289415
  { name: "site", summary: "PROVISION a Wix project, then analyze or extend it. `create` is the one door that makes a site instead of adopting one: POST /funnel/projects/v1/create (a WIX site, a HEADLESS backend, a BRANDED_APP, or a VIBE site), and for headless it also mints the OAuth app whose id IS the `WIX_CLIENT_ID` \u2014 with --redirect-uri already registered, because an unregistered redirect makes native signInDirect fail at redirect-session. `--verticals` REQUIRES `--template` and reports only what Wix confirmed: measured, installing onto a project created from the BLANK template returns 200 while the vertical's API answers 428 forever, because there is no site for it to attach to (the install asks for CREATE_SITE). A real template ships its verticals installed and populated, and installing further ones onto it then works. It MUTATES your Wix account and needs --yes; without it you get the payload and nothing is sent. `list` is the read-only site inventory (with each site's premium flag, which is what explains an installed-but-428 vertical). Auth is the account-scoped `wix token` (no --site), falling back to WIX_API_KEY + WIX_ACCOUNT_ID. `client` is the same OAuth step for a site that ALREADY exists \u2014 the one himi adopts rather than makes \u2014 so a clientId no longer means a manual trip to the dashboard: `client ensure` reconciles rather than mints, because a site can already carry a client with NO registered redirect and shipping that one fails signInDirect at runtime; it reuses a client that carries --redirect-uri, PATCHes one that matches --name but lacks it (unioning, so another app's redirect survives), and creates only when there is nothing to reuse (--new forces a fresh one). --name IS the idempotency key. `client` auth is SITE-scoped (WIX_API_KEY, else the owner's account token in WIX_TOKEN exchanged for that site, else `wix token --site <msid>`) because minting is owner-of-that-site, and --yes gates every mutation: a site that already has a usable client resolves WITHOUT it, but --write-provisioning needs --yes even then because it rewrites a manifest on disk (the dry run's planned.provisioning names the file). That query endpoint IGNORES paging (measured: query.paging, cursorPaging and a top-level paging all return the full set at offset 0), so when pagingMetadata reports more clients than came back, `ensure` REFUSES EVERY outcome \u2014 create, patch AND reuse. Reuse is refused too because pickClient breaks ties on the OLDEST createdDate, so an omitted older same-named MOBILE client with the same redirect would win a later complete read and the resolved clientId would MOVE between runs \u2014 and it gets written into provisioning.json; convergence is what makes a stray duplicate untidy rather than harmful. --name cannot narrow the query (no filter is sent; the name is applied to the rows after they arrive), so the recovery is the dashboard; --new skips the query entirely. A `patched` result is verified against what Wix STORED \u2014 the redirect list is read off the PATCH response, and re-read via GET when the response omits it, because falling back to the list himi just sent would make the guard pass vacuously on exactly the silent no-op it exists to catch. `client list` is the read-only inventory of a site's clients: act on its `shippable` column rather than `hasRedirect`, because shippable ALSO requires a MOBILE applicationType and `ensure` refuses a WEB client \u2014 a WEB one carrying your redirect looks right and is not a candidate \u2014 and it sets truncated:true rather than presenting a partial inventory as the whole one. `analyze --read-only` returns API-only generation context as JSON (identity, access probes, CMS permissions and selected redacted Velo source); it needs no browser and never uploads or applies anything. A URL is optional there: `--url` lets it read the published page's Velo code-app ids (credential-free, pinned transport) so the backend source is found on sites where the owner code-app probe 404s. `analyze` reads a site into a business-book folder (REST + Playwright, GET-only); `--url` alone is the visitor-only pass over the published pages, and `--client-id` adds the vertical probes and the app binding `--apply` requires; with no Playwright/Chromium it refuses before any work (code \"browser_unavailable\", the install command in `fix`) unless `--no-browser` asks for the static-HTML-only pass; `site function` list/get/put/publish/invokes that site's Velo HTTP functions and is not `himi functions` (serve-plane jobs). `--apply` bakes into a brandable shell (a site shell needs no `--client-id`: it is visitor-only and binds no client); `--shell` takes the same names `himi dist --shell` does and defaults to branded-lite, and a shell that ships no prepare:customer is refused by name rather than half-built. A site shell (RFC 0062) \u2014 a target whose contract has a `site` block, whatever the shell is called: `--shell brandy` in the repo, or off-repo a content package whose provisioning.json names the website \u2014 also derives the site's page map from its published pages and header menu \u2014 Home first, up to four tabs for the pages a visitor returns to, the rest in the drawer \u2014 into the overlay's `site` block, so it can be edited before `--apply`; only a site shell ever receives that block, and a branded-lite target without one stays a native app. It never overwrites any shell's committed apps/<shell>/provisioning.json. `member-app set|clear|show <msid>` is the site's member app in Spaces (#4091): the himi app the site's members open in Spaces Lite instead of Branded Lite. `set --app <id>` takes the site's own app or one your account owns (an owned app not yet tied to the site is linked first; another account's app is refused, 403); `clear` returns the site to Branded Lite; `show` prints the pick plus the COMPUTED verdict \u2014 the picked release's requirements judged against the Spaces host manifest (checkHostCompatibility, `--platform` to judge one phone platform) \u2014 and `reason` when it falls back to Branded Lite. Auth is your `himi login` control token plus the account `wix token`, which the plane uses to verify you own the site.", required: "create <name> [--type wix|headless|branded-app|vibe] [--template <guid>] [--verticals stores,bookings,\u2026] [--folder <guid>] [--redirect-uri <uri>] [--no-oauth-app] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | list | client ensure|list --site <msid> [--name <name>] [--redirect-uri <uri>] [--new] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | analyze --read-only [--site <msid>] [--client-id <id>] [--url <https>] [--json] | analyze --url <https> [--client-id <id>] [--site <msid>] [--out <dir>] [--redirect-uri <uri>] [--apply [--site-pages] [--dry-run]] [--no-browser] [--shell " + SHELL_ENUM + "] | function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET|POST|PUT|DELETE] [--source <file>] [--body <json>] [--publish] [--invoke] | member-app set|clear|show <msid> [--app <id>] [--platform ios|android]" },
289090
289416
  { name: "base44", summary: "read a BASE44 app into an app book (book.json + BOOK.md) for the agent building a Himi app from it \u2014 the Base44 counterpart of `site analyze`, READ-ONLY. `analyze --url <published app>` is the VISITOR pass: the app id, name, favicon and colours from the published SPA, its router paths, and screenshots + look tokens from the Playwright crawl. `analyze --app-id <id>` adds the OWNER pass and needs a session: the project source under <out>/source/ (the read half of `base44 eject` \u2014 GET api/apps/<id>/eject \u2014 through the same deny-list and secret scan `himi push` uses, widened by the book's token shapes; `eject` itself is never run because it CREATES a copy of the app), every entity's JSON schema, required fields and RLS rules with up to --sample redacted rows (default 5, 0 = off), backend functions, agents, connectors (names and scopes only, never tokens), secret NAMES (never values), auth visibility + providers, and the route \u2192 component \u2192 entities map from the source router. Every chapter it could not read is listed in `gaps` rather than failing the run. `login` runs Base44's device sign-in and stores the session in ~/.himi/base44/session.json (never the repo; --from-base44-cli imports `npx base44 login`'s session instead); BASE44_ACCESS_TOKEN in the environment wins, for CI. `whoami` prints who is signed in (never the token); `logout` removes the stored session. `auth-check --url <tenant> --ios-app-id <PREFIX.bundle.id>` and/or `--android-package <package> --android-sha256 <fingerprint>` checks public native-login associations and prints missing entries; it never reads an owner token. --json prints the book itself. himi docs base44-app-context. `adopt` turns the book into a reviewable base44-entities.ts of ADOPTED entity + function declarations for config.ts (never edits config.ts, never overwrites); `entities query` is READ-ONLY and reports, per declared entity, ownership, row count and schema drift against the live app, plus foreign entities. `entities create` provisions the app's OWNED Himi<App>* entities: Base44's schema write is a destructive full-set sync, so the single PUT carries every entity in a freshly read eject snapshot (foreign ones verbatim) and the run refuses BEFORE sending when one would be dropped, the snapshot is unreadable or empty, or it moved since the plan; removing an owned field/entity needs --allow-destructive, rewriting owned RLS needs --apply-permissions. `entities seed` bulk-inserts seed rows into empty owned entities only (--ai writes base44-seed.json offline). `functions deploy` ships owned functions one PUT each, never the bulk sync or DELETE, and refuses a name deployed by someone else. All three print a plan and write only with --yes, which needs a `login --write` (apps:write) session. `types` writes tier5-src/_shared/base44-entities.ts \u2014 a row type and a typed `entities<Row>()` handle per declared entity, byte-stable \u2014 and `himi validate` reports base44-types-stale when that file falls behind the block (nothing when it is absent). himi docs base44-entities. `screens` (base44-starter packages) writes one generated list + detail screen per declared entity over the template's shared engine, with write controls gated by the entity's rls; an unchanged config reports every file `unchanged`, a hand-edited generated file is `skipped-edited` unless --force; never calls Base44. himi docs base44-app-to-himi-app", required: "analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | adopt [--book .himi/base44-book] [--entities A,B] [--write [path]] [--json] | entities query [--content <dir>] [--all] [--json] | entities create [--app <a>] [--yes] [--allow-destructive] [--apply-permissions] [--empty-app-ok] | entities seed [--app <a>] [--yes] [--only A,B] [--ai] | functions deploy [--app <a>] [--yes] [--only a,b] | types [--content <dir>] [--json] | screens [--content <dir>] [--force] [--dry-run] [--json] | login [--write] [--from-base44-cli] | whoami | logout | auth-check --url <https://tenant> [--ios-app-id <PREFIX.bundle.id>] [--android-package <package> --android-sha256 <fingerprint>]" },
@@ -289252,8 +289578,8 @@ async function resolveFromUrl(ctx) {
289252
289578
  const { pixelToolchainAvailable: pixelToolchainAvailable2 } = await Promise.resolve().then(() => (init_icon(), icon_exports));
289253
289579
  if (await pixelToolchainAvailable2()) {
289254
289580
  const { sourceImageMinEdge: sourceImageMinEdge2 } = await Promise.resolve().then(() => (init_pixels(), pixels_exports));
289255
- const { readFileSync: readFileSync196 } = await import("node:fs");
289256
- if (await sourceImageMinEdge2(readFileSync196(spec.icon)) === null) {
289581
+ const { readFileSync: readFileSync197 } = await import("node:fs");
289582
+ if (await sourceImageMinEdge2(readFileSync197(spec.icon)) === null) {
289257
289583
  throw new FromUrlError2("app_spec_invalid", `app spec: icon ${spec.icon} is not an image this CLI can read \u2014 supply a PNG or JPEG, ideally 1024x1024`);
289258
289584
  }
289259
289585
  }
@@ -290269,17 +290595,17 @@ async function buildCommand(ctx) {
290269
290595
  const dir = contentDir(flags);
290270
290596
  const { buildContentBundles: buildContentBundles2 } = await loadAuthoring();
290271
290597
  const res = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
290272
- const failed3 = res.compileErrors;
290598
+ const failed2 = res.compileErrors;
290273
290599
  print({
290274
- ok: failed3.length === 0,
290600
+ ok: failed2.length === 0,
290275
290601
  outDir: res.outDir,
290276
290602
  built: res.built,
290277
- ...failed3.length ? { compileErrors: failed3 } : {},
290603
+ ...failed2.length ? { compileErrors: failed2 } : {},
290278
290604
  // #642.1b — a stale @wix/himalaya is advisory on `build` (the bundles may
290279
290605
  // still compile); `validate --strict` is where it hard-fails.
290280
290606
  ...res.sdkVersionIssue || res.staleShared ? { warnings: [...res.sdkVersionIssue ? [res.sdkVersionIssue] : [], ...res.staleShared ? [res.staleShared] : []] } : {}
290281
290607
  });
290282
- return failed3.length ? 1 : 0;
290608
+ return failed2.length ? 1 : 0;
290283
290609
  }
290284
290610
 
290285
290611
  // src/commands/eject.ts
@@ -291194,13 +291520,13 @@ async function testCommand(ctx) {
291194
291520
  return 2;
291195
291521
  }
291196
291522
  nativeAvailabilities = platforms.map((platform) => platform === "ios" ? detectNativeDecode2() : detectAndroidNativeDecode2());
291197
- const unavailable = nativeAvailabilities.filter((availability) => !availability.available);
291198
- if (flags.native !== true && unavailable.length > 0) {
291199
- io2.error(JSON.stringify({ error: `--native ${unavailable[0].platform} unavailable: ${unavailable[0].reason}` }));
291523
+ const unavailable2 = nativeAvailabilities.filter((availability) => !availability.available);
291524
+ if (flags.native !== true && unavailable2.length > 0) {
291525
+ io2.error(JSON.stringify({ error: `--native ${unavailable2[0].platform} unavailable: ${unavailable2[0].reason}` }));
291200
291526
  return 2;
291201
291527
  }
291202
291528
  if (nativeAvailabilities.every((availability) => !availability.available)) {
291203
- io2.error(JSON.stringify({ error: `--native unavailable: ${unavailable.map((item2) => `${item2.platform}: ${item2.reason}`).join("; ")}` }));
291529
+ io2.error(JSON.stringify({ error: `--native unavailable: ${unavailable2.map((item2) => `${item2.platform}: ${item2.reason}`).join("; ")}` }));
291204
291530
  return 2;
291205
291531
  }
291206
291532
  }
@@ -292032,8 +292358,8 @@ function pushAuthHint(status2, token, target, hasOwnerIssuer = true) {
292032
292358
  }
292033
292359
  async function contentVisibility(dir) {
292034
292360
  try {
292035
- const { readFileSync: readFileSync196 } = await import("node:fs");
292036
- const m2 = JSON.parse(readFileSync196(join161(dir, "himalaya.content.json"), "utf8"));
292361
+ const { readFileSync: readFileSync197 } = await import("node:fs");
292362
+ const m2 = JSON.parse(readFileSync197(join161(dir, "himalaya.content.json"), "utf8"));
292037
292363
  if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
292038
292364
  } catch {
292039
292365
  }
@@ -293436,9 +293762,9 @@ async function runPackageCommand(ctx) {
293436
293762
  });
293437
293763
  await announce(run4);
293438
293764
  print({ ok: true, app: run4.app, url: run4.url, port: run4.port, plane: "browser" });
293439
- await new Promise((resolve134) => {
293765
+ await new Promise((resolve135) => {
293440
293766
  const stop2 = () => {
293441
- void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run4.close().finally(() => resolve134()));
293767
+ void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run4.close().finally(() => resolve135()));
293442
293768
  };
293443
293769
  dropEarlySignals?.();
293444
293770
  process.once("SIGINT", stop2);
@@ -293481,7 +293807,7 @@ async function runPackageCommand(ctx) {
293481
293807
  const live4 = join167(running.releaseRoot, running.app);
293482
293808
  const manifestOf = (tree) => JSON.parse(readFileSync155(join167(tree, "release-manifest.json"), "utf8"));
293483
293809
  let current = manifestOf(live4);
293484
- const failed3 = async (message5) => {
293810
+ const failed2 = async (message5) => {
293485
293811
  if (stopping) return;
293486
293812
  bus.publish("build.failed", { message: message5 });
293487
293813
  record5(running, { ok: false, at: (/* @__PURE__ */ new Date()).toISOString(), error: message5 });
@@ -293496,14 +293822,14 @@ async function runPackageCommand(ctx) {
293496
293822
  if (bres.compileErrors.length) {
293497
293823
  const first = bres.compileErrors[0];
293498
293824
  const diag = first.errors[0];
293499
- await failed3(`${first.bundle}: ${diag ? `${diag.file ? `${diag.file}${diag.line ? `:${diag.line}` : ""} ` : ""}${diag.text}` : "did not compile"}`);
293825
+ await failed2(`${first.bundle}: ${diag ? `${diag.file ? `${diag.file}${diag.line ? `:${diag.line}` : ""} ` : ""}${diag.text}` : "did not compile"}`);
293500
293826
  return;
293501
293827
  }
293502
293828
  const hasWorkers = bres.built.length > 0;
293503
293829
  const outcome = await buildReleaseFromContent2(dir, next, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {}, freshModule: true, ...RUN_CONTENT_BUILD2 });
293504
293830
  const blocker = watchKit.rebuildBlocker(outcome, servedMissing);
293505
293831
  if (blocker) {
293506
- await failed3(blocker);
293832
+ await failed2(blocker);
293507
293833
  return;
293508
293834
  }
293509
293835
  if (stopping) return;
@@ -293526,7 +293852,7 @@ async function runPackageCommand(ctx) {
293526
293852
  await refreshBoard();
293527
293853
  io2.error(JSON.stringify({ watch: "rebuilt", ms: Date.now() - t0, screens: diff.screens, tokens: diff.tokens, config: diff.config, ...changes.items.length ? { changed: headline2(changes), changes } : {}, tabs: bus.listeners }));
293528
293854
  } catch (e2) {
293529
- await failed3(e2.message.split("\n")[0]);
293855
+ await failed2(e2.message.split("\n")[0]);
293530
293856
  } finally {
293531
293857
  rmSync39(next, { recursive: true, force: true });
293532
293858
  }
@@ -298184,7 +298510,11 @@ async function setupCommand(ctx) {
298184
298510
  return runSetupCheck2(flags, io2, {
298185
298511
  pushStatus: async (sub, subIo) => {
298186
298512
  const { runNotifySetup: runNotifySetup2 } = await Promise.resolve().then(() => (init_notify_setup(), notify_setup_exports));
298187
- return runNotifySetup2(["notify", "status"], sub, subIo, { withSignIn: true });
298513
+ return runNotifySetup2(["notify", "status"], sub, subIo, { withSignIn: true, withSteps: true });
298514
+ },
298515
+ iapSetup: async (sub, subIo) => {
298516
+ const { runIapSetupCheck: runIapSetupCheck2 } = await Promise.resolve().then(() => (init_check2(), check_exports));
298517
+ return runIapSetupCheck2(sub, subIo);
298188
298518
  },
298189
298519
  iapCheck: async (sub, subIo) => {
298190
298520
  const { runStoreIap: runStoreIap2, defaultStoreIapDeps: defaultStoreIapDeps2 } = await Promise.resolve().then(() => (init_store_iap(), store_iap_exports));
@@ -298289,7 +298619,7 @@ import {
298289
298619
  lstatSync as lstatSync40,
298290
298620
  mkdirSync as mkdirSync62,
298291
298621
  openSync as openSync13,
298292
- readFileSync as readFileSync175,
298622
+ readFileSync as readFileSync176,
298293
298623
  readdirSync as readdirSync65,
298294
298624
  realpathSync as realpathSync23,
298295
298625
  renameSync as renameSync26,
@@ -298297,7 +298627,7 @@ import {
298297
298627
  statSync as statSync51,
298298
298628
  writeFileSync as writeFileSync68
298299
298629
  } from "node:fs";
298300
- import { basename as basename41, dirname as dirname84, join as join187, relative as relative37, resolve as resolve120 } from "node:path";
298630
+ import { basename as basename41, dirname as dirname84, join as join187, relative as relative37, resolve as resolve121 } from "node:path";
298301
298631
  var L10N_USAGE = "usage: himi l10n import --format oneapp <dir> (--app <slug> | --content <app dir>) [--locales en,he] [--source en] [--overwrite] [--json]";
298302
298632
  var MESSAGES_FILE = /^messages_(.+)\.json$/;
298303
298633
  var UnsafePath = class extends Error {
@@ -298310,7 +298640,7 @@ function readRegularFile(path2) {
298310
298640
  const fd = openSync13(path2, constants12.O_RDONLY | (constants12.O_NOFOLLOW ?? 0));
298311
298641
  try {
298312
298642
  if (!fstatSync4(fd).isFile()) throw new Error(`${path2} is not a regular file`);
298313
- return readFileSync175(fd);
298643
+ return readFileSync176(fd);
298314
298644
  } finally {
298315
298645
  closeSync14(fd);
298316
298646
  }
@@ -298370,7 +298700,7 @@ async function l10nCommand(ctx) {
298370
298700
  if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) {
298371
298701
  return fail16("app_not_found", { error: `--app ${slug}: an app slug, not a path`, hint: "pass --content <app dir> to target a directory" }, 2);
298372
298702
  }
298373
- const dir = resolve120("apps", slug);
298703
+ const dir = resolve121("apps", slug);
298374
298704
  if (!existsSync145(join187(dir, "config.ts")) && !existsSync145(join187(dir, "config.js")) && !existsSync145(join187(dir, "config.mjs"))) {
298375
298705
  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);
298376
298706
  }
@@ -298379,7 +298709,7 @@ async function l10nCommand(ctx) {
298379
298709
  } else {
298380
298710
  return fail16("invalid_usage", { error: "name the app: --app <slug> (in a checkout) or --content <app dir>" }, 2);
298381
298711
  }
298382
- const messagesDir = resolve120(dirArg);
298712
+ const messagesDir = resolve121(dirArg);
298383
298713
  if (!existsSync145(messagesDir) || !statSync51(messagesDir).isDirectory()) {
298384
298714
  return fail16("messages_dir_not_found", { error: `${dirArg} is not a directory`, dir: messagesDir }, 1);
298385
298715
  }
@@ -298586,7 +298916,7 @@ async function l10nCommand(ctx) {
298586
298916
  init_define_HHP_CATALOG();
298587
298917
  init_cli_shared();
298588
298918
  import { existsSync as existsSync153 } from "node:fs";
298589
- import { join as join196, resolve as resolve124 } from "node:path";
298919
+ import { join as join196, resolve as resolve125 } from "node:path";
298590
298920
  async function base44Command(ctx) {
298591
298921
  const { io: io2, pos, flags, print } = ctx;
298592
298922
  if (pos[1] === "auth-check") {
@@ -298742,7 +299072,7 @@ async function base44Command(ctx) {
298742
299072
  const slug = str3(flags.app);
298743
299073
  if (!provisioning || str3(flags.content) !== void 0 || !slug) return contentDir(flags);
298744
299074
  if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return void 0;
298745
- const dir = resolve124("apps", slug);
299075
+ const dir = resolve125("apps", slug);
298746
299076
  return existsSync153(join196(dir, "config.ts")) || existsSync153(join196(dir, "config.mjs")) ? dir : void 0;
298747
299077
  };
298748
299078
  if (sub === "entities" || sub === "functions") {
@@ -299232,7 +299562,7 @@ function createTrimValidator(deps = {}, spawnFn = spawn13) {
299232
299562
  return { code: code3, counts, ...errors ? { errors } : {}, ...code3 !== 0 ? { tail: said.slice(-4e3) } : {} };
299233
299563
  };
299234
299564
  return async (dir, opts = {}) => {
299235
- const argv = ["validate", "--content", resolve133(dir), "--strict", "--skip-version-check"];
299565
+ const argv = ["validate", "--content", resolve134(dir), "--strict", "--skip-version-check"];
299236
299566
  if (!opts.fresh) {
299237
299567
  const out2 = [];
299238
299568
  const err = [];