peachsim 0.1.2470 → 0.1.2472

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 (137) hide show
  1. package/cli/catalog/meta.ts +5 -0
  2. package/cli/commands/agent.ts +4 -5
  3. package/cli/internal-child-contract.ts +6 -0
  4. package/cli/internal-child.ts +38 -6
  5. package/dist-lib/agent-daemon-client.cjs +3 -3
  6. package/dist-lib/agent-events.cjs +1 -1
  7. package/dist-lib/attached-projects.cjs +1 -1
  8. package/dist-lib/auth/shared-session.cjs +1 -1
  9. package/dist-lib/backend-origin.cjs +1 -1
  10. package/dist-lib/beta.cjs +1 -1
  11. package/dist-lib/beta.mjs +2 -2
  12. package/dist-lib/bridge-constants.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.mjs +5 -5
  15. package/dist-lib/bridge-contract.cjs +1 -1
  16. package/dist-lib/bridge-contract.mjs +3 -3
  17. package/dist-lib/bundle-channel.cjs +24 -30
  18. package/dist-lib/capture-contract.cjs +1 -1
  19. package/dist-lib/capture-contract.mjs +3 -3
  20. package/dist-lib/cloud-contract.cjs +1 -1
  21. package/dist-lib/cloud-contract.mjs +3 -3
  22. package/dist-lib/cloud-test-args.cjs +1 -1
  23. package/dist-lib/cloud-test-args.mjs +2 -2
  24. package/dist-lib/cloud.cjs +1 -1
  25. package/dist-lib/cloud.mjs +7 -7
  26. package/dist-lib/config.cjs +1 -1
  27. package/dist-lib/config.mjs +5 -5
  28. package/dist-lib/detox/index.cjs +2 -2
  29. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  30. package/dist-lib/esm-chunks/{acorn-UYJCU4LQ.mjs → acorn-QIMLXJTI.mjs} +3 -3
  31. package/dist-lib/esm-chunks/{chunk-JCFAV27Q.mjs → chunk-45VKM7N5.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-Q6BHZLJE.mjs → chunk-4TLFZLBT.mjs} +3 -3
  33. package/dist-lib/esm-chunks/{chunk-63YE3HPT.mjs → chunk-4YR6CPOD.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-LI6FJRET.mjs → chunk-57KHHRE4.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-FEVD526T.mjs → chunk-BERSJG2N.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-XJBFYM6G.mjs → chunk-BLJMIS4D.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-RTVCEFGY.mjs → chunk-BQ7AFT33.mjs} +4 -4
  38. package/dist-lib/esm-chunks/{chunk-ADSOZUR7.mjs → chunk-CIRUDWWA.mjs} +2 -2
  39. package/dist-lib/esm-chunks/{chunk-OBHGZUZU.mjs → chunk-DBL2SPLB.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-5EVI2Q7R.mjs → chunk-GJI5PS7F.mjs} +14 -13
  41. package/dist-lib/esm-chunks/{chunk-BAJ5TJJJ.mjs → chunk-I4NQBHWT.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-WYKU357M.mjs → chunk-KY5MCRDQ.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-3LUHAGKN.mjs → chunk-LODJ5JY3.mjs} +3 -3
  44. package/dist-lib/esm-chunks/{chunk-UATEBCVH.mjs → chunk-MER2MOVT.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-62GDPPRK.mjs → chunk-NOIPV2UU.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-SBGAGY36.mjs → chunk-NQ4WLOZ2.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-K75XVJ6M.mjs → chunk-STZKGNIY.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-YHRVFO7U.mjs → chunk-TBT2N4IT.mjs} +4 -4
  49. package/dist-lib/esm-chunks/{chunk-CZUHIYNB.mjs → chunk-WLK6TCKI.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-ZIO5YODN.mjs → chunk-ZSITGCQ4.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{metro-layout-parser-O4IPDC42.mjs → metro-layout-parser-3LHDZADO.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-4M7BXJ3C.mjs → swift-package-prebuilt-3L57A5BV.mjs} +9 -9
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-LXZCH25K.mjs → swift-sdk-app-module-IOLCLSPU.mjs} +12 -12
  54. package/dist-lib/esm-chunks/{swift-sdk-image-OMB2EECT.mjs → swift-sdk-image-BDVQHA62.mjs} +12 -12
  55. package/dist-lib/expo-swift-bundle.cjs +22 -28
  56. package/dist-lib/expo-swift-metadata.cjs +1 -1
  57. package/dist-lib/expo-swift-metadata.mjs +7 -7
  58. package/dist-lib/home-paths.cjs +1 -1
  59. package/dist-lib/host/bridge-host.cjs +63 -37
  60. package/dist-lib/host/fetch-proxy-handler.cjs +5 -5
  61. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  62. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  63. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  64. package/dist-lib/host/websocket-proxy.cjs +1 -1
  65. package/dist-lib/index.cjs +1 -1
  66. package/dist-lib/kotlin-host.cjs +1 -1
  67. package/dist-lib/menu.cjs +1 -1
  68. package/dist-lib/menu.mjs +3 -3
  69. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  70. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  71. package/dist-lib/metro-production-bundle.cjs +1 -1
  72. package/dist-lib/metro-production-bundle.mjs +4 -4
  73. package/dist-lib/native-app-identity-project.cjs +2 -2
  74. package/dist-lib/native-app-identity-project.mjs +14 -14
  75. package/dist-lib/native-app-identity.cjs +1 -1
  76. package/dist-lib/native-app-identity.mjs +6 -6
  77. package/dist-lib/native-firebase-metadata.cjs +1 -1
  78. package/dist-lib/native-firebase-metadata.mjs +3 -3
  79. package/dist-lib/pdfium-raster.cjs +33 -25
  80. package/dist-lib/pdfium-raster.mjs +32 -25
  81. package/dist-lib/plist.cjs +1 -1
  82. package/dist-lib/plist.mjs +3 -3
  83. package/dist-lib/profiles.cjs +1 -1
  84. package/dist-lib/public-brand.cjs +1 -1
  85. package/dist-lib/public-origins-lib-esm.json +75 -75
  86. package/dist-lib/public-origins-lib.json +69 -69
  87. package/dist-lib/react-native-host-modules.cjs +1 -1
  88. package/dist-lib/react-native-host-modules.mjs +2 -2
  89. package/dist-lib/reap-browser.cjs +1 -1
  90. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  91. package/dist-lib/sdk.cjs +1 -1
  92. package/dist-lib/sdk.mjs +7 -7
  93. package/dist-lib/skills.cjs +69 -38
  94. package/dist-lib/swift-compile.cjs +4 -3
  95. package/dist-lib/swift-compile.mjs +9 -9
  96. package/dist-lib/swift-package.cjs +1 -1
  97. package/dist-lib/swift-package.mjs +3 -3
  98. package/dist-lib/swift-submit.cjs +1 -1
  99. package/dist-lib/swift-submit.mjs +5 -5
  100. package/dist-lib/swift-svg-raster.cjs +1 -1
  101. package/dist-lib/swift-svg-raster.mjs +2 -2
  102. package/dist-lib/swift-toolchain.cjs +1 -1
  103. package/dist-lib/swift.cjs +1 -1
  104. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  105. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  106. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  107. package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
  108. package/dist-lib/vendor/acorn.cjs +1 -1
  109. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  110. package/dist-lib/vendor/ignore.cjs +1 -1
  111. package/dist-lib/vendor/magic-string.cjs +1 -1
  112. package/dist-lib/vendor/plist.cjs +1 -1
  113. package/dist-lib/vendor/smol-toml.cjs +1 -1
  114. package/dist-lib/vendor/stream-json.cjs +1 -1
  115. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  116. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  117. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  118. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  119. package/dist-lib/vendor/sucrase.cjs +1 -1
  120. package/dist-lib/vendor/terser.cjs +1 -1
  121. package/dist-lib/vendor/valibot.cjs +1 -1
  122. package/dist-lib/vendor/ws.cjs +1 -1
  123. package/dist-lib/vendor/zod.cjs +1 -1
  124. package/dist-lib/worklet-executable.cjs +1 -1
  125. package/dist-lib/worklet-executable.mjs +3 -3
  126. package/dist-types/packages/peach-engine/src/engine/remote-display-protocol.d.ts +1 -0
  127. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +1 -0
  128. package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +1 -0
  129. package/package.json +1 -1
  130. package/runtime-companion.json +1 -1
  131. package/src/agent-daemon-client.ts +3 -1
  132. package/src/agent-prompt.ts +7 -0
  133. package/src/canvas-agent-note-delivery.ts +16 -9
  134. package/src/case-insensitive-header-overlay.ts +4 -1
  135. package/src/host/agent-host.ts +40 -13
  136. package/src/pdfium-raster.ts +37 -24
  137. package/src/swift-pdf-raster.ts +17 -23
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -2058,7 +2058,7 @@ var init_runtime_assets = __esm({
2058
2058
  var runtime_companion_default;
2059
2059
  var init_runtime_companion = __esm({
2060
2060
  "runtime-companion.json"() {
2061
- runtime_companion_default = { abi: 1, sha256: "e7f1c9e8915dde6d33182604db7b13e169aa5c1b29cbe8f575b24818535e0b9f", file: "node/cli-e7f1c9e8915dde6d33182604db7b13e169aa5c1b29cbe8f575b24818535e0b9f.cjs" };
2061
+ runtime_companion_default = { abi: 1, sha256: "44db3cfaca62afc6cb450c628036852b92ea5cd806d74b132c3aa3eccae58b04", file: "node/cli-44db3cfaca62afc6cb450c628036852b92ea5cd806d74b132c3aa3eccae58b04.cjs" };
2062
2062
  }
2063
2063
  });
2064
2064
 
@@ -5656,13 +5656,13 @@ var init_swift_standin_digest = __esm({
5656
5656
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
5657
5657
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
5658
5658
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
5659
- STANDIN_SOURCE_DIGEST = true ? "a2dd0455bb0943434942f584133f2eb8dcf9d08664b9547ba527a748c7e5d175" : standinSourceDigest();
5659
+ STANDIN_SOURCE_DIGEST = true ? "d0a580a3a5e6b77a75f3d7ebca3aac93191508ae440ed2610ff59c6d40803096" : standinSourceDigest();
5660
5660
  }
5661
5661
  });
5662
5662
 
5663
5663
  // src/expo-native-compiler-digest.ts
5664
5664
  function expoNativeCompilerDigestValue() {
5665
- return true ? "2badd86d88c9798ab81e61f7e99ab4fa5730086643d5f4f62c6f1b31a81068e5" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
5665
+ return true ? "be014315bc5a0bfaa1200194789489272bda7a5e6d2834893c3dd5bd7cd05656" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
5666
5666
  }
5667
5667
  var import_node_crypto11;
5668
5668
  var init_expo_native_compiler_digest = __esm({
@@ -12835,7 +12835,8 @@ function needsCaseOverlay(directory2) {
12835
12835
  }
12836
12836
  function scan(directory2, listed) {
12837
12837
  const node = { files: /* @__PURE__ */ new Map(), directories: /* @__PURE__ */ new Map() };
12838
- for (const entry of import_node_fs34.default.readdirSync(directory2, { withFileTypes: true })) {
12838
+ const entries2 = import_node_fs34.default.readdirSync(directory2, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
12839
+ for (const entry of entries2) {
12839
12840
  const full = import_node_path32.default.join(directory2, entry.name);
12840
12841
  const stat2 = entry.isSymbolicLink() ? import_node_fs34.default.statSync(full, { throwIfNoEntry: false }) : entry;
12841
12842
  if (!stat2) continue;
@@ -57551,7 +57552,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
57551
57552
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
57552
57553
  MULTI_MANIFEST_VERSION = 76;
57553
57554
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
57554
- compilerSourceDigest = true ? "5138e8ed10fa7249f6c61d732d0635e37243a0523ba2d72c557b5100ed937ddd" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
57555
+ compilerSourceDigest = true ? "22e3790b03db31dcd4245a72555fa050c53156b1f8c5d4f0d0076b0d2fb64d75" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
57555
57556
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
57556
57557
  MODULE_MAP_RESPONSE_FILE_RUN = 16;
57557
57558
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
@@ -93152,37 +93153,30 @@ function rasterizePdfFiles(inputs2, { imageBytes, imageTotalBytes } = { imageByt
93152
93153
  file: import_node_path126.default.resolve(input.file),
93153
93154
  output: import_node_path126.default.join(work, `${index}.png`)
93154
93155
  }));
93156
+ const manifest = import_node_path126.default.join(work, "render.json");
93157
+ import_node_fs125.default.writeFileSync(
93158
+ manifest,
93159
+ JSON.stringify({
93160
+ requests,
93161
+ imageBytes: Number.isFinite(imageBytes) ? imageBytes : null,
93162
+ remainingBytes: Number.isFinite(remainingBytes) ? remainingBytes : null
93163
+ })
93164
+ );
93155
93165
  if (process.platform === "darwin") {
93156
- const manifest = import_node_path126.default.join(work, "render.json");
93157
- import_node_fs125.default.writeFileSync(manifest, JSON.stringify({ requests, imageBytes, remainingBytes }));
93158
93166
  (0, import_node_child_process59.execFileSync)(
93159
93167
  "/usr/bin/osascript",
93160
93168
  ["-l", "JavaScript", "-e", RASTER_PDF, manifest],
93161
93169
  { stdio: "pipe" }
93162
93170
  );
93171
+ } else {
93172
+ const { executable, prefixArgs } = rnxSelfInvocation();
93173
+ (0, import_node_child_process59.execFileSync)(
93174
+ executable,
93175
+ [...prefixArgs, RNX_INTERNAL_COMMAND, RNX_INTERNAL_CHILDREN.pdfRaster, manifest],
93176
+ { stdio: "pipe" }
93177
+ );
93163
93178
  }
93164
93179
  for (const request of requests) {
93165
- if (process.platform !== "darwin") {
93166
- const { executable, prefixArgs } = rnxSelfInvocation();
93167
- try {
93168
- (0, import_node_child_process59.execFileSync)(
93169
- executable,
93170
- [
93171
- ...prefixArgs,
93172
- RNX_INTERNAL_COMMAND,
93173
- RNX_INTERNAL_CHILDREN.pdfRaster,
93174
- request.file,
93175
- "3",
93176
- request.output
93177
- ],
93178
- { stdio: "pipe" }
93179
- );
93180
- } catch (error) {
93181
- throw new Error(`swift pdf asset ${request.file} did not rasterize`, {
93182
- cause: error
93183
- });
93184
- }
93185
- }
93186
93180
  record6(request, import_node_fs125.default.readFileSync(request.output));
93187
93181
  if (!writeCache) continue;
93188
93182
  try {
@@ -116380,7 +116374,7 @@ var init_nitro_superset = __esm({
116380
116374
  init_nitroContract();
116381
116375
  init_swift_standin_digest();
116382
116376
  NITRO_SUPERSET_ENTRY_NAME = "superset";
116383
- NITRO_COMPILER_DIGEST = true ? "f0c0f6fc7f25b7198a23a62896da0e409aba9232a36658fec168ec91e92bc9bf" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
116377
+ NITRO_COMPILER_DIGEST = true ? "e9c14edcb0e261255cca050ab9dc382b9cff9aa4b3f9506f8dfea233b9ca81cf" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
116384
116378
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
116385
116379
  nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
116386
116380
  published3 = /* @__PURE__ */ new Map();
@@ -121350,6 +121344,9 @@ var CANVAS_NOTE_REPLY_MAX_CHARS = 2e3;
121350
121344
  function readCanvasNoteReply(value) {
121351
121345
  return typeof value === "string" && value.trim() && value.length <= CANVAS_NOTE_REPLY_MAX_CHARS ? value.trim() : null;
121352
121346
  }
121347
+ function readCanvasAgentNoteWait(value) {
121348
+ return value === "pending" || value === "taken" ? value : null;
121349
+ }
121353
121350
  var MAX_NOTE_CROP_LENGTH = 2 * 1024 * 1024;
121354
121351
  var CANVAS_AGENT_ID_MAX_CHARS = 200;
121355
121352
  var MAX_CANVAS_AGENT_NOTE_BODY_BYTES = MAX_NOTE_CROP_LENGTH + 256 * 1024;
@@ -122138,6 +122135,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
122138
122135
  // src/host/agent-host.ts
122139
122136
  var WS_OPEN = 1;
122140
122137
  var SESSION_STATUS_PERSIST_DELAY_MS = 25;
122138
+ var CANVAS_NOTE_STATUS_HOLD_MS = 1e4;
122141
122139
  function defaultExcludePorts() {
122142
122140
  return [
122143
122141
  Number(process.env.VITE_PORT_WEB || process.env.PORT || 3e3),
@@ -122162,6 +122160,8 @@ var AgentHost = class {
122162
122160
  inspectQueues = /* @__PURE__ */ new Map();
122163
122161
  inspectListeners = /* @__PURE__ */ new Map();
122164
122162
  takenNotes = /* @__PURE__ */ new Map();
122163
+ // canvas status reads held until their note is taken or answered
122164
+ noteWaiters = /* @__PURE__ */ new Map();
122165
122165
  // agent wrappers also emit prompt-received from the FIFO reader, but the
122166
122166
  // shell/daemon already knows the user-facing display text when send-prompt
122167
122167
  // is accepted. emit the friendly prompt immediately and suppress the raw
@@ -122263,6 +122263,7 @@ var AgentHost = class {
122263
122263
  this.inspectListeners.clear();
122264
122264
  this.inspectQueues.clear();
122265
122265
  this.takenNotes.clear();
122266
+ for (const id of [...this.noteWaiters.keys()]) this.wakeNote(id);
122266
122267
  this.allSockets.clear();
122267
122268
  this.browserSockets.clear();
122268
122269
  }
@@ -122330,13 +122331,23 @@ var AgentHost = class {
122330
122331
  }
122331
122332
  case "agent:canvas-note-status": {
122332
122333
  const simId = this.requireSimId(msg, type);
122333
- this.pruneTakenNotes();
122334
- const pending = this.inspectQueue(simId).some(
122335
- (message) => message.id === msg.messageId
122336
- );
122337
- const taken = this.takenNotes.get(String(msg.messageId));
122338
- const status = pending ? { status: "pending" } : taken?.simId !== simId ? { status: "missing" } : taken.reply ? { status: "replied", reply: taken.reply } : { status: "taken" };
122339
- return status;
122334
+ const messageId = String(msg.messageId);
122335
+ const status = this.canvasNoteStatus(simId, messageId);
122336
+ if (status.status !== readCanvasAgentNoteWait(msg.changedFrom)) return status;
122337
+ await new Promise((resolve10) => {
122338
+ const waiters = this.noteWaiters.get(messageId) ?? /* @__PURE__ */ new Set();
122339
+ this.noteWaiters.set(messageId, waiters);
122340
+ const wake = () => {
122341
+ clearTimeout(timer);
122342
+ waiters.delete(wake);
122343
+ if (!waiters.size && this.noteWaiters.get(messageId) === waiters)
122344
+ this.noteWaiters.delete(messageId);
122345
+ resolve10();
122346
+ };
122347
+ const timer = setTimeout(wake, CANVAS_NOTE_STATUS_HOLD_MS);
122348
+ waiters.add(wake);
122349
+ });
122350
+ return this.canvasNoteStatus(simId, messageId);
122340
122351
  }
122341
122352
  case "agent:reply-canvas-note": {
122342
122353
  this.pruneTakenNotes();
@@ -122345,6 +122356,7 @@ var AgentHost = class {
122345
122356
  if (!reply) throw new AgentSessionError("INVALID_REPLY", "invalid note reply");
122346
122357
  if (!taken) throw new AgentSessionError("NOT_FOUND", "no taken note with that id");
122347
122358
  taken.reply = reply;
122359
+ this.wakeNote(String(msg.messageId));
122348
122360
  return { ok: true };
122349
122361
  }
122350
122362
  case "agent:get-inspect-listener-status": {
@@ -122401,6 +122413,19 @@ var AgentHost = class {
122401
122413
  this.inspectListeners.set(simId, listeners);
122402
122414
  });
122403
122415
  }
122416
+ canvasNoteStatus(simId, messageId) {
122417
+ this.pruneTakenNotes();
122418
+ if (this.inspectQueue(simId).some((message) => message.id === messageId))
122419
+ return { status: "pending" };
122420
+ const taken = this.takenNotes.get(messageId);
122421
+ if (taken?.simId !== simId) return { status: "missing" };
122422
+ return taken.reply ? { status: "replied", reply: taken.reply } : { status: "taken" };
122423
+ }
122424
+ wakeNote(messageId) {
122425
+ const waiters = this.noteWaiters.get(messageId);
122426
+ this.noteWaiters.delete(messageId);
122427
+ for (const wake of waiters ?? []) wake();
122428
+ }
122404
122429
  pruneTakenNotes() {
122405
122430
  const now = Date.now();
122406
122431
  for (const [id, receipt] of this.takenNotes) {
@@ -122414,6 +122439,7 @@ var AgentHost = class {
122414
122439
  simId: message.simId,
122415
122440
  expiresAt: Date.now() + AGENT_NOTE_TTL_MS
122416
122441
  });
122442
+ this.wakeNote(message.id);
122417
122443
  }
122418
122444
  inspectQueue(simId) {
122419
122445
  const queue = this.inspectQueues.get(simId);
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -989,13 +989,13 @@ var init_swift_standin_digest = __esm({
989
989
  import_node_crypto5 = require("node:crypto");
990
990
  import_node_fs11 = require("node:fs");
991
991
  import_node_path12 = __toESM(require("node:path"), 1);
992
- STANDIN_SOURCE_DIGEST = true ? "a2dd0455bb0943434942f584133f2eb8dcf9d08664b9547ba527a748c7e5d175" : standinSourceDigest();
992
+ STANDIN_SOURCE_DIGEST = true ? "d0a580a3a5e6b77a75f3d7ebca3aac93191508ae440ed2610ff59c6d40803096" : standinSourceDigest();
993
993
  }
994
994
  });
995
995
 
996
996
  // src/expo-native-compiler-digest.ts
997
997
  function expoNativeCompilerDigestValue() {
998
- return true ? "2badd86d88c9798ab81e61f7e99ab4fa5730086643d5f4f62c6f1b31a81068e5" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
998
+ return true ? "be014315bc5a0bfaa1200194789489272bda7a5e6d2834893c3dd5bd7cd05656" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
999
999
  }
1000
1000
  var import_node_crypto6;
1001
1001
  var init_expo_native_compiler_digest = __esm({
@@ -9669,7 +9669,7 @@ var init_swift_compile = __esm({
9669
9669
  };
9670
9670
  OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES));
9671
9671
  NON_IOS_MODULES = /* @__PURE__ */ new Set(["FoundationNetworking", "WASILibc"]);
9672
- compilerSourceDigest = true ? "5138e8ed10fa7249f6c61d732d0635e37243a0523ba2d72c557b5100ed937ddd" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
9672
+ compilerSourceDigest = true ? "22e3790b03db31dcd4245a72555fa050c53156b1f8c5d4f0d0076b0d2fb64d75" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
9673
9673
  NOT_ON_IOS = new RegExp(
9674
9674
  `\\b(?:os\\(\\s*WASI\\s*\\)|canImport\\(\\s*(?:${[...NON_IOS_MODULES].join("|")})\\s*\\))`,
9675
9675
  "g"
@@ -23477,7 +23477,7 @@ var init_dev_server_package_versions = __esm({
23477
23477
  var runtime_companion_default;
23478
23478
  var init_runtime_companion = __esm({
23479
23479
  "runtime-companion.json"() {
23480
- runtime_companion_default = { abi: 1, sha256: "e7f1c9e8915dde6d33182604db7b13e169aa5c1b29cbe8f575b24818535e0b9f", file: "node/cli-e7f1c9e8915dde6d33182604db7b13e169aa5c1b29cbe8f575b24818535e0b9f.cjs" };
23480
+ runtime_companion_default = { abi: 1, sha256: "44db3cfaca62afc6cb450c628036852b92ea5cd806d74b132c3aa3eccae58b04", file: "node/cli-44db3cfaca62afc6cb450c628036852b92ea5cd806d74b132c3aa3eccae58b04.cjs" };
23481
23481
  }
23482
23482
  });
23483
23483
 
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,5 +1,5 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
- import "../esm-chunks/chunk-K75XVJ6M.mjs";
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import "../esm-chunks/chunk-STZKGNIY.mjs";
3
3
 
4
4
  // src/host/fetch-proxy-overrides.ts
5
5
  var FETCH_PROXY_NATIVE_USER_AGENT_HEADER = "x-sootsim-native-user-agent";
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
package/dist-lib/menu.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/menu.mjs CHANGED
@@ -1,8 +1,8 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  rnxPublicBrand
4
- } from "./esm-chunks/chunk-OBHGZUZU.mjs";
5
- import "./esm-chunks/chunk-K75XVJ6M.mjs";
4
+ } from "./esm-chunks/chunk-DBL2SPLB.mjs";
5
+ import "./esm-chunks/chunk-STZKGNIY.mjs";
6
6
 
7
7
  // src/menuContract.ts
8
8
  var SOOTSIM_ENGINE_EVENT_NAME = "sootsim:engine-event";
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,8 +1,8 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  isRecord
4
- } from "./esm-chunks/chunk-ZIO5YODN.mjs";
5
- import "./esm-chunks/chunk-K75XVJ6M.mjs";
4
+ } from "./esm-chunks/chunk-ZSITGCQ4.mjs";
5
+ import "./esm-chunks/chunk-STZKGNIY.mjs";
6
6
 
7
7
  // src/metro-fingerprint-registry.ts
8
8
  var RNX_METRO_FINGERPRINT_SCHEMA_VERSION = 2;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,8 +1,8 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  findBundleFooter
4
- } from "./esm-chunks/chunk-LI6FJRET.mjs";
5
- import "./esm-chunks/chunk-K75XVJ6M.mjs";
4
+ } from "./esm-chunks/chunk-57KHHRE4.mjs";
5
+ import "./esm-chunks/chunk-STZKGNIY.mjs";
6
6
 
7
7
  // src/metro-production-bundle.ts
8
8
  var RNXSIM_METRO_MODULE_PATHS_PREFIX = "globalThis.__sootsimModulePaths=";
@@ -131,7 +131,7 @@ function metroCalls(expression) {
131
131
  return [];
132
132
  }
133
133
  async function readRNXMetroBundleLayout(source) {
134
- const { loadMetroLayoutParser } = await import("./esm-chunks/metro-layout-parser-O4IPDC42.mjs");
134
+ const { loadMetroLayoutParser } = await import("./esm-chunks/metro-layout-parser-3LHDZADO.mjs");
135
135
  const MetroLayoutParser = await loadMetroLayoutParser();
136
136
  const program = MetroLayoutParser.parse(source, {
137
137
  ecmaVersion: "latest",
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -2060,7 +2060,7 @@ var init_swift_compile = __esm({
2060
2060
  };
2061
2061
  OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES));
2062
2062
  NON_IOS_MODULES = /* @__PURE__ */ new Set(["FoundationNetworking", "WASILibc"]);
2063
- compilerSourceDigest = true ? "5138e8ed10fa7249f6c61d732d0635e37243a0523ba2d72c557b5100ed937ddd" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
2063
+ compilerSourceDigest = true ? "22e3790b03db31dcd4245a72555fa050c53156b1f8c5d4f0d0076b0d2fb64d75" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
2064
2064
  NOT_ON_IOS = new RegExp(
2065
2065
  `\\b(?:os\\(\\s*WASI\\s*\\)|canImport\\(\\s*(?:${[...NON_IOS_MODULES].join("|")})\\s*\\))`,
2066
2066
  "g"
@@ -1,21 +1,21 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  swiftNativePin
4
- } from "./esm-chunks/chunk-RTVCEFGY.mjs";
5
- import "./esm-chunks/chunk-FEVD526T.mjs";
4
+ } from "./esm-chunks/chunk-BQ7AFT33.mjs";
5
+ import "./esm-chunks/chunk-BERSJG2N.mjs";
6
6
  import {
7
7
  NATIVE_GRAPH_SDK_VERSION,
8
8
  cacheDir,
9
9
  privateSwiftRelease,
10
10
  swiftEnvironment,
11
11
  swiftToolchainBin
12
- } from "./esm-chunks/chunk-5EVI2Q7R.mjs";
13
- import "./esm-chunks/chunk-SBGAGY36.mjs";
12
+ } from "./esm-chunks/chunk-GJI5PS7F.mjs";
13
+ import "./esm-chunks/chunk-NQ4WLOZ2.mjs";
14
14
  import {
15
15
  SWIFT_OBJCXX_LANGUAGE_FLAG,
16
16
  isSwiftNativeTranslationUnit,
17
17
  moduleMapName
18
- } from "./esm-chunks/chunk-XJBFYM6G.mjs";
18
+ } from "./esm-chunks/chunk-BLJMIS4D.mjs";
19
19
  import {
20
20
  androidMergedResourceValuesDirectory,
21
21
  extractNativeAppIdentityFromFiles,
@@ -33,25 +33,25 @@ import {
33
33
  xcodeBuildFileBuildsForIos,
34
34
  xcodePathResolver,
35
35
  xcodeTargetMemberVisitor
36
- } from "./esm-chunks/chunk-YHRVFO7U.mjs";
37
- import "./esm-chunks/chunk-63YE3HPT.mjs";
36
+ } from "./esm-chunks/chunk-TBT2N4IT.mjs";
37
+ import "./esm-chunks/chunk-4YR6CPOD.mjs";
38
38
  import {
39
39
  parsePlistSource,
40
40
  require_lib,
41
41
  require_plist
42
- } from "./esm-chunks/chunk-ADSOZUR7.mjs";
43
- import "./esm-chunks/chunk-OBHGZUZU.mjs";
44
- import "./esm-chunks/chunk-UATEBCVH.mjs";
45
- import "./esm-chunks/chunk-LI6FJRET.mjs";
42
+ } from "./esm-chunks/chunk-CIRUDWWA.mjs";
43
+ import "./esm-chunks/chunk-DBL2SPLB.mjs";
44
+ import "./esm-chunks/chunk-MER2MOVT.mjs";
45
+ import "./esm-chunks/chunk-57KHHRE4.mjs";
46
46
  import {
47
47
  isRecord
48
- } from "./esm-chunks/chunk-ZIO5YODN.mjs";
48
+ } from "./esm-chunks/chunk-ZSITGCQ4.mjs";
49
49
  import {
50
50
  __commonJS,
51
51
  __publicField,
52
52
  __require,
53
53
  __toESM
54
- } from "./esm-chunks/chunk-K75XVJ6M.mjs";
54
+ } from "./esm-chunks/chunk-STZKGNIY.mjs";
55
55
 
56
56
  // ../../node_modules/big-integer/BigInteger.js
57
57
  var require_BigInteger = __commonJS({
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  NATIVE_APP_IDENTITY_HEADER,
4
4
  applyNativeAppIdentity,
@@ -21,11 +21,11 @@ import {
21
21
  readRootModuleName,
22
22
  readSiriEntitlement,
23
23
  selectNativeAppIdentityReader
24
- } from "./esm-chunks/chunk-YHRVFO7U.mjs";
25
- import "./esm-chunks/chunk-63YE3HPT.mjs";
26
- import "./esm-chunks/chunk-LI6FJRET.mjs";
27
- import "./esm-chunks/chunk-ZIO5YODN.mjs";
28
- import "./esm-chunks/chunk-K75XVJ6M.mjs";
24
+ } from "./esm-chunks/chunk-TBT2N4IT.mjs";
25
+ import "./esm-chunks/chunk-4YR6CPOD.mjs";
26
+ import "./esm-chunks/chunk-57KHHRE4.mjs";
27
+ import "./esm-chunks/chunk-ZSITGCQ4.mjs";
28
+ import "./esm-chunks/chunk-STZKGNIY.mjs";
29
29
  export {
30
30
  NATIVE_APP_IDENTITY_HEADER,
31
31
  applyNativeAppIdentity,
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,8 +1,8 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  findBundleFooter
4
- } from "./esm-chunks/chunk-LI6FJRET.mjs";
5
- import "./esm-chunks/chunk-K75XVJ6M.mjs";
4
+ } from "./esm-chunks/chunk-57KHHRE4.mjs";
5
+ import "./esm-chunks/chunk-STZKGNIY.mjs";
6
6
 
7
7
  // src/native-firebase-metadata.ts
8
8
  var PREFIX = "globalThis.__peachNativeFirebaseConfig=";
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2470 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2472 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -22,7 +22,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  // src/pdfium-raster.ts
23
23
  var pdfium_raster_exports = {};
24
24
  __export(pdfium_raster_exports, {
25
- rasterizePdfBytes: () => rasterizePdfBytes
25
+ rasterizePdfBytes: () => rasterizePdfBytes,
26
+ withPdfiumRasterizer: () => withPdfiumRasterizer
26
27
  });
27
28
  module.exports = __toCommonJS(pdfium_raster_exports);
28
29
  var import_inline = require("@hyzyla/pdfium/inline");
@@ -72,35 +73,42 @@ async function encodeRgbaPng(width, height, rgba) {
72
73
  }
73
74
  return png;
74
75
  }
75
- async function rasterizePdfBytes(pdf, scale) {
76
- const library = await import_inline.PDFiumLibrary.init({ disableBase64Warning: true });
76
+ async function rasterizePage(library, pdf, scale) {
77
+ const document = await library.loadDocument(pdf);
77
78
  try {
78
- const document = await library.loadDocument(pdf);
79
- try {
80
- const size = document.getPage(0).getOriginalSize();
81
- const width = Math.ceil(size.originalWidth * scale);
82
- const height = Math.ceil(size.originalHeight * scale);
83
- if (width <= 0 || height <= 0 || width > 12e3 || height > 12e3) {
84
- throw new Error(
85
- `pdf page ${size.originalWidth}x${size.originalHeight} is out of range`
86
- );
87
- }
88
- const bitmap = await document.getPage(0).render({
89
- scale: 1,
90
- width,
91
- height,
92
- render: "bitmap",
93
- transparent: true
94
- });
95
- return await encodeRgbaPng(width, height, bitmap.data);
96
- } finally {
97
- document.destroy();
79
+ const size = document.getPage(0).getOriginalSize();
80
+ const width = Math.ceil(size.originalWidth * scale);
81
+ const height = Math.ceil(size.originalHeight * scale);
82
+ if (width <= 0 || height <= 0 || width > 12e3 || height > 12e3) {
83
+ throw new Error(
84
+ `pdf page ${size.originalWidth}x${size.originalHeight} is out of range`
85
+ );
98
86
  }
87
+ const bitmap = await document.getPage(0).render({
88
+ scale: 1,
89
+ width,
90
+ height,
91
+ render: "bitmap",
92
+ transparent: true
93
+ });
94
+ return await encodeRgbaPng(width, height, bitmap.data);
95
+ } finally {
96
+ document.destroy();
97
+ }
98
+ }
99
+ async function withPdfiumRasterizer(render) {
100
+ const library = await import_inline.PDFiumLibrary.init({ disableBase64Warning: true });
101
+ try {
102
+ return await render((pdf, scale) => rasterizePage(library, pdf, scale));
99
103
  } finally {
100
104
  library.destroy();
101
105
  }
102
106
  }
107
+ function rasterizePdfBytes(pdf, scale) {
108
+ return withPdfiumRasterizer((rasterize) => rasterize(pdf, scale));
109
+ }
103
110
  // Annotate the CommonJS export names for ESM import in node:
104
111
  0 && (module.exports = {
105
- rasterizePdfBytes
112
+ rasterizePdfBytes,
113
+ withPdfiumRasterizer
106
114
  });