peachsim 0.1.686 → 0.1.688

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/cli/cloud-client.ts +3 -3
  2. package/cli/command-registry.ts +2 -0
  3. package/cli/commands/control.ts +1 -0
  4. package/cli/commands/debug.ts +10 -33
  5. package/cli/commands/do-chain.ts +56 -6
  6. package/cli/commands/inspect/core.ts +2 -0
  7. package/cli/commands/inspect/list.ts +2 -1
  8. package/cli/commands/inspect/settling.ts +17 -3
  9. package/cli/commands/inspect/shared.ts +2 -0
  10. package/cli/commands/inspect/wait-idle.ts +2 -2
  11. package/cli/commands/inspect/wait-ready.ts +3 -3
  12. package/cli/commands/inspect.ts +33 -7
  13. package/cli/commands/location.ts +164 -0
  14. package/cli/commands/platform.ts +1 -1
  15. package/cli/drivers/playwright-sim-host.ts +46 -25
  16. package/cli/main.ts +6 -0
  17. package/detox/index.ts +13 -8
  18. package/dist-lib/agent-daemon-client.cjs +1 -1
  19. package/dist-lib/agent-events.cjs +1 -1
  20. package/dist-lib/agent-identity.cjs +1 -1
  21. package/dist-lib/agent-sessions.cjs +1 -1
  22. package/dist-lib/attached-projects.cjs +1 -1
  23. package/dist-lib/auth/shared-session.cjs +1 -1
  24. package/dist-lib/backend-origin.cjs +1 -1
  25. package/dist-lib/beta.cjs +1 -1
  26. package/dist-lib/beta.mjs +1 -1
  27. package/dist-lib/bridge-constants.cjs +4 -3
  28. package/dist-lib/bridge-contract-input.cjs +12 -1
  29. package/dist-lib/bridge-contract-input.mjs +12 -1
  30. package/dist-lib/bridge-contract.cjs +4 -3
  31. package/dist-lib/bridge-contract.mjs +4 -3
  32. package/dist-lib/capture-contract.cjs +1 -1
  33. package/dist-lib/capture-contract.mjs +1 -1
  34. package/dist-lib/cli-constants.cjs +1 -1
  35. package/dist-lib/cloud-contract.cjs +2 -1
  36. package/dist-lib/cloud-contract.mjs +2 -1
  37. package/dist-lib/cloud-test-args.cjs +1 -1
  38. package/dist-lib/cloud-test-args.mjs +1 -1
  39. package/dist-lib/cloud.cjs +2 -1
  40. package/dist-lib/cloud.mjs +2 -1
  41. package/dist-lib/config.cjs +1 -1
  42. package/dist-lib/detox/index.cjs +1197 -65
  43. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  44. package/dist-lib/home-paths.cjs +1 -1
  45. package/dist-lib/host/bridge-host.cjs +402 -113
  46. package/dist-lib/host/fetch-proxy-handler.cjs +50 -40
  47. package/dist-lib/host/fetch-proxy-overrides.cjs +50 -6
  48. package/dist-lib/host/fetch-proxy-overrides.mjs +48 -5
  49. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  50. package/dist-lib/host/websocket-proxy.cjs +1 -1
  51. package/dist-lib/index.cjs +29 -11
  52. package/dist-lib/jump-to-source-babel.cjs +1 -1
  53. package/dist-lib/jump-to-source-native.cjs +1 -1
  54. package/dist-lib/kotlin-host.cjs +89 -13
  55. package/dist-lib/menu.cjs +1 -1
  56. package/dist-lib/menu.mjs +1 -1
  57. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  58. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  59. package/dist-lib/metro-production-bundle.cjs +1 -1
  60. package/dist-lib/metro-production-bundle.mjs +1 -1
  61. package/dist-lib/metro.cjs +5 -3
  62. package/dist-lib/native-app-identity.cjs +8 -3
  63. package/dist-lib/native-app-identity.mjs +8 -3
  64. package/dist-lib/native-firebase-metadata.cjs +1 -1
  65. package/dist-lib/native-firebase-metadata.mjs +1 -1
  66. package/dist-lib/plist.cjs +1 -1
  67. package/dist-lib/plist.mjs +1 -1
  68. package/dist-lib/profiles.cjs +1 -1
  69. package/dist-lib/public-brand.cjs +1 -1
  70. package/dist-lib/react-native-host-modules.cjs +1 -1
  71. package/dist-lib/react-native-host-modules.mjs +1 -1
  72. package/dist-lib/render-mode.cjs +1 -1
  73. package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
  74. package/dist-lib/sdk.cjs +21 -6
  75. package/dist-lib/sdk.mjs +21 -6
  76. package/dist-lib/skills.cjs +441 -135
  77. package/dist-lib/swift-compile.cjs +317 -27
  78. package/dist-lib/swift-compile.mjs +315 -27
  79. package/dist-lib/swift-package.cjs +1 -1
  80. package/dist-lib/swift-package.mjs +1 -1
  81. package/dist-lib/swift-submit.cjs +2 -2
  82. package/dist-lib/swift-submit.mjs +2 -2
  83. package/dist-lib/swift-toolchain.cjs +10 -10
  84. package/dist-lib/swift.cjs +1 -1
  85. package/dist-lib/vite-swift.cjs +320 -49
  86. package/dist-lib/vite.cjs +1 -1
  87. package/kotlin/AppSources/android/content/res/Configuration.kt +2 -0
  88. package/kotlin/AppSources/android/content/res/Resources.kt +6 -3
  89. package/kotlin/AppSources/android/util/DisplayMetrics.kt +12 -0
  90. package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +70 -0
  91. package/kotlin/AppSources/dev/peach/app/PeachApp.kt +12 -10
  92. package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +95 -0
  93. package/kotlin/fixtures/kotlin-app-variants/Bitmaps.kt +50 -0
  94. package/kotlin/fixtures/kotlin-app-variants/Drawables.kt +53 -0
  95. package/package.json +2 -2
  96. package/scripts/dev-server-scanner.ts +3 -1
  97. package/skills/contrast/SKILL.md +1 -0
  98. package/src/android-drawables.ts +315 -0
  99. package/src/android-theme.ts +9 -0
  100. package/src/bridge-constants.ts +3 -2
  101. package/src/bridge-contract-input.ts +11 -0
  102. package/src/bridge-contract.ts +45 -3
  103. package/src/cloud-contract.ts +1 -0
  104. package/src/host/fetch-proxy-handler.ts +13 -49
  105. package/src/host/fetch-proxy-overrides.ts +69 -12
  106. package/src/kotlin-app.ts +6 -0
  107. package/src/kotlin-host.ts +103 -15
  108. package/src/native-app-identity.ts +16 -3
  109. package/src/swift-compile.ts +426 -29
  110. package/src/swift-distribution-contract.ts +11 -4
  111. package/src/swift-distribution.lock.json +11 -9
  112. package/src/swift-distribution.ts +4 -4
  113. package/src/swift-icu.ts +8 -11
  114. package/src/swift-submit.ts +13 -1
  115. package/src/swift-toolchain.ts +17 -9
  116. package/src/vite-plugin.ts +86 -34
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.686 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.688 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -559,7 +559,7 @@ var init_reap_browser = __esm({
559
559
  "msEdgeUpdateLaunchServicesPreferredVersion"
560
560
  ];
561
561
  PLAYWRIGHT_ENABLED_FEATURES = ["CDPScreenshotNewSurface"];
562
- DISABLED_FEATURES = ["NetworkTimeServiceQuerying"];
562
+ DISABLED_FEATURES = ["NetworkTimeServiceQuerying", "LocalNetworkAccessChecks"];
563
563
  }
564
564
  });
565
565
 
@@ -3630,9 +3630,9 @@ var init_capability_outcomes2 = __esm({
3630
3630
  }
3631
3631
  }
3632
3632
  },
3633
- capturedAt: "2026-10-01T07:50:49.727Z",
3634
- receipts: ["core-paired-capture.2026-10-01T07:50:49.727Z.json"],
3635
- sourceCommit: "7b3f26ea6413895ef474cf7adcbb130c5eb298c7"
3633
+ capturedAt: "2026-10-04T14:45:43.524Z",
3634
+ receipts: ["core-paired-capture.2026-10-04T14:45:43.524Z.json"],
3635
+ sourceCommit: "a0153483ee758b7fe88b6dbf91930fa65f2a9ff0"
3636
3636
  },
3637
3637
  unmatchedReferenceCount: 7368,
