agentroam-runtime-darwin-arm64 0.2.0-preview.80 → 0.2.0-preview.82

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 (361) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-build-manifest.json +8 -8
  5. package/runtime/.next/app-path-routes-manifest.json +1 -1
  6. package/runtime/.next/build-manifest.json +5 -5
  7. package/runtime/.next/prerender-manifest.json +1 -1
  8. package/runtime/.next/required-server-files.json +1 -1
  9. package/runtime/.next/server/app/_not-found/page.js +1 -1
  10. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/runtime/.next/server/app/_not-found.html +1 -1
  12. package/runtime/.next/server/app/_not-found.rsc +1 -1
  13. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  14. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
  16. package/runtime/.next/server/app/api/agent/composer/route.js +1 -0
  17. package/runtime/.next/server/app/api/agent/composer/route.js.nft.json +1 -0
  18. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  23. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  24. package/runtime/.next/server/app/api/agent/stream/route.js +2 -2
  25. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  26. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  27. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  28. package/runtime/.next/server/app/api/business/route.js +1 -1
  29. package/runtime/.next/server/app/api/calendar/route.js +2 -2
  30. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  31. package/runtime/.next/server/app/api/collaboration/route.js +2 -2
  32. package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
  33. package/runtime/.next/server/app/api/engine-threads.body +1 -1
  34. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  35. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  36. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
  37. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  38. package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
  39. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -1
  40. package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
  41. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  42. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  43. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  44. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  45. package/runtime/.next/server/app/api/memory/route.js +1 -1
  46. package/runtime/.next/server/app/api/messaging/route.js +1 -1
  47. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
  48. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
  49. package/runtime/.next/server/app/api/notifications/route.js +1 -1
  50. package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
  51. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  52. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  53. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  54. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  55. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  56. package/runtime/.next/server/app/api/projects/route.js +1 -1
  57. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  58. package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
  59. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  60. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  61. package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
  62. package/runtime/.next/server/app/api/session-views/route.js +1 -1
  63. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  64. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  65. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  67. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  69. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  70. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  73. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  74. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  75. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  76. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  77. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  78. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  79. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  80. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  81. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  82. package/runtime/.next/server/app/api/settings/route.js +1 -1
  83. package/runtime/.next/server/app/api/skills/route.js +1 -1
  84. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
  85. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
  86. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
  87. package/runtime/.next/server/app/api/todos/route.js +1 -1
  88. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  89. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  90. package/runtime/.next/server/app/api/tools/route.js +1 -1
  91. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  92. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  93. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  94. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  95. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  96. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  97. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  98. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  99. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  100. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  101. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  102. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  103. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  104. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  105. package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
  106. package/runtime/.next/server/app/web/page.js +4 -4
  107. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  108. package/runtime/.next/server/app-paths-manifest.json +36 -35
  109. package/runtime/.next/server/chunks/5303.js +2 -2
  110. package/runtime/.next/server/chunks/5801.js +1 -1
  111. package/runtime/.next/server/chunks/9119.js +3 -3
  112. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  113. package/runtime/.next/server/pages/404.html +1 -1
  114. package/runtime/.next/server/pages/500.html +1 -1
  115. package/runtime/.next/server/server-reference-manifest.json +1 -1
  116. package/runtime/.next/static/chunks/app/web/{error-f313c4014e78cef5.js → error-828d278147a0619d.js} +1 -1
  117. package/runtime/.next/static/chunks/app/web/layout-1127176e7e88e395.js +1 -0
  118. package/runtime/.next/static/chunks/app/web/{page-2e962377e57d3383.js → page-f008ab6dfeab7ce7.js} +1 -1
  119. package/runtime/.next/static/chunks/{main-68faabab5d101471.js → main-9c08f7656f9692e6.js} +1 -1
  120. package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +1 -0
  121. package/runtime/lib/remote-control/application/paced-video-sender.mjs +20 -1
  122. package/runtime/lib/remote-control/application/remote-video-session.mjs +18 -4
  123. package/runtime/lib/remote-control/helper-manager.mjs +36 -2
  124. package/runtime/lib/remote-control/infrastructure/native-video-encoder.mjs +15 -2
  125. package/runtime/lib/remote-control/infrastructure/werift-video-transport.mjs +3 -1
  126. package/runtime/lib/remote-control/macos-helper-app.mjs +85 -15
  127. package/runtime/lib/remote-control/macos-helper-permissions.mjs +113 -0
  128. package/runtime/lib/remote-control/remote-authorization.mjs +2 -2
  129. package/runtime/lib/remote-control/remote-video-signal.mjs +2 -0
  130. package/runtime/lib/todo-completion-worker.mjs +45 -0
  131. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  132. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  133. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  134. package/runtime/node_modules/.package-lock.json +129 -129
  135. package/runtime/node_modules/@agent/core/dist/index.js +286 -68
  136. package/runtime/node_modules/@agent/native-runtime/dist/index.js +444 -127
  137. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +75 -79
  138. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +52 -52
  139. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2g5j09ba.mjs +16 -0
  140. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-59ydwk0g.mjs +17 -0
  141. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-q4cwy1ja.mjs → core-664d5mmy.mjs} +2 -2
  142. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-zn1abzvs.mjs → core-70sfhqm6.mjs} +2 -2
  143. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-95gcz3n1.mjs +38 -0
  144. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ew5sfvfe.mjs +39 -0
  145. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gjhs7gf6.mjs +20 -0
  146. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-kvdt1szx.mjs +18 -0
  147. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p654hjkr.mjs +22 -0
  148. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-q9bjbxkv.mjs +19 -0
  149. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-samdvsjh.mjs +33 -0
  150. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x6bt758j.mjs +17 -0
  151. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
  152. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +22 -22
  153. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +26 -26
  154. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +22 -23
  155. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +84 -83
  156. package/runtime/node_modules/caniuse-lite/package.json +1 -1
  157. package/runtime/node_modules/mediabunny/README.md +4 -0
  158. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +185 -127
  159. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +11 -11
  160. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +12 -12
  161. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +185 -127
  162. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +185 -127
  163. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.worker.js +8 -0
  164. package/runtime/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js +4 -0
  165. package/runtime/node_modules/mediabunny/dist/modules/src/aes.js +6 -4
  166. package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-demuxer.js +6 -0
  167. package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-segmented-input.js +17 -5
  168. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-boxes.js +2 -1
  169. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +12 -1
  170. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +34 -18
  171. package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +3 -0
  172. package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +3 -8
  173. package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +5 -12
  174. package/runtime/node_modules/mediabunny/dist/modules/src/misc.js +19 -5
  175. package/runtime/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js +4 -0
  176. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +22 -13
  177. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +2 -2
  178. package/runtime/node_modules/mediabunny/dist/modules/src/segmented-input.js +70 -65
  179. package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  180. package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
  181. package/runtime/node_modules/mediabunny/dist/modules/src/worker.js +26 -0
  182. package/runtime/node_modules/mediabunny/package.json +1 -1
  183. package/runtime/node_modules/mediabunny/src/adts/adts-demuxer.ts +5 -0
  184. package/runtime/node_modules/mediabunny/src/aes.ts +7 -4
  185. package/runtime/node_modules/mediabunny/src/hls/hls-demuxer.ts +7 -0
  186. package/runtime/node_modules/mediabunny/src/hls/hls-segmented-input.ts +19 -6
  187. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-boxes.ts +2 -1
  188. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +15 -1
  189. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +37 -19
  190. package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +4 -0
  191. package/runtime/node_modules/mediabunny/src/media-sink.ts +3 -12
  192. package/runtime/node_modules/mediabunny/src/media-source.ts +5 -20
  193. package/runtime/node_modules/mediabunny/src/misc.ts +26 -5
  194. package/runtime/node_modules/mediabunny/src/mp3/mp3-demuxer.ts +5 -0
  195. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +30 -19
  196. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-muxer.ts +2 -2
  197. package/runtime/node_modules/mediabunny/src/segmented-input.ts +76 -79
  198. package/runtime/node_modules/mediabunny/src/version.ts +1 -1
  199. package/runtime/node_modules/mediabunny/src/worker.ts +28 -0
  200. package/runtime/package-lock.json +162 -162
  201. package/runtime/server.js +1 -1
  202. package/runtime/webapp/dist/assets/AIHubView-CNKanNZa.js +1 -0
  203. package/runtime/webapp/dist/assets/{AgentManager-dXI31b0a.js → AgentManager-B8TTqJaL.js} +2 -2
  204. package/runtime/webapp/dist/assets/AiHubPane-Coyn3P-J.js +1 -0
  205. package/runtime/webapp/dist/assets/App-BGIGpBp3.js +68 -0
  206. package/runtime/webapp/dist/assets/BrowserLivePanel-DnzJOz5w.js +61 -0
  207. package/runtime/webapp/dist/assets/CalendarPage-D0oaq2_l.js +1 -0
  208. package/runtime/webapp/dist/assets/{CalendarView-QfbrlL9X.js → CalendarView-QXZbXnXA.js} +3 -3
  209. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CE8OML-A.js +1 -0
  210. package/runtime/webapp/dist/assets/CollaborationDashboard-CV18iiBO.js +1 -0
  211. package/runtime/webapp/dist/assets/{CollaborationPage-B1tiqgnG.js → CollaborationPage-B2mIAc-h.js} +2 -2
  212. package/runtime/webapp/dist/assets/{FilePreview-CPY6dP8Q.js → FilePreview-BCEiERA1.js} +9 -9
  213. package/runtime/webapp/dist/assets/{FileTree-BBgrOian.js → FileTree-CMbs1Gj3.js} +2 -2
  214. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BxFS-0sF.js +1 -0
  215. package/runtime/webapp/dist/assets/FlowStudioPane-CVP0Q6zR.js +5 -0
  216. package/runtime/webapp/dist/assets/HostProjectPicker-DUUgM2Cm.js +1 -0
  217. package/runtime/webapp/dist/assets/{LSPServerList-B-R7HDSP.js → LSPServerList-COMVmsvb.js} +1 -1
  218. package/runtime/webapp/dist/assets/{MCPServerList-CTc0iAwT.js → MCPServerList-C_juD6B4.js} +1 -1
  219. package/runtime/webapp/dist/assets/{MemoryViewer-Dzh_miRv.js → MemoryViewer-Et2vysSN.js} +1 -1
  220. package/runtime/webapp/dist/assets/NewSessionWindow-DwJhkRJd.js +1 -0
  221. package/runtime/webapp/dist/assets/RemoteDesktopPage-Cqsea4X7.js +1 -0
  222. package/runtime/webapp/dist/assets/{RemoteDesktopTabBridge-BA_HQv3V.js → RemoteDesktopTabBridge-BFzNwpUn.js} +1 -1
  223. package/runtime/webapp/dist/assets/{RunningSessionsIcon-BvFSI9OF.js → RunningSessionsIcon-D_cOqmmk.js} +1 -1
  224. package/runtime/webapp/dist/assets/{SessionDashboard-DcPPoXe2.js → SessionDashboard-yjdEKypJ.js} +2 -2
  225. package/runtime/webapp/dist/assets/{SessionDashboardBridge-CjoeUy-v.js → SessionDashboardBridge-Kc_1Et9r.js} +1 -1
  226. package/runtime/webapp/dist/assets/{SettingsPanel-DmdXDQUm.js → SettingsPanel-t26XhKHP.js} +2 -2
  227. package/runtime/webapp/dist/assets/{SkillManager-CS_skFZj.js → SkillManager-nZU7b1sc.js} +1 -1
  228. package/runtime/webapp/dist/assets/{TaskPaneTerminal-BFHDRCb9.js → TaskPaneTerminal-BPaCKman.js} +1 -1
  229. package/runtime/webapp/dist/assets/{TerminalPane-Dr_nY9pI.js → TerminalPane-CiIpI1Id.js} +1 -1
  230. package/runtime/webapp/dist/assets/TodoPage-CG__S6_l.js +1 -0
  231. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-FEEApB15.js → abnfDiagram-VCTEODGH-DmKjGVfG.js} +1 -1
  232. package/runtime/webapp/dist/assets/{arc-CycwMc2c.js → arc-D6bpvBke.js} +1 -1
  233. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BFq9JapX.js → architectureDiagram-5GKGNRK7-NEKc2BYf.js} +1 -1
  234. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DkOJ55Ag.js → blockDiagram-I7D4REHJ-V6G00twZ.js} +1 -1
  235. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-CRvi_3RM.js → c4Diagram-7LVT6UL2-CojA33V5.js} +1 -1
  236. package/runtime/webapp/dist/assets/{calendar-days-CLwKstxM.js → calendar-days-DXE_2mLa.js} +1 -1
  237. package/runtime/webapp/dist/assets/channel-D66Qxmo0.js +1 -0
  238. package/runtime/webapp/dist/assets/{check-8EVJMrTV.js → check-UipgMBET.js} +1 -1
  239. package/runtime/webapp/dist/assets/{chevron-down-ChNxfI2x.js → chevron-down-Dvinwg2S.js} +1 -1
  240. package/runtime/webapp/dist/assets/{chevron-right-Cbkc_d70.js → chevron-right-BGU3tcLA.js} +1 -1
  241. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cklzvs8u.js → chunk-2Q5K7J3B-DObpPEgk.js} +1 -1
  242. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-NxozE5UP.js → chunk-5VM5RSS4-PaTzAg6w.js} +1 -1
  243. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-Dyb8E7YM.js → chunk-F27PBJKO-Pn4gut94.js} +1 -1
  244. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BqbMMc1n.js → chunk-IMKFNOWR-nRaVFzK9.js} +1 -1
  245. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-do0R2H6U.js → chunk-JWPE2WC7-CxssjKKN.js} +1 -1
  246. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-B2HIaynf.js → chunk-POPQ4Y6H-CweDXr-B.js} +1 -1
  247. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-C_zmjkwn.js → chunk-SVP7TREG-C7T3FGE-.js} +1 -1
  248. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-Dh2bZgM1.js → chunk-TICWLB2K-Nc0H-0_V.js} +1 -1
  249. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CnqciVDz.js → chunk-XXDRQBXY-D_GQGF5g.js} +1 -1
  250. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BAX0-S6b.js +1 -0
  251. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BAX0-S6b.js +1 -0
  252. package/runtime/webapp/dist/assets/{client-I0ZVCjOI.js → client-Bb0hpbIR.js} +1 -1
  253. package/runtime/webapp/dist/assets/{codeSyntax-C8n4_KZS.js → codeSyntax-DHonp3tF.js} +3 -3
  254. package/runtime/webapp/dist/assets/{collaboration-lVxWL5ce.js → collaboration-e_iziKU1.js} +1 -1
  255. package/runtime/webapp/dist/assets/composer-file-routing-CWyT7leB.js +6 -0
  256. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-CulKVUkj.js → cose-bilkent-JH36ORCC-Ac_FBan4.js} +1 -1
  257. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-C1LUI1_G.js → cynefin-OW5HDTMX-vr6c389q.js} +1 -1
  258. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-D3Ymzw_P.js → cynefinDiagram-5FMLGOSQ-sXmUCrp_.js} +1 -1
  259. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-DRaL0cGu.js → dagre-GXQ25YYZ-B0DmGxDv.js} +1 -1
  260. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-D8gLHoZo.js → diagram-S7CK7UJ4-Dn-2jJ6S.js} +1 -1
  261. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CaVU0aQT.js → diagram-UQ7AKVKN-BcasYsju.js} +1 -1
  262. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-LFAKRvZz.js → diagram-VSXAHHWV-DCgGkc82.js} +1 -1
  263. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DXpxUERc.js → diagram-VX7I27RA-Cjs0Ny4i.js} +1 -1
  264. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-vAiik55G.js → diagram-Z3DM3KII-0nyddp0v.js} +1 -1
  265. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-MaFL7Kgb.js → ebnfDiagram-PWID7BFC-By7gCUsz.js} +1 -1
  266. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-DuEu79B3.js → erDiagram-RLTQ6QDP-DdwBp45A.js} +1 -1
  267. package/runtime/webapp/dist/assets/{file-types-ZVLWtslN.js → file-types-nujx8XUw.js} +1 -1
  268. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BAQ6nP2D.js → flowDiagram-HODETNUW-DbOwRaT9.js} +1 -1
  269. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-C48VBnPy.js → ganttDiagram-EL5Y4UJY-CG8obc7O.js} +3 -3
  270. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-BfWAh9Kr.js → gitGraphDiagram-WWUBYQGX-ru6aSu_g.js} +1 -1
  271. package/runtime/webapp/dist/assets/{history-D4E3D_aM.js → history-DaBh5_SJ.js} +1 -1
  272. package/runtime/webapp/dist/assets/{image-plus-DQV_EEAN.js → image-plus-Cm9jq1yo.js} +1 -1
  273. package/runtime/webapp/dist/assets/index-BAGzBXQc.css +1 -0
  274. package/runtime/webapp/dist/assets/index-YrEOkxAg.js +500 -0
  275. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-BM7P_-u_.js → infoDiagram-27XIBGKW-Crx1iSbW.js} +1 -1
  276. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-Cwd8XR-p.js → ishikawaDiagram-5VMMS53U-ClQPMEk5.js} +1 -1
  277. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-MOgiksTh.js → journeyDiagram-3NMN7TZE-DHso2Xht.js} +1 -1
  278. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DulC5OLL.js → kanban-definition-UXKFOSKX-D6psIAhv.js} +1 -1
  279. package/runtime/webapp/dist/assets/{layout-Dku9sXQ7.js → layout-B6AVZ9v9.js} +1 -1
  280. package/runtime/webapp/dist/assets/{linear-B3-dddD7.js → linear-CEZOUjlB.js} +1 -1
  281. package/runtime/webapp/dist/assets/{list-todo-Bik5IY2r.js → list-todo-D9ChIz0f.js} +1 -1
  282. package/runtime/webapp/dist/assets/{loader-circle-C5C-IzGK.js → loader-circle-CAHZbD5s.js} +1 -1
  283. package/runtime/webapp/dist/assets/{locate-fixed-CHkezEEh.js → locate-fixed-2R48MVg_.js} +1 -1
  284. package/runtime/webapp/dist/assets/{mermaid.core-CRRXKysA.js → mermaid.core-DH0df9xk.js} +5 -5
  285. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-CaaP-nEb.js → mindmap-definition-YA3MSWOX-QWt8leZC.js} +1 -1
  286. package/runtime/webapp/dist/assets/{mobileViewport-CekmYKqS.js → mobileViewport-CKvpvxYc.js} +1 -1
  287. package/runtime/webapp/dist/assets/new-session-window-CiRwM3Od.js +191 -0
  288. package/runtime/webapp/dist/assets/{new-session-window-BfDMd-h3.css → new-session-window-DIU2v1uh.css} +1 -1
  289. package/runtime/webapp/dist/assets/{page-_fFyRId-.js → page-Cd9ci9uo.js} +6 -6
  290. package/runtime/webapp/dist/assets/{pause-BsmUCuwZ.js → pause-ddt7BLlm.js} +1 -1
  291. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BqybPEwk.js → pegDiagram-XKGWAZYB-JNBt0nDx.js} +1 -1
  292. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-BX1H2lh2.js → pieDiagram-E7YTZNPT-g0hnDqNp.js} +1 -1
  293. package/runtime/webapp/dist/assets/{pin-BsEEYq8M.js → pin-BTP5lC_c.js} +1 -1
  294. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-Btnywv1k.js → quadrantDiagram-AXDQQJYC-mLZASjSm.js} +1 -1
  295. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-Da_TV1ER.js → railroadDiagram-O6MQD6OU-CAXNAZhB.js} +1 -1
  296. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-5V1Aow9h.js → requirementDiagram-BXWQKSXE-BC8y1ZXE.js} +1 -1
  297. package/runtime/webapp/dist/assets/{rotate-ccw-BbSby0GQ.js → rotate-ccw-CHFTy38a.js} +1 -1
  298. package/runtime/webapp/dist/assets/{rotate-cw-BMdX-ln4.js → rotate-cw-CFCtRFDl.js} +1 -1
  299. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-D_OIVihV.js → sankeyDiagram-P5KCCOFB-Boi5NPjT.js} +1 -1
  300. package/runtime/webapp/dist/assets/{send-Cb7EWSJF.js → send-CzCncLlt.js} +1 -1
  301. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-LKeF5Mri.js → sequenceDiagram-WJ2MYXX4-D4ccoVEB.js} +1 -1
  302. package/runtime/webapp/dist/assets/{session-dashboard-BFqNDCc8.js → session-dashboard-C0KfSCDl.js} +1 -1
  303. package/runtime/webapp/dist/assets/{session-tree-BK_qaCnb.js → session-tree-CTzXmV6R.js} +1 -1
  304. package/runtime/webapp/dist/assets/{shield-check-C-r87aMq.js → shield-check-Da6EGdIt.js} +1 -1
  305. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-B6j7Q_MN.js → sizeCapture-INFHLROL-Cd5jIVgK.js} +1 -1
  306. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-zhPFqHdQ.js → stateDiagram-D77RDMKH-DXlmaNwu.js} +1 -1
  307. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Dh6coc1l.js +1 -0
  308. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-C_FCENx1.js → swimlanes-42K2YHIH-DyhRB_e0.js} +1 -1
  309. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BzriATjP.js +8 -0
  310. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-C3DBXjDU.js → timeline-definition-24CTP7MA-Bkfs9Mi-.js} +1 -1
  311. package/runtime/webapp/dist/assets/{trash-2-DjggJGbw.js → trash-2-C682LDDA.js} +1 -1
  312. package/runtime/webapp/dist/assets/{types-BQCEWNQz.js → types-CfOuS-6l.js} +1 -1
  313. package/runtime/webapp/dist/assets/{use-session-activity-BbTXGW7Z.js → use-session-activity-C9Cn92Hj.js} +1 -1
  314. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CssdTIB0.js → vennDiagram-4TSXK5OY-APWT64sw.js} +1 -1
  315. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C58K2vVU.js → wardleyDiagram-VM6X3IG4-H7xLoxwM.js} +1 -1
  316. package/runtime/webapp/dist/assets/{web-B4y8vdRZ.js → web-CT8e03DV.js} +1 -1
  317. package/runtime/webapp/dist/assets/{web-D9rJZXHW.js → web-DG022HwJ.js} +1 -1
  318. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CQi8bD6A.js → xychartDiagram-S5SC5T6Z-DIrxZ4UJ.js} +1 -1
  319. package/runtime/webapp/dist/assets/{zoom-out-iMMWRXJs.js → zoom-out-CRN76HNZ.js} +1 -1
  320. package/runtime/webapp/dist/index.html +2 -2
  321. package/runtime/ws-server.mjs +5 -0
  322. package/runtime/.next/static/chunks/app/web/layout-80fa1b5f4c96b0b5.js +0 -1
  323. package/runtime/.next/static/chunks/main-app-ea4c5663714943e2.js +0 -1
  324. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0e6mn0ck.mjs +0 -17
  325. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0ssqfy51.mjs +0 -18
  326. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82ghff97.mjs +0 -39
  327. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82yhcz2x.mjs +0 -17
  328. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b8jr1m8m.mjs +0 -23
  329. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cj0jh226.mjs +0 -17
  330. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ebtbxtjf.mjs +0 -28
  331. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-pb4erfqh.mjs +0 -42
  332. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rs058s2g.mjs +0 -16
  333. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-w6pv4szb.mjs +0 -18
  334. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-wjeh40nr.mjs +0 -20
  335. package/runtime/webapp/dist/assets/AIHubView-CM6ugXG3.js +0 -1
  336. package/runtime/webapp/dist/assets/AiHubPane-DFzC3nbd.js +0 -1
  337. package/runtime/webapp/dist/assets/App-mF6ELC07.js +0 -68
  338. package/runtime/webapp/dist/assets/BrowserLivePanel-CamAULwS.js +0 -61
  339. package/runtime/webapp/dist/assets/CalendarPage-BbYdGYWn.js +0 -1
  340. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CWhmFQtA.js +0 -1
  341. package/runtime/webapp/dist/assets/CollaborationDashboard-XL5SnFOu.js +0 -1
  342. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BXDuKlrL.js +0 -1
  343. package/runtime/webapp/dist/assets/FlowStudioPane-lnjLcd9c.js +0 -5
  344. package/runtime/webapp/dist/assets/HostProjectPicker-DN_vGqQb.js +0 -1
  345. package/runtime/webapp/dist/assets/NewSessionWindow-zjqAUfKb.js +0 -1
  346. package/runtime/webapp/dist/assets/RemoteDesktopPage-9AhztqA2.js +0 -1
  347. package/runtime/webapp/dist/assets/TodoPage-guIvBCW0.js +0 -1
  348. package/runtime/webapp/dist/assets/artifact-links-B0ApmgK6.js +0 -2
  349. package/runtime/webapp/dist/assets/channel-BwDuyJO4.js +0 -1
  350. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BfyV8P0w.js +0 -1
  351. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BfyV8P0w.js +0 -1
  352. package/runtime/webapp/dist/assets/composer-file-routing-qSvJpT-v.js +0 -6
  353. package/runtime/webapp/dist/assets/download-BE31-Qm0.js +0 -6
  354. package/runtime/webapp/dist/assets/index-DSgLFE4Q.js +0 -489
  355. package/runtime/webapp/dist/assets/index-zQk0NCEB.css +0 -1
  356. package/runtime/webapp/dist/assets/new-session-window-Dgl7UWPR.js +0 -190
  357. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DWnBZAiI.js +0 -1
  358. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-DOZCbCJP.js +0 -8
  359. package/runtime/webapp/dist/assets/x-BYUglEo9.js +0 -6
  360. /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → _rMvYWpbWkNWrFkCQx3rK}/_buildManifest.js +0 -0
  361. /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → _rMvYWpbWkNWrFkCQx3rK}/_ssgManifest.js +0 -0
