shadow-claw 1.54.0 → 1.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/.well-known/mcp/server-card.json +1 -1
  2. package/.well-known/mcp.json +1 -1
  3. package/README.md +1 -1
  4. package/dist/cli/build/build.js +1 -1
  5. package/dist/cli/{chunk-DO2t9bUI.js → chunk--IuVyWfT.js} +24 -23
  6. package/dist/cli/{chunk-2ZYd9gYC.js → chunk--JpdI-Ht.js} +1 -1
  7. package/dist/cli/{chunk-m4Ineemy.js → chunk-4O8yrQuN.js} +1 -1
  8. package/dist/cli/{chunk-BiH9IXnQ.js → chunk-7S9Ywlfy.js} +1 -1
  9. package/dist/cli/{chunk-BmMOdYvk.js → chunk-B0SqqDSK.js} +1 -1
  10. package/dist/cli/chunk-BNaWaEm-.js +1 -0
  11. package/dist/cli/chunk-BXCsxO9e.js +1 -0
  12. package/dist/cli/chunk-Bq37qDoZ.js +18 -0
  13. package/dist/cli/{chunk-C1htf-nO.js → chunk-BrEeCKIo.js} +2 -2
  14. package/dist/cli/{chunk-BI1SOTM1.js → chunk-Bu3ylrhT.js} +8 -8
  15. package/dist/cli/{chunk-3smiGQoQ.js → chunk-C1v_s0Kb.js} +1 -1
  16. package/dist/cli/{chunk-DGeysxz3.js → chunk-C44G533y.js} +1 -1
  17. package/dist/cli/{chunk-9KiBalKu.js → chunk-C7hJLmsL.js} +1 -1
  18. package/dist/cli/{chunk-BFv9XSNd.js → chunk-CAaQWd6t.js} +1 -1
  19. package/dist/cli/chunk-CIkgn5Fh.js +1 -0
  20. package/dist/cli/chunk-CWEIN2kc.js +1 -0
  21. package/dist/cli/{chunk-BDeDZ-0L.js → chunk-CYg1lO1a.js} +1 -1
  22. package/dist/cli/{chunk-DXLmEQ3i.js → chunk-Ce09lwXT.js} +1 -1
  23. package/dist/cli/{chunk-XsfHeN4m.js → chunk-CpdqRSO-.js} +1 -1
  24. package/dist/cli/chunk-DB4x5L-B.js +1 -0
  25. package/dist/cli/{chunk-DaNyMqrk.js → chunk-DBvObsBQ.js} +1 -1
  26. package/dist/cli/chunk-DGPpt7Ka.js +1 -0
  27. package/dist/cli/chunk-DGagHluH.js +1 -0
  28. package/dist/cli/chunk-DUIs23D9.js +1 -0
  29. package/dist/cli/{chunk-CyvfQV16.js → chunk-DaurYOqg.js} +1 -1
  30. package/dist/cli/{chunk-DSFrcSyA.js → chunk-DfwRL0Ue.js} +1 -1
  31. package/dist/cli/{chunk-M2tZrzY5.js → chunk-DudYQk0p.js} +1 -1
  32. package/dist/cli/chunk-DvKo50Tp.js +2 -0
  33. package/dist/cli/{chunk-H_Mw5ypp.js → chunk-Dvrqte5Q.js} +2 -2
  34. package/dist/cli/{chunk-BtNO-m9T.js → chunk-DzhSExU0.js} +1 -1
  35. package/dist/cli/{chunk-IOMO88kZ.js → chunk-ENKlt3i9.js} +1 -1
  36. package/dist/cli/{chunk-Bspgzwsm.js → chunk-FWRwAX75.js} +8 -8
  37. package/dist/cli/chunk-Lf-Z-h48.js +32 -0
  38. package/dist/cli/{chunk-BucXnZ4Z.js → chunk-VRfkSLrD.js} +1 -1
  39. package/dist/cli/chunk-uaTxD024.js +1 -0
  40. package/dist/cli/cli.js +1 -1
  41. package/dist/cli/prerender/dsd-shell/prerender-dsd-shell.js +1 -1
  42. package/dist/headless-agent.js +2 -2
  43. package/dist/lib/components/index.js +25 -25
  44. package/dist/lib/components/settings/shadow-claw-accounts.js +1 -1
  45. package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
  46. package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
  47. package/dist/lib/components/settings/shadow-claw-git.js +1 -1
  48. package/dist/lib/components/settings/shadow-claw-integrations.js +1 -1
  49. package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
  50. package/dist/lib/components/settings/shadow-claw-mcp-remote.js +1 -1
  51. package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
  52. package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
  53. package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
  54. package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
  55. package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
  56. package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
  57. package/dist/lib/components/shadow-claw/utils/get-route.d.ts +3 -0
  58. package/dist/lib/components/shadow-claw/utils/sync-slotted-sidebar-active-links.d.ts +1 -1
  59. package/dist/lib/components/shadow-claw-accounts.js +1 -1
  60. package/dist/lib/components/shadow-claw-channel-config.js +1 -1
  61. package/dist/lib/components/shadow-claw-channels.js +1 -1
  62. package/dist/lib/components/shadow-claw-chat.js +1 -1
  63. package/dist/lib/components/shadow-claw-control-plane.js +1 -1
  64. package/dist/lib/components/shadow-claw-conversations.js +1 -1
  65. package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
  66. package/dist/lib/components/shadow-claw-files.js +1 -1
  67. package/dist/lib/components/shadow-claw-git.js +1 -1
  68. package/dist/lib/components/shadow-claw-integrations.js +1 -1
  69. package/dist/lib/components/shadow-claw-llm.js +1 -1
  70. package/dist/lib/components/shadow-claw-mcp-remote.js +1 -1
  71. package/dist/lib/components/shadow-claw-networking.js +1 -1
  72. package/dist/lib/components/shadow-claw-notifications.js +1 -1
  73. package/dist/lib/components/shadow-claw-page-header.js +1 -1
  74. package/dist/lib/components/shadow-claw-pages.js +1 -1
  75. package/dist/lib/components/shadow-claw-peerjs.js +1 -1
  76. package/dist/lib/components/shadow-claw-settings.js +1 -1
  77. package/dist/lib/components/shadow-claw-storage.js +1 -1
  78. package/dist/lib/components/shadow-claw-task-server.js +1 -1
  79. package/dist/lib/components/shadow-claw-tasks.js +1 -1
  80. package/dist/lib/components/shadow-claw-terminal.js +1 -1
  81. package/dist/lib/components/shadow-claw-tools.js +1 -1
  82. package/dist/lib/components/shadow-claw-webvm.js +1 -1
  83. package/dist/lib/components/shadow-claw.js +1 -1
  84. package/dist/lib/{configure-peer-js-D5jDCtLx.js → configure-peer-js-C9554Slv.js} +2 -2
  85. package/dist/lib/{configure-peer-js-D5jDCtLx.js.map → configure-peer-js-C9554Slv.js.map} +1 -1
  86. package/dist/lib/{file-viewer-B4CL4e0i.js → file-viewer-DBc5dxNy.js} +2 -2
  87. package/dist/lib/{file-viewer-B4CL4e0i.js.map → file-viewer-DBc5dxNy.js.map} +1 -1
  88. package/dist/lib/index.js +28 -27
  89. package/dist/lib/{init-control-plane-l2uFnhGV.js → init-control-plane-D-41Fm5q.js} +12 -12
  90. package/dist/lib/{init-control-plane-l2uFnhGV.js.map → init-control-plane-D-41Fm5q.js.map} +1 -1
  91. package/dist/lib/{markdown-0_p_zfxL.js → markdown-KnDWzWJJ.js} +2 -2
  92. package/dist/lib/{markdown-0_p_zfxL.js.map → markdown-KnDWzWJJ.js.map} +1 -1
  93. package/dist/lib/{orchestrator-D6wm8Sec.js → orchestrator-BEZcqgR5.js} +9 -9
  94. package/dist/lib/{orchestrator-D6wm8Sec.js.map → orchestrator-BEZcqgR5.js.map} +1 -1
  95. package/dist/lib/{orchestrator-Dh-hnIpK.js → orchestrator-Cda13e5U.js} +4 -4
  96. package/dist/lib/{orchestrator-Dh-hnIpK.js.map → orchestrator-Cda13e5U.js.map} +1 -1
  97. package/dist/lib/{peerjs-BWZnsD0B.js → peerjs-DYkUTcee.js} +5 -5
  98. package/dist/lib/{peerjs-BWZnsD0B.js.map → peerjs-DYkUTcee.js.map} +1 -1
  99. package/dist/lib/{push-client-MybDfOdi.js → push-client-CQtCFDaD.js} +3 -3
  100. package/dist/lib/{push-client-MybDfOdi.js.map → push-client-CQtCFDaD.js.map} +1 -1
  101. package/dist/lib/security/custom-element-security.d.ts +8 -4
  102. package/dist/lib/{shadow-claw-PdOpgTxH.js → shadow-claw-DYe9u6Tp.js} +142 -33
  103. package/dist/lib/shadow-claw-DYe9u6Tp.js.map +1 -0
  104. package/dist/lib/{shadow-claw-accounts-3bR76EOb.js → shadow-claw-accounts-D2URoHys.js} +2 -2
  105. package/dist/lib/{shadow-claw-accounts-3bR76EOb.js.map → shadow-claw-accounts-D2URoHys.js.map} +1 -1
  106. package/dist/lib/{shadow-claw-channel-config-ChdZ1iB8.js → shadow-claw-channel-config-buXoz2xv.js} +3 -3
  107. package/dist/lib/{shadow-claw-channel-config-ChdZ1iB8.js.map → shadow-claw-channel-config-buXoz2xv.js.map} +1 -1
  108. package/dist/lib/{shadow-claw-channels-CK9sc7h_.js → shadow-claw-channels-5yVJ1gLk.js} +3 -3
  109. package/dist/lib/{shadow-claw-channels-CK9sc7h_.js.map → shadow-claw-channels-5yVJ1gLk.js.map} +1 -1
  110. package/dist/lib/{shadow-claw-chat-B6uuZnJ7.js → shadow-claw-chat-CVc-7ycM.js} +7 -7
  111. package/dist/lib/{shadow-claw-chat-B6uuZnJ7.js.map → shadow-claw-chat-CVc-7ycM.js.map} +1 -1
  112. package/dist/lib/{shadow-claw-control-plane-BpRcl312.js → shadow-claw-control-plane-B5vsF91B.js} +6 -6
  113. package/dist/lib/{shadow-claw-control-plane-BpRcl312.js.map → shadow-claw-control-plane-B5vsF91B.js.map} +1 -1
  114. package/dist/lib/{shadow-claw-conversations-Dc_Xk2mB.js → shadow-claw-conversations-PGK5zqn3.js} +54 -12
  115. package/dist/lib/{shadow-claw-conversations-Dc_Xk2mB.js.map → shadow-claw-conversations-PGK5zqn3.js.map} +1 -1
  116. package/dist/lib/{shadow-claw-file-viewer-C4x1PtB2.js → shadow-claw-file-viewer-DSqn0hgx.js} +6 -6
  117. package/dist/lib/{shadow-claw-file-viewer-C4x1PtB2.js.map → shadow-claw-file-viewer-DSqn0hgx.js.map} +1 -1
  118. package/dist/lib/{shadow-claw-files-DhnHbXKf.js → shadow-claw-files-vOa9ZWbr.js} +6 -6
  119. package/dist/lib/{shadow-claw-files-DhnHbXKf.js.map → shadow-claw-files-vOa9ZWbr.js.map} +1 -1
  120. package/dist/lib/{shadow-claw-git-BeQ1ElUd.js → shadow-claw-git-D54Z85Bj.js} +4 -4
  121. package/dist/lib/{shadow-claw-git-BeQ1ElUd.js.map → shadow-claw-git-D54Z85Bj.js.map} +1 -1
  122. package/dist/lib/{shadow-claw-integrations-Bbdolk3w.js → shadow-claw-integrations-BTubMH9d.js} +2 -2
  123. package/dist/lib/{shadow-claw-integrations-Bbdolk3w.js.map → shadow-claw-integrations-BTubMH9d.js.map} +1 -1
  124. package/dist/lib/{shadow-claw-llm-DPda4L3C.js → shadow-claw-llm-8koGTNYs.js} +3 -3
  125. package/dist/lib/{shadow-claw-llm-DPda4L3C.js.map → shadow-claw-llm-8koGTNYs.js.map} +1 -1
  126. package/dist/lib/{shadow-claw-mcp-remote-Dn9c30WI.js → shadow-claw-mcp-remote-C2jwBsQt.js} +2 -2
  127. package/dist/lib/{shadow-claw-mcp-remote-Dn9c30WI.js.map → shadow-claw-mcp-remote-C2jwBsQt.js.map} +1 -1
  128. package/dist/lib/{shadow-claw-networking-zqNuyn3-.js → shadow-claw-networking-BV-rna16.js} +2 -2
  129. package/dist/lib/{shadow-claw-networking-zqNuyn3-.js.map → shadow-claw-networking-BV-rna16.js.map} +1 -1
  130. package/dist/lib/{shadow-claw-notifications-DFgdo33v.js → shadow-claw-notifications-Dku7VBLk.js} +2 -2
  131. package/dist/lib/{shadow-claw-notifications-DFgdo33v.js.map → shadow-claw-notifications-Dku7VBLk.js.map} +1 -1
  132. package/dist/lib/{shadow-claw-page-header-B7LFGQRf.js → shadow-claw-page-header-VPjYWfsT.js} +2 -2
  133. package/dist/lib/{shadow-claw-page-header-B7LFGQRf.js.map → shadow-claw-page-header-VPjYWfsT.js.map} +1 -1
  134. package/dist/lib/{shadow-claw-pages-DLspFqdK.js → shadow-claw-pages-DXrM6hgZ.js} +29 -19
  135. package/dist/lib/shadow-claw-pages-DXrM6hgZ.js.map +1 -0
  136. package/dist/lib/{shadow-claw-peerjs-D8xWwuWR.js → shadow-claw-peerjs-D3xonez5.js} +3 -3
  137. package/dist/lib/{shadow-claw-peerjs-D8xWwuWR.js.map → shadow-claw-peerjs-D3xonez5.js.map} +1 -1
  138. package/dist/lib/{shadow-claw-settings-NbvzXASD.js → shadow-claw-settings-DMTx6OS9.js} +5 -5
  139. package/dist/lib/{shadow-claw-settings-NbvzXASD.js.map → shadow-claw-settings-DMTx6OS9.js.map} +1 -1
  140. package/dist/lib/{shadow-claw-storage-B_NAoZmd.js → shadow-claw-storage-BJLnukxa.js} +3 -3
  141. package/dist/lib/{shadow-claw-storage-B_NAoZmd.js.map → shadow-claw-storage-BJLnukxa.js.map} +1 -1
  142. package/dist/lib/{shadow-claw-task-server-BaQJXhYJ.js → shadow-claw-task-server-DcMj20hD.js} +2 -2
  143. package/dist/lib/{shadow-claw-task-server-BaQJXhYJ.js.map → shadow-claw-task-server-DcMj20hD.js.map} +1 -1
  144. package/dist/lib/{shadow-claw-tasks-CAZua0-j.js → shadow-claw-tasks-BQBe4lVi.js} +7 -7
  145. package/dist/lib/{shadow-claw-tasks-CAZua0-j.js.map → shadow-claw-tasks-BQBe4lVi.js.map} +1 -1
  146. package/dist/lib/{shadow-claw-terminal-B2YJhkJL.js → shadow-claw-terminal-DPEzTxXv.js} +2 -2
  147. package/dist/lib/{shadow-claw-terminal-B2YJhkJL.js.map → shadow-claw-terminal-DPEzTxXv.js.map} +1 -1
  148. package/dist/lib/{shadow-claw-tools-CkZWxxTm.js → shadow-claw-tools-BCnU8FaK.js} +6 -6
  149. package/dist/lib/{shadow-claw-tools-CkZWxxTm.js.map → shadow-claw-tools-BCnU8FaK.js.map} +1 -1
  150. package/dist/lib/{shadow-claw-webvm-BL9cgrP9.js → shadow-claw-webvm-CnW-hoJ8.js} +2 -2
  151. package/dist/lib/{shadow-claw-webvm-BL9cgrP9.js.map → shadow-claw-webvm-CnW-hoJ8.js.map} +1 -1
  152. package/dist/lib/subsystems/mcp/webmcp.d.ts +15 -2
  153. package/dist/lib/{sync-web-mcp-registration-dW2MVCj4.js → sync-web-mcp-registration-DwpGjVdo.js} +10 -4
  154. package/dist/lib/sync-web-mcp-registration-DwpGjVdo.js.map +1 -0
  155. package/dist/lib/{tools-D7whby3H.js → tools-CP6G0HF7.js} +5 -6
  156. package/dist/lib/tools-CP6G0HF7.js.map +1 -0
  157. package/dist/lib/{trusted-types-d0cdkut_.js → trusted-types-0cu5Dm6M.js} +29 -4
  158. package/dist/lib/{trusted-types-d0cdkut_.js.map → trusted-types-0cu5Dm6M.js.map} +1 -1
  159. package/dist/lib/utils/index.d.ts +1 -0
  160. package/dist/lib/utils/index.js +4 -2
  161. package/dist/lib/utils/index.js.map +1 -1
  162. package/dist/lib/utils/resolve-page-script-dependencies.d.ts +19 -0
  163. package/dist/lib/utils/resolve-page-script-dependencies.js +98 -0
  164. package/dist/lib/utils/resolve-page-script-dependencies.js.map +1 -0
  165. package/dist/lib/utils/utils.js +1 -1
  166. package/dist/lib/webmcp-Bf9rT7uu.js +2001 -0
  167. package/dist/lib/webmcp-Bf9rT7uu.js.map +1 -0
  168. package/dist/public/.well-known/mcp/server-card.json +1 -1
  169. package/dist/public/.well-known/mcp.json +1 -1
  170. package/dist/public/AGENTS.md +3 -3
  171. package/dist/public/README.md +1 -1
  172. package/dist/public/agent.worker.js +2 -2
  173. package/dist/public/components/shadow-claw/shadow-claw.css +1 -1
  174. package/dist/public/components/shadow-claw/shadow-claw.html +1 -1
  175. package/dist/public/components/shadow-claw-conversations/shadow-claw-conversations.css +1 -1
  176. package/dist/public/components/shadow-claw-conversations/shadow-claw-conversations.html +1 -1
  177. package/dist/public/{configure-peer-js-WLRM7Qa7.js → configure-peer-js-OYl3V8sW.js} +1 -1
  178. package/dist/public/{custom-element-security-Cl991z-x.js → custom-element-security-BR4V40j4.js} +1 -1
  179. package/dist/public/docs/example/article/index.html +3 -3
  180. package/dist/public/docs/example/article.html +3 -3
  181. package/dist/public/docs/publishing/index.html +3 -3
  182. package/dist/public/docs/publishing.html +3 -3
  183. package/dist/public/docs/skill-creator/index.html +3 -3
  184. package/dist/public/docs/skill-creator.html +3 -3
  185. package/dist/public/docs/subsystems/custom-element-security.md +19 -5
  186. package/dist/public/docs/subsystems/pages.md +10 -2
  187. package/dist/public/docs/subsystems/tools.md +1 -2
  188. package/dist/public/docs/subsystems/webmcp.md +41 -6
  189. package/dist/public/{download-group-file-fFjoIIp4.js → download-group-file-BNmK8wac.js} +1 -1
  190. package/dist/public/e2e/README.md +2 -2
  191. package/dist/public/{e2e-bridge-CiSfBRT4.js → e2e-bridge-4phD1JUQ.js} +1 -1
  192. package/dist/public/{file-viewer-DFC3kfeO.js → file-viewer-Dbh3K9nL.js} +1 -1
  193. package/dist/public/index.html +3 -3
  194. package/dist/public/index.js +1 -1
  195. package/dist/public/{init-control-plane-BEbcwmmv.js → init-control-plane-DGOY_RNS.js} +1 -1
  196. package/dist/public/llms.txt +1 -1
  197. package/dist/public/main/index.html +3 -3
  198. package/dist/public/main/memory/index.html +3 -3
  199. package/dist/public/main/memory.html +3 -3
  200. package/dist/public/main.html +3 -3
  201. package/dist/public/{markdown-BeglYzw9.js → markdown-BPZYpfGm.js} +1 -1
  202. package/dist/public/{orchestrator-BlvEG3PO.js → orchestrator-OoUK7CF9.js} +1 -1
  203. package/dist/public/{orchestrator-DTNrntd4.js → orchestrator-a9047bGu.js} +1 -1
  204. package/dist/public/{peerjs-CnBdK94R.js → peerjs-Cbn310Tz.js} +1 -1
  205. package/dist/public/{push-client-DOHbdCyj.js → push-client-Dy4LGJy9.js} +1 -1
  206. package/dist/public/service-worker.js +1 -1
  207. package/dist/public/shadow-claw-B-HWC1uN.js +1180 -0
  208. package/dist/public/{shadow-claw-accounts-C6FXVw2K.js → shadow-claw-accounts-Di-anCZ1.js} +1 -1
  209. package/dist/public/{shadow-claw-channels-tr_r60Kq.js → shadow-claw-channels-RVwCE8pE.js} +1 -1
  210. package/dist/public/{shadow-claw-chat-BAAPhAOs.js → shadow-claw-chat-DI1q8UnX.js} +1 -1
  211. package/dist/public/{shadow-claw-control-plane-C_5VIx8E.js → shadow-claw-control-plane-KXEdLOGl.js} +2 -2
  212. package/dist/public/{shadow-claw-conversations-DGYZdDa3.js → shadow-claw-conversations-BCBGtS30.js} +40 -6
  213. package/dist/public/{shadow-claw-file-viewer-5j2-Z3fN.js → shadow-claw-file-viewer-CW3t6j-w.js} +1 -1
  214. package/dist/public/{shadow-claw-files-DKF4Yy0m.js → shadow-claw-files-JQ-o0ImX.js} +1 -1
  215. package/dist/public/{shadow-claw-git-CtUTJXKT.js → shadow-claw-git-D2M8VixW.js} +2 -2
  216. package/dist/public/{shadow-claw-integrations-CuBy9D3z.js → shadow-claw-integrations-Cgw6v9_1.js} +1 -1
  217. package/dist/public/{shadow-claw-llm-BIfNNjGL.js → shadow-claw-llm-74ieXp7i.js} +1 -1
  218. package/dist/public/{shadow-claw-mcp-remote-C17FXvrb.js → shadow-claw-mcp-remote-BX0BkSmy.js} +1 -1
  219. package/dist/public/{shadow-claw-networking-CjxQ1CLI.js → shadow-claw-networking-DNX8vaIQ.js} +1 -1
  220. package/dist/public/{shadow-claw-notifications-Brn2O3Ps.js → shadow-claw-notifications-BLTaGAny.js} +1 -1
  221. package/dist/public/{shadow-claw-page-header-Bn1P7Cxb.js → shadow-claw-page-header-CjFOdo9v.js} +1 -1
  222. package/dist/public/shadow-claw-pages-DOQqMm0_.js +645 -0
  223. package/dist/public/{shadow-claw-settings-CfDm0hVA.js → shadow-claw-settings-DFtl0Fy8.js} +2 -2
  224. package/dist/public/{shadow-claw-storage-DOOesRzw.js → shadow-claw-storage-gQGExZRq.js} +1 -1
  225. package/dist/public/{shadow-claw-task-server-H36iDDp2.js → shadow-claw-task-server-Ca45uY7S.js} +1 -1
  226. package/dist/public/{shadow-claw-tasks-4JsjSGkN.js → shadow-claw-tasks-CCTaaSdi.js} +1 -1
  227. package/dist/public/{shadow-claw-terminal-CTRTcYz-.js → shadow-claw-terminal-BfgulLkl.js} +1 -1
  228. package/dist/public/{shadow-claw-tools-Dm1LxNf4.js → shadow-claw-tools-V8NA4n18.js} +1 -1
  229. package/dist/public/{shadow-claw-webvm-JzuPe9Nr.js → shadow-claw-webvm-CxxI2bnC.js} +1 -1
  230. package/dist/public/sync-web-mcp-registration-CkCA8UFm.js +1 -0
  231. package/dist/public/{tools-FiTtOlIt.js → tools-CwQq5tJH.js} +2 -2
  232. package/dist/public/webmcp-CmtWOAFm.js +6 -0
  233. package/dist/server.js +2 -2
  234. package/package.json +3 -3
  235. package/src/cli/prerender/dsd-shell/prerender-dsd-shell.test.ts +16 -0
  236. package/src/cli/prerender/dsd-shell/prerender-dsd-shell.ts +62 -1
  237. package/src/cli/prerender/pretty-paths/prerender-pretty-paths.test.ts +277 -0
  238. package/src/cli/prerender/pretty-paths/prerender-pretty-paths.ts +28 -1
  239. package/src/cli/site-config/custom-elements/build-custom-element-script-tags.ts +13 -1
  240. package/src/components/shadow-claw/shadow-claw.css +12 -0
  241. package/src/components/shadow-claw/shadow-claw.html +12 -2
  242. package/src/components/shadow-claw/utils/bind-event-listeners.test.ts +18 -0
  243. package/src/components/shadow-claw/utils/bind-event-listeners.ts +14 -0
  244. package/src/components/shadow-claw/utils/get-route.test.ts +35 -0
  245. package/src/components/shadow-claw/utils/get-route.ts +18 -0
  246. package/src/components/shadow-claw/utils/sync-slotted-sidebar-active-links.test.ts +152 -1
  247. package/src/components/shadow-claw/utils/sync-slotted-sidebar-active-links.ts +139 -8
  248. package/src/components/shadow-claw-conversations/shadow-claw-conversations.css +11 -0
  249. package/src/components/shadow-claw-conversations/shadow-claw-conversations.html +27 -4
  250. package/src/components/shadow-claw-conversations/shadow-claw-conversations.ts +32 -4
  251. package/src/components/shadow-claw-pages/shadow-claw-pages-scripts.test.ts +266 -0
  252. package/src/components/shadow-claw-pages/shadow-claw-pages.ts +41 -17
  253. package/src/core/orchestrator/utils/sync-web-mcp-registration.test.ts +18 -1
  254. package/src/core/orchestrator/utils/sync-web-mcp-registration.ts +8 -0
  255. package/src/core/utils/init-control-plane.test.ts +9 -4
  256. package/src/security/custom-element-security.test.ts +65 -0
  257. package/src/security/custom-element-security.ts +67 -4
  258. package/src/stores/tools.test.ts +5 -3
  259. package/src/stores/tools.ts +5 -10
  260. package/src/subsystems/mcp/webmcp.test.ts +84 -13
  261. package/src/subsystems/mcp/webmcp.ts +73 -10
  262. package/src/utils/index.ts +1 -0
  263. package/src/utils/resolve-page-script-dependencies.test.ts +245 -0
  264. package/src/utils/resolve-page-script-dependencies.ts +198 -0
  265. package/dist/cli/chunk-B1hufJeO.js +0 -1
  266. package/dist/cli/chunk-BZpn8npn.js +0 -1
  267. package/dist/cli/chunk-Bw5aOTFr.js +0 -1
  268. package/dist/cli/chunk-C8nH01Gw.js +0 -32
  269. package/dist/cli/chunk-CK1ZoyoE.js +0 -17
  270. package/dist/cli/chunk-CVkhDr-7.js +0 -1
  271. package/dist/cli/chunk-Cum07Vlh.js +0 -1
  272. package/dist/cli/chunk-D3UhDDmV.js +0 -2
  273. package/dist/cli/chunk-D8GI6qj6.js +0 -1
  274. package/dist/cli/chunk-DEH-FvmP.js +0 -1
  275. package/dist/cli/chunk-DksvJ_kf.js +0 -1
  276. package/dist/cli/chunk-RGb9wM4R.js +0 -1
  277. package/dist/lib/shadow-claw-PdOpgTxH.js.map +0 -1
  278. package/dist/lib/shadow-claw-pages-DLspFqdK.js.map +0 -1
  279. package/dist/lib/sync-web-mcp-registration-dW2MVCj4.js.map +0 -1
  280. package/dist/lib/tools-D7whby3H.js.map +0 -1
  281. package/dist/lib/webmcp-CYTNZfkn.js +0 -1687
  282. package/dist/lib/webmcp-CYTNZfkn.js.map +0 -1
  283. package/dist/public/shadow-claw-CnNX-WCh.js +0 -1158
  284. package/dist/public/shadow-claw-pages-BwOOqRWW.js +0 -645
  285. package/dist/public/sync-web-mcp-registration-BnHVUjat.js +0 -1
  286. package/dist/public/webmcp-_TBqXlVW.js +0 -1
