agentroam-runtime-darwin-arm64 0.2.0-preview.81 → 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 (364) 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/mcp/servers.body +1 -1
  45. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  46. package/runtime/.next/server/app/api/memory/route.js +1 -1
  47. package/runtime/.next/server/app/api/messaging/route.js +1 -1
  48. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
  49. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
  50. package/runtime/.next/server/app/api/notifications/route.js +1 -1
  51. package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
  52. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  53. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  54. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  55. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  56. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  57. package/runtime/.next/server/app/api/projects/route.js +1 -1
  58. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  59. package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
  60. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  61. package/runtime/.next/server/app/api/push/vapid.body +1 -1
  62. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  63. package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
  64. package/runtime/.next/server/app/api/session-views/route.js +1 -1
  65. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  67. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  69. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  70. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  73. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  74. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  75. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  76. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  77. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  78. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  79. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  80. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  81. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  82. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  83. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  84. package/runtime/.next/server/app/api/settings/route.js +1 -1
  85. package/runtime/.next/server/app/api/skills/route.js +1 -1
  86. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
  87. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
  88. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
  89. package/runtime/.next/server/app/api/todos/route.js +1 -1
  90. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  91. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  92. package/runtime/.next/server/app/api/tools/route.js +1 -1
  93. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  94. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  95. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  96. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  97. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  98. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  99. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  100. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  101. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  102. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  103. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  104. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  105. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  106. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  107. package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
  108. package/runtime/.next/server/app/web/page.js +4 -4
  109. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  110. package/runtime/.next/server/app-paths-manifest.json +34 -33
  111. package/runtime/.next/server/chunks/1298.js +1 -1
  112. package/runtime/.next/server/chunks/5303.js +2 -2
  113. package/runtime/.next/server/chunks/5801.js +1 -1
  114. package/runtime/.next/server/chunks/6703.js +1 -1
  115. package/runtime/.next/server/chunks/9119.js +3 -3
  116. package/runtime/.next/server/chunks/9457.js +1 -1
  117. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  118. package/runtime/.next/server/pages/404.html +1 -1
  119. package/runtime/.next/server/pages/500.html +1 -1
  120. package/runtime/.next/server/server-reference-manifest.json +1 -1
  121. package/runtime/.next/static/chunks/app/web/error-828d278147a0619d.js +1 -0
  122. package/runtime/.next/static/chunks/app/web/layout-1127176e7e88e395.js +1 -0
  123. package/runtime/.next/static/chunks/app/web/{page-b0da5ef19349a66b.js → page-f008ab6dfeab7ce7.js} +1 -1
  124. package/runtime/.next/static/chunks/{main-68faabab5d101471.js → main-9c08f7656f9692e6.js} +1 -1
  125. package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +1 -0
  126. package/runtime/lib/remote-control/application/paced-video-sender.mjs +20 -1
  127. package/runtime/lib/remote-control/application/remote-video-session.mjs +18 -4
  128. package/runtime/lib/remote-control/infrastructure/native-video-encoder.mjs +15 -2
  129. package/runtime/lib/remote-control/infrastructure/werift-video-transport.mjs +3 -1
  130. package/runtime/lib/remote-control/remote-authorization.mjs +2 -2
  131. package/runtime/lib/remote-control/remote-video-signal.mjs +2 -0
  132. package/runtime/lib/todo-completion-worker.mjs +45 -0
  133. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  134. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  135. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  136. package/runtime/node_modules/.package-lock.json +129 -129
  137. package/runtime/node_modules/@agent/core/dist/index.js +286 -68
  138. package/runtime/node_modules/@agent/native-runtime/dist/index.js +444 -127
  139. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +75 -79
  140. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +52 -52
  141. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2g5j09ba.mjs +16 -0
  142. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-59ydwk0g.mjs +17 -0
  143. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-q4cwy1ja.mjs → core-664d5mmy.mjs} +2 -2
  144. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-zn1abzvs.mjs → core-70sfhqm6.mjs} +2 -2
  145. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-95gcz3n1.mjs +38 -0
  146. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ew5sfvfe.mjs +39 -0
  147. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gjhs7gf6.mjs +20 -0
  148. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-kvdt1szx.mjs +18 -0
  149. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p654hjkr.mjs +22 -0
  150. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-q9bjbxkv.mjs +19 -0
  151. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-samdvsjh.mjs +33 -0
  152. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x6bt758j.mjs +17 -0
  153. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
  154. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +22 -22
  155. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +26 -26
  156. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +22 -23
  157. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +84 -83
  158. package/runtime/node_modules/caniuse-lite/package.json +1 -1
  159. package/runtime/node_modules/mediabunny/README.md +4 -0
  160. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +185 -127
  161. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +11 -11
  162. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +12 -12
  163. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +185 -127
  164. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +185 -127
  165. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.worker.js +8 -0
  166. package/runtime/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js +4 -0
  167. package/runtime/node_modules/mediabunny/dist/modules/src/aes.js +6 -4
  168. package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-demuxer.js +6 -0
  169. package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-segmented-input.js +17 -5
  170. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-boxes.js +2 -1
  171. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +12 -1
  172. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +34 -18
  173. package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +3 -0
  174. package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +3 -8
  175. package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +5 -12
  176. package/runtime/node_modules/mediabunny/dist/modules/src/misc.js +19 -5
  177. package/runtime/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js +4 -0
  178. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +22 -13
  179. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +2 -2
  180. package/runtime/node_modules/mediabunny/dist/modules/src/segmented-input.js +70 -65
  181. package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  182. package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
  183. package/runtime/node_modules/mediabunny/dist/modules/src/worker.js +26 -0
  184. package/runtime/node_modules/mediabunny/package.json +1 -1
  185. package/runtime/node_modules/mediabunny/src/adts/adts-demuxer.ts +5 -0
  186. package/runtime/node_modules/mediabunny/src/aes.ts +7 -4
  187. package/runtime/node_modules/mediabunny/src/hls/hls-demuxer.ts +7 -0
  188. package/runtime/node_modules/mediabunny/src/hls/hls-segmented-input.ts +19 -6
  189. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-boxes.ts +2 -1
  190. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +15 -1
  191. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +37 -19
  192. package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +4 -0
  193. package/runtime/node_modules/mediabunny/src/media-sink.ts +3 -12
  194. package/runtime/node_modules/mediabunny/src/media-source.ts +5 -20
  195. package/runtime/node_modules/mediabunny/src/misc.ts +26 -5
  196. package/runtime/node_modules/mediabunny/src/mp3/mp3-demuxer.ts +5 -0
  197. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +30 -19
  198. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-muxer.ts +2 -2
  199. package/runtime/node_modules/mediabunny/src/segmented-input.ts +76 -79
  200. package/runtime/node_modules/mediabunny/src/version.ts +1 -1
  201. package/runtime/node_modules/mediabunny/src/worker.ts +28 -0
  202. package/runtime/package-lock.json +162 -162
  203. package/runtime/server.js +1 -1
  204. package/runtime/webapp/dist/assets/AIHubView-CNKanNZa.js +1 -0
  205. package/runtime/webapp/dist/assets/{AgentManager-dXI31b0a.js → AgentManager-B8TTqJaL.js} +2 -2
  206. package/runtime/webapp/dist/assets/AiHubPane-Coyn3P-J.js +1 -0
  207. package/runtime/webapp/dist/assets/App-BGIGpBp3.js +68 -0
  208. package/runtime/webapp/dist/assets/BrowserLivePanel-DnzJOz5w.js +61 -0
  209. package/runtime/webapp/dist/assets/CalendarPage-D0oaq2_l.js +1 -0
  210. package/runtime/webapp/dist/assets/{CalendarView-QfbrlL9X.js → CalendarView-QXZbXnXA.js} +3 -3
  211. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CE8OML-A.js +1 -0
  212. package/runtime/webapp/dist/assets/CollaborationDashboard-CV18iiBO.js +1 -0
  213. package/runtime/webapp/dist/assets/{CollaborationPage-B1tiqgnG.js → CollaborationPage-B2mIAc-h.js} +2 -2
  214. package/runtime/webapp/dist/assets/{FilePreview-CPY6dP8Q.js → FilePreview-BCEiERA1.js} +9 -9
  215. package/runtime/webapp/dist/assets/{FileTree-BBgrOian.js → FileTree-CMbs1Gj3.js} +2 -2
  216. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BxFS-0sF.js +1 -0
  217. package/runtime/webapp/dist/assets/FlowStudioPane-CVP0Q6zR.js +5 -0
  218. package/runtime/webapp/dist/assets/HostProjectPicker-DUUgM2Cm.js +1 -0
  219. package/runtime/webapp/dist/assets/{LSPServerList-B-R7HDSP.js → LSPServerList-COMVmsvb.js} +1 -1
  220. package/runtime/webapp/dist/assets/{MCPServerList-CTc0iAwT.js → MCPServerList-C_juD6B4.js} +1 -1
  221. package/runtime/webapp/dist/assets/{MemoryViewer-Dzh_miRv.js → MemoryViewer-Et2vysSN.js} +1 -1
  222. package/runtime/webapp/dist/assets/NewSessionWindow-DwJhkRJd.js +1 -0
  223. package/runtime/webapp/dist/assets/RemoteDesktopPage-Cqsea4X7.js +1 -0
  224. package/runtime/webapp/dist/assets/{RemoteDesktopTabBridge-BA_HQv3V.js → RemoteDesktopTabBridge-BFzNwpUn.js} +1 -1
  225. package/runtime/webapp/dist/assets/{RunningSessionsIcon-BvFSI9OF.js → RunningSessionsIcon-D_cOqmmk.js} +1 -1
  226. package/runtime/webapp/dist/assets/{SessionDashboard-DcPPoXe2.js → SessionDashboard-yjdEKypJ.js} +2 -2
  227. package/runtime/webapp/dist/assets/{SessionDashboardBridge-CjoeUy-v.js → SessionDashboardBridge-Kc_1Et9r.js} +1 -1
  228. package/runtime/webapp/dist/assets/{SettingsPanel-DmdXDQUm.js → SettingsPanel-t26XhKHP.js} +2 -2
  229. package/runtime/webapp/dist/assets/{SkillManager-CS_skFZj.js → SkillManager-nZU7b1sc.js} +1 -1
  230. package/runtime/webapp/dist/assets/{TaskPaneTerminal-BFHDRCb9.js → TaskPaneTerminal-BPaCKman.js} +1 -1
  231. package/runtime/webapp/dist/assets/{TerminalPane-Dr_nY9pI.js → TerminalPane-CiIpI1Id.js} +1 -1
  232. package/runtime/webapp/dist/assets/TodoPage-CG__S6_l.js +1 -0
  233. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-FEEApB15.js → abnfDiagram-VCTEODGH-DmKjGVfG.js} +1 -1
  234. package/runtime/webapp/dist/assets/{arc-CycwMc2c.js → arc-D6bpvBke.js} +1 -1
  235. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BFq9JapX.js → architectureDiagram-5GKGNRK7-NEKc2BYf.js} +1 -1
  236. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DkOJ55Ag.js → blockDiagram-I7D4REHJ-V6G00twZ.js} +1 -1
  237. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-CRvi_3RM.js → c4Diagram-7LVT6UL2-CojA33V5.js} +1 -1
  238. package/runtime/webapp/dist/assets/{calendar-days-CLwKstxM.js → calendar-days-DXE_2mLa.js} +1 -1
  239. package/runtime/webapp/dist/assets/channel-D66Qxmo0.js +1 -0
  240. package/runtime/webapp/dist/assets/{check-8EVJMrTV.js → check-UipgMBET.js} +1 -1
  241. package/runtime/webapp/dist/assets/{chevron-down-ChNxfI2x.js → chevron-down-Dvinwg2S.js} +1 -1
  242. package/runtime/webapp/dist/assets/{chevron-right-Cbkc_d70.js → chevron-right-BGU3tcLA.js} +1 -1
  243. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cklzvs8u.js → chunk-2Q5K7J3B-DObpPEgk.js} +1 -1
  244. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-NxozE5UP.js → chunk-5VM5RSS4-PaTzAg6w.js} +1 -1
  245. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-Dyb8E7YM.js → chunk-F27PBJKO-Pn4gut94.js} +1 -1
  246. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BqbMMc1n.js → chunk-IMKFNOWR-nRaVFzK9.js} +1 -1
  247. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-do0R2H6U.js → chunk-JWPE2WC7-CxssjKKN.js} +1 -1
  248. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-B2HIaynf.js → chunk-POPQ4Y6H-CweDXr-B.js} +1 -1
  249. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-C_zmjkwn.js → chunk-SVP7TREG-C7T3FGE-.js} +1 -1
  250. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-Dh2bZgM1.js → chunk-TICWLB2K-Nc0H-0_V.js} +1 -1
  251. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CnqciVDz.js → chunk-XXDRQBXY-D_GQGF5g.js} +1 -1
  252. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BAX0-S6b.js +1 -0
  253. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BAX0-S6b.js +1 -0
  254. package/runtime/webapp/dist/assets/{client-I0ZVCjOI.js → client-Bb0hpbIR.js} +1 -1
  255. package/runtime/webapp/dist/assets/{codeSyntax-C8n4_KZS.js → codeSyntax-DHonp3tF.js} +3 -3
  256. package/runtime/webapp/dist/assets/{collaboration-lVxWL5ce.js → collaboration-e_iziKU1.js} +1 -1
  257. package/runtime/webapp/dist/assets/composer-file-routing-CWyT7leB.js +6 -0
  258. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-CulKVUkj.js → cose-bilkent-JH36ORCC-Ac_FBan4.js} +1 -1
  259. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-C1LUI1_G.js → cynefin-OW5HDTMX-vr6c389q.js} +1 -1
  260. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-D3Ymzw_P.js → cynefinDiagram-5FMLGOSQ-sXmUCrp_.js} +1 -1
  261. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-DRaL0cGu.js → dagre-GXQ25YYZ-B0DmGxDv.js} +1 -1
  262. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-D8gLHoZo.js → diagram-S7CK7UJ4-Dn-2jJ6S.js} +1 -1
  263. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CaVU0aQT.js → diagram-UQ7AKVKN-BcasYsju.js} +1 -1
  264. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-LFAKRvZz.js → diagram-VSXAHHWV-DCgGkc82.js} +1 -1
  265. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DXpxUERc.js → diagram-VX7I27RA-Cjs0Ny4i.js} +1 -1
  266. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-vAiik55G.js → diagram-Z3DM3KII-0nyddp0v.js} +1 -1
  267. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-MaFL7Kgb.js → ebnfDiagram-PWID7BFC-By7gCUsz.js} +1 -1
  268. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-DuEu79B3.js → erDiagram-RLTQ6QDP-DdwBp45A.js} +1 -1
  269. package/runtime/webapp/dist/assets/{file-types-ZVLWtslN.js → file-types-nujx8XUw.js} +1 -1
  270. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BAQ6nP2D.js → flowDiagram-HODETNUW-DbOwRaT9.js} +1 -1
  271. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-C48VBnPy.js → ganttDiagram-EL5Y4UJY-CG8obc7O.js} +3 -3
  272. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-BfWAh9Kr.js → gitGraphDiagram-WWUBYQGX-ru6aSu_g.js} +1 -1
  273. package/runtime/webapp/dist/assets/{history-D4E3D_aM.js → history-DaBh5_SJ.js} +1 -1
  274. package/runtime/webapp/dist/assets/{image-plus-DQV_EEAN.js → image-plus-Cm9jq1yo.js} +1 -1
  275. package/runtime/webapp/dist/assets/index-BAGzBXQc.css +1 -0
  276. package/runtime/webapp/dist/assets/index-YrEOkxAg.js +500 -0
  277. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-BM7P_-u_.js → infoDiagram-27XIBGKW-Crx1iSbW.js} +1 -1
  278. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-Cwd8XR-p.js → ishikawaDiagram-5VMMS53U-ClQPMEk5.js} +1 -1
  279. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-MOgiksTh.js → journeyDiagram-3NMN7TZE-DHso2Xht.js} +1 -1
  280. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DulC5OLL.js → kanban-definition-UXKFOSKX-D6psIAhv.js} +1 -1
  281. package/runtime/webapp/dist/assets/{layout-Dku9sXQ7.js → layout-B6AVZ9v9.js} +1 -1
  282. package/runtime/webapp/dist/assets/{linear-B3-dddD7.js → linear-CEZOUjlB.js} +1 -1
  283. package/runtime/webapp/dist/assets/{list-todo-Bik5IY2r.js → list-todo-D9ChIz0f.js} +1 -1
  284. package/runtime/webapp/dist/assets/{loader-circle-C5C-IzGK.js → loader-circle-CAHZbD5s.js} +1 -1
  285. package/runtime/webapp/dist/assets/{locate-fixed-CHkezEEh.js → locate-fixed-2R48MVg_.js} +1 -1
  286. package/runtime/webapp/dist/assets/{mermaid.core-CRRXKysA.js → mermaid.core-DH0df9xk.js} +5 -5
  287. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-CaaP-nEb.js → mindmap-definition-YA3MSWOX-QWt8leZC.js} +1 -1
  288. package/runtime/webapp/dist/assets/{mobileViewport-CekmYKqS.js → mobileViewport-CKvpvxYc.js} +1 -1
  289. package/runtime/webapp/dist/assets/new-session-window-CiRwM3Od.js +191 -0
  290. package/runtime/webapp/dist/assets/{new-session-window-BfDMd-h3.css → new-session-window-DIU2v1uh.css} +1 -1
  291. package/runtime/webapp/dist/assets/{page-_fFyRId-.js → page-Cd9ci9uo.js} +6 -6
  292. package/runtime/webapp/dist/assets/{pause-BsmUCuwZ.js → pause-ddt7BLlm.js} +1 -1
  293. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BqybPEwk.js → pegDiagram-XKGWAZYB-JNBt0nDx.js} +1 -1
  294. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-BX1H2lh2.js → pieDiagram-E7YTZNPT-g0hnDqNp.js} +1 -1
  295. package/runtime/webapp/dist/assets/{pin-BsEEYq8M.js → pin-BTP5lC_c.js} +1 -1
  296. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-Btnywv1k.js → quadrantDiagram-AXDQQJYC-mLZASjSm.js} +1 -1
  297. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-Da_TV1ER.js → railroadDiagram-O6MQD6OU-CAXNAZhB.js} +1 -1
  298. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-5V1Aow9h.js → requirementDiagram-BXWQKSXE-BC8y1ZXE.js} +1 -1
  299. package/runtime/webapp/dist/assets/{rotate-ccw-BbSby0GQ.js → rotate-ccw-CHFTy38a.js} +1 -1
  300. package/runtime/webapp/dist/assets/{rotate-cw-BMdX-ln4.js → rotate-cw-CFCtRFDl.js} +1 -1
  301. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-D_OIVihV.js → sankeyDiagram-P5KCCOFB-Boi5NPjT.js} +1 -1
  302. package/runtime/webapp/dist/assets/{send-Cb7EWSJF.js → send-CzCncLlt.js} +1 -1
  303. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-LKeF5Mri.js → sequenceDiagram-WJ2MYXX4-D4ccoVEB.js} +1 -1
  304. package/runtime/webapp/dist/assets/{session-dashboard-BFqNDCc8.js → session-dashboard-C0KfSCDl.js} +1 -1
  305. package/runtime/webapp/dist/assets/{session-tree-BK_qaCnb.js → session-tree-CTzXmV6R.js} +1 -1
  306. package/runtime/webapp/dist/assets/{shield-check-C-r87aMq.js → shield-check-Da6EGdIt.js} +1 -1
  307. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-B6j7Q_MN.js → sizeCapture-INFHLROL-Cd5jIVgK.js} +1 -1
  308. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-zhPFqHdQ.js → stateDiagram-D77RDMKH-DXlmaNwu.js} +1 -1
  309. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Dh6coc1l.js +1 -0
  310. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-C_FCENx1.js → swimlanes-42K2YHIH-DyhRB_e0.js} +1 -1
  311. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BzriATjP.js +8 -0
  312. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-C3DBXjDU.js → timeline-definition-24CTP7MA-Bkfs9Mi-.js} +1 -1
  313. package/runtime/webapp/dist/assets/{trash-2-DjggJGbw.js → trash-2-C682LDDA.js} +1 -1
  314. package/runtime/webapp/dist/assets/{types-BQCEWNQz.js → types-CfOuS-6l.js} +1 -1
  315. package/runtime/webapp/dist/assets/{use-session-activity-BbTXGW7Z.js → use-session-activity-C9Cn92Hj.js} +1 -1
  316. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CssdTIB0.js → vennDiagram-4TSXK5OY-APWT64sw.js} +1 -1
  317. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C58K2vVU.js → wardleyDiagram-VM6X3IG4-H7xLoxwM.js} +1 -1
  318. package/runtime/webapp/dist/assets/{web-B4y8vdRZ.js → web-CT8e03DV.js} +1 -1
  319. package/runtime/webapp/dist/assets/{web-D9rJZXHW.js → web-DG022HwJ.js} +1 -1
  320. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CQi8bD6A.js → xychartDiagram-S5SC5T6Z-DIrxZ4UJ.js} +1 -1
  321. package/runtime/webapp/dist/assets/{zoom-out-iMMWRXJs.js → zoom-out-CRN76HNZ.js} +1 -1
  322. package/runtime/webapp/dist/index.html +2 -2
  323. package/runtime/ws-server.mjs +5 -0
  324. package/runtime/.next/static/chunks/app/web/error-30cea9cffce0ebc2.js +0 -1
  325. package/runtime/.next/static/chunks/app/web/layout-d8a4f4131e7f2330.js +0 -1
  326. package/runtime/.next/static/chunks/main-app-30a478479a347a9e.js +0 -1
  327. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0e6mn0ck.mjs +0 -17
  328. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0ssqfy51.mjs +0 -18
  329. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82ghff97.mjs +0 -39
  330. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82yhcz2x.mjs +0 -17
  331. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b8jr1m8m.mjs +0 -23
  332. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cj0jh226.mjs +0 -17
  333. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ebtbxtjf.mjs +0 -28
  334. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-pb4erfqh.mjs +0 -42
  335. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rs058s2g.mjs +0 -16
  336. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-w6pv4szb.mjs +0 -18
  337. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-wjeh40nr.mjs +0 -20
  338. package/runtime/webapp/dist/assets/AIHubView-CM6ugXG3.js +0 -1
  339. package/runtime/webapp/dist/assets/AiHubPane-DFzC3nbd.js +0 -1
  340. package/runtime/webapp/dist/assets/App-mF6ELC07.js +0 -68
  341. package/runtime/webapp/dist/assets/BrowserLivePanel-CamAULwS.js +0 -61
  342. package/runtime/webapp/dist/assets/CalendarPage-BbYdGYWn.js +0 -1
  343. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CWhmFQtA.js +0 -1
  344. package/runtime/webapp/dist/assets/CollaborationDashboard-XL5SnFOu.js +0 -1
  345. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BXDuKlrL.js +0 -1
  346. package/runtime/webapp/dist/assets/FlowStudioPane-lnjLcd9c.js +0 -5
  347. package/runtime/webapp/dist/assets/HostProjectPicker-DN_vGqQb.js +0 -1
  348. package/runtime/webapp/dist/assets/NewSessionWindow-zjqAUfKb.js +0 -1
  349. package/runtime/webapp/dist/assets/RemoteDesktopPage-9AhztqA2.js +0 -1
  350. package/runtime/webapp/dist/assets/TodoPage-guIvBCW0.js +0 -1
  351. package/runtime/webapp/dist/assets/artifact-links-B0ApmgK6.js +0 -2
  352. package/runtime/webapp/dist/assets/channel-BwDuyJO4.js +0 -1
  353. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BfyV8P0w.js +0 -1
  354. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BfyV8P0w.js +0 -1
  355. package/runtime/webapp/dist/assets/composer-file-routing-qSvJpT-v.js +0 -6
  356. package/runtime/webapp/dist/assets/download-BE31-Qm0.js +0 -6
  357. package/runtime/webapp/dist/assets/index-DSgLFE4Q.js +0 -489
  358. package/runtime/webapp/dist/assets/index-zQk0NCEB.css +0 -1
  359. package/runtime/webapp/dist/assets/new-session-window-Dgl7UWPR.js +0 -190
  360. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DWnBZAiI.js +0 -1
  361. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-DOZCbCJP.js +0 -8
  362. package/runtime/webapp/dist/assets/x-BYUglEo9.js +0 -6
  363. /package/runtime/.next/static/{5rv6PMhU7yq1sI1ClFWRU → _rMvYWpbWkNWrFkCQx3rK}/_buildManifest.js +0 -0
  364. /package/runtime/.next/static/{5rv6PMhU7yq1sI1ClFWRU → _rMvYWpbWkNWrFkCQx3rK}/_ssgManifest.js +0 -0
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) 2026-present, Vanilagy and contributors
3
+ *
4
+ * This Source Code Form is subject to the terms of the Mozilla Public
5
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
6
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7
+ */
8
+ "use strict";(()=>{var q=Math.PI/180,H=180/Math.PI;var R=c=>{throw new Error(`Unexpected value: ${c}`)};var L=1e6*(1+Number.EPSILON);var M=()=>{let c=new Map,g=new Map;self.onmessage=k=>{let h=k.data;switch(h.type){case"set-timeout":{let o=setTimeout(()=>{c.delete(h.timerId),self.postMessage({type:"fire",timerId:h.timerId})},h.delay);c.set(h.timerId,o)}break;case"set-interval":{let o=setInterval(()=>{self.postMessage({type:"fire",timerId:h.timerId})},h.delay);g.set(h.timerId,o)}break;case"clear-timeout":{let o=c.get(h.timerId);o!==void 0&&(clearTimeout(o),c.delete(h.timerId))}break;case"clear-interval":{let o=g.get(h.timerId);o!==void 0&&(clearInterval(o),g.delete(h.timerId))}break}}};var F=()=>{let c=null,g=Promise.resolve();self.addEventListener("message",m=>{let{id:s,sourceFrame:a}=m.data;g=g.then(async()=>{try{let{colorFrame:e,alphaFrame:n}=await k(a);self.postMessage({id:s,colorFrame:e,alphaFrame:n},{transfer:[e,n]})}catch(e){self.postMessage({id:s,error:e.message})}finally{a.close()}})});let k=async m=>{let s=m.format;if(!s)throw new Error("CPU color/alpha splitting requires a known VideoFrame format.");let a=m.allocationSize();if((!c||c.byteLength!==a)&&(c=new Uint8Array(a)),await m.copyTo(c),s==="RGBA"||s==="BGRA")return h(c,s,m);if(s==="I420A"||s==="I420AP10"||s==="I420AP12"||s==="I422A"||s==="I422AP10"||s==="I422AP12"||s==="I444A"||s==="I444AP10"||s==="I444AP12")return o(c,s,m);throw new Error(`CPU color/alpha splitting does not support format '${s}'.`)},h=(m,s,a)=>{let e=a.visibleRect?.width??a.codedWidth,n=a.visibleRect?.height??a.codedHeight,t=e*n,i=Math.ceil(e/2),r=Math.ceil(n/2),u=t+i*r*2,d=new Uint8Array(u);for(let w=0,y=3;w<t;w++,y+=4)d[w]=m[y];d.fill(128,t);let l=new VideoFrame(m,{format:s==="RGBA"?"RGBX":"BGRX",codedWidth:e,codedHeight:n,timestamp:a.timestamp,duration:a.duration??void 0}),p={format:"I420",codedWidth:e,codedHeight:n,timestamp:a.timestamp,duration:a.duration??void 0,colorSpace:{fullRange:!0,matrix:"bt709",primaries:"bt709",transfer:"bt709"},transfer:[d.buffer]},f=new VideoFrame(d,p);return{colorFrame:l,alphaFrame:f}},o=(m,s,a)=>{let e=a.visibleRect?.width??a.codedWidth,n=a.visibleRect?.height??a.codedHeight,t=s.includes("P10"),i=s.includes("P12"),r=t||i?2:1,u,d;s.startsWith("I420")?(u=Math.ceil(e/2),d=Math.ceil(n/2)):s.startsWith("I422")?(u=Math.ceil(e/2),d=n):(u=e,d=n);let l=e*n,p=u*d,f=l*r,w=p*r,y=l*r,b=f+w*2,x=s.replace("A",""),S=Math.ceil(e/2),E=Math.ceil(n/2),T=S*E,_=T*r,A=y+2*_,v=new Uint8Array(A),C=b;v.set(m.subarray(C,C+y),0);let P=y,I=t?512:i?2048:128;r===1?v.fill(I,P):new Uint16Array(v.buffer,P,2*T).fill(I);let D=t?"I420P10":i?"I420P12":"I420",z=new VideoFrame(m.subarray(0,b),{format:x,codedWidth:e,codedHeight:n,timestamp:a.timestamp,duration:a.duration??void 0,colorSpace:a.colorSpace}),W={format:D,codedWidth:e,codedHeight:n,timestamp:a.timestamp,duration:a.duration??void 0,colorSpace:{fullRange:!0,matrix:"bt709",primaries:"bt709",transfer:"bt709"},transfer:[v.buffer]},U=new VideoFrame(v,W);return{colorFrame:z,alphaFrame:U}}};var V=()=>{let c=(h,o)=>{o?self.postMessage(h,{transfer:o}):self.postMessage(h)};c({type:"support",supported:typeof MediaStreamTrackProcessor<"u"});let g=new Map,k=new Map;self.addEventListener("message",h=>{let o=h.data;switch(o.type){case"videoTrack":{k.set(o.trackId,o.track);let m=new MediaStreamTrackProcessor({track:o.track}),s=new WritableStream({write:e=>{if(!k.has(o.trackId)){e.close();return}c({type:"videoFrame",trackId:o.trackId,videoFrame:e},[e])}}),a=new AbortController;g.set(o.trackId,a),m.readable.pipeTo(s,{signal:a.signal}).catch(e=>{e instanceof DOMException&&e.name==="AbortError"||c({type:"error",trackId:o.trackId,error:e})})}break;case"stopTrack":{let m=g.get(o.trackId);m&&(m.abort(),g.delete(o.trackId)),k.get(o.trackId)?.stop(),k.delete(o.trackId),c({type:"trackStopped",trackId:o.trackId})}break;default:R(o)}})};var O=()=>{let c=null,g=null,k=Promise.resolve();self.addEventListener("message",e=>{let{id:n,color:t,alpha:i}=e.data;k=k.then(async()=>{try{let r=await h(t,i);self.postMessage({id:n,frame:r},{transfer:[r]})}catch(r){self.postMessage({id:n,error:r.message})}finally{t.close(),i.close()}})});let h=async(e,n)=>{let t=e.format,i=n.format;if(!t||!i)throw new Error("CPU color/alpha merging requires a known VideoFrame format.");let r=t.includes("P10"),u=t.includes("P12"),d=i.includes("P10"),l=i.includes("P12");if(d!==r||l!==u)throw new Error(`CPU color/alpha merging requires the alpha frame to have the same bit depth as the color frame (color: '${t}', alpha: '${i}').`);if(t==="RGBX"||t==="RGBA"||t==="BGRX"||t==="BGRA")return await o(e,n,t);if(t==="I420"||t==="I420P10"||t==="I420P12"||t==="I422"||t==="I422P10"||t==="I422P12"||t==="I444"||t==="I444P10"||t==="I444P12")return await m(e,n,t);if(t==="NV12")return await s(e,n);throw new Error(`CPU color/alpha merging does not support format '${t}'.`)},o=async(e,n,t)=>{let i=e.visibleRect?.width??e.codedWidth,r=e.visibleRect?.height??e.codedHeight,u=i*r,d=new Uint8Array(u*4);await e.copyTo(d);let l=await a(n,i,r,1);for(let w=0,y=3;w<u;w++,y+=4)d[y]=l[w];let f={format:t==="RGBX"||t==="RGBA"?"RGBA":"BGRA",codedWidth:i,codedHeight:r,displayWidth:e.displayWidth,displayHeight:e.displayHeight,colorSpace:e.colorSpace.toJSON(),timestamp:e.timestamp,duration:e.duration??void 0,transfer:[d.buffer]};return new VideoFrame(d,f)},m=async(e,n,t)=>{let i=e.visibleRect?.width??e.codedWidth,r=e.visibleRect?.height??e.codedHeight,u=t.includes("P10"),d=t.includes("P12"),l=u||d?2:1,p,f;t.startsWith("I420")?(p=Math.ceil(i/2),f=Math.ceil(r/2)):t.startsWith("I422")?(p=Math.ceil(i/2),f=r):(p=i,f=r);let w=i*r,y=p*f,b=w*l,x=y*l,S=w*l,E=b+2*x+S,T=new Uint8Array(E);await e.copyTo(T);let _=await a(n,i,r,l),A=b+2*x;T.set(_,A);let C={format:t.slice(0,4)+"A"+t.slice(4),codedWidth:i,codedHeight:r,displayWidth:e.displayWidth,displayHeight:e.displayHeight,colorSpace:e.colorSpace.toJSON(),timestamp:e.timestamp,duration:e.duration??void 0,transfer:[T.buffer]};return new VideoFrame(T,C)},s=async(e,n)=>{let t=e.visibleRect?.width??e.codedWidth,i=e.visibleRect?.height??e.codedHeight,r=t*i,u=Math.ceil(t/2),d=Math.ceil(i/2),l=u*d,p=e.allocationSize();(!g||g.byteLength!==p)&&(g=new Uint8Array(p)),await e.copyTo(g);let f=new Uint8Array(r+2*l+r);f.set(g.subarray(0,r),0);let w=r,y=r+l,b=r;for(let E=0;E<l;E++)f[w+E]=g[b+E*2],f[y+E]=g[b+E*2+1];let x=await a(n,t,i,1);f.set(x,r+2*l);let S={format:"I420A",codedWidth:t,codedHeight:i,displayWidth:e.displayWidth,displayHeight:e.displayHeight,colorSpace:e.colorSpace.toJSON(),timestamp:e.timestamp,duration:e.duration??void 0,transfer:[f.buffer]};return new VideoFrame(f,S)},a=async(e,n,t,i)=>{let r=e.allocationSize();(!c||c.byteLength!==r)&&(c=new Uint8Array(r)),await e.copyTo(c);let u=e.format;if(u==="RGBA"||u==="BGRA"||u==="RGBX"||u==="BGRX"){let d=u==="RGBA"||u==="RGBX"?0:2,l=n*t;for(let p=0;p<l;p++)c[p]=c[p*4+d];return c.subarray(0,l)}else{let d=c.subarray(0,n*t*i);if(e.colorSpace.fullRange===!1){let l=u.includes("P12")?12:u.includes("P10")?10:8,p=16<<l-8,f=235<<l-8,w=(1<<l)-1,y=i===2?new Uint16Array(d.buffer,0,n*t):d;for(let b=0;b<y.length;b++){let x=Math.round((y[b]-p)*w/(f-p));y[b]=Math.min(Math.max(x,0),w)}}return d}}};switch(self.name){case"unthrottled-timer":M();break;case"color-alpha-splitter":F();break;case"color-alpha-merger":O();break;case"media-stream-track-processor":V();break;default:throw new Error(`Unknown worker name '${self.name}'.`)}})();
@@ -232,6 +232,10 @@ class AdtsAudioTrackBacking {
232
232
  if (!rawSample) {
233
233
  return null;
234
234
  }
235
+ const fileSize = this.demuxer.reader.fileSize;
236
+ if (fileSize !== null && rawSample.dataStart + rawSample.dataSize > fileSize) {
237
+ return null; // Data definitely doesn't fit
238
+ }
235
239
  let data;
236
240
  if (options.metadataOnly) {
237
241
  data = PLACEHOLDER_DATA;
@@ -214,10 +214,8 @@ export const createAes128CbcDecryptStream = (reader, getInit, close) => {
214
214
  return new ReadableStream({
215
215
  pull: async (controller) => {
216
216
  try {
217
- if (!initted) {
218
- aesContext.init(await getInit());
219
- initted = true;
220
- }
217
+ const initPromise = initted ? null : Promise.resolve(getInit());
218
+ void initPromise?.catch(() => { }); // Awaited below
221
219
  const requestedLength = CHUNK_SIZE + BLOCK_SIZE;
222
220
  let nextSlice = reader.requestSliceRange(pos, 0, requestedLength);
223
221
  if (isThenable(nextSlice))
@@ -235,6 +233,10 @@ export const createAes128CbcDecryptStream = (reader, getInit, close) => {
235
233
  : sliceLength;
236
234
  const input = readBytes(nextSlice, bytesToRead);
237
235
  const output = new Uint8Array(bytesToRead);
236
+ if (initPromise) {
237
+ aesContext.init(await initPromise);
238
+ initted = true;
239
+ }
238
240
  for (let i = 0; i < bytesToRead; i += 16) {
239
241
  aesContext.in.set(input.subarray(i, i + 16));
240
242
  aesContext.decrypt();
@@ -612,14 +612,17 @@ class HlsInputTrackBacking {
612
612
  return this.internalTrack.hasOnlyKeyPackets || null;
613
613
  }
614
614
  async getFirstPacket(options) {
615
+ this.prefetchReferencePlaylist();
615
616
  await this.hydrate();
616
617
  return this.internalTrack.backingTrack.getFirstPacket(options);
617
618
  }
618
619
  async getPacket(timestamp, options) {
620
+ this.prefetchReferencePlaylist();
619
621
  await this.hydrate();
620
622
  return this.internalTrack.backingTrack.getPacket(timestamp, options);
621
623
  }
622
624
  async getKeyPacket(timestamp, options) {
625
+ this.prefetchReferencePlaylist();
623
626
  await this.hydrate();
624
627
  return this.internalTrack.backingTrack.getKeyPacket(timestamp, options);
625
628
  }
@@ -631,6 +634,9 @@ class HlsInputTrackBacking {
631
634
  await this.hydrate();
632
635
  return this.internalTrack.backingTrack.getNextKeyPacket(packet, options);
633
636
  }
637
+ prefetchReferencePlaylist() {
638
+ void this.internalTrack.demuxer.getReferenceSegmentedInput().getFirstSegment().catch(() => { });
639
+ }
634
640
  }
635
641
  class HlsInputVideoTrackBacking extends HlsInputTrackBacking {
636
642
  constructor(internalTrack) {
@@ -567,8 +567,16 @@ export class HlsSegmentedInput extends SegmentedInput {
567
567
  return cacheEntry.input;
568
568
  }
569
569
  let initInput = null;
570
- if (hlsSegment.initSegment || hlsSegment.firstSegment) {
571
- initInput = this.getInputForSegment((hlsSegment.initSegment ?? hlsSegment.firstSegment));
570
+ if (hlsSegment.initSegment) {
571
+ initInput = this.getInputForSegment(hlsSegment.initSegment);
572
+ // Fetch the init input's data immediately to avoid the serial request chain of first having to go through
573
+ // the segment before the init section is even requested. Reduces latency.
574
+ void initInput.getTracks().catch(() => { });
575
+ }
576
+ else if (hlsSegment.firstSegment) {
577
+ // Don't prefetch this one. It's only needed in rare cases, like MPEG-TS segments that are missing media
578
+ // initialization, so it's not generally worth it to prefetch this.
579
+ initInput = this.getInputForSegment(hlsSegment.firstSegment);
572
580
  }
573
581
  const formatOptions = {
574
582
  ...this.input._formatOptions,
@@ -694,15 +702,17 @@ export class HlsSegmentedInput extends SegmentedInput {
694
702
  }
695
703
  getFirstSegmentTimestampOffset() {
696
704
  return this.segmentTimestampOffsetPromise ??= (async () => {
697
- const firstSegment = await this.getFirstSegment();
698
- assert(firstSegment);
699
705
  const referenceSegmentedInput = this.demuxer.getReferenceSegmentedInput();
700
706
  if (this === referenceSegmentedInput) {
701
707
  return 0;
702
708
  }
709
+ const [firstSegment, referenceFirstSegment] = await Promise.all([
710
+ this.getFirstSegment(),
711
+ referenceSegmentedInput.getFirstSegment(),
712
+ ]);
713
+ assert(firstSegment);
703
714
  // An offset of 0 is only safe (= close enough) if we start at the same point as the reference: either both
704
715
  // of us list all segments since the presentation's start, or both of us are on date-time-based timelines
705
- const referenceFirstSegment = await referenceSegmentedInput.getFirstSegment();
706
716
  if (referenceFirstSegment
707
717
  && ((this.listsAllSegments() && referenceSegmentedInput.listsAllSegments())
708
718
  || (firstSegment.unixEpochTimestamp === firstSegment.timestamp
@@ -712,6 +722,8 @@ export class HlsSegmentedInput extends SegmentedInput {
712
722
  // Otherwise, we must fetch the actual media timestamp of the first segment to properly deduce the offset
713
723
  // that we need
714
724
  const input = this.getInputForSegment(firstSegment);
725
+ // Kick this off early so it runs in parallel to loading our own media
726
+ void this.getMediaOffsetForDiscontinuity(firstSegment.discontinuityNumber).catch(() => { });
715
727
  if (await this.getRawTimestampOffset(input) === null) {
716
728
  return 0;
717
729
  }
@@ -1305,7 +1305,8 @@ export const tfhd = (trackData) => {
1305
1305
  export const tfdt = (trackData) => {
1306
1306
  assert(trackData.currentChunk);
1307
1307
  return fullBox('tfdt', 1, 0, [
1308
- u64(intoTimescale(trackData.currentChunk.startTimestamp, trackData.timescale)), // Base Media Decode Time
1308
+ // Base Media Decode Time
1309
+ u64(intoTimescale(trackData.currentChunk.samples[0].decodeTimestamp, trackData.timescale)),
1309
1310
  ]);
1310
1311
  };
1311
1312
  /** Track Run Box: Specifies a run of contiguous samples for a given track. */
@@ -128,7 +128,10 @@ export class IsobmffDemuxer extends Demuxer {
128
128
  }
129
129
  currentPos = startPos + boxInfo.totalSize;
130
130
  }
131
- if (!foundMovieBoxes && this.input._initInput) {
131
+ if (!foundMovieBoxes) {
132
+ if (!this.input._initInput) {
133
+ throw new Error('No "moov" box found; the file is invalid or incomplete.');
134
+ }
132
135
  // A segment file is allowed to hold zero fragments, in which case there's no moof box to key off of.
133
136
  // It's still a perfectly valid segment, so let's take the tracks from the init input.
134
137
  await this.copyMetadataFromInitInput(this.input._initInput);
@@ -2915,6 +2918,10 @@ class IsobmffTrackBacking {
2915
2918
  if (!sampleInfo) {
2916
2919
  return null;
2917
2920
  }
2921
+ const fileSize = this.internalTrack.demuxer.reader.fileSize;
2922
+ if (fileSize !== null && sampleInfo.sampleOffset + sampleInfo.sampleSize > fileSize) {
2923
+ return null; // Data is definitely outside
2924
+ }
2918
2925
  let data;
2919
2926
  if (options.metadataOnly && this.internalTrack.info?.codec !== 'eac3') { // E-AC-3 is split by its data
2920
2927
  data = PLACEHOLDER_DATA;
@@ -2958,6 +2965,10 @@ class IsobmffTrackBacking {
2958
2965
  const trackData = fragment.trackData.get(this.internalTrack.id);
2959
2966
  const fragmentSample = trackData.samples[sampleIndex];
2960
2967
  assert(fragmentSample);
2968
+ const fileSize = this.internalTrack.demuxer.reader.fileSize;
2969
+ if (fileSize !== null && fragmentSample.byteOffset + fragmentSample.byteSize > fileSize) {
2970
+ return null; // Data is definitely outside
2971
+ }
2961
2972
  let data;
2962
2973
  if (options.metadataOnly && this.internalTrack.info?.codec !== 'eac3') { // E-AC-3 is split by its data
2963
2974
  data = PLACEHOLDER_DATA;
@@ -727,21 +727,36 @@ export class IsobmffMuxer extends Muxer {
727
727
  trackData.timestampProcessingQueue.length = 0;
728
728
  return;
729
729
  }
730
- const sortedTimestamps = trackData.timestampProcessingQueue.map(x => x.timestamp).sort((a, b) => a - b);
730
+ const queue = trackData.timestampProcessingQueue;
731
+ const sortedTimestamps = queue.map(x => x.timestamp).sort((a, b) => a - b);
732
+ const firstTimestampInTimescale = intoTimescale(sortedTimestamps[0], trackData.timescale);
731
733
  if (this.isFragmented) {
732
734
  trackData.startTimestampOffset ??= Math.min(sortedTimestamps[0], 0);
733
735
  }
734
736
  else {
735
737
  trackData.startTimestampOffset ??= sortedTimestamps[0];
736
738
  }
737
- for (let i = 0; i < trackData.timestampProcessingQueue.length; i++) {
738
- const sample = trackData.timestampProcessingQueue[i];
739
- // Since the user only supplies presentation time, but these may be out of order, we reverse-engineer from
740
- // that a sensible decode timestamp. The notion of a decode timestamp doesn't really make sense
741
- // (presentation timestamp & decode order are all you need), but it is a concept in ISOBMFF so we need to
742
- // model it.
743
- sample.decodeTimestamp = sortedTimestamps[i];
744
- const sampleCompositionTimeOffset = intoTimescale(sample.timestamp - sample.decodeTimestamp, trackData.timescale);
739
+ // Since the user only supplies presentation time & decode order, we have to reverse-engineer from that a
740
+ // sensible decode timestamp, which is a concept in ISOBMFF: we hand out the sorted presentation timestamps in
741
+ // decode order. The first group starts at its lowest timestamp, every following group exactly where the
742
+ // previous one ended, so that there are no gaps or overlaps in the decode timeline.
743
+ let groupStartTimescaleUnits;
744
+ if (trackData.lastTimescaleUnits === null) {
745
+ groupStartTimescaleUnits = firstTimestampInTimescale;
746
+ }
747
+ else {
748
+ assert(trackData.lastSample);
749
+ groupStartTimescaleUnits = Math.round(trackData.lastTimescaleUnits)
750
+ + trackData.lastSample.timescaleUnitsToNextSample;
751
+ }
752
+ let lastDecodeStep = 0;
753
+ for (let i = 0; i < queue.length; i++) {
754
+ const sample = queue[i];
755
+ const decodeTimescaleUnits = groupStartTimescaleUnits
756
+ + intoTimescale(sortedTimestamps[i], trackData.timescale)
757
+ - firstTimestampInTimescale;
758
+ sample.decodeTimestamp = decodeTimescaleUnits / trackData.timescale;
759
+ const sampleCompositionTimeOffset = intoTimescale(sample.timestamp, trackData.timescale) - decodeTimescaleUnits;
745
760
  const durationInTimescale = intoTimescale(sample.duration, trackData.timescale);
746
761
  if (trackData.lastTimescaleUnits !== null) {
747
762
  assert(trackData.lastSample);
@@ -750,6 +765,7 @@ export class IsobmffMuxer extends Muxer {
750
765
  assert(delta >= 0);
751
766
  trackData.lastTimescaleUnits += delta;
752
767
  trackData.lastSample.timescaleUnitsToNextSample = delta;
768
+ lastDecodeStep = delta;
753
769
  if (!this.isFragmented) {
754
770
  let lastTableEntry = last(trackData.timeToSampleTable);
755
771
  assert(lastTableEntry);
@@ -817,15 +833,15 @@ export class IsobmffMuxer extends Muxer {
817
833
  trackData.timestampProcessingQueue.length = 0;
818
834
  assert(trackData.lastSample);
819
835
  assert(trackData.lastTimescaleUnits !== null);
820
- if (nextSample !== undefined && trackData.lastSample.timescaleUnitsToNextSample === 0) {
821
- assert(nextSample.type === 'key');
822
- // Given the next sample, we can make a guess about the duration of the last sample. This avoids having
823
- // the last sample's duration in each fragment be "0" for fragmented files. The guess we make here is
824
- // actually correct most of the time, since typically, no delta frame with a lower timestamp follows the key
825
- // frame (although it can happen).
826
- const timescaleUnits = intoTimescale(nextSample.timestamp, trackData.timescale, false);
827
- const delta = Math.round(timescaleUnits - trackData.lastTimescaleUnits);
828
- trackData.lastSample.timescaleUnitsToNextSample = delta;
836
+ if (nextSample) {
837
+ // The last sample fills the time until the next key frame, where the next group starts. The next sample
838
+ // will also set the last sample's duration, but the last sample may get written before that.
839
+ const nextTimestampInTimescale = intoTimescale(nextSample.timestamp, trackData.timescale);
840
+ trackData.lastSample.timescaleUnitsToNextSample = Math.max(nextTimestampInTimescale - Math.round(trackData.lastTimescaleUnits),
841
+ // With open GOPs, the last sample's decode timestamp may already lie past the next key frame. Then, it
842
+ // still gets a regular decode step to keep decode timestamps strictly increasing, and the next group
843
+ // starts later. If we didn't do this, we'd get duplicate DTSs.
844
+ lastDecodeStep);
829
845
  }
830
846
  }
831
847
  async registerSample(trackData, sample) {
@@ -162,6 +162,9 @@ export class MatroskaDemuxer extends Demuxer {
162
162
  assertDefinedSize(size);
163
163
  currentPos = dataStartPos + size;
164
164
  }
165
+ if (this.segments.length === 0) {
166
+ throw new Error('No Segment element found; the file is invalid or incomplete.');
167
+ }
165
168
  })();
166
169
  }
167
170
  async readSegment(segmentDataStart, dataSize) {
@@ -10,7 +10,7 @@ import { addAvcBitstreamRestriction, AvcNalUnitType, concatAvcNalUnits, countSho
10
10
  import { customVideoDecoders, customAudioDecoders } from './custom-coder.js';
11
11
  import { InputDisposedError } from './input.js';
12
12
  import { InputAudioTrack, InputTrack, InputVideoTrack } from './input-track.js';
13
- import { assert, assertNever, CallSerializer, clamp, colorSpaceIsComplete, getInt24, getUint24, insertSorted, isAndroid, isChromium, isFirefox, isNumber, isWebKit, last, mapAsyncGenerator, missingWebCodecsClassMessage, promiseWithResolvers, removeItem, roundToDivisor, toAsyncIterator, toDataView, toUint8Array, validateAnyIterable, } from './misc.js';
13
+ import { assert, assertNever, CallSerializer, clamp, colorSpaceIsComplete, createWorker, getInt24, getUint24, insertSorted, isAndroid, isChromium, isFirefox, isNumber, isWebKit, last, mapAsyncGenerator, missingWebCodecsClassMessage, promiseWithResolvers, removeItem, roundToDivisor, toAsyncIterator, toDataView, toUint8Array, validateAnyIterable, } from './misc.js';
14
14
  import { EncodedPacket } from './packet.js';
15
15
  import { fromAlaw, fromUlaw } from './pcm.js';
16
16
  import { AudioSample, clampCropRectangle, validateCropRectangle, VideoSample, } from './sample.js';
@@ -1294,7 +1294,6 @@ class VideoDecoderWrapper extends DecoderWrapper {
1294
1294
  this.sampleQueue.length = 0;
1295
1295
  }
1296
1296
  }
1297
- let mergerWorkerUrl = null;
1298
1297
  /** Utility class that merges together color and alpha information on the CPU in a pool of workers. */
1299
1298
  export class ColorAlphaMerger {
1300
1299
  constructor() {
@@ -1305,13 +1304,9 @@ export class ColorAlphaMerger {
1305
1304
  }
1306
1305
  merge(color, alpha) {
1307
1306
  if (this.workers.length === 0) {
1308
- if (!mergerWorkerUrl) {
1309
- const blob = new Blob([`(${colorAlphaMergerWorkerCode.toString()})()`], { type: 'application/javascript' });
1310
- mergerWorkerUrl = URL.createObjectURL(blob);
1311
- }
1312
1307
  const poolSize = clamp(navigator.hardwareConcurrency, 1, 4);
1313
1308
  for (let i = 0; i < poolSize; i++) {
1314
- const worker = new Worker(mergerWorkerUrl);
1309
+ const worker = createWorker('color-alpha-merger', colorAlphaMergerWorkerCode);
1315
1310
  worker.addEventListener('message', (event) => {
1316
1311
  const data = event.data;
1317
1312
  const pending = this.pendingRequests.get(data.id);
@@ -1360,7 +1355,7 @@ export class ColorAlphaMerger {
1360
1355
  this.pendingRequests.clear();
1361
1356
  }
1362
1357
  }
1363
- const colorAlphaMergerWorkerCode = () => {
1358
+ export const colorAlphaMergerWorkerCode = () => {
1364
1359
  // These buffers are reused across frames as long as the size matches, since consecutive frames usually share
1365
1360
  // dimensions
1366
1361
  let cpuAlphaBuffer = null;
@@ -59,7 +59,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
59
59
  });
60
60
  import { buildAacAudioSpecificConfig, parseAacAudioSpecificConfig } from '../shared/aac-misc.js';
61
61
  import { AUDIO_CODECS, extractVideoCodecString, getAudioEncoderConfigExtension, OPUS_SAMPLE_RATE, parsePcmCodec, PCM_AUDIO_CODECS, SUBTITLE_CODECS, VIDEO_CODECS, } from './codec.js';
62
- import { assert, assertNever, AsyncMutex, binarySearchLessOrEqual, CallSerializer, clamp, clearIntervalUnthrottled, floorToDivisor, isCodecReclaimedError, isFirefox, isThenable, isWebKit, last, missingWebCodecsClassMessage, promiseWithResolvers, roundToDivisor, setInt24, setIntervalUnthrottled, setUint24, toUint8Array, wait, } from './misc.js';
62
+ import { assert, assertNever, AsyncMutex, binarySearchLessOrEqual, CallSerializer, clamp, clearIntervalUnthrottled, createWorker, floorToDivisor, isCodecReclaimedError, isFirefox, isThenable, isWebKit, last, missingWebCodecsClassMessage, promiseWithResolvers, roundToDivisor, setInt24, setIntervalUnthrottled, setUint24, toUint8Array, wait, } from './misc.js';
63
63
  import { SubtitleParser } from './subtitles.js';
64
64
  import { toAlaw, toUlaw } from './pcm.js';
65
65
  import { customVideoEncoders, customAudioEncoders, } from './custom-coder.js';
@@ -1042,7 +1042,6 @@ const detectAvcChunkTimestampShift = () => {
1042
1042
  return chunkTimestamp === 500;
1043
1043
  })();
1044
1044
  };
1045
- let splitterWorkerUrl = null;
1046
1045
  /** Utility class for splitting a composite frame into separate color and alpha parts on the CPU in a worker. */
1047
1046
  export class ColorAlphaSplitter {
1048
1047
  constructor() {
@@ -1052,11 +1051,7 @@ export class ColorAlphaSplitter {
1052
1051
  }
1053
1052
  split(sourceFrame) {
1054
1053
  if (!this.worker) {
1055
- if (!splitterWorkerUrl) {
1056
- const blob = new Blob([`(${colorAlphaSplitterWorkerCode.toString()})()`], { type: 'application/javascript' });
1057
- splitterWorkerUrl = URL.createObjectURL(blob);
1058
- }
1059
- this.worker = new Worker(splitterWorkerUrl);
1054
+ this.worker = createWorker('color-alpha-splitter', colorAlphaSplitterWorkerCode);
1060
1055
  this.worker.addEventListener('message', (event) => {
1061
1056
  const data = event.data;
1062
1057
  const pending = this.pendingRequests.get(data.id);
@@ -1095,7 +1090,7 @@ export class ColorAlphaSplitter {
1095
1090
  this.pendingRequests.clear();
1096
1091
  }
1097
1092
  }
1098
- const colorAlphaSplitterWorkerCode = () => {
1093
+ export const colorAlphaSplitterWorkerCode = () => {
1099
1094
  // Reused across frames as long as the size matches, since consecutive frames usually share dimensions.
1100
1095
  let cpuSourceBuffer = null;
1101
1096
  // Serialize execution internally so concurrent requests don't race on the shared cpuSourceBuffer.
@@ -2755,7 +2750,7 @@ export class MediaStreamAudioTrackSource extends AudioSource {
2755
2750
  }
2756
2751
  }
2757
2752
  }
2758
- const mediaStreamTrackProcessorWorkerCode = () => {
2753
+ export const mediaStreamTrackProcessorWorkerCode = () => {
2759
2754
  const sendMessage = (message, transfer) => {
2760
2755
  if (transfer) {
2761
2756
  self.postMessage(message, { transfer });
@@ -2833,9 +2828,7 @@ const mediaStreamTrackProcessorWorkerCode = () => {
2833
2828
  let nextMediaStreamTrackProcessorWorkerId = 0;
2834
2829
  let mediaStreamTrackProcessorWorker = null;
2835
2830
  const initMediaStreamTrackProcessorWorker = () => {
2836
- const blob = new Blob([`(${mediaStreamTrackProcessorWorkerCode.toString()})()`], { type: 'application/javascript' });
2837
- const url = URL.createObjectURL(blob);
2838
- mediaStreamTrackProcessorWorker = new Worker(url);
2831
+ mediaStreamTrackProcessorWorker = createWorker('media-stream-track-processor', mediaStreamTrackProcessorWorkerCode);
2839
2832
  };
2840
2833
  let mediaStreamTrackProcessorIsSupportedInWorkerCache = null;
2841
2834
  const mediaStreamTrackProcessorIsSupportedInWorker = async () => {
@@ -1103,7 +1103,7 @@ const unthrottledIntervalCallbacks = new Map();
1103
1103
  const shouldUseNativeTimers = () => {
1104
1104
  return typeof window === 'undefined';
1105
1105
  };
1106
- const unthrottledTimerWorkerMain = () => {
1106
+ export const unthrottledTimerWorkerCode = () => {
1107
1107
  const timeoutHandles = new Map();
1108
1108
  const intervalHandles = new Map();
1109
1109
  self.onmessage = (event) => {
@@ -1155,10 +1155,7 @@ const getUnthrottledTimerWorker = () => {
1155
1155
  if (unthrottledTimerWorker) {
1156
1156
  return unthrottledTimerWorker;
1157
1157
  }
1158
- const workerSource = `(${unthrottledTimerWorkerMain.toString()})();`;
1159
- const workerURL = URL.createObjectURL(new Blob([workerSource], { type: 'text/javascript' }));
1160
- unthrottledTimerWorker = new Worker(workerURL);
1161
- URL.revokeObjectURL(workerURL);
1158
+ unthrottledTimerWorker = createWorker('unthrottled-timer', unthrottledTimerWorkerCode);
1162
1159
  unthrottledTimerWorker.onmessage = (event) => {
1163
1160
  const message = event.data;
1164
1161
  const timeoutCallback = unthrottledTimeoutCallbacks.get(message.timerId);
@@ -1174,6 +1171,23 @@ const getUnthrottledTimerWorker = () => {
1174
1171
  };
1175
1172
  return unthrottledTimerWorker;
1176
1173
  };
1174
+ const workerBlobUrls = new Map();
1175
+ export const createWorker = (name, workerMain) => {
1176
+ const workerUrl = globalThis[Symbol.for('mediabunny:workerUrl')];
1177
+ if (workerUrl !== undefined && typeof workerUrl !== 'string' && !(workerUrl instanceof URL)) {
1178
+ throw new TypeError('globalThis[Symbol.for(\'mediabunny:workerUrl\')], when provided, must be a string or URL.');
1179
+ }
1180
+ // For environments that can't run blob: workers. The standalone worker file runs the program matching the name.
1181
+ if (workerUrl !== undefined) {
1182
+ return new Worker(workerUrl, { name });
1183
+ }
1184
+ let blobUrl = workerBlobUrls.get(workerMain);
1185
+ if (!blobUrl) {
1186
+ blobUrl = URL.createObjectURL(new Blob([`(${workerMain.toString()})();`], { type: 'text/javascript' }));
1187
+ workerBlobUrls.set(workerMain, blobUrl);
1188
+ }
1189
+ return new Worker(blobUrl, { name });
1190
+ };
1177
1191
  export const setTimeoutUnthrottled = (
1178
1192
  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
1179
1193
  callback, delay) => {
@@ -361,6 +361,10 @@ class Mp3AudioTrackBacking {
361
361
  if (!rawSample) {
362
362
  return null;
363
363
  }
364
+ const fileSize = this.demuxer.reader.fileSize;
365
+ if (fileSize !== null && rawSample.dataStart + rawSample.dataSize > fileSize) {
366
+ return null; // Data definitely doesn't fit
367
+ }
364
368
  let data;
365
369
  if (options.metadataOnly) {
366
370
  data = PLACEHOLDER_DATA;
@@ -85,6 +85,7 @@ export class MpegTsDemuxer extends Demuxer {
85
85
  // Some files contain these multiple times, but we only care about their first appearance
86
86
  let hasProgramAssociationTable = false;
87
87
  let hasProgramMap = false;
88
+ let initDemuxer = null;
88
89
  while (true) {
89
90
  const packetHeader = await this.readPacketHeader(currentPos);
90
91
  if (!packetHeader) {
@@ -352,23 +353,31 @@ export class MpegTsDemuxer extends Demuxer {
352
353
  }
353
354
  elementaryStream.firstSection = section;
354
355
  elementaryStream.canBeTrustedWithKeyPackets = section.randomAccessIndicator === 1;
355
- if (this.input._initInput) {
356
- const initDemuxer = (await this.input._initInput._getDemuxer());
357
- if (initDemuxer.constructor !== MpegTsDemuxer) {
358
- throw new Error('Init input must match the input\'s format.');
359
- }
360
- await initDemuxer.readMetadata();
361
- const matchingStream = initDemuxer.elementaryStreams.find(x => (x.pid === section.pid && x.info.codec === elementaryStream.info.codec && x.initialized));
362
- if (matchingStream) {
363
- elementaryStream.info = matchingStream.info;
364
- elementaryStream.initialized = true;
365
- break outer; // We have the stream info, we're done
366
- }
367
- }
368
356
  const context = new PacketReadingContext(elementaryStream, section.startPos);
369
357
  if (elementaryStream.info.type === 'video') {
358
+ let packetCount = 0;
370
359
  // We loop because in some files, the video parameters are not in the first packet
371
360
  while (true) {
361
+ if (packetCount === 1 && this.input._initInput) {
362
+ // The parameters aren't in the first packet, so instead of searching further (which
363
+ // may take long), get them from the init input
364
+ if (!initDemuxer) {
365
+ initDemuxer = (await this.input._initInput._getDemuxer());
366
+ if (initDemuxer.constructor !== MpegTsDemuxer) {
367
+ throw new Error('Init input must match the input\'s format.');
368
+ }
369
+ await initDemuxer.readMetadata();
370
+ }
371
+ const matchingStream = initDemuxer.elementaryStreams.find(x => (x.pid === section.pid
372
+ && x.info.codec === elementaryStream.info.codec
373
+ && x.initialized));
374
+ if (matchingStream) {
375
+ elementaryStream.info = matchingStream.info;
376
+ elementaryStream.initialized = true;
377
+ break outer; // We have the stream info, we're done
378
+ }
379
+ }
380
+ packetCount++;
372
381
  const contextAlias = context; // TyyyyypeScript 😩
373
382
  contextAlias.suppliedPacket = null;
374
383
  await context.markNextPacket();
@@ -14,8 +14,8 @@ import { Muxer } from '../muxer.js';
14
14
  import { buildMpegTsMimeType, MPEG_TS_TIMESCALE, secondsToMpegTsTimestamp, TS_PACKET_SIZE, } from './mpeg-ts-misc.js';
15
15
  // Resources:
16
16
  // ISO/IEC 13818-1
17
- const PAT_PID = 0x0000;
18
- const PMT_PID = 0x1000;
17
+ export const PAT_PID = 0x0000;
18
+ export const PMT_PID = 0x1000;
19
19
  const FIRST_TRACK_PID = 0x0100;
20
20
  const VIDEO_STREAM_ID_BASE = 0xE0;
21
21
  const AUDIO_STREAM_ID_BASE = 0xC0;