@@ -1074,7 +1074,7 @@ var unthrottledIntervalCallbacks = /* @__PURE__ */ new Map();
1074
1074
  var shouldUseNativeTimers = () => {
1075
1075
  return typeof window === "undefined";
1076
1076
  };
1077
- var unthrottledTimerWorkerMain = () => {
1077
+ var unthrottledTimerWorkerCode = () => {
1078
1078
  const timeoutHandles = /* @__PURE__ */ new Map();
1079
1079
  const intervalHandles = /* @__PURE__ */ new Map();
1080
1080
  self.onmessage = (event) => {
@@ -1126,10 +1126,7 @@ var getUnthrottledTimerWorker = () => {
1126
1126
  if (unthrottledTimerWorker) {
1127
1127
  return unthrottledTimerWorker;
1128
1128
  }
1129
- const workerSource = `(${unthrottledTimerWorkerMain.toString()})();`;
1130
- const workerURL = URL.createObjectURL(new Blob([workerSource], { type: "text/javascript" }));
1131
- unthrottledTimerWorker = new Worker(workerURL);
1132
- URL.revokeObjectURL(workerURL);
1129
+ unthrottledTimerWorker = createWorker("unthrottled-timer", unthrottledTimerWorkerCode);
1133
1130
  unthrottledTimerWorker.onmessage = (event) => {
1134
1131
  const message = event.data;
1135
1132
  const timeoutCallback = unthrottledTimeoutCallbacks.get(message.timerId);
@@ -1145,6 +1142,24 @@ var getUnthrottledTimerWorker = () => {
1145
1142
  };
1146
1143
  return unthrottledTimerWorker;
1147
1144
  };
1145
+ var workerBlobUrls = /* @__PURE__ */ new Map();
1146
+ var createWorker = (name, workerMain) => {
1147
+ const workerUrl = globalThis[Symbol.for("mediabunny:workerUrl")];
1148
+ if (workerUrl !== void 0 && typeof workerUrl !== "string" && !(workerUrl instanceof URL)) {
1149
+ throw new TypeError(
1150
+ "globalThis[Symbol.for('mediabunny:workerUrl')], when provided, must be a string or URL."
1151
+ );
1152
+ }
1153
+ if (workerUrl !== void 0) {
1154
+ return new Worker(workerUrl, { name });
1155
+ }
1156
+ let blobUrl = workerBlobUrls.get(workerMain);
1157
+ if (!blobUrl) {
1158
+ blobUrl = URL.createObjectURL(new Blob([`(${workerMain.toString()})();`], { type: "text/javascript" }));
1159
+ workerBlobUrls.set(workerMain, blobUrl);
1160
+ }
1161
+ return new Worker(blobUrl, { name });
1162
+ };
1148
1163
  var setIntervalUnthrottled = (callback, delay) => {
1149
1164
  if (shouldUseNativeTimers()) {
1150
1165
  return { id: setInterval(callback, delay) };
@@ -2233,7 +2248,7 @@ var EAC3_REDUCED_SAMPLE_RATES = [24e3, 22050, 16e3];
2233
2248
  var TRUEHD_MAJOR_SYNC_WORD = 4168249274;
2234
2249
 
2235
2250
  // src/version.ts
2236
- var VERSION = "1.66.2";
2251
+ var VERSION = "1.66.4";
2237
2252
  var VERSIONED_NAME = `Mediabunny v${VERSION}`;
2238
2253
 
2239
2254
  // src/codec-data.ts
@@ -9251,10 +9266,9 @@ var createAes128CbcDecryptStream = (reader, getInit, close) => {
9251
9266
  return new ReadableStream({
9252
9267
  pull: async (controller) => {
9253
9268
  try {
9254
- if (!initted) {
9255
- aesContext.init(await getInit());
9256
- initted = true;
9257
- }
9269
+ const initPromise = initted ? null : Promise.resolve(getInit());
9270
+ void initPromise?.catch(() => {
9271
+ });
9258
9272
  const requestedLength = CHUNK_SIZE + BLOCK_SIZE;
9259
9273
  let nextSlice = reader.requestSliceRange(pos, 0, requestedLength);
9260
9274
  if (isThenable(nextSlice)) nextSlice = await nextSlice;
@@ -9268,6 +9282,10 @@ var createAes128CbcDecryptStream = (reader, getInit, close) => {
9268
9282
  const bytesToRead = sliceLength === requestedLength ? sliceLength - BLOCK_SIZE : sliceLength;
9269
9283
  const input = readBytes(nextSlice, bytesToRead);
9270
9284
  const output = new Uint8Array(bytesToRead);
9285
+ if (initPromise) {
9286
+ aesContext.init(await initPromise);
9287
+ initted = true;
9288
+ }
9271
9289
  for (let i = 0; i < bytesToRead; i += 16) {
9272
9290
  aesContext.in.set(input.subarray(i, i + 16));
9273
9291
  aesContext.decrypt();
@@ -9398,7 +9416,10 @@ var IsobmffDemuxer = class _IsobmffDemuxer extends Demuxer {
9398
9416
  }
9399
9417
  currentPos = startPos + boxInfo.totalSize;
9400
9418
  }
9401
- if (!foundMovieBoxes && this.input._initInput) {
9419
+ if (!foundMovieBoxes) {
9420
+ if (!this.input._initInput) {
9421
+ throw new Error('No "moov" box found; the file is invalid or incomplete.');
9422
+ }
9402
9423
  await this.copyMetadataFromInitInput(this.input._initInput);
9403
9424
  }
9404
9425
  if (lookForMfraBox) {
@@ -12003,6 +12024,10 @@ var IsobmffTrackBacking = class {
12003
12024
  if (!sampleInfo) {
12004
12025
  return null;
12005
12026
  }
12027
+ const fileSize = this.internalTrack.demuxer.reader.fileSize;
12028
+ if (fileSize !== null && sampleInfo.sampleOffset + sampleInfo.sampleSize > fileSize) {
12029
+ return null;
12030
+ }
12006
12031
  let data;
12007
12032
  if (options.metadataOnly && this.internalTrack.info?.codec !== "eac3") {
12008
12033
  data = PLACEHOLDER_DATA;
@@ -12057,6 +12082,10 @@ var IsobmffTrackBacking = class {
12057
12082
  const trackData = fragment.trackData.get(this.internalTrack.id);
12058
12083
  const fragmentSample = trackData.samples[sampleIndex];
12059
12084
  assert(fragmentSample);
12085
+ const fileSize = this.internalTrack.demuxer.reader.fileSize;
12086
+ if (fileSize !== null && fragmentSample.byteOffset + fragmentSample.byteSize > fileSize) {
12087
+ return null;
12088
+ }
12060
12089
  let data;
12061
12090
  if (options.metadataOnly && this.internalTrack.info?.codec !== "eac3") {
12062
12091
  data = PLACEHOLDER_DATA;
@@ -13479,6 +13508,9 @@ var MatroskaDemuxer = class extends Demuxer {
13479
13508
  assertDefinedSize(size);
13480
13509
  currentPos = dataStartPos + size;
13481
13510
  }
13511
+ if (this.segments.length === 0) {
13512
+ throw new Error("No Segment element found; the file is invalid or incomplete.");
13513
+ }
13482
13514
  })();
13483
13515
  }
13484
13516
  async readSegment(segmentDataStart, dataSize) {
@@ -17123,6 +17155,10 @@ var Mp3AudioTrackBacking = class {
17123
17155
  if (!rawSample) {
17124
17156
  return null;
17125
17157
  }
17158
+ const fileSize = this.demuxer.reader.fileSize;
17159
+ if (fileSize !== null && rawSample.dataStart + rawSample.dataSize > fileSize) {
17160
+ return null;
17161
+ }
17126
17162
  let data;
17127
17163
  if (options.metadataOnly) {
17128
17164
  data = PLACEHOLDER_DATA;
@@ -18943,6 +18979,10 @@ var AdtsAudioTrackBacking = class {
18943
18979
  if (!rawSample) {
18944
18980
  return null;
18945
18981
  }
18982
+ const fileSize = this.demuxer.reader.fileSize;
18983
+ if (fileSize !== null && rawSample.dataStart + rawSample.dataSize > fileSize) {
18984
+ return null;
18985
+ }
18946
18986
  let data;
18947
18987
  if (options.metadataOnly) {
18948
18988
  data = PLACEHOLDER_DATA;
@@ -19728,6 +19768,7 @@ var MpegTsDemuxer = class _MpegTsDemuxer extends Demuxer {
19728
19768
  let programMapPid = null;
19729
19769
  let hasProgramAssociationTable = false;
19730
19770
  let hasProgramMap = false;
19771
+ let initDemuxer = null;
19731
19772
  while (true) {
19732
19773
  const packetHeader = await this.readPacketHeader(currentPos);
19733
19774
  if (!packetHeader) {
@@ -19968,22 +20009,26 @@ var MpegTsDemuxer = class _MpegTsDemuxer extends Demuxer {
19968
20009
  }
19969
20010
  elementaryStream.firstSection = section;
19970
20011
  elementaryStream.canBeTrustedWithKeyPackets = section.randomAccessIndicator === 1;
19971
- if (this.input._initInput) {
19972
- const initDemuxer = await this.input._initInput._getDemuxer();
19973
- if (initDemuxer.constructor !== _MpegTsDemuxer) {
19974
- throw new Error("Init input must match the input's format.");
19975
- }
19976
- await initDemuxer.readMetadata();
19977
- const matchingStream = initDemuxer.elementaryStreams.find((x) => x.pid === section.pid && x.info.codec === elementaryStream.info.codec && x.initialized);
19978
- if (matchingStream) {
19979
- elementaryStream.info = matchingStream.info;
19980
- elementaryStream.initialized = true;
19981
- break outer;
19982
- }
19983
- }
19984
20012
  const context = new PacketReadingContext(elementaryStream, section.startPos);
19985
20013
  if (elementaryStream.info.type === "video") {
20014
+ let packetCount = 0;
19986
20015
  while (true) {
20016
+ if (packetCount === 1 && this.input._initInput) {
20017
+ if (!initDemuxer) {
20018
+ initDemuxer = await this.input._initInput._getDemuxer();
20019
+ if (initDemuxer.constructor !== _MpegTsDemuxer) {
20020
+ throw new Error("Init input must match the input's format.");
20021
+ }
20022
+ await initDemuxer.readMetadata();
20023
+ }
20024
+ const matchingStream = initDemuxer.elementaryStreams.find((x) => x.pid === section.pid && x.info.codec === elementaryStream.info.codec && x.initialized);
20025
+ if (matchingStream) {
20026
+ elementaryStream.info = matchingStream.info;
20027
+ elementaryStream.initialized = true;
20028
+ break outer;
20029
+ }
20030
+ }
20031
+ packetCount++;
19987
20032
  const contextAlias = context;
19988
20033
  contextAlias.suppliedPacket = null;
19989
20034
  await context.markNextPacket();
@@ -21736,7 +21781,7 @@ var SegmentedInput = class {
21736
21781
  if (!this.firstSegment) {
21737
21782
  return [];
21738
21783
  }
21739
- const input = this.getInputForSegment(this.firstSegment);
21784
+ const input = this.getInputForSegment(this.firstSegment.initSegment ?? this.firstSegment);
21740
21785
  const inputTracks = await input.getTracks();
21741
21786
  for (const track of inputTracks) {
21742
21787
  if (track.type === "video") {
@@ -21804,34 +21849,34 @@ var SegmentedInputInputTrackBacking = class {
21804
21849
  constructor(segmentedInput, decl, number) {
21805
21850
  this.packetInfos = /* @__PURE__ */ new WeakMap();
21806
21851
  this.hydrationPromise = null;
21807
- this.firstInputTrack = null;
21808
- this.firstSegment = null;
21852
+ this.metadataInputTrack = null;
21809
21853
  this.segmentedInput = segmentedInput;
21810
21854
  this.decl = decl;
21811
21855
  this.number = number;
21812
21856
  }
21813
21857
  hydrate() {
21814
21858
  return this.hydrationPromise ??= (async () => {
21815
- this.segmentedInput.firstSegment ??= await this.segmentedInput.getFirstSegment({});
21816
- if (!this.segmentedInput.firstSegment) {
21817
- throw new Error("Missing first segment, can't retrieve track.");
21818
- }
21819
- let currentSegment = this.segmentedInput.firstSegment;
21859
+ const firstSegment = await this.getFirstSegment();
21820
21860
  let track = null;
21821
- while (currentSegment) {
21822
- const input = this.segmentedInput.getInputForSegment(currentSegment);
21823
- const inputTracks = await input.getTracks();
21861
+ if (firstSegment.initSegment) {
21862
+ const inputTracks = await this.segmentedInput.getInputForSegment(firstSegment.initSegment).getTracks();
21824
21863
  track = inputTracks.find((x) => x.type === this.decl.type && x.number === this.number) ?? null;
21825
- if (track) {
21826
- break;
21864
+ } else {
21865
+ let currentSegment = firstSegment;
21866
+ while (currentSegment) {
21867
+ const input = this.segmentedInput.getInputForSegment(currentSegment);
21868
+ const inputTracks = await input.getTracks();
21869
+ track = inputTracks.find((x) => x.type === this.decl.type && x.number === this.number) ?? null;
21870
+ if (track) {
21871
+ break;
21872
+ }
21873
+ currentSegment = await this.segmentedInput.getNextSegment(currentSegment, {});
21827
21874
  }
21828
- currentSegment = await this.segmentedInput.getNextSegment(currentSegment, {});
21829
21875
  }
21830
21876
  if (!track) {
21831
21877
  throw new Error("No matching track found in underlying media data.");
21832
21878
  }
21833
- this.firstInputTrack = track;
21834
- this.firstSegment = currentSegment;
21879
+ this.metadataInputTrack = track;
21835
21880
  })();
21836
21881
  }
21837
21882
  getType() {
@@ -21842,53 +21887,52 @@ var SegmentedInputInputTrackBacking = class {
21842
21887
  }
21843
21888
  /** If the backing track is already present, delegate synchronously; otherwise, hydrate first. */
21844
21889
  delegate(fn) {
21845
- if (this.firstInputTrack) {
21890
+ if (this.metadataInputTrack) {
21846
21891
  return fn();
21847
21892
  }
21848
21893
  return this.hydrate().then(fn);
21849
21894
  }
21850
21895
  async getDecoderConfig() {
21851
- return this.delegate(() => this.firstInputTrack._backing.getDecoderConfig());
21896
+ return this.delegate(() => this.metadataInputTrack._backing.getDecoderConfig());
21852
21897
  }
21853
21898
  getHasOnlyKeyPackets() {
21854
21899
  return this.delegate(() => {
21855
- return this.segmentedInput.hasOnlyKeyPackets || (this.firstInputTrack._backing.getHasOnlyKeyPackets?.() ?? null);
21900
+ return this.segmentedInput.hasOnlyKeyPackets || (this.metadataInputTrack._backing.getHasOnlyKeyPackets?.() ?? null);
21856
21901
  });
21857
21902
  }
21858
21903
  getPairingMask() {
21859
21904
  return 1n;
21860
21905
  }
21861
21906
  getCodec() {
21862
- return this.delegate(() => this.firstInputTrack._backing.getCodec());
21907
+ return this.delegate(() => this.metadataInputTrack._backing.getCodec());
21863
21908
  }
21864
21909
  getInternalCodecId() {
21865
- return this.delegate(() => this.firstInputTrack._backing.getInternalCodecId());
21910
+ return this.delegate(() => this.metadataInputTrack._backing.getInternalCodecId());
21866
21911
  }
21867
21912
  getDisposition() {
21868
- return this.delegate(() => this.firstInputTrack._backing.getDisposition());
21913
+ return this.delegate(() => this.metadataInputTrack._backing.getDisposition());
21869
21914
  }
21870
21915
  getLanguageCode() {
21871
- return this.delegate(() => this.firstInputTrack._backing.getLanguageCode());
21916
+ return this.delegate(() => this.metadataInputTrack._backing.getLanguageCode());
21872
21917
  }
21873
21918
  getName() {
21874
- return this.delegate(() => this.firstInputTrack._backing.getName());
21919
+ return this.delegate(() => this.metadataInputTrack._backing.getName());
21875
21920
  }
21876
21921
  getTimeResolution() {
21877
- return this.delegate(() => this.firstInputTrack._backing.getTimeResolution());
21922
+ return this.delegate(() => this.metadataInputTrack._backing.getTimeResolution());
21878
21923
  }
21879
21924
  async isRelativeToUnixEpoch() {
21880
- await this.hydrate();
21881
- assert(this.segmentedInput.firstSegment);
21882
- return this.segmentedInput.firstSegment.unixEpochTimestamp === this.segmentedInput.firstSegment.timestamp;
21925
+ const firstSegment = await this.getFirstSegment();
21926
+ return firstSegment.unixEpochTimestamp === firstSegment.timestamp;
21883
21927
  }
21884
21928
  getUnixTimeForTimestamp(timestamp) {
21885
21929
  return this.segmentedInput.getUnixTimeForTimestamp(timestamp);
21886
21930
  }
21887
21931
  getBitrate() {
21888
- return this.delegate(() => this.firstInputTrack._backing.getBitrate());
21932
+ return this.delegate(() => this.metadataInputTrack._backing.getBitrate());
21889
21933
  }
21890
21934
  getAverageBitrate() {
21891
- return this.delegate(() => this.firstInputTrack._backing.getAverageBitrate());
21935
+ return this.delegate(() => this.metadataInputTrack._backing.getAverageBitrate());
21892
21936
  }
21893
21937
  getDurationFromMetadata(options) {
21894
21938
  return this.segmentedInput.getDurationFromMetadata(options);
@@ -21898,9 +21942,9 @@ var SegmentedInputInputTrackBacking = class {
21898
21942
  }
21899
21943
  async createAdjustedPacket(packet, segment, track) {
21900
21944
  assert(packet.sequenceNumber >= 0);
21901
- assert(this.segmentedInput.firstSegment);
21945
+ const firstSegment = await this.getFirstSegment();
21902
21946
  const mediaOffset = await this.segmentedInput.getMediaOffset(segment, track.input);
21903
- const segmentTimestampRelativeToFirst = segment.timestamp - this.segmentedInput.firstSegment.timestamp;
21947
+ const segmentTimestampRelativeToFirst = segment.timestamp - firstSegment.timestamp;
21904
21948
  const modified = packet.clone({
21905
21949
  timestamp: roundToDivisor(
21906
21950
  packet.timestamp + mediaOffset,
@@ -21918,30 +21962,33 @@ var SegmentedInputInputTrackBacking = class {
21918
21962
  return modified;
21919
21963
  }
21920
21964
  async getFirstPacket(options) {
21921
- await this.hydrate();
21922
- assert(this.firstInputTrack);
21923
- assert(this.firstSegment);
21924
- let currentTrack = this.firstInputTrack;
21925
- let currentSegment = this.firstSegment;
21926
- while (true) {
21927
- if (currentTrack) {
21928
- const packet = await currentTrack._backing.getFirstPacket(options);
21965
+ const firstSegment = await this.getFirstSegment();
21966
+ void this.segmentedInput.getMediaOffsetForDiscontinuity(firstSegment.discontinuityNumber).catch(() => {
21967
+ });
21968
+ let currentSegment = firstSegment;
21969
+ while (currentSegment) {
21970
+ const input = this.segmentedInput.getInputForSegment(currentSegment);
21971
+ const tracks = await input.getTracks();
21972
+ const track = tracks.find((t) => t.type === this.decl.type && t.number === this.number);
21973
+ if (track) {
21974
+ const packet = await track._backing.getFirstPacket(options);
21929
21975
  if (packet) {
21930
- return this.createAdjustedPacket(packet, currentSegment, currentTrack);
21976
+ return this.createAdjustedPacket(packet, currentSegment, track);
21931
21977
  }
21932
21978
  }
21933
21979
  currentSegment = await this.segmentedInput.getNextSegment(currentSegment, {
21934
21980
  skipLiveWait: options.skipLiveWait
21935
21981
  });
21936
- if (!currentSegment) {
21937
- break;
21938
- }
21939
- const nextInput = this.segmentedInput.getInputForSegment(currentSegment);
21940
- const nextTracks = await nextInput.getTracks();
21941
- currentTrack = nextTracks.find((t) => t.type === this.firstInputTrack.type && t.number === this.firstInputTrack.number) ?? null;
21942
21982
  }
21943
21983
  return null;
21944
21984
  }
21985
+ async getFirstSegment() {
21986
+ this.segmentedInput.firstSegment ??= await this.segmentedInput.getFirstSegment({});
21987
+ if (!this.segmentedInput.firstSegment) {
21988
+ throw new Error("Missing first segment, can't retrieve track.");
21989
+ }
21990
+ return this.segmentedInput.firstSegment;
21991
+ }
21945
21992
  getNextPacket(packet, options) {
21946
21993
  return this._getNextInternal(packet, options, false);
21947
21994
  }
@@ -21997,11 +22044,12 @@ var SegmentedInputInputTrackBacking = class {
21997
22044
  if (!currentSegment) {
21998
22045
  return null;
21999
22046
  }
22000
- await this.hydrate();
22047
+ void this.segmentedInput.getMediaOffsetForDiscontinuity(currentSegment.discontinuityNumber).catch(() => {
22048
+ });
22001
22049
  while (currentSegment) {
22002
22050
  const input = this.segmentedInput.getInputForSegment(currentSegment);
22003
22051
  const tracks = await input.getTracks();
22004
- const track = tracks.find((t) => t.type === this.firstInputTrack.type && t.number === this.firstInputTrack.number);
22052
+ const track = tracks.find((t) => t.type === this.decl.type && t.number === this.number);
22005
22053
  if (!track) {
22006
22054
  currentSegment = await this.segmentedInput.getPreviousSegment(currentSegment, {
22007
22055
  skipLiveWait: options.skipLiveWait
@@ -22041,7 +22089,7 @@ var SegmentedInputInputTrackBacking = class {
22041
22089
  if (nextSegment) {
22042
22090
  const nextInput = this.segmentedInput.getInputForSegment(nextSegment);
22043
22091
  const nextTracks = await nextInput.getTracks();
22044
- const nextTrack = nextTracks.find((t) => t.type === this.firstInputTrack.type && t.number === this.firstInputTrack.number);
22092
+ const nextTrack = nextTracks.find((t) => t.type === this.decl.type && t.number === this.number);
22045
22093
  let nextPacket = nextTrack ? await nextTrack._backing.getFirstPacket({ ...options, metadataOnly: true }) : null;
22046
22094
  if (nextPacket && keyframesOnly && nextPacket.type !== "key") {
22047
22095
  nextPacket = await nextTrack._backing.getNextKeyPacket(nextPacket, {
@@ -22077,31 +22125,31 @@ var SegmentedInputInputVideoTrackBacking = class extends SegmentedInputInputTrac
22077
22125
  return "video";
22078
22126
  }
22079
22127
  getCodec() {
22080
- return this.delegate(() => this.firstInputTrack._backing.getCodec());
22128
+ return this.delegate(() => this.metadataInputTrack._backing.getCodec());
22081
22129
  }
22082
22130
  getCodedWidth() {
22083
- return this.delegate(() => this.firstInputTrack._backing.getCodedWidth());
22131
+ return this.delegate(() => this.metadataInputTrack._backing.getCodedWidth());
22084
22132
  }
22085
22133
  getCodedHeight() {
22086
- return this.delegate(() => this.firstInputTrack._backing.getCodedHeight());
22134
+ return this.delegate(() => this.metadataInputTrack._backing.getCodedHeight());
22087
22135
  }
22088
22136
  getSquarePixelWidth() {
22089
- return this.delegate(() => this.firstInputTrack._backing.getSquarePixelWidth());
22137
+ return this.delegate(() => this.metadataInputTrack._backing.getSquarePixelWidth());
22090
22138
  }
22091
22139
  getSquarePixelHeight() {
22092
- return this.delegate(() => this.firstInputTrack._backing.getSquarePixelHeight());
22140
+ return this.delegate(() => this.metadataInputTrack._backing.getSquarePixelHeight());
22093
22141
  }
22094
22142
  getTransformationMatrix() {
22095
- return this.delegate(() => this.firstInputTrack._backing.getTransformationMatrix());
22143
+ return this.delegate(() => this.metadataInputTrack._backing.getTransformationMatrix());
22096
22144
  }
22097
22145
  async getColorSpace() {
22098
- return this.delegate(() => this.firstInputTrack._backing.getColorSpace());
22146
+ return this.delegate(() => this.metadataInputTrack._backing.getColorSpace());
22099
22147
  }
22100
22148
  async canBeTransparent() {
22101
- return this.delegate(() => this.firstInputTrack._backing.canBeTransparent());
22149
+ return this.delegate(() => this.metadataInputTrack._backing.canBeTransparent());
22102
22150
  }
22103
22151
  async getDecoderConfig() {
22104
- return this.delegate(() => this.firstInputTrack._backing.getDecoderConfig());
22152
+ return this.delegate(() => this.metadataInputTrack._backing.getDecoderConfig());
22105
22153
  }
22106
22154
  };
22107
22155
  var SegmentedInputInputAudioTrackBacking = class extends SegmentedInputInputTrackBacking {
@@ -22109,16 +22157,16 @@ var SegmentedInputInputAudioTrackBacking = class extends SegmentedInputInputTrac
22109
22157
  return "audio";
22110
22158
  }
22111
22159
  getCodec() {
22112
- return this.delegate(() => this.firstInputTrack._backing.getCodec());
22160
+ return this.delegate(() => this.metadataInputTrack._backing.getCodec());
22113
22161
  }
22114
22162
  getNumberOfChannels() {
22115
- return this.delegate(() => this.firstInputTrack._backing.getNumberOfChannels());
22163
+ return this.delegate(() => this.metadataInputTrack._backing.getNumberOfChannels());
22116
22164
  }
22117
22165
  getSampleRate() {
22118
- return this.delegate(() => this.firstInputTrack._backing.getSampleRate());
22166
+ return this.delegate(() => this.metadataInputTrack._backing.getSampleRate());
22119
22167
  }
22120
22168
  async getDecoderConfig() {
22121
- return this.delegate(() => this.firstInputTrack._backing.getDecoderConfig());
22169
+ return this.delegate(() => this.metadataInputTrack._backing.getDecoderConfig());
22122
22170
  }
22123
22171
  };
22124
22172
 
@@ -24493,8 +24541,12 @@ var HlsSegmentedInput = class extends SegmentedInput {
24493
24541
  return cacheEntry.input;
24494
24542
  }
24495
24543
  let initInput = null;
24496
- if (hlsSegment.initSegment || hlsSegment.firstSegment) {
24497
- initInput = this.getInputForSegment(hlsSegment.initSegment ?? hlsSegment.firstSegment);
24544
+ if (hlsSegment.initSegment) {
24545
+ initInput = this.getInputForSegment(hlsSegment.initSegment);
24546
+ void initInput.getTracks().catch(() => {
24547
+ });
24548
+ } else if (hlsSegment.firstSegment) {
24549
+ initInput = this.getInputForSegment(hlsSegment.firstSegment);
24498
24550
  }
24499
24551
  const formatOptions = {
24500
24552
  ...this.input._formatOptions,
@@ -24615,17 +24667,21 @@ var HlsSegmentedInput = class extends SegmentedInput {
24615
24667
  }
24616
24668
  getFirstSegmentTimestampOffset() {
24617
24669
  return this.segmentTimestampOffsetPromise ??= (async () => {
24618
- const firstSegment = await this.getFirstSegment();
24619
- assert(firstSegment);
24620
24670
  const referenceSegmentedInput = this.demuxer.getReferenceSegmentedInput();
24621
24671
  if (this === referenceSegmentedInput) {
24622
24672
  return 0;
24623
24673
  }
24624
- const referenceFirstSegment = await referenceSegmentedInput.getFirstSegment();
24674
+ const [firstSegment, referenceFirstSegment] = await Promise.all([
24675
+ this.getFirstSegment(),
24676
+ referenceSegmentedInput.getFirstSegment()
24677
+ ]);
24678
+ assert(firstSegment);
24625
24679
  if (referenceFirstSegment && (this.listsAllSegments() && referenceSegmentedInput.listsAllSegments() || firstSegment.unixEpochTimestamp === firstSegment.timestamp && referenceFirstSegment.unixEpochTimestamp === referenceFirstSegment.timestamp)) {
24626
24680
  return 0;
24627
24681
  }
24628
24682
  const input = this.getInputForSegment(firstSegment);
24683
+ void this.getMediaOffsetForDiscontinuity(firstSegment.discontinuityNumber).catch(() => {
24684
+ });
24629
24685
  if (await this.getRawTimestampOffset(input) === null) {
24630
24686
  return 0;
24631
24687
  }
@@ -25271,14 +25327,17 @@ var HlsInputTrackBacking = class {
25271
25327
  return this.internalTrack.hasOnlyKeyPackets || null;
25272
25328
  }
25273
25329
  async getFirstPacket(options) {
25330
+ this.prefetchReferencePlaylist();
25274
25331
  await this.hydrate();
25275
25332
  return this.internalTrack.backingTrack.getFirstPacket(options);
25276
25333
  }
25277
25334
  async getPacket(timestamp, options) {
25335
+ this.prefetchReferencePlaylist();
25278
25336
  await this.hydrate();
25279
25337
  return this.internalTrack.backingTrack.getPacket(timestamp, options);
25280
25338
  }
25281
25339
  async getKeyPacket(timestamp, options) {
25340
+ this.prefetchReferencePlaylist();
25282
25341
  await this.hydrate();
25283
25342
  return this.internalTrack.backingTrack.getKeyPacket(timestamp, options);
25284
25343
  }
@@ -25290,6 +25349,10 @@ var HlsInputTrackBacking = class {
25290
25349
  await this.hydrate();
25291
25350
  return this.internalTrack.backingTrack.getNextKeyPacket(packet, options);
25292
25351
  }
25352
+ prefetchReferencePlaylist() {
25353
+ void this.internalTrack.demuxer.getReferenceSegmentedInput().getFirstSegment().catch(() => {
25354
+ });
25355
+ }
25293
25356
  };
25294
25357
  var HlsInputVideoTrackBacking = class extends HlsInputTrackBacking {
25295
25358
  constructor(internalTrack) {
@@ -26984,7 +27047,6 @@ var VideoDecoderWrapper = class extends DecoderWrapper {
26984
27047
  this.sampleQueue.length = 0;
26985
27048
  }
26986
27049
  };
26987
- var mergerWorkerUrl = null;
26988
27050
  var ColorAlphaMerger = class {
26989
27051
  constructor() {
26990
27052
  this.workers = [];
@@ -26994,16 +27056,9 @@ var ColorAlphaMerger = class {
26994
27056
  }
26995
27057
  merge(color, alpha) {
26996
27058
  if (this.workers.length === 0) {
26997
- if (!mergerWorkerUrl) {
26998
- const blob = new Blob(
26999
- [`(${colorAlphaMergerWorkerCode.toString()})()`],
27000
- { type: "application/javascript" }
27001
- );
27002
- mergerWorkerUrl = URL.createObjectURL(blob);
27003
- }
27004
27059
  const poolSize = clamp(navigator.hardwareConcurrency, 1, 4);
27005
27060
  for (let i = 0; i < poolSize; i++) {
27006
- const worker2 = new Worker(mergerWorkerUrl);
27061
+ const worker2 = createWorker("color-alpha-merger", colorAlphaMergerWorkerCode);
27007
27062
  worker2.addEventListener("message", (event) => {
27008
27063
  const data = event.data;
27009
27064
  const pending2 = this.pendingRequests.get(data.id);
@@ -30709,7 +30764,6 @@ var detectAvcChunkTimestampShift = () => {
30709
30764
  return chunkTimestamp === 500;
30710
30765
  })();
30711
30766
  };
30712
- var splitterWorkerUrl = null;
30713
30767
  var ColorAlphaSplitter = class {
30714
30768
  constructor() {
30715
30769
  this.worker = null;
@@ -30718,14 +30772,7 @@ var ColorAlphaSplitter = class {
30718
30772
  }
30719
30773
  split(sourceFrame) {
30720
30774
  if (!this.worker) {
30721
- if (!splitterWorkerUrl) {
30722
- const blob = new Blob(
30723
- [`(${colorAlphaSplitterWorkerCode.toString()})()`],
30724
- { type: "application/javascript" }
30725
- );
30726
- splitterWorkerUrl = URL.createObjectURL(blob);
30727
- }
30728
- this.worker = new Worker(splitterWorkerUrl);
30775
+ this.worker = createWorker("color-alpha-splitter", colorAlphaSplitterWorkerCode);
30729
30776
  this.worker.addEventListener("message", (event) => {
30730
30777
  const data = event.data;
30731
30778
  const pending2 = this.pendingRequests.get(data.id);
@@ -32314,12 +32361,7 @@ var mediaStreamTrackProcessorWorkerCode = () => {
32314
32361
  var nextMediaStreamTrackProcessorWorkerId = 0;
32315
32362
  var mediaStreamTrackProcessorWorker = null;
32316
32363
  var initMediaStreamTrackProcessorWorker = () => {
32317
- const blob = new Blob(
32318
- [`(${mediaStreamTrackProcessorWorkerCode.toString()})()`],
32319
- { type: "application/javascript" }
32320
- );
32321
- const url2 = URL.createObjectURL(blob);
32322
- mediaStreamTrackProcessorWorker = new Worker(url2);
32364
+ mediaStreamTrackProcessorWorker = createWorker("media-stream-track-processor", mediaStreamTrackProcessorWorkerCode);
32323
32365
  };
32324
32366
  var mediaStreamTrackProcessorIsSupportedInWorkerCache = null;
32325
32367
  var mediaStreamTrackProcessorIsSupportedInWorker = async () => {
@@ -35383,8 +35425,8 @@ var tfhd = (trackData) => {
35383
35425
  var tfdt = (trackData) => {
35384
35426
  assert(trackData.currentChunk);
35385
35427
  return fullBox("tfdt", 1, 0, [
35386
- u64(intoTimescale(trackData.currentChunk.startTimestamp, trackData.timescale))
35387
35428
  // Base Media Decode Time
35429
+ u64(intoTimescale(trackData.currentChunk.samples[0].decodeTimestamp, trackData.timescale))
35388
35430
  ]);
35389
35431
  };
35390
35432
  var trun = (trackData) => {
@@ -37353,16 +37395,27 @@ var IsobmffMuxer2 = class extends Muxer {
37353
37395
  trackData.timestampProcessingQueue.length = 0;
37354
37396
  return;
37355
37397
  }
37356
- const sortedTimestamps = trackData.timestampProcessingQueue.map((x) => x.timestamp).sort((a, b) => a - b);
37398
+ const queue = trackData.timestampProcessingQueue;
37399
+ const sortedTimestamps = queue.map((x) => x.timestamp).sort((a, b) => a - b);
37400
+ const firstTimestampInTimescale = intoTimescale(sortedTimestamps[0], trackData.timescale);
37357
37401
  if (this.isFragmented) {
37358
37402
  trackData.startTimestampOffset ??= Math.min(sortedTimestamps[0], 0);
37359
37403
  } else {
37360
37404
  trackData.startTimestampOffset ??= sortedTimestamps[0];
37361
37405
  }
37362
- for (let i = 0; i < trackData.timestampProcessingQueue.length; i++) {
37363
- const sample = trackData.timestampProcessingQueue[i];
37364
- sample.decodeTimestamp = sortedTimestamps[i];
37365
- const sampleCompositionTimeOffset = intoTimescale(sample.timestamp - sample.decodeTimestamp, trackData.timescale);
37406
+ let groupStartTimescaleUnits;
37407
+ if (trackData.lastTimescaleUnits === null) {
37408
+ groupStartTimescaleUnits = firstTimestampInTimescale;
37409
+ } else {
37410
+ assert(trackData.lastSample);
37411
+ groupStartTimescaleUnits = Math.round(trackData.lastTimescaleUnits) + trackData.lastSample.timescaleUnitsToNextSample;
37412
+ }
37413
+ let lastDecodeStep = 0;
37414
+ for (let i = 0; i < queue.length; i++) {
37415
+ const sample = queue[i];
37416
+ const decodeTimescaleUnits = groupStartTimescaleUnits + intoTimescale(sortedTimestamps[i], trackData.timescale) - firstTimestampInTimescale;
37417
+ sample.decodeTimestamp = decodeTimescaleUnits / trackData.timescale;
37418
+ const sampleCompositionTimeOffset = intoTimescale(sample.timestamp, trackData.timescale) - decodeTimescaleUnits;
37366
37419
  const durationInTimescale = intoTimescale(sample.duration, trackData.timescale);
37367
37420
  if (trackData.lastTimescaleUnits !== null) {
37368
37421
  assert(trackData.lastSample);
@@ -37371,6 +37424,7 @@ var IsobmffMuxer2 = class extends Muxer {
37371
37424
  assert(delta >= 0);
37372
37425
  trackData.lastTimescaleUnits += delta;
37373
37426
  trackData.lastSample.timescaleUnitsToNextSample = delta;
37427
+ lastDecodeStep = delta;
37374
37428
  if (!this.isFragmented) {
37375
37429
  let lastTableEntry = last(trackData.timeToSampleTable);
37376
37430
  assert(lastTableEntry);
@@ -37426,11 +37480,15 @@ var IsobmffMuxer2 = class extends Muxer {
37426
37480
  trackData.timestampProcessingQueue.length = 0;
37427
37481
  assert(trackData.lastSample);
37428
37482
  assert(trackData.lastTimescaleUnits !== null);
37429
- if (nextSample !== void 0 && trackData.lastSample.timescaleUnitsToNextSample === 0) {
37430
- assert(nextSample.type === "key");
37431
- const timescaleUnits = intoTimescale(nextSample.timestamp, trackData.timescale, false);
37432
- const delta = Math.round(timescaleUnits - trackData.lastTimescaleUnits);
37433
- trackData.lastSample.timescaleUnitsToNextSample = delta;
37483
+ if (nextSample) {
37484
+ const nextTimestampInTimescale = intoTimescale(nextSample.timestamp, trackData.timescale);
37485
+ trackData.lastSample.timescaleUnitsToNextSample = Math.max(
37486
+ nextTimestampInTimescale - Math.round(trackData.lastTimescaleUnits),
37487
+ // With open GOPs, the last sample's decode timestamp may already lie past the next key frame. Then, it
37488
+ // still gets a regular decode step to keep decode timestamps strictly increasing, and the next group
37489
+ // starts later. If we didn't do this, we'd get duplicate DTSs.
37490
+ lastDecodeStep
37491
+ );
37434
37492
  }
37435
37493
  }
37436
37494
  async registerSample(trackData, sample) {