@@ -17,7 +17,7 @@ function fi(e,t){this.v=e,this.k=t}function pi(e,t){(t==null||t>e.length)&&(t=e.
17
17
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}
18
18
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
19
19
  function _i(e,t){return mi(e)||hi(e,t)||vi(e,t)||gi()}function vi(e,t){if(e){if(typeof e==`string`)return pi(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pi(e,t):void 0}}function yi(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof fi;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}function bi(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ri(e,t,n)}}function xi(e){return function(){return zi(e,[...arguments])}}function Si(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ki;if(Ai&&Ai(e,null),!Gi(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ji(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ci(e){for(let t=0;t<e.length;t++)na(e,t)||(e[t]=null);return e}function wi(e){let t=Ii(null);for(let r of ki(e)){var n=_i(r,2);let i=n[0],a=n[1];na(e,i)&&(t[i]=Gi(a)?Ci(a):a&&typeof a==`object`&&a.constructor===Object?wi(a):a)}return t}function Ti(e){switch(typeof e){case`string`:return e;case`number`:return Qi(e);case`boolean`:return $i(e);case`bigint`:return ea?ea(e):`0`;case`symbol`:return ta?ta(e):`Symbol()`;case`undefined`:return ra(e);case`function`:case`object`:{if(e===null)return ra(e);let t=e,n=Ei(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:ra(e)}return ra(e)}default:return ra(e)}}function Ei(e,t){for(;e!==null;){let n=Ni(e,t);if(n){if(n.get)return bi(n.get);if(typeof n.value==`function`)return bi(n.value)}e=Mi(e)}function n(){return null}return n}function Di(e){try{return ia(e,``),!0}catch{return!1}}function Oi(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fa(),t=e=>Oi(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==ja.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Ei(d,`cloneNode`),p=Ei(d,`remove`),m=Ei(d,`removeAttributeNode`),h=Ei(d,`nextSibling`),g=Ei(d,`childNodes`),_=Ei(d,`parentNode`),v=Ei(d,`shadowRoot`),y=Ei(d,`attributes`),b=o&&o.prototype?Ei(o.prototype,`nodeType`):null,x=o&&o.prototype?Ei(o.prototype,`nodeName`):null,S=o&&o.prototype?Ei(o.prototype,`ownerDocument`):null,ee=function(e){return b?b(e):e.nodeType},te=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let C,ne=``,w,re=!1,T=0,E=function(){if(T>0)throw aa(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},ie=function(e){E(),T++;try{return C.createHTML(e)}finally{T--}},D=function(e){E(),T++;try{return C.createScriptURL(e)}finally{T--}},O=function(){return re||=(w=Ia(u,i),!0),w},ae=n,oe=ae.implementation,se=ae.createNodeIterator,ce=ae.createDocumentFragment,le=ae.getElementsByTagName,ue=r.importNode,de=La();t.isSupported=typeof ki==`function`&&typeof _==`function`&&oe&&oe.createHTMLDocument!==void 0;let fe=_a,pe=va,me=ya,he=ba,ge=xa,_e=Ca,ve=wa,ye=Ea,be=Sa,k=null,xe=Si({},[...oa,...sa,...ca,...ua,...fa]),Se=null,Ce=Si({},[...pa,...ma,...ha,...ga]),we=Object.seal(Ii(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ee=null,De=Object.seal(Ii(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,ke=!0,Ae=!1,A=!0,je=!1,Me=!0,Ne=!1,Pe=!1,Fe=null,Ie=null,Le=!1,Re=!1,ze=!1,Be=!1,Ve=!0,He=!1,Ue=`user-content-`,j=!0,We=!1,Ge={},Ke=null,qe=Si({},/* @__PURE__ */ `annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Je=null,Ye=Si({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Xe=null,Ze=Si({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Qe=`http://www.w3.org/1998/Math/MathML`,$e=`http://www.w3.org/2000/svg`,et=`http://www.w3.org/1999/xhtml`,tt=et,M=!1,nt=null,rt=Si({},[Qe,$e,et],qi),it=Pi([`mi`,`mo`,`mn`,`ms`,`mtext`]),at=Si({},it),ot=Pi([`annotation-xml`]),st=Si({},ot),ct=Si({},[`title`,`style`,`font`,`a`,`script`]),N=null,lt=[`application/xhtml+xml`,`text/html`],P=null,ut=null,dt=n.createElement(`form`),ft=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ut&&ut===e)return;(!e||typeof e!=`object`)&&(e={}),e=wi(e),N=lt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,P=N===`application/xhtml+xml`?qi:Ki,k=Ra(e,`ALLOWED_TAGS`,xe,{transform:P}),Se=Ra(e,`ALLOWED_ATTR`,Ce,{transform:P}),nt=Ra(e,`ALLOWED_NAMESPACES`,rt,{transform:qi}),Xe=Ra(e,`ADD_URI_SAFE_ATTR`,Ze,{transform:P,base:Ze}),Je=Ra(e,`ADD_DATA_URI_TAGS`,Ye,{transform:P,base:Ye}),Ke=Ra(e,`FORBID_CONTENTS`,qe,{transform:P}),Te=Ra(e,`FORBID_TAGS`,wi({}),{transform:P}),Ee=Ra(e,`FORBID_ATTR`,wi({}),{transform:P}),Ge=na(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?wi(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,Ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,A=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,ze=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,Ve=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,j=e.KEEP_CONTENT!==!1,We=e.IN_PLACE||!1,be=Di(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Sa,tt=typeof e.NAMESPACE==`string`?e.NAMESPACE:et,at=za(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Si({},it)),st=za(e,`HTML_INTEGRATION_POINTS`,()=>Si({},ot));let t=za(e,`CUSTOM_ELEMENT_HANDLING`,()=>Ii(null));if(we=Ii(null),na(t,`tagNameCheck`)&&ft(t.tagNameCheck)&&(we.tagNameCheck=t.tagNameCheck),na(t,`attributeNameCheck`)&&ft(t.attributeNameCheck)&&(we.attributeNameCheck=t.attributeNameCheck),na(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(we.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Fi(we),je&&(ke=!1),ze&&(Re=!0),Ge&&(k=Si({},fa),Se=Ii(null),Ge.html===!0&&(Si(k,oa),Si(Se,pa)),Ge.svg===!0&&(Si(k,sa),Si(Se,ma),Si(Se,ga)),Ge.svgFilters===!0&&(Si(k,ca),Si(Se,ma),Si(Se,ga)),Ge.mathMl===!0&&(Si(k,ua),Si(Se,ha),Si(Se,ga))),De.tagCheck=null,De.attributeCheck=null,na(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?De.tagCheck=e.ADD_TAGS:Gi(e.ADD_TAGS)&&(k===xe&&(k=wi(k)),Si(k,e.ADD_TAGS,P))),na(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?De.attributeCheck=e.ADD_ATTR:Gi(e.ADD_ATTR)&&(Se===Ce&&(Se=wi(Se)),Si(Se,e.ADD_ATTR,P))),na(e,`ADD_FORBID_CONTENTS`)&&Gi(e.ADD_FORBID_CONTENTS)&&(Ke===qe&&(Ke=wi(Ke)),Si(Ke,e.ADD_FORBID_CONTENTS,P)),j&&(k[`#text`]=!0),Ne&&Si(k,[`html`,`head`,`body`]),k.table&&(Si(k,[`tbody`]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw aa(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw aa(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=C;C=e.TRUSTED_TYPES_POLICY;try{ne=ie(``)}catch(e){throw C=t,e}}else e.TRUSTED_TYPES_POLICY===null?(C=void 0,ne=``):(C===void 0&&(C=O()),C&&typeof ne==`string`&&(ne=ie(``)));Pi&&Pi(e),ut=e},mt=Si({},[...sa,...ca,...la]),ht=Si({},[...ua,...da]),gt=function(e,t,n){return t.namespaceURI===et?e===`svg`:t.namespaceURI===Qe?e===`svg`&&(n===`annotation-xml`||at[n]):!!mt[e]},_t=function(e,t,n){return t.namespaceURI===et?e===`math`:t.namespaceURI===$e?e===`math`&&st[n]:!!ht[e]},vt=function(e,t,n){return t.namespaceURI===$e&&!st[n]||t.namespaceURI===Qe&&!at[n]?!1:!ht[e]&&(ct[e]||!mt[e])},yt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:tt,tagName:`template`});let n=Ki(e.tagName),r=Ki(t.tagName);return nt[e.namespaceURI]?e.namespaceURI===$e?gt(n,t,r):e.namespaceURI===Qe?_t(n,t,r):e.namespaceURI===et?vt(n,t,r):!!(N===`application/xhtml+xml`&&nt[e.namespaceURI]):!1},bt=function(e){Ui(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw aa(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},F=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},xt=function(e){L(e);let t=g(e);if(t){let e=[];Bi(t,t=>{Ui(e,t)}),Bi(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&F(e,r,i)}},I=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Ui(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Re||ze)try{bt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},St=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||Se[P(i)]||F(e,r,i)}},L=function(e){let t=[e];for(;t.length>0;){let e=t.pop();ee(e)===ja.element&&St(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Ct=function(e,t){return Me?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},wt=function(e){if(!Me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=ee(e);if(n===ja.processingInstruction||n===ja.comment&&ia(Oa,e.data)){try{p(e)}catch{}continue}if(n===ja.element){let t=e,n=P(te(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Ct(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Tt=function(e){let t=null,r=null;if(Le)e=`<remove></remove>`+e;else{let t=Ji(e,/^[\r\n\t ]+/);r=t&&t[0]}N===`application/xhtml+xml`&&tt===et&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=C?ie(e):e;if(tt===et)try{t=new l().parseFromString(i,N)}catch{}if(!t||!t.documentElement){t=oe.createDocument(tt,`template`,null);try{t.documentElement.innerHTML=M?ne:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),tt===et?le.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},Et=function(e){let t=S?S(e):e.ownerDocument;return se.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Dt=function(e){return e=Yi(e,fe,` `),e=Yi(e,pe,` `),e=Yi(e,me,` `),e},Ot=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=se.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Dt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&Bi(i,e=>{At(e.content)&&Ot(e.content)})},kt=function(e){let t=x?x(e):null;return typeof t!=`string`||P(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},At=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===ja.documentFragment}catch{return!1}},jt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Mt(e,n,r){e.length!==0&&Bi(e,e=>{e.call(t,n,r,ut)})}let Nt=function(e,t){return!!(Me&&e.hasChildNodes()&&!jt(e.firstElementChild)&&ia(Da,e.textContent)&&ia(Da,e.innerHTML)||Me&&e.namespaceURI===et&&Na[t]&&(jt(e.firstElementChild)||typeof e.textContent==`string`&&ia(Pa[t],e.textContent))||e.nodeType===ja.processingInstruction||Me&&e.nodeType===ja.comment&&ia(Oa,e.data))},Pt=function(e,t){return e instanceof RegExp?ia(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Ft=function(e,t,n){if(!Te[t]&&Vt(t)&&Pt(we.tagNameCheck,t))return!1;if(j&&!Ke[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return bt(e),!0},It=function(e,t,n,r){return e.length===0?t:t===n||t===r?wi(t):t},Lt=function(e,t){return e===t||_(e)!==null?!1:(We&&L(e),!0)},Rt=function(e,n){if(Mt(de.beforeSanitizeElements,e,null),Lt(e,n))return!0;if(kt(e))return bt(e),!0;let r=P(te(e));if(k=It(de.uponSanitizeElement,k,xe,Fe),Mt(de.uponSanitizeElement,e,{tagName:r,allowedTags:k}),Lt(e,n))return!0;if(Nt(e,r))return bt(e),!0;if(Te[r]||!(De.tagCheck instanceof Function&&De.tagCheck(r))&&!k[r]){let t=Ft(e,r,n);return t===!1&&(Mt(de.afterSanitizeElements,e,null),Lt(e,n))?!0:t}if(ee(e)===ja.element&&!yt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&ia(ka,e.innerHTML))return bt(e),!0;if(je&&e.nodeType===ja.text){let n=Dt(e.textContent);e.textContent!==n&&(Ui(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Mt(de.afterSanitizeElements,e,null),Lt(e,n)},zt=function(e,t,r){if(Ee[t]||Ct(t,e)||Ve&&(t===`id`||t===`name`)&&(r in n||r in dt))return!1;let i=Se[t]||De.attributeCheck instanceof Function&&De.attributeCheck(t,e);return ke&&ia(he,t)||Oe&&ia(ge,t)?!0:i?Xe[t]||ia(be,Yi(r,ve,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Xi(r,`data:`)===0&&Je[e]||Ae&&!ia(_e,Yi(r,ve,``))?!0:!r:Vt(e)&&Pt(we.tagNameCheck,e)&&Pt(we.attributeNameCheck,t,e)||t===`is`&&we.allowCustomizedBuiltInElements&&Pt(we.tagNameCheck,r)},Bt=Si({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Vt=function(e){return!Bt[Ki(e)]&&ia(ye,e)},Ht=function(e,t,n,r){if(C&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ie(r);case`TrustedScriptURL`:return D(r)}return r},Ut=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!kt(e)||(bt(e),!1)}catch{return I(t,e),!1}},R=function(e,n){if(Mt(de.beforeSanitizeAttributes,e,null),Lt(e,n))return;let r=e.attributes;if(!r||kt(e))return;Se=It(de.uponSanitizeAttribute,Se,Ce,Ie);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:Se,forceKeepAttr:void 0},a=r.length,o=P(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=P(s),d=l,f=s===`value`?d:Zi(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Mt(de.uponSanitizeAttribute,e,i),f=i.attrValue,He&&(u===`id`||u===`name`)&&Xi(f,Ue)!==0&&(I(s,e,n),f=Ue+f,p=!0),Me&&ia(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)||u===`attributename`&&Ji(f,`href`)?I(s,e,n):i.forceKeepAttr||(i.keepAttr?!A&&ia(Aa,f)?I(s,e,n):(je&&(f=Dt(f)),zt(o,u,f)?(f=Ht(o,u,c,f),f!==d&&Ut(e,s,c,f)&&p&&Hi(t.removed)):I(s,e,n)):I(s,e,n))}Mt(de.afterSanitizeAttributes,e,null),Lt(e,n)},Wt=function(e){let t=null,n=Et(e);for(Mt(de.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Mt(de.uponSanitizeShadowNode,t,null),Rt(t,e),R(t,e),At(t.content)&&Wt(t.content),ee(t)===ja.element){let e=v(t);At(e)&&(Gt(e),Wt(e))}Mt(de.afterSanitizeShadowDOM,e,null)},Gt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Wt(e.shadow);continue}let n=e.node,r=ee(n)===ja.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&P(e)===`template`){let e=n.content;At(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);At(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(M=!e,M&&(e=`<!-->`),typeof e!=`string`&&!jt(e)&&(e=Ti(e),typeof e!=`string`))throw aa(`dirty is not a string, aborting`);if(!t.isSupported)return e;Pe?(k=Fe,Se=Ie):pt(n),(de.uponSanitizeElement.length>0||de.uponSanitizeAttribute.length>0)&&(k=wi(k)),de.uponSanitizeAttribute.length>0&&(Se=wi(Se)),t.removed=[];let c=We&&typeof e!=`string`&&jt(e);if(c){wt(e);let t=te(e);if(typeof t==`string`){let n=P(t);if(!k[n]||Te[n])throw xt(e),aa(`root node is forbidden and cannot be sanitized in-place`)}if(kt(e))throw xt(e),aa(`root node is clobbered and cannot be sanitized in-place`);try{Gt(e)}catch(t){throw xt(e),t}}else if(jt(e))i=Tt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===ja.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Gt(i);else{if(!Re&&!je&&!Ne&&e.indexOf(`<`)===-1)return C&&Be?ie(e):e;if(i=Tt(e),!i)return Re?null:Be?ne:``}i&&Le&&bt(i.firstChild);let l=c?e:i;try{let e=Et(l);for(;o=e.nextNode();)Rt(o,l),R(o,l),At(o.content)&&Wt(o.content)}catch(n){throw c&&(xt(e),Bi(t.removed,e=>{e.element&&L(e.element)})),n}if(c){let n=!1;if(Bi(t.removed,t=>{t.element&&(t.element===e&&(n=!0),L(t.element))}),n)throw aa(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return je&&Ot(e),e}if(Re){if(je&&Ot(i),ze)for(s=ce.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(Se.shadowroot||Se.shadowrootmode)&&(s=ue.call(r,s,!0)),s}let u=Ne?i.outerHTML:i.innerHTML;return Ne&&k[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ia(Ta,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
20
- `+u),je&&(u=Dt(u)),C&&Be?ie(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pt(e),Pe=!0,Fe=k,Ie=Se},t.clearConfig=function(){ut=null,Pe=!1,Fe=null,Ie=null,C=w,ne=``},t.isValidAttribute=function(e,t,n){ut||pt({});let r=P(e),i=P(t);return zt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&na(de,e)&&Ui(de[e],t)},t.removeHook=function(e,t){if(na(de,e)){if(t!==void 0){let n=Vi(de[e],t);return n===-1?void 0:Wi(de[e],n,1)[0]}return Hi(de[e])}},t.removeHooks=function(e){na(de,e)&&(de[e]=[])},t.removeAllHooks=function(){de=La()},t}var ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba=k((()=>{yi.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},yi.prototype.next=function(e){return this._invoke(`next`,e)},yi.prototype.throw=function(e){return this._invoke(`throw`,e)},yi.prototype.return=function(e){return this._invoke(`return`,e)},ki=Object.entries,Ai=Object.setPrototypeOf,ji=Object.isFrozen,Mi=Object.getPrototypeOf,Ni=Object.getOwnPropertyDescriptor,Pi=Object.freeze,Fi=Object.seal,Ii=Object.create,Li=typeof Reflect<`u`&&Reflect,Ri=Li.apply,zi=Li.construct,Pi||=function(e){return e},Fi||=function(e){return e},Ri||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},zi||=function(e){return new e(...[...arguments].slice(1))},Bi=bi(Array.prototype.forEach),Array.prototype.indexOf,Vi=bi(Array.prototype.lastIndexOf),Hi=bi(Array.prototype.pop),Ui=bi(Array.prototype.push),Array.prototype.slice,Wi=bi(Array.prototype.splice),Gi=Array.isArray,Ki=bi(String.prototype.toLowerCase),qi=bi(String.prototype.toString),Ji=bi(String.prototype.match),Yi=bi(String.prototype.replace),Xi=bi(String.prototype.indexOf),Zi=bi(String.prototype.trim),Qi=bi(Number.prototype.toString),$i=bi(Boolean.prototype.toString),ea=typeof BigInt>`u`?null:bi(BigInt.prototype.toString),ta=typeof Symbol>`u`?null:bi(Symbol.prototype.toString),na=bi(Object.prototype.hasOwnProperty),ra=bi(Object.prototype.toString),ia=bi(RegExp.prototype.test),aa=xi(TypeError),oa=Pi(/* @__PURE__ */ `a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),sa=Pi(/* @__PURE__ */ `svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ca=Pi([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),la=Pi([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ua=Pi(/* @__PURE__ */ `math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),da=Pi([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),fa=Pi([`#text`]),pa=Pi(/* @__PURE__ */ `accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),ma=Pi(/* @__PURE__ */ `accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),ha=Pi(/* @__PURE__ */ `accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ga=Pi([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),_a=Fi(/{{[\w\W]*|^[\w\W]*}}/g),va=Fi(/<%[\w\W]*|^[\w\W]*%>/g),ya=Fi(/\${[\w\W]*/g),ba=Fi(/^data-[\-\w.\u00B7-\uFFFF]+$/),xa=Fi(/^aria-[\-\w]+$/),Sa=Fi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ca=Fi(/^(?:\w+script|data):/i),wa=Fi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ta=Fi(/^html$/i),Ea=Fi(/^[a-z][.\w]*(-[.\w]+)+$/i),Da=Fi(/<[/\w!]/g),Oa=Fi(/<[/\w]/g),ka=Fi(/<\/no(script|embed|frames)/i),Aa=Fi(/\/>/i),ja={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ma=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Na=Pi(Si({},Ma)),Pa=function(){let e={};return Bi(Ma,t=>{e[t]=Fi(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Pi(e)}(),Fa=function(){return typeof window>`u`?null:window},Ia=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},La=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ra=function(e,t,n,r){return na(e,t)&&Gi(e[t])?Si(r.base?wi(r.base):{},e[t],r.transform):n},za=function(e,t,n){let r=na(e,t)?e[t]:void 0;return r&&typeof r==`object`?wi(r):n()},Oi()}));function Va(e){let t=e.trim();if(!t)return()=>!1;if(t.startsWith(`/`)&&(t.endsWith(`/`)||/\/[gimuy]*$/.test(t)))try{let e=t.lastIndexOf(`/`),n=t.slice(1,e),r=t.slice(e+1),i=new RegExp(n,r||`i`);return e=>i.test(e)}catch{}if(t.includes(`^`)||t.includes(`$`)||t.includes(`(`)&&t.includes(`)`))try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{}if(t.startsWith(`*.`)){let e=t.slice(2).toLowerCase();return t=>{let n=t.toLowerCase();return n===e||n.endsWith(`.`+e)}}let n=t.toLowerCase();return e=>{let t=e.toLowerCase();return t===n||t.endsWith(`.`+n)}}var Ha=k((()=>{}));function Ua(e){eee=e.map(e=>Va(e)).filter(Boolean)}var Wa,Ga,eee,Ka=k((()=>{Ba(),Dt(),Ft(),Wt(),Ha(),Wa=[`youtube.com`,`youtube-nocookie.com`,`youtu.be`,`xt-ml.github.io`,`kherrick.github.io`],Ga=[...Wa],Ua(Ga)}));function qa(e){co=e.map(e=>Va(e)).filter(Boolean)}function tee(e){return Array.isArray(e)?e.map(e=>typeof e==`string`?e.toLowerCase().trim():``).filter(Boolean):typeof e==`string`?e.split(/[\n,]+/).map(e=>e.toLowerCase().trim()).filter(Boolean):[]}function Ja(e){return Array.isArray(e)?e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean):typeof e==`string`?e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean):[]}function Ya(e){let t=tee(e);oo=new Set(t)}function Xa(e){let t=Ja(e);so=t,qa(t)}function Za(e){if(!e||typeof e!=`string`)return!1;let t=e.trim().toLowerCase();return!t.includes(`-`)||t===`shadow-claw`||t.startsWith(`shadow-claw-`)||t.startsWith(`sc-`)?!0:oo.has(t)}function Qa(e){if(!e||typeof e!=`string`)return!1;let t=e.trim();if(!t||/^(?:javascript|data|vbscript):/i.test(t))return!1;if(/^blob:/i.test(t)||t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`))return!0;try{let e=typeof globalThis<`u`&&globalThis.location?.origin&&globalThis.location.origin!==`null`?globalThis.location.origin:`http://localhost`,n=new URL(t,e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return!1;if(typeof globalThis<`u`&&globalThis.location?.origin&&globalThis.location.origin!==`null`&&n.origin===globalThis.location.origin)return!0;let r=n.hostname.toLowerCase();return co.some(e=>e(r))}catch{return!1}}function $a(e){if(!e||typeof e!=`object`)return;let t=e.allowedCustomElements||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedElements:void 0);t!==void 0&&Ya(t);let n=e.allowedCustomElementDomains||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedDomains:void 0);n!==void 0&&Xa(n)}function eo(e){lo=e}function to(){if(typeof document>`u`)return;let e=document.getElementById(`shadow-claw-site-config`);if(e&&e.textContent)try{let t=JSON.parse(e.textContent);$a(t),lo?.(t)}catch{}}function no(){to(),!(fo||typeof customElements>`u`||typeof customElements.define!=`function`)&&(uo=customElements.define.bind(customElements),customElements.define=function(e,t,n){if(!Za((e||``).toLowerCase().trim())){let t=`[Security] Registration blocked: <${e}> is not an approved custom element.`;throw console.error(t),Error(t)}return uo(e,t,n)},fo=!0)}function ro(e=typeof document<`u`?document.documentElement:null){if(typeof MutationObserver>`u`||!e)return null;if(typeof e.querySelectorAll==`function`)try{e.querySelectorAll(`*`).forEach(e=>{let t=e.tagName?e.tagName.toLowerCase():``;t.includes(`-`)&&!Za(t)&&(console.warn(`[Security] Removing existing unapproved custom element: <${t}>`),e.remove())})}catch{}let t=new MutationObserver(e=>{for(let t of e)t.addedNodes.forEach(e=>{if(e.nodeType===1){let t=e,n=t.tagName?t.tagName.toLowerCase():``;n.includes(`-`)&&!Za(n)&&(console.warn(`[Security] Removing unapproved custom element: <${n}>`),t.remove())}})});return t.observe(e,{childList:!0,subtree:!0}),t}var io,ao,oo,so,co,lo,uo,fo,po=k((()=>{Ha(),io=[],ao=[],oo=new Set(io.map(e=>e.toLowerCase().trim())),so=[...ao],co=[],qa(so),lo=null,uo=null,fo=!1}));function mo(e){Co=Array.isArray(e)?e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean).join(` `):typeof e==`string`&&e.trim()?e.trim():vo}function ho(e){if(!e||typeof e!=`object`)return;let t=e.allowedCustomElements||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedElements:void 0);t!==void 0&&Ya(t);let n=e.allowedCustomElementDomains||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedDomains:void 0);n!==void 0&&Xa(n);let r=typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.scripts:void 0;r!==void 0&&go(r),e.security?.iframeSandbox===void 0?(e.security?.allowSameOrigin===!0||e.security?.allowIframeSameOrigin===!0)&&(Co.includes(`allow-same-origin`)||(Co=`${Co} allow-same-origin`.trim())):mo(e.security.iframeSandbox),e.security?.workerSrc!==void 0&&(nee=Ja(e.security.workerSrc)),e.security?.connectSrc!==void 0&&(ree=Ja(e.security.connectSrc)),e.security?.scriptSrc!==void 0&&(iee=Ja(e.security.scriptSrc)),e.security?.styleSrc!==void 0&&(aee=Ja(e.security.styleSrc)),e.security?.imgSrc!==void 0&&(oee=Ja(e.security.imgSrc))}function go(e){see=Array.isArray(e)?e.map(e=>({src:typeof e==`string`?e:e?.src,hasInit:typeof e==`object`&&e?!!e.hasInit:!1})).filter(e=>typeof e.src==`string`&&Qa(e.src)):[]}async function _o(e){try{let{getDb:t}=await Promise.resolve().then(()=>(Ft(),Ot)),{getConfig:n}=await Promise.resolve().then(()=>(Wt(),Ut)),r=e??await t();if(!r)return;let[i,a]=await Promise.all([n(r,`allowed_custom_elements`),n(r,`allowed_custom_element_host_patterns`)]);if(typeof i==`string`&&i.trim())try{Ya(JSON.parse(i))}catch{Ya(i)}if(typeof a==`string`&&a.trim())try{Xa(JSON.parse(a))}catch{Xa(a)}}catch(e){console.warn(`Failed to load custom element security from db:`,e)}}var vo,yo,bo,xo,So,Co,nee,ree,iee,aee,oee,see,wo=k((()=>{po(),po(),Ka(),jo(),vo=`allow-modals allow-scripts allow-popups allow-popups-to-escape-sandbox`,yo=[`'self'`,`blob:`,`data:`],bo=[`'self'`,`blob:`,`data:`],xo=[`'self'`,`'unsafe-inline'`,`https:`,`http:`],So=[`'self'`,`blob:`,`data:`,`https:`,`http:`],Co=vo,[...yo],[...bo],[...xo],[...So],eo(ho)})),To=k((()=>{Je(),Ka(),wo()}));function Eo(){let e=globalThis.trustedTypes;return!e||typeof e.createPolicy!=`function`?null:e}function Do(){if(Ao!==void 0)return Ao;let e=Eo();if(!e)return Ao=null,Ao;if(typeof e.getPolicy==`function`){let t=e.getPolicy(ko);if(t)return Ao=t,Ao}try{Ao=e.createPolicy(ko,{createHTML:e=>e,createScriptURL:e=>e})}catch{Ao=typeof e.getPolicy==`function`?e.getPolicy(ko)??null:null}return Ao}function Oo(e){let t=Do();return!t||typeof t.createScriptURL!=`function`?e:t.createScriptURL(e)}var ko,Ao,jo=k((()=>{To(),ko=`shadowclaw`}));async function Mo(e,t){let n=e?.createWritable,r=Reflect.get(e,`createWriteable`),i=typeof n==`function`?n.bind(e):typeof r==`function`?r.bind(e):null;if(i){let e=await i();await e.write(Po(t)),await e.close()}else if(typeof e.createSyncAccessHandle==`function`){let n=await e.createSyncAccessHandle();try{let e=await Fo(t);n.truncate(0),n.write(e,{at:0}),typeof n.flush==`function`&&n.flush()}finally{n.close()}}else throw Error(`Writable file streams are not supported by this browser/storage backend.`)}async function No(e,t){if(typeof globalThis.Worker!=`function`)throw Error(`Writable file streams are not supported by this browser/storage backend.`);let n=await Fo(t);return new Promise((t,r)=>{let i=``,a=null;try{let e=[`self.onmessage = async (e) => {`,` try {`,` const { pathSegments, bytes } = e.data;`,` let dir = await navigator.storage.getDirectory();`,` for (let i = 0; i < pathSegments.length - 1; i++) {`,` dir = await dir.getDirectoryHandle(pathSegments[i], { create: true });`,` }`,` const filename = pathSegments[pathSegments.length - 1];`,` const fh = await dir.getFileHandle(filename, { create: true });`,` const h = await fh.createSyncAccessHandle();`,` try {`,` h.truncate(0);`,` h.write(bytes, { at: 0 });`,` if (typeof h.flush === 'function') h.flush();`,` } finally { h.close(); }`,` self.postMessage({ ok: true });`,` } catch (err) {`,` self.postMessage({ error: err.message || String(err) });`,` }`,`};`].join(`
20
+ `+u),je&&(u=Dt(u)),C&&Be?ie(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pt(e),Pe=!0,Fe=k,Ie=Se},t.clearConfig=function(){ut=null,Pe=!1,Fe=null,Ie=null,C=w,ne=``},t.isValidAttribute=function(e,t,n){ut||pt({});let r=P(e),i=P(t);return zt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&na(de,e)&&Ui(de[e],t)},t.removeHook=function(e,t){if(na(de,e)){if(t!==void 0){let n=Vi(de[e],t);return n===-1?void 0:Wi(de[e],n,1)[0]}return Hi(de[e])}},t.removeHooks=function(e){na(de,e)&&(de[e]=[])},t.removeAllHooks=function(){de=La()},t}var ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba=k((()=>{yi.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},yi.prototype.next=function(e){return this._invoke(`next`,e)},yi.prototype.throw=function(e){return this._invoke(`throw`,e)},yi.prototype.return=function(e){return this._invoke(`return`,e)},ki=Object.entries,Ai=Object.setPrototypeOf,ji=Object.isFrozen,Mi=Object.getPrototypeOf,Ni=Object.getOwnPropertyDescriptor,Pi=Object.freeze,Fi=Object.seal,Ii=Object.create,Li=typeof Reflect<`u`&&Reflect,Ri=Li.apply,zi=Li.construct,Pi||=function(e){return e},Fi||=function(e){return e},Ri||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},zi||=function(e){return new e(...[...arguments].slice(1))},Bi=bi(Array.prototype.forEach),Array.prototype.indexOf,Vi=bi(Array.prototype.lastIndexOf),Hi=bi(Array.prototype.pop),Ui=bi(Array.prototype.push),Array.prototype.slice,Wi=bi(Array.prototype.splice),Gi=Array.isArray,Ki=bi(String.prototype.toLowerCase),qi=bi(String.prototype.toString),Ji=bi(String.prototype.match),Yi=bi(String.prototype.replace),Xi=bi(String.prototype.indexOf),Zi=bi(String.prototype.trim),Qi=bi(Number.prototype.toString),$i=bi(Boolean.prototype.toString),ea=typeof BigInt>`u`?null:bi(BigInt.prototype.toString),ta=typeof Symbol>`u`?null:bi(Symbol.prototype.toString),na=bi(Object.prototype.hasOwnProperty),ra=bi(Object.prototype.toString),ia=bi(RegExp.prototype.test),aa=xi(TypeError),oa=Pi(/* @__PURE__ */ `a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),sa=Pi(/* @__PURE__ */ `svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ca=Pi([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),la=Pi([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ua=Pi(/* @__PURE__ */ `math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),da=Pi([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),fa=Pi([`#text`]),pa=Pi(/* @__PURE__ */ `accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),ma=Pi(/* @__PURE__ */ `accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),ha=Pi(/* @__PURE__ */ `accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ga=Pi([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),_a=Fi(/{{[\w\W]*|^[\w\W]*}}/g),va=Fi(/<%[\w\W]*|^[\w\W]*%>/g),ya=Fi(/\${[\w\W]*/g),ba=Fi(/^data-[\-\w.\u00B7-\uFFFF]+$/),xa=Fi(/^aria-[\-\w]+$/),Sa=Fi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ca=Fi(/^(?:\w+script|data):/i),wa=Fi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ta=Fi(/^html$/i),Ea=Fi(/^[a-z][.\w]*(-[.\w]+)+$/i),Da=Fi(/<[/\w!]/g),Oa=Fi(/<[/\w]/g),ka=Fi(/<\/no(script|embed|frames)/i),Aa=Fi(/\/>/i),ja={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ma=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Na=Pi(Si({},Ma)),Pa=function(){let e={};return Bi(Ma,t=>{e[t]=Fi(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Pi(e)}(),Fa=function(){return typeof window>`u`?null:window},Ia=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},La=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ra=function(e,t,n,r){return na(e,t)&&Gi(e[t])?Si(r.base?wi(r.base):{},e[t],r.transform):n},za=function(e,t,n){let r=na(e,t)?e[t]:void 0;return r&&typeof r==`object`?wi(r):n()},Oi()}));function Va(e){let t=e.trim();if(!t)return()=>!1;if(t.startsWith(`/`)&&(t.endsWith(`/`)||/\/[gimuy]*$/.test(t)))try{let e=t.lastIndexOf(`/`),n=t.slice(1,e),r=t.slice(e+1),i=new RegExp(n,r||`i`);return e=>i.test(e)}catch{}if(t.includes(`^`)||t.includes(`$`)||t.includes(`(`)&&t.includes(`)`))try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{}if(t.startsWith(`*.`)){let e=t.slice(2).toLowerCase();return t=>{let n=t.toLowerCase();return n===e||n.endsWith(`.`+e)}}let n=t.toLowerCase();return e=>{let t=e.toLowerCase();return t===n||t.endsWith(`.`+n)}}var Ha=k((()=>{}));function Ua(e){eee=e.map(e=>Va(e)).filter(Boolean)}var Wa,Ga,eee,Ka=k((()=>{Ba(),Dt(),Ft(),Wt(),Ha(),Wa=[`youtube.com`,`youtube-nocookie.com`,`youtu.be`,`xt-ml.github.io`,`kherrick.github.io`],Ga=[...Wa],Ua(Ga)}));function qa(e){co=e.map(e=>Va(e)).filter(Boolean)}function tee(e){return Array.isArray(e)?e.map(e=>typeof e==`string`?e.toLowerCase().trim():``).filter(Boolean):typeof e==`string`?e.split(/[\n,]+/).map(e=>e.toLowerCase().trim()).filter(Boolean):[]}function Ja(e){return Array.isArray(e)?e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean):typeof e==`string`?e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean):[]}function Ya(e){let t=tee(e);oo=new Set(t)}function Xa(e){let t=Ja(e);so=t,qa(t)}function Za(e){if(!e||typeof e!=`string`)return!1;let t=e.trim().toLowerCase();return!t.includes(`-`)||t===`shadow-claw`||t.startsWith(`shadow-claw-`)||t.startsWith(`sc-`)?!0:oo.has(t)}function Qa(e){if(!e||typeof e!=`string`)return!1;let t=e.trim();if(!t||/^(?:javascript|data|vbscript):/i.test(t))return!1;if(/^blob:/i.test(t)||t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`))return!0;try{let e=typeof globalThis<`u`&&globalThis.location?.origin&&globalThis.location.origin!==`null`?globalThis.location.origin:`http://localhost`,n=new URL(t,e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return!1;if(typeof globalThis<`u`&&globalThis.location?.origin&&globalThis.location.origin!==`null`&&n.origin===globalThis.location.origin)return!0;let r=n.hostname.toLowerCase();return co.some(e=>e(r))}catch{return!1}}function $a(e){if(!e||typeof e!=`object`)return;let t=e.allowedCustomElements||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedElements:void 0);t!==void 0&&Ya(t);let n=e.allowedCustomElementDomains||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedDomains:void 0);n!==void 0&&Xa(n)}function eo(e){lo=e}function to(){if(typeof document>`u`)return;let e=document.getElementById(`shadow-claw-site-config`);if(e&&e.textContent)try{let t=JSON.parse(e.textContent);$a(t),lo?.(t)}catch{}}function no(){to(),!(fo||typeof customElements>`u`||typeof customElements.define!=`function`)&&(uo=customElements.define.bind(customElements),customElements.define=function(e,t,n){if(!Za((e||``).toLowerCase().trim())){let t=`[Security] Registration blocked: <${e}> is not an approved custom element.`;throw console.error(t),Error(t)}return uo(e,t,n)},fo=!0)}function ro(e=typeof document<`u`?document.documentElement:null){if(typeof MutationObserver>`u`||!e)return null;if(typeof e.querySelectorAll==`function`)try{e.querySelectorAll(`*`).forEach(e=>{let t=e.tagName?e.tagName.toLowerCase():``;t.includes(`-`)&&!Za(t)&&(console.warn(`[Security] Removing existing unapproved custom element: <${t}>`),e.remove())})}catch{}let t=new MutationObserver(e=>{for(let t of e)t.addedNodes.forEach(e=>{if(e.nodeType===1){let t=e,n=t.tagName?t.tagName.toLowerCase():``;n.includes(`-`)&&!Za(n)&&(console.warn(`[Security] Removing unapproved custom element: <${n}>`),t.remove())}})});return t.observe(e,{childList:!0,subtree:!0}),t}var io,ao,oo,so,co,lo,uo,fo,po=k((()=>{Ha(),io=[],ao=[],oo=new Set(io.map(e=>e.toLowerCase().trim())),so=[...ao],co=[],qa(so),lo=null,uo=null,fo=!1}));function mo(e){Co=Array.isArray(e)?e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean).join(` `):typeof e==`string`&&e.trim()?e.trim():vo}function ho(e){if(!e||typeof e!=`object`)return;let t=e.allowedCustomElements||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedElements:void 0);t!==void 0&&Ya(t);let n=e.allowedCustomElementDomains||(typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.allowedDomains:void 0);n!==void 0&&Xa(n);let r=typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.scripts:void 0;r!==void 0&&go(r),e.security?.iframeSandbox===void 0?(e.security?.allowSameOrigin===!0||e.security?.allowIframeSameOrigin===!0)&&(Co.includes(`allow-same-origin`)||(Co=`${Co} allow-same-origin`.trim())):mo(e.security.iframeSandbox),e.security?.workerSrc!==void 0&&(nee=Ja(e.security.workerSrc)),e.security?.connectSrc!==void 0&&(ree=Ja(e.security.connectSrc)),e.security?.scriptSrc!==void 0&&(iee=Ja(e.security.scriptSrc)),e.security?.styleSrc!==void 0&&(aee=Ja(e.security.styleSrc)),e.security?.imgSrc!==void 0&&(oee=Ja(e.security.imgSrc))}function go(e){see=Array.isArray(e)?e.map(e=>{let t=typeof e==`string`?e:e?.src,n=typeof e==`object`&&e&&typeof e.id==`string`?e.id.trim():void 0,r=typeof e==`object`&&e&&typeof e.name==`string`?e.name.trim():void 0,i=typeof e==`object`&&e?!!(e.global||e.autoload):!1,a=typeof e==`object`&&e&&typeof e.type==`string`?e.type:void 0,o=typeof e==`object`&&e&&typeof e.async==`boolean`?e.async:void 0,s=typeof e==`object`&&e&&typeof e.defer==`boolean`?e.defer:void 0,c=typeof e==`object`&&e?!!e.hasInit:!1;return{src:t,...n?{id:n}:{},...r?{name:r}:{},...i?{global:!0,autoload:!0}:{},...a?{type:a}:{},...o?{async:o}:{},...s?{defer:s}:{},hasInit:c}}).filter(e=>typeof e.src==`string`&&Qa(e.src)):[]}async function _o(e){try{let{getDb:t}=await Promise.resolve().then(()=>(Ft(),Ot)),{getConfig:n}=await Promise.resolve().then(()=>(Wt(),Ut)),r=e??await t();if(!r)return;let[i,a]=await Promise.all([n(r,`allowed_custom_elements`),n(r,`allowed_custom_element_host_patterns`)]);if(typeof i==`string`&&i.trim())try{Ya(JSON.parse(i))}catch{Ya(i)}if(typeof a==`string`&&a.trim())try{Xa(JSON.parse(a))}catch{Xa(a)}}catch(e){console.warn(`Failed to load custom element security from db:`,e)}}var vo,yo,bo,xo,So,Co,nee,ree,iee,aee,oee,see,wo=k((()=>{po(),po(),Ka(),jo(),vo=`allow-modals allow-scripts allow-popups allow-popups-to-escape-sandbox`,yo=[`'self'`,`blob:`,`data:`],bo=[`'self'`,`blob:`,`data:`],xo=[`'self'`,`'unsafe-inline'`,`https:`,`http:`],So=[`'self'`,`blob:`,`data:`,`https:`,`http:`],Co=vo,[...yo],[...bo],[...xo],[...So],eo(ho)})),To=k((()=>{Je(),Ka(),wo()}));function Eo(){let e=globalThis.trustedTypes;return!e||typeof e.createPolicy!=`function`?null:e}function Do(){if(Ao!==void 0)return Ao;let e=Eo();if(!e)return Ao=null,Ao;if(typeof e.getPolicy==`function`){let t=e.getPolicy(ko);if(t)return Ao=t,Ao}try{Ao=e.createPolicy(ko,{createHTML:e=>e,createScriptURL:e=>e})}catch{Ao=typeof e.getPolicy==`function`?e.getPolicy(ko)??null:null}return Ao}function Oo(e){let t=Do();return!t||typeof t.createScriptURL!=`function`?e:t.createScriptURL(e)}var ko,Ao,jo=k((()=>{To(),ko=`shadowclaw`}));async function Mo(e,t){let n=e?.createWritable,r=Reflect.get(e,`createWriteable`),i=typeof n==`function`?n.bind(e):typeof r==`function`?r.bind(e):null;if(i){let e=await i();await e.write(Po(t)),await e.close()}else if(typeof e.createSyncAccessHandle==`function`){let n=await e.createSyncAccessHandle();try{let e=await Fo(t);n.truncate(0),n.write(e,{at:0}),typeof n.flush==`function`&&n.flush()}finally{n.close()}}else throw Error(`Writable file streams are not supported by this browser/storage backend.`)}async function No(e,t){if(typeof globalThis.Worker!=`function`)throw Error(`Writable file streams are not supported by this browser/storage backend.`);let n=await Fo(t);return new Promise((t,r)=>{let i=``,a=null;try{let e=[`self.onmessage = async (e) => {`,` try {`,` const { pathSegments, bytes } = e.data;`,` let dir = await navigator.storage.getDirectory();`,` for (let i = 0; i < pathSegments.length - 1; i++) {`,` dir = await dir.getDirectoryHandle(pathSegments[i], { create: true });`,` }`,` const filename = pathSegments[pathSegments.length - 1];`,` const fh = await dir.getFileHandle(filename, { create: true });`,` const h = await fh.createSyncAccessHandle();`,` try {`,` h.truncate(0);`,` h.write(bytes, { at: 0 });`,` if (typeof h.flush === 'function') h.flush();`,` } finally { h.close(); }`,` self.postMessage({ ok: true });`,` } catch (err) {`,` self.postMessage({ error: err.message || String(err) });`,` }`,`};`].join(`
21
21
  `);i=URL.createObjectURL(new Blob([e],{type:`text/javascript`})),a=new Worker(Oo(i))}catch{i&&URL.revokeObjectURL(i),r(/* @__PURE__ */ Error(`Writable file streams are not supported by this browser/storage backend.`));return}let o=()=>{a&&a.terminate(),URL.revokeObjectURL(i)};a.onmessage=e=>{o(),e.data?.error?r(Error(e.data.error)):t()},a.onerror=e=>{o(),r(Error(e.message||`Worker file write failed`))},a.postMessage({pathSegments:e,bytes:n},[n.buffer])})}function Po(e){if(typeof e==`string`||e instanceof Blob)return e;if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),new Blob([t])}return new Blob([e])}async function Fo(e){return e instanceof Uint8Array?e:typeof e==`string`?new TextEncoder().encode(e):e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof ArrayBuffer?new Uint8Array(e):/* @__PURE__ */ new Uint8Array}var Io=k((()=>{jo()}));async function Lo(e,t,n,r){let{dirs:i,filename:a}=ri(n);for(let n=0;n<2;n++)try{let n=await Tn(e,t);for(let e of i)n=await n.getDirectoryHandle(e,{create:!0});let o=await n.getFileHandle(a,{create:!0});try{await Mo(o,r);return}catch(t){if(!((t instanceof Error?t.message:String(t)).includes(`Writable file streams are not supported`)&&(await Sn(e)).type===`opfs`))throw t}let s=t.replace(/:/g,`-`);await No([hn(),`groups`,s,...i,a],r);return}catch(e){if(n===0&&xn(e)){bn();continue}throw e}}var Ro=k((()=>{En(),ii(),wn(),Io()}));function B(e,t,n){return Vt(e,`config`,`readwrite`,e=>e.put({key:t,value:n})).then(()=>void 0)}var zo=k((()=>{Ht()})),Bo,Vo=k((()=>{Bo=`---
22
22
  title: "Agent Memory"
23
23
  created: "1970-01-01T00:00:00Z"
@@ -277,7 +277,7 @@ actions:
277
277
  updateComponents — add or replace components on an existing surface
278
278
  updateDataModel — update a single path in the data model (re-renders bound components)
279
279
  deleteSurface — remove the surface from the chat`,input_schema:{type:`object`,properties:{action:{type:`string`,enum:[`createSurface`,`updateComponents`,`updateDataModel`,`deleteSurface`],description:`The A2UI operation to perform`},surfaceId:{type:`string`,description:`Unique identifier for this surface. Use a stable ID so you can update it later.`},components:{type:`array`,description:`Flat array of component objects (required for createSurface/updateComponents). Each object MUST have an 'id' field and a 'component' field. The component with id 'root' is the tree root (required for createSurface). Component field values: Text | Row | Column | Button | TextField | Image | Icon | Video | AudioPlayer | List | Card | Tabs | Modal | Divider | CheckBox | ChoicePicker | Slider | DateTimeInput. Put all properties at the TOP LEVEL alongside 'component' and 'id'. DO NOT nest properties under a 'properties' key. Children arrays contain other component ID strings, not nested objects.`,items:{type:`object`,additionalProperties:!0}},dataModel:{type:`object`,description:`Initial data model for the surface (used with createSurface). Components can reference values via { "path": "/key" }.`,properties:{},additionalProperties:!0},path:{type:`string`,description:`JSON Pointer path to update (required for updateDataModel). Examples: "/result", "/user/name", "/count". Use "/" to replace the entire data model.`},value:{type:`string`,description:`New value to set at the specified path (used with updateDataModel). Omit to delete the key at the given path.`},surfaceProperties:{type:`object`,description:`Optional display/branding properties for this surface (e.g. agentDisplayName).`,properties:{},additionalProperties:!0}},required:[`action`,`surfaceId`]}}})),Ol,Tee=k((()=>{Ol={name:`spawn_subagent`,description:`Spawn one or more independent agent loops to work on subtasks in parallel and collect their results. Each subagent has its own tool-use loop, inherits the current API key, and can optionally override provider/model. and runs concurrently with other subagents via Promise.all. Use spawn_subagent when a task has independent parallel workstreams — for example: researching multiple topics simultaneously, processing a list of items in parallel, or delegating isolated subtasks to specialized agents. Do NOT use spawn_subagent for sequential tasks where step 2 depends on step 1's output — just do those steps directly. Do NOT use spawn_subagent for simple single-step work that takes one tool call. Use the parallel_agents field to fan out multiple subagents in a single call.`,input_schema:{type:`object`,properties:{prompt:{type:`string`,description:`The task prompt for a single subagent. Required unless using parallel_agents for multi-agent fan-out.`},tools:{type:`array`,description:`Optional list of tool names to allow in the subagent. If omitted, the subagent inherits the current tool set (minus spawn_subagent to prevent recursion). If provided, only these tools are available to the subagent.`,items:{type:`string`}},profile:{type:`string`,enum:[`current`,`fast`,`smart`,`powerful`],description:`Optional model profile to run the subagent on. Use 'fast' for simple/cheap subtasks (e.g., text formatting, basic search), 'smart' for moderate reasoning, 'powerful' for deep thinking or complex coding, and 'current' to inherit the parent model. Defaults to 'current'.`},workspace_group_id:{type:`string`,description:`Optional workspace group id override for subagent file/tool scope. Use 'parent' to reuse the parent workspace in automatic mode. When omitted, subagents use an isolated workspace by default.`},system_prompt:{type:`string`,description:`Optional system prompt override for the subagent. Defaults to the current system prompt.`},parallel_agents:{type:`array`,description:`Optional list of subagent specifications to run in parallel. When provided, all agents are launched concurrently and their results are combined. Note: There is a configurable maximum limit on parallel subagents (default 5). Each entry can specify a prompt, optional tools list, optional profile, and optional system_prompt.`,items:{type:`object`,properties:{prompt:{type:`string`,description:`The task prompt for this subagent.`},tools:{type:`array`,description:`Optional tool names for this subagent.`,items:{type:`string`}},profile:{type:`string`,enum:[`current`,`fast`,`smart`,`powerful`],description:`Optional model profile for this subagent. Defaults to 'current'.`},workspace_group_id:{type:`string`,description:`Optional workspace group id for this subagent. Use 'parent' for parent workspace in automatic mode.`},system_prompt:{type:`string`,description:`Optional system prompt override for this subagent.`}},required:[`prompt`]}}},required:[`prompt`]}}})),kl,Eee=k((()=>{kl={name:`get_current_time`,description:`Get the current date and time. Returns an ISO 8601 string representing the current date and time. Use this tool whenever you need to know the current time, instead of relying on shell tools which may be unavailable.`,input_schema:{type:`object`,properties:{timezone:{type:`string`,description:`Optional timezone to format the time in (e.g. 'America/New_York'). If omitted, returns UTC.`}}}}})),Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul=k((()=>{Al={name:`attach_file_to_chat`,description:`Prepare a workspace file for chat delivery by generating an exact markdown attachment snippet. Validates the file path and returns markdown that works for inline image rendering in ShadowClaw and attachment upload in external channels like Telegram/iMessage.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},alt:{type:`string`,description:`Optional alt/caption text to use in the generated markdown`}},required:[`path`]}},jl={name:`copy_file`,description:`Copy a file or directory in the group workspace to a new destination path. Supports copying single files or nested directories. Optionally supports copying between different conversation workspaces via source_group_id or target_group_id.`,input_schema:{type:`object`,properties:{source_path:{type:`string`,description:`Source file or directory path relative to workspace root`},target_path:{type:`string`,description:`Destination file or directory path relative to workspace root`},source_group_id:{type:`string`,description:`Optional source conversation group ID (defaults to current workspace)`},target_group_id:{type:`string`,description:`Optional target conversation group ID (defaults to current workspace)`}},required:[`source_path`,`target_path`]}},Ml={name:`create_directory`,description:`Create a new directory (and any missing parent directories) in the group workspace.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Directory path relative to the group workspace root`}},required:[`path`]}},Nl={name:`delete_file`,description:`Delete a file or directory from the group workspace. If the target path is a directory, it will be recursively deleted.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File or directory path relative to the group workspace root`}},required:[`path`]}},Pl={name:`diff_files`,description:`Compare two files in the workspace and output the differences. Useful for comparing generated code, checking before patching, or finding changes outside of git repositories.`,input_schema:{type:`object`,properties:{path_a:{type:`string`,description:`Path to the first file relative to the group workspace root.`},path_b:{type:`string`,description:`Path to the second file relative to the group workspace root.`}},required:[`path_a`,`path_b`]}},Fl={name:`list_files`,description:`List files and directories in the group workspace. Directory names end with /. Returns sorted entries.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Directory path relative to workspace root (default: root)`}}}},Il={name:`move_file`,description:`Move or rename a file or directory in the group workspace to a target path. Supports moving single files or nested directories. Optionally supports moving between different conversation workspaces via source_group_id or target_group_id.`,input_schema:{type:`object`,properties:{source_path:{type:`string`,description:`Source file or directory path relative to workspace root`},target_path:{type:`string`,description:`Destination file or directory path relative to workspace root`},source_group_id:{type:`string`,description:`Optional source conversation group ID (defaults to current workspace)`},target_group_id:{type:`string`,description:`Optional target conversation group ID (defaults to current workspace)`}},required:[`source_path`,`target_path`]}},Ll={name:`open_file`,description:`Open a file from the group workspace in the UI file viewer dialog. Use this only when the user explicitly asks to inspect a file visually with preview support. Do not use this tool to send or attach files in chat responses.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`}},required:[`path`]}},Rl={name:`patch_file`,description:`Make a targeted text replacement in a file. Finds the single occurrence of old_string and replaces it with new_string. Fails if old_string is not found or matches more than once. Use this instead of write_file when you only need to change part of a file — it is safer and works well with large files. Include enough surrounding context in old_string to make the match unique. IMPORTANT: You must provide 'path', 'old_string', and 'new_string' parameters.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},old_string:{type:`string`,description:`The exact text to find in the file. Must match exactly once. Include 2-3 lines of surrounding context to ensure a unique match.`},new_string:{type:`string`,description:`The replacement text. Can be empty to delete old_string.`}},required:[`path`,`old_string`,`new_string`]}},zl={name:`read_file`,description:`Read the contents of one or more files from the group workspace. IMPORTANT: You must specify either the 'path' parameter (for a single file) or the 'paths' parameter (an array of file paths for multiple files). When paths is provided, returns all file contents concatenated with --- filename --- headers. Prefer paths to batch reads in a single call. Image files (png, jpg, gif, webp, etc.) are returned as native image content that the model can see directly. Other binary files will be detected and an error returned suggesting alternative tools.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Single file path relative to the group workspace root`},paths:{type:`array`,items:{type:`string`},description:`Array of file paths relative to the group workspace root. Use this to read multiple files in a single tool call.`}}}},Bl={name:`search_files`,description:`Search for a pattern (regex or exact text) in files across the workspace. Useful for finding code references, function definitions, or specific content without needing to rely on a shell environment.`,input_schema:{type:`object`,properties:{pattern:{type:`string`,description:`The text or regular expression to search for.`},path:{type:`string`,description:`Optional directory path to restrict the search to (e.g. 'src/'). Defaults to workspace root.`},file_glob:{type:`string`,description:`Optional simple glob to filter files (e.g. '*.ts'). Supports * as wildcard.`},is_regex:{type:`boolean`,description:`Set to true to parse the pattern as a regular expression.`}},required:[`pattern`]}},Vl={name:`send_file`,description:`Send a workspace file directly to connected peer(s) over the P2P (PeerJS/WebRTC) data channel. Use this when the user is in a peer conversation or room, or specify peer_id to send to a remote peer directly. The file is read from the current workspace and transferred over WebRTC in binary chunks so there is no size limit.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},peer_id:{type:`string`,description:`Optional target PeerJS peer ID (or peer: groupId). If omitted, sends to the current peer/room conversation.`}},required:[`path`]}},Hl={name:`write_file`,description:`Write content to a file in the group workspace. Creates the file and any intermediate directories if they don't exist. Overwrites the file if it already exists. IMPORTANT: You must provide both the 'path' and 'content' parameters when calling this tool.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},content:{type:`string`,description:`Content to write to the file`}},required:[`path`,`content`]}}})),Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du,fu,pu,mu=k((()=>{Wl={name:`git_add`,description:`Stage files in a cloned repo. Accepts an array of filepaths. If omitted or empty, stages the repo root.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},filepaths:{type:`array`,items:{type:`string`},description:`Array of file paths to stage (relative to repo root). Pass a single item for one file.`}},required:[`repo`]}},Gl={name:`git_branch`,description:`Create a new branch in a cloned repo. Optionally switch to it immediately (like git checkout -b).`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (returned by git_clone)`},name:{type:`string`,description:`Name for the new branch`},checkout:{type:`boolean`,description:`Switch to the new branch after creating it (default: false)`},start_point:{type:`string`,description:`Branch, tag, or commit SHA to branch from (default: HEAD)`}},required:[`repo`,`name`]}},Kl={name:`git_branches`,description:`List branches in a cloned repo. Current branch is marked with *.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},remote:{type:`boolean`,description:`List remote-tracking branches instead (default: false)`}},required:[`repo`]}},ql={name:`git_checkout`,description:`Checkout a branch, tag, or commit SHA in a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (returned by git_clone)`},ref:{type:`string`,description:`Branch name, tag, or commit SHA to checkout`}},required:[`repo`,`ref`]}},Jl={name:`git_clone`,description:`Clone a git repository into browser-persistent OPFS storage. Files are stored directly under repos/<repo-name>/ in the workspace and are immediately accessible to other git_* tools without any extra sync step. Works with public and private repos (GitHub, GitLab, GitHub Enterprise, etc.). If a Git PAT is configured in Settings, it is used automatically for authentication. Uses a CORS proxy. Returns the short repo name used for subsequent git_* operations.`,input_schema:{type:`object`,properties:{url:{type:`string`,description:`Full HTTPS repo URL (e.g. https://github.com/user/repo)`},name:{type:`string`,description:`Optional short repo name to use for the clone directory; defaults to the repository name parsed from the URL.`},branch:{type:`string`,description:`Branch to clone (default: default branch)`},depth:{type:`number`,description:`Shallow clone depth (default: 20)`}},required:[`url`]}},Yl={name:`git_commit`,description:`Stage all changes and create a commit in a cloned repo. Uses configured git author name/email or defaults.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},message:{type:`string`,description:`Commit message`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`,`message`]}},Xl={name:`git_config`,description:`Get or set a git config value for a repo (e.g. user.name, user.email). Persistent per-repo identity avoids specifying author on every commit.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},command:{type:`string`,enum:[`get`,`set`],description:`Operation: get or set a config value`},key:{type:`string`,description:`Config key path (e.g. user.name, user.email, core.autocrlf)`},value:{type:`string`,description:`Value to set — required when command is set`}},required:[`repo`,`command`,`key`]}},Zl={name:`git_delete_branch`,description:`Delete a local branch from a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},name:{type:`string`,description:`Name of the branch to delete`}},required:[`repo`,`name`]}},Ql={name:`git_delete_repo`,description:"Delete the git metadata for a cloned repository while leaving the working tree files in place. Use this to clean up corrupted or stale repos that fail to re-clone. The repo directory remains under repos/<repo>, but the `.git/` metadata is removed.",input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (as returned by git_clone or git_list_repos)`}},required:[`repo`]}},$l={name:`git_diff`,description:`Show changed files between HEAD and working tree, or between two refs.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref1:{type:`string`,description:`First ref (default: HEAD)`},ref2:{type:`string`,description:`Second ref (if omitted, diffs HEAD vs workdir)`}},required:[`repo`]}},eu={name:`git_fetch`,description:`Fetch commits from the remote without merging. Safe for inspecting remote state before deciding to merge or rebase.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Remote branch to fetch (default: default branch)`},remote:{type:`string`,description:`Remote name (default: origin)`}},required:[`repo`]}},tu={name:`git_init`,description:`Initialize a new empty git repository in browser storage. Use this to create a new project from scratch before using git_push to push to a remote.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short name for the new repo (used for all subsequent git_ operations)`}},required:[`repo`]}},nu={name:`git_list_repos`,description:`List all git repositories currently cloned in browser storage.`,input_schema:{type:`object`,properties:{}}},ru={name:`git_log`,description:`Show the commit log for a cloned repo. Returns commit SHA, date, author, and message.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Ref to log from (default: HEAD)`},depth:{type:`number`,description:`Number of commits to show (default: 10)`}},required:[`repo`]}},iu={name:`git_merge`,description:`Merge a branch or ref into the current branch. Supports fast-forward and three-way merges. If the merge has conflicts, a detailed report is returned with the conflicted files and their conflict regions inline. To resolve: use read_file on each conflicted file, then write_file with the complete resolved content (no conflict markers). After all files are resolved, use git_add for each, then git_commit. Do NOT use bash/sed for conflict resolution.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},theirs:{type:`string`,description:`Branch name, tag, or commit SHA to merge into the current branch`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`,`theirs`]}},au={name:`git_pull`,description:`Fetch and merge commits from the remote repository. Uses configured git author name/email for merge commits if needed.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Branch to pull (default: current branch)`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`]}},ou={name:`git_push`,description:`Push commits to the remote repository. Requires a GitHub personal access token (PAT) to be configured. The token is loaded from the encrypted credential store.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Local branch to push (default: current branch)`},remote_ref:{type:`string`,description:`Remote branch name to push to, if different from local branch. Example: push local 'feature-rebased' to remote 'feature/original'.`},force:{type:`boolean`,description:`Force push (default: false)`},tags:{type:`boolean`,description:`Also push all local tags to the remote (default: false)`}},required:[`repo`]}},su={name:`git_read_file_at_ref`,description:`Read a file's contents at a specific ref (branch, tag, or commit SHA) without checking it out. Useful for code review across branches.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Branch name, tag, or commit SHA`},filepath:{type:`string`,description:`File path relative to the repo root`}},required:[`repo`,`ref`,`filepath`]}},cu={name:`git_remote`,description:`Manage git remotes: list, add, or remove a remote in a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},command:{type:`string`,enum:[`list`,`add`,`remove`],description:`Operation to perform`},remote:{type:`string`,description:`Remote name (e.g. origin, upstream) — required for add/remove`},url:{type:`string`,description:`Remote URL — required for add`}},required:[`repo`,`command`]}},lu={name:`git_reset`,description:`Reset the current branch HEAD to a specific ref or commit SHA. Updates the branch pointer and checks out the target, discarding local changes. Equivalent to 'git reset --hard <ref>'.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Branch name, tag, or commit SHA to reset to`}},required:[`repo`,`ref`]}},uu={name:`git_show`,description:`Show the metadata and diff of a specific commit. Returns author, date, message, and a unified diff against the parent commit.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Commit SHA, branch, or tag to inspect (default: HEAD)`}},required:[`repo`,`ref`]}},du={name:`git_status`,description:`Show the working tree status of a cloned repo. Reports modified, added, deleted, and unstaged files.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`}},required:[`repo`]}},fu={name:`git_tag`,description:`Create a lightweight or annotated tag at HEAD. Use git_push with tags=true to push tags to the remote.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},tag:{type:`string`,description:`Tag name (e.g. v1.2.3)`},message:{type:`string`,description:`Annotation message — if provided, creates an annotated tag; otherwise lightweight`},author_name:{type:`string`,description:`Tagger name (optional, uses configured default)`},author_email:{type:`string`,description:`Tagger email (optional, uses configured default)`}},required:[`repo`,`tag`]}},pu={name:`git_unstage`,description:`Remove one or more staged files from the index without touching the working tree. The inverse of git_add — use to undo accidental staging.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},filepath:{type:`string`,description:`File path or array of file paths to unstage (relative to repo root)`}},required:[`repo`,`filepath`]}}})),hu,gu,_u,vu,yu,bu,xu,Su=k((()=>{hu={name:`create_task`,description:`Create a scheduled recurring task. The task will run automatically on the specified schedule and send the result back to this group. Uses cron expressions (minute hour day-of-month month day-of-week).`,input_schema:{type:`object`,properties:{schedule:{type:`string`,description:`Cron expression, e.g. "0 9 * * 1-5" for 9am weekdays`},prompt:{type:`string`,description:`The prompt/instruction to execute on each run (used if type is 'prompt')`},type:{type:`string`,enum:[`prompt`,`tools`],description:`The type of task to create. Defaults to 'prompt'.`},tools:{type:`array`,description:`A list of tools to execute sequentially (used if type is 'tools')`,items:{type:`object`,properties:{name:{type:`string`},input:{type:`object`}},required:[`name`,`input`]}},name:{type:`string`,description:`The optional title/name for the task, helping to identify its purpose.`}},required:[`prompt`,`type`]}},gu={name:`list_tasks`,description:`List all scheduled recurring tasks for this group. Returns a list of tasks with their IDs, schedules, and prompts.`,input_schema:{type:`object`,properties:{}}},_u={name:`update_task`,description:`Update an existing scheduled task's schedule or prompt.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to update`},schedule:{type:`string`,description:`Standard cron expression (e.g. '0 9 * * *'). Leave empty for an unscheduled task.`},prompt:{type:`string`,description:`New prompt/instruction (optional)`},type:{type:`string`,enum:[`prompt`,`tools`],description:`New task type (optional)`},tools:{type:`array`,description:`New list of tools (optional)`,items:{type:`object`,properties:{name:{type:`string`},input:{type:`object`}},required:[`name`,`input`]}},enabled:{type:`boolean`,description:`Whether the task is enabled (optional)`},name:{type:`string`,description:`New name/title for the task (optional).`}},required:[`id`]}},vu={name:`delete_task`,description:`Delete a scheduled task by its ID.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to delete`}},required:[`id`]}},yu={name:`enable_task`,description:`Enable a scheduled task so it runs on its schedule.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to enable`}},required:[`id`]}},bu={name:`disable_task`,description:`Disable a scheduled task so it stops running.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to disable`}},required:[`id`]}},xu={name:`run_task`,description:`Immediately trigger a scheduled task by its ID, outside of its normal cron schedule. Use this to manually fire a task on demand. Use list_tasks to find the task ID first.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to run immediately`}},required:[`id`]}}})),Cu,wu,Tu,Eu,Dee=k((()=>{Cu={name:`create_room`,description:`Create a new multi-party room (a shared PeerJS conversation) hosted by this device. Other agents or humans can then be invited to participate. Returns the room so you can share or invite peers into it.`,input_schema:{type:`object`,properties:{name:{type:`string`,description:`A human-readable name for the room.`}},required:[`name`]}},wu={name:`invite_to_room`,description:`Invite a peer (another agent or human, identified by their PeerJS peer ID) into a room so they can join the shared conversation. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{peer_id:{type:`string`,description:`The PeerJS peer ID of the participant to invite.`},room_id:{type:`string`,description:`The room id to invite into. Defaults to the current room conversation.`}},required:[`peer_id`]}},Tu={name:`leave_room`,description:`Leave a room. If you are the host, the room is disbanded for all members. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{room_id:{type:`string`,description:`The room id to leave. Defaults to the current room conversation.`}}}},Eu={name:`list_room_members`,description:`List the participants (humans and agents) currently in a room. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{room_id:{type:`string`,description:`The room id to inspect. Defaults to the current room conversation.`}}}}})),Du,Ou,ku,Au,ju,Mu,Oee=k((()=>{Du={name:`summarize_text`,description:`Summarize text using Web Platform's Summarizer API (or polyfill fallback). Produces key points, TLDR, teaser, or headline.`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text content to summarize.`},type:{type:`string`,enum:[`key-points`,`tldr`,`teaser`,`headline`],description:`The summary type (default: key-points).`},format:{type:`string`,enum:[`plain-text`,`markdown`],description:`Output format (default: markdown).`},length:{type:`string`,enum:[`short`,`medium`,`long`],description:`Summary length (default: short).`},preference:{type:`string`,enum:[`capability`,`speed`,`auto`],description:`Summarizer performance preference (default: auto).`},context:{type:`string`,description:`Optional background context for summarization.`},outputLanguage:{type:`string`,description:`Optional target language code (e.g. 'en', 'es').`},sharedContext:{type:`string`,description:`Optional shared context passed to the underlying model.`},overridePrompt:{type:`string`,description:`Optional custom system prompt overriding default summarization instructions.`}},required:[`text`]}},Ou={name:`write_text`,description:`Generate or draft text using Web Platform's Writer API (or polyfill fallback).`,input_schema:{type:`object`,properties:{prompt:{type:`string`,description:`The prompt or writing instructions.`},tone:{type:`string`,enum:[`formal`,`neutral`,`casual`],description:`Tone for drafting (default: neutral).`},format:{type:`string`,enum:[`plain-text`,`markdown`],description:`Output format (default: plain-text).`},length:{type:`string`,enum:[`short`,`medium`,`long`],description:`Target length (default: short).`},context:{type:`string`,description:`Optional background context for writing.`},outputLanguage:{type:`string`,description:`Optional target language code (e.g. 'en', 'es').`},sharedContext:{type:`string`,description:`Optional shared context passed to the underlying model.`}},required:[`prompt`]}},ku={name:`rewrite_text`,description:`Rewrite or rephrase text using Web Platform's Rewriter API (or polyfill fallback). Can adjust tone or length.`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to rewrite.`},tone:{type:`string`,enum:[`as-is`,`more-formal`,`more-casual`],description:`Tone adjustment (default: as-is).`},format:{type:`string`,enum:[`as-is`,`plain-text`,`markdown`],description:`Format adjustment (default: as-is).`},length:{type:`string`,enum:[`as-is`,`shorter`,`longer`],description:`Length adjustment (default: as-is).`},context:{type:`string`,description:`Optional background context for rewriting.`},outputLanguage:{type:`string`,description:`Optional target language code (e.g. 'en', 'es').`},sharedContext:{type:`string`,description:`Optional shared context passed to the underlying model.`}},required:[`text`]}},Au={name:`proofread_text`,description:`Proofread and correct grammar, spelling, and phrasing errors using Web Platform's Proofreader API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to proofread.`},context:{type:`string`,description:`Optional background context for proofreading.`}},required:[`text`]}},ju={name:`detect_language`,description:`Detect the language of input text using Web Platform's Language Detector API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to analyze for language detection.`}},required:[`text`]}},Mu={name:`translate_text`,description:`Translate text using Web Platform's Translator API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to translate.`},sourceLanguage:{type:`string`,description:`Source language BCP 47 code (e.g. 'en', 'es', 'ja').`},targetLanguage:{type:`string`,description:`Target language BCP 47 code (e.g. 'en', 'es', 'ja').`}},required:[`text`,`sourceLanguage`,`targetLanguage`]}}})),Nu,Pu,kee=k((()=>{Nu={name:`prompt_peer`,description:`Send a prompt or message directly to another connected ShadowClaw peer or agent over WebRTC, triggering their orchestration loop and returning their answer. Use this to ask another agent to perform a task, answer a question, or analyze data.`,input_schema:{type:`object`,properties:{peer_id:{type:`string`,description:`The PeerJS peer ID or client ID of the target agent to prompt.`},prompt:{type:`string`,description:`The prompt, question, or instruction for the peer agent.`},timeout_seconds:{type:`number`,description:`Optional timeout in seconds to wait for the peer agent's response (default: 120).`}},required:[`peer_id`,`prompt`]}},Pu={name:`list_peers`,description:`List the currently connected peers or clients available over WebRTC and the control plane. Returns peer IDs and device labels so you know which peers you can prompt or collaborate with.`,input_schema:{type:`object`,properties:{}}}})),Fu,Iu=k((()=>{$c(),nl(),ol(),ul(),fl(),hl(),vl(),Cee(),Sl(),wee(),Tee(),Eee(),Ul(),mu(),Su(),Dee(),Oee(),kee(),Fu=[tl,Al,Qc,el,jl,Ml,Cu,hu,Nl,vu,ju,Pl,bu,il,al,yu,cl,sl,kl,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du,fu,pu,wu,dl,Tu,El,Fl,Pu,Eu,gu,_l,rl,gl,Il,Ll,Rl,Nu,Au,zl,ml,pl,Dl,ku,xu,Bl,Vl,xl,bl,Ol,Du,Mu,yl,_u,ll,Hl,Ou]})),Lu=k((()=>{Iu()})),Ru,zu=k((()=>{Ru={id:`__builtin_default`,name:`Default`,providerId:`prompt_api`,enabledToolNames:[`javascript`,`list_files`,`open_file`,`read_file`,`write_file`],customTools:[],systemPromptOverride:"You are a helpful coding assistant.\nContent intended to be rendered as a `Page` (HTML or Markdown) SHOULD include frontmatter (title, created, updated, and slug).\nHTML content intended to be rendered as a `Page` SHOULD USE `<article><h2>${subTitle}</h2>...</article>` for its main body content."}}));function Bu(e,t){if(!t||typeof t!=`object`)throw Error(`Tool at ${e} must be a JSON object`);let n=t,r=typeof n.name==`string`?n.name.trim():``,i=typeof n.description==`string`?n.description.trim():``,a=n.input_schema??n.parameters,o=n.execution??n.evaluation;if(!Uu.test(r))throw Error(`Tool name is invalid: ${r||`(missing)`}`);if(!i)throw Error(`Tool ${r} requires a description`);if(!a||typeof a!=`object`)throw Error(`Tool ${r} requires input_schema`);if(!o||typeof o!=`object`)throw Error(`Tool ${r} requires execution`);let s=o,c=s.type;if(c!==`bash`&&c!==`javascript`&&c!==`tool`)throw Error(`Tool ${r} execution type must be bash, javascript, or tool`);if(c===`tool`){if(typeof s.name!=`string`||!Uu.test(s.name))throw Error(`Tool ${r} execution requires a valid tool name`);return{name:r,description:i,input_schema:a,execution:{type:c,name:s.name,...s.input&&typeof s.input==`object`?{input:s.input}:{}},path:e}}let l=c===`bash`?`command`:`code`,u=s[l]??s.expression;if(typeof u!=`string`||u.trim()===``)throw Error(`Tool ${r} execution requires ${l}`);return{name:r,description:i,input_schema:a,execution:{type:c,[l]:u},path:e}}async function Vu(e,t=ut){let n=[],r=[],i=t===`br:main`?[ut]:[t,ut];for(let t of i)try{let i=await Tn(e,t),a=[];async function o(e,t){for await(let[n,r]of e.entries()){let e=`${t}/${n}`;r.kind===`directory`?await o(r,e):n.endsWith(`.json`)&&e.startsWith(`.agents/tools/`)&&a.push(e)}}try{await o(await(await i.getDirectoryHandle(`.agents`)).getDirectoryHandle(`tools`),`.agents/tools`)}catch{continue}for(let i of a.sort())try{let r=Bu(i,JSON.parse(await Ho(e,t,i)));n.some(e=>e.name===r.name)||n.push(r)}catch(e){r.push(e instanceof Error?e.message:String(e))}}catch{}return{tools:n,diagnostics:r}}async function Hu(e,t=ut,n){try{let{tools:r}=await Vu(e,t),i=r.find(e=>e.name===n)||null;if(!i)return null;let a=await R(e,L.DECLARATIVE_TOOLS_ENABLED);return Array.isArray(a)&&!a.includes(n)?null:i}catch{return null}}var Uu,Wu=k((()=>{Dt(),Wt(),En(),Uo(),Uu=/^[a-z][a-z0-9_]{0,63}$/}));async function Gu(e){if(typeof e==`string`)return new TextEncoder().encode(e).buffer;if(typeof Blob<`u`&&e instanceof Blob)return e.arrayBuffer();if(e instanceof ArrayBuffer)return e.slice(0);if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:n,byteLength:r}=e;return t.slice(n,n+r)}return/* @__PURE__ */ new ArrayBuffer(0)}function Ku(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function qu(e){let t=await Gu(e),r=globalThis.crypto?.subtle??globalThis.window?.crypto?.subtle??(n===void 0?void 0:(await import(`node:crypto`)).webcrypto?.subtle);if(!r)throw Error(`crypto.subtle is not available in current environment`);return Ku(await r.digest(`SHA-256`,t))}var Ju=k((()=>{}));function Yu(e){let t=e.trim();if(!t)throw Error(`URL cannot be empty`);let n=t;if(!n.startsWith(`http://`)&&!n.startsWith(`https://`)&&(n=`https://${n}`),n=n.replace(/\/+$/,``),n.endsWith(ed)){let e=n.slice(0,-35).replace(/\/+$/,``);return{baseUrl:e,siteUrl:e,manifestUrl:n}}return{baseUrl:n,siteUrl:n,manifestUrl:`${n}/${ed}`}}function Xu(e,t){if(!e)return``;try{return new URL(e,t).href}catch{return e}}function Zu(e,t){let n=JSON.parse(JSON.stringify(e));return Array.isArray(n.tools)&&(n.tools=n.tools.map(e=>({...e,url:Xu(e.url,t)}))),Array.isArray(n.scripts)&&(n.scripts=n.scripts.map(e=>({...e,url:Xu(e.url,t)}))),Array.isArray(n.skills)&&(n.skills=n.skills.map(e=>({...e,url:Xu(e.url,t),tools:Array.isArray(e.tools)?e.tools.map(e=>({...e,url:e.url?Xu(e.url,t):void 0})):void 0,scripts:Array.isArray(e.scripts)?e.scripts.map(e=>({...e,url:e.url?Xu(e.url,t):void 0})):void 0}))),n}async function Qu(e,t){if(!t||!t.startsWith(`sha256:`))return!0;let n=t.slice(7).trim().toLowerCase();return!n||(await qu(typeof e==`string`?new TextEncoder().encode(e):e)).toLowerCase()===n}async function $u(e,t=globalThis.fetch){let{baseUrl:n,manifestUrl:r}=Yu(e),i=await t(r,{headers:{Accept:`application/json`}});if(!i.ok)throw Error(`Failed to fetch discovery manifest: HTTP ${i.status} ${i.statusText}`.trim());let a=await i.json();if(!a||typeof a!=`object`)throw Error(`Invalid discovery manifest: expected a JSON object`);return{manifest:Zu(a,r),siteUrl:n,manifestUrl:r}}var ed,td=k((()=>{Ju(),ed=`.well-known/agent-skills/index.json`}));function nd(e){try{let t=a(e);return{data:t.data&&typeof t.data==`object`?t.data:{},content:t.content||``}}catch{let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);if(t){let e=t[1],n=t[2]||``,r=e.split(/\r?\n/).map(e=>{let t=e.match(/^([a-zA-Z0-9_-]+):\s*(.+)$/);if(t){let[,e,n]=t,r=n.trim();if(r&&r!==`true`&&r!==`false`&&r!==`null`&&!r.startsWith(`"`)&&!r.startsWith(`'`)&&!r.startsWith(`[`)&&!r.startsWith(`{`)&&r!==`>`&&r!==`|`&&r!==`>-`&&r!==`|-`&&!/^-?\d+(?:\.\d+)?$/.test(r))return`${e}: ${JSON.stringify(r)}`}return e});try{let e=`---\n${r.join(`
280
- `)}\n---\n${n}`,t=a(e);return{data:t.data&&typeof t.data==`object`?t.data:{},content:t.content||``}}catch{}let i={},o=e.match(/^name:\s*["']?([^"'\r\n]+)["']?/m);o&&(i.name=o[1].trim());let s=e.match(/^description:\s*(.+)$/m);if(s){let e=s[1].trim();(e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`))&&(e=e.slice(1,-1)),i.description=e}let c=e.match(/^user-invocable:\s*(true|false)/im);c&&(i[`user-invocable`]=c[1].toLowerCase()===`true`);let l=e.match(/^disable-model-invocation:\s*(true|false)/im);l&&(i[`disable-model-invocation`]=l[1].toLowerCase()===`true`);let u=e.match(/^allowed-tools:\s*["']?([^"'\r\n]+)["']?/m);u&&(i[`allowed-tools`]=u[1].trim());let d=e.match(/allowed-tools:\s*\n((?:\s*-\s*[^\r\n]+\r?\n?)+)/m);if(d){let e=d[1].split(/\r?\n/).map(e=>e.replace(/^\s*-\s*/,``).trim()).filter(Boolean);e.length>0&&(i[`allowed-tools`]=e)}return{data:i,content:n}}return{data:{},content:e}}}function rd(e){if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t.join(` `):void 0}}function id(e,t){let n=nd(t),r=n.data,i=typeof r.name==`string`?r.name.trim():``,a=typeof r.description==`string`?r.description.trim():``;if(!i)throw Error(`Skill at ${e} requires a name`);if(!a)throw Error(`Skill ${i} requires a description`);if(i.length>64||!ad.test(i))throw Error(`Skill name must be 1-64 lowercase characters and hyphens: ${i}`);if(a.length>1024)throw Error(`Skill ${i} description must be 1024 characters or fewer`);let o=e.replace(/\/SKILL\.md$/u,``),s=r.metadata&&typeof r.metadata==`object`?r.metadata:void 0,c=rd(s?.[`allowed-tools`])||rd(s?.allowedTools)||rd(r[`allowed-tools`])||rd(r.allowedTools),l=[];if(s){for(let[e,t]of Object.entries(s))if(e!==`execution`&&t!=null){if(e===`allowed-tools`||e===`allowedTools`)c&&l.push([e,c]);else if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)l.push([e,String(t)]);else if(Array.isArray(t)){let n=t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean);n.length>0&&l.push([e,n.join(` `)])}}}let u=l.length>0?Object.fromEntries(l):void 0,d=s?.execution,f;if(d!==void 0){if(!d||typeof d!=`object`||d.type!==`tools`||!Array.isArray(d.tools))throw Error(`Skill ${i} has invalid tools execution`);let e=d,t=typeof e.suppressToast==`boolean`?e.suppressToast:void 0,n=typeof e.suppressOutput==`boolean`?e.suppressOutput:void 0,r=e.tools.map(e=>({...e,...t!==void 0&&e.suppressToast===void 0?{suppressToast:t}:{},...n!==void 0&&e.suppressOutput===void 0?{suppressOutput:n}:{}}));f={type:`tools`,...t===void 0?{}:{suppressToast:t},...n===void 0?{}:{suppressOutput:n},tools:r}}return{name:i,description:a,...typeof r.license==`string`?{license:r.license}:{},...typeof r.compatibility==`string`?{compatibility:r.compatibility}:{},...u?{metadata:u}:{},...typeof c==`string`?{allowedTools:c}:{},...typeof r[`user-invocable`]==`boolean`?{userInvocable:r[`user-invocable`]}:typeof r[`user-invocable`]==`string`&&(r[`user-invocable`].toLowerCase()===`true`||r[`user-invocable`].toLowerCase()===`false`)?{userInvocable:r[`user-invocable`].toLowerCase()===`true`}:{},...typeof r[`disable-model-invocation`]==`boolean`?{disableModelInvocation:r[`disable-model-invocation`]}:typeof r[`disable-model-invocation`]==`string`&&(r[`disable-model-invocation`].toLowerCase()===`true`||r[`disable-model-invocation`].toLowerCase()===`false`)?{disableModelInvocation:r[`disable-model-invocation`].toLowerCase()===`true`}:{},...f?{execution:f}:{},body:n.content.trim(),path:e,basePath:o}}var ad,od=k((()=>{ad=/^[a-z0-9](?:[a-z0-9]|-(?!-))*[a-z0-9]$|^[a-z0-9]$/}));function sd(e){return e?.targetSubdir?e.targetSubdir:e?.siteSlug?`imported/${e.siteSlug}`:`main`}async function cd(e,t=ut,n,r){let i=(n.name||``).trim();if(fd.has(i))return{name:i,path:``,status:`failed`,error:`Cannot shadow built-in tool: ${i}`};if(!pd.test(i))return{name:i,path:``,status:`failed`,error:`Invalid tool name: ${i}`};let a=`.agents/tools/${sd(r)}/${i}.json`;try{if(await Wo(e,t,a)&&!r?.overwrite)return{name:i,path:a,status:`skipped`};let o=await(r?.fetchFn||globalThis.fetch)(n.url);if(!o.ok)return{name:i,path:a,status:`failed`,error:`HTTP ${o.status} ${o.statusText}`};let s=await o.text();if(n.digest&&!await Qu(s,n.digest))return{name:i,path:a,status:`failed`,error:`Integrity verification failed for tool definition`};let c;try{c=JSON.parse(s)}catch{return{name:i,path:a,status:`failed`,error:`Downloaded tool definition is not valid JSON`}}if(Bu(a,c),await Lo(e,t,a,JSON.stringify(c,null,2)),r?.autoEnable){let t=await R(e,L.DECLARATIVE_TOOLS_ENABLED),n=new Set(Array.isArray(t)?t:[]);n.add(i),await B(e,L.DECLARATIVE_TOOLS_ENABLED,Array.from(n))}return{name:i,path:a,status:`imported`}}catch(e){return{name:i,path:a,status:`failed`,error:e instanceof Error?e.message:String(e)}}}async function ld(e,t=ut,n,r){let i=(n.name||``).trim(),a=`.agents/scripts/${sd(r)}/${i.endsWith(`.js`)||i.endsWith(`.mjs`)?i:`${i}.js`}`;try{if(await Wo(e,t,a)&&!r?.overwrite)return{name:i,path:a,status:`skipped`};let o=await(r?.fetchFn||globalThis.fetch)(n.url);if(!o.ok)return{name:i,path:a,status:`failed`,error:`HTTP ${o.status} ${o.statusText}`};let s=await o.text();return n.digest&&!await Qu(s,n.digest)?{name:i,path:a,status:`failed`,error:`Integrity verification failed for script`}:(await Lo(e,t,a,s),{name:i,path:a,status:`imported`})}catch(e){return{name:i,path:a,status:`failed`,error:e instanceof Error?e.message:String(e)}}}async function ud(e,t=ut,n,r){let i=(n.name||``).trim(),a=`.agents/skills/${sd(r)}/${i}/SKILL.md`;try{if(await Wo(e,t,a)&&!r?.overwrite)return{name:i,path:a,status:`skipped`};let o=await(r?.fetchFn||globalThis.fetch)(n.url);if(!o.ok)return{name:i,path:a,status:`failed`,error:`HTTP ${o.status} ${o.statusText}`};let s=await o.text();return n.digest&&!await Qu(s,n.digest)?{name:i,path:a,status:`failed`,error:`Integrity verification failed for skill`}:(id(a,s),await Lo(e,t,a,s),{name:i,path:a,status:`imported`})}catch(e){return{name:i,path:a,status:`failed`,error:e instanceof Error?e.message:String(e)}}}async function dd(e,t=ut,n,r,i){let a={tools:[],skills:[],scripts:[],diagnostics:[]},o=new Set(r.toolNames||[]),s=new Set(r.skillNames||[]),c=new Set(r.scriptNames||[]),l=n.tools||[],u=n.skills||[],d=n.scripts||[];for(let e of u)if(s.has(e.name)){if(Array.isArray(e.tools))for(let t of e.tools)o.add(t.name);if(Array.isArray(e.scripts))for(let t of e.scripts)c.add(t.name)}for(let n of d)if(c.has(n.name)){let r=await ld(e,t,n,i);a.scripts.push(r),r.status===`failed`&&r.error&&a.diagnostics.push(`Script ${n.name}: ${r.error}`)}for(let n of l)if(o.has(n.name)){let r=await cd(e,t,n,i);a.tools.push(r),r.status===`failed`&&r.error&&a.diagnostics.push(`Tool ${n.name}: ${r.error}`)}for(let n of u)if(s.has(n.name)){let r=await ud(e,t,n,i);a.skills.push(r),r.status===`failed`&&r.error&&a.diagnostics.push(`Skill ${n.name}: ${r.error}`)}return a}var fd,pd,md=k((()=>{Dt(),Wt(),zo(),Ro(),Go(),Wu(),Lu(),od(),td(),fd=new Set(Fu.map(e=>e.name)),pd=/^[a-z][a-z0-9_]{0,63}$/})),hd,gd,_d=k((()=>{Us(),Dt(),Wt(),zo(),Lu(),zu(),Wu(),td(),md(),hd=class{_activeProfile;_activeProfileId;_allTools;_customTools;_declarativeTools;_declarativeToolNamesEnabled;_enabledDeclarativeTools;_enabledToolNames;_enabledTools;_profiles;_systemPromptOverride;_webSearchProxyUrl;_webSearchUrl;_webSearchUseProxy;_searchFilesMaxFileBytes;_searchFilesMaxFilesVisited;_searchFilesSkipDirs;constructor(){this._enabledToolNames=new Hs.State(new Set(Ru.enabledToolNames)),this._customTools=new Hs.State([]),this._declarativeTools=new Hs.State([]),this._declarativeToolNamesEnabled=new Hs.State(null),this._systemPromptOverride=new Hs.State(``),this._profiles=new Hs.State([]),this._activeProfileId=new Hs.State(Ru.id),this._webSearchUseProxy=new Hs.State(!1),this._webSearchProxyUrl=new Hs.State(`/proxy`),this._webSearchUrl=new Hs.State(`https://html.duckduckgo.com/html/?q={query}`),this._searchFilesMaxFileBytes=new Hs.State(524288),this._searchFilesMaxFilesVisited=new Hs.State(1e3),this._searchFilesSkipDirs=new Hs.State(`.git,node_modules,dist,dist-electron,.cache,.nx,.turbo,__pycache__,.venv,venv`),this._allTools=new Hs.Computed(()=>[...Fu,...this._customTools.get()]),this._enabledTools=new Hs.Computed(()=>{let e=this._enabledToolNames.get();return this._allTools.get().filter(t=>e.has(t.name))}),this._enabledDeclarativeTools=new Hs.Computed(()=>{let e=this._declarativeTools.get(),t=this._declarativeToolNamesEnabled.get();return t===null?e:e.filter(e=>t.has(e.name))}),this._activeProfile=new Hs.Computed(()=>{let e=this._activeProfileId.get();return e?Ru.id===e?Ru:this._profiles.get().find(t=>t.id===e)||null:null})}get activeProfile(){return this._activeProfile.get()}get activeProfileId(){return this._activeProfileId.get()}get allTools(){return this._allTools.get()}get customTools(){return this._customTools.get()}get declarativeTools(){return this._declarativeTools.get()}get declarativeToolNamesEnabled(){return this._declarativeToolNamesEnabled.get()}get enabledDeclarativeTools(){return this._enabledDeclarativeTools.get()}get enabledToolNames(){return this._enabledToolNames.get()}get enabledTools(){return this._enabledTools.get()}isDeclarativeToolEnabled(e){let t=this._declarativeToolNamesEnabled.get();return t===null||t.has(e)}async refreshDeclarativeTools(e,t){try{let n=await Vu(e,t||`br:main`),r=this.allTools,i=(n?.tools||[]).filter(e=>!r.some(t=>t.name===e.name)),a=this._declarativeTools.get();return a.length===i.length&&a.every((e,t)=>e.name===i[t].name&&e.description===i[t].description&&JSON.stringify(e.execution)===JSON.stringify(i[t].execution))||this._declarativeTools.set(i),i}catch{return this._declarativeTools.get().length>0&&this._declarativeTools.set([]),[]}}async setDeclarativeToolEnabled(e,t,n){let r=this._declarativeToolNamesEnabled.get(),i=this._declarativeTools.get(),a=new Set(r===null?i.map(e=>e.name):r);n?a.add(t):a.delete(t),this._declarativeToolNamesEnabled.set(a),await B(e,L.DECLARATIVE_TOOLS_ENABLED,Array.from(a))}async setAllDeclarativeEnabled(e,t){let n=new Set(t);this._declarativeToolNamesEnabled.set(n),await B(e,L.DECLARATIVE_TOOLS_ENABLED,t)}async fetchRemoteDiscoveryManifest(e){return await $u(e)}async importFromRemoteSite(e,t,n,r){let i=r?.groupId||`br:main`,a=await dd(e,i,t,n,r);return await this.refreshDeclarativeTools(e,i),a}exportBackup(){return JSON.stringify({enabledTools:[...this._enabledToolNames.get()],customTools:this._customTools.get(),declarativeToolsEnabled:this._declarativeToolNamesEnabled.get()?Array.from(this._declarativeToolNamesEnabled.get()):null,systemPromptOverride:this._systemPromptOverride.get(),profiles:this._profiles.get(),activeProfileId:this._activeProfileId.get(),webSearchUseProxy:this._webSearchUseProxy.get(),webSearchProxyUrl:this._webSearchProxyUrl.get(),webSearchUrl:this._webSearchUrl.get(),searchFilesMaxFileBytes:this._searchFilesMaxFileBytes.get(),searchFilesMaxFilesVisited:this._searchFilesMaxFilesVisited.get(),searchFilesSkipDirs:this._searchFilesSkipDirs.get()},null,2)}findProfilesForProvider(e,t){return this.profiles.filter(n=>!(n.providerId&&n.providerId!==e||n.model&&n.model!==t))}get profiles(){return[Ru,...this._profiles.get()]}get systemPromptOverride(){return this._systemPromptOverride.get()}get webSearchProxyUrl(){return this._webSearchProxyUrl.get()}get webSearchUrl(){return this._webSearchUrl.get()}get webSearchUseProxy(){return this._webSearchUseProxy.get()}get searchFilesMaxFileBytes(){return this._searchFilesMaxFileBytes.get()}get searchFilesMaxFilesVisited(){return this._searchFilesMaxFilesVisited.get()}get searchFilesSkipDirs(){return this._searchFilesSkipDirs.get()}get searchFilesSkipDirsSet(){return new Set(this._searchFilesSkipDirs.get().split(`,`).map(e=>e.trim()).filter(Boolean))}async activateProfile(e,t){let n=this.profiles.find(e=>e.id===t);n&&(this._activeProfileId.set(t),this._enabledToolNames.set(new Set(n.enabledToolNames)),this._customTools.set(n.customTools),this._systemPromptOverride.set(n.systemPromptOverride||``),await Promise.all([B(e,L.ACTIVE_TOOL_PROFILE,t),B(e,L.ENABLED_TOOLS,n.enabledToolNames),B(e,L.CUSTOM_TOOLS,n.customTools),B(e,L.SYSTEM_PROMPT_OVERRIDE,n.systemPromptOverride||``)]))}async addCustomTool(e,t){let n=[...this._customTools.get(),t];this._customTools.set(n);let r=new Set(this._enabledToolNames.get());r.add(t.name),this._enabledToolNames.set(r),await Promise.all([B(e,L.CUSTOM_TOOLS,n),B(e,L.ENABLED_TOOLS,[...r])])}async addProfile(e,t){let n=[...this._profiles.get(),t];this._profiles.set(n),await B(e,L.TOOL_PROFILES,n)}async cloneTool(e,t,n,r){let i=this.allTools.find(e=>e.name===t);if(!i||this.allTools.some(e=>e.name===n))return!1;let a={name:n,description:r||i.description,input_schema:JSON.parse(JSON.stringify(i.input_schema))};return await this.addCustomTool(e,a),!0}async deactivateProfile(e){this._activeProfileId.set(null),await B(e,L.ACTIVE_TOOL_PROFILE,null)}async deleteProfile(e,t){if(t===Ru.id)return;let n=this._profiles.get().filter(e=>e.id!==t);this._profiles.set(n),this._activeProfileId.get()===t&&(this._activeProfileId.set(null),await B(e,L.ACTIVE_TOOL_PROFILE,null)),await B(e,L.TOOL_PROFILES,n)}async importBackup(e,t){let n=JSON.parse(t);Array.isArray(n.enabledTools)&&(this._enabledToolNames.set(new Set(n.enabledTools)),await B(e,L.ENABLED_TOOLS,n.enabledTools)),Array.isArray(n.customTools)&&(this._customTools.set(n.customTools),await B(e,L.CUSTOM_TOOLS,n.customTools)),typeof n.systemPromptOverride==`string`&&(this._systemPromptOverride.set(n.systemPromptOverride),await B(e,L.SYSTEM_PROMPT_OVERRIDE,n.systemPromptOverride)),Array.isArray(n.profiles)&&(this._profiles.set(n.profiles),await B(e,L.TOOL_PROFILES,n.profiles)),(typeof n.activeProfileId==`string`||n.activeProfileId===null)&&(this._activeProfileId.set(n.activeProfileId),await B(e,L.ACTIVE_TOOL_PROFILE,n.activeProfileId)),typeof n.webSearchUseProxy==`boolean`&&(this._webSearchUseProxy.set(n.webSearchUseProxy),await B(e,L.WEB_SEARCH_USE_PROXY,n.webSearchUseProxy?`true`:`false`)),typeof n.webSearchProxyUrl==`string`&&(this._webSearchProxyUrl.set(n.webSearchProxyUrl),await B(e,L.WEB_SEARCH_PROXY_URL,n.webSearchProxyUrl)),typeof n.webSearchUrl==`string`&&(this._webSearchUrl.set(n.webSearchUrl),await B(e,L.WEB_SEARCH_URL,n.webSearchUrl)),typeof n.searchFilesMaxFileBytes==`number`&&n.searchFilesMaxFileBytes>0&&(this._searchFilesMaxFileBytes.set(n.searchFilesMaxFileBytes),await B(e,L.SEARCH_FILES_MAX_FILE_BYTES,String(n.searchFilesMaxFileBytes))),typeof n.searchFilesMaxFilesVisited==`number`&&n.searchFilesMaxFilesVisited>0&&(this._searchFilesMaxFilesVisited.set(n.searchFilesMaxFilesVisited),await B(e,L.SEARCH_FILES_MAX_FILES_VISITED,String(n.searchFilesMaxFilesVisited))),typeof n.searchFilesSkipDirs==`string`&&(this._searchFilesSkipDirs.set(n.searchFilesSkipDirs),await B(e,L.SEARCH_FILES_SKIP_DIRS,n.searchFilesSkipDirs)),Array.isArray(n.declarativeToolsEnabled)?(this._declarativeToolNamesEnabled.set(new Set(n.declarativeToolsEnabled)),await B(e,L.DECLARATIVE_TOOLS_ENABLED,n.declarativeToolsEnabled)):n.declarativeToolsEnabled===null&&(this._declarativeToolNamesEnabled.set(null),await B(e,L.DECLARATIVE_TOOLS_ENABLED,null))}async load(e){let[t,n,r,i,a,o,s,c,l,u,d,f]=await Promise.all([R(e,L.ENABLED_TOOLS),R(e,L.CUSTOM_TOOLS),R(e,L.SYSTEM_PROMPT_OVERRIDE),R(e,L.TOOL_PROFILES),R(e,L.ACTIVE_TOOL_PROFILE),R(e,L.WEB_SEARCH_USE_PROXY),R(e,L.WEB_SEARCH_PROXY_URL),R(e,L.WEB_SEARCH_URL),R(e,L.SEARCH_FILES_MAX_FILE_BYTES),R(e,L.SEARCH_FILES_MAX_FILES_VISITED),R(e,L.SEARCH_FILES_SKIP_DIRS),R(e,L.DECLARATIVE_TOOLS_ENABLED)]);if(Array.isArray(t)&&this._enabledToolNames.set(new Set(t)),Array.isArray(n)&&this._customTools.set(n),Array.isArray(f)&&this._declarativeToolNamesEnabled.set(new Set(f)),typeof r==`string`&&this._systemPromptOverride.set(r),Array.isArray(i)&&this._profiles.set(i),typeof a==`string`&&this._activeProfileId.set(a),o!=null){let e=String(o).toLowerCase();this._webSearchUseProxy.set(e===`true`||e===`1`)}if(typeof s==`string`&&s.trim().length>0&&this._webSearchProxyUrl.set(s.trim()),typeof c==`string`&&c.trim().length>0&&this._webSearchUrl.set(c.trim()),l!=null){let e=Number(l);Number.isFinite(e)&&e>0&&this._searchFilesMaxFileBytes.set(e)}if(u!=null){let e=Number(u);Number.isFinite(e)&&e>0&&this._searchFilesMaxFilesVisited.set(e)}typeof d==`string`&&d.trim().length>0&&this._searchFilesSkipDirs.set(d.trim())}async setWebSearchProxyUrl(e,t){let n=t.trim()||`/proxy`;this._webSearchProxyUrl.set(n),await B(e,L.WEB_SEARCH_PROXY_URL,n)}async setWebSearchUrl(e,t){let n=t.trim()||`https://html.duckduckgo.com/html/?q={query}`;this._webSearchUrl.set(n),await B(e,L.WEB_SEARCH_URL,n)}async setWebSearchUseProxy(e,t){let n=!!t;this._webSearchUseProxy.set(n),await B(e,L.WEB_SEARCH_USE_PROXY,n?`true`:`false`)}async setSearchFilesMaxFileBytes(e,t){let n=Math.max(1,Math.round(t));this._searchFilesMaxFileBytes.set(n),await B(e,L.SEARCH_FILES_MAX_FILE_BYTES,String(n))}async setSearchFilesMaxFilesVisited(e,t){let n=Math.max(1,Math.round(t));this._searchFilesMaxFilesVisited.set(n),await B(e,L.SEARCH_FILES_MAX_FILES_VISITED,String(n))}async setSearchFilesSkipDirs(e,t){let n=t.trim();this._searchFilesSkipDirs.set(n),await B(e,L.SEARCH_FILES_SKIP_DIRS,n)}async removeCustomTool(e,t){let n=this._customTools.get().filter(e=>e.name!==t);this._customTools.set(n);let r=new Set(this._enabledToolNames.get());r.delete(t),this._enabledToolNames.set(r),await Promise.all([B(e,L.CUSTOM_TOOLS,n),B(e,L.ENABLED_TOOLS,[...r])])}async saveToActiveProfile(e){let t=this._activeProfileId.get();if(!t)return;let n=this._profiles.get().find(e=>e.id===t);if(!n)return;let r={...n,enabledToolNames:[...this._enabledToolNames.get()],customTools:[...this._customTools.get()],systemPromptOverride:this._systemPromptOverride.get()};await this.updateProfile(e,r)}async setAllEnabled(e,t){this._enabledToolNames.set(new Set(t));let n=[B(e,L.ENABLED_TOOLS,t)];this._activeProfileId.get()&&(this._activeProfileId.set(null),n.push(B(e,L.ACTIVE_TOOL_PROFILE,null))),await Promise.all(n)}async setSystemPromptOverride(e,t){this._systemPromptOverride.set(t),await B(e,L.SYSTEM_PROMPT_OVERRIDE,t)}async setToolEnabled(e,t,n){let r=new Set(this._enabledToolNames.get());n?r.add(t):r.delete(t),this._enabledToolNames.set(r);let i=[B(e,L.ENABLED_TOOLS,[...r])];this._activeProfileId.get()&&(this._activeProfileId.set(null),i.push(B(e,L.ACTIVE_TOOL_PROFILE,null))),await Promise.all(i)}async updateProfile(e,t){let n=this._profiles.get().map(e=>e.id===t.id?t:e);this._profiles.set(n),await B(e,L.TOOL_PROFILES,n)}},gd=new hd}));function vd(e){for(let t of xd)if(t.test(e))return!0;return!1}function yd(e){let t=String(e||``),n=t;for(let e of xd)t=t.replace(e,``);return t!==n&&(t=t.replace(/^[ \t]+$/gm,``),t=t.replace(/\n{3,}/g,`
280
+ `)}\n---\n${n}`,t=a(e);return{data:t.data&&typeof t.data==`object`?t.data:{},content:t.content||``}}catch{}let i={},o=e.match(/^name:\s*["']?([^"'\r\n]+)["']?/m);o&&(i.name=o[1].trim());let s=e.match(/^description:\s*(.+)$/m);if(s){let e=s[1].trim();(e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`))&&(e=e.slice(1,-1)),i.description=e}let c=e.match(/^user-invocable:\s*(true|false)/im);c&&(i[`user-invocable`]=c[1].toLowerCase()===`true`);let l=e.match(/^disable-model-invocation:\s*(true|false)/im);l&&(i[`disable-model-invocation`]=l[1].toLowerCase()===`true`);let u=e.match(/^allowed-tools:\s*["']?([^"'\r\n]+)["']?/m);u&&(i[`allowed-tools`]=u[1].trim());let d=e.match(/allowed-tools:\s*\n((?:\s*-\s*[^\r\n]+\r?\n?)+)/m);if(d){let e=d[1].split(/\r?\n/).map(e=>e.replace(/^\s*-\s*/,``).trim()).filter(Boolean);e.length>0&&(i[`allowed-tools`]=e)}return{data:i,content:n}}return{data:{},content:e}}}function rd(e){if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t.join(` `):void 0}}function id(e,t){let n=nd(t),r=n.data,i=typeof r.name==`string`?r.name.trim():``,a=typeof r.description==`string`?r.description.trim():``;if(!i)throw Error(`Skill at ${e} requires a name`);if(!a)throw Error(`Skill ${i} requires a description`);if(i.length>64||!ad.test(i))throw Error(`Skill name must be 1-64 lowercase characters and hyphens: ${i}`);if(a.length>1024)throw Error(`Skill ${i} description must be 1024 characters or fewer`);let o=e.replace(/\/SKILL\.md$/u,``),s=r.metadata&&typeof r.metadata==`object`?r.metadata:void 0,c=rd(s?.[`allowed-tools`])||rd(s?.allowedTools)||rd(r[`allowed-tools`])||rd(r.allowedTools),l=[];if(s){for(let[e,t]of Object.entries(s))if(e!==`execution`&&t!=null){if(e===`allowed-tools`||e===`allowedTools`)c&&l.push([e,c]);else if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)l.push([e,String(t)]);else if(Array.isArray(t)){let n=t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean);n.length>0&&l.push([e,n.join(` `)])}}}let u=l.length>0?Object.fromEntries(l):void 0,d=s?.execution,f;if(d!==void 0){if(!d||typeof d!=`object`||d.type!==`tools`||!Array.isArray(d.tools))throw Error(`Skill ${i} has invalid tools execution`);let e=d,t=typeof e.suppressToast==`boolean`?e.suppressToast:void 0,n=typeof e.suppressOutput==`boolean`?e.suppressOutput:void 0,r=e.tools.map(e=>({...e,...t!==void 0&&e.suppressToast===void 0?{suppressToast:t}:{},...n!==void 0&&e.suppressOutput===void 0?{suppressOutput:n}:{}}));f={type:`tools`,...t===void 0?{}:{suppressToast:t},...n===void 0?{}:{suppressOutput:n},tools:r}}return{name:i,description:a,...typeof r.license==`string`?{license:r.license}:{},...typeof r.compatibility==`string`?{compatibility:r.compatibility}:{},...u?{metadata:u}:{},...typeof c==`string`?{allowedTools:c}:{},...typeof r[`user-invocable`]==`boolean`?{userInvocable:r[`user-invocable`]}:typeof r[`user-invocable`]==`string`&&(r[`user-invocable`].toLowerCase()===`true`||r[`user-invocable`].toLowerCase()===`false`)?{userInvocable:r[`user-invocable`].toLowerCase()===`true`}:{},...typeof r[`disable-model-invocation`]==`boolean`?{disableModelInvocation:r[`disable-model-invocation`]}:typeof r[`disable-model-invocation`]==`string`&&(r[`disable-model-invocation`].toLowerCase()===`true`||r[`disable-model-invocation`].toLowerCase()===`false`)?{disableModelInvocation:r[`disable-model-invocation`].toLowerCase()===`true`}:{},...f?{execution:f}:{},body:n.content.trim(),path:e,basePath:o}}var ad,od=k((()=>{ad=/^[a-z0-9](?:[a-z0-9]|-(?!-))*[a-z0-9]$|^[a-z0-9]$/}));function sd(e){return e?.targetSubdir?e.targetSubdir:e?.siteSlug?`imported/${e.siteSlug}`:`main`}async function cd(e,t=ut,n,r){let i=(n.name||``).trim();if(fd.has(i))return{name:i,path:``,status:`failed`,error:`Cannot shadow built-in tool: ${i}`};if(!pd.test(i))return{name:i,path:``,status:`failed`,error:`Invalid tool name: ${i}`};let a=`.agents/tools/${sd(r)}/${i}.json`;try{if(await Wo(e,t,a)&&!r?.overwrite)return{name:i,path:a,status:`skipped`};let o=await(r?.fetchFn||globalThis.fetch)(n.url);if(!o.ok)return{name:i,path:a,status:`failed`,error:`HTTP ${o.status} ${o.statusText}`};let s=await o.text();if(n.digest&&!await Qu(s,n.digest))return{name:i,path:a,status:`failed`,error:`Integrity verification failed for tool definition`};let c;try{c=JSON.parse(s)}catch{return{name:i,path:a,status:`failed`,error:`Downloaded tool definition is not valid JSON`}}if(Bu(a,c),await Lo(e,t,a,JSON.stringify(c,null,2)),r?.autoEnable){let t=await R(e,L.DECLARATIVE_TOOLS_ENABLED),n=new Set(Array.isArray(t)?t:[]);n.add(i),await B(e,L.DECLARATIVE_TOOLS_ENABLED,Array.from(n))}return{name:i,path:a,status:`imported`}}catch(e){return{name:i,path:a,status:`failed`,error:e instanceof Error?e.message:String(e)}}}async function ld(e,t=ut,n,r){let i=(n.name||``).trim(),a=`.agents/scripts/${sd(r)}/${i.endsWith(`.js`)||i.endsWith(`.mjs`)?i:`${i}.js`}`;try{if(await Wo(e,t,a)&&!r?.overwrite)return{name:i,path:a,status:`skipped`};let o=await(r?.fetchFn||globalThis.fetch)(n.url);if(!o.ok)return{name:i,path:a,status:`failed`,error:`HTTP ${o.status} ${o.statusText}`};let s=await o.text();return n.digest&&!await Qu(s,n.digest)?{name:i,path:a,status:`failed`,error:`Integrity verification failed for script`}:(await Lo(e,t,a,s),{name:i,path:a,status:`imported`})}catch(e){return{name:i,path:a,status:`failed`,error:e instanceof Error?e.message:String(e)}}}async function ud(e,t=ut,n,r){let i=(n.name||``).trim(),a=`.agents/skills/${sd(r)}/${i}/SKILL.md`;try{if(await Wo(e,t,a)&&!r?.overwrite)return{name:i,path:a,status:`skipped`};let o=await(r?.fetchFn||globalThis.fetch)(n.url);if(!o.ok)return{name:i,path:a,status:`failed`,error:`HTTP ${o.status} ${o.statusText}`};let s=await o.text();return n.digest&&!await Qu(s,n.digest)?{name:i,path:a,status:`failed`,error:`Integrity verification failed for skill`}:(id(a,s),await Lo(e,t,a,s),{name:i,path:a,status:`imported`})}catch(e){return{name:i,path:a,status:`failed`,error:e instanceof Error?e.message:String(e)}}}async function dd(e,t=ut,n,r,i){let a={tools:[],skills:[],scripts:[],diagnostics:[]},o=new Set(r.toolNames||[]),s=new Set(r.skillNames||[]),c=new Set(r.scriptNames||[]),l=n.tools||[],u=n.skills||[],d=n.scripts||[];for(let e of u)if(s.has(e.name)){if(Array.isArray(e.tools))for(let t of e.tools)o.add(t.name);if(Array.isArray(e.scripts))for(let t of e.scripts)c.add(t.name)}for(let n of d)if(c.has(n.name)){let r=await ld(e,t,n,i);a.scripts.push(r),r.status===`failed`&&r.error&&a.diagnostics.push(`Script ${n.name}: ${r.error}`)}for(let n of l)if(o.has(n.name)){let r=await cd(e,t,n,i);a.tools.push(r),r.status===`failed`&&r.error&&a.diagnostics.push(`Tool ${n.name}: ${r.error}`)}for(let n of u)if(s.has(n.name)){let r=await ud(e,t,n,i);a.skills.push(r),r.status===`failed`&&r.error&&a.diagnostics.push(`Skill ${n.name}: ${r.error}`)}return a}var fd,pd,md=k((()=>{Dt(),Wt(),zo(),Ro(),Go(),Wu(),Lu(),od(),td(),fd=new Set(Fu.map(e=>e.name)),pd=/^[a-z][a-z0-9_]{0,63}$/})),hd,gd,_d=k((()=>{Us(),Dt(),Wt(),zo(),Lu(),zu(),Wu(),td(),md(),hd=class{_activeProfile;_activeProfileId;_allTools;_customTools;_declarativeTools;_declarativeToolNamesEnabled;_enabledDeclarativeTools;_enabledToolNames;_enabledTools;_profiles;_systemPromptOverride;_webSearchProxyUrl;_webSearchUrl;_webSearchUseProxy;_searchFilesMaxFileBytes;_searchFilesMaxFilesVisited;_searchFilesSkipDirs;constructor(){this._enabledToolNames=new Hs.State(new Set(Ru.enabledToolNames)),this._customTools=new Hs.State([]),this._declarativeTools=new Hs.State([]),this._declarativeToolNamesEnabled=new Hs.State(null),this._systemPromptOverride=new Hs.State(``),this._profiles=new Hs.State([]),this._activeProfileId=new Hs.State(Ru.id),this._webSearchUseProxy=new Hs.State(!1),this._webSearchProxyUrl=new Hs.State(`/proxy`),this._webSearchUrl=new Hs.State(`https://html.duckduckgo.com/html/?q={query}`),this._searchFilesMaxFileBytes=new Hs.State(524288),this._searchFilesMaxFilesVisited=new Hs.State(1e3),this._searchFilesSkipDirs=new Hs.State(`.git,node_modules,dist,dist-electron,.cache,.nx,.turbo,__pycache__,.venv,venv`),this._allTools=new Hs.Computed(()=>[...Fu,...this._customTools.get()]),this._enabledTools=new Hs.Computed(()=>{let e=this._enabledToolNames.get();return this._allTools.get().filter(t=>e.has(t.name))}),this._enabledDeclarativeTools=new Hs.Computed(()=>{let e=this._declarativeTools.get(),t=this._declarativeToolNamesEnabled.get();return!t||t.size===0?[]:e.filter(e=>t.has(e.name))}),this._activeProfile=new Hs.Computed(()=>{let e=this._activeProfileId.get();return e?Ru.id===e?Ru:this._profiles.get().find(t=>t.id===e)||null:null})}get activeProfile(){return this._activeProfile.get()}get activeProfileId(){return this._activeProfileId.get()}get allTools(){return this._allTools.get()}get customTools(){return this._customTools.get()}get declarativeTools(){return this._declarativeTools.get()}get declarativeToolNamesEnabled(){return this._declarativeToolNamesEnabled.get()}get enabledDeclarativeTools(){return this._enabledDeclarativeTools.get()}get enabledToolNames(){return this._enabledToolNames.get()}get enabledTools(){return this._enabledTools.get()}isDeclarativeToolEnabled(e){let t=this._declarativeToolNamesEnabled.get();return t?t.has(e):!1}async refreshDeclarativeTools(e,t){try{let n=await Vu(e,t||`br:main`),r=this.allTools,i=(n?.tools||[]).filter(e=>!r.some(t=>t.name===e.name)),a=this._declarativeTools.get();return a.length===i.length&&a.every((e,t)=>e.name===i[t].name&&e.description===i[t].description&&JSON.stringify(e.execution)===JSON.stringify(i[t].execution))||this._declarativeTools.set(i),i}catch{return this._declarativeTools.get().length>0&&this._declarativeTools.set([]),[]}}async setDeclarativeToolEnabled(e,t,n){let r=this._declarativeToolNamesEnabled.get(),i=new Set(r===null?[]:r);n?i.add(t):i.delete(t),this._declarativeToolNamesEnabled.set(i),await B(e,L.DECLARATIVE_TOOLS_ENABLED,Array.from(i))}async setAllDeclarativeEnabled(e,t){let n=new Set(t);this._declarativeToolNamesEnabled.set(n),await B(e,L.DECLARATIVE_TOOLS_ENABLED,t)}async fetchRemoteDiscoveryManifest(e){return await $u(e)}async importFromRemoteSite(e,t,n,r){let i=r?.groupId||`br:main`,a=await dd(e,i,t,n,r);return await this.refreshDeclarativeTools(e,i),a}exportBackup(){return JSON.stringify({enabledTools:[...this._enabledToolNames.get()],customTools:this._customTools.get(),declarativeToolsEnabled:this._declarativeToolNamesEnabled.get()?Array.from(this._declarativeToolNamesEnabled.get()):null,systemPromptOverride:this._systemPromptOverride.get(),profiles:this._profiles.get(),activeProfileId:this._activeProfileId.get(),webSearchUseProxy:this._webSearchUseProxy.get(),webSearchProxyUrl:this._webSearchProxyUrl.get(),webSearchUrl:this._webSearchUrl.get(),searchFilesMaxFileBytes:this._searchFilesMaxFileBytes.get(),searchFilesMaxFilesVisited:this._searchFilesMaxFilesVisited.get(),searchFilesSkipDirs:this._searchFilesSkipDirs.get()},null,2)}findProfilesForProvider(e,t){return this.profiles.filter(n=>!(n.providerId&&n.providerId!==e||n.model&&n.model!==t))}get profiles(){return[Ru,...this._profiles.get()]}get systemPromptOverride(){return this._systemPromptOverride.get()}get webSearchProxyUrl(){return this._webSearchProxyUrl.get()}get webSearchUrl(){return this._webSearchUrl.get()}get webSearchUseProxy(){return this._webSearchUseProxy.get()}get searchFilesMaxFileBytes(){return this._searchFilesMaxFileBytes.get()}get searchFilesMaxFilesVisited(){return this._searchFilesMaxFilesVisited.get()}get searchFilesSkipDirs(){return this._searchFilesSkipDirs.get()}get searchFilesSkipDirsSet(){return new Set(this._searchFilesSkipDirs.get().split(`,`).map(e=>e.trim()).filter(Boolean))}async activateProfile(e,t){let n=this.profiles.find(e=>e.id===t);n&&(this._activeProfileId.set(t),this._enabledToolNames.set(new Set(n.enabledToolNames)),this._customTools.set(n.customTools),this._systemPromptOverride.set(n.systemPromptOverride||``),await Promise.all([B(e,L.ACTIVE_TOOL_PROFILE,t),B(e,L.ENABLED_TOOLS,n.enabledToolNames),B(e,L.CUSTOM_TOOLS,n.customTools),B(e,L.SYSTEM_PROMPT_OVERRIDE,n.systemPromptOverride||``)]))}async addCustomTool(e,t){let n=[...this._customTools.get(),t];this._customTools.set(n);let r=new Set(this._enabledToolNames.get());r.add(t.name),this._enabledToolNames.set(r),await Promise.all([B(e,L.CUSTOM_TOOLS,n),B(e,L.ENABLED_TOOLS,[...r])])}async addProfile(e,t){let n=[...this._profiles.get(),t];this._profiles.set(n),await B(e,L.TOOL_PROFILES,n)}async cloneTool(e,t,n,r){let i=this.allTools.find(e=>e.name===t);if(!i||this.allTools.some(e=>e.name===n))return!1;let a={name:n,description:r||i.description,input_schema:JSON.parse(JSON.stringify(i.input_schema))};return await this.addCustomTool(e,a),!0}async deactivateProfile(e){this._activeProfileId.set(null),await B(e,L.ACTIVE_TOOL_PROFILE,null)}async deleteProfile(e,t){if(t===Ru.id)return;let n=this._profiles.get().filter(e=>e.id!==t);this._profiles.set(n),this._activeProfileId.get()===t&&(this._activeProfileId.set(null),await B(e,L.ACTIVE_TOOL_PROFILE,null)),await B(e,L.TOOL_PROFILES,n)}async importBackup(e,t){let n=JSON.parse(t);Array.isArray(n.enabledTools)&&(this._enabledToolNames.set(new Set(n.enabledTools)),await B(e,L.ENABLED_TOOLS,n.enabledTools)),Array.isArray(n.customTools)&&(this._customTools.set(n.customTools),await B(e,L.CUSTOM_TOOLS,n.customTools)),typeof n.systemPromptOverride==`string`&&(this._systemPromptOverride.set(n.systemPromptOverride),await B(e,L.SYSTEM_PROMPT_OVERRIDE,n.systemPromptOverride)),Array.isArray(n.profiles)&&(this._profiles.set(n.profiles),await B(e,L.TOOL_PROFILES,n.profiles)),(typeof n.activeProfileId==`string`||n.activeProfileId===null)&&(this._activeProfileId.set(n.activeProfileId),await B(e,L.ACTIVE_TOOL_PROFILE,n.activeProfileId)),typeof n.webSearchUseProxy==`boolean`&&(this._webSearchUseProxy.set(n.webSearchUseProxy),await B(e,L.WEB_SEARCH_USE_PROXY,n.webSearchUseProxy?`true`:`false`)),typeof n.webSearchProxyUrl==`string`&&(this._webSearchProxyUrl.set(n.webSearchProxyUrl),await B(e,L.WEB_SEARCH_PROXY_URL,n.webSearchProxyUrl)),typeof n.webSearchUrl==`string`&&(this._webSearchUrl.set(n.webSearchUrl),await B(e,L.WEB_SEARCH_URL,n.webSearchUrl)),typeof n.searchFilesMaxFileBytes==`number`&&n.searchFilesMaxFileBytes>0&&(this._searchFilesMaxFileBytes.set(n.searchFilesMaxFileBytes),await B(e,L.SEARCH_FILES_MAX_FILE_BYTES,String(n.searchFilesMaxFileBytes))),typeof n.searchFilesMaxFilesVisited==`number`&&n.searchFilesMaxFilesVisited>0&&(this._searchFilesMaxFilesVisited.set(n.searchFilesMaxFilesVisited),await B(e,L.SEARCH_FILES_MAX_FILES_VISITED,String(n.searchFilesMaxFilesVisited))),typeof n.searchFilesSkipDirs==`string`&&(this._searchFilesSkipDirs.set(n.searchFilesSkipDirs),await B(e,L.SEARCH_FILES_SKIP_DIRS,n.searchFilesSkipDirs)),Array.isArray(n.declarativeToolsEnabled)?(this._declarativeToolNamesEnabled.set(new Set(n.declarativeToolsEnabled)),await B(e,L.DECLARATIVE_TOOLS_ENABLED,n.declarativeToolsEnabled)):n.declarativeToolsEnabled===null&&(this._declarativeToolNamesEnabled.set(null),await B(e,L.DECLARATIVE_TOOLS_ENABLED,null))}async load(e){let[t,n,r,i,a,o,s,c,l,u,d,f]=await Promise.all([R(e,L.ENABLED_TOOLS),R(e,L.CUSTOM_TOOLS),R(e,L.SYSTEM_PROMPT_OVERRIDE),R(e,L.TOOL_PROFILES),R(e,L.ACTIVE_TOOL_PROFILE),R(e,L.WEB_SEARCH_USE_PROXY),R(e,L.WEB_SEARCH_PROXY_URL),R(e,L.WEB_SEARCH_URL),R(e,L.SEARCH_FILES_MAX_FILE_BYTES),R(e,L.SEARCH_FILES_MAX_FILES_VISITED),R(e,L.SEARCH_FILES_SKIP_DIRS),R(e,L.DECLARATIVE_TOOLS_ENABLED)]);if(Array.isArray(t)&&this._enabledToolNames.set(new Set(t)),Array.isArray(n)&&this._customTools.set(n),Array.isArray(f)&&this._declarativeToolNamesEnabled.set(new Set(f)),typeof r==`string`&&this._systemPromptOverride.set(r),Array.isArray(i)&&this._profiles.set(i),typeof a==`string`&&this._activeProfileId.set(a),o!=null){let e=String(o).toLowerCase();this._webSearchUseProxy.set(e===`true`||e===`1`)}if(typeof s==`string`&&s.trim().length>0&&this._webSearchProxyUrl.set(s.trim()),typeof c==`string`&&c.trim().length>0&&this._webSearchUrl.set(c.trim()),l!=null){let e=Number(l);Number.isFinite(e)&&e>0&&this._searchFilesMaxFileBytes.set(e)}if(u!=null){let e=Number(u);Number.isFinite(e)&&e>0&&this._searchFilesMaxFilesVisited.set(e)}typeof d==`string`&&d.trim().length>0&&this._searchFilesSkipDirs.set(d.trim())}async setWebSearchProxyUrl(e,t){let n=t.trim()||`/proxy`;this._webSearchProxyUrl.set(n),await B(e,L.WEB_SEARCH_PROXY_URL,n)}async setWebSearchUrl(e,t){let n=t.trim()||`https://html.duckduckgo.com/html/?q={query}`;this._webSearchUrl.set(n),await B(e,L.WEB_SEARCH_URL,n)}async setWebSearchUseProxy(e,t){let n=!!t;this._webSearchUseProxy.set(n),await B(e,L.WEB_SEARCH_USE_PROXY,n?`true`:`false`)}async setSearchFilesMaxFileBytes(e,t){let n=Math.max(1,Math.round(t));this._searchFilesMaxFileBytes.set(n),await B(e,L.SEARCH_FILES_MAX_FILE_BYTES,String(n))}async setSearchFilesMaxFilesVisited(e,t){let n=Math.max(1,Math.round(t));this._searchFilesMaxFilesVisited.set(n),await B(e,L.SEARCH_FILES_MAX_FILES_VISITED,String(n))}async setSearchFilesSkipDirs(e,t){let n=t.trim();this._searchFilesSkipDirs.set(n),await B(e,L.SEARCH_FILES_SKIP_DIRS,n)}async removeCustomTool(e,t){let n=this._customTools.get().filter(e=>e.name!==t);this._customTools.set(n);let r=new Set(this._enabledToolNames.get());r.delete(t),this._enabledToolNames.set(r),await Promise.all([B(e,L.CUSTOM_TOOLS,n),B(e,L.ENABLED_TOOLS,[...r])])}async saveToActiveProfile(e){let t=this._activeProfileId.get();if(!t)return;let n=this._profiles.get().find(e=>e.id===t);if(!n)return;let r={...n,enabledToolNames:[...this._enabledToolNames.get()],customTools:[...this._customTools.get()],systemPromptOverride:this._systemPromptOverride.get()};await this.updateProfile(e,r)}async setAllEnabled(e,t){this._enabledToolNames.set(new Set(t));let n=[B(e,L.ENABLED_TOOLS,t)];this._activeProfileId.get()&&(this._activeProfileId.set(null),n.push(B(e,L.ACTIVE_TOOL_PROFILE,null))),await Promise.all(n)}async setSystemPromptOverride(e,t){this._systemPromptOverride.set(t),await B(e,L.SYSTEM_PROMPT_OVERRIDE,t)}async setToolEnabled(e,t,n){let r=new Set(this._enabledToolNames.get());n?r.add(t):r.delete(t),this._enabledToolNames.set(r);let i=[B(e,L.ENABLED_TOOLS,[...r])];this._activeProfileId.get()&&(this._activeProfileId.set(null),i.push(B(e,L.ACTIVE_TOOL_PROFILE,null))),await Promise.all(i)}async updateProfile(e,t){let n=this._profiles.get().map(e=>e.id===t.id?t:e);this._profiles.set(n),await B(e,L.TOOL_PROFILES,n)}},gd=new hd}));function vd(e){for(let t of xd)if(t.test(e))return!0;return!1}function yd(e){let t=String(e||``),n=t;for(let e of xd)t=t.replace(e,``);return t!==n&&(t=t.replace(/^[ \t]+$/gm,``),t=t.replace(/\n{3,}/g,`
281
281
 
282
282
  `)),t}function bd(e,t){let n=yd(e);return n!==e&&vd(e)&&console.info(`[ShadowClaw] Chat-template control token(s) detected and stripped from "${t}" output. The provider or model may not be applying its chat template correctly. Original length: ${e.length}, cleaned length: ${n.length}.`),n}var xd,Sd=k((()=>{xd=[/<\|start_header_id\|>\s*(?:system|user|assistant|tool)\s*<\|end_header_id\|>/gi,/<\|(?:begin_of_text|end_of_text|eot_id|im_start|im_end|end_of_message)\|>/gi,/<\|(?:startofturn|endofturn|start_of_turn|end_of_turn)\|>/gi,/<\|(?:image|audio|video|tool_call|tool_response|tool_result|function_call)\|>|<\|\/function_call\|>/gi,/<|(?:system|user|assistant|im_start|im_end)|>/g,/\[\s*INST\s*\]|\[\s*\/INST\s*\]|<<\s*SYS\s*>>|<<\s*\/SYS\s*>>/gi,/<\/?s>|<\/?bos>|<\/?eos>|<\|(?:bos|eos|pad|unk)\|>/gi,/<\|(?:START_OF_TURN_TOKEN|END_OF_TURN_TOKEN|CHATBOT_TOKEN|USER_TOKEN|SYSTEM_TOKEN)\|>/gi,/<\|(?:system|user|assistant|end|endoftext|placeholder\d*)\|>/gi,/<|(?:begin▁of▁sentence|end▁of▁sentence)|>/g,/<\|start\|>\s*(?:system|user|assistant|tool)\s*<\|message\|>/gi]}));function Cd(e,t,n,r){return{type:`thinking-log`,payload:{groupId:e,level:t,timestamp:Date.now(),label:n,message:r||``}}}var wd=k((()=>{}));function Td(e,t,n){return{type:`tool-activity`,payload:{groupId:e,tool:t,status:n}}}var Ed=k((()=>{}));async function Dd(e,t,n,r){let{dirs:i,filename:a}=ri(n);for(let n=0;n<2;n++)try{let n=await Tn(e,t);for(let e of i)n=await n.getDirectoryHandle(e,{create:!0});let o=await n.getFileHandle(a,{create:!0});try{await Mo(o,r);return}catch(t){if(!((t instanceof Error?t.message:String(t)).includes(`Writable file streams are not supported`)&&(await Sn(e)).type===`opfs`))throw t}let s=t.replace(/:/g,`-`);await No([hn(),`groups`,s,...i,a],r);return}catch(e){if(n===0&&xn(e)){bn();continue}throw e}}var Od=k((()=>{En(),ii(),wn(),Io()}));function kd(){return new Promise((e,t)=>{let n=indexedDB.open(Nd,1);n.onupgradeneeded=()=>{n.result.createObjectStore(Pd)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function Ad(){let e=await kd();if(!e)return null;let t=await new Promise((t,n)=>{let r=e.transaction(Pd,`readonly`).objectStore(Pd).get(Fd);r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)});if(t)return e.close(),t;let n=await crypto.subtle.generateKey({name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`]);try{await new Promise((t,r)=>{let i=e.transaction(Pd,`readwrite`);i.objectStore(Pd).put(n,Fd),i.oncomplete=()=>t(),i.onerror=()=>r(i.error)})}finally{e.close()}return n}async function jd(e){let t=await Ad();if(!t)return null;let n=crypto.getRandomValues(new Uint8Array(Id)),r=await crypto.subtle.encrypt({name:`AES-GCM`,iv:n},t,new TextEncoder().encode(e)),i=new Uint8Array(n.length+new Uint8Array(r).length);return i.set(n),i.set(new Uint8Array(r),n.length),btoa(String.fromCharCode(...i))}async function Md(e){let t=await Ad();if(!t)return null;let n=Uint8Array.from(atob(e),e=>e.charCodeAt(0)),r=n.slice(0,Id),i=n.slice(Id),a=await crypto.subtle.decrypt({name:`AES-GCM`,iv:r},t,i);return new TextDecoder().decode(a)}var Nd,Pd,Fd,Id,Ld=k((()=>{Nd=`shadowclaw-keystore`,Pd=`keys`,Fd=`api-key-encryption`,Id=12}));function Rd(e){return!e||e.authMode===`token`||e.authMode===`pat`?`token`:e.authMode===`basic`?`basic`:e.authMode===`oauth`||e.oauthProviderId||e.oauthClientId||e.oauthClientSecret||e.refreshToken||e.accessTokenExpiresAt||e.tokenType||e.oauthReauthRequired?`oauth`:`token`}var zd=k((()=>{}));function Bd(e){return Rd(e)}function Aee(e,t){return Bd(e)!==`oauth`||e.oauthReauthRequired||!e.refreshToken||!e.oauthProviderId||!e.oauthClientId?!1:t.forceRefresh?!0:e.accessTokenExpiresAt?e.accessTokenExpiresAt<=Date.now()+Wd:!1}async function jee(e,t,n){if(!n.refreshToken||!n.oauthProviderId||!n.oauthClientId)return n;let r=await Md(n.refreshToken);if(!r)return n;let i=n.oauthClientSecret?await Md(n.oauthClientSecret):void 0,a=async r=>{let i=t.findIndex(e=>e.id===n.id);i!==-1&&(t[i]=r,await B(e,L.SERVICE_ACCOUNTS,t))},o=async()=>{let e=(n.oauthRefreshFailureCount||0)+1,t=e>=Gd,r={...n,oauthRefreshFailureCount:e,oauthReauthRequired:t,oauthReauthRequiredAt:t?n.oauthReauthRequiredAt||Date.now():void 0};return await a(r),r};try{let e=await fetch(`/oauth/refresh`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({providerId:n.oauthProviderId,clientId:n.oauthClientId,clientSecret:i,refreshToken:r,scope:n.scopes,tokenUrl:n.oauthCustomTokenUrl})});if(!e.ok)return o();let t=await e.json();if(!t.accessToken)return o();let s=await jd(t.accessToken);if(!s)return o();let c=n.refreshToken;if(t.refreshToken){let e=await jd(t.refreshToken);e&&(c=e)}let l={...n,token:s,refreshToken:c,accessTokenExpiresAt:t.expiresIn?Date.now()+t.expiresIn*1e3:n.accessTokenExpiresAt,tokenType:t.tokenType||n.tokenType,scopes:t.scope?t.scope.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):n.scopes,oauthRefreshFailureCount:0,oauthReauthRequired:!1,oauthReauthRequiredAt:void 0};return await a(l),l}catch{return o()}}function Vd(e,t){if(e.oauthProviderId){let t=M(e.oauthProviderId);if(t)return t}let n=[e.service,e.hostPattern,t].filter(e=>!!e).map(e=>e.toLowerCase());for(let e of Object.values(xt))if([e.providerId,...e.aliases||[]].map(e=>e.toLowerCase()).some(e=>n.some(t=>t.includes(e))))return e;return null}function Mee(e,t){let n=Bd(e),r=Vd(e,t);if(r){let e;return e=n===`oauth`?r.tokenAuth.oauth:n===`basic`&&r.tokenAuth.basic?r.tokenAuth.basic:r.tokenAuth.token,{headerName:e.headerName,headerPrefix:e.headerPrefix||``}}return{headerName:`Authorization`,headerPrefix:n===`basic`?`Basic `:`Bearer `}}function Nee(e,t){let n=[],r=-1,i=t.toLowerCase();for(let t of e){if(!t.hostPattern)continue;let e=t.hostPattern.toLowerCase();i.includes(e)&&(e.length>r?(r=e.length,n.length=0,n.push(t)):e.length===r&&n.push(t))}return n}function Hd(e,t){return e.length?t&&e.find(e=>Bd(e)===t)||e[0]:void 0}async function Ud(e,t,n={}){let r=await R(e,L.SERVICE_ACCOUNTS),i=Array.isArray(r)?r:[];if(i.length===0)return;let a;if(n.accountId&&(a=i.find(e=>e.id===n.accountId)),!a&&t){let e=Nee(i,t);a=n.authMode?Hd(e,n.authMode):Hd(e,e[0]?Vd(e[0],t)?.defaultMode:void 0)}if(!a){let t=await R(e,L.SERVICE_DEFAULT_ACCOUNT);t&&(a=i.find(e=>e.id===t))}if(!a&&n.authMode&&(a=Hd(i,n.authMode)),a||=i[0],!a)return;if(Aee(a,n)&&(a=await jee(e,i,a)),Bd(a)===`oauth`&&a.oauthReauthRequired)return{token:``,service:a.service,hostPattern:a.hostPattern,headerName:`Authorization`,headerValue:``,accountId:a.id,authMode:`oauth`,reauthRequired:!0};let o=``;a.token&&(o=await Md(a.token)??``);let{headerName:s,headerPrefix:c}=Mee(a,t),l=o;Bd(a)===`basic`&&a.basicUsername&&(l=btoa(`${a.basicUsername}:${o}`));let u=c?`${c}${l}`:l;return{token:o,service:a.service,hostPattern:a.hostPattern,headerName:s,headerValue:u,accountId:a.id,authMode:Bd(a)}}var Wd,Gd,Kd=k((()=>{Dt(),Wt(),zo(),Ld(),zd(),Wd=6e4,Gd=3}));function qd(e){return Rd(e)}function Pee(e){switch(e){case`azure-devops`:return`azure_devops`;default:return e}}function Jd(e){if(!e)return`generic`;let t=e.toLowerCase();return t.includes(`github`)?`github`:t.includes(`dev.azure.com`)||t.includes(`visualstudio.com`)?`azure-devops`:t.includes(`gitlab`)?`gitlab`:`generic`}function Yd(e){if(e.reauthRequired)return{};let t=e.provider||Jd(e.hostPattern||``),n=Pee(t),r=e.authMode||`token`;if(e.token&&n===`azure_devops`&&nt(n,r,`git_remote`)?.headerPrefix===`Basic `)return{Authorization:`Basic ${btoa(`:`+e.token)}`};if(t===`azure-devops`&&e.username&&e.password)return{Authorization:`Basic ${btoa(e.username+`:`+e.password)}`};if(e.token){let t=nt(n,r,`git_remote`);return t?.headerName?{[t.headerName]:`${t.headerPrefix||``}${e.token}`}:{Authorization:`Bearer ${e.token}`}}return{}}function Xd(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return n?t.hostname+n:t.hostname}catch{return}}function Fee(e,t){let n=t.toLowerCase(),r=[],i=-1;for(let t of e){if(!t.hostPattern)continue;let e=t.hostPattern.toLowerCase();n.includes(e)&&(e.length>i?(i=e.length,r.length=0,r.push(t)):e.length===i&&r.push(t))}return r}function Zd(e,t){if(!e.length)return;if(!t)return e[0];let n=e.find(e=>qd(e)===t);if(n)return n;if(t===`token`){let t=e.find(e=>qd(e)===`token`&&!e.authMode);if(t)return t}return e[0]}async function Qd(e){if(e)return await Md(e)??void 0}function Iee(e,t){return qd(e)!==`oauth`||e.oauthReauthRequired||!e.refreshToken||!e.oauthProviderId||!e.oauthClientId?!1:t.forceRefresh?!0:e.accessTokenExpiresAt?e.accessTokenExpiresAt<=Date.now()+ef:!1}async function Lee(e,t,n){if(!n.refreshToken||!n.oauthProviderId||!n.oauthClientId)return n;let r=await Qd(n.refreshToken);if(!r)return n;let i=n.oauthClientSecret?await Qd(n.oauthClientSecret):void 0,a=async r=>{let i=t.findIndex(e=>e.id===n.id);i!==-1&&(t[i]=r,await B(e,L.GIT_ACCOUNTS,t))},o=async()=>{let e=(n.oauthRefreshFailureCount||0)+1,t=e>=tf,r={...n,oauthRefreshFailureCount:e,oauthReauthRequired:t,oauthReauthRequiredAt:t?n.oauthReauthRequiredAt||Date.now():void 0};return await a(r),r};try{let e=await fetch(`/oauth/refresh`,{body:JSON.stringify({clientId:n.oauthClientId,clientSecret:i,providerId:n.oauthProviderId,refreshToken:r,scope:n.scopes}),headers:{"content-type":`application/json`},method:`POST`});if(!e.ok)return o();let t=await e.json();if(!t.accessToken)return o();let s=await jd(t.accessToken);if(!s)return o();let c=n.refreshToken;if(t.refreshToken){let e=await jd(t.refreshToken);e&&(c=e)}let l={...n,token:s,refreshToken:c,accessTokenExpiresAt:t.expiresIn?Date.now()+t.expiresIn*1e3:n.accessTokenExpiresAt,tokenType:t.tokenType||n.tokenType,scopes:t.scope?t.scope.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):n.scopes,oauthRefreshFailureCount:0,oauthReauthRequired:!1,oauthReauthRequiredAt:void 0};return await a(l),l}catch{return o()}}async function $d(e,t,n={}){let r=await R(e,L.GIT_ACCOUNTS);return Array.isArray(r)&&r.length>0?Ree(e,r,t,n):zee(e)}async function Ree(e,t,n,r={}){let i;if(r.accountId&&(i=t.find(e=>e.id===r.accountId)),!i&&n){let e=Xd(n);e&&(i=Zd(Fee(t,e),r.authMode))}if(!i){let r=await R(e,L.GIT_DEFAULT_ACCOUNT);if(r){let e=t.find(e=>e.id===r);if(e){if(!n)i=e;else{let t=Xd(n);if(t&&e.hostPattern){let n=t?.toLowerCase(),r=e.hostPattern.toLowerCase();n?.includes(r)&&(i=e)}}}}}if(!i&&!n&&r.authMode&&(i=Zd(t,r.authMode)),!i&&!n&&(i=t[0]),!i)return{authMode:`token`,authorEmail:void 0,authorName:void 0,password:void 0,provider:`generic`,token:void 0,username:void 0};Iee(i,r)&&(i=await Lee(e,t,i));let a=i.provider||Jd(i.hostPattern||``);return qd(i)===`oauth`&&i.oauthReauthRequired?{accountId:i.id,authMode:`oauth`,authorEmail:i.authorEmail||void 0,authorName:i.authorName||void 0,hostPattern:i.hostPattern||void 0,password:void 0,provider:a,reauthRequired:!0,token:void 0,username:i.username||void 0}:{accountId:i.id,authMode:qd(i),authorEmail:i.authorEmail||void 0,authorName:i.authorName||void 0,hostPattern:i.hostPattern||void 0,password:await Qd(i.password),provider:a,token:await Qd(i.token),username:i.username||void 0}}async function zee(e){let t=await R(e,L.GIT_TOKEN),n=await R(e,L.GIT_PASSWORD);return{authMode:`token`,authorEmail:await R(e,L.GIT_AUTHOR_EMAIL)||void 0,authorName:await R(e,L.GIT_AUTHOR_NAME)||void 0,password:n?await Qd(n):void 0,provider:`generic`,token:t?await Qd(t):void 0,username:await R(e,L.GIT_USERNAME)||void 0}}var ef,tf,nf=k((()=>{Dt(),zd(),Ld(),Wt(),zo(),ef=6e4,tf=3}));function Bee(e){if(typeof e!=`string`||!e.trim())return!1;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function Vee(e,t){if(!e||typeof e!=`object`)return null;let n=e;if(!n.serviceType||!n.authType)return null;if(n.serviceType!==t)throw Error(`Credential ref serviceType must match connection serviceType`);return{serviceType:n.serviceType,authType:n.authType,providerId:n.providerId||void 0,accountId:n.accountId||void 0,gitAccountId:n.gitAccountId||void 0,headerName:n.headerName||void 0,encryptedValue:n.encryptedValue||void 0}}function Hee(e){if(!e||typeof e!=`object`)return null;let t=e;return!t.id||!t.label||!t.serviceType||!t.transport||typeof t.enabled!=`boolean`||typeof t.createdAt!=`number`||typeof t.updatedAt!=`number`||!Bee(t.serverUrl)||t.serviceType!==`mcp_remote`&&t.serviceType!==`webmcp_local`||t.transport!==`streamable_http`&&t.transport!==`sse`&&t.transport!==`websocket`?null:{id:t.id,label:t.label,serviceType:t.serviceType,serverUrl:t.serverUrl,transport:t.transport,enabled:t.enabled,autoReconnectOAuth:t.autoReconnectOAuth===!0,createdAt:t.createdAt,updatedAt:t.updatedAt,credentialRef:Vee(t.credentialRef,t.serviceType)}}async function rf(e){let t=await R(e,L.REMOTE_MCP_CONNECTIONS);if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=Hee(e);t&&n.push(t)}return n}async function Uee(e){return rf(e)}async function af(e,t){if(!t)return null;let n=await rf(e);return n.find(e=>e.id===t)||n.find(e=>e.label.toLowerCase()===t.toLowerCase())||null}var of=k((()=>{Dt(),Wt(),zo()}));function Wee(e){return e===`oauth`?`oauth`:`token`}async function sf(e,t,n={}){let r=await af(e,t);if(!r)return null;let i=r.credentialRef;if(!i||i.authType===`none`)return{connection:r,authType:`none`,headers:{}};if(i.authType===`custom_header`){if(!i.headerName||!i.encryptedValue)return{connection:r,authType:`custom_header`,headers:{}};let e=await Md(i.encryptedValue);return{connection:r,authType:`custom_header`,headers:e?{[i.headerName]:e}:{}}}let a=Wee(i.authType);if(i.accountId){let t=await Ud(e,r.serverUrl,{accountId:i.accountId,authMode:a,forceRefresh:n.forceRefresh});return t?t.reauthRequired?{connection:r,authType:i.authType,headers:{},reauthRequired:!0}:{connection:r,authType:i.authType,headers:t.headerValue?{[t.headerName]:t.headerValue}:{}}:{connection:r,authType:i.authType,headers:{}}}if(i.gitAccountId){let t=await $d(e,r.serverUrl,{accountId:i.gitAccountId,authMode:a,forceRefresh:n.forceRefresh});return t.reauthRequired?{connection:r,authType:i.authType,headers:{},reauthRequired:!0}:{connection:r,authType:i.authType,headers:Yd(t)}}return{connection:r,authType:i.authType,headers:{}}}var Gee=k((()=>{Ld(),of(),Kd(),nf()}));function cf(e){return typeof e==`object`&&!!e&&`method`in e&&`id`in e&&!(`result`in e)&&!(`error`in e)}function Kee(e){let t=(e.requestedSchema||{}).properties||{},n={};for(let[e,r]of Object.entries(t))`default`in r?n[e]=r.default:r.type===`boolean`&&(n[e]=!0);return n}function lf(e,t){return!e.headers||typeof e.headers.get!=`function`?null:e.headers.get(t)}function uf(e){return/no valid session id provided/i.test(e)}function df(e,t){let n=t&&`error`in t?t.error.message||`Remote MCP JSON-RPC error`:``;return uf(n)?new Cf(n):e.ok?Error(n||`Remote MCP JSON-RPC error`):new wf(e.status,n?`Remote MCP HTTP error: ${e.status} (${n})`:`Remote MCP HTTP error: ${e.status}`)}function ff(e){if(!e)return null;let t=null,n=e.split(/\r?\n/);for(let e of n){let n=e.trim();if(!n.startsWith(`data:`))continue;let r=n.slice(5).trim();if(r&&r!==`[DONE]`)try{let e=JSON.parse(r);e&&typeof e==`object`&&`jsonrpc`in e&&(t=e)}catch{}}return t}function pf(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}async function mf(e,t,n){let r=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json, text/event-stream`,...t},body:JSON.stringify(n)}),i=(lf(r,`content-type`)||``).toLowerCase(),a=null;if(typeof r.text==`function`){let e=await r.text();a=i.includes(`text/event-stream`)?ff(e):pf(e)}else try{a=await r.json()}catch{a=null}return{response:r,payload:a}}async function hf(e,t,n){let{response:r,payload:i}=await mf(e,{...t,"mcp-session-id":n},{jsonrpc:`2.0`,method:`notifications/initialized`,params:{}});if(!r.ok||i&&`error`in i)throw df(r,i)}async function gf(e,t,n){let r=Sf.get(e);if(r?.sessionId)return r;let{response:i,payload:a}=await mf(t,n,{jsonrpc:`2.0`,id:`initialize-${Date.now().toString(36)}`,method:`initialize`,params:{protocolVersion:`2025-03-26`,capabilities:{elicitation:{}},clientInfo:{name:`shadowclaw-remote-mcp-client`,version:`1.0.0`}}});if(!i.ok||a&&`error`in a)throw df(i,a);let o=lf(i,`mcp-session-id`)||`local-${Date.now()}-${Math.random().toString(36).slice(2)}`,s={sessionId:o,protocolVersion:lf(i,`mcp-protocol-version`)||a?.result?.protocolVersion,lastUsedAt:Date.now()};return await hf(t,n,o),Sf.set(e,s),s}async function _f(e,t,n,r,i){let a=await gf(e,t,n),o=async e=>{let a={jsonrpc:`2.0`,id:Date.now().toString(),method:r,params:i||{}},o={...n,"mcp-session-id":e},{response:s,payload:c}=await mf(t,o,a),l=0;for(;cf(c)&&l<5&&(l++,c.method===`elicitation/create`);){let e=Kee(c.params||{});({response:s,payload:c}=await mf(t,o,{jsonrpc:`2.0`,id:c.id,result:{action:`accept`,content:e}}))}if(cf(c))throw Error(`Unsupported server request: ${c.method}`);if(!s.ok||!c||`error`in c)throw df(s,c);return c.result};try{let t=await o(a.sessionId);return a.lastUsedAt=Date.now(),Sf.set(e,a),t}catch(r){if(!(r instanceof Cf))throw r;Sf.delete(e),a=await gf(e,t,n);let i=await o(a.sessionId);return a.lastUsedAt=Date.now(),Sf.set(e,a),i}}function vf(e){e&&Sf.delete(e)}async function yf(e,t,n,r){let i=await sf(e,t);if(!i)throw Error(`Remote MCP connection not found`);if(i.reauthRequired)throw new Tf(t);let{connection:a,authType:o,headers:s}=i;if(a.transport!==`streamable_http`)throw Error(`Unsupported remote MCP transport`);try{return await _f(t,a.serverUrl,s,n,r)}catch(i){if(!(i instanceof wf)||i.status!==401||o!==`oauth`)throw i;vf(t);let a=await sf(e,t,{forceRefresh:!0});if(!a||a.reauthRequired)throw new Tf(t);try{return await _f(t,a.connection.serverUrl,a.headers,n,r)}catch(e){throw e instanceof wf&&e.status===401?new Tf(t):e}}}async function bf(e,t){let n=await yf(e,t,`tools/list`);return Array.isArray(n.tools)?n.tools:[]}async function xf(e,t,n,r={}){return yf(e,t,`tools/call`,{name:n,arguments:r})}var Sf,Cf,wf,Tf,Ef=k((()=>{Gee(),Sf=/* @__PURE__ */ new Map,Cf=class extends Error{constructor(e){super(e),this.name=`InvalidRemoteMcpSessionError`}},wf=class extends Error{status;constructor(e,t){super(t),this.name=`HttpRemoteMcpError`,this.status=e}},Tf=class extends Error{connectionId;constructor(e){super(`OAuth reconnect required for remote MCP connection`),this.name=`McpReauthRequiredError`,this.connectionId=e}}}));async function Df(e,t,n,r){let{dirs:i,filename:a}=ri(n);for(let n=0;n<2;n++)try{let n=await Tn(e,t);for(let e of i)n=await n.getDirectoryHandle(e,{create:!0});let o=await n.getFileHandle(a,{create:!0});try{await Mo(o,r);return}catch(t){if(!((t instanceof Error?t.message:String(t)).includes(`Writable file streams are not supported`)&&(await Sn(e)).type===`opfs`))throw t}let s=t.replace(/:/g,`-`);await No([hn(),`groups`,s,...i,a],r);return}catch(e){if(n===0&&xn(e)){bn();continue}throw e}}var Of=k((()=>{En(),ii(),wn(),Io()}));function kf(){return[...jf].sort((e,t)=>e.id.localeCompare(t.id))}function Af(e){return e&&jf.find(t=>t.id===e)||null}var jf,Mf=k((()=>{jf=[{id:`imap`,name:`IMAP Mail`,protocol:`imap`,description:`Read mailboxes and fetch message metadata/content.`,version:`0.1.0`,actions:[`messages.read`,`messages.send`],authTypes:[`basic_userpass`,`oauth`],serviceTypes:[`http_api`],configurableFields:[`host`,`port`,`secure`,`mailboxPath`,`smtpHost`,`smtpPort`,`smtpSecure`,`fromAddress`,`executionMode`,`pollIntervalSec`]}]}));function Nf(e){if(!e||typeof e!=`object`)return null;let t=e;return!t.serviceType||!t.authType?null:{serviceType:t.serviceType,authType:t.authType,providerId:t.providerId||void 0,accountId:t.accountId||void 0,username:t.username||void 0,headerName:t.headerName||void 0,encryptedSecret:t.encryptedSecret||void 0}}function Pf(e){if(!e||typeof e!=`object`)return null;let t=e;return!t.id||!t.label||!t.pluginId||typeof t.enabled!=`boolean`||typeof t.createdAt!=`number`||typeof t.updatedAt!=`number`||!Af(t.pluginId)?null:{id:t.id,label:t.label,pluginId:t.pluginId,enabled:t.enabled,config:t.config&&typeof t.config==`object`?{...t.config}:{},credentialRef:Nf(t.credentialRef),createdAt:t.createdAt,updatedAt:t.updatedAt}}async function Ff(e){let t=await R(e,L.INTEGRATION_CONNECTIONS);if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=Pf(e);t&&n.push(t)}return n}async function If(e,t){await B(e,L.INTEGRATION_CONNECTIONS,t)}async function Lf(e){return Ff(e)}async function Rf(e,t){if(!t)return null;let n=await Ff(e);return n.find(e=>e.id===t)||n.find(e=>e.label.toLowerCase()===t.toLowerCase())||null}async function zf(e,t){if(!t.label?.trim())throw Error(`Email connection label is required`);let n=Af(t.pluginId);if(!n)throw Error(`Unknown email plugin: ${t.pluginId}`);let r=await Ff(e),i=Date.now();if(t.id){let a=r.findIndex(e=>e.id===t.id);if(a!==-1){let o=r[a],s={...o,label:t.label.trim(),pluginId:n.id,enabled:t.enabled??o.enabled,config:t.config?{...t.config}:o.config,updatedAt:i};return r[a]=s,await If(e,r),s}}let a={id:t.id||Pc(),label:t.label.trim(),pluginId:n.id,enabled:t.enabled??!0,config:t.config?{...t.config}:{},credentialRef:null,createdAt:i,updatedAt:i};return r.push(a),await If(e,r),a}async function Bf(e,t,n){if(!t)return null;let r=await Ff(e),i=r.findIndex(e=>e.id===t);if(i===-1)return null;let a={...r[i],credentialRef:n?Nf(n):null,updatedAt:Date.now()};return r[i]=a,await If(e,r),a}async function Vf(e,t){if(!t)return!1;let n=await Ff(e),r=n.filter(e=>e.id!==t);return r.length!==n.length&&(await If(e,r),!0)}var Hf=k((()=>{Dt(),Wt(),zo(),Vc(),Mf()}));function Uf(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n==`string`){let e=n.trim();e&&t.push({path:e});continue}if(!n||typeof n!=`object`)continue;let e=typeof n.path==`string`?n.path.trim():``;if(!e)continue;let r=typeof n.filename==`string`?n.filename.trim():``,i=typeof n.content_type==`string`?n.content_type.trim():``;t.push({path:e,filename:r||void 0,contentType:i||void 0})}return t}var Wf=k((()=>{}));function Gf(e,t,n){if(e==null||e===``||typeof e==`boolean`)return t;let r=typeof e==`number`?e:Number(e);if(!Number.isFinite(r))return t;let i=r;return typeof n?.min==`number`&&(i=Math.max(n.min,i)),typeof n?.max==`number`&&(i=Math.min(n.max,i)),i}function Kf(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[]}function qf(e){if(!Array.isArray(e))return[];let t=e.map(e=>typeof e==`number`?e:Number(e)).filter(e=>Number.isFinite(e)&&e>0).map(e=>Math.floor(e));return Array.from(new Set(t))}var Jf,Yf,Xf,Zf=k((()=>{Jf=Gf,Yf=Kf,Xf=qf}));function Qf(e,t=`attachment.bin`){if(!e)return t;let n=e.replace(/\\/g,`/`).split(`/`).filter(Boolean);return n[n.length-1]||t}function $f(e,t={}){let n=t.replacement??`_`,r=t.fallback??`attachment.bin`,i=e.trim();t.stripControlChars&&(i=i.replace(/[\u0000-\u001f\u007f]+/g,``)),t.stripLeadingDots&&(i=i.replace(/^\.+/,``));let a=t.stripControlChars?/[\\/:*?"<>|]/g:/[\\/:*?"<>|\x00-\x1f\u007f]/g;if(t.collapseReplacement&&n){let e=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);i=i.replace(t.stripControlChars?/[\\/:*?"<>|]+/g:/[\\/:*?"<>|\x00-\x1f\u007f]+/g,n),i=i.replace(RegExp(`${e}+`,`g`),n)}else i=i.replace(a,n);return i=i.trim(),t.stripLeadingDots&&(i=i.replace(/^\.+/,``).trim()),i||r}var ep=k((()=>{}));async function tp(e,t,n,r=!1){let i=(typeof n.username==`string`?n.username.trim():``)||t.credentialRef?.username||(typeof t.config.username==`string`?t.config.username:``);if(!i)return`Error: Integration connection ${t.id} is missing username credentials.`;if(t.credentialRef?.authType===`oauth`){let n=t.credentialRef.accountId;if(!n)return`Error: Integration connection ${t.id} is missing linked OAuth account.`;let a=await Ud(e,void 0,{accountId:n,authMode:`oauth`,forceRefresh:r});if(!a||a.reauthRequired||!a.token){let e=t.credentialRef?.providerId||`the configured`;return`Error: OAuth account reconnect required for integration ${t.id}.\nOpen Settings -> Integrations, edit this email connection, and click Connect OAuth for ${e} to re-authorize.`}return{authType:`oauth`,username:i,accessToken:a.token}}let a=(typeof n.password==`string`?n.password.trim():``)||t.credentialRef?.encryptedSecret&&await Md(t.credentialRef.encryptedSecret)||``;return a?{authType:`basic_userpass`,username:i,password:a}:`Error: Integration connection ${t.id} is missing password credentials.`}var np=k((()=>{Ld(),Kd()}));async function rp(e,t,n,r){let i=$f(r),a=i.lastIndexOf(`.`),o=a>0?i.slice(0,a):i,s=a>0?i.slice(a):``,c=n.trim().replace(/^\/+|\/+$/g,``);for(let n=0;n<1e3;n++){let r=n===0?i:`${o}-${n+1}${s}`,a=c?`${c}/${r}`:r;if(!await Wo(e,t,a))return a}return c?`${c}/${Pc()}-${i}`:`${Pc()}-${i}`}var ip=k((()=>{Go(),Vc(),ep()}));async function ap(e,t,n){let r=typeof t.action==`string`?t.action.trim():``;if(!r)return`Error: manage_email requires action.`;if(r===`list_plugins`){let e=kf();return e.length?e.map(e=>`- ${e.id} (${e.protocol})\n Name: ${e.name}\n Actions: ${e.actions.join(`, `)}\n Auth: ${e.authTypes.join(`, `)}\n Fields: ${e.configurableFields.join(`, `)||`(none)`}`).join(`
283
283
 
@@ -1,40 +1,40 @@
1
1
  import ShadowClawElement from "./shadow-claw-element.js";
2
2
  import { a as showSuccess, i as showInfo, l as toastStore, o as showToast, r as showError, s as showWarning } from "../toast-Ck7OIKDf.js";
3
- import { t as ShadowClaw } from "../shadow-claw-PdOpgTxH.js";
4
- import { t as ShadowClawChat } from "../shadow-claw-chat-B6uuZnJ7.js";
3
+ import { t as ShadowClaw } from "../shadow-claw-DYe9u6Tp.js";
4
+ import { t as ShadowClawChat } from "../shadow-claw-chat-CVc-7ycM.js";
5
5
  import { t as ShadowClawA2UI } from "../shadow-claw-a2ui-WmH9P1jy.js";
6
6
  import { t as ShadowClawPageHeaderActionButton } from "../shadow-claw-page-header-action-button-BXXm5b5N.js";
7
7
  import { ShadowClawA2UIInterceptor } from "./shadow-claw-a2ui-interceptor.js";
8
8
  import { ShadowClawDialog } from "./shadow-claw-dialog.js";
9
- import { t as ShadowClawPageHeader } from "../shadow-claw-page-header-B7LFGQRf.js";
10
- import { t as ShadowClawFiles } from "../shadow-claw-files-DhnHbXKf.js";
9
+ import { t as ShadowClawPageHeader } from "../shadow-claw-page-header-VPjYWfsT.js";
10
+ import { t as ShadowClawFiles } from "../shadow-claw-files-vOa9ZWbr.js";
11
11
  import { t as ShadowClawEmptyState } from "../shadow-claw-empty-state-D9bnqWMF.js";
12
- import { t as ShadowClawFileViewer } from "../shadow-claw-file-viewer-C4x1PtB2.js";
12
+ import { t as ShadowClawFileViewer } from "../shadow-claw-file-viewer-DSqn0hgx.js";
13
13
  import { t as ShadowClawPdfViewer } from "../shadow-claw-pdf-viewer-D-7W4CFV.js";
14
- import { t as ShadowClawTasks } from "../shadow-claw-tasks-CAZua0-j.js";
15
- import { n as ShadowClawTerminal } from "../shadow-claw-terminal-B2YJhkJL.js";
16
- import { t as ShadowClawPages } from "../shadow-claw-pages-DLspFqdK.js";
17
- import { t as ShadowClawSettings } from "../shadow-claw-settings-NbvzXASD.js";
18
- import { t as ShadowClawPeerJs } from "../shadow-claw-peerjs-D8xWwuWR.js";
19
- import { t as ShadowClawChannelConfig } from "../shadow-claw-channel-config-ChdZ1iB8.js";
20
- import { t as ShadowClawChannels } from "../shadow-claw-channels-CK9sc7h_.js";
14
+ import { t as ShadowClawTasks } from "../shadow-claw-tasks-BQBe4lVi.js";
15
+ import { n as ShadowClawTerminal } from "../shadow-claw-terminal-DPEzTxXv.js";
16
+ import { t as ShadowClawPages } from "../shadow-claw-pages-DXrM6hgZ.js";
17
+ import { t as ShadowClawSettings } from "../shadow-claw-settings-DMTx6OS9.js";
18
+ import { t as ShadowClawPeerJs } from "../shadow-claw-peerjs-D3xonez5.js";
19
+ import { t as ShadowClawChannelConfig } from "../shadow-claw-channel-config-buXoz2xv.js";
20
+ import { t as ShadowClawChannels } from "../shadow-claw-channels-5yVJ1gLk.js";
21
21
  import { t as ShadowClawProviderModelPicker } from "../shadow-claw-provider-model-picker-DNnrStnN.js";
22
22
  import { t as ShadowClawProviderModuleSettings } from "../shadow-claw-provider-module-settings-3sCTnCSp.js";
23
- import { t as ShadowClawConversations } from "../shadow-claw-conversations-Dc_Xk2mB.js";
23
+ import { t as ShadowClawConversations } from "../shadow-claw-conversations-PGK5zqn3.js";
24
24
  import { t as ShadowClawToast } from "../shadow-claw-toast-DEqsSFJH.js";
25
- import { t as ShadowClawTools } from "../shadow-claw-tools-CkZWxxTm.js";
25
+ import { t as ShadowClawTools } from "../shadow-claw-tools-BCnU8FaK.js";
26
26
  import { t as ShadowClawActions } from "../shadow-claw-actions-G99P9oxr.js";
27
27
  import { t as ShadowClawCard } from "../shadow-claw-card-D9azfSMu.js";
28
- import { t as ShadowClawAccounts } from "../shadow-claw-accounts-3bR76EOb.js";
29
- import { t as ShadowClawControlPlane } from "../shadow-claw-control-plane-BpRcl312.js";
30
- import { t as ShadowClawGit } from "../shadow-claw-git-BeQ1ElUd.js";
31
- import { t as ShadowClawIntegrations } from "../shadow-claw-integrations-Bbdolk3w.js";
32
- import { t as ShadowClawLlm } from "../shadow-claw-llm-DPda4L3C.js";
33
- import { t as ShadowClawMcpRemote } from "../shadow-claw-mcp-remote-Dn9c30WI.js";
34
- import { t as ShadowClawNetworking } from "../shadow-claw-networking-zqNuyn3-.js";
35
- import { t as ShadowClawNotifications } from "../shadow-claw-notifications-DFgdo33v.js";
36
- import { t as ShadowClawStorage } from "../shadow-claw-storage-B_NAoZmd.js";
37
- import { t as ShadowClawTaskServer } from "../shadow-claw-task-server-BaQJXhYJ.js";
38
- import { t as ShadowClawWebvm } from "../shadow-claw-webvm-BL9cgrP9.js";
28
+ import { t as ShadowClawAccounts } from "../shadow-claw-accounts-D2URoHys.js";
29
+ import { t as ShadowClawControlPlane } from "../shadow-claw-control-plane-B5vsF91B.js";
30
+ import { t as ShadowClawGit } from "../shadow-claw-git-D54Z85Bj.js";
31
+ import { t as ShadowClawIntegrations } from "../shadow-claw-integrations-BTubMH9d.js";
32
+ import { t as ShadowClawLlm } from "../shadow-claw-llm-8koGTNYs.js";
33
+ import { t as ShadowClawMcpRemote } from "../shadow-claw-mcp-remote-C2jwBsQt.js";
34
+ import { t as ShadowClawNetworking } from "../shadow-claw-networking-BV-rna16.js";
35
+ import { t as ShadowClawNotifications } from "../shadow-claw-notifications-Dku7VBLk.js";
36
+ import { t as ShadowClawStorage } from "../shadow-claw-storage-BJLnukxa.js";
37
+ import { t as ShadowClawTaskServer } from "../shadow-claw-task-server-DcMj20hD.js";
38
+ import { t as ShadowClawWebvm } from "../shadow-claw-webvm-CnW-hoJ8.js";
39
39
 
40
40
  export { ShadowClaw, ShadowClawA2UI, ShadowClawA2UIInterceptor, ShadowClawAccounts, ShadowClawActions, ShadowClawCard, ShadowClawChannelConfig, ShadowClawChannels, ShadowClawChat, ShadowClawControlPlane, ShadowClawConversations, ShadowClawDialog, ShadowClawElement, ShadowClawEmptyState, ShadowClawFileViewer, ShadowClawFiles, ShadowClawGit, ShadowClawIntegrations, ShadowClawLlm, ShadowClawMcpRemote, ShadowClawNetworking, ShadowClawNotifications, ShadowClawPageHeader, ShadowClawPageHeaderActionButton, ShadowClawPages, ShadowClawPdfViewer, ShadowClawPeerJs, ShadowClawProviderModelPicker, ShadowClawProviderModuleSettings, ShadowClawSettings, ShadowClawStorage, ShadowClawTaskServer, ShadowClawTasks, ShadowClawTerminal, ShadowClawToast, ShadowClawTools, ShadowClawWebvm, showError, showInfo, showSuccess, showToast, showWarning, toastStore };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawAccounts } from "../../shadow-claw-accounts-3bR76EOb.js";
1
+ import { t as ShadowClawAccounts } from "../../shadow-claw-accounts-D2URoHys.js";
2
2
 
3
3
  export { ShadowClawAccounts };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawChannelConfig } from "../../shadow-claw-channel-config-ChdZ1iB8.js";
1
+ import { t as ShadowClawChannelConfig } from "../../shadow-claw-channel-config-buXoz2xv.js";
2
2
 
3
3
  export { ShadowClawChannelConfig };
@@ -1,3 +1,3 @@
1
- import { n as getControlPlaneTargetAddressSpace, t as ShadowClawControlPlane } from "../../shadow-claw-control-plane-BpRcl312.js";
1
+ import { n as getControlPlaneTargetAddressSpace, t as ShadowClawControlPlane } from "../../shadow-claw-control-plane-B5vsF91B.js";
2
2
 
3
3
  export { ShadowClawControlPlane, getControlPlaneTargetAddressSpace };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawGit } from "../../shadow-claw-git-BeQ1ElUd.js";
1
+ import { t as ShadowClawGit } from "../../shadow-claw-git-D54Z85Bj.js";
2
2
 
3
3
  export { ShadowClawGit };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawIntegrations } from "../../shadow-claw-integrations-Bbdolk3w.js";
1
+ import { t as ShadowClawIntegrations } from "../../shadow-claw-integrations-BTubMH9d.js";
2
2
 
3
3
  export { ShadowClawIntegrations };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawLlm } from "../../shadow-claw-llm-DPda4L3C.js";
1
+ import { t as ShadowClawLlm } from "../../shadow-claw-llm-8koGTNYs.js";
2
2
 
3
3
  export { ShadowClawLlm };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawMcpRemote } from "../../shadow-claw-mcp-remote-Dn9c30WI.js";
1
+ import { t as ShadowClawMcpRemote } from "../../shadow-claw-mcp-remote-C2jwBsQt.js";
2
2
 
3
3
  export { ShadowClawMcpRemote };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawNetworking } from "../../shadow-claw-networking-zqNuyn3-.js";
