shadow-claw 1.59.7 → 1.60.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 (253) hide show
  1. package/.well-known/mcp/server-card.json +4 -12
  2. package/.well-known/mcp.json +4 -12
  3. package/README.md +6 -2
  4. package/dist/cli/build/build.js +1 -1
  5. package/dist/cli/{chunk-DDvuLVfW.js → chunk-3C5izdQW.js} +1 -1
  6. package/dist/cli/chunk-B-75h9gX.js +1 -0
  7. package/dist/cli/{chunk-hVf839t7.js → chunk-B7Kn-otm.js} +1 -1
  8. package/dist/cli/{chunk-YX32FcN7.js → chunk-BBczgswQ.js} +1 -1
  9. package/dist/cli/{chunk-DcNxjqH6.js → chunk-BE-lYWcn.js} +1 -1
  10. package/dist/cli/{chunk-CQaCgswD.js → chunk-BECr0WxI.js} +11 -11
  11. package/dist/cli/chunk-BEz1PD1_.js +1 -0
  12. package/dist/cli/chunk-BLzI1Fp2.js +1 -0
  13. package/dist/cli/{chunk-B3TrWbca.js → chunk-BVSC1MNQ.js} +11 -11
  14. package/dist/cli/{chunk-D_te8ufL.js → chunk-BdWcep6o.js} +1 -1
  15. package/dist/cli/{chunk-SRBRVorc.js → chunk-BfTpnSS4.js} +1 -1
  16. package/dist/cli/{chunk-D2_eAO83.js → chunk-BgvqTf7w.js} +1 -1
  17. package/dist/cli/chunk-BwsJfUT3.js +1 -0
  18. package/dist/cli/{chunk--PFY91kE.js → chunk-C9b4b7c_.js} +1 -1
  19. package/dist/cli/{chunk-SxK79JmB.js → chunk-CAw9XYFe.js} +1 -1
  20. package/dist/cli/chunk-CFCcbFs2.js +396 -0
  21. package/dist/cli/{chunk-Cnjb8Usu.js → chunk-CTarF4FC.js} +1 -1
  22. package/dist/cli/{chunk-3vNYrs_L.js → chunk-Cbq5hpjb.js} +4 -4
  23. package/dist/cli/chunk-CjTjKy_v.js +310 -0
  24. package/dist/cli/chunk-Cjyu4cr_.js +36 -0
  25. package/dist/cli/{chunk-DUGZPka_.js → chunk-ClMKygjZ.js} +1 -1
  26. package/dist/cli/chunk-Cppnq1KF.js +1 -0
  27. package/dist/cli/{chunk-DvemF16v.js → chunk-D9QCNFMO.js} +1 -1
  28. package/dist/cli/{chunk-iB8OoMmW.js → chunk-DB21BMqt.js} +1 -1
  29. package/dist/cli/{chunk-_Vo-o_e3.js → chunk-DHoIWvCc.js} +1 -1
  30. package/dist/cli/chunk-DZEN9T5y.js +1 -0
  31. package/dist/cli/{chunk-5rLO4DWS.js → chunk-Dl14OyYO.js} +9 -9
  32. package/dist/cli/chunk-Dl_vv0dI.js +1 -0
  33. package/dist/cli/chunk-Dpmfhlyl.js +1 -0
  34. package/dist/cli/{chunk-BrR1DOBS.js → chunk-Du7Xtucq.js} +1 -1
  35. package/dist/cli/{chunk-B88Z8T_9.js → chunk-DxcDFUi_.js} +1 -1
  36. package/dist/cli/{chunk-Dt7-hzJU.js → chunk-DyyEWbV7.js} +1 -1
  37. package/dist/cli/chunk-N0x3mXU0.js +1 -0
  38. package/dist/cli/{chunk-CGoE4llV.js → chunk-V-w0Bata.js} +1 -1
  39. package/dist/cli/{chunk-CncW6_WL.js → chunk-ZxDxSSn-.js} +1 -1
  40. package/dist/cli/{chunk-CZdCRqNe.js → chunk-lPvFUkd5.js} +1 -1
  41. package/dist/cli/{chunk-66BvqAV0.js → chunk-n5s-sCdU.js} +1 -1
  42. package/dist/cli/{chunk-CAAeGOdy.js → chunk-nD9VPVMq.js} +1 -1
  43. package/dist/cli/{chunk-DMs7kREC.js → chunk-rFuy8aS_.js} +1 -1
  44. package/dist/cli/{chunk-B0qusANw.js → chunk-wjM6JXWa.js} +1 -1
  45. package/dist/cli/{chunk-DhOU6GYX.js → chunk-zcES9rut.js} +1 -1
  46. package/dist/cli/cli.js +3 -3
  47. package/dist/headless-agent.js +1 -1
  48. package/dist/lib/{channel-mmdGzPkT.js → channel-DB77spML.js} +2 -2
  49. package/dist/lib/{channel-mmdGzPkT.js.map → channel-DB77spML.js.map} +1 -1
  50. package/dist/lib/{compact-context-CY9BBlUQ.js → compact-context-Q9t9aL1e.js} +7 -7
  51. package/dist/lib/{compact-context-CY9BBlUQ.js.map → compact-context-Q9t9aL1e.js.map} +1 -1
  52. package/dist/lib/components/index.js +21 -21
  53. package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
  54. package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
  55. package/dist/lib/components/settings/shadow-claw-git.js +1 -1
  56. package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
  57. package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
  58. package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
  59. package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
  60. package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
  61. package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
  62. package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
  63. package/dist/lib/components/shadow-claw-channel-config.js +1 -1
  64. package/dist/lib/components/shadow-claw-channels.js +1 -1
  65. package/dist/lib/components/shadow-claw-chat.js +1 -1
  66. package/dist/lib/components/shadow-claw-control-plane.js +1 -1
  67. package/dist/lib/components/shadow-claw-conversations.js +1 -1
  68. package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
  69. package/dist/lib/components/shadow-claw-files.js +1 -1
  70. package/dist/lib/components/shadow-claw-git.js +1 -1
  71. package/dist/lib/components/shadow-claw-llm.js +1 -1
  72. package/dist/lib/components/shadow-claw-networking.js +1 -1
  73. package/dist/lib/components/shadow-claw-notifications.js +1 -1
  74. package/dist/lib/components/shadow-claw-pages.js +1 -1
  75. package/dist/lib/components/shadow-claw-peerjs.js +1 -1
  76. package/dist/lib/components/shadow-claw-settings.js +1 -1
  77. package/dist/lib/components/shadow-claw-storage.js +1 -1
  78. package/dist/lib/components/shadow-claw-task-server.js +1 -1
  79. package/dist/lib/components/shadow-claw-tasks.js +1 -1
  80. package/dist/lib/components/shadow-claw-terminal.js +1 -1
  81. package/dist/lib/components/shadow-claw-tools.js +1 -1
  82. package/dist/lib/components/shadow-claw-webvm.js +1 -1
  83. package/dist/lib/components/shadow-claw.js +1 -1
  84. package/dist/lib/{configure-peer-js-ccNvax2N.js → configure-peer-js-CgFiwoxY.js} +2 -2
  85. package/dist/lib/{configure-peer-js-ccNvax2N.js.map → configure-peer-js-CgFiwoxY.js.map} +1 -1
  86. package/dist/lib/content/build-attachment-content-blocks.d.ts +2 -0
  87. package/dist/lib/{discover-skills-OwlQ2sXA.js → discover-skills-CXyaWHKi.js} +5 -5
  88. package/dist/lib/{discover-skills-OwlQ2sXA.js.map → discover-skills-CXyaWHKi.js.map} +1 -1
  89. package/dist/lib/{git-D2J_j9X9.js → git-CogDRlEz.js} +2 -2
  90. package/dist/lib/{git-D2J_j9X9.js.map → git-CogDRlEz.js.map} +1 -1
  91. package/dist/lib/index.js +21 -21
  92. package/dist/lib/{init-control-plane-B7blDVIE.js → init-control-plane-CEGdzgWX.js} +7 -7
  93. package/dist/lib/{init-control-plane-B7blDVIE.js.map → init-control-plane-CEGdzgWX.js.map} +1 -1
  94. package/dist/lib/{invoke-agent-SxvudiDT.js → invoke-agent-cac3gCsj.js} +6 -6
  95. package/dist/lib/{invoke-agent-SxvudiDT.js.map → invoke-agent-cac3gCsj.js.map} +1 -1
  96. package/dist/lib/{move-group-entry-DDpjxa10.js → move-group-entry-D8dptMg0.js} +2 -2
  97. package/dist/lib/{move-group-entry-DDpjxa10.js.map → move-group-entry-D8dptMg0.js.map} +1 -1
  98. package/dist/lib/{orchestrator-C7fkh7T7.js → orchestrator-BBAwy9Nm.js} +12 -12
  99. package/dist/lib/{orchestrator-C7fkh7T7.js.map → orchestrator-BBAwy9Nm.js.map} +1 -1
  100. package/dist/lib/{orchestrator-CCARkxQC.js → orchestrator-cRBe3lhq.js} +2 -2
  101. package/dist/lib/{orchestrator-CCARkxQC.js.map → orchestrator-cRBe3lhq.js.map} +1 -1
  102. package/dist/lib/{peerjs-Bfw_FWLB.js → peerjs-BLg8aGUj.js} +3 -3
  103. package/dist/lib/{peerjs-Bfw_FWLB.js.map → peerjs-BLg8aGUj.js.map} +1 -1
  104. package/dist/lib/{process-peer-query-param-BxYiZNdf.js → process-peer-query-param-BnsVnxzH.js} +5 -5
  105. package/dist/lib/{process-peer-query-param-BxYiZNdf.js.map → process-peer-query-param-BnsVnxzH.js.map} +1 -1
  106. package/dist/lib/{process-pending-shared-payloads-DPIbwRb3.js → process-pending-shared-payloads-DBZfZOOa.js} +2 -2
  107. package/dist/lib/{process-pending-shared-payloads-DPIbwRb3.js.map → process-pending-shared-payloads-DBZfZOOa.js.map} +1 -1
  108. package/dist/lib/{process-room-query-param-B2_d50nE.js → process-room-query-param-B8EYg_-r.js} +4 -4
  109. package/dist/lib/{process-room-query-param-B2_d50nE.js.map → process-room-query-param-B8EYg_-r.js.map} +1 -1
  110. package/dist/lib/{push-client-rrjTdc-U.js → push-client-CAm6UMvE.js} +3 -3
  111. package/dist/lib/{push-client-rrjTdc-U.js.map → push-client-CAm6UMvE.js.map} +1 -1
  112. package/dist/lib/{rooms-bwGoYb1q.js → rooms-Dzphx3rK.js} +2 -2
  113. package/dist/lib/{rooms-bwGoYb1q.js.map → rooms-Dzphx3rK.js.map} +1 -1
  114. package/dist/lib/{shadow-claw-CypGVlVO.js → shadow-claw-CGl8tXtG.js} +6 -6
  115. package/dist/lib/{shadow-claw-CypGVlVO.js.map → shadow-claw-CGl8tXtG.js.map} +1 -1
  116. package/dist/lib/{shadow-claw-channel-config-DJpDovkF.js → shadow-claw-channel-config-BNIWCdsL.js} +4 -4
  117. package/dist/lib/{shadow-claw-channel-config-DJpDovkF.js.map → shadow-claw-channel-config-BNIWCdsL.js.map} +1 -1
  118. package/dist/lib/{shadow-claw-channels-DJLwRovH.js → shadow-claw-channels-C2QSn4Ew.js} +2 -2
  119. package/dist/lib/{shadow-claw-channels-DJLwRovH.js.map → shadow-claw-channels-C2QSn4Ew.js.map} +1 -1
  120. package/dist/lib/{shadow-claw-chat-B92cPaft.js → shadow-claw-chat-Wx3y9y6c.js} +3 -3
  121. package/dist/lib/{shadow-claw-chat-B92cPaft.js.map → shadow-claw-chat-Wx3y9y6c.js.map} +1 -1
  122. package/dist/lib/{shadow-claw-control-plane-fvn-qyHj.js → shadow-claw-control-plane-D5E4cFGu.js} +6 -6
  123. package/dist/lib/{shadow-claw-control-plane-fvn-qyHj.js.map → shadow-claw-control-plane-D5E4cFGu.js.map} +1 -1
  124. package/dist/lib/{shadow-claw-conversations-CsVyDOny.js → shadow-claw-conversations-BtDv7GRW.js} +2 -2
  125. package/dist/lib/{shadow-claw-conversations-CsVyDOny.js.map → shadow-claw-conversations-BtDv7GRW.js.map} +1 -1
  126. package/dist/lib/{shadow-claw-file-viewer-DFfyP7s5.js → shadow-claw-file-viewer-CG40kwWV.js} +2 -2
  127. package/dist/lib/{shadow-claw-file-viewer-DFfyP7s5.js.map → shadow-claw-file-viewer-CG40kwWV.js.map} +1 -1
  128. package/dist/lib/{shadow-claw-files-cT6HL7ye.js → shadow-claw-files-BOUULrlX.js} +3 -3
  129. package/dist/lib/{shadow-claw-files-cT6HL7ye.js.map → shadow-claw-files-BOUULrlX.js.map} +1 -1
  130. package/dist/lib/{shadow-claw-git-Cv9mQgTx.js → shadow-claw-git-BeHV73_9.js} +3 -3
  131. package/dist/lib/{shadow-claw-git-Cv9mQgTx.js.map → shadow-claw-git-BeHV73_9.js.map} +1 -1
  132. package/dist/lib/{shadow-claw-llm-CKOYzPDp.js → shadow-claw-llm-KONyWKZM.js} +2 -2
  133. package/dist/lib/{shadow-claw-llm-CKOYzPDp.js.map → shadow-claw-llm-KONyWKZM.js.map} +1 -1
  134. package/dist/lib/{shadow-claw-networking-DYfiUQaH.js → shadow-claw-networking-Diy3JJkc.js} +2 -2
  135. package/dist/lib/{shadow-claw-networking-DYfiUQaH.js.map → shadow-claw-networking-Diy3JJkc.js.map} +1 -1
  136. package/dist/lib/{shadow-claw-notifications-JJlzriuX.js → shadow-claw-notifications-C-upPa-4.js} +2 -2
  137. package/dist/lib/{shadow-claw-notifications-JJlzriuX.js.map → shadow-claw-notifications-C-upPa-4.js.map} +1 -1
  138. package/dist/lib/{shadow-claw-pages-BCo3ihZI.js → shadow-claw-pages-CfAjUKgd.js} +2 -2
  139. package/dist/lib/{shadow-claw-pages-BCo3ihZI.js.map → shadow-claw-pages-CfAjUKgd.js.map} +1 -1
  140. package/dist/lib/{shadow-claw-peerjs-CFNjfrY5.js → shadow-claw-peerjs-t4YibS9s.js} +5 -5
  141. package/dist/lib/{shadow-claw-peerjs-CFNjfrY5.js.map → shadow-claw-peerjs-t4YibS9s.js.map} +1 -1
  142. package/dist/lib/{shadow-claw-settings-BMwne0bh.js → shadow-claw-settings-Cg5V0e9g.js} +2 -2
  143. package/dist/lib/{shadow-claw-settings-BMwne0bh.js.map → shadow-claw-settings-Cg5V0e9g.js.map} +1 -1
  144. package/dist/lib/{shadow-claw-storage-DUY8B9m-.js → shadow-claw-storage-C7tCnsSG.js} +2 -2
  145. package/dist/lib/{shadow-claw-storage-DUY8B9m-.js.map → shadow-claw-storage-C7tCnsSG.js.map} +1 -1
  146. package/dist/lib/{shadow-claw-task-server-yWeoA3eL.js → shadow-claw-task-server-BObsRdf8.js} +2 -2
  147. package/dist/lib/{shadow-claw-task-server-yWeoA3eL.js.map → shadow-claw-task-server-BObsRdf8.js.map} +1 -1
  148. package/dist/lib/{shadow-claw-tasks-Bg0uM15I.js → shadow-claw-tasks-B2EEqrcY.js} +3 -3
  149. package/dist/lib/{shadow-claw-tasks-Bg0uM15I.js.map → shadow-claw-tasks-B2EEqrcY.js.map} +1 -1
  150. package/dist/lib/{shadow-claw-terminal-fyJPppY_.js → shadow-claw-terminal-DSHfO2b9.js} +2 -2
  151. package/dist/lib/{shadow-claw-terminal-fyJPppY_.js.map → shadow-claw-terminal-DSHfO2b9.js.map} +1 -1
  152. package/dist/lib/{shadow-claw-tools-D0T8m3go.js → shadow-claw-tools-DwPBADua.js} +3 -3
  153. package/dist/lib/{shadow-claw-tools-D0T8m3go.js.map → shadow-claw-tools-DwPBADua.js.map} +1 -1
  154. package/dist/lib/{shadow-claw-webvm-CQvzJwKI.js → shadow-claw-webvm-CY4qGaMB.js} +2 -2
  155. package/dist/lib/{shadow-claw-webvm-CQvzJwKI.js.map → shadow-claw-webvm-CY4qGaMB.js.map} +1 -1
  156. package/dist/lib/{sync-web-mcp-registration-BFtG_4kx.js → sync-web-mcp-registration-BiOZvW-R.js} +3 -3
  157. package/dist/lib/{sync-web-mcp-registration-BFtG_4kx.js.map → sync-web-mcp-registration-BiOZvW-R.js.map} +1 -1
  158. package/dist/lib/{system-prompt-bhGRLoL2.js → system-prompt-CxJ3Nx4c.js} +4 -3
  159. package/dist/lib/system-prompt-CxJ3Nx4c.js.map +1 -0
  160. package/dist/public/.well-known/mcp/server-card.json +4 -12
  161. package/dist/public/.well-known/mcp.json +4 -12
  162. package/dist/public/AGENTS.md +3 -1
  163. package/dist/public/README.md +6 -2
  164. package/dist/public/agent.worker.js +1 -1
  165. package/dist/public/{channel-Dk7wl-Av.js → channel-DIpDQekL.js} +1 -1
  166. package/dist/public/{chat-template-BwAnTFKf.js → chat-template-CXKs8lFR.js} +1 -1
  167. package/dist/public/compact-context-BQ2ZXoAc.js +5 -0
  168. package/dist/public/{compact-context-fOTqwKF6.js → compact-context-dHitmPsV.js} +2 -2
  169. package/dist/public/{configure-peer-js-BOV0tR6G.js → configure-peer-js-DV1rqvFX.js} +1 -1
  170. package/dist/public/{create-model-cache-fetch-DSAFjOwc.js → create-model-cache-fetch-B0mSCEk6.js} +1 -1
  171. package/dist/public/{discover-skills-D1sNTy2r.js → discover-skills-BWJB8HUA.js} +1 -1
  172. package/dist/public/docs/architecture/overview.md +1 -1
  173. package/dist/public/docs/example/article/index.html +21 -21
  174. package/dist/public/docs/example/article.html +21 -21
  175. package/dist/public/docs/publishing/index.html +21 -21
  176. package/dist/public/docs/publishing.html +21 -21
  177. package/dist/public/docs/skill-creator/index.html +21 -21
  178. package/dist/public/docs/skill-creator.html +21 -21
  179. package/dist/public/docs/subsystems/attachment-capabilities.md +14 -1
  180. package/dist/public/docs/subsystems/cli.md +95 -51
  181. package/dist/public/docs/subsystems/pages.md +5 -0
  182. package/dist/public/e2e/README.md +1 -1
  183. package/dist/public/{e2e-bridge-Cz95DLlb.js → e2e-bridge-lP2qqiv3.js} +1 -1
  184. package/dist/public/{git-BmMlwIMP.js → git-DjmQ16rm.js} +1 -1
  185. package/dist/public/{iframe-bridge-scripts-Cibg0m6A.js → iframe-bridge-scripts-CO0izGjW.js} +1 -1
  186. package/dist/public/index.html +21 -21
  187. package/dist/public/index.js +1 -1
  188. package/dist/public/{init-control-plane-Cb31yLTY.js → init-control-plane-Ctz7FI8M.js} +1 -1
  189. package/dist/public/{invoke-agent-CN7mSV0Z.js → invoke-agent-C_geruwq.js} +1 -1
  190. package/dist/public/llms.txt +1 -1
  191. package/dist/public/main/index.html +21 -21
  192. package/dist/public/main/memory/index.html +21 -21
  193. package/dist/public/main/memory.html +21 -21
  194. package/dist/public/main.html +21 -21
  195. package/dist/public/{move-group-entry-CXneuNVa.js → move-group-entry-QQ9Hkk54.js} +1 -1
  196. package/dist/public/{orchestrator-Dyylc8IU.js → orchestrator-C1kaTltu.js} +2 -2
  197. package/dist/public/{orchestrator-DBO4NZqd.js → orchestrator-Li1UAsv7.js} +1 -1
  198. package/dist/public/{peerjs-l0jiBoh6.js → peerjs-DbBryE-9.js} +1 -1
  199. package/dist/public/{process-peer-query-param-s-aSP1Rq.js → process-peer-query-param-DQIgr3KL.js} +1 -1
  200. package/dist/public/{process-pending-shared-payloads-BN3GigPT.js → process-pending-shared-payloads-Ctb-TFqB.js} +1 -1
  201. package/dist/public/{process-room-query-param-B2Qe0F0M.js → process-room-query-param-F-XnIVoZ.js} +1 -1
  202. package/dist/public/{push-client-B2LC8Qp9.js → push-client-DRx9Eggz.js} +1 -1
  203. package/dist/public/{rooms-ChCEOvkw.js → rooms-BurBI7is.js} +1 -1
  204. package/dist/public/service-worker/init.js +1 -1
  205. package/dist/public/service-worker.js +1 -1
  206. package/dist/public/{shadow-claw-Br8mWDUx.js → shadow-claw-Bg9AQ5x_.js} +2 -2
  207. package/dist/public/{shadow-claw-accounts-Dm6G7KMP.js → shadow-claw-accounts-B3mjYI0M.js} +1 -1
  208. package/dist/public/{shadow-claw-card-CggS8uSa.js → shadow-claw-card-tcXRS1GF.js} +1 -1
  209. package/dist/public/{shadow-claw-channels-088vhuWO.js → shadow-claw-channels-BiSfLvWv.js} +1 -1
  210. package/dist/public/{shadow-claw-chat-BRwRlq-n.js → shadow-claw-chat-N5jMsXZZ.js} +1 -1
  211. package/dist/public/{shadow-claw-control-plane-rhKACK85.js → shadow-claw-control-plane-DFVe_Xdq.js} +2 -2
  212. package/dist/public/{shadow-claw-conversations-CF_yUfKl.js → shadow-claw-conversations-wAR06_ya.js} +1 -1
  213. package/dist/public/{shadow-claw-empty-state-CkpOSXCS.js → shadow-claw-empty-state-CnPm3NVM.js} +1 -1
  214. package/dist/public/{shadow-claw-file-viewer-DWCejuY3.js → shadow-claw-file-viewer-sZN_FCDW.js} +2 -2
  215. package/dist/public/{shadow-claw-files-L6_ioyzh.js → shadow-claw-files-CnvkCbd4.js} +2 -2
  216. package/dist/public/{shadow-claw-git-DsdkwLqQ.js → shadow-claw-git-BBHfClGk.js} +2 -2
  217. package/dist/public/{shadow-claw-integrations-CSbRTOm3.js → shadow-claw-integrations-DvdBqzRJ.js} +1 -1
  218. package/dist/public/{shadow-claw-llm-BitaeAVc.js → shadow-claw-llm-YfohG519.js} +1 -1
  219. package/dist/public/{shadow-claw-mcp-remote-gSbV5riy.js → shadow-claw-mcp-remote-BAVbf5pi.js} +1 -1
  220. package/dist/public/{shadow-claw-networking-Dn_y6Cl9.js → shadow-claw-networking-CZ4LWPW7.js} +1 -1
  221. package/dist/public/{shadow-claw-notifications-Cj4Lqx8U.js → shadow-claw-notifications-BHwyREkG.js} +1 -1
  222. package/dist/public/{shadow-claw-page-header-DR4OZFt2.js → shadow-claw-page-header-De6Qf6eY.js} +1 -1
  223. package/dist/public/{shadow-claw-page-header-action-button-BnCV_2Kb.js → shadow-claw-page-header-action-button-FSOhTc9z.js} +1 -1
  224. package/dist/public/{shadow-claw-pages-mpDOtNYj.js → shadow-claw-pages-D_oPyDca.js} +1 -1
  225. package/dist/public/{shadow-claw-pdf-viewer-DZ_84qJH.js → shadow-claw-pdf-viewer-CrU4wqRq.js} +1 -1
  226. package/dist/public/{shadow-claw-settings-CfFTYTEy.js → shadow-claw-settings-DkUhvxVr.js} +2 -2
  227. package/dist/public/{shadow-claw-storage-DLmiT4bG.js → shadow-claw-storage-D0o56Tjw.js} +1 -1
  228. package/dist/public/{shadow-claw-task-server-BoMBCsiS.js → shadow-claw-task-server-4rkroO9K.js} +1 -1
  229. package/dist/public/{shadow-claw-tasks-ChEp1j7x.js → shadow-claw-tasks-BdP7lmvu.js} +1 -1
  230. package/dist/public/{shadow-claw-terminal-BaoVbOda.js → shadow-claw-terminal-DVHX7Fsu.js} +1 -1
  231. package/dist/public/{shadow-claw-toast-e8oz7z6Z.js → shadow-claw-toast-B9Y9tSkW.js} +1 -1
  232. package/dist/public/{shadow-claw-tools-BYjUBiJz.js → shadow-claw-tools-BwwY53Lr.js} +1 -1
  233. package/dist/public/{shadow-claw-webvm-xGb13TME.js → shadow-claw-webvm-CXGdkCNM.js} +1 -1
  234. package/dist/public/{sync-web-mcp-registration-CQluj-Kz.js → sync-web-mcp-registration-DVK_IhXZ.js} +1 -1
  235. package/dist/public/{system-prompt-CTJn0tK-.js → system-prompt-BmswoQwF.js} +2 -2
  236. package/dist/public/{workbox-92eae37e.js → workbox-e4022e15.js} +1 -1
  237. package/dist/public/{zip-reader-DN7FB-Q0.js → zip-reader-JHoTbATw.js} +1 -1
  238. package/dist/server.js +5 -5
  239. package/package.json +1 -1
  240. package/dist/cli/chunk-2gZFafgY.js +0 -1
  241. package/dist/cli/chunk-BCjL0JXf.js +0 -1
  242. package/dist/cli/chunk-BNcu1oiT.js +0 -1
  243. package/dist/cli/chunk-BUNoeMKY.js +0 -36
  244. package/dist/cli/chunk-C5ypckWC.js +0 -225
  245. package/dist/cli/chunk-CFxww5Yz.js +0 -1
  246. package/dist/cli/chunk-CGIgtL6R.js +0 -1
  247. package/dist/cli/chunk-CafdvLx-.js +0 -1
  248. package/dist/cli/chunk-Dhap1VwA.js +0 -1
  249. package/dist/cli/chunk-Ds5-K-9o.js +0 -1
  250. package/dist/cli/chunk-DwvavohW.js +0 -1
  251. package/dist/cli/chunk-_a0CkUNS.js +0 -139
  252. package/dist/lib/system-prompt-bhGRLoL2.js.map +0 -1
  253. package/dist/public/compact-context-CX4H8V57.js +0 -5
