shadow-claw 1.32.0 → 1.33.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 (220) hide show
  1. package/.well-known/mcp/server-card.json +1 -1
  2. package/.well-known/mcp.json +1 -1
  3. package/dist/electron/main.cjs +1 -1
  4. package/dist/lib/components/index.js +26 -26
  5. package/dist/lib/components/settings/shadow-claw-accounts.js +1 -1
  6. package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
  7. package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
  8. package/dist/lib/components/settings/shadow-claw-git.js +1 -1
  9. package/dist/lib/components/settings/shadow-claw-integrations.js +1 -1
  10. package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
  11. package/dist/lib/components/settings/shadow-claw-mcp-remote.js +1 -1
  12. package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
  13. package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
  14. package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
  15. package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
  16. package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
  17. package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
  18. package/dist/lib/components/shadow-claw-a2ui.js +1 -1
  19. package/dist/lib/components/shadow-claw-accounts.js +1 -1
  20. package/dist/lib/components/shadow-claw-channel-config.js +1 -1
  21. package/dist/lib/components/shadow-claw-channels.js +1 -1
  22. package/dist/lib/components/shadow-claw-chat.js +1 -1
  23. package/dist/lib/components/shadow-claw-control-plane.js +1 -1
  24. package/dist/lib/components/shadow-claw-conversations.js +1 -1
  25. package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
  26. package/dist/lib/components/shadow-claw-files.js +1 -1
  27. package/dist/lib/components/shadow-claw-git.js +1 -1
  28. package/dist/lib/components/shadow-claw-integrations.js +1 -1
  29. package/dist/lib/components/shadow-claw-llm.js +1 -1
  30. package/dist/lib/components/shadow-claw-mcp-remote.js +1 -1
  31. package/dist/lib/components/shadow-claw-networking.js +1 -1
  32. package/dist/lib/components/shadow-claw-notifications.js +1 -1
  33. package/dist/lib/components/shadow-claw-page-header.js +1 -1
  34. package/dist/lib/components/shadow-claw-pages.js +1 -1
  35. package/dist/lib/components/shadow-claw-peerjs.js +1 -1
  36. package/dist/lib/components/shadow-claw-settings.js +1 -1
  37. package/dist/lib/components/shadow-claw-storage.js +1 -1
  38. package/dist/lib/components/shadow-claw-task-server.js +1 -1
  39. package/dist/lib/components/shadow-claw-tasks.js +1 -1
  40. package/dist/lib/components/shadow-claw-terminal.js +1 -1
  41. package/dist/lib/components/shadow-claw-tools.js +1 -1
  42. package/dist/lib/components/shadow-claw-webvm.js +1 -1
  43. package/dist/lib/components/shadow-claw.js +1 -1
  44. package/dist/lib/{config-DjZ9QWc4.js → config-BcFbkaQv.js} +21 -4
  45. package/dist/lib/config-BcFbkaQv.js.map +1 -0
  46. package/dist/lib/{configurePeerJs-DD3G3Pms.js → configurePeerJs-CBMPHbwa.js} +3 -3
  47. package/dist/lib/{configurePeerJs-DD3G3Pms.js.map → configurePeerJs-CBMPHbwa.js.map} +1 -1
  48. package/dist/lib/{connections-BURqMIUv.js → connections-PZrUDf49.js} +2 -2
  49. package/dist/lib/{connections-BURqMIUv.js.map → connections-PZrUDf49.js.map} +1 -1
  50. package/dist/lib/{downloadGroupFile-B8J4up2a.js → downloadGroupFile-DSRUa9Au.js} +2 -2
  51. package/dist/lib/{downloadGroupFile-B8J4up2a.js.map → downloadGroupFile-DSRUa9Au.js.map} +1 -1
  52. package/dist/lib/{file-viewer-DoHM75Jz.js → file-viewer-11VVOpJv.js} +5 -5
  53. package/dist/lib/{file-viewer-DoHM75Jz.js.map → file-viewer-11VVOpJv.js.map} +1 -1
  54. package/dist/lib/{getGroupDir-QrN2aTo8.js → getGroupDir-BxKMYPPm.js} +3 -3
  55. package/dist/lib/{getGroupDir-QrN2aTo8.js.map → getGroupDir-BxKMYPPm.js.map} +1 -1
  56. package/dist/lib/{git-Brr7JIbs.js → git-BppibnJW.js} +3 -3
  57. package/dist/lib/{git-Brr7JIbs.js.map → git-BppibnJW.js.map} +1 -1
  58. package/dist/lib/{iframe-sanitizer-Bujgq14T.js → iframe-sanitizer-Dp8EYffI.js} +2 -2
  59. package/dist/lib/{iframe-sanitizer-Bujgq14T.js.map → iframe-sanitizer-Dp8EYffI.js.map} +1 -1
  60. package/dist/lib/index.js +27 -27
  61. package/dist/lib/{initChatSplitResize-BjiWoqC_.js → initChatSplitResize-CE_kWaLf.js} +2 -2
  62. package/dist/lib/{initChatSplitResize-BjiWoqC_.js.map → initChatSplitResize-CE_kWaLf.js.map} +1 -1
  63. package/dist/lib/{initControlPlane-3TUdhRBM.js → initControlPlane-BRIIOzoH.js} +18 -17
  64. package/dist/lib/{initControlPlane-3TUdhRBM.js.map → initControlPlane-BRIIOzoH.js.map} +1 -1
  65. package/dist/lib/{markdown-BFUTPQoO.js → markdown-Cq4sVwUT.js} +4 -4
  66. package/dist/lib/{markdown-BFUTPQoO.js.map → markdown-Cq4sVwUT.js.map} +1 -1
  67. package/dist/lib/{mcp-reconnect-BxJ77WSb.js → mcp-reconnect-CoHDMjmY.js} +2 -2
  68. package/dist/lib/{mcp-reconnect-BxJ77WSb.js.map → mcp-reconnect-CoHDMjmY.js.map} +1 -1
  69. package/dist/lib/{memoryStorage-D3FBwO9T.js → memoryStorage-DcFWrn_y.js} +2 -2
  70. package/dist/lib/{memoryStorage-D3FBwO9T.js.map → memoryStorage-DcFWrn_y.js.map} +1 -1
  71. package/dist/lib/{orchestrator-DW5l2bbW.js → orchestrator-C3TgDZvq.js} +81 -18
  72. package/dist/lib/{orchestrator-DW5l2bbW.js.map → orchestrator-C3TgDZvq.js.map} +1 -1
  73. package/dist/lib/{orchestrator-DLnCmeTZ.js → orchestrator-Ce9_lmL2.js} +12 -12
  74. package/dist/lib/{orchestrator-DLnCmeTZ.js.map → orchestrator-Ce9_lmL2.js.map} +1 -1
  75. package/dist/lib/{peerjs-BXlMuIQn.js → peerjs-PTYQ7yEG.js} +6 -6
  76. package/dist/lib/{peerjs-BXlMuIQn.js.map → peerjs-PTYQ7yEG.js.map} +1 -1
  77. package/dist/lib/{push-client-B419nn-i.js → push-client-DDV5Rcg6.js} +3 -3
  78. package/dist/lib/{push-client-B419nn-i.js.map → push-client-DDV5Rcg6.js.map} +1 -1
  79. package/dist/lib/{readGroupFileBytes-CSA7u-nJ.js → readGroupFileBytes-7C8G-yps.js} +2 -2
  80. package/dist/lib/{readGroupFileBytes-CSA7u-nJ.js.map → readGroupFileBytes-7C8G-yps.js.map} +1 -1
  81. package/dist/lib/{shadow-claw-DmMO4vVG.js → shadow-claw-WrWoPqFx.js} +10 -10
  82. package/dist/lib/{shadow-claw-DmMO4vVG.js.map → shadow-claw-WrWoPqFx.js.map} +1 -1
  83. package/dist/lib/{shadow-claw-a2ui-2I5nffIn.js → shadow-claw-a2ui-CcmJNXQP.js} +2 -2
  84. package/dist/lib/{shadow-claw-a2ui-2I5nffIn.js.map → shadow-claw-a2ui-CcmJNXQP.js.map} +1 -1
  85. package/dist/lib/{shadow-claw-accounts-DMb0y4ca.js → shadow-claw-accounts-CcB2429E.js} +3 -3
  86. package/dist/lib/{shadow-claw-accounts-DMb0y4ca.js.map → shadow-claw-accounts-CcB2429E.js.map} +1 -1
  87. package/dist/lib/{shadow-claw-channel-config-BhxHf6wZ.js → shadow-claw-channel-config-C4v0h8oa.js} +3 -3
  88. package/dist/lib/{shadow-claw-channel-config-BhxHf6wZ.js.map → shadow-claw-channel-config-C4v0h8oa.js.map} +1 -1
  89. package/dist/lib/{shadow-claw-channels-B5vzE9Z2.js → shadow-claw-channels-CyV88k9T.js} +3 -3
  90. package/dist/lib/{shadow-claw-channels-B5vzE9Z2.js.map → shadow-claw-channels-CyV88k9T.js.map} +1 -1
  91. package/dist/lib/{shadow-claw-chat-BsYnJ4-G.js → shadow-claw-chat-DSYtuZod.js} +11 -11
  92. package/dist/lib/{shadow-claw-chat-BsYnJ4-G.js.map → shadow-claw-chat-DSYtuZod.js.map} +1 -1
  93. package/dist/lib/{shadow-claw-control-plane-DqcgQsun.js → shadow-claw-control-plane-DBSGuDT1.js} +7 -7
  94. package/dist/lib/{shadow-claw-control-plane-DqcgQsun.js.map → shadow-claw-control-plane-DBSGuDT1.js.map} +1 -1
  95. package/dist/lib/{shadow-claw-conversations-B9Pn58g3.js → shadow-claw-conversations-Cp8pK4PM.js} +5 -5
  96. package/dist/lib/{shadow-claw-conversations-B9Pn58g3.js.map → shadow-claw-conversations-Cp8pK4PM.js.map} +1 -1
  97. package/dist/lib/{shadow-claw-file-viewer-DL6c4oPK.js → shadow-claw-file-viewer-B8G8yo48.js} +8 -8
  98. package/dist/lib/{shadow-claw-file-viewer-DL6c4oPK.js.map → shadow-claw-file-viewer-B8G8yo48.js.map} +1 -1
  99. package/dist/lib/{shadow-claw-files-C_ksPb8W.js → shadow-claw-files-D1COKzuC.js} +9 -9
  100. package/dist/lib/{shadow-claw-files-C_ksPb8W.js.map → shadow-claw-files-D1COKzuC.js.map} +1 -1
  101. package/dist/lib/{shadow-claw-git-jwsY7L1N.js → shadow-claw-git-60tWU4Ee.js} +6 -6
  102. package/dist/lib/{shadow-claw-git-jwsY7L1N.js.map → shadow-claw-git-60tWU4Ee.js.map} +1 -1
  103. package/dist/lib/{shadow-claw-integrations-yT7j07TM.js → shadow-claw-integrations-Bw1cG1ze.js} +4 -4
  104. package/dist/lib/{shadow-claw-integrations-yT7j07TM.js.map → shadow-claw-integrations-Bw1cG1ze.js.map} +1 -1
  105. package/dist/lib/{shadow-claw-llm-CEPJh1Jh.js → shadow-claw-llm-By5CvsFJ.js} +6 -6
  106. package/dist/lib/{shadow-claw-llm-CEPJh1Jh.js.map → shadow-claw-llm-By5CvsFJ.js.map} +1 -1
  107. package/dist/lib/{shadow-claw-mcp-remote-DGDWjByQ.js → shadow-claw-mcp-remote-BaNODd1v.js} +4 -4
  108. package/dist/lib/{shadow-claw-mcp-remote-DGDWjByQ.js.map → shadow-claw-mcp-remote-BaNODd1v.js.map} +1 -1
  109. package/dist/lib/{shadow-claw-networking-Bi4yvc73.js → shadow-claw-networking-DtZ5bsTz.js} +2 -2
  110. package/dist/lib/{shadow-claw-networking-Bi4yvc73.js.map → shadow-claw-networking-DtZ5bsTz.js.map} +1 -1
  111. package/dist/lib/{shadow-claw-notifications-C-JgGqQx.js → shadow-claw-notifications-C3VEba_A.js} +3 -3
  112. package/dist/lib/{shadow-claw-notifications-C-JgGqQx.js.map → shadow-claw-notifications-C3VEba_A.js.map} +1 -1
  113. package/dist/lib/{shadow-claw-page-header-DrAcWCZ9.js → shadow-claw-page-header-BLowJopA.js} +2 -2
  114. package/dist/lib/{shadow-claw-page-header-DrAcWCZ9.js.map → shadow-claw-page-header-BLowJopA.js.map} +1 -1
  115. package/dist/lib/{shadow-claw-pages-OEOClgA8.js → shadow-claw-pages-CpeUV-hw.js} +9 -9
  116. package/dist/lib/{shadow-claw-pages-OEOClgA8.js.map → shadow-claw-pages-CpeUV-hw.js.map} +1 -1
  117. package/dist/lib/{shadow-claw-peerjs-DmC2CV-9.js → shadow-claw-peerjs-DYAzJbTy.js} +3 -3
  118. package/dist/lib/{shadow-claw-peerjs-DmC2CV-9.js.map → shadow-claw-peerjs-DYAzJbTy.js.map} +1 -1
  119. package/dist/lib/{shadow-claw-settings-xAtFog0T.js → shadow-claw-settings-ByxwW3WK.js} +9 -9
  120. package/dist/lib/{shadow-claw-settings-xAtFog0T.js.map → shadow-claw-settings-ByxwW3WK.js.map} +1 -1
  121. package/dist/lib/{shadow-claw-storage-B4UHl-po.js → shadow-claw-storage-CsSPYVDJ.js} +5 -5
  122. package/dist/lib/{shadow-claw-storage-B4UHl-po.js.map → shadow-claw-storage-CsSPYVDJ.js.map} +1 -1
  123. package/dist/lib/{shadow-claw-task-server-B0eWzg57.js → shadow-claw-task-server-De2WCEw4.js} +2 -2
  124. package/dist/lib/{shadow-claw-task-server-B0eWzg57.js.map → shadow-claw-task-server-De2WCEw4.js.map} +1 -1
  125. package/dist/lib/{shadow-claw-tasks-HHU_8Gyg.js → shadow-claw-tasks-zHWT4GaE.js} +7 -7
  126. package/dist/lib/{shadow-claw-tasks-HHU_8Gyg.js.map → shadow-claw-tasks-zHWT4GaE.js.map} +1 -1
  127. package/dist/lib/{shadow-claw-terminal-CdC2G6Zz.js → shadow-claw-terminal-Bpawfv4N.js} +2 -2
  128. package/dist/lib/{shadow-claw-terminal-CdC2G6Zz.js.map → shadow-claw-terminal-Bpawfv4N.js.map} +1 -1
  129. package/dist/lib/{shadow-claw-tools-2AICxVXA.js → shadow-claw-tools-BbKdWcps.js} +7 -7
  130. package/dist/lib/{shadow-claw-tools-2AICxVXA.js.map → shadow-claw-tools-BbKdWcps.js.map} +1 -1
  131. package/dist/lib/{shadow-claw-webvm-Cy-Ia2vs.js → shadow-claw-webvm-DLqK0AxW.js} +3 -3
  132. package/dist/lib/{shadow-claw-webvm-Cy-Ia2vs.js.map → shadow-claw-webvm-DLqK0AxW.js.map} +1 -1
  133. package/dist/lib/subsystems/mcp/webmcp.d.ts +37 -0
  134. package/dist/lib/subsystems/providers/model-registry.d.ts +4 -1
  135. package/dist/lib/subsystems/providers/providers.d.ts +10 -0
  136. package/dist/lib/{syncWebMcpRegistration-CaAPPg2V.js → syncWebMcpRegistration-mlbbvcdm.js} +5 -5
  137. package/dist/lib/{syncWebMcpRegistration-CaAPPg2V.js.map → syncWebMcpRegistration-mlbbvcdm.js.map} +1 -1
  138. package/dist/lib/{tools-f1WPNDSS.js → tools-Bb2ujM2E.js} +4 -4
  139. package/dist/lib/{tools-f1WPNDSS.js.map → tools-Bb2ujM2E.js.map} +1 -1
  140. package/dist/lib/utils/index.js +1 -1
  141. package/dist/lib/utils/utils.js +1 -1
  142. package/dist/lib/{utils-B99XP70b.js → utils-mpsYPfS7.js} +3 -3
  143. package/dist/lib/{utils-B99XP70b.js.map → utils-mpsYPfS7.js.map} +1 -1
  144. package/dist/lib/webmcp-BVR2lBVo.js +1544 -0
  145. package/dist/lib/webmcp-BVR2lBVo.js.map +1 -0
  146. package/dist/public/.well-known/mcp/server-card.json +1 -1
  147. package/dist/public/.well-known/mcp.json +1 -1
  148. package/dist/public/agent.worker.js +44 -44
  149. package/dist/public/config-BqecTktB.js +1 -0
  150. package/dist/public/{configurePeerJs--JGpJVti.js → configurePeerJs-BPKfWuEt.js} +1 -1
  151. package/dist/public/{connections-6575KDGE.js → connections-C_3tYsmX.js} +1 -1
  152. package/dist/public/{custom-element-security-Da_6HQ6X.js → custom-element-security-DXwU3Lae.js} +1 -1
  153. package/dist/public/docs/example/article/index.html +2 -2
  154. package/dist/public/docs/publishing/index.html +2 -2
  155. package/dist/public/docs/skill-creator/index.html +2 -2
  156. package/dist/public/docs/subsystems/tools.md +4 -3
  157. package/dist/public/docs/subsystems/webmcp.md +58 -13
  158. package/dist/public/{downloadGroupFile-Dj-AMNsd.js → downloadGroupFile-DTyf5DIC.js} +1 -1
  159. package/dist/public/{e2e-bridge-CbYqdMp-.js → e2e-bridge-DXwWCQKw.js} +1 -1
  160. package/dist/public/{file-viewer-vHJ5Zsgk.js → file-viewer-ConEyDDG.js} +1 -1
  161. package/dist/public/{getGroupDir-BwprrdrQ.js → getGroupDir-ZfZsiq6d.js} +1 -1
  162. package/dist/public/{git-8F7wvoUB.js → git-BtBaLC1-.js} +2 -2
  163. package/dist/public/{iframe-sanitizer-viROQkRn.js → iframe-sanitizer-Corkvo_d.js} +1 -1
  164. package/dist/public/index.html +2 -2
  165. package/dist/public/index.js +1 -1
  166. package/dist/public/{initChatSplitResize-BA18wLQQ.js → initChatSplitResize-CUc-TEmT.js} +1 -1
  167. package/dist/public/{initControlPlane-C5v0FtJE.js → initControlPlane-B_uYS8a4.js} +1 -1
  168. package/dist/public/main/index.html +2 -2
  169. package/dist/public/main/memory/index.html +2 -2
  170. package/dist/public/{markdown-eFKxxpVP.js → markdown-Cfa6GuJs.js} +1 -1
  171. package/dist/public/{mcp-reconnect-CBHuaYdF.js → mcp-reconnect-CUOkdPEz.js} +1 -1
  172. package/dist/public/{memoryStorage-C1llaYus.js → memoryStorage-Bh8fjmip.js} +1 -1
  173. package/dist/public/{orchestrator-DNr2HDI2.js → orchestrator-BcSzrg6E.js} +2 -2
  174. package/dist/public/{orchestrator-BeJfwtvz.js → orchestrator-Bi5OdVZD.js} +11 -11
  175. package/dist/public/{peerjs-mG30TAJ_.js → peerjs-CzCXG-NW.js} +1 -1
  176. package/dist/public/{push-client-C2zMT3Sf.js → push-client-Cr3Ruahp.js} +1 -1
  177. package/dist/public/service-worker.js +1 -1
  178. package/dist/public/{shadow-claw-Ble6l0Iw.js → shadow-claw-CzUYuuOa.js} +2 -2
  179. package/dist/public/{shadow-claw-accounts-D1y-zbMs.js → shadow-claw-accounts-BgIHB_aP.js} +1 -1
  180. package/dist/public/{shadow-claw-channels-D_xfBoWp.js → shadow-claw-channels-Ce_trJ5D.js} +1 -1
  181. package/dist/public/{shadow-claw-chat-D_Lbi5oH.js → shadow-claw-chat-CdECLLwL.js} +1 -1
  182. package/dist/public/{shadow-claw-control-plane-CrnA5lM0.js → shadow-claw-control-plane-DM62UmOz.js} +2 -2
  183. package/dist/public/{shadow-claw-conversations-BN-hFmN1.js → shadow-claw-conversations-AM5g3C00.js} +1 -1
  184. package/dist/public/{shadow-claw-file-viewer-BKEpzpbx.js → shadow-claw-file-viewer-BP7gWS5g.js} +1 -1
  185. package/dist/public/{shadow-claw-files-DDZMk5AA.js → shadow-claw-files-RPPGszcK.js} +1 -1
  186. package/dist/public/{shadow-claw-git-CqOO97Re.js → shadow-claw-git-BsHEvLrb.js} +2 -2
  187. package/dist/public/{shadow-claw-integrations-CRGL78Fy.js → shadow-claw-integrations-B0vbcOqg.js} +1 -1
  188. package/dist/public/{shadow-claw-llm-DoGxEHQL.js → shadow-claw-llm-FNNamrc_.js} +2 -2
  189. package/dist/public/{shadow-claw-mcp-remote-DyGnK4S_.js → shadow-claw-mcp-remote-7mDgniQu.js} +1 -1
  190. package/dist/public/{shadow-claw-networking-DJeCdb7e.js → shadow-claw-networking-CGsetaLp.js} +1 -1
  191. package/dist/public/{shadow-claw-notifications-hSKJeMXb.js → shadow-claw-notifications-pnwRcR-4.js} +1 -1
  192. package/dist/public/{shadow-claw-page-header-DA-FG08G.js → shadow-claw-page-header-BUy15Poz.js} +1 -1
  193. package/dist/public/{shadow-claw-pages-DTS98Zbi.js → shadow-claw-pages-ILAjGWNk.js} +1 -1
  194. package/dist/public/{shadow-claw-settings-5w0ce8SP.js → shadow-claw-settings-Bx5IgVqN.js} +3 -3
  195. package/dist/public/{shadow-claw-storage-DqlVt27X.js → shadow-claw-storage-PAtNykaF.js} +1 -1
  196. package/dist/public/{shadow-claw-task-server-ByZwKI6S.js → shadow-claw-task-server-Cbbi_2OO.js} +1 -1
  197. package/dist/public/{shadow-claw-tasks-Dc4G4zBu.js → shadow-claw-tasks-B-jKYWZJ.js} +1 -1
  198. package/dist/public/{shadow-claw-terminal-DvusP7wg.js → shadow-claw-terminal-BRejND-Z.js} +1 -1
  199. package/dist/public/{shadow-claw-tools-BEsid8q-.js → shadow-claw-tools-DNQe3oa-.js} +1 -1
  200. package/dist/public/{shadow-claw-webvm-BWlIeK78.js → shadow-claw-webvm-BFuwRifU.js} +1 -1
  201. package/dist/public/{syncWebMcpRegistration-CqVCB6m8.js → syncWebMcpRegistration-FxKAPwaz.js} +1 -1
  202. package/dist/public/theme-init.js +1 -1
  203. package/dist/public/{tools-Cp1gequ8.js → tools-BwQKGsro.js} +1 -1
  204. package/dist/public/transformers-js.worker.js +1 -1
  205. package/dist/public/webmcp-C28PAlfy.js +1 -0
  206. package/dist/server.js +1 -1
  207. package/package.json +3 -3
  208. package/src/core/utils/initControlPlane.test.ts +122 -1
  209. package/src/core/utils/initControlPlane.ts +12 -8
  210. package/src/subsystems/mcp/webmcp.test.ts +253 -1
  211. package/src/subsystems/mcp/webmcp.ts +147 -4
  212. package/src/subsystems/providers/model-registry.test.ts +139 -0
  213. package/src/subsystems/providers/model-registry.ts +54 -2
  214. package/src/subsystems/providers/providers.test.ts +329 -0
  215. package/src/subsystems/providers/providers.ts +135 -11
  216. package/dist/lib/config-DjZ9QWc4.js.map +0 -1
  217. package/dist/lib/webmcp-BC8_WafM.js +0 -1710
  218. package/dist/lib/webmcp-BC8_WafM.js.map +0 -1
  219. package/dist/public/config-Bnwx4EfS.js +0 -1
  220. package/dist/public/webmcp-DBONjQWd.js +0 -2