3638
3638
  byPlatform: {
@@ -18985,13 +18985,14 @@ function resolveSootsimBridgePortForRuntimeLocation(input = {}) {
18985
18985
  const hrefUrl = parseHrefUrl(input.href);
18986
18986
  const httpPort = parsePort(input.httpPort) ?? parsePort(hrefUrl?.port);
18987
18987
  if (httpPort === null) return DEFAULT_SOOTSIM_BRIDGE_PORT;
18988
- if (hrefUrl?.pathname.startsWith("/sootsim") && (hrefUrl.searchParams.has("embed") || hrefUrl.searchParams.has("nativePreview"))) {
18988
+ const hostedShell = hrefUrl && /^\/(?:simulator|sootsim)(?:\/|$)/.test(hrefUrl.pathname);
18989
+ if (hostedShell && (hrefUrl.searchParams.has("embed") || hrefUrl.searchParams.has("nativePreview"))) {
18989
18990
  return resolveSootsimBridgePortForHttpPort({
18990
18991
  httpPort,
18991
18992
  baseHttpPort: CONTRAST_DEV_HTTP_BASE_PORT
18992
18993
  });
18993
18994
  }
18994
- if (hrefUrl?.pathname.startsWith("/sootsim") && httpPort >= SOOTSIM_SITE_DEV_HTTP_BASE_PORT && httpPort <= SOOTSIM_SITE_DEV_HTTP_BASE_PORT + MAX_LOCAL_DEV_PORT_OFFSET) {
18995
+ if (hostedShell && httpPort >= SOOTSIM_SITE_DEV_HTTP_BASE_PORT && httpPort <= SOOTSIM_SITE_DEV_HTTP_BASE_PORT + MAX_LOCAL_DEV_PORT_OFFSET) {
18995
18996
  return resolveSootsimBridgePortForHttpPort({
18996
18997
  httpPort,
18997
18998
  baseHttpPort: SOOTSIM_SITE_DEV_HTTP_BASE_PORT
@@ -20461,7 +20462,7 @@ async function scanDevServers(opts = {}) {
20461
20462
  for (const pid of [...cwdByPid.keys()]) {
20462
20463
  if (!livePids.has(pid)) cwdByPid.delete(pid);
20463
20464
  }
20464
- return results.filter((r) => !isSootSimSelfServer(r));
20465
+ return results.filter((r) => !isSootSimSelfServer(r)).sort((a, b) => a.port - b.port);
20465
20466
  }
20466
20467
  var import_child_process, import_promises2, import_http, import_net, import_node_fs2, import_node_path3, TIMEOUT_MS, MANIFEST_TIMEOUT_MS, TCP_GATE_MS, BODY_TIMEOUT_MS, FALLBACK_PORTS, SELF_PORT_RANGE_START, SELF_PORT_RANGE_END, DevServerScanUnavailableError, LISTING_TIMEOUT_MS, inflightListing, cwdByPid, localIconPathCache, localIconProbeInFlight, ENRICH_TIMEOUT_MS, enrichmentCache, enrichmentInFlight, knownNonPatched, knownNonExpo, knownOne, portCache, portCacheInvalidatedAt, NEGATIVE_CACHE_TTL_MS, WEAK_RESULT_CACHE_TTL_MS;
20467
20468
  var init_dev_server_scanner = __esm({
@@ -21615,7 +21616,7 @@ function swiftDistributionHost(platform, arch) {
21615
21616
  return SWIFT_DISTRIBUTION_HOSTS.find((candidate) => candidate === host2) ?? null;
21616
21617
  }
21617
21618
  function parseSwiftDistributionManifest(value) {
21618
- if (!isRecord(value) || typeof value.id !== "string" || typeof value.release !== "string" || typeof value.wasmSdkChecksum !== "string" || !isStrings(value.modules) || !isStrings(value.objects) || !isStrings(value.link) || !isRecord(value.files) || !Object.values(value.files).every((sha) => typeof sha === "string") || typeof value.host !== "string" || !isStrings(value.plugins)) {
21619
+ if (!isRecord(value) || typeof value.id !== "string" || typeof value.release !== "string" || typeof value.wasmSdkId !== "string" || typeof value.wasmSdkUrl !== "string" || typeof value.wasmSdkChecksum !== "string" || !isStrings(value.modules) || !isStrings(value.objects) || !isStrings(value.link) || !isRecord(value.files) || !Object.values(value.files).every((sha) => typeof sha === "string") || typeof value.host !== "string" || !isStrings(value.plugins)) {
21619
21620
  throw new Error(`invalid Swift distribution ${SWIFT_DISTRIBUTION_MANIFEST}`);
21620
21621
  }
21621
21622
  const host2 = SWIFT_DISTRIBUTION_HOSTS.find((candidate) => candidate === value.host);
@@ -21623,6 +21624,8 @@ function parseSwiftDistributionManifest(value) {
21623
21624
  return {
21624
21625
  id: value.id,
21625
21626
  release: value.release,
21627
+ wasmSdkId: value.wasmSdkId,
21628
+ wasmSdkUrl: value.wasmSdkUrl,
21626
21629
  wasmSdkChecksum: value.wasmSdkChecksum,
21627
21630
  modules: value.modules,
21628
21631
  objects: value.objects,
@@ -21635,7 +21638,7 @@ function parseSwiftDistributionManifest(value) {
21635
21638
  };
21636
21639
  }
21637
21640
  function parseSwiftDistributionLock(value) {
21638
- if (!isRecord(value) || typeof value.id !== "string" || !/^[a-f0-9]{16}$/.test(value.id) || typeof value.release !== "string" || typeof value.wasmSdkChecksum !== "string" || typeof value.source !== "string" || !isRecord(value.hosts)) {
21641
+ if (!isRecord(value) || typeof value.id !== "string" || !/^[a-f0-9]{16}$/.test(value.id) || typeof value.release !== "string" || typeof value.wasmSdkId !== "string" || typeof value.wasmSdkUrl !== "string" || typeof value.wasmSdkChecksum !== "string" || typeof value.source !== "string" || !isRecord(value.hosts)) {
21639
21642
  throw new Error("invalid Swift distribution lock");
21640
21643
  }
21641
21644
  const hosts = value.hosts;
@@ -21649,6 +21652,8 @@ function parseSwiftDistributionLock(value) {
21649
21652
  return {
21650
21653
  id: value.id,
21651
21654
  release: value.release,
21655
+ wasmSdkId: value.wasmSdkId,
21656
+ wasmSdkUrl: value.wasmSdkUrl,
21652
21657
  wasmSdkChecksum: value.wasmSdkChecksum,
21653
21658
  source: value.source,
21654
21659
  hosts: {
@@ -21686,25 +21691,25 @@ function memo(cache, key, load2) {
21686
21691
  }
21687
21692
  return pending;
21688
21693
  }
21689
- function swiftIcuData(toolchainBin, release) {
21690
- return memo(raw, `${toolchainBin}\0${release}`, () => load(toolchainBin, release));
21694
+ function swiftIcuData(toolchainBin, sdk) {
21695
+ return memo(raw, `${toolchainBin}\0${sdk}`, () => load(toolchainBin, sdk));
21691
21696
  }
21692
- function swiftIcuAsset(toolchainBin, release) {
21693
- return memo(assets, `${toolchainBin}\0${release}`, async () => {
21694
- const zipped = await deflate(await swiftIcuData(toolchainBin, release));
21697
+ function swiftIcuAsset(toolchainBin, sdk) {
21698
+ return memo(assets, `${toolchainBin}\0${sdk}`, async () => {
21699
+ const zipped = await deflate(await swiftIcuData(toolchainBin, sdk));
21695
21700
  return { sha256: (0, import_node_crypto3.createHash)("sha256").update(zipped).digest("hex"), gzip: zipped };
21696
21701
  });
21697
21702
  }
21698
- async function load(toolchainBin, release) {
21703
+ async function load(toolchainBin, sdk) {
21699
21704
  const { stdout } = await run(import_node_path8.default.join(toolchainBin, "swift"), [
21700
21705
  "sdk",
21701
21706
  "configure",
21702
21707
  "--show-configuration",
21703
- `${release}_wasm`,
21708
+ sdk,
21704
21709
  "wasm32-unknown-wasip1"
21705
21710
  ]);
21706
21711
  const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
21707
- if (!resources) throw new Error(`swift-icu: ${release}_wasm names no static resources`);
21712
+ if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
21708
21713
  return Buffer.from(
21709
21714
  icuSegment(archiveMember((0, import_node_fs8.readFileSync)(import_node_path8.default.join(resources, ARCHIVE)), MEMBER))
21710
21715
  );
@@ -21851,6 +21856,16 @@ function swiftDistributionAt(root) {
21851
21856
  if (!(0, import_node_fs9.existsSync)(file)) return null;
21852
21857
  return parseSwiftDistributionManifest(JSON.parse((0, import_node_fs9.readFileSync)(file, "utf8")));
21853
21858
  }
21859
+ function swiftModuleSdk(root) {
21860
+ const pin = swiftDistributionAt(root) ?? JSON.parse((0, import_node_fs9.readFileSync)(import_node_path9.default.join(root, "toolchain.json"), "utf8"));
21861
+ if (!pin || typeof pin !== "object" || typeof Reflect.get(pin, "wasmSdkId") !== "string" || typeof Reflect.get(pin, "wasmSdkUrl") !== "string" || typeof Reflect.get(pin, "wasmSdkChecksum") !== "string")
21862
+ throw new Error(`${root} pins no wasm SDK id, url and checksum`);
21863
+ return {
21864
+ wasmSdkId: String(Reflect.get(pin, "wasmSdkId")),
21865
+ wasmSdkUrl: String(Reflect.get(pin, "wasmSdkUrl")),
21866
+ wasmSdkChecksum: String(Reflect.get(pin, "wasmSdkChecksum"))
21867
+ };
21868
+ }
21854
21869
  function swiftModuleInputFiles(root) {
21855
21870
  if (swiftDistributionAt(root)) return [SWIFT_DISTRIBUTION_MANIFEST];
21856
21871
  const files = [
@@ -21862,7 +21877,7 @@ function swiftModuleInputFiles(root) {
21862
21877
  for (const entry of (0, import_node_fs9.readdirSync)(import_node_path9.default.join(root, dir), { withFileTypes: true })) {
21863
21878
  const relative2 = `${dir}/${entry.name}`;
21864
21879
  if (entry.isDirectory()) walk(relative2);
21865
- else if (/\.(swift|c|h)$/.test(entry.name)) files.push(relative2);
21880
+ else if (/\.(swift|c|cpp|h)$/.test(entry.name)) files.push(relative2);
21866
21881
  }
21867
21882
  };
21868
21883
  walk("Sources");
@@ -21940,14 +21955,18 @@ function withNativeSourceGlue(input, glue) {
21940
21955
  oneModule: true
21941
21956
  };
21942
21957
  }
21943
- function swiftSiblingDependencies(files, targets) {
21944
- const names = new Set(targets.map((target) => target.name));
21958
+ function swiftTargetDependencies(files, targets) {
21959
+ const names = /* @__PURE__ */ new Set([...OPTIONAL_FRAMEWORKS, ...targets.map((target) => target.name)]);
21945
21960
  const siblings = /* @__PURE__ */ new Map();
21946
21961
  for (const target of targets) {
21947
- const prefix = `${target.path}/`;
21962
+ const prefix = target.path === "." ? "" : `${target.path}/`;
21948
21963
  const deps = /* @__PURE__ */ new Set();
21949
21964
  for (const [file, contents] of Object.entries(files)) {
21950
21965
  if (file === "Package.swift" || !file.startsWith(prefix)) continue;
21966
+ if (targets.some(
21967
+ (candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
21968
+ ))
21969
+ continue;
21951
21970
  for (const match of contents.matchAll(
21952
21971
  /^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/gm
21953
21972
  )) {
@@ -21960,7 +21979,7 @@ function swiftSiblingDependencies(files, targets) {
21960
21979
  }
21961
21980
  function swiftArtifactHash(input, release, moduleRoot) {
21962
21981
  const hash = (0, import_node_crypto4.createHash)("sha256");
21963
- hash.update(`swift-compile/v7
21982
+ hash.update(`swift-compile/v12
21964
21983
  ${release}
21965
21984
  `);
21966
21985
  if (input.oneModule) hash.update("one-module\n");
@@ -21989,7 +22008,7 @@ ${release}
21989
22008
  hash.update(
21990
22009
  JSON.stringify({
21991
22010
  targets,
21992
- siblings: [...swiftSiblingDependencies(input.files, targets)].sort(
22011
+ siblings: [...swiftTargetDependencies(input.files, targets)].sort(
21993
22012
  (a, b) => String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0
21994
22013
  )
21995
22014
  })
@@ -21999,22 +22018,34 @@ ${release}
21999
22018
  }
22000
22019
  function emitSwiftPackageManifest(args) {
22001
22020
  const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
22021
+ const reachedFrameworks = new Set(
22022
+ [...siblings.values()].flat().filter(
22023
+ (name2) => OPTIONAL_FRAMEWORKS.has(name2) && !targets.some((target) => target.name === name2)
22024
+ ).flatMap((name2) => [name2, ...OPTIONAL_FRAMEWORK_DEPENDENCIES[name2] ?? []])
22025
+ );
22026
+ const distributionObjects = distribution?.objects.filter(
22027
+ (object) => [...OPTIONAL_FRAMEWORKS].every(
22028
+ (name2) => !object.startsWith(`lib/${name2}-`) || reachedFrameworks.has(name2)
22029
+ )
22030
+ );
22002
22031
  const executable = targets.find((target) => target.executable);
22003
22032
  if (!executable) throw new Error("swift-compile: no executable target to emit");
22004
22033
  const stanza = (target) => {
22005
22034
  const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
22006
22035
  const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path9.default.join(moduleRoot, "modules"))}` : "";
22007
- const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation} .unsafeFlags(["-Osize"${OBJC_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}])]`;
22036
+ const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation} .unsafeFlags(["-Osize"${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}])]`;
22008
22037
  const deps = [
22009
22038
  ...distribution ? [] : [
22010
22039
  '.product(name: "SwiftUI", package: "sootsim-swift")',
22011
22040
  ...oneModule ? [ONE_PRODUCT] : [],
22012
22041
  ...spriteKit ? [SPRITEKIT_PRODUCT] : []
22013
22042
  ],
22014
- ...(siblings.get(target.name) ?? []).map((sibling) => `"${sibling}"`)
22043
+ ...(siblings.get(target.name) ?? []).flatMap(
22044
+ (dependency) => OPTIONAL_FRAMEWORKS.has(dependency) && !targets.some((candidate) => candidate.name === dependency) ? distribution ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
22045
+ )
22015
22046
  ].join(", ");
22016
22047
  const library = distribution ? [
22017
- ...distribution.objects.map((object) => import_node_path9.default.join(moduleRoot, object)),
22048
+ ...(distributionObjects ?? []).map((object) => import_node_path9.default.join(moduleRoot, object)),
22018
22049
  ...distribution.link
22019
22050
  ].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
22020
22051
  const kind = target.executable ? ".executableTarget" : ".target";
@@ -22068,7 +22099,169 @@ function syncSwiftTree(base, files) {
22068
22099
  (0, import_node_fs9.writeFileSync)(full, contents, "utf8");
22069
22100
  }
22070
22101
  }
22071
- function swiftSourceAsIOS(source) {
22102
+ function splitTopLevel(text) {
22103
+ const parts = [];
22104
+ let depth = 0;
22105
+ let start = 0;
22106
+ for (let i = 0; i < text.length; i++) {
22107
+ const char = text[i];
22108
+ if (char === "(" || char === "[" || char === "<") depth++;
22109
+ else if (char === ")" || char === "]" || char === ">" && text[i - 1] !== "-")
22110
+ depth--;
22111
+ else if (char === "," && depth === 0) {
22112
+ parts.push(text.slice(start, i));
22113
+ start = i + 1;
22114
+ }
22115
+ }
22116
+ parts.push(text.slice(start));
22117
+ return parts.map((part) => part.trim()).filter((part) => part !== "");
22118
+ }
22119
+ function forwardedArguments(parameters) {
22120
+ const args = [];
22121
+ for (const parameter of splitTopLevel(parameters)) {
22122
+ const match = /^(?:([A-Za-z_]\w*)\s+)?([A-Za-z_]\w*)\s*:\s*([\s\S]*)$/.exec(parameter);
22123
+ if (!match || match[3].includes("...")) return null;
22124
+ const label = match[1] ?? match[2];
22125
+ const value = (/^(?:@\w+\s+)*inout\b/.test(match[3]) ? "&" : "") + match[2];
22126
+ args.push(label === "_" ? value : `${label}: ${value}`);
22127
+ }
22128
+ return args.join(", ");
22129
+ }
22130
+ function liftExtensionOverrides(source) {
22131
+ const { tokens } = swiftCodeScan(source);
22132
+ const stack = [];
22133
+ let pending = null;
22134
+ const classes = /* @__PURE__ */ new Map();
22135
+ let declaredBase = null;
22136
+ let declaredObjCMembers = false;
22137
+ const lifted = [];
22138
+ const closing = (open) => {
22139
+ let depth = 0;
22140
+ for (const at of tokens) {
22141
+ if (at < open) continue;
22142
+ if (source[at] === "{") depth++;
22143
+ else if (source[at] === "}" && --depth === 0) return at + 1;
22144
+ }
22145
+ return source.length;
22146
+ };
22147
+ for (const at of tokens) {
22148
+ const rest = source.slice(at, at + 600);
22149
+ if (rest.startsWith("{")) {
22150
+ const frame = pending ?? { kind: "other", name: "" };
22151
+ if (frame.kind === "class" && !classes.has(frame.name))
22152
+ classes.set(frame.name, {
22153
+ brace: at,
22154
+ base: declaredBase,
22155
+ objcMembers: declaredObjCMembers
22156
+ });
22157
+ stack.push(frame);
22158
+ pending = null;
22159
+ continue;
22160
+ }
22161
+ if (rest.startsWith("}")) {
22162
+ stack.pop();
22163
+ continue;
22164
+ }
22165
+ const declared = CLASS_DECL.exec(rest);
22166
+ if (declared) {
22167
+ pending = { kind: "class", name: declared[1] };
22168
+ declaredBase = CLASS_BASE.exec(rest)?.[2]?.split(".").pop() ?? null;
22169
+ const lines = source.lastIndexOf("\n", source.lastIndexOf("\n", at - 1) - 1) + 1;
22170
+ declaredObjCMembers = /@objcMembers\b/.test(source.slice(lines, at));
22171
+ continue;
22172
+ }
22173
+ const extended = EXTENSION_DECL.exec(rest);
22174
+ if (extended) {
22175
+ pending = { kind: "extension", name: extended[1].split(".").pop() };
22176
+ continue;
22177
+ }
22178
+ const top = stack.at(-1);
22179
+ if (!rest.startsWith("override") || top?.kind !== "extension" || pending) continue;
22180
+ const line = source.slice(source.lastIndexOf("\n", at - 1) + 1, at);
22181
+ const modifiers = (` ${line} `.match(MODIFIERS) ?? []).map((word) => word.trim());
22182
+ const func = OVERRIDE_FUNC.exec(rest);
22183
+ if (func) {
22184
+ const name2 = func[2];
22185
+ const open = at + func[0].length - 1;
22186
+ let depth = 0;
22187
+ let close = open;
22188
+ for (; close < source.length; close++) {
22189
+ if (source[close] === "(") depth++;
22190
+ else if (source[close] === ")" && --depth === 0) break;
22191
+ }
22192
+ const body = tokens.find((token) => token > close && source[token] === "{");
22193
+ if (body === void 0) continue;
22194
+ const clause = source.slice(close + 1, body).trim();
22195
+ const args = forwardedArguments(source.slice(open + 1, close));
22196
+ if (args === null) continue;
22197
+ const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name2}(${args})`;
22198
+ const signature = `func ${name2}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
22199
+ lifted.push({
22200
+ type: top.name,
22201
+ member: name2,
22202
+ stub: `${[...modifiers, "override"].join(" ")} ${signature} { ${call} };`,
22203
+ edits: [
22204
+ [at, "override".length, " ".repeat("override".length)],
22205
+ [
22206
+ at + rest.indexOf(
22207
+ name2,
22208
+ rest.indexOf("func", "override".length + func[1].length) + 4
22209
+ ),
22210
+ 0,
22211
+ "__peach_ext_"
22212
+ ]
22213
+ ]
22214
+ });
22215
+ continue;
22216
+ }
22217
+ const property = OVERRIDE_VAR.exec(rest);
22218
+ if (property) {
22219
+ const open = at + property[0].length - 1;
22220
+ if (/\b(?:set|willSet|didSet)\b/.test(source.slice(open, closing(open)))) continue;
22221
+ const name2 = property[2];
22222
+ lifted.push({
22223
+ type: top.name,
22224
+ member: name2,
22225
+ stub: `${[...modifiers, "override"].join(" ")} var ${name2}: ${property[3].trim()} { __peach_ext_${name2} };`,
22226
+ edits: [
22227
+ [at, "override".length, " ".repeat("override".length)],
22228
+ [at + rest.indexOf(name2, rest.indexOf("var")), 0, "__peach_ext_"]
22229
+ ]
22230
+ });
22231
+ }
22232
+ }
22233
+ const overridesObjC = (type, member) => {
22234
+ let base = classes.get(type)?.base ?? null;
22235
+ while (base !== null) {
22236
+ if (APPLE_CLASS.test(base)) return true;
22237
+ const declaredClass = classes.get(base);
22238
+ if (!declaredClass) return false;
22239
+ const body = source.slice(declaredClass.brace, closing(declaredClass.brace));
22240
+ const found = new RegExp(`\\b(?:func|var)\\s+${member}\\b`).exec(body);
22241
+ if (found) {
22242
+ const line = body.slice(body.lastIndexOf("\n", found.index) + 1, found.index);
22243
+ return declaredClass.objcMembers || /@objc\b/.test(line);
22244
+ }
22245
+ base = declaredClass.base;
22246
+ }
22247
+ return false;
22248
+ };
22249
+ const edits = [];
22250
+ const stubs = /* @__PURE__ */ new Map();
22251
+ for (const entry of lifted) {
22252
+ const brace = classes.get(entry.type)?.brace;
22253
+ if (brace === void 0 || !overridesObjC(entry.type, entry.member)) continue;
22254
+ edits.push(...entry.edits);
22255
+ stubs.set(brace, [...stubs.get(brace) ?? [], entry.stub]);
22256
+ }
22257
+ for (const [brace, list] of stubs) edits.push([brace + 1, 0, ` ${list.join(" ")}`]);
22258
+ let out = source;
22259
+ for (const [at, remove, insert] of edits.sort((a, b) => b[0] - a[0]))
22260
+ out = out.slice(0, at) + insert + out.slice(at + remove);
22261
+ return out;
22262
+ }
22263
+ function swiftSourceAsIOS(original) {
22264
+ const source = liftExtensionOverrides(original);
22072
22265
  const { lineStarts, tokens } = swiftCodeScan(source);
22073
22266
  let offset = 0;
22074
22267
  const conditioned = source.split("\n").map((line) => {
@@ -22079,8 +22272,30 @@ function swiftSourceAsIOS(source) {
22079
22272
  }).join("\n");
22080
22273
  let out = "";
22081
22274
  let copied = 0;
22275
+ const reusableViews = new Set(REUSABLE_VIEW_BASES);
22276
+ const reusableBodies = [];
22277
+ let depth = 0;
22278
+ let opensReusableBody = false;
22082
22279
  for (const at of tokens) {
22083
22280
  const rest = conditioned.slice(at, at + 400);
22281
+ if (rest.startsWith("{")) {
22282
+ depth++;
22283
+ if (opensReusableBody) reusableBodies.push(depth);
22284
+ opensReusableBody = false;
22285
+ continue;
22286
+ }
22287
+ if (rest.startsWith("}")) {
22288
+ if (reusableBodies.at(-1) === depth) reusableBodies.pop();
22289
+ depth--;
22290
+ continue;
22291
+ }
22292
+ if (rest.startsWith("override")) {
22293
+ if (REUSABLE_INIT.test(rest) || reusableBodies.at(-1) === depth && FRAME_INIT.test(rest)) {
22294
+ out += `${conditioned.slice(copied, at)}required`;
22295
+ copied = at + "override".length;
22296
+ }
22297
+ continue;
22298
+ }
22084
22299
  const imported = /^import\s+CoreImage\.CIFilterBuiltins\b/.exec(rest);
22085
22300
  if (imported) {
22086
22301
  out += conditioned.slice(copied, at) + "import CoreImage".padEnd(imported[0].length);
@@ -22093,6 +22308,11 @@ function swiftSourceAsIOS(source) {
22093
22308
  continue;
22094
22309
  }
22095
22310
  if (rest.startsWith("class")) {
22311
+ const declared = CLASS_BASE.exec(rest);
22312
+ if (declared && reusableViews.has(declared[2].split(".").pop())) {
22313
+ reusableViews.add(declared[1]);
22314
+ opensReusableBody = true;
22315
+ }
22096
22316
  const modifiers = conditioned.slice(conditioned.lastIndexOf("\n", at - 1) + 1, at);
22097
22317
  if (DELEGATE_CLASS.test(rest) && !/\b(?:final|open)\b/.test(modifiers)) {
22098
22318
  out += `${conditioned.slice(copied, at)}final `;
@@ -22107,6 +22327,8 @@ function swiftSourceAsIOS(source) {
22107
22327
  if (selector) replacement = "#Selector";
22108
22328
  else if (match[0] === "@objcMembers") replacement = "@ObjCMembers";
22109
22329
  else if (match[0] === "@IBAction") replacement = "@ObjC".padEnd(match[0].length);
22330
+ else if (TYPE_AFTER_ATTRIBUTE.test(rest.slice(match[0].length)))
22331
+ replacement = " ".repeat(match[0].length);
22110
22332
  else if (match[2] !== void 0)
22111
22333
  replacement = `@ObjC${match[1]}("${match[2].trim()}")`;
22112
22334
  out += conditioned.slice(copied, at) + replacement;
@@ -22185,6 +22407,9 @@ function swiftCodeScan(source) {
22185
22407
  if (hashes > 0) tokens.push(at - 1);
22186
22408
  i = Math.max(at, i + 1);
22187
22409
  }
22410
+ } else if (char === "{" || char === "}") {
22411
+ tokens.push(i);
22412
+ i++;
22188
22413
  } else if (char === "(") {
22189
22414
  top.parens++;
22190
22415
  i++;
@@ -22193,7 +22418,7 @@ function swiftCodeScan(source) {
22193
22418
  else top.parens--;
22194
22419
  i++;
22195
22420
  } else {
22196
- const keyword = source.startsWith("class", i) ? "class" : source.startsWith("import", i) ? "import" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : null;
22421
+ const keyword = source.startsWith("class", i) ? "class" : source.startsWith("extension", i) ? "extension" : source.startsWith("override", i) ? "override" : source.startsWith("import", i) ? "import" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : null;
22197
22422
  if (keyword && !/[\w$]/.test(source[i - 1] ?? "") && !/[\w$]/.test(source[i + keyword.length] ?? "")) {
22198
22423
  tokens.push(i);
22199
22424
  i += keyword.length;
@@ -22230,9 +22455,24 @@ function writeSwiftProject(layout, input, moduleRoot) {
22230
22455
  import_node_path9.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
22231
22456
  "utf8"
22232
22457
  ).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
22458
+ const optionalProducts = swiftTargetDependencies(input.files, [{ name: "App", path: "." }]).get("App") ?? [];
22459
+ if (optionalProducts.length > 0) {
22460
+ const product = '.product(name: "SwiftUI", package: "sootsim-swift"),';
22461
+ if (!manifest.includes(product))
22462
+ throw new Error("Swift app template lost its framework dependency anchor");
22463
+ manifest = manifest.replace(
22464
+ product,
22465
+ [
22466
+ product,
22467
+ ...optionalProducts.map(
22468
+ (name2) => `.product(name: "${name2}", package: "sootsim-swift"),`
22469
+ )
22470
+ ].join("\n ")
22471
+ );
22472
+ }
22233
22473
  if (input.oneModule) {
22234
22474
  const product = '.product(name: "CoreLocation", package: "sootsim-swift"),';
22235
- const flags = `"-Osize"${OBJC_IMPLICIT_FLAGS}`;
22475
+ const flags = `"-Osize"${FOUNDATION_IMPLICIT_FLAGS}`;
22236
22476
  if (!manifest.includes(product) || !manifest.includes(flags)) {
22237
22477
  throw new Error(
22238
22478
  "scripts/contrast-app-Package.swift lost the lines the One module links at"
@@ -22275,7 +22515,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
22275
22515
  import_node_path9.default.join(layout.root, "Package.swift"),
22276
22516
  emitSwiftPackageManifest({
22277
22517
  targets,
22278
- siblings: swiftSiblingDependencies(input.files, targets),
22518
+ siblings: swiftTargetDependencies(
22519
+ input.files,
22520
+ layout.multi ? targets : targets.map((target) => ({ ...target, path: "." }))
22521
+ ),
22279
22522
  moduleRoot,
22280
22523
  oneModule: input.oneModule,
22281
22524
  spriteKit: importsSpriteKit(input.files),
@@ -22350,7 +22593,8 @@ function compileSwiftProjectUnit(input, options) {
22350
22593
  );
22351
22594
  }
22352
22595
  const macroPlugins = await ensureMacroPlugins(moduleRoot, options.toolchainBin);
22353
- const icu = swiftIcuAsset(options.toolchainBin, options.release);
22596
+ const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
22597
+ const icu = swiftIcuAsset(options.toolchainBin, sdk);
22354
22598
  try {
22355
22599
  await run2(
22356
22600
  swift,
@@ -22361,7 +22605,7 @@ function compileSwiftProjectUnit(input, options) {
22361
22605
  "--package-path",
22362
22606
  root,
22363
22607
  "--swift-sdk",
22364
- `${options.release}_wasm`,
22608
+ sdk,
22365
22609
  "-c",
22366
22610
  "release",
22367
22611
  "-Xswiftc",
@@ -22385,7 +22629,7 @@ function compileSwiftProjectUnit(input, options) {
22385
22629
  };
22386
22630
  });
22387
22631
  }
22388
- var import_node_child_process5, import_node_crypto4, import_node_fs9, import_node_os3, import_node_path9, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, OBJC_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, DELEGATE_CLASS, compiledSource, ROOT_LOCKS, host, rootLocks;
22632
+ var import_node_child_process5, import_node_crypto4, import_node_fs9, import_node_os3, import_node_path9, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, compiledSource, ROOT_LOCKS, host, rootLocks;
22389
22633
  var init_swift_compile = __esm({
22390
22634
  "src/swift-compile.ts"() {
22391
22635
  "use strict";
@@ -22404,6 +22648,17 @@ var init_swift_compile = __esm({
22404
22648
  BUILD_ENV = { ...process.env, BINARYEN_CORES: String(Math.min(4, cores)) };
22405
22649
  BUILD_JOBS = String(Math.max(1, Math.floor(cores / 2)));
22406
22650
  linkedModuleDigests = /* @__PURE__ */ new Map();
22651
+ OPTIONAL_FRAMEWORK_DEPENDENCIES = {
22652
+ Accelerate: [],
22653
+ CryptoKit: [],
22654
+ Security: [],
22655
+ Statsig: [],
22656
+ DatadogCore: [],
22657
+ DatadogLogs: ["DatadogCore"],
22658
+ DatadogRUM: ["DatadogCore"],
22659
+ DatadogTrace: ["DatadogCore"]
22660
+ };
22661
+ OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES));
22407
22662
  ONE_PRODUCT = '.product(name: "One", package: "sootsim-swift")';
22408
22663
  SPRITEKIT_PRODUCT = '.product(name: "SpriteKit", package: "sootsim-swift")';
22409
22664
  importsSpriteKit = (files) => Object.entries(files).some(
@@ -22411,14 +22666,29 @@ var init_swift_compile = __esm({
22411
22666
  contents
22412
22667
  )
22413
22668
  );
22414
- OBJC_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC"';
22669
+ FOUNDATION_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC", "-Xfrontend", "-import-module", "-Xfrontend", "Dispatch", "-Xfrontend", "-import-module", "-Xfrontend", "FoundationNetworking"';
22415
22670
  ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
22416
- MULTI_MANIFEST_VERSION = 7;
22671
+ MULTI_MANIFEST_VERSION = 10;
22417
22672
  DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
22418
22673
  OS_IOS = /\bos\(\s*iOS\s*\)/g;
22419
22674
  OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
22420
22675
  SELECTOR = /^#selector\b/;
22676
+ TYPE_AFTER_ATTRIBUTE = /^(?:\s+|\/\/[^\n]*|\/\*[\s\S]*?\*\/|@\w+(?:\([^()]*\))?|\b(?:public|open|final|internal|fileprivate|private|package|nonisolated|indirect)\b)*\b(?:class(?!\s+(?:func|var|let|subscript)\b)|struct|enum|protocol|extension|actor)\b/;
22421
22677
  DELEGATE_CLASS = /^class\s+[A-Za-z_]\w*\s*(?:<[^>{]*>)?\s*:[^{]*\b(?:UIApplicationDelegate|UISceneDelegate|UIWindowSceneDelegate)\b[^{]*\{/;
22678
+ REUSABLE_INIT = /^override(?=\s+init\s*\(\s*(?:style\s*:[^,)]*,\s*reuseIdentifier|reuseIdentifier)\s*:)/;
22679
+ REUSABLE_VIEW_BASES = [
22680
+ "UICollectionReusableView",
22681
+ "UICollectionViewCell",
22682
+ "UICollectionViewListCell"
22683
+ ];
22684
+ CLASS_BASE = /^class\s+([A-Za-z_]\w*)\s*(?:<[^>{]*>)?\s*:\s*([A-Za-z_][\w.]*)[^{]*\{/;
22685
+ FRAME_INIT = /^override(?=\s+(?:(?:public|open|internal)\s+)?init\s*\(\s*frame\s*:)/;
22686
+ APPLE_CLASS = /^(?:UI|NS|CA|SK|WK|MK|AV|PK|CL|GK|PH|SF|AS|QL)[A-Z]/;
22687
+ EXTENSION_DECL = /^extension\s+([A-Za-z_][\w.]*)/;
22688
+ CLASS_DECL = /^class\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/;
22689
+ MODIFIERS = /(?:^|\s)(public|open|internal|fileprivate|private|final|nonisolated|@MainActor)(?=\s)/g;
22690
+ OVERRIDE_FUNC = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+func\s+([A-Za-z_]\w*)\s*(<[^>{}]*>)?\s*\(/;
22691
+ OVERRIDE_VAR = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+var\s+([A-Za-z_]\w*)\s*:\s*([^{=]+?)\s*\{/;
22422
22692
  compiledSource = (file, contents) => file.endsWith(".swift") ? swiftSourceAsIOS(contents) : contents;
22423
22693
  ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
22424
22694
  host = globalThis;
@@ -22431,22 +22701,24 @@ var swift_distribution_lock_default;
22431
22701
  var init_swift_distribution_lock = __esm({
22432
22702
  "src/swift-distribution.lock.json"() {
22433
22703
  swift_distribution_lock_default = {
22434
- id: "6f2d91274094c8af",
22704
+ id: "37329dbb7d21fea3",
22435
22705
  release: "swift-6.3-RELEASE",
22436
- wasmSdkChecksum: "9fa4016ee632c7e9e906608ec3b55cf13dfc4dff44e47574c5af58064dc33fd9",
22437
- source: "27df8ca4ecdc5369d51f08fe54ac32a1f21c5949",
22706
+ wasmSdkId: "swift-6.3-RELEASE_wasm-peach-503c2533",
22707
+ wasmSdkUrl: "https://r2.sootsim.com/swift-wasm-sdk/swift-6.3-RELEASE_wasm-peach-503c2533.artifactbundle.tar.gz",
22708
+ wasmSdkChecksum: "00fd9cc559652638552cc19c27624ea350f30bb866d87c41bbfe97d2ae1810eb",
22709
+ source: "dd8c803162eb6e23ce3fca4ab40d5eedf8717d9f",
22438
22710
  hosts: {
22439
22711
  "darwin-arm64": {
22440
- sha256: "606751627cfeafedfeb6a0abefc7f9a734935b7fd222d93ead096a6d89695a98",
22441
- size: 4551053
22712
+ sha256: "b00c5daa751bd315c8157bddb2dc5037b475c3587e4040d12ccb624bfe3f1bb2",
22713
+ size: 6796662
22442
22714
  },
22443
22715
  "linux-x64": {
22444
- sha256: "7d7cb0adc43af4b83576979693a9a4994abca5d773e5550f4f154939fe08b091",
22445
- size: 4556463
22716
+ sha256: "d3f00367c7d3858e922574a49f5c80281fecaa0b2fc595f43c6bbdfc1aed9ac6",
22717
+ size: 6802137
22446
22718
  },
22447
22719
  "linux-arm64": {
22448
- sha256: "78c7c76b8a29a3ec797cd410fd882a6f1dfb349f1785e0cf5cf0d8aebb2d96a9",
22449
- size: 4555726
22720
+ sha256: "2b58ae90a2c2c9709a6487ada493e2f556e74db42d16ebb93bc819e60139b363",
22721
+ size: 6801173
22450
22722
  }
22451
22723
  }
22452
22724
  };
@@ -22468,8 +22740,8 @@ function swiftToolchainBin(release) {
22468
22740
  if (import_node_fs10.default.existsSync(import_node_path10.default.join(image, "swift"))) return image;
22469
22741
  return (process.env.PATH ?? "").split(import_node_path10.default.delimiter).find((dir) => dir && import_node_fs10.default.existsSync(import_node_path10.default.join(dir, "swift"))) ?? image;
22470
22742
  }
22471
- function swiftToolchain(release, wasmSdkChecksum) {
22472
- const cached4 = verified.get(release);
22743
+ function swiftToolchain(release, sdk) {
22744
+ const cached4 = verified.get(`${release}\0${sdk.wasmSdkId}`);
22473
22745
  if (cached4) return cached4;
22474
22746
  const bin = swiftToolchainBin(release);
22475
22747
  const swift = import_node_path10.default.join(bin, "swift");
@@ -22481,26 +22753,26 @@ function swiftToolchain(release, wasmSdkChecksum) {
22481
22753
  const found = version ? `found ${version.split("\n")[0]?.trim()} at ${swift}` : process.platform === "darwin" ? `found no ${release}.xctoolchain in ~/Library/Developer/Toolchains or /Library/Developer/Toolchains` : "found no swift on PATH";
22482
22754
  throw new Error(
22483
22755
  `peach compiles Swift with the swift.org toolchain ${release} and its wasm SDK; ${found}.
22484
- ${swiftInstallSteps(release, wasmSdkChecksum)}`
22756
+ ${swiftInstallSteps(release, sdk)}`
22485
22757
  );
22486
22758
  }
22487
22759
  const sdks = (0, import_node_child_process6.execFileSync)(swift, ["sdk", "list"], {
22488
22760
  encoding: "utf8",
22489
22761
  stdio: ["ignore", "pipe", "pipe"]
22490
22762
  });
22491
- if (!sdks.split("\n").some((line) => line.trim() === `${release}_wasm`)) {
22763
+ if (!sdks.split("\n").some((line) => line.trim() === sdk.wasmSdkId)) {
22492
22764
  throw new Error(
22493
- `peach compiles Swift with the ${release}_wasm SDK, which ${swift} does not have.
22494
- ${swiftInstallSteps(release, wasmSdkChecksum)}`
22765
+ `peach compiles Swift with the ${sdk.wasmSdkId} SDK, which ${swift} does not have.
22766
+ ${swiftInstallSteps(release, sdk)}`
22495
22767
  );
22496
22768
  }
22497
- verified.set(release, bin);
22769
+ verified.set(`${release}\0${sdk.wasmSdkId}`, bin);
22498
22770
  return bin;
22499
22771
  }
22500
- function swiftInstallSteps(release, wasmSdkChecksum) {
22772
+ function swiftInstallSteps(release, wasmSdk) {
22501
22773
  const version = release.replace(/^swift-/, "").toLowerCase();
22502
22774
  const downloads = `https://download.swift.org/swift-${version}`;
22503
- const sdk = `swift sdk install ${downloads}/wasm-sdk/${release}/${release}_wasm.artifactbundle.tar.gz --checksum ${wasmSdkChecksum}`;
22775
+ const sdk = `swift sdk install ${wasmSdk.wasmSdkUrl} --checksum ${wasmSdk.wasmSdkChecksum}`;
22504
22776
  if (process.platform === "darwin") {
22505
22777
  const swift = `~/Library/Developer/Toolchains/${release}.xctoolchain/usr/bin/swift`;
22506
22778
  return [
@@ -22542,7 +22814,7 @@ function swiftDistributionRoot() {
22542
22814
  `peach has no Swift distribution for ${process.platform}-${process.arch}; it ships for macOS arm64 and Linux x64 and arm64`
22543
22815
  );
22544
22816
  }
22545
- swiftToolchain(lock.release, lock.wasmSdkChecksum);
22817
+ swiftToolchain(lock.release, lock);
22546
22818
  const dir = import_node_path11.default.join(rnxHomeDir(), "swift", `${lock.id}-${host2}`);
22547
22819
  let pending = installs.get(dir);
22548
22820
  if (!pending) {
@@ -22591,7 +22863,7 @@ function swiftModuleToolchain(root) {
22591
22863
  const pin = swiftDistributionAt(root) ?? JSON.parse(import_node_fs11.default.readFileSync(import_node_path11.default.join(root, "toolchain.json"), "utf8"));
22592
22864
  return {
22593
22865
  release: pin.release,
22594
- toolchainBin: swiftToolchain(pin.release, pin.wasmSdkChecksum)
22866
+ toolchainBin: swiftToolchain(pin.release, swiftModuleSdk(root))
22595
22867
  };
22596
22868
  }
22597
22869
  var import_node_fs11, import_node_path11, import_meta2, SWIFT_ENDPOINT_ENV, installs;
@@ -23254,7 +23526,7 @@ var init_swift_submit = __esm({
23254
23526
  MAX_SWIFT_COMPILE_IMAGES = 128;
23255
23527
  MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
23256
23528
  MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
23257
- SWIFT_HOST_ABI = 5;
23529
+ SWIFT_HOST_ABI = 15;
23258
23530
  POLL_INTERVAL_MS = 1500;
23259
23531
  }
23260
23532
  });
@@ -25593,15 +25865,34 @@ function resolveFetchProxyTargetUrl(requested) {
25593
25865
  const replacement = PUBLIC_RPC_BY_QUICKNODE_CHAIN[chain];
25594
25866
  return replacement ? new URL(replacement) : requested;
25595
25867
  }
25596
- function getFetchProxyTargetHeaders(targetUrl, nativeUserAgent) {
25597
- const hostOverrides = headerOverridesFor(targetUrl.hostname);
25868
+ function buildFetchProxyUpstreamHeaders(requestHeaders, targetUrl) {
25869
+ const headers = {};
25870
+ let nativeUserAgent;
25871
+ for (const [rawKey, value] of requestHeaders) {
25872
+ const key = rawKey.toLowerCase();
25873
+ if (key === FETCH_PROXY_NATIVE_USER_AGENT_HEADER) nativeUserAgent = value;
25874
+ if (STRIP_FETCH_PROXY_REQUEST_HEADERS.has(key) || key.startsWith("x-forwarded-")) {
25875
+ continue;
25876
+ }
25877
+ headers[key] = value;
25878
+ }
25879
+ if (!targetUrl) return headers;
25598
25880
  return {
25881
+ ...headers,
25599
25882
  "accept-encoding": "identity",
25600
25883
  ...nativeUserAgent ? { "user-agent": nativeUserAgent } : {},
25601
- ...hostOverrides?.headers
25884
+ ...headerOverridesFor(targetUrl.hostname)?.headers
25602
25885
  };
25603
25886
  }
25604
- var FETCH_PROXY_NATIVE_USER_AGENT_HEADER, HOST_HEADER_OVERRIDES, PUBLIC_RPC_TENANT, QUICKNODE_HOST_SUFFIX, PUBLIC_RPC_BY_QUICKNODE_CHAIN;
25887
+ function nodeRequestHeaderEntries(headers) {
25888
+ const entries = [];
25889
+ for (const [key, value] of Object.entries(headers)) {
25890
+ if (!value) continue;
25891
+ entries.push([key, Array.isArray(value) ? value.join(", ") : value]);
25892
+ }
25893
+ return entries;
25894
+ }
25895
+ var FETCH_PROXY_NATIVE_USER_AGENT_HEADER, HOST_HEADER_OVERRIDES, PUBLIC_RPC_TENANT, QUICKNODE_HOST_SUFFIX, PUBLIC_RPC_BY_QUICKNODE_CHAIN, STRIP_FETCH_PROXY_REQUEST_HEADERS;
25605
25896
  var init_fetch_proxy_overrides = __esm({
25606
25897
  "src/host/fetch-proxy-overrides.ts"() {
25607
25898
  "use strict";
@@ -25630,6 +25921,29 @@ var init_fetch_proxy_overrides = __esm({
25630
25921
  "soneium-mainnet": "https://soneium-rpc.publicnode.com",
25631
25922
  "unichain-mainnet": "https://unichain-rpc.publicnode.com"
25632
25923
  };
25924
+ STRIP_FETCH_PROXY_REQUEST_HEADERS = /* @__PURE__ */ new Set([
25925
+ "host",
25926
+ "x-forwarded",
25927
+ "x-real-ip",
25928
+ "forwarded",
25929
+ "origin",
25930
+ "referer",
25931
+ "user-agent",
25932
+ "accept-encoding",
25933
+ "cookie",
25934
+ "connection",
25935
+ "keep-alive",
25936
+ "transfer-encoding",
25937
+ "upgrade",
25938
+ "content-length",
25939
+ "sec-fetch-site",
25940
+ "sec-fetch-mode",
25941
+ "sec-fetch-dest",
25942
+ "sec-ch-ua",
25943
+ "sec-ch-ua-mobile",
25944
+ "sec-ch-ua-platform",
25945
+ FETCH_PROXY_NATIVE_USER_AGENT_HEADER
25946
+ ]);
25633
25947
  }
25634
25948
  });
25635
25949
 
@@ -25647,19 +25961,7 @@ function applyFetchProxyCors(res) {
25647
25961
  }
25648
25962
  }
25649
25963
  function buildFetchProxyHeaders(reqHeaders, targetUrl) {
25650
- const headers = {};
25651
- for (const [key, value] of Object.entries(reqHeaders)) {
25652
- if (!value) continue;
25653
- if (STRIP_FETCH_PROXY_HEADERS.has(key.toLowerCase())) continue;
25654
- headers[key] = Array.isArray(value) ? value.join(", ") : value;
25655
- }
25656
- const rawNativeUserAgent = reqHeaders[FETCH_PROXY_NATIVE_USER_AGENT_HEADER];
25657
- const nativeUserAgent = Array.isArray(rawNativeUserAgent) ? rawNativeUserAgent[0] : rawNativeUserAgent;
25658
- Object.assign(
25659
- headers,
25660
- targetUrl ? getFetchProxyTargetHeaders(targetUrl, nativeUserAgent) : {}
25661
- );
25662
- return headers;
25964
+ return buildFetchProxyUpstreamHeaders(nodeRequestHeaderEntries(reqHeaders), targetUrl);
25663
25965
  }
25664
25966
  function buildAppApiProxyHeaders(reqHeaders, targetUrl) {
25665
25967
  const headers = {};
@@ -25708,16 +26010,6 @@ async function handleFetchProxyRequest(req, res) {
25708
26010
  res.end("invalid url param");
25709
26011
  return;
25710
26012
  }
25711
- let body;
25712
- if (req.method !== "GET" && req.method !== "HEAD") {
25713
- const chunks = [];
25714
- for await (const chunk of req) {
25715
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
25716
- }
25717
- if (chunks.length > 0) {
25718
- body = Buffer.concat(chunks);
25719
- }
25720
- }
25721
26013
  const originalMethod = req.method || "GET";
25722
26014
  const proxy = async (targetUrl2, method, nextBody, redirects) => {
25723
26015
  const transport = targetUrl2.protocol === "https:" ? import_https.default : import_http2.default;
@@ -25789,7 +26081,17 @@ async function handleFetchProxyRequest(req, res) {
25789
26081
  res.statusCode = status;
25790
26082
  await (0, import_promises4.pipeline)(proxyRes, res);
25791
26083
  };
26084
+ let body;
25792
26085
  try {
26086
+ if (req.method !== "GET" && req.method !== "HEAD") {
26087
+ const chunks = [];
26088
+ for await (const chunk of req) {
26089
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
26090
+ }
26091
+ if (chunks.length > 0) {
26092
+ body = Buffer.concat(chunks);
26093
+ }
26094
+ }
25793
26095
  await proxy(upstreamUrl, originalMethod, body, 0);
25794
26096
  } catch (err) {
25795
26097
  const norm = normalizeHostname(upstreamUrl.hostname);
@@ -25901,7 +26203,7 @@ function handleAppApiRequest(req, res) {
25901
26203
  req.pipe(proxyReq);
25902
26204
  return true;
25903
26205
  }
25904
- var import_http2, import_https, import_promises4, fetchProxyHttpAgent, fetchProxyHttpsAgent, STRIP_FETCH_PROXY_HEADERS, FETCH_PROXY_CORS_HEADERS, APP_API_HEADER_REWRITES;
26206
+ var import_http2, import_https, import_promises4, fetchProxyHttpAgent, fetchProxyHttpsAgent, FETCH_PROXY_CORS_HEADERS, APP_API_HEADER_REWRITES;
25905
26207
  var init_fetch_proxy_handler = __esm({
25906
26208
  "src/host/fetch-proxy-handler.ts"() {
25907
26209
  "use strict";
@@ -25912,26 +26214,6 @@ var init_fetch_proxy_handler = __esm({
25912
26214
  init_fetch_proxy_overrides();
25913
26215
  fetchProxyHttpAgent = new import_http2.default.Agent({ keepAlive: true, maxSockets: 256 });
25914
26216
  fetchProxyHttpsAgent = new import_https.default.Agent({ keepAlive: true, maxSockets: 256 });
25915
- STRIP_FETCH_PROXY_HEADERS = /* @__PURE__ */ new Set([
25916
- "host",
25917
- "origin",
25918
- "referer",
25919
- "user-agent",
25920
- "accept-encoding",
25921
- "cookie",
25922
- "connection",
25923
- "keep-alive",
25924
- "transfer-encoding",
25925
- "upgrade",
25926
- "content-length",
25927
- "sec-fetch-site",
25928
- "sec-fetch-mode",
25929
- "sec-fetch-dest",
25930
- "sec-ch-ua",
25931
- "sec-ch-ua-mobile",
25932
- "sec-ch-ua-platform",
25933
- FETCH_PROXY_NATIVE_USER_AGENT_HEADER
25934
- ]);
25935
26217
  FETCH_PROXY_CORS_HEADERS = {
25936
26218
  "access-control-allow-origin": "*",
25937
26219
  "access-control-allow-methods": "GET,POST,PUT,DELETE,PATCH,OPTIONS",
@@ -27472,6 +27754,10 @@ function getDevice(model, posture, orientation, landscapeSide) {
27472
27754
  housing: { rail: uniformFrameInsets(4.3333), hingeBarrel: null },
27473
27755
  cameraCutout: null,
27474
27756
  physicalPPI: 430,
27757
+ // focused keyboard frames on the ios 27.1 duo simulator's inner display:
27758
+ // qwerty (0,442,951,227), number pad 220, emoji (0,349,951,320)pt
27759
+ // (plans/contrast/duo-platform.md)
27760
+ keyboardPanelHeights: { qwerty: 227, pad: 220, emoji: 320 },
27475
27761
  posture: "open",
27476
27762
  // the fold band exists on the open profile even though the os region
27477
27763
  // reads inactive while flat; two-group compositions anchor to its centre.
@@ -27546,7 +27832,7 @@ var init_devices = __esm({
27546
27832
  iosVersion: "27.0",
27547
27833
  // no native device has this geometry; carries the iphone 16 keyboard
27548
27834
  // height so the experimental profile still shows a keyboard.
27549
- keyboardHeight: 308,
27835
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27550
27836
  physicalPPI: 110,
27551
27837
  hardwareButtons: modernButtons(
27552
27838
  [185.8, 41.7],
@@ -27574,7 +27860,7 @@ var init_devices = __esm({
27574
27860
  dynamicIsland: null,
27575
27861
  safeAreaInsets: { top: 20, bottom: 0, left: 0, right: 0 },
27576
27862
  iosVersion: "27.0",
27577
- keyboardHeight: 233,
27863
+ keyboardPanelHeights: { qwerty: 226, pad: 226, emoji: 320 },
27578
27864
  physicalPPI: 326,
27579
27865
  hardwareButtons: LEGACY_HARDWARE_BUTTONS
27580
27866
  }),
@@ -27593,7 +27879,7 @@ var init_devices = __esm({
27593
27879
  dynamicIsland: null,
27594
27880
  safeAreaInsets: { top: 47, bottom: 34, left: 0, right: 0 },
27595
27881
  iosVersion: "27.0",
27596
- keyboardHeight: 308,
27882
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27597
27883
  physicalPPI: 460,
27598
27884
  hardwareButtons: modernButtons(
27599
27885
  [141.7, 29.7],
@@ -27618,7 +27904,7 @@ var init_devices = __esm({
27618
27904
  statusRowCenter: 32.75,
27619
27905
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27620
27906
  iosVersion: "27.0",
27621
- keyboardHeight: 308,
27907
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27622
27908
  physicalPPI: 460,
27623
27909
  hardwareButtons: modernButtons(
27624
27910
  [171.7, 32],
@@ -27643,7 +27929,7 @@ var init_devices = __esm({
27643
27929
  statusRowCenter: 30.05,
27644
27930
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27645
27931
  iosVersion: "27.0",
27646
- keyboardHeight: 318,
27932
+ keyboardPanelHeights: { qwerty: 311, pad: 311, emoji: 405 },
27647
27933
  physicalPPI: 460,
27648
27934
  hardwareButtons: modernButtons(
27649
27935
  [172.1, 33],
@@ -27668,7 +27954,7 @@ var init_devices = __esm({
27668
27954
  statusRowCenter: 32.4,
27669
27955
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27670
27956
  iosVersion: "27.0",
27671
- keyboardHeight: 308,
27957
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27672
27958
  physicalPPI: 460,
27673
27959
  hardwareButtons: modernButtons(
27674
27960
  [159.1, 31.5],
@@ -27693,7 +27979,7 @@ var init_devices = __esm({
27693
27979
  statusRowCenter: 32.3,
27694
27980
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27695
27981
  iosVersion: "27.0",
27696
- keyboardHeight: 318,
27982
+ keyboardPanelHeights: { qwerty: 311, pad: 311, emoji: 405 },
27697
27983
  physicalPPI: 460,
27698
27984
  hardwareButtons: modernButtons(
27699
27985
  [173.3, 32.2],
@@ -27722,7 +28008,7 @@ var init_devices = __esm({
27722
28008
  statusRowCenter: 29.65,
27723
28009
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27724
28010
  iosVersion: "27.0",
27725
- keyboardHeight: 308,
28011
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27726
28012
  physicalPPI: 460,
27727
28013
  hardwareButtons: modernButtons(
27728
28014
  [159.1, 31.5],
@@ -27747,7 +28033,7 @@ var init_devices = __esm({
27747
28033
  statusRowCenter: 30.05,
27748
28034
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27749
28035
  iosVersion: "27.0",
27750
- keyboardHeight: 318,
28036
+ keyboardPanelHeights: { qwerty: 311, pad: 311, emoji: 405 },
27751
28037
  physicalPPI: 460,
27752
28038
  hardwareButtons: modernButtons(
27753
28039
  [173.3, 32.2],
@@ -27774,7 +28060,7 @@ var init_devices = __esm({
27774
28060
  statusRowCenter: 32.5,
27775
28061
  safeAreaInsets: { top: 62, bottom: 34, left: 0, right: 0 },
27776
28062
  iosVersion: "27.0",
27777
- keyboardHeight: 308,
28063
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27778
28064
  physicalPPI: 460,
27779
28065
  hardwareButtons: modernButtons(
27780
28066
  [159.1, 31.5],
@@ -27802,7 +28088,7 @@ var init_devices = __esm({
27802
28088
  statusRowCenter: 33,
27803
28089
  safeAreaInsets: { top: 62, bottom: 34, left: 0, right: 0 },
27804
28090
  iosVersion: "27.0",
27805
- keyboardHeight: 318,
28091
+ keyboardPanelHeights: { qwerty: 311, pad: 311, emoji: 405 },
27806
28092
  physicalPPI: 460,
27807
28093
  hardwareButtons: modernButtons(
27808
28094
  [178.8, 32.2],
@@ -27828,7 +28114,7 @@ var init_devices = __esm({
27828
28114
  statusRowCenter: 32.65,
27829
28115
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27830
28116
  iosVersion: "27.0",
27831
- keyboardHeight: 308,
28117
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27832
28118
  physicalPPI: 460,
27833
28119
  hardwareButtons: modernButtons(
27834
28120
  [159.1, 31.5],
@@ -27871,7 +28157,7 @@ var init_devices = __esm({
27871
28157
  statusRowCenter: 39,
27872
28158
  safeAreaInsets: { top: 59, bottom: 34, left: 0, right: 0 },
27873
28159
  iosVersion: "27.0",
27874
- keyboardHeight: 318,
28160
+ keyboardPanelHeights: { qwerty: 311, pad: 311, emoji: 405 },
27875
28161
  physicalPPI: 460,
27876
28162
  hardwareButtons: modernButtons(
27877
28163
  [178.8, 32.2],
@@ -27904,7 +28190,7 @@ var init_devices = __esm({
27904
28190
  statusRowCenter: 33,
27905
28191
  safeAreaInsets: { top: 62, bottom: 34, left: 0, right: 0 },
27906
28192
  iosVersion: "27.0",
27907
- keyboardHeight: 308,
28193
+ keyboardPanelHeights: { qwerty: 301, pad: 301, emoji: 395 },
27908
28194
  physicalPPI: 460,
27909
28195
  hardwareButtons: modernButtons(
27910
28196
  [159.1, 31.5],
@@ -27932,7 +28218,7 @@ var init_devices = __esm({
27932
28218
  statusRowCenter: 33,
27933
28219
  safeAreaInsets: { top: 62, bottom: 34, left: 0, right: 0 },
27934
28220
  iosVersion: "27.0",
27935
- keyboardHeight: 318,
28221
+ keyboardPanelHeights: { qwerty: 311, pad: 311, emoji: 405 },
27936
28222
  physicalPPI: 460,
27937
28223
  hardwareButtons: modernButtons(
27938
28224
  [178.8, 32.2],
@@ -27989,7 +28275,10 @@ var init_devices = __esm({
27989
28275
  // 84pt trailing Vertical Bar on the outer display (Apple iOS 27 UI kit).
27990
28276
  safeAreaInsets: { top: 0, bottom: 34, left: 0, right: 84 },
27991
28277
  iosVersion: "27.1",
27992
- keyboardHeight: 0,
28278
+ // focused keyboard frames on the ios 27.1 duo simulator's cover: qwerty
28279
+ // (0,426,466,252), number pad 256, emoji (0,340,466,338)pt
28280
+ // (plans/contrast/duo-platform.md)
28281
+ keyboardPanelHeights: { qwerty: 252, pad: 256, emoji: 338 },
27993
28282
  physicalPPI: 460,
27994
28283
  // official model extraction for button positions is outside this slice.
27995
28284
  hardwareButtons: modernButtons([0, 0], [0, 0], [0, 0], [0, 0]),
@@ -28037,7 +28326,7 @@ var init_devices = __esm({
28037
28326
  iosVersion: "27.0",
28038
28327
  // portrait docked keyboard, UIKeyboardFrameEndUserInfoKey
28039
28328
  // {0, 870, 834, 340}. landscape posted a zero-height frame.
28040
- keyboardHeight: 340,
28329
+ keyboardPanelHeights: { qwerty: 333, pad: 333, emoji: 427 },
28041
28330
  // hypot(1668, 2420) / 11, measured native pixels over the device type's
28042
28331
  // 11-inch name. not a separate density read.
28043
28332
  physicalPPI: 267.19578360606573,
@@ -28057,7 +28346,7 @@ var init_devices = __esm({
28057
28346
  navigationBarHeight: ANDROID_GESTURE_NAV_BAR_HEIGHT,
28058
28347
  // not measured on an android emulator yet: this is the iphone 16 figure
28059
28348
  // the engine used for every device before per-device heights landed.
28060
- keyboardHeight: 308,
28349
+ keyboardPanelHeights: { qwerty: 308, pad: 308, emoji: 395 },
28061
28350
  navigationBarMode: "gesture",
28062
28351
  displayCutout: {
28063
28352
  top: PIXEL_8_STATUS_BAR_HEIGHT,
@@ -28107,7 +28396,7 @@ var init_devices = __esm({
28107
28396
  navigationBarHeight: 48,
28108
28397
  // not measured on an android emulator yet: this is the iphone 16 figure
28109
28398
  // the engine used for every device before per-device heights landed.
28110
- keyboardHeight: 308,
28399
+ keyboardPanelHeights: { qwerty: 308, pad: 308, emoji: 395 },
28111
28400
  navigationBarMode: "three-button",
28112
28401
  displayCutout: {
28113
28402
  top: PIXEL_8_STATUS_BAR_HEIGHT,
@@ -28154,7 +28443,7 @@ var init_devices = __esm({
28154
28443
  navigationBarHeight: ANDROID_GESTURE_NAV_BAR_HEIGHT,
28155
28444
  // not measured on an android emulator yet: this is the iphone 16 figure
28156
28445
  // the engine used for every device before per-device heights landed.
28157
- keyboardHeight: 308,
28446
+ keyboardPanelHeights: { qwerty: 308, pad: 308, emoji: 395 },
28158
28447
  navigationBarMode: "gesture",
28159
28448
  displayCutout: { top: 40, bottom: 0, left: 0, right: 0 },
28160
28449
  cornerRadius: cornerRadii(41),
@@ -28192,7 +28481,7 @@ var init_devices = __esm({
28192
28481
  navigationBarHeight: ANDROID_GESTURE_NAV_BAR_HEIGHT,
28193
28482
  // not measured on an android emulator yet: this is the iphone 16 figure
28194
28483
  // the engine used for every device before per-device heights landed.
28195
- keyboardHeight: 308,
28484
+ keyboardPanelHeights: { qwerty: 308, pad: 308, emoji: 395 },
28196
28485
  navigationBarMode: "gesture",
28197
28486
  displayCutout: { top: 40, bottom: 0, left: 0, right: 0 },
28198
28487
  cornerRadius: cornerRadii(40),
@@ -28231,7 +28520,7 @@ var init_devices = __esm({
28231
28520
  navigationBarHeight: ANDROID_GESTURE_NAV_BAR_HEIGHT,
28232
28521
  // not measured on an android emulator yet: this is the iphone 16 figure
28233
28522
  // the engine used for every device before per-device heights landed.
28234
- keyboardHeight: 308,
28523
+ keyboardPanelHeights: { qwerty: 308, pad: 308, emoji: 395 },
28235
28524
  navigationBarMode: "gesture",
28236
28525
  displayCutout: { top: 36, bottom: 0, left: 0, right: 0 },
28237
28526
  cornerRadius: cornerRadii(36),
@@ -28271,7 +28560,7 @@ var init_devices = __esm({
28271
28560
  navigationBarHeight: ANDROID_GESTURE_NAV_BAR_HEIGHT,
28272
28561
  // not measured on an android emulator yet: this is the iphone 16 figure
28273
28562
  // the engine used for every device before per-device heights landed.
28274
- keyboardHeight: 308,
28563
+ keyboardPanelHeights: { qwerty: 308, pad: 308, emoji: 395 },
28275
28564
  navigationBarMode: "gesture",
28276
28565
  displayCutout: { top: 36, bottom: 0, left: 0, right: 0 },
28277
28566
  cornerRadius: cornerRadii(24),
@@ -30363,6 +30652,7 @@ var init_cloud_contract = __esm({
30363
30652
  flowStatus: "drive",
30364
30653
  reset: "reset",
30365
30654
  camera: "media",
30655
+ location: "media",
30366
30656
  // string evaluation and arbitrary bridge calls are maestro's boundary: the
30367
30657
  // customer sdk never carries this scope, and the service grants it only to
30368
30658
  // the account api key caller. close rides along, since ending the page ends
@@ -31203,12 +31493,12 @@ var init_cloud_client = __esm({
31203
31493
  init_metro_fingerprint();
31204
31494
  init_backend_origin();
31205
31495
  init_cloud_contract();
31496
+ init_is_record();
31206
31497
  init_metro_production_bundle();
31207
31498
  init_public_brand();
31208
31499
  init_auth();
31209
31500
  init_cloud_session();
31210
31501
  init_detect();
31211
- init_is_record();
31212
31502
  DEFAULT_RNX_CLOUD_ORIGIN = rnxPublicBrand.origin;
31213
31503
  MAX_RNX_CLOUD_BUNDLE_BYTES = RNX_CLOUD_MAX_ARTIFACT_BYTES;
31214
31504
  REMOTE_COMMAND = "peach remote";
@@ -35584,10 +35874,10 @@ var init_app_splash = __esm({
35584
35874
 
35585
35875
  // src/bridge-contract.ts
35586
35876
  function readyProbeHasContent(probe3) {
35587
- return probe3.liveFrameActive || probe3.targets > 0 || probe3.nodes >= SEMANTIC_READY_CONTENT_NODE_FLOOR;
35877
+ return (probe3.browserSurfaceCount ?? 0) > 0 || probe3.liveFrameActive || probe3.targets > 0 || probe3.nodes >= SEMANTIC_READY_CONTENT_NODE_FLOOR;
35588
35878
  }
35589
35879
  function readyProbeHasTargetContent(probe3) {
35590
- return probe3.liveFrameActive || probe3.targets > 0;
35880
+ return (probe3.browserSurfaceCount ?? 0) > 0 || probe3.liveFrameActive || probe3.targets > 0;
35591
35881
  }
35592
35882
  function readyProbeIsReady(probe3) {
35593
35883
  return (probe3.flag === true ? readyProbeHasContent(probe3) : readyProbeHasTargetContent(probe3)) && probe3.externalReady !== false && !probe3.externalError && !probe3.loadingText;
@@ -36125,6 +36415,7 @@ function waitReadyStatus(result, ready) {
36125
36415
  nodes: probe3?.nodes ?? 0,
36126
36416
  targets: probe3?.targets ?? 0,
36127
36417
  liveFrameActive: probe3?.liveFrameActive ?? false,
36418
+ browserSurfaceCount: probe3?.browserSurfaceCount ?? 0,
36128
36419
  liveFrameChannels: probe3?.liveFrameChannels ?? 0,
36129
36420
  liveFramePublishes: probe3?.liveFramePublishes ?? 0,
36130
36421
  flag: probe3?.flag,
@@ -38379,6 +38670,7 @@ var init_command_registry = __esm({
38379
38670
  "state",
38380
38671
  "reset",
38381
38672
  "camera",
38673
+ "location",
38382
38674
  "mode",
38383
38675
  "debug",
38384
38676
  "timeline",
@@ -39209,7 +39501,7 @@ function looksLikeSootsimUrl(target) {
39209
39501
  try {
39210
39502
  const url = new URL(target);
39211
39503
  const pathname = url.pathname.replace(/\/+$/, "") || "/";
39212
- return url.searchParams.has("open") || url.searchParams.has("port") || url.searchParams.has("bundle") || url.searchParams.has("demo") || url.pathname.includes("/sootsim/index.html") || pathname === "/sootsim" || url.pathname === "/__soot" || url.pathname === "/__soot/" || pathname === "/rn" || /^\/rn\/[^/]+$/i.test(pathname) || /^\/app\/[^/]+$/i.test(pathname) || pathname === "/__soot/rn" || /^\/__soot\/rn\/[^/]+$/i.test(pathname) || /^\/__soot\/app\/[^/]+$/i.test(pathname);
39504
+ return url.searchParams.has("open") || url.searchParams.has("port") || url.searchParams.has("bundle") || url.searchParams.has("demo") || url.pathname.includes("/sootsim/index.html") || /^\/simulator(?:\/(?:rn(?:\/[^/]+)?|app\/[^/]+|dock\/[^/]+))?$/.test(pathname) || pathname === "/sootsim" || url.pathname === "/__soot" || url.pathname === "/__soot/" || pathname === "/rn" || /^\/rn\/[^/]+$/i.test(pathname) || /^\/app\/[^/]+$/i.test(pathname) || pathname === "/__soot/rn" || /^\/__soot\/rn\/[^/]+$/i.test(pathname) || /^\/__soot\/app\/[^/]+$/i.test(pathname);
39213
39505
  } catch {
39214
39506
  return false;
39215
39507
  }
@@ -41271,6 +41563,16 @@ async function waitForSootsimIdle({
41271
41563
  let requestInFlight = 0
41272
41564
  let renderStatsAvailable = false
41273
41565
  let frameCount = -1
41566
+ let shellAnimating = false
41567
+ // strict also waits out shell motion: a system alert, sheet or menu
41568
+ // animates in the shell worker while the app's own stats read still,
41569
+ // so its presentation is complete only once the shell's list empties.
41570
+ if (strict) {
41571
+ try {
41572
+ const motion = await window.__sootsimTest?.listAnimations?.()
41573
+ shellAnimating = Array.isArray(motion) && motion.some((anim) => anim.realm === 'shell')
41574
+ } catch {}
41575
+ }
41274
41576
  try {
41275
41577
  const stats = await window.__sootsimRenderHost?.queryStats?.()
41276
41578
  if (stats) {
@@ -41308,7 +41610,7 @@ async function waitForSootsimIdle({
41308
41610
  }
41309
41611
  walk(root)
41310
41612
  }
41311
- return { layout: nodes.join(';'), frameCount, animating, layoutDirty, pendingFetches, renderStatsAvailable, requestTotal, requestInFlight }
41613
+ return { layout: nodes.join(';'), frameCount, animating, shellAnimating, layoutDirty, pendingFetches, renderStatsAvailable, requestTotal, requestInFlight }
41312
41614
  }
41313
41615
 
41314
41616
  // how long generic background network is allowed to keep us waiting AFTER
@@ -41339,13 +41641,16 @@ async function waitForSootsimIdle({
41339
41641
  const snapshot = await readSnapshot()
41340
41642
  polls++
41341
41643
  if (snapshot.layoutDirty) dirtyPolls++
41342
- if (snapshot.animating) animatingPolls++
41644
+ if (snapshot.animating || snapshot.shellAnimating) animatingPolls++
41343
41645
  if (polls > 1 && snapshot.layout !== lastLayout) layoutChangedPolls++
41344
41646
  const painted = paintStill && snapshot.frameCount !== lastFrameCount
41345
41647
  if (polls > 1 && painted) paintedPolls++
41346
41648
  const strictOk =
41347
41649
  !strict ||
41348
- (snapshot.renderStatsAvailable && !snapshot.animating && !snapshot.layoutDirty)
41650
+ (snapshot.renderStatsAvailable &&
41651
+ !snapshot.animating &&
41652
+ !snapshot.shellAnimating &&
41653
+ !snapshot.layoutDirty)
41349
41654
  // visually settled: no animations, no image content loading, layout
41350
41655
  // unchanged since the last poll.
41351
41656
  const visuallyStill =
@@ -41381,6 +41686,7 @@ async function waitForSootsimIdle({
41381
41686
  const blockers = []
41382
41687
  if (strict && !last.renderStatsAvailable) blockers.push('render stats unavailable')
41383
41688
  if (last.animating) blockers.push('animations still running')
41689
+ if (last.shellAnimating) blockers.push('shell animations still running')
41384
41690
  if (last.layoutDirty) blockers.push('layout still dirty')
41385
41691
  if (last.pendingFetches > 0) blockers.push(last.pendingFetches + ' image fetches pending')
41386
41692
  if (last.layout !== lastLayout) blockers.push('layout still changing')