@wix/himalaya-cli 0.1370.0 → 0.1371.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
@@ -33226,7 +33226,89 @@ function wixClientIdOf(appConfigJson) {
33226
33226
  if (typeof clientId !== "string" || !clientId) return { error: "no_client_id" };
33227
33227
  return { clientId };
33228
33228
  }
33229
- var WIX_API, ONE_APP_SESSION, OWNER_SCOPED_WIX_HOST, WIX_FORWARDABLE_HEADERS, OWNER_REFRESH_MARGIN_MS, OWNER_RENEW_MIN_AGE_MS, OWNER_MINT_TIMEOUT_MS, OwnerInstanceCache, OWNER_SITES_QUERY_PATH, OWNER_SITES_COUNT_PATH, OwnerSitesCache;
33229
+ function isForwardableWixSessionCookie(name) {
33230
+ return name === "wixSession2" || name.startsWith("session3") || name === "XSRF-TOKEN" || name === "petri_ovr" || name.toLowerCase() === "svsession" || name === "wixUIDX";
33231
+ }
33232
+ function forwardableWixSessionCookies(cookieHeader) {
33233
+ const pairs = (cookieHeader ?? "").split(/;\s*/).filter((pair) => {
33234
+ const eq = pair.indexOf("=");
33235
+ return eq > 0 && isForwardableWixSessionCookie(pair.slice(0, eq).trim());
33236
+ });
33237
+ return pairs.some((pair) => pair.startsWith("wixSession2=")) ? pairs.join("; ") : "";
33238
+ }
33239
+ function wixAccountSignInUrl(postLogin) {
33240
+ const signIn = new URL("https://users.wix.com/signin");
33241
+ signIn.searchParams.set("postLogin", postLogin);
33242
+ return signIn.toString();
33243
+ }
33244
+ function allowedAccountTarget(method, url) {
33245
+ let target;
33246
+ try {
33247
+ target = new URL(url);
33248
+ } catch {
33249
+ return null;
33250
+ }
33251
+ if (target.protocol !== "https:" || target.port !== "" && target.port !== "443" || target.username || target.password) return null;
33252
+ const host = target.hostname.toLowerCase();
33253
+ const verb = method.toUpperCase();
33254
+ return ACCOUNT_FORWARD_ALLOWLIST.some((e2) => e2.host === host && e2.method === verb && e2.path === target.pathname) ? target : null;
33255
+ }
33256
+ function isAccountJoinCall(method, url) {
33257
+ const target = allowedAccountTarget(method, url);
33258
+ return !!target && ACCOUNT_JOIN_PATHS.has(target.pathname);
33259
+ }
33260
+ async function wixAccountCall(method, url, body, sessionCookie, fetchImpl = fetch, forwardedHeaders = {}, memberInstance) {
33261
+ const target = allowedAccountTarget(method, url);
33262
+ if (!target) throw new Error("not an allowlisted account endpoint");
33263
+ const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(sessionCookie)?.[1];
33264
+ const res = await fetchImpl(target.toString(), {
33265
+ method: method.toUpperCase(),
33266
+ headers: {
33267
+ ...forwardedHeaders,
33268
+ Cookie: sessionCookie,
33269
+ Accept: "application/json",
33270
+ ...xsrf ? { "x-xsrf-token": xsrf } : {},
33271
+ ...memberInstance ? { Authorization: memberInstance } : {},
33272
+ ...body ? { "Content-Type": "application/json" } : {}
33273
+ },
33274
+ body: method.toUpperCase() === "GET" || method.toUpperCase() === "HEAD" ? void 0 : body,
33275
+ redirect: "manual"
33276
+ });
33277
+ return { status: res.status, body: await res.text() };
33278
+ }
33279
+ function instancePayload(instance) {
33280
+ const part = instance.split(".")[1];
33281
+ if (!part) return null;
33282
+ try {
33283
+ const b64 = part.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(part.length / 4) * 4, "=");
33284
+ const parsed = JSON.parse(decodeURIComponent(Array.from(atob(b64), (c2) => `%${c2.charCodeAt(0).toString(16).padStart(2, "0")}`).join("")));
33285
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
33286
+ } catch {
33287
+ return null;
33288
+ }
33289
+ }
33290
+ function memberInstanceRejection(instance, metaSiteId) {
33291
+ const p2 = instancePayload(instance);
33292
+ if (!p2) return "undecodable instance";
33293
+ if (typeof p2.metaSiteId !== "string" || !p2.metaSiteId) return "no metaSiteId";
33294
+ if (p2.metaSiteId !== metaSiteId) return "instance is for another site";
33295
+ if (typeof p2.siteMemberId !== "string" || !p2.siteMemberId) return "no siteMemberId";
33296
+ if (p2.uid !== p2.siteMemberId) return "uid is not the site member";
33297
+ if (p2.permissions !== void 0) return "a User instance, not a Member one";
33298
+ return null;
33299
+ }
33300
+ function memberInstanceRefreshAt(instance, now, fallbackMs = 12e4) {
33301
+ const raw = instancePayload(instance)?.expirationDate;
33302
+ const expiry = typeof raw === "string" ? Date.parse(raw) : NaN;
33303
+ return Number.isFinite(expiry) ? Math.max(now, expiry - MEMBER_REFRESH_MARGIN_MS) : now + fallbackMs;
33304
+ }
33305
+ function memberInstanceRefusal(e2) {
33306
+ if (e2 instanceof NotSiteMember) return { status: 403, body: { error: "NotSiteMember", metaSiteId: e2.metaSiteId, reason: e2.reason } };
33307
+ if (e2 instanceof AccountSessionExpired) return { status: 401, body: { error: "AccountSessionExpired", metaSiteId: e2.metaSiteId, reason: e2.reason } };
33308
+ if (e2 instanceof SiteInstanceUnavailable) return { status: 502, body: { error: "SiteInstanceUnavailable", metaSiteId: e2.metaSiteId, reason: e2.reason } };
33309
+ return { status: 502, body: { error: "SiteInstanceUnavailable" } };
33310
+ }
33311
+ var WIX_API, ONE_APP_SESSION, OWNER_SCOPED_WIX_HOST, WIX_FORWARDABLE_HEADERS, OWNER_REFRESH_MARGIN_MS, OWNER_RENEW_MIN_AGE_MS, OWNER_MINT_TIMEOUT_MS, OwnerInstanceCache, OWNER_SITES_QUERY_PATH, OWNER_SITES_COUNT_PATH, OwnerSitesCache, ACCOUNT_FORWARD_ALLOWLIST, ACCOUNT_JOIN_PATHS, NotSiteMember, AccountSessionExpired, SiteInstanceUnavailable, MEMBER_REFRESH_MARGIN_MS, MEMBER_NEGATIVE_TTL_MS, MEMBER_TRANSIENT_TTL_MS, MemberInstanceCache;
33230
33312
  var init_wix_bridge = __esm({
33231
33313
  "../../core/serve-runtime/src/wix-bridge.ts"() {
33232
33314
  init_sha256();
@@ -33375,6 +33457,166 @@ ${cookieHeader}`);
33375
33457
  this.cache.delete(this.key(cookieHeader, limit));
33376
33458
  }
33377
33459
  };
33460
+ ACCOUNT_FORWARD_ALLOWLIST = [
33461
+ // My Sites (my-sites.ts)
33462
+ { host: "apps.wix.com", method: "GET", path: "/_api/app-state/v1/user/state" },
33463
+ { host: "apps.wix.com", method: "GET", path: "/wixapp/api/v1/businesses/recent" },
33464
+ { host: "manage.wix.com", method: "POST", path: "/_serverless/mobile-apps-editor-middleware/spaces-businesses" },
33465
+ { host: "apps.wix.com", method: "GET", path: "/api/v1/mobile-platform-facade/business/pending" },
33466
+ { host: "apps.wix.com", method: "POST", path: "/api/v1/mobile-platform-facade/business/pinned" },
33467
+ { host: "apps.wix.com", method: "POST", path: "/api/v1/mobile-platform-facade/business/hidden" },
33468
+ { host: "apps.wix.com", method: "POST", path: "/growth/v1/business/pending/cancel" },
33469
+ { host: "www.wixapis.com", method: "POST", path: OWNER_SITES_QUERY_PATH },
33470
+ // Site open (site-open.ts)
33471
+ { host: "apps.wix.com", method: "GET", path: "/wixapp/api/v1/business" },
33472
+ // Join, invite, leave (join.ts)
33473
+ { host: "apps.wix.com", method: "GET", path: "/clubs/api/v1/invites/details" },
33474
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/business/join/details" },
33475
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/invites/accept" },
33476
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/business/join" },
33477
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/invites" },
33478
+ { host: "apps.wix.com", method: "DELETE", path: "/api/v1/mobile-platform-facade/members/me" }
33479
+ ];
33480
+ ACCOUNT_JOIN_PATHS = /* @__PURE__ */ new Set(["/clubs/api/v1/invites/accept", "/clubs/api/v1/business/join"]);
33481
+ NotSiteMember = class extends Error {
33482
+ constructor(metaSiteId, reason) {
33483
+ super(`NotSiteMember(metaSiteId: ${metaSiteId}): ${reason}`);
33484
+ this.metaSiteId = metaSiteId;
33485
+ this.reason = reason;
33486
+ this.name = "NotSiteMember";
33487
+ }
33488
+ code = "NotSiteMember";
33489
+ };
33490
+ AccountSessionExpired = class extends Error {
33491
+ constructor(metaSiteId, reason) {
33492
+ super(`AccountSessionExpired(metaSiteId: ${metaSiteId}): ${reason}`);
33493
+ this.metaSiteId = metaSiteId;
33494
+ this.reason = reason;
33495
+ this.name = "AccountSessionExpired";
33496
+ }
33497
+ code = "AccountSessionExpired";
33498
+ };
33499
+ SiteInstanceUnavailable = class extends Error {
33500
+ constructor(metaSiteId, reason) {
33501
+ super(`SiteInstanceUnavailable(metaSiteId: ${metaSiteId}): ${reason}`);
33502
+ this.metaSiteId = metaSiteId;
33503
+ this.reason = reason;
33504
+ this.name = "SiteInstanceUnavailable";
33505
+ }
33506
+ code = "SiteInstanceUnavailable";
33507
+ };
33508
+ MEMBER_REFRESH_MARGIN_MS = 6e4;
33509
+ MEMBER_NEGATIVE_TTL_MS = 1e4;
33510
+ MEMBER_TRANSIENT_TTL_MS = 3e3;
33511
+ MemberInstanceCache = class {
33512
+ constructor(fetchImpl = fetch, mintTimeoutMs = OWNER_MINT_TIMEOUT_MS) {
33513
+ this.fetchImpl = fetchImpl;
33514
+ this.mintTimeoutMs = mintTimeoutMs;
33515
+ }
33516
+ cache = /* @__PURE__ */ new Map();
33517
+ inflight = /* @__PURE__ */ new Map();
33518
+ refusals = /* @__PURE__ */ new Map();
33519
+ /** Per session: bumped by `forgetSession` / `forgetRefusals`. A mint that started under an older
33520
+ * generation still answers its own callers, but writes nothing back — otherwise a mint in flight
33521
+ * across a sign-out re-caches the signed-out instance, and one in flight across a join re-caches
33522
+ * the `NotSiteMember` the join just made stale. */
33523
+ generations = /* @__PURE__ */ new Map();
33524
+ session(sessionCookie) {
33525
+ return sha256Hex(/(?:^|;\s*)wixSession2=([^;]*)/.exec(sessionCookie)?.[1] ?? sessionCookie);
33526
+ }
33527
+ key(msid, session) {
33528
+ return sha256Hex(`${msid}
33529
+ Member
33530
+ ${session}`);
33531
+ }
33532
+ /** The site's Member instance for this session. Throws `NotSiteMember` or `SiteInstanceUnavailable`.
33533
+ * `force`: Wix refused the instance this cache handed out (a 401) — mint a new one. */
33534
+ async instance(msid, sessionCookie, opts = {}) {
33535
+ const now = opts.now ?? Date.now();
33536
+ const session = this.session(sessionCookie);
33537
+ const key2 = this.key(msid, session);
33538
+ const generation = this.generations.get(session) ?? 0;
33539
+ const pending = this.inflight.get(key2);
33540
+ if (pending && pending.generation === generation) return (await pending.mint).instance;
33541
+ const refused2 = this.refusals.get(key2);
33542
+ if (refused2 && refused2.until > now && !opts.force) throw refused2.error;
33543
+ const hit = this.cache.get(key2);
33544
+ if (hit && !opts.force && hit.refreshAt > now) return hit.instance;
33545
+ const mint = this.mint(key2, msid, sessionCookie, session, now, generation).finally(() => {
33546
+ if (this.inflight.get(key2)?.mint === mint) this.inflight.delete(key2);
33547
+ });
33548
+ this.inflight.set(key2, { mint, generation });
33549
+ return (await mint).instance;
33550
+ }
33551
+ /** Drop everything held for this session — instances and refusals alike: its sign-out or expiry
33552
+ * (RFC 0071 §6, sign-out purges every per-site instance). */
33553
+ forgetSession(sessionCookie) {
33554
+ const session = this.session(sessionCookie);
33555
+ for (const [key2, entry] of this.cache) if (entry.session === session) this.cache.delete(key2);
33556
+ this.forgetRefusals(sessionCookie);
33557
+ }
33558
+ /** Drop every refusal held for this session — after a join, which makes them stale. */
33559
+ forgetRefusals(sessionCookie) {
33560
+ const session = this.session(sessionCookie);
33561
+ this.generations.set(session, (this.generations.get(session) ?? 0) + 1);
33562
+ for (const [key2, refusal] of this.refusals) if (refusal.session === session) this.refusals.delete(key2);
33563
+ }
33564
+ async mint(key2, msid, sessionCookie, session, now, generation) {
33565
+ const current = () => (this.generations.get(session) ?? 0) === generation;
33566
+ const refuse7 = (error, ttl2) => {
33567
+ if (!current()) throw error;
33568
+ this.cache.delete(key2);
33569
+ this.refusals.set(key2, { error, until: now + ttl2, session });
33570
+ throw error;
33571
+ };
33572
+ const abort = new AbortController();
33573
+ let timer;
33574
+ const timedOut = new Promise((_2, reject) => {
33575
+ timer = setTimeout(() => {
33576
+ abort.abort();
33577
+ reject(new Error(`timed out after ${this.mintTimeoutMs}ms`));
33578
+ }, this.mintTimeoutMs);
33579
+ });
33580
+ const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(sessionCookie)?.[1];
33581
+ let status;
33582
+ let text9;
33583
+ try {
33584
+ const res = await Promise.race([
33585
+ this.fetchImpl(`${ONE_APP_SESSION}/${msid}/signed-instance?signed_instance_type=Member`, {
33586
+ method: "GET",
33587
+ headers: { Cookie: sessionCookie, Accept: "application/json", ...xsrf ? { "x-xsrf-token": xsrf } : {} },
33588
+ signal: abort.signal,
33589
+ redirect: "manual"
33590
+ }),
33591
+ timedOut
33592
+ ]);
33593
+ status = res.status;
33594
+ text9 = await Promise.race([res.text(), timedOut]);
33595
+ } catch (e2) {
33596
+ return refuse7(new SiteInstanceUnavailable(msid, `mint failed: ${e2?.message ?? e2}`), MEMBER_TRANSIENT_TTL_MS);
33597
+ } finally {
33598
+ clearTimeout(timer);
33599
+ }
33600
+ if (status === 403 || status === 404) return refuse7(new NotSiteMember(msid, `mint refused (${status})`), MEMBER_NEGATIVE_TTL_MS);
33601
+ if (status === 401) return refuse7(new AccountSessionExpired(msid, `mint refused (${status})`), MEMBER_TRANSIENT_TTL_MS);
33602
+ let instance;
33603
+ try {
33604
+ instance = JSON.parse(text9).signedInstance;
33605
+ } catch {
33606
+ }
33607
+ if (status < 200 || status >= 300 || typeof instance !== "string" || !instance) {
33608
+ return refuse7(new SiteInstanceUnavailable(msid, `mint failed (${status})`), MEMBER_TRANSIENT_TTL_MS);
33609
+ }
33610
+ const rejection = memberInstanceRejection(instance, msid);
33611
+ if (rejection) return refuse7(new NotSiteMember(msid, rejection), MEMBER_NEGATIVE_TTL_MS);
33612
+ const entry = { instance, refreshAt: memberInstanceRefreshAt(instance, now), session };
33613
+ if (current()) {
33614
+ this.refusals.delete(key2);
33615
+ this.cache.set(key2, entry);
33616
+ }
33617
+ return entry;
33618
+ }
33619
+ };
33378
33620
  }
33379
33621
  });
33380
33622
 
@@ -34154,6 +34396,238 @@ var init_aria_realtime_dev = __esm({
34154
34396
  }
34155
34397
  });
34156
34398
 
34399
+ // ../../core/serve-runtime/src/wix-account.ts
34400
+ function unwrapString(v2) {
34401
+ if (typeof v2 === "string") return v2;
34402
+ if (v2 && typeof v2 === "object" && typeof v2.value === "string") {
34403
+ return v2.value;
34404
+ }
34405
+ return void 0;
34406
+ }
34407
+ function hasWixSession(cookieHeader) {
34408
+ return !!cookieHeader && /(?:^|;\s*)wixSession2=/.test(cookieHeader);
34409
+ }
34410
+ function normalizeWixAuthorization(raw) {
34411
+ if (!raw) return null;
34412
+ const trimmed = raw.trim();
34413
+ if (!trimmed) return null;
34414
+ const bearer = /^Bearer\s+(.+)$/i.exec(trimmed);
34415
+ const value = (bearer ? bearer[1] : trimmed).trim();
34416
+ if (!value) return null;
34417
+ if (/^(?:Bearer|Basic|Digest|Negotiate|NTLM)$/i.test(value)) return null;
34418
+ if (/^Basic\s/i.test(value)) return null;
34419
+ return value;
34420
+ }
34421
+ async function resolveWixAccounts(cookieHeader, fetchImpl = fetch, authorization) {
34422
+ const hasCookie = hasWixSession(cookieHeader);
34423
+ const auth = hasCookie ? null : normalizeWixAuthorization(authorization);
34424
+ if (!auth && !hasCookie) return { ok: false, reason: "no_session" };
34425
+ const cookie = cookieHeader ?? "";
34426
+ const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(cookie)?.[1];
34427
+ let res;
34428
+ try {
34429
+ res = await fetchImpl(`${ACCOUNT_SERVER}/v1/users/my_accounts`, {
34430
+ method: "GET",
34431
+ headers: auth ? { Authorization: auth, Accept: "application/json" } : {
34432
+ Cookie: cookie,
34433
+ Accept: "application/json",
34434
+ ...xsrf ? { "x-xsrf-token": xsrf } : {}
34435
+ }
34436
+ });
34437
+ } catch (err) {
34438
+ return { ok: false, reason: "upstream_failed", status: 0, detail: err.message };
34439
+ }
34440
+ if (auth && res.status === 428) return resolveAccountCredential(auth, fetchImpl);
34441
+ if (res.status === 428 || res.status === 401 || res.status === 403) {
34442
+ return { ok: false, reason: "no_session" };
34443
+ }
34444
+ const text9 = await res.text();
34445
+ if (!res.ok) {
34446
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: text9.slice(0, 200) };
34447
+ }
34448
+ let parsed;
34449
+ try {
34450
+ parsed = JSON.parse(text9);
34451
+ } catch {
34452
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: "unparseable_body" };
34453
+ }
34454
+ if (!parsed || !Array.isArray(parsed.accounts)) {
34455
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: "no_accounts_array" };
34456
+ }
34457
+ const accounts = [];
34458
+ for (const raw of parsed.accounts) {
34459
+ const account = toWixAccount(raw);
34460
+ if (account) accounts.push(account);
34461
+ }
34462
+ if (accounts.length === 0) return { ok: false, reason: "no_session" };
34463
+ return { ok: true, accounts };
34464
+ }
34465
+ function toWixAccount(raw) {
34466
+ if (!raw || typeof raw !== "object") return void 0;
34467
+ const a2 = raw;
34468
+ const accountId = typeof a2.accountId === "string" ? a2.accountId : void 0;
34469
+ if (!accountId) return void 0;
34470
+ return {
34471
+ accountId,
34472
+ ...typeof a2.slug === "string" ? { slug: a2.slug } : {},
34473
+ ...typeof a2.status === "string" ? { status: a2.status } : {},
34474
+ ...typeof a2.accountOwner === "string" ? { accountOwner: a2.accountOwner } : {},
34475
+ ...unwrapString(a2.accountName) ? { name: unwrapString(a2.accountName) } : {}
34476
+ };
34477
+ }
34478
+ async function resolveAccountCredential(auth, fetchImpl) {
34479
+ let res;
34480
+ try {
34481
+ res = await fetchImpl(`${ACCOUNT_SERVER}/v1/accounts/my_account`, {
34482
+ method: "GET",
34483
+ headers: { Authorization: auth, Accept: "application/json" }
34484
+ });
34485
+ } catch (err) {
34486
+ return { ok: false, reason: "upstream_failed", status: 0, detail: err.message };
34487
+ }
34488
+ if (res.status === 428 || res.status === 401 || res.status === 403 || res.status === 404) {
34489
+ return { ok: false, reason: "no_session" };
34490
+ }
34491
+ const text9 = await res.text();
34492
+ if (!res.ok) {
34493
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: text9.slice(0, 200) };
34494
+ }
34495
+ let parsed;
34496
+ try {
34497
+ parsed = JSON.parse(text9);
34498
+ } catch {
34499
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: "unparseable_body" };
34500
+ }
34501
+ const account = toWixAccount(parsed && typeof parsed === "object" ? parsed.account : void 0);
34502
+ if (!account) return { ok: false, reason: "upstream_failed", status: res.status, detail: "no_account" };
34503
+ return { ok: true, accounts: [account] };
34504
+ }
34505
+ var ACCOUNT_SERVER;
34506
+ var init_wix_account = __esm({
34507
+ "../../core/serve-runtime/src/wix-account.ts"() {
34508
+ ACCOUNT_SERVER = "https://www.wix.com/_api/account-server";
34509
+ }
34510
+ });
34511
+
34512
+ // ../../core/dev-server/src/person-session-auth.ts
34513
+ import { join as pathJoin } from "node:path";
34514
+ import { homedir as homedir5 } from "node:os";
34515
+ function isWixSessionExpired(token, nowMs = Date.now()) {
34516
+ try {
34517
+ const raw = token.startsWith("JWT.") ? token.slice(4) : token;
34518
+ const mid = raw.split(".")[1];
34519
+ if (!mid) return false;
34520
+ const payload = JSON.parse(Buffer.from(mid, "base64url").toString("utf8"));
34521
+ const data = typeof payload.data === "string" ? JSON.parse(payload.data) : payload.data;
34522
+ const wxexp = data?.wxexp;
34523
+ if (!wxexp || typeof wxexp !== "string") return false;
34524
+ const expMs = Date.parse(wxexp);
34525
+ if (Number.isNaN(expMs)) return false;
34526
+ return expMs <= nowMs;
34527
+ } catch {
34528
+ return false;
34529
+ }
34530
+ }
34531
+ var AUTOMATION_KEY_PATH, DPX_SESSION_PATH, DEFAULT_PERSON_EMAIL;
34532
+ var init_person_session_auth = __esm({
34533
+ "../../core/dev-server/src/person-session-auth.ts"() {
34534
+ AUTOMATION_KEY_PATH = pathJoin(homedir5(), ".argus", "automation_master_key");
34535
+ DPX_SESSION_PATH = pathJoin(homedir5(), ".dpx", "session", "wix-session");
34536
+ DEFAULT_PERSON_EMAIL = process.env.WIX_PERSON_SESSION_EMAIL ?? "bookingsowner@test.com";
34537
+ }
34538
+ });
34539
+
34540
+ // ../../core/dev-server/src/wix-account-session.ts
34541
+ import { readFileSync as readFileSync44 } from "node:fs";
34542
+ import { homedir as homedir6 } from "node:os";
34543
+ import { join as pathJoin2 } from "node:path";
34544
+ import { createHash as createHash16 } from "node:crypto";
34545
+ function captureAccountSession(req, opts = {}) {
34546
+ const env = opts.env ?? process.env;
34547
+ const now = opts.now ?? Date.now();
34548
+ const live3 = (cookie) => {
34549
+ const ws2 = /(?:^|;\s*)wixSession2=([^;]+)/.exec(cookie)?.[1];
34550
+ if (!ws2) return false;
34551
+ let value = ws2;
34552
+ try {
34553
+ value = decodeURIComponent(ws2);
34554
+ } catch {
34555
+ }
34556
+ return !isWixSessionExpired(value, now);
34557
+ };
34558
+ const fromRequest = forwardableWixSessionCookies(req.headers.cookie);
34559
+ if (fromRequest && live3(fromRequest)) return { cookie: fromRequest, source: "cookie" };
34560
+ if (!opts.machineSession) return null;
34561
+ const fromEnv = forwardableWixSessionCookies(env.HIMI_WEB_ACCOUNT_COOKIE);
34562
+ if (fromEnv && live3(fromEnv)) return { cookie: fromEnv, source: "env" };
34563
+ let fromFile = "";
34564
+ try {
34565
+ fromFile = readFileSync44(opts.dpxSessionPath ?? pathJoin2(homedir6(), ".dpx", "session", "wix-session"), "utf8").trim();
34566
+ } catch {
34567
+ }
34568
+ if (fromFile && /^[^;\s=]+$/.test(fromFile)) {
34569
+ const cookie = `wixSession2=${fromFile}`;
34570
+ if (live3(cookie)) return { cookie, source: "file" };
34571
+ }
34572
+ return null;
34573
+ }
34574
+ function isLocalDeveloperRequest(req) {
34575
+ if (!LOOPBACK_PEERS.has(req.socket?.remoteAddress ?? "")) return false;
34576
+ const hostname3 = (req.headers.host ?? "").replace(/:\d+$/, "").toLowerCase();
34577
+ return hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "[::1]";
34578
+ }
34579
+ async function accountPrincipal(cookie, fetchImpl = fetch) {
34580
+ const identity = await resolveWixAccounts(cookie, fetchImpl);
34581
+ if (!identity.ok) return { ok: false, reason: identity.reason };
34582
+ const ids = identity.accounts.map((a2) => a2.accountId).sort().join("\n");
34583
+ return { ok: true, principal: `acct_${createHash16("sha256").update(ids).digest("hex").slice(0, 32)}` };
34584
+ }
34585
+ function safeAccountReturn(raw, requestHost, requestProto = "http") {
34586
+ if (typeof raw !== "string" || !raw) return "/";
34587
+ if (raw.startsWith("/") && !raw.startsWith("//") && !raw.startsWith("/\\")) {
34588
+ const base = "http://placeholder.invalid";
34589
+ try {
34590
+ const url = new URL(raw, base);
34591
+ if (url.origin !== base || url.pathname.startsWith("//")) return "/";
34592
+ return `${url.pathname}${url.search}${url.hash}`;
34593
+ } catch {
34594
+ return "/";
34595
+ }
34596
+ }
34597
+ try {
34598
+ const url = new URL(raw);
34599
+ if (url.protocol !== "http:" && url.protocol !== "https:") return "/";
34600
+ if (url.username || url.password) return "/";
34601
+ return !!requestHost && url.host === requestHost && url.protocol === `${requestProto}:` ? url.toString() : "/";
34602
+ } catch {
34603
+ return "/";
34604
+ }
34605
+ }
34606
+ function isWixAccountOrigin(host) {
34607
+ const hostname3 = (host ?? "").replace(/:\d+$/, "").toLowerCase();
34608
+ return hostname3 === "wix.com" || hostname3.endsWith(".wix.com");
34609
+ }
34610
+ function withAccountOutcome(target, outcome) {
34611
+ const absolute = /^https?:\/\//i.test(target);
34612
+ const url = new URL(target, "http://placeholder.invalid");
34613
+ url.searchParams.set("webwix_account", outcome);
34614
+ return absolute ? url.toString() : `${url.pathname}${url.search}${url.hash}`;
34615
+ }
34616
+ function isWixAccountModeApp(app) {
34617
+ const auth = app?.meta.auth;
34618
+ return auth?.providerId === "wix-native" && auth.config?.mode === "account";
34619
+ }
34620
+ var LOOPBACK_PEERS, ACCOUNT_SESSION_HINT;
34621
+ var init_wix_account_session = __esm({
34622
+ "../../core/dev-server/src/wix-account-session.ts"() {
34623
+ init_wix_bridge();
34624
+ init_wix_account();
34625
+ init_person_session_auth();
34626
+ LOOPBACK_PEERS = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
34627
+ ACCOUNT_SESSION_HINT = "Wix sign-in cannot redirect back to this origin. Set HIMI_WEB_ACCOUNT_COOKIE to your *.wix.com session cookies, or provision ~/.dpx/session/wix-session (docs/wix-authentication.md).";
34628
+ }
34629
+ });
34630
+
34157
34631
  // ../../core/serve-runtime/src/flag-assignments.ts
34158
34632
  function bad(error) {
34159
34633
  return new Response(JSON.stringify({ error }), { status: 400, headers: { "content-type": JSON_CT, "cache-control": "no-store" } });
@@ -34216,9 +34690,9 @@ var init_flag_assignments = __esm({
34216
34690
  });
34217
34691
 
34218
34692
  // ../../core/dev-server/src/images.ts
34219
- import { createHash as createHash16 } from "node:crypto";
34693
+ import { createHash as createHash17 } from "node:crypto";
34220
34694
  function svgFor(productId, title, sku) {
34221
- const seedHex = createHash16("sha1").update(productId + ":" + title).digest("hex");
34695
+ const seedHex = createHash17("sha1").update(productId + ":" + title).digest("hex");
34222
34696
  const h2 = (n2) => parseInt(seedHex.slice(n2, n2 + 2), 16);
34223
34697
  const hue1 = h2(0) % 360;
34224
34698
  const hue2 = (hue1 + 30 + h2(2) % 60) % 360;
@@ -34250,7 +34724,7 @@ function escapeXml(s2) {
34250
34724
  return s2.replace(/[<>&"']/g, (c2) => ({ "<": "&lt;", ">": "&gt;", "&": "&amp;", '"': "&quot;", "'": "&apos;" })[c2] ?? c2);
34251
34725
  }
34252
34726
  function wixPhotoSvg(category, seed2) {
34253
- const seedHex = createHash16("sha1").update(category + ":" + seed2).digest("hex");
34727
+ const seedHex = createHash17("sha1").update(category + ":" + seed2).digest("hex");
34254
34728
  const h2 = (n2) => parseInt(seedHex.slice(n2, n2 + 2), 16);
34255
34729
  const palette2 = paletteForCategory(category, h2);
34256
34730
  const glyph = glyphForCategory(category);
@@ -34375,9 +34849,9 @@ var init_stable_ids = __esm({
34375
34849
 
34376
34850
  // ../../core/dev-server/src/preview.ts
34377
34851
  import { spawn as spawn4 } from "node:child_process";
34378
- import { createHash as createHash17 } from "node:crypto";
34379
- import { existsSync as existsSync43, createReadStream, statSync as statSync11, readFileSync as readFileSync44, renameSync as renameSync9, unlinkSync as unlinkSync3 } from "node:fs";
34380
- import { homedir as homedir5, tmpdir as tmpdir2 } from "node:os";
34852
+ import { createHash as createHash18 } from "node:crypto";
34853
+ import { existsSync as existsSync43, createReadStream, statSync as statSync11, readFileSync as readFileSync45, renameSync as renameSync9, unlinkSync as unlinkSync3 } from "node:fs";
34854
+ import { homedir as homedir7, tmpdir as tmpdir2 } from "node:os";
34381
34855
  import { resolve as resolvePath, dirname as dirname27 } from "node:path";
34382
34856
  import { fileURLToPath as fileURLToPath18 } from "node:url";
34383
34857
  function firstExisting(paths) {
@@ -34391,7 +34865,7 @@ function macosWinlistBin() {
34391
34865
  }
34392
34866
  function macosWinlistSourceHash() {
34393
34867
  try {
34394
- return createHash17("sha1").update(readFileSync44(MACOS_WINLIST)).digest("hex").slice(0, 12);
34868
+ return createHash18("sha1").update(readFileSync45(MACOS_WINLIST)).digest("hex").slice(0, 12);
34395
34869
  } catch {
34396
34870
  return "missing";
34397
34871
  }
@@ -34536,7 +35010,7 @@ async function captureFrame(params, format = "png") {
34536
35010
  const tmp = resolvePath(tmpdir2(), `himalaya-macos-preview-${windowId}-${process.pid}-${++macosCaptureSeq}.png`);
34537
35011
  try {
34538
35012
  await runner.capture(SCREENCAPTURE_BIN, ["-o", "-x", `-l${windowId}`, tmp]);
34539
- return { buf: readFileSync44(tmp), mime: "image/png" };
35013
+ return { buf: readFileSync45(tmp), mime: "image/png" };
34540
35014
  } finally {
34541
35015
  try {
34542
35016
  unlinkSync3(tmp);
@@ -35198,7 +35672,7 @@ var init_preview2 = __esm({
35198
35672
  };
35199
35673
  runner = defaultRunner2;
35200
35674
  ADB_BIN = process.env.HIMALAYA_ADB_PATH ?? firstExisting([
35201
- resolvePath(homedir5(), "Library/Android/sdk/platform-tools/adb"),
35675
+ resolvePath(homedir7(), "Library/Android/sdk/platform-tools/adb"),
35202
35676
  "/Users/Shared/Android/sdk/platform-tools/adb",
35203
35677
  "/opt/android-sdk/platform-tools/adb"
35204
35678
  ]) ?? "adb";
@@ -35247,9 +35721,9 @@ var init_preview2 = __esm({
35247
35721
  });
35248
35722
 
35249
35723
  // ../../core/dev-server/src/tier4-integrity.ts
35250
- import { createHash as createHash18 } from "node:crypto";
35724
+ import { createHash as createHash19 } from "node:crypto";
35251
35725
  function computeSri(bytes2) {
35252
- const digest2 = createHash18("sha384").update(bytes2).digest("base64");
35726
+ const digest2 = createHash19("sha384").update(bytes2).digest("base64");
35253
35727
  return `sha384-${digest2}`;
35254
35728
  }
35255
35729
  function parseManifestIntegrity(manifest) {
@@ -35264,7 +35738,7 @@ var init_tier4_integrity = __esm({
35264
35738
  });
35265
35739
 
35266
35740
  // ../../core/dev-server/src/tier4-verifier.ts
35267
- import { readFileSync as readFileSync45, existsSync as existsSync44 } from "node:fs";
35741
+ import { readFileSync as readFileSync46, existsSync as existsSync44 } from "node:fs";
35268
35742
  import { resolve as resolve34 } from "node:path";
35269
35743
  var TierFourVerifier;
35270
35744
  var init_tier4_verifier = __esm({
@@ -35282,7 +35756,7 @@ var init_tier4_verifier = __esm({
35282
35756
  const expected = this.expectedSri(bundleId, relPath);
35283
35757
  if (!expected) return { ok: true };
35284
35758
  const path2 = resolve34(this.tier4Root, bundleId, relPath);
35285
- const bytes2 = providedBytes ?? (existsSync44(path2) ? readFileSync45(path2) : null);
35759
+ const bytes2 = providedBytes ?? (existsSync44(path2) ? readFileSync46(path2) : null);
35286
35760
  if (!bytes2) return { ok: false, reason: "file not found" };
35287
35761
  if (computeSri(bytes2) !== expected) return { ok: false, reason: "sri mismatch" };
35288
35762
  return { ok: true };
@@ -35292,7 +35766,7 @@ var init_tier4_verifier = __esm({
35292
35766
  if (cached3) return cached3;
35293
35767
  const manifestPath = resolve34(this.tier4Root, bundleId, "manifest.json");
35294
35768
  if (!existsSync44(manifestPath)) return void 0;
35295
- const manifest = JSON.parse(readFileSync45(manifestPath, "utf8"));
35769
+ const manifest = JSON.parse(readFileSync46(manifestPath, "utf8"));
35296
35770
  cached3 = { integrity: parseManifestIntegrity(manifest) };
35297
35771
  this.cache.set(bundleId, cached3);
35298
35772
  return cached3;
@@ -35356,13 +35830,13 @@ var init_net_mocks_rollover = __esm({
35356
35830
  });
35357
35831
 
35358
35832
  // ../../core/dev-server/src/player-proxy.ts
35359
- import { readFileSync as readFileSync46 } from "node:fs";
35360
- import { homedir as homedir6 } from "node:os";
35833
+ import { readFileSync as readFileSync47 } from "node:fs";
35834
+ import { homedir as homedir8 } from "node:os";
35361
35835
  import { dirname as dirname28, join as join42 } from "node:path";
35362
35836
  import { fileURLToPath as fileURLToPath19 } from "node:url";
35363
35837
  function readJson2(path2) {
35364
35838
  try {
35365
- return JSON.parse(readFileSync46(path2, "utf8"));
35839
+ return JSON.parse(readFileSync47(path2, "utf8"));
35366
35840
  } catch {
35367
35841
  return void 0;
35368
35842
  }
@@ -35374,7 +35848,7 @@ function ledgerDevServerPort(tenant) {
35374
35848
  return typeof port === "number" ? port : void 0;
35375
35849
  }
35376
35850
  function loadSupervisorRegistry() {
35377
- const home = process.env.HIMALAYA_HOME ?? join42(homedir6(), ".himalaya");
35851
+ const home = process.env.HIMALAYA_HOME ?? join42(homedir8(), ".himalaya");
35378
35852
  const reg = readJson2(join42(home, "instances.json"));
35379
35853
  return { instances: reg?.instances && typeof reg.instances === "object" ? reg.instances : {} };
35380
35854
  }
@@ -35434,7 +35908,7 @@ function tenantPrefixed(url, hostApp, method = "GET") {
35434
35908
  return tenantsOf(hostApp).includes(tenant) ? { tenant, url: tenantUrl } : null;
35435
35909
  }
35436
35910
  function forwardedBaseUrl(req) {
35437
- if (!LOOPBACK_PEERS.has(req.socket?.remoteAddress ?? "")) return null;
35911
+ if (!LOOPBACK_PEERS2.has(req.socket?.remoteAddress ?? "")) return null;
35438
35912
  const first = (h2) => (Array.isArray(h2) ? h2[0] : h2)?.split(",", 1)[0]?.trim() ?? "";
35439
35913
  const host = first(req.headers["x-forwarded-host"]);
35440
35914
  if (!host || !/^[A-Za-z0-9.\-:[\]]+$/.test(host)) return null;
@@ -35583,7 +36057,7 @@ async function proxyToServe(base, req, res, opts = {}) {
35583
36057
  res.writeHead(upstream.status, outHeaders);
35584
36058
  res.end(buf);
35585
36059
  }
35586
- var PLAYER_APP_ID, HOSTED_TENANTS, TENANT_PREFIX, LOOPBACK_PEERS, STRIP_RESPONSE_HEADERS, STRIP_REQUEST_HEADERS;
36060
+ var PLAYER_APP_ID, HOSTED_TENANTS, TENANT_PREFIX, LOOPBACK_PEERS2, STRIP_RESPONSE_HEADERS, STRIP_REQUEST_HEADERS;
35587
36061
  var init_player_proxy = __esm({
35588
36062
  "../../core/dev-server/src/player-proxy.ts"() {
35589
36063
  init_config();
@@ -35593,7 +36067,7 @@ var init_player_proxy = __esm({
35593
36067
  "himi-spaces-lite": ["himi-branded-lite"]
35594
36068
  };
35595
36069
  TENANT_PREFIX = "/__tenant/";
35596
- LOOPBACK_PEERS = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
36070
+ LOOPBACK_PEERS2 = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
35597
36071
  STRIP_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
35598
36072
  "connection",
35599
36073
  "keep-alive",
@@ -128632,12 +129106,12 @@ var init_render_descriptor = __esm({
128632
129106
  });
128633
129107
 
128634
129108
  // ../../core/dev-server/src/render-fonts.ts
128635
- import { existsSync as existsSync45, readFileSync as readFileSync47 } from "node:fs";
129109
+ import { existsSync as existsSync45, readFileSync as readFileSync48 } from "node:fs";
128636
129110
  import { extname, join as join43 } from "node:path";
128637
129111
  function servedFontFaces(appDir3, tokens2) {
128638
129112
  try {
128639
129113
  const policyPath = join43(appDir3, "fonts.json");
128640
- const policy = existsSync45(policyPath) ? JSON.parse(readFileSync47(policyPath, "utf8")) : {};
129114
+ const policy = existsSync45(policyPath) ? JSON.parse(readFileSync48(policyPath, "utf8")) : {};
128641
129115
  let plan = planFonts(tokens2, policy);
128642
129116
  if (!hasVendoredFloor()) plan = { ...plan, families: plan.families.filter((f2) => !isHostProvided(f2.name)) };
128643
129117
  if (plan.families.length === 0) return void 0;
@@ -128658,7 +129132,7 @@ async function faceBytes(face, catalog3, opts) {
128658
129132
  try {
128659
129133
  if (opts.source) {
128660
129134
  const path2 = opts.source(face.file, face.sha256);
128661
- return path2 ? readFileSync47(path2) : null;
129135
+ return path2 ? readFileSync48(path2) : null;
128662
129136
  }
128663
129137
  const bytes2 = await catalogFaceBytes(face.sha256, { catalog: catalog3, ...opts.fetchFace ? { fetchFace: opts.fetchFace } : {} });
128664
129138
  return bytes2 ?? null;
@@ -128724,7 +129198,7 @@ async function idiomFontFaceCss(idiomContext) {
128724
129198
  const bundled = idiomControls2(controlIdiomFor2(idiomContext)).font.bundled;
128725
129199
  if (!bundled) return "";
128726
129200
  try {
128727
- const bytes2 = readFileSync47(new URL(`../../web-host/public/${bundled.file}`, import.meta.url));
129201
+ const bytes2 = readFileSync48(new URL(`../../web-host/public/${bundled.file}`, import.meta.url));
128728
129202
  return `@font-face { font-family: "${bundled.family}"; font-weight: 100 900; font-style: normal; src: url(data:font/ttf;base64,${bytes2.toString("base64")}) format("truetype"); }`;
128729
129203
  } catch {
128730
129204
  return "";
@@ -128767,7 +129241,7 @@ var init_tier = __esm({
128767
129241
  });
128768
129242
 
128769
129243
  // ../../core/dev-server/src/flags/index.ts
128770
- import { readFileSync as readFileSync48 } from "node:fs";
129244
+ import { readFileSync as readFileSync49 } from "node:fs";
128771
129245
  import { resolve as resolve35 } from "node:path";
128772
129246
  function selectProvider(config, store) {
128773
129247
  const local = new LocalFlagProvider(store, () => config?.overrides);
@@ -128863,7 +129337,7 @@ var init_flags2 = __esm({
128863
129337
  if (now - this.lastFetch < this.ttlMs) return;
128864
129338
  this.lastFetch = now;
128865
129339
  try {
128866
- const defs = JSON.parse(readFileSync48(resolve35(appDir3, "flags.json"), "utf8"));
129340
+ const defs = JSON.parse(readFileSync49(resolve35(appDir3, "flags.json"), "utf8"));
128867
129341
  if (Array.isArray(defs) && defs.length > 0) store.replaceAll(defs);
128868
129342
  } catch {
128869
129343
  }
@@ -128913,19 +129387,19 @@ var init_motion_flags = __esm({
128913
129387
  });
128914
129388
 
128915
129389
  // ../../core/dev-server/src/kits.ts
128916
- import { readdirSync as readdirSync24, readFileSync as readFileSync49 } from "node:fs";
129390
+ import { readdirSync as readdirSync24, readFileSync as readFileSync50 } from "node:fs";
128917
129391
  import { resolve as resolve36, join as join44 } from "node:path";
128918
129392
  import { fileURLToPath as fileURLToPath20 } from "node:url";
128919
129393
  function listKits() {
128920
129394
  return readdirSync24(CATALOG).filter((f2) => f2.endsWith(".json")).map((f2) => {
128921
- const { tokens: tokens2, ...meta } = JSON.parse(readFileSync49(join44(CATALOG, f2), "utf8"));
129395
+ const { tokens: tokens2, ...meta } = JSON.parse(readFileSync50(join44(CATALOG, f2), "utf8"));
128922
129396
  return meta;
128923
129397
  });
128924
129398
  }
128925
129399
  function readKit(id) {
128926
129400
  if (!/^[a-z0-9-]+$/.test(id)) return null;
128927
129401
  try {
128928
- return JSON.parse(readFileSync49(join44(CATALOG, `${id}.json`), "utf8"));
129402
+ return JSON.parse(readFileSync50(join44(CATALOG, `${id}.json`), "utf8"));
128929
129403
  } catch {
128930
129404
  return null;
128931
129405
  }
@@ -128956,7 +129430,7 @@ __export(widgets_exports, {
128956
129430
  viewWidgetId: () => viewWidgetId,
128957
129431
  widgetRealm: () => widgetRealm
128958
129432
  });
128959
- import { createHash as createHash19 } from "node:crypto";
129433
+ import { createHash as createHash20 } from "node:crypto";
128960
129434
  import { inspect } from "node:util";
128961
129435
  async function widgetRealm() {
128962
129436
  if (!realmPromise) {
@@ -129012,7 +129486,7 @@ function dropEntry(cache, key2) {
129012
129486
  cache.bytes -= entry.bytes;
129013
129487
  }
129014
129488
  function produceCacheKey(bundleJs, timeoutMs, clock) {
129015
- const digest2 = createHash19("sha256").update(bundleJs).digest("base64");
129489
+ const digest2 = createHash20("sha256").update(bundleJs).digest("base64");
129016
129490
  return `${timeoutMs}|${clock === void 0 ? "live" : Math.trunc(clock)}|${digest2}`;
129017
129491
  }
129018
129492
  function cachedProduce(evaluator, key2) {
@@ -129403,7 +129877,7 @@ function contentEtag(snapshot2) {
129403
129877
  // Lever A — a timeline change must bump the etag (frame values/times are content).
129404
129878
  frames: snapshot2.frames ?? null
129405
129879
  });
129406
- return "sha256-" + createHash19("sha256").update(canonical4).digest("base64");
129880
+ return "sha256-" + createHash20("sha256").update(canonical4).digest("base64");
129407
129881
  }
129408
129882
  async function buildWidgetSnapshot(bundleJs, widgetId, opts = {}) {
129409
129883
  const { widgets } = await extractWidgets(bundleJs, opts);
@@ -129660,7 +130134,7 @@ __export(config_exports2, {
129660
130134
  serializeRolloutYaml: () => serializeRolloutYaml,
129661
130135
  validateOverlayPatch: () => validateOverlayPatch
129662
130136
  });
129663
- import { mkdirSync as mkdirSync22, readFileSync as readFileSync50, writeFileSync as writeFileSync19 } from "node:fs";
130137
+ import { mkdirSync as mkdirSync22, readFileSync as readFileSync51, writeFileSync as writeFileSync19 } from "node:fs";
129664
130138
  import { dirname as dirname29, join as join45, resolve as resolve37 } from "node:path";
129665
130139
  import { fileURLToPath as fileURLToPath21 } from "node:url";
129666
130140
  function strip(line) {
@@ -129728,7 +130202,7 @@ function appConfigPath(app, file2, root = REPO_ROOT6) {
129728
130202
  for (const base of ["apps", "test-apps"]) {
129729
130203
  const p2 = join45(root, base, app, file2);
129730
130204
  try {
129731
- readFileSync50(p2);
130205
+ readFileSync51(p2);
129732
130206
  return p2;
129733
130207
  } catch {
129734
130208
  }
@@ -129781,7 +130255,7 @@ function validateOverlayPatch(patch) {
129781
130255
  }
129782
130256
  function readJsonAt(app, file2, root) {
129783
130257
  try {
129784
- return JSON.parse(readFileSync50(appConfigPath(app, file2, root), "utf8"));
130258
+ return JSON.parse(readFileSync51(appConfigPath(app, file2, root), "utf8"));
129785
130259
  } catch {
129786
130260
  return null;
129787
130261
  }
@@ -129819,14 +130293,14 @@ function saveLocalFlags(app, defs, root = REPO_ROOT6) {
129819
130293
  }
129820
130294
  function loadRollout(app) {
129821
130295
  try {
129822
- return parseRolloutYaml(readFileSync50(appConfigPath(app, "rollout.yaml"), "utf8"));
130296
+ return parseRolloutYaml(readFileSync51(appConfigPath(app, "rollout.yaml"), "utf8"));
129823
130297
  } catch {
129824
130298
  return null;
129825
130299
  }
129826
130300
  }
129827
130301
  function loadRevocations(app) {
129828
130302
  try {
129829
- return parseRevocationsYaml(readFileSync50(appConfigPath(app, "revocations.yaml"), "utf8")).revoked;
130303
+ return parseRevocationsYaml(readFileSync51(appConfigPath(app, "revocations.yaml"), "utf8")).revoked;
129830
130304
  } catch {
129831
130305
  return [];
129832
130306
  }
@@ -129904,9 +130378,9 @@ var init_config2 = __esm({
129904
130378
  // ../../core/dev-server/src/index.ts
129905
130379
  import { createServer as createServer3 } from "node:http";
129906
130380
  import { readFile, stat } from "node:fs/promises";
129907
- import { readFileSync as readFileSync51, existsSync as existsSync46, watch, mkdirSync as mkdirSync23, rmSync as rmSync11 } from "node:fs";
130381
+ import { readFileSync as readFileSync52, existsSync as existsSync46, watch, mkdirSync as mkdirSync23, rmSync as rmSync11 } from "node:fs";
129908
130382
  import { basename as basename10, dirname as dirname30, extname as extname2, join as join46, relative as relative8, resolve as resolve38, normalize as normalize3, sep as sep10 } from "node:path";
129909
- import { createHash as createHash20, randomUUID as randomUUID5 } from "node:crypto";
130383
+ import { createHash as createHash21, randomUUID as randomUUID5 } from "node:crypto";
129910
130384
  import { fileURLToPath as fileURLToPath22, pathToFileURL as pathToFileURL6 } from "node:url";
129911
130385
  function readLogicBundle(read, tier5Dir, name) {
129912
130386
  return read(tier5Dir ?? TIER5_ROOT2, name) ?? (tier5Dir && tier5Dir !== TIER5_ROOT2 ? read(TIER5_ROOT2, name) : void 0);
@@ -129952,7 +130426,7 @@ async function readBody2(req) {
129952
130426
  return Buffer.concat(chunks).toString("utf-8");
129953
130427
  }
129954
130428
  function makeEtag(body) {
129955
- return `"${createHash20("sha256").update(body).digest("hex").slice(0, 32)}"`;
130429
+ return `"${createHash21("sha256").update(body).digest("hex").slice(0, 32)}"`;
129956
130430
  }
129957
130431
  function servedTokensPath(app) {
129958
130432
  return app.module.designTokensPath ?? resolve38(app.dir, uiConfig(app.module.config).designTokensPath ?? "tokens.json");
@@ -129960,7 +130434,7 @@ function servedTokensPath(app) {
129960
130434
  function readAppTokens(state) {
129961
130435
  if (!state.app) return null;
129962
130436
  try {
129963
- const parsed = JSON.parse(readFileSync51(servedTokensPath(state.app), "utf8"));
130437
+ const parsed = JSON.parse(readFileSync52(servedTokensPath(state.app), "utf8"));
129964
130438
  delete parsed._meta;
129965
130439
  return parsed;
129966
130440
  } catch {
@@ -129972,7 +130446,7 @@ function effectiveAppConfigOverride(state) {
129972
130446
  if (state.app) {
129973
130447
  try {
129974
130448
  gitOverlay = JSON.parse(
129975
- readFileSync51(resolve38(state.app.dir, "app-config.overlay.json"), "utf8")
130449
+ readFileSync52(resolve38(state.app.dir, "app-config.overlay.json"), "utf8")
129976
130450
  );
129977
130451
  } catch {
129978
130452
  }
@@ -130041,7 +130515,7 @@ function handleL10nRequest(req, res, state) {
130041
130515
  let messages;
130042
130516
  try {
130043
130517
  messages = Object.fromEntries(
130044
- keyMap(parseCatalog(readFileSync51(path2, "utf8")), { sourceFallback: tag === sourceLocale })
130518
+ keyMap(parseCatalog(readFileSync52(path2, "utf8")), { sourceFallback: tag === sourceLocale })
130045
130519
  );
130046
130520
  } catch {
130047
130521
  return sendJson(res, 500, { error: "catalog_unreadable", app, tag }, cors);
@@ -130443,8 +130917,8 @@ async function buildDescriptorForScreenId(state, screenId, query = new URLSearch
130443
130917
  function bundleIntegritySync(name, dir) {
130444
130918
  for (const root of dir ? [dir, TIER5_ROOT2] : [TIER5_ROOT2]) {
130445
130919
  try {
130446
- const bytes2 = readFileSync51(resolve38(root, `${name}.bundle.js`));
130447
- return "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
130920
+ const bytes2 = readFileSync52(resolve38(root, `${name}.bundle.js`));
130921
+ return "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
130448
130922
  } catch {
130449
130923
  }
130450
130924
  }
@@ -130865,7 +131339,7 @@ function tokensAreDerived(state) {
130865
131339
  }
130866
131340
  function servedTokensHash(app) {
130867
131341
  try {
130868
- return createHash20("sha256").update(readFileSync51(servedTokensPath(app))).digest("hex");
131342
+ return createHash21("sha256").update(readFileSync52(servedTokensPath(app))).digest("hex");
130869
131343
  } catch {
130870
131344
  return "";
130871
131345
  }
@@ -131076,6 +131550,13 @@ function resolveWebWixAuth(app) {
131076
131550
  redirectUri: WEBWIX_REDIRECT
131077
131551
  });
131078
131552
  }
131553
+ function rotateWebWixSession(req, res, state, session) {
131554
+ const current = req.headers.cookie?.match(new RegExp(`(?:^|;\\s*)${WEBWIX_COOKIE}=([^;]+)`))?.[1];
131555
+ if (current && state.wixWebSessions.get(current) === session) state.wixWebSessions.set(current, {});
131556
+ const id = randomUUID5();
131557
+ state.wixWebSessions.set(id, session);
131558
+ res.setHeader("set-cookie", `${WEBWIX_COOKIE}=${id}; Path=/; HttpOnly; SameSite=Lax`);
131559
+ }
131079
131560
  function webWixSession(req, res, state) {
131080
131561
  const requestedId = req.headers.cookie?.match(new RegExp(`(?:^|;\\s*)${WEBWIX_COOKIE}=([^;]+)`))?.[1];
131081
131562
  const id = requestedId && state.wixWebSessions.has(requestedId) ? requestedId : randomUUID5();
@@ -131270,20 +131751,68 @@ async function handleWebWix(req, res, state) {
131270
131751
  session.memberToken = memberToken;
131271
131752
  session.visitorToken = visitorToken;
131272
131753
  session.email = String(b2.email ?? "");
131754
+ if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
131755
+ session.account = void 0;
131273
131756
  return reply(200, { ok: true, email: session.email });
131274
131757
  } catch (e2) {
131275
131758
  return reply(200, { ok: false, error: String(e2?.message ?? e2) });
131276
131759
  }
131277
131760
  }
131761
+ const accountApp = isWixAccountModeApp(state.app);
131762
+ if (path2 === "/v1/__webwix/account/login" || path2 === "/v1/__webwix/account/callback") {
131763
+ if (!accountApp) return reply(404, { error: "webwix_account_unsupported" });
131764
+ const query = new URL(req.url ?? "", "http://localhost").searchParams;
131765
+ const forwardedHost = req.headers["x-forwarded-host"];
131766
+ const requestHost = (Array.isArray(forwardedHost) ? forwardedHost[0] : forwardedHost) ?? req.headers.host;
131767
+ const forwardedProto = req.headers["x-forwarded-proto"];
131768
+ const proto = (Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto) === "https" ? "https" : "http";
131769
+ const back = safeAccountReturn(query.get("return"), requestHost, proto);
131770
+ const wixOrigin = isWixAccountOrigin(requestHost);
131771
+ const signInUrl = wixOrigin ? wixAccountSignInUrl(`${proto}://${requestHost}/v1/__webwix/account/callback?return=${encodeURIComponent(back)}`) : void 0;
131772
+ const machineSession = path2 === "/v1/__webwix/account/login" && !wixOrigin && isLocalDeveloperRequest(req);
131773
+ const establish = async () => {
131774
+ const captured = captureAccountSession(req, { machineSession });
131775
+ if (!captured) return { ok: false, error: "webwix_account_no_session" };
131776
+ const who = await accountPrincipal(captured.cookie);
131777
+ if (!who.ok) return { ok: false, error: who.reason === "no_session" ? "webwix_account_no_session" : "webwix_account_upstream_failed" };
131778
+ session.account = { cookie: captured.cookie, principal: who.principal };
131779
+ session.memberToken = void 0;
131780
+ session.email = void 0;
131781
+ rotateWebWixSession(req, res, state, session);
131782
+ return { ok: true, principal: who.principal };
131783
+ };
131784
+ res.setHeader("cache-control", "no-store");
131785
+ if (path2 === "/v1/__webwix/account/login" && req.method === "GET" && signInUrl) {
131786
+ res.statusCode = 302;
131787
+ res.setHeader("location", signInUrl);
131788
+ return void res.end();
131789
+ }
131790
+ if (path2 === "/v1/__webwix/account/login" && req.method === "POST") {
131791
+ const outcome = await establish();
131792
+ return outcome.ok ? reply(200, { ok: true, authenticated: true, userId: outcome.principal }) : reply(outcome.error === "webwix_account_no_session" ? 401 : 502, {
131793
+ ok: false,
131794
+ error: outcome.error,
131795
+ ...signInUrl ? { signInUrl } : { hint: ACCOUNT_SESSION_HINT }
131796
+ });
131797
+ }
131798
+ if (req.method === "GET") {
131799
+ const outcome = await establish();
131800
+ res.statusCode = 302;
131801
+ res.setHeader("location", withAccountOutcome(back, outcome.ok ? "signed_in" : outcome.error));
131802
+ return void res.end();
131803
+ }
131804
+ return reply(405, { error: "method_not_allowed" });
131805
+ }
131278
131806
  if (path2 === "/v1/__webwix/call" && req.method === "POST") {
131279
131807
  const b2 = await readJson9();
131280
131808
  const ownerRung = b2.ownerMsid !== void 0 || b2.checkOwnerSession === true;
131809
+ const accountRung = !ownerRung && accountApp && !!session.account;
131281
131810
  const msid = String(b2.ownerMsid ?? "");
131282
131811
  const cookie = req.headers.cookie ?? "";
131283
131812
  const method = String(b2.method ?? "GET").toUpperCase();
131284
131813
  const requestedPath = String(b2.path ?? "/");
131285
131814
  const started = Date.now();
131286
- const capability = ownerRung ? "wix_api.web.owner" : "wix_api.web";
131815
+ const capability = ownerRung ? "wix_api.web.owner" : accountRung ? "wix_api.web.account" : "wix_api.web";
131287
131816
  const refuseEarly = (status, error, parsed) => {
131288
131817
  recordWixTraffic(state.wix, state.appName, state.adminUrl, {
131289
131818
  ts: started,
@@ -131310,6 +131839,7 @@ async function handleWebWix(req, res, state) {
131310
131839
  }
131311
131840
  const body = b2.body === void 0 ? void 0 : typeof b2.body === "string" ? b2.body : JSON.stringify(b2.body);
131312
131841
  const forwardedHeaders = normalizeWixForwardedHeaders(b2.headers, requestedPath);
131842
+ const logged = accountApp ? new URL(`${target.origin}${target.pathname}`) : target;
131313
131843
  const record2 = (source, status, respBody, mockRuleId, respHeaders) => {
131314
131844
  const redactBodies = source === "proxy" || mockRuleId === UNMATCHED_FAIL_CLOSED_ID;
131315
131845
  recordWixTraffic(state.wix, state.appName, state.adminUrl, {
@@ -131318,7 +131848,7 @@ async function handleWebWix(req, res, state) {
131318
131848
  capability,
131319
131849
  host: target.host,
131320
131850
  method,
131321
- url: target.toString(),
131851
+ url: logged.toString(),
131322
131852
  path: target.pathname,
131323
131853
  status,
131324
131854
  durationMs: Date.now() - started,
@@ -131328,7 +131858,7 @@ async function handleWebWix(req, res, state) {
131328
131858
  mockRuleId
131329
131859
  });
131330
131860
  };
131331
- if (b2.checkOwnerSession !== true && state.wix.mode === "mock" && (!ownerRung || failsClosed(state.wix))) {
131861
+ if (b2.checkOwnerSession !== true && state.wix.mode === "mock" && (!ownerRung && !accountRung || failsClosed(state.wix))) {
131332
131862
  const matchCtx = { host: target.host, query: Object.fromEntries(target.searchParams.entries()), headers: forwardedHeaders, body };
131333
131863
  let match = matchRuleEx(state.wix.rules, method, target.pathname, matchCtx);
131334
131864
  if (match && (match.rule.kind ?? "mock") !== "mock") {
@@ -131348,6 +131878,44 @@ async function handleWebWix(req, res, state) {
131348
131878
  return reply(200, { status: refusal.status, body: refusal.body });
131349
131879
  }
131350
131880
  }
131881
+ if (accountRung && session.account) {
131882
+ const account = session.account;
131883
+ const absolute = /^[a-z][a-z0-9+.-]*:\/\//i.test(requestedPath);
131884
+ const allowed2 = absolute && !!allowedAccountTarget(method, requestedPath);
131885
+ const siteId = Object.entries(forwardedHeaders).find(([name]) => name.toLowerCase() === "wix-site-id")?.[1]?.trim() ?? "";
131886
+ if (allowed2 || !absolute && siteId) {
131887
+ if (siteId && !isSafeMsid(siteId)) return refuseEarly(400, "webwix_account_bad_site_id", logged);
131888
+ res.setHeader("cache-control", "no-store");
131889
+ const send2 = async (force) => {
131890
+ const instance = siteId ? await webAccountMemberInstances.instance(siteId, account.cookie, { force }) : void 0;
131891
+ return allowed2 ? wixAccountCall(method, requestedPath, body, account.cookie, fetch, forwardedHeaders, instance) : wixVisitorCall(method, requestedPath, body, instance ?? "", fetch, forwardedHeaders);
131892
+ };
131893
+ try {
131894
+ let result = await send2(false);
131895
+ if (result.status === 401 && siteId) result = await send2(true);
131896
+ if (result.status >= 200 && result.status < 300 && isAccountJoinCall(method, requestedPath)) {
131897
+ webAccountMemberInstances.forgetRefusals(account.cookie);
131898
+ }
131899
+ record2("proxy", result.status, result.body);
131900
+ return reply(200, result);
131901
+ } catch (e2) {
131902
+ if (e2 instanceof AccountSessionExpired) {
131903
+ webAccountMemberInstances.forgetSession(account.cookie);
131904
+ if (session.account === account) session.account = void 0;
131905
+ }
131906
+ if (e2 instanceof NotSiteMember || e2 instanceof SiteInstanceUnavailable || e2 instanceof AccountSessionExpired) {
131907
+ const refusal = memberInstanceRefusal(e2);
131908
+ record2("proxy", refusal.status, void 0);
131909
+ return reply(refusal.status, refusal.body);
131910
+ }
131911
+ record2("proxy", 502, void 0);
131912
+ return reply(502, { error: "webwix_bridge_upstream_failed" });
131913
+ }
131914
+ }
131915
+ }
131916
+ if (accountApp && !ownerRung && !session.account && /^[a-z][a-z0-9+.-]*:\/\//i.test(requestedPath) && allowedAccountTarget(method, requestedPath)) {
131917
+ return refuseEarly(401, "webwix_account_signed_out", logged);
131918
+ }
131351
131919
  if (ownerRung) {
131352
131920
  try {
131353
131921
  if (b2.checkOwnerSession !== true && method === "POST" && isOwnerSitesPath(requestedPath)) {
@@ -131403,11 +131971,16 @@ async function handleWebWix(req, res, state) {
131403
131971
  }
131404
131972
  }
131405
131973
  if (path2 === "/v1/__webwix/logout" && req.method === "POST") {
131974
+ if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
131406
131975
  session.memberToken = void 0;
131407
131976
  session.email = void 0;
131977
+ session.account = void 0;
131408
131978
  return reply(200, { ok: true });
131409
131979
  }
131410
131980
  if (path2 === "/v1/__webwix/identity" && (req.method === "GET" || req.method === "POST")) {
131981
+ if (accountApp && session.account) {
131982
+ return reply(200, { authenticated: true, mode: "account", userId: session.account.principal, email: "" });
131983
+ }
131411
131984
  if (!session.memberToken) return reply(200, { authenticated: false, userId: null, email: "" });
131412
131985
  const userId = await readMemberId(session.memberToken);
131413
131986
  const preferenceIdentity = session.email?.trim().toLowerCase() || userId;
@@ -131416,7 +131989,7 @@ async function handleWebWix(req, res, state) {
131416
131989
  userId: userId ?? session.email ?? null,
131417
131990
  email: session.email ?? "",
131418
131991
  preferenceContext: preferenceIdentity ? {
131419
- accountId: `m_${createHash20("sha256").update(preferenceIdentity).digest("hex")}`,
131992
+ accountId: `m_${createHash21("sha256").update(preferenceIdentity).digest("hex")}`,
131420
131993
  // Headless client IDs are site-bound and come from the server's app
131421
131994
  // configuration, never the URL's user-supplied business parameter.
131422
131995
  businessId: auth.clientId
@@ -131437,6 +132010,8 @@ async function handleWebWix(req, res, state) {
131437
132010
  session.memberToken = memberToken;
131438
132011
  session.visitorToken = visitorToken;
131439
132012
  session.email = String(b2.email ?? "");
132013
+ if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
132014
+ session.account = void 0;
131440
132015
  return reply(200, { ok: true, email: session.email });
131441
132016
  } catch (e2) {
131442
132017
  return reply(200, { ok: false, error: String(e2?.message ?? e2) });
@@ -132135,7 +132710,7 @@ async function readBundleFile(name, dir) {
132135
132710
  if (!roots.some((root) => path2.startsWith(root))) continue;
132136
132711
  try {
132137
132712
  const bytes2 = await readFile(path2);
132138
- const integrity2 = "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
132713
+ const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
132139
132714
  return { bytes: bytes2, integrity: integrity2 };
132140
132715
  } catch {
132141
132716
  }
@@ -132300,12 +132875,12 @@ function readActionHandlerManifest(app) {
132300
132875
  let decls;
132301
132876
  let bytes2;
132302
132877
  try {
132303
- decls = JSON.parse(readFileSync51(manifestPath, "utf8"));
132304
- bytes2 = readFileSync51(bundlePath);
132878
+ decls = JSON.parse(readFileSync52(manifestPath, "utf8"));
132879
+ bytes2 = readFileSync52(bundlePath);
132305
132880
  } catch {
132306
132881
  return { handlers: [] };
132307
132882
  }
132308
- const integrity2 = "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
132883
+ const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
132309
132884
  const bundleUrl = `/v1/action-handler-bundles/${app}`;
132310
132885
  return { handlers: decls.map((d2) => ({ id: d2.id, policy: d2.policy, description: d2.description, bundleUrl, integrity: integrity2 })) };
132311
132886
  }
@@ -132318,7 +132893,7 @@ async function handleActionHandlerBundleGet(res, app) {
132318
132893
  if (!path2.startsWith(ACTION_HANDLERS_ROOT)) return sendJson(res, 404, { error: "not_found" });
132319
132894
  try {
132320
132895
  const bytes2 = await readFile(path2);
132321
- const integrity2 = "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
132896
+ const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
132322
132897
  res.setHeader("content-type", "application/javascript; charset=utf-8");
132323
132898
  res.setHeader("cache-control", "max-age=300");
132324
132899
  res.setHeader("x-himalaya-bundle-integrity", integrity2);
@@ -132620,7 +133195,7 @@ function createDevServer(opts = {}) {
132620
133195
  const q2 = new URLSearchParams(url.split("?")[1] ?? "");
132621
133196
  const assetApp = q2.get("app") ?? state.appName;
132622
133197
  const assetDir = state.app && assetApp === state.app.name ? state.app.dir : resolveAppDir(assetApp);
132623
- const hit = assetDir ? collectAssets(assetDir).find((a2) => assetSha256(readFileSync51(a2.path)) === sha2) : void 0;
133198
+ const hit = assetDir ? collectAssets(assetDir).find((a2) => assetSha256(readFileSync52(a2.path)) === sha2) : void 0;
132624
133199
  if (!hit && assetDir) {
132625
133200
  const fontBytes = await fontFaceBytesBySha(assetDir, sha2);
132626
133201
  if (fontBytes) {
@@ -132643,7 +133218,7 @@ function createDevServer(opts = {}) {
132643
133218
  res.end(JSON.stringify({ error: "asset_not_found", app: assetApp, sha: sha2 }));
132644
133219
  return;
132645
133220
  }
132646
- const bytes2 = readFileSync51(hit.path);
133221
+ const bytes2 = readFileSync52(hit.path);
132647
133222
  res.writeHead(200, {
132648
133223
  "content-type": hit.contentType,
132649
133224
  "content-length": String(bytes2.length),
@@ -132736,7 +133311,7 @@ function createDevServer(opts = {}) {
132736
133311
  if (url === "/v1/schema/screen-descriptor.json" && req.method === "GET") {
132737
133312
  try {
132738
133313
  const schemaPath = resolve38(ROOT6, "core/schema/generated/screen-descriptor.schema.json");
132739
- const body = readFileSync51(schemaPath, "utf8");
133314
+ const body = readFileSync52(schemaPath, "utf8");
132740
133315
  return send(res, 200, body, {
132741
133316
  "content-type": "application/schema+json; charset=utf-8",
132742
133317
  "cache-control": "no-store",
@@ -132787,7 +133362,7 @@ function createDevServer(opts = {}) {
132787
133362
  try {
132788
133363
  const { parseRevocationsYaml: parseRevocationsYaml2 } = await Promise.resolve().then(() => (init_config2(), config_exports2));
132789
133364
  revoked = parseRevocationsYaml2(
132790
- readFileSync51(resolve38(state.app.dir, "revocations.yaml"), "utf8")
133365
+ readFileSync52(resolve38(state.app.dir, "revocations.yaml"), "utf8")
132791
133366
  ).revoked;
132792
133367
  } catch {
132793
133368
  }
@@ -133000,7 +133575,7 @@ ${err.message}`);
133000
133575
  });
133001
133576
  return httpServer;
133002
133577
  }
133003
- var ROOT6, TIER3_ROOT, TIER4_ROOT, tier4Verifier, TIER5_ROOT2, ACTION_HANDLERS_ROOT, SAMPLES_ROOT, TELEMETRY_BUFFER_CAP, overrideHistorySeq, CACHE_CONTROL, TIER5_SRC_ROOT, HMR_TMP_DIR, appReloadSeq, appReloadChain, WEBWIX_CLIENT_ID, WEBWIX_REDIRECT, WEBWIX_COOKIE, webOwnerPreviewInstances, MIME, widgetOverrides;
133578
+ var ROOT6, TIER3_ROOT, TIER4_ROOT, tier4Verifier, TIER5_ROOT2, ACTION_HANDLERS_ROOT, SAMPLES_ROOT, TELEMETRY_BUFFER_CAP, overrideHistorySeq, CACHE_CONTROL, TIER5_SRC_ROOT, HMR_TMP_DIR, appReloadSeq, appReloadChain, WEBWIX_CLIENT_ID, WEBWIX_REDIRECT, WEBWIX_COOKIE, webOwnerPreviewInstances, webAccountMemberInstances, MIME, widgetOverrides;
133004
133579
  var init_src6 = __esm({
133005
133580
  "../../core/dev-server/src/index.ts"() {
133006
133581
  init_inject();
@@ -133014,6 +133589,7 @@ var init_src6 = __esm({
133014
133589
  init_aria_realtime_dev();
133015
133590
  init_wix_member_login();
133016
133591
  init_wix_bridge();
133592
+ init_wix_account_session();
133017
133593
  init_flag_assignments();
133018
133594
  init_images();
133019
133595
  init_l10n();
@@ -133062,6 +133638,7 @@ var init_src6 = __esm({
133062
133638
  WEBWIX_REDIRECT = "himalaya-demo-app://oauth/callback";
133063
133639
  WEBWIX_COOKIE = "himi_webwix_session";
133064
133640
  webOwnerPreviewInstances = new OwnerInstanceCache(fetch);
133641
+ webAccountMemberInstances = new MemberInstanceCache(fetch);
133065
133642
  MIME = {
133066
133643
  ".html": "text/html; charset=utf-8",
133067
133644
  ".css": "text/css; charset=utf-8",
@@ -133081,9 +133658,9 @@ var init_src6 = __esm({
133081
133658
  });
133082
133659
 
133083
133660
  // ../../core/serve-storage/src/release-patch.ts
133084
- import { createHash as createHash21 } from "node:crypto";
133661
+ import { createHash as createHash22 } from "node:crypto";
133085
133662
  function sha256hex(b2) {
133086
- return createHash21("sha256").update(b2).digest("hex");
133663
+ return createHash22("sha256").update(b2).digest("hex");
133087
133664
  }
133088
133665
  function stableStringify(value) {
133089
133666
  if (value === null || typeof value !== "object") return JSON.stringify(value);
@@ -136014,11 +136591,11 @@ var init_dependencies = __esm({
136014
136591
  });
136015
136592
 
136016
136593
  // ../../core/functions-build/src/sbom.ts
136017
- import { createHash as createHash22 } from "node:crypto";
136594
+ import { createHash as createHash23 } from "node:crypto";
136018
136595
  function createFunctionSbom(packages) {
136019
136596
  const components2 = [...packages].sort((a2, b2) => a2.name.localeCompare(b2.name)).map(({ name, version: version4, integrity: integrity2, license }) => ({ name, version: version4, integrity: integrity2, license }));
136020
136597
  const body = JSON.stringify({ format: "himalaya-sbom-v1", components: components2 });
136021
- return { format: "himalaya-sbom-v1", components: components2, hash: createHash22("sha256").update(body).digest("hex") };
136598
+ return { format: "himalaya-sbom-v1", components: components2, hash: createHash23("sha256").update(body).digest("hex") };
136022
136599
  }
136023
136600
  var init_sbom = __esm({
136024
136601
  "../../core/functions-build/src/sbom.ts"() {
@@ -136026,12 +136603,12 @@ var init_sbom = __esm({
136026
136603
  });
136027
136604
 
136028
136605
  // ../../core/functions-build/src/build.ts
136029
- import { createHash as createHash23 } from "node:crypto";
136606
+ import { createHash as createHash24 } from "node:crypto";
136030
136607
  function sha2563(value) {
136031
- return createHash23("sha256").update(value).digest("hex");
136608
+ return createHash24("sha256").update(value).digest("hex");
136032
136609
  }
136033
136610
  function sri(value) {
136034
- return `sha256-${createHash23("sha256").update(value).digest("base64")}`;
136611
+ return `sha256-${createHash24("sha256").update(value).digest("base64")}`;
136035
136612
  }
136036
136613
  function schemaHash(schema) {
136037
136614
  if (!schema) return "";
@@ -136225,8 +136802,8 @@ __export(build_exports2, {
136225
136802
  withStoreNavBundle: () => withStoreNavBundle,
136226
136803
  withoutDevOnlyAppConfig: () => withoutDevOnlyAppConfig
136227
136804
  });
136228
- import { createHash as createHash24 } from "node:crypto";
136229
- import { readFileSync as readFileSync52, readdirSync as readdirSync25, existsSync as existsSync47 } from "node:fs";
136805
+ import { createHash as createHash25 } from "node:crypto";
136806
+ import { readFileSync as readFileSync53, readdirSync as readdirSync25, existsSync as existsSync47 } from "node:fs";
136230
136807
  import { dirname as dirname31, join as join47, resolve as resolve39 } from "node:path";
136231
136808
  import { fileURLToPath as fileURLToPath23 } from "node:url";
136232
136809
  import { createRequire as createRequire2 } from "node:module";
@@ -136272,7 +136849,7 @@ function l10nLintOptions(locale, appDir3) {
136272
136849
  const path2 = join47(appDir3, "l10n", `${tag}.json`);
136273
136850
  if (!existsSync47(path2)) continue;
136274
136851
  try {
136275
- const parsed = JSON.parse(readFileSync52(path2, "utf8"));
136852
+ const parsed = JSON.parse(readFileSync53(path2, "utf8"));
136276
136853
  for (const m2 of Object.values(parsed.messages ?? {})) {
136277
136854
  if (typeof m2?.source === "string" && typeof m2.translation === "string" && m2.translation.length > 0) {
136278
136855
  catalog3.add(m2.source);
@@ -136308,10 +136885,10 @@ function servesMessages(text9) {
136308
136885
  }
136309
136886
  }
136310
136887
  function sha2564(buf) {
136311
- return createHash24("sha256").update(buf).digest("hex");
136888
+ return createHash25("sha256").update(buf).digest("hex");
136312
136889
  }
136313
136890
  function sri2(buf) {
136314
- return "sha256-" + createHash24("sha256").update(buf).digest("base64");
136891
+ return "sha256-" + createHash25("sha256").update(buf).digest("base64");
136315
136892
  }
136316
136893
  async function widgetFailureDetail(res) {
136317
136894
  try {
@@ -136639,7 +137216,7 @@ async function buildReleaseFromContent(contentDir2, dest, opts = {}) {
136639
137216
  function readTokensForLint(preloaded) {
136640
137217
  try {
136641
137218
  const tokenPath = preloaded.module.designTokensPath ?? resolve39(preloaded.dir, uiConfig(preloaded.module.config).designTokensPath ?? "tokens.json");
136642
- const parsed = JSON.parse(readFileSync52(tokenPath, "utf8"));
137219
+ const parsed = JSON.parse(readFileSync53(tokenPath, "utf8"));
136643
137220
  delete parsed._meta;
136644
137221
  return parsed;
136645
137222
  } catch {
@@ -136661,7 +137238,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136661
137238
  };
136662
137239
  const readBundle = (name) => {
136663
137240
  const path2 = bundlePath(name);
136664
- return path2 ? readFileSync52(path2, "utf8") : void 0;
137241
+ return path2 ? readFileSync53(path2, "utf8") : void 0;
136665
137242
  };
136666
137243
  const collect2 = opts.collect;
136667
137244
  const config = preloaded.module.config;
@@ -136807,11 +137384,11 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136807
137384
  };
136808
137385
  checkRegistry(preloaded.module.actions);
136809
137386
  const contentManifestPath2 = join47(preloaded.dir, "himalaya.content.json");
136810
- const contentManifest = existsSync47(contentManifestPath2) ? JSON.parse(readFileSync52(contentManifestPath2, "utf8")) : void 0;
137387
+ const contentManifest = existsSync47(contentManifestPath2) ? JSON.parse(readFileSync53(contentManifestPath2, "utf8")) : void 0;
136811
137388
  let screenMetadata = parseScreenMetadata(contentManifest?.screens);
136812
137389
  if (contentManifest?.shell === "brandy" && screenMetadata) {
136813
137390
  const provisioningPath2 = join47(preloaded.dir, "provisioning.json");
136814
- if (existsSync47(provisioningPath2)) screenMetadata = siteViewMetadataForBuild(screenMetadata, JSON.parse(readFileSync52(provisioningPath2, "utf8")).site);
137391
+ if (existsSync47(provisioningPath2)) screenMetadata = siteViewMetadataForBuild(screenMetadata, JSON.parse(readFileSync53(provisioningPath2, "utf8")).site);
136815
137392
  }
136816
137393
  await store.reset(app);
136817
137394
  const bundles = {};
@@ -136848,7 +137425,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136848
137425
  try {
136849
137426
  const path2 = bundlePath(name);
136850
137427
  if (!path2) return null;
136851
- bytes2 = readFileSync52(path2);
137428
+ bytes2 = readFileSync53(path2);
136852
137429
  } catch {
136853
137430
  return null;
136854
137431
  }
@@ -136872,7 +137449,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136872
137449
  for (const [name, file2] of [["spec", "SPEC.md"], ["mobile-ux", "MOBILE-UX.md"]]) {
136873
137450
  const path2 = join47(preloaded.dir, file2);
136874
137451
  if (!existsSync47(path2)) continue;
136875
- const bytes2 = readFileSync52(path2);
137452
+ const bytes2 = readFileSync53(path2);
136876
137453
  if (bytes2.length === 0 || bytes2.length > MAX_AUTHORING_DOC_BYTES) {
136877
137454
  throw new Error(`${file2} must be non-empty and at most ${MAX_AUTHORING_DOC_BYTES} bytes to ship with a release.`);
136878
137455
  }
@@ -136887,7 +137464,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136887
137464
  const iconPath = resolveAppDirIcon(preloaded.dir);
136888
137465
  if (iconPath) {
136889
137466
  try {
136890
- const bytes2 = readFileSync52(iconPath);
137467
+ const bytes2 = readFileSync53(iconPath);
136891
137468
  await store.putIcon(app, bytes2);
136892
137469
  iconHash = sha2564(bytes2);
136893
137470
  } catch {
@@ -136909,7 +137486,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136909
137486
  }
136910
137487
  const seenAssetSha = /* @__PURE__ */ new Set();
136911
137488
  for (const a2 of collected) {
136912
- const bytes2 = readFileSync52(a2.path);
137489
+ const bytes2 = readFileSync53(a2.path);
136913
137490
  const hash2 = sha2564(bytes2);
136914
137491
  if (!seenAssetSha.has(hash2)) {
136915
137492
  await store.putAsset(app, hash2, bytes2, a2.contentType);
@@ -136931,7 +137508,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136931
137508
  const fontWarnings = [];
136932
137509
  try {
136933
137510
  const appTokens = readTokensForLint(preloaded) ?? {};
136934
- const policy = existsSync47(join47(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync52(join47(preloaded.dir, "fonts.json"), "utf8")) : {};
137511
+ const policy = existsSync47(join47(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync53(join47(preloaded.dir, "fonts.json"), "utf8")) : {};
136935
137512
  fontPlan = planFonts(appTokens, policy);
136936
137513
  } catch (err) {
136937
137514
  throw new Error(
@@ -136947,7 +137524,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136947
137524
  `[release-build] ${family.name} face ${face.postScriptName} has no local bytes (sha ${face.sha256.slice(0, 12)}\u2026), so the release would declare a face the asset route cannot serve. Run \`npm run fonts:catalog\` to warm the cache before publishing.`
136948
137525
  );
136949
137526
  }
136950
- const bytes2 = readFileSync52(src);
137527
+ const bytes2 = readFileSync53(src);
136951
137528
  const hash2 = sha2564(bytes2);
136952
137529
  if (hash2 !== face.sha256) {
136953
137530
  throw new Error(
@@ -136997,7 +137574,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136997
137574
  if (store.putAsset) {
136998
137575
  for (const face of collectBrandFonts(preloaded.dir)) {
136999
137576
  try {
137000
- const bytes2 = readFileSync52(face.path);
137577
+ const bytes2 = readFileSync53(face.path);
137001
137578
  if (bytes2.length === 0) continue;
137002
137579
  const hash2 = sha2564(bytes2);
137003
137580
  await store.putAsset(app, hash2, bytes2, "font/ttf");
@@ -137464,7 +138041,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
137464
138041
  const candidates = [".ts", ".js", ".mts", ".mjs"].map((extension) => join47(preloaded.dir, "functions", `${definition.name}${extension}`));
137465
138042
  const source = candidates.find((candidate) => existsSync47(candidate));
137466
138043
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
137467
- sources[definition.name] = readFileSync52(source, "utf8");
138044
+ sources[definition.name] = readFileSync53(source, "utf8");
137468
138045
  }
137469
138046
  const built = await buildFunctions(config.functions.functions, sources);
137470
138047
  const bundles = {};
@@ -138099,7 +138676,7 @@ __export(build_changes_exports, {
138099
138676
  diffTokens: () => diffTokens,
138100
138677
  headline: () => headline
138101
138678
  });
138102
- import { existsSync as existsSync48, readdirSync as readdirSync26, readFileSync as readFileSync53 } from "node:fs";
138679
+ import { existsSync as existsSync48, readdirSync as readdirSync26, readFileSync as readFileSync54 } from "node:fs";
138103
138680
  import { join as join48 } from "node:path";
138104
138681
  function componentsOf(descriptor) {
138105
138682
  const out2 = /* @__PURE__ */ new Map();
@@ -138239,7 +138816,7 @@ var init_build_changes = __esm({
138239
138816
  scalar2 = (v2) => typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean";
138240
138817
  readJson3 = (path2) => {
138241
138818
  try {
138242
- return JSON.parse(readFileSync53(path2, "utf8"));
138819
+ return JSON.parse(readFileSync54(path2, "utf8"));
138243
138820
  } catch {
138244
138821
  return void 0;
138245
138822
  }
@@ -138256,7 +138833,7 @@ var init_build_changes = __esm({
138256
138833
  });
138257
138834
 
138258
138835
  // src/studio-timeline.ts
138259
- import { existsSync as existsSync49, readFileSync as readFileSync54 } from "node:fs";
138836
+ import { existsSync as existsSync49, readFileSync as readFileSync55 } from "node:fs";
138260
138837
  import { join as join49 } from "node:path";
138261
138838
  function stateOf(view) {
138262
138839
  const j2 = view.journal[0];
@@ -138327,7 +138904,7 @@ function readTimeline(dir) {
138327
138904
  const file2 = join49(dir, TIMELINE_FILE);
138328
138905
  if (!existsSync49(file2)) return [];
138329
138906
  const out2 = [];
138330
- for (const line of readFileSync54(file2, "utf8").split("\n")) {
138907
+ for (const line of readFileSync55(file2, "utf8").split("\n")) {
138331
138908
  if (!line.trim()) continue;
138332
138909
  try {
138333
138910
  const f2 = JSON.parse(line);
@@ -138420,8 +138997,8 @@ __export(studio_exports, {
138420
138997
  renderStudioHtml: () => renderStudioHtml,
138421
138998
  writeStudioRecord: () => writeStudioRecord
138422
138999
  });
138423
- import { createHash as createHash25 } from "node:crypto";
138424
- import { existsSync as existsSync50, readdirSync as readdirSync27, readFileSync as readFileSync55, realpathSync as realpathSync8, statSync as statSync12 } from "node:fs";
139000
+ import { createHash as createHash26 } from "node:crypto";
139001
+ import { existsSync as existsSync50, readdirSync as readdirSync27, readFileSync as readFileSync56, realpathSync as realpathSync8, statSync as statSync12 } from "node:fs";
138425
139002
  import { basename as basename11, extname as extname3, join as join50, relative as relative9, resolve as resolve40, sep as sep11 } from "node:path";
138426
139003
  import { pathToFileURL as pathToFileURL7 } from "node:url";
138427
139004
  function realInside(dir, abs) {
@@ -138452,7 +139029,7 @@ function archiveFile(dir, memory, abs) {
138452
139029
  }
138453
139030
  let archived;
138454
139031
  try {
138455
- archived = archiveBytes(dir, readFileSync55(real));
139032
+ archived = archiveBytes(dir, readFileSync56(real));
138456
139033
  } catch {
138457
139034
  return null;
138458
139035
  }
@@ -138702,7 +139279,7 @@ function buildView(dir, memory, now) {
138702
139279
  reveal: memory.reveal ?? null
138703
139280
  };
138704
139281
  const { generatedAt: _ignored, timelineFrames: _count, ...stable } = view;
138705
- const v2 = createHash25("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
139282
+ const v2 = createHash26("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
138706
139283
  return { v: v2, ...view };
138707
139284
  }
138708
139285
  function writeAtomic(file2, content) {
@@ -138780,7 +139357,7 @@ var init_studio = __esm({
138780
139357
  MAX_NAV_EDGES = 40;
138781
139358
  readJson4 = (file2) => {
138782
139359
  try {
138783
- return JSON.parse(readFileSync55(file2, "utf8"));
139360
+ return JSON.parse(readFileSync56(file2, "utf8"));
138784
139361
  } catch {
138785
139362
  return null;
138786
139363
  }
@@ -139344,11 +139921,11 @@ __export(captcha_exports, {
139344
139921
  captchaContentInput: () => captchaContentInput,
139345
139922
  runCaptcha: () => runCaptcha
139346
139923
  });
139347
- import { readFileSync as readFileSync56 } from "node:fs";
139924
+ import { readFileSync as readFileSync57 } from "node:fs";
139348
139925
  import { resolve as resolve41 } from "node:path";
139349
139926
  function readObject(path2) {
139350
139927
  try {
139351
- return JSON.parse(readFileSync56(path2, "utf8"));
139928
+ return JSON.parse(readFileSync57(path2, "utf8"));
139352
139929
  } catch {
139353
139930
  return {};
139354
139931
  }
@@ -139418,7 +139995,7 @@ __export(preflight_exports, {
139418
139995
  parseStoreConfig: () => parseStoreConfig,
139419
139996
  requireEnv: () => requireEnv
139420
139997
  });
139421
- import { existsSync as existsSync51, readFileSync as readFileSync57 } from "node:fs";
139998
+ import { existsSync as existsSync51, readFileSync as readFileSync58 } from "node:fs";
139422
139999
  import { isAbsolute as isAbsolute4, relative as relative10, resolve as resolve42 } from "node:path";
139423
140000
  function isInsideRepo(p2) {
139424
140001
  const rel = relative10(REPO_ROOT3, resolve42(p2));
@@ -139478,7 +140055,7 @@ function loadStoreConfig(app) {
139478
140055
  if (!existsSync51(p2)) {
139479
140056
  throw new Error(`No store config at ${p2}. Create apps/${app}/store/store.config.yaml first (see /setup-store-signing).`);
139480
140057
  }
139481
- return parseStoreConfig(readFileSync57(p2, "utf8"));
140058
+ return parseStoreConfig(readFileSync58(p2, "utf8"));
139482
140059
  }
139483
140060
  var init_preflight = __esm({
139484
140061
  "../store-release/preflight.ts"() {
@@ -145548,7 +146125,7 @@ var init_fxp = __esm({
145548
146125
  });
145549
146126
 
145550
146127
  // ../../packages/serve/src/pkcs12.ts
145551
- import { X509Certificate, createHash as createHash26, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
146128
+ import { X509Certificate, createHash as createHash27, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
145552
146129
  function decodePkcs12(der, password) {
145553
146130
  try {
145554
146131
  const pfx = readSequence(der, 0);
@@ -145822,7 +146399,7 @@ function expand(src, v2) {
145822
146399
  return out2;
145823
146400
  }
145824
146401
  function sha12(data) {
145825
- return createHash26("sha1").update(data).digest();
146402
+ return createHash27("sha1").update(data).digest();
145826
146403
  }
145827
146404
  function readAt(buf, i2) {
145828
146405
  if (i2 >= buf.length) return void 0;
@@ -145911,7 +146488,7 @@ var init_pkcs12 = __esm({
145911
146488
  });
145912
146489
 
145913
146490
  // ../../packages/serve/src/customer-signing-assets.ts
145914
- import { createHash as createHash27 } from "node:crypto";
146491
+ import { createHash as createHash28 } from "node:crypto";
145915
146492
  function readValue(node) {
145916
146493
  const [tag, children] = Object.entries(node)[0] ?? [];
145917
146494
  if (!tag || !Array.isArray(children)) return refuse3("customer_profile_invalid");
@@ -145989,7 +146566,7 @@ function toBundle(assets, expected, decoded, profileType, apns, deviceCount) {
145989
146566
  provisioningProfile: Buffer.from(assets.provisioningProfile).toString("base64"),
145990
146567
  profileSha256: sha2565(assets.provisioningProfile),
145991
146568
  certificateSha256: sha2565(decoded.cert.raw),
145992
- certificateSha1: createHash27("sha1").update(decoded.cert.raw).digest("hex").toUpperCase(),
146569
+ certificateSha1: createHash28("sha1").update(decoded.cert.raw).digest("hex").toUpperCase(),
145993
146570
  expiresAt: new Date(Math.min(decoded.expiration, Date.parse(decoded.cert.validTo))).toISOString(),
145994
146571
  ...apns ? { apnsEnvironment: apns } : {},
145995
146572
  deviceCount
@@ -146040,7 +146617,7 @@ var init_customer_signing_assets = __esm({
146040
146617
  init_fxp();
146041
146618
  init_pkcs12();
146042
146619
  init_customer_dist_signing();
146043
- sha2565 = (bytes2) => createHash27("sha256").update(bytes2).digest("hex");
146620
+ sha2565 = (bytes2) => createHash28("sha256").update(bytes2).digest("hex");
146044
146621
  refuse3 = (code) => {
146045
146622
  throw new CustomerSigningError(code);
146046
146623
  };
@@ -146207,11 +146784,11 @@ var init_customer_signing_inspect = __esm({
146207
146784
  });
146208
146785
 
146209
146786
  // src/push-onboarding.ts
146210
- import { existsSync as existsSync52, mkdirSync as mkdirSync24, readFileSync as readFileSync58, statSync as statSync13, writeFileSync as writeFileSync20, chmodSync as chmodSync2 } from "node:fs";
146787
+ import { existsSync as existsSync52, mkdirSync as mkdirSync24, readFileSync as readFileSync59, statSync as statSync13, writeFileSync as writeFileSync20, chmodSync as chmodSync2 } from "node:fs";
146211
146788
  import { basename as basename12, dirname as dirname32, join as join51, resolve as resolve43 } from "node:path";
146212
146789
  function readJson5(path2) {
146213
146790
  try {
146214
- const parsed = JSON.parse(readFileSync58(path2, "utf8"));
146791
+ const parsed = JSON.parse(readFileSync59(path2, "utf8"));
146215
146792
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
146216
146793
  } catch {
146217
146794
  return {};
@@ -146296,7 +146873,7 @@ function readKeyFile(path2) {
146296
146873
  }
146297
146874
  let body;
146298
146875
  try {
146299
- body = readFileSync58(path2, "utf8");
146876
+ body = readFileSync59(path2, "utf8");
146300
146877
  } catch {
146301
146878
  return { ok: false, code: "key_file_unreadable", reason: "cannot read the selected key file; check its path and file permissions" };
146302
146879
  }
@@ -146454,7 +147031,7 @@ var signing_inspect_exports = {};
146454
147031
  __export(signing_inspect_exports, {
146455
147032
  runSigningInspect: () => runSigningInspect
146456
147033
  });
146457
- import { existsSync as existsSync53, readFileSync as readFileSync59, statSync as statSync14 } from "node:fs";
147034
+ import { existsSync as existsSync53, readFileSync as readFileSync60, statSync as statSync14 } from "node:fs";
146458
147035
  import { isAbsolute as isAbsolute5, resolve as resolve44 } from "node:path";
146459
147036
  function fail3(io2, code, fields = {}) {
146460
147037
  io2.error(JSON.stringify({ ok: false, code, ...fields }));
@@ -146551,9 +147128,9 @@ async function runSigningInspect(pos, flags, io2, deps = {}) {
146551
147128
  return fail3(io2, "signing_inspect_local_assets_unreadable", { error: "cert or profile file is unexpectedly large" });
146552
147129
  }
146553
147130
  assets = {
146554
- certificate: readFileSync59(certPath),
147131
+ certificate: readFileSync60(certPath),
146555
147132
  certificatePassword: text4(flags["cert-password"]),
146556
- provisioningProfile: readFileSync59(profilePath2)
147133
+ provisioningProfile: readFileSync60(profilePath2)
146557
147134
  };
146558
147135
  }
146559
147136
  try {
@@ -146838,7 +147415,7 @@ __export(config_push_edit_exports, {
146838
147415
  enablePushInConfig: () => enablePushInConfig,
146839
147416
  previewPushConfigEdit: () => previewPushConfigEdit
146840
147417
  });
146841
- import { readFileSync as readFileSync60 } from "node:fs";
147418
+ import { readFileSync as readFileSync61 } from "node:fs";
146842
147419
  import { basename as basename13 } from "node:path";
146843
147420
  import ts6 from "typescript";
146844
147421
  function enablePushInConfig(source, options) {
@@ -146958,7 +147535,7 @@ function noLiteralInstruction(pingAppName) {
146958
147535
  function previewPushConfigEdit(dir, options) {
146959
147536
  const path2 = configEntry(dir);
146960
147537
  if (!path2) return void 0;
146961
- const { applied, instructions } = enablePushInConfig(readFileSync60(path2, "utf8"), { ...options, fileName: basename13(path2) });
147538
+ const { applied, instructions } = enablePushInConfig(readFileSync61(path2, "utf8"), { ...options, fileName: basename13(path2) });
146962
147539
  return { wouldApply: applied, instructions };
146963
147540
  }
146964
147541
  async function applyPushConfigEdit(dir, options, validate4) {
@@ -146967,7 +147544,7 @@ async function applyPushConfigEdit(dir, options, validate4) {
146967
147544
  const fileName = basename13(path2);
146968
147545
  const refuse7 = (why) => ({ changed: false, pushOn: false, applied: [], instructions: [why] });
146969
147546
  if (isSymlink2(path2)) return refuse7(`${fileName} is a symlink, so it was not edited: turn push on in the file it points to.`);
146970
- const original = readFileSync60(path2, "utf8");
147547
+ const original = readFileSync61(path2, "utf8");
146971
147548
  const edit = enablePushInConfig(original, { ...options, fileName });
146972
147549
  const { applied, instructions, pushOn } = edit;
146973
147550
  if (!edit.changed) return { changed: false, pushOn, applied, instructions };
@@ -147285,9 +147862,9 @@ __export(pack_exports, {
147285
147862
  unpackTo: () => unpackTo,
147286
147863
  writeZip: () => writeZip
147287
147864
  });
147288
- import { createHash as createHash28 } from "node:crypto";
147865
+ import { createHash as createHash29 } from "node:crypto";
147289
147866
  import { deflateRawSync, inflateRawSync } from "node:zlib";
147290
- import { existsSync as existsSync54, mkdirSync as mkdirSync25, readFileSync as readFileSync61, readdirSync as readdirSync28, rmSync as rmSync12, statSync as statSync15, writeFileSync as writeFileSync21 } from "node:fs";
147867
+ import { existsSync as existsSync54, mkdirSync as mkdirSync25, readFileSync as readFileSync62, readdirSync as readdirSync28, rmSync as rmSync12, statSync as statSync15, writeFileSync as writeFileSync21 } from "node:fs";
147291
147868
  import { dirname as dirname33, join as join53, resolve as resolve46 } from "node:path";
147292
147869
  function writeZip(entries) {
147293
147870
  const sorted2 = entries.slice().sort((a2, b2) => a2.path < b2.path ? -1 : a2.path > b2.path ? 1 : 0);
@@ -147382,7 +147959,7 @@ function inflateEntry(buf, entry) {
147382
147959
  return bytes2;
147383
147960
  }
147384
147961
  function readIf(path2) {
147385
- return existsSync54(path2) && statSync15(path2).isFile() ? readFileSync61(path2) : null;
147962
+ return existsSync54(path2) && statSync15(path2).isFile() ? readFileSync62(path2) : null;
147386
147963
  }
147387
147964
  function listDir(dir) {
147388
147965
  return existsSync54(dir) ? readdirSync28(dir).filter((f2) => statSync15(join53(dir, f2)).isFile()) : [];
@@ -147435,11 +148012,11 @@ function gatherReleaseEntries(appDir3) {
147435
148012
  return { entries, manifest, skipped };
147436
148013
  }
147437
148014
  function sha256Hex4(bytes2) {
147438
- return createHash28("sha256").update(bytes2).digest("hex");
148015
+ return createHash29("sha256").update(bytes2).digest("hex");
147439
148016
  }
147440
148017
  function computeContentHash(entries) {
147441
148018
  const input = packageHashInput(entries.map((e2) => ({ path: e2.path, hash: sha256Hex4(e2.bytes) })));
147442
- return "sha256-" + createHash28("sha256").update(input).digest("base64");
148019
+ return "sha256-" + createHash29("sha256").update(input).digest("base64");
147443
148020
  }
147444
148021
  function buildEntries(appDir3, app, opts) {
147445
148022
  const { entries: released, manifest, skipped } = gatherReleaseEntries(appDir3);
@@ -147532,7 +148109,7 @@ function openPackageBuffer(buf) {
147532
148109
  return openFromEntries(readZip(buf), { requireHeader: true });
147533
148110
  }
147534
148111
  function openPackageFile(file2) {
147535
- return openPackageBuffer(readFileSync61(file2));
148112
+ return openPackageBuffer(readFileSync62(file2));
147536
148113
  }
147537
148114
  function openPackageDir(dir) {
147538
148115
  const root = resolve46(dir);
@@ -147543,7 +148120,7 @@ function openPackageDir(dir) {
147543
148120
  const childRel = rel ? `${rel}/${name}` : name;
147544
148121
  const childAbs = join53(abs, name);
147545
148122
  if (statSync15(childAbs).isDirectory()) walk2(childRel);
147546
- else if (isSafeEntryName(childRel)) entries.set(childRel, readFileSync61(childAbs));
148123
+ else if (isSafeEntryName(childRel)) entries.set(childRel, readFileSync62(childAbs));
147547
148124
  }
147548
148125
  };
147549
148126
  if (!existsSync54(root)) throw new Error(`no such package directory: ${root}`);
@@ -147630,8 +148207,8 @@ __export(app_source_exports, {
147630
148207
  writeConflicts: () => writeConflicts,
147631
148208
  zipAppSource: () => zipAppSource
147632
148209
  });
147633
- import { createHash as createHash29 } from "node:crypto";
147634
- import { readdirSync as readdirSync29, lstatSync as lstatSync15, readFileSync as readFileSync62, mkdirSync as mkdirSync26, writeFileSync as writeFileSync22, existsSync as existsSync55, rmSync as rmSync13, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
148210
+ import { createHash as createHash30 } from "node:crypto";
148211
+ import { readdirSync as readdirSync29, lstatSync as lstatSync15, readFileSync as readFileSync63, mkdirSync as mkdirSync26, writeFileSync as writeFileSync22, existsSync as existsSync55, rmSync as rmSync13, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
147635
148212
  import { join as join54, resolve as resolve47, sep as sep13 } from "node:path";
147636
148213
  import { createRequire as createRequire3 } from "node:module";
147637
148214
  import { deflateRawSync as deflateRawSync2 } from "node:zlib";
@@ -147665,7 +148242,7 @@ function collectAppSource(dir) {
147665
148242
  const skipped = [];
147666
148243
  walkSourceTree(
147667
148244
  dir,
147668
- (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync62(join54(dir, hostRel)) }),
148245
+ (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync63(join54(dir, hostRel)) }),
147669
148246
  (hostRel) => skipped.push(hostRel)
147670
148247
  );
147671
148248
  entries.sort((a2, b2) => a2.path < b2.path ? -1 : a2.path > b2.path ? 1 : 0);
@@ -147746,13 +148323,13 @@ function sourceFingerprint(dir) {
147746
148323
  dir,
147747
148324
  (archivePath, hostRel) => {
147748
148325
  if (/\.md$/i.test(archivePath)) return;
147749
- files.push(`${archivePath}\0${createHash29("sha256").update(readFileSync62(join54(dir, hostRel))).digest("hex")}`);
148326
+ files.push(`${archivePath}\0${createHash30("sha256").update(readFileSync63(join54(dir, hostRel))).digest("hex")}`);
147750
148327
  },
147751
148328
  () => {
147752
148329
  }
147753
148330
  );
147754
148331
  files.sort();
147755
- return createHash29("sha256").update(files.join("\n")).digest("hex");
148332
+ return createHash30("sha256").update(files.join("\n")).digest("hex");
147756
148333
  }
147757
148334
  function largestEntries(entries, limit = 5) {
147758
148335
  return entries.map((e2) => ({
@@ -147959,7 +148536,7 @@ __export(run_watch_exports, {
147959
148536
  watchedContentDir: () => watchedContentDir,
147960
148537
  writeRunRecord: () => writeRunRecord
147961
148538
  });
147962
- import { closeSync as closeSync4, constants as constants2, existsSync as existsSync56, fstatSync, lstatSync as lstatSync16, statSync as statSync16, readdirSync as readdirSync30, mkdirSync as mkdirSync27, openSync as openSync4, readFileSync as readFileSync63, realpathSync as realpathSync9, renameSync as renameSync10, rmSync as rmSync14, writeFileSync as writeFileSync23, watch as fsWatch } from "node:fs";
148539
+ import { closeSync as closeSync4, constants as constants2, existsSync as existsSync56, fstatSync, lstatSync as lstatSync16, statSync as statSync16, readdirSync as readdirSync30, mkdirSync as mkdirSync27, openSync as openSync4, readFileSync as readFileSync64, realpathSync as realpathSync9, renameSync as renameSync10, rmSync as rmSync14, writeFileSync as writeFileSync23, watch as fsWatch } from "node:fs";
147963
148540
  import { randomUUID as randomUUID6 } from "node:crypto";
147964
148541
  import { extname as extname4, join as join55, resolve as resolve48, sep as sep14 } from "node:path";
147965
148542
  function diffReleases(prev, next) {
@@ -148217,7 +148794,7 @@ function readConfined(root, rel) {
148217
148794
  const fd = openSync4(at2, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0));
148218
148795
  try {
148219
148796
  if (!fstatSync(fd).isFile()) return null;
148220
- return readFileSync63(fd);
148797
+ return readFileSync64(fd);
148221
148798
  } finally {
148222
148799
  closeSync4(fd);
148223
148800
  }
@@ -148274,8 +148851,8 @@ __export(screen_state_exports, {
148274
148851
  shotStateFor: () => shotStateFor,
148275
148852
  withHomeCaveat: () => withHomeCaveat
148276
148853
  });
148277
- import { createHash as createHash30 } from "node:crypto";
148278
- import { lstatSync as lstatSync17, readFileSync as readFileSync64 } from "node:fs";
148854
+ import { createHash as createHash31 } from "node:crypto";
148855
+ import { lstatSync as lstatSync17, readFileSync as readFileSync65 } from "node:fs";
148279
148856
  import { join as join56 } from "node:path";
148280
148857
  function quotableLine(text9) {
148281
148858
  if (!text9) return void 0;
@@ -148335,7 +148912,7 @@ function readRecord(dir) {
148335
148912
  const file2 = join56(dir, SHOT_STATES_FILE);
148336
148913
  try {
148337
148914
  if (!lstatSync17(file2).isFile()) return {};
148338
- const r2 = JSON.parse(readFileSync64(file2, "utf8"));
148915
+ const r2 = JSON.parse(readFileSync65(file2, "utf8"));
148339
148916
  return r2.v === 1 && r2.shots && typeof r2.shots === "object" ? r2.shots : {};
148340
148917
  } catch {
148341
148918
  return {};
@@ -148394,7 +148971,7 @@ var init_screen_state = __esm({
148394
148971
  KEEP = 40;
148395
148972
  LINE_MAX = 120;
148396
148973
  str3 = (v2) => typeof v2 === "string" && v2.trim() ? v2 : void 0;
148397
- sha256Of = (file2) => createHash30("sha256").update(readFileSync64(file2)).digest("hex");
148974
+ sha256Of = (file2) => createHash31("sha256").update(readFileSync65(file2)).digest("hex");
148398
148975
  }
148399
148976
  });
148400
148977
 
@@ -148409,8 +148986,8 @@ __export(studio_reel_exports, {
148409
148986
  thin: () => thin,
148410
148987
  utcDay: () => utcDay
148411
148988
  });
148412
- import { createHash as createHash31 } from "node:crypto";
148413
- import { lstatSync as lstatSync18, readFileSync as readFileSync65 } from "node:fs";
148989
+ import { createHash as createHash32 } from "node:crypto";
148990
+ import { lstatSync as lstatSync18, readFileSync as readFileSync66 } from "node:fs";
148414
148991
  import { basename as basename14, join as join57 } from "node:path";
148415
148992
  function loadMemory2(dir) {
148416
148993
  const m2 = readJson6(join57(dir, ".himi", "studio", "memory.json"));
@@ -148497,8 +149074,8 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
148497
149074
  const path2 = join57(dir, HISTORY_DIR, f2);
148498
149075
  const st2 = lstatSync18(path2);
148499
149076
  if (!st2.isFile() || st2.nlink !== 1) return null;
148500
- const bytes2 = readFileSync65(path2);
148501
- return createHash31("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
149077
+ const bytes2 = readFileSync66(path2);
149078
+ return createHash32("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
148502
149079
  } catch {
148503
149080
  return null;
148504
149081
  }
@@ -148631,7 +149208,7 @@ var init_studio_reel = __esm({
148631
149208
  mimeOf = (file2) => MIME2[file2.slice(65)] ?? "image/png";
148632
149209
  readJson6 = (file2) => {
148633
149210
  try {
148634
- return JSON.parse(readFileSync65(file2, "utf8"));
149211
+ return JSON.parse(readFileSync66(file2, "utf8"));
148635
149212
  } catch {
148636
149213
  return null;
148637
149214
  }
@@ -148648,12 +149225,12 @@ var init_studio_reel = __esm({
148648
149225
  });
148649
149226
 
148650
149227
  // src/home-screen-id.ts
148651
- import { readFileSync as readFileSync66 } from "node:fs";
149228
+ import { readFileSync as readFileSync67 } from "node:fs";
148652
149229
  import { join as join58 } from "node:path";
148653
149230
  function homeScreenIdOf(dir) {
148654
149231
  let src;
148655
149232
  try {
148656
- src = readFileSync66(join58(dir, "dev", "index.ts"), "utf8");
149233
+ src = readFileSync67(join58(dir, "dev", "index.ts"), "utf8");
148657
149234
  } catch {
148658
149235
  return null;
148659
149236
  }
@@ -148719,9 +149296,9 @@ __export(milestones_exports, {
148719
149296
  watchUrlFor: () => watchUrlFor,
148720
149297
  writeHandoverReel: () => writeHandoverReel
148721
149298
  });
148722
- import { createHash as createHash32, randomUUID as randomUUID7 } from "node:crypto";
149299
+ import { createHash as createHash33, randomUUID as randomUUID7 } from "node:crypto";
148723
149300
  import { spawn as spawn5 } from "node:child_process";
148724
- import { closeSync as closeSync5, existsSync as existsSync57, lstatSync as lstatSync19, readFileSync as readFileSync67, statSync as statSync17 } from "node:fs";
149301
+ import { closeSync as closeSync5, existsSync as existsSync57, lstatSync as lstatSync19, readFileSync as readFileSync68, statSync as statSync17 } from "node:fs";
148725
149302
  import { createServer as createServer4 } from "node:net";
148726
149303
  import { basename as basename15, dirname as dirname34, isAbsolute as isAbsolute6, join as join59, relative as relative11, resolve as resolve49, sep as sep15 } from "node:path";
148727
149304
  function homeShotPath(dir, home) {
@@ -149067,7 +149644,7 @@ function lastDraft(dir) {
149067
149644
  try {
149068
149645
  const file2 = join59(dir, LAST_DRAFT_FILE);
149069
149646
  if (!lstatSync19(file2).isFile()) return null;
149070
- const r2 = JSON.parse(readFileSync67(file2, "utf8"));
149647
+ const r2 = JSON.parse(readFileSync68(file2, "utf8"));
149071
149648
  const m2 = r2.manifest;
149072
149649
  if (r2.v !== 1 || typeof r2.releaseId !== "string" || !m2 || typeof m2.screens !== "object" || !m2.screens || typeof m2.bundles !== "object" || !m2.bundles) return null;
149073
149650
  return { releaseId: r2.releaseId, manifest: m2 };
@@ -149129,7 +149706,7 @@ function readInitSource(dir) {
149129
149706
  const file2 = join59(dir, INIT_SOURCE_FILE);
149130
149707
  try {
149131
149708
  if (!lstatSync19(file2).isFile()) return null;
149132
- const r2 = JSON.parse(readFileSync67(file2, "utf8"));
149709
+ const r2 = JSON.parse(readFileSync68(file2, "utf8"));
149133
149710
  if (r2.v !== 1 || typeof r2.fingerprint !== "string" || !/^[0-9a-f]{64}$/.test(r2.fingerprint) || typeof r2.newestMs !== "number") return null;
149134
149711
  return {
149135
149712
  v: 1,
@@ -149217,7 +149794,7 @@ function readInitWatch(dir) {
149217
149794
  const file2 = join59(dir, INIT_WATCH_FILE);
149218
149795
  try {
149219
149796
  if (!lstatSync19(file2).isFile()) return null;
149220
- const r2 = JSON.parse(readFileSync67(file2, "utf8"));
149797
+ const r2 = JSON.parse(readFileSync68(file2, "utf8"));
149221
149798
  if (r2.v !== 1 || typeof r2.pid !== "number" || !Number.isInteger(r2.pid) || r2.pid < 1) return null;
149222
149799
  if (typeof r2.url !== "string" || !/^http:\/\/127\.0\.0\.1:\d+\//.test(r2.url) || typeof r2.board !== "string" || typeof r2.log !== "string" || typeof r2.startedAt !== "string") return null;
149223
149800
  if (r2.root !== runRootId(dir)) return null;
@@ -149249,7 +149826,7 @@ function watchReminder(dir, opts = {}) {
149249
149826
  const file2 = join59(dir, REMINDERS_FILE);
149250
149827
  let last = Number.NaN;
149251
149828
  try {
149252
- if (lstatSync19(file2).isFile()) last = Date.parse(JSON.parse(readFileSync67(file2, "utf8")).watch ?? "");
149829
+ if (lstatSync19(file2).isFile()) last = Date.parse(JSON.parse(readFileSync68(file2, "utf8")).watch ?? "");
149253
149830
  } catch {
149254
149831
  }
149255
149832
  if (Number.isFinite(last) && now - last >= 0 && now - last < WATCH_REMINDER_EVERY_MS) return void 0;
@@ -149409,7 +149986,7 @@ var init_milestones = __esm({
149409
149986
  INIT_SOURCE_FILE = join59(".himi", "init-source.json");
149410
149987
  STARTING_POINT_REF = "starting-point";
149411
149988
  TEMPLATE_NAME = /^[A-Za-z0-9._-]{1,64}$/;
149412
- sha256Of2 = (file2) => createHash32("sha256").update(readFileSync67(file2)).digest("hex");
149989
+ sha256Of2 = (file2) => createHash33("sha256").update(readFileSync68(file2)).digest("hex");
149413
149990
  WATCH_REMINDER_EVERY_MS = 10 * 60 * 1e3;
149414
149991
  REMINDERS_FILE = join59(".himi", "reminders.json");
149415
149992
  pidAlive = (pid) => {
@@ -149456,7 +150033,7 @@ __export(template_sweep_exports, {
149456
150033
  sweepCopy: () => sweepCopy,
149457
150034
  sweepPairs: () => sweepPairs
149458
150035
  });
149459
- import { readFileSync as readFileSync68, writeFileSync as writeFileSync24 } from "node:fs";
150036
+ import { readFileSync as readFileSync69, writeFileSync as writeFileSync24 } from "node:fs";
149460
150037
  import { join as join60 } from "node:path";
149461
150038
  import ts7 from "typescript";
149462
150039
  function isCopy(node, file2) {
@@ -149498,7 +150075,7 @@ function sweepCopy(dir, pairs, dryRun) {
149498
150075
  const next = /* @__PURE__ */ new Map();
149499
150076
  const replaced = pairs.map(([from, to2]) => ({ from, to: to2, files: {} }));
149500
150077
  for (const f2 of files) {
149501
- const text9 = readFileSync68(join60(dir, f2), "utf8");
150078
+ const text9 = readFileSync69(join60(dir, f2), "utf8");
149502
150079
  if (!pairs.some(([from]) => text9.includes(from) || text9.includes(JSON.stringify(from).slice(1, -1)))) continue;
149503
150080
  const kind = f2.endsWith(".json") ? ts7.ScriptKind.JSON : f2.endsWith("x") ? ts7.ScriptKind.TSX : ts7.ScriptKind.TS;
149504
150081
  const sf2 = ts7.createSourceFile(f2, text9, ts7.ScriptTarget.Latest, true, kind);
@@ -149527,8 +150104,8 @@ function sweepCopy(dir, pairs, dryRun) {
149527
150104
  if (errors.length) throw new TrimRefusal(`the sweep would break ${f2} \u2014 nothing written: ${errors[0]}`);
149528
150105
  next.set(f2, out2);
149529
150106
  }
149530
- const dev = next.get("dev/index.ts") ?? readFileSync68(join60(dir, "dev", "index.ts"), "utf8");
149531
- const config = next.get("config.ts") ?? readFileSync68(join60(dir, "config.ts"), "utf8");
150107
+ const dev = next.get("dev/index.ts") ?? readFileSync69(join60(dir, "dev", "index.ts"), "utf8");
150108
+ const config = next.get("config.ts") ?? readFileSync69(join60(dir, "config.ts"), "utf8");
149532
150109
  try {
149533
150110
  parseApp(dev, config);
149534
150111
  } catch (e2) {
@@ -149536,7 +150113,7 @@ function sweepCopy(dir, pairs, dryRun) {
149536
150113
  }
149537
150114
  if (!dryRun) for (const [f2, t2] of next) writeFileSync24(join60(dir, f2), t2);
149538
150115
  const g2 = new RegExp(PLACEHOLDER.source, `${PLACEHOLDER.flags.replace("g", "")}g`);
149539
- const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ?? readFileSync68(join60(dir, f2), "utf8")).matchAll(g2)].length, 0);
150116
+ const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ?? readFileSync69(join60(dir, f2), "utf8")).matchAll(g2)].length, 0);
149540
150117
  return {
149541
150118
  ok: true,
149542
150119
  dryRun,
@@ -149553,7 +150130,7 @@ function sweepPairs(set, mapFile) {
149553
150130
  pairs.push([s2.slice(0, at2), s2.slice(at2 + 2)]);
149554
150131
  }
149555
150132
  if (mapFile) {
149556
- const map = JSON.parse(readFileSync68(mapFile, "utf8"));
150133
+ const map = JSON.parse(readFileSync69(mapFile, "utf8"));
149557
150134
  for (const [k2, v2] of Object.entries(map)) {
149558
150135
  if (typeof v2 !== "string") throw new TrimRefusal(`--map ${mapFile}: "${k2}" must map to a string`);
149559
150136
  pairs.push([k2, v2]);
@@ -149798,18 +150375,18 @@ __export(template_recommend_exports, {
149798
150375
  recommendTemplates: () => recommendTemplates,
149799
150376
  verticalsFromBook: () => verticalsFromBook
149800
150377
  });
149801
- import { existsSync as existsSync58, readFileSync as readFileSync69 } from "node:fs";
150378
+ import { existsSync as existsSync58, readFileSync as readFileSync70 } from "node:fs";
149802
150379
  import { join as join61 } from "node:path";
149803
150380
  function verticalsFromBook(path2) {
149804
150381
  const dir = existsSync58(join61(path2, "book.json")) || existsSync58(join61(path2, "provisioning.overlay.json")) ? path2 : join61(path2, ".himi", "business-book");
149805
150382
  const overlay = join61(dir, "provisioning.overlay.json");
149806
150383
  if (existsSync58(overlay)) {
149807
- const v2 = JSON.parse(readFileSync69(overlay, "utf8")).installedVerticals;
150384
+ const v2 = JSON.parse(readFileSync70(overlay, "utf8")).installedVerticals;
149808
150385
  if (Array.isArray(v2) && v2.length) return v2.filter((x2) => typeof x2 === "string");
149809
150386
  }
149810
150387
  const book = join61(dir, "book.json");
149811
150388
  if (existsSync58(book)) {
149812
- const probes = JSON.parse(readFileSync69(book, "utf8")).probes;
150389
+ const probes = JSON.parse(readFileSync70(book, "utf8")).probes;
149813
150390
  if (Array.isArray(probes)) return installedFromProbes(probes);
149814
150391
  }
149815
150392
  throw new Error(`no book.json / provisioning.overlay.json under ${path2} \u2014 run \`himi site analyze\` first, or pass --verticals`);
@@ -150219,7 +150796,7 @@ __export(eject_exports, {
150219
150796
  EJECTABLE: () => EJECTABLE,
150220
150797
  ejectModule: () => ejectModule
150221
150798
  });
150222
- import { existsSync as existsSync59, mkdirSync as mkdirSync28, readFileSync as readFileSync70, writeFileSync as writeFileSync25 } from "node:fs";
150799
+ import { existsSync as existsSync59, mkdirSync as mkdirSync28, readFileSync as readFileSync71, writeFileSync as writeFileSync25 } from "node:fs";
150223
150800
  import { dirname as dirname35, join as join62, relative as relative12, resolve as resolve50, sep as sep16 } from "node:path";
150224
150801
  function locate(repoRootOrCwd, mod) {
150225
150802
  const inRepo = resolve50(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
@@ -150263,7 +150840,7 @@ function ejectModule(opts) {
150263
150840
  // gate still applies. Ejecting buys layout and flow, never the floor.
150264
150841
 
150265
150842
  `;
150266
- const normalized = readFileSync70(found.path, "utf8").replace(
150843
+ const normalized = readFileSync71(found.path, "utf8").replace(
150267
150844
  /(["'])@himalaya\/([a-z0-9-]+(?:\/[a-z0-9-]+)?)\1/g,
150268
150845
  (_m, q2, sub) => `${q2}@wix/himalaya/${sub}${q2}`
150269
150846
  );
@@ -150271,7 +150848,7 @@ function ejectModule(opts) {
150271
150848
  const rewired = [];
150272
150849
  for (const f2 of files) {
150273
150850
  if (!existsSync59(f2)) continue;
150274
- const before = readFileSync70(f2, "utf8");
150851
+ const before = readFileSync71(f2, "utf8");
150275
150852
  let after = before;
150276
150853
  let rel = relative12(dirname35(f2), target).split(sep16).join("/").replace(/\.tsx?$/, ".js");
150277
150854
  if (!rel.startsWith(".")) rel = `./${rel}`;
@@ -150391,7 +150968,7 @@ var init_app_map = __esm({
150391
150968
  });
150392
150969
 
150393
150970
  // src/wix-writes.ts
150394
- import { existsSync as existsSync60, readFileSync as readFileSync71 } from "node:fs";
150971
+ import { existsSync as existsSync60, readFileSync as readFileSync72 } from "node:fs";
150395
150972
  import { join as join63 } from "node:path";
150396
150973
  function isProvenRead(method, path2) {
150397
150974
  if (/[#\x00-\x1F\x7F]/.test(path2)) return false;
@@ -150514,7 +151091,7 @@ function readDataAccess(dir) {
150514
151091
  if (!existsSync60(p2)) continue;
150515
151092
  let text9;
150516
151093
  try {
150517
- text9 = readFileSync71(p2, "utf8");
151094
+ text9 = readFileSync72(p2, "utf8");
150518
151095
  } catch {
150519
151096
  continue;
150520
151097
  }
@@ -150628,14 +151205,14 @@ __export(test_exports, {
150628
151205
  scopeDescriptors: () => scopeDescriptors,
150629
151206
  writeRecordedMocks: () => writeRecordedMocks
150630
151207
  });
150631
- import { existsSync as existsSync61, mkdirSync as mkdirSync29, readFileSync as readFileSync72, writeFileSync as writeFileSync26 } from "node:fs";
151208
+ import { existsSync as existsSync61, mkdirSync as mkdirSync29, readFileSync as readFileSync73, writeFileSync as writeFileSync26 } from "node:fs";
150632
151209
  import { join as join64, resolve as resolve51 } from "node:path";
150633
151210
  function readTestConfig(dir) {
150634
151211
  const p2 = resolve51(dir, TEST_CONFIG_FILE);
150635
151212
  if (!existsSync61(p2)) return {};
150636
151213
  let parsed;
150637
151214
  try {
150638
- parsed = JSON.parse(readFileSync72(p2, "utf8"));
151215
+ parsed = JSON.parse(readFileSync73(p2, "utf8"));
150639
151216
  } catch (e2) {
150640
151217
  throw new Error(`${TEST_CONFIG_FILE} is not valid JSON \u2014 ${e2.message}`);
150641
151218
  }
@@ -150682,7 +151259,7 @@ function readTestConfig(dir) {
150682
151259
  function readNetRules(path2) {
150683
151260
  let parsed;
150684
151261
  try {
150685
- parsed = JSON.parse(readFileSync72(path2, "utf8"));
151262
+ parsed = JSON.parse(readFileSync73(path2, "utf8"));
150686
151263
  } catch (e2) {
150687
151264
  throw new Error(`--net ${path2} could not be read as JSON \u2014 ${e2.message}`);
150688
151265
  }
@@ -150719,7 +151296,7 @@ function readCannedResponses() {
150719
151296
  ];
150720
151297
  for (const url of candidates) {
150721
151298
  try {
150722
- const parsed = JSON.parse(readFileSync72(url, "utf8"));
151299
+ const parsed = JSON.parse(readFileSync73(url, "utf8"));
150723
151300
  const byKey = {};
150724
151301
  for (const [k2, v2] of Object.entries(parsed)) {
150725
151302
  if (!k2.startsWith("//")) byKey[k2] = v2;
@@ -151356,14 +151933,14 @@ var mobile_ux_lint_exports = {};
151356
151933
  __export(mobile_ux_lint_exports, {
151357
151934
  mobileUxIssues: () => mobileUxIssues
151358
151935
  });
151359
- import { existsSync as existsSync62, readFileSync as readFileSync73 } from "node:fs";
151936
+ import { existsSync as existsSync62, readFileSync as readFileSync74 } from "node:fs";
151360
151937
  import { join as join65 } from "node:path";
151361
151938
  function mobileUxIssues(dir, strict) {
151362
151939
  const file2 = join65(dir, "MOBILE-UX.md");
151363
151940
  if (!existsSync62(file2)) return [];
151364
151941
  let text9;
151365
151942
  try {
151366
- text9 = readFileSync73(file2, "utf8");
151943
+ text9 = readFileSync74(file2, "utf8");
151367
151944
  } catch {
151368
151945
  return [];
151369
151946
  }
@@ -152213,10 +152790,10 @@ var init_calls = __esm({
152213
152790
  });
152214
152791
 
152215
152792
  // ../../core/functions-runtime/src/queue.ts
152216
- import { createHash as createHash33 } from "node:crypto";
152793
+ import { createHash as createHash34 } from "node:crypto";
152217
152794
  function inputSchemaHash(definition) {
152218
152795
  const schema = definition.input;
152219
- return schema ? createHash33("sha256").update(JSON.stringify(schema.descriptor ?? { kind: schema.kind, optional: schema.optional === true })).digest("hex") : "";
152796
+ return schema ? createHash34("sha256").update(JSON.stringify(schema.descriptor ?? { kind: schema.kind, optional: schema.optional === true })).digest("hex") : "";
152220
152797
  }
152221
152798
  function createFunctionEnqueueCapability(options) {
152222
152799
  return {
@@ -152282,14 +152859,14 @@ var init_queue = __esm({
152282
152859
  });
152283
152860
 
152284
152861
  // ../../core/data-resources/src/plan.ts
152285
- import { createHash as createHash34 } from "node:crypto";
152862
+ import { createHash as createHash35 } from "node:crypto";
152286
152863
  function canonical3(value) {
152287
152864
  if (Array.isArray(value)) return `[${value.map(canonical3).join(",")}]`;
152288
152865
  if (value && typeof value === "object") return `{${Object.entries(value).sort(([a2], [b2]) => a2.localeCompare(b2)).map(([key2, item]) => `${JSON.stringify(key2)}:${canonical3(item)}`).join(",")}}`;
152289
152866
  return JSON.stringify(value);
152290
152867
  }
152291
152868
  function hashResourcePlan(plan) {
152292
- return createHash34("sha256").update(canonical3(plan)).digest("hex");
152869
+ return createHash35("sha256").update(canonical3(plan)).digest("hex");
152293
152870
  }
152294
152871
  function finalize(input) {
152295
152872
  return { ...input, hash: hashResourcePlan(input) };
@@ -153044,7 +153621,7 @@ __export(functions_exports, {
153044
153621
  resolveFunctionsTarget: () => resolveFunctionsTarget,
153045
153622
  runRemoteFunctionOperation: () => runRemoteFunctionOperation
153046
153623
  });
153047
- import { readFileSync as readFileSync74, existsSync as existsSync63 } from "node:fs";
153624
+ import { readFileSync as readFileSync75, existsSync as existsSync63 } from "node:fs";
153048
153625
  import { join as join66, resolve as resolve52 } from "node:path";
153049
153626
  function resolveFunctionsTarget(input) {
153050
153627
  const explicitUrl = input.functionsUrl?.trim();
@@ -153066,7 +153643,7 @@ async function loadFunctionsApp(dir) {
153066
153643
  for (const definition of config.functions.functions) {
153067
153644
  const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join66(loaded.dir, "functions", `${definition.name}${extension}`)).find(existsSync63);
153068
153645
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
153069
- sources[definition.name] = readFileSync74(source, "utf8");
153646
+ sources[definition.name] = readFileSync75(source, "utf8");
153070
153647
  }
153071
153648
  const data = config.cms || config.data ? mergeDataResources(config) : void 0;
153072
153649
  const dataErrors = validateDataResources(data, loaded.name).filter((issue2) => issue2.severity === "error");
@@ -153254,7 +153831,7 @@ var init_cli_bridge = __esm({
153254
153831
  });
153255
153832
 
153256
153833
  // src/mcp/file-tools.ts
153257
- import { closeSync as closeSync6, constants as constants3, lstatSync as lstatSync20, mkdirSync as mkdirSync30, openSync as openSync5, readdirSync as readdirSync31, readFileSync as readFileSync75, realpathSync as realpathSync10, renameSync as renameSync11, rmSync as rmSync15, statSync as statSync18, writeSync, existsSync as existsSync64 } from "node:fs";
153834
+ import { closeSync as closeSync6, constants as constants3, lstatSync as lstatSync20, mkdirSync as mkdirSync30, openSync as openSync5, readdirSync as readdirSync31, readFileSync as readFileSync76, realpathSync as realpathSync10, renameSync as renameSync11, rmSync as rmSync15, statSync as statSync18, writeSync, existsSync as existsSync64 } from "node:fs";
153258
153835
  import { randomBytes as randomBytes4 } from "node:crypto";
153259
153836
  import { dirname as dirname36, isAbsolute as isAbsolute7, join as join67, relative as relative13, resolve as resolve53, sep as sep17 } from "node:path";
153260
153837
  import * as z2 from "zod";
@@ -153427,7 +154004,7 @@ function fileTools() {
153427
154004
  if (!existsSync64(p2) || !lstatSync20(p2).isFile()) return refuse5("not_found", `no file "${String(a2.path)}"`);
153428
154005
  const size = statSync18(p2).size;
153429
154006
  if (size > MAX_FILE_BYTES) return refuse5("too_large", `"${String(a2.path)}" is ${size} bytes \u2014 over the ${MAX_FILE_BYTES}-byte read limit`);
153430
- return ok({ ok: true, path: a2.path, bytes: size, content: readFileSync75(p2, "utf8") });
154007
+ return ok({ ok: true, path: a2.path, bytes: size, content: readFileSync76(p2, "utf8") });
153431
154008
  }
153432
154009
  },
153433
154010
  {
@@ -154039,7 +154616,7 @@ __export(server_exports, {
154039
154616
  protectStdout: () => protectStdout,
154040
154617
  startMcpServer: () => startMcpServer
154041
154618
  });
154042
- import { mkdirSync as mkdirSync31, readFileSync as readFileSync76 } from "node:fs";
154619
+ import { mkdirSync as mkdirSync31, readFileSync as readFileSync77 } from "node:fs";
154043
154620
  import { fileURLToPath as fileURLToPath24 } from "node:url";
154044
154621
  import { McpServer } from "@modelcontextprotocol/server";
154045
154622
  import { serveStdio, StdioServerTransport } from "@modelcontextprotocol/server/stdio";
@@ -154099,7 +154676,7 @@ async function startMcpServer(opts) {
154099
154676
  status: (dir) => previewStatus(dir, previewDeps),
154100
154677
  stop: (dir) => stopPreview(dir, previewDeps)
154101
154678
  },
154102
- readFile: (p2) => readFileSync76(p2),
154679
+ readFile: (p2) => readFileSync77(p2),
154103
154680
  login: createLoginSession({ ...defaultLoginDeps, selfCommand: previewDeps.selfCommand, ...opts.login }),
154104
154681
  ...opts.workspace ? { workspaceBoundary: opts.workspace } : {}
154105
154682
  };
@@ -154143,7 +154720,7 @@ __export(native_decode_exports, {
154143
154720
  runNativeDecode: () => runNativeDecode
154144
154721
  });
154145
154722
  import { execFileSync as execFileSync5, spawnSync as spawnSync2 } from "node:child_process";
154146
- import { existsSync as existsSync65, mkdtempSync as mkdtempSync2, readFileSync as readFileSync77, rmSync as rmSync16, writeFileSync as writeFileSync27 } from "node:fs";
154723
+ import { existsSync as existsSync65, mkdtempSync as mkdtempSync2, readFileSync as readFileSync78, rmSync as rmSync16, writeFileSync as writeFileSync27 } from "node:fs";
154147
154724
  import { tmpdir as tmpdir3 } from "node:os";
154148
154725
  import { join as join68 } from "node:path";
154149
154726
  import { fileURLToPath as fileURLToPath25 } from "node:url";
@@ -154179,7 +154756,7 @@ function detectNativeDecode(options = {}) {
154179
154756
  }
154180
154757
  function localPropertiesSdk(harnessDir) {
154181
154758
  try {
154182
- const match = readFileSync77(join68(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
154759
+ const match = readFileSync78(join68(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
154183
154760
  return match?.[1]?.trim().replace(/\\([ :\\])/g, "$1") ?? null;
154184
154761
  } catch {
154185
154762
  return null;
@@ -154330,7 +154907,7 @@ function runAndroidNativeDecode(options) {
154330
154907
  stdio: ["ignore", "ignore", "pipe"],
154331
154908
  encoding: "utf8"
154332
154909
  });
154333
- const stdout = readFileSync77(outputPath, "utf8");
154910
+ const stdout = readFileSync78(outputPath, "utf8");
154334
154911
  return {
154335
154912
  platform: "android",
154336
154913
  verdicts: parseNativeDecodeOutput(stdout, options.descriptors.map((descriptor) => descriptor.screenId), "android"),
@@ -154399,8 +154976,8 @@ __export(browser_authoring_exports, {
154399
154976
  sdkSubpathReader: () => sdkSubpathReader
154400
154977
  });
154401
154978
  import { createServer as createServer5 } from "node:http";
154402
- import { createHash as createHash35, randomBytes as randomBytes5 } from "node:crypto";
154403
- import { existsSync as existsSync66, readdirSync as readdirSync32, readFileSync as readFileSync78, realpathSync as realpathSync11, statSync as statSync19 } from "node:fs";
154979
+ import { createHash as createHash36, randomBytes as randomBytes5 } from "node:crypto";
154980
+ import { existsSync as existsSync66, readdirSync as readdirSync32, readFileSync as readFileSync79, realpathSync as realpathSync11, statSync as statSync19 } from "node:fs";
154404
154981
  import { join as join69, posix as posix3, relative as relative14, sep as sep18 } from "node:path";
154405
154982
  function humanMs(ms2) {
154406
154983
  return ms2 < 1e3 ? `${ms2}ms` : `${Math.round(ms2 / 1e3)}s`;
@@ -154419,7 +154996,7 @@ function collectWorkerSources(tier5SrcDir, bundleName) {
154419
154996
  if (statSync19(childAbs).isDirectory()) {
154420
154997
  walk2(childAbs, childRel);
154421
154998
  } else if (/\.(ts|tsx|js|mjs|json)$/.test(name)) {
154422
- files[childRel] = readFileSync78(childAbs, "utf8");
154999
+ files[childRel] = readFileSync79(childAbs, "utf8");
154423
155000
  }
154424
155001
  }
154425
155002
  };
@@ -154453,7 +155030,7 @@ function collectRelativeSiblings(files, tier5SrcDir) {
154453
155030
  if (!existsSync66(abs) || statSync19(abs).isDirectory()) continue;
154454
155031
  const key2 = `/tier5-src/${relative14(tier5SrcDir, abs).split(sep18).join(posix3.sep)}`;
154455
155032
  if (key2 in files) break;
154456
- files[key2] = readFileSync78(abs, "utf8");
155033
+ files[key2] = readFileSync79(abs, "utf8");
154457
155034
  queue.push(key2);
154458
155035
  break;
154459
155036
  }
@@ -154488,7 +155065,7 @@ function collectSdkModules(files, resolveSubpath) {
154488
155065
  function sdkSubpathReader(resolve62) {
154489
155066
  return (sub) => {
154490
155067
  try {
154491
- return readFileSync78(resolve62(`@wix/himalaya/${sub}`), "utf8");
155068
+ return readFileSync79(resolve62(`@wix/himalaya/${sub}`), "utf8");
154492
155069
  } catch {
154493
155070
  return null;
154494
155071
  }
@@ -154498,7 +155075,7 @@ function encodeJob(job) {
154498
155075
  return Buffer.from(JSON.stringify(job), "utf8").toString("base64");
154499
155076
  }
154500
155077
  function mintToken2(payload, nonce = randomBytes5(16).toString("hex")) {
154501
- const digest2 = createHash35("sha256").update(payload, "utf8").digest("base64url");
155078
+ const digest2 = createHash36("sha256").update(payload, "utf8").digest("base64url");
154502
155079
  return `${nonce}.${digest2}`;
154503
155080
  }
154504
155081
  function defaultOpenBrowser2(url) {
@@ -154660,7 +155237,7 @@ __export(coverage_exports, {
154660
155237
  suppressedNativeKeys: () => suppressedNativeKeys,
154661
155238
  trendAndStore: () => trendAndStore
154662
155239
  });
154663
- import { existsSync as existsSync67, mkdirSync as mkdirSync32, readFileSync as readFileSync79, writeFileSync as writeFileSync28 } from "node:fs";
155240
+ import { existsSync as existsSync67, mkdirSync as mkdirSync32, readFileSync as readFileSync80, writeFileSync as writeFileSync28 } from "node:fs";
154664
155241
  import { dirname as dirname37, join as join70 } from "node:path";
154665
155242
  function suppressedNativeKeys(oracle) {
154666
155243
  return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
@@ -154845,7 +155422,7 @@ function trendAndStore(dir, entries, suppressed) {
154845
155422
  let previous = null;
154846
155423
  try {
154847
155424
  if (existsSync67(p2)) {
154848
- const parsed = JSON.parse(readFileSync79(p2, "utf8"));
155425
+ const parsed = JSON.parse(readFileSync80(p2, "utf8"));
154849
155426
  if (Array.isArray(parsed.keys)) previous = parsed.keys.filter((k2) => typeof k2 === "string");
154850
155427
  }
154851
155428
  } catch {
@@ -154888,7 +155465,7 @@ function diffAndStoreObservations(dir, current) {
154888
155465
  let previous = null;
154889
155466
  try {
154890
155467
  if (existsSync67(p2)) {
154891
- const parsed = JSON.parse(readFileSync79(p2, "utf8"));
155468
+ const parsed = JSON.parse(readFileSync80(p2, "utf8"));
154892
155469
  if (parsed.screens && typeof parsed.screens === "object" && !Array.isArray(parsed.screens) && Object.values(parsed.screens).every(
154893
155470
  (v2) => Array.isArray(v2) && v2.every((l2) => typeof l2 === "string")
154894
155471
  )) {
@@ -154949,7 +155526,7 @@ __export(design_kits_exports, {
154949
155526
  kitsDir: () => kitsDir,
154950
155527
  listKits: () => listKits2
154951
155528
  });
154952
- import { existsSync as existsSync68, readFileSync as readFileSync80, readdirSync as readdirSync33 } from "node:fs";
155529
+ import { existsSync as existsSync68, readFileSync as readFileSync81, readdirSync as readdirSync33 } from "node:fs";
154953
155530
  import { join as join71, basename as basename16 } from "node:path";
154954
155531
  import { fileURLToPath as fileURLToPath26 } from "node:url";
154955
155532
  function kitsDir() {
@@ -154977,7 +155554,7 @@ In a published @wix/himalaya-cli this is a packaging bug \u2014 the kits should
154977
155554
  if (!kits.includes(name)) {
154978
155555
  return { ok: false, kit: name, kits, problems: [`no design kit named "${name}". Available: ${kits.join(", ")}`] };
154979
155556
  }
154980
- const raw = readFileSync80(join71(dir, `${name}.json`), "utf8");
155557
+ const raw = readFileSync81(join71(dir, `${name}.json`), "utf8");
154981
155558
  let parsed;
154982
155559
  try {
154983
155560
  parsed = JSON.parse(raw);
@@ -155017,11 +155594,11 @@ __export(assets_exports, {
155017
155594
  removeAssetPayload: () => removeAssetPayload,
155018
155595
  verifyReport: () => verifyReport
155019
155596
  });
155020
- import { readFileSync as readFileSync81 } from "node:fs";
155597
+ import { readFileSync as readFileSync82 } from "node:fs";
155021
155598
  import { basename as basename17 } from "node:path";
155022
155599
  function declaredAssets(dir) {
155023
155600
  return collectAssets(dir).map((a2) => {
155024
- const bytes2 = readFileSync81(a2.path);
155601
+ const bytes2 = readFileSync82(a2.path);
155025
155602
  return {
155026
155603
  name: a2.name,
155027
155604
  sha256: assetSha256(bytes2),
@@ -155098,7 +155675,7 @@ function verifyReport(dir, app, manifest) {
155098
155675
  };
155099
155676
  }
155100
155677
  function addAssetPayload(manifest, filePath, opts) {
155101
- const bytes2 = readFileSync81(filePath);
155678
+ const bytes2 = readFileSync82(filePath);
155102
155679
  const name = opts.name ?? basename17(filePath);
155103
155680
  const sha2566 = assetSha256(bytes2);
155104
155681
  const record2 = {
@@ -156892,7 +157469,7 @@ __export(run_exports, {
156892
157469
  runPackage: () => runPackage,
156893
157470
  withoutProdServe: () => withoutProdServe
156894
157471
  });
156895
- import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync33, mkdtempSync as mkdtempSync3, readFileSync as readFileSync82, rmSync as rmSync17, statSync as statSync20 } from "node:fs";
157472
+ import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync33, mkdtempSync as mkdtempSync3, readFileSync as readFileSync83, rmSync as rmSync17, statSync as statSync20 } from "node:fs";
156896
157473
  import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir4 } from "node:os";
156897
157474
  import { dirname as dirname38, join as join72 } from "node:path";
156898
157475
  import { fileURLToPath as fileURLToPath27 } from "node:url";
@@ -156952,7 +157529,7 @@ async function resolvePackage(source, workDir) {
156952
157529
  }
156953
157530
  throw new Error(`${source} is a directory but has no release-manifest.json \u2014 is it a package?`);
156954
157531
  }
156955
- const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync82(source);
157532
+ const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync83(source);
156956
157533
  const root = workDir ?? mkdtempSync3(join72(tmpdir4(), "himi-run-"));
156957
157534
  const { app, appDir: appDir3 } = unpackTo(bytes2, root);
156958
157535
  const opened = openPackageDir(appDir3);
@@ -156983,7 +157560,7 @@ async function loadPreviewAssets() {
156983
157560
  ];
156984
157561
  for (const path2 of candidates) {
156985
157562
  if (!existsSync69(path2)) continue;
156986
- const blob = readFileSync82(path2);
157563
+ const blob = readFileSync83(path2);
156987
157564
  return mod.assemblePreviewAssetsFromBlob(new Uint8Array(blob.buffer, blob.byteOffset, blob.byteLength));
156988
157565
  }
156989
157566
  return /* @__PURE__ */ new Map();
@@ -157120,7 +157697,7 @@ __export(run_browser_exports, {
157120
157697
  runInBrowser: () => runInBrowser
157121
157698
  });
157122
157699
  import { createServer as createServer7 } from "node:http";
157123
- import { existsSync as existsSync70, readFileSync as readFileSync83 } from "node:fs";
157700
+ import { existsSync as existsSync70, readFileSync as readFileSync84 } from "node:fs";
157124
157701
  import { spawnSync as spawnSync3 } from "node:child_process";
157125
157702
  import { dirname as dirname39, resolve as resolve55 } from "node:path";
157126
157703
  import { fileURLToPath as fileURLToPath28 } from "node:url";
@@ -157228,7 +157805,7 @@ async function runInBrowser(releaseRoot, app, header, opts = {}) {
157228
157805
  }
157229
157806
  let bytes2;
157230
157807
  try {
157231
- bytes2 = readFileSync83(resolve55(stagedDir(), name));
157808
+ bytes2 = readFileSync84(resolve55(stagedDir(), name));
157232
157809
  } catch (e2) {
157233
157810
  res.writeHead(503, { "content-type": "application/json" });
157234
157811
  res.end(JSON.stringify({ error: "browser_plane_unstaged", file: name, detail: String(e2) }));
@@ -157281,14 +157858,14 @@ var hhp_preview_exports = {};
157281
157858
  __export(hhp_preview_exports, {
157282
157859
  hhpPreviewResponse: () => hhpPreviewResponse
157283
157860
  });
157284
- import { existsSync as existsSync71, readFileSync as readFileSync84 } from "node:fs";
157861
+ import { existsSync as existsSync71, readFileSync as readFileSync85 } from "node:fs";
157285
157862
  import { join as join73 } from "node:path";
157286
157863
  function hhpPreviewResponse(root, request) {
157287
157864
  if (new URL(request.url).pathname !== "/__himi/hhp-preview" || !existsSync71(join73(root, "hhp.json"))) return null;
157288
157865
  if (request.method !== "GET") return new Response(null, { status: 405 });
157289
157866
  try {
157290
157867
  const file2 = localPath(root, ".himi/hhp-preview.json");
157291
- const authored2 = existsSync71(file2) ? JSON.parse(readFileSync84(file2, "utf8")) : {};
157868
+ const authored2 = existsSync71(file2) ? JSON.parse(readFileSync85(file2, "utf8")) : {};
157292
157869
  if (authored2.mockCapabilities && (!Array.isArray(authored2.mockCapabilities) || authored2.mockCapabilities.some((v2) => typeof v2 !== "string"))) throw new Error("mockCapabilities must be a string array.");
157293
157870
  const fixtures = authored2.fixtures ?? {};
157294
157871
  if (typeof fixtures !== "object" || Array.isArray(fixtures) || fixtures === null) throw new Error("fixtures must be an object.");
@@ -157438,7 +158015,7 @@ var init_embedded_bundles = __esm({
157438
158015
  });
157439
158016
 
157440
158017
  // ../store-release/register-bundle.ts
157441
- import { readFileSync as readFileSync85 } from "node:fs";
158018
+ import { readFileSync as readFileSync86 } from "node:fs";
157442
158019
  import { createPrivateKey as createPrivateKey4, sign as sign2 } from "node:crypto";
157443
158020
  function b64url2(b2) {
157444
158021
  return Buffer.from(b2).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -157456,7 +158033,7 @@ function bundleIdBody(identifier, name, platform = "IOS") {
157456
158033
  async function registerBundleId(opts) {
157457
158034
  const env = requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
157458
158035
  assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
157459
- const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync85(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
158036
+ const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync86(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
157460
158037
  const res = await fetch(`${ASC_API}/v1/bundleIds`, {
157461
158038
  method: "POST",
157462
158039
  headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" },
@@ -157486,7 +158063,7 @@ async function main() {
157486
158063
  }
157487
158064
  const ni2 = rest.indexOf("--name");
157488
158065
  const name = ni2 >= 0 ? rest[ni2 + 1] : cfg.app ?? app;
157489
- const yml = readFileSync85(iosProjectYml(app), "utf8");
158066
+ const yml = readFileSync86(iosProjectYml(app), "utf8");
157490
158067
  for (const { id, label: label2 } of [{ id: identifier, label: name }, ...embeddedBundles(yml).map((b2) => ({
157491
158068
  id: embeddedBundleId(identifier, b2),
157492
158069
  label: `${name} ${embeddedAppIdLabel(b2)}`
@@ -157897,7 +158474,7 @@ var init_iap_api = __esm({
157897
158474
  });
157898
158475
 
157899
158476
  // ../store-release/iap-manifest.ts
157900
- import { createHash as createHash36 } from "node:crypto";
158477
+ import { createHash as createHash37 } from "node:crypto";
157901
158478
  function readTarget(reader, value) {
157902
158479
  const obj3 = reader.object(value, "target", TARGET_KEYS);
157903
158480
  return {
@@ -158041,7 +158618,7 @@ function canonicalJson(value) {
158041
158618
  return JSON.stringify(sortKeys(value));
158042
158619
  }
158043
158620
  function sha256Digest(value) {
158044
- return `sha256:${createHash36("sha256").update(canonicalJson(value)).digest("hex")}`;
158621
+ return `sha256:${createHash37("sha256").update(canonicalJson(value)).digest("hex")}`;
158045
158622
  }
158046
158623
  function manifestDigest(manifest) {
158047
158624
  return sha256Digest(manifest);
@@ -158895,13 +159472,13 @@ __export(credential_profile_exports, {
158895
159472
  profilePath: () => profilePath,
158896
159473
  resolveStoreCredentials: () => resolveStoreCredentials
158897
159474
  });
158898
- import { existsSync as existsSync72, readFileSync as readFileSync86 } from "node:fs";
158899
- import { homedir as homedir7 } from "node:os";
159475
+ import { existsSync as existsSync72, readFileSync as readFileSync87 } from "node:fs";
159476
+ import { homedir as homedir9 } from "node:os";
158900
159477
  import { join as join74 } from "node:path";
158901
- function credentialsDir(home = homedir7()) {
159478
+ function credentialsDir(home = homedir9()) {
158902
159479
  return join74(home, ".himalaya", "store-credentials");
158903
159480
  }
158904
- function profilePath(name, home = homedir7()) {
159481
+ function profilePath(name, home = homedir9()) {
158905
159482
  if (!PROFILE_NAME.test(name)) {
158906
159483
  throw new Error(
158907
159484
  `credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join74(credentialsDir(home), "<name>.json")}; it is never a path.`
@@ -158937,8 +159514,8 @@ function namedProfile(cfg, profileFlag) {
158937
159514
  function resolveStoreCredentials(opts) {
158938
159515
  const { app, cfg } = opts;
158939
159516
  const env = opts.env ?? process.env;
158940
- const home = opts.home ?? homedir7();
158941
- const read = opts.readProfile ?? ((p2) => readFileSync86(p2, "utf8"));
159517
+ const home = opts.home ?? homedir9();
159518
+ const read = opts.readProfile ?? ((p2) => readFileSync87(p2, "utf8"));
158942
159519
  const exists = opts.profileExists ?? existsSync72;
158943
159520
  const ios = cfg.ios ?? {};
158944
159521
  const flagName = opts.profileFlag?.trim();
@@ -159004,11 +159581,11 @@ var init_credential_profile = __esm({
159004
159581
  });
159005
159582
 
159006
159583
  // ../store-release/iap-credentials.ts
159007
- import { createHash as createHash37 } from "node:crypto";
159008
- import { existsSync as existsSync73, readFileSync as readFileSync87, realpathSync as realpathSync12 } from "node:fs";
159009
- import { homedir as homedir8 } from "node:os";
159584
+ import { createHash as createHash38 } from "node:crypto";
159585
+ import { existsSync as existsSync73, readFileSync as readFileSync88, realpathSync as realpathSync12 } from "node:fs";
159586
+ import { homedir as homedir10 } from "node:os";
159010
159587
  function accountFingerprint(keyId, issuerId) {
159011
- return `sha256:${createHash37("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
159588
+ return `sha256:${createHash38("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
159012
159589
  }
159013
159590
  function requireExplicitProfile(profileFlag, target) {
159014
159591
  const profile = profileFlag?.trim();
@@ -159038,8 +159615,8 @@ function canonicalKeyPath(path2, profile, realpath) {
159038
159615
  }
159039
159616
  function resolveIapCredentials(options) {
159040
159617
  const { target } = options;
159041
- const home = options.home ?? homedir8();
159042
- const readFile3 = options.readFile ?? ((p2) => readFileSync87(p2, "utf8"));
159618
+ const home = options.home ?? homedir10();
159619
+ const readFile3 = options.readFile ?? ((p2) => readFileSync88(p2, "utf8"));
159043
159620
  const realpath = options.realpath ?? realpathSync12;
159044
159621
  const profile = requireExplicitProfile(options.profileFlag, target);
159045
159622
  const creds = resolveStoreCredentials({
@@ -159085,7 +159662,7 @@ var init_wix_payments_contract = __esm({
159085
159662
  });
159086
159663
 
159087
159664
  // ../store-release/iap-draft.ts
159088
- import { createHash as createHash38 } from "node:crypto";
159665
+ import { createHash as createHash39 } from "node:crypto";
159089
159666
  function fit(text9, max) {
159090
159667
  const chars = [...text9];
159091
159668
  return chars.length <= max ? text9 : `${chars.slice(0, max - 1).join("").trimEnd()}${ELLIPSIS}`;
@@ -159223,7 +159800,7 @@ var init_iap_draft = __esm({
159223
159800
  TIER_DESCRIPTION = "Unlocks one item in the app";
159224
159801
  ELLIPSIS = "\u2026";
159225
159802
  entityKey = (entityType, entityId) => `${entityType}:${entityId}`;
159226
- sha = (text9) => createHash38("sha256").update(text9).digest("hex");
159803
+ sha = (text9) => createHash39("sha256").update(text9).digest("hex");
159227
159804
  ENTITIES = { "&amp;": "&", "&nbsp;": " ", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" };
159228
159805
  MAX_SUFFIX = 24;
159229
159806
  ReferenceNames = class {
@@ -159361,7 +159938,7 @@ __export(version_exports, {
159361
159938
  stampTargetVersion: () => stampTargetVersion,
159362
159939
  stampVersionKeys: () => stampVersionKeys
159363
159940
  });
159364
- import { readFileSync as readFileSync88, writeFileSync as writeFileSync29 } from "node:fs";
159941
+ import { readFileSync as readFileSync89, writeFileSync as writeFileSync29 } from "node:fs";
159365
159942
  function readIosVersion(projectYml) {
159366
159943
  const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
159367
159944
  const build3 = matchScalar(projectYml, "CFBundleVersion");
@@ -159508,8 +160085,8 @@ function setAndroidVersion(gradle, v2) {
159508
160085
  function bumpVersion(app, opts) {
159509
160086
  const iosPath = iosProjectYml(app);
159510
160087
  const gradlePath = androidGradle(app);
159511
- const iosYml = readFileSync88(iosPath, "utf8");
159512
- const gradle = readFileSync88(gradlePath, "utf8");
160088
+ const iosYml = readFileSync89(iosPath, "utf8");
160089
+ const gradle = readFileSync89(gradlePath, "utf8");
159513
160090
  const current = readIosVersion(iosYml);
159514
160091
  const next = {
159515
160092
  marketing: opts.marketing ?? current.marketing,
@@ -159539,7 +160116,7 @@ var init_store_spec = __esm({
159539
160116
  });
159540
160117
 
159541
160118
  // src/iap-config-edit.ts
159542
- import { existsSync as existsSync74, readFileSync as readFileSync89 } from "node:fs";
160119
+ import { existsSync as existsSync74, readFileSync as readFileSync90 } from "node:fs";
159543
160120
  import { basename as basename18, join as join75 } from "node:path";
159544
160121
  import ts8 from "typescript";
159545
160122
  function bindPurchasesAppInConfig(source, options) {
@@ -159621,14 +160198,14 @@ function withStoreBundle(dir, options) {
159621
160198
  if (options.storeBundleId) return options;
159622
160199
  const path2 = join75(dir, "store", "store.config.yaml");
159623
160200
  if (!existsSync74(path2)) return options;
159624
- const storeBundleId = parseStoreConfig(readFileSync89(path2, "utf8")).ios?.bundleId;
160201
+ const storeBundleId = parseStoreConfig(readFileSync90(path2, "utf8")).ios?.bundleId;
159625
160202
  return storeBundleId ? { ...options, storeBundleId } : options;
159626
160203
  }
159627
160204
  function previewIapConfigEdit(dir, options) {
159628
160205
  const path2 = configEntry(dir);
159629
160206
  if (!path2) return void 0;
159630
160207
  if (isSymlink2(path2)) return { path: path2, changed: false, applied: [], conflicts: [], instructions: [`${basename18(path2)} is a symlink, so it would not be edited: add the purchases app in the file it points to.`] };
159631
- const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync89(path2, "utf8"), { ...withStoreBundle(dir, options), fileName: basename18(path2) });
160208
+ const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync90(path2, "utf8"), { ...withStoreBundle(dir, options), fileName: basename18(path2) });
159632
160209
  return { path: path2, changed, applied, conflicts, instructions };
159633
160210
  }
159634
160211
  async function applyIapConfigEdit(dir, options, validate4) {
@@ -159637,7 +160214,7 @@ async function applyIapConfigEdit(dir, options, validate4) {
159637
160214
  const fileName = basename18(path2);
159638
160215
  const refuse7 = (why) => ({ path: path2, changed: false, applied: [], conflicts: [], instructions: [why] });
159639
160216
  if (isSymlink2(path2)) return refuse7(`${fileName} is a symlink, so it was not edited: add the purchases app in the file it points to.`);
159640
- const original = readFileSync89(path2, "utf8");
160217
+ const original = readFileSync90(path2, "utf8");
159641
160218
  const edit = bindPurchasesAppInConfig(original, { ...withStoreBundle(dir, options), fileName });
159642
160219
  const { applied, conflicts, instructions } = edit;
159643
160220
  if (!edit.changed) return { path: path2, changed: false, applied, conflicts, instructions };
@@ -160110,8 +160687,8 @@ __export(store_iap_exports, {
160110
160687
  runStoreIap: () => runStoreIap
160111
160688
  });
160112
160689
  import { randomUUID as randomUUID8 } from "node:crypto";
160113
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as readFileSync90, realpathSync as realpathSync13, rmSync as rmSync18, writeFileSync as writeFileSync30 } from "node:fs";
160114
- import { homedir as homedir9, hostname } from "node:os";
160690
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as readFileSync91, realpathSync as realpathSync13, rmSync as rmSync18, writeFileSync as writeFileSync30 } from "node:fs";
160691
+ import { homedir as homedir11, hostname } from "node:os";
160115
160692
  import { join as join76 } from "node:path";
160116
160693
  function scrubDeep(value, scrub) {
160117
160694
  if (typeof value === "string") return scrub(value);
@@ -160568,7 +161145,7 @@ function fileJournal(path2) {
160568
161145
  }
160569
161146
  function readLockSummary(path2) {
160570
161147
  try {
160571
- const { pid, host, at: at2 } = JSON.parse(readFileSync90(path2, "utf8"));
161148
+ const { pid, host, at: at2 } = JSON.parse(readFileSync91(path2, "utf8"));
160572
161149
  return `pid ${pid} on ${host} since ${at2}`;
160573
161150
  } catch {
160574
161151
  return "unreadable lock";
@@ -160588,7 +161165,7 @@ function acquireApplyLock(dir, appleAppId) {
160588
161165
  return () => {
160589
161166
  let current = "";
160590
161167
  try {
160591
- current = readFileSync90(path2, "utf8");
161168
+ current = readFileSync91(path2, "utf8");
160592
161169
  } catch {
160593
161170
  return;
160594
161171
  }
@@ -160596,7 +161173,7 @@ function acquireApplyLock(dir, appleAppId) {
160596
161173
  };
160597
161174
  }
160598
161175
  function stateDir(appleAppId) {
160599
- const dir = join76(homedir9(), ".himalaya", "store-iap", appleAppId);
161176
+ const dir = join76(homedir11(), ".himalaya", "store-iap", appleAppId);
160600
161177
  mkdirSync34(dir, { recursive: true, mode: 448 });
160601
161178
  return dir;
160602
161179
  }
@@ -160612,7 +161189,7 @@ async function confirmOnTerminal(question) {
160612
161189
  }
160613
161190
  function defaultStoreIapDeps() {
160614
161191
  return {
160615
- readFile: (path2) => readFileSync90(path2, "utf8"),
161192
+ readFile: (path2) => readFileSync91(path2, "utf8"),
160616
161193
  writeFileAtomic,
160617
161194
  resolveCredentials: ({ profileFlag, target }) => resolveIapCredentials({ profileFlag, target }),
160618
161195
  createApi: (key2) => createIapApi(createAscClient({ key: key2 })),
@@ -161094,8 +161671,8 @@ __export(preflight_app_exports, {
161094
161671
  preflightApp: () => preflightApp,
161095
161672
  profileAccount: () => profileAccount
161096
161673
  });
161097
- import { readFileSync as readFileSync91, existsSync as existsSync75, readdirSync as readdirSync34, statSync as statSync21 } from "node:fs";
161098
- import { createHash as createHash39 } from "node:crypto";
161674
+ import { readFileSync as readFileSync92, existsSync as existsSync75, readdirSync as readdirSync34, statSync as statSync21 } from "node:fs";
161675
+ import { createHash as createHash40 } from "node:crypto";
161099
161676
  import { join as join77 } from "node:path";
161100
161677
  function analyze(projectYml, storeConfig, icon, account) {
161101
161678
  const f2 = [];
@@ -161160,8 +161737,8 @@ function profileAccount(app, storeConfig, opts = {}) {
161160
161737
  }
161161
161738
  }
161162
161739
  async function preflightApp(app, opts = {}) {
161163
- const projectYml = existsSync75(iosProjectYml(app)) ? readFileSync91(iosProjectYml(app), "utf8") : "";
161164
- const storeConfig = existsSync75(storeConfigPath(app)) ? readFileSync91(storeConfigPath(app), "utf8") : "";
161740
+ const projectYml = existsSync75(iosProjectYml(app)) ? readFileSync92(iosProjectYml(app), "utf8") : "";
161741
+ const storeConfig = existsSync75(storeConfigPath(app)) ? readFileSync92(storeConfigPath(app), "utf8") : "";
161165
161742
  if (!storeConfig) return [{ level: "error", message: `no apps/${app}/store/store.config.yaml \u2014 run /setup-store-signing first.` }];
161166
161743
  const findings = analyze(
161167
161744
  projectYml,
@@ -161320,7 +161897,7 @@ function playListingAssets(app, locale = "en-US") {
161320
161897
  for (const name of names) {
161321
161898
  const p2 = join77(dir, name);
161322
161899
  try {
161323
- if (statSync21(p2).isFile()) return { name, bytes: readFileSync91(p2) };
161900
+ if (statSync21(p2).isFile()) return { name, bytes: readFileSync92(p2) };
161324
161901
  } catch {
161325
161902
  }
161326
161903
  }
@@ -161360,7 +161937,7 @@ function listScreenshots(app, locale = "en-US") {
161360
161937
  const flat = join77(storeDir(app), "screenshots", locale);
161361
161938
  if (existsSync75(flat)) {
161362
161939
  for (const png of readdirSync34(flat).filter((n2) => n2.endsWith(".png"))) {
161363
- const sz = pngSize(readFileSync91(join77(flat, png)));
161940
+ const sz = pngSize(readFileSync92(join77(flat, png)));
161364
161941
  if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
161365
161942
  }
161366
161943
  }
@@ -161370,7 +161947,7 @@ function listScreenshots(app, locale = "en-US") {
161370
161947
  const d2 = join77(legacy, deviceDir);
161371
161948
  if (!statSync21(d2).isDirectory()) continue;
161372
161949
  for (const png of readdirSync34(d2).filter((n2) => n2.endsWith(".png"))) {
161373
- const sz = pngSize(readFileSync91(join77(d2, png)));
161950
+ const sz = pngSize(readFileSync92(join77(d2, png)));
161374
161951
  if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
161375
161952
  }
161376
161953
  }
@@ -161384,7 +161961,7 @@ function placeholderHashes2() {
161384
161961
  const p2 = join77(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
161385
161962
  try {
161386
161963
  if (!statSync21(p2).isFile()) continue;
161387
- return [LEGACY_PLACEHOLDER_SHA2562, createHash39("sha256").update(readFileSync91(p2)).digest("hex")];
161964
+ return [LEGACY_PLACEHOLDER_SHA2562, createHash40("sha256").update(readFileSync92(p2)).digest("hex")];
161388
161965
  } catch {
161389
161966
  }
161390
161967
  }
@@ -161420,8 +161997,8 @@ async function appIconState(iosDir) {
161420
161997
  const p2 = join77(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
161421
161998
  try {
161422
161999
  if (!statSync21(p2).isFile()) continue;
161423
- const bytes2 = readFileSync91(p2);
161424
- const hash2 = createHash39("sha256").update(bytes2).digest("hex");
162000
+ const bytes2 = readFileSync92(p2);
162001
+ const hash2 = createHash40("sha256").update(bytes2).digest("hex");
161425
162002
  const pixels = await pixelIssues(bytes2);
161426
162003
  return {
161427
162004
  exists: true,
@@ -161487,7 +162064,7 @@ __export(asc_status_exports, {
161487
162064
  ascStatus: () => ascStatus,
161488
162065
  buildVerdict: () => buildVerdict
161489
162066
  });
161490
- import { readFileSync as readFileSync92 } from "node:fs";
162067
+ import { readFileSync as readFileSync93 } from "node:fs";
161491
162068
  function buildVerdict(builds) {
161492
162069
  if (!builds.length) {
161493
162070
  return "NO builds registered \u2014 if you uploaded recently and it's been >15 min, the binary was REJECTED IN PROCESSING (reason is email-only; run validate-binary.ts / scan-purpose-strings.ts to reproduce it).";
@@ -161501,7 +162078,7 @@ function buildVerdict(builds) {
161501
162078
  function client(creds) {
161502
162079
  const env = creds ?? requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
161503
162080
  assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
161504
- const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync92(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
162081
+ const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync93(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
161505
162082
  return async (path2) => {
161506
162083
  const r2 = await fetch(`${ASC}${path2}`, { headers: { Authorization: `Bearer ${jwt}` } });
161507
162084
  return { status: r2.status, json: await r2.json().catch(() => ({})) };
@@ -161766,7 +162343,7 @@ __export(secrets_exports, {
161766
162343
  runRemoteSecretsCommand: () => runRemoteSecretsCommand,
161767
162344
  runSecretsCommand: () => runSecretsCommand
161768
162345
  });
161769
- import { readFileSync as readFileSync93 } from "node:fs";
162346
+ import { readFileSync as readFileSync94 } from "node:fs";
161770
162347
  function environment(value) {
161771
162348
  if (value === "preview" || value === "production") return value;
161772
162349
  throw new Error("--environment must be preview or production");
@@ -161797,7 +162374,7 @@ async function runSecretsCommand(operation, flags, io2, options = {}) {
161797
162374
  io2.log(JSON.stringify(await vault.list({ app, environment: env })));
161798
162375
  return 0;
161799
162376
  }
161800
- const value = options.readValue ? options.readValue() : readFileSync93(0, "utf8").replace(/\r?\n$/, "");
162377
+ const value = options.readValue ? options.readValue() : readFileSync94(0, "utf8").replace(/\r?\n$/, "");
161801
162378
  if (operation === "set") await vault.set({ app, environment: env, name, value });
161802
162379
  else if (operation === "rotate") await vault.rotate({ app, environment: env, name, value });
161803
162380
  else throw new Error(`unknown secrets operation ${operation}`);
@@ -161826,7 +162403,7 @@ async function runRemoteSecretsCommand(operation, flags, io2, options) {
161826
162403
  }
161827
162404
  let body;
161828
162405
  if (operation !== "list") {
161829
- const value = options.readValue ? options.readValue() : readFileSync93(0, "utf8").replace(/\r?\n$/, "");
162406
+ const value = options.readValue ? options.readValue() : readFileSync94(0, "utf8").replace(/\r?\n$/, "");
161830
162407
  body = JSON.stringify({ value });
161831
162408
  }
161832
162409
  const response = await (options.fetchImpl ?? fetch)(url, { method: operation === "list" ? "GET" : operation === "set" ? "PUT" : "POST", headers: headers2, body });
@@ -162020,7 +162597,7 @@ var init_site_member = __esm({
162020
162597
  });
162021
162598
 
162022
162599
  // src/notify-ping-all.ts
162023
- import { createHash as createHash40 } from "node:crypto";
162600
+ import { createHash as createHash41 } from "node:crypto";
162024
162601
  async function listApprovedMembers(input) {
162025
162602
  const first = await scanMembers(input);
162026
162603
  const second = await scanMembers(input);
@@ -162074,7 +162651,7 @@ async function scanMembers(input) {
162074
162651
  }
162075
162652
  }
162076
162653
  function campaignRequestId(campaignId, memberId) {
162077
- const bytes2 = createHash40("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
162654
+ const bytes2 = createHash41("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
162078
162655
  bytes2[6] = bytes2[6] & 15 | 80;
162079
162656
  bytes2[8] = bytes2[8] & 63 | 128;
162080
162657
  const hex2 = bytes2.toString("hex");
@@ -162324,15 +162901,15 @@ __export(notify_exports, {
162324
162901
  runNotify: () => runNotify,
162325
162902
  saveAdminSession: () => saveAdminSession
162326
162903
  });
162327
- import { chmodSync as chmodSync3, mkdirSync as mkdirSync35, readFileSync as readFileSync94, writeFileSync as writeFileSync31 } from "node:fs";
162328
- import { homedir as homedir10 } from "node:os";
162904
+ import { chmodSync as chmodSync3, mkdirSync as mkdirSync35, readFileSync as readFileSync95, writeFileSync as writeFileSync31 } from "node:fs";
162905
+ import { homedir as homedir12 } from "node:os";
162329
162906
  import { dirname as dirname41, join as join78 } from "node:path";
162330
162907
  function defaultSessionsPath() {
162331
- return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join78(homedir10(), ".himalaya", "admin-sessions.json");
162908
+ return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join78(homedir12(), ".himalaya", "admin-sessions.json");
162332
162909
  }
162333
162910
  function loadSessionsFile(path2 = defaultSessionsPath()) {
162334
162911
  try {
162335
- return JSON.parse(readFileSync94(path2, "utf8"));
162912
+ return JSON.parse(readFileSync95(path2, "utf8"));
162336
162913
  } catch {
162337
162914
  return {};
162338
162915
  }
@@ -162709,20 +163286,20 @@ __export(base44_auth_exports, {
162709
163286
  usableBase44Auth: () => usableBase44Auth,
162710
163287
  writeBase44Session: () => writeBase44Session
162711
163288
  });
162712
- import { chmodSync as chmodSync4, existsSync as existsSync76, mkdirSync as mkdirSync36, readFileSync as readFileSync95, rmSync as rmSync19, writeFileSync as writeFileSync32 } from "node:fs";
162713
- import { homedir as homedir11 } from "node:os";
163289
+ import { chmodSync as chmodSync4, existsSync as existsSync76, mkdirSync as mkdirSync36, readFileSync as readFileSync96, rmSync as rmSync19, writeFileSync as writeFileSync32 } from "node:fs";
163290
+ import { homedir as homedir13 } from "node:os";
162714
163291
  import { dirname as dirname42, join as join79 } from "node:path";
162715
163292
  function base44ApiBase(env = process.env) {
162716
163293
  return (env.BASE44_API_URL?.trim() || "https://app.base44.com").replace(/\/+$/, "");
162717
163294
  }
162718
- function base44SessionPath(home = homedir11()) {
163295
+ function base44SessionPath(home = homedir13()) {
162719
163296
  return join79(home, ".himi", "base44", "session.json");
162720
163297
  }
162721
163298
  function readBase44Session(home) {
162722
163299
  const p2 = base44SessionPath(home);
162723
163300
  if (!existsSync76(p2)) return void 0;
162724
163301
  try {
162725
- const s2 = JSON.parse(readFileSync95(p2, "utf8"));
163302
+ const s2 = JSON.parse(readFileSync96(p2, "utf8"));
162726
163303
  return typeof s2.accessToken === "string" && s2.accessToken ? s2 : void 0;
162727
163304
  } catch {
162728
163305
  return void 0;
@@ -162832,10 +163409,10 @@ async function base44DeviceLogin(opts) {
162832
163409
  }
162833
163410
  throw new Error("the Base44 sign-in code expired before it was approved \u2014 run `himi base44 login` again");
162834
163411
  }
162835
- function importBase44CliSession(home = homedir11(), env = process.env) {
163412
+ function importBase44CliSession(home = homedir13(), env = process.env) {
162836
163413
  const src = join79(home, ".base44", "auth", "auth.json");
162837
163414
  if (!existsSync76(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
162838
- const a2 = JSON.parse(readFileSync95(src, "utf8"));
163415
+ const a2 = JSON.parse(readFileSync96(src, "utf8"));
162839
163416
  if (typeof a2.accessToken !== "string" || !a2.accessToken) throw new Error(`${src} holds no access token`);
162840
163417
  const session = {
162841
163418
  accessToken: a2.accessToken,
@@ -166139,11 +166716,11 @@ var init_analyze = __esm({
166139
166716
  });
166140
166717
 
166141
166718
  // src/base44-analyze/write-artifacts.ts
166142
- import { existsSync as existsSync77, mkdirSync as mkdirSync38, readFileSync as readFileSync96, rmSync as rmSync20, writeFileSync as writeFileSync34 } from "node:fs";
166719
+ import { existsSync as existsSync77, mkdirSync as mkdirSync38, readFileSync as readFileSync97, rmSync as rmSync20, writeFileSync as writeFileSync34 } from "node:fs";
166143
166720
  import { dirname as dirname43, join as join81, resolve as resolve57, sep as sep19 } from "node:path";
166144
166721
  function isBookFolder(dir) {
166145
166722
  try {
166146
- return JSON.parse(readFileSync96(join81(dir, "book.json"), "utf8")).kind === "base44-app-book";
166723
+ return JSON.parse(readFileSync97(join81(dir, "book.json"), "utf8")).kind === "base44-app-book";
166147
166724
  } catch {
166148
166725
  return false;
166149
166726
  }
@@ -171559,7 +172136,7 @@ var init_customer_build = __esm({
171559
172136
  });
171560
172137
 
171561
172138
  // src/site-analyze/apply.ts
171562
- import { existsSync as existsSync78, readFileSync as readFileSync97, writeFileSync as writeFileSync36, copyFileSync as copyFileSync2, mkdirSync as mkdirSync40, realpathSync as realpathSync14, statSync as statSync22 } from "node:fs";
172139
+ import { existsSync as existsSync78, readFileSync as readFileSync98, writeFileSync as writeFileSync36, copyFileSync as copyFileSync2, mkdirSync as mkdirSync40, realpathSync as realpathSync14, statSync as statSync22 } from "node:fs";
171563
172140
  import { dirname as dirname44, isAbsolute as isAbsolute8, join as join83, resolve as resolve59, sep as sep20 } from "node:path";
171564
172141
  import { spawnSync as spawnSync4 } from "node:child_process";
171565
172142
  function unpairedRedirectNote(overlay) {
@@ -171682,7 +172259,7 @@ function buildMergedContract(options) {
171682
172259
  if (!existsSync78(committedPath)) {
171683
172260
  throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
171684
172261
  }
171685
- const committed = JSON.parse(readFileSync97(committedPath, "utf8"));
172262
+ const committed = JSON.parse(readFileSync98(committedPath, "utf8"));
171686
172263
  const merged = mergeCustomerOwned(committed, overlay);
171687
172264
  const overlayFontFamily = (overlay.branding ?? {}).fontFamily;
171688
172265
  const branding = merged.branding ?? {};
@@ -171721,7 +172298,7 @@ function buildMergedContract(options) {
171721
172298
  if (existsSync78(facesPath)) {
171722
172299
  let faces = [];
171723
172300
  try {
171724
- const parsed = JSON.parse(readFileSync97(facesPath, "utf8"));
172301
+ const parsed = JSON.parse(readFileSync98(facesPath, "utf8"));
171725
172302
  faces = Array.isArray(parsed) ? parsed : [];
171726
172303
  } catch {
171727
172304
  faces = [];
@@ -171782,7 +172359,7 @@ function staticFaqFor(overlay, overlayPath) {
171782
172359
  const bookPath = join83(dirname44(resolve59(overlayPath)), "book.json");
171783
172360
  if (!existsSync78(bookPath)) return void 0;
171784
172361
  try {
171785
- const book = JSON.parse(readFileSync97(bookPath, "utf8"));
172362
+ const book = JSON.parse(readFileSync98(bookPath, "utf8"));
171786
172363
  const copy = book?.copy;
171787
172364
  if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
171788
172365
  const pairs = deriveStaticFaq(copy.faq);
@@ -171799,7 +172376,7 @@ function staticGalleriesFor(overlay, overlayPath) {
171799
172376
  const bookPath = join83(dirname44(resolve59(overlayPath)), "book.json");
171800
172377
  if (!existsSync78(bookPath)) return void 0;
171801
172378
  try {
171802
- const book = JSON.parse(readFileSync97(bookPath, "utf8"));
172379
+ const book = JSON.parse(readFileSync98(bookPath, "utf8"));
171803
172380
  if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
171804
172381
  const galleries = deriveStaticGalleries(book.look.pages);
171805
172382
  return galleries.length || book.look.complete === true ? galleries : void 0;
@@ -171811,8 +172388,8 @@ async function applyOverlays(input) {
171811
172388
  const cwd = resolve59(input.cwd);
171812
172389
  const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
171813
172390
  assertKnownShell(shell);
171814
- const overlay = JSON.parse(readFileSync97(input.overlayPath, "utf8"));
171815
- const tokens2 = JSON.parse(readFileSync97(input.tokensPath, "utf8"));
172391
+ const overlay = JSON.parse(readFileSync98(input.overlayPath, "utf8"));
172392
+ const tokens2 = JSON.parse(readFileSync98(input.tokensPath, "utf8"));
171816
172393
  const faq = staticFaqFor(overlay, input.overlayPath);
171817
172394
  if (faq !== void 0) overlay.faq = faq;
171818
172395
  const galleries = staticGalleriesFor(overlay, input.overlayPath);
@@ -171831,7 +172408,7 @@ async function applyOverlays(input) {
171831
172408
  }
171832
172409
  const appDir3 = join83(repoRoot2, shellAppDir(shell));
171833
172410
  const committedPath = join83(appDir3, "provisioning.json");
171834
- const committedSite = existsSync78(committedPath) ? JSON.parse(readFileSync97(committedPath, "utf8")).site : void 0;
172411
+ const committedSite = existsSync78(committedPath) ? JSON.parse(readFileSync98(committedPath, "utf8")).site : void 0;
171835
172412
  if (committedSite !== void 0 && overlay.site === void 0) {
171836
172413
  throw new Error(
171837
172414
  `shell "${shell}" is a site shell: its contract names the customer's website (a \`site\` block), and this overlay has none. Re-run \`himi site analyze --url <site> --shell ${shell}\` to derive the site's page map (edit \`site.pages\` in provisioning.overlay.json if needed), then --apply.`
@@ -171873,7 +172450,7 @@ async function applyOverlays(input) {
171873
172450
  let packageFaq = faq;
171874
172451
  let packageGalleries = galleries;
171875
172452
  if (existsSync78(pkgProv)) {
171876
- const cur = JSON.parse(readFileSync97(pkgProv, "utf8"));
172453
+ const cur = JSON.parse(readFileSync98(pkgProv, "utf8"));
171877
172454
  if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
171878
172455
  const merged = deepMerge4(cur, overlay);
171879
172456
  packageFaq = merged.faq;
@@ -171891,7 +172468,7 @@ async function applyOverlays(input) {
171891
172468
  }
171892
172469
  const pkgTokens = join83(cwd, "tokens.json");
171893
172470
  if (existsSync78(pkgTokens) && (tokens2.colors || tokens2.typography)) {
171894
- const cur = JSON.parse(readFileSync97(pkgTokens, "utf8"));
172471
+ const cur = JSON.parse(readFileSync98(pkgTokens, "utf8"));
171895
172472
  let tokensIn = tokens2;
171896
172473
  if (tokens2.typography) {
171897
172474
  const fonts = catalogTypography(tokens2.typography, cur.typography);
@@ -171918,7 +172495,7 @@ async function applyOverlays(input) {
171918
172495
  const homeAction = homeRefreshActionId(shell);
171919
172496
  const homeSrc = join83(cwd, "dev/index.ts");
171920
172497
  if (homeAction && existsSync78(homeSrc)) {
171921
- const prev = readFileSync97(homeSrc, "utf8");
172498
+ const prev = readFileSync98(homeSrc, "utf8");
171922
172499
  const patched = patchBrandParams(prev, overlay, homeAction);
171923
172500
  let next = patched.src;
171924
172501
  if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
@@ -172917,7 +173494,7 @@ __export(cli_exports2, {
172917
173494
  runSiteAnalyze: () => runSiteAnalyze,
172918
173495
  runSiteFunctionCli: () => runSiteFunctionCli
172919
173496
  });
172920
- import { existsSync as existsSync79, readFileSync as readFileSync98 } from "node:fs";
173497
+ import { existsSync as existsSync79, readFileSync as readFileSync99 } from "node:fs";
172921
173498
  import { resolve as resolve60 } from "node:path";
172922
173499
  function applyNeedsClient(shell) {
172923
173500
  if (shell === void 0 || !SHELL_NAMES2.includes(shell)) return true;
@@ -172976,7 +173553,7 @@ async function runSiteAnalyze(opts) {
172976
173553
  const prevOverlayPath = resolve60(outDir, "provisioning.overlay.json");
172977
173554
  const prevSite = existsSync79(prevOverlayPath) ? (() => {
172978
173555
  try {
172979
- return JSON.parse(readFileSync98(prevOverlayPath, "utf8")).site;
173556
+ return JSON.parse(readFileSync99(prevOverlayPath, "utf8")).site;
172980
173557
  } catch {
172981
173558
  return void 0;
172982
173559
  }
@@ -172995,7 +173572,7 @@ async function runSiteAnalyze(opts) {
172995
173572
  }
172996
173573
  const previousOverlay = resolve60(outDir, "provisioning.overlay.json");
172997
173574
  carryOverGoals(
172998
- existsSync79(previousOverlay) ? readFileSync98(previousOverlay, "utf8") : void 0,
173575
+ existsSync79(previousOverlay) ? readFileSync99(previousOverlay, "utf8") : void 0,
172999
173576
  result.provisioningOverlay
173000
173577
  );
173001
173578
  const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
@@ -173053,7 +173630,7 @@ async function runSiteFunctionCli(opts) {
173053
173630
  let source;
173054
173631
  if (opts.sourcePath) {
173055
173632
  const p2 = resolve60(opts.cwd ?? process.cwd(), opts.sourcePath);
173056
- source = readFileSync98(p2, "utf8");
173633
+ source = readFileSync99(p2, "utf8");
173057
173634
  }
173058
173635
  let body;
173059
173636
  if (opts.bodyRaw != null) {
@@ -173083,7 +173660,7 @@ async function runSiteFunctionCli(opts) {
173083
173660
  function base44BookRoutes(bookPath, siteUrl) {
173084
173661
  if (!existsSync79(bookPath)) return void 0;
173085
173662
  try {
173086
- const book = JSON.parse(readFileSync98(bookPath, "utf8"));
173663
+ const book = JSON.parse(readFileSync99(bookPath, "utf8"));
173087
173664
  if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
173088
173665
  const host = (u2) => {
173089
173666
  try {
@@ -173223,7 +173800,7 @@ function explainAuthFailure(err) {
173223
173800
  return `${err.status} from the \`wix token\` identity \u2014 your Wix user may not be allowed to provision on this account. Generate an API key with site-provisioning permission at ${API_KEYS_URL}, then export WIX_API_KEY and WIX_ACCOUNT_ID and retry.`;
173224
173801
  }
173225
173802
  var API_BASE2, API_KEYS_URL, TOKEN_RE2, TOKEN_MINT_TIMEOUT_MS2, cached2, DEFAULT_TIMEOUT_MS5;
173226
- var init_wix_account = __esm({
173803
+ var init_wix_account2 = __esm({
173227
173804
  "src/wix-account.ts"() {
173228
173805
  init_wix_owner();
173229
173806
  API_BASE2 = "https://www.wixapis.com";
@@ -173338,7 +173915,7 @@ __export(site_create_exports, {
173338
173915
  runSiteList: () => runSiteList,
173339
173916
  writeProvisioningBinding: () => writeProvisioningBinding
173340
173917
  });
173341
- import { existsSync as existsSync80, readFileSync as readFileSync99, writeFileSync as writeFileSync37 } from "node:fs";
173918
+ import { existsSync as existsSync80, readFileSync as readFileSync100, writeFileSync as writeFileSync37 } from "node:fs";
173342
173919
  import { resolve as resolvePath2 } from "node:path";
173343
173920
  function oauthClientName(projectName) {
173344
173921
  return `${projectName} client`;
@@ -173487,7 +174064,7 @@ async function runSiteCreate(opts) {
173487
174064
  if (!wantOauthApp) return { ...base, nextSteps: nextSteps(metaSiteId) };
173488
174065
  return { ...base, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
173489
174066
  }
173490
- function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync80, readFileSync: readFileSync99, writeFileSync: writeFileSync37 }) {
174067
+ function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync80, readFileSync: readFileSync100, writeFileSync: writeFileSync37 }) {
173491
174068
  const msid = binding2.siteId;
173492
174069
  const path2 = resolvePath2(target);
173493
174070
  const committed = committedShellProvisioning(path2);
@@ -173571,7 +174148,7 @@ var init_site_create = __esm({
173571
174148
  "src/site-create.ts"() {
173572
174149
  init_shell_quote();
173573
174150
  init_wix_owner();
173574
- init_wix_account();
174151
+ init_wix_account2();
173575
174152
  init_wix_verticals();
173576
174153
  init_apply2();
173577
174154
  init_types2();
@@ -174184,11 +174761,11 @@ var init_context = __esm({
174184
174761
  });
174185
174762
 
174186
174763
  // src/cli.ts
174187
- import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync100, mkdirSync as mkdirSync41, writeFileSync as writeFileSync38, existsSync as existsSync81, rmSync as rmSync22, readdirSync as readdirSync35, statSync as statSync23, lstatSync as lstatSync21, accessSync, constants as constants4, renameSync as renameSync12, cpSync as cpSync3 } from "node:fs";
174764
+ import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync101, mkdirSync as mkdirSync41, writeFileSync as writeFileSync38, existsSync as existsSync81, rmSync as rmSync22, readdirSync as readdirSync35, statSync as statSync23, lstatSync as lstatSync21, accessSync, constants as constants4, renameSync as renameSync12, cpSync as cpSync3 } from "node:fs";
174188
174765
  import { execFile as execFile2, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn7 } from "node:child_process";
174189
174766
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
174190
- import { createHash as createHash41, randomUUID as randomUUID11 } from "node:crypto";
174191
- import { tmpdir as tmpdir6, homedir as homedir12, hostname as hostname2 } from "node:os";
174767
+ import { createHash as createHash42, randomUUID as randomUUID11 } from "node:crypto";
174768
+ import { tmpdir as tmpdir6, homedir as homedir14, hostname as hostname2 } from "node:os";
174192
174769
  import { join as join84, resolve as resolve61, relative as relative15, basename as basename19, dirname as dirname45 } from "node:path";
174193
174770
  import { fileURLToPath as fileURLToPath29 } from "node:url";
174194
174771
 
@@ -176263,7 +176840,7 @@ var num3 = (v2) => typeof v2 === "string" && v2 !== "" && Number.isFinite(Number
176263
176840
  function embeddedTemplateCatalog() {
176264
176841
  return availableTemplates().map((name) => {
176265
176842
  const path2 = join84(templateSourceDir(name), TEMPLATE_META_FILE);
176266
- const meta = JSON.parse(readFileSync100(path2, "utf8"));
176843
+ const meta = JSON.parse(readFileSync101(path2, "utf8"));
176267
176844
  if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
176268
176845
  throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
176269
176846
  }
@@ -177141,7 +177718,7 @@ var COMMANDS2 = [
177141
177718
  ];
177142
177719
  function cliVersion() {
177143
177720
  try {
177144
- return JSON.parse(readFileSync100(new URL("../package.json", import.meta.url), "utf8")).version ?? "unknown";
177721
+ return JSON.parse(readFileSync101(new URL("../package.json", import.meta.url), "utf8")).version ?? "unknown";
177145
177722
  } catch {
177146
177723
  return "unknown";
177147
177724
  }
@@ -177179,7 +177756,7 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
177179
177756
  const configured = async (key2) => {
177180
177757
  const timeout = deadline - Date.now();
177181
177758
  if (timeout <= 0) throw new Error("npm config: out of budget");
177182
- const raw = String(await exec("npm", ["config", "get", key2], { cwd: homedir12(), timeout })).trim();
177759
+ const raw = String(await exec("npm", ["config", "get", key2], { cwd: homedir14(), timeout })).trim();
177183
177760
  return raw && raw !== "undefined" ? raw : void 0;
177184
177761
  };
177185
177762
  const effective = normalizeRegistry(await configured("@wix:registry") ?? await configured("registry"));
@@ -177266,7 +177843,7 @@ function ageInDays(publishedAt, now = Date.now()) {
177266
177843
  }
177267
177844
  function packageVersion(path2) {
177268
177845
  try {
177269
- const version4 = JSON.parse(readFileSync100(path2, "utf8")).version;
177846
+ const version4 = JSON.parse(readFileSync101(path2, "utf8")).version;
177270
177847
  return typeof version4 === "string" && version4 ? version4 : void 0;
177271
177848
  } catch {
177272
177849
  return void 0;
@@ -177332,11 +177909,11 @@ var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
177332
177909
  var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
177333
177910
  var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
177334
177911
  function updateCachePath(env = process.env) {
177335
- return env.HIMI_UPDATE_CACHE_FILE ?? join84(homedir12(), ".himalaya", "update-check.json");
177912
+ return env.HIMI_UPDATE_CACHE_FILE ?? join84(homedir14(), ".himalaya", "update-check.json");
177336
177913
  }
177337
177914
  function readUpdateCache(path2) {
177338
177915
  try {
177339
- const parsed = JSON.parse(readFileSync100(path2, "utf8"));
177916
+ const parsed = JSON.parse(readFileSync101(path2, "utf8"));
177340
177917
  return parsed && typeof parsed === "object" ? parsed : {};
177341
177918
  } catch {
177342
177919
  return {};
@@ -177398,7 +177975,7 @@ function createUpdateRunner(spawn8 = spawnSync5) {
177398
177975
  // parse — the agent case this whole feature exists for (#2985 review). And no stdin: an
177399
177976
  // install needs none, and must not consume input piped to the command we are about to re-run.
177400
177977
  stdio: ["ignore", 2, 2],
177401
- cwd: homedir12()
177978
+ cwd: homedir14()
177402
177979
  });
177403
177980
  if (result.error) return { ok: false, detail: result.error.message };
177404
177981
  return result.status === 0 ? { ok: true } : { ok: false, detail: `npm exited ${result.status}` };
@@ -177457,7 +178034,7 @@ function staleUpdateLockFile(cachePath, now) {
177457
178034
  for (const path2 of [`${cachePath}.lock.break`, `${cachePath}.lock`]) {
177458
178035
  let content;
177459
178036
  try {
177460
- content = readFileSync100(path2, "utf8");
178037
+ content = readFileSync101(path2, "utf8");
177461
178038
  } catch {
177462
178039
  continue;
177463
178040
  }
@@ -177480,7 +178057,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
177480
178057
  const mine = lockStamp(now);
177481
178058
  const readLock = (path2) => {
177482
178059
  try {
177483
- return readFileSync100(path2, "utf8");
178060
+ return readFileSync101(path2, "utf8");
177484
178061
  } catch {
177485
178062
  return void 0;
177486
178063
  }
@@ -177571,7 +178148,7 @@ function createUpdateRefreshSpawner(spawnFn = spawn7, execArgv = process.execArg
177571
178148
  const child = spawnFn(process.execPath, [...loaderArgs(execArgv), fileURLToPath29(import.meta.url), UPDATE_REFRESH_COMMAND], {
177572
178149
  detached: true,
177573
178150
  stdio: "ignore",
177574
- cwd: homedir12(),
178151
+ cwd: homedir14(),
177575
178152
  env: process.env
177576
178153
  });
177577
178154
  child.on("error", () => {
@@ -178181,7 +178758,7 @@ async function nativeConfigAdvisories(app, configSource) {
178181
178758
  const { iosProjectYml: iosProjectYml2 } = await Promise.resolve().then(() => (init_paths2(), paths_exports));
178182
178759
  const { androidOptedIn: androidOptedIn3, LABEL_IOS_SPLASH: LABEL_IOS_SPLASH2 } = await Promise.resolve().then(() => (init_splash(), splash_exports));
178183
178760
  const iosYmlPath = iosProjectYml2(app);
178184
- const iosYml = existsSync81(iosYmlPath) ? readFileSync100(iosYmlPath, "utf8") : "";
178761
+ const iosYml = existsSync81(iosYmlPath) ? readFileSync101(iosYmlPath, "utf8") : "";
178185
178762
  let optedIn = iosYml.includes(LABEL_IOS_SPLASH2);
178186
178763
  if (!optedIn) {
178187
178764
  const { androidManifestPath: androidManifestPath3 } = await Promise.resolve().then(() => (init_gen_native_config(), gen_native_config_exports));
@@ -178195,7 +178772,7 @@ async function nativeConfigAdvisories(app, configSource) {
178195
178772
  }
178196
178773
  function readConfigSource(dir) {
178197
178774
  try {
178198
- return readFileSync100(join84(dir, "config.ts"), "utf8");
178775
+ return readFileSync101(join84(dir, "config.ts"), "utf8");
178199
178776
  } catch {
178200
178777
  return null;
178201
178778
  }
@@ -178403,8 +178980,8 @@ function materializeForPreview(appDir3, slug, displayName2) {
178403
178980
  }
178404
178981
  async function appId(dir) {
178405
178982
  try {
178406
- const { readFileSync: readFileSync101 } = await import("node:fs");
178407
- const m2 = JSON.parse(readFileSync101(join84(dir, "himalaya.content.json"), "utf8"));
178983
+ const { readFileSync: readFileSync102 } = await import("node:fs");
178984
+ const m2 = JSON.parse(readFileSync102(join84(dir, "himalaya.content.json"), "utf8"));
178408
178985
  if (m2.name) return m2.name;
178409
178986
  } catch {
178410
178987
  }
@@ -178412,8 +178989,8 @@ async function appId(dir) {
178412
178989
  }
178413
178990
  async function contentVisibility(dir) {
178414
178991
  try {
178415
- const { readFileSync: readFileSync101 } = await import("node:fs");
178416
- const m2 = JSON.parse(readFileSync101(join84(dir, "himalaya.content.json"), "utf8"));
178992
+ const { readFileSync: readFileSync102 } = await import("node:fs");
178993
+ const m2 = JSON.parse(readFileSync102(join84(dir, "himalaya.content.json"), "utf8"));
178417
178994
  if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
178418
178995
  } catch {
178419
178996
  }
@@ -178907,7 +179484,7 @@ async function producedWidgetFamilies(dir) {
178907
179484
  let js2;
178908
179485
  for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
178909
179486
  try {
178910
- js2 = readFileSync100(join84(outDir, candidate), "utf8");
179487
+ js2 = readFileSync101(join84(outDir, candidate), "utf8");
178911
179488
  break;
178912
179489
  } catch {
178913
179490
  }
@@ -179477,13 +180054,13 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179477
180054
  if (adding) {
179478
180055
  const from = str9(flags.from);
179479
180056
  if (!from) throw new TrimRefusal2('--add <id> needs --from <file> holding the whole new SCREENS entry (` "<id>": { "screenId": "<id>", \u2026 },`)');
179480
- print(adopt.addScreen(dir, adding, readFileSync100(from, "utf8"), { parent: str9(flags.parent), tab: str9(flags.tab), displayName: str9(flags["display-name"]) }));
180057
+ print(adopt.addScreen(dir, adding, readFileSync101(from, "utf8"), { parent: str9(flags.parent), tab: str9(flags.tab), displayName: str9(flags["display-name"]) }));
179481
180058
  return 0;
179482
180059
  }
179483
180060
  if (target) {
179484
180061
  const from = str9(flags.from);
179485
180062
  if (!from) throw new TrimRefusal2("--write <id> needs --from <file> holding the whole entry, as --show prints it");
179486
- print(adopt.replaceScreen(dir, target, readFileSync100(from, "utf8")));
180063
+ print(adopt.replaceScreen(dir, target, readFileSync101(from, "utf8")));
179487
180064
  return 0;
179488
180065
  }
179489
180066
  if (show) {
@@ -179635,7 +180212,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179635
180212
  const sourceDir = resolve61(str9(flags["source-dir"]) ?? appDir3);
179636
180213
  let meta;
179637
180214
  try {
179638
- meta = JSON.parse(readFileSync100(join84(sourceDir, TEMPLATE_META_FILE), "utf8"));
180215
+ meta = JSON.parse(readFileSync101(join84(sourceDir, TEMPLATE_META_FILE), "utf8"));
179639
180216
  } catch {
179640
180217
  io2.error(JSON.stringify({ error: `no ${TEMPLATE_META_FILE} in ${sourceDir} \u2014 a template must declare { title, description, tags } to be published`, hint: `add ${TEMPLATE_META_FILE} next to himalaya.content.json (or pass --source-dir <dir>)` }));
179641
180218
  return 2;
@@ -179645,7 +180222,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179645
180222
  return 2;
179646
180223
  }
179647
180224
  try {
179648
- const appearance = extractTemplateAppearance(JSON.parse(readFileSync100(join84(sourceDir, "tokens.json"), "utf8")));
180225
+ const appearance = extractTemplateAppearance(JSON.parse(readFileSync101(join84(sourceDir, "tokens.json"), "utf8")));
179649
180226
  meta = { ...appearance, ...meta };
179650
180227
  } catch {
179651
180228
  }
@@ -179724,9 +180301,9 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179724
180301
  let iconHash;
179725
180302
  if (iconPath) {
179726
180303
  try {
179727
- const bytes2 = readFileSync100(iconPath);
180304
+ const bytes2 = readFileSync101(iconPath);
179728
180305
  payload.icon = bytes2.toString("base64");
179729
- iconHash = createHash41("sha256").update(bytes2).digest("hex");
180306
+ iconHash = createHash42("sha256").update(bytes2).digest("hex");
179730
180307
  } catch {
179731
180308
  }
179732
180309
  }
@@ -179937,16 +180514,16 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179937
180514
  return 2;
179938
180515
  }
179939
180516
  const { readdirSync: readdirSync36, existsSync: fileExists } = await import("node:fs");
179940
- const { join: pathJoin } = await import("node:path");
180517
+ const { join: pathJoin3 } = await import("node:path");
179941
180518
  const targets = [];
179942
- const t5 = pathJoin(dir, "tier5-src");
180519
+ const t5 = pathJoin3(dir, "tier5-src");
179943
180520
  if (fileExists(t5)) {
179944
180521
  for (const d2 of readdirSync36(t5, { withFileTypes: true })) {
179945
- if (d2.isDirectory()) targets.push(pathJoin(t5, d2.name, "index.ts"));
180522
+ if (d2.isDirectory()) targets.push(pathJoin3(t5, d2.name, "index.ts"));
179946
180523
  }
179947
180524
  }
179948
180525
  for (const f2 of ["dev/index.ts", "dev/index.tsx"]) {
179949
- const c2 = pathJoin(dir, f2);
180526
+ const c2 = pathJoin3(dir, f2);
179950
180527
  if (fileExists(c2)) targets.push(c2);
179951
180528
  }
179952
180529
  const res = ejectModule2({
@@ -180028,7 +180605,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
180028
180605
  const path2 = dpxSessionTokenPath();
180029
180606
  let raw;
180030
180607
  try {
180031
- raw = readFileSync100(path2, "utf8");
180608
+ raw = readFileSync101(path2, "utf8");
180032
180609
  } catch {
180033
180610
  throw new Error(`no DPX BO session at ${path2}; run dpx auth login, write dpx auth token to that path, then himi login --dpx --target bo`);
180034
180611
  }
@@ -180885,7 +181462,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
180885
181462
  return 2;
180886
181463
  }
180887
181464
  try {
180888
- const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync100(stateArg.replace(/^@/, ""), "utf8");
181465
+ const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync101(stateArg.replace(/^@/, ""), "utf8");
180889
181466
  injectedState = JSON.parse(raw);
180890
181467
  } catch (e2) {
180891
181468
  io2.error(JSON.stringify({ error: `--state must be inline JSON or a path to a .json file \u2014 ${e2.message}` }));
@@ -180900,7 +181477,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
180900
181477
  return 2;
180901
181478
  }
180902
181479
  try {
180903
- const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync100(inputArg.replace(/^@/, ""), "utf8");
181480
+ const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync101(inputArg.replace(/^@/, ""), "utf8");
180904
181481
  const parsed = JSON.parse(raw);
180905
181482
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("must be a JSON object");
180906
181483
  injectedInput = parsed;
@@ -181585,7 +182162,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
181585
182162
  let localSourceHash;
181586
182163
  try {
181587
182164
  const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
181588
- localSourceHash = createHash41("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
182165
+ localSourceHash = createHash42("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
181589
182166
  } catch {
181590
182167
  }
181591
182168
  return runReleasePatch({
@@ -182269,7 +182846,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
182269
182846
  }));
182270
182847
  return 1;
182271
182848
  }
182272
- const archive = readFileSync100(resolve61(file2));
182849
+ const archive = readFileSync101(resolve61(file2));
182273
182850
  const result = await client2().createPackageShare({
182274
182851
  app: opened.header.app,
182275
182852
  releaseId: opened.header.releaseId,
@@ -182475,7 +183052,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
182475
183052
  if (watchKit && bus) {
182476
183053
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
182477
183054
  const live3 = join84(running.releaseRoot, running.app);
182478
- const manifestOf = (tree) => JSON.parse(readFileSync100(join84(tree, "release-manifest.json"), "utf8"));
183055
+ const manifestOf = (tree) => JSON.parse(readFileSync101(join84(tree, "release-manifest.json"), "utf8"));
182479
183056
  let current = manifestOf(live3);
182480
183057
  const failed3 = async (message) => {
182481
183058
  if (stopping) return;
@@ -183195,7 +183772,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183195
183772
  lintNote: "`himi patch` sends a raw file. Nothing here built or linted your app \u2014 `himi push --only <selector>` is the same edit with the full lint gate in front of it."
183196
183773
  };
183197
183774
  if (kind === "tokens" || kind === "app-config") {
183198
- const body = readFileSync100(file2, "utf8");
183775
+ const body = readFileSync101(file2, "utf8");
183199
183776
  const patch2 = kind === "tokens" ? { tokens: body } : { appConfig: body };
183200
183777
  return runReleasePatch({
183201
183778
  ...common,
@@ -183210,7 +183787,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183210
183787
  io2.error(JSON.stringify({ error: "patch screen needs a <screenId>", usage: PATCH_USAGE }));
183211
183788
  return 2;
183212
183789
  }
183213
- const descriptor = readFileSync100(file2, "utf8");
183790
+ const descriptor = readFileSync101(file2, "utf8");
183214
183791
  try {
183215
183792
  JSON.parse(descriptor);
183216
183793
  } catch (e2) {
@@ -183250,8 +183827,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183250
183827
  extra: { kind, screen: id, file: { path: file2, bytes: Buffer.byteLength(descriptor, "utf8") } }
183251
183828
  });
183252
183829
  }
183253
- const bytes2 = readFileSync100(file2);
183254
- const sha2 = createHash41("sha256").update(bytes2).digest("hex");
183830
+ const bytes2 = readFileSync101(file2);
183831
+ const sha2 = createHash42("sha256").update(bytes2).digest("hex");
183255
183832
  const forScreens = (str9(flags["for-screen"]) ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
183256
183833
  if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
183257
183834
  io2.error(JSON.stringify({ ok: false, error: "no_rebind_takes_no_value", message: "--no-rebind is a switch and takes no value; pass it bare.", usage: PATCH_USAGE }));
@@ -183394,7 +183971,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183394
183971
  }
183395
183972
  let def;
183396
183973
  try {
183397
- const parsed = JSON.parse(arg.startsWith("@") ? readFileSync100(arg.slice(1), "utf8") : arg);
183974
+ const parsed = JSON.parse(arg.startsWith("@") ? readFileSync101(arg.slice(1), "utf8") : arg);
183398
183975
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
183399
183976
  io2.error(JSON.stringify({ error: "invalid_definition", problems: [`--definition must be a JSON object, got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`] }));
183400
183977
  return 2;
@@ -184256,7 +184833,7 @@ ${label2}`);
184256
184833
  const dpxPath = dpxSessionTokenPath();
184257
184834
  let dpx;
184258
184835
  try {
184259
- dpx = readFileSync100(dpxPath, "utf8").trim();
184836
+ dpx = readFileSync101(dpxPath, "utf8").trim();
184260
184837
  } catch {
184261
184838
  io2.error(JSON.stringify({ error: `no dpx session at ${dpxPath} \u2014 run \`dpx auth login\` then \`dpx auth token > ${dpxPath}\` (dpx 2.x keeps its own state in ~/.dpx/auth.json and does NOT write the legacy session file), or omit --dpx` }));
184262
184839
  return 1;
@@ -184719,7 +185296,7 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
184719
185296
  const path2 = dpxSessionTokenPath();
184720
185297
  let raw;
184721
185298
  try {
184722
- raw = readFileSync100(path2, "utf8");
185299
+ raw = readFileSync101(path2, "utf8");
184723
185300
  } catch {
184724
185301
  io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
184725
185302
  return 1;