@wix/himalaya-cli 0.1906.0 → 0.1908.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
@@ -3367,6 +3367,16 @@ function assertAppId(app2, where) {
3367
3367
  }
3368
3368
  return app2;
3369
3369
  }
3370
+ function isMediaArchiveUrl(url, metaSiteId) {
3371
+ if (typeof url !== "string" || typeof metaSiteId !== "string" || !/^[0-9a-f-]{36}$/.test(metaSiteId)) return false;
3372
+ let u2;
3373
+ try {
3374
+ u2 = new URL(url);
3375
+ } catch {
3376
+ return false;
3377
+ }
3378
+ return u2.protocol === "https:" && u2.host === `${metaSiteId}.usrfiles.com` && /^\/archives\/[A-Za-z0-9_.-]+$/.test(u2.pathname) && !u2.search && !u2.hash;
3379
+ }
3370
3380
  var BUNDLE_CACHE_CONTROL, LARGE_ASSET_REDIRECT_MAX_AGE_SEC, ASSET_LOCATION_HEADER, ASSET_LOCATION_CONTENT_TYPE, DOC_CACHE_CONTROL, PINNED_CACHE_CONTROL, APP_ID_RE;
3371
3381
  var init_contract = __esm({
3372
3382
  "../../core/serve-storage/src/contract.ts"() {
@@ -156421,10 +156431,49 @@ var init_widget_identity = __esm({
156421
156431
  }
156422
156432
  });
156423
156433
 
156424
- // ../../core/serve-storage/src/release-patch.ts
156434
+ // ../../core/serve-storage/src/release-payload-hash.ts
156425
156435
  import { createHash as createHash21 } from "node:crypto";
156436
+ function canonical2(value2) {
156437
+ if (value2 === null || typeof value2 !== "object") return JSON.stringify(value2);
156438
+ if (Array.isArray(value2)) return `[${value2.map(canonical2).join(",")}]`;
156439
+ const record6 = value2;
156440
+ return `{${Object.keys(record6).filter((key4) => record6[key4] !== void 0).sort().map((key4) => `${JSON.stringify(key4)}:${canonical2(record6[key4])}`).join(",")}}`;
156441
+ }
156442
+ function releasePayloadHash(payload) {
156443
+ const hash3 = (value2) => createHash21("sha256").update(canonical2(value2)).digest("hex");
156444
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return hash3(payload);
156445
+ const { catalogs: _catalogBytes, ...record6 } = payload;
156446
+ const manifest2 = record6.manifest;
156447
+ if (!manifest2 || typeof manifest2 !== "object" || Array.isArray(manifest2)) return hash3(record6);
156448
+ let manifestRecord = manifest2;
156449
+ const assets = manifestRecord.assets;
156450
+ if (assets && typeof assets === "object" && !Array.isArray(assets)) manifestRecord = { ...manifestRecord, assets: unplacedAssets(assets) };
156451
+ const widgets = manifestRecord.widgets;
156452
+ if (!widgets || typeof widgets !== "object" || Array.isArray(widgets)) return hash3({ ...record6, manifest: manifestRecord });
156453
+ return hash3({ ...record6, manifest: { ...manifestRecord, widgets: stableWidgets(widgets) } });
156454
+ }
156455
+ function unplacedAssets(assets) {
156456
+ const out2 = {};
156457
+ for (const [name, value2] of Object.entries(assets)) {
156458
+ const r3 = value2;
156459
+ if (r3 && typeof r3 === "object" && r3.storage === "media") {
156460
+ const { url: _url, mediaSiteId: _site, ...rest } = r3;
156461
+ out2[name] = { ...rest, storage: "large" };
156462
+ } else out2[name] = value2;
156463
+ }
156464
+ return out2;
156465
+ }
156466
+ var init_release_payload_hash = __esm({
156467
+ "../../core/serve-storage/src/release-payload-hash.ts"() {
156468
+ init_define_HHP_CATALOG();
156469
+ init_widget_identity();
156470
+ }
156471
+ });
156472
+
156473
+ // ../../core/serve-storage/src/release-patch.ts
156474
+ import { createHash as createHash22 } from "node:crypto";
156426
156475
  function sha256hex(b3) {
156427
- return createHash21("sha256").update(b3).digest("hex");
156476
+ return createHash22("sha256").update(b3).digest("hex");
156428
156477
  }
156429
156478
  function stableStringify(value2) {
156430
156479
  if (value2 === null || typeof value2 !== "object") return JSON.stringify(value2);
@@ -156452,6 +156501,9 @@ function manifestContent(m2) {
156452
156501
  function releaseContentId(m2) {
156453
156502
  const content = manifestContent(m2);
156454
156503
  delete content.appSourceHash;
156504
+ if (content.assets && typeof content.assets === "object" && !Array.isArray(content.assets)) {
156505
+ content.assets = unplacedAssets(content.assets);
156506
+ }
156455
156507
  const widgets = content.widgets;
156456
156508
  if (widgets && typeof widgets === "object" && !Array.isArray(widgets)) content.widgets = stableWidgets(widgets);
156457
156509
  return sha256hex(stableStringify(content));
@@ -156460,6 +156512,7 @@ var init_release_patch = __esm({
156460
156512
  "../../core/serve-storage/src/release-patch.ts"() {
156461
156513
  init_define_HHP_CATALOG();
156462
156514
  init_widget_identity();
156515
+ init_release_payload_hash();
156463
156516
  init_wip_pointer();
156464
156517
  }
156465
156518
  });
@@ -160774,11 +160827,11 @@ var init_dependencies2 = __esm({
160774
160827
  });
160775
160828
 
160776
160829
  // ../../core/functions-build/src/sbom.ts
160777
- import { createHash as createHash22 } from "node:crypto";
160830
+ import { createHash as createHash23 } from "node:crypto";
160778
160831
  function createFunctionSbom(packages) {
160779
160832
  const components2 = [...packages].sort((a3, b3) => a3.name.localeCompare(b3.name)).map(({ name, version: version5, integrity: integrity2, license }) => ({ name, version: version5, integrity: integrity2, license }));
160780
160833
  const body = JSON.stringify({ format: "himalaya-sbom-v1", components: components2 });
160781
- return { format: "himalaya-sbom-v1", components: components2, hash: createHash22("sha256").update(body).digest("hex") };
160834
+ return { format: "himalaya-sbom-v1", components: components2, hash: createHash23("sha256").update(body).digest("hex") };
160782
160835
  }
160783
160836
  var init_sbom = __esm({
160784
160837
  "../../core/functions-build/src/sbom.ts"() {
@@ -160787,12 +160840,12 @@ var init_sbom = __esm({
160787
160840
  });
160788
160841
 
160789
160842
  // ../../core/functions-build/src/build.ts
160790
- import { createHash as createHash23 } from "node:crypto";
160843
+ import { createHash as createHash24 } from "node:crypto";
160791
160844
  function sha2562(value2) {
160792
- return createHash23("sha256").update(value2).digest("hex");
160845
+ return createHash24("sha256").update(value2).digest("hex");
160793
160846
  }
160794
160847
  function sri(value2) {
160795
- return `sha256-${createHash23("sha256").update(value2).digest("base64")}`;
160848
+ return `sha256-${createHash24("sha256").update(value2).digest("base64")}`;
160796
160849
  }
160797
160850
  function schemaHash(schema2) {
160798
160851
  if (!schema2) return "";
@@ -161066,7 +161119,7 @@ __export(build_exports2, {
161066
161119
  withStoreNavBundle: () => withStoreNavBundle,
161067
161120
  withoutDevOnlyAppConfig: () => withoutDevOnlyAppConfig
161068
161121
  });
161069
- import { createHash as createHash24 } from "node:crypto";
161122
+ import { createHash as createHash25 } from "node:crypto";
161070
161123
  import { readFileSync as readFileSync46, readdirSync as readdirSync26, existsSync as existsSync43, realpathSync as realpathSync6 } from "node:fs";
161071
161124
  import { dirname as dirname28, join as join38, resolve as resolve36, sep as sep13 } from "node:path";
161072
161125
  import { fileURLToPath as fileURLToPath27 } from "node:url";
@@ -161235,10 +161288,10 @@ function servesMessages(text32) {
161235
161288
  }
161236
161289
  }
161237
161290
  function sha2563(buf) {
161238
- return createHash24("sha256").update(buf).digest("hex");
161291
+ return createHash25("sha256").update(buf).digest("hex");
161239
161292
  }
161240
161293
  function sri2(buf) {
161241
- return "sha256-" + createHash24("sha256").update(buf).digest("base64");
161294
+ return "sha256-" + createHash25("sha256").update(buf).digest("base64");
161242
161295
  }
161243
161296
  async function widgetFailureDetail(res) {
161244
161297
  try {
@@ -162875,11 +162928,13 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
162875
162928
  const a3 = config.auth;
162876
162929
  const cid = a3?.config?.clientId;
162877
162930
  const siteUrl = a3?.config?.siteUrl;
162931
+ const siteId = a3?.config?.siteId;
162878
162932
  const oneAppMetaSiteId = oneAppMetaSiteIdOf(a3);
162879
162933
  return {
162880
162934
  ...a3?.providerId ? { providerId: a3.providerId } : {},
162881
162935
  ...typeof cid === "string" && cid ? { clientId: cid } : {},
162882
162936
  ...typeof siteUrl === "string" && siteUrl ? { siteUrl } : {},
162937
+ ...typeof siteId === "string" && siteId ? { siteId } : {},
162883
162938
  ...oneAppMetaSiteId ? { oneAppMetaSiteId } : {}
162884
162939
  };
162885
162940
  })()
@@ -164152,7 +164207,7 @@ __export(studio_exports, {
164152
164207
  renderStudioHtml: () => renderStudioHtml,
164153
164208
  writeStudioRecord: () => writeStudioRecord
164154
164209
  });
164155
- import { createHash as createHash25 } from "node:crypto";
164210
+ import { createHash as createHash26 } from "node:crypto";
164156
164211
  import { existsSync as existsSync46, readdirSync as readdirSync28, readFileSync as readFileSync49, realpathSync as realpathSync7, statSync as statSync11 } from "node:fs";
164157
164212
  import { basename as basename12, extname as extname3, join as join41, relative as relative11, resolve as resolve37, sep as sep14 } from "node:path";
164158
164213
  import { pathToFileURL as pathToFileURL6 } from "node:url";
@@ -164434,7 +164489,7 @@ function buildView(dir, memory2, now) {
164434
164489
  reveal: memory2.reveal ?? null
164435
164490
  };
164436
164491
  const { generatedAt: _ignored, timelineFrames: _count, ...stable } = view;
164437
- const v2 = createHash25("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
164492
+ const v2 = createHash26("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
164438
164493
  return { v: v2, ...view };
164439
164494
  }
164440
164495
  function writeAtomic(file2, content) {
@@ -165518,6 +165573,12 @@ var init_cli_help = __esm({
165518
165573
  --account-id: which account owns the app, when your Wix session
165519
165574
  resolves to several. The first-push auto-claim cannot guess;
165520
165575
  without it a multi-account caller is told to name one.
165576
+ --media-site <msid>: put assets over the inline cap (a game pack,
165577
+ up to 512 MB) in that Wix site's Media Manager as public files,
165578
+ instead of the plane's large asset channel. Without the flag,
165579
+ only when the plane has nowhere to keep one: then the site the
165580
+ app's Wix login names (auth siteId). Needs a Wix sign-in that
165581
+ manages that site; a re-push of the same bytes reuses the file.
165521
165582
  --no-source: do NOT archive the content package with the release.
165522
165583
  On by default, so himi pull can restore an editable copy.
165523
165584
  Never archives .himi/, .env*, node_modules/, dist/, the
@@ -166912,7 +166973,7 @@ __export(wix_owner_exports, {
166912
166973
  wixCliOnPath: () => wixCliOnPath
166913
166974
  });
166914
166975
  import { spawn as spawn3 } from "node:child_process";
166915
- import { createHash as createHash26 } from "node:crypto";
166976
+ import { createHash as createHash27 } from "node:crypto";
166916
166977
  import { accessSync as accessSync2, constants as fsConstants, statSync as statSync13 } from "node:fs";
166917
166978
  import { delimiter, join as join44 } from "node:path";
166918
166979
  function resolveSiteId(flag3) {
@@ -166937,7 +166998,7 @@ async function siteToken(msid, spawnImpl = spawn3, fetchImpl = fetch) {
166937
166998
  return await mintToken(["token", "--site", msid], `wix token --site ${msid}`, msid, spawnImpl);
166938
166999
  }
166939
167000
  function subjectFingerprint(subject) {
166940
- return createHash26("sha256").update(subject).digest("hex").slice(0, 16);
167001
+ return createHash27("sha256").update(subject).digest("hex").slice(0, 16);
166941
167002
  }
166942
167003
  async function exchangeSiteToken(subject, msid, opts = {}) {
166943
167004
  const now = opts.now ?? Date.now;
@@ -174294,7 +174355,7 @@ var init_fxp = __esm({
174294
174355
  });
174295
174356
 
174296
174357
  // ../../packages/serve/src/pkcs12.ts
174297
- import { X509Certificate, createHash as createHash27, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
174358
+ import { X509Certificate, createHash as createHash28, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
174298
174359
  function decodePkcs12(der, password) {
174299
174360
  try {
174300
174361
  const pfx = readSequence(der, 0);
@@ -174568,7 +174629,7 @@ function expand(src, v2) {
174568
174629
  return out2;
174569
174630
  }
174570
174631
  function sha12(data) {
174571
- return createHash27("sha1").update(data).digest();
174632
+ return createHash28("sha1").update(data).digest();
174572
174633
  }
174573
174634
  function readAt(buf, i2) {
174574
174635
  if (i2 >= buf.length) return void 0;
@@ -174658,7 +174719,7 @@ var init_pkcs12 = __esm({
174658
174719
  });
174659
174720
 
174660
174721
  // ../../packages/serve/src/customer-signing-assets.ts
174661
- import { createHash as createHash28 } from "node:crypto";
174722
+ import { createHash as createHash29 } from "node:crypto";
174662
174723
  function readValue(node4) {
174663
174724
  const [tag, children2] = Object.entries(node4)[0] ?? [];
174664
174725
  if (!tag || !Array.isArray(children2)) return refuse2("customer_profile_invalid");
@@ -174736,7 +174797,7 @@ function toBundle(assets, expected, decoded2, profileType, apns, deviceCount) {
174736
174797
  provisioningProfile: Buffer.from(assets.provisioningProfile).toString("base64"),
174737
174798
  profileSha256: sha2564(assets.provisioningProfile),
174738
174799
  certificateSha256: sha2564(decoded2.cert.raw),
174739
- certificateSha1: createHash28("sha1").update(decoded2.cert.raw).digest("hex").toUpperCase(),
174800
+ certificateSha1: createHash29("sha1").update(decoded2.cert.raw).digest("hex").toUpperCase(),
174740
174801
  expiresAt: new Date(Math.min(decoded2.expiration, Date.parse(decoded2.cert.validTo))).toISOString(),
174741
174802
  ...apns ? { apnsEnvironment: apns } : {},
174742
174803
  deviceCount
@@ -174788,7 +174849,7 @@ var init_customer_signing_assets = __esm({
174788
174849
  init_fxp();
174789
174850
  init_pkcs12();
174790
174851
  init_customer_dist_signing();
174791
- sha2564 = (bytes2) => createHash28("sha256").update(bytes2).digest("hex");
174852
+ sha2564 = (bytes2) => createHash29("sha256").update(bytes2).digest("hex");
174792
174853
  refuse2 = (code3) => {
174793
174854
  throw new CustomerSigningError(code3);
174794
174855
  };
@@ -179167,7 +179228,7 @@ __export(icon_exports, {
179167
179228
  summarize: () => summarize3,
179168
179229
  writePreparedIcon: () => writePreparedIcon
179169
179230
  });
179170
- import { createHash as createHash29 } from "node:crypto";
179231
+ import { createHash as createHash30 } from "node:crypto";
179171
179232
  import { accessSync as accessSync3, constants as constants4, existsSync as existsSync57, mkdirSync as mkdirSync28, readFileSync as readFileSync61, statSync as statSync18, writeFileSync as writeFileSync24 } from "node:fs";
179172
179233
  import { basename as basename15, dirname as dirname35, join as join49, resolve as resolve45, sep as sep16 } from "node:path";
179173
179234
  function readManifest(dir) {
@@ -179256,7 +179317,7 @@ async function iconStatus(dir) {
179256
179317
  ...base2,
179257
179318
  templateIcon: templateIconMatch(png),
179258
179319
  bytes: png.length,
179259
- sha256: createHash29("sha256").update(png).digest("hex"),
179320
+ sha256: createHash30("sha256").update(png).digest("hex"),
179260
179321
  header: pngHeader(png),
179261
179322
  byteIssues
179262
179323
  };
@@ -181013,8 +181074,8 @@ function renderBookMarkdown(book) {
181013
181074
  lines2.push(`theme: null`);
181014
181075
  }
181015
181076
  const shots = look.pages.filter((p2) => p2.screenshotLocal);
181016
- const usable = shots.filter((p2) => !looksGated(p2));
181017
- if (usable.length) {
181077
+ const usable2 = shots.filter((p2) => !looksGated(p2));
181078
+ if (usable2.length) {
181018
181079
  lines2.push(`OPEN the screenshots below before choosing tokens \u2014 judge character, then map.`);
181019
181080
  } else if (shots.length) {
181020
181081
  lines2.push(`DO NOT judge the look from these screenshots \u2014 every crawled page is an auth wall,`);
@@ -182667,9 +182728,9 @@ function base44HostSuffix(origin) {
182667
182728
  return suffix && label4.includes("-") && /^[0-9a-f]{8}$/.test(suffix) ? suffix : void 0;
182668
182729
  }
182669
182730
  function iconUrls(icons) {
182670
- const usable = icons.filter((i2) => !/svg/i.test(i2.type ?? "") && !/\.svg(\?|$)/i.test(i2.url));
182731
+ const usable2 = icons.filter((i2) => !/svg/i.test(i2.type ?? "") && !/\.svg(\?|$)/i.test(i2.url));
182671
182732
  const rank = (i2) => i2.source === "manifest" ? 2 : i2.source === "apple-touch-icon" ? 1 : 0;
182672
- const sorted3 = [...usable].sort((a3, b3) => rank(b3) - rank(a3) || b3.size - a3.size);
182733
+ const sorted3 = [...usable2].sort((a3, b3) => rank(b3) - rank(a3) || b3.size - a3.size);
182673
182734
  const out2 = [];
182674
182735
  const taken2 = /* @__PURE__ */ new Map();
182675
182736
  for (const icon of sorted3) {
@@ -183955,7 +184016,7 @@ __export(pack_exports, {
183955
184016
  unpackTo: () => unpackTo,
183956
184017
  writeZip: () => writeZip
183957
184018
  });
183958
- import { createHash as createHash30 } from "node:crypto";
184019
+ import { createHash as createHash31 } from "node:crypto";
183959
184020
  import { deflateRawSync, inflateRawSync } from "node:zlib";
183960
184021
  import { existsSync as existsSync62, mkdirSync as mkdirSync31, readFileSync as readFileSync66, readdirSync as readdirSync32, rmSync as rmSync18, statSync as statSync19, writeFileSync as writeFileSync27 } from "node:fs";
183961
184022
  import { dirname as dirname38, join as join55, resolve as resolve47 } from "node:path";
@@ -184105,11 +184166,11 @@ function gatherReleaseEntries(appDir3) {
184105
184166
  return { entries, manifest: manifest2, skipped };
184106
184167
  }
184107
184168
  function sha256Hex4(bytes2) {
184108
- return createHash30("sha256").update(bytes2).digest("hex");
184169
+ return createHash31("sha256").update(bytes2).digest("hex");
184109
184170
  }
184110
184171
  function computeContentHash(entries) {
184111
184172
  const input = packageHashInput(entries.map((e2) => ({ path: e2.path, hash: sha256Hex4(e2.bytes) })));
184112
- return "sha256-" + createHash30("sha256").update(input).digest("base64");
184173
+ return "sha256-" + createHash31("sha256").update(input).digest("base64");
184113
184174
  }
184114
184175
  function buildEntries(appDir3, app2, opts) {
184115
184176
  const { entries: released, manifest: manifest2, skipped } = gatherReleaseEntries(appDir3);
@@ -184302,7 +184363,7 @@ __export(app_source_exports, {
184302
184363
  writeConflicts: () => writeConflicts,
184303
184364
  zipAppSource: () => zipAppSource
184304
184365
  });
184305
- import { createHash as createHash31 } from "node:crypto";
184366
+ import { createHash as createHash32 } from "node:crypto";
184306
184367
  import { readdirSync as readdirSync33, lstatSync as lstatSync20, readFileSync as readFileSync67, mkdirSync as mkdirSync32, writeFileSync as writeFileSync28, existsSync as existsSync63, rmSync as rmSync19, rmdirSync as rmdirSync3, unlinkSync as unlinkSync3 } from "node:fs";
184307
184368
  import { join as join56, resolve as resolve48, sep as sep18 } from "node:path";
184308
184369
  import { createRequire as createRequire5 } from "node:module";
@@ -184423,13 +184484,13 @@ function sourceFingerprint(dir) {
184423
184484
  dir,
184424
184485
  (archivePath, hostRel) => {
184425
184486
  if (/\.md$/i.test(archivePath)) return;
184426
- files.push(`${archivePath}\0${createHash31("sha256").update(readFileSync67(join56(dir, hostRel))).digest("hex")}`);
184487
+ files.push(`${archivePath}\0${createHash32("sha256").update(readFileSync67(join56(dir, hostRel))).digest("hex")}`);
184427
184488
  },
184428
184489
  () => {
184429
184490
  }
184430
184491
  );
184431
184492
  files.sort();
184432
- return createHash31("sha256").update(files.join("\n")).digest("hex");
184493
+ return createHash32("sha256").update(files.join("\n")).digest("hex");
184433
184494
  }
184434
184495
  function largestEntries(entries, limit = 5) {
184435
184496
  return entries.map((e2) => ({
@@ -184926,7 +184987,7 @@ __export(screen_state_exports, {
184926
184987
  shotStateFor: () => shotStateFor,
184927
184988
  withHomeCaveat: () => withHomeCaveat
184928
184989
  });
184929
- import { createHash as createHash32 } from "node:crypto";
184990
+ import { createHash as createHash33 } from "node:crypto";
184930
184991
  import { lstatSync as lstatSync22, readFileSync as readFileSync69 } from "node:fs";
184931
184992
  import { join as join58 } from "node:path";
184932
184993
  function quotableLine(text32) {
@@ -185047,7 +185108,7 @@ var init_screen_state = __esm({
185047
185108
  KEEP = 40;
185048
185109
  LINE_MAX = 120;
185049
185110
  str6 = (v2) => typeof v2 === "string" && v2.trim() ? v2 : void 0;
185050
- sha256Of = (file2) => createHash32("sha256").update(readFileSync69(file2)).digest("hex");
185111
+ sha256Of = (file2) => createHash33("sha256").update(readFileSync69(file2)).digest("hex");
185051
185112
  }
185052
185113
  });
185053
185114
 
@@ -185062,7 +185123,7 @@ __export(studio_reel_exports, {
185062
185123
  thin: () => thin,
185063
185124
  utcDay: () => utcDay
185064
185125
  });
185065
- import { createHash as createHash33 } from "node:crypto";
185126
+ import { createHash as createHash34 } from "node:crypto";
185066
185127
  import { lstatSync as lstatSync23, readFileSync as readFileSync70 } from "node:fs";
185067
185128
  import { basename as basename17, join as join59 } from "node:path";
185068
185129
  function loadMemory2(dir) {
@@ -185151,7 +185212,7 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
185151
185212
  const st2 = lstatSync23(path2);
185152
185213
  if (!st2.isFile() || st2.nlink !== 1) return null;
185153
185214
  const bytes2 = readFileSync70(path2);
185154
- return createHash33("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
185215
+ return createHash34("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
185155
185216
  } catch {
185156
185217
  return null;
185157
185218
  }
@@ -185379,7 +185440,7 @@ __export(milestones_exports, {
185379
185440
  watchUrlFor: () => watchUrlFor,
185380
185441
  writeHandoverReel: () => writeHandoverReel
185381
185442
  });
185382
- import { createHash as createHash34, randomUUID as randomUUID10 } from "node:crypto";
185443
+ import { createHash as createHash35, randomUUID as randomUUID10 } from "node:crypto";
185383
185444
  import { spawn as spawn4 } from "node:child_process";
185384
185445
  import { closeSync as closeSync6, existsSync as existsSync65, lstatSync as lstatSync24, readFileSync as readFileSync72, statSync as statSync21 } from "node:fs";
185385
185446
  import { createServer as createServer3 } from "node:net";
@@ -186083,7 +186144,7 @@ var init_milestones = __esm({
186083
186144
  INIT_SOURCE_FILE = join61(".himi", "init-source.json");
186084
186145
  STARTING_POINT_REF = "starting-point";
186085
186146
  TEMPLATE_NAME2 = /^[A-Za-z0-9._-]{1,64}$/;
186086
- sha256Of2 = (file2) => createHash34("sha256").update(readFileSync72(file2)).digest("hex");
186147
+ sha256Of2 = (file2) => createHash35("sha256").update(readFileSync72(file2)).digest("hex");
186087
186148
  WATCH_REMINDER_EVERY_MS = 10 * 60 * 1e3;
186088
186149
  REMINDERS_FILE = join61(".himi", "reminders.json");
186089
186150
  pidAlive = (pid) => {
@@ -186505,7 +186566,7 @@ async function loadReleaseFromDir(app2, dir) {
186505
186566
  let assets;
186506
186567
  if (store.getAsset) {
186507
186568
  for (const rec of Object.values(manifest2.assets ?? {})) {
186508
- if (!rec?.sha256 || assets?.[rec.sha256] || rec.storage === "large") continue;
186569
+ if (!rec?.sha256 || assets?.[rec.sha256] || rec.storage === "large" || rec.storage === "media") continue;
186509
186570
  const b3 = await store.getAsset(app2, rec.sha256);
186510
186571
  if (b3) (assets ??= {})[rec.sha256] = asBuffer(b3).toString("base64");
186511
186572
  }
@@ -188585,7 +188646,7 @@ var init_social_sign_in = __esm({
188585
188646
 
188586
188647
  // ../app-icons/plan.ts
188587
188648
  import { existsSync as existsSync73, readFileSync as readFileSync80, readdirSync as readdirSync37 } from "node:fs";
188588
- import { createHash as createHash35 } from "node:crypto";
188649
+ import { createHash as createHash36 } from "node:crypto";
188589
188650
  import { inflateSync } from "node:zlib";
188590
188651
  import { dirname as dirname41, join as join71, resolve as resolve52 } from "node:path";
188591
188652
  function stripComments(src) {
@@ -188673,7 +188734,7 @@ function parseIconConfig(configTs) {
188673
188734
  return out2;
188674
188735
  }
188675
188736
  function idHash(id) {
188676
- return createHash35("sha1").update(id).digest();
188737
+ return createHash36("sha1").update(id).digest();
188677
188738
  }
188678
188739
  function deriveGlyph(id) {
188679
188740
  const h2 = idHash(id);
@@ -188857,7 +188918,7 @@ function placeholderHashes() {
188857
188918
  }
188858
188919
  function fileSha256(path2) {
188859
188920
  try {
188860
- return createHash35("sha256").update(readFileSync80(path2)).digest("hex");
188921
+ return createHash36("sha256").update(readFileSync80(path2)).digest("hex");
188861
188922
  } catch {
188862
188923
  return null;
188863
188924
  }
@@ -197208,14 +197269,14 @@ function renderBase44Types(entities, app2) {
197208
197269
  const names2 = exportNames(candidates, app2);
197209
197270
  const exportName = (e2) => names2.get(e2);
197210
197271
  const sortKey = (e2) => `${exportName(e2)}\0${physicalEntityName(e2, app2)}`;
197211
- const usable = [...candidates].sort((a3, b3) => sortKey(a3) < sortKey(b3) ? -1 : sortKey(a3) > sortKey(b3) ? 1 : 0);
197272
+ const usable2 = [...candidates].sort((a3, b3) => sortKey(a3) < sortKey(b3) ? -1 : sortKey(a3) > sortKey(b3) ? 1 : 0);
197212
197273
  const L2 = [
197213
197274
  BASE44_TYPES_HEADER,
197214
197275
  "// Source: the base44.entities block in config.ts. Re-run `himi base44 types` after editing it;",
197215
197276
  "// `himi validate` reports base44-types-stale until you do."
197216
197277
  ];
197217
197278
  const body = [];
197218
- for (const e2 of usable) {
197279
+ for (const e2 of usable2) {
197219
197280
  const name = exportName(e2);
197220
197281
  const required3 = new Set(Array.isArray(e2.required) ? e2.required : []);
197221
197282
  const builtins = new Set(BASE44_BUILTIN_FIELDS);
@@ -197227,7 +197288,7 @@ function renderBase44Types(entities, app2) {
197227
197288
  }
197228
197289
  const text32 = body.join("\n");
197229
197290
  const types2 = ["Json", "JsonObject"].filter((t2) => new RegExp(`\\b${t2}\\b`).test(text32)).map((t2) => `type ${t2}`);
197230
- if (usable.length) L2.push(`import { ${["entities", ...types2].join(", ")} } from "@himalaya/base44";`);
197291
+ if (usable2.length) L2.push(`import { ${["entities", ...types2].join(", ")} } from "@himalaya/base44";`);
197231
197292
  return [...L2, ...body].join("\n") + "\n";
197232
197293
  }
197233
197294
  async function declaredEntities(dir) {
@@ -197504,11 +197565,11 @@ __export(account_screens_lint_exports, {
197504
197565
  reachableScreens: () => reachableScreens,
197505
197566
  staticNavTargets: () => staticNavTargets
197506
197567
  });
197507
- import { createHash as createHash36 } from "node:crypto";
197568
+ import { createHash as createHash37 } from "node:crypto";
197508
197569
  import ts19 from "typescript";
197509
197570
  function memberSignInIn(bundleJs) {
197510
197571
  if (![...MEMBER_SIGN_IN_VERBS, `.wix.${HOSTED_SIGN_IN_VERB}`, WIX_PLATFORM_SIGN_IN_ID].some((v2) => bundleJs.includes(v2)) && !AUTH_SIGN_IN_GATE.test(bundleJs)) return null;
197511
- const key4 = createHash36("sha1").update(bundleJs).digest("hex");
197572
+ const key4 = createHash37("sha1").update(bundleJs).digest("hex");
197512
197573
  const cached3 = PARSED.get(key4);
197513
197574
  if (cached3 !== void 0) return cached3;
197514
197575
  const found = parseMemberSignIn(bundleJs);
@@ -197753,7 +197814,7 @@ var init_account_screens_lint = __esm({
197753
197814
 
197754
197815
  // src/commands/template.ts
197755
197816
  import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync92, existsSync as existsSync84, rmSync as rmSync24 } from "node:fs";
197756
- import { createHash as createHash37 } from "node:crypto";
197817
+ import { createHash as createHash38 } from "node:crypto";
197757
197818
  import { tmpdir as tmpdir6 } from "node:os";
197758
197819
  import { join as join82, resolve as resolve57, basename as basename22 } from "node:path";
197759
197820
  function embeddedTemplateCatalog() {
@@ -198155,7 +198216,7 @@ async function templateCommand(ctx) {
198155
198216
  if (!iconPath) return void 0;
198156
198217
  try {
198157
198218
  const bytes2 = readFileSync92(iconPath);
198158
- return { bytes: bytes2, hash: createHash37("sha256").update(bytes2).digest("hex") };
198219
+ return { bytes: bytes2, hash: createHash38("sha256").update(bytes2).digest("hex") };
198159
198220
  } catch {
198160
198221
  return void 0;
198161
198222
  }
@@ -198166,7 +198227,7 @@ async function templateCommand(ctx) {
198166
198227
  template: name,
198167
198228
  app: templateAppId,
198168
198229
  published: false,
198169
- sourceHash: createHash37("sha256").update(JSON.stringify(catalogView())).digest("hex"),
198230
+ sourceHash: createHash38("sha256").update(JSON.stringify(catalogView())).digest("hex"),
198170
198231
  iconHash: launcherIcon()?.hash ?? null
198171
198232
  });
198172
198233
  return 0;
@@ -199960,7 +200021,7 @@ var init_policy = __esm({
199960
200021
 
199961
200022
  // ../pre-pr-review/scope.mjs
199962
200023
  import { execFileSync as execFileSync6 } from "node:child_process";
199963
- import { createHash as createHash38 } from "node:crypto";
200024
+ import { createHash as createHash39 } from "node:crypto";
199964
200025
  import { resolve as resolve62, dirname as dirname51, isAbsolute as isAbsolute10, join as join88 } from "node:path";
199965
200026
  import { fileURLToPath as fileURLToPath32 } from "node:url";
199966
200027
  function resolveRepoRoot2(cwd = process.cwd()) {
@@ -199988,7 +200049,7 @@ function git(args, opts = {}) {
199988
200049
  }).toString();
199989
200050
  }
199990
200051
  function diffHash(diff) {
199991
- return createHash38("sha256").update(diff).digest("hex");
200052
+ return createHash39("sha256").update(diff).digest("hex");
199992
200053
  }
199993
200054
  var REPO_ROOT7, BASE_REF;
199994
200055
  var init_scope = __esm({
@@ -200014,7 +200075,7 @@ import {
200014
200075
  rmSync as rmSync25,
200015
200076
  writeFileSync as writeFileSync38
200016
200077
  } from "node:fs";
200017
- import { createHash as createHash39 } from "node:crypto";
200078
+ import { createHash as createHash40 } from "node:crypto";
200018
200079
  import { tmpdir as tmpdir7 } from "node:os";
200019
200080
  import { basename as basename23, dirname as dirname52, join as join89, resolve as resolve63 } from "node:path";
200020
200081
  import { pathToFileURL as pathToFileURL7 } from "node:url";
@@ -200092,7 +200153,7 @@ function stagedIdentity(head2, index, worktree) {
200092
200153
  }
200093
200154
  function blobOid(contents, algorithm2) {
200094
200155
  const body = Buffer.isBuffer(contents) ? contents : Buffer.from(contents);
200095
- return createHash39(algorithm2).update(Buffer.from(`blob ${body.byteLength}\0`)).update(body).digest("hex");
200156
+ return createHash40(algorithm2).update(Buffer.from(`blob ${body.byteLength}\0`)).update(body).digest("hex");
200096
200157
  }
200097
200158
  function validationDiffHash(cwd = process.cwd()) {
200098
200159
  const root = resolveRepoRoot2(cwd);
@@ -200266,7 +200327,7 @@ var init_diff_hash = __esm({
200266
200327
  run: () => {
200267
200328
  const { repo } = selfTestRepo({ withBase: true });
200268
200329
  try {
200269
- return validationDiffHash(repo) !== createHash39("sha256").update("validation-worktree-v2\0").digest("hex");
200330
+ return validationDiffHash(repo) !== createHash40("sha256").update("validation-worktree-v2\0").digest("hex");
200270
200331
  } finally {
200271
200332
  rmSync25(repo, { recursive: true, force: true });
200272
200333
  }
@@ -200448,32 +200509,6 @@ var init_attestation_lock = __esm({
200448
200509
  }
200449
200510
  });
200450
200511
 
200451
- // ../../core/serve-storage/src/release-payload-hash.ts
200452
- import { createHash as createHash40 } from "node:crypto";
200453
- function canonical2(value2) {
200454
- if (value2 === null || typeof value2 !== "object") return JSON.stringify(value2);
200455
- if (Array.isArray(value2)) return `[${value2.map(canonical2).join(",")}]`;
200456
- const record6 = value2;
200457
- return `{${Object.keys(record6).filter((key4) => record6[key4] !== void 0).sort().map((key4) => `${JSON.stringify(key4)}:${canonical2(record6[key4])}`).join(",")}}`;
200458
- }
200459
- function releasePayloadHash(payload) {
200460
- const hash3 = (value2) => createHash40("sha256").update(canonical2(value2)).digest("hex");
200461
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) return hash3(payload);
200462
- const { catalogs: _catalogBytes, ...record6 } = payload;
200463
- const manifest2 = record6.manifest;
200464
- if (!manifest2 || typeof manifest2 !== "object" || Array.isArray(manifest2)) return hash3(record6);
200465
- const manifestRecord = manifest2;
200466
- const widgets = manifestRecord.widgets;
200467
- if (!widgets || typeof widgets !== "object" || Array.isArray(widgets)) return hash3(record6);
200468
- return hash3({ ...record6, manifest: { ...manifestRecord, widgets: stableWidgets(widgets) } });
200469
- }
200470
- var init_release_payload_hash = __esm({
200471
- "../../core/serve-storage/src/release-payload-hash.ts"() {
200472
- init_define_HHP_CATALOG();
200473
- init_widget_identity();
200474
- }
200475
- });
200476
-
200477
200512
  // src/attestation.ts
200478
200513
  import { execFileSync as execFileSync7 } from "node:child_process";
200479
200514
  import { createHash as createHash41, randomBytes as randomBytes3 } from "node:crypto";
@@ -226108,9 +226143,9 @@ async function recordJob(record6, job, opts) {
226108
226143
  for (const path2 of removed)
226109
226144
  out2.warnings.push(`left ${path2} out of the record: it looks like a secret`);
226110
226145
  const raw = job.result?.ids ?? [];
226111
- const usable = (id) => typeof id === "string" && !hasSecretShape(id);
226112
- const ids2 = raw.filter(usable);
226113
- const idAt = (i2) => usable(raw[i2]) ? raw[i2] : void 0;
226146
+ const usable2 = (id) => typeof id === "string" && !hasSecretShape(id);
226147
+ const ids2 = raw.filter(usable2);
226148
+ const idAt = (i2) => usable2(raw[i2]) ? raw[i2] : void 0;
226114
226149
  const p2 = Object.fromEntries(Object.entries(params).filter(([k3]) => !APPROVAL_KEYS.includes(k3)));
226115
226150
  const c2 = { record: record6, app: app2, job, p: p2, ids: ids2, idAt, at: at2, warnings: out2.warnings };
226116
226151
  let complete = true;
@@ -235366,7 +235401,7 @@ var init_media_sets = __esm({
235366
235401
  return pollUntil(() => this.asset(id), done, { clock: this.clock, intervalMs: mediaPollInterval(1, this.pollMs), nextIntervalMs: () => mediaPollInterval(++checks + 1, this.pollMs), timeoutMs, what });
235367
235402
  }
235368
235403
  async plan(versionId, spec) {
235369
- const { sets: setPath, typeAttr, perSet, usable } = this.kind;
235404
+ const { sets: setPath, typeAttr, perSet, usable: usable2 } = this.kind;
235370
235405
  const changes = [];
235371
235406
  const locs = flatList((await this.t.list(`/v1/appStoreVersions/${encodeURIComponent(versionId)}/appStoreVersionLocalizations`)).data);
235372
235407
  for (const [locale, sets] of Object.entries(spec)) {
@@ -235383,7 +235418,7 @@ var init_media_sets = __esm({
235383
235418
  const kept = [];
235384
235419
  const deletes = [];
235385
235420
  for (const shot of shots) {
235386
- const keep = shot.sourceFileChecksum && wanted.has(shot.sourceFileChecksum) && !kept.includes(shot.sourceFileChecksum) && usable(shot);
235421
+ const keep = shot.sourceFileChecksum && wanted.has(shot.sourceFileChecksum) && !kept.includes(shot.sourceFileChecksum) && usable2(shot);
235387
235422
  const change2 = { op: keep ? "keep" : "delete", locale, displayType, fileName: shot.fileName, checksum: shot.sourceFileChecksum, id: shot.id, localizationId: loc.id, setId: set3.id };
235388
235423
  changes.push(change2);
235389
235424
  if (keep)
@@ -242549,7 +242584,7 @@ async function screenshotWrites(c2, refs, version5) {
242549
242584
  if (!segment(displayType) || !Array.isArray(files))
242550
242585
  continue;
242551
242586
  const images = [];
242552
- let usable = true;
242587
+ let usable2 = true;
242553
242588
  for (const f2 of files) {
242554
242589
  const name = f2.fileName ?? (f2.path ? basename30(f2.path) : "?");
242555
242590
  let bytes2;
@@ -242559,24 +242594,24 @@ async function screenshotWrites(c2, refs, version5) {
242559
242594
  bytes2 = new Uint8Array(await readFile19(f2.path));
242560
242595
  } catch (e2) {
242561
242596
  c2.warnings.push(`${locale} ${displayType}: could not read ${name} to record it (${message4(e2)}), so that set was left out of the record`);
242562
- usable = false;
242597
+ usable2 = false;
242563
242598
  break;
242564
242599
  }
242565
242600
  const md53 = md5Hex(bytes2);
242566
242601
  if (f2.md5 && md53 !== f2.md5.toLowerCase()) {
242567
242602
  c2.warnings.push(`${locale} ${displayType}: ${name} changed after the job (md5 differs), so that set was left out of the record`);
242568
- usable = false;
242603
+ usable2 = false;
242569
242604
  break;
242570
242605
  }
242571
242606
  if (!sniffType(bytes2)) {
242572
242607
  c2.warnings.push(`${locale} ${displayType}: ${name} is not a PNG, JPEG or WebP, so that set was left out of the record`);
242573
- usable = false;
242608
+ usable2 = false;
242574
242609
  break;
242575
242610
  }
242576
242611
  const ref = await c2.record.putBlob(bytes2, sniffType(bytes2));
242577
242612
  images.push({ ...ref, md5: md53, fileName: name });
242578
242613
  }
242579
- if (usable)
242614
+ if (usable2)
242580
242615
  writes.push({ path: APPLE.screenshots(version5, locale, displayType), schema: "apple.screenshots@1", older: REPLACE2, update: replace2({ locale, displayType, images }) });
242581
242616
  }
242582
242617
  }
@@ -242956,9 +242991,9 @@ async function recordAppleJob(record6, job, opts = {}) {
242956
242991
  if (!/^params\.\w*PasswordEnv$/.test(path2))
242957
242992
  out2.warnings.push(`left ${path2} out of the record: it looks like a secret`);
242958
242993
  const raw = job.result?.ids ?? [];
242959
- const usable = (id) => typeof id === "string" && id !== "" && !hasSecretShape(id);
242960
- const ids2 = raw.filter(usable);
242961
- const idAt = (i2) => usable(raw[i2]) ? raw[i2] : void 0;
242994
+ const usable2 = (id) => typeof id === "string" && id !== "" && !hasSecretShape(id);
242995
+ const ids2 = raw.filter(usable2);
242996
+ const idAt = (i2) => usable2(raw[i2]) ? raw[i2] : void 0;
242962
242997
  const c2 = { record: record6, app: app2, job, p: params, facts: obj21(job.plan?.facts), ids: ids2, idAt, at: at2, look, warnings: out2.warnings };
242963
242998
  let complete = true;
242964
242999
  const why = agreementOf2(job);
@@ -261676,9 +261711,9 @@ async function runInputEvidenceChild(ctx) {
261676
261711
  }
261677
261712
  }
261678
261713
  async function inputEvidenceSourceArchiveHash(dir) {
261679
- const { createHash: createHash106 } = await import("node:crypto");
261714
+ const { createHash: createHash107 } = await import("node:crypto");
261680
261715
  const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
261681
- return createHash106("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
261716
+ return createHash107("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
261682
261717
  }
261683
261718
  var init_input_evidence_isolation = __esm({
261684
261719
  "src/input-evidence-isolation.ts"() {
@@ -265912,7 +265947,7 @@ async function uploadLargeAssets(client4, app2, uploads) {
265912
265947
  return fail18(
265913
265948
  "large_assets_unavailable",
265914
265949
  `this serve plane keeps large assets in its own store, up to ${limit} bytes each, and this one is ${u2.bytes}`,
265915
- `make the asset smaller than ${limit} bytes, or an operator must set LARGE_ASSET_S3 and its key pair on the plane`,
265950
+ `make the asset smaller than ${limit} bytes, push with --media-site <metaSiteId> to keep it in that site's Media Manager, or an operator must set LARGE_ASSET_S3 and its key pair on the plane`,
265916
265951
  { status: first.status, body: j2 }
265917
265952
  );
265918
265953
  }
@@ -265920,7 +265955,7 @@ async function uploadLargeAssets(client4, app2, uploads) {
265920
265955
  return fail18(
265921
265956
  "large_assets_unavailable",
265922
265957
  "this serve plane has no large asset channel configured",
265923
- "an operator must set LARGE_ASSET_S3 and its key pair on the plane, or move the asset under the inline cap",
265958
+ "push with --media-site <metaSiteId> to keep large assets in that site's Media Manager, or an operator must set LARGE_ASSET_S3 and its key pair on the plane, or move the asset under the inline cap",
265924
265959
  { status: first.status, body: j2 }
265925
265960
  );
265926
265961
  }
@@ -267574,7 +267609,14 @@ var init_push_errors = __esm({
267574
267609
  "large_asset_upload_failed",
267575
267610
  "large_asset_missing",
267576
267611
  "large_asset_quota_exceeded",
267577
- "large_asset_tag_failed"
267612
+ "large_asset_tag_failed",
267613
+ "media_site_invalid",
267614
+ "media_site_refused",
267615
+ "media_upload_failed",
267616
+ "media_asset_unsupported",
267617
+ "media_asset_missing",
267618
+ "invalid_media_asset",
267619
+ "media_placement_live"
267578
267620
  ];
267579
267621
  UX_CODES = {
267580
267622
  absent: "ux_evidence_absent",
@@ -267594,6 +267636,119 @@ var init_push_errors = __esm({
267594
267636
  }
267595
267637
  });
267596
267638
 
267639
+ // ../serve-cli/src/media-assets.ts
267640
+ var media_assets_exports = {};
267641
+ __export(media_assets_exports, {
267642
+ isMediaArchiveName: () => isMediaArchiveName,
267643
+ mediaFileName: () => mediaFileName,
267644
+ placeLargeAssetsInMedia: () => placeLargeAssetsInMedia,
267645
+ withMediaPlacements: () => withMediaPlacements
267646
+ });
267647
+ import { createHash as createHash86 } from "node:crypto";
267648
+ function isMediaArchiveName(name) {
267649
+ return /\.zip$/i.test(name);
267650
+ }
267651
+ function mediaFileName(u2) {
267652
+ const ext = /\.([A-Za-z0-9]{1,8})$/.exec(u2.names[0] ?? "")?.[1]?.toLowerCase() ?? "bin";
267653
+ return `himi-${u2.sha256}.${ext}`;
267654
+ }
267655
+ function usable(f2, siteId, bytes2, md53) {
267656
+ return !!f2 && typeof f2.id === "string" && f2.private === false && f2.operationStatus === "READY" && String(f2.sizeInBytes) === String(bytes2) && f2.hash === md53 && isMediaArchiveUrl(fileUrl(f2), siteId);
267657
+ }
267658
+ async function placeLargeAssetsInMedia(opts) {
267659
+ const { siteId, uploads } = opts;
267660
+ let token = opts.token;
267661
+ const f2 = opts.fetchImpl ?? fetch;
267662
+ const sleep5 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
267663
+ const api4 = async (path2, body, method = "POST") => {
267664
+ const call = () => f2(`${API2}/${path2}`, { method, headers: { Authorization: token, "wix-site-id": siteId, ...body ? { "Content-Type": "application/json" } : {} }, ...body ? { body: JSON.stringify(body) } : {} });
267665
+ let res = await call();
267666
+ if (res.status === 401 && opts.refreshToken) {
267667
+ const fresh = await opts.refreshToken(token);
267668
+ if (fresh && fresh !== token) {
267669
+ token = fresh;
267670
+ res = await call();
267671
+ }
267672
+ }
267673
+ return { status: res.status, ok: res.ok, json: await res.json().catch(() => ({})) };
267674
+ };
267675
+ const unsupported2 = uploads.find((u2) => !u2.names.every(isMediaArchiveName));
267676
+ if (unsupported2) {
267677
+ return { ok: false, code: "media_asset_unsupported", error: `Media Manager can keep only .zip archives for a release, not ${unsupported2.names.join(", ")}`, sha256: unsupported2.sha256, names: unsupported2.names, hint: "pack the asset in a .zip, or keep it under the inline asset cap" };
267678
+ }
267679
+ const placed = [];
267680
+ let bytesUploaded = 0;
267681
+ for (const u2 of uploads) {
267682
+ const fail18 = (code3, error, hint, status2) => ({ ok: false, code: code3, error, sha256: u2.sha256, names: u2.names, ...status2 ? { status: status2 } : {}, hint });
267683
+ const name = mediaFileName(u2);
267684
+ const bytes2 = await u2.read();
267685
+ const md53 = createHash86("md5").update(bytes2).digest("hex");
267686
+ if (createHash86("sha256").update(bytes2).digest("hex") !== u2.sha256) {
267687
+ return fail18("media_upload_failed", `the bytes of ${u2.names[0]} do not match the sha256 the release names`, "rebuild the release and push again");
267688
+ }
267689
+ const found = await api4("files/search", { search: name, mediaTypes: ["ARCHIVE", "DOCUMENT"] });
267690
+ if (found.status === 401 || found.status === 403) {
267691
+ return fail18("media_site_refused", `the site ${siteId} refused Media Manager access`, "check that you can manage that site's media (wix login), or pass another --media-site", found.status);
267692
+ }
267693
+ if (!found.ok) return fail18("media_upload_failed", "Media Manager did not answer the search for an earlier upload", "push again", found.status);
267694
+ const existing = (found.json.files ?? []).find((x2) => x2.displayName === name && usable(x2, siteId, u2.bytes, md53));
267695
+ if (existing) {
267696
+ placed.push({ sha256: u2.sha256, url: fileUrl(existing), fileId: existing.id, reused: true });
267697
+ continue;
267698
+ }
267699
+ const mint = await api4("files/generate-resumable-upload-url", { mimeType: "application/zip", fileName: name, sizeInBytes: String(u2.bytes), private: false, uploadProtocol: "TUS" });
267700
+ const uploadUrl = mint.json.uploadUrl;
267701
+ const uploadToken = mint.json.uploadToken;
267702
+ if (!mint.ok || typeof uploadUrl !== "string" || typeof uploadToken !== "string" || new URL(uploadUrl).host !== "upload.wixmp.com") {
267703
+ if (mint.status === 401 || mint.status === 403) return fail18("media_site_refused", `the site ${siteId} refused a Media Manager upload`, "check that you can manage that site's media (wix login), or pass another --media-site", mint.status);
267704
+ return fail18("media_upload_failed", "Media Manager did not grant an upload", "retry the push; if it persists, check the site's storage quota", mint.status);
267705
+ }
267706
+ const b643 = (s5) => Buffer.from(s5).toString("base64");
267707
+ const create = await f2(uploadUrl, { method: "POST", headers: { "Tus-Resumable": "1.0.0", "Upload-Length": String(u2.bytes), "Upload-Metadata": `filename ${b643(name)},acl ${b643("public")},token ${b643(uploadToken)}` } });
267708
+ const location = create.headers.get("location");
267709
+ if (create.status !== 201 || !location) return fail18("media_upload_failed", "Media Manager did not open an upload session", "retry the push", create.status);
267710
+ const session = new URL(location, uploadUrl);
267711
+ if (session.host !== "upload.wixmp.com") return fail18("media_upload_failed", "Media Manager answered with an unexpected upload host", "retry the push");
267712
+ const patch = await f2(session.toString(), { method: "PATCH", body: bytes2, headers: { "Tus-Resumable": "1.0.0", "Upload-Offset": "0", "Content-Type": "application/offset+octet-stream" } });
267713
+ if (patch.status !== 204 || patch.headers.get("upload-offset") !== String(u2.bytes)) return fail18("media_upload_failed", "Media Manager did not take all the bytes", "retry the push", patch.status);
267714
+ const finish3 = await f2(`${uploadUrl.replace(/\/+$/, "")}/${uploadToken}?${new URLSearchParams({ filename: name, acl: "public", token: uploadToken })}`, { method: "PUT", headers: { "Content-Type": "application/json" } });
267715
+ const finished = await finish3.json().catch(() => ({}));
267716
+ let file2 = finished.file;
267717
+ if (!finish3.ok || typeof file2?.id !== "string") return fail18("media_upload_failed", "Media Manager did not create the file", "retry the push", finish3.status);
267718
+ bytesUploaded += u2.bytes;
267719
+ for (let i2 = 0; i2 < READY_MAX_POLLS && file2?.operationStatus !== "READY" && file2?.operationStatus !== "FAILED"; i2++) {
267720
+ await sleep5(READY_POLL_MS);
267721
+ const got = await api4(`files/${encodeURIComponent(file2.id)}`, void 0, "GET");
267722
+ file2 = got.json.file ?? file2;
267723
+ }
267724
+ if (!usable(file2, siteId, u2.bytes, md53)) {
267725
+ return fail18("media_upload_failed", `Media Manager did not end with a public, ready archive of these bytes (status ${String(file2?.operationStatus)})`, "retry the push; a repeat finds a good earlier upload");
267726
+ }
267727
+ placed.push({ sha256: u2.sha256, url: fileUrl(file2), fileId: file2.id, reused: false });
267728
+ }
267729
+ return { ok: true, placed, bytesUploaded };
267730
+ }
267731
+ function withMediaPlacements(manifest2, siteId, placed) {
267732
+ const bySha = new Map(placed.map((p2) => [p2.sha256, p2]));
267733
+ const assets = {};
267734
+ for (const [name, rec] of Object.entries(manifest2.assets ?? {})) {
267735
+ const p2 = rec?.storage === "large" ? bySha.get(rec.sha256) : void 0;
267736
+ assets[name] = p2 ? { ...rec, storage: "media", url: p2.url, mediaSiteId: siteId } : rec;
267737
+ }
267738
+ return { ...manifest2, assets };
267739
+ }
267740
+ var API2, READY_POLL_MS, READY_MAX_POLLS, fileUrl;
267741
+ var init_media_assets = __esm({
267742
+ "../serve-cli/src/media-assets.ts"() {
267743
+ init_define_HHP_CATALOG();
267744
+ init_contract();
267745
+ API2 = "https://www.wixapis.com/site-media/v1";
267746
+ READY_POLL_MS = 2e3;
267747
+ READY_MAX_POLLS = 90;
267748
+ fileUrl = (f2) => typeof f2.media?.archive?.url === "string" ? f2.media.archive.url : f2.url;
267749
+ }
267750
+ });
267751
+
267597
267752
  // src/login-refresh.ts
267598
267753
  var login_refresh_exports = {};
267599
267754
  __export(login_refresh_exports, {
@@ -267765,7 +267920,7 @@ var init_ring_pins = __esm({
267765
267920
  });
267766
267921
 
267767
267922
  // src/commands/push.ts
267768
- import { createHash as createHash86 } from "node:crypto";
267923
+ import { createHash as createHash87 } from "node:crypto";
267769
267924
  import { existsSync as existsSync138 } from "node:fs";
267770
267925
  import { join as join172, relative as relative32 } from "node:path";
267771
267926
  function loopbackTargetWarning(base2, explicitTarget) {
@@ -267836,6 +267991,17 @@ function designSummary(output) {
267836
267991
  return "failed";
267837
267992
  }
267838
267993
  }
267994
+ async function mediaSiteToken(site, from) {
267995
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(site)) {
267996
+ return { ok: false, code: "media_site_invalid", fields: { ok: false, pushed: false, site, error: `${from} must be a site's metaSiteId (a uuid), not ${JSON.stringify(site)}`, hint: "`himi site list` shows each site's id" } };
267997
+ }
267998
+ const { siteToken: siteToken2 } = await Promise.resolve().then(() => (init_wix_owner(), wix_owner_exports));
267999
+ try {
268000
+ return { ok: true, token: await siteToken2(site) };
268001
+ } catch (e2) {
268002
+ return { ok: false, code: "media_site_refused", fields: { ok: false, pushed: false, site, error: `no Wix token for site ${site} (${from}): ${e2.message}`, hint: "sign in with an account that manages that site (`wix login`), or pass another --media-site" } };
268003
+ }
268004
+ }
267839
268005
  async function pushCommand(ctx) {
267840
268006
  const { argv, io: io2, flags, uxEvidenceCode: uxEvidenceCode2, pushFailure: pushFailure2, print, contextualDefaultTarget, targetName: targetName2, client: client4, serveBase, runReleasePatch, patchBlastRadius } = ctx;
267841
268007
  const dir = contentDir(flags);
@@ -267857,7 +268023,8 @@ async function pushCommand(ctx) {
267857
268023
  }
267858
268024
  for (const [flag3, why] of [
267859
268025
  ["no-source", "a patch never archives source \u2014 the derived release inherits the base's archive"],
267860
- ["visibility", "the patch route does not stamp visibility; set it with `himi visibility` instead"]
268026
+ ["visibility", "the patch route does not stamp visibility; set it with `himi visibility` instead"],
268027
+ ["media-site", "a patch never uploads large assets \u2014 the derived release keeps the base's"]
267861
268028
  ]) {
267862
268029
  if (flags[flag3] !== void 0) {
267863
268030
  io2.error(JSON.stringify(pushFailure2("incompatible_push_flags", { error: `--${flag3} is not meaningful with --only`, message: why, usage: ONLY_USAGE })));
@@ -267883,14 +268050,14 @@ async function pushCommand(ctx) {
267883
268050
  if (pushTokenHealth.expired) {
267884
268051
  const { loadTargetsFile: loadTargetsFile2 } = await Promise.resolve().then(() => (init_config(), config_exports));
267885
268052
  const configured = loadTargetsFile2();
267886
- const usable = Object.keys(configured.targets ?? {}).filter((n2) => n2 !== pushTarget).filter((n2) => inspectControlToken(configured.targets?.[n2]?.controlToken).valid).sort().map((n2) => ({ target: n2, control: configured.targets?.[n2]?.control }));
268053
+ const usable2 = Object.keys(configured.targets ?? {}).filter((n2) => n2 !== pushTarget).filter((n2) => inspectControlToken(configured.targets?.[n2]?.controlToken).valid).sort().map((n2) => ({ target: n2, control: configured.targets?.[n2]?.control }));
267887
268054
  io2.error(JSON.stringify(pushFailure2("control_token_expired", {
267888
268055
  ok: false,
267889
268056
  pushed: false,
267890
268057
  error: "control_token_expired",
267891
268058
  target: pushTarget,
267892
- ...usable.length ? { usableTargets: usable } : {},
267893
- hint: `${pushAuthHint(401, pushToken, pushTarget, !!ownerIssue)}` + (usable.length ? ` \u2014 you are also logged in for ${usable.map((u2) => `${u2.target}${u2.control ? ` (${u2.control})` : ""}`).join(", ")}, but check the plane before switching: a different target publishes somewhere else and claims the slug there.` : "")
268059
+ ...usable2.length ? { usableTargets: usable2 } : {},
268060
+ hint: `${pushAuthHint(401, pushToken, pushTarget, !!ownerIssue)}` + (usable2.length ? ` \u2014 you are also logged in for ${usable2.map((u2) => `${u2.target}${u2.control ? ` (${u2.control})` : ""}`).join(", ")}, but check the plane before switching: a different target publishes somewhere else and claims the slug there.` : "")
267894
268061
  })));
267895
268062
  return 1;
267896
268063
  }
@@ -268063,7 +268230,7 @@ async function pushCommand(ctx) {
268063
268230
  try {
268064
268231
  const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2, PUSH_EXCLUDED_ROOTS: PUSH_EXCLUDED_ROOTS2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
268065
268232
  const { largeAssetSourcePaths: largeAssetSourcePaths2 } = await Promise.resolve().then(() => (init_app_assets(), app_assets_exports));
268066
- localSourceHash = createHash86("sha256").update(zipAppSource2(collectAppSource2(dir, { excludeRoots: PUSH_EXCLUDED_ROOTS2, excludePaths: largeAssetSourcePaths2(dir) }).entries).toString("base64")).digest("hex");
268233
+ localSourceHash = createHash87("sha256").update(zipAppSource2(collectAppSource2(dir, { excludeRoots: PUSH_EXCLUDED_ROOTS2, excludePaths: largeAssetSourcePaths2(dir) }).entries).toString("base64")).digest("hex");
268067
268234
  } catch {
268068
268235
  }
268069
268236
  const staleShared = staleSharedWarnings(report9);
@@ -268199,6 +268366,20 @@ async function pushCommand(ctx) {
268199
268366
  }
268200
268367
  }
268201
268368
  const extensionsBody = extensionUploads2(preparedExtensions);
268369
+ const explicitMediaSite = typeof flags["media-site"] === "string" && flags["media-site"].trim() ? flags["media-site"].trim().toLowerCase() : void 0;
268370
+ if (flags["media-site"] !== void 0 && !explicitMediaSite) {
268371
+ print(pushFailure2("media_site_invalid", { ok: false, app: app2, pushed: false, error: "--media-site needs a site's metaSiteId", hint: "`himi site list` shows each site's id" }));
268372
+ return 1;
268373
+ }
268374
+ let explicitMediaToken;
268375
+ if (explicitMediaSite) {
268376
+ const site = await mediaSiteToken(explicitMediaSite, "--media-site");
268377
+ if (!site.ok) {
268378
+ print(pushFailure2(site.code, { app: app2, ...site.fields }));
268379
+ return 1;
268380
+ }
268381
+ explicitMediaToken = site.token;
268382
+ }
268202
268383
  const uxEvidence = handoverUxEvidence(dir, {
268203
268384
  releaseId: manifest2.releaseId,
268204
268385
  releaseHash: releasePayloadHash(payload),
@@ -268338,7 +268519,37 @@ async function pushCommand(ctx) {
268338
268519
  const publishPayload = publishBodyFor(app2);
268339
268520
  const largeUploads = await largeAssetUploadsFromDir(declared, out2);
268340
268521
  let largeAssetReport;
268341
- if (largeUploads.length > 0) {
268522
+ let mediaAssetReport;
268523
+ const placeInMedia = async (site, token, uploads = largeUploads) => {
268524
+ const { placeLargeAssetsInMedia: placeLargeAssetsInMedia2, withMediaPlacements: withMediaPlacements2 } = await Promise.resolve().then(() => (init_media_assets(), media_assets_exports));
268525
+ let placed;
268526
+ try {
268527
+ const refreshToken = async (sent) => {
268528
+ const { dropExchangedSiteToken: dropExchangedSiteToken2, siteToken: siteToken2 } = await Promise.resolve().then(() => (init_wix_owner(), wix_owner_exports));
268529
+ return dropExchangedSiteToken2(site, sent) ? await siteToken2(site).catch(() => void 0) : void 0;
268530
+ };
268531
+ placed = await placeLargeAssetsInMedia2({ siteId: site, token, refreshToken, uploads });
268532
+ } catch (e2) {
268533
+ print(pushFailure2("media_upload_failed", { ok: false, app: app2, pushed: false, site, error: `the Media Manager upload did not complete: ${e2.message}`, hint: "check the connection and push again; a good earlier upload is found and reused" }));
268534
+ return 1;
268535
+ }
268536
+ if (!placed.ok) {
268537
+ const { ok: _ok, code: code3, ...rest } = placed;
268538
+ void _ok;
268539
+ print(pushFailure2(code3, { ok: false, app: app2, pushed: false, site, ...rest }));
268540
+ return 1;
268541
+ }
268542
+ publishPayload.manifest = withMediaPlacements2(publishPayload.manifest, site, placed.placed);
268543
+ const placedSize = measurePublishBody(publishPayload, meta, draft);
268544
+ const placedAdmission = admitPublishBody2(placedSize, { eligibility: eligibilityFor(app2) });
268545
+ if (!placedAdmission.ok) return refuseOversizedBody(app2, placedSize, placedAdmission.compressedUpload);
268546
+ mediaAssetReport = { site, uploaded: placed.placed.filter((p2) => !p2.reused).length, reused: placed.placed.filter((p2) => p2.reused).length, bytesUploaded: placed.bytesUploaded };
268547
+ return void 0;
268548
+ };
268549
+ if (largeUploads.length > 0 && explicitMediaSite && explicitMediaToken) {
268550
+ const failed2 = await placeInMedia(explicitMediaSite, explicitMediaToken);
268551
+ if (failed2 !== void 0) return failed2;
268552
+ } else if (largeUploads.length > 0) {
268342
268553
  const { uploadLargeAssets: uploadLargeAssets2 } = await Promise.resolve().then(() => (init_large_assets(), large_assets_exports));
268343
268554
  let up2;
268344
268555
  try {
@@ -268350,16 +268561,27 @@ async function pushCommand(ctx) {
268350
268561
  })));
268351
268562
  return 1;
268352
268563
  }
268353
- if (!up2.ok) {
268354
- const { ok: _ok, code: code3, ...rest } = up2;
268564
+ const loginSite = outcome.auth?.siteId?.trim().toLowerCase();
268565
+ const { isMediaArchiveName: isMediaArchiveName2 } = await Promise.resolve().then(() => (init_media_assets(), media_assets_exports));
268566
+ const rest = up2.ok ? [] : largeUploads.slice(Math.max(0, largeUploads.findIndex((u2) => u2.sha256 === up2.sha256)));
268567
+ if (!up2.ok && up2.code === "large_assets_unavailable" && loginSite && rest.every((u2) => u2.names.every(isMediaArchiveName2))) {
268568
+ const site = await mediaSiteToken(loginSite, "the app's Wix login (auth siteId)");
268569
+ if (!site.ok) {
268570
+ print(pushFailure2(site.code, { app: app2, ...site.fields }));
268571
+ return 1;
268572
+ }
268573
+ const failed2 = await placeInMedia(loginSite, site.token, rest);
268574
+ if (failed2 !== void 0) return failed2;
268575
+ } else if (!up2.ok) {
268576
+ const { ok: _ok, code: code3, ...rest2 } = up2;
268355
268577
  void _ok;
268356
268578
  const fed = up2.status !== void 0 ? (await Promise.resolve().then(() => (init_push_errors(), push_errors_exports))).federatedRefusal(up2.status, up2.body, pushToken) : void 0;
268357
268579
  const hint = fed?.code === "federated_not_allowed" ? `assets over the inline cap (${up2.names.join(", ")}) need a Wix sign-in (\`himi login --device --provider wix\`); accounts signed in without Wix can push a release without them \u2014 shrink or remove those assets` : fed?.hint;
268358
- if (fed) print(pushFailure2(fed.code, { ok: false, app: app2, pushed: false, ...rest, hint }));
268359
- else print(pushFailure2(code3, { ok: false, app: app2, pushed: false, ...rest }));
268580
+ if (fed) print(pushFailure2(fed.code, { ok: false, app: app2, pushed: false, ...rest2, hint }));
268581
+ else print(pushFailure2(code3, { ok: false, app: app2, pushed: false, ...rest2 }));
268360
268582
  return 1;
268361
268583
  }
268362
- largeAssetReport = { uploaded: up2.uploaded.length, alreadyStored: up2.alreadyStored.length, bytesUploaded: up2.bytesUploaded };
268584
+ if (up2.ok) largeAssetReport = { uploaded: up2.uploaded.length, alreadyStored: up2.alreadyStored.length, bytesUploaded: up2.bytesUploaded };
268363
268585
  }
268364
268586
  let r3;
268365
268587
  try {
@@ -268393,11 +268615,14 @@ async function pushCommand(ctx) {
268393
268615
  }
268394
268616
  }
268395
268617
  }
268396
- if (!r3.ok && ["large_asset_missing", "large_assets_unavailable", "large_asset_tag_failed"].includes(String(r3.json?.error))) {
268618
+ if (!r3.ok && ["large_asset_missing", "large_assets_unavailable", "large_asset_tag_failed", "media_asset_missing", "invalid_media_asset", "media_placement_live"].includes(String(r3.json?.error))) {
268397
268619
  const j2 = r3.json;
268398
268620
  const hints = {
268399
268621
  large_asset_missing: "push again: the upload is retried and already-stored assets are skipped",
268400
- large_assets_unavailable: "an operator must set LARGE_ASSET_S3 and its key pair on the plane",
268622
+ large_assets_unavailable: "an operator must set LARGE_ASSET_S3 and its key pair on the plane, or push with --media-site <metaSiteId> to keep large assets in that site's Media Manager",
268623
+ media_asset_missing: "the file is gone from the site's media or not public: push again with --media-site to upload it again (with --live if the release is live)",
268624
+ invalid_media_asset: "push with a current himi: the release names a media file that is not its site's public archive",
268625
+ media_placement_live: "this release is live: push again with --live (and --media-site) so live players get the new archive",
268401
268626
  large_asset_tag_failed: "push again; if it keeps failing, the plane's key pair lacks s3:PutObjectTagging on the large asset bucket"
268402
268627
  };
268403
268628
  print(pushFailure2(j2.error, {
@@ -268558,7 +268783,7 @@ async function pushCommand(ctx) {
268558
268783
  ...effectiveVisibility === "unlisted" ? { visibilityNote: "not listed in /v1/apps or the player picker \u2014 share it via the preview links below, or run `himi visibility public` to list it" } : {},
268559
268784
  screens: Object.keys(payload.screens).length,
268560
268785
  bundles: Object.keys(payload.bundles).length,
268561
- ...assetSummary ? { assets: { ...assetSummary, ...largeAssetReport ? { largeUpload: largeAssetReport } : {} } } : {},
268786
+ ...assetSummary ? { assets: { ...assetSummary, ...largeAssetReport ? { largeUpload: largeAssetReport } : {}, ...mediaAssetReport ? { mediaUpload: mediaAssetReport } : {} } } : {},
268562
268787
  // WHAT LEFT THIS MACHINE, and how to get it back. Silence would make both halves
268563
268788
  // invisible: nobody would know their code is stored on Wix infrastructure, and nobody
268564
268789
  // would know a restore exists.
@@ -269124,7 +269349,7 @@ var init_preview_assets_format = __esm({
269124
269349
 
269125
269350
  // src/preview-embed-cache.ts
269126
269351
  import { spawnSync as spawnSync12 } from "node:child_process";
269127
- import { createHash as createHash87 } from "node:crypto";
269352
+ import { createHash as createHash88 } from "node:crypto";
269128
269353
  import { existsSync as existsSync140, mkdirSync as mkdirSync60, readdirSync as readdirSync60, readFileSync as readFileSync162, renameSync as renameSync22, rmSync as rmSync40, writeFileSync as writeFileSync64 } from "node:fs";
269129
269354
  import { join as join174 } from "node:path";
269130
269355
  import { pathToFileURL as pathToFileURL10 } from "node:url";
@@ -269152,7 +269377,7 @@ function previewEmbedKey(repoRoot2) {
269152
269377
  if (ids2.length !== PREVIEW_EMBED_KEY_ROOTS.length) return null;
269153
269378
  const webs = appWebTrees(repoRoot2);
269154
269379
  if (!webs) return null;
269155
- return createHash87("sha256").update([...ids2, ...webs].join("\n")).digest("hex").slice(0, 24);
269380
+ return createHash88("sha256").update([...ids2, ...webs].join("\n")).digest("hex").slice(0, 24);
269156
269381
  }
269157
269382
  function entriesWithContentTypes(manifest2, lib) {
269158
269383
  return lib.manifestEntries(manifest2).map((e2) => {
@@ -270366,6 +270591,8 @@ function makeServeHandler(opts) {
270366
270591
  }
270367
270592
  const PINNED_MANIFEST_CACHE_CAP = 100;
270368
270593
  const pinnedManifestCache = /* @__PURE__ */ new Map();
270594
+ const pinnedPlacedAt = /* @__PURE__ */ new Map();
270595
+ const placesAssets = (m2) => Object.values(m2.assets ?? {}).some((r3) => r3?.storage === "media" || r3?.storage === "large");
270369
270596
  const sha256hex2 = (b3) => sha256Hex(b3);
270370
270597
  function resolvePin(request2, url) {
270371
270598
  return request2.headers.get("x-himalaya-release") || url.searchParams.get("release") || null;
@@ -270397,7 +270624,13 @@ function makeServeHandler(opts) {
270397
270624
  async function pinnedManifest(app2, releaseId) {
270398
270625
  const key4 = `${app2}
270399
270626
  ${releaseId}`;
270400
- const hit = pinnedManifestCache.get(key4);
270627
+ let hit = pinnedManifestCache.get(key4);
270628
+ const mediaAt = pinnedPlacedAt.get(key4);
270629
+ if (hit && mediaAt !== void 0 && Date.now() - mediaAt >= manifestCacheTtlMs) {
270630
+ pinnedManifestCache.delete(key4);
270631
+ pinnedPlacedAt.delete(key4);
270632
+ hit = void 0;
270633
+ }
270401
270634
  if (!app2.startsWith("site.") && hit) return hit;
270402
270635
  const store = await getStore();
270403
270636
  if (app2.startsWith("site.") && await store.isMigrationCleanupFenced?.(app2)) {
@@ -270413,9 +270646,13 @@ ${releaseId}`;
270413
270646
  if (m2) {
270414
270647
  if (pinnedManifestCache.size >= PINNED_MANIFEST_CACHE_CAP) {
270415
270648
  const oldest3 = pinnedManifestCache.keys().next().value;
270416
- if (oldest3 !== void 0) pinnedManifestCache.delete(oldest3);
270649
+ if (oldest3 !== void 0) {
270650
+ pinnedManifestCache.delete(oldest3);
270651
+ pinnedPlacedAt.delete(oldest3);
270652
+ }
270417
270653
  }
270418
270654
  pinnedManifestCache.set(key4, m2);
270655
+ if (placesAssets(m2)) pinnedPlacedAt.set(key4, Date.now());
270419
270656
  }
270420
270657
  return m2;
270421
270658
  }
@@ -271488,8 +271725,10 @@ ${releaseId}`;
271488
271725
  const record6 = Object.values(m2?.assets ?? {}).find((a3) => a3.sha256 === sha7);
271489
271726
  if (!record6) return json6(404, { error: "asset_not_found", app: app2 });
271490
271727
  const etag = strongEtagForSha256(sha7);
271491
- let location = record6.storage === "large" ? opts.largeAssetUrl?.(sha7, { contentType: record6.contentType || "application/octet-stream" }) ?? void 0 : void 0;
271492
- if (location && store.largeAssetUploadMaxBytes && store.hasAsset && await store.hasAsset(app2, sha7).catch(() => false)) location = void 0;
271728
+ const media = record6.storage === "media";
271729
+ if (media && !isMediaArchiveUrl(record6.url, record6.mediaSiteId)) return json6(502, { error: "bad_media_asset", app: app2 });
271730
+ let location = media ? record6.url : record6.storage === "large" ? opts.largeAssetUrl?.(sha7, { contentType: record6.contentType || "application/octet-stream" }) ?? void 0 : void 0;
271731
+ if (location && !media && store.largeAssetUploadMaxBytes && store.hasAsset && await store.hasAsset(app2, sha7).catch(() => false)) location = void 0;
271493
271732
  if (!location && request2.headers.get("if-none-match") === etag) {
271494
271733
  return new Response(null, { status: 304, headers: { etag, "cache-control": BUNDLE_CACHE_CONTROL } });
271495
271734
  }
@@ -273888,7 +274127,7 @@ var init_git = __esm({
273888
274127
 
273889
274128
  // src/commands/patch.ts
273890
274129
  import { readFileSync as readFileSync169, existsSync as existsSync145 } from "node:fs";
273891
- import { createHash as createHash88 } from "node:crypto";
274130
+ import { createHash as createHash89 } from "node:crypto";
273892
274131
  async function patchCommand(ctx) {
273893
274132
  const { io: io2, pos, flags, client: client4, runReleasePatch, patchBlastRadius } = ctx;
273894
274133
  const PATCH_USAGE = "himi patch screen <id> --file <d.json> | bundle --file <b.js> (--for-screen <id>[,<id>]|--no-rebind) | tokens --file <t.json> | app-config --file <c.json> ; --app <a> (--draft|--live) [--from-release <id>] [--accept-regressions] [--notes <t>]";
@@ -274041,7 +274280,7 @@ async function patchCommand(ctx) {
274041
274280
  });
274042
274281
  }
274043
274282
  const bytes2 = readFileSync169(file2);
274044
- const sha7 = createHash88("sha256").update(bytes2).digest("hex");
274283
+ const sha7 = createHash89("sha256").update(bytes2).digest("hex");
274045
274284
  const forScreens = (str3(flags["for-screen"]) ?? "").split(",").map((s5) => s5.trim()).filter(Boolean);
274046
274285
  if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
274047
274286
  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 }));
@@ -278083,7 +278322,7 @@ var init_iap_catalog_api = __esm({
278083
278322
  });
278084
278323
 
278085
278324
  // ../store-release/iap-manifest.ts
278086
- import { createHash as createHash89 } from "node:crypto";
278325
+ import { createHash as createHash90 } from "node:crypto";
278087
278326
  function readTarget(reader, value2) {
278088
278327
  const obj30 = reader.object(value2, "target", TARGET_KEYS);
278089
278328
  return {
@@ -278229,7 +278468,7 @@ function canonicalJson4(value2) {
278229
278468
  return JSON.stringify(sortKeys(value2));
278230
278469
  }
278231
278470
  function sha256Digest(value2) {
278232
- return `sha256:${createHash89("sha256").update(canonicalJson4(value2)).digest("hex")}`;
278471
+ return `sha256:${createHash90("sha256").update(canonicalJson4(value2)).digest("hex")}`;
278233
278472
  }
278234
278473
  function manifestDigest(manifest2) {
278235
278474
  return sha256Digest(manifest2);
@@ -278589,7 +278828,7 @@ var init_screenshot_display_types = __esm({
278589
278828
  });
278590
278829
 
278591
278830
  // ../store-release/iap-review-screenshot.ts
278592
- import { createHash as createHash90 } from "node:crypto";
278831
+ import { createHash as createHash91 } from "node:crypto";
278593
278832
  import { basename as basename41, resolve as resolve116 } from "node:path";
278594
278833
  function pngSize2(bytes2) {
278595
278834
  const signed = PNG_SIGNATURE2.every((b3, i2) => bytes2[i2] === b3);
@@ -278608,7 +278847,7 @@ function readImageSize(bytes2) {
278608
278847
  return pngSize2(buffer) ?? jpegSize(buffer);
278609
278848
  }
278610
278849
  function md5Hex2(bytes2) {
278611
- return createHash90("md5").update(bytes2).digest("hex");
278850
+ return createHash91("md5").update(bytes2).digest("hex");
278612
278851
  }
278613
278852
  function isAppStoreScreenshotSize(file2) {
278614
278853
  return displayTypeForSize(file2.width, file2.height) !== null;
@@ -279633,11 +279872,11 @@ var init_credential_profile = __esm({
279633
279872
  });
279634
279873
 
279635
279874
  // ../store-release/iap-credentials.ts
279636
- import { createHash as createHash91 } from "node:crypto";
279875
+ import { createHash as createHash92 } from "node:crypto";
279637
279876
  import { existsSync as existsSync148, readFileSync as readFileSync173, realpathSync as realpathSync21 } from "node:fs";
279638
279877
  import { homedir as homedir19 } from "node:os";
279639
279878
  function accountFingerprint(keyId, issuerId) {
279640
- return `sha256:${createHash91("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
279879
+ return `sha256:${createHash92("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
279641
279880
  }
279642
279881
  function requireExplicitProfile(profileFlag, target) {
279643
279882
  const profile = profileFlag?.trim();
@@ -279709,7 +279948,7 @@ var init_iap_credentials = __esm({
279709
279948
  });
279710
279949
 
279711
279950
  // ../store-release/iap-draft.ts
279712
- import { createHash as createHash92 } from "node:crypto";
279951
+ import { createHash as createHash93 } from "node:crypto";
279713
279952
  function fit(text32, max) {
279714
279953
  const chars = [...text32];
279715
279954
  return chars.length <= max ? text32 : `${chars.slice(0, max - 1).join("").trimEnd()}${ELLIPSIS}`;
@@ -279865,7 +280104,7 @@ var init_iap_draft = __esm({
279865
280104
  TIER_DESCRIPTION = "Unlocks one item in the app";
279866
280105
  ELLIPSIS = "\u2026";
279867
280106
  entityKey = (entityType, entityId) => `${entityType}:${entityId}`;
279868
- sha4 = (text32) => createHash92("sha256").update(text32).digest("hex");
280107
+ sha4 = (text32) => createHash93("sha256").update(text32).digest("hex");
279869
280108
  ENTITIES3 = { "&amp;": "&", "&nbsp;": " ", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" };
279870
280109
  MAX_SUFFIX = 24;
279871
280110
  ReferenceNames = class {
@@ -282309,7 +282548,7 @@ __export(preflight_app_exports, {
282309
282548
  readXcconfigVars: () => readXcconfigVars
282310
282549
  });
282311
282550
  import { readFileSync as readFileSync177, existsSync as existsSync151, readdirSync as readdirSync63, statSync as statSync50 } from "node:fs";
282312
- import { createHash as createHash93 } from "node:crypto";
282551
+ import { createHash as createHash94 } from "node:crypto";
282313
282552
  import { dirname as dirname81, join as join189 } from "node:path";
282314
282553
  function analyze(projectYml, storeConfig, icon, account2, adopted) {
282315
282554
  const f2 = [];
@@ -282708,7 +282947,7 @@ function placeholderHashes2() {
282708
282947
  const p2 = join189(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
282709
282948
  try {
282710
282949
  if (!statSync50(p2).isFile()) continue;
282711
- return [LEGACY_PLACEHOLDER_SHA2562, createHash93("sha256").update(readFileSync177(p2)).digest("hex")];
282950
+ return [LEGACY_PLACEHOLDER_SHA2562, createHash94("sha256").update(readFileSync177(p2)).digest("hex")];
282712
282951
  } catch {
282713
282952
  }
282714
282953
  }
@@ -282745,7 +282984,7 @@ async function appIconState(iosDir) {
282745
282984
  try {
282746
282985
  if (!statSync50(p2).isFile()) continue;
282747
282986
  const bytes2 = readFileSync177(p2);
282748
- const hash3 = createHash93("sha256").update(bytes2).digest("hex");
282987
+ const hash3 = createHash94("sha256").update(bytes2).digest("hex");
282749
282988
  const pixels = await pixelIssues(bytes2);
282750
282989
  return {
282751
282990
  exists: true,
@@ -286770,7 +287009,7 @@ var init_cms2 = __esm({
286770
287009
  });
286771
287010
 
286772
287011
  // src/data.ts
286773
- import { createHash as createHash94 } from "node:crypto";
287012
+ import { createHash as createHash95 } from "node:crypto";
286774
287013
  async function planData(options2) {
286775
287014
  const kv = [];
286776
287015
  for (const spec of options2.data?.kv ?? []) {
@@ -286835,7 +287074,7 @@ var init_data2 = __esm({
286835
287074
  url.searchParams.set("site", scope3.siteId);
286836
287075
  url.searchParams.set("environment", scope3.environment);
286837
287076
  const serialized = body === void 0 ? void 0 : JSON.stringify(body);
286838
- const idempotencyKey = serialized === void 0 ? void 0 : createHash94("sha256").update(`${scope3.app}\0${scope3.siteId}\0${scope3.environment}\0${method}\0${name}\0${serialized}`).digest("hex");
287077
+ const idempotencyKey = serialized === void 0 ? void 0 : createHash95("sha256").update(`${scope3.app}\0${scope3.siteId}\0${scope3.environment}\0${method}\0${name}\0${serialized}`).digest("hex");
286839
287078
  const response = await this.fetchImpl(url, { method, headers: { authorization: `Bearer ${this.token}`, "content-type": "application/json", ...idempotencyKey ? { "idempotency-key": idempotencyKey } : {} }, ...serialized === void 0 ? {} : { body: serialized } });
286840
287079
  if (response.status === 404 && method === "GET") return { exists: false };
286841
287080
  if (!response.ok) throw new Error(`data admin ${method} failed (${response.status}): ${(await response.text()).slice(0, 256)}`);
@@ -287110,7 +287349,7 @@ var init_site_member = __esm({
287110
287349
  });
287111
287350
 
287112
287351
  // src/notify-ping-all.ts
287113
- import { createHash as createHash95 } from "node:crypto";
287352
+ import { createHash as createHash96 } from "node:crypto";
287114
287353
  async function listApprovedMembers(input) {
287115
287354
  const first = await scanMembers(input);
287116
287355
  const second = await scanMembers(input);
@@ -287164,7 +287403,7 @@ async function scanMembers(input) {
287164
287403
  }
287165
287404
  }
287166
287405
  function campaignRequestId(campaignId, memberId) {
287167
- const bytes2 = createHash95("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
287406
+ const bytes2 = createHash96("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
287168
287407
  bytes2[6] = bytes2[6] & 15 | 80;
287169
287408
  bytes2[8] = bytes2[8] & 63 | 128;
287170
287409
  const hex2 = bytes2.toString("hex");
@@ -288767,7 +289006,7 @@ __export(runtime_copy_exports, {
288767
289006
  renderTs: () => renderTs,
288768
289007
  rowId: () => rowId
288769
289008
  });
288770
- import { createHash as createHash96 } from "node:crypto";
289009
+ import { createHash as createHash97 } from "node:crypto";
288771
289010
  import { existsSync as existsSync156, readFileSync as readFileSync187, writeFileSync as writeFileSync69 } from "node:fs";
288772
289011
  import { readdirSync as readdirSync64 } from "node:fs";
288773
289012
  import { dirname as dirname84, join as join196, relative as relative34, resolve as resolve122 } from "node:path";
@@ -288838,7 +289077,7 @@ export const RUNTIME_RENDERER_COPY: Readonly<Record<string, string>> = ${JSON.st
288838
289077
  `;
288839
289078
  }
288840
289079
  function rowId(key4) {
288841
- return "n_" + createHash96("sha1").update("runtime-copy:" + key4).digest("hex").slice(0, 12);
289080
+ return "n_" + createHash97("sha1").update("runtime-copy:" + key4).digest("hex").slice(0, 12);
288842
289081
  }
288843
289082
  function injectRuntimeRows(catalog4, table = loadTable()) {
288844
289083
  const prior = catalog4.messages ?? {};
@@ -288925,7 +289164,7 @@ __export(auth_gate_copy_exports, {
288925
289164
  scanProse: () => scanProse,
288926
289165
  scanThrownMessages: () => scanThrownMessages
288927
289166
  });
288928
- import { createHash as createHash97 } from "node:crypto";
289167
+ import { createHash as createHash98 } from "node:crypto";
288929
289168
  import { existsSync as existsSync157, readdirSync as readdirSync65, readFileSync as readFileSync188, writeFileSync as writeFileSync70 } from "node:fs";
288930
289169
  import { dirname as dirname85, join as join197, relative as relative35, resolve as resolve123 } from "node:path";
288931
289170
  import { fileURLToPath as fileURLToPath42 } from "node:url";
@@ -289003,7 +289242,7 @@ ${rows}
289003
289242
  `;
289004
289243
  }
289005
289244
  function rowId2(key4) {
289006
- return "n_" + createHash97("sha1").update("auth-gate:" + key4).digest("hex").slice(0, 12);
289245
+ return "n_" + createHash98("sha1").update("auth-gate:" + key4).digest("hex").slice(0, 12);
289007
289246
  }
289008
289247
  function injectGateRows(catalog4, table = loadTable2()) {
289009
289248
  const prior = catalog4.messages ?? {};
@@ -289051,7 +289290,7 @@ function loadAppTable(appDir3) {
289051
289290
  return out2;
289052
289291
  }
289053
289292
  function nativeRowId(key4) {
289054
- return "n_" + createHash97("sha1").update("app-native:" + key4).digest("hex").slice(0, 12);
289293
+ return "n_" + createHash98("sha1").update("app-native:" + key4).digest("hex").slice(0, 12);
289055
289294
  }
289056
289295
  function injectNativeRows(catalog4, table, keys2) {
289057
289296
  const prior = catalog4.messages ?? {};
@@ -289231,10 +289470,10 @@ var init_auth_gate_copy = __esm({
289231
289470
 
289232
289471
  // ../l10n/extract.ts
289233
289472
  import { resolve as resolve124, join as join198, relative as relative36, dirname as dirname86 } from "node:path";
289234
- import { createHash as createHash98 } from "node:crypto";
289473
+ import { createHash as createHash99 } from "node:crypto";
289235
289474
  import { fileURLToPath as fileURLToPath43 } from "node:url";
289236
289475
  function keyOf4(source2) {
289237
- return "h_" + createHash98("sha1").update(source2).digest("hex").slice(0, 12);
289476
+ return "h_" + createHash99("sha1").update(source2).digest("hex").slice(0, 12);
289238
289477
  }
289239
289478
  var ROOT8;
289240
289479
  var init_extract = __esm({
@@ -290285,7 +290524,7 @@ __export(generate_exports, {
290285
290524
  withHeader: () => withHeader,
290286
290525
  writeGenerated: () => writeGenerated2
290287
290526
  });
290288
- import { createHash as createHash99 } from "node:crypto";
290527
+ import { createHash as createHash100 } from "node:crypto";
290289
290528
  import { existsSync as existsSync160, mkdirSync as mkdirSync65, readdirSync as readdirSync67, readFileSync as readFileSync191, writeFileSync as writeFileSync73 } from "node:fs";
290290
290529
  import { dirname as dirname88, join as join201 } from "node:path";
290291
290530
  function withHeader(body) {
@@ -290452,7 +290691,7 @@ var init_generate2 = __esm({
290452
290691
  GENERATED_HEADER = "// @generated by himi base44 screens \u2014 sha256:";
290453
290692
  HEADER_RE = /^\/\/ @generated by himi base44 screens — sha256:([0-9a-f]{64})\n/;
290454
290693
  ENGINE_FILES = ["tier5-src/_shared/entity-list.ts", "tier5-src/_shared/entity-detail.ts", "tier5-src/_shared/entity-plan.ts", "dev/entity-screens.ts"];
290455
- sha2568 = (s5) => createHash99("sha256").update(s5).digest("hex");
290694
+ sha2568 = (s5) => createHash100("sha256").update(s5).digest("hex");
290456
290695
  planFile = (p2) => `${p2.ids.bundleDetail}-plan`;
290457
290696
  ident = (p2) => `plan_${p2.ids.detail.replace(/^b44_/, "")}`;
290458
290697
  json8 = (v2) => JSON.stringify(v2, null, 2);
@@ -296699,11 +296938,11 @@ function cleanNode(node4, path2, depth, ctx, parentType) {
296699
296938
  const inBlocks = holdsBlocks(parentType);
296700
296939
  if (node4.type !== "TEXT" || inBlocks) {
296701
296940
  const own6 = typeof node4.id === "string" ? node4.id : "";
296702
- const usable = own6 !== "" && !unusableId(own6);
296941
+ const usable2 = own6 !== "" && !unusableId(own6);
296703
296942
  if (inBlocks && !isWrapper(node4.type)) {
296704
- if (usable && !ctx.ids.has(own6)) ctx.ids.add(own6);
296943
+ if (usable2 && !ctx.ids.has(own6)) ctx.ids.add(own6);
296705
296944
  else node4.id = path2;
296706
- } else if (!usable) node4.id = path2;
296945
+ } else if (!usable2) node4.id = path2;
296707
296946
  }
296708
296947
  if (Array.isArray(node4.nodes)) node4.nodes = cleanNodes(node4.nodes, path2, depth + 1, ctx, typeof node4.type === "string" ? node4.type : "");
296709
296948
  return node4;
@@ -296963,7 +297202,7 @@ var init_one_app_page = __esm({
296963
297202
  });
296964
297203
 
296965
297204
  // src/one-app/pages.ts
296966
- import { createHash as createHash100 } from "node:crypto";
297205
+ import { createHash as createHash101 } from "node:crypto";
296967
297206
  function oneAppPagePlacements(raw) {
296968
297207
  const sections2 = object14(raw.sections);
296969
297208
  const placements = [];
@@ -297028,7 +297267,7 @@ var init_pages = __esm({
297028
297267
  init_errors4();
297029
297268
  object14 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
297030
297269
  pointer2 = (s5) => s5.replaceAll("~", "~0").replaceAll("/", "~1");
297031
- hash2 = (s5) => createHash100("sha256").update(s5).digest("hex");
297270
+ hash2 = (s5) => createHash101("sha256").update(s5).digest("hex");
297032
297271
  ONE_APP_PAGES_BASE = "https://apps.wix.com/social-content/api/v1/pages/";
297033
297272
  }
297034
297273
  });
@@ -297041,7 +297280,7 @@ __export(collect_exports, {
297041
297280
  resolveSourceLocale: () => resolveSourceLocale,
297042
297281
  sourceMemberChat: () => sourceMemberChat
297043
297282
  });
297044
- import { createHash as createHash101 } from "node:crypto";
297283
+ import { createHash as createHash102 } from "node:crypto";
297045
297284
  function isObject3(value2) {
297046
297285
  return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
297047
297286
  }
@@ -297157,7 +297396,7 @@ function semanticFingerprint(structure) {
297157
297396
  }
297158
297397
  return JSON.stringify(value2);
297159
297398
  };
297160
- return createHash101("sha256").update(canonical9(structure, true)).digest("hex");
297399
+ return createHash102("sha256").update(canonical9(structure, true)).digest("hex");
297161
297400
  }
297162
297401
  async function collectOneApp(input, deps = {}) {
297163
297402
  const locale = resolveSourceLocale(input.locale);
@@ -298190,7 +298429,7 @@ var init_widget_velo = __esm({
298190
298429
  });
298191
298430
 
298192
298431
  // src/one-app/widget-inspect.ts
298193
- import { createHash as createHash102 } from "node:crypto";
298432
+ import { createHash as createHash103 } from "node:crypto";
298194
298433
  import { mkdirSync as mkdirSync69, mkdtempSync as mkdtempSync16, rmSync as rmSync51, writeFileSync as writeFileSync80, readFileSync as readFileSync197, existsSync as existsSync168, renameSync as renameSync27 } from "node:fs";
298195
298434
  import { tmpdir as tmpdir17 } from "node:os";
298196
298435
  import { join as join210 } from "node:path";
@@ -298628,7 +298867,7 @@ var init_widget_inspect = __esm({
298628
298867
  obj26 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
298629
298868
  arr5 = (v2) => Array.isArray(v2) ? v2 : [];
298630
298869
  str24 = (v2) => typeof v2 === "string" ? v2 : "";
298631
- sha5 = (v2) => createHash102("sha256").update(v2).digest("hex");
298870
+ sha5 = (v2) => createHash103("sha256").update(v2).digest("hex");
298632
298871
  INSPECTION_SCHEMA = 1;
298633
298872
  VETTED_ASSET_HOSTS = ["static.parastorage.com", "siteassets.parastorage.com", "bundler-velo.parastorage.com", "static.wixstatic.com", "video.wixstatic.com"];
298634
298873
  SOURCE_MAP_HOSTS = ["bundler.wix-code.com"];
@@ -298664,7 +298903,7 @@ var init_widget_inspect = __esm({
298664
298903
  });
298665
298904
 
298666
298905
  // src/one-app/widget-tests.ts
298667
- import { createHash as createHash103 } from "node:crypto";
298906
+ import { createHash as createHash104 } from "node:crypto";
298668
298907
  import { mkdirSync as mkdirSync70, readFileSync as readFileSync198, writeFileSync as writeFileSync81 } from "node:fs";
298669
298908
  import { isAbsolute as isAbsolute22, join as join211, relative as relative38, resolve as resolve131 } from "node:path";
298670
298909
  function runWidgetTests(options2) {
@@ -298754,7 +298993,7 @@ var init_widget_tests = __esm({
298754
298993
  init_widgets_plan();
298755
298994
  init_widget_run();
298756
298995
  obj27 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
298757
- sha6 = (v2) => createHash103("sha256").update(v2).digest("hex");
298996
+ sha6 = (v2) => createHash104("sha256").update(v2).digest("hex");
298758
298997
  }
298759
298998
  });
298760
298999
 
@@ -299379,7 +299618,7 @@ __export(cli_exports2, {
299379
299618
  runOneAppCommand: () => runOneAppCommand
299380
299619
  });
299381
299620
  import { closeSync as closeSync15, constants as constants13, lstatSync as lstatSync43, mkdirSync as mkdirSync71, openSync as openSync14, readFileSync as readFileSync201, realpathSync as realpathSync24, writeFileSync as writeFileSync82 } from "node:fs";
299382
- import { createHash as createHash104 } from "node:crypto";
299621
+ import { createHash as createHash105 } from "node:crypto";
299383
299622
  import { isIP as isIP2 } from "node:net";
299384
299623
  import { dirname as dirname91, join as join214, parse as parse13, resolve as resolve134 } from "node:path";
299385
299624
  function nativeSiteHost(host) {
@@ -299603,7 +299842,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
299603
299842
  throw new OneAppError("artifact_write_failed", "Could not save the migration evidence. Existing files were kept.", { stage });
299604
299843
  }
299605
299844
  artifacts[name] = path2;
299606
- hashes[name] = createHash104("sha256").update(content).digest("hex");
299845
+ hashes[name] = createHash105("sha256").update(content).digest("hex");
299607
299846
  return path2;
299608
299847
  };
299609
299848
  const progress = (nextStage) => {
@@ -302284,9 +302523,9 @@ function buildMergedContract(options2) {
302284
302523
  } catch {
302285
302524
  faces = [];
302286
302525
  }
302287
- const usable = (f2) => typeof f2?.family === "string" && f2.family.trim() !== "" && typeof f2?.file === "string" && f2.file.trim() !== "" && typeof f2?.postscriptName === "string" && f2.postscriptName.trim() !== "" && Number.isFinite(f2?.weight);
302526
+ const usable2 = (f2) => typeof f2?.family === "string" && f2.family.trim() !== "" && typeof f2?.file === "string" && f2.file.trim() !== "" && typeof f2?.postscriptName === "string" && f2.postscriptName.trim() !== "" && Number.isFinite(f2?.weight);
302288
302527
  const fonts = faces.flatMap((face) => {
302289
- if (!usable(face)) return [];
302528
+ if (!usable2(face)) return [];
302290
302529
  const rel2 = stage(face.file, `${STAGED}/${face.postscriptName}.ttf`);
302291
302530
  return rel2 ? [{ family: face.family, file: rel2, postscriptName: face.postscriptName, weight: face.weight }] : [];
302292
302531
  });
@@ -302312,7 +302551,7 @@ function catalogTypography(overlay, template) {
302312
302551
  const typography = {};
302313
302552
  const notes = [];
302314
302553
  const base2 = template && typeof template === "object" ? template : {};
302315
- const usable = (family) => typeof family === "string" && family.trim() !== "" && (family === SYSTEM_FONT_FAMILY || canonicalFamilyName(family) !== void 0);
302554
+ const usable2 = (family) => typeof family === "string" && family.trim() !== "" && (family === SYSTEM_FONT_FAMILY || canonicalFamilyName(family) !== void 0);
302316
302555
  for (const [role, token] of Object.entries(overlay ?? {})) {
302317
302556
  const family = token?.family;
302318
302557
  if (typeof family !== "string" || family.trim() === "") {
@@ -302329,7 +302568,7 @@ function catalogTypography(overlay, template) {
302329
302568
  continue;
302330
302569
  }
302331
302570
  const kept = base2[role]?.family;
302332
- const using = usable(kept) ? `the template's ${kept}` : `the template's default (${TIER1_FLOOR[0]})`;
302571
+ const using = usable2(kept) ? `the template's ${kept}` : `the template's default (${TIER1_FLOOR[0]})`;
302333
302572
  notes.push(`site font "${family}" (${role}) isn't in the font catalog; using ${using}`);
302334
302573
  }
302335
302574
  return { typography, notes };
@@ -304821,7 +305060,7 @@ __export(check_report_exports, {
304821
305060
  sendCheckResult: () => sendCheckResult,
304822
305061
  takeCheckReportTarget: () => takeCheckReportTarget
304823
305062
  });
304824
- import { createHash as createHash105, randomUUID as randomUUID20 } from "node:crypto";
305063
+ import { createHash as createHash106, randomUUID as randomUUID20 } from "node:crypto";
304825
305064
  import { request as httpRequest2 } from "node:http";
304826
305065
  import { createConnection } from "node:net";
304827
305066
  import { isAbsolute as isAbsolute24, relative as relative39, resolve as resolve137 } from "node:path";
@@ -304993,7 +305232,7 @@ function errorFindings(run4, mode) {
304993
305232
  if (mode === "functions") {
304994
305233
  return envelope.functions.map(record5).filter((f2) => f2.ok === false).map((f2) => ({
304995
305234
  // Stable per function, in the HimiReport id alphabet: the name may hold anything.
304996
- id: `test:functions:${createHash105("sha256").update(text31(f2.name) ?? "").digest("hex").slice(0, 12)}`,
305235
+ id: `test:functions:${createHash106("sha256").update(text31(f2.name) ?? "").digest("hex").slice(0, 12)}`,
304997
305236
  severity: "error",
304998
305237
  message: `function "${text31(f2.name) ?? "?"}" (${text31(f2.method) ?? "?"} ${text31(f2.path) ?? "?"}) answered HTTP ${String(f2.status)}`
304999
305238
  }));