1
+ import { t as ShadowClawNetworking } from "../../shadow-claw-networking-BV-rna16.js";
2
2
 
3
3
  export { ShadowClawNetworking };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawNotifications } from "../../shadow-claw-notifications-DFgdo33v.js";
1
+ import { t as ShadowClawNotifications } from "../../shadow-claw-notifications-Dku7VBLk.js";
2
2
 
3
3
  export { ShadowClawNotifications };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawPeerJs } from "../../shadow-claw-peerjs-D8xWwuWR.js";
1
+ import { t as ShadowClawPeerJs } from "../../shadow-claw-peerjs-D3xonez5.js";
2
2
 
3
3
  export { ShadowClawPeerJs };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawStorage } from "../../shadow-claw-storage-B_NAoZmd.js";
1
+ import { t as ShadowClawStorage } from "../../shadow-claw-storage-BJLnukxa.js";
2
2
 
3
3
  export { ShadowClawStorage };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawTaskServer } from "../../shadow-claw-task-server-BaQJXhYJ.js";
1
+ import { t as ShadowClawTaskServer } from "../../shadow-claw-task-server-DcMj20hD.js";
2
2
 
3
3
  export { ShadowClawTaskServer };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawWebvm } from "../../shadow-claw-webvm-BL9cgrP9.js";