@@ -1 +0,0 @@
1
- export{t as getAgentCore}from"./chunk-CncW6_WL.js";
@@ -1 +0,0 @@
1
- export{n as runWebRtcListenCommand}from"./chunk-CAAeGOdy.js";
@@ -1 +0,0 @@
1
- export{t as resolveAgentProvider,c as runAgentRun}from"./chunk-CQaCgswD.js";
@@ -1 +0,0 @@
1
- export{r as orchestratorStore}from"./chunk-iB8OoMmW.js";
@@ -1 +0,0 @@
1
- import{a as e,n as t}from"./chunk-vVEl6p-f.js";async function n(n=[],r,i={}){let a=i.maxInlineTextBytes??102400,o=[];for(let i of n){let n=i.mimeType||`application/octet-stream`,s=t(n,i.fileName),c=s===`text`?`file`:s===`document`?`document`:s,l=null;try{l=await r(i)}catch{l=null}let u=l?.length??(typeof i.size==`number`?i.size:0);if(s===`text`&&l&&u<=a)try{let e=new TextDecoder(`utf-8`).decode(l),t=e.includes("```")?`~~~~`:"```";o.push({type:`text`,text:`Attachment: ${i.fileName}\n${t}\n${e}\n${t}`});continue}catch{}let d={type:`attachment`,mediaType:c,fileName:i.fileName,mimeType:n,size:i.size,path:i.path};l&&(c===`image`&&u<=3145728||c===`audio`&&u<=5242880||c===`document`&&u<=20971520)&&(d.data=e(l)),o.push(d)}return o}export{n as t};
@@ -1 +0,0 @@
1
- export{n as runWebRtcListenCommand}from"./chunk-D_te8ufL.js";
@@ -1,139 +0,0 @@
1
- import{t as e}from"./chunk-uAI_Zi6n.js";import{C as t,E as n,S as r,T as i,_ as a,a as o,b as s,d as c,f as l,g as u,h as d,i as f,l as p,m,o as h,p as g,r as _,t as v,w as y,x as b,y as ee}from"./chunk-Di6Kyrgh.js";import{i as te,r as x,t as S}from"./chunk-4-QO2z6r.js";import{a as C,i as ne,o as w,s as T}from"./chunk-B409KI5N.js";import{n as re}from"./chunk-kF1oe5Yi.js";import*as E from"node:fs";import D,{basename as ie,join as O,posix as ae,relative as oe,resolve as se,win32 as ce}from"node:path";import{fileURLToPath as k}from"node:url";import A,{chdir as le,env as j,exit as ue}from"node:process";import{execSync as de}from"node:child_process";import{copyFile as M,cp as N,lstat as fe,mkdir as P,readFile as F,readdir as pe,readlink as me,realpath as he,rm as ge,stat as _e,writeFile as I}from"node:fs/promises";import{chmodSync as ve,lstatSync as ye,lstatSync as be,readdir as xe,readdirSync as Se,readlinkSync as Ce,realpathSync as we,renameSync as Te,rmSync as Ee,rmdirSync as De,statSync as Oe,unlinkSync as ke}from"fs";import{EventEmitter as Ae}from"node:events";import je from"node:stream";import{StringDecoder as Me}from"node:string_decoder";import{basename as Ne,parse as L,resolve as Pe}from"path";import{inspect as Fe}from"util";import Ie from"fs/promises";import{setTimeout as Le}from"timers/promises";import{tmpdir as Re}from"os";import ze from"gray-matter";var R=(e,t,n)=>{let r=e instanceof RegExp?Be(e,n):e,i=t instanceof RegExp?Be(t,n):t,a=r!==null&&i!=null&&Ve(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},Be=(e,t)=>{let n=t.match(e);return n?n[0]:null},Ve=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},He=`\0SLASH`+Math.random()+`\0`,Ue=`\0OPEN`+Math.random()+`\0`,We=`\0CLOSE`+Math.random()+`\0`,Ge=`\0COMMA`+Math.random()+`\0`,Ke=`\0PERIOD`+Math.random()+`\0`,qe=new RegExp(He,`g`),Je=new RegExp(Ue,`g`),Ye=new RegExp(We,`g`),Xe=new RegExp(Ge,`g`),Ze=new RegExp(Ke,`g`),Qe=/\\\\/g,$e=/\\{/g,et=/\\}/g,tt=/\\,/g,nt=/\\./g,rt=1e5;function it(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function at(e){return e.replace(Qe,He).replace($e,Ue).replace(et,We).replace(tt,Ge).replace(nt,Ke)}function ot(e){return e.replace(qe,`\\`).replace(Je,`{`).replace(Ye,`}`).replace(Xe,`,`).replace(Ze,`.`)}function st(e){if(!e)return[``];let t=[],n=R(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=st(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function ct(e,t={}){if(!e)return[];let{max:n=rt}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),pt(at(e),n,!0).map(ot)}function lt(e){return`{`+e+`}`}function ut(e){return/^-?0\d/.test(e)}function dt(e,t){return e<=t}function ft(e,t){return e>=t}function pt(e,t,n){let r=[],i=R(`{`,`}`,e);if(!i)return[e];let a=i.pre,o=i.post.length?pt(i.post,t,!1):[``];if(/\$$/.test(i.pre))for(let e=0;e<o.length&&e<t;e++){let t=a+`{`+i.body+`}`+o[e];r.push(t)}else{let s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=s||c,u=i.body.indexOf(`,`)>=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+We+i.post,pt(e,t,!0)):[e];let d;if(l)d=i.body.split(/\.\./);else if(d=st(i.body),d.length===1&&d[0]!==void 0&&(d=pt(d[0],t,!1).map(lt),d.length===1))return o.map(e=>i.pre+d[0]+e);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let e=it(d[0]),t=it(d[1]),n=Math.max(d[0].length,d[1].length),r=d.length===3&&d[2]!==void 0?Math.abs(it(d[2])):1,i=dt;t<e&&(r*=-1,i=ft);let a=d.some(ut);f=[];for(let o=e;i(o,t);o+=r){let e;if(c)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,pt(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<o.length&&r.length<t;i++){let t=a+f[e]+o[i];(!n||l||t)&&r.push(t)}}return r}var mt=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},ht={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},gt=e=>e.replace(/[[\]\\-]/g,`\\$&`),_t=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),vt=e=>e.join(``),yt=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;t:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1)l=!0,a++;else{if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c)c=!0,a++;else{if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(ht))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue t}}c=!1,d?(t>d?r.push(gt(d)+`-`+gt(t)):t===d&&r.push(gt(t)),d=``,a++):e.startsWith(`-]`,a+1)?(r.push(gt(t+`-`)),a+=2):e.startsWith(`-`,a+1)?(d=t,a+=2):(r.push(gt(t)),a++)}}}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[_t(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+vt(r)+`]`,p=`[`+(l?``:`^`)+vt(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},bt=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),xt=/* @__PURE__ */ new Set([`!`,`?`,`+`,`*`,`@`]),St=e=>xt.has(e),Ct=`(?!(?:^|/)\\.\\.?(?:$|/))`,wt=`(?!\\.)`,Tt=/* @__PURE__ */ new Set([`[`,`.`]),Et=/* @__PURE__ */ new Set([`..`,`.`]),Dt=/* @__PURE__ */ new Set(`().*{}+?[]^$\\!`),Ot=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),kt=`[^/]`,At=kt+`*?`,jt=kt+`+?`,Mt=class e{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.#l=this.type?this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...t){for(let n of t)if(n!==``){if(typeof n!=`string`&&!(n instanceof e&&n.#i===this))throw Error(`invalid part: `+n);this.#r.push(n)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let n=0;n<this.#a;n++){let r=t.#r[n];if(!(r instanceof e&&r.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(t){let n=new e(this.type,t);for(let e of this.#r)n.copyIn(e);return n}static#f(t,n,r,i){let a=!1,o=!1,s=-1,c=!1;if(n.type===null){let l=r,u=``;for(;l<t.length;){let r=t.charAt(l++);if(a||r===`\\`)a=!a,u+=r;else if(o)l===s+1?(r===`^`||r===`!`)&&(c=!0):r===`]`&&!(l===s+2&&c)&&(o=!1),u+=r;else if(r===`[`)o=!0,s=l,c=!1,u+=r;else if(!i.noext&&St(r)&&t.charAt(l)===`(`){n.push(u),u=``;let a=new e(r,n);l=e.#f(t,a,l,i),n.push(a)}else u+=r}return n.push(u),l}let l=r+1,u=new e(null,n),d=[],f=``;for(;l<t.length;){let r=t.charAt(l++);if(a||r===`\\`)a=!a,f+=r;else if(o)l===s+1?(r===`^`||r===`!`)&&(c=!0):r===`]`&&!(l===s+2&&c)&&(o=!1),f+=r;else if(r===`[`)o=!0,s=l,c=!1,f+=r;else if(St(r)&&t.charAt(l)===`(`){u.push(f),f=``;let n=new e(r,u);u.push(n),l=e.#f(t,n,l,i)}else if(r===`|`)u.push(f),f=``,d.push(u),u=new e(null,n);else{if(r===`)`)return f===``&&n.#r.length===0&&(n.#u=!0),u.push(f),f=``,n.push(...d,u),l;f+=r}}return n.type=null,n.#t=void 0,n.#r=[t.substring(r-1)],l}static fromGlob(t,n={}){let r=new e(null,void 0,n);return e.#f(t,r,0,n),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(t){let n=t??!!this.#c.dot;if(this.#e===this&&this.#d(),!this.type){let r=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),i=this.#r.map(n=>{let[i,a,o,s]=typeof n==`string`?e.#m(n,this.#t,r):n.toRegExpSource(t);return this.#t=this.#t||o,this.#n=this.#n||s,i}).join(``),a=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Et.has(this.#r[0]))){let e=Tt,r=n&&e.has(i.charAt(0))||i.startsWith(`\\.`)&&e.has(i.charAt(2))||i.startsWith(`\\.\\.`)&&e.has(i.charAt(4)),o=!n&&!t&&e.has(i.charAt(0));a=r?Ct:o?wt:``}let o=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(o=`(?:$|\\/)`),[a+i+o,bt(i),this.#t=!!this.#t,this.#n]}let r=this.type===`*`||this.type===`+`,i=this.type===`!`?`(?:(?!(?:`:`(?:`,a=this.#p(n);if(this.isStart()&&this.isEnd()&&!a&&this.type!==`!`){let e=this.toString();return this.#r=[e],this.type=null,this.#t=void 0,[e,bt(this.toString()),!1,!1]}let o=!r||t||n||!wt?``:this.#p(!0);o===a&&(o=``),o&&(a=`(?:${a})(?:${o})*?`);let s=``;if(this.type===`!`&&this.#u)s=(this.isStart()&&!n?wt:``)+jt;else{let e=this.type===`!`?`))`+(this.isStart()&&!n&&!t?wt:``)+At+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&o?`)`:this.type===`*`&&o?`)?`:`)${this.type}`;s=i+a+e}return[s,bt(a),this.#t=!!this.#t,this.#n]}#p(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#m(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r)r=!1,i+=(Dt.has(c)?`\\`:``)+c;else if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?jt:At,t=!0}else if(o=!1,c===`\\`)s===e.length-1?i+=`\\\\`:r=!0;else{if(c===`[`){let[n,r,o,c]=yt(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}c===`?`?(i+=kt,t=!0):i+=Ot(c)}}return[i,bt(e),!!t,a]}},Nt=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),z=(e,t,n={})=>(mt(t),!n.nocomment&&t.charAt(0)===`#`?!1:new un(t,n).match(e)),Pt=/^\*+([^+@!?\*\[\(]*)$/,Ft=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),It=e=>t=>t.endsWith(e),Lt=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Rt=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),zt=/^\*+\.\*+$/,Bt=e=>!e.startsWith(`.`)&&e.includes(`.`),Vt=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Ht=/^\.\*+$/,Ut=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Wt=/^\*+$/,Gt=e=>e.length!==0&&!e.startsWith(`.`),Kt=e=>e.length!==0&&e!==`.`&&e!==`..`,qt=/^\?+([^+@!?\*\[\(]*)?$/,Jt=([e,t=``])=>{let n=Qt([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Yt=([e,t=``])=>{let n=$t([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Xt=([e,t=``])=>{let n=$t([e]);return t?e=>n(e)&&e.endsWith(t):n},Zt=([e,t=``])=>{let n=Qt([e]);return t?e=>n(e)&&e.endsWith(t):n},Qt=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},$t=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},en=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,tn={win32:{sep:`\\`},posix:{sep:`/`}};z.sep=en===`win32`?tn.win32.sep:tn.posix.sep;var B=Symbol(`globstar **`);z.GLOBSTAR=B;var nn=`[^/]*?`,rn=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,an=`(?:(?!(?:\\/|^)\\.).)*?`;z.filter=(e,t={})=>n=>z(n,e,t);var on=(e,t={})=>Object.assign({},e,t);z.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return z;let t=z;return Object.assign((n,r,i={})=>t(n,r,on(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,on(e,n))}static defaults(n){return t.defaults(on(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,on(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,on(e,r))}},unescape:(n,r={})=>t.unescape(n,on(e,r)),escape:(n,r={})=>t.escape(n,on(e,r)),filter:(n,r={})=>t.filter(n,on(e,r)),defaults:n=>t.defaults(on(e,n)),makeRe:(n,r={})=>t.makeRe(n,on(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,on(e,r)),match:(n,r,i={})=>t.match(n,r,on(e,i)),sep:t.sep,GLOBSTAR:B})};var sn=(e,t={})=>(mt(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ct(e,{max:t.braceExpandMax}));z.braceExpand=sn,z.makeRe=(e,t={})=>new un(e,t).makeRe(),z.match=(e,t,n={})=>{let r=new un(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var cn=/[?*]|[+@!]\(.*?\)|\[|\]/,ln=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),un=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){mt(e),t||={},this.options=t,this.pattern=e,this.platform=t.platform||en,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!cn.test(e[2]))&&!cn.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=this.options;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),r=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),i=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),a=!i&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),o=r?3:n?0:void 0,s=a?3:i?0:void 0;if(typeof o==`number`&&typeof s==`number`){let[n,r]=[e[o],t[s]];n.toLowerCase()===r.toLowerCase()&&(t[s]=n,s>o?t=t.slice(s):o>s&&(e=e.slice(o)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(e=this.levelTwoFileOptimize(e)),this.debug(`matchOne`,this,{file:e,pattern:t}),this.debug(`matchOne`,e.length,t.length);for(var a=0,o=0,s=e.length,c=t.length;a<s&&o<c;a++,o++){this.debug(`matchOne loop`);var l=t[o],u=e[a];if(this.debug(t,l,u),l===!1)return!1;if(l===B){this.debug(`GLOBSTAR`,[t,l,u]);var d=a,f=o+1;if(f===c){for(this.debug(`** at the end`);a<s;a++)if(e[a]===`.`||e[a]===`..`||!r.dot&&e[a].charAt(0)===`.`)return!1;return!0}for(;d<s;){var p=e[d];if(this.debug(`
2
- globstar while`,e,d,t,f,p),this.matchOne(e.slice(d),t.slice(f),n))return this.debug(`globstar found match!`,d,s,p),!0;if(p===`.`||p===`..`||!r.dot&&p.charAt(0)===`.`){this.debug(`dot detected!`,e,d,t,f);break}this.debug(`globstar swallow a segment, and continue`),d++}return!!(n&&(this.debug(`
3
- >>> no match, partial?`,e,d,t,f),d===s))}let i;if(typeof l==`string`?(i=u===l,this.debug(`string match`,l,u,i)):(i=l.test(u),this.debug(`pattern match`,l,u,i)),!i)return!1}if(a===s&&o===c)return!0;if(a===s)return n;if(o===c)return a===s-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return sn(this.pattern,this.options)}parse(e){mt(e);let t=this.options;if(e===`**`)return B;if(e===``)return``;let n,r=null;(n=e.match(Wt))?r=t.dot?Kt:Gt:(n=e.match(Pt))?r=(t.nocase?t.dot?Rt:Lt:t.dot?It:Ft)(n[1]):(n=e.match(qt))?r=(t.nocase?t.dot?Yt:Jt:t.dot?Xt:Zt)(n):(n=e.match(zt))?r=t.dot?Vt:Bt:(n=e.match(Ht))&&(r=Ut);let i=Mt.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?nn:t.dot?rn:an,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?ln(e):e===B?B:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==B||a===B||(a===void 0?i!==void 0&&i!==B?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==B&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=B))});let i=t.filter(e=>e!==B);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return z.defaults(e).Minimatch}};z.AST=Mt,z.Minimatch=un,z.escape=Nt,z.unescape=bt;var dn=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,fn=/* @__PURE__ */ new Set,pn=typeof process==`object`&&process?process:{},mn=(e,t,n,r)=>{typeof pn.emitWarning==`function`?pn.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},hn=globalThis.AbortController,gn=globalThis.AbortSignal;if(typeof hn>`u`){gn=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},hn=class{constructor(){t()}signal=new gn;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e=pn.env?.LRU_CACHE_IGNORE_AC_WARNING!==`1`,t=()=>{e&&(e=!1,mn("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.",`NO_ABORT_CONTROLLER`,`ENOTSUP`,t))}}var _n=e=>!fn.has(e),vn=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),yn=e=>vn(e)?e<=256?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?bn:null:null,bn=class extends Array{constructor(e){super(e),this.fill(0)}},xn=class e{heap;length;static#e=!1;static create(t){let n=yn(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Sn=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#V(t),backgroundFetch:(t,n,r,i)=>e.#B(t,n,r,i),moveToTail:t=>e.#U(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:ee,allowStaleOnFetchAbort:te,ignoreFetchAbort:x,perf:S}=t;if(S!==void 0&&typeof S?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=S??dn,n!==0&&!vn(n))throw TypeError(`max option must be a nonnegative integer`);let C=n?yn(n):Array;if(!C)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=/* @__PURE__ */ new Map,this.#d=Array(n).fill(void 0),this.#f=Array(n).fill(void 0),this.#p=new C(n),this.#m=new C(n),this.#h=0,this.#g=0,this.#_=xn.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!ee,this.allowStaleOnFetchAbort=!!te,this.ignoreFetchAbort=!!x,this.maxEntrySize!==0){if(this.#t!==0&&!vn(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!vn(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=vn(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!vn(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;_n(t)&&(fn.add(t),mn(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new bn(this.#e),t=new bn(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array(this.#e):void 0;this.#S=n,this.#A=(r,i,a=this.#s.now())=>{if(t[r]=i===0?0:a,e[r]=i,n?.[r]&&(clearTimeout(n[r]),n[r]=void 0),i!==0&&n){let e=setTimeout(()=>{this.#j(r)&&this.#W(this.#d[r],`expire`)},i+1);e.unref&&e.unref(),n[r]=e}},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now()},this.#k=(n,a)=>{if(e[a]){let o=e[a],s=t[a];if(!o||!s)return;n.ttl=o,n.start=s,n.now=r||i(),n.remainingTTL=o-(n.now-s)}};let r=0,i=()=>{let e=this.#s.now();if(this.ttlResolution>0){r=e;let t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let a=this.#u.get(n);if(a===void 0)return 0;let o=e[a],s=t[a];return!o||!s?1/0:o-((r||i())-s)},this.#j=n=>{let a=t[n],o=e[n];return!!o&&!!a&&(r||i())-a>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new bn(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(this.#V(t))return 0;if(!vn(n)){if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!vn(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#z(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#h));)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#g));)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.get(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#W(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#V(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#V(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#F(e,t,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return s&&(s.set=`miss`,s.maxEntrySizeExceeded=!0),this.#W(e,`set`),this;let u=this.#c===0?void 0:this.#u.get(e);if(u===void 0)u=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#z(!1):this.#c:this.#_.pop(),this.#d[u]=e,this.#f[u]=t,this.#u.set(e,u),this.#p[this.#g]=u,this.#m[u]=this.#g,this.#g=u,this.#c++,this.#P(u,l,s),s&&(s.set=`add`),c=!1,this.#E&&this.#r?.(t,e,`add`);else{this.#U(u);let n=this.#f[u];if(t!==n){if(this.#w&&this.#V(n)){n.__abortController.abort(/* @__PURE__ */ Error(`replaced`));let{__staleWhileFetching:t}=n;t!==void 0&&!a&&(this.#C&&this.#n?.(t,e,`set`),this.#T&&this.#v?.push([t,e,`set`]))}else a||(this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]));if(this.#N(u),this.#P(u,l,s),this.#f[u]=t,s){s.set=`replace`;let e=n&&this.#V(n)?n.__staleWhileFetching:n;e!==void 0&&(s.oldValue=e)}}else s&&(s.set=`update`);this.#E&&this.onInsert?.(t,e,t===n?`update`:`replace`)}if(r!==0&&!this.#x&&this.#D(),this.#x&&(c||this.#A(u,r,i),s&&this.#k(s,u)),!a&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#z(!0),this.#V(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#z(e){let t=this.#h,n=this.#d[t],r=this.#f[t];return this.#w&&this.#V(r)?r.__abortController.abort(/* @__PURE__ */ Error(`evicted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(r,n,`evict`),this.#T&&this.#v?.push([r,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#V(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#u.get(e);if(r===void 0||!n&&this.#j(r))return;let i=this.#f[r];return this.#V(i)?i.__staleWhileFetching:i}#B(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#V(i))return i;let a=new hn,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||c&&i&&p===void 0)&&(r===void 0?d.__staleWhileFetching===void 0?this.#W(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,s.options))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#W(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);o&&o instanceof Promise&&o.then(e=>t(e===void 0?void 0:e),r),a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.set(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#V(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof hn}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(!this.#w)return g&&(g.fetch=`get`),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#B(e,y,v,m);return t.__returned=t}{let t=this.#f[y];if(this.#V(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#U(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#B(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,forceRefresh:i,...a}=t,o=this.get(e,a);if(!i&&o!==void 0)return o;let s=n(e,o,{options:a,context:r});return this.set(e,s,a),s}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o!==void 0){let t=this.#f[o],s=this.#V(t);return a&&this.#k(a,o),this.#j(o)?(a&&(a.get=`stale`),s?(a&&n&&t.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#W(e,`expire`),a&&n&&(a.returnedStale=!0),n?t:void 0)):(a&&(a.get=`hit`),s?t.__staleWhileFetching:(this.#U(o),r&&this.#O(o),t))}a&&(a.get=`miss`)}#H(e,t){this.#m[t]=e,this.#p[e]=t}#U(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#H(this.#m[e],this.#p[e]),this.#H(this.#g,e),this.#g=e)}delete(e){return this.#W(e,`delete`)}#W(e,t){let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0){if(this.#S?.[r]&&(clearTimeout(this.#S?.[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#G(t);else{this.#N(r);let n=this.#f[r];if(this.#V(n)?n.__abortController.abort(/* @__PURE__ */ Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#G(`delete`)}#G(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#V(n))n.__abortController.abort(/* @__PURE__ */ Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},Cn=typeof process==`object`&&process?process:{stdout:null,stderr:null},wn=e=>!!e&&typeof e==`object`&&(e instanceof sr||e instanceof je||Tn(e)||En(e)),Tn=e=>!!e&&typeof e==`object`&&e instanceof Ae&&typeof e.pipe==`function`&&e.pipe!==je.Writable.prototype.pipe,En=e=>!!e&&typeof e==`object`&&e instanceof Ae&&typeof e.write==`function`&&typeof e.end==`function`,Dn=Symbol(`EOF`),On=Symbol(`maybeEmitEnd`),kn=Symbol(`emittedEnd`),An=Symbol(`emittingEnd`),jn=Symbol(`emittedError`),Mn=Symbol(`closed`),Nn=Symbol(`read`),Pn=Symbol(`flush`),Fn=Symbol(`flushChunk`),In=Symbol(`encoding`),Ln=Symbol(`decoder`),V=Symbol(`flowing`),Rn=Symbol(`paused`),zn=Symbol(`resume`),H=Symbol(`buffer`),U=Symbol(`pipes`),W=Symbol(`bufferLength`),Bn=Symbol(`bufferPush`),Vn=Symbol(`bufferShift`),G=Symbol(`objectMode`),K=Symbol(`destroyed`),Hn=Symbol(`error`),Un=Symbol(`emitData`),Wn=Symbol(`emitEnd`),Gn=Symbol(`emitEnd2`),Kn=Symbol(`async`),qn=Symbol(`abort`),Jn=Symbol(`aborted`),Yn=Symbol(`signal`),Xn=Symbol(`dataListeners`),Zn=Symbol(`discarded`),Qn=e=>Promise.resolve().then(e),$n=e=>e(),er=e=>e===`end`||e===`finish`||e===`prefinish`,tr=e=>e instanceof ArrayBuffer||!!e&&typeof e==`object`&&e.constructor&&e.constructor.name===`ArrayBuffer`&&e.byteLength>=0,nr=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),rr=class{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[zn](),this.dest.on(`drain`,this.ondrain)}unpipe(){this.dest.removeListener(`drain`,this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ir=class extends rr{unpipe(){this.src.removeListener(`error`,this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>this.dest.emit(`error`,e),e.on(`error`,this.proxyErrors)}},ar=e=>!!e.objectMode,or=e=>!e.objectMode&&!!e.encoding&&e.encoding!==`buffer`,sr=class extends Ae{[V]=!1;[Rn]=!1;[U]=[];[H]=[];[G];[In];[Kn];[Ln];[Dn]=!1;[kn]=!1;[An]=!1;[Mn]=!1;[jn]=null;[W]=0;[K]=!1;[Yn];[Jn]=!1;[Xn]=0;[Zn]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding==`string`)throw TypeError(`Encoding and objectMode may not be used together`);ar(t)?(this[G]=!0,this[In]=null):or(t)?(this[In]=t.encoding,this[G]=!1):(this[G]=!1,this[In]=null),this[Kn]=!!t.async,this[Ln]=this[In]?new Me(this[In]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[H]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[U]});let{signal:n}=t;n&&(this[Yn]=n,n.aborted?this[qn]():n.addEventListener(`abort`,()=>this[qn]()))}get bufferLength(){return this[W]}get encoding(){return this[In]}set encoding(e){throw Error(`Encoding must be set at instantiation time`)}setEncoding(e){throw Error(`Encoding must be set at instantiation time`)}get objectMode(){return this[G]}set objectMode(e){throw Error(`objectMode must be set at instantiation time`)}get async(){return this[Kn]}set async(e){this[Kn]=this[Kn]||!!e}[qn](){this[Jn]=!0,this.emit(`abort`,this[Yn]?.reason),this.destroy(this[Yn]?.reason)}get aborted(){return this[Jn]}set aborted(e){}write(e,t,n){if(this[Jn])return!1;if(this[Dn])throw Error(`write after end`);if(this[K])return this.emit(`error`,Object.assign(/* @__PURE__ */ Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`})),!0;typeof t==`function`&&(n=t,t=`utf8`),t||=`utf8`;let r=this[Kn]?Qn:$n;if(!this[G]&&!Buffer.isBuffer(e)){if(nr(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(tr(e))e=Buffer.from(e);else if(typeof e!=`string`)throw Error(`Non-contiguous data written to non-objectMode stream`)}return this[G]?(this[V]&&this[W]!==0&&this[Pn](!0),this[V]?this.emit(`data`,e):this[Bn](e),this[W]!==0&&this.emit(`readable`),n&&r(n),this[V]):e.length?(typeof e==`string`&&(t!==this[In]||this[Ln]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[In]&&(e=this[Ln].write(e)),this[V]&&this[W]!==0&&this[Pn](!0),this[V]?this.emit(`data`,e):this[Bn](e),this[W]!==0&&this.emit(`readable`),n&&r(n),this[V]):(this[W]!==0&&this.emit(`readable`),n&&r(n),this[V])}read(e){if(this[K])return null;if(this[Zn]=!1,this[W]===0||e===0||e&&e>this[W])return this[On](),null;this[G]&&(e=null),this[H].length>1&&!this[G]&&(this[H]=[this[In]?this[H].join(``):Buffer.concat(this[H],this[W])]);let t=this[Nn](e||null,this[H][0]);return this[On](),t}[Nn](e,t){if(this[G])this[Vn]();else{let n=t;e===n.length||e===null?this[Vn]():typeof n==`string`?(this[H][0]=n.slice(e),t=n.slice(0,e),this[W]-=e):(this[H][0]=n.subarray(e),t=n.subarray(0,e),this[W]-=e)}return this.emit(`data`,t),!this[H].length&&!this[Dn]&&this.emit(`drain`),t}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=`utf8`),e!==void 0&&this.write(e,t),n&&this.once(`end`,n),this[Dn]=!0,this.writable=!1,(this[V]||!this[Rn])&&this[On](),this}[zn](){this[K]||(!this[Xn]&&!this[U].length&&(this[Zn]=!0),this[Rn]=!1,this[V]=!0,this.emit(`resume`),this[H].length?this[Pn]():this[Dn]?this[On]():this.emit(`drain`))}resume(){return this[zn]()}pause(){this[V]=!1,this[Rn]=!0,this[Zn]=!1}get destroyed(){return this[K]}get flowing(){return this[V]}get paused(){return this[Rn]}[Bn](e){this[G]?this[W]+=1:this[W]+=e.length,this[H].push(e)}[Vn](){return this[G]?--this[W]:this[W]-=this[H][0].length,this[H].shift()}[Pn](e=!1){do;while(this[Fn](this[Vn]())&&this[H].length);!e&&!this[H].length&&!this[Dn]&&this.emit(`drain`)}[Fn](e){return this.emit(`data`,e),this[V]}pipe(e,t){if(this[K])return e;this[Zn]=!1;let n=this[kn];return t||={},e===Cn.stdout||e===Cn.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[U].push(t.proxyErrors?new ir(this,e,t):new rr(this,e,t)),this[Kn]?Qn(()=>this[zn]()):this[zn]()),e}unpipe(e){let t=this[U].find(t=>t.dest===e);t&&(this[U].length===1?(this[V]&&this[Xn]===0&&(this[V]=!1),this[U]=[]):this[U].splice(this[U].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e===`data`)this[Zn]=!1,this[Xn]++,!this[U].length&&!this[V]&&this[zn]();else if(e===`readable`&&this[W]!==0)super.emit(`readable`);else if(er(e)&&this[kn])super.emit(e),this.removeAllListeners(e);else if(e===`error`&&this[jn]){let e=t;this[Kn]?Qn(()=>e.call(this,this[jn])):e.call(this,this[jn])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e===`data`&&(this[Xn]=this.listeners(`data`).length,this[Xn]===0&&!this[Zn]&&!this[U].length&&(this[V]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e===`data`||e===void 0)&&(this[Xn]=0,!this[Zn]&&!this[U].length&&(this[V]=!1)),t}get emittedEnd(){return this[kn]}[On](){!this[An]&&!this[kn]&&!this[K]&&this[H].length===0&&this[Dn]&&(this[An]=!0,this.emit(`end`),this.emit(`prefinish`),this.emit(`finish`),this[Mn]&&this.emit(`close`),this[An]=!1)}emit(e,...t){let n=t[0];if(e!==`error`&&e!==`close`&&e!==K&&this[K])return!1;if(e===`data`)return!this[G]&&!n?!1:this[Kn]?(Qn(()=>this[Un](n)),!0):this[Un](n);if(e===`end`)return this[Wn]();if(e===`close`){if(this[Mn]=!0,!this[kn]&&!this[K])return!1;let e=super.emit(`close`);return this.removeAllListeners(`close`),e}if(e===`error`){this[jn]=n,super.emit(Hn,n);let e=!this[Yn]||this.listeners(`error`).length?super.emit(`error`,n):!1;return this[On](),e}if(e===`resume`){let e=super.emit(`resume`);return this[On](),e}if(e===`finish`||e===`prefinish`){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[On](),r}[Un](e){for(let t of this[U])t.dest.write(e)===!1&&this.pause();let t=!this[Zn]&&super.emit(`data`,e);return this[On](),t}[Wn](){return!this[kn]&&(this[kn]=!0,this.readable=!1,this[Kn]?(Qn(()=>this[Gn]()),!0):this[Gn]())}[Gn](){if(this[Ln]){let e=this[Ln].end();if(e){for(let t of this[U])t.dest.write(e);this[Zn]||super.emit(`data`,e)}}for(let e of this[U])e.end();let e=super.emit(`end`);return this.removeAllListeners(`end`),e}async collect(){let e=Object.assign([],{dataLength:0});this[G]||(e.dataLength=0);let t=this.promise();return this.on(`data`,t=>{e.push(t),this[G]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[G])throw Error(`cannot concat in objectMode`);let e=await this.collect();return this[In]?e.join(``):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(K,()=>t(/* @__PURE__ */ Error(`stream destroyed`))),this.on(`error`,e=>t(e)),this.on(`end`,()=>e())})}[Symbol.asyncIterator](){this[Zn]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[Dn])return t();let r,i,a=e=>{this.off(`data`,o),this.off(`end`,s),this.off(K,c),t(),i(e)},o=e=>{this.off(`error`,a),this.off(`end`,s),this.off(K,c),this.pause(),r({value:e,done:!!this[Dn]})},s=()=>{this.off(`error`,a),this.off(`data`,o),this.off(K,c),t(),r({done:!0,value:void 0})},c=()=>a(/* @__PURE__ */ Error(`stream destroyed`));return new Promise((e,t)=>{i=t,r=e,this.once(K,c),this.once(`error`,a),this.once(`end`,s),this.once(`data`,o)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[Zn]=!1;let e=!1,t=()=>(this.pause(),this.off(Hn,t),this.off(K,t),this.off(`end`,t),e=!0,{done:!0,value:void 0});return this.once(`end`,t),this.once(Hn,t),this.once(K,t),{next:()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[K])return e?this.emit(`error`,e):this.emit(K),this;this[K]=!0,this[Zn]=!0,this[H].length=0,this[W]=0;let t=this;return typeof t.close==`function`&&!this[Mn]&&t.close(),e?this.emit(`error`,e):this.emit(K),this}static get isStream(){return wn}},cr=we.native,lr={lstatSync:ye,readdir:xe,readdirSync:Se,readlinkSync:Ce,realpathSync:cr,promises:{lstat:fe,readdir:pe,readlink:me,realpath:he}},ur=e=>!e||e===lr||e===E?lr:{...lr,...e,promises:{...lr.promises,...e.promises||{}}},dr=/^\\\\\?\\([a-z]:)\\?$/i,fr=e=>e.replace(/\//g,`\\`).replace(dr,`$1\\`),pr=/[\\\/]/,mr=0,hr=1,gr=2,_r=4,vr=6,yr=8,br=10,xr=12,Sr=15,Cr=~Sr,wr=16,Tr=32,Er=64,Dr=128,Or=256,kr=512,Ar=Er|Dr|kr,jr=1023,Mr=e=>e.isFile()?yr:e.isDirectory()?_r:e.isSymbolicLink()?br:e.isCharacterDevice()?gr:e.isBlockDevice()?vr:e.isSocket()?xr:e.isFIFO()?hr:mr,Nr=new Sn({max:4096}),Pr=e=>{let t=Nr.get(e);if(t)return t;let n=e.normalize(`NFKD`);return Nr.set(e,n),n},Fr=new Sn({max:4096}),Ir=e=>{let t=Fr.get(e);if(t)return t;let n=Pr(e.toLowerCase());return Fr.set(e,n),n},Lr=class extends Sn{constructor(){super({max:256})}},Rr=class extends Sn{constructor(e=16384){super({maxSize:e,sizeCalculation:e=>e.length+1})}},zr=Symbol(`PathScurry setAsCwd`),q=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#o;get rdev(){return this.#o}#s;get blksize(){return this.#s}#c;get ino(){return this.#c}#l;get size(){return this.#l}#u;get blocks(){return this.#u}#d;get atimeMs(){return this.#d}#f;get mtimeMs(){return this.#f}#p;get ctimeMs(){return this.#p}#m;get birthtimeMs(){return this.#m}#h;get atime(){return this.#h}#g;get mtime(){return this.#g}#_;get ctime(){return this.#_}#v;get birthtime(){return this.#v}#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=mr,n,r,i,a,o){this.name=e,this.#y=i?Ir(e):Pr(e),this.#T=t&jr,this.nocase=i,this.roots=r,this.root=n||this,this.#E=a,this.#x=o.fullpath,this.#C=o.relative,this.#w=o.relativePosix,this.parent=o.parent,this.#e=this.parent?this.parent.#e:ur(o.fs)}depth(){return this.#b===void 0?this.#b=this.parent?this.parent.depth()+1:0:this.#b}childrenCache(){return this.#E}resolve(e){if(!e)return this;let t=this.getRootString(e),n=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#k(n):this.#k(n)}#k(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#E.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#E.set(this,t),this.#T&=~wr,t}child(e,t){if(e===``||e===`.`)return this;if(e===`..`)return this.parent||this;let n=this.children(),r=this.nocase?Ir(e):Pr(e);for(let e of n)if(e.#y===r)return e;let i=this.parent?this.sep:``,a=this.#x?this.#x+i+e:void 0,o=this.newChild(e,mr,{...t,parent:this,fullpath:a});return this.canReaddir()||(o.#T|=Dr),n.push(o),o}relative(){if(this.isCWD)return``;if(this.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.name;let n=t.relative();return n+(!n||!t.parent?``:this.sep)+e}relativePosix(){if(this.sep===`/`)return this.relative();if(this.isCWD)return``;if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?``:`/`)+e}fullpath(){if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.name;let n=t.fullpath()+(t.parent?this.sep:``)+e;return this.#x=n}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep===`/`)return this.#S=this.fullpath();if(!this.parent){let e=this.fullpath().replace(/\\/g,`/`);return this.#S=/^[a-z]:\//i.test(e)?`//?/${e}`:e}let e=this.parent,t=e.fullpathPosix(),n=t+(!t||!e.parent?``:`/`)+this.name;return this.#S=n}isUnknown(){return(this.#T&Sr)===mr}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?`Unknown`:this.isDirectory()?`Directory`:this.isFile()?`File`:this.isSymbolicLink()?`SymbolicLink`:this.isFIFO()?`FIFO`:this.isCharacterDevice()?`CharacterDevice`:this.isBlockDevice()?`BlockDevice`:this.isSocket()?`Socket`:`Unknown`}isFile(){return(this.#T&Sr)===yr}isDirectory(){return(this.#T&Sr)===_r}isCharacterDevice(){return(this.#T&Sr)===gr}isBlockDevice(){return(this.#T&Sr)===vr}isFIFO(){return(this.#T&Sr)===hr}isSocket(){return(this.#T&Sr)===xr}isSymbolicLink(){return(this.#T&br)===br}lstatCached(){return this.#T&Tr?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let e=this.#T&Sr;return!(e!==mr&&e!==br||this.#T&Or||this.#T&Dr)}calledReaddir(){return!!(this.#T&wr)}isENOENT(){return!!(this.#T&Dr)}isNamed(e){return this.nocase?this.#y===Ir(e):this.#y===Pr(e)}async readlink(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=await this.#e.promises.readlink(this.fullpath()),t=(await this.parent.realpath())?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}readlinkSync(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=this.#e.readlinkSync(this.fullpath()),t=this.parent.realpathSync()?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}#A(e){this.#T|=wr;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#j()}}#j(){this.#T&Dr||(this.#T=(this.#T|Dr)&Cr,this.#M())}#M(){let e=this.children();e.provisional=0;for(let t of e)t.#j()}#N(){this.#T|=kr,this.#P()}#P(){if(this.#T&Er)return;let e=this.#T;(e&Sr)===_r&&(e&=Cr),this.#T=e|Er,this.#M()}#F(e=``){e===`ENOTDIR`||e===`EPERM`?this.#P():e===`ENOENT`?this.#j():this.children().provisional=0}#I(e=``){e===`ENOTDIR`?this.parent.#P():e===`ENOENT`&&this.#j()}#L(e=``){let t=this.#T;t|=Or,e===`ENOENT`&&(t|=Dr),(e===`EINVAL`||e===`UNKNOWN`)&&(t&=Cr),this.#T=t,e===`ENOTDIR`&&this.parent&&this.parent.#P()}#R(e,t){return this.#B(e,t)||this.#z(e,t)}#z(e,t){let n=Mr(e),r=this.newChild(e.name,n,{parent:this}),i=r.#T&Sr;return i!==_r&&i!==br&&i!==mr&&(r.#T|=Er),t.unshift(r),t.provisional++,r}#B(e,t){for(let n=t.provisional;n<t.length;n++){let r=t[n];if((this.nocase?Ir(e.name):Pr(e.name))===r.#y)return this.#V(e,r,n,t)}}#V(e,t,n,r){let i=t.name;return t.#T=t.#T&Cr|Mr(e),i!==e.name&&(t.name=e.name),n!==r.provisional&&(n===r.length-1?r.pop():r.splice(n,1),r.unshift(t)),r.provisional++,t}async lstat(){if((this.#T&Dr)===0)try{return this.#H(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#I(e.code)}}lstatSync(){if((this.#T&Dr)===0)try{return this.#H(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#I(e.code)}}#H(e){let{atime:t,atimeMs:n,birthtime:r,birthtimeMs:i,blksize:a,blocks:o,ctime:s,ctimeMs:c,dev:l,gid:u,ino:d,mode:f,mtime:p,mtimeMs:m,nlink:h,rdev:g,size:_,uid:v}=e;this.#h=t,this.#d=n,this.#v=r,this.#m=i,this.#s=a,this.#u=o,this.#_=s,this.#p=c,this.#t=l,this.#a=u,this.#c=d,this.#n=f,this.#g=p,this.#f=m,this.#r=h,this.#o=g,this.#l=_,this.#i=v;let y=Mr(e);this.#T=this.#T&Cr|y|Tr,y!==mr&&y!==_r&&y!==br&&(this.#T|=Er)}#U=[];#W=!1;#G(e){this.#W=!1;let t=this.#U.slice();this.#U.length=0,t.forEach(t=>t(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#U.push(e),this.#W)return;this.#W=!0;let r=this.fullpath();this.#e.readdir(r,{withFileTypes:!0},(e,t)=>{if(e)this.#F(e.code),n.provisional=0;else{for(let e of t)this.#R(e,n);this.#A(n)}this.#G(n.slice(0,n.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#K)await this.#K;else{let n=()=>{};this.#K=new Promise(e=>n=e);try{for(let n of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}this.#K=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#e.readdirSync(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#T&Ar)return!1;let e=Sr&this.#T;return e===mr||e===_r||e===br}shouldWalk(e,t){return(this.#T&_r)===_r&&!(this.#T&Ar)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((kr|Or|Dr)&this.#T))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#O)return this.#O;if(!((kr|Or|Dr)&this.#T))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}[zr](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=/* @__PURE__ */ new Set([]),n=[],r=this;for(;r&&r.parent;)t.add(r),r.#C=n.join(this.sep),r.#w=n.join(`/`),r=r.parent,n.push(`..`);for(r=e;r&&r.parent&&!t.has(r);)r.#C=void 0,r.#w=void 0,r=r.parent}},Br=class e extends q{sep=`\\`;splitSep=pr;constructor(e,t=mr,n,r,i,a,o){super(e,t,n,r,i,a,o)}newChild(t,n=mr,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return ce.parse(e).root}getRoot(e){if(e=fr(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new Ur(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,`\\`).replace(dr,`$1\\`),e===t}},Vr=class e extends q{splitSep=`/`;sep=`/`;constructor(e,t=mr,n,r,i,a,o){super(e,t,n,r,i,a,o)}getRootString(e){return e.startsWith(`/`)?`/`:``}getRoot(e){return this.root}newChild(t,n=mr,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Hr=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),t,n,{nocase:r,childrenCacheSize:i=16384,fs:a=lr}={}){this.#r=ur(a),(e instanceof URL||e.startsWith(`file://`))&&(e=k(e));let o=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#e=new Lr,this.#t=new Lr,this.#n=new Rr(i);let s=o.substring(this.rootPath.length).split(n);if(s.length===1&&!s[0]&&s.pop(),r===void 0)throw TypeError(`must provide nocase setting to PathScurryBase ctor`);this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=s.length-1,u=t.sep,d=this.rootPath,f=!1;for(let e of s){let t=l--;c=c.child(e,{relative:Array(t).fill(`..`).join(u),relativePosix:Array(t).fill(`..`).join(`/`),fullpath:d+=(f?``:u)+e}),f=!0}this.cwd=c}depth(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r&&r!==`.`&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#e.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpath();return this.#e.set(t,r),r}resolvePosix(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r&&r!==`.`&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#t.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpathPosix();return this.#t.set(t,r),r}relative(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let t=await e.readdir();return n?t:t.map(e=>e.name)}return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(e=>e.name):[]}async lstat(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=/* @__PURE__ */ new Set,c=(e,t)=>{s.add(e),e.readdirCB((e,l)=>{if(e)return t(e);let u=l.length;if(!u)return t();let d=()=>{--u===0&&t()};for(let e of l)(!i||i(e))&&o.push(n?e:e.fullpath()),r&&e.isSymbolicLink()?e.realpath().then(e=>e?.isUnknown()?e.lstat():e).then(e=>e?.shouldWalk(s,a)?c(e,d):d()):e.shouldWalk(s,a)?c(e,d):d()},!0)},l=e;return new Promise((e,t)=>{c(l,n=>{if(n)return t(n);e(o)})})}walkSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=/* @__PURE__ */ new Set([e]);for(let e of s){let t=e.readdirSync();for(let e of t){(!i||i(e))&&o.push(n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&s.add(t)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t;(!i||i(e))&&(yield n?e:e.fullpath());let o=/* @__PURE__ */ new Set([e]);for(let e of o){let t=e.readdirSync();for(let e of t){(!i||i(e))&&(yield n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,a)&&o.add(t)}}}stream(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new sr({objectMode:!0});(!i||i(e))&&o.write(n?e:e.fullpath());let s=/* @__PURE__ */ new Set,c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let d=(t,p,m=!1)=>{if(t)return o.emit(`error`,t);if(r&&!m){let e=[];for(let t of p)t.isSymbolicLink()&&e.push(t.realpath().then(e=>e?.isUnknown()?e.lstat():e));if(e.length){Promise.all(e).then(()=>d(null,p,!0));return}}for(let t of p)t&&(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of p){let t=e.realpathCached()||e;t.shouldWalk(s,a)&&c.push(t)}e&&!o.flowing?o.once(`drain`,u):f||u()},f=!0;t.readdirCB(d,!0),f=!1}};return u(),o}streamSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new sr({objectMode:!0}),s=/* @__PURE__ */ new Set;(!i||i(e))&&o.write(n?e:e.fullpath());let c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let u=t.readdirSync();for(let t of u)(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of u){let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&c.push(t)}}e&&!o.flowing&&o.once(`drain`,u)};return u(),o}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e==`string`?this.cwd.resolve(e):e,this.cwd[zr](t)}},Ur=class extends Hr{sep=`\\`;constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,ce,`\\`,{...t,nocase:n}),this.nocase=n;for(let e=this.cwd;e;e=e.parent)e.nocase=this.nocase}parseRootPath(e){return ce.parse(e).root.toUpperCase()}newRoot(e){return new Br(this.rootPath,_r,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)||e.startsWith(`\\`)||/^[a-z]:(\/|\\)/i.test(e)}},Wr=class extends Hr{sep=`/`;constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,ae,`/`,{...t,nocase:n}),this.nocase=n}parseRootPath(e){return`/`}newRoot(e){return new Vr(this.rootPath,_r,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)}},Gr=class extends Wr{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}};process.platform;var Kr=process.platform===`win32`?Ur:process.platform===`darwin`?Gr:Wr,qr=e=>e.length>=1,Jr=e=>e.length>=1,Yr=Symbol.for(`nodejs.util.inspect.custom`),Xr=class e{#e;#t;#n;length;#r;#i;#a;#o;#s;#c;#l=!0;constructor(e,t,n,r){if(!qr(e))throw TypeError(`empty pattern list`);if(!Jr(t))throw TypeError(`empty glob list`);if(t.length!==e.length)throw TypeError(`mismatched pattern list and glob list lengths`);if(this.length=e.length,n<0||n>=this.length)throw TypeError(`index out of range`);if(this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#n===0){if(this.isUNC()){let[e,t,n,r,...i]=this.#e,[a,o,s,c,...l]=this.#t;i[0]===``&&(i.shift(),l.shift());let u=[e,t,n,r,``].join(`/`),d=[a,o,s,c,``].join(`/`);this.#e=[u,...i],this.#t=[d,...l],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[e,...t]=this.#e,[n,...r]=this.#t;t[0]===``&&(t.shift(),r.shift());let i=e+`/`,a=n+`/`;this.#e=[i,...t],this.#t=[a,...r],this.length=this.#e.length}}}[Yr](){return`Pattern <`+this.#t.slice(this.#n).join(`/`)+`>`}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]==`string`}isGlobstar(){return this.#e[this.#n]===B}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join(`/`):this.#t.join(`/`):this.#t.slice(this.#n).join(`/`))}hasMore(){return this.length>this.#n+1}rest(){return this.#i===void 0?this.hasMore()?(this.#i=new e(this.#e,this.#t,this.#n+1,this.#r),this.#i.#c=this.#c,this.#i.#s=this.#s,this.#i.#o=this.#o,this.#i):this.#i=null:this.#i}isUNC(){let e=this.#e;return this.#s===void 0?this.#s=this.#r===`win32`&&this.#n===0&&e[0]===``&&e[1]===``&&typeof e[2]==`string`&&!!e[2]&&typeof e[3]==`string`&&!!e[3]:this.#s}isDrive(){let e=this.#e;return this.#o===void 0?this.#o=this.#r===`win32`&&this.#n===0&&this.length>1&&typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]):this.#o}isAbsolute(){let e=this.#e;return this.#c===void 0?this.#c=e[0]===``&&e.length>1||this.isDrive()||this.isUNC():this.#c}root(){let e=this.#e[0];return typeof e==`string`&&this.isAbsolute()&&this.#n===0?e:``}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}},Zr=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,Qr=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:r,noglobstar:i,platform:a=Zr}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:r,noglobstar:i,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let t of e)this.add(t)}add(e){let t=new un(e,this.mmopts);for(let e=0;e<t.set.length;e++){let n=t.set[e],r=t.globParts[e];if(!n||!r)throw Error(`invalid pattern object`);for(;n[0]===`.`&&r[0]===`.`;)n.shift(),r.shift();let i=new Xr(n,r,0,this.platform),a=new un(i.globString(),this.mmopts),o=r[r.length-1]===`**`,s=i.isAbsolute();s?this.absolute.push(a):this.relative.push(a),o&&(s?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let t=e.fullpath(),n=`${t}/`,r=e.relative()||`.`,i=`${r}/`;for(let e of this.relative)if(e.match(r)||e.match(i))return!0;for(let e of this.absolute)if(e.match(t)||e.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+`/`,n=(e.relative()||`.`)+`/`;for(let e of this.relativeChildren)if(e.match(n))return!0;for(let e of this.absoluteChildren)if(e.match(t))return!0;return!1}},$r=class e{store;constructor(e=/* @__PURE__ */ new Map){this.store=e}copy(){return new e(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),r=this.store.get(n);r?r.add(t.globString()):this.store.set(n,/* @__PURE__ */ new Set([t.globString()]))}},ei=class{store=/* @__PURE__ */ new Map;add(e,t,n){let r=(t?2:0)|!!n,i=this.store.get(e);this.store.set(e,i===void 0?r:r&i)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},ti=class{store=/* @__PURE__ */ new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(e=>e.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw Error(`attempting to walk unknown path`);return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},ni=class e{hasWalkedCache;matches=new ei;subwalks=new ti;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new $r}processPatterns(e,t){this.patterns=t;let n=t.map(t=>[e,t]);for(let[e,t]of n){this.hasWalkedCache.storeWalked(e,t);let n=t.root(),r=t.isAbsolute()&&this.opts.absolute!==!1;if(n){e=e.resolve(n===`/`&&this.opts.root!==void 0?this.opts.root:n);let r=t.rest();if(r)t=r;else{this.matches.add(e,!0,!1);continue}}if(e.isENOENT())continue;let i,a,o=!1;for(;typeof(i=t.pattern())==`string`&&(a=t.rest());)e=e.resolve(i),t=a,o=!0;if(i=t.pattern(),a=t.rest(),o){if(this.hasWalkedCache.hasWalked(e,t))continue;this.hasWalkedCache.storeWalked(e,t)}if(typeof i==`string`){let t=i===`..`||i===``||i===`.`;this.matches.add(e.resolve(i),r,t)}else if(i===B){(!e.isSymbolicLink()||this.follow||t.checkFollowGlobstar())&&this.subwalks.add(e,t);let n=a?.pattern(),i=a?.rest();if(!a||(n===``||n===`.`)&&!i)this.matches.add(e,r,n===``||n===`.`);else if(n===`..`){let t=e.parent||e;i?this.hasWalkedCache.hasWalked(t,i)||this.subwalks.add(t,i):this.matches.add(t,r,!0)}}else i instanceof RegExp&&this.subwalks.add(e,t)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),r=this.child();for(let e of t)for(let t of n){let n=t.isAbsolute(),i=t.pattern(),a=t.rest();i===B?r.testGlobstar(e,t,a,n):i instanceof RegExp?r.testRegExp(e,i,a,n):r.testString(e,i,a,n)}return r}testGlobstar(e,t,n,r){if((this.dot||!e.name.startsWith(`.`))&&(t.hasMore()||this.matches.add(e,r,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let t=n.pattern();if(typeof t==`string`&&t!==`..`&&t!==``&&t!==`.`)this.testString(e,t,n.rest(),r);else if(t===`..`){let t=e.parent||e;this.subwalks.add(t,n)}else t instanceof RegExp&&this.testRegExp(e,t,n.rest(),r)}}testRegExp(e,t,n,r){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}testString(e,t,n,r){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}},ri=(e,t)=>typeof e==`string`?new Qr([e],t):Array.isArray(e)?new Qr(e,t):e,ii=class{path;patterns;opts;seen=/* @__PURE__ */ new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform===`win32`?`\\`:`/`,this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#t=ri(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.add!=`function`))throw Error(`cannot ignore child matches, ignore lacks add() method.`);this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener(`abort`,()=>{this.#e.length=0}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#i(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=await r.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=r.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let t=`${e.relativePosix()}/**`;this.#t.add(t)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let r=this.opts.mark&&e.isDirectory()?this.#n:``;if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+r)}else{let t=this.opts.posix?e.relativePosix():e.relative(),n=this.opts.dotRelative&&!t.startsWith(`..`+this.#n)?`.`+this.#n:``;this.matchEmit(t?n+t+r:`.`+r)}}async match(e,t,n){let r=await this.matchCheck(e,n);r&&this.matchFinish(r,t)}matchSync(e,t,n){let r=this.matchCheckSync(e,n);r&&this.matchFinish(r,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new ni(this.opts),n)}walkCB2(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,n,a):e.readdirCB((t,r)=>this.walkCB3(e,r,n,a),!0)}a()}walkCB3(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let[e,t]of n.subwalks.entries())i++,this.walkCB2(e,t,n.child(),a);a()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new ni(this.opts),n)}walkCB2Sync(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirSync();this.walkCB3Sync(e,t,n,a)}a()}walkCB3Sync(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let[e,t]of n.subwalks.entries())i++,this.walkCB2Sync(e,t,n.child(),a);a()}},ai=class extends ii{matches=/* @__PURE__ */ new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},oi=class extends ii{results;constructor(e,t,n){super(e,t,n),this.results=new sr({signal:this.signal,objectMode:!0}),this.results.on(`drain`,()=>this.resume()),this.results.on(`resume`,()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},si=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,ci=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw TypeError(`glob options required`);if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith(`file://`))&&(t.cwd=k(t.cwd)):this.cwd=``,this.cwd=t.cwd||``,this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error(`cannot set absolute and withFileTypes:true`);if(typeof e==`string`&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(e=>e.replace(/\\/g,`/`))),this.matchBase){if(t.noglobstar)throw TypeError(`base matching requires globstar`);e=e.map(e=>e.includes(`/`)?e:`./**/${e}`)}if(this.pattern=e,this.platform=t.platform||si,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw Error(`nocase option contradicts provided scurry option`)}else{let e=t.platform===`win32`?Ur:t.platform===`darwin`?Gr:t.platform?Wr:Kr;this.scurry=new e(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n=this.platform===`darwin`||this.platform===`win32`,r={braceExpandMax:1e4,...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[i,a]=this.pattern.map(e=>new un(e,r)).reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=i.map((e,t)=>{let n=a[t];if(!n)throw Error(`invalid pattern object`);return new Xr(e,n,0,this.platform)})}async walk(){return[...await new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},li=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let n of e)if(new un(n,t).hasMagic())return!0;return!1};function ui(e,t={}){return new ci(e,t).streamSync()}function di(e,t={}){return new ci(e,t).stream()}function fi(e,t={}){return new ci(e,t).walkSync()}async function pi(e,t={}){return new ci(e,t).walk()}function mi(e,t={}){return new ci(e,t).iterateSync()}function hi(e,t={}){return new ci(e,t).iterate()}var gi=ui,_i=Object.assign(di,{sync:ui}),vi=mi,yi=Object.assign(hi,{sync:mi}),bi=Object.assign(fi,{stream:ui,iterate:mi}),xi=Object.assign(pi,{glob:pi,globSync:fi,sync:bi,globStream:di,stream:_i,globStreamSync:ui,streamSync:gi,globIterate:hi,iterate:yi,globIterateSync:mi,iterateSync:vi,Glob:ci,hasMagic:li,escape:Nt,unescape:bt});xi.glob=xi;const Si=(e,t)=>e===void 0||typeof e===t,Ci=e=>!!e&&typeof e==`object`&&Si(e.preserveRoot,`boolean`)&&Si(e.tmp,`string`)&&Si(e.maxRetries,`number`)&&Si(e.retryDelay,`number`)&&Si(e.backoff,`number`)&&Si(e.maxBackoff,`number`)&&(Si(e.glob,`boolean`)||e.glob&&typeof e.glob==`object`)&&Si(e.filter,`function`),wi=e=>{if(!Ci(e))throw Error(`invalid rimraf options`)},Ti=e=>{wi(e);let{glob:t,...n}=e;if(!t)return n;let r=t===!0?e.signal?{signal:e.signal}:{}:e.signal?{signal:e.signal,...t}:t;return{...n,glob:{...r,absolute:!0,withFileTypes:!1}}},Ei=(e={})=>Ti(e),Di=(e={})=>Ti(e),Oi=(e,t={})=>{let n=typeof e;if(n!==`string`){let t=e&&n===`object`&&e.constructor,r=`The "path" argument must be of type string. Received ${t&&t.name?`an instance of ${t.name}`:n===`object`?Fe(e):`type ${n} ${e}`}`;throw Object.assign(TypeError(r),{path:e,code:`ERR_INVALID_ARG_TYPE`})}if(/\0/.test(e))throw Object.assign(/* @__PURE__ */ TypeError(`path must be a string without null bytes`),{path:e,code:`ERR_INVALID_ARG_VALUE`});e=Pe(e);let{root:r}=L(e);if(e===r&&t.preserveRoot!==!1)throw Object.assign(/* @__PURE__ */ Error(`refusing to remove root directory without preserveRoot:false`),{path:e,code:`ERR_PRESERVE_ROOT`});if(process.platform===`win32`){let t=/[*|"<>?:]/,{root:n}=L(e);if(t.test(e.substring(n.length)))throw Object.assign(/* @__PURE__ */ Error(`Illegal characters in path.`),{path:e,code:`EINVAL`})}return e},ki=e=>Se(e,{withFileTypes:!0}),Ai={chmod:Ie.chmod,mkdir:Ie.mkdir,readdir:e=>Ie.readdir(e,{withFileTypes:!0}),rename:Ie.rename,rm:Ie.rm,rmdir:Ie.rmdir,stat:Ie.stat,lstat:Ie.lstat,unlink:Ie.unlink},{readdir:ji}=Ai,Mi=e=>ji(e).catch(e=>e),Ni=e=>{try{return ki(e)}catch(e){return e}},Pi=e=>!!e&&typeof e==`object`,Fi=(e,t)=>t in e&&typeof e[t]==`string`,Ii=e=>Pi(e)&&Fi(e,`code`)&&Fi(e,`path`),J=e=>Pi(e)&&Fi(e,`code`)?e.code:null,Li=async(e,t)=>e.catch(e=>{if(J(e)!==`ENOENT`)throw t??e}),Ri=(e,t)=>{try{return e()}catch(e){if(J(e)===`ENOENT`)return;throw t??e}},{lstat:zi,rmdir:Bi,unlink:Vi}=Ai,Hi=async(e,t)=>(t?.signal?.throwIfAborted(),await Li(zi(e).then(n=>Wi(e,t,n)))??!0),Ui=(e,t)=>(t?.signal?.throwIfAborted(),Ri(()=>Gi(e,t,be(e)))??!0),Wi=async(e,t,n)=>{t?.signal?.throwIfAborted();let r=n.isDirectory()?await Mi(e):null;if(!Array.isArray(r)){
4
- /* c8 ignore start */
5
- if(r){if(J(r)===`ENOENT`)return!0;if(J(r)!==`ENOTDIR`)throw r}return t.filter&&!await t.filter(e,n)?!1:(await Li(Vi(e)),!0)}return!(await Promise.all(r.map(n=>Wi(Pe(e,n.name),t,n)))).every(e=>e===!0)||t.preserveRoot===!1&&e===L(e).root||t.filter&&!await t.filter(e,n)?!1:(await Li(Bi(e)),!0)},Gi=(e,t,n)=>{t?.signal?.throwIfAborted();let r=n.isDirectory()?Ni(e):null;if(!Array.isArray(r)){
6
- /* c8 ignore start */
7
- if(r){if(J(r)===`ENOENT`)return!0;if(J(r)!==`ENOTDIR`)throw r}return t.filter&&!t.filter(e,n)?!1:(Ri(()=>ke(e)),!0)}let i=!0;for(let n of r){let r=Pe(e,n.name);i=Gi(r,t,n)&&i}return t.preserveRoot===!1&&e===L(e).root||!i||t.filter&&!t.filter(e,n)?!1:(Ri(()=>De(e)),!0)},{chmod:Ki}=Ai,qi=e=>async t=>{try{await Li(e(t));return}catch(n){if(J(n)===`EPERM`){if(!await Li(Ki(t,438).then(()=>!0),n))return;await e(t);return}throw n}},Ji=e=>t=>{try{Ri(()=>e(t));return}catch(n){if(J(n)===`EPERM`){if(!Ri(()=>(ve(t,438),!0),n))return;e(t);return}throw n}},Yi=/* @__PURE__ */ new Set([`EMFILE`,`ENFILE`,`EBUSY`]),Xi=e=>{let t=async(n,r,i=1,a=0)=>{let o=r.maxBackoff||200,s=r.backoff||1.2,c=r.maxRetries||10,l=0;for(;;)try{return await e(n)}catch(e){if(Ii(e)&&e.path===n&&Yi.has(e.code)){if(i=Math.ceil(i*s),a=i+a,a<o)return await Le(i),t(n,r,i,a);if(l<c){l++;continue}}throw e}};return t},Zi=e=>(t,n)=>{let r=n.maxRetries||10,i=0;for(;;)try{return e(t)}catch(e){if(Ii(e)&&e.path===t&&Yi.has(e.code)&&i<r){i++;continue}throw e}},{stat:Qi}=Ai,$i=e=>{try{return Oe(e).isDirectory()}catch{return!1}},ea=e=>Qi(e).then(e=>e.isDirectory(),()=>!1),ta=async e=>{let{root:t}=L(e),n=Re(),{root:r}=L(n);if(t.toLowerCase()===r.toLowerCase())return n;let i=Pe(t,`/temp`);return await ea(i)?i:t},na=e=>{let{root:t}=L(e),n=Re(),{root:r}=L(n);if(t.toLowerCase()===r.toLowerCase())return n;let i=Pe(t,`/temp`);return $i(i)?i:t},ra=async()=>Re(),ia=()=>Re(),aa=process.platform===`win32`?ta:ra,oa=process.platform===`win32`?na:ia,{lstat:sa,rename:ca,unlink:la,rmdir:ua}=Ai,da=e=>`.${Ne(e)}.${Math.random()}`,fa=qi(la),pa=Ji(ke),ma=async(e,t)=>(t?.signal?.throwIfAborted(),await Li(sa(e).then(n=>ha(e,t,n)))??!0),ha=async(e,t,n)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return ha(e,{...t,tmp:await aa(e)},n);if(e===t.tmp&&L(e).root!==e)throw Error(`cannot delete temp directory used for deletion`);let r=n.isDirectory()?await Mi(e):null;if(!Array.isArray(r)){
8
- /* c8 ignore start */
9
- if(r){if(J(r)===`ENOENT`)return!0;if(J(r)!==`ENOTDIR`)throw r}return t.filter&&!await t.filter(e,n)?!1:(await Li(ga(e,t.tmp,fa)),!0)}return!(await Promise.all(r.map(n=>ha(Pe(e,n.name),t,n)))).every(e=>e===!0)||t.preserveRoot===!1&&e===L(e).root||t.filter&&!await t.filter(e,n)?!1:(await Li(ga(e,t.tmp,ua)),!0)},ga=async(e,t,n)=>{let r=Pe(t,da(e));return await ca(e,r),await n(r)},_a=(e,t)=>(t?.signal?.throwIfAborted(),Ri(()=>va(e,t,be(e)))??!0),va=(e,t,n)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return va(e,{...t,tmp:oa(e)},n);let r=t.tmp;if(e===t.tmp&&L(e).root!==e)throw Error(`cannot delete temp directory used for deletion`);let i=n.isDirectory()?Ni(e):null;if(!Array.isArray(i)){
10
- /* c8 ignore start */
11
- if(i){if(J(i)===`ENOENT`)return!0;if(J(i)!==`ENOTDIR`)throw i}return t.filter&&!t.filter(e,n)?!1:(Ri(()=>ya(e,r,pa)),!0)}let a=!0;for(let n of i){let r=Pe(e,n.name);a=va(r,t,n)&&a}return!a||t.preserveRoot===!1&&e===L(e).root||t.filter&&!t.filter(e,n)?!1:(Ri(()=>ya(e,r,De)),!0)},ya=(e,t,n)=>{let r=Pe(t,da(e));return Te(e,r),n(r)},{unlink:ba,rmdir:xa,lstat:Sa}=Ai,Ca=Xi(qi(ba)),wa=Zi(Ji(ke)),Ta=Xi(qi(xa)),Ea=Zi(Ji(De)),Da=async(e,{filter:t,...n})=>{
12
- /* c8 ignore next */
13
- n?.signal?.throwIfAborted();try{return await Ta(e,n),!0}catch(t){if(J(t)===`ENOTEMPTY`)return ma(e,n);throw t}},Oa=(e,{filter:t,...n})=>{n?.signal?.throwIfAborted();try{return Ea(e,n),!0}catch(t){if(J(t)===`ENOTEMPTY`)return _a(e,n);throw t}},ka=Symbol(`start`),Aa=Symbol(`child`),ja=Symbol(`finish`),Ma=async(e,t)=>(t?.signal?.throwIfAborted(),await Li(Sa(e).then(n=>Pa(e,t,n,ka)))??!0),Na=(e,t)=>(t?.signal?.throwIfAborted(),Ri(()=>Fa(e,t,be(e),ka))??!0),Pa=async(e,t,n,r=ka)=>{t?.signal?.throwIfAborted();let i=n.isDirectory()?await Mi(e):null;if(!Array.isArray(i)){
14
- /* c8 ignore start */
15
- if(i){if(J(i)===`ENOENT`)return!0;if(J(i)!==`ENOTDIR`)throw i}return t.filter&&!await t.filter(e,n)?!1:(await Li(Ca(e,t)),!0)}let a=r===ka?Aa:r,o=(await Promise.all(i.map(n=>Pa(Pe(e,n.name),t,n,a)))).every(e=>e===!0);if(r===ka)return Pa(e,t,n,ja);if(r===ja){if(t.preserveRoot===!1&&e===L(e).root||!o||t.filter&&!await t.filter(e,n))return!1;await Li(Da(e,t))}return!0},Fa=(e,t,n,r=ka)=>{let i=n.isDirectory()?Ni(e):null;if(!Array.isArray(i)){
16
- /* c8 ignore start */
17
- if(i){if(J(i)===`ENOENT`)return!0;if(J(i)!==`ENOTDIR`)throw i}return t.filter&&!t.filter(e,n)?!1:(Ri(()=>wa(e,t)),!0)}let a=!0;for(let n of i){let i=r===ka?Aa:r,o=Pe(e,n.name);a=Fa(o,t,n,i)&&a}if(r===ka)return Fa(e,t,n,ja);if(r===ja){if(t.preserveRoot===!1&&e===L(e).root||!a||t.filter&&!t.filter(e,n))return!1;Ri(()=>Oa(e,t))}return!0},Ia=process.platform===`win32`?Ma:Hi,La=process.platform===`win32`?Na:Ui,{rm:Ra}=Ai,za=async(e,t)=>(await Ra(e,{...t,force:!0,recursive:!0}),!0),Ba=(e,t)=>(Ee(e,{...t,force:!0,recursive:!0}),!0),[Va=0,Ha=0]=process.version.replace(/^v/,``).split(`.`).map(e=>parseInt(e,10)),Ua=Va>14||Va===14&&Ha>=14,Wa=!Ua||process.platform===`win32`?()=>!1:e=>!e?.signal&&!e?.filter,Ga=!Ua||process.platform===`win32`?()=>!1:e=>!e?.signal&&!e?.filter,Ka=e=>async(t,n)=>{let r=Ei(n);return r.glob&&(t=await xi(t,r.glob)),Array.isArray(t)?!!(await Promise.all(t.map(t=>e(Oi(t,r),r)))).reduce((e,t)=>e&&t,!0):!!await e(Oi(t,r),r)},qa=e=>(t,n)=>{let r=Di(n);return r.glob&&(t=fi(t,r.glob)),Array.isArray(t)?!!t.map(t=>e(Oi(t,r),r)).reduce((e,t)=>e&&t,!0):!!e(Oi(t,r),r)},Ja=qa(Ba),Ya=Object.assign(Ka(za),{sync:Ja}),Xa=qa(La),Za=Object.assign(Ka(Ia),{sync:Xa}),Qa=qa(Na),$a=Object.assign(Ka(Ma),{sync:Qa}),eo=qa(Ui),to=Object.assign(Ka(Hi),{sync:eo}),no=qa(_a),ro=Object.assign(Ka(ma),{sync:no}),io=qa((e,t)=>Ga(t)?Ba(e,t):La(e,t)),ao=Ka((e,t)=>Wa(t)?za(e,t):Ia(e,t)),oo=Object.assign(ao,{rimraf:ao,sync:io,rimrafSync:io,manual:Za,manualSync:Xa,native:Ya,nativeSync:Ja,posix:to,posixSync:eo,windows:$a,windowsSync:Qa,moveRemove:ro,moveRemoveSync:no});oo.rimraf=oo;async function so(e,t,{baseDir:n=``,readdirImpl:r=pe,cpImpl:i=N,joinImpl:a=O}={}){for(let o of e){let e=n?a(n,o):o;try{let n=await r(e,{withFileTypes:!0});for(let r of n){let n=a(e,r.name),o=a(t,r.name);r.isDirectory()?await i(n,o,{recursive:!0,force:!0}):r.isFile()&&await i(n,o,{force:!0})}}catch{}}}async function co(e,t,n={},{statImpl:r=_e,cpImpl:i=N}={}){let a=Array.isArray(e)?e:[e];for(let e of a)try{return await r(e),await i(e,t,n),!0}catch{}return!1}async function lo(e,{statImpl:t=_e}={}){for(let n of e)try{return await t(n),n}catch{}return null}function uo({contentRoot:e=``,toolchainRoot:t=``,distPublicDir:n=`dist/public`}={}){let r=[{sources:[`pages/resources/README.md`,`pages/deps/README.md`,`resources/README.md`,`deps/README.md`,`pages/README.md`,`README.md`],dest:`dist/public/README.md`},{sources:[`pages/resources/docs`,`pages/deps/docs`,`resources/docs`,`deps/docs`,`pages/docs`,`docs`],dest:`dist/public/docs`,opts:{recursive:!0}},{sources:[`pages/resources/AGENTS.md`,`pages/deps/AGENTS.md`,`resources/AGENTS.md`,`deps/AGENTS.md`,`pages/AGENTS.md`,`AGENTS.md`],dest:`dist/public/AGENTS.md`},{sources:[`pages/resources/llms.txt`,`pages/deps/llms.txt`,`resources/llms.txt`,`deps/llms.txt`,`pages/llms.txt`,`llms.txt`],dest:`dist/public/llms.txt`},{sources:[`pages/resources/robots.txt`,`pages/deps/robots.txt`,`resources/robots.txt`,`deps/robots.txt`,`pages/robots.txt`,`robots.txt`],dest:`dist/public/robots.txt`},{sources:[`pages/resources/sitemap.xml`,`pages/deps/sitemap.xml`,`resources/sitemap.xml`,`deps/sitemap.xml`,`pages/sitemap.xml`,`pages/main/sitemap.xml`,`sitemap.xml`],dest:`dist/public/sitemap.xml`},{sources:[`pages/resources/sitemap.txt`,`pages/deps/sitemap.txt`,`resources/sitemap.txt`,`deps/sitemap.txt`,`pages/sitemap.txt`,`pages/main/sitemap.txt`,`sitemap.txt`],dest:`dist/public/sitemap.txt`},{sources:[`pages/resources/404.html`,`pages/deps/404.html`,`resources/404.html`,`deps/404.html`,`pages/404.html`,`pages/main/404.html`,`404.html`],dest:`dist/public/404.html`},{sources:[`pages/resources/manifest.json`,`pages/deps/manifest.json`,`resources/manifest.json`,`deps/manifest.json`,`pages/manifest.json`,`pages/main/manifest.json`,`manifest.json`],dest:`dist/public/manifest.json`},{sources:[`pages/resources/assets/icons/favicon.svg`,`pages/deps/assets/icons/favicon.svg`,`resources/assets/icons/favicon.svg`,`deps/assets/icons/favicon.svg`,`pages/resources/assets/favicon.svg`,`pages/resources/favicon.svg`,`pages/deps/favicon.svg`,`resources/favicon.svg`,`deps/favicon.svg`,`pages/favicon.svg`,`pages/main/favicon.svg`,`assets/icons/favicon.svg`],dest:`dist/public/favicon.svg`},{sources:[`pages/resources/assets/icons/favicon.ico`,`pages/deps/assets/icons/favicon.ico`,`resources/assets/icons/favicon.ico`,`deps/assets/icons/favicon.ico`,`pages/resources/assets/favicon.ico`,`pages/resources/favicon.ico`,`pages/deps/favicon.ico`,`resources/favicon.ico`,`deps/favicon.ico`,`pages/favicon.ico`,`pages/main/favicon.ico`,`assets/icons/favicon.ico`],dest:`dist/public/favicon.ico`}];if(!e&&!t&&n===`dist/public`)return r;let i=/* @__PURE__ */ new Set([`dist/public/404.html`,`dist/public/manifest.json`,`dist/public/robots.txt`,`dist/public/favicon.svg`,`dist/public/favicon.ico`]);return r.map(r=>{let a=n?r.dest.replace(/^dist\/public/,n):r.dest,o=[];if(e)for(let t of r.sources)o.push(D.join(e,t));if(t&&t!==e&&i.has(r.dest))for(let e of r.sources)o.push(D.join(t,e));return!e&&!t&&o.push(...r.sources),{sources:o,dest:a,...r.opts?{opts:r.opts}:{}}})}function fo(e){let t=[`pages/resources/routes.json`,`pages/deps/routes.json`,`resources/routes.json`,`deps/routes.json`,`pages/routes.json`,`routes.json`];return e?t.map(t=>D.join(e,t)):t}function po(e){return e?[D.join(e,`shadow-claw-config.json`),D.join(e,`shadow-claw.config.json`),D.join(e,`shadowclaw.config.json`),D.join(e,`pages/shadow-claw-config.json`),D.join(e,`pages/shadow-claw.config.json`),D.join(e,`site-config.json`),D.join(e,`pages/site-config.json`)]:[`shadow-claw-config.json`,`shadow-claw.config.json`,`shadowclaw.config.json`,`site-config.json`]}function mo(e={}){let t=e.PRERENDER_PAGES||`all`;return{isProduction:e.NODE_ENV===`production`,copyAllAssets:e.COPY_ALL_ASSETS===`true`,prerenderPages:t,prerenderMainMemory:e.PRERENDER_MAIN_MEMORY!==`false`&&t!==`none`&&t!==`0`}}function ho(e){let t=ne(e);if(t.startsWith(`pages/main/`))return t.slice(11);if(t.startsWith(`pages/br:main/`)||t.startsWith(`pages/br-main/`))return t.slice(14);if(t.startsWith(`main/`))return t.slice(5);if(t.startsWith(`pages/`)){let e=t.split(`/`);if(e.length>=3)return e.slice(2).join(`/`)}return t}function go(e,t){let n=`<script id="shadow-claw-static-routing" type="application/json">${w(t)}<\/script>`;return/id="shadow-claw-static-routing"/iu.test(e)?e.replace(/<script\s+id="shadow-claw-static-routing"[\s\S]*?<\/script>/iu,()=>n):i(e,` ${n}`)}function _o(e){let t=(e.siteTitle||``).trim(),n=e.pageTitle?T(e.pageTitle).trim():``;if(e.isHome||!n)return t;if(!t)return n;if(n.toLowerCase()===t.toLowerCase())return t;let r=e.separator==null?` - `:e.separator;r&&!r.startsWith(` `)&&!r.endsWith(` `)&&(r=` ${r} `);let i=r.trim();return RegExp(`(?:\\s*[-|—•·]\\s*|\\s+${bo(i)}\\s+)${bo(t)}$`,`i`).test(n)?n:e.titleTemplate?e.titleTemplate.replace(/%%title%%|%title%/g,n).replace(/%%sitename%%|%%site%%|%sitename%|%site%/g,t).replace(/%%sep%%|%sep%/g,i).replace(/%%sitedesc%%|%%description%%|%sitedesc%|%description%/g,(e.siteDescription||``).trim()).replace(/\s+/g,` `).trim():`${n}${r}${t}`}function vo(e,t){if(!e)return t?.fallback||``;let n=t?.maxLength??160,r=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``);r=r.replace(/```[\s\S]*?```/gu,``),r=r.replace(/~~~[\s\S]*?~~~/gu,``),r=r.replace(/^#{1,6}\s+.*$/gmu,``),r=r.replace(/!\[.*?\]\(.*?\)/gu,``),r=r.replace(/\[([^\]]+)\]\([^)]+\)/gu,`$1`),r=r.replace(/^>\s*/gmu,``),r=r.replace(/\*\*([^*]+)\*\*/gu,`$1`),r=r.replace(/\*([^*]+)\*/gu,`$1`),r=r.replace(/__([^_]+)__/gu,`$1`),r=r.replace(/_([^_]+)_/gu,`$1`),r=r.replace(/`([^`]+)`/gu,`$1`);let i=r.split(/\r?\n\s*\r?\n/).map(e=>T(e).replace(/\s+/g,` `).trim()).filter(e=>e.length>0);if(i.length===0)return t?.fallback||``;let a=i[0];if(a.length<=n)return a;let o=a.slice(0,n),s=o.lastIndexOf(` `);return s>n*.7&&(o=o.slice(0,s)),o=o.replace(/[,;.:\-—]+$/u,``).trim(),`${o}...`}function yo(e){let t=(e.origin||``).trim().replace(/\/+$/,``),n=(e.basePath||``).trim(),r=e.prettyPath.trim();if(r.startsWith(`/`)||(r=`/${r}`),n&&n!==`/`){let e=`/${n.replace(/^\/+|\/+$/g,``)}`;r.startsWith(e)||t.endsWith(e)||(r=`${e}${r}`)}return t?`${t}${r}`:r}function bo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xo(e){let t=/<!--[\s\S]*?-->|<script\b[\s\S]*?<\/script>|<style\b[\s\S]*?<\/style>|<template\b[\s\S]*?<\/template>|<\/head>/gi,n;for(;(n=t.exec(e))!==null;)if(n[0].toLowerCase().startsWith(`</head`))return n.index;return-1}function So(e,t){let n=xo(e);return n===-1?`${t}\n${e}`:`${e.slice(0,n)} ${t}\n${e.slice(n)}`}function Co(e,t){let n=e;if(t.title){let e=C(t.title);n=/<title>[^<]*<\/title>/iu.test(n)?n.replace(/<title>[^<]*<\/title>/iu,`<title>${e}</title>`):So(n,`<title>${e}</title>`)}if(t.description){let e=`<meta name="description" content="${C(t.description)}" />`;n=/<meta\s+name="description"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="description"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.canonicalUrl){let e=`<link rel="canonical" href="${C(t.canonicalUrl)}" />`;n=/<link\s+rel="canonical"\s+href="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<link\s+rel="canonical"\s+href="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.title){let e=`<meta property="og:title" content="${C(t.title)}" />`;n=/<meta\s+property="og:title"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:title"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.description){let e=`<meta property="og:description" content="${C(t.description)}" />`;n=/<meta\s+property="og:description"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:description"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.canonicalUrl){let e=`<meta property="og:url" content="${C(t.canonicalUrl)}" />`;n=/<meta\s+property="og:url"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:url"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.siteTitle){let e=`<meta property="og:site_name" content="${C(t.siteTitle)}" />`;n=/<meta\s+property="og:site_name"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:site_name"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.type){let e=`<meta property="og:type" content="${C(t.type)}" />`;n=/<meta\s+property="og:type"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:type"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.title){let e=`<meta name="twitter:title" content="${C(t.title)}" />`;n=/<meta\s+name="twitter:title"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="twitter:title"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.description){let e=`<meta name="twitter:description" content="${C(t.description)}" />`;n=/<meta\s+name="twitter:description"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="twitter:description"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.image){let e=C(t.image),r=`<meta property="og:image" content="${e}" />`;n=/<meta\s+property="og:image"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:image"\s+content="[^"]*"\s*\/?>/iu,r):So(n,r);let i=`<meta name="twitter:image" content="${e}" />`;n=/<meta\s+name="twitter:image"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="twitter:image"\s+content="[^"]*"\s*\/?>/iu,i):So(n,i)}return n}const wo=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`);function To(e){let t=e?.routes;if(!t||typeof t!=`object`)return[];let n=/* @__PURE__ */ new Set;for(let e of Object.values(t)){let t=e?.prettyPath;typeof t==`string`&&t&&n.add(t)}return[...n]}function Eo(e,t){let n=t.endsWith(`/`)?t:`${t}/`,r=/* @__PURE__ */ new Set([n]);for(let t of To(e))r.add(n+t.replace(/^\/+/,``));return`<?xml version="1.0" encoding="UTF-8"?>
18
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
19
- ${[...r].map(e=>` <url>\n <loc>${wo(e)}</loc>\n </url>`).join(`
20
- `)}
21
- </urlset>
22
- `}const Y=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`);function Do(e){return`<![CDATA[${e.replace(/]]>/g,`]]]]><![CDATA[>`)}]]>`}function Oo(e){if(!e)return(/* @__PURE__ */ new Date()).toUTCString();let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?(/* @__PURE__ */ new Date()).toUTCString():t.toUTCString()}function ko(e){if(!e)return(/* @__PURE__ */ new Date()).toISOString();let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?(/* @__PURE__ */ new Date()).toISOString():t.toISOString()}function Ao(e){let t=e.match(/\b(19\d\d|20\d\d)[-_/](0[1-9]|1[0-2])[-_/](0[1-9]|[12]\d|3[01])\b/);if(t)return`${t[1]}-${t[2]}-${t[3]}T00:00:00Z`}function jo(e){let t=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``).match(/^#+\s+(.+)$/m);return t?t[1].trim():``}function Mo(e){let t=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``).replace(/^#+.*$/gm,``).replace(/<[^>]+>/g,``).trim().split(/\n\s*\n/);return t[0]?t[0].trim().slice(0,300):``}function No(e,t){let n=/* @__PURE__ */ new Set;if(t){n.add(t);let e=t.replace(/^\/+|\/+$/g,``);e&&n.add(e)}if(e){n.add(e);let t=e.replace(/^\/+|\/+$/g,``);t&&n.add(t);let r=t.replace(/^pages\/main\//,``).replace(/^pages\//,``).replace(/^main\//,``);r&&n.add(r);let i=D.basename(e);i&&n.add(i)}return Array.from(n)}function Po(e,t){let n=e.trim();if(!n)return!1;if(n.includes(`*`)){let e=n.replace(/^\/+/,``).replace(/\/+$/,``).replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*\*/g,`.*`).replace(/\*/g,`[^/]*`),r=RegExp(`^${e}$`,`i`);return t.some(e=>r.test(e))}if(n.endsWith(`/`)){let e=n.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();return t.some(t=>{let n=t.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();return n===e||n.startsWith(`${e}/`)})}let r=n.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();for(let e of t){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();if(t===r||t.replace(/\.(md|markdown|html|xhtml|txt)$/i,``)===r.replace(/\.(md|markdown|html|xhtml|txt)$/i,``))return!0}return!1}async function Fo(e,t){let n=e?.routes;if(!n||typeof n!=`object`)return[];let r=t.origin.endsWith(`/`)?t.origin:`${t.origin}/`,i=[];for(let[e,a]of Object.entries(n)){let n=a?.prettyPath;if(!n||typeof n!=`string`)continue;let o=n.replace(/^\/+|\/+$/g,``);if(o===``||o===`index.html`||o===`main`||o===`feed`||o.startsWith(`feed/`)||e.endsWith(`.xml`))continue;let s=No(e,n);if(t.denyList&&t.denyList.length>0&&t.denyList.some(e=>Po(e,s))||t.allowList&&t.allowList.length>0&&!t.allowList.some(e=>Po(e,s)))continue;let c=``;if(t.pagesDir){let n=[D.join(t.pagesDir,e.replace(/^\/pages\/main\//,``).replace(/^\/main\//,``).replace(/^\//,``)),D.join(t.pagesDir,D.basename(e))];for(let e of n)try{c=await F(e,`utf8`);break}catch{}}let l={},u=c;if(c)try{let e=ze(c);l=e.data||{},u=e.content||``}catch{}if(l.slug===`shadow-claw--purge-pages`||l.draft===!0||l.published===!1||l.feed===!1||l.feed?.enabled===!1||l.feed?.exclude===!0||l.syndication===!1||l.syndicate===!1||l.rss===!1)continue;let d=a.title||l.title||jo(c)||D.basename(e,D.extname(e)).replace(/[-_]/g,` `),f=l.date||l.pubDate||l.created||l.updated||a.date||Ao(e),p=f?new Date(f):void 0,m=l.updated||l.created||f,h=m?new Date(m):p,g=a.description||l.description||l.excerpt||l.summary||Mo(u),_=`${r}${n.replace(/^\/+/,``)}`,v=l.author||a.author||t.author,y=Array.isArray(l.categories)?l.categories:Array.isArray(l.tags)?l.tags:typeof l.section==`string`?[l.section]:[];i.push({title:d,link:_,guid:_,pubDate:p,updated:h,description:g,content:u?u.trim():void 0,author:v,categories:y})}let a=t.sortOrder!==`asc`;return i.sort((e,t)=>{let n=e.pubDate?new Date(e.pubDate).getTime():0,r=t.pubDate?new Date(t.pubDate).getTime():0;return n===r?e.title.localeCompare(t.title):a?r-n:n-r}),i}function Io(e){let t=e.lang||`en-US`,n=Oo(e.lastBuildDate),r=e.link.endsWith(`/`)?e.link:`${e.link}/`,i=e.feedUrl||`${r}feed/`,a=e.items.map(t=>{let n=Oo(t.pubDate),r=t.guid||t.link,i=t.author||e.author||e.title,a=(t.categories||[]).map(e=>` <category>${Do(e)}</category>`).join(`
23
- `),o=t.content?` <content:encoded>${Do(t.content)}</content:encoded>\n`:``;return` <item>
24
- <title>${Y(t.title)}</title>
25
- <link>${Y(t.link)}</link>
26
- <pubDate>${n}</pubDate>
27
- <dc:creator>${Do(i)}</dc:creator>
28
- <guid isPermaLink="true">${Y(r)}</guid>
29
- <description>${Do(t.description||``)}</description>
30
- ${o}${a?a+`
31
- `:``} </item>`}).join(`
32
- `);return`<?xml version="1.0" encoding="UTF-8"?>
33
- <rss version="2.0"
34
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
35
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
36
- xmlns:dc="http://purl.org/dc/elements/1.1/"
37
- xmlns:atom="http://www.w3.org/2005/Atom"
38
- xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
39
- xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
40
- >
41
- <channel>
42
- <title>${Y(e.title)}</title>
43
- <atom:link href="${Y(i)}" rel="self" type="application/rss+xml" />
44
- <link>${Y(e.link)}</link>
45
- <description>${Y(e.description||``)}</description>
46
- <lastBuildDate>${n}</lastBuildDate>
47
- <language>${Y(t)}</language>
48
- <sy:updatePeriod>hourly</sy:updatePeriod>
49
- <sy:updateFrequency>1</sy:updateFrequency>
50
- <generator>ShadowClaw</generator>
51
- ${a?a+`
52
- `:``} </channel>
53
- </rss>
54
- `}function Lo(e){let t=e.lang||`en-US`,n=ko(e.lastBuildDate),r=e.link.endsWith(`/`)?e.link:`${e.link}/`,i=e.feedUrl||`${r}feed/atom/`,a=e.items.map(t=>{let n=ko(t.pubDate),r=ko(t.updated||t.pubDate),i=t.guid||t.link,a=t.author||e.author||e.title,o=t.description?` <summary type="html">${Do(t.description)}</summary>\n`:``,s=t.content?` <content type="html" xml:base="${Y(t.link)}">${Do(t.content)}</content>\n`:``,c=(t.categories||[]).map(e=>` <category term="${Y(e)}" />`).join(`
55
- `);return` <entry>
56
- <author><name>${Y(a)}</name></author>
57
- <title type="html">${Do(t.title)}</title>
58
- <link rel="alternate" type="text/html" href="${Y(t.link)}" />
59
- <id>${Y(i)}</id>
60
- <updated>${r}</updated>
61
- <published>${n}</published>
62
- ${o}${s}${c?c+`
63
- `:``} </entry>`}).join(`
64
- `);return`<?xml version="1.0" encoding="UTF-8"?>
65
- <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="${Y(t)}">
66
- <title type="text">${Y(e.title)}</title>
67
- <subtitle type="text">${Y(e.description||``)}</subtitle>
68
- <updated>${n}</updated>
69
- <link rel="alternate" type="text/html" href="${Y(e.link)}" />
70
- <id>${Y(i)}</id>
71
- <link rel="self" type="application/atom+xml" href="${Y(i)}" />
72
- <generator uri="https://github.com/xt-ml/shadow-claw">ShadowClaw</generator>
73
- ${a?a+`
74
- `:``}
75
- </feed>
76
- `}function Ro(e){let t=e.lang||`en-US`,n=ko(e.lastBuildDate),r=e.link.endsWith(`/`)?e.link:`${e.link}/`,i=e.feedUrl||`${r}feed/rdf/`,a=e.items.map(e=>` <rdf:li rdf:resource="${Y(e.link)}" />`).join(`
77
- `),o=e.items.map(t=>{let n=ko(t.pubDate),r=t.author||e.author||e.title,i=t.content?` <content:encoded>${Do(t.content)}</content:encoded>\n`:``;return`<item rdf:about="${Y(t.link)}">
78
- <title>${Y(t.title)}</title>
79
- <link>${Y(t.link)}</link>
80
- <dc:date>${n}</dc:date>
81
- <dc:creator>${Y(r)}</dc:creator>
82
- <description>${Do(t.description||``)}</description>
83
- ${i}</item>`}).join(`
84
-
85
- `);return`<?xml version="1.0" encoding="UTF-8"?>
86
- <rdf:RDF
87
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
88
- xmlns="http://purl.org/rss/1.0/"
89
- xmlns:dc="http://purl.org/dc/elements/1.1/"
90
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
91
- xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
92
- xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
93
- xmlns:admin="http://webns.net/mvcb/"
94
- >
95
- <channel rdf:about="${Y(i)}">
96
- <title>${Y(e.title)}</title>
97
- <link>${Y(e.link)}</link>
98
- <description>${Y(e.description||``)}</description>
99
- <dc:date>${n}</dc:date>
100
- <dc:language>${Y(t)}</dc:language>
101
- <syn:updatePeriod>hourly</syn:updatePeriod>
102
- <syn:updateFrequency>1</syn:updateFrequency>
103
- <syn:updateBase>1970-01-01T00:00+00:00</syn:updateBase>
104
- <items>
105
- <rdf:Seq>
106
- ${a?a+`
107
- `:``} </rdf:Seq>
108
- </items>
109
- </channel>
110
-
111
- ${o}
112
- </rdf:RDF>
113
- `}function zo(e,t,n){return`<!DOCTYPE html>
114
- <html lang="en">
115
- <head>
116
- <meta charset="utf-8" />
117
- <meta http-equiv="refresh" content="0; url=${Y(e)}" />
118
- <link rel="alternate" type="${Y(n)}" title="${Y(t)}" href="${Y(e)}" />
119
- <title>${Y(t)}</title>
120
- </head>
121
- <body>
122
- <p><a href="${Y(e)}">Click here to view ${Y(t)}</a></p>
123
- </body>
124
- </html>
125
- `}function Bo(e,t){if(!t)return e;let n=t.endsWith(`/`)?t:`${t}/`,r=new URL(n),i=r.pathname.replace(/\/$/,``);return e.replace(/(<(?:link|guid|id)[^>]*>|rdf:about="|rdf:resource="|href="|xml:base=")(https?:\/\/[^"<>\s]+)/giu,(e,t,n)=>{try{let e=new URL(n),a=e.pathname;i&&a.startsWith(i+`/`)?a=a.slice(i.length):i&&a===i&&(a=`/`);let o=a.startsWith(`/`)?a:`/${a}`,s=`${r.origin}${i}${o}${e.search}${e.hash}`;return`${t}${Y(s)}`}catch{return e}})}async function Vo(e){let t=e.origin||``,n=t.endsWith(`/`)?t:`${t}/`,r=e.siteConfig?.site||{},i=e.siteConfig?.branding||{},a=i.titleText||r.title||`ShadowClaw`,o=r.description||``,s=r.lang||`en-US`,c=i.repoLabel||r.author||a,l=e.lastBuildDate||/* @__PURE__ */ new Date,u=typeof e.siteConfig?.feed==`object`?e.siteConfig.feed:{},d=[...u?.allowList||u?.allowlist||[],...e.siteConfig?.pages?.allowList||e.siteConfig?.allowList||[]],f=[...u?.denyList||u?.denylist||[],...e.siteConfig?.pages?.denyList||e.siteConfig?.denyList||[]],p=await Fo(e.routesJson,{origin:n,pagesDir:e.pagesDir,allowList:d.length>0?d:void 0,denyList:f.length>0?f:void 0,sortOrder:e.siteConfig?.pages?.sortOrder,author:c}),m={title:a,link:n,feedUrl:`${n}feed/`,description:o,lang:s,author:c,lastBuildDate:l,items:p},h={...m,feedUrl:`${n}feed/atom/`},g={...m,feedUrl:`${n}feed/rdf/`},_=Io(m),v=Lo(h),y=Ro(g);return{rss2:_,atom:v,rdf:y,files:{"feed/rss.xml":_,"feed/index.xml":_,"feed/index.html":zo(`rss.xml`,`${a} Feed`,`application/rss+xml`),"feed/atom/atom.xml":v,"feed/atom/index.xml":v,"feed/atom/index.html":zo(`atom.xml`,`${a} Atom Feed`,`application/atom+xml`),"feed/rdf/index.xml":y,"feed/rdf/index.html":zo(`index.xml`,`${a} RDF Feed`,`application/rdf+xml`)}}}function Ho(e={},t={}){let n=e.customElements;return{rawScripts:(typeof n==`object`&&!Array.isArray(n)?n.scripts:n)||e.scripts||t.scripts||[],allowedDomains:(typeof n==`object`&&!Array.isArray(n)?n.allowedDomains:void 0)||e.allowedCustomElementDomains||[]}}function Uo(e,t){if(!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`//`)||!t||Array.isArray(t)&&t.length===0)return!0;try{let n=new URL(e,`https://localhost`).hostname.toLowerCase();return(Array.isArray(t)?t:String(t).split(/[\n,]+/)).some(e=>{let t=e.trim().toLowerCase();return n===t||n.endsWith(`.`+t)||t===`*`})}catch{return!1}}function Wo(e,t){let n=JSON.parse(JSON.stringify(e));return n.customElements&&typeof n.customElements==`object`&&Array.isArray(n.customElements.scripts)&&(n.customElements.scripts=n.customElements.scripts.filter(e=>{let n=typeof e==`string`?e:e?.src;return n?Uo(n,t):!1})),n}function X(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}const Go=[`pages/resources/`,`pages/deps/`,`resources/`,`deps/`,`pages/assets/`,`pages/main/assets/`];function Ko(e){for(let t of Go)if(e.startsWith(t))return e.slice(t.length).replace(/^\/+/,``);return e.replace(/^\/+/,``)}async function qo(e){try{return JSON.parse(await F(e,`utf8`))}catch{return null}}async function Jo(e){try{return await F(e,`utf8`)}catch{return null}}async function Yo(e,t){await I(e,t,`utf8`)}function Xo(e){return!Array.isArray(e)||e.length===0?``:`<nav slot="sidebar" class="sidebar-custom-sections" aria-label="Site Navigation">\n${e.map((e,t)=>{if(e.html)return e.html;let n=e.title?`sidebar-${e.title.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`:`sidebar-section-${t+1}`,r=e.headerHref?`<a href="${X(e.headerHref)}" class="sidebar-link">${X(e.title||``)}</a>`:`<span>${X(e.title||``)}</span>`,i=e.title?` <div class="sidebar-section-header">${r}</div>`:``,a=(e.items||[]).map(e=>{let t=e.title||e.label||``,n=e.href||`#`,r=e.target?` target="${X(e.target)}"`:``,i=e.rel?` rel="${X(e.rel)}"`:e.target===`_blank`?` rel="noopener noreferrer"`:``,a=e.active?` active`:``,o=e.active?` aria-current="page"`:``;return` <div class="sidebar-item"><a href="${X(n)}"${r}${i} class="sidebar-link${a}"${o}>${X(t)}</a></div>`}).join(`
126
- `);return[` <section class="sidebar-section" id="${n}">`,i,a,` </section>`].filter(Boolean).join(`
127
- `)}).join(`
128
- `)}\n</nav>`}function Zo(e){let t=e.trim();if(!t||t===`/`)return`/`;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n:`${n}/`}function Qo(e){if(!e||typeof e!=`string`||!e.trim())return null;let t=e.trim();try{return Zo(new URL(t).pathname||`/`)}catch{return t.startsWith(`/`)?Zo(t):null}}function $o(e={}){return e.basePath&&e.basePath.trim()?Zo(e.basePath):Qo(e.pagesOrigin)||Qo(e.siteUrl)||(e.defaultBasePath&&e.defaultBasePath.trim()?Zo(e.defaultBasePath):`/`)}function es(e,t){let n=Zo(t);return e.replace(/<base\s+href="[^"]*"\s*\/?>/iu,`<base href="${X(n)}" />`)}function ts(e,t,n,r){let a=e,o=t.site||{};o.title&&(a=a.replace(/<title>[^<]*<\/title>/iu,`<title>${X(o.title)}</title>`)),o.description&&(a=a.replace(/<meta\s+name="description"\s+content="[^"]*"\s*\/?>/iu,`<meta name="description" content="${X(o.description)}" />`)),o.themeColor&&(a=a.replace(/<meta\s+name="theme-color"\s+content="[^"]*"\s*\/?>/iu,`<meta name="theme-color" content="${X(o.themeColor)}" />`)),o.lang&&(a=a.replace(/<html\s+lang="[^"]*"/iu,`<html lang="${o.lang}"`));let s=t.branding||{},c=r?.isProduction??A.env.NODE_ENV===`production`;if(r?.basePath&&r.basePath.trim())a=es(a,r.basePath);else if(c&&(r?.pagesOrigin||s.siteUrl)){let e=$o({pagesOrigin:r?.pagesOrigin,siteUrl:s.siteUrl});a=es(a,e)}if(s.faviconPath){let e=s.faviconPath.replace(/^pages\/main\//,``),t=e.endsWith(`.svg`)?`image/svg+xml`:e.endsWith(`.png`)?`image/png`:`image/x-icon`,n=`<link href="${X(e)}" rel="icon" type="${t}" />`,r=!1;a=a.replace(/<link\b[^>]*\brel=["']?(?:shortcut\s+)?icon["']?[^>]*\/?>/giu,()=>r?``:(r=!0,n)),r||(a=i(a,` ${n}`))}if(s.appleTouchIconPath){let e=`<link href="${X(s.appleTouchIconPath.replace(/^pages\/main\//,``))}" rel="apple-touch-icon" />`,t=!1;a=a.replace(/<link\b[^>]*\brel=["']?apple-touch-icon["']?[^>]*\/?>/giu,()=>t?``:(t=!0,e)),t||(a=i(a,` ${e}`))}if(s.titleText||s.siteUrl||s.logoSlotHtml!==void 0){let e=s.siteUrl||``;a=a.replace(/<a\b([^>]*\bslot="header-title-link"[^>]*)>([\s\S]*?)<\/a>/iu,(n,r,i)=>{let a=``;if(s.logoSlotHtml!==void 0){let e=typeof s.logoSlotHtml==`string`?s.logoSlotHtml.trim():``;e!==``&&e.toLowerCase()!==`none`&&(a=s.logoSlotHtml)}else{let e=i.match(/<svg\b[\s\S]*?<\/svg>/iu)||i.match(/<img\b[^>]*\bclass="[^"]*header-title-logo[^"]*"[^>]*\/?>/iu);e&&(a=e[0])}let o=i.match(/<(h1|span)\b[^>]*\bclass="[^"]*header-title[^"]*"[^>]*>([\s\S]*?)<\/\1>/iu),c=o?o[1]:/<h1\b/i.test(i)?`h1`:`span`,l=o?o[2].trim():`ShadowClaw`,u=s.titleText||t.site?.title||l;return[`<a`,` aria-label="${X(u)}"`,` class="header-title-link"`,e?` href="${X(e)}"`:``,` slot="header-title-link"`,` >`,a?` ${a.trim()}`:``,` <${c} class="header-title">${X(u)}</${c}>`,` </a>`].filter(Boolean).join(`
129
- `)})}if(s.repoUrl){let e=s.repoLabel||`Project on GitHub`;a=a.replace(/<a\b[^>]*\bslot="header-actions-logo"[^>]*>[\s\S]*?<\/a>/iu,[`<a`,` aria-label="${X(e)}"`,` class="header-actions-logo-link"`,` href="${X(s.repoUrl)}"`,` slot="header-actions-logo"`,` >`,` <svg aria-hidden="true" focusable="false" viewBox="0 0 496 512" xmlns="http://www.w3.org/2000/svg">`,` <path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8z" fill="var(--shadow-claw-bg-primary-reverse, currentColor)"></path>`,` </svg>`,` </a>`].join(`
130
- `))}s.siteUrl&&!s.siteUrl.includes(`xt-ml.github.io`)&&(a=a.replace(/\s*<meta\s+http-equiv="origin-trial"\s+content="[^"]*"\s*\/?>\s*/iu,`
131
- `));let l=t.theme||{};if(l.stylesheet){let e=Ko(l.stylesheet),t=`<link rel="stylesheet" href="${X(e)}" />`,n=X(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=RegExp(`<link\\s+[^>]*href=["'](?:${r}|${n})["'][^>]*>`,`iu`),s=y(a),c=(s===-1?a:a.slice(0,s)).replace(/<script\b[\s\S]*?<\/script>/gi,``);o.test(c)||(a=/<link\s+rel="stylesheet"\s+href="index\.css"\s*\/?>/iu.test(a)?a.replace(/(<link\s+rel="stylesheet"\s+href="index\.css"\s*\/?>)/iu,`$1\n ${t}`):i(a,` ${t}`))}let{allowedDomains:u}=Ho(t,l),d=Wo(t,u),f=`<script id="shadow-claw-site-config" type="application/json">${JSON.stringify(d).replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`).replace(/\//g,`\\u002f`)}<\/script>`;a=a.includes(`<script id="shadow-claw-site-config"`)?a.replace(/<script\s+id="shadow-claw-site-config"[\s\S]*?<\/script>/iu,()=>f):a.includes(`<script src="theme-init.js">`)?a.replace(`<script src="theme-init.js">`,`${f}\n <script src="theme-init.js">`):/<script\b[^>]*>\s*var\s+ShadowClawThemeInit\b/iu.test(a)?a.replace(/(<script\b[^>]*>\s*var\s+ShadowClawThemeInit\b)/iu,`${f}\n $1`):i(a,` ${f}`),a=a.replace(/\s*<meta\s+name="shadow-claw-override-prerender-skeleton"[^>]*>/giu,``),typeof t.settings?.overridePrerenderSkeleton==`boolean`&&(a=a.replace(`<script id="shadow-claw-site-config"`,`<meta name="shadow-claw-override-prerender-skeleton" content="${t.settings.overridePrerenderSkeleton}" />\n <script id="shadow-claw-site-config"`));let p=n||t.sidebar?.slotHtml||(t.sidebar?.sections?Xo(t.sidebar.sections):``);if(p){let e=p.trim();/\bslot="sidebar(?:-nav|-content|-footer)?"/iu.test(e)||(e=`<div slot="sidebar" class="sidebar-custom-sections">\n${e}\n</div>`);let t=a.match(/<[^>]+?\bslot="sidebar(?:-nav|-content|-footer)?"[^>]*>[\s\S]*?<\/[^>]+>/iu);t&&(a=a.replace(t[0],``)),a.includes(`</shadow-claw>`)?a=a.replace(`</shadow-claw>`,` ${e}\n</shadow-claw>`):a.includes(`<shadow-claw></shadow-claw>`)&&(a=a.replace(`<shadow-claw></shadow-claw>`,`<shadow-claw>\n ${e}\n</shadow-claw>`))}if(t.sidebar&&(a=v(a,t.sidebar)),t.feed===!0||typeof t.feed==`object`&&t.feed?.enabled===!0){let e=s.titleText||o.title||`ShadowClaw`,t=s.siteUrl?s.siteUrl.endsWith(`/`)?s.siteUrl:`${s.siteUrl}/`:``,n=`<link rel="alternate" type="application/rss+xml" title="${X(e)} &raquo; Feed" href="${X(t)}feed/" />`,r=`<link rel="alternate" type="application/atom+xml" title="${X(e)} &raquo; Atom Feed" href="${X(t)}feed/atom/" />`,c=`<link rel="alternate" type="application/rdf+xml" title="${X(e)} &raquo; RDF Feed" href="${X(t)}feed/rdf/" />`;a.includes(`type="application/rss+xml"`)||(a=i(a,` ${n}`)),a.includes(`type="application/atom+xml"`)||(a=i(a,` ${r}`)),a.includes(`type="application/rdf+xml"`)||(a=i(a,` ${c}`))}return a}function ns(e){let t=(e.src||``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),n=e.type||(t.endsWith(`.svg`)?`image/svg+xml`:t.endsWith(`.png`)?`image/png`:`image/x-icon`),r=(e.purpose||`any`).trim();return n===`image/svg+xml`||t.endsWith(`.svg`)?[{...e,src:t,type:n,purpose:`any`}]:r.includes(`any`)&&r.includes(`maskable`)?[{...e,src:t,type:n,purpose:`any`},{...e,src:t,type:n,purpose:`maskable`}]:[{...e,src:t,type:n,purpose:r}]}function rs(e,t){let n=typeof e==`string`?JSON.parse(e):e,r=t.pwa||{},i=t.site||{},a=A.env.PAGES_ORIGIN;if((r.name||i.title)&&(n.name=r.name||i.title),(r.shortName||i.title)&&(n.short_name=r.shortName||i.title),i.description&&(n.description=i.description),r.backgroundColor&&(n.background_color=r.backgroundColor),(r.themeColor||i.themeColor)&&(n.theme_color=r.themeColor||i.themeColor),r.startUrl?n.start_url=r.startUrl:a?n.start_url=a:n.start_url||=`./`,r.icons&&Array.isArray(r.icons)){let e=r.icons.flatMap(ns),t=Array.isArray(n.icons)?n.icons.flatMap(ns):[],i=new Set(e.map(e=>e.src));n.icons=[...e,...t.filter(e=>!i.has(e.src))]}else Array.isArray(n.icons)&&(n.icons=n.icons.flatMap(ns));return r.screenshots&&Array.isArray(r.screenshots)&&(n.screenshots=r.screenshots.map(e=>{let t=(e.src||``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``);return{...e,src:t}})),JSON.stringify(n,null,2)}function is(e,t){if(!t)return e;let n=t.endsWith(`/`)?t:t+`/`;return/<loc>/i.test(e)?e.replace(/<loc>([^<]*)<\/loc>/giu,(e,t)=>{try{let e=new URL(t.trim()),r=new URL(n),i=r.pathname.replace(/\/$/,``);return`<loc>${X(r.origin+i+e.pathname+e.search)}</loc>`}catch{return`<loc>${X(n)}</loc>`}}):e.split(`
132
- `).map(e=>{let t=e.trim();if(!t)return e;if(t.startsWith(`http://`)||t.startsWith(`https://`))try{let e=new URL(t),r=new URL(n);return e.protocol=r.protocol,e.host=r.host,e.pathname=(r.pathname.endsWith(`/`)?r.pathname.slice(0,-1):r.pathname)+e.pathname,e.toString()}catch{return n}if(t.startsWith(`/`))try{return new URL(t,n).toString()}catch{return e}return e}).join(`
133
- `)}function as(e,t,n){let r=e,i=t.site||{};if(i.title&&(r=r.replace(/<title>[^<]*<\/title>/iu,`<title>${X(i.title)} - Not Found</title>`)),n){let e=n.endsWith(`/`)?n:n+`/`;r=r.replace(/l\.replace\(["']\/shadow-claw\/["']\)/gu,`l.replace("${X(e)}")`)}return r}function os(e){let t=D.resolve(e),n=t.split(D.sep),r=n[n.length-1],i=n[n.length-2];return(r===`resources`||r===`deps`)&&i===`pages`?D.resolve(t,`../..`):r===`resources`||r===`deps`||r===`pages`?D.resolve(t,`..`):t}function ss(e){let t=D.resolve(e),n=D.basename(t);return n===`resources`||n===`deps`||n===`pages`?D.resolve(t,`..`):t}function Z(e,t,n){if(!e||typeof e!=`string`)return[];if(D.isAbsolute(e))return[e];let r=e.replace(/^\/+/,``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=os(t);return[D.resolve(t,`resources`,r),D.resolve(t,`deps`,r),D.resolve(t,`main`,r),D.resolve(i,`pages`,`resources`,r),D.resolve(i,`pages`,`resources`,e),D.resolve(i,`pages`,`deps`,r),D.resolve(i,`pages`,`deps`,e),D.resolve(i,`resources`,r),D.resolve(i,`resources`,e),D.resolve(i,`deps`,r),D.resolve(i,`deps`,e),D.resolve(n,`pages`,`resources`,r),D.resolve(n,`pages`,`deps`,r),D.resolve(n,`resources`,r),D.resolve(n,`deps`,r),D.resolve(n,`pages`,e),D.resolve(n,`pages`,r),D.resolve(n,`pages`,`main`,r),D.resolve(i,`pages`,e),D.resolve(i,`pages`,r),D.resolve(i,`pages`,`main`,r),D.resolve(i,`pages`,`main`,e),D.resolve(t,e),D.resolve(t,r),D.resolve(n,e),D.resolve(n,r),D.resolve(i,e),D.resolve(i,r)]}async function cs(e,t,n){if(!n)return null;let r=await Q([...fo(e),...fo(t),...fo(os(e))]);if(!r)return null;let i=await qo(r);return i?Eo(i,n):null}async function Q(e){for(let t of e)if(t)try{return await _e(t),t}catch{}return null}async function ls(e,t,n){let r=n?D.dirname(D.resolve(n)):A.cwd(),i=ss(r),a=os(r),o=[D.resolve(r,`resources`),D.resolve(r,`deps`),D.resolve(i,`resources`),D.resolve(i,`deps`),D.resolve(i,`pages`,`resources`),D.resolve(i,`pages`,`deps`),D.resolve(a,`resources`),D.resolve(a,`deps`),D.resolve(a,`pages`,`resources`),D.resolve(a,`pages`,`deps`)];for(let e of o)try{let n=await pe(e,{withFileTypes:!0});for(let r of n){let n=D.join(e,r.name),i=D.join(t,r.name);r.isDirectory()?await N(n,i,{recursive:!0,force:!0}):r.isFile()&&(await P(D.dirname(i),{recursive:!0}),await M(n,i))}}catch{}let s=await Q([...e.pages?.notFoundPath?Z(e.pages.notFoundPath,r,i):[],...e.branding?.notFoundPath?Z(e.branding.notFoundPath,r,i):[],...e.notFoundPath?Z(e.notFoundPath,r,i):[],...Z(`404.html`,r,i)]);if(s)try{await M(s,D.join(t,`404.html`)),console.log(` Copied custom 404.html: ${s}`)}catch(e){console.warn(` Warning: Could not copy custom 404.html: ${e.message}`)}let c=await Q([...e.pwa?.manifestPath?Z(e.pwa.manifestPath,r,i):[],...e.manifestPath?Z(e.manifestPath,r,i):[],...Z(`manifest.json`,r,i)]);if(c)try{await M(c,D.join(t,`manifest.json`)),console.log(` Copied custom manifest.json: ${c}`)}catch(e){console.warn(` Warning: Could not copy custom manifest.json: ${e.message}`)}if(e.feedPath){let n=await Q(Z(e.feedPath,r,i));if(n)try{let e=D.basename(n);await M(n,D.join(t,e)),console.log(` Copied custom feed: ${n} → ${e}`)}catch(e){console.warn(` Warning: Could not copy custom feed: ${e.message}`)}}let l=!1;if(e.sitemapPath){let n=await Q(Z(e.sitemapPath,r,i));if(n)try{let e=D.basename(n);await M(n,D.join(t,e)),console.log(` Copied custom sitemap: ${n} → ${e}`),l=!0}catch(e){console.warn(` Warning: Could not copy custom sitemap: ${e.message}`)}}if(!l){let e=await Q(Z(`sitemap.xml`,r,i));if(e)try{await M(e,D.join(t,`sitemap.xml`)),console.log(` Copied custom sitemap.xml: ${e}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.xml: ${e.message}`)}let n=await Q(Z(`sitemap.txt`,r,i));if(n)try{await M(n,D.join(t,`sitemap.txt`)),console.log(` Copied custom sitemap.txt: ${n}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.txt: ${e.message}`)}}let u=e.overwriteAssets===!0||e.branding?.overwriteAssets===!0,d=Array.isArray(e.assets)?e.assets:[e.assetsDir,e.assets].filter(Boolean),f=Array.from(new Set([...d.flatMap(e=>Z(e,r,i)),...Z(`assets`,r,i)].filter(e=>e&&typeof e==`string`))),p=D.join(t,`assets`);if(u)try{await ge(p,{recursive:!0,force:!0}),await P(p,{recursive:!0}),console.log(` Cleared dist public assets for complete template asset overwrite.`)}catch{}let m=/* @__PURE__ */ new Set,h=[...f].reverse();for(let e of h)if(!m.has(e))try{let t=await _e(e);if(m.add(e),t.isDirectory())await N(e,p,{recursive:!0,force:!0}),console.log(` Copied custom assets: ${e} → ${p}`);else if(t.isFile()){let t=D.basename(e);await P(p,{recursive:!0}),await M(e,D.join(p,t)),console.log(` Copied custom asset file: ${e} → ${p}`)}}catch{}}async function us(e,t,n){let r=e.theme||{};if(!r.stylesheet)return;let i=n?D.dirname(D.resolve(n)):A.cwd(),a=ss(i),o=await Q(Z(r.stylesheet,i,a));if(!o)return;let s=r.stylesheet.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),c=D.join(t,s);try{await P(D.dirname(c),{recursive:!0}),await M(o,c),console.log(` Copied theme stylesheet: ${o} → ${c}`)}catch(e){console.warn(` Warning: Could not copy theme stylesheet ${o}: ${e.message}`)}}async function ds(e,t,n){let r=(e.customElements&&typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.scripts:void 0)||e.scripts||[];if(!Array.isArray(r)||r.length===0)return;let i=n?D.dirname(D.resolve(n)):A.cwd(),a=ss(i);for(let e of r){let n=typeof e==`string`?e:e?.src;if(!n||n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))continue;let r=await Q(Z(n,i,a));if(r){let e=n.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=D.join(t,e);try{await P(D.dirname(i),{recursive:!0}),await M(r,i),console.log(` Copied custom script: ${r} → ${i}`)}catch(e){console.warn(` Warning: Could not copy custom script ${r}: ${e.message}`)}}}}async function fs(e,t,n){let r=e.branding||{},i=e.pwa||{},a=n?D.dirname(D.resolve(n)):A.cwd(),o=ss(a),s=[],c=await Q(Z(i.manifestPath||e.manifestPath||`manifest.json`,a,o));if(c){let e=await qo(c);e&&Array.isArray(e.icons)&&(s=e.icons.map(e=>e?.src).filter(Boolean))}let l=[r.faviconPath,r.appleTouchIconPath,`assets/icons/favicon.svg`,`assets/icons/favicon.ico`,`favicon.svg`,`favicon.ico`,`pages/resources/assets/icons/favicon.svg`,`pages/resources/assets/icons/favicon.ico`,`pages/resources/favicon.svg`,`pages/deps/favicon.svg`,`pages/main/favicon.svg`,...Array.isArray(i.icons)?i.icons.map(e=>e.src):[],...s].filter(e=>!!e&&typeof e==`string`&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`//`));if(l.length===0)return;let u=/* @__PURE__ */ new Set,d=/* @__PURE__ */ new Set;for(let e of l){if(u.has(e))continue;u.add(e);let n=await Q(Z(e,a,o));if(n){let r=e.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=D.join(t,r);if(d.has(i))continue;d.add(i);try{await P(D.dirname(i),{recursive:!0}),await M(n,i),console.log(` Copied branding asset: ${n} → ${i}`)}catch(e){console.warn(` Warning: Could not copy branding asset ${n}: ${e.message}`)}}}}async function ps(e,t,n){let r=await qo(t);if(!r)return console.log(`No site-config.json found — skipping site configuration.`),{applied:!1};console.log(`Applying site-config.json...`);let i=n?.pagesOrigin||A.env.PAGES_ORIGIN||``,a=n?.basePath||A.env.PAGES_BASE_PATH||``,o=n?.isProduction??A.env.NODE_ENV===`production`;await ls(r,e,t);let s=t?D.dirname(D.resolve(t)):A.cwd(),c=ss(s),l;if(r.sidebar?.slotHtml)l=r.sidebar.slotHtml;else if(r.sidebar?.sections)l=Xo(r.sidebar.sections);else{let e=await Q([r.sidebar?.slotPath,`pages/main/sidebar.html`,`pages/sidebar.html`,`sidebar.html`,`resources/sidebar.html`].filter(Boolean).flatMap(e=>Z(e,s,c)));e&&(l=await Jo(e)??void 0,console.log(` Found slotted sidebar: ${e}`))}let u=D.join(e,`index.html`),d=await Jo(u);d&&(await Yo(u,ts(d,r,l,{basePath:a,pagesOrigin:i,isProduction:o})),console.log(` Patched index.html`));let f=D.join(e,`share/share-target.html`),p=await Jo(f);if(p){let e=`/`;a&&a.trim()?e=a:o&&(i||r.branding?.siteUrl)&&(e=$o({pagesOrigin:i,siteUrl:r.branding?.siteUrl})),await Yo(f,es(p,e)),console.log(` Patched share/share-target.html`)}let m=D.join(e,`manifest.json`),h=await Jo(m);h&&(await Yo(m,rs(h,r)),console.log(` Patched manifest.json`));let g=D.join(e,`sitemap.xml`),_=!!await Jo(D.join(e,`sitemap.txt`)),v=!1;if(!await Jo(g)&&!_){let e=await cs(s,c,i||r.branding?.siteUrl||``);e&&(await Yo(g,e),v=!0,console.log(` Generated sitemap.xml from routes.json`))}let y=v?``:await Jo(g);y&&(await Yo(g,is(y,i)),console.log(` Patched sitemap.xml`));let b=D.join(e,`sitemap.txt`),ee=await Jo(b);if(ee&&(await Yo(b,is(ee,i)),console.log(` Patched sitemap.txt`)),r.feed===!0||typeof r.feed==`object`&&r.feed?.enabled===!0){let t=await Q([...fo(s),...fo(c),...fo(os(s))]);if(t){let n=await qo(t);if(n){let t=await Q([D.join(e,`pages/main`),D.join(e,`files/main`),D.join(e,`static-main`),D.join(s,`pages/main`),D.join(s,`main`),D.join(c,`pages/main`),D.resolve(`pages/main`)]),a=await Vo({routesJson:n,siteConfig:r,origin:i||r.branding?.siteUrl||``,pagesDir:t||void 0});for(let[t,n]of Object.entries(a.files)){let r=D.join(e,t);await P(D.dirname(r),{recursive:!0}),await Yo(r,t.endsWith(`.xml`)?Bo(n,i):n)}console.log(` Generated RSS 2.0, Atom, and RDF feeds`)}}}let te=D.join(e,`404.html`),x=await Jo(te);return x&&(await Yo(te,as(x,r,a)),console.log(` Patched 404.html`)),await us(r,e,t),await ds(r,e,t),await fs(r,e,t),console.log(`Site configuration applied successfully.`),{applied:!0}}async function ms(){let[e,t]=A.argv.slice(2);(!e||!t)&&(console.error(`Usage: node bin/site-config/apply.mjs <distPublicDir> <siteConfigPath>`),A.exit(1)),await ps(e,t)}A.argv[1]&&D.resolve(A.argv[1])===D.resolve(k(import.meta.url))&&ms().catch(e=>{console.error(`site-config/apply.ts failed:`,e),A.exit(1)});function hs(e){let t=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``).match(/^#+\s+(.+)$/m);return t?t[1].trim():``}async function gs(e={}){let u=D.resolve(e.publicDir||`dist/public`),v=D.resolve(e.routesPath||`pages/routes.json`),y=D.resolve(e.sourcePath||`pages/main`),te=D.resolve(e.indexPath||D.join(u,`index.html`)),x=e.siteConfig||{},C=!!e.siteConfig;if(!e.siteConfig){let t=[e.siteConfigPath,D.resolve(D.dirname(y),`shadow-claw.config.json`),D.resolve(D.dirname(y),`site-config.json`),D.resolve(`shadow-claw.config.json`),D.resolve(`site-config.json`),D.join(u,`shadow-claw.config.json`),D.join(u,`site-config.json`)].filter(Boolean);for(let n of t)try{let t=await F(n,`utf8`);x=JSON.parse(t),(e.siteConfigPath||n.startsWith(D.dirname(y))||n.startsWith(u)||u.startsWith(A.cwd()))&&(C=!0);break}catch{}}let w=e.prerenderPages===void 0?A.env.PRERENDER_PAGES??1:e.prerenderPages,T=n(w),re;try{re=await F(v,`utf8`)}catch(e){if(e?.code===`ENOENT`)return{count:0,skipped:!0,reason:`No routes.json found`};throw e}let E;try{E=JSON.parse(re)}catch(e){return console.warn(`Failed to parse ${v}:`,e),{count:0,skipped:!0,reason:`Invalid JSON in routes.json`}}if(!E||typeof E!=`object`)return{count:0,skipped:!0,reason:`Invalid routes.json`};E.routes||(E.routes={});let ie={...E.routes||{}},O=/* @__PURE__ */ new Set;async function ae(e,t){if(!e.subRoutes)return;let n=Array.isArray(e.subRoutes)?e.subRoutes:Object.values(e.subRoutes);for(let e of n){let n=D.resolve(D.dirname(t),e);if(typeof e==`string`&&e.startsWith(`pages/`)&&(n=D.resolve(e)),!O.has(n)){O.add(n);try{let e=await F(n,`utf8`),t=JSON.parse(e);t.routes&&Object.assign(ie,t.routes),await ae(t,n)}catch(e){console.warn(`Failed to read subRoute: ${n}`,e?.message)}}}}await ae(E,v),Object.assign(E.routes,ie),Array.isArray(E.subRoutes)&&delete E.subRoutes;let oe={allowList:x?.pages?.allowList??x?.pages?.allowlist??x?.allowList??x?.allowlist,denyList:x?.pages?.denyList??x?.pages?.denylist??x?.denyList??x?.denylist};for(let[e,t]of Object.entries(ie)){let n=ho(e);(!S(n,{...oe,basePathPrefix:y})||!S(e,oe)||t?.prettyPath&&!S(t.prettyPath,oe))&&(delete ie[e],delete E.routes[e])}let se=Object.entries(ie);if(se.length===0)return{count:0,skipped:!0,reason:`Empty routes table`};let ce=JSON.stringify(E,null,2),k=D.join(u,`static-routing.json`);await P(u,{recursive:!0}),await I(k,ce,`utf8`);let le=JSON.stringify(E),j=D.join(u,`components/shadow-claw/shadow-claw.html`),ue=D.join(u,`components/shadow-claw-pages/shadow-claw-pages.html`),de=D.join(u,`components/shadow-claw-page-header/shadow-claw-page-header.html`),M=D.join(u,`components/shadow-claw/shadow-claw.css`),fe=D.join(u,`components/shadow-claw-pages/shadow-claw-pages.css`),me=D.join(u,`components/shadow-claw-page-header/shadow-claw-page-header.css`),[he,ge,ve,ye,be,xe,Se,Ce]=await Promise.all([F(te,`utf8`),F(j,`utf8`),F(ue,`utf8`).catch(()=>``),F(de,`utf8`).catch(()=>``),h(y,`desc`,{allowList:x?.pages?.allowList??x?.pages?.allowlist??x?.allowList??x?.allowlist,denyList:x?.pages?.denyList??x?.pages?.denylist??x?.denyList??x?.denylist}),F(M,`utf8`).catch(()=>``),F(fe,`utf8`).catch(()=>``),F(me,`utf8`).catch(()=>``)]),we=e.isProduction??A.env.NODE_ENV===`production`,Te=e.singleFile??!1,Ee=e.basePath===void 0?A.env.PAGES_BASE_PATH||``:e.basePath,De=e.pagesOrigin||A.env.PAGES_ORIGIN||``,Oe=C&&(we||e.basePath===void 0)?x?.branding?.siteUrl:void 0,ke=he.match(/<base\s+href="([^"]*)"/i),Ae=ke?ke[1]:`/`,je=Ee||De||Oe?$o({basePath:Ee,pagesOrigin:De,siteUrl:Oe,defaultBasePath:Ae}):Ae,Me=ke?es(he,Ee===``?je===`/`?Ae:je:Ee):he,Ne=(await Promise.all(be.map(async e=>{let t=typeof e.inlineContent==`string`?e.inlineContent:await F(e.absolutePath,`utf8`);return{...e,content:t}}))).filter(e=>!(e.displayPath.endsWith(`.md`)&&/^---\r?\n[\s\S]*?slug:\s*"shadow-claw--purge-pages"[\s\S]*?---/mu.test(e.content||``))),L=d(go(Me,le)),Pe=await l(L,u,{isProduction:we,singleFile:Te});await I(te,Pe,`utf8`);let Fe=p(ge),Ie=p(ve),Le=p(ye),Re=Ne.map(e=>({displayPath:e.displayPath,content:e.content})),ze=D.join(u,`static-main-manifest.json`),R={};try{R=JSON.parse(await F(ze,`utf8`))}catch{}let Be={pages:Re,...Array.isArray(R.skills)?{skills:R.skills}:{},...Array.isArray(R.tools)?{tools:R.tools}:{},...R.skillsPurgeId?{skillsPurgeId:R.skillsPurgeId}:{},...R.preRenderedStaticPages?{preRenderedStaticPages:R.preRenderedStaticPages}:{},...R.purgeId?{purgeId:R.purgeId}:{}};await I(ze,JSON.stringify(Be,null,2),`utf8`);try{if((await _e(y)).isDirectory()){let e=D.join(u,`static-main`);await P(e,{recursive:!0}),await N(y,e,{recursive:!0});let t=D.join(u,`files/main`);await P(t,{recursive:!0}),await N(y,t,{recursive:!0})}}catch{}let Ve=[],He=0;for(let[e,n]of se){if(!n||!n.prettyPath)continue;let p=ne(n.prettyPath);if(p===`feed`||p.startsWith(`feed/`)||e.endsWith(`.xml`))continue;let h=ho(e),v=Ne.find(e=>e.displayPath===h);if(!v)try{let e=D.join(y,h);v={absolutePath:e,displayPath:h,content:await F(e,`utf8`)}}catch{console.warn(`Could not find page file for route: ${e} (${h})`);continue}let te=Ne.filter(e=>e.displayPath!==v.displayPath),S=[],C=[];T===`all`?(S=[v,...te],C=S.map(e=>({displayPath:e.displayPath,content:e.content}))):typeof T==`number`&&(T===0?(S=[],C=[]):(S=[v,...te.slice(0,T-1)],C=S.map(e=>({displayPath:e.displayPath,content:e.content}))));let w=ee(v.content||``),re=w.data&&w.data.title?w.data.title:``,E=(x?.customElements?.scripts||[]).map(e=>typeof e==`string`?e:e?.src).filter(Boolean),ie=await a(v.content||``,v.displayPath,{approvedScripts:E}),O=x?.theme?.stylesheet,ae=``;if(typeof O==`string`&&O.trim()){let e=s(O.trim());ae=e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`)?e:e.replace(/^\/+/,``)}let oe;if(T===0)oe=o(Fe,xe,x.sidebar);else{let e=_(Ie,S,ie,Le,re,Se,Ce,ae);oe=f(Fe,e,xe,x.sidebar)}let se=c(Me,oe),ce=m(se),k=JSON.stringify({pages:C,...Array.isArray(R.skills)?{skills:R.skills}:{},...Array.isArray(R.tools)?{tools:R.tools}:{},...R.skillsPurgeId?{skillsPurgeId:R.skillsPurgeId}:{},...R.preRenderedStaticPages?{preRenderedStaticPages:R.preRenderedStaticPages}:{},...R.purgeId?{purgeId:R.purgeId}:{}}),A=t(ce,k),j=ne(n.prettyPath),ue=j===``||j===`index.html`||n.prettyPath===`/`,de=Me.match(/<base\s+href="([^"]*)"/i),M=de?de[1]:void 0,fe=x?.branding?.siteUrl||void 0,me=Co(A,{title:_o({pageTitle:n.title||w.data?.seo_title||w.data?.seoTitle||w.data?.title||hs(v.content||``),siteTitle:x?.site?.title||`ShadowClaw`,siteDescription:x?.site?.description,separator:x?.site?.titleSeparator??x?.site?.sep,titleTemplate:x?.site?.titleTemplate,isHome:ue}),description:n.description||w.data?.seo_description||w.data?.seoDescription||w.data?.description||w.data?.excerpt||w.data?.summary||vo(v.content||``,{fallback:x?.site?.description})||x?.site?.description,canonicalUrl:yo({origin:fe,basePath:M,prettyPath:n.prettyPath}),siteTitle:x?.site?.title||`ShadowClaw`,type:ue?`website`:`article`}),he=x?.customElements?.scripts||[],ge=r(he,w.data,v.content),_e=me;if(ge.length>0){let e=_e.match(/<head[^>]*>([\s\S]*?)<\/head>/i),t=e?e[1]:``,n=ge.filter(e=>!t.includes(`src="${e.src}"`)&&!t.includes(`src='${e.src}'`));if(n.length>0){let e=b(n);_e=i(_e,` ${e.trim()}`)}}let ve=d(go(_e,le)),ye=await l(ve,u,{isProduction:we,singleFile:Te}),be;be=j.endsWith(`.html`)?j:D.join(j,`index.html`);let Ee=D.join(u,be),De=D.dirname(Ee);if(await P(De,{recursive:!0}),await I(Ee,ye,`utf8`),v&&v.absolutePath)try{let e=D.dirname(v.absolutePath),t=await pe(e,{withFileTypes:!0});for(let n of t)n.isFile()&&!g(n.name)&&n.name!==`routes.json`&&await N(D.join(e,n.name),D.join(De,n.name))}catch(t){console.warn(`Failed to copy co-located assets for ${e}:`,t)}if(Ve.push(be.replace(/\\/g,`/`)),!j.endsWith(`.html`)&&j.length>0){let e=`${j}.html`,t=D.join(u,e);await P(D.dirname(t),{recursive:!0}),await I(t,ye,`utf8`),Ve.push(e.replace(/\\/g,`/`))}He++}return(e.silent??A.env.NODE_ENV===`test`)||console.log(`Prerendered ${He} pretty path page${He===1?``:`s`} from ${v} (prerender-pages: ${T}).`),{count:He,generatedPaths:Ve,skipped:!1}}async function _s(){let e=A.argv.slice(2).filter(e=>!e.startsWith(`--`)),t=A.argv.slice(2).filter(e=>e.startsWith(`--`)),n;for(let e of t)e.startsWith(`--prerender-pages=`)?n=e.slice(18):e.startsWith(`--pages=`)&&(n=e.slice(8));let r=e[0]||`dist/public`;await gs({publicDir:r,routesPath:e[1]||`pages/routes.json`,sourcePath:e[2]||`pages/main`,indexPath:e[3]||D.join(r,`index.html`),prerenderPages:n})}A.argv[1]&&D.resolve(A.argv[1])===D.resolve(k(import.meta.url))&&_s().catch(e=>{console.error(e),A.exit(1)});async function vs(t,{writeFileImpl:n=I}={}){let r=t||O(e(import.meta.url),`dist`,`public`);await n(O(r,`.nojekyll`),``,`utf-8`)}A.argv[1]&&D.resolve(A.argv[1])===D.resolve(k(import.meta.url))&&await vs();const ys=e(import.meta.url);async function $(e){try{return await _e(e),!0}catch{return!1}}async function bs(e,t){let n=[t?O(t,`package.json`):``,O(ys,`package.json`),O(e,`package.json`)].filter(Boolean);for(let e of n)if(await $(e))try{let t=JSON.parse(await F(e,`utf8`));if(t.name===`shadow-claw`&&t.version)return t.version}catch{}let r=O(e,`package.json`);if(await $(r))try{let e=JSON.parse(await F(r,`utf8`)),t=e.dependencies?.[`shadow-claw`]||e.devDependencies?.[`shadow-claw`];if(typeof t==`string`&&t.trim()){let e=t.replace(/^[~^>=<v\s]+/,``);if(e)return e}}catch{}return`latest`}async function xs(e){let{indexPath:t,mainSourcePath:n,contentRoot:r,toolchainRoot:a,cdnBase:o,isQuiet:s,log:c}=e;if(s||c(`Embedding pages, theme, and CDN runtime for single-file distribution...`),await $(t)){let s=await F(t,`utf8`),c=await lo([O(n,`theme.css`),O(r,`pages/main/theme.css`),O(r,`pages/theme.css`),O(r,`theme.css`)]);if(c)try{let e=await F(c,`utf8`);if(e.trim()&&!s.includes(`id="shadow-claw-theme"`)){let t=`<style id="shadow-claw-theme">\n${e.trim()}\n</style>`;s=i(s,` ${t}`)}}catch{}try{let e=await h(n),t=[];for(let n of e){let e=null;if(typeof n.inlineContent==`string`?e=n.inlineContent:n.absolutePath&&await $(n.absolutePath)&&(e=await F(n.absolutePath,`utf8`)),typeof e==`string`){let r=/^memory\.(md|markdown)$/iu.test(n.displayPath)&&e.trim()===x.trim(),i=n.displayPath===`index.html`&&e.trim()===te.trim();r||i?t.push(`<!-- prettier-ignore -->\n <script type="text/markdown" data-shadow-claw-page="${n.displayPath}"><\/script>`):t.push(`<!-- prettier-ignore -->\n <script type="text/markdown" data-shadow-claw-page="${n.displayPath}">${e}<\/script>`)}}t.length>0&&(s=i(s,` ${t.join(`
134
- `)}`))}catch{}let l=o||j.SHADOWCLAW_CDN;l||=`https://cdn.jsdelivr.net/npm/shadow-claw@${await bs(r,a)}`,l=l.replace(/\/+$/,``);let u=`${l}/dist/public/`;s=s.includes(`name="shadow-claw-asset-base"`)?s.replace(/<meta\s+name="shadow-claw-asset-base"[^>]*>/i,`<meta name="shadow-claw-asset-base" content="${u}" />`):/<base\s+href="[^"]*"\s*\/?>/i.test(s)?s.replace(/(<base\s+href="[^"]*"\s*\/?>)/i,`$1\n <meta name="shadow-claw-asset-base" content="${u}" />`):i(s,` <meta name="shadow-claw-asset-base" content="${u}" />`),s=s.replace(/<script\b[^>]*>\s*var\s+ShadowClawThemeInit\b[\s\S]*?<\/script>/giu,`<script src="${u}theme-init.js"><\/script>`),s=s.replace(/<script\s+src="[^"]*?theme-init\.js"><\/script>/gi,`<script src="${u}theme-init.js"><\/script>`),s=/index\.css/i.test(s)?s.replace(/<link\b([^>]*?)href="[^"]*?index\.css"([^>]*?)\/?>/gi,`<link$1href="${u}index.css"$2 />`):i(s,` <link rel="stylesheet" href="${u}index.css" />`);let d=e.siteConfig;if(!d&&e.siteConfigPath&&await $(e.siteConfigPath))try{d=JSON.parse(await F(e.siteConfigPath,`utf8`))}catch{}let f=d?.branding||{},p=d?.pwa||{},m=f.siteUrl||e.pagesOrigin,g=typeof m==`string`&&m.trim()?m.trim().replace(/\/*$/,`/`):``,_=(p.manifestPath||f.manifestPath||`manifest.json`).replace(/^\/+/,``),v=g?`${g}${_}`:`${u}manifest.json`;s=s.replace(/<link\b[^>]*\b(?:href="[^"]*?manifest\.json"|rel=["']?manifest["']?)[^>]*\/?>/giu,`<link rel="manifest" href="${v}" />`);let y=(f.faviconPath||`assets/icons/favicon.ico`).replace(/^\/+/,``).replace(/^pages\/main\//,``),b=g?`${g}${y}`:`${u}assets/icons/favicon.ico`,ee=y.endsWith(`.svg`)?`image/svg+xml`:y.endsWith(`.png`)?`image/png`:`image/x-icon`,S=!1;s=s.replace(/<link\b[^>]*\brel=["']?(?:shortcut\s+)?icon["']?[^>]*\/?>/giu,()=>S?``:(S=!0,`<link rel="icon" href="${b}" type="${ee}" />`)),S||(s=i(s,` <link rel="icon" href="${b}" type="${ee}" />`));let C=(f.appleTouchIconPath||`assets/icons/180.png`).replace(/^\/+/,``).replace(/^pages\/main\//,``),ne=g?`${g}${C}`:`${u}assets/icons/180.png`,w=!1;if(s=s.replace(/<link\b[^>]*\brel=["']?apple-touch-icon["']?[^>]*\/?>/giu,()=>w?``:(w=!0,`<link rel="apple-touch-icon" href="${ne}" />`)),!w&&g&&(s=i(s,` <link rel="apple-touch-icon" href="${ne}" />`)),s=s.replace(/\s*<script\s+type="module"\s+src="(?:\.\/|\/)?index\.js"><\/script>/gi,``),s=s.replace(/\s*<script\s+type="module"\s+src="(?:\.\/|\/)?service-worker\/init\.js"><\/script>/gi,``),s.includes(`<script type="importmap">`))s=s.replace(/"shadow-claw":\s*"[^"]*?\/dist\/lib\/index\.js"/g,`"shadow-claw": "${l}/dist/lib/index.js"`),s=s.replace(/"shadow-claw\/":\s*"[^"]*?"/g,`"shadow-claw/": "${l}/"`);else{let e=[` <!-- Import Map -->`,` <script type="importmap">`,` {`,` "imports": {`,` "shadow-claw": "${l}/dist/lib/index.js",`,` "shadow-claw/": "${l}/"`,` }`,` }`,` <\/script>`,` <!-- ShadowClaw Library Module -->`,` <script type="module">`,` import "shadow-claw";`,` <\/script>`].join(`
135
- `);s=i(s,e)}if(!s.includes(`data-shadow-claw-dedent="true"`)){let e=[` <!-- Dedent embedded markdown scripts if indented by formatters (e.g. Prettier) -->`,` <script data-shadow-claw-dedent="true">`,` for (const el of document.querySelectorAll('script[type="text/markdown"][data-shadow-claw-page]')) {`,` const text = el.textContent || '';`,` const m = text.match(/^\\r?\\n([ \\t]+)/);`,` if (m) {`,` const indent = m[1].length;`," const regex = new RegExp(`^[ \\\\t]{1,${indent}}`, 'gm');",` el.textContent = text.replace(/^\\r?\\n/, '').replace(regex, '').replace(/\\r?\\n[ \\t]*$/, '\\n');`,` }`,` }`,` <\/script>`].join(`
136
- `);s=i(s,e)}if(!s.includes(`data-shadow-claw-opfs-cleanup="true"`)){let e=[` <!-- Self-heal stale pre-seeded OPFS files with leading whitespace before frontmatter -->`,` <script data-shadow-claw-opfs-cleanup="true">`,` (async () => {`,` try {`,` if (!navigator.storage?.getDirectory) return;`,` const root = await navigator.storage.getDirectory();`,` const scDir = await root.getDirectoryHandle("shadowclaw", { create: false }).catch(() => null);`,` if (!scDir) return;`,` const groupsDir = await scDir.getDirectoryHandle("groups", { create: false }).catch(() => null);`,` if (!groupsDir) return;`,` for await (const [, grp] of groupsDir.entries()) {`,` if (grp.kind !== "directory") continue;`,` async function cleanDir(dir) {`,` for await (const [name, handle] of dir.entries()) {`,` if (handle.kind === "directory") {`,` await cleanDir(handle);`,` } else if (handle.kind === "file") {`,` try {`,` const file = await handle.getFile();`,` const text = await file.text();`,` if (/^(?:\\r?\\n)+[ \\t]*---/.test(text) || /^[ \\t]+---/.test(text)) {`,` await dir.removeEntry(name);`,` }`,` } catch {}`,` }`,` }`,` }`,` await cleanDir(grp);`,` }`,` } catch {}`,` })();`,` <\/script>`].join(`
137
- `);s=i(s,e)}await I(t,s,`utf8`)}}async function Ss(e={}){let t=process.env.NODE_ENV;try{let t=e.quiet??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE),n=e.stdio??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE?`pipe`:`inherit`),r=(...e)=>{t||console.log(...e)},i=se(e.contentRoot||j.SHADOWCLAW_CONTENT_ROOT||process.cwd()),a=se(e.toolchainRoot||ys),o=i===a,{isProduction:s,copyAllAssets:c,prerenderPages:l,prerenderMainMemory:d}=mo({...j,...e.isProduction===void 0?{}:{NODE_ENV:e.isProduction?`production`:`development`},...e.copyAllAssets===void 0?{}:{COPY_ALL_ASSETS:String(e.copyAllAssets)},...e.prerenderPages===void 0?{}:{PRERENDER_PAGES:String(e.prerenderPages)},...e.prerenderMainMemory===void 0?{}:{PRERENDER_MAIN_MEMORY:String(e.prerenderMainMemory)}});s?process.env.NODE_ENV=`production`:e.isProduction===!1&&(process.env.NODE_ENV=`development`);async function f(e,r={}){!t&&!r.quiet&&console.log(`> ${e}`);let i=r.stdio??n,a={...process.env,...s?{NODE_ENV:`production`}:{},...r.env||{}};de(e,{stdio:i,...r,env:a})}if(o){if(le(ys),await oo(`dist/public`),await P(`dist/public/assets`,{recursive:!0}),c)await N(`assets`,`dist/public`,{recursive:!0});else{await N(`assets/icons`,`dist/public/assets/icons`,{recursive:!0}),await N(`assets/screenshots`,`dist/public/assets/screenshots`,{recursive:!0});try{await N(`assets/fonts`,`dist/public/assets/fonts`,{recursive:!0})}catch{}}await so([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],`dist/public`);for(let e of uo())await co(e.sources,e.dest,e.opts||{});try{await N(`e2e/README.md`,`dist/public/e2e/README.md`)}catch{}try{await N(`pages`,`dist/public/pages`,{recursive:!0})}catch{}try{await N(`pages/main`,`dist/public/files/main`,{recursive:!0})}catch{}let n;try{let{isTestFileOrDir:e}=await import(`./chunk-CGoE4llV.js`);n=t=>!e(ie(t),t)}catch{}try{await N(`pages/main`,`dist/public/static-main`,{recursive:!0})}catch{}try{let{migrateLegacyWorkspaceLayout:e}=await import(`./chunk-CeuR-KKG.js`);await e(process.cwd())}catch{}try{await N(`.agents/skills`,`dist/public/.agents/skills`,{recursive:!0,...n?{filter:n}:{}})}catch{}try{await N(`.agents/tools`,`dist/public/.agents/tools`,{recursive:!0,...n?{filter:n}:{}})}catch{}try{await N(`.agents/scripts`,`dist/public/.agents/scripts`,{recursive:!0,...n?{filter:n}:{}})}catch{}if(await $(`.agents/skills`))try{let{generateSkillsIndex:e}=await import(`./chunk-CGoE4llV.js`);await e(ys)}catch(e){console.warn(`Notice: Failed to auto-generate agent-skills index:`,e)}if(await $(`.well-known`))try{await N(`.well-known`,`dist/public/.well-known`,{recursive:!0,force:!0})}catch{}await f(`npm run -s rolldown`);let o=await lo(po()),p=o||`pages/site-config.json`,m;if(o)try{m=JSON.parse(await F(o,`utf8`))}catch{}let h=e.pagesOrigin||j.PAGES_ORIGIN,g=s?$o({basePath:e.basePath||j.PAGES_BASE_PATH,pagesOrigin:h,siteUrl:m?.branding?.siteUrl,defaultBasePath:`/shadow-claw/`}):e.basePath||j.PAGES_BASE_PATH||`/`;d?await u({indexPath:`dist/public/index.html`,sourcePath:`pages/main`,prerenderPages:l,siteConfigPath:p,isProduction:s,singleFile:e.singleFile}):await u({indexPath:`dist/public/index.html`,noSeed:!0,siteConfigPath:p,isProduction:s,singleFile:e.singleFile});try{await ps(`dist/public`,p,{basePath:g,pagesOrigin:h,isProduction:s})}catch{}try{let e=JSON.parse(await F(`package.json`,`utf8`));if(e.version){let t=`dist/public/index.html`,n=await F(t,`utf8`);await I(t,n.replace(/<meta\s+name="version"[^>]*>/,`<meta name="version" content="${e.version}" />`),`utf8`);for(let t of[`.well-known/mcp.json`,`.well-known/mcp/server-card.json`]){let n=O(`dist/public`,t);if(await $(n))try{let t=JSON.parse(await F(n,`utf8`));t.version!==e.version&&(t.version=e.version,await I(n,JSON.stringify(t,null,2)+`
138
- `,`utf8`))}catch{}}}}catch{}try{let e=`dist/public/index.html`,t=await F(e,`utf8`);await I(e,es(t,g),`utf8`);let n=`dist/public/share/share-target.html`;if(await $(n)){let e=await F(n,`utf8`);await I(n,es(e,g),`utf8`)}}catch{}if(s){if(r(`Running production post-build steps...`),r(` PAGES_ORIGIN : ${h||`(relative ./)`}`),r(` PAGES_BASE_PATH: ${g}`),h)try{let e=`dist/public/manifest.json`,t=await F(e,`utf8`),n=JSON.parse(t);n.start_url&&(n.start_url=h,await I(e,JSON.stringify(n,null,2),`utf8`))}catch{}await vs(`dist/public`);let e=``;try{e=de(`npm run -s build:pkg:get:meta`,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{}e&&await f(`npm run -s build:pkg:meta "${e}"`)}await gs({publicDir:`dist/public`,routesPath:await lo(fo())||`pages/routes.json`,sourcePath:`pages/main`,prerenderPages:l,siteConfigPath:p,basePath:g,pagesOrigin:h,isProduction:s,singleFile:e.singleFile}),await f(`npm run -s build:service-worker`);let _=`dist/public/service-worker.js`;if(await $(_)&&await re(_,{logImpl:()=>{}}),s)try{let{precompressAssets:e}=await import(`./chunk-Cwpkwpa9.js`),n=await e(`dist/public`,{silent:t});!t&&n.count>0&&r(`Pre-compressed ${n.count} assets (.br and .gz).`)}catch(e){t||console.warn(`Notice: Asset pre-compression encountered an issue:`,e)}e.singleFile&&await xs({indexPath:`dist/public/index.html`,mainSourcePath:`pages/main`,contentRoot:i,toolchainRoot:a,cdnBase:e.cdn,siteConfig:m,siteConfigPath:p,pagesOrigin:h,isQuiet:t,log:r}),r(`Build completed successfully.`);return}let p=e.outDir||`dist/public`,m=se(i,p);await oo(m),await P(m,{recursive:!0}),await P(O(m,`assets`),{recursive:!0});let h=O(a,`dist/public`);await $(O(h,`index.js`))||(r(`Building ShadowClaw core toolchain...`),await oo(O(a,`dist/public`)),await oo(O(a,`dist-electron`)),await f(`npm run -s rolldown`,{cwd:a})),await N(h,m,{recursive:!0,filter:e=>{if(e.includes(`/assets/cache/`)||e.includes(`\\assets\\cache\\`)||e.includes(`/.cache/`)||e.includes(`\\.cache\\`)||e.includes(`/cache/`)||e.includes(`\\cache\\`)||e.endsWith(`/cache`)||e.endsWith(`\\cache`))return!1;if(i!==a){let t=oe(h,e).replace(/\\/g,`/`);if(t===`docs`||t.startsWith(`docs/`)||t===`main`||t.startsWith(`main/`)||t===`main.html`||t.startsWith(`main.html.`)||t===`static-main`||t.startsWith(`static-main/`)||t===`static-main-manifest.json`||t.startsWith(`static-main-manifest.json.`)||t===`static-routing.json`||t.startsWith(`static-routing.json.`)||t===`files`||t.startsWith(`files/`)||t===`pages`||t.startsWith(`pages/`)||t===`sitemap.xml`||t.startsWith(`sitemap.xml.`)||t===`sitemap.txt`||t.startsWith(`sitemap.txt.`)||t===`llms.txt`||t.startsWith(`llms.txt.`)||t===`README.md`||t.startsWith(`README.md.`)||t===`AGENTS.md`||t.startsWith(`AGENTS.md.`))return!1}return!0}}),i!==a&&(await oo(O(m,`sitemap.xml`)),await oo(O(m,`sitemap.txt`)));let g=O(a,`assets`);if(i!==a&&await $(g)){let e=O(g,`icons`);await $(e)&&await N(e,O(m,`assets/icons`),{recursive:!0,force:!1,errorOnExist:!1});let t=O(g,`screenshots`);await $(t)&&await N(t,O(m,`assets/screenshots`),{recursive:!0,force:!1,errorOnExist:!1});let n=O(g,`fonts`);await $(n)&&await N(n,O(m,`assets/fonts`),{recursive:!0,force:!1,errorOnExist:!1})}let _=O(i,`assets`);await $(_)&&(c?await N(_,m,{recursive:!0,force:!0}):(await $(O(_,`icons`))&&await N(O(_,`icons`),O(m,`assets/icons`),{recursive:!0,force:!0}),await $(O(_,`screenshots`))&&await N(O(_,`screenshots`),O(m,`assets/screenshots`),{recursive:!0,force:!0}),await $(O(_,`fonts`))&&await N(O(_,`fonts`),O(m,`assets/fonts`),{recursive:!0,force:!0}))),await so([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],m,{baseDir:i});let v=uo({contentRoot:i,toolchainRoot:a,distPublicDir:m});for(let e of v)await co(e.sources,e.dest,e.opts||{});let y=O(i,`pages`);await $(y)&&await N(y,O(m,`pages`),{recursive:!0,force:!0});let b=O(i,`pages/main`);await $(b)&&(await N(b,O(m,`files/main`),{recursive:!0,force:!0}),await N(b,O(m,`static-main`),{recursive:!0,force:!0}));try{let{migrateLegacyWorkspaceLayout:e}=await import(`./chunk-CeuR-KKG.js`);await $(O(i,`.agents`))&&await e(i),i!==a&&await $(O(a,`.agents`))&&await e(a)}catch{}let ee=O(i,`.agents/skills`);await $(ee)&&await N(ee,O(m,`.agents/skills`),{recursive:!0,force:!0});let te=O(a,`.agents/skills`);i!==a&&await $(te)&&await N(te,O(m,`.agents/skills`),{recursive:!0,force:!1,errorOnExist:!1});let x=O(i,`.agents/tools`);if(await $(x))await N(x,O(m,`.agents/tools`),{recursive:!0,force:!0});else{let e=O(a,`.agents/tools`);await $(e)&&await N(e,O(m,`.agents/tools`),{recursive:!0,force:!0})}let S=O(i,`.agents/scripts`);if(await $(S))await N(S,O(m,`.agents/scripts`),{recursive:!0,force:!0});else{let e=O(a,`.agents/scripts`);await $(e)&&await N(e,O(m,`.agents/scripts`),{recursive:!0,force:!0})}let C=O(a,`.well-known`);await $(C)&&await N(C,O(m,`.well-known`),{recursive:!0,force:!0});let ne=O(i,`.well-known`);if(i!==a&&await $(ne)&&await N(ne,O(m,`.well-known`),{recursive:!0,force:!0}),await $(O(m,`.agents/skills`)))try{let{generateSkillsIndex:e}=await import(`./chunk-CGoE4llV.js`);if(await e(m,{metadataRoot:i,outDir:`.well-known/agent-skills`,toolchainRoot:a,includeBundled:!0}),await $(ee))try{await e(i,{toolchainRoot:a,includeBundled:!0})}catch{}}catch(e){console.warn(`Notice: Failed to auto-generate agent-skills index:`,e)}let w=await lo(po(i)),T=w||O(i,`pages/site-config.json`),E=d,D;if(w)try{D=JSON.parse(await F(w,`utf8`))}catch{}e.prerenderMainMemory===void 0&&D&&(D?.settings?.prerenderMainMemory===!1?(E=!1,r(` site-config: prerenderMainMemory=false — pages DSD pre-rendering disabled.`)):D?.settings?.overridePrerenderSkeleton===!1&&r(` site-config: overridePrerenderSkeleton=false — skeleton overlay disabled.`));let ae=O(m,`index.html`),ce=await $(b);E&&(ce||e.singleFile)?await u({indexPath:ae,sourcePath:ce?b:O(a,`pages/main`),prerenderPages:l,siteConfigPath:T,isProduction:s,singleFile:e.singleFile}):await u({indexPath:ae,noSeed:!0,siteConfigPath:T,isProduction:s,singleFile:e.singleFile});let k=e.pagesOrigin||j.PAGES_ORIGIN,A=s?$o({basePath:e.basePath||j.PAGES_BASE_PATH,pagesOrigin:k,siteUrl:D?.branding?.siteUrl,defaultBasePath:`/`}):e.basePath||j.PAGES_BASE_PATH||`/`;try{await ps(m,T,{basePath:A,pagesOrigin:k,isProduction:s})}catch{}try{let e=await F(ae,`utf8`);e=es(e,A);let t=``;try{let e=await lo([O(i,`package.json`),O(a,`package.json`)]);e&&(t=JSON.parse(await F(e,`utf8`)).version||``)}catch{}if(t){e=e.replace(/<meta\s+name="version"[^>]*>/,`<meta name="version" content="${t}" />`);for(let e of[`.well-known/mcp.json`,`.well-known/mcp/server-card.json`]){let n=O(m,e);if(await $(n))try{let e=JSON.parse(await F(n,`utf8`));e.version!==t&&(e.version=t,await I(n,JSON.stringify(e,null,2)+`
139
- `,`utf8`))}catch{}}}await I(ae,e,`utf8`);let n=O(m,`share/share-target.html`);if(await $(n)){let e=await F(n,`utf8`);await I(n,es(e,A),`utf8`)}}catch{}if(s){if(r(`Running production post-build steps...`),r(` PAGES_ORIGIN : ${k||`(relative ./)`}`),r(` PAGES_BASE_PATH: ${A}`),k)try{let e=O(m,`manifest.json`),t=await F(e,`utf8`),n=JSON.parse(t);n.start_url&&(n.start_url=k,await I(e,JSON.stringify(n,null,2),`utf8`))}catch{}await I(O(m,`.nojekyll`),``,`utf8`);let e=``;try{e=de(`git rev-parse HEAD`,{cwd:i,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{try{e=de(`git rev-parse HEAD`,{cwd:a,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{}}if(e){let t=await F(ae,`utf8`);await I(ae,t.replace(/<meta\s+name="revision"[^>]*>/,`<meta name="revision" content="${e}" />`),`utf8`)}}let ue=await lo(fo(i))||O(i,`pages/routes.json`),M=await $(b)?b:O(a,`pages/main`);await gs({publicDir:m,routesPath:ue,sourcePath:M,prerenderPages:l,siteConfigPath:T,basePath:A,pagesOrigin:k,isProduction:s,singleFile:e.singleFile});let fe=O(m,`service-worker.js`);if(await $(fe)&&await re(fe,{logImpl:()=>{}}),s)try{let{precompressAssets:e}=await import(`./chunk-Cwpkwpa9.js`),n=await e(m,{silent:t});!t&&n.count>0&&r(`Pre-compressed ${n.count} assets (.br and .gz).`)}catch(e){t||console.warn(`Notice: Asset pre-compression encountered an issue:`,e)}e.singleFile&&await xs({indexPath:O(m,`index.html`),mainSourcePath:M,contentRoot:i,toolchainRoot:a,cdnBase:e.cdn,siteConfig:D,siteConfigPath:T,pagesOrigin:k,isQuiet:t,log:r}),r(`Build completed successfully.`)}finally{t===void 0?delete process.env.NODE_ENV:process.env.NODE_ENV=t}}process.argv[1]&&se(process.argv[1])===se(k(import.meta.url))&&Ss().catch(e=>{console.error(e),ue(1)});export{Ss as t};