@@ -1,5 +1,5 @@
1
- <!doctype html><html lang="en"><head><title>ShadowClaw</title><meta charset="utf-8"><meta name="revision" content="979d27349392e33a2f52555e93b057de32865e31" /><meta name="version" content="1.32.0" /><meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"><meta name="description" content="ShadowClaw - Browser-native AI agent." /><link rel="canonical" href="https://xt-ml.github.io/shadow-claw/"><meta property="og:title" content="ShadowClaw"><meta property="og:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta property="og:type" content="website"><meta property="og:url" content="https://xt-ml.github.io/shadow-claw/"><meta property="og:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><meta name="twitter:card" content="summary"><meta name="twitter:title" content="ShadowClaw"><meta name="twitter:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta name="twitter:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"SoftwareApplication","@id":"https://xt-ml.github.io/shadow-claw/#software","name":"ShadowClaw","description":"Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.","url":"https://xt-ml.github.io/shadow-claw/","applicationCategory":"DeveloperApplication","operatingSystem":"Web, Browser, Desktop","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"author":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"},"codeRepository":"https://github.com/xt-ml/shadow-claw","license":"https://github.com/xt-ml/shadow-claw/blob/main/LICENSE"},{"@type":"WebSite","@id":"https://xt-ml.github.io/shadow-claw/#website","url":"https://xt-ml.github.io/shadow-claw/","name":"ShadowClaw","description":"Official website and live deployment of ShadowClaw browser-native AI assistant.","publisher":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"}},{"@type":"Organization","@id":"https://xt-ml.github.io/shadow-claw/#organization","name":"xt-ml","url":"https://github.com/xt-ml","sameAs":["https://github.com/xt-ml"]}]}</script><meta name="theme-color" content="#fff" /><meta http-equiv="origin-trial" content="A88uTgESYWcVgREKVReKB6jom41uP8TzW6ei3jNdidf+Xl6ONqKRjKNBphsxhrZmdkakLK3oXDgkGq53rtZYSAMAAAB2eyJvcmlnaW4iOiJodHRwczovL3h0LW1sLmdpdGh1Yi5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViTUNQIiwiZXhwaXJ5IjoxNzk0ODczNjAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><base href="/shadow-claw/"><script id="shadow-claw-site-config" type="application/json">{"$schema":"https:\u002f\u002fjson-schema.org\u002fdraft\u002f2020-12\u002fschema","site":{"title":"ShadowClaw","description":"ShadowClaw - Browser-native AI agent.","themeColor":"#fff"},"branding":{"faviconPath":"assets\u002ficons\u002ffavicon.ico","appleTouchIconPath":"assets\u002ficons\u002f180.png","notFoundPath":"404.html"},"pwa":{"manifestPath":"manifest.json","themeColor":"#000000"},"sitemapPath":"sitemap.xml","assets":["assets"],"sidebar":{"pagesHidden":false,"chatHidden":false,"tasksHidden":false,"filesHidden":false,"defaultPage":"pages"},"settings":{"defaultToolsProfile":"__builtin_default"},"customElements":{"allowedElements":["block-garden","block-garden-option","block-garden-select"],"allowedDomains":["kherrick.github.io","cdn.jsdelivr.net"],"scripts":[{"src":"https:\u002f\u002fkherrick.github.io\u002fblock-garden-knowledge-hub\u002f.agents\u002fscripts\u002fmain\u002fblock-garden-adapter.js","hasInit":true},"https:\u002f\u002fkherrick.github.io\u002fblock-garden\u002fblock-garden-bundle-min.mjs"]},"security":{"connectSrc":["'self'","blob:","data:","https:\u002f\u002fkherrick.github.io","https:\u002f\u002fcdn.jsdelivr.net"]}}</script>
2
- <script>var ShadowClawThemeInit=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function n(){if(globalThis.trustedTypes)return;let e=new Map;globalThis.trustedTypes={createPolicy:(t,n)=>{if(e.has(t))throw TypeError(`Policy with name "${t}" already exists.`);let r={createHTML:n.createHTML?e=>n.createHTML(e):void 0,createScriptURL:n.createScriptURL?e=>n.createScriptURL(e):void 0,createScript:n.createScript?e=>n.createScript(e):void 0};return e.set(t,r),r},getPolicy:t=>e.get(t)??null,isHTML:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScriptURL:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScript:e=>typeof e==`string`||e instanceof Object&&`toString`in e}}let r=`__shadowClawDefaultTrustedTypesPolicyState`,i=`default`,a=`shadowclaw-sandbox`;function o(){let e=globalThis;return e[r]||(e[r]={initialized:!1,policy:null}),e[r]}function s(){let e=o();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(i);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(i)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(a);if(n){e.policy=n;return}}e.policy=t.createPolicy(a,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(i)??t.getPolicy(a)??null)}}}new class{loading=!1;models=new Map;getModelInfo(e){return this.models.get(e.toLowerCase())??null}registerModelInfo(e,t){this.models.set(e.toLowerCase(),t)}clear(){this.models.clear()}async fetchModelInfo(e,t,n){if(e.modelsUrl){this.loading=!0;try{let r=new Headers;if(r.set(`Content-Type`,`application/json`),e.headers)for(let[t,n]of Object.entries(e.headers))r.set(t,n);if(n)for(let[e,t]of Object.entries(n))r.set(e,t);if(t&&e.apiKeyHeader){let n=e.apiKeyHeaderFormat;r.set(e.apiKeyHeader,n?n.replace(`{key}`,t):t)}let i=await fetch(e.modelsUrl,{headers:r});if(!i.ok)throw Error(`HTTP ${i.status} ${i.statusText}`);let a=await i.json(),o=Array.isArray(a.data)?a.data:Array.isArray(a.models)?a.models:[];for(let e of o){if(!e.id)continue;let t=e.context_length??e.context_window??0,n=e.max_completion_tokens||e.per_request_limits?.completion_tokens||e.top_provider?.max_completion_tokens||null,r=typeof e.supports_tools==`boolean`?e.supports_tools:typeof e.supportsTools==`boolean`?e.supportsTools:void 0,i=this.extractModalities(e,`input`),a=this.extractModalities(e,`output`),o=this.modalitiesInclude(i,`image`,`vision`),s=this.modalitiesInclude(i,`audio`,`voice`,`hearing`),c=this.modalitiesInclude(i,`video`),l=e.id===`openrouter/free`||this.supportedParametersInclude(e,`image`,`vision`,`audio`,`tool`,`structured`),u=this.extractReasoning(e);!t&&Array.isArray(e.providers)&&e.providers.length>0&&(t=e.providers[0]?.context_length||0),this.registerModelInfo(e.id,{contextWindow:t,maxOutput:n,...r!==void 0&&{supportsTools:r},...i.length>0&&{inputModalities:i},...a.length>0&&{outputModalities:a},...o!==void 0&&{supportsImageInput:o},...s!==void 0&&{supportsAudioInput:s},...c!==void 0&&{supportsVideoInput:c},...u&&{reasoning:u},...l&&{routesByRequestFeatures:l}})}o.length>0&&console.log(`[ModelRegistry] Registered ${o.length} models for provider "${e.id}"`)}catch(t){console.error(`[ModelRegistry] Error fetching models for ${e.id}:`,t)}finally{this.loading=!1}}}extractModalities(e,t){let n=t===`input`?e.input_modalities||e.inputModalities:e.output_modalities||e.outputModalities,r=e.architecture||{},i=t===`input`?r.input_modalities||r.inputModalities:r.output_modalities||r.outputModalities,a=typeof r.modality==`string`?r.modality:``,o=this.parseArchitectureModality(a,t),s=[...this.normalizeStringArray(n),...this.normalizeStringArray(i),...o];return Array.from(new Set(s))}extractReasoning(e){let t=e?.reasoning;if(!t||typeof t!=`object`)return;let n=this.normalizeStringArray(t.supported_efforts),r=typeof t.default_effort==`string`?t.default_effort.toLowerCase():void 0,i=typeof t.default_enabled==`boolean`?t.default_enabled:void 0,a=typeof t.supports_max_tokens==`boolean`?t.supports_max_tokens:void 0,o=typeof t.mandatory==`boolean`?t.mandatory:void 0;if(!(n.length===0&&r===void 0&&i===void 0&&a===void 0&&o===void 0))return{...n.length>0&&{supportedEfforts:n},...r!==void 0&&{defaultEffort:r},...i!==void 0&&{defaultEnabled:i},...a!==void 0&&{supportsMaxTokens:a},...o!==void 0&&{mandatory:o}}}modalitiesInclude(e,...t){if(e.length!==0)return t.some(t=>e.some(e=>e.includes(t)))}normalizeStringArray(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.toLowerCase()):[]}parseArchitectureModality(e,t){if(!e)return[];let[n=``,r=``]=e.toLowerCase().split(`->`).map(e=>e.trim());return(t===`input`?n:r).split(/[+,/\s]+/).map(e=>e.trim()).filter(Boolean)}supportedParametersInclude(e,...t){let n=this.normalizeStringArray(e.supported_parameters||e.supportedParameters);return t.some(e=>n.some(t=>t.includes(e)))}};function c(e){return e.replace(/^\/+|\/+$/g,``)}function l(e){let t=c(e);return t.endsWith(`/index.html`)?t=t.slice(0,-11):t.endsWith(`index.html`)&&(t=t.slice(0,-10)),c(t)}function u(e){let t=c(e),n=t.split(`/`).filter(Boolean);if(n.length===0)return null;let r=n[0].toLowerCase();if(r===`pages`){if(n.length>=3){let e=n[1];return{page:`pages`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)}}return{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}}if(r===`files`){let e=n[1]||`main`;return{page:`files`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)||void 0}}if(r===`chat`){let e=n[1]||`main`;return{page:`chat`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}if(r===`tasks`){let e=n[1]||`main`;return{page:`tasks`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}return r===`main`?{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}:{page:`pages`,groupId:`br:main`,path:t}}function d(){if(typeof document<`u`){let e=document.getElementById(`shadow-claw-static-routing`);if(e&&e.textContent)try{let t=JSON.parse(e.textContent);if(t&&typeof t==`object`&&t.routes)return t}catch(e){console.warn(`Failed to parse embedded static routing manifest:`,e)}}return null}function f(e,t){let n=t||d();if(!n||!n.routes)return null;let r=l(e);if(!r)return null;for(let[e,t]of Object.entries(n.routes))if(!(!t||!t.prettyPath)&&l(t.prettyPath)===r)return u(e);return null}let p=null,ee=new Set([`chat`,`files`,`tasks`,`pages`,`settings`,`tools`,`channels`]);function m(){p=null}typeof globalThis<`u`&&(globalThis.__applyBasePathCacheReset=m);function h(){let e=typeof window<`u`?window:typeof self<`u`?self:globalThis;if(e&&e.__SHADOWCLAW_DEPLOY_ID__){let t=String(e.__SHADOWCLAW_DEPLOY_ID__).trim();if(t)return t.replace(/[^a-zA-Z0-9_-]/g,`-`)}let t=globalThis.process;if(t&&t.env&&t.env.SHADOWCLAW_DEPLOY_ID){let e=String(t.env.SHADOWCLAW_DEPLOY_ID).trim();if(e)return e.replace(/[^a-zA-Z0-9_-]/g,`-`)}let n=te();return!n||n===`/`?``:n.replace(/^\/+|\/+$/g,``).replace(/[^a-zA-Z0-9_-]/g,`-`)}function te(){if(p!==null)return p;if((typeof window>`u`||globalThis.WorkerGlobalScope!==void 0&&typeof self<`u`&&self instanceof globalThis.WorkerGlobalScope)&&typeof self<`u`&&self.location){let e=(self.location.pathname||`/`).split(`/`).filter(Boolean);if(e.length<=1)return p=`/`,p;let t=e[0].toLowerCase(),n=t===`service-worker.js`||t===`sw.js`||t===`manifest.json`||t===`sitemap.xml`||t===`favicon.ico`||t===`index.html`||t===`service-worker`||t===`assets`||t===`dist`||t===`public`;if(n&&e.length===2)return p=`/`,p;if(!n)return p=`/`+e[0]+`/`,p}let e=typeof window<`u`&&window.location?window.location:typeof self<`u`&&self.location?self.location:null;if(!e)return`/`;if(typeof document<`u`&&typeof document.querySelector==`function`){let t=document.querySelector(`base[href]`);if(t){let n=t.getAttribute(`href`);if(n)try{let t=new URL(n,e.origin).pathname;return t.endsWith(`/`)||(t+=`/`),p=t,p}catch{}}}let t=e.pathname||`/`;if(t===`/`)return p=`/`,p;let n=t.split(`/`).filter(Boolean),r=n.findIndex(e=>ee.has(e.toLowerCase()));return r>=0?r===0?(p=`/`,p):(p=`/`+n.slice(0,r).join(`/`)+`/`,p):f(t)?(p=`/`,p):n.length===1&&!t.includes(`.`)?(p=`/`+n[0]+`/`,p):(p=`/`,p)}function ne(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^|\\s)@${t}\\b`,`i`)}ne(`ShadowClaw`);function g(){let e=h();return e?`shadowclaw-${e}`:`shadowclaw`}g();let _={github:{providerId:`github`,name:`GitHub`,aliases:[`github`,`api.github.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`token `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://github.com/login/oauth/authorize`,tokenUrl:`https://github.com/login/oauth/access_token`,defaultScopes:[`repo`,`read:user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},gitlab:{providerId:`gitlab`,name:`GitLab`,aliases:[`gitlab`,`gitlab.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`PRIVATE-TOKEN`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}}},oauth:{authorizeUrl:`https://gitlab.com/oauth/authorize`,tokenUrl:`https://gitlab.com/oauth/token`,defaultScopes:[`read_api`,`read_user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},figma:{providerId:`figma`,name:`Figma`,aliases:[`figma`,`api.figma.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`X-Figma-Token`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://www.figma.com/oauth`,tokenUrl:`https://api.figma.com/v1/oauth/token`,refreshUrl:`https://api.figma.com/v1/oauth/refresh`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},notion:{providerId:`notion`,name:`Notion`,aliases:[`notion`,`api.notion.com`,`notion.so`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.notion.com/v1/oauth/authorize`,tokenUrl:`https://api.notion.com/v1/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},microsoft_graph:{providerId:`microsoft_graph`,name:`Microsoft Graph`,aliases:[`microsoft`,`graph.microsoft.com`,`microsoft_graph`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/authorize`,tokenUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/token`,defaultScopes:[`openid`,`profile`,`offline_access`,`User.Read`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},yahoo_mail:{providerId:`yahoo_mail`,name:`Yahoo Mail`,aliases:[`yahoo`,`yahoo_mail`,`mail.yahoo.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.login.yahoo.com/oauth2/request_auth`,tokenUrl:`https://api.login.yahoo.com/oauth2/get_token`,defaultScopes:[`mail-r`,`mail-w`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},google:{providerId:`google`,name:`Google`,aliases:[`google`,`googleapis.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,defaultScopes:[`openid`,`profile`,`email`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},atlassian:{providerId:`atlassian`,name:`Atlassian`,aliases:[`atlassian`,`api.atlassian.com`],modes:[`oauth`,`token`,`basic`],defaultMode:`basic`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `},basic:{headerName:`Authorization`,headerPrefix:`Basic `}},oauth:{authorizeUrl:`https://auth.atlassian.com/authorize`,tokenUrl:`https://auth.atlassian.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},slack:{providerId:`slack`,name:`Slack`,aliases:[`slack`,`slack.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://slack.com/oauth/v2/authorize`,tokenUrl:`https://slack.com/api/oauth.v2.access`,defaultScopes:[],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`comma`}},linear:{providerId:`linear`,name:`Linear`,aliases:[`linear`,`api.linear.app`,`linear.app`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://linear.app/oauth/authorize`,tokenUrl:`https://api.linear.app/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},azure_devops:{providerId:`azure_devops`,name:`Azure DevOps`,aliases:[`azure_devops`,`dev.azure.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Basic `},oauth:{headerName:`Authorization`,headerPrefix:`Basic `}}},oauth:{authorizeUrl:`https://app.vssps.visualstudio.com/oauth2/authorize`,tokenUrl:`https://app.vssps.visualstudio.com/oauth2/token`,defaultScopes:[`vso.code`,`vso.profile`,`offline_access`],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`space`}},custom_mcp:{providerId:`custom_mcp`,name:`Custom MCP`,aliases:[`custom_mcp`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`mcp_remote`,`webmcp_local`],authTypes:[`none`,`token`,`oauth`,`custom_header`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://example.com/oauth/authorize`,tokenUrl:`https://example.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}}};Object.fromEntries(Object.values(_).filter(e=>!!e.oauth).map(e=>{let t=e.oauth;return[e.providerId,{id:e.providerId,name:e.name,authorizeUrl:t.authorizeUrl,tokenUrl:t.tokenUrl,redirectUri:t.redirectUri,defaultScopes:t.defaultScopes,usePkce:t.usePkce,clientAuthMethod:t.clientAuthMethod,scopeSeparator:t.scopeSeparator}]})),Object.fromEntries(Object.values(_).map(e=>[e.providerId,{providerId:e.providerId,modes:e.modes,defaultMode:e.defaultMode}])),new Promise(e=>{});
1
+ <!doctype html><html lang="en"><head><title>ShadowClaw</title><meta charset="utf-8"><meta name="revision" content="52f960e61fd87ed2fed8fc961777d1d447c2bee4" /><meta name="version" content="1.33.0" /><meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"><meta name="description" content="ShadowClaw - Browser-native AI agent." /><link rel="canonical" href="https://xt-ml.github.io/shadow-claw/"><meta property="og:title" content="ShadowClaw"><meta property="og:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta property="og:type" content="website"><meta property="og:url" content="https://xt-ml.github.io/shadow-claw/"><meta property="og:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><meta name="twitter:card" content="summary"><meta name="twitter:title" content="ShadowClaw"><meta name="twitter:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta name="twitter:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"SoftwareApplication","@id":"https://xt-ml.github.io/shadow-claw/#software","name":"ShadowClaw","description":"Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.","url":"https://xt-ml.github.io/shadow-claw/","applicationCategory":"DeveloperApplication","operatingSystem":"Web, Browser, Desktop","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"author":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"},"codeRepository":"https://github.com/xt-ml/shadow-claw","license":"https://github.com/xt-ml/shadow-claw/blob/main/LICENSE"},{"@type":"WebSite","@id":"https://xt-ml.github.io/shadow-claw/#website","url":"https://xt-ml.github.io/shadow-claw/","name":"ShadowClaw","description":"Official website and live deployment of ShadowClaw browser-native AI assistant.","publisher":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"}},{"@type":"Organization","@id":"https://xt-ml.github.io/shadow-claw/#organization","name":"xt-ml","url":"https://github.com/xt-ml","sameAs":["https://github.com/xt-ml"]}]}</script><meta name="theme-color" content="#fff" /><meta http-equiv="origin-trial" content="A88uTgESYWcVgREKVReKB6jom41uP8TzW6ei3jNdidf+Xl6ONqKRjKNBphsxhrZmdkakLK3oXDgkGq53rtZYSAMAAAB2eyJvcmlnaW4iOiJodHRwczovL3h0LW1sLmdpdGh1Yi5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViTUNQIiwiZXhwaXJ5IjoxNzk0ODczNjAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><base href="/shadow-claw/"><script id="shadow-claw-site-config" type="application/json">{"$schema":"https:\u002f\u002fjson-schema.org\u002fdraft\u002f2020-12\u002fschema","site":{"title":"ShadowClaw","description":"ShadowClaw - Browser-native AI agent.","themeColor":"#fff"},"branding":{"faviconPath":"assets\u002ficons\u002ffavicon.ico","appleTouchIconPath":"assets\u002ficons\u002f180.png","notFoundPath":"404.html"},"pwa":{"manifestPath":"manifest.json","themeColor":"#000000"},"sitemapPath":"sitemap.xml","assets":["assets"],"sidebar":{"pagesHidden":false,"chatHidden":false,"tasksHidden":false,"filesHidden":false,"defaultPage":"pages"},"settings":{"defaultToolsProfile":"__builtin_default"},"customElements":{"allowedElements":["block-garden","block-garden-option","block-garden-select"],"allowedDomains":["kherrick.github.io","cdn.jsdelivr.net"],"scripts":[{"src":"https:\u002f\u002fkherrick.github.io\u002fblock-garden-knowledge-hub\u002f.agents\u002fscripts\u002fmain\u002fblock-garden-adapter.js","hasInit":true},"https:\u002f\u002fkherrick.github.io\u002fblock-garden\u002fblock-garden-bundle-min.mjs"]},"security":{"connectSrc":["'self'","blob:","data:","https:\u002f\u002fkherrick.github.io","https:\u002f\u002fcdn.jsdelivr.net"]}}</script>
2
+ <script>var ShadowClawThemeInit=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function n(){if(globalThis.trustedTypes)return;let e=new Map;globalThis.trustedTypes={createPolicy:(t,n)=>{if(e.has(t))throw TypeError(`Policy with name "${t}" already exists.`);let r={createHTML:n.createHTML?e=>n.createHTML(e):void 0,createScriptURL:n.createScriptURL?e=>n.createScriptURL(e):void 0,createScript:n.createScript?e=>n.createScript(e):void 0};return e.set(t,r),r},getPolicy:t=>e.get(t)??null,isHTML:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScriptURL:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScript:e=>typeof e==`string`||e instanceof Object&&`toString`in e}}let r=`__shadowClawDefaultTrustedTypesPolicyState`,i=`default`,a=`shadowclaw-sandbox`;function o(){let e=globalThis;return e[r]||(e[r]={initialized:!1,policy:null}),e[r]}function s(){let e=o();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(i);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(i)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(a);if(n){e.policy=n;return}}e.policy=t.createPolicy(a,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(i)??t.getPolicy(a)??null)}}}new class{loading=!1;models=new Map;getModelInfo(e){if(!e||typeof e!=`string`)return null;let t=e.toLowerCase().trim(),n=this.models.get(t);if(n)return n;if(t.includes(`/`)){let e=t.split(`/`).pop();if(e&&this.models.has(e))return this.models.get(e)}else for(let[e,n]of this.models.entries())if(e.endsWith(`/${t}`))return n;if(t.includes(`:`)){let e=t.split(`:`)[0],n=this.getModelInfo(e);if(n)return n}return null}registerModelInfo(e,t){this.models.set(e.toLowerCase(),t)}clear(){this.models.clear()}async fetchModelInfo(e,t,n){if(e.modelsUrl){this.loading=!0;try{let r=new Headers;if(r.set(`Content-Type`,`application/json`),e.headers)for(let[t,n]of Object.entries(e.headers))r.set(t,n);if(n)for(let[e,t]of Object.entries(n))r.set(e,t);if(t&&e.apiKeyHeader){let n=e.apiKeyHeaderFormat;r.set(e.apiKeyHeader,n?n.replace(`{key}`,t):t)}let i=await fetch(e.modelsUrl,{headers:r});if(!i.ok)throw Error(`HTTP ${i.status} ${i.statusText}`);let a=await i.json(),o=Array.isArray(a.data)?a.data:Array.isArray(a.models)?a.models:[];for(let e of o){if(!e.id)continue;let t=e.context_length??e.context_window??0,n=e.max_completion_tokens||e.per_request_limits?.completion_tokens||e.top_provider?.max_completion_tokens||null,r=typeof e.supports_tools==`boolean`?e.supports_tools:typeof e.supportsTools==`boolean`?e.supportsTools:void 0,i=this.extractModalities(e,`input`),a=this.extractModalities(e,`output`),o=this.modalitiesInclude(i,`image`,`vision`),s=this.modalitiesInclude(i,`audio`,`voice`,`hearing`),c=this.modalitiesInclude(i,`video`),l=e.id===`openrouter/free`||this.supportedParametersInclude(e,`image`,`vision`,`audio`,`tool`,`structured`),u=this.extractReasoning(e),d=typeof e.supports_prompt_caching==`boolean`?e.supports_prompt_caching:typeof e.supportsPromptCaching==`boolean`?e.supportsPromptCaching:this.supportedParametersInclude(e,`cache_control`,`prompt_caching`)?!0:void 0;!t&&Array.isArray(e.providers)&&e.providers.length>0&&(t=e.providers[0]?.context_length||0),this.registerModelInfo(e.id,{contextWindow:t,maxOutput:n,...r!==void 0&&{supportsTools:r},...i.length>0&&{inputModalities:i},...a.length>0&&{outputModalities:a},...o!==void 0&&{supportsImageInput:o},...s!==void 0&&{supportsAudioInput:s},...c!==void 0&&{supportsVideoInput:c},...u&&{reasoning:u},...l&&{routesByRequestFeatures:l},...d!==void 0&&{supportsPromptCaching:d}})}o.length>0&&console.log(`[ModelRegistry] Registered ${o.length} models for provider "${e.id}"`)}catch(t){console.error(`[ModelRegistry] Error fetching models for ${e.id}:`,t)}finally{this.loading=!1}}}extractModalities(e,t){let n=t===`input`?e.input_modalities||e.inputModalities:e.output_modalities||e.outputModalities,r=e.architecture||{},i=t===`input`?r.input_modalities||r.inputModalities:r.output_modalities||r.outputModalities,a=typeof r.modality==`string`?r.modality:``,o=this.parseArchitectureModality(a,t),s=[...this.normalizeStringArray(n),...this.normalizeStringArray(i),...o];return Array.from(new Set(s))}extractReasoning(e){let t=e?.reasoning;if(!t||typeof t!=`object`)return;let n=this.normalizeStringArray(t.supported_efforts),r=typeof t.default_effort==`string`?t.default_effort.toLowerCase():void 0,i=typeof t.default_enabled==`boolean`?t.default_enabled:void 0,a=typeof t.supports_max_tokens==`boolean`?t.supports_max_tokens:void 0,o=typeof t.mandatory==`boolean`?t.mandatory:void 0;if(!(n.length===0&&r===void 0&&i===void 0&&a===void 0&&o===void 0))return{...n.length>0&&{supportedEfforts:n},...r!==void 0&&{defaultEffort:r},...i!==void 0&&{defaultEnabled:i},...a!==void 0&&{supportsMaxTokens:a},...o!==void 0&&{mandatory:o}}}modalitiesInclude(e,...t){if(e.length!==0)return t.some(t=>e.some(e=>e.includes(t)))}normalizeStringArray(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.toLowerCase()):[]}parseArchitectureModality(e,t){if(!e)return[];let[n=``,r=``]=e.toLowerCase().split(`->`).map(e=>e.trim());return(t===`input`?n:r).split(/[+,/\s]+/).map(e=>e.trim()).filter(Boolean)}supportedParametersInclude(e,...t){let n=this.normalizeStringArray(e.supported_parameters||e.supportedParameters);return t.some(e=>n.some(t=>t.includes(e)))}};function c(e){return e.replace(/^\/+|\/+$/g,``)}function l(e){let t=c(e);return t.endsWith(`/index.html`)?t=t.slice(0,-11):t.endsWith(`index.html`)&&(t=t.slice(0,-10)),c(t)}function u(e){let t=c(e),n=t.split(`/`).filter(Boolean);if(n.length===0)return null;let r=n[0].toLowerCase();if(r===`pages`){if(n.length>=3){let e=n[1];return{page:`pages`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)}}return{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}}if(r===`files`){let e=n[1]||`main`;return{page:`files`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)||void 0}}if(r===`chat`){let e=n[1]||`main`;return{page:`chat`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}if(r===`tasks`){let e=n[1]||`main`;return{page:`tasks`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}return r===`main`?{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}:{page:`pages`,groupId:`br:main`,path:t}}function d(){if(typeof document<`u`){let e=document.getElementById(`shadow-claw-static-routing`);if(e&&e.textContent)try{let t=JSON.parse(e.textContent);if(t&&typeof t==`object`&&t.routes)return t}catch(e){console.warn(`Failed to parse embedded static routing manifest:`,e)}}return null}function f(e,t){let n=t||d();if(!n||!n.routes)return null;let r=l(e);if(!r)return null;for(let[e,t]of Object.entries(n.routes))if(!(!t||!t.prettyPath)&&l(t.prettyPath)===r)return u(e);return null}let p=null,ee=new Set([`chat`,`files`,`tasks`,`pages`,`settings`,`tools`,`channels`]);function m(){p=null}typeof globalThis<`u`&&(globalThis.__applyBasePathCacheReset=m);function h(){let e=typeof window<`u`?window:typeof self<`u`?self:globalThis;if(e&&e.__SHADOWCLAW_DEPLOY_ID__){let t=String(e.__SHADOWCLAW_DEPLOY_ID__).trim();if(t)return t.replace(/[^a-zA-Z0-9_-]/g,`-`)}let t=globalThis.process;if(t&&t.env&&t.env.SHADOWCLAW_DEPLOY_ID){let e=String(t.env.SHADOWCLAW_DEPLOY_ID).trim();if(e)return e.replace(/[^a-zA-Z0-9_-]/g,`-`)}let n=te();return!n||n===`/`?``:n.replace(/^\/+|\/+$/g,``).replace(/[^a-zA-Z0-9_-]/g,`-`)}function te(){if(p!==null)return p;if((typeof window>`u`||globalThis.WorkerGlobalScope!==void 0&&typeof self<`u`&&self instanceof globalThis.WorkerGlobalScope)&&typeof self<`u`&&self.location){let e=(self.location.pathname||`/`).split(`/`).filter(Boolean);if(e.length<=1)return p=`/`,p;let t=e[0].toLowerCase(),n=t===`service-worker.js`||t===`sw.js`||t===`manifest.json`||t===`sitemap.xml`||t===`favicon.ico`||t===`index.html`||t===`service-worker`||t===`assets`||t===`dist`||t===`public`;if(n&&e.length===2)return p=`/`,p;if(!n)return p=`/`+e[0]+`/`,p}let e=typeof window<`u`&&window.location?window.location:typeof self<`u`&&self.location?self.location:null;if(!e)return`/`;if(typeof document<`u`&&typeof document.querySelector==`function`){let t=document.querySelector(`base[href]`);if(t){let n=t.getAttribute(`href`);if(n)try{let t=new URL(n,e.origin).pathname;return t.endsWith(`/`)||(t+=`/`),p=t,p}catch{}}}let t=e.pathname||`/`;if(t===`/`)return p=`/`,p;let n=t.split(`/`).filter(Boolean),r=n.findIndex(e=>ee.has(e.toLowerCase()));return r>=0?r===0?(p=`/`,p):(p=`/`+n.slice(0,r).join(`/`)+`/`,p):f(t)?(p=`/`,p):n.length===1&&!t.includes(`.`)?(p=`/`+n[0]+`/`,p):(p=`/`,p)}function ne(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^|\\s)@${t}\\b`,`i`)}ne(`ShadowClaw`);function g(){let e=h();return e?`shadowclaw-${e}`:`shadowclaw`}g();let _={github:{providerId:`github`,name:`GitHub`,aliases:[`github`,`api.github.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`token `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://github.com/login/oauth/authorize`,tokenUrl:`https://github.com/login/oauth/access_token`,defaultScopes:[`repo`,`read:user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},gitlab:{providerId:`gitlab`,name:`GitLab`,aliases:[`gitlab`,`gitlab.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`PRIVATE-TOKEN`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}}},oauth:{authorizeUrl:`https://gitlab.com/oauth/authorize`,tokenUrl:`https://gitlab.com/oauth/token`,defaultScopes:[`read_api`,`read_user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},figma:{providerId:`figma`,name:`Figma`,aliases:[`figma`,`api.figma.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`X-Figma-Token`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://www.figma.com/oauth`,tokenUrl:`https://api.figma.com/v1/oauth/token`,refreshUrl:`https://api.figma.com/v1/oauth/refresh`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},notion:{providerId:`notion`,name:`Notion`,aliases:[`notion`,`api.notion.com`,`notion.so`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.notion.com/v1/oauth/authorize`,tokenUrl:`https://api.notion.com/v1/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},microsoft_graph:{providerId:`microsoft_graph`,name:`Microsoft Graph`,aliases:[`microsoft`,`graph.microsoft.com`,`microsoft_graph`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/authorize`,tokenUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/token`,defaultScopes:[`openid`,`profile`,`offline_access`,`User.Read`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},yahoo_mail:{providerId:`yahoo_mail`,name:`Yahoo Mail`,aliases:[`yahoo`,`yahoo_mail`,`mail.yahoo.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.login.yahoo.com/oauth2/request_auth`,tokenUrl:`https://api.login.yahoo.com/oauth2/get_token`,defaultScopes:[`mail-r`,`mail-w`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},google:{providerId:`google`,name:`Google`,aliases:[`google`,`googleapis.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,defaultScopes:[`openid`,`profile`,`email`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},atlassian:{providerId:`atlassian`,name:`Atlassian`,aliases:[`atlassian`,`api.atlassian.com`],modes:[`oauth`,`token`,`basic`],defaultMode:`basic`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `},basic:{headerName:`Authorization`,headerPrefix:`Basic `}},oauth:{authorizeUrl:`https://auth.atlassian.com/authorize`,tokenUrl:`https://auth.atlassian.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},slack:{providerId:`slack`,name:`Slack`,aliases:[`slack`,`slack.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://slack.com/oauth/v2/authorize`,tokenUrl:`https://slack.com/api/oauth.v2.access`,defaultScopes:[],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`comma`}},linear:{providerId:`linear`,name:`Linear`,aliases:[`linear`,`api.linear.app`,`linear.app`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://linear.app/oauth/authorize`,tokenUrl:`https://api.linear.app/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},azure_devops:{providerId:`azure_devops`,name:`Azure DevOps`,aliases:[`azure_devops`,`dev.azure.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Basic `},oauth:{headerName:`Authorization`,headerPrefix:`Basic `}}},oauth:{authorizeUrl:`https://app.vssps.visualstudio.com/oauth2/authorize`,tokenUrl:`https://app.vssps.visualstudio.com/oauth2/token`,defaultScopes:[`vso.code`,`vso.profile`,`offline_access`],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`space`}},custom_mcp:{providerId:`custom_mcp`,name:`Custom MCP`,aliases:[`custom_mcp`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`mcp_remote`,`webmcp_local`],authTypes:[`none`,`token`,`oauth`,`custom_header`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://example.com/oauth/authorize`,tokenUrl:`https://example.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}}};Object.fromEntries(Object.values(_).filter(e=>!!e.oauth).map(e=>{let t=e.oauth;return[e.providerId,{id:e.providerId,name:e.name,authorizeUrl:t.authorizeUrl,tokenUrl:t.tokenUrl,redirectUri:t.redirectUri,defaultScopes:t.defaultScopes,usePkce:t.usePkce,clientAuthMethod:t.clientAuthMethod,scopeSeparator:t.scopeSeparator}]})),Object.fromEntries(Object.values(_).map(e=>[e.providerId,{providerId:e.providerId,modes:e.modes,defaultMode:e.defaultMode}])),new Promise(e=>{});
3
3
  /*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */
4
4
  function v(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){if(Array.isArray(e))return e}function b(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function re(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
5
5
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ie(e,t){return y(e)||b(e,t)||x(e,t)||re()}function x(e,t){if(e){if(typeof e==`string`)return v(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)?v(e,t):void 0}}let ae=Object.entries,oe=Object.setPrototypeOf,S=Object.isFrozen,se=Object.getPrototypeOf,ce=Object.getOwnPropertyDescriptor,C=Object.freeze,w=Object.seal,T=Object.create,E=typeof Reflect<`u`&&Reflect,le=E.apply,ue=E.construct;C||=function(e){return e},w||=function(e){return e},le||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},ue||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};let D=P(Array.prototype.forEach),de=P(Array.prototype.lastIndexOf),fe=P(Array.prototype.pop),pe=P(Array.prototype.push),me=P(Array.prototype.splice),O=Array.isArray,he=P(String.prototype.toLowerCase),ge=P(String.prototype.toString),_e=P(String.prototype.match),ve=P(String.prototype.replace),ye=P(String.prototype.indexOf),be=P(String.prototype.trim),xe=P(Number.prototype.toString),Se=P(Boolean.prototype.toString),Ce=typeof BigInt>`u`?null:P(BigInt.prototype.toString),k=typeof Symbol>`u`?null:P(Symbol.prototype.toString),A=P(Object.prototype.hasOwnProperty),j=P(Object.prototype.toString),M=P(RegExp.prototype.test),N=we(TypeError);function P(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return le(e,t,r)}}function we(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return ue(e,n)}}function F(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:he;if(oe&&oe(e,null),!O(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(S(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Te(e){for(let t=0;t<e.length;t++)A(e,t)||(e[t]=null);return e}function I(e){let t=T(null);for(let r of ae(e)){var n=ie(r,2);let i=n[0],a=n[1];A(e,i)&&(O(a)?t[i]=Te(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=I(a):t[i]=a)}return t}function Ee(e){switch(typeof e){case`string`:return e;case`number`:return xe(e);case`boolean`:return Se(e);case`bigint`:return Ce?Ce(e):`0`;case`symbol`:return k?k(e):`Symbol()`;case`undefined`:return j(e);case`function`:case`object`:{if(e===null)return j(e);let t=e,n=L(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:j(e)}return j(e)}default:return j(e)}}function L(e,t){for(;e!==null;){let n=ce(e,t);if(n){if(n.get)return P(n.get);if(typeof n.value==`function`)return P(n.value)}e=se(e)}function n(){return null}return n}function De(e){try{return M(e,``),!0}catch{return!1}}let Oe=C(`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(`.`)),ke=C(`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(`.`)),Ae=C([`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`]),je=C([`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`]),Me=C(`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(`.`)),Ne=C([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Pe=C([`#text`]),Fe=C(`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(`.`)),Ie=C(`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.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.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(`.`)),Le=C(`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(`.`)),Re=C([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ze=w(/{{[\w\W]*|^[\w\W]*}}/g),Be=w(/<%[\w\W]*|^[\w\W]*%>/g),Ve=w(/\${[\w\W]*/g),He=w(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ue=w(/^aria-[\-\w]+$/),We=w(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ge=w(/^(?:\w+script|data):/i),Ke=w(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qe=w(/^html$/i),Je=w(/^[a-z][.\w]*(-[.\w]+)+$/i),Ye=w(/<[/\w!]/g),Xe=w(/<[/\w]/g),Ze=w(/<\/no(script|embed|frames)/i),Qe=w(/\/>/i),R={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$e=function(){return typeof window>`u`?null:window},et=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}},tt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},z=function(e,t,n,r){return A(e,t)&&O(e[t])?F(r.base?I(r.base):{},e[t],r.transform):n};function nt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$e(),t=e=>nt(e);if(t.version=`3.4.13`,t.removed=[],!e||!e.document||e.document.nodeType!==R.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=L(d,`cloneNode`),p=L(d,`remove`),ee=L(d,`nextSibling`),m=L(d,`childNodes`),h=L(d,`parentNode`),te=L(d,`shadowRoot`),ne=L(d,`attributes`),g=o&&o.prototype?L(o.prototype,`nodeType`):null,_=o&&o.prototype?L(o.prototype,`nodeName`):null,v=o&&o.prototype?L(o.prototype,`ownerDocument`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let y,b=``,re,ie=!1,x=0,oe=function(){if(x>0)throw N(`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.`)},S=function(e){oe(),x++;try{return y.createHTML(e)}finally{x--}},se=function(e){oe(),x++;try{return y.createScriptURL(e)}finally{x--}},ce=function(){return ie||=(re=et(u,i),!0),re},E=n,le=E.implementation,ue=E.createNodeIterator,xe=E.createDocumentFragment,Se=E.getElementsByTagName,Ce=r.importNode,k=tt();t.isSupported=typeof ae==`function`&&typeof h==`function`&&le&&le.createHTMLDocument!==void 0;let j=ze,P=Be,we=Ve,Te=He,rt=Ue,it=Ge,at=Ke,ot=Je,st=We,B=null,ct=F({},[...Oe,...ke,...Ae,...Me,...Pe]),V=null,lt=F({},[...Fe,...Ie,...Le,...Re]),H=Object.seal(T(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}})),ut=null,dt=null,U=Object.seal(T(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ft=!0,pt=!0,mt=!1,ht=!0,W=!1,G=!0,K=!1,gt=!1,_t=null,vt=null,yt=!1,q=!1,bt=!1,xt=!1,St=!0,Ct=!1,wt=`user-content-`,Tt=!0,Et=!1,Dt={},J=null,Ot=F({},`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(`.`)),kt=null,At=F({},[`audio`,`video`,`img`,`source`,`image`,`track`]),jt=null,Mt=F({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Nt=`http://www.w3.org/1998/Math/MathML`,Pt=`http://www.w3.org/2000/svg`,Y=`http://www.w3.org/1999/xhtml`,Ft=Y,It=!1,Lt=null,Rt=F({},[Nt,Pt,Y],ge),zt=C([`mi`,`mo`,`mn`,`ms`,`mtext`]),Bt=F({},zt),Vt=C([`annotation-xml`]),Ht=F({},Vt),Ut=F({},[`title`,`style`,`font`,`a`,`script`]),Wt=null,Gt=[`application/xhtml+xml`,`text/html`],X=null,Kt=null,qt=n.createElement(`form`),Jt=function(e){return e instanceof RegExp||e instanceof Function},Yt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Kt&&Kt===e)return;(!e||typeof e!=`object`)&&(e={}),e=I(e),Wt=Gt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,X=Wt===`application/xhtml+xml`?ge:he,B=z(e,`ALLOWED_TAGS`,ct,{transform:X}),V=z(e,`ALLOWED_ATTR`,lt,{transform:X}),Lt=z(e,`ALLOWED_NAMESPACES`,Rt,{transform:ge}),jt=z(e,`ADD_URI_SAFE_ATTR`,Mt,{transform:X,base:Mt}),kt=z(e,`ADD_DATA_URI_TAGS`,At,{transform:X,base:At}),J=z(e,`FORBID_CONTENTS`,Ot,{transform:X}),ut=z(e,`FORBID_TAGS`,I({}),{transform:X}),dt=z(e,`FORBID_ATTR`,I({}),{transform:X}),Dt=A(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?I(e.USE_PROFILES):e.USE_PROFILES:!1,ft=e.ALLOW_ARIA_ATTR!==!1,pt=e.ALLOW_DATA_ATTR!==!1,mt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ht=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,W=e.SAFE_FOR_TEMPLATES||!1,G=e.SAFE_FOR_XML!==!1,K=e.WHOLE_DOCUMENT||!1,q=e.RETURN_DOM||!1,bt=e.RETURN_DOM_FRAGMENT||!1,xt=e.RETURN_TRUSTED_TYPE||!1,yt=e.FORCE_BODY||!1,St=e.SANITIZE_DOM!==!1,Ct=e.SANITIZE_NAMED_PROPS||!1,Tt=e.KEEP_CONTENT!==!1,Et=e.IN_PLACE||!1,st=De(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:We,Ft=typeof e.NAMESPACE==`string`?e.NAMESPACE:Y,Bt=A(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?I(e.MATHML_TEXT_INTEGRATION_POINTS):F({},zt),Ht=A(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?I(e.HTML_INTEGRATION_POINTS):F({},Vt);let t=A(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?I(e.CUSTOM_ELEMENT_HANDLING):T(null);if(H=T(null),A(t,`tagNameCheck`)&&Jt(t.tagNameCheck)&&(H.tagNameCheck=t.tagNameCheck),A(t,`attributeNameCheck`)&&Jt(t.attributeNameCheck)&&(H.attributeNameCheck=t.attributeNameCheck),A(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(H.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),w(H),W&&(pt=!1),bt&&(q=!0),Dt&&(B=F({},Pe),V=T(null),Dt.html===!0&&(F(B,Oe),F(V,Fe)),Dt.svg===!0&&(F(B,ke),F(V,Ie),F(V,Re)),Dt.svgFilters===!0&&(F(B,Ae),F(V,Ie),F(V,Re)),Dt.mathMl===!0&&(F(B,Me),F(V,Le),F(V,Re))),U.tagCheck=null,U.attributeCheck=null,A(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?U.tagCheck=e.ADD_TAGS:O(e.ADD_TAGS)&&(B===ct&&(B=I(B)),F(B,e.ADD_TAGS,X))),A(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?U.attributeCheck=e.ADD_ATTR:O(e.ADD_ATTR)&&(V===lt&&(V=I(V)),F(V,e.ADD_ATTR,X))),A(e,`ADD_URI_SAFE_ATTR`)&&O(e.ADD_URI_SAFE_ATTR)&&F(jt,e.ADD_URI_SAFE_ATTR,X),A(e,`FORBID_CONTENTS`)&&O(e.FORBID_CONTENTS)&&(J===Ot&&(J=I(J)),F(J,e.FORBID_CONTENTS,X)),A(e,`ADD_FORBID_CONTENTS`)&&O(e.ADD_FORBID_CONTENTS)&&(J===Ot&&(J=I(J)),F(J,e.ADD_FORBID_CONTENTS,X)),Tt&&(B[`#text`]=!0),K&&F(B,[`html`,`head`,`body`]),B.table&&(F(B,[`tbody`]),delete ut.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw N(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw N(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=y;y=e.TRUSTED_TYPES_POLICY;try{b=S(``)}catch(e){throw y=t,e}}else e.TRUSTED_TYPES_POLICY===null?(y=void 0,b=``):(y===void 0&&(y=ce()),y&&typeof b==`string`&&(b=S(``)));C&&C(e),Kt=e},Xt=F({},[...ke,...Ae,...je]),Zt=F({},[...Me,...Ne]),Qt=function(e,t,n){return t.namespaceURI===Y?e===`svg`:t.namespaceURI===Nt?e===`svg`&&(n===`annotation-xml`||Bt[n]):!!Xt[e]},$t=function(e,t,n){return t.namespaceURI===Y?e===`math`:t.namespaceURI===Pt?e===`math`&&Ht[n]:!!Zt[e]},en=function(e,t,n){return t.namespaceURI===Pt&&!Ht[n]||t.namespaceURI===Nt&&!Bt[n]?!1:!Zt[e]&&(Ut[e]||!Xt[e])},tn=function(e){let t=h(e);(!t||!t.tagName)&&(t={namespaceURI:Ft,tagName:`template`});let n=he(e.tagName),r=he(t.tagName);return Lt[e.namespaceURI]?e.namespaceURI===Pt?Qt(n,t,r):e.namespaceURI===Nt?$t(n,t,r):e.namespaceURI===Y?en(n,t,r):!!(Wt===`application/xhtml+xml`&&Lt[e.namespaceURI]):!1},Z=function(e){pe(t.removed,{element:e});try{h(e).removeChild(e)}catch{if(p(e),!h(e))throw N(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},nn=function(e){an(e);let t=m(e);if(t){let e=[];D(t,t=>{pe(e,t)}),D(e,e=>{try{p(e)}catch{}})}let n=ne(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},Q=function(e,n){try{pe(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{pe(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(q||bt)try{Z(n)}catch{}else try{n.setAttribute(e,``)}catch{}},rn=function(e){let t=ne(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||V[X(i)]))try{e.removeAttribute(i)}catch{}}},an=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(g?g(e):e.nodeType)===R.element&&rn(e);let n=m(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},on=function(e){if(!G)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=g?g(e):e.nodeType;if(n===R.processingInstruction||n===R.comment&&M(Xe,e.data)){try{p(e)}catch{}continue}if(n===R.element){let t=e,n=X(_?_(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=m(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},sn=function(e){let t=null,r=null;if(yt)e=`<remove></remove>`+e;else{let t=_e(e,/^[\r\n\t ]+/);r=t&&t[0]}Wt===`application/xhtml+xml`&&Ft===Y&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=y?S(e):e;if(Ft===Y)try{t=new l().parseFromString(i,Wt)}catch{}if(!t||!t.documentElement){t=le.createDocument(Ft,`template`,null);try{t.documentElement.innerHTML=It?b:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ft===Y?Se.call(t,K?`html`:`body`)[0]:K?t.documentElement:a},cn=function(e){let t=v?v(e):e.ownerDocument;return ue.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ln=function(e){return e=ve(e,j,` `),e=ve(e,P,` `),e=ve(e,we,` `),e},un=function(e){e.normalize();let t=v?v(e):e.ownerDocument,n=ue.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=ln(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&D(i,e=>{fn(e.content)&&un(e.content)})},dn=function(e){let t=_?_(e):null;return typeof t!=`string`||X(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ne(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==g(e)||e.childNodes!==m(e)},fn=function(e){if(!g||typeof e!=`object`||!e)return!1;try{return g(e)===R.documentFragment}catch{return!1}},pn=function(e){if(!g||typeof e!=`object`||!e)return!1;try{return typeof g(e)==`number`}catch{return!1}};function $(e,n,r){e.length!==0&&D(e,e=>{e.call(t,n,r,Kt)})}let mn=function(e,t){return!!(G&&e.hasChildNodes()&&!pn(e.firstElementChild)&&M(Ye,e.textContent)&&M(Ye,e.innerHTML)||G&&e.namespaceURI===Y&&t===`style`&&pn(e.firstElementChild)||e.nodeType===R.processingInstruction||G&&e.nodeType===R.comment&&M(Xe,e.data))},hn=function(e,t,n){if(!ut[t]&&bn(t)&&(H.tagNameCheck instanceof RegExp&&M(H.tagNameCheck,t)||H.tagNameCheck instanceof Function&&H.tagNameCheck(t)))return!1;if(Tt&&!J[t]){let t=h(e),r=m(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,ee(e))}}}return Z(e),!0},gn=function(e,t,n,r){return e.length===0?t:t===n||t===r?I(t):t},_n=function(e,n){if($(k.beforeSanitizeElements,e,null),e!==n&&h(e)===null)return Et&&an(e),!0;if(dn(e))return Z(e),!0;let r=X(_?_(e):e.nodeName);if(B=gn(k.uponSanitizeElement,B,ct,_t),$(k.uponSanitizeElement,e,{tagName:r,allowedTags:B}),e!==n&&h(e)===null)return Et&&an(e),!0;if(mn(e,r))return Z(e),!0;if(ut[r]||!(U.tagCheck instanceof Function&&U.tagCheck(r))&&!B[r]){let t=hn(e,r,n);return t===!1&&$(k.afterSanitizeElements,e,null),t}if((g?g(e):e.nodeType)===R.element&&!tn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&M(Ze,e.innerHTML))return Z(e),!0;if(W&&e.nodeType===R.text){let n=ln(e.textContent);e.textContent!==n&&(pe(t.removed,{element:e.cloneNode()}),e.textContent=n)}return $(k.afterSanitizeElements,e,null),!1},vn=function(e,t,r){if(dt[t]||G&&t===`patchsrc`||G&&t===`for`&&e!==`label`&&e!==`output`||St&&(t===`id`||t===`name`)&&(r in n||r in qt))return!1;let i=V[t]||U.attributeCheck instanceof Function&&U.attributeCheck(t,e);if(!(pt&&M(Te,t))&&!(ft&&M(rt,t))){if(!i){if(!(bn(e)&&(H.tagNameCheck instanceof RegExp&&M(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&M(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t,e))||t===`is`&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&M(H.tagNameCheck,r)||H.tagNameCheck instanceof Function&&H.tagNameCheck(r))))return!1}else if(!jt[t]&&!M(st,ve(r,at,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ye(r,`data:`)===0&&kt[e])&&!(mt&&!M(it,ve(r,at,``)))&&r)return!1}return!0},yn=F({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),bn=function(e){return!yn[he(e)]&&M(ot,e)},xn=function(e,t,n,r){if(y&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return S(r);case`TrustedScriptURL`:return se(r)}return r},Sn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),dn(e)?Z(e):fe(t.removed)}catch{Q(n,e)}},Cn=function(e){$(k.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||dn(e))return;V=gn(k.uponSanitizeAttribute,V,lt,vt);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0},r=t.length,i=X(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=X(o),u=c,d=o===`value`?u:be(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,$(k.uponSanitizeAttribute,e,n),d=n.attrValue,Ct&&(l===`id`||l===`name`)&&ye(d,wt)!==0&&(Q(o,e),d=wt+d),G&&M(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Q(o,e);continue}if(l===`attributename`&&_e(d,`href`)){Q(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){Q(o,e);continue}if(!ht&&M(Qe,d)){Q(o,e);continue}if(W&&(d=ln(d)),!vn(i,l,d)){Q(o,e);continue}d=xn(i,l,s,d),d!==u&&Sn(e,o,s,d)}}$(k.afterSanitizeAttributes,e,null)},wn=function(e){let t=null,n=cn(e);for($(k.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(k.uponSanitizeShadowNode,t,null),_n(t,e),Cn(t),fn(t.content)&&wn(t.content),(g?g(t):t.nodeType)===R.element){let e=te(t);fn(e)&&(Tn(e),wn(e))}$(k.afterSanitizeShadowDOM,e,null)},Tn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){wn(e.shadow);continue}let n=e.node,r=(g?g(n):n.nodeType)===R.element,i=m(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=_?_(n):null;if(typeof e==`string`&&X(e)===`template`){let e=n.content;fn(e)&&t.push({node:e,shadow:null})}}if(r){let e=te(n);fn(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(It=!e,It&&(e=`<!-->`),typeof e!=`string`&&!pn(e)&&(e=Ee(e),typeof e!=`string`))throw N(`dirty is not a string, aborting`);if(!t.isSupported)return e;gt?(B=_t,V=vt):Yt(n),(k.uponSanitizeElement.length>0||k.uponSanitizeAttribute.length>0)&&(B=I(B)),k.uponSanitizeAttribute.length>0&&(V=I(V)),t.removed=[];let c=Et&&typeof e!=`string`&&pn(e);if(c){on(e);let t=_?_(e):e.nodeName;if(typeof t==`string`){let n=X(t);if(!B[n]||ut[n])throw nn(e),N(`root node is forbidden and cannot be sanitized in-place`)}if(dn(e))throw nn(e),N(`root node is clobbered and cannot be sanitized in-place`);try{Tn(e)}catch(t){throw nn(e),t}}else if(pn(e))i=sn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===R.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Tn(a);else{if(!q&&!W&&!K&&e.indexOf(`<`)===-1)return y&&xt?S(e):e;if(i=sn(e),!i)return q?null:xt?b:``}i&&yt&&Z(i.firstChild);let l=c?e:i;try{let e=cn(l);for(;o=e.nextNode();)_n(o,l),Cn(o),fn(o.content)&&wn(o.content)}catch(n){throw c&&(nn(e),D(t.removed,e=>{e.element&&an(e.element)})),n}if(c)return D(t.removed,e=>{e.element&&an(e.element)}),W&&un(e),e;if(q){if(W&&un(i),bt)for(s=xe.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(V.shadowroot||V.shadowrootmode)&&(s=Ce.call(r,s,!0)),s}let u=K?i.outerHTML:i.innerHTML;return K&&B[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&M(qe,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
@@ -162,7 +162,7 @@ When any tool that returns untrusted external content is active (`fetch_url`, `w
162
162
  **Layer B — Structural wrapping (`wrapUntrustedContent`)**
163
163
  The utility in `src/worker/utils/wrapUntrustedContent.ts` wraps externally-sourced body content in labeled delimiters:
164
164
 
165
- ```
165
+ ```text
166
166
  --- BEGIN EXTERNAL CONTENT (UNTRUSTED: <toolName>) ---
167
167
  <content>
168
168
  --- END EXTERNAL CONTENT ---
@@ -235,9 +235,10 @@ When a user manually toggles individual tools:
235
235
 
236
236
  When the browser WebMCP API is available (`document.modelContext`, with `navigator.modelContext` fallback), tools are also registered via `src/subsystems/mcp/webmcp.ts` so browser-side model contexts can invoke the same tool surface through `registerWebMcpTools()`.
237
237
 
238
- WebMCP mode can be toggled between `"polyfill"` and `"native"` in Tool Configuration:
238
+ WebMCP mode can be toggled between `"polyfill"` and `"native"` in Tool Configuration. Tools are registered with accurate metadata annotations:
239
239
 
240
- - `readOnlyHint: false`
240
+ - `readOnlyHint`: `true` for non-mutating query tools, `false` for mutating/consequential tools
241
+ - `consequentialHint`: `true` for destructive, irreversible, or external real-world actions (`bash`, `delete_file`, `delete_task`, `git_push`, `email_send_message`, etc.) requiring user confirmation (Chrome 154.0.8017.0+ / WebMCP issue #176)
241
242
  - `untrustedContentHint: true` (tool output may contain untrusted/user or external data)
242
243
 
243
244
  Tool registration is managed with `AbortController` signals passed to `registerTool(...)`, and shutdown aborts those signals while also attempting legacy `unregisterTool` when available.
@@ -101,12 +101,17 @@ Returns `true` on success, `false` if the ModelContext API is unavailable.
101
101
  Registration is **idempotent** — tools already in `registeredToolNames` are skipped on
102
102
  subsequent calls. The event loop is yielded between each registration to avoid blocking.
103
103
 
104
- Each tool is registered with these annotations:
104
+ Each tool is registered with annotations resolved by `resolveWebMcpToolAnnotations(toolName)`:
105
+
106
+ - `consequentialHint`: `true` for high-stakes, irreversible, or real-world actions requiring user confirmation (Chrome 154.0.8017.0+ / Issue #176). E.g. `bash`, `delete_file`, `delete_task`, `git_delete_repo`, `git_delete_branch`, `git_reset`, `git_push`, `email_send_message`, `clear_chat`.
107
+ - `readOnlyHint`: `true` for query/inspection tools that do not mutate state (e.g. `read_file`, `list_files`, `git_status`, `list_tasks`). `false` for mutating or consequential tools.
108
+ - `untrustedContentHint`: `true` (tool outputs may contain untrusted user or external web data).
105
109
 
106
110
  ```ts
107
111
  annotations: {
108
- readOnlyHint: false, // tools may mutate state
109
- untrustedContentHint: true // outputs may contain untrusted content
112
+ readOnlyHint: isReadOnly, // true for read-only query tools
113
+ consequentialHint: isConsequential, // true for destructive / irreversible actions
114
+ untrustedContentHint: true, // outputs may contain untrusted content
110
115
  }
111
116
  ```
112
117
 
@@ -131,6 +136,15 @@ Queries tools registered on `document.modelContext.getTools()` while practicing
131
136
  2. If `getTools()` is absent (older browser builds or basic polyfills), returns an empty array `[]` without throwing.
132
137
  3. Normalizes `inputSchema` on every returned tool so callers receive a JavaScript object regardless of Chrome version or polyfill implementation.
133
138
 
139
+ ### `executeWebMcpTool(modelContext, tool, input?, options?): Promise<unknown>`
140
+
141
+ Executes a tool on a WebMCP `ModelContext` instance with backwards compatibility for Chrome 155+ (PR #246 & #251):
142
+
143
+ 1. Accepts an optional JavaScript object directly or a JSON string.
144
+ 2. Calls `modelContext.executeTool(tool, inputObject, options)` first.
145
+ 3. If the host environment rejects with an error starting with `"Failed to parse input"` (Chrome < 155 / `@mcp-b/webmcp-polyfill`) or a WebIDL `TypeError`, it retries with `JSON.stringify(inputObject)`.
146
+ 4. Propagates all other errors without retrying.
147
+
134
148
  ### `unregisterWebMcpTools(): void`
135
149
 
136
150
  Unregisters all previously registered tools.
@@ -186,7 +200,7 @@ If a tool's `input` configuration contains a special `{ "$pipe": ... }` object,
186
200
  - `{ "$pipe": <number> }` — Resolves to the raw output of a specific index (0-indexed).
187
201
  - `{ "$pipe": "<toolName>" }` — Resolves to the raw output of the most recent step that ran a tool with name `<toolName>`.
188
202
 
189
- #### Example — Piping URL contents to a command without using the filesystem:
203
+ #### Example — Piping URL contents to a command without using the filesystem
190
204
 
191
205
  ```json
192
206
  {
@@ -210,7 +224,7 @@ If a tool's `input` configuration contains a special `{ "$pipe": ... }` object,
210
224
 
211
225
  If a tool returns structured content (such as `ToolResultContentBlock[]`), the resolver automatically extracts the text fields and flattens them into a clean string, ensuring seamless Unix-like stdout-to-stdin compatibility.
212
226
 
213
- #### Example — Piping to a JavaScript sandbox:
227
+ #### Example — Piping to a JavaScript sandbox
214
228
 
215
229
  ```json
216
230
  {
@@ -331,6 +345,28 @@ ShadowClaw handles this gracefully with `extractAbortSignal(context)`:
331
345
  - **Pre-aborted signals:** Rejects immediately without posting to the agent worker.
332
346
  - **Chrome < 153 & Legacy Callers (`execute(input)`):** Gracefully falls back to standard execution without signal context when no second argument is provided.
333
347
 
348
+ ### Input Argument Format Compatibility (PR #246, #251 / Chrome 155+)
349
+
350
+ Starting in Chrome 155.0.8052.0 (PRs #246 and #251), `document.modelContext.executeTool()` accepts an optional JavaScript object directly (`executeTool(tool, inputObject)`) instead of requiring stringified JSON (`DOMString`). Note that the returned promise rejects if the input object is neither a valid JavaScript object nor serializable to a JSON string.
351
+
352
+ In Chrome < 155 and early polyfills (including `@mcp-b/webmcp-polyfill` up to 5.1.0), `executeTool()` strictly expects a stringified JSON string (`DOMString`) and rejects with `"Failed to parse input arguments"` or a WebIDL `TypeError` when passed an object.
353
+
354
+ ShadowClaw provides `executeWebMcpTool()` to execute tools with seamless backwards compatibility across Chrome versions and polyfill environments:
355
+
356
+ ```ts
357
+ import { executeWebMcpTool } from "./webmcp.js";
358
+
359
+ const result = await executeWebMcpTool(document.modelContext, toastTool, {
360
+ message: "Hello from 🦞 Shadow Claw!",
361
+ });
362
+ ```
363
+
364
+ Internally, `executeWebMcpTool()`:
365
+
366
+ 1. Passes the JavaScript object to `executeTool(tool, inputObject, options)` first.
367
+ 2. If `executeTool` rejects with an error starting with `"Failed to parse input"` or a `TypeError`, it transparently retries with `JSON.stringify(inputObject)`.
368
+ 3. Propagates all other application or execution errors without retrying.
369
+
334
370
  ### Tool Querying & Graceful Degradation (`getWebMcpTools`)
335
371
 
336
372
  ShadowClaw provides `getWebMcpTools()` to safely query registered WebMCP tools across different browser environments:
@@ -344,18 +380,18 @@ ShadowClaw provides `getWebMcpTools()` to safely query registered WebMCP tools a
344
380
  When dispatching tool calls from external hosts via the Control Plane (`invoke-tool`):
345
381
 
346
382
  1. **Client-Side Gating:** Verifies whether the tool is active in the conversation group (`group.toolTags`) or enabled globally (`toolsStore.enabledToolNames`). Disabled tools are rejected before execution.
347
- 2. **Native Tool Resolution:** Queries `ctx.getTools()` to find the registered `ModelContextTool` object and passes it to `ctx.executeTool(matchedTool, input)` (required by native Chromium).
383
+ 2. **Native Tool Resolution:** Queries `ctx.getTools()` to find the registered `ModelContextTool` object and passes it to `executeWebMcpTool(ctx, matchedTool, input)` (required by native Chromium).
348
384
  3. **Compatibility Fallbacks:** If the native call fails or `getTools()` does not yield a tool object, falls back through `{ name: toolName }`, string tool names, `navigator.modelContextTesting.executeTool`, extension `callTool`, or direct Web Worker execution via `executeTool(db, name, input, groupId, { allowedTools })`.
349
385
  4. **Interactive Timeout:** Extends timeout up to 300 seconds for interactive tools (`ask_user`) to support user review.
350
386
 
351
387
  **ShadowClaw's Role:**
352
- ShadowClaw acts primarily as a **Tool Provider** via `registerTool()`, exposing built-in tools (Bash, Git, etc.) to the browser context for consumption by external AI agents. With `getWebMcpTools()`, ShadowClaw also supports tool discovery with backwards-compatible schema parsing and graceful degradation when running on older browsers or polyfill targets.
388
+ ShadowClaw acts primarily as a **Tool Provider** via `registerTool()`, exposing built-in tools (Bash, Git, etc.) to the browser context for consumption by external AI agents. With `getWebMcpTools()` and `executeWebMcpTool()`, ShadowClaw also acts as a robust tool consumer supporting tool discovery and execution with backwards-compatible schema and argument parsing and graceful degradation when running on older browsers or polyfill targets.
353
389
 
354
390
  ---
355
391
 
356
392
  ## Testing WebMCP Integration
357
393
 
358
- When `document.modelContext` is available (with `navigator.modelContext` fallback for Chrome < 152), tools are registered through the browser's Model Context Protocol (`@mcp-b/webmcp-polyfill` v3). ShadowClaw provides `parseWebMcpInputSchema` to normalize input schemas across Chrome 154+ (native object) and Chrome < 154 (DOMString JSON) versions, and `getWebMcpTools()` to safely query registered tools with graceful degradation.
394
+ When `document.modelContext` is available (with `navigator.modelContext` fallback for Chrome < 152), tools are registered through the browser's Model Context Protocol (`@mcp-b/webmcp-polyfill` v3). ShadowClaw provides `parseWebMcpInputSchema` to normalize input schemas across Chrome 154+ (native object) and Chrome < 154 (DOMString JSON) versions, `getWebMcpTools()` to safely query registered tools with graceful degradation, and `executeWebMcpTool()` to execute tools with backwards-compatible argument handling across Chrome 155+ and legacy environments.
359
395
 
360
396
  To test registered tools directly from the browser DevTools console:
361
397
 
@@ -385,11 +421,20 @@ console.log(formattedToolsJSON);
385
421
  // get the toast tool
386
422
  var [toastTool] = tools.filter((v) => v.description.includes("Show a toast"));
387
423
 
388
- // run the toast tool
389
- await document.modelContext.executeTool(
390
- toastTool,
391
- '{ "message": "Hello from 🦞 Shadow Claw!"}',
392
- );
424
+ // run the toast tool (Chrome 155+ object syntax with backwards-compatible fallback)
425
+ const inputObject = { message: "Hello from 🦞 Shadow Claw!" };
426
+ try {
427
+ await document.modelContext.executeTool(toastTool, inputObject);
428
+ } catch (e) {
429
+ if (e.message?.startsWith("Failed to parse input")) {
430
+ await document.modelContext.executeTool(
431
+ toastTool,
432
+ JSON.stringify(inputObject),
433
+ );
434
+ } else {
435
+ throw e;
436
+ }
437
+ }
393
438
  ```
394
439
 
395
440
  You can also use the [Model Context Tool Inspector](https://chromewebstore.google.com/detail/model-context-tool-inspec/gbpdfapgefenggkahomfgkhfehlcenpd) Chrome extension for interactive visual debugging.
@@ -1 +1 @@
1
- import{t as e}from"./getGroupDir-BwprrdrQ.js";import{p as t}from"./tools-Cp1gequ8.js";async function n(n,r,i){let a=await e(n,r),{dirs:o,filename:s}=t(i),c=a;for(let e of o)c=await c.getDirectoryHandle(e);let l=await(await c.getFileHandle(s)).getFile(),u=URL.createObjectURL(l),d=document.createElement(`a`);d.href=u,d.download=s,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(u)}export{n as t};
1
+ import{t as e}from"./getGroupDir-ZfZsiq6d.js";import{p as t}from"./tools-BwQKGsro.js";async function n(n,r,i){let a=await e(n,r),{dirs:o,filename:s}=t(i),c=a;for(let e of o)c=await c.getDirectoryHandle(e);let l=await(await c.getFileHandle(s)).getFile(),u=URL.createObjectURL(l),d=document.createElement(`a`);d.href=u,d.download=s,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(u)}export{n as t};
@@ -1 +1 @@
1
- import{W as e,it as t,tt as n,v as r}from"./orchestrator-BeJfwtvz.js";function i(i,a){globalThis.__SHADOWCLAW_E2E__={isReady(){return i.ready},getDb(){return a.db},getActiveGroupId(){return i.activeGroupId},async createConversation(e){let t=a.db;if(!t)throw Error(`[E2E Bridge] DB not ready`);return i.createConversation(t,e)},async switchConversation(e){let t=a.db;if(!t)throw Error(`[E2E Bridge] DB not ready`);await i.switchConversation(t,e)},async loadTasks(){let e=a.db;if(!e)throw Error(`[E2E Bridge] DB not ready`);await i.loadTasks(e)},async configureProvider(o,s,c,l){let u=i.orchestrator,d=a.db;if(!u||!d)throw Error(`[E2E Bridge] Orchestrator or DB not ready`);await t(u,d,o,{loadApiKeyForProvider:u.loadApiKeyForProvider.bind(u),getApiKeyForHeaders:()=>e(u)}),await u.setApiKey(d,s),await n(u,d,c),await r(u,d,l)}}}function a(){return globalThis.__SHADOWCLAW_E2E_ENABLE__===!0}export{a as n,i as t};
1
+ import{W as e,it as t,tt as n,v as r}from"./orchestrator-Bi5OdVZD.js";function i(i,a){globalThis.__SHADOWCLAW_E2E__={isReady(){return i.ready},getDb(){return a.db},getActiveGroupId(){return i.activeGroupId},async createConversation(e){let t=a.db;if(!t)throw Error(`[E2E Bridge] DB not ready`);return i.createConversation(t,e)},async switchConversation(e){let t=a.db;if(!t)throw Error(`[E2E Bridge] DB not ready`);await i.switchConversation(t,e)},async loadTasks(){let e=a.db;if(!e)throw Error(`[E2E Bridge] DB not ready`);await i.loadTasks(e)},async configureProvider(o,s,c,l){let u=i.orchestrator,d=a.db;if(!u||!d)throw Error(`[E2E Bridge] Orchestrator or DB not ready`);await t(u,d,o,{loadApiKeyForProvider:u.loadApiKeyForProvider.bind(u),getApiKeyForHeaders:()=>e(u)}),await u.setApiKey(d,s),await n(u,d,c),await r(u,d,l)}}}function a(){return globalThis.__SHADOWCLAW_E2E_ENABLE__===!0}export{a as n,i as t};
@@ -1 +1 @@
1
- import{o as e}from"./config-Bnwx4EfS.js";import{t}from"./dist-B9m1QM9v.js";import{dn as n}from"./orchestrator-BeJfwtvz.js";import{t as r}from"./getGroupDir-BwprrdrQ.js";import{f as i,p as a}from"./tools-Cp1gequ8.js";async function o(e,t,n){let i=await r(e,t),{dirs:o,filename:s}=a(n),c=i;for(let e of o)c=await c.getDirectoryHandle(e);return await(await c.getFileHandle(s)).getFile()}const s=new class{_file;constructor(){this._file=new t.State(null)}closeFile(){this._file.set(null)}get file(){return this._file.get()}getFile(){return this.file}getPreviewBinaryMimeType(e){return{"3gp":`video/3gpp`,"7z":`application/x-7z-compressed`,aac:`audio/aac`,apng:`image/apng`,avi:`video/x-msvideo`,avif:`image/avif`,bin:`application/octet-stream`,bmp:`image/bmp`,db:`application/vnd.sqlite3`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dylib:`application/octet-stream`,exe:`application/vnd.microsoft.portable-executable`,flac:`audio/flac`,flv:`video/x-flv`,gif:`image/gif`,gz:`application/gzip`,heic:`image/heic`,heif:`image/heif`,ico:`image/x-icon`,iso:`application/octet-stream`,jpeg:`image/jpeg`,jpg:`image/jpeg`,m4a:`audio/mp4`,m4v:`video/mp4`,mkv:`video/x-matroska`,mov:`video/mp4`,mp3:`audio/mpeg`,mp4:`video/mp4`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,png:`image/png`,rar:`application/vnd.rar`,so:`application/octet-stream`,sqlite:`application/vnd.sqlite3`,sqlite3:`application/vnd.sqlite3`,tar:`application/x-tar`,tif:`image/tiff`,tiff:`image/tiff`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webp:`image/webp`,wmv:`video/x-ms-wmv`,zip:`application/zip`}[e.toLowerCase().split(`.`).pop()||``]||``}async openFile(t,r,a=e){try{let e=r.split(`/`).pop()||r,s=/\.pdf$/i.test(e),c=this.getPreviewBinaryMimeType(e);if(s){let i=await n(t,a,r);this._file.set({name:e,path:r,groupId:a,content:``,kind:`pdf`,binaryContent:i,mimeType:`application/pdf`});return}if(c){let n=await o(t,a,r);this._file.set({name:e,path:r,groupId:a,content:``,kind:`binary`,binaryContent:null,nativeFile:n,mimeType:c});return}let l=await i(t,a,r);this._file.set({name:e,path:r,groupId:a,content:l,kind:`text`,binaryContent:null,mimeType:`text/plain`})}catch(e){throw console.error(`Failed to open file:`,r,e),e}}};export{s as t};
1
+ import{o as e}from"./config-BqecTktB.js";import{t}from"./dist-B9m1QM9v.js";import{dn as n}from"./orchestrator-Bi5OdVZD.js";import{t as r}from"./getGroupDir-ZfZsiq6d.js";import{f as i,p as a}from"./tools-BwQKGsro.js";async function o(e,t,n){let i=await r(e,t),{dirs:o,filename:s}=a(n),c=i;for(let e of o)c=await c.getDirectoryHandle(e);return await(await c.getFileHandle(s)).getFile()}const s=new class{_file;constructor(){this._file=new t.State(null)}closeFile(){this._file.set(null)}get file(){return this._file.get()}getFile(){return this.file}getPreviewBinaryMimeType(e){return{"3gp":`video/3gpp`,"7z":`application/x-7z-compressed`,aac:`audio/aac`,apng:`image/apng`,avi:`video/x-msvideo`,avif:`image/avif`,bin:`application/octet-stream`,bmp:`image/bmp`,db:`application/vnd.sqlite3`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dylib:`application/octet-stream`,exe:`application/vnd.microsoft.portable-executable`,flac:`audio/flac`,flv:`video/x-flv`,gif:`image/gif`,gz:`application/gzip`,heic:`image/heic`,heif:`image/heif`,ico:`image/x-icon`,iso:`application/octet-stream`,jpeg:`image/jpeg`,jpg:`image/jpeg`,m4a:`audio/mp4`,m4v:`video/mp4`,mkv:`video/x-matroska`,mov:`video/mp4`,mp3:`audio/mpeg`,mp4:`video/mp4`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,png:`image/png`,rar:`application/vnd.rar`,so:`application/octet-stream`,sqlite:`application/vnd.sqlite3`,sqlite3:`application/vnd.sqlite3`,tar:`application/x-tar`,tif:`image/tiff`,tiff:`image/tiff`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webp:`image/webp`,wmv:`video/x-ms-wmv`,zip:`application/zip`}[e.toLowerCase().split(`.`).pop()||``]||``}async openFile(t,r,a=e){try{let e=r.split(`/`).pop()||r,s=/\.pdf$/i.test(e),c=this.getPreviewBinaryMimeType(e);if(s){let i=await n(t,a,r);this._file.set({name:e,path:r,groupId:a,content:``,kind:`pdf`,binaryContent:i,mimeType:`application/pdf`});return}if(c){let n=await o(t,a,r);this._file.set({name:e,path:r,groupId:a,content:``,kind:`binary`,binaryContent:null,nativeFile:n,mimeType:c});return}let l=await i(t,a,r);this._file.set({name:e,path:r,groupId:a,content:l,kind:`text`,binaryContent:null,mimeType:`text/plain`})}catch(e){throw console.error(`Failed to open file:`,r,e),e}}};export{s as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{r as t,x as n}from"./config-Bnwx4EfS.js";import{a as r}from"./app-routes-BMQ4HFaM.js";import{t as i}from"./txPromise-EBECky1b.js";import{t as a}from"./getConfig-D89uJgo5.js";import{t as o}from"./memoryStorage-C1llaYus.js";async function s(e,...t){let n=e;for(let e of t){let t=await n.getDirectoryHandle(e,{create:!0});if(typeof n.isSameEntry==`function`&&await n.isSameEntry(t))throw Error(`Directory navigation failed: "${e}" resolved to the same directory as its parent. The stored directory handle may be stale — try re-selecting the storage folder.`);n=t}return n}function c(e,t){return i(e,`config`,`readwrite`,e=>e.delete(t)).then(()=>void 0)}let l=null;async function u(e,t){try{return await e.entries().next(),`granted`}catch{return t}}function d(){let e=r();return e?`${n}-${e}`:n}async function f(){try{if(typeof navigator<`u`&&navigator.storage&&typeof navigator.storage.getDirectory==`function`){let e=await navigator.storage.getDirectory(),t=d();return await e.getDirectoryHandle(t,{create:!0})}}catch(e){console.warn(`OPFS is unavailable (e.g. Firefox Private Browsing). Using in-memory storage fallback:`,e)}return o()}function p(e){if(!e||typeof e!=`object`)return!1;let t=globalThis.FileSystemDirectoryHandle;return t!==void 0&&e instanceof t||typeof e.getDirectoryHandle==`function`&&typeof e.getFileHandle==`function`}async function m(e){if(l)return l;try{let n=await a(e,t.STORAGE_HANDLE);if(p(n)){let e=n;if(typeof e.queryPermission==`function`&&await e.queryPermission({mode:`readwrite`})!==`granted`&&typeof e.requestPermission==`function`)try{await e.requestPermission({mode:`readwrite`})}catch{}return e}}catch(e){console.warn(`Failed to retrieve local storage handle from DB:`,e)}return f()}function h(e){l=e}function g(){l=null}function _(e){return e instanceof DOMException&&e.name===`InvalidStateError`}async function v(e){await c(e,t.STORAGE_HANDLE),l=null}async function y(e){if(l)try{let e=await l.queryPermission({mode:`readwrite`});return{type:`local`,permission:e===`granted`?`granted`:await u(l,e),name:l.name}}catch{console.warn(`Getting storage status failed for explicit storage root.`)}try{let n=await a(e,t.STORAGE_HANDLE);if(p(n)){let e=n,t=await e.queryPermission({mode:`readwrite`});return{type:`local`,permission:t===`granted`?`granted`:await u(e,t),name:e.name}}}catch(e){console.warn(`Failed to check storage status:`,e)}return{type:`opfs`,permission:`granted`,name:`OPFS`}}var b=e({getGroupDir:()=>x});async function x(e,t){return s(await m(e),`groups`,t.replace(/:/g,`-`))}export{y as a,v as c,m as i,h as l,b as n,g as o,d as r,_ as s,x as t};
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{r as t,x as n}from"./config-BqecTktB.js";import{a as r}from"./app-routes-BMQ4HFaM.js";import{t as i}from"./txPromise-EBECky1b.js";import{t as a}from"./getConfig-D89uJgo5.js";import{t as o}from"./memoryStorage-Bh8fjmip.js";async function s(e,...t){let n=e;for(let e of t){let t=await n.getDirectoryHandle(e,{create:!0});if(typeof n.isSameEntry==`function`&&await n.isSameEntry(t))throw Error(`Directory navigation failed: "${e}" resolved to the same directory as its parent. The stored directory handle may be stale — try re-selecting the storage folder.`);n=t}return n}function c(e,t){return i(e,`config`,`readwrite`,e=>e.delete(t)).then(()=>void 0)}let l=null;async function u(e,t){try{return await e.entries().next(),`granted`}catch{return t}}function d(){let e=r();return e?`${n}-${e}`:n}async function f(){try{if(typeof navigator<`u`&&navigator.storage&&typeof navigator.storage.getDirectory==`function`){let e=await navigator.storage.getDirectory(),t=d();return await e.getDirectoryHandle(t,{create:!0})}}catch(e){console.warn(`OPFS is unavailable (e.g. Firefox Private Browsing). Using in-memory storage fallback:`,e)}return o()}function p(e){if(!e||typeof e!=`object`)return!1;let t=globalThis.FileSystemDirectoryHandle;return t!==void 0&&e instanceof t||typeof e.getDirectoryHandle==`function`&&typeof e.getFileHandle==`function`}async function m(e){if(l)return l;try{let n=await a(e,t.STORAGE_HANDLE);if(p(n)){let e=n;if(typeof e.queryPermission==`function`&&await e.queryPermission({mode:`readwrite`})!==`granted`&&typeof e.requestPermission==`function`)try{await e.requestPermission({mode:`readwrite`})}catch{}return e}}catch(e){console.warn(`Failed to retrieve local storage handle from DB:`,e)}return f()}function h(e){l=e}function g(){l=null}function _(e){return e instanceof DOMException&&e.name===`InvalidStateError`}async function v(e){await c(e,t.STORAGE_HANDLE),l=null}async function y(e){if(l)try{let e=await l.queryPermission({mode:`readwrite`});return{type:`local`,permission:e===`granted`?`granted`:await u(l,e),name:l.name}}catch{console.warn(`Getting storage status failed for explicit storage root.`)}try{let n=await a(e,t.STORAGE_HANDLE);if(p(n)){let e=n,t=await e.queryPermission({mode:`readwrite`});return{type:`local`,permission:t===`granted`?`granted`:await u(e,t),name:e.name}}}catch(e){console.warn(`Failed to check storage status:`,e)}return{type:`opfs`,permission:`granted`,name:`OPFS`}}var b=e({getGroupDir:()=>x});async function x(e,t){return s(await m(e),`groups`,t.replace(/:/g,`-`))}export{y as a,v as c,m as i,h as l,b as n,g as o,d as r,_ as s,x as t};
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,i as r}from"./config-Bnwx4EfS.js";import{t as i}from"./browser-nBz_r6l4.js";import{t as a}from"./buffer-9oRIc-5Z.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./constants-BR3kgTKA.js";import{n as f,t as p}from"./crypto-browserify-U1v0eryt.js";var m=t(((t,n)=>{var r=e(i()),a=function(e){if(e||={},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(r.default===void 0||r.default.domain===void 0)throw Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||a.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||a.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||a.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=a.DEFAULT_MAX_PENDING};a.DEFAULT_TIMEOUT=0,a.DEFAULT_MAX_OCCUPATION_TIME=0,a.DEFAULT_MAX_EXECUTION_TIME=0,a.DEFAULT_MAX_PENDING=1e3,a.prototype.acquire=function(e,t,n,i){if(Array.isArray(e))return this._acquireBatch(e,t,n,i);if(typeof t!=`function`)throw Error(`You must pass a function to execute`);var a=null,o=null,s=null;typeof n!=`function`&&(i=n,n=null,s=new this.Promise(function(e,t){a=e,o=t})),i||={};var c=!1,l=null,u=null,d=null,f=this,p=function(t,r,i){u&&=(clearTimeout(u),null),d&&=(clearTimeout(d),null),t&&(f.queues[e]&&f.queues[e].length===0&&delete f.queues[e],f.domainReentrant&&delete f.domains[e]),c||=(s?r?o(r):a(i):typeof n==`function`&&n(r,i),!0),t&&f.queues[e]&&f.queues[e].length>0&&f.queues[e].shift()()},m=function(n){if(c)return p(n);l&&=(clearTimeout(l),null),f.domainReentrant&&n&&(f.domains[e]=r.default.domain);var a=i.maxExecutionTime||f.maxExecutionTime;if(a&&(d=setTimeout(function(){f.queues[e]&&p(n,Error(`Maximum execution time is exceeded `+e))},a)),t.length===1){var o=!1;try{t(function(e,t){o||(o=!0,p(n,e,t))})}catch(e){o||(o=!0,p(n,e))}}else f._promiseTry(function(){return t()}).then(function(e){p(n,void 0,e)},function(e){p(n,e)})};f.domainReentrant&&r.default.domain&&(m=r.default.domain.bind(m));var h=i.maxPending||f.maxPending;if(!f.queues[e])f.queues[e]=[],m(!0);else if(f.domainReentrant&&r.default.domain&&r.default.domain===f.domains[e])m(!1);else if(f.queues[e].length>=h)p(!1,Error(`Too many pending tasks in queue `+e));else{var g=function(){m(!0)};i.skipQueue?f.queues[e].unshift(g):f.queues[e].push(g);var _=i.timeout||f.timeout;_&&(l=setTimeout(function(){l=null,p(!1,Error(`async-lock timed out in queue `+e))},_))}var v=i.maxOccupationTime||f.maxOccupationTime;if(v&&(u=setTimeout(function(){f.queues[e]&&p(!1,Error(`Maximum occupation time is exceeded in queue `+e))},v)),s)return s},a.prototype._acquireBatch=function(e,t,n,r){typeof n!=`function`&&(r=n,n=null);var i=this,a=function(e,t){return function(n){i.acquire(e,t,n,r)}},o=e.reduceRight(function(e,t){return a(t,e)},t);if(typeof n==`function`)o(n);else return new this.Promise(function(e,t){o.length===1?o(function(n,r){n?t(n):e(r)}):e(o())})},a.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},a.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(e){return this.Promise.reject(e)}},n.exports=a})),h=t(((e,t)=>{t.exports=m()})),g=t((e=>{
1
+ import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,i as r}from"./config-BqecTktB.js";import{t as i}from"./browser-nBz_r6l4.js";import{t as a}from"./buffer-9oRIc-5Z.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./constants-BR3kgTKA.js";import{n as f,t as p}from"./crypto-browserify-U1v0eryt.js";var m=t(((t,n)=>{var r=e(i()),a=function(e){if(e||={},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(r.default===void 0||r.default.domain===void 0)throw Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||a.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||a.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||a.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=a.DEFAULT_MAX_PENDING};a.DEFAULT_TIMEOUT=0,a.DEFAULT_MAX_OCCUPATION_TIME=0,a.DEFAULT_MAX_EXECUTION_TIME=0,a.DEFAULT_MAX_PENDING=1e3,a.prototype.acquire=function(e,t,n,i){if(Array.isArray(e))return this._acquireBatch(e,t,n,i);if(typeof t!=`function`)throw Error(`You must pass a function to execute`);var a=null,o=null,s=null;typeof n!=`function`&&(i=n,n=null,s=new this.Promise(function(e,t){a=e,o=t})),i||={};var c=!1,l=null,u=null,d=null,f=this,p=function(t,r,i){u&&=(clearTimeout(u),null),d&&=(clearTimeout(d),null),t&&(f.queues[e]&&f.queues[e].length===0&&delete f.queues[e],f.domainReentrant&&delete f.domains[e]),c||=(s?r?o(r):a(i):typeof n==`function`&&n(r,i),!0),t&&f.queues[e]&&f.queues[e].length>0&&f.queues[e].shift()()},m=function(n){if(c)return p(n);l&&=(clearTimeout(l),null),f.domainReentrant&&n&&(f.domains[e]=r.default.domain);var a=i.maxExecutionTime||f.maxExecutionTime;if(a&&(d=setTimeout(function(){f.queues[e]&&p(n,Error(`Maximum execution time is exceeded `+e))},a)),t.length===1){var o=!1;try{t(function(e,t){o||(o=!0,p(n,e,t))})}catch(e){o||(o=!0,p(n,e))}}else f._promiseTry(function(){return t()}).then(function(e){p(n,void 0,e)},function(e){p(n,e)})};f.domainReentrant&&r.default.domain&&(m=r.default.domain.bind(m));var h=i.maxPending||f.maxPending;if(!f.queues[e])f.queues[e]=[],m(!0);else if(f.domainReentrant&&r.default.domain&&r.default.domain===f.domains[e])m(!1);else if(f.queues[e].length>=h)p(!1,Error(`Too many pending tasks in queue `+e));else{var g=function(){m(!0)};i.skipQueue?f.queues[e].unshift(g):f.queues[e].push(g);var _=i.timeout||f.timeout;_&&(l=setTimeout(function(){l=null,p(!1,Error(`async-lock timed out in queue `+e))},_))}var v=i.maxOccupationTime||f.maxOccupationTime;if(v&&(u=setTimeout(function(){f.queues[e]&&p(!1,Error(`Maximum occupation time is exceeded in queue `+e))},v)),s)return s},a.prototype._acquireBatch=function(e,t,n,r){typeof n!=`function`&&(r=n,n=null);var i=this,a=function(e,t){return function(n){i.acquire(e,t,n,r)}},o=e.reduceRight(function(e,t){return a(t,e)},t);if(typeof n==`function`)o(n);else return new this.Promise(function(e,t){o.length===1?o(function(n,r){n?t(n):e(r)}):e(o())})},a.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},a.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(e){return this.Promise.reject(e)}},n.exports=a})),h=t(((e,t)=>{t.exports=m()})),g=t((e=>{
2
2
  /*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
3
3
  (function(t){typeof DO_NOT_EXPORT_CRC>`u`?typeof e==`object`?t(e):typeof define==`function`&&define.amd?define(function(){var e={};return t(e),e}):t({}):t({})})(function(e){e.version=`1.2.2`;function t(){for(var e=0,t=Array(256),n=0;n!=256;++n)e=n,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,t[n]=e;return typeof Int32Array<`u`?new Int32Array(t):t}var n=t();function r(e){var t=0,n=0,r=0,i=typeof Int32Array<`u`?new Int32Array(4096):Array(4096);for(r=0;r!=256;++r)i[r]=e[r];for(r=0;r!=256;++r)for(n=e[r],t=256+r;t<4096;t+=256)n=i[t]=n>>>8^e[n&255];var a=[];for(r=1;r!=16;++r)a[r-1]=typeof Int32Array<`u`?i.subarray(r*256,r*256+256):i.slice(r*256,r*256+256);return a}var i=r(n),a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14];function b(e,t){for(var r=t^-1,i=0,a=e.length;i<a;)r=r>>>8^n[(r^e.charCodeAt(i++))&255];return~r}function x(e,t){for(var r=t^-1,i=e.length-15,b=0;b<i;)r=y[e[b++]^r&255]^v[e[b++]^r>>8&255]^_[e[b++]^r>>16&255]^g[e[b++]^r>>>24]^h[e[b++]]^m[e[b++]]^p[e[b++]]^f[e[b++]]^d[e[b++]]^u[e[b++]]^l[e[b++]]^c[e[b++]]^s[e[b++]]^o[e[b++]]^a[e[b++]]^n[e[b++]];for(i+=15;b<i;)r=r>>>8^n[(r^e[b++])&255];return~r}function S(e,t){for(var r=t^-1,i=0,a=e.length,o=0,s=0;i<a;)o=e.charCodeAt(i++),o<128?r=r>>>8^n[(r^o)&255]:o<2048?(r=r>>>8^n[(r^(192|o>>6&31))&255],r=r>>>8^n[(r^(128|o&63))&255]):o>=55296&&o<57344?(o=(o&1023)+64,s=e.charCodeAt(i++)&1023,r=r>>>8^n[(r^(240|o>>8&7))&255],r=r>>>8^n[(r^(128|o>>2&63))&255],r=r>>>8^n[(r^(128|s>>6&15|(o&3)<<4))&255],r=r>>>8^n[(r^(128|s&63))&255]):(r=r>>>8^n[(r^(224|o>>12&15))&255],r=r>>>8^n[(r^(128|o>>6&63))&255],r=r>>>8^n[(r^(128|o&63))&255]);return~r}e.table=n,e.bstr=b,e.buf=x,e.str=S})})),_=t((e=>{var t=o(),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var i=new t.Buf8(256),a=0;a<256;a++)i[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;i[254]=i[254]=1,e.string2buf=function(e){var n,r,i,a,o,s=e.length,c=0;for(a=0;a<s;a++)r=e.charCodeAt(a),(r&64512)==55296&&a+1<s&&(i=e.charCodeAt(a+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),a++)),c+=r<128?1:r<2048?2:r<65536?3:4;for(n=new t.Buf8(c),o=0,a=0;o<c;a++)r=e.charCodeAt(a),(r&64512)==55296&&a+1<s&&(i=e.charCodeAt(a+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),a++)),r<128?n[o++]=r:r<2048?(n[o++]=192|r>>>6,n[o++]=128|r&63):r<65536?(n[o++]=224|r>>>12,n[o++]=128|r>>>6&63,n[o++]=128|r&63):(n[o++]=240|r>>>18,n[o++]=128|r>>>12&63,n[o++]=128|r>>>6&63,n[o++]=128|r&63);return n};function s(e,i){if(i<65534&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,t.shrinkBuf(e,i));for(var a=``,o=0;o<i;o++)a+=String.fromCharCode(e[o]);return a}e.buf2binstring=function(e){return s(e,e.length)},e.binstring2buf=function(e){for(var n=new t.Buf8(e.length),r=0,i=n.length;r<i;r++)n[r]=e.charCodeAt(r);return n},e.buf2string=function(e,t){var n,r,a,o,c=t||e.length,l=Array(c*2);for(r=0,n=0;n<c;){if(a=e[n++],a<128){l[r++]=a;continue}if(o=i[a],o>4){l[r++]=65533,n+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&n<c;)a=a<<6|e[n++]&63,o--;if(o>1){l[r++]=65533;continue}a<65536?l[r++]=a:(a-=65536,l[r++]=55296|a>>10&1023,l[r++]=56320|a&1023)}return s(l,r)},e.utf8border=function(e,t){var n;for(t||=e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+i[e[n]]>t?n:t}})),v=t((e=>{var t=u(),n=o(),r=_(),i=s(),a=l(),c=Object.prototype.toString,d=0,f=4,p=0,m=1,h=2,g=-1,v=0,y=8;function b(e){if(!(this instanceof b))return new b(e);this.options=n.assign({level:g,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:v,to:``},e||{});var o=this.options;o.raw&&o.windowBits>0?o.windowBits=-o.windowBits:o.gzip&&o.windowBits>0&&o.windowBits<16&&(o.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var s=t.deflateInit2(this.strm,o.level,o.method,o.windowBits,o.memLevel,o.strategy);if(s!==p)throw Error(i[s]);if(o.header&&t.deflateSetHeader(this.strm,o.header),o.dictionary){var l=typeof o.dictionary==`string`?r.string2buf(o.dictionary):c.call(o.dictionary)===`[object ArrayBuffer]`?new Uint8Array(o.dictionary):o.dictionary;if(s=t.deflateSetDictionary(this.strm,l),s!==p)throw Error(i[s]);this._dict_set=!0}}b.prototype.push=function(e,i){var a=this.strm,o=this.options.chunkSize,s,l;if(this.ended)return!1;l=i===~~i?i:i===!0?f:d,typeof e==`string`?a.input=r.string2buf(e):c.call(e)===`[object ArrayBuffer]`?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(a.avail_out===0&&(a.output=new n.Buf8(o),a.next_out=0,a.avail_out=o),s=t.deflate(a,l),s!==m&&s!==p)return this.onEnd(s),this.ended=!0,!1;(a.avail_out===0||a.avail_in===0&&(l===f||l===h))&&(this.options.to===`string`?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||a.avail_out===0)&&s!==m);return l===f?(s=t.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===p):l===h?(this.onEnd(p),a.avail_out=0,!0):!0},b.prototype.onData=function(e){this.chunks.push(e)},b.prototype.onEnd=function(e){e===p&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function x(e,t){var n=new b(t);if(n.push(e,!0),n.err)throw n.msg||i[n.err];return n.result}function S(e,t){return t||={},t.raw=!0,x(e,t)}function C(e,t){return t||={},t.gzip=!0,x(e,t)}e.Deflate=b,e.deflate=x,e.deflateRaw=S,e.gzip=C})),y=t(((e,t)=>{function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}t.exports=n})),b=t((e=>{var t=c(),n=o(),r=_(),i=d(),a=s(),u=l(),f=y(),p=Object.prototype.toString;function m(e){if(!(this instanceof m))return new m(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:``},e||{});var o=this.options;o.raw&&o.windowBits>=0&&o.windowBits<16&&(o.windowBits=-o.windowBits,o.windowBits===0&&(o.windowBits=-15)),o.windowBits>=0&&o.windowBits<16&&!(e&&e.windowBits)&&(o.windowBits+=32),o.windowBits>15&&o.windowBits<48&&(o.windowBits&15||(o.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var s=t.inflateInit2(this.strm,o.windowBits);if(s!==i.Z_OK||(this.header=new f,t.inflateGetHeader(this.strm,this.header),o.dictionary&&(typeof o.dictionary==`string`?o.dictionary=r.string2buf(o.dictionary):p.call(o.dictionary)===`[object ArrayBuffer]`&&(o.dictionary=new Uint8Array(o.dictionary)),o.raw&&(s=t.inflateSetDictionary(this.strm,o.dictionary),s!==i.Z_OK))))throw Error(a[s])}m.prototype.push=function(e,a){var o=this.strm,s=this.options.chunkSize,c=this.options.dictionary,l,u,d,f,m,h=!1;if(this.ended)return!1;u=a===~~a?a:a===!0?i.Z_FINISH:i.Z_NO_FLUSH,typeof e==`string`?o.input=r.binstring2buf(e):p.call(e)===`[object ArrayBuffer]`?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(o.avail_out===0&&(o.output=new n.Buf8(s),o.next_out=0,o.avail_out=s),l=t.inflate(o,i.Z_NO_FLUSH),l===i.Z_NEED_DICT&&c&&(l=t.inflateSetDictionary(this.strm,c)),l===i.Z_BUF_ERROR&&h===!0&&(l=i.Z_OK,h=!1),l!==i.Z_STREAM_END&&l!==i.Z_OK)return this.onEnd(l),this.ended=!0,!1;o.next_out&&(o.avail_out===0||l===i.Z_STREAM_END||o.avail_in===0&&(u===i.Z_FINISH||u===i.Z_SYNC_FLUSH))&&(this.options.to===`string`?(d=r.utf8border(o.output,o.next_out),f=o.next_out-d,m=r.buf2string(o.output,d),o.next_out=f,o.avail_out=s-f,f&&n.arraySet(o.output,o.output,d,f,0),this.onData(m)):this.onData(n.shrinkBuf(o.output,o.next_out))),o.avail_in===0&&o.avail_out===0&&(h=!0)}while((o.avail_in>0||o.avail_out===0)&&l!==i.Z_STREAM_END);return l===i.Z_STREAM_END&&(u=i.Z_FINISH),u===i.Z_FINISH?(l=t.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,l===i.Z_OK):u===i.Z_SYNC_FLUSH?(this.onEnd(i.Z_OK),o.avail_out=0,!0):!0},m.prototype.onData=function(e){this.chunks.push(e)},m.prototype.onEnd=function(e){e===i.Z_OK&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function h(e,t){var n=new m(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}function g(e,t){return t||={},t.raw=!0,h(e,t)}e.Inflate=m,e.inflate=h,e.inflateRaw=g,e.ungzip=h})),x=t(((e,t)=>{var n=o().assign,r=v(),i=b(),a=d(),s={};n(s,r,i,a),t.exports=s})),S=t(((e,t)=>{let n=(e,t)=>function(...n){let r=t.promiseModule;return new r((r,i)=>{t.multiArgs?n.push((...e)=>{t.errorFirst?e[0]?i(e):(e.shift(),r(e)):r(e)}):t.errorFirst?n.push((e,t)=>{e?i(e):r(t)}):n.push(r),e.apply(this,n)})};t.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);let r=typeof e;if(!(e!==null&&(r===`object`||r===`function`)))throw TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?`null`:r}\``);let i=e=>{let n=t=>typeof t==`string`?e===t:t.test(e);return t.include?t.include.some(n):!t.exclude.some(n)},a;a=r===`function`?function(...r){return t.excludeMain?e(...r):n(e,t).apply(this,r)}:Object.create(Object.getPrototypeOf(e));for(let r in e){let o=e[r];a[r]=typeof o==`function`&&i(r)?n(o,t):o}return a}})),C=t(((t,n)=>{var r=e(i());function a(e){return Array.isArray(e)?e:[e]}let o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`node-ignore`;typeof Symbol<`u`&&(f=Symbol.for(`node-ignore`));let p=f,m=(e,t,n)=>Object.defineProperty(e,t,{value:n}),h=/([0-z])-([0-z])/g,g=()=>!1,_=e=>e.replace(h,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),v=e=>{let{length:t}=e;return e.slice(0,t-t%2)},y=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${v(r)}${i}`:i===`]`&&r.length%2==0?`[${_(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],b=Object.create(null),x=(e,t)=>{let n=b[e];return n||(n=y.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),b[e]=n),t?new RegExp(n,`i`):new RegExp(n)},S=e=>typeof e==`string`,C=e=>e&&S(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,w=e=>e.split(u);var T=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let E=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=x(e,t);return new T(n,e,r,i)},D=(e,t)=>{throw new t(e)},O=(e,t,n)=>S(e)?e?!O.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),k=e=>d.test(e);O.isNotRelative=k,O.convert=e=>e;var A=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){m(this,p,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[p]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(C(e)){let t=E(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,a(S(e)?w(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&O.convert(e);return O(i,e,this._allowRelativePaths?g:D),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return a(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let ee=e=>new A(e);if(ee.isPathValid=e=>O(e&&O.convert(e),e,g),ee.default=ee,n.exports=ee,r.default!==void 0&&(r.default.env&&r.default.env.IGNORE_TEST_WIN32||r.default.platform===`win32`)){O.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;O.isNotRelative=t=>e.test(t)||k(t)}})),w=t(((e,t)=>{function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function r(e,t,r){return t=t instanceof RegExp?t:new RegExp(n(t),`g`),e.replace(t,r)}t.exports={clean:function(e){if(typeof e!=`string`)throw Error(`Expected a string, received: `+e);return e=r(e,`./`,`/`),e=r(e,`..`,`.`),e=r(e,` `,`-`),e=r(e,/^[~^:?*\\\-]/g,``),e=r(e,/[~^:?*\\]/g,`-`),e=r(e,/[~^:?*\\\-]$/g,``),e=r(e,`@{`,`-`),e=r(e,/\.$/g,``),e=r(e,/\/$/g,``),e=r(e,/\.lock$/g,``),e}}})),T=t(((e,t)=>{t.exports=function(e,t){var n=e,r=t,i=n.length,a=r.length,o=!1,s=null,c=i+1,l=[],u=[],d=[],f=``,p=-1,m=0,h=1,g,_,v=function(){i>=a&&(g=n,_=i,n=r,r=g,i=a,a=_,o=!0,c=i+1)},y=function(e,t,n){return{x:e,y:t,k:n}},b=function(e,t){return{elem:e,t}},x=function(e,t,o){var s=t>o?l[e-1+c]:l[e+1+c],d,f=Math.max(t,o);for(d=f-e;d<i&&f<a&&n[d]===r[f];)++d,++f;return l[e+c]=u.length,u[u.length]=new y(d,f,s),f},S=function(e){var t=i=1,i,a=s=0,s,c;for(c=e.length-1;c>=0;--c)for(;a<e[c].x||s<e[c].y;)e[c].y-e[c].x>s-a?(o?d[d.length]=new b(r[s],p):d[d.length]=new b(r[s],h),++i,++s):e[c].y-e[c].x<s-a?(o?d[d.length]=new b(n[a],h):d[d.length]=new b(n[a],p),++t,++a):(d[d.length]=new b(n[a],m),f+=n[a],++t,++i,++a,++s)};return v(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return s},getlcs:function(){return f},getses:function(){return d},compose:function(){var e=a-i,t=i+a+3,n={},r,o,d,f,p;for(f=0;f<t;++f)n[f]=-1,l[f]=-1;r=-1;do{for(++r,p=-r;p<=e-1;++p)n[p+c]=x(p,n[p-1+c]+1,n[p+1+c]);for(p=e+r;p>=e+1;--p)n[p+c]=x(p,n[p-1+c]+1,n[p+1+c]);n[e+c]=x(e,n[e-1+c]+1,n[e+1+c])}while(n[e+c]!==a);for(s=e+2*r,o=l[e+c],d=[];o!==-1;)d[d.length]=new y(u[o].x,u[o].y,null),o=u[o].k;S(d)}}}})),E=t(((e,t)=>{var n=T();function r(e,t){var r=new n(e,t);r.compose();for(var i=r.getses(),a,o,s=e.length-1,c=t.length-1,l=i.length-1;l>=0;--l)i[l].t===r.SES_COMMON?(o?(o.chain={file1index:s,file2index:c,chain:null},o=o.chain):(a={file1index:s,file2index:c,chain:null},o=a),s--,c--):i[l].t===r.SES_DELETE?s--:i[l].t===r.SES_ADD&&c--;var u={file1index:-1,file2index:-1,chain:null};return o?(o.chain=u,a):u}function i(e,t){for(var n=[],i=e.length,a=t.length,o=r(e,t);o!==null;o=o.chain){var s=i-o.file1index-1,c=a-o.file2index-1;i=o.file1index,a=o.file2index,(s||c)&&n.push({file1:[i+1,s],file2:[a+1,c]})}return n.reverse(),n}function a(e,t,n){var r,a=i(t,e),o=i(t,n),s=[];function c(e,t){s.push([e.file1[0],t,e.file1[1],e.file2[0],e.file2[1]])}for(r=0;r<a.length;r++)c(a[r],0);for(r=0;r<o.length;r++)c(o[r],2);s.sort(function(e,t){return e[0]-t[0]});var l=[],u=0;function d(e){e>u&&(l.push([1,u,e-u]),u=e)}for(var f=0;f<s.length;f++){for(var p=f,m=s[f],h=m[0],g=h+m[2];f<s.length-1;){var _=s[f+1],v=_[0];if(v>g)break;g=Math.max(g,v+_[2]),f++}if(d(h),p==f)m[4]>0&&l.push([m[1],m[3],m[4]]);else{var y={0:[e.length,-1,t.length,-1],2:[n.length,-1,t.length,-1]};for(r=p;r<=f;r++){m=s[r];var b=y[m[1]],x=m[0],S=x+m[2],C=m[3],w=C+m[4];b[0]=Math.min(C,b[0]),b[1]=Math.max(w,b[1]),b[2]=Math.min(x,b[2]),b[3]=Math.max(S,b[3])}var T=y[0][0]+(h-y[0][2]),E=y[0][1]+(g-y[0][3]),D=y[2][0]+(h-y[2][2]),O=y[2][1]+(g-y[2][3]);l.push([-1,T,E-T,h,g-h,D,O-D])}u=g}return d(t.length),l}function o(e,t,n){var r=[],i=[e,t,n],o=a(e,t,n),s=[];function c(){s.length&&r.push({ok:s}),s=[]}function l(e){for(var t=0;t<e.length;t++)s.push(e[t])}function u(t){if(t[2]!=t[6])return!0;for(var r=t[1],i=t[5],a=0;a<t[2];a++)if(e[a+r]!=n[a+i])return!0;return!1}for(var d=0;d<o.length;d++){var f=o[d],p=f[0];p==-1?u(f)?(c(),r.push({conflict:{a:e.slice(f[1],f[1]+f[2]),aIndex:f[1],o:t.slice(f[3],f[3]+f[4]),oIndex:f[3],b:n.slice(f[5],f[5]+f[6]),bIndex:f[5]}})):l(i[0].slice(f[1],f[1]+f[2])):l(i[p].slice(f[1],f[1]+f[2]))}return c(),r}t.exports=o})),D=e(t((t=>{var n=e(i()),r=a();Object.defineProperty(t,"__esModule",{value:!0});function o(e){return e&&typeof e==`object`&&`default`in e?e.default:e}var s=o(h()),c=o(f()),l=o(g()),u=o(x()),d=p(),m=o(S()),_=o(C()),v=o(w()),y=o(E()),b=class e extends Error{constructor(e){super(e),this.caller=``}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(t){let n=new e(t.message);return n.code=t.code,n.data=t.data,n.caller=t.caller,n.stack=t.stack,n}get isIsomorphicGitError(){return!0}},T=class e extends b{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=e.code,this.data={filepaths:t}}};T.code=`UnmergedPathsError`;var D=class e extends b{constructor(t){super(`An internal error caused this command to fail.\n\nIf you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.\n\nPlease file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${t}`),this.code=this.name=e.code,this.data={message:t}}};D.code=`InternalError`;var O=class e extends b{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=e.code,this.data={filepath:t}}};O.code=`UnsafeFilepathError`;var k=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let r=this.buffer.write(e,this._start,t,n);return this._start+=t,r}copy(e,t,n){let r=e.copy(this.buffer,this._start,t,n);return this._start+=r,r}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}};function A(e,t){return-(e<t)||+(e>t)}function ee(e,t){return A(e.path,t.path)}function j(e){let t=e>0?e>>12:0;t!==4&&t!==8&&t!==10&&t!==14&&(t=8);let n=e&511;return n=n&73?493:420,t!==8&&(n=0),(t<<12)+n}let M=2**32;function te(e,t,n,r){if(e!==void 0&&t!==void 0)return[e,t];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3);return[i,(n-i*1e3)*1e6]}function N(e){let[t,n]=te(e.ctimeSeconds,e.ctimeNanoseconds,e.ctimeMs,e.ctime),[r,i]=te(e.mtimeSeconds,e.mtimeNanoseconds,e.mtimeMs,e.mtime);return{ctimeSeconds:t%M,ctimeNanoseconds:n%M,mtimeSeconds:r%M,mtimeNanoseconds:i%M,dev:e.dev%M,ino:e.ino%M,mode:j(e.mode%M),uid:e.uid%M,gid:e.gid%M,size:e.size>-1?e.size%M:0}}function P(e){let t=``;for(let n of new Uint8Array(e))n<16&&(t+=`0`),t+=n.toString(16);return t}let ne=null;async function F(e){return ne===null&&(ne=await ae()),ne?ie(e):re(e)}function re(e){return new c().update(e).digest(`hex`)}async function ie(e){return P(await crypto.subtle.digest(`SHA-1`,e))}async function ae(){try{return await ie(new Uint8Array([]))===`da39a3ee5e6b4b0d3255bfef95601890afd80709`}catch{}return!1}function oe(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function se(e){let t=e.flags;return t.extended=!1,t.nameLength=Math.min(r.Buffer.from(e.path).length,4095),(t.assumeValid?32768:0)+(t.extended?16384:0)+((t.stage&3)<<12)+(t.nameLength&4095)}var I=class e{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||=(this._entries.set(e.path,e),e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(t){if(r.Buffer.isBuffer(t))return e.fromBuffer(t);if(t===null)return new e(null);throw new D(`invalid type passed to GitIndex.from`)}static async fromBuffer(t){if(t.length===0)throw new D(`Index file is empty (.git/index)`);let n=new e,r=new k(t),i=r.toString(`utf8`,4);if(i!==`DIRC`)throw new D(`Invalid dircache magic file number: ${i}`);let a=await F(t.slice(0,-20)),o=t.slice(-20).toString(`hex`);if(o!==a)throw new D(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${a}`);let s=r.readUInt32BE();if(s!==2)throw new D(`Unsupported dircache version: ${s}`);let c=r.readUInt32BE(),l=0;for(;!r.eof()&&l<c;){let e={};e.ctimeSeconds=r.readUInt32BE(),e.ctimeNanoseconds=r.readUInt32BE(),e.mtimeSeconds=r.readUInt32BE(),e.mtimeNanoseconds=r.readUInt32BE(),e.dev=r.readUInt32BE(),e.ino=r.readUInt32BE(),e.mode=r.readUInt32BE(),e.uid=r.readUInt32BE(),e.gid=r.readUInt32BE(),e.size=r.readUInt32BE(),e.oid=r.slice(20).toString(`hex`),e.flags=oe(r.readUInt16BE());let i=t.indexOf(0,r.tell()+1)-r.tell();if(i<1)throw new D(`Got a path length of: ${i}`);if(e.path=r.toString(`utf8`,i),e.path.includes(`..\\`)||e.path.includes(`../`))throw new O(e.path);let a=8-(r.tell()-12)%8;for(a===0&&(a=8);a--;){let t=r.readUInt8();if(t!==0)throw new D(`Expected 1-8 null characters but got '${t}' after ${e.path}`);if(r.eof())throw new D(`Unexpected end of file`)}e.stages=[],n._addEntry(e),l++}return n}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(ee)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(e=>e):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:t,oid:n,stage:i=0}){t||={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0},t=N(t);let a=r.Buffer.from(e),o={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(o),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let t of this._entries.keys())t.startsWith(e+`/`)&&this._entries.delete(t);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
4
4
  `)}static async _entryToBuffer(e){let t=r.Buffer.from(e.path),n=Math.ceil((62+t.length+1)/8)*8,i=r.Buffer.alloc(n),a=new k(i),o=N(e);return a.writeUInt32BE(o.ctimeSeconds),a.writeUInt32BE(o.ctimeNanoseconds),a.writeUInt32BE(o.mtimeSeconds),a.writeUInt32BE(o.mtimeNanoseconds),a.writeUInt32BE(o.dev),a.writeUInt32BE(o.ino),a.writeUInt32BE(o.mode),a.writeUInt32BE(o.uid),a.writeUInt32BE(o.gid),a.writeUInt32BE(o.size),a.write(e.oid,20,`hex`),a.writeUInt16BE(se(e)),a.write(e.path,t.length,`utf8`),i}async toObject(){let t=r.Buffer.alloc(12),n=new k(t);n.write(`DIRC`,4,`utf8`),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let i=[];for(let t of this.entries)if(i.push(e._entryToBuffer(t)),t.stages.length>1)for(let n of t.stages)n&&n!==t&&i.push(e._entryToBuffer(n));i=await Promise.all(i);let a=r.Buffer.concat(i),o=r.Buffer.concat([t,a]),s=await F(o);return r.Buffer.concat([o,r.Buffer.from(s,`hex`)])}};function ce(e,t,n=!0,r=!0){let i=N(e),a=N(t);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}let le=null,ue=Symbol(`IndexCache`);function de(){return{map:new Map,stats:new Map}}async function fe(e,t,n){let[r,i]=await Promise.all([e.lstat(t),e.read(t)]),a=await I.from(i);n.map.set(t,a),n.stats.set(t,r)}async function pe(e,t,n){let r=n.stats.get(t);if(r===void 0)return!0;if(r===null)return!1;let i=await e.lstat(t);return i!==null&&ce(r,i)}var L=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:r=!0},i){n[ue]||(n[ue]=de());let a=`${t}/index`;le===null&&(le=new s({maxPending:1/0}));let o,c=[];return await le.acquire(a,async()=>{let t=n[ue];await pe(e,a,t)&&await fe(e,a,t);let s=t.map.get(a);if(c=s.unmergedPaths,c.length&&!r)throw new T(c);if(o=await i(s),s._dirty){let n=await s.toObject();await e.write(a,n),t.stats.set(a,await e.lstat(a)),s._dirty=!1}}),o}};function me(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>-1&&(e=e.slice(t+1)),e}function he(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t===-1?`.`:t===0?`/`:e.slice(0,t)}function ge(e){let t=new Map,n=function(e){if(!t.has(e)){let r={type:`tree`,fullpath:e,basename:me(e),metadata:{},children:[]};t.set(e,r),r.parent=n(he(e)),r.parent&&r.parent!==r&&r.parent.children.push(r)}return t.get(e)},r=function(e,r){if(!t.has(e)){let i={type:`blob`,fullpath:e,basename:me(e),metadata:r,parent:n(he(e)),children:[]};i.parent&&i.parent.children.push(i),t.set(e,i)}return t.get(e)};n(`.`);for(let t of e)r(t.path,t);return t}function _e(e){switch(e){case 16384:return`tree`;case 33188:return`blob`;case 33261:return`blob`;case 40960:return`blob`;case 57344:return`commit`}throw new D(`Unexpected GitTree entry mode: ${e.toString(8)}`)}var ve=class{constructor({fs:e,gitdir:t,cache:n}){this.treePromise=L.acquire({fs:e,gitdir:t,cache:n},async function(e){return ge(e.entries)});let r=this;this.ConstructEntry=class{constructor(e){this._fullpath=e,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return r.type(this)}async mode(){return r.mode(this)}async stat(){return r.stat(this)}async content(){return r.content(this)}async oid(){return r.oid(this)}}}async readdir(e){let t=e._fullpath,n=(await this.treePromise).get(t);if(!n||n.type===`blob`)return null;if(n.type!==`tree`)throw Error(`ENOTDIR: not a directory, scandir '${t}'`);let r=n.children.map(e=>e.fullpath);return r.sort(A),r}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let t=(await this.treePromise).get(e._fullpath);if(!t)throw Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=t.type===`tree`?{}:N(t.metadata);e._type=t.type===`tree`?`tree`:_e(n.mode),e._mode=n.mode,t.type===`tree`?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){return e._oid===!1&&(e._oid=(await this.treePromise).get(e._fullpath).metadata.oid),e._oid}};let ye=Symbol(`GitWalkSymbol`);function be(){let e=Object.create(null);return Object.defineProperty(e,ye,{value:function({fs:e,gitdir:t,cache:n}){return new ve({fs:e,gitdir:t,cache:n})}}),Object.freeze(e),e}var R=class e extends b{constructor(t){super(`Could not find ${t}.`),this.code=this.name=e.code,this.data={what:t}}};R.code=`NotFoundError`;var z=class e extends b{constructor(t,n,r,i){super(`Object ${t} ${i?`at ${i}`:``}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=e.code,this.data={oid:t,actual:n,expected:r,filepath:i}}};z.code=`ObjectTypeError`;var xe=class e extends b{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=e.code,this.data={value:t}}};xe.code=`InvalidOidError`;var Se=class e extends b{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:
@@ -74,7 +74,7 @@ gpgsig`+un(o)+`
74
74
  `,author:o,committer:s,signingKey:c})}async function Pa({fs:e,onSign:t,dir:n,gitdir:r=B(n,`.git`),ref:i=`refs/notes/commits`,oid:a,author:o,committer:s,signingKey:c,cache:l={}}){try{X(`fs`,e),X(`gitdir`,r),X(`oid`,a);let n=new Y(e),u=await Z({fsp:n,dotgit:r}),d=await Hn({fs:n,gitdir:u,author:o});if(!d)throw new G(`author`);let f=await Un({fs:n,gitdir:u,author:d,committer:s});if(!f)throw new G(`committer`);return await Na({fs:n,cache:l,onSign:t,gitdir:u,ref:i,oid:a,author:d,committer:f,signingKey:c})}catch(e){throw e.caller=`git.removeNote`,e}}async function Fa({fs:e,gitdir:t,oldref:n,ref:r,checkout:i=!1}){if(!tr(r,!0))throw new zt(r,v.clean(r));if(!tr(n,!0))throw new zt(n,v.clean(n));let a=`refs/heads/${n}`,o=`refs/heads/${r}`;if(await H.exists({fs:e,gitdir:t,ref:o}))throw new Ot(`branch`,r,!1);let s=await H.resolve({fs:e,gitdir:t,ref:a,depth:1});await H.writeRef({fs:e,gitdir:t,ref:o,value:s}),await H.deleteRef({fs:e,gitdir:t,ref:a});let c=await Ar({fs:e,gitdir:t,fullname:!0})===a;(i||c)&&await H.writeSymbolicRef({fs:e,gitdir:t,ref:`HEAD`,value:o})}async function Ia({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r,oldref:i,checkout:a=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r),X(`oldref`,i);let t=new Y(e);return await Fa({fs:t,gitdir:await Z({fsp:t,dotgit:n}),ref:r,oldref:i,checkout:a})}catch(e){throw e.caller=`git.renameBranch`,e}}async function La({gitdir:e,type:t,object:n}){return F(rt.wrap({type:t,object:n}))}async function Ra({fs:e,dir:t,gitdir:n=B(t,`.git`),filepath:r,ref:i,cache:a={}}){try{X(`fs`,e),X(`gitdir`,n),X(`filepath`,r);let o=new Y(e),s=await Z({fsp:o,dotgit:n}),c,l;try{c=await H.resolve({fs:o,gitdir:s,ref:i||`HEAD`})}catch(e){if(i)throw e}if(c)try{c=await Jn({fs:o,cache:a,gitdir:s,oid:c,filepath:r})}catch{c=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},d=t&&await o.read(B(t,r));d&&(l=await La({gitdir:s,type:`blob`,object:d}),c===l&&(u=await o.lstat(B(t,r)))),await L.acquire({fs:o,gitdir:s,cache:a},async function(e){e.delete({filepath:r}),c&&e.insert({filepath:r,stats:u,oid:c})})}catch(e){throw e.caller=`git.reset`,e}}async function za({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r,depth:i}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r);let t=new Y(e),a=await Z({fsp:t,dotgit:n});return await H.resolve({fs:t,gitdir:a,ref:r,depth:i})}catch(e){throw e.caller=`git.resolveRef`,e}}async function Ba({fs:e,dir:t,gitdir:n=B(t,`.git`),path:r,value:i,append:a=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`path`,r);let t=new Y(e),o=await Z({fsp:t,dotgit:n}),s=await V.get({fs:t,gitdir:o});a?await s.append(r,i):await s.set(r,i),await V.save({fs:t,gitdir:o,config:s})}catch(e){throw e.caller=`git.setConfig`,e}}async function Va({fs:e,gitdir:t,commit:n}){return await Q({fs:e,gitdir:t,type:`commit`,object:q.from(n).toObject(),format:`content`})}var Ha=class e{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),t=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,`0`);return`${e>0?`-`:`+`}${t.toString().padStart(2,`0`)}${n}`}static createStashReflogEntry(t,n,r){let i=t.name.replace(/\s/g,``),a=Math.floor(Date.now()/1e3),o=e.timezoneOffsetForRefLogEntry;return`0000000000000000000000000000000000000000 ${n} ${i} ${t.email} ${a} ${o}\t${r}\n`}static getStashReflogEntry(e,t=!1){return e.split(`
75
75
  `).filter(e=>e).reverse().map((e,n)=>t?`stash@{${n}}: ${e.split(` `)[1]}`:e)}},Ua=class e{constructor({fs:e,dir:t,gitdir:n=B(t,`.git`)}){Object.assign(this,{fs:e,dir:t,gitdir:n,_author:null})}static get refStash(){return`refs/stash`}static get refLogsStash(){return`logs/refs/stash`}get refStashPath(){return B(this.gitdir,e.refStash)}get refLogsStashPath(){return B(this.gitdir,e.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Hn({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new G(`author`);return this._author}async getStashSHA(e,t){return await this.fs.exists(this.refStashPath)?(t||await this.readStashReflogs({parsed:!1}))[e].split(` `)[1]:null}async writeStashCommit({message:e,tree:t,parent:n}){return Va({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:t,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let t=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>t.length-1))throw new zt(`stash@${e}`,`number that is in range of [0, num of stash pushed]`);let n=await this.getStashSHA(e,t);return n?Gn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(t){return H.writeRef({fs:this.fs,gitdir:this.gitdir,ref:e.refStash,value:t})}async writeStashReflogEntry({stashCommit:e,message:t}){let n=await this.getAuthor(),r=Ha.createStashReflogEntry(n,e,t),i=this.refLogsStashPath;await xr({filepath:i,entry:r},async()=>{let e=await this.fs.exists(i)?await this.fs.read(i,`utf8`):``;await this.fs.write(i,e+r,`utf8`)})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let t=await this.fs.read(this.refLogsStashPath,`utf8`);return Ha.getStashReflogEntry(t,e)}};async function Wa({fs:e,dir:t,gitdir:n,message:r=``}){let i=new Ua({fs:e,dir:t,gitdir:n});await i.getAuthor();let a=await Ar({fs:e,gitdir:n,fullname:!1}),o=await H.resolve({fs:e,gitdir:n,ref:`HEAD`}),s=(await Ta({fs:e,dir:t,gitdir:n,oid:o})).commit.message,c=[o],l=null,u=J({ref:`HEAD`}),d=await wr({fs:e,dir:t,gitdir:n,treePair:[J({ref:`HEAD`}),`stage`]});if(d){let e=await i.writeStashCommit({message:`stash-Index: WIP on ${a} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(e),l=d,u=be()}let f=await wr({fs:e,dir:t,gitdir:n,treePair:[u,`workdir`]});if(f){let e=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${a} - ${new Date().toISOString()}`,tree:f,parent:[c[c.length-1]]});c.push(e),l=f}if(!l||!d&&!f)throw new R(`changes, nothing to stash`);let p=(r.trim()||`WIP on ${a}`)+`: ${o.substring(0,7)} ${s}`;return{stashCommit:await i.writeStashCommit({message:p,tree:l,parent:c}),stashMsg:p,branch:a,stashMgr:i}}async function Ga({fs:e,dir:t,gitdir:n,message:r=``}){let{stashCommit:i,stashMsg:a,branch:o,stashMgr:s}=await Wa({fs:e,dir:t,gitdir:n,message:r});return await s.writeStashRef(i),await s.writeStashReflogEntry({stashCommit:i,message:a}),await mr({fs:e,dir:t,gitdir:n,ref:o,track:!1,force:!0}),i}async function Ka({fs:e,dir:t,gitdir:n,message:r=``}){let{stashCommit:i}=await Wa({fs:e,dir:t,gitdir:n,message:r});return i}async function qa({fs:e,dir:t,gitdir:n,refIdx:r=0}){let i=await new Ua({fs:e,dir:t,gitdir:n}).readStashCommit(r),{parent:a=null}=i.commit?i.commit:{};if(!(!a||!Array.isArray(a)))for(let r=0;r<a.length-1;r++){let i=(await Gn({fs:e,cache:{},gitdir:n,oid:a[r+1]})).commit.message.startsWith(`stash-Index`);await Tr({fs:e,dir:t,gitdir:n,stashCommit:a[r+1],parentCommit:a[r],wasStaged:i})}}async function Ja({fs:e,dir:t,gitdir:n,refIdx:r=0}){let i=new Ua({fs:e,dir:t,gitdir:n});if(!(await i.readStashCommit(r)).commit)return;let a=i.refStashPath;await xr(a,async()=>{await e.exists(a)&&await e.rm(a)});let o=await i.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(r,1);let s=i.refLogsStashPath;await xr({reflogEntries:o,stashReflogPath:s,stashMgr:i},async()=>{if(o.length){await e.write(s,o.reverse().join(`
76
76
  `)+`
77
- `,`utf8`);let t=o[o.length-1].split(` `)[1];await i.writeStashRef(t)}else await e.rm(s)})}async function Ya({fs:e,dir:t,gitdir:n}){return new Ua({fs:e,dir:t,gitdir:n}).readStashReflogs({parsed:!0})}async function Xa({fs:e,dir:t,gitdir:n}){let r=new Ua({fs:e,dir:t,gitdir:n}),i=[r.refStashPath,r.refLogsStashPath];await xr(i,async()=>{await Promise.all(i.map(async t=>{if(await e.exists(t))return e.rm(t)}))})}async function Za({fs:e,dir:t,gitdir:n,refIdx:r=0}){await qa({fs:e,dir:t,gitdir:n,refIdx:r}),await Ja({fs:e,dir:t,gitdir:n,refIdx:r})}async function Qa({fs:e,dir:t,gitdir:n=B(t,`.git`),op:r=`push`,message:i=``,refIdx:a=0}){X(`fs`,e),X(`dir`,t),X(`gitdir`,n),X(`op`,r);let o={push:Ga,apply:qa,drop:Ja,list:Ya,clear:Xa,pop:Za,create:Ka},s=[`apply`,`drop`,`pop`];try{let c=new Y(e),l=await Z({fsp:c,dotgit:n});[`refs`,`logs`,`logs/refs`].map(e=>B(l,e)).forEach(async e=>{await c.exists(e)||await c.mkdir(e)});let u=o[r];if(u){if(s.includes(r)&&a<0)throw new zt(`stash@${a}`,`number that is in range of [0, num of stash pushed]`);return await u({fs:c,dir:t,gitdir:l,message:i,refIdx:a})}throw Error(`To be implemented: ${r}`)}catch(e){throw e.caller=`git.stash`,e}}async function $a({fs:e,dir:t,gitdir:n=B(t,`.git`),filepath:r,cache:i={}}){try{X(`fs`,e),X(`gitdir`,n),X(`filepath`,r);let a=new Y(e),o=await Z({fsp:a,dotgit:n});if(await jn.isIgnored({fs:a,gitdir:o,dir:t,filepath:r}))return`ignored`;let s=await eo({fs:a,cache:i,gitdir:o,tree:await to({fs:a,cache:i,gitdir:o}),path:r}),c=await L.acquire({fs:a,gitdir:o,cache:i},async function(e){for(let t of e)if(t.path===r)return t;return null}),l=await a.lstat(B(t,r)),u=s!==null,d=c!==null,f=l!==null,p=async()=>{if(d&&!ce(c,l))return c.oid;{let e=await a.read(B(t,r)),n=await La({gitdir:o,type:`blob`,object:e});return d&&c.oid===n&&l.size!==-1&&L.acquire({fs:a,gitdir:o,cache:i},async function(e){e.insert({filepath:r,stats:l,oid:n})}),n}};if(!u&&!f&&!d)return`absent`;if(!u&&!f&&d)return`*absent`;if(!u&&f&&!d)return`*added`;if(!u&&f&&d)return await p()===c.oid?`added`:`*added`;if(u&&!f&&!d)return`deleted`;if(u&&!f&&d)return c.oid,`*deleted`;if(u&&f&&!d)return await p()===s?`*undeleted`:`*undeletemodified`;if(u&&f&&d){let e=await p();return e===s?e===c.oid?`unmodified`:`*unmodified`:e===c.oid?`modified`:`*modified`}}catch(e){throw e.caller=`git.status`,e}}async function eo({fs:e,cache:t,gitdir:n,tree:r,path:i}){typeof i==`string`&&(i=i.split(`/`));let a=i.shift();for(let o of r)if(o.path===a){if(i.length===0)return o.oid;let{type:r,object:a}=await W({fs:e,cache:t,gitdir:n,oid:o.oid});if(r===`tree`)return eo({fs:e,cache:t,gitdir:n,tree:U.from(a),path:i});if(r===`blob`)throw new z(o.oid,r,`blob`,i.join(`/`))}return null}async function to({fs:e,cache:t,gitdir:n}){let r;try{r=await H.resolve({fs:e,gitdir:n,ref:`HEAD`})}catch(e){if(e instanceof R)return[]}let{tree:i}=await Xn({fs:e,cache:t,gitdir:n,oid:r});return i}async function no({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r=`HEAD`,filepaths:i=[`.`],filter:a,cache:o={},ignored:s=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r);let c=new Y(e);return await bn({fs:c,cache:o,dir:t,gitdir:await Z({fsp:c,dotgit:n}),trees:[J({ref:r}),hn(),be()],map:async function(e,[n,r,o]){if(!n&&!o&&r&&!s&&await jn.isIgnored({fs:c,dir:t,filepath:e})||!i.some(t=>cr(e,t)))return null;if(a&&!a(e))return;let[l,u,d]=await Promise.all([n&&n.type(),r&&r.type(),o&&o.type()]),f=[l,u,d].includes(`blob`);if((l===`tree`||l===`special`)&&!f)return;if(l===`commit`)return null;if((u===`tree`||u===`special`)&&!f)return;if(d===`commit`)return null;if((d===`tree`||d===`special`)&&!f)return;let p=l===`blob`?await n.oid():void 0,m=d===`blob`?await o.oid():void 0,h;l!==`blob`&&u===`blob`&&d!==`blob`?h=`42`:u===`blob`&&(h=await r.oid());let g=[void 0,p,h,m],_=g.map(e=>g.indexOf(e));return _.shift(),[e,..._]}})}catch(e){throw e.caller=`git.statusMatrix`,e}}async function ro({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r,object:i,force:a=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r);let t=new Y(e);if(r===void 0)throw new K(`ref`);r=r.startsWith(`refs/tags/`)?r:`refs/tags/${r}`;let o=await Z({fsp:t,dotgit:n}),s=await H.resolve({fs:t,gitdir:o,ref:i||`HEAD`});if(!a&&await H.exists({fs:t,gitdir:o,ref:r}))throw new Ot(`tag`,r);await H.writeRef({fs:t,gitdir:o,ref:r,value:s})}catch(e){throw e.caller=`git.tag`,e}}async function io({fs:e,dir:t,gitdir:n=B(t,`.git`),cache:r={},filepath:i,oid:a,mode:o,add:s,remove:c,force:l}){try{X(`fs`,e),X(`gitdir`,n),X(`filepath`,i);let u=new Y(e),d=await Z({fsp:u,dotgit:n});if(c)return await L.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!l){let e=await u.lstat(B(t,i));if(e){if(e.isDirectory())throw new Rt(`directory`);return}}e.has({filepath:i})&&e.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(B(t,i)),!f)throw new R(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new Rt(`directory`)}return await L.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!s&&!e.has({filepath:i}))throw new R(`file at "${i}" in index and "add" not set`);let n;if(a)n={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{n=f;let e=n.isSymbolicLink()?await u.readlink(B(t,i)):await u.read(B(t,i));a=await Q({fs:u,gitdir:d,type:`blob`,format:`content`,object:e})}return e.insert({filepath:i,oid:a,stats:n}),a})}catch(e){throw e.caller=`git.updateIndex`,e}}function ao(){try{return $r.version}catch(e){throw e.caller=`git.version`,e}}async function oo({fs:e,dir:t,gitdir:n=B(t,`.git`),trees:r,map:i,reduce:a,iterate:o,cache:s={}}){try{X(`fs`,e),X(`gitdir`,n),X(`trees`,r);let c=new Y(e);return await bn({fs:c,cache:s,dir:t,gitdir:await Z({fsp:c,dotgit:n}),trees:r,map:i,reduce:a,iterate:o})}catch(e){throw e.caller=`git.walk`,e}}async function so({fs:e,dir:t,gitdir:n=B(t,`.git`),blob:r}){try{X(`fs`,e),X(`gitdir`,n),X(`blob`,r);let t=new Y(e);return await Q({fs:t,gitdir:await Z({fsp:t,dotgit:n}),type:`blob`,object:r,format:`content`})}catch(e){throw e.caller=`git.writeBlob`,e}}async function co({fs:e,dir:t,gitdir:n=B(t,`.git`),commit:r}){try{X(`fs`,e),X(`gitdir`,n),X(`commit`,r);let t=new Y(e);return await Va({fs:t,gitdir:await Z({fsp:t,dotgit:n}),commit:r})}catch(e){throw e.caller=`git.writeCommit`,e}}async function lo({fs:e,dir:t,gitdir:n=B(t,`.git`),type:i,object:a,format:o=`parsed`,oid:s,encoding:c=void 0}){try{let t=new Y(e),l=await Z({fsp:t,dotgit:n});if(o===`parsed`){switch(i){case`commit`:a=q.from(a).toObject();break;case`tree`:a=U.from(a).toObject();break;case`blob`:a=r.Buffer.from(a,c);break;case`tag`:a=ln.from(a).toObject();break;default:throw new z(s||``,i,`blob|commit|tag|tree`)}o=`content`}return s=await Q({fs:t,gitdir:l,type:i,object:a,oid:s,format:o}),s}catch(e){throw e.caller=`git.writeObject`,e}}async function uo({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r,value:i,force:a=!1,symbolic:o=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r),X(`value`,i);let t=new Y(e);if(!tr(r,!0))throw new zt(r,v.clean(r));let s=await Z({fsp:t,dotgit:n});if(!a&&await H.exists({fs:t,gitdir:s,ref:r}))throw new Ot(`ref`,r);o?await H.writeSymbolicRef({fs:t,gitdir:s,ref:r,value:i}):(i=await H.resolve({fs:t,gitdir:s,ref:i}),await H.writeRef({fs:t,gitdir:s,ref:r,value:i}))}catch(e){throw e.caller=`git.writeRef`,e}}async function fo({fs:e,gitdir:t,tag:n}){return await Q({fs:e,gitdir:t,type:`tag`,object:ln.from(n).toObject(),format:`content`})}async function po({fs:e,dir:t,gitdir:n=B(t,`.git`),tag:r}){try{X(`fs`,e),X(`gitdir`,n),X(`tag`,r);let t=new Y(e);return await fo({fs:t,gitdir:await Z({fsp:t,dotgit:n}),tag:r})}catch(e){throw e.caller=`git.writeTag`,e}}async function mo({fs:e,dir:t,gitdir:n=B(t,`.git`),tree:r}){try{X(`fs`,e),X(`gitdir`,n),X(`tree`,r);let t=new Y(e);return await Zn({fs:t,gitdir:await Z({fsp:t,dotgit:n}),tree:r})}catch(e){throw e.caller=`git.writeTree`,e}}var ho={Errors:$t,STAGE:be,TREE:J,WORKDIR:hn,add:Rn,abortMerge:An,addNote:$n,addRemote:rr,annotatedTag:ar,branch:sr,cherryPick:Dr,checkout:mr,clone:li,commit:ui,getConfig:Mi,getConfigAll:Pi,setConfig:Ba,currentBranch:di,deleteBranch:pi,deleteRef:mi,deleteRemote:gi,deleteTag:vi,expandOid:Si,expandRef:Ci,fastForward:Di,fetch:Oi,findMergeBase:ki,findRoot:ji,getRemoteInfo:Fi,getRemoteInfo2:Li,hashBlob:zi,indexPack:Vi,init:Hi,isDescendent:Wi,isIgnored:Gi,listBranches:Ki,listFiles:Yi,listNotes:Zi,listRefs:Qi,listRemotes:ea,listServerRefs:ra,listTags:ia,log:la,merge:ua,packObjects:ma,pull:ha,push:xa,readBlob:wa,readCommit:Ta,readNote:Da,readObject:Oa,readTag:Aa,readTree:ja,remove:Ma,removeNote:Pa,renameBranch:Ia,resetIndex:Ra,updateIndex:io,resolveRef:za,status:$a,statusMatrix:no,tag:ro,version:ao,walk:oo,writeBlob:so,writeCommit:co,writeObject:lo,writeRef:uo,writeTag:po,writeTree:mo,stash:Qa};t.Errors=$t,t.STAGE=be,t.TREE=J,t.WORKDIR=hn,t.abortMerge=An,t.add=Rn,t.addNote=$n,t.addRemote=rr,t.annotatedTag=ar,t.branch=sr,t.checkout=mr,t.cherryPick=Dr,t.clone=li,t.commit=ui,t.currentBranch=di,t.default=ho,t.deleteBranch=pi,t.deleteRef=mi,t.deleteRemote=gi,t.deleteTag=vi,t.expandOid=Si,t.expandRef=Ci,t.fastForward=Di,t.fetch=Oi,t.findMergeBase=ki,t.findRoot=ji,t.getConfig=Mi,t.getConfigAll=Pi,t.getRemoteInfo=Fi,t.getRemoteInfo2=Li,t.hashBlob=zi,t.indexPack=Vi,t.init=Hi,t.isDescendent=Wi,t.isIgnored=Gi,t.listBranches=Ki,t.listFiles=Yi,t.listNotes=Zi,t.listRefs=Qi,t.listRemotes=ea,t.listServerRefs=ra,t.listTags=ia,t.log=la,t.merge=ua,t.packObjects=ma,t.pull=ha,t.push=xa,t.readBlob=wa,t.readCommit=Ta,t.readNote=Da,t.readObject=Oa,t.readTag=Aa,t.readTree=ja,t.remove=Ma,t.removeNote=Pa,t.renameBranch=Ia,t.resetIndex=Ra,t.resolveRef=za,t.setConfig=Ba,t.stash=Qa,t.status=$a,t.statusMatrix=no,t.tag=ro,t.updateIndex=io,t.version=ao,t.walk=oo,t.writeBlob=so,t.writeCommit=co,t.writeObject=lo,t.writeRef=uo,t.writeTag=po,t.writeTree=mo}))(),1),O=a();globalThis.Buffer||(globalThis.Buffer=O.Buffer);function k(e){try{let t=typeof location<`u`&&location.origin?location.origin:typeof globalThis<`u`&&globalThis.location?.origin?globalThis.location.origin:`http://127.0.0.1:8888`,n=new URL(e,t).hostname.toLowerCase();if(n===`localhost`||n===`127.0.0.1`||n===`::1`||n===`[::1]`)return`loopback`;if(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(n)||!n.includes(`.`)||n.endsWith(`.local`)||n.endsWith(`.lan`)||n.endsWith(`.home`)||n.endsWith(`.internal`))return`private`}catch{}}const A={async request({url:e,method:t=`GET`,headers:n={},body:r}){r&&=await ee(r);let i=k(e),a={method:t,headers:n,body:r,credentials:`omit`};i&&(a.targetAddressSpace=i);let o=await fetch(e,a),s=o.body&&typeof o.body.getReader==`function`?j(o.body):[new Uint8Array(await o.arrayBuffer())],c={};for(let[e,t]of o.headers.entries())c[e]=t;return{url:o.url,method:t,statusCode:o.status,statusMessage:o.statusText,body:s,headers:c}}};async function ee(e){let t=[];if(e[Symbol.asyncIterator])for await(let n of e)t.push(n);else if(e[Symbol.iterator])for(let n of e)t.push(n);else if(e.next){let n=await e.nexT();for(;!n.done;)t.push(n.value),n=await e.nexT()}else return e;let n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}function j(e){let t=e.getReader();return{next(){return t.read()},return(){return t.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}let M=null,te=null,N=null,P=null,ne=null;function F(e){return e.trim().replace(/^[\\/]+/,``).replace(/[\\/]+$/,``).split(/[\\/]+/).filter(e=>e!==`.`&&e!==``).join(`/`)}const re=new class{_map=new Map;_maxSize;constructor(e=2048){this._maxSize=e}clear(){this._map.clear()}get(e){let t=this._map.get(e);return t!==void 0&&(this._map.delete(e),this._map.set(e,t)),t}invalidate(e){let t=e.endsWith(`/`)?e:e+`/`;for(let n of this._map.keys())(n===e||n.startsWith(t))&&this._map.delete(n)}set(e,t){if(this._map.size>=this._maxSize){let e=this._map.keys().next().value;e!==void 0&&this._map.delete(e)}this._map.set(e,t)}};async function ie(e,t,n={},r=``){let i=e,a=r;for(let e of t){a=a?`${a}/${e}`:e;let t=re.get(a);t&&!n.create?i=t:(i=await i.getDirectoryHandle(e,{create:n.create??!1}),re.set(a,i))}return i}async function ae(e,t,n={}){let r=F(t),i=r.split(`/`).filter(Boolean);if(i.length===0)return e;let a=await ie(e,i.slice(0,-1),n),o=i[i.length-1];if(n.forceFile||o.includes(`.`))try{return await a.getFileHandle(o,{create:n.create??!1})}catch{}try{let e=await a.getDirectoryHandle(o,{create:n.create??!1}),t=r;return re.set(t,e),e}catch{return await a.getFileHandle(o,{create:n.create??!1})}}async function oe(e,t,n={}){let r=F(t).split(`/`).filter(Boolean);return r.length===0?e:ie(e,r,n)}async function se(e,t,n={}){let r=F(t).split(`/`).filter(Boolean);if(r.length===0)throw Error(`Cannot resolve '.' as file`);return(await ie(e,r.slice(0,-1),n)).getFileHandle(r[r.length-1],{create:n.create??!1})}async function I(e,t){let n=F(t).split(`/`).filter(Boolean);if(n.length===0)throw Error(`Cannot get parent of root`);let r=n[n.length-1];return[await ie(e,n.slice(0,-1)),r]}function ce(e){return e.trim().replace(/\\/g,`/`).replace(/^\/+/,``).replace(/^\.\//,``)}function le(e){let t=new Map,n=`repos/.git-modes`;function r(e){return e.replace(/\\/g,`/`.replace(/^\/+/,``))}async function i(){try{let r=await(await(await se(e,n)).getFile()).text(),i=JSON.parse(r);for(let[e,n]of i)t.set(e,n)}catch{}}let a=null;function o(){a===null&&(a=setTimeout(async()=>{a=null;try{let r=await(await se(e,n,{create:!0})).createWritable(),i=JSON.stringify([...t.entries()]);await r.write(new TextEncoder().encode(i)),await r.close()}catch{}},500))}let s=i(),c={async readFile(t,n){let r=await(await(await se(e,t)).getFile()).arrayBuffer(),i=typeof n==`string`?n:n?.encoding;return i===`utf8`||i===`utf-8`?new TextDecoder().decode(r):new Uint8Array(r)},async writeFile(n,i,a){let s=await(await se(e,n,{create:!0})).createWritable();typeof i==`string`&&(i=new TextEncoder().encode(i)),await s.write(i),await s.close();let c=typeof a==`object`&&a?a.mode:void 0,l=r(n);if(c!=null){let e=(c&73)!=0;t.set(l,e?33261:33188),o()}else t.has(l)||t.set(l,33188)},async mkdir(t){await oe(e,t,{create:!0})},async rmdir(n){let[i,a]=await I(e,n);await i.removeEntry(a,{recursive:!0});let o=r(n)+`/`;for(let e of t.keys())(e===r(n)||e.startsWith(o))&&t.delete(e);re.invalidate(F(n))},async readdir(t){let n=await oe(e,t),r=[];for await(let[e]of n.entries())r.push(e);return r},async stat(n){await s;let i;try{i=await ae(e,n)}catch{let e=Error(`ENOENT: no such file or directory, stat '${n}'`);throw e.code=`ENOENT`,e}if(i.kind===`directory`){let e=new Date;return{isDirectory:()=>!0,isFile:()=>!1,isSymbolicLink:()=>!1,size:0,mtimeMs:Date.now(),mode:16877,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:e,mtime:e}}else{let e=await i.getFile(),a=new Date(e.lastModified),o=r(n),s=t.get(o)??33188;return{isDirectory:()=>!1,isFile:()=>!0,isSymbolicLink:()=>!1,size:e.size,mtimeMs:e.lastModified,mode:s,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:a,mtime:a}}},async lstat(e){return c.stat(e)},async unlink(n){let[i,a]=await I(e,n);await i.removeEntry(a),t.delete(r(n))},async symlink(e,t){throw Error(`OPFS does not support symlinks`)},async readlink(e){return await c.readFile(e,`utf8`)}};return{promises:c}}const ue=le,de=`repos`;function fe(e,t,i){if(e===`custom`&&t)return t;if(e===`public`)return`https://www.cors-anywhere.com`;let a=i||(typeof globalThis<`u`&&globalThis.location?globalThis.location:typeof self<`u`&&self.location?self.location:typeof window<`u`&&window.location?window.location:null),o=a?.protocol||``,s=o===`https:`||o===`https`||typeof a?.origin==`string`&&a.origin.startsWith(`https:`)||typeof a?.href==`string`&&a.href.startsWith(`https://`)?`https:`:`http:`,c=a?.host||``,l=a?.hostname||``,u=l===`localhost`||l===`127.0.0.1`||l===`::1`||l===`[::1]`||l===`0.0.0.0`||c.startsWith(`localhost:`)||c.startsWith(`127.0.0.1:`)||c.startsWith(`[::1]:`),d=a&&(a.protocol===`file:`||l&&(l.endsWith(`.github.io`)||l.endsWith(`.pages.dev`)));return c&&(u||!d)?`${s}//${c}/git-proxy`:`${s}//${r}:${n}/git-proxy`}async function pe(){return ne||=(async()=>{if(M=D.default,te=A,!N){let e;try{e=await navigator.storage.getDirectory()}catch(t){console.warn(`OPFS is unavailable for git root, falling back to memory:`,t);let{getMemoryOpfsRoot:n}=await import(`./memoryStorage-C1llaYus.js`).then(e=>e.n);e=n()}N=le(e),P=N.promises}})(),await ne,{git:M,http:te,fs:N,pfs:P}}async function L(e){let t=await pe();if(e){let n=le(e);return{git:t.git,http:t.http,fs:n,pfs:n.promises,repoDirFn:e=>`repos/${e}`}}return{...t,repoDirFn:he}}function me(e){return(e.replace(/\/+$/,``).split(`/`).pop()||`repo`).replace(/\.git$/,``)}function he(e){return`${de}/${e}`}async function ge(e,t,n){try{await e.getConfig({fs:t,dir:n,path:`core.filemode`})!==!1&&await e.setConfig({fs:t,dir:n,path:`core.filemode`,value:!1})}catch(e){console.error(`Failed to set core.filemode=false:`,e)}}async function _e(e,t){try{await e.mkdir(t)}catch{}}function ve({token:e,username:t,password:n}={}){if(!e&&!t)return{};let r;e?r={Authorization:`Basic ${btoa(`${e}:x-oauth-basic`)}`}:t&&(r={Authorization:`Basic ${btoa(`${t}:${n||``}`)}`});let i=()=>e?{username:e,password:`x-oauth-basic`}:t?{username:t,password:n||``}:{cancel:!0},a=()=>({cancel:!0});return{...r?{headers:r}:{},onAuth:i,onAuthFailure:a}}async function ye({url:e,branch:t,depth:n=20,corsProxy:r,name:i,token:a,username:o,password:s,groupRoot:c}){let{git:l,http:u,fs:d,pfs:f,repoDirFn:p}=await L(c),m=i||me(e),h=p(m);r||=fe(`local`),await _e(f,de),await _e(f,h);let g=ve({token:a,username:o,password:s});try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch{try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.fetch(i)}catch{try{await Le(f,h),await _e(f,h);let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch(t){throw Error(`Failed to clone/fetch ${e}: ${t instanceof Error?t.message:String(t)}`)}}}return await ge(l,d,h),m}async function be({repo:e,ref:t,groupRoot:n}){let{git:r,fs:i,repoDirFn:a}=await L(n),o=a(e);return await r.checkout({fs:i,dir:o,ref:t,force:!0}),`Checked out ${t} in ${e}`}async function R({repo:e,name:t,checkout:n=!1,startPoint:r,groupRoot:i}){let{git:a,fs:o,repoDirFn:s}=await L(i),c=s(e),l={fs:o,dir:c,ref:t};return r&&(l.object=r),await a.branch(l),n?(await a.checkout({fs:o,dir:c,ref:t}),`Created and switched to branch ${t} in ${e}`):`Created branch ${t} in ${e}`}async function z({repo:e,groupRoot:t}){let{git:n,fs:r,repoDirFn:i}=await L(t),a=i(e);await ge(n,r,a);let o=await n.statusMatrix({fs:r,dir:a});if(o.length===0)return`Empty repository.`;let s=[];for(let[e,t,n,r]of o){let i=``;if(t===0&&n===2&&r===2)i=`added`;else if(t===0&&n===2&&r===0)i=`new (unstaged)`;else if(t===1&&n===2&&r===2)i=`modified (staged)`;else if(t===1&&n===2&&r===1)i=`modified`;else if(t===1&&n===0&&r===0)i=`deleted`;else if(t===1&&n===1&&r===1)continue;else i=`[${t},${n},${r}]`;s.push(`${i}: ${e}`)}return s.length===0?`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\nNothing to commit, working tree clean.`:`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\n${s.join(`
77
+ `,`utf8`);let t=o[o.length-1].split(` `)[1];await i.writeStashRef(t)}else await e.rm(s)})}async function Ya({fs:e,dir:t,gitdir:n}){return new Ua({fs:e,dir:t,gitdir:n}).readStashReflogs({parsed:!0})}async function Xa({fs:e,dir:t,gitdir:n}){let r=new Ua({fs:e,dir:t,gitdir:n}),i=[r.refStashPath,r.refLogsStashPath];await xr(i,async()=>{await Promise.all(i.map(async t=>{if(await e.exists(t))return e.rm(t)}))})}async function Za({fs:e,dir:t,gitdir:n,refIdx:r=0}){await qa({fs:e,dir:t,gitdir:n,refIdx:r}),await Ja({fs:e,dir:t,gitdir:n,refIdx:r})}async function Qa({fs:e,dir:t,gitdir:n=B(t,`.git`),op:r=`push`,message:i=``,refIdx:a=0}){X(`fs`,e),X(`dir`,t),X(`gitdir`,n),X(`op`,r);let o={push:Ga,apply:qa,drop:Ja,list:Ya,clear:Xa,pop:Za,create:Ka},s=[`apply`,`drop`,`pop`];try{let c=new Y(e),l=await Z({fsp:c,dotgit:n});[`refs`,`logs`,`logs/refs`].map(e=>B(l,e)).forEach(async e=>{await c.exists(e)||await c.mkdir(e)});let u=o[r];if(u){if(s.includes(r)&&a<0)throw new zt(`stash@${a}`,`number that is in range of [0, num of stash pushed]`);return await u({fs:c,dir:t,gitdir:l,message:i,refIdx:a})}throw Error(`To be implemented: ${r}`)}catch(e){throw e.caller=`git.stash`,e}}async function $a({fs:e,dir:t,gitdir:n=B(t,`.git`),filepath:r,cache:i={}}){try{X(`fs`,e),X(`gitdir`,n),X(`filepath`,r);let a=new Y(e),o=await Z({fsp:a,dotgit:n});if(await jn.isIgnored({fs:a,gitdir:o,dir:t,filepath:r}))return`ignored`;let s=await eo({fs:a,cache:i,gitdir:o,tree:await to({fs:a,cache:i,gitdir:o}),path:r}),c=await L.acquire({fs:a,gitdir:o,cache:i},async function(e){for(let t of e)if(t.path===r)return t;return null}),l=await a.lstat(B(t,r)),u=s!==null,d=c!==null,f=l!==null,p=async()=>{if(d&&!ce(c,l))return c.oid;{let e=await a.read(B(t,r)),n=await La({gitdir:o,type:`blob`,object:e});return d&&c.oid===n&&l.size!==-1&&L.acquire({fs:a,gitdir:o,cache:i},async function(e){e.insert({filepath:r,stats:l,oid:n})}),n}};if(!u&&!f&&!d)return`absent`;if(!u&&!f&&d)return`*absent`;if(!u&&f&&!d)return`*added`;if(!u&&f&&d)return await p()===c.oid?`added`:`*added`;if(u&&!f&&!d)return`deleted`;if(u&&!f&&d)return c.oid,`*deleted`;if(u&&f&&!d)return await p()===s?`*undeleted`:`*undeletemodified`;if(u&&f&&d){let e=await p();return e===s?e===c.oid?`unmodified`:`*unmodified`:e===c.oid?`modified`:`*modified`}}catch(e){throw e.caller=`git.status`,e}}async function eo({fs:e,cache:t,gitdir:n,tree:r,path:i}){typeof i==`string`&&(i=i.split(`/`));let a=i.shift();for(let o of r)if(o.path===a){if(i.length===0)return o.oid;let{type:r,object:a}=await W({fs:e,cache:t,gitdir:n,oid:o.oid});if(r===`tree`)return eo({fs:e,cache:t,gitdir:n,tree:U.from(a),path:i});if(r===`blob`)throw new z(o.oid,r,`blob`,i.join(`/`))}return null}async function to({fs:e,cache:t,gitdir:n}){let r;try{r=await H.resolve({fs:e,gitdir:n,ref:`HEAD`})}catch(e){if(e instanceof R)return[]}let{tree:i}=await Xn({fs:e,cache:t,gitdir:n,oid:r});return i}async function no({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r=`HEAD`,filepaths:i=[`.`],filter:a,cache:o={},ignored:s=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r);let c=new Y(e);return await bn({fs:c,cache:o,dir:t,gitdir:await Z({fsp:c,dotgit:n}),trees:[J({ref:r}),hn(),be()],map:async function(e,[n,r,o]){if(!n&&!o&&r&&!s&&await jn.isIgnored({fs:c,dir:t,filepath:e})||!i.some(t=>cr(e,t)))return null;if(a&&!a(e))return;let[l,u,d]=await Promise.all([n&&n.type(),r&&r.type(),o&&o.type()]),f=[l,u,d].includes(`blob`);if((l===`tree`||l===`special`)&&!f)return;if(l===`commit`)return null;if((u===`tree`||u===`special`)&&!f)return;if(d===`commit`)return null;if((d===`tree`||d===`special`)&&!f)return;let p=l===`blob`?await n.oid():void 0,m=d===`blob`?await o.oid():void 0,h;l!==`blob`&&u===`blob`&&d!==`blob`?h=`42`:u===`blob`&&(h=await r.oid());let g=[void 0,p,h,m],_=g.map(e=>g.indexOf(e));return _.shift(),[e,..._]}})}catch(e){throw e.caller=`git.statusMatrix`,e}}async function ro({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r,object:i,force:a=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r);let t=new Y(e);if(r===void 0)throw new K(`ref`);r=r.startsWith(`refs/tags/`)?r:`refs/tags/${r}`;let o=await Z({fsp:t,dotgit:n}),s=await H.resolve({fs:t,gitdir:o,ref:i||`HEAD`});if(!a&&await H.exists({fs:t,gitdir:o,ref:r}))throw new Ot(`tag`,r);await H.writeRef({fs:t,gitdir:o,ref:r,value:s})}catch(e){throw e.caller=`git.tag`,e}}async function io({fs:e,dir:t,gitdir:n=B(t,`.git`),cache:r={},filepath:i,oid:a,mode:o,add:s,remove:c,force:l}){try{X(`fs`,e),X(`gitdir`,n),X(`filepath`,i);let u=new Y(e),d=await Z({fsp:u,dotgit:n});if(c)return await L.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!l){let e=await u.lstat(B(t,i));if(e){if(e.isDirectory())throw new Rt(`directory`);return}}e.has({filepath:i})&&e.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(B(t,i)),!f)throw new R(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new Rt(`directory`)}return await L.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!s&&!e.has({filepath:i}))throw new R(`file at "${i}" in index and "add" not set`);let n;if(a)n={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{n=f;let e=n.isSymbolicLink()?await u.readlink(B(t,i)):await u.read(B(t,i));a=await Q({fs:u,gitdir:d,type:`blob`,format:`content`,object:e})}return e.insert({filepath:i,oid:a,stats:n}),a})}catch(e){throw e.caller=`git.updateIndex`,e}}function ao(){try{return $r.version}catch(e){throw e.caller=`git.version`,e}}async function oo({fs:e,dir:t,gitdir:n=B(t,`.git`),trees:r,map:i,reduce:a,iterate:o,cache:s={}}){try{X(`fs`,e),X(`gitdir`,n),X(`trees`,r);let c=new Y(e);return await bn({fs:c,cache:s,dir:t,gitdir:await Z({fsp:c,dotgit:n}),trees:r,map:i,reduce:a,iterate:o})}catch(e){throw e.caller=`git.walk`,e}}async function so({fs:e,dir:t,gitdir:n=B(t,`.git`),blob:r}){try{X(`fs`,e),X(`gitdir`,n),X(`blob`,r);let t=new Y(e);return await Q({fs:t,gitdir:await Z({fsp:t,dotgit:n}),type:`blob`,object:r,format:`content`})}catch(e){throw e.caller=`git.writeBlob`,e}}async function co({fs:e,dir:t,gitdir:n=B(t,`.git`),commit:r}){try{X(`fs`,e),X(`gitdir`,n),X(`commit`,r);let t=new Y(e);return await Va({fs:t,gitdir:await Z({fsp:t,dotgit:n}),commit:r})}catch(e){throw e.caller=`git.writeCommit`,e}}async function lo({fs:e,dir:t,gitdir:n=B(t,`.git`),type:i,object:a,format:o=`parsed`,oid:s,encoding:c=void 0}){try{let t=new Y(e),l=await Z({fsp:t,dotgit:n});if(o===`parsed`){switch(i){case`commit`:a=q.from(a).toObject();break;case`tree`:a=U.from(a).toObject();break;case`blob`:a=r.Buffer.from(a,c);break;case`tag`:a=ln.from(a).toObject();break;default:throw new z(s||``,i,`blob|commit|tag|tree`)}o=`content`}return s=await Q({fs:t,gitdir:l,type:i,object:a,oid:s,format:o}),s}catch(e){throw e.caller=`git.writeObject`,e}}async function uo({fs:e,dir:t,gitdir:n=B(t,`.git`),ref:r,value:i,force:a=!1,symbolic:o=!1}){try{X(`fs`,e),X(`gitdir`,n),X(`ref`,r),X(`value`,i);let t=new Y(e);if(!tr(r,!0))throw new zt(r,v.clean(r));let s=await Z({fsp:t,dotgit:n});if(!a&&await H.exists({fs:t,gitdir:s,ref:r}))throw new Ot(`ref`,r);o?await H.writeSymbolicRef({fs:t,gitdir:s,ref:r,value:i}):(i=await H.resolve({fs:t,gitdir:s,ref:i}),await H.writeRef({fs:t,gitdir:s,ref:r,value:i}))}catch(e){throw e.caller=`git.writeRef`,e}}async function fo({fs:e,gitdir:t,tag:n}){return await Q({fs:e,gitdir:t,type:`tag`,object:ln.from(n).toObject(),format:`content`})}async function po({fs:e,dir:t,gitdir:n=B(t,`.git`),tag:r}){try{X(`fs`,e),X(`gitdir`,n),X(`tag`,r);let t=new Y(e);return await fo({fs:t,gitdir:await Z({fsp:t,dotgit:n}),tag:r})}catch(e){throw e.caller=`git.writeTag`,e}}async function mo({fs:e,dir:t,gitdir:n=B(t,`.git`),tree:r}){try{X(`fs`,e),X(`gitdir`,n),X(`tree`,r);let t=new Y(e);return await Zn({fs:t,gitdir:await Z({fsp:t,dotgit:n}),tree:r})}catch(e){throw e.caller=`git.writeTree`,e}}var ho={Errors:$t,STAGE:be,TREE:J,WORKDIR:hn,add:Rn,abortMerge:An,addNote:$n,addRemote:rr,annotatedTag:ar,branch:sr,cherryPick:Dr,checkout:mr,clone:li,commit:ui,getConfig:Mi,getConfigAll:Pi,setConfig:Ba,currentBranch:di,deleteBranch:pi,deleteRef:mi,deleteRemote:gi,deleteTag:vi,expandOid:Si,expandRef:Ci,fastForward:Di,fetch:Oi,findMergeBase:ki,findRoot:ji,getRemoteInfo:Fi,getRemoteInfo2:Li,hashBlob:zi,indexPack:Vi,init:Hi,isDescendent:Wi,isIgnored:Gi,listBranches:Ki,listFiles:Yi,listNotes:Zi,listRefs:Qi,listRemotes:ea,listServerRefs:ra,listTags:ia,log:la,merge:ua,packObjects:ma,pull:ha,push:xa,readBlob:wa,readCommit:Ta,readNote:Da,readObject:Oa,readTag:Aa,readTree:ja,remove:Ma,removeNote:Pa,renameBranch:Ia,resetIndex:Ra,updateIndex:io,resolveRef:za,status:$a,statusMatrix:no,tag:ro,version:ao,walk:oo,writeBlob:so,writeCommit:co,writeObject:lo,writeRef:uo,writeTag:po,writeTree:mo,stash:Qa};t.Errors=$t,t.STAGE=be,t.TREE=J,t.WORKDIR=hn,t.abortMerge=An,t.add=Rn,t.addNote=$n,t.addRemote=rr,t.annotatedTag=ar,t.branch=sr,t.checkout=mr,t.cherryPick=Dr,t.clone=li,t.commit=ui,t.currentBranch=di,t.default=ho,t.deleteBranch=pi,t.deleteRef=mi,t.deleteRemote=gi,t.deleteTag=vi,t.expandOid=Si,t.expandRef=Ci,t.fastForward=Di,t.fetch=Oi,t.findMergeBase=ki,t.findRoot=ji,t.getConfig=Mi,t.getConfigAll=Pi,t.getRemoteInfo=Fi,t.getRemoteInfo2=Li,t.hashBlob=zi,t.indexPack=Vi,t.init=Hi,t.isDescendent=Wi,t.isIgnored=Gi,t.listBranches=Ki,t.listFiles=Yi,t.listNotes=Zi,t.listRefs=Qi,t.listRemotes=ea,t.listServerRefs=ra,t.listTags=ia,t.log=la,t.merge=ua,t.packObjects=ma,t.pull=ha,t.push=xa,t.readBlob=wa,t.readCommit=Ta,t.readNote=Da,t.readObject=Oa,t.readTag=Aa,t.readTree=ja,t.remove=Ma,t.removeNote=Pa,t.renameBranch=Ia,t.resetIndex=Ra,t.resolveRef=za,t.setConfig=Ba,t.stash=Qa,t.status=$a,t.statusMatrix=no,t.tag=ro,t.updateIndex=io,t.version=ao,t.walk=oo,t.writeBlob=so,t.writeCommit=co,t.writeObject=lo,t.writeRef=uo,t.writeTag=po,t.writeTree=mo}))(),1),O=a();globalThis.Buffer||(globalThis.Buffer=O.Buffer);function k(e){try{let t=typeof location<`u`&&location.origin?location.origin:typeof globalThis<`u`&&globalThis.location?.origin?globalThis.location.origin:`http://127.0.0.1:8888`,n=new URL(e,t).hostname.toLowerCase();if(n===`localhost`||n===`127.0.0.1`||n===`::1`||n===`[::1]`)return`loopback`;if(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(n)||!n.includes(`.`)||n.endsWith(`.local`)||n.endsWith(`.lan`)||n.endsWith(`.home`)||n.endsWith(`.internal`))return`private`}catch{}}const A={async request({url:e,method:t=`GET`,headers:n={},body:r}){r&&=await ee(r);let i=k(e),a={method:t,headers:n,body:r,credentials:`omit`};i&&(a.targetAddressSpace=i);let o=await fetch(e,a),s=o.body&&typeof o.body.getReader==`function`?j(o.body):[new Uint8Array(await o.arrayBuffer())],c={};for(let[e,t]of o.headers.entries())c[e]=t;return{url:o.url,method:t,statusCode:o.status,statusMessage:o.statusText,body:s,headers:c}}};async function ee(e){let t=[];if(e[Symbol.asyncIterator])for await(let n of e)t.push(n);else if(e[Symbol.iterator])for(let n of e)t.push(n);else if(e.next){let n=await e.nexT();for(;!n.done;)t.push(n.value),n=await e.nexT()}else return e;let n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}function j(e){let t=e.getReader();return{next(){return t.read()},return(){return t.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}let M=null,te=null,N=null,P=null,ne=null;function F(e){return e.trim().replace(/^[\\/]+/,``).replace(/[\\/]+$/,``).split(/[\\/]+/).filter(e=>e!==`.`&&e!==``).join(`/`)}const re=new class{_map=new Map;_maxSize;constructor(e=2048){this._maxSize=e}clear(){this._map.clear()}get(e){let t=this._map.get(e);return t!==void 0&&(this._map.delete(e),this._map.set(e,t)),t}invalidate(e){let t=e.endsWith(`/`)?e:e+`/`;for(let n of this._map.keys())(n===e||n.startsWith(t))&&this._map.delete(n)}set(e,t){if(this._map.size>=this._maxSize){let e=this._map.keys().next().value;e!==void 0&&this._map.delete(e)}this._map.set(e,t)}};async function ie(e,t,n={},r=``){let i=e,a=r;for(let e of t){a=a?`${a}/${e}`:e;let t=re.get(a);t&&!n.create?i=t:(i=await i.getDirectoryHandle(e,{create:n.create??!1}),re.set(a,i))}return i}async function ae(e,t,n={}){let r=F(t),i=r.split(`/`).filter(Boolean);if(i.length===0)return e;let a=await ie(e,i.slice(0,-1),n),o=i[i.length-1];if(n.forceFile||o.includes(`.`))try{return await a.getFileHandle(o,{create:n.create??!1})}catch{}try{let e=await a.getDirectoryHandle(o,{create:n.create??!1}),t=r;return re.set(t,e),e}catch{return await a.getFileHandle(o,{create:n.create??!1})}}async function oe(e,t,n={}){let r=F(t).split(`/`).filter(Boolean);return r.length===0?e:ie(e,r,n)}async function se(e,t,n={}){let r=F(t).split(`/`).filter(Boolean);if(r.length===0)throw Error(`Cannot resolve '.' as file`);return(await ie(e,r.slice(0,-1),n)).getFileHandle(r[r.length-1],{create:n.create??!1})}async function I(e,t){let n=F(t).split(`/`).filter(Boolean);if(n.length===0)throw Error(`Cannot get parent of root`);let r=n[n.length-1];return[await ie(e,n.slice(0,-1)),r]}function ce(e){return e.trim().replace(/\\/g,`/`).replace(/^\/+/,``).replace(/^\.\//,``)}function le(e){let t=new Map,n=`repos/.git-modes`;function r(e){return e.replace(/\\/g,`/`.replace(/^\/+/,``))}async function i(){try{let r=await(await(await se(e,n)).getFile()).text(),i=JSON.parse(r);for(let[e,n]of i)t.set(e,n)}catch{}}let a=null;function o(){a===null&&(a=setTimeout(async()=>{a=null;try{let r=await(await se(e,n,{create:!0})).createWritable(),i=JSON.stringify([...t.entries()]);await r.write(new TextEncoder().encode(i)),await r.close()}catch{}},500))}let s=i(),c={async readFile(t,n){let r=await(await(await se(e,t)).getFile()).arrayBuffer(),i=typeof n==`string`?n:n?.encoding;return i===`utf8`||i===`utf-8`?new TextDecoder().decode(r):new Uint8Array(r)},async writeFile(n,i,a){let s=await(await se(e,n,{create:!0})).createWritable();typeof i==`string`&&(i=new TextEncoder().encode(i)),await s.write(i),await s.close();let c=typeof a==`object`&&a?a.mode:void 0,l=r(n);if(c!=null){let e=(c&73)!=0;t.set(l,e?33261:33188),o()}else t.has(l)||t.set(l,33188)},async mkdir(t){await oe(e,t,{create:!0})},async rmdir(n){let[i,a]=await I(e,n);await i.removeEntry(a,{recursive:!0});let o=r(n)+`/`;for(let e of t.keys())(e===r(n)||e.startsWith(o))&&t.delete(e);re.invalidate(F(n))},async readdir(t){let n=await oe(e,t),r=[];for await(let[e]of n.entries())r.push(e);return r},async stat(n){await s;let i;try{i=await ae(e,n)}catch{let e=Error(`ENOENT: no such file or directory, stat '${n}'`);throw e.code=`ENOENT`,e}if(i.kind===`directory`){let e=new Date;return{isDirectory:()=>!0,isFile:()=>!1,isSymbolicLink:()=>!1,size:0,mtimeMs:Date.now(),mode:16877,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:e,mtime:e}}else{let e=await i.getFile(),a=new Date(e.lastModified),o=r(n),s=t.get(o)??33188;return{isDirectory:()=>!1,isFile:()=>!0,isSymbolicLink:()=>!1,size:e.size,mtimeMs:e.lastModified,mode:s,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:a,mtime:a}}},async lstat(e){return c.stat(e)},async unlink(n){let[i,a]=await I(e,n);await i.removeEntry(a),t.delete(r(n))},async symlink(e,t){throw Error(`OPFS does not support symlinks`)},async readlink(e){return await c.readFile(e,`utf8`)}};return{promises:c}}const ue=le,de=`repos`;function fe(e,t,i){if(e===`custom`&&t)return t;if(e===`public`)return`https://www.cors-anywhere.com`;let a=i||(typeof globalThis<`u`&&globalThis.location?globalThis.location:typeof self<`u`&&self.location?self.location:typeof window<`u`&&window.location?window.location:null),o=a?.protocol||``,s=o===`https:`||o===`https`||typeof a?.origin==`string`&&a.origin.startsWith(`https:`)||typeof a?.href==`string`&&a.href.startsWith(`https://`)?`https:`:`http:`,c=a?.host||``,l=a?.hostname||``,u=l===`localhost`||l===`127.0.0.1`||l===`::1`||l===`[::1]`||l===`0.0.0.0`||c.startsWith(`localhost:`)||c.startsWith(`127.0.0.1:`)||c.startsWith(`[::1]:`),d=a&&(a.protocol===`file:`||l&&(l.endsWith(`.github.io`)||l.endsWith(`.pages.dev`)));return c&&(u||!d)?`${s}//${c}/git-proxy`:`${s}//${r}:${n}/git-proxy`}async function pe(){return ne||=(async()=>{if(M=D.default,te=A,!N){let e;try{e=await navigator.storage.getDirectory()}catch(t){console.warn(`OPFS is unavailable for git root, falling back to memory:`,t);let{getMemoryOpfsRoot:n}=await import(`./memoryStorage-Bh8fjmip.js`).then(e=>e.n);e=n()}N=le(e),P=N.promises}})(),await ne,{git:M,http:te,fs:N,pfs:P}}async function L(e){let t=await pe();if(e){let n=le(e);return{git:t.git,http:t.http,fs:n,pfs:n.promises,repoDirFn:e=>`repos/${e}`}}return{...t,repoDirFn:he}}function me(e){return(e.replace(/\/+$/,``).split(`/`).pop()||`repo`).replace(/\.git$/,``)}function he(e){return`${de}/${e}`}async function ge(e,t,n){try{await e.getConfig({fs:t,dir:n,path:`core.filemode`})!==!1&&await e.setConfig({fs:t,dir:n,path:`core.filemode`,value:!1})}catch(e){console.error(`Failed to set core.filemode=false:`,e)}}async function _e(e,t){try{await e.mkdir(t)}catch{}}function ve({token:e,username:t,password:n}={}){if(!e&&!t)return{};let r;e?r={Authorization:`Basic ${btoa(`${e}:x-oauth-basic`)}`}:t&&(r={Authorization:`Basic ${btoa(`${t}:${n||``}`)}`});let i=()=>e?{username:e,password:`x-oauth-basic`}:t?{username:t,password:n||``}:{cancel:!0},a=()=>({cancel:!0});return{...r?{headers:r}:{},onAuth:i,onAuthFailure:a}}async function ye({url:e,branch:t,depth:n=20,corsProxy:r,name:i,token:a,username:o,password:s,groupRoot:c}){let{git:l,http:u,fs:d,pfs:f,repoDirFn:p}=await L(c),m=i||me(e),h=p(m);r||=fe(`local`),await _e(f,de),await _e(f,h);let g=ve({token:a,username:o,password:s});try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch{try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.fetch(i)}catch{try{await Le(f,h),await _e(f,h);let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch(t){throw Error(`Failed to clone/fetch ${e}: ${t instanceof Error?t.message:String(t)}`)}}}return await ge(l,d,h),m}async function be({repo:e,ref:t,groupRoot:n}){let{git:r,fs:i,repoDirFn:a}=await L(n),o=a(e);return await r.checkout({fs:i,dir:o,ref:t,force:!0}),`Checked out ${t} in ${e}`}async function R({repo:e,name:t,checkout:n=!1,startPoint:r,groupRoot:i}){let{git:a,fs:o,repoDirFn:s}=await L(i),c=s(e),l={fs:o,dir:c,ref:t};return r&&(l.object=r),await a.branch(l),n?(await a.checkout({fs:o,dir:c,ref:t}),`Created and switched to branch ${t} in ${e}`):`Created branch ${t} in ${e}`}async function z({repo:e,groupRoot:t}){let{git:n,fs:r,repoDirFn:i}=await L(t),a=i(e);await ge(n,r,a);let o=await n.statusMatrix({fs:r,dir:a});if(o.length===0)return`Empty repository.`;let s=[];for(let[e,t,n,r]of o){let i=``;if(t===0&&n===2&&r===2)i=`added`;else if(t===0&&n===2&&r===0)i=`new (unstaged)`;else if(t===1&&n===2&&r===2)i=`modified (staged)`;else if(t===1&&n===2&&r===1)i=`modified`;else if(t===1&&n===0&&r===0)i=`deleted`;else if(t===1&&n===1&&r===1)continue;else i=`[${t},${n},${r}]`;s.push(`${i}: ${e}`)}return s.length===0?`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\nNothing to commit, working tree clean.`:`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\n${s.join(`
78
78
  `)}`}async function xe({repo:e,ref:t,depth:n=10,groupRoot:r}){let{git:i,fs:a,repoDirFn:o}=await L(r),s={fs:a,dir:o(e),depth:n};t&&(s.ref=t);let c=await i.log(s);return c.length===0?`No commits found.`:c.map(e=>{let t=e.commit,n=new Date(t.author.timestamp*1e3).toISOString();return`${e.oid} ${n} ${t.author.name} — ${t.message.trim().split(`
79
79
  `)[0]}`}).join(`
80
80
  `)}async function Se({repo:e,ref1:t,ref2:n,groupRoot:r}){let{git:i,fs:a,repoDirFn:o}=await L(r),s=o(e),c=a.promises;if(await ge(i,a,s),!t&&!n){let e=(await i.statusMatrix({fs:a,dir:s})).filter(([,e,t])=>!(e===1&&t===1));if(e.length===0)return`No differences.`;let t=[];for(let[n,r,o]of e)try{if(r===0&&o===2){let e=(await we(c,s,n)).split(`