1
+ import { t as ShadowClawWebvm } from "../../shadow-claw-webvm-CnW-hoJ8.js";
2
2
 
3
3
  export { ShadowClawWebvm };
@@ -1,4 +1,7 @@
1
1
  import type { ShadowClawDatabase } from "../../../db/types.js";
2
+ export declare function recordHistoryReplaceState(state: any): void;
3
+ export declare function getLastHistoryReplaceState(): any;
4
+ export declare function clearLastHistoryReplaceState(): void;
2
5
  export declare function getRoute(db: ShadowClawDatabase, ev: Event): {
3
6
  parsedUrl: URL;
4
7
  navigateEvent: any;
@@ -4,7 +4,7 @@
4
4
  export declare function syncSlottedSidebarActiveLinks(host: HTMLElement | null, currentUrl?: URL): void;
5
5
  /**
6
6
  * Sets up listeners so slotted sidebar active links stay in sync whenever
7
- * the URL changes (popstate, Navigation API navigate, or iframe replaceState).
7
+ * the URL changes (popstate, Navigation API navigate, replaceState, or feed scroll events).
8
8
  * Returns a cleanup function to remove the listeners.
9
9
  */
10
10
  export declare function setupSlottedSidebarActiveLinks(host: HTMLElement | null): () => void;
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawAccounts } from "../shadow-claw-accounts-3bR76EOb.js";
1
+ import { t as ShadowClawAccounts } from "../shadow-claw-accounts-D2URoHys.js";
2
2
 
3
3
  export { ShadowClawAccounts };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawChannelConfig } from "../shadow-claw-channel-config-ChdZ1iB8.js";
1
+ import { t as ShadowClawChannelConfig } from "../shadow-claw-channel-config-buXoz2xv.js";
2
2
 
3
3
  export { ShadowClawChannelConfig };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawChannels } from "../shadow-claw-channels-CK9sc7h_.js";
1
+ import { t as ShadowClawChannels } from "../shadow-claw-channels-5yVJ1gLk.js";
2
2
 
3
3
  export { ShadowClawChannels };
@@ -1,3 +1,3 @@
1
- import { t as ShadowClawChat } from "../shadow-claw-chat-B6uuZnJ7.js";
1
+ import { t as ShadowClawChat } from "../shadow-claw-chat-CVc-7ycM.js";
2
2
 
3
3
  export { ShadowClawChat };