kennel 0.2.1 → 0.2.2

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 (872) hide show
  1. package/README.md +18 -5
  2. package/dist/cli/dispatch.js +9 -0
  3. package/dist/cli/src/automations/notifications.d.ts +40 -0
  4. package/dist/cli/src/automations/notifications.js +220 -0
  5. package/dist/cli/src/cli/dispatch.d.ts +1 -0
  6. package/dist/cli/src/cli/dispatch.js +125 -0
  7. package/dist/cli/src/cli/usage.d.ts +1 -0
  8. package/dist/cli/src/cli/usage.js +25 -0
  9. package/dist/cli/src/core/api-client.d.ts +13 -0
  10. package/dist/cli/src/core/api-client.js +1 -0
  11. package/dist/cli/src/core/command.d.ts +1 -0
  12. package/dist/cli/src/core/command.js +69 -0
  13. package/dist/cli/src/core/core-folders.d.ts +1 -0
  14. package/dist/cli/src/core/core-folders.js +42 -0
  15. package/dist/cli/src/core/init.d.ts +1 -0
  16. package/dist/cli/src/core/init.js +141 -0
  17. package/dist/cli/src/core/runtime.d.ts +14 -0
  18. package/dist/cli/src/core/runtime.js +1 -0
  19. package/dist/cli/src/deploy/cloudflare.d.ts +6 -0
  20. package/dist/cli/src/deploy/cloudflare.js +100 -0
  21. package/dist/cli/src/deploy/environment.d.ts +2 -0
  22. package/dist/cli/src/deploy/environment.js +47 -0
  23. package/dist/cli/src/deploy/smoke-tests.d.ts +4 -0
  24. package/dist/cli/src/deploy/smoke-tests.js +92 -0
  25. package/dist/cli/src/deploy/trigger-dev.d.ts +2 -0
  26. package/dist/cli/src/deploy/trigger-dev.js +255 -0
  27. package/dist/cli/src/deploy/vercel.d.ts +3 -0
  28. package/dist/cli/src/deploy/vercel.js +67 -0
  29. package/dist/cli/src/main.d.ts +1 -0
  30. package/dist/cli/src/main.js +9 -0
  31. package/dist/cli/src/mcp/agent-tools.d.ts +8 -0
  32. package/dist/cli/src/mcp/agent-tools.js +247 -0
  33. package/dist/cli/src/mcp/config.d.ts +25 -0
  34. package/dist/cli/src/mcp/config.js +185 -0
  35. package/dist/cli/src/mcp/function-source.d.ts +7 -0
  36. package/dist/cli/src/mcp/function-source.js +42 -0
  37. package/dist/cli/src/mcp/generate.d.ts +1 -0
  38. package/dist/cli/src/mcp/generate.js +47 -0
  39. package/dist/cli/src/mcp/install-page.d.ts +12 -0
  40. package/dist/cli/src/mcp/install-page.js +5 -0
  41. package/dist/cli/src/notifications/email-worker.d.ts +8 -0
  42. package/dist/cli/src/notifications/email-worker.js +137 -0
  43. package/dist/cli/src/package/mcp-data.d.ts +1 -0
  44. package/dist/cli/src/package/mcp-data.js +1 -0
  45. package/dist/cli/src/package/mcp-email-worker.d.ts +1 -0
  46. package/dist/cli/src/package/mcp-email-worker.js +1 -0
  47. package/dist/cli/src/package/mcp-http.d.ts +1 -0
  48. package/dist/cli/src/package/mcp-http.js +1 -0
  49. package/dist/cli/src/package/mcp-stdio.d.ts +1 -0
  50. package/dist/cli/src/package/mcp-stdio.js +1 -0
  51. package/dist/cli/src/package/mcp.d.ts +1 -0
  52. package/dist/cli/src/package/mcp.js +1 -0
  53. package/dist/cli/src/package/preview.d.ts +9 -0
  54. package/dist/cli/src/package/preview.js +1 -0
  55. package/dist/cli/src/plugins/external.d.ts +36 -0
  56. package/dist/cli/src/plugins/external.js +503 -0
  57. package/dist/cli/src/publish/cloudflare-init.d.ts +12 -0
  58. package/dist/cli/src/publish/cloudflare-init.js +101 -0
  59. package/dist/cli/src/publish/config.d.ts +28 -0
  60. package/dist/cli/src/publish/config.js +178 -0
  61. package/dist/cli/src/publish/options.d.ts +13 -0
  62. package/dist/cli/src/publish/options.js +78 -0
  63. package/dist/cli/src/publish/vercel-init.d.ts +9 -0
  64. package/dist/cli/src/publish/vercel-init.js +52 -0
  65. package/dist/cli/src/shared/json.d.ts +4 -0
  66. package/dist/cli/src/shared/json.js +56 -0
  67. package/dist/cli/src/shared/object.d.ts +2 -0
  68. package/dist/cli/src/shared/object.js +3 -0
  69. package/dist/cli/src/shared/package-manager.d.ts +11 -0
  70. package/dist/cli/src/shared/package-manager.js +39 -0
  71. package/dist/cli/src/shared/path.d.ts +4 -0
  72. package/dist/cli/src/shared/path.js +40 -0
  73. package/dist/cli/src/shared/process.d.ts +7 -0
  74. package/dist/cli/src/shared/process.js +12 -0
  75. package/dist/cli/src/shared/project-config.d.ts +2 -0
  76. package/dist/cli/src/shared/project-config.js +26 -0
  77. package/dist/cli/src/site/dev.d.ts +10 -0
  78. package/dist/cli/src/site/dev.js +126 -0
  79. package/dist/cli/src/site/extension.d.ts +8 -0
  80. package/dist/cli/src/site/extension.js +113 -0
  81. package/dist/cli/src/site/folder-icons.d.ts +46 -0
  82. package/dist/cli/src/site/folder-icons.js +86 -0
  83. package/dist/cli/src/site/hot-viewer.d.ts +2 -0
  84. package/dist/cli/src/site/hot-viewer.js +231 -0
  85. package/dist/cli/src/site/kinds.d.ts +1 -0
  86. package/dist/cli/src/site/kinds.js +1 -0
  87. package/dist/cli/src/site/mail.d.ts +1 -0
  88. package/dist/cli/src/site/mail.js +10 -0
  89. package/dist/cli/src/site/renderers.d.ts +61 -0
  90. package/dist/cli/src/site/renderers.js +219 -0
  91. package/dist/cli/src/site/server-plugins.d.ts +54 -0
  92. package/dist/cli/src/site/server-plugins.js +1 -0
  93. package/dist/cli/src/site/viewer.d.ts +36 -0
  94. package/dist/cli/src/site/viewer.js +352 -0
  95. package/dist/cli/src/site/vitepress.d.ts +1 -0
  96. package/dist/cli/src/site/vitepress.js +1 -0
  97. package/dist/cli/usage.js +1 -0
  98. package/dist/core/api-client.js +75 -44
  99. package/dist/core/command.js +6 -3
  100. package/dist/core/core-folders.js +38280 -33
  101. package/dist/core/init.js +59 -4
  102. package/dist/core/runtime.js +57163 -41853
  103. package/dist/package/preview.js +40589 -17894
  104. package/dist/plugins/external.d.ts +36 -0
  105. package/dist/plugins/external.js +503 -0
  106. package/dist/site/server-plugins.js +394 -59
  107. package/dist/site/viewer.js +18 -5
  108. package/kernel/apps/web/.env.example +11 -0
  109. package/kernel/apps/web/components.json +20 -0
  110. package/kernel/apps/web/eslint.config.mjs +60 -0
  111. package/kernel/apps/web/index.html +17 -0
  112. package/kernel/apps/web/package.json +79 -0
  113. package/kernel/apps/web/public/favicon.svg +6 -0
  114. package/kernel/apps/web/public/providers/claude.svg +1 -0
  115. package/kernel/apps/web/public/providers/codex.svg +1 -0
  116. package/kernel/apps/web/public/providers/cursor.svg +1 -0
  117. package/kernel/apps/web/public/providers/opencode.svg +1 -0
  118. package/kernel/apps/web/public/providers/pi.svg +1 -0
  119. package/kernel/apps/web/server/acp/index.ts +1 -0
  120. package/kernel/apps/web/server/acp/live-agent-connection.ts +1 -0
  121. package/kernel/apps/web/server/acp/process-manager.ts +1 -0
  122. package/kernel/apps/web/server/acp/registry.ts +1 -0
  123. package/kernel/apps/web/server/acp/sdk.ts +1 -0
  124. package/kernel/apps/web/server/acp/transport.ts +1 -0
  125. package/kernel/apps/web/server/acp/types.ts +1 -0
  126. package/kernel/apps/web/server/acp-live-plugin.ts +30 -0
  127. package/kernel/apps/web/server/api/document-edit.ts +1 -0
  128. package/kernel/apps/web/server/api/open-path.ts +1 -0
  129. package/kernel/apps/web/server/core-plugin.ts +49 -0
  130. package/kernel/apps/web/server/folder-favicon.ts +1 -0
  131. package/kernel/apps/web/server/folder-icons.ts +1 -0
  132. package/kernel/apps/web/server/folder-metadata-plugin.ts +31 -0
  133. package/kernel/apps/web/server/plugins.ts +1 -0
  134. package/kernel/apps/web/server/preview-kinds.ts +1 -0
  135. package/kernel/apps/web/src/ai-input.tsx +62 -0
  136. package/kernel/apps/web/src/annotations.tsx +430 -0
  137. package/kernel/apps/web/src/api/client.ts +3 -0
  138. package/kernel/apps/web/src/api/errors.ts +1 -0
  139. package/kernel/apps/web/src/api/events.ts +42 -0
  140. package/kernel/apps/web/src/app.css +332 -0
  141. package/kernel/apps/web/src/app.tsx +667 -0
  142. package/kernel/apps/web/src/ask-draft.ts +164 -0
  143. package/kernel/apps/web/src/ask-tray.tsx +256 -0
  144. package/kernel/apps/web/src/comment-editor.tsx +93 -0
  145. package/kernel/apps/web/src/comment-form.tsx +162 -0
  146. package/kernel/apps/web/src/copy-path.ts +18 -0
  147. package/kernel/apps/web/src/deferred-ask-tray.tsx +20 -0
  148. package/kernel/apps/web/src/document-url.ts +46 -0
  149. package/kernel/apps/web/src/documents-url.ts +23 -0
  150. package/kernel/apps/web/src/dropped-folder.ts +64 -0
  151. package/kernel/apps/web/src/external-plugins.ts +3 -0
  152. package/kernel/apps/web/src/file-viewer.tsx +171 -0
  153. package/kernel/apps/web/src/folder-filter-icons.tsx +39 -0
  154. package/kernel/apps/web/src/folder-metadata.ts +76 -0
  155. package/kernel/apps/web/src/folder-plugin-view.tsx +87 -0
  156. package/kernel/apps/web/src/folder-query-cache.ts +66 -0
  157. package/kernel/apps/web/src/host-adapters.ts +209 -0
  158. package/kernel/apps/web/src/host-bridge.ts +214 -0
  159. package/kernel/apps/web/src/lib/entity-folder.ts +2 -0
  160. package/kernel/apps/web/src/linked-session-header.tsx +43 -0
  161. package/kernel/apps/web/src/live-session-controls.tsx +326 -0
  162. package/kernel/apps/web/src/local-source.ts +32 -0
  163. package/kernel/apps/web/src/main.tsx +24 -0
  164. package/kernel/apps/web/src/markdown-page.tsx +444 -0
  165. package/kernel/apps/web/src/notes-page.tsx +103 -0
  166. package/kernel/apps/web/src/plugins.ts +53 -0
  167. package/kernel/apps/web/src/project-search-dialog.tsx +257 -0
  168. package/kernel/apps/web/src/project-search.ts +18 -0
  169. package/kernel/apps/web/src/query-client.ts +4 -0
  170. package/kernel/apps/web/src/rehype-source-lines.ts +22 -0
  171. package/kernel/apps/web/src/routes/document.tsx +1 -0
  172. package/kernel/apps/web/src/routes/entities.tsx +277 -0
  173. package/kernel/apps/web/src/routes/search.tsx +60 -0
  174. package/kernel/apps/web/src/selection-context.ts +68 -0
  175. package/kernel/apps/web/src/selection-input.tsx +58 -0
  176. package/kernel/apps/web/src/selection-popup.tsx +155 -0
  177. package/kernel/apps/web/src/session-transcript-page.tsx +152 -0
  178. package/kernel/apps/web/src/use-annotations.ts +162 -0
  179. package/kernel/apps/web/src/use-ask-ai.ts +26 -0
  180. package/kernel/apps/web/src/use-ask-draft.ts +27 -0
  181. package/kernel/apps/web/src/use-document.ts +37 -0
  182. package/kernel/apps/web/src/use-folder-notes.ts +49 -0
  183. package/kernel/apps/web/src/use-linked-session.ts +33 -0
  184. package/kernel/apps/web/src/view-context.tsx +69 -0
  185. package/kernel/apps/web/src/view-header.tsx +66 -0
  186. package/kernel/apps/web/src/viewer-capabilities.ts +33 -0
  187. package/kernel/apps/web/src/viewer-route.ts +1 -0
  188. package/kernel/apps/web/src/viewport-height.ts +33 -0
  189. package/kernel/apps/web/tsconfig.json +24 -0
  190. package/kernel/apps/web/vite.config.ts +252 -0
  191. package/kernel/packages/agents/eslint.config.js +10 -0
  192. package/kernel/packages/agents/package.json +75 -0
  193. package/kernel/packages/agents/src/agent-card.tsx +334 -0
  194. package/kernel/packages/agents/src/client.tsx +13 -0
  195. package/kernel/packages/agents/src/index.ts +18 -0
  196. package/kernel/packages/agents/src/manifest.ts +7 -0
  197. package/kernel/packages/agents/src/node.ts +447 -0
  198. package/kernel/packages/agents/src/profiles.ts +137 -0
  199. package/kernel/packages/agents/src/resolve.ts +69 -0
  200. package/kernel/packages/agents/src/server.ts +60 -0
  201. package/kernel/packages/agents/src/types.ts +82 -0
  202. package/kernel/packages/agents/src/viewer.tsx +370 -0
  203. package/kernel/packages/agents/test/profiles.test.mjs +88 -0
  204. package/kernel/packages/agents/test/resolve.test.mjs +729 -0
  205. package/kernel/packages/agents/tsconfig.json +17 -0
  206. package/kernel/packages/api/README.md +73 -0
  207. package/kernel/packages/api/openapi.json +3368 -0
  208. package/kernel/packages/api/package.json +41 -0
  209. package/kernel/packages/api/src/client/errors.ts +1 -0
  210. package/kernel/packages/api/src/client/index.ts +2 -0
  211. package/kernel/packages/api/src/contracts/schemas.ts +277 -0
  212. package/kernel/packages/api/src/contracts.ts +20 -0
  213. package/kernel/packages/api/src/index.ts +34 -0
  214. package/kernel/packages/api/src/server/acp/index.ts +35 -0
  215. package/kernel/packages/api/src/server/acp/live-agent-connection.ts +44 -0
  216. package/kernel/packages/api/src/server/acp/process-manager.ts +291 -0
  217. package/kernel/packages/api/src/server/acp/registry.ts +140 -0
  218. package/kernel/packages/api/src/server/acp/sdk.ts +15 -0
  219. package/kernel/packages/api/src/server/acp/transport.ts +115 -0
  220. package/kernel/packages/api/src/server/acp/types.ts +89 -0
  221. package/kernel/packages/api/src/server/acp-live-plugin.ts +423 -0
  222. package/kernel/packages/api/src/server/api/create-agent-file.ts +46 -0
  223. package/kernel/packages/api/src/server/api/document-edit.ts +125 -0
  224. package/kernel/packages/api/src/server/api/open-path.ts +40 -0
  225. package/kernel/packages/api/src/server/contracts.ts +85 -0
  226. package/kernel/packages/api/src/server/entity-folder.ts +353 -0
  227. package/kernel/packages/api/src/server/folder-favicon.ts +17 -0
  228. package/kernel/packages/api/src/server/folder-icons.ts +113 -0
  229. package/kernel/packages/api/src/server/folder-metadata-plugin.ts +1758 -0
  230. package/kernel/packages/api/src/server/host.ts +21 -0
  231. package/kernel/packages/api/src/server/index.ts +197 -0
  232. package/kernel/packages/api/src/server/linked-folder-discovery.ts +158 -0
  233. package/kernel/packages/api/src/server/plugins.ts +205 -0
  234. package/kernel/packages/api/src/server/project-discovery.ts +69 -0
  235. package/kernel/packages/api/src/server/watcher.ts +46 -0
  236. package/kernel/packages/api/src/shared/selection.ts +16 -0
  237. package/kernel/packages/api/src/shared/viewer-route.ts +200 -0
  238. package/kernel/packages/api/test/agents-loading.test.ts +94 -0
  239. package/kernel/packages/api/test/core.test.ts +364 -0
  240. package/kernel/packages/api/test/entity-folder.test.ts +131 -0
  241. package/kernel/packages/api/test/linked-folder-discovery.test.ts +78 -0
  242. package/kernel/packages/api/test/media-endpoint.test.ts +83 -0
  243. package/kernel/packages/api/test/partial-loading.test.ts +43 -0
  244. package/kernel/packages/api/test/project-discovery.test.ts +44 -0
  245. package/kernel/packages/api/tsconfig.json +11 -0
  246. package/kernel/packages/api-client/README.md +72 -0
  247. package/kernel/packages/api-client/package.json +26 -0
  248. package/kernel/packages/api-client/scripts/generate.ts +68 -0
  249. package/kernel/packages/api-client/src/errors.ts +59 -0
  250. package/kernel/packages/api-client/src/generated.d.ts +1248 -0
  251. package/kernel/packages/api-client/src/index.ts +206 -0
  252. package/kernel/packages/api-client/src/responses.ts +19 -0
  253. package/kernel/packages/api-client/test/client.test.ts +143 -0
  254. package/kernel/packages/api-client/tsconfig.json +12 -0
  255. package/kernel/packages/folder-plugin/eslint.config.js +10 -0
  256. package/kernel/packages/folder-plugin/package.json +50 -0
  257. package/kernel/packages/folder-plugin/src/client.ts +73 -0
  258. package/kernel/packages/folder-plugin/src/endpoint.ts +273 -0
  259. package/kernel/packages/folder-plugin/src/index.ts +15 -0
  260. package/kernel/packages/folder-plugin/src/server.ts +78 -0
  261. package/kernel/packages/folder-plugin/src/subpath.ts +34 -0
  262. package/kernel/packages/folder-plugin/src/types.ts +86 -0
  263. package/kernel/packages/folder-plugin/src/validation.ts +56 -0
  264. package/kernel/packages/folder-plugin/test/contract.test.mjs +133 -0
  265. package/kernel/packages/folder-plugin/tsconfig.json +17 -0
  266. package/kernel/packages/kinds/package.json +24 -0
  267. package/kernel/packages/kinds/src/kinds.ts +172 -0
  268. package/kernel/packages/markdown/README.md +40 -0
  269. package/kernel/packages/markdown/explorer.css +1 -0
  270. package/kernel/packages/markdown/package.json +30 -0
  271. package/kernel/packages/markdown/src/documents.ts +1 -0
  272. package/kernel/packages/markdown/src/explorer.ts +1 -0
  273. package/kernel/packages/markdown/src/index.ts +2 -0
  274. package/kernel/packages/markdown/src/metadata.ts +63 -0
  275. package/kernel/packages/markdown/src/node.ts +1 -0
  276. package/kernel/packages/markdown/styles.css +1 -0
  277. package/kernel/packages/notes/SKILL.md +19 -0
  278. package/kernel/packages/notes/eslint.config.js +10 -0
  279. package/kernel/packages/notes/package.json +72 -0
  280. package/kernel/packages/notes/src/client.tsx +12 -0
  281. package/kernel/packages/notes/src/data/ai-input.ts +58 -0
  282. package/kernel/packages/notes/src/data/api.ts +40 -0
  283. package/kernel/packages/notes/src/data/parse.ts +15 -0
  284. package/kernel/packages/notes/src/data/routing.ts +33 -0
  285. package/kernel/packages/notes/src/data/use-folder-notes.ts +49 -0
  286. package/kernel/packages/notes/src/index.ts +2 -0
  287. package/kernel/packages/notes/src/manifest.ts +6 -0
  288. package/kernel/packages/notes/src/pages/notes-page.tsx +79 -0
  289. package/kernel/packages/notes/src/pages/single-note-page.tsx +57 -0
  290. package/kernel/packages/notes/src/server.ts +88 -0
  291. package/kernel/packages/notes/src/ui/ai-composer-controls.tsx +70 -0
  292. package/kernel/packages/notes/src/ui/folder-notes-list.tsx +140 -0
  293. package/kernel/packages/notes/tsconfig.json +16 -0
  294. package/kernel/packages/schemas/ICON-POLICY.md +43 -0
  295. package/kernel/packages/schemas/SKILL.md +185 -0
  296. package/kernel/packages/schemas/eslint.config.js +10 -0
  297. package/kernel/packages/schemas/package.json +81 -0
  298. package/kernel/packages/schemas/src/client.tsx +137 -0
  299. package/kernel/packages/schemas/src/data/config-file.ts +37 -0
  300. package/kernel/packages/schemas/src/data/contract.ts +174 -0
  301. package/kernel/packages/schemas/src/data/favicon.ts +218 -0
  302. package/kernel/packages/schemas/src/data/fields.ts +96 -0
  303. package/kernel/packages/schemas/src/data/icon-image.ts +53 -0
  304. package/kernel/packages/schemas/src/data/icon.ts +97 -0
  305. package/kernel/packages/schemas/src/data/load.ts +161 -0
  306. package/kernel/packages/schemas/src/data/params.ts +103 -0
  307. package/kernel/packages/schemas/src/data/query.ts +33 -0
  308. package/kernel/packages/schemas/src/data/sort.ts +50 -0
  309. package/kernel/packages/schemas/src/data/workspace.ts +101 -0
  310. package/kernel/packages/schemas/src/index.ts +22 -0
  311. package/kernel/packages/schemas/src/manifest.ts +4 -0
  312. package/kernel/packages/schemas/src/node.ts +384 -0
  313. package/kernel/packages/schemas/src/pages/collection.tsx +252 -0
  314. package/kernel/packages/schemas/src/server.ts +208 -0
  315. package/kernel/packages/schemas/src/ui/schema-entity-list.tsx +124 -0
  316. package/kernel/packages/schemas/src/ui/schema-filters.tsx +186 -0
  317. package/kernel/packages/schemas/src/ui/schema-search.tsx +35 -0
  318. package/kernel/packages/schemas/src/ui/use-query-param-filter-setting.tsx +15 -0
  319. package/kernel/packages/schemas/test/contract.test.mjs +26 -0
  320. package/kernel/packages/schemas/test/fields.test.mjs +187 -0
  321. package/kernel/packages/schemas/test/load.test.mjs +12 -0
  322. package/kernel/packages/schemas/test/node.test.mjs +412 -0
  323. package/kernel/packages/schemas/test/query.test.mjs +134 -0
  324. package/kernel/packages/schemas/test/workspace.test.mjs +86 -0
  325. package/kernel/packages/schemas/tsconfig.json +17 -0
  326. package/kernel/packages/session-finding/package.json +33 -0
  327. package/kernel/packages/session-finding/src/index.ts +120 -0
  328. package/kernel/packages/session-finding/test/list-sessions.test.mjs +139 -0
  329. package/kernel/packages/session-finding/tsconfig.json +12 -0
  330. package/kernel/packages/ui/LICENSE +21 -0
  331. package/kernel/packages/ui/components.json +20 -0
  332. package/kernel/packages/ui/eslint.config.js +8 -0
  333. package/kernel/packages/ui/package.json +106 -0
  334. package/kernel/packages/ui/src/chat/file-link.ts +178 -0
  335. package/kernel/packages/ui/src/chat/index.ts +18 -0
  336. package/kernel/packages/ui/src/chat/transcript.tsx +348 -0
  337. package/kernel/packages/ui/src/chat/turns.ts +76 -0
  338. package/kernel/packages/ui/src/chat/types.ts +23 -0
  339. package/kernel/packages/ui/src/chat/use-overflowing.ts +56 -0
  340. package/kernel/packages/ui/src/components/accordion.tsx +74 -0
  341. package/kernel/packages/ui/src/components/alert-dialog.tsx +164 -0
  342. package/kernel/packages/ui/src/components/alert.tsx +68 -0
  343. package/kernel/packages/ui/src/components/app-breadcrumbs.tsx +170 -0
  344. package/kernel/packages/ui/src/components/app-header.tsx +125 -0
  345. package/kernel/packages/ui/src/components/app-options.tsx +87 -0
  346. package/kernel/packages/ui/src/components/app-view-header.tsx +34 -0
  347. package/kernel/packages/ui/src/components/aspect-ratio.tsx +11 -0
  348. package/kernel/packages/ui/src/components/avatar.tsx +53 -0
  349. package/kernel/packages/ui/src/components/badge.tsx +47 -0
  350. package/kernel/packages/ui/src/components/base-dialog.tsx +3 -0
  351. package/kernel/packages/ui/src/components/base-tabs.tsx +63 -0
  352. package/kernel/packages/ui/src/components/breadcrumb.tsx +110 -0
  353. package/kernel/packages/ui/src/components/button-group.tsx +86 -0
  354. package/kernel/packages/ui/src/components/button.tsx +65 -0
  355. package/kernel/packages/ui/src/components/calendar.tsx +240 -0
  356. package/kernel/packages/ui/src/components/card.tsx +95 -0
  357. package/kernel/packages/ui/src/components/carousel.tsx +240 -0
  358. package/kernel/packages/ui/src/components/chart.tsx +375 -0
  359. package/kernel/packages/ui/src/components/checkbox.tsx +39 -0
  360. package/kernel/packages/ui/src/components/collapsible.tsx +33 -0
  361. package/kernel/packages/ui/src/components/collection-icon.tsx +28 -0
  362. package/kernel/packages/ui/src/components/command.tsx +205 -0
  363. package/kernel/packages/ui/src/components/content-issues.tsx +63 -0
  364. package/kernel/packages/ui/src/components/context-menu.tsx +298 -0
  365. package/kernel/packages/ui/src/components/copy-context.tsx +134 -0
  366. package/kernel/packages/ui/src/components/dialog.tsx +157 -0
  367. package/kernel/packages/ui/src/components/drawer.tsx +162 -0
  368. package/kernel/packages/ui/src/components/dropdown-menu.tsx +303 -0
  369. package/kernel/packages/ui/src/components/empty.tsx +108 -0
  370. package/kernel/packages/ui/src/components/field.tsx +260 -0
  371. package/kernel/packages/ui/src/components/file-preview.tsx +152 -0
  372. package/kernel/packages/ui/src/components/file-renderer.tsx +466 -0
  373. package/kernel/packages/ui/src/components/filter-chip-panel.tsx +157 -0
  374. package/kernel/packages/ui/src/components/filter-select.tsx +127 -0
  375. package/kernel/packages/ui/src/components/folder-activity.tsx +646 -0
  376. package/kernel/packages/ui/src/components/folder-file-list.tsx +58 -0
  377. package/kernel/packages/ui/src/components/folder-filter-bar.tsx +191 -0
  378. package/kernel/packages/ui/src/components/folder-image.tsx +18 -0
  379. package/kernel/packages/ui/src/components/folder-landing.tsx +70 -0
  380. package/kernel/packages/ui/src/components/folder-list.tsx +140 -0
  381. package/kernel/packages/ui/src/components/folder-metadata.tsx +107 -0
  382. package/kernel/packages/ui/src/components/folder-mobile-bar.tsx +60 -0
  383. package/kernel/packages/ui/src/components/folder-project-list.tsx +133 -0
  384. package/kernel/packages/ui/src/components/folder-session-list.tsx +113 -0
  385. package/kernel/packages/ui/src/components/folder-session-page.tsx +126 -0
  386. package/kernel/packages/ui/src/components/folder-sidebar.tsx +52 -0
  387. package/kernel/packages/ui/src/components/folder-skill-list.tsx +62 -0
  388. package/kernel/packages/ui/src/components/folder-tabs.tsx +156 -0
  389. package/kernel/packages/ui/src/components/form.tsx +167 -0
  390. package/kernel/packages/ui/src/components/hover-card.tsx +52 -0
  391. package/kernel/packages/ui/src/components/icons.tsx +34 -0
  392. package/kernel/packages/ui/src/components/input-group.tsx +184 -0
  393. package/kernel/packages/ui/src/components/input-otp.tsx +90 -0
  394. package/kernel/packages/ui/src/components/input.tsx +29 -0
  395. package/kernel/packages/ui/src/components/item.tsx +195 -0
  396. package/kernel/packages/ui/src/components/kbd.tsx +32 -0
  397. package/kernel/packages/ui/src/components/label.tsx +27 -0
  398. package/kernel/packages/ui/src/components/link.tsx +45 -0
  399. package/kernel/packages/ui/src/components/live-tool-call.tsx +193 -0
  400. package/kernel/packages/ui/src/components/menubar.tsx +323 -0
  401. package/kernel/packages/ui/src/components/navigation-menu.tsx +210 -0
  402. package/kernel/packages/ui/src/components/note-card.tsx +149 -0
  403. package/kernel/packages/ui/src/components/pagination.tsx +128 -0
  404. package/kernel/packages/ui/src/components/popover.tsx +56 -0
  405. package/kernel/packages/ui/src/components/progress.tsx +31 -0
  406. package/kernel/packages/ui/src/components/radio-group.tsx +54 -0
  407. package/kernel/packages/ui/src/components/scroll-area.tsx +61 -0
  408. package/kernel/packages/ui/src/components/select.tsx +219 -0
  409. package/kernel/packages/ui/src/components/separator.tsx +30 -0
  410. package/kernel/packages/ui/src/components/session-icon.tsx +124 -0
  411. package/kernel/packages/ui/src/components/sheet.tsx +157 -0
  412. package/kernel/packages/ui/src/components/sidebar.tsx +789 -0
  413. package/kernel/packages/ui/src/components/skeleton.tsx +13 -0
  414. package/kernel/packages/ui/src/components/slider.tsx +73 -0
  415. package/kernel/packages/ui/src/components/sonner.tsx +41 -0
  416. package/kernel/packages/ui/src/components/spinner.tsx +16 -0
  417. package/kernel/packages/ui/src/components/switch.tsx +40 -0
  418. package/kernel/packages/ui/src/components/table.tsx +120 -0
  419. package/kernel/packages/ui/src/components/tabs.tsx +78 -0
  420. package/kernel/packages/ui/src/components/textarea.tsx +25 -0
  421. package/kernel/packages/ui/src/components/toggle-group.tsx +87 -0
  422. package/kernel/packages/ui/src/components/toggle.tsx +48 -0
  423. package/kernel/packages/ui/src/components/tooltip.tsx +71 -0
  424. package/kernel/packages/ui/src/components/viewer-options.tsx +166 -0
  425. package/kernel/packages/ui/src/hooks/use-folder-filter.ts +103 -0
  426. package/kernel/packages/ui/src/hooks/use-mobile.ts +19 -0
  427. package/kernel/packages/ui/src/index.ts +13 -0
  428. package/kernel/packages/ui/src/lib/document-extensions.ts +83 -0
  429. package/kernel/packages/ui/src/lib/folder-activity.ts +143 -0
  430. package/kernel/packages/ui/src/lib/folder-filter.ts +284 -0
  431. package/kernel/packages/ui/src/lib/live-tool-call.tsx +109 -0
  432. package/kernel/packages/ui/src/lib/media-urls.ts +176 -0
  433. package/kernel/packages/ui/src/lib/obsidian-links.ts +120 -0
  434. package/kernel/packages/ui/src/lib/source-components.tsx +65 -0
  435. package/kernel/packages/ui/src/lib/utils.tsx +7 -0
  436. package/kernel/packages/ui/src/pages/entity-detail-page.tsx +82 -0
  437. package/kernel/packages/ui/src/pages/entity-list-page.tsx +50 -0
  438. package/kernel/packages/ui/src/pages/entity-page.tsx +69 -0
  439. package/kernel/packages/ui/src/styles/folder-activity.css +2151 -0
  440. package/kernel/packages/ui/test/copy-context.test.mjs +48 -0
  441. package/kernel/packages/ui/test/folder-filter.test.mjs +484 -0
  442. package/kernel/packages/ui/tsconfig.json +15 -0
  443. package/kernel/plugins/calendar/SKILL.md +173 -0
  444. package/kernel/plugins/calendar/eslint.config.js +10 -0
  445. package/kernel/plugins/calendar/package.json +73 -0
  446. package/kernel/plugins/calendar/schema.json +137 -0
  447. package/kernel/plugins/calendar/src/calendar.tsx +328 -0
  448. package/kernel/plugins/calendar/src/client.tsx +139 -0
  449. package/kernel/plugins/calendar/src/context.ts +48 -0
  450. package/kernel/plugins/calendar/src/copy-button.tsx +66 -0
  451. package/kernel/plugins/calendar/src/event-dialog.tsx +270 -0
  452. package/kernel/plugins/calendar/src/index.ts +4 -0
  453. package/kernel/plugins/calendar/src/manifest.ts +7 -0
  454. package/kernel/plugins/calendar/src/parse.ts +610 -0
  455. package/kernel/plugins/calendar/src/server.ts +160 -0
  456. package/kernel/plugins/calendar/src/utils.ts +80 -0
  457. package/kernel/plugins/calendar/src/views.tsx +418 -0
  458. package/kernel/plugins/calendar/test/context.test.mjs +60 -0
  459. package/kernel/plugins/calendar/test/package.test.mjs +43 -0
  460. package/kernel/plugins/calendar/test/parse.test.mjs +392 -0
  461. package/kernel/plugins/calendar/test/server.test.mjs +126 -0
  462. package/kernel/plugins/calendar/tsconfig.json +17 -0
  463. package/kernel/plugins/mail/SKILL.md +97 -0
  464. package/kernel/plugins/mail/eslint.config.js +10 -0
  465. package/kernel/plugins/mail/package.json +79 -0
  466. package/kernel/plugins/mail/src/api.ts +359 -0
  467. package/kernel/plugins/mail/src/bun-ffi.d.ts +14 -0
  468. package/kernel/plugins/mail/src/client.tsx +14 -0
  469. package/kernel/plugins/mail/src/flock.ts +137 -0
  470. package/kernel/plugins/mail/src/folders.ts +37 -0
  471. package/kernel/plugins/mail/src/history.ts +485 -0
  472. package/kernel/plugins/mail/src/index.ts +3 -0
  473. package/kernel/plugins/mail/src/mail-card.tsx +123 -0
  474. package/kernel/plugins/mail/src/mail-conversation.tsx +153 -0
  475. package/kernel/plugins/mail/src/mail-detail-page.tsx +467 -0
  476. package/kernel/plugins/mail/src/mail-hooks.ts +252 -0
  477. package/kernel/plugins/mail/src/mail-page.tsx +109 -0
  478. package/kernel/plugins/mail/src/mail-request.ts +78 -0
  479. package/kernel/plugins/mail/src/mail-send-box.tsx +175 -0
  480. package/kernel/plugins/mail/src/mailos.ts +723 -0
  481. package/kernel/plugins/mail/src/manifest.ts +7 -0
  482. package/kernel/plugins/mail/src/node.ts +171 -0
  483. package/kernel/plugins/mail/src/parse.ts +139 -0
  484. package/kernel/plugins/mail/src/server.ts +125 -0
  485. package/kernel/plugins/mail/src/types.ts +10 -0
  486. package/kernel/plugins/mail/src/viewer.tsx +147 -0
  487. package/kernel/plugins/mail/test/flock.test.mjs +156 -0
  488. package/kernel/plugins/mail/test/folders.test.mjs +138 -0
  489. package/kernel/plugins/mail/test/history.test.mjs +460 -0
  490. package/kernel/plugins/mail/test/mailos.test.mjs +752 -0
  491. package/kernel/plugins/mail/test/node.test.mjs +207 -0
  492. package/kernel/plugins/mail/test/package.test.mjs +54 -0
  493. package/kernel/plugins/mail/test/parse.test.mjs +32 -0
  494. package/kernel/plugins/mail/test/server.test.mjs +116 -0
  495. package/kernel/plugins/mail/test/viewer.test.mjs +192 -0
  496. package/kernel/plugins/mail/tsconfig.json +17 -0
  497. package/kernel/plugins/projects/SKILL.md +73 -0
  498. package/kernel/plugins/projects/eslint.config.js +10 -0
  499. package/kernel/plugins/projects/package.json +70 -0
  500. package/kernel/plugins/projects/src/client.tsx +17 -0
  501. package/kernel/plugins/projects/src/data/model.ts +129 -0
  502. package/kernel/plugins/projects/src/index.ts +17 -0
  503. package/kernel/plugins/projects/src/manifest.ts +7 -0
  504. package/kernel/plugins/projects/src/project-context.ts +41 -0
  505. package/kernel/plugins/projects/src/server.ts +276 -0
  506. package/kernel/plugins/projects/src/ui/project-card.tsx +61 -0
  507. package/kernel/plugins/projects/src/ui/projects-page.tsx +102 -0
  508. package/kernel/plugins/projects/test/package.test.mjs +51 -0
  509. package/kernel/plugins/projects/tsconfig.json +17 -0
  510. package/kernel/plugins/tasks/SKILL.md +341 -0
  511. package/kernel/plugins/tasks/eslint.config.js +10 -0
  512. package/kernel/plugins/tasks/package.json +74 -0
  513. package/kernel/plugins/tasks/schema.json +939 -0
  514. package/kernel/plugins/tasks/src/api.ts +212 -0
  515. package/kernel/plugins/tasks/src/client.tsx +23 -0
  516. package/kernel/plugins/tasks/src/data/parse.ts +544 -0
  517. package/kernel/plugins/tasks/src/data/task-id.ts +56 -0
  518. package/kernel/plugins/tasks/src/data/todo-model.ts +795 -0
  519. package/kernel/plugins/tasks/src/index.ts +34 -0
  520. package/kernel/plugins/tasks/src/manifest.ts +7 -0
  521. package/kernel/plugins/tasks/src/pages/task-detail.tsx +48 -0
  522. package/kernel/plugins/tasks/src/pages/task-list.tsx +88 -0
  523. package/kernel/plugins/tasks/src/server.ts +447 -0
  524. package/kernel/plugins/tasks/src/styles.css +9 -0
  525. package/kernel/plugins/tasks/src/ui/compact-todo-list.tsx +372 -0
  526. package/kernel/plugins/tasks/src/ui/error-details.tsx +78 -0
  527. package/kernel/plugins/tasks/src/ui/task-page.tsx +392 -0
  528. package/kernel/plugins/tasks/src/ui/todo-agent-filter.tsx +36 -0
  529. package/kernel/plugins/tasks/src/ui/todo-filter-bar.tsx +66 -0
  530. package/kernel/plugins/tasks/src/ui/todo-item.tsx +494 -0
  531. package/kernel/plugins/tasks/src/ui/todo-status-filter.tsx +60 -0
  532. package/kernel/plugins/tasks/src/ui/todo-tag-filter.tsx +48 -0
  533. package/kernel/plugins/tasks/src/ui/todo-warnings.tsx +106 -0
  534. package/kernel/plugins/tasks/test/api.test.mjs +99 -0
  535. package/kernel/plugins/tasks/test/folder-sources.test.mjs +46 -0
  536. package/kernel/plugins/tasks/test/package.test.mjs +54 -0
  537. package/kernel/plugins/tasks/test/parse.test.mjs +225 -0
  538. package/kernel/plugins/tasks/test/server.test.mjs +386 -0
  539. package/kernel/plugins/tasks/tsconfig.json +17 -0
  540. package/node_modules/@agentclientprotocol/sdk/LICENSE +191 -0
  541. package/node_modules/@agentclientprotocol/sdk/README.md +70 -0
  542. package/node_modules/@agentclientprotocol/sdk/dist/acp.d.ts +1835 -0
  543. package/node_modules/@agentclientprotocol/sdk/dist/acp.js +1885 -0
  544. package/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
  545. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.d.ts +1 -0
  546. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js +5036 -0
  547. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js.map +1 -0
  548. package/node_modules/@agentclientprotocol/sdk/dist/connection.d.ts +82 -0
  549. package/node_modules/@agentclientprotocol/sdk/dist/connection.js +428 -0
  550. package/node_modules/@agentclientprotocol/sdk/dist/connection.js.map +1 -0
  551. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.d.ts +1 -0
  552. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js +470 -0
  553. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js.map +1 -0
  554. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.d.ts +26 -0
  555. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js +96 -0
  556. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js.map +1 -0
  557. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.d.ts +1 -0
  558. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js +77 -0
  559. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js.map +1 -0
  560. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.d.ts +2 -0
  561. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js +232 -0
  562. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js.map +1 -0
  563. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.d.ts +2 -0
  564. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js +132 -0
  565. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js.map +1 -0
  566. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.d.ts +9 -0
  567. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +221 -0
  568. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js.map +1 -0
  569. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.d.ts +2 -0
  570. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js +86 -0
  571. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js.map +1 -0
  572. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.d.ts +2 -0
  573. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js +112 -0
  574. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js.map +1 -0
  575. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.d.ts +2 -0
  576. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js +88 -0
  577. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js.map +1 -0
  578. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.d.ts +33 -0
  579. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js +435 -0
  580. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js.map +1 -0
  581. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.d.ts +1 -0
  582. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js +1380 -0
  583. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js.map +1 -0
  584. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.d.ts +603 -0
  585. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js +1064 -0
  586. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js.map +1 -0
  587. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.d.ts +1 -0
  588. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js +851 -0
  589. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js.map +1 -0
  590. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.d.ts +22 -0
  591. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js +64 -0
  592. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js.map +1 -0
  593. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.d.ts +1 -0
  594. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js +45 -0
  595. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js.map +1 -0
  596. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.d.ts +17 -0
  597. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js +426 -0
  598. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js.map +1 -0
  599. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.d.ts +1 -0
  600. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js +499 -0
  601. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js.map +1 -0
  602. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.d.ts +37 -0
  603. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js +474 -0
  604. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js.map +1 -0
  605. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.d.ts +1 -0
  606. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js +535 -0
  607. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js.map +1 -0
  608. package/node_modules/@agentclientprotocol/sdk/dist/protocol.d.ts +11 -0
  609. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js +57 -0
  610. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js.map +1 -0
  611. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.d.ts +1 -0
  612. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js +73 -0
  613. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js.map +1 -0
  614. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.d.ts +199 -0
  615. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js +211 -0
  616. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js.map +1 -0
  617. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.d.ts +51 -0
  618. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js +52 -0
  619. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js.map +1 -0
  620. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.d.ts +6118 -0
  621. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js +3 -0
  622. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js.map +1 -0
  623. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.d.ts +14160 -0
  624. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +3066 -0
  625. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js.map +1 -0
  626. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.d.ts +30 -0
  627. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js +98 -0
  628. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js.map +1 -0
  629. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.d.ts +1 -0
  630. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js +93 -0
  631. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js.map +1 -0
  632. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.d.ts +1 -0
  633. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js +261 -0
  634. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js.map +1 -0
  635. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.d.ts +1 -0
  636. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js +490 -0
  637. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js.map +1 -0
  638. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.d.ts +2 -0
  639. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js +104 -0
  640. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js.map +1 -0
  641. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.d.ts +1 -0
  642. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js +52 -0
  643. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js.map +1 -0
  644. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.d.ts +1 -0
  645. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js +946 -0
  646. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js.map +1 -0
  647. package/node_modules/@agentclientprotocol/sdk/dist/server.d.ts +81 -0
  648. package/node_modules/@agentclientprotocol/sdk/dist/server.js +380 -0
  649. package/node_modules/@agentclientprotocol/sdk/dist/server.js.map +1 -0
  650. package/node_modules/@agentclientprotocol/sdk/dist/server.test.d.ts +1 -0
  651. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js +1082 -0
  652. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js.map +1 -0
  653. package/node_modules/@agentclientprotocol/sdk/dist/sse.d.ts +4 -0
  654. package/node_modules/@agentclientprotocol/sdk/dist/sse.js +91 -0
  655. package/node_modules/@agentclientprotocol/sdk/dist/sse.js.map +1 -0
  656. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.d.ts +1 -0
  657. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js +126 -0
  658. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js.map +1 -0
  659. package/node_modules/@agentclientprotocol/sdk/dist/stream.d.ts +35 -0
  660. package/node_modules/@agentclientprotocol/sdk/dist/stream.js +106 -0
  661. package/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
  662. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.d.ts +1 -0
  663. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js +206 -0
  664. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js.map +1 -0
  665. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.d.ts +8 -0
  666. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js +51 -0
  667. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js.map +1 -0
  668. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.d.ts +24 -0
  669. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js +163 -0
  670. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js.map +1 -0
  671. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.d.ts +9 -0
  672. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js +74 -0
  673. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js.map +1 -0
  674. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.d.ts +806 -0
  675. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +1183 -0
  676. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js.map +1 -0
  677. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.d.ts +1 -0
  678. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js +512 -0
  679. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js.map +1 -0
  680. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.d.ts +954 -0
  681. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +1035 -0
  682. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js.map +1 -0
  683. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.d.ts +42 -0
  684. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js +43 -0
  685. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js.map +1 -0
  686. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.d.ts +6146 -0
  687. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js +3 -0
  688. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js.map +1 -0
  689. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.d.ts +30552 -0
  690. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +3204 -0
  691. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js.map +1 -0
  692. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.d.ts +14 -0
  693. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js +358 -0
  694. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js.map +1 -0
  695. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.d.ts +54 -0
  696. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js +246 -0
  697. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js.map +1 -0
  698. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.d.ts +1 -0
  699. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js +833 -0
  700. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js.map +1 -0
  701. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.d.ts +13 -0
  702. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js +78 -0
  703. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js.map +1 -0
  704. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.d.ts +1 -0
  705. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js +42 -0
  706. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js.map +1 -0
  707. package/node_modules/@agentclientprotocol/sdk/package.json +105 -0
  708. package/node_modules/@agentclientprotocol/sdk/schema/schema.json +8819 -0
  709. package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +10098 -0
  710. package/package.json +52 -6
  711. package/web/assets/{abnfDiagram-VRR7QNED-Nfq-O04D.js → abnfDiagram-VRR7QNED-Bgfb1nEB.js} +1 -1
  712. package/web/assets/app-DoGr2Zi7.js +2 -0
  713. package/web/assets/app-options-D-RJiQ-X.js +25 -0
  714. package/web/assets/app-view-header-BLvLq02T.js +1 -0
  715. package/web/assets/arc-Dk_KI36B.js +1 -0
  716. package/web/assets/{architectureDiagram-ZJ3FMSHR-qhRwPNcQ.js → architectureDiagram-ZJ3FMSHR-NR_KhRCf.js} +1 -1
  717. package/web/assets/ask-tray-TzeTcO6-.js +14 -0
  718. package/web/assets/{blockDiagram-677ZJIJ3-C56P3bGu.js → blockDiagram-677ZJIJ3-CkLkwx9C.js} +1 -1
  719. package/web/assets/button-C6arH7zt.js +1 -0
  720. package/web/assets/{c4Diagram-LMCZKHZV-Ey1M72zD.js → c4Diagram-LMCZKHZV-CFCUH8e_.js} +1 -1
  721. package/web/assets/channel-uMEjV8qc.js +1 -0
  722. package/web/assets/{chunk-2Q5K7J3B-a6isk9VU.js → chunk-2Q5K7J3B-B_BPLWsW.js} +1 -1
  723. package/web/assets/{chunk-32BRIVSS-uy4kdSLL.js → chunk-32BRIVSS-B1VB1hOy.js} +1 -1
  724. package/web/assets/{chunk-5VM5RSS4-oj2sBFd7.js → chunk-5VM5RSS4-KFcYr8Co.js} +1 -1
  725. package/web/assets/{chunk-EX3LRPZG-Bzl1ukAi.js → chunk-EX3LRPZG-CpBX3kuK.js} +3 -3
  726. package/web/assets/{chunk-JWPE2WC7-sUph7I_t.js → chunk-JWPE2WC7-BPSl40wG.js} +1 -1
  727. package/web/assets/{chunk-MOJQB5TN-C0ERSuVK.js → chunk-MOJQB5TN-D2RcYmoU.js} +1 -1
  728. package/web/assets/{chunk-RYQCIY6F-Dyw1Hfwp.js → chunk-RYQCIY6F-m7Gyn-t3.js} +1 -1
  729. package/web/assets/{chunk-V7JOEXUC-DnSz22rb.js → chunk-V7JOEXUC-TDvdopxS.js} +1 -1
  730. package/web/assets/{chunk-VR4S4FIN-Bp2SNel7.js → chunk-VR4S4FIN-DZTsG51a.js} +1 -1
  731. package/web/assets/{chunk-XXDRQBXY-Dqtar746.js → chunk-XXDRQBXY-Dp0--RE2.js} +1 -1
  732. package/web/assets/classDiagram-OUVF2IWQ-fbZocVor.js +1 -0
  733. package/web/assets/classDiagram-v2-EOCWNBFH-fbZocVor.js +1 -0
  734. package/web/assets/client-C6Nxdfif.js +2 -0
  735. package/web/assets/client-CXYfBko5.js +17 -0
  736. package/web/assets/client-CoKtOq-X.js +7 -0
  737. package/web/assets/client-DyRQz5RU.js +53 -0
  738. package/web/assets/client-OY6HUzuD.js +98 -0
  739. package/web/assets/client-YOYWZIFi.js +34 -0
  740. package/web/assets/client-j2kQmxsO.js +22 -0
  741. package/web/assets/command-BugZBGXE.js +38 -0
  742. package/web/assets/copy-context-C0Uqsp-3.js +1 -0
  743. package/web/assets/{cose-bilkent-JH36ORCC-Dx1VqMjj.js → cose-bilkent-JH36ORCC-CPu3PI8h.js} +1 -1
  744. package/web/assets/{cynefin-VYW2F7L2-SjhCWmIV.js → cynefin-VYW2F7L2-DWxftYAm.js} +1 -1
  745. package/web/assets/{cynefinDiagram-TSTJHNR4-Dvqz2594.js → cynefinDiagram-TSTJHNR4-DsmN2V-p.js} +1 -1
  746. package/web/assets/{dagre-VKFMJZFB-Ju2m2qXt.js → dagre-VKFMJZFB-COEbApyY.js} +1 -1
  747. package/web/assets/{diagram-FQU43EPY-DsHKTt0k.js → diagram-FQU43EPY-0O9WGWKB.js} +1 -1
  748. package/web/assets/{diagram-G47NLZAW-DWHAcLkJ.js → diagram-G47NLZAW-CutEdMVh.js} +1 -1
  749. package/web/assets/{diagram-NH7WQ7WH-uUMz46ZD.js → diagram-NH7WQ7WH-C9KZc3B2.js} +1 -1
  750. package/web/assets/{diagram-OA4YK3LP-BRjVzjdp.js → diagram-OA4YK3LP-D8kkPXbY.js} +1 -1
  751. package/web/assets/{diagram-WEI45ONY-Cb-FhBpQ.js → diagram-WEI45ONY-_YqiTaGP.js} +1 -1
  752. package/web/assets/document-Dgt5eZFj.js +19 -0
  753. package/web/assets/{ebnfDiagram-CCIWWBDH-IhhxX3IB.js → ebnfDiagram-CCIWWBDH-JO-zQh6g.js} +1 -1
  754. package/web/assets/{entities-DUnx74kH.js → entities-C3wz7FCx.js} +12 -12
  755. package/web/assets/{erDiagram-Q63AITRT-D1frgeWf.js → erDiagram-Q63AITRT-9UjQwJ4P.js} +1 -1
  756. package/web/assets/file-viewer-DZJ8nYnl.js +1 -0
  757. package/web/assets/{flowDiagram-23GEKE2U-BiPPM-FY.js → flowDiagram-23GEKE2U-Ca08tnYM.js} +5 -5
  758. package/web/assets/folder-image-BfGgxo7i.js +1 -0
  759. package/web/assets/folder-landing-qUKBCnG-.js +54 -0
  760. package/web/assets/folder-list-BfFjv7rR.js +1 -0
  761. package/web/assets/folder-metadata-DCw8xzHk.js +2 -0
  762. package/web/assets/folder-mobile-bar-Ubz4babf.js +1 -0
  763. package/web/assets/folder-plugin-view-DsWR1zmQ.js +6 -0
  764. package/web/assets/{ganttDiagram-NO4QXBWP-CmEOlHD7.js → ganttDiagram-NO4QXBWP-KnHzX5W3.js} +1 -1
  765. package/web/assets/{gitGraphDiagram-IHSO6WYX-tTjcpZpU.js → gitGraphDiagram-IHSO6WYX-Cm8woNtK.js} +1 -1
  766. package/web/assets/index-BaRnbYRw.js +1 -0
  767. package/web/assets/index-BexmLxIP.css +1 -0
  768. package/web/assets/index-Bp9DidgD.js +1 -0
  769. package/web/assets/{index-eL1k96k8.js → index-CCXE8zc9.js} +1 -1
  770. package/web/assets/index-CNyy98F8.js +2 -0
  771. package/web/assets/{index-DmrKjrlM.js → index-CXhBn-ar.js} +1 -1
  772. package/web/assets/index-DDirZMgx.js +1 -0
  773. package/web/assets/{infoDiagram-FWYZ7A6U-Ok2sdbc1.js → infoDiagram-FWYZ7A6U-yyqmUtIb.js} +1 -1
  774. package/web/assets/{ishikawaDiagram-FXEZZL3T-kPnM5psX.js → ishikawaDiagram-FXEZZL3T-BfvR_Zy4.js} +4 -4
  775. package/web/assets/{journeyDiagram-5HDEW3XC-BkoT0-45.js → journeyDiagram-5HDEW3XC-BKuw06HM.js} +1 -1
  776. package/web/assets/{kanban-definition-HUTT4EX6-xnm_eFoU.js → kanban-definition-HUTT4EX6-n0010rmQ.js} +8 -8
  777. package/web/assets/{linear-CLZpgLH-.js → linear-C0d0lT8O.js} +1 -1
  778. package/web/assets/linked-session-header-BkEweU0Z.js +3 -0
  779. package/web/assets/{markdown-njUwQKsR.js → markdown-Bw9RgUGR.js} +9 -9
  780. package/web/assets/{mermaid.core-Bvxj3RoN.js → mermaid.core-BDVbShyO.js} +6 -6
  781. package/web/assets/metadata-KV0dpp4G.js +1 -0
  782. package/web/assets/{mindmap-definition-LN4V7U3C-42Uoox79.js → mindmap-definition-LN4V7U3C--_0ks3GF.js} +1 -1
  783. package/web/assets/note-card-DBfX6gW1.js +6 -0
  784. package/web/assets/{pegDiagram-2B236MQR-B-GZCw3w.js → pegDiagram-2B236MQR-CBoNIpKR.js} +1 -1
  785. package/web/assets/{pieDiagram-ENE6RG2P-DRmmssIB.js → pieDiagram-ENE6RG2P-MA5tkYh5.js} +3 -3
  786. package/web/assets/popover-DBD7FF-W.js +9 -0
  787. package/web/assets/{project-search-dialog-B730oZ1S.js → project-search-dialog-DM1IkSZu.js} +6 -6
  788. package/web/assets/{quadrantDiagram-ABIIQ3AL-BfhVQ7V9.js → quadrantDiagram-ABIIQ3AL-CWT1ryqF.js} +1 -1
  789. package/web/assets/{railroadDiagram-RFXS5EU6-DxKx7XRp.js → railroadDiagram-RFXS5EU6-ZiLB5FGi.js} +1 -1
  790. package/web/assets/{react-DZzLHL-l.js → react-B9jn2M18.js} +2 -2
  791. package/web/assets/{requirementDiagram-TGXJPOKE-NUzj9fw1.js → requirementDiagram-TGXJPOKE-CQq9uneq.js} +1 -1
  792. package/web/assets/{sankeyDiagram-HTMAVEWB-Cy9OMnl-.js → sankeyDiagram-HTMAVEWB-qDG-0JqI.js} +1 -1
  793. package/web/assets/search-DNrQA5fF.js +2 -0
  794. package/web/assets/select-D8cqNgcp.js +30 -0
  795. package/web/assets/selection-popup-DmtTeRs2.js +7 -0
  796. package/web/assets/{sequenceDiagram-DBY2YBRQ-CBNE9mzn.js → sequenceDiagram-DBY2YBRQ-CiApurLO.js} +1 -1
  797. package/web/assets/{sizeCapture-X5ZJPWSS-S4HhfX0n.js → sizeCapture-X5ZJPWSS-DZSR5QXm.js} +1 -1
  798. package/web/assets/stateDiagram-2N3HPSRC-CjJJR9_z.js +1 -0
  799. package/web/assets/stateDiagram-v2-6OUMAXLB-BpeGSCu9.js +1 -0
  800. package/web/assets/{swimlanes-5IMT3BWC-DJ2aLWal.js → swimlanes-5IMT3BWC-CKmo1sg6.js} +2 -2
  801. package/web/assets/swimlanesDiagram-G3AALYLV-D9RjLKb9.js +8 -0
  802. package/web/assets/tanstack-YzX_Mi37.js +3 -0
  803. package/web/assets/{timeline-definition-FHXFAJF6-vFDUVPCX.js → timeline-definition-FHXFAJF6-D-NMwS3y.js} +1 -1
  804. package/web/assets/{use-folder-filter-BbTUlXgG.js → use-folder-filter-LQyXns5Q.js} +1 -1
  805. package/web/assets/{utils-CwHGE3BB.js → utils-DCaHk0Gm.js} +1 -1
  806. package/web/assets/{vennDiagram-L72KCM5P-AsnhK2zW.js → vennDiagram-L72KCM5P-CfL6LBWw.js} +1 -1
  807. package/web/assets/view-context-gyDl_p2V.js +229 -0
  808. package/web/assets/viewer-capabilities-Bpp8Uvcg.js +1 -0
  809. package/web/assets/{wardleyDiagram-EHGQE667-Cj1wFbNV.js → wardleyDiagram-EHGQE667-DgldMxaj.js} +1 -1
  810. package/web/assets/{xychartDiagram-FW5EYKEG-Bbvnutsm.js → xychartDiagram-FW5EYKEG-CIoAIFX8.js} +1 -1
  811. package/web/favicon.svg +6 -0
  812. package/web/index.html +5 -4
  813. package/web/assets/app-CPSmsokP.js +0 -2
  814. package/web/assets/app-options-XEWvevsz.js +0 -25
  815. package/web/assets/app-view-header-BKZ90ToF.js +0 -1
  816. package/web/assets/arc-DbpbZvCt.js +0 -1
  817. package/web/assets/arrow-left-CFeHb-Z1.js +0 -1
  818. package/web/assets/ask-tray-D2YHtbPj.js +0 -14
  819. package/web/assets/button-BJ7z-ZA7.js +0 -1
  820. package/web/assets/calendar-days-DWh2XMO2.js +0 -1
  821. package/web/assets/channel-dSRp_qTo.js +0 -1
  822. package/web/assets/chevron-down-C5oRtqbX.js +0 -1
  823. package/web/assets/chevron-right-CsPtvh8C.js +0 -1
  824. package/web/assets/chevron-up-DjpU6Pyv.js +0 -1
  825. package/web/assets/classDiagram-OUVF2IWQ-B7B2zLzM.js +0 -1
  826. package/web/assets/classDiagram-v2-EOCWNBFH-B7B2zLzM.js +0 -1
  827. package/web/assets/client-CAudjYV9.js +0 -34
  828. package/web/assets/client-Dn9-_Gm_.js +0 -14
  829. package/web/assets/client-Dxrf2tyq.js +0 -102
  830. package/web/assets/client-aFI2M4pE.js +0 -53
  831. package/web/assets/collection-icon-TbOVyORG.js +0 -1
  832. package/web/assets/collection-page-Du6FKkuU.js +0 -10
  833. package/web/assets/command-C_g5E1Wx.js +0 -38
  834. package/web/assets/copy-Ikmr6Iq2.js +0 -1
  835. package/web/assets/copy-context-Cl1TE2PJ.js +0 -1
  836. package/web/assets/document-DcjNSJCk.js +0 -2
  837. package/web/assets/external-link-BXmSXqqF.js +0 -1
  838. package/web/assets/file-renderer-BRZTrYx8.js +0 -19
  839. package/web/assets/file-text-CiiSsCDq.js +0 -1
  840. package/web/assets/file-viewer-C1wAeVDK.js +0 -1
  841. package/web/assets/folder-image-AXBrHUcU.js +0 -1
  842. package/web/assets/folder-landing-BhRg7hwn.js +0 -54
  843. package/web/assets/folder-list-rIdszVde.js +0 -1
  844. package/web/assets/folder-metadata-puTC5QqJ.js +0 -2
  845. package/web/assets/folder-mobile-bar-DjjRQo3T.js +0 -1
  846. package/web/assets/folder-plugin-view-BU_kzR8j.js +0 -6
  847. package/web/assets/index-DS2Wmd9I.css +0 -1
  848. package/web/assets/index-DgqzSeIR.js +0 -1
  849. package/web/assets/index-DnlTDqaa.js +0 -1
  850. package/web/assets/index-DztTMDFz.js +0 -2
  851. package/web/assets/index-kY75qc96.js +0 -1
  852. package/web/assets/index-p38i_yyY.js +0 -1
  853. package/web/assets/link-2-BWKA6t--.js +0 -1
  854. package/web/assets/link-DC_1Z6Yy.js +0 -11
  855. package/web/assets/linked-session-header-DJYWZ_-q.js +0 -3
  856. package/web/assets/mail-2rCdIFul.js +0 -1
  857. package/web/assets/markdown-title-dncAYYiP.js +0 -131
  858. package/web/assets/notes-page-DIW6rgJp.js +0 -10
  859. package/web/assets/pencil-8cobiSSq.js +0 -1
  860. package/web/assets/plus-BHV2wJr7.js +0 -1
  861. package/web/assets/popover-Cmmgj-MJ.js +0 -9
  862. package/web/assets/search-CvlYUkN6.js +0 -2
  863. package/web/assets/select-1SvaKQsS.js +0 -30
  864. package/web/assets/selection-popup-ntjycEVh.js +0 -7
  865. package/web/assets/sparkles-CBhGREdc.js +0 -1
  866. package/web/assets/stateDiagram-2N3HPSRC-BEw1Mheu.js +0 -1
  867. package/web/assets/stateDiagram-v2-6OUMAXLB-BHtjl1iD.js +0 -1
  868. package/web/assets/swimlanesDiagram-G3AALYLV-Z362aroZ.js +0 -8
  869. package/web/assets/tanstack-CD46mJkU.js +0 -1
  870. package/web/assets/view-context-D-fh9AbH.js +0 -81
  871. package/web/assets/viewer-capabilities-CROIaoqh.js +0 -1
  872. package/web/assets/x-BUeE--I4.js +0 -1
@@ -1,102 +0,0 @@
1
- import{j as l,r as me}from"./react-DZzLHL-l.js";import{B as ir,a as Ep,t as Ip}from"./folder-plugin-view-BU_kzR8j.js";import{u as Rp,c as Cp,h as jp}from"./tanstack-CD46mJkU.js";import{B as Js,C as ea}from"./button-BJ7z-ZA7.js";import{c as Kn,t as Mp,h as Ap}from"./view-context-D-fh9AbH.js";import{C as Vs}from"./copy-context-Cl1TE2PJ.js";import{C as ta}from"./chevron-down-C5oRtqbX.js";import{F as el}from"./file-text-CiiSsCDq.js";import{E as tl}from"./external-link-BXmSXqqF.js";import{L as Fp}from"./link-2-BWKA6t--.js";import{D as Pp,g as Lp,h as Kp,i as Dp,j as Up,k as qp}from"./command-C_g5E1Wx.js";import{A as Bp}from"./arrow-left-CFeHb-Z1.js";import{u as Jp}from"./use-folder-filter-BbTUlXgG.js";import{e as Vp}from"./index-DztTMDFz.js";import{c as hn}from"./utils-CwHGE3BB.js";import{R as zp,T as Hp,c as Wp,C as Gp}from"./popover-Cmmgj-MJ.js";import{S as Yp,a as Qp,c as Xp,b as Zp,d as em,e as tm,f as nm,g as rm,i as sm,h as om}from"./index-DnlTDqaa.js";import{C as im}from"./chevron-right-CsPtvh8C.js";import"./markdown-njUwQKsR.js";import"./index-p38i_yyY.js";import"./index-eL1k96k8.js";import"./folder-image-AXBrHUcU.js";import"./viewer-capabilities-CROIaoqh.js";import"./copy-Ikmr6Iq2.js";import"./x-BUeE--I4.js";import"./index-kY75qc96.js";import"./index-DmrKjrlM.js";import"./index-DgqzSeIR.js";const am=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],cm=Kn("circle-dot",am);const um=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],lm=Kn("circle-pause",um);const fm=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],dm=Kn("git-branch",fm);const hm=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],pm=Kn("git-commit-horizontal",hm);const mm=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],gm=Kn("git-pull-request",mm);const ym=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],bm=Kn("message-square",ym);function _m({file:e,issues:t,variant:n="error"}){return n==="warning"?l.jsxs("div",{className:"rounded-md border border-amber-500/40 p-4",children:[l.jsxs("p",{className:"m-0 text-sm font-semibold text-amber-700",children:[e," warnings."]}),l.jsx("ul",{className:"m-0 mt-2 list-disc space-y-1 pl-5 text-sm text-amber-700",children:t.map((r,s)=>l.jsxs("li",{children:[l.jsx("code",{className:"text-[13px]",children:r.path||e}),r.path?": ":" — ",r.message]},s))})]}):l.jsxs("div",{className:"rounded-md border border-[#9c3a3a]/40 p-4",children:[l.jsxs("p",{className:"m-0 text-sm font-semibold text-[#9c3a3a]",children:[e," is not valid."]}),l.jsx("ul",{className:"m-0 mt-2 list-disc space-y-1 pl-5 text-sm text-[#9c3a3a]",children:t.map((r,s)=>l.jsxs("li",{children:[l.jsx("code",{className:"text-[13px]",children:r.path||e}),r.path?": ":" — ",r.message]},s))})]})}const Sm=e=>typeof e=="function",d=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(s){return t(s,n)}};case 3:return function(n,r,s){return arguments.length>=3?t(n,r,s):function(o){return t(o,n,r)}};case 4:return function(n,r,s,o){return arguments.length>=4?t(n,r,s,o):function(i){return t(i,n,r,s)}};case 5:return function(n,r,s,o,i){return arguments.length>=5?t(n,r,s,o,i):function(a){return t(a,n,r,s,o)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(r){return t(r,...n)}}}},Y=e=>e,zs=e=>()=>e,Tc=zs(!0),ai=zs(!1),nl=zs(void 0),wm=nl;function g(e,t,n,r,s,o,i,a,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return s(r(n(t(e))));case 6:return o(s(r(n(t(e)))));case 7:return i(o(s(r(n(t(e))))));case 8:return a(i(o(s(r(n(t(e)))))));case 9:return c(a(i(o(s(r(n(t(e))))))));default:{let u=arguments[0];for(let f=1;f<arguments.length;f++)u=arguments[f](u);return u}}}const Hs=e=>(t,n)=>t===n||e(t,n),km=d(2,(e,t)=>Hs((n,r)=>e(t(n),t(r)))),xm=e=>Hs((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}),Oc="effect/GlobalValue";let Qn;const B=(e,t)=>(Qn||(globalThis[Oc]??=new Map,Qn=globalThis[Oc]),Qn.has(e)||Qn.set(e,t()),Qn.get(e)),ut=e=>typeof e=="string",Jt=e=>typeof e=="number",na=e=>typeof e=="boolean",Ws=e=>typeof e=="bigint",ci=e=>typeof e=="symbol",xr=Sm,vm=e=>e===void 0,Tm=e=>e!==void 0,Fo=e=>e!==null,Om=e=>!1,ra=e=>typeof e=="object"&&e!==null,wt=e=>ra(e)||xr(e),A=d(2,(e,t)=>wt(e)&&t in e),rl=d(2,(e,t)=>A(e,"_tag")&&e._tag===t),cn=e=>e==null,Nm=e=>e!=null,$m=e=>e instanceof Date,Em=e=>typeof e=="string"||A(e,Symbol.iterator),Im=e=>ra(e)&&!Array.isArray(e),Rm=e=>A(e,"then")&&xr(e.then),Gs=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;let sl=class ol{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new ol(this.self)}};const Cm=335903614,jm=4150755663,Mm=1481765933,Am=1284865837,Fm=9007199254740992,Pm=134217728;class Lm{_state;constructor(t,n,r,s){return cn(n)&&cn(t)?(n=Math.random()*4294967295>>>0,t=0):cn(n)&&(n=t,t=0),cn(s)&&cn(r)?(s=this._state?this._state[3]:jm,r=this._state?this._state[2]:Cm):cn(s)&&(s=r,r=0),this._state=new Int32Array([0,0,r>>>0,((s||0)|1)>>>0]),this._next(),Nc(this._state,this._state[0],this._state[1],t>>>0,n>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=t[3]|1}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){const t=(this._next()&67108863)*1,n=(this._next()&134217727)*1;return(t*Pm+n)/Fm}_next(){const t=this._state[0]>>>0,n=this._state[1]>>>0;Km(this._state,t,n,Mm,Am),Nc(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=t>>>18,s=(n>>>18|t<<14)>>>0;r=(r^t)>>>0,s=(s^n)>>>0;const o=(s>>>27|r<<5)>>>0,i=t>>>27,a=(-i>>>0&31)>>>0;return(o>>>i|o<<a)>>>0}}function Km(e,t,n,r,s){let o=(n>>>16)*(s&65535)>>>0,i=(n&65535)*(s>>>16)>>>0,a=(n&65535)*(s&65535)>>>0,c=(n>>>16)*(s>>>16)+((i>>>16)+(o>>>16))>>>0;i=i<<16>>>0,a=a+i>>>0,a>>>0<i>>>0&&(c=c+1>>>0),o=o<<16>>>0,a=a+o>>>0,a>>>0<o>>>0&&(c=c+1>>>0),c=c+Math.imul(n,r)>>>0,c=c+Math.imul(t,s)>>>0,e[0]=c,e[1]=a}function Nc(e,t,n,r,s){let o=t+r>>>0;const i=n+s>>>0;i>>>0<n>>>0&&(o=o+1|0),e[0]=o,e[1]=i}const ui=Symbol.for("effect/Utils/YieldWrap");class vr{#e;constructor(t){this.#e=t}[ui](){return this.#e}}function Dm(e){if(typeof e=="object"&&e!==null&&ui in e)return e[ui]();throw new Error(Gs("yieldWrapGet"))}const qe=B("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),il={effect_internal_function:e=>e()},Um={effect_internal_function:e=>e()},qm=il.effect_internal_function(()=>new Error().stack)?.includes("effect_internal_function")===!0,Ie=qm?il.effect_internal_function:Um.effect_internal_function,Po=B(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),D=Symbol.for("effect/Hash"),k=e=>{if(qe.enabled===!0)return 0;switch(typeof e){case"number":return oa(e);case"bigint":return se(e.toString(10));case"boolean":return se(String(e));case"symbol":return se(String(e));case"string":return se(e);case"undefined":return se("undefined");case"function":case"object":return e===null?se("null"):e instanceof Date?Number.isNaN(e.getTime())?se("Invalid Date"):k(e.toISOString()):e instanceof URL?k(e.href):Bm(e)?e[D]():sa(e);default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},sa=e=>(Po.has(e)||Po.set(e,oa(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),Po.get(e)),J=e=>t=>t*53^e,Ys=e=>e&3221225471|e>>>1&1073741824,Bm=e=>A(e,D),oa=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Ys(t)},se=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Ys(t)},Jm=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=g(se(t[r]),J(k(e[t[r]])));return Ys(n)},al=e=>Jm(e,Object.keys(e)),Tr=e=>{let t=6151;for(let n=0;n<e.length;n++)t=g(t,J(k(e[n])));return Ys(t)},ne=function(){if(arguments.length===1){const n=arguments[0];return function(r){return Object.defineProperty(n,D,{value(){return r},enumerable:!1}),r}}const e=arguments[0],t=arguments[1];return Object.defineProperty(e,D,{value(){return t},enumerable:!1}),t},L=Symbol.for("effect/Equal");function K(){return arguments.length===1?e=>gs(e,arguments[0]):gs(arguments[0],arguments[1])}function gs(e,t){if(e===t)return!0;const n=typeof e;if(n!==typeof t)return!1;if(n==="object"||n==="function"){if(e!==null&&t!==null){if(ys(e)&&ys(t))return k(e)===k(t)&&e[L](t)?!0:qe.enabled&&qe.tester?qe.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){const r=e.getTime(),s=t.getTime();return r===s||Number.isNaN(r)&&Number.isNaN(s)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(qe.enabled){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,s)=>gs(r,t[s]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){const r=Object.keys(e),s=Object.keys(t);if(r.length===s.length){for(const o of r)if(!(o in t&&gs(e[o],t[o])))return qe.tester?qe.tester(e,t):!1;return!0}}return qe.tester?qe.tester(e,t):!1}}return qe.enabled&&qe.tester?qe.tester(e,t):!1}const ys=e=>A(e,L),ia=()=>K,ee=Symbol.for("nodejs.util.inspect.custom"),le=e=>{try{if(A(e,"toJSON")&&xr(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(le)}catch{return{}}return Wm(e)},Lo="[Circular]";function Vm(e){try{return e.toISOString()}catch{return"Invalid Date"}}function zm(e){try{const t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function cl(e){return ut(e)?JSON.stringify(e):String(e)}function Zt(e,t){const n=new WeakSet,r=(i,a)=>{const c=i?.constructor;return c&&c!==Object.prototype.constructor&&c.name?`${c.name}(${a})`:a},s=i=>{try{return Reflect.ownKeys(i)}catch{return["[ownKeys threw]"]}};function o(i,a=0){if(Array.isArray(i))return n.has(i)?Lo:(n.add(i),`[${i.map(c=>o(c,a)).join(",")}]`);if($m(i))return Vm(i);if(A(i,"toString")&&xr(i.toString)&&i.toString!==Object.prototype.toString&&i.toString!==Array.prototype.toString){const c=zm(i);return i instanceof Error&&i.cause?`${c} (cause: ${o(i.cause,a)})`:c}if(ut(i))return JSON.stringify(i);if(Jt(i)||i==null||na(i)||ci(i))return String(i);if(Ws(i))return String(i)+"n";if(i instanceof Set||i instanceof Map)return n.has(i)?Lo:(n.add(i),`${i.constructor.name}(${o(Array.from(i),a)})`);if(wt(i)){if(n.has(i))return Lo;n.add(i);const c=s(i);{const u=`{${c.map(f=>`${cl(f)}:${o(i[f],a)}`).join(",")}}`;return r(i,u)}}return String(i)}return o(e,0)}const ge=e=>JSON.stringify(e,null,2),yn=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?ul(e,t):String(e)}catch{return String(e)}},ul=(e,t)=>{let n=[];const r=JSON.stringify(e,(s,o)=>typeof o=="object"&&o!==null?n.includes(o)?void 0:n.push(o)&&(Lt.fiberRefs!==void 0&&ll(o)?o[aa](Lt.fiberRefs):o):o,t);return n=void 0,r},aa=Symbol.for("effect/Inspectable/Redactable"),ll=e=>typeof e=="object"&&e!==null&&aa in e,Lt=B("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),Hm=(e,t)=>{const n=Lt.fiberRefs;Lt.fiberRefs=e;try{return t()}finally{Lt.fiberRefs=n}},Wm=e=>ll(e)&&Lt.fiberRefs!==void 0?e[aa](Lt.fiberRefs):e,R=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,s=t.length;r<s;r++)n=t[r](n);return n}}},lr="Async",Qs="Commit",ze="Failure",Ko="OnFailure",bs="OnSuccess",_s="OnSuccessAndFailure",He="Success",fl="Sync",Gm="Tag",Or="UpdateRuntimeFlags",Ss="While",ss="Iterator",dl="WithRuntime",os="Yield",ca="RevertFlags";let Ym="3.19.15";const ua=()=>Ym,Qm=Symbol.for("effect/Effect"),Xm=Symbol.for("effect/Stream"),Zm=Symbol.for("effect/Sink"),eg=Symbol.for("effect/Channel"),bn={_R:e=>e,_E:e=>e,_A:e=>e,_V:ua()},tg={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},ng={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},Nr={[Qm]:bn,[Xm]:bn,[Zm]:tg,[eg]:ng,[L](e){return this===e},[D](){return ne(this,sa(this))},[Symbol.iterator](){return new sl(new vr(this))},pipe(){return R(this,arguments)}},la={[D](){return ne(this,al(this))},[L](e){const t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!(r in e&&K(this[r],e[r])))return!1;return!0}},$r={...Nr,_op:Qs},rg={...$r,...la},sg=(function(){function e(){}return e.prototype=$r,e})(),hl=Symbol.for("effect/Option"),pl={...Nr,[hl]:{_A:e=>e},[ee](){return this.toJSON()},toString(){return ge(this.toJSON())}},og=Object.assign(Object.create(pl),{_tag:"Some",_op:"Some",[L](e){return fa(e)&&gl(e)&&K(this.value,e.value)},[D](){return ne(this,J(k(this._tag))(k(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:le(this.value)}}}),ig=k("None"),ag=Object.assign(Object.create(pl),{_tag:"None",_op:"None",[L](e){return fa(e)&&ml(e)},[D](){return ig},toJSON(){return{_id:"Option",_tag:this._tag}}}),fa=e=>A(e,hl),ml=e=>e._tag==="None",gl=e=>e._tag==="Some",da=Object.create(ag),ws=e=>{const t=Object.create(og);return t.value=e,t},yl=Symbol.for("effect/Either"),bl={...Nr,[yl]:{_R:e=>e},[ee](){return this.toJSON()},toString(){return ge(this.toJSON())}},cg=Object.assign(Object.create(bl),{_tag:"Right",_op:"Right",[L](e){return ha(e)&&Sl(e)&&K(this.right,e.right)},[D](){return J(k(this._tag))(k(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:le(this.right)}}}),ug=Object.assign(Object.create(bl),{_tag:"Left",_op:"Left",[L](e){return ha(e)&&_l(e)&&K(this.left,e.left)},[D](){return J(k(this._tag))(k(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:le(this.left)}}}),ha=e=>A(e,yl),_l=e=>e._tag==="Left",Sl=e=>e._tag==="Right",lg=e=>{const t=Object.create(ug);return t.left=e,t},fg=e=>{const t=Object.create(cg);return t.right=e,t},V=fg,P=lg,dg=ha,he=_l,gt=Sl,hg=d(2,(e,{onLeft:t,onRight:n})=>he(e)?P(t(e.left)):V(n(e.right))),pg=d(2,(e,t)=>he(e)?P(t(e.left)):V(e.right)),mg=d(2,(e,t)=>gt(e)?V(t(e.right)):P(e.left)),pa=d(2,(e,{onLeft:t,onRight:n})=>he(e)?t(e.left):n(e.right)),gg=pa({onLeft:Y,onRight:Y}),wl=d(2,(e,t)=>{if(gt(e))return e.right;throw t(e.left)}),yg=wl(()=>new Error("getOrThrow called on a Left")),kl=e=>e.length>0,Er=e=>(t,n)=>t===n?0:e(t,n),ma=Er((e,t)=>e<t?-1:1),xl=Er((e,t)=>e<t?-1:1),bg=Er((e,t)=>e<t?-1:1),_g=d(2,(e,t)=>Er((n,r)=>{let s=e(n,r);if(s!==0)return s;for(const o of t)if(s=o(n,r),s!==0)return s;return s})),en=d(2,(e,t)=>Er((n,r)=>e(t(n),t(r)))),Sg=e=>d(2,(t,n)=>e(t,n)===1),N=()=>da,I=ws,wg=fa,te=ml,we=gl,Se=d(2,(e,{onNone:t,onSome:n})=>te(e)?t():n(e.value)),ye=d(2,(e,t)=>te(e)?t():e.value),yt=d(2,(e,t)=>te(e)?t():e),kg=d(2,(e,t)=>te(e)?I(t()):e),Xs=e=>e==null?N():I(e),st=ye(nl),xg=e=>(...t)=>{try{return I(e(...t))}catch{return N()}},vl=d(2,(e,t)=>te(e)?N():I(t(e.value))),Dn=d(2,(e,t)=>te(e)?N():t(e.value)),vg=d(2,(e,t)=>te(e)?N():Xs(t(e.value))),Tg=Dn,Xn=d(2,(e,t)=>Tg(e,n=>t(n)?ws(n):da)),Og=e=>Hs((t,n)=>te(t)?te(n):te(n)?!1:e(t.value,n.value)),Ng=e=>d(2,(t,n)=>te(t)?!1:e(t.value,n)),$g=ia(),Eg=Ng($g),Ig=d(2,(e,t)=>te(e)?!1:t(e.value)),Rg=(...e)=>e,Zs=e=>new Array(e),Cg=d(2,(e,t)=>{const n=Math.max(1,Math.floor(e)),r=new Array(n);for(let s=0;s<n;s++)r[s]=t(s);return r}),oe=e=>Array.isArray(e)?e:Array.from(e),jg=e=>Array.isArray(e)?e:[e],Mg=d(2,(e,{onEmpty:t,onNonEmpty:n})=>be(e)?n(Re(e),Vt(e)):t()),ks=d(2,(e,t)=>[t,...e]),Ag=d(2,(e,t)=>[...e,t]),Tl=d(2,(e,t)=>oe(e).concat(oe(t))),Fg=Array.isArray,Pg=e=>e.length===0,Lg=Pg,is=kl,be=kl,Ol=(e,t)=>e<0||e>=t.length,Kg=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),Dg=d(2,(e,t)=>{const n=Math.floor(t);return Ol(n,e)?N():I(e[n])}),Nl=d(2,(e,t)=>{const n=Math.floor(t);if(Ol(n,e))throw new Error(`Index ${n} out of bounds`);return e[n]}),fr=Dg(0),Re=Nl(0),Ug=e=>be(e)?I($l(e)):N(),$l=e=>e[e.length-1],Vt=e=>e.slice(1),qg=(e,t)=>{let n=0;for(const r of e){if(!t(r,n))break;n++}return n},Bg=d(2,(e,t)=>Hg(e,qg(e,t))),Jg=d(2,(e,t)=>{const n=oe(e);return n.slice(Kg(t,n),n.length)}),$c=e=>Array.from(e).reverse(),_n=d(2,(e,t)=>{const n=Array.from(e);return n.sort(t),n}),Ec=d(2,(e,t)=>Vg(e,t,Rg)),Vg=d(3,(e,t,n)=>{const r=oe(e),s=oe(t);if(be(r)&&be(s)){const o=[n(Re(r),Re(s))],i=Math.min(r.length,s.length);for(let a=1;a<i;a++)o[a]=n(r[a],s[a]);return o}return[]}),zg=ia(),Hg=d(2,(e,t)=>{const n=Array.from(e),r=Math.floor(t);return be(n)?r>=1?Wg(n,r):[[],n]:[n,[]]}),Wg=d(2,(e,t)=>{const n=Math.max(1,Math.floor(t));return n>=e.length?[ar(e),[]]:[ks(e.slice(1,n),Re(e)),e.slice(n)]}),ar=e=>e.slice(),Gg=d(3,(e,t,n)=>{const r=oe(e),s=oe(t);return be(r)?be(s)?Rl(n)(Tl(r,s)):r:s}),as=d(2,(e,t)=>Gg(e,t,zg)),Sn=()=>[],Ge=e=>[e],Kt=d(2,(e,t)=>e.map(t)),El=d(2,(e,t)=>{if(Lg(e))return[];const n=[];for(let r=0;r<e.length;r++){const s=t(e[r],r);for(let o=0;o<s.length;o++)n.push(s[o])}return n}),Yg=El(Y),Zn=d(2,(e,t)=>{const n=oe(e),r=[];for(let s=0;s<n.length;s++)t(n[s],s)&&r.push(n[s]);return r}),Il=d(3,(e,t,n)=>oe(e).reduce((r,s,o)=>n(r,s,o),t)),Ic=(e,t)=>{const n=[];let r=e,s;for(;we(s=t(r));){const[o,i]=s.value;n.push(o),r=i}return n},ga=xm,Rl=d(2,(e,t)=>{const n=oe(e);if(be(n)){const r=[Re(n)],s=Vt(n);for(const o of s)r.every(i=>!t(o,i))&&r.push(o);return r}return[]}),Qg=e=>Rl(e,ia()),Un=d(2,(e,t)=>oe(e).join(t)),Cl=(e,t)=>{switch(t._tag){case"StringKeyword":case"TemplateLiteral":return Object.keys(e);case"SymbolKeyword":return Object.getOwnPropertySymbols(e);case"Refinement":return Cl(e,t.from)}},jl=e=>{let t=!1,n;return()=>(t||(n=e(),t=!0),n)},Ml=e=>Array.isArray(e),Rc=e=>`[${cl(e)}]`,Xg=e=>Ml(e)?e.map(Rc).join(""):Rc(e),tn=(e,t,n,r)=>{let s=e;return t!==void 0&&(s+=`
2
- details: ${t}`),r&&(s+=`
3
- schema (${r._tag}): ${r}`),s},Zg=e=>tn("Unsupported key schema",void 0,void 0,e),ey=e=>tn("Unsupported literal",`literal value: ${Zt(e)}`),Cc=e=>tn("Duplicate index signature",`${e} index signature`),ty=tn("Unsupported index signature parameter","An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),ny=tn("Invalid element","A required element cannot follow an optional element. ts(1257)"),jc=e=>tn("Duplicate property signature transformation",`Duplicate key ${Zt(e)}`),ry=e=>tn("Duplicate property signature",`Duplicate key ${Zt(e)}`),wn=xl,xs=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),sy=Symbol.for("effect/annotation/TypeConstructor"),oy=Symbol.for("effect/annotation/Brand"),iy=Symbol.for("effect/annotation/SchemaId"),Al=Symbol.for("effect/annotation/Message"),ya=Symbol.for("effect/annotation/MissingMessage"),ba=Symbol.for("effect/annotation/Identifier"),kt=Symbol.for("effect/annotation/Title"),li=Symbol.for("effect/annotation/AutoTitle"),Ir=Symbol.for("effect/annotation/Description"),Fl=Symbol.for("effect/annotation/Examples"),Pl=Symbol.for("effect/annotation/Default"),Ll=Symbol.for("effect/annotation/JSONSchema"),Kl=Symbol.for("effect/annotation/Arbitrary"),Dl=Symbol.for("effect/annotation/Pretty"),Ul=Symbol.for("effect/annotation/Equivalence"),ay=Symbol.for("effect/annotation/Documentation"),ql=Symbol.for("effect/annotation/Concurrency"),Bl=Symbol.for("effect/annotation/Batching"),Jl=Symbol.for("effect/annotation/ParseIssueTitle"),Vl=Symbol.for("effect/annotation/ParseOptions"),zl=Symbol.for("effect/annotation/DecodingFallback"),Hl=Symbol.for("effect/annotation/Surrogate"),cy=Symbol.for("effect/annotation/StableFilter"),Ce=d(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?I(e.annotations[t]):N()),uy=Ce(oy),ly=Ce(Al),fy=Ce(ya),Wl=Ce(kt),Gl=Ce(li),eo=Ce(ba),Yl=Ce(Ir),dy=Ce(ql),hy=Ce(Bl),py=Ce(Jl),my=Ce(Vl),gy=Ce(zl),Ql=Ce(Hl),yy=Ce(cy),by=e=>Ig(yy(e),t=>t===!0),Xl=Symbol.for("effect/annotation/JSONIdentifier"),_y=Ce(Xl),Sy=e=>yt(_y(e),()=>eo(e));class to{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag="Declaration";constructor(t,n,r,s={}){this.typeParameters=t,this.decodeUnknown=n,this.encodeUnknown=r,this.annotations=s}toString(){return ye(lt(this),()=>"<declaration schema>")}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(t=>t.toJSON()),annotations:fe(this.annotations)}}}const Rr=e=>t=>t._tag===e;let vs=class{literal;annotations;_tag="Literal";constructor(t,n={}){this.literal=t,this.annotations=n}toString(){return ye(lt(this),()=>Zt(this.literal))}toJSON(){return{_tag:this._tag,literal:Ws(this.literal)?String(this.literal):this.literal,annotations:fe(this.annotations)}}};const Mc=Rr("Literal"),wy=new vs(null);class ky{symbol;annotations;_tag="UniqueSymbol";constructor(t,n={}){this.symbol=t,this.annotations=n}toString(){return ye(lt(this),()=>Zt(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:fe(this.annotations)}}}class xy{annotations;_tag="UndefinedKeyword";constructor(t={}){this.annotations=t}toString(){return rn(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const vy=new xy({[kt]:"undefined"});class Ty{annotations;_tag="NeverKeyword";constructor(t={}){this.annotations=t}toString(){return rn(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const Zl=new Ty({[kt]:"never"});class Oy{annotations;_tag="UnknownKeyword";constructor(t={}){this.annotations=t}toString(){return rn(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const ef=new Oy({[kt]:"unknown"});class Ny{annotations;_tag="AnyKeyword";constructor(t={}){this.annotations=t}toString(){return rn(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const $y=new Ny({[kt]:"any"});class Ey{annotations;_tag="StringKeyword";constructor(t={}){this.annotations=t}toString(){return rn(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const Iy=new Ey({[kt]:"string",[Ir]:"a string"}),Ry=Rr("StringKeyword");class Cy{annotations;_tag="NumberKeyword";constructor(t={}){this.annotations=t}toString(){return rn(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const jy=new Cy({[kt]:"number",[Ir]:"a number"});class My{annotations;_tag="BooleanKeyword";constructor(t={}){this.annotations=t}toString(){return rn(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const Ay=new My({[kt]:"boolean",[Ir]:"a boolean"}),Fy=Rr("SymbolKeyword");let no=class{type;annotations;constructor(t,n={}){this.type=t,this.annotations=n}toJSON(){return{type:this.type.toJSON(),annotations:fe(this.annotations)}}toString(){return String(this.type)}};class nn extends no{isOptional;constructor(t,n,r={}){super(t,r),this.isOptional=n}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:fe(this.annotations)}}toString(){return String(this.type)+(this.isOptional?"?":"")}}const tf=e=>e.map(t=>t.type);class _a{elements;rest;isReadonly;annotations;_tag="TupleType";constructor(t,n,r,s={}){this.elements=t,this.rest=n,this.isReadonly=r,this.annotations=s;let o=!1,i=!1;for(const a of t)if(a.isOptional)o=!0;else if(o){i=!0;break}if(i||o&&n.length>1)throw new Error(ny)}toString(){return ye(lt(this),()=>Py(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(t=>t.toJSON()),rest:this.rest.map(t=>t.toJSON()),isReadonly:this.isReadonly,annotations:fe(this.annotations)}}}const Py=e=>{const t=e.elements.map(String).join(", ");return Mg(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{const s=String(n),o=s.includes(" | ")?`(${s})`:s;if(r.length>0){const i=r.map(String).join(", ");return e.elements.length>0?`readonly [${t}, ...${o}[], ${i}]`:`readonly [...${o}[], ${i}]`}else return e.elements.length>0?`readonly [${t}, ...${o}[]]`:`ReadonlyArray<${s}>`}})};class Te extends nn{name;isReadonly;constructor(t,n,r,s,o){super(n,r,o),this.name=t,this.isReadonly=s}toString(){return(this.isReadonly?"readonly ":"")+String(this.name)+(this.isOptional?"?":"")+": "+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:fe(this.annotations)}}}const nf=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return!0;case"Refinement":return nf(e.from)}return!1};class ro{type;isReadonly;parameter;constructor(t,n,r){if(this.type=n,this.isReadonly=r,nf(t))this.parameter=t;else throw new Error(ty)}toString(){return(this.isReadonly?"readonly ":"")+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}}class Dt{annotations;_tag="TypeLiteral";propertySignatures;indexSignatures;constructor(t,n,r={}){this.annotations=r;const s={};for(let i=0;i<t.length;i++){const a=t[i].name;if(Object.prototype.hasOwnProperty.call(s,a))throw new Error(ry(a));s[a]=null}const o={string:!1,symbol:!1};for(let i=0;i<n.length;i++){const a=lf(n[i].parameter);if(Ry(a)){if(o.string)throw new Error(Cc("string"));o.string=!0}else if(Fy(a)){if(o.symbol)throw new Error(Cc("symbol"));o.symbol=!0}}this.propertySignatures=t,this.indexSignatures=n}toString(){return ye(lt(this),()=>Ly(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(t=>t.toJSON()),indexSignatures:this.indexSignatures.map(t=>t.toJSON()),annotations:fe(this.annotations)}}}const Ac=e=>e.map(String).join("; "),Ly=e=>{if(e.propertySignatures.length>0){const t=e.propertySignatures.map(String).join("; ");return e.indexSignatures.length>0?`{ ${t}; ${Ac(e.indexSignatures)} }`:`{ ${t} }`}else return e.indexSignatures.length>0?`{ ${Ac(e.indexSignatures)} }`:"{}"},Ky=_n(en(wn,e=>{switch(e._tag){case"AnyKeyword":return 0;case"UnknownKeyword":return 1;case"ObjectKeyword":return 2;case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":return 3}return 4})),Dy={string:"StringKeyword",number:"NumberKeyword",boolean:"BooleanKeyword",bigint:"BigIntKeyword"},rf=e=>El(e,t=>sf(t)?rf(t.types):[t]),Uy=e=>{const t=Ky(e),n=[],r={},s=[];for(const o of t)switch(o._tag){case"NeverKeyword":break;case"AnyKeyword":return[$y];case"UnknownKeyword":return[ef];case"ObjectKeyword":case"UndefinedKeyword":case"VoidKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":{r[o._tag]||(r[o._tag]=o,n.push(o));break}case"Literal":{const i=typeof o.literal;switch(i){case"string":case"number":case"bigint":case"boolean":{const a=Dy[i];!r[a]&&!s.includes(o.literal)&&(s.push(o.literal),n.push(o));break}case"object":{s.includes(o.literal)||(s.push(o.literal),n.push(o));break}}break}case"UniqueSymbol":{!r.SymbolKeyword&&!s.includes(o.symbol)&&(s.push(o.symbol),n.push(o));break}case"TupleType":{r.ObjectKeyword||n.push(o);break}case"TypeLiteral":{o.propertySignatures.length===0&&o.indexSignatures.length===0?r["{}"]||(r["{}"]=o,n.push(o)):r.ObjectKeyword||n.push(o);break}default:n.push(o)}return n};let ot=class fi{types;annotations;static make=(t,n)=>Sa(t)?new fi(t,n):t.length===1?t[0]:Zl;static unify=(t,n)=>fi.make(Uy(rf(t)),n);_tag="Union";constructor(t,n={}){this.types=t,this.annotations=n}toString(){return ye(lt(this),()=>this.types.map(String).join(" | "))}toJSON(){return{_tag:this._tag,types:this.types.map(t=>t.toJSON()),annotations:fe(this.annotations)}}};const qy=(e,t)=>e.map(t),Sa=e=>e.length>1,sf=Rr("Union"),Do=B(Symbol.for("effect/Schema/AST/toJSONMemoMap"),()=>new WeakMap);class of{f;annotations;_tag="Suspend";constructor(t,n={}){this.f=t,this.annotations=n,this.f=jl(t)}toString(){return lt(this).pipe(yt(()=>Dn(xg(this.f)(),t=>lt(t))),ye(()=>"<suspended schema>"))}toJSON(){const t=this.f();let n=Do.get(t);return n||(Do.set(t,{_tag:this._tag}),n={_tag:this._tag,ast:t.toJSON(),annotations:fe(this.annotations)},Do.set(t,n),n)}}let By=class{from;filter;annotations;_tag="Refinement";constructor(t,n,r={}){this.from=t,this.filter=n,this.annotations=r}toString(){return eo(this).pipe(ye(()=>Se(ff(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:t=>wa(this.from)?String(this.from)+" & "+t:t})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:fe(this.annotations)}}};const wa=Rr("Refinement"),Uo={};let Jy=class{from;to;transformation;annotations;_tag="Transformation";constructor(t,n,r,s={}){this.from=t,this.to=n,this.transformation=r,this.annotations=s}toString(){return ye(lt(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:fe(this.annotations)}}},Vy=class{from;to;decode;encode;constructor(t,n,r,s){this.from=t,this.to=n,this.decode=r,this.encode=s}};class zy{propertySignatureTransformations;_tag="TypeLiteralTransformation";constructor(t){this.propertySignatureTransformations=t;const n={},r={};for(const s of t){const o=s.from;if(n[o])throw new Error(jc(o));n[o]=!0;const i=s.to;if(r[i])throw new Error(jc(i));r[i]=!0}}}const ka=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[ba];const s={...r,...t},o=Ql(e);return we(o)&&(s[Hl]=ka(o.value,t)),n.annotations.value=s,Object.create(Object.getPrototypeOf(e),n)},Hy="[\\s\\S]*?",Wy="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",af=(e,t)=>{switch(e._tag){case"Literal":return xs(String(e.literal));case"StringKeyword":return Hy;case"NumberKeyword":return Wy;case"TemplateLiteral":return cf(e);case"Union":return e.types.map(n=>af(n)).join("|")}},Gy=(e,t,n,r)=>sf(e)?`(${t})`:t,cf=(e,t,n)=>{let r="";if(e.head!==""){const s=xs(e.head);r+=s}for(const s of e.spans){const o=af(s.type);if(r+=Gy(s.type,o),s.literal!==""){const i=xs(s.literal);r+=i}}return r},Yy=e=>new RegExp(`^${cf(e)}$`),Fc=(e,t)=>{const n=[],r=[],s=o=>{switch(o._tag){case"NeverKeyword":break;case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":case"Refinement":r.push(new ro(o,t,!0));break;case"Literal":if(ut(o.literal)||Jt(o.literal))n.push(new Te(o.literal,t,!1,!0));else throw new Error(ey(o.literal));break;case"Enums":{for(const[i,a]of o.enums)n.push(new Te(a,t,!1,!0));break}case"UniqueSymbol":n.push(new Te(o.symbol,t,!1,!0));break;case"Union":o.types.forEach(s);break;default:throw new Error(Zg(o))}};return s(e),{propertySignatures:n,indexSignatures:r}},uf=e=>t=>{let n;for(const r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},Qy=uf([Fl,Pl,Ll,Kl,Dl,Ul]),pe=e=>{switch(e._tag){case"Declaration":{const t=Je(e.typeParameters,pe);return t===e.typeParameters?e:new to(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case"TupleType":{const t=Je(e.elements,s=>{const o=pe(s.type);return o===s.type?s:new nn(o,s.isOptional)}),n=tf(e.rest),r=Je(n,pe);return t===e.elements&&r===n?e:new _a(t,r.map(s=>new no(s)),e.isReadonly,e.annotations)}case"TypeLiteral":{const t=Je(e.propertySignatures,r=>{const s=pe(r.type);return s===r.type?r:new Te(r.name,s,r.isOptional,r.isReadonly)}),n=Je(e.indexSignatures,r=>{const s=pe(r.type);return s===r.type?r:new ro(r.parameter,s,r.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new Dt(t,n,e.annotations)}case"Union":{const t=Je(e.types,pe);return t===e.types?e:ot.make(t,e.annotations)}case"Suspend":return new of(()=>pe(e.f()),e.annotations);case"Refinement":{const t=pe(e.from);return t===e.from?e:new By(t,e.filter,e.annotations)}case"Transformation":{const t=Qy(e);return pe(t!==void 0?ka(e.to,t):e.to)}}return e};function Je(e,t){let n=!1;const r=Zs(e.length);for(let s=0;s<e.length;s++){const o=e[s],i=t(o);i!==o&&(n=!0),r[s]=i}return n?r:e}const tt=(e,t)=>{switch(e._tag){case"Declaration":{const n=Je(e.typeParameters,r=>tt(r));return n===e.typeParameters?e:new to(n,e.decodeUnknown,e.encodeUnknown)}case"TupleType":{const n=Je(e.elements,o=>{const i=tt(o.type);return i===o.type?o:new nn(i,o.isOptional)}),r=tf(e.rest),s=Je(r,o=>tt(o));return n===e.elements&&s===r?e:new _a(n,s.map(o=>new no(o)),e.isReadonly)}case"TypeLiteral":{const n=Je(e.propertySignatures,s=>{const o=tt(s.type);return o===s.type?s:new Te(s.name,o,s.isOptional,s.isReadonly)}),r=Je(e.indexSignatures,s=>{const o=tt(s.type);return o===s.type?s:new ro(s.parameter,o,s.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new Dt(n,r)}case"Union":{const n=Je(e.types,r=>tt(r));return n===e.types?e:ot.make(n)}case"Suspend":{let n;const r=Sy(e);return we(r)&&(n={[Xl]:`${r.value}Encoded`}),new of(()=>tt(e.f()),n)}case"Refinement":return tt(e.from);case"Transformation":return tt(e.from)}return e},Pc=e=>tt(e),fe=e=>{const t={};for(const n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},lf=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return e;case"Refinement":return lf(e.from)}},rn=e=>ye(lt(e),()=>e._tag);function Xy(e){return Se(uy(e),{onNone:()=>"",onSome:t=>t.map(n=>` & Brand<${Zt(n)}>`).join("")})}const ff=e=>Wl(e).pipe(yt(()=>Yl(e)),yt(()=>Gl(e)),vl(t=>t+Xy(e))),lt=e=>yt(eo(e),()=>ff(e)),Zy=Symbol.for("effect/Context/Tag"),Ts=Symbol.for("effect/Context/Reference"),eb="effect/STM",tb=Symbol.for(eb),df={...Nr,_op:"Tag",[tb]:bn,[Zy]:{_Service:e=>e,_Identifier:e=>e},toString(){return ge(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[ee](){return this.toJSON()},of(e){return e},context(e){return pf(this,e)}},nb={...df,[Ts]:Ts},rb=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;const r=Object.create(df);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=e,r},sb=()=>(e,t)=>{const n=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=n;function s(){}return Object.setPrototypeOf(s,nb),s.key=e,s.defaultValue=t.defaultValue,Object.defineProperty(s,"stack",{get(){return r.stack}}),s},hf=Symbol.for("effect/Context"),ob={[hf]:{_Services:e=>e},[L](e){if(ab(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!K(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[D](){return ne(this,oa(this.unsafeMap.size))},pipe(){return R(this,arguments)},toString(){return ge(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(le)}},[ee](){return this.toJSON()}},kn=e=>{const t=Object.create(ob);return t.unsafeMap=e,t},ib=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
4
- `);if(n.length>2){const r=n[2].match(/at (.*)/);r&&(t.message=t.message+` (defined at ${r[1]})`)}}if(t.stack){const n=t.stack.split(`
5
- `);n.splice(1,3),t.stack=n.join(`
6
- `)}return t},ab=e=>A(e,hf),cb=e=>A(e,Ts),ub=kn(new Map),lb=()=>ub,pf=(e,t)=>kn(new Map([[e.key,t]])),fb=d(3,(e,t,n)=>{const r=new Map(e.unsafeMap);return r.set(t.key,n),kn(r)}),qo=B("effect/Context/defaultValueCache",()=>new Map),xa=e=>{if(qo.has(e.key))return qo.get(e.key);const t=e.defaultValue();return qo.set(e.key,t),t},db=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):xa(t),mf=d(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(Ts in t)return xa(t);throw ib(t)}return e.unsafeMap.get(t.key)}),hb=mf,pb=d(2,(e,t)=>e.unsafeMap.has(t.key)?ws(e.unsafeMap.get(t.key)):cb(t)?ws(xa(t)):da),mb=d(2,(e,t)=>{const n=new Map(e.unsafeMap);for(const[r,s]of t.unsafeMap)n.set(r,s);return kn(n)}),sn=rb,va=lb,gb=pf,er=fb,gf=hb,yf=mf,Cr=pb,bf=mb,_f=sb,Sf=Symbol.for("effect/Chunk");function yb(e,t,n,r,s){for(let o=t;o<Math.min(e.length,t+s);o++)n[r+o-t]=e[o];return n}const wf=[],bb=e=>Hs((t,n)=>t.length===n.length&&Ut(t).every((r,s)=>e(r,pn(n,s)))),_b=bb(K),Sb={[Sf]:{_A:e=>e},toString(){return ge(this.toJSON())},toJSON(){return{_id:"Chunk",values:Ut(this).map(le)}},[ee](){return this.toJSON()},[L](e){return kf(e)&&_b(this,e)},[D](){return ne(this,Tr(Ut(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return wf[Symbol.iterator]();default:return Ut(this)[Symbol.iterator]()}},pipe(){return R(this,arguments)}},ae=e=>{const t=Object.create(Sb);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=it,t.right=it;break}case"ISingleton":{t.length=1,t.depth=0,t.left=it,t.right=it;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=it,t.right=it;break}}return t},kf=e=>A(e,Sf),it=ae({_tag:"IEmpty"}),_t=()=>it,Bo=(...e)=>xb(e),Le=e=>ae({_tag:"ISingleton",a:e}),xf=e=>kf(e)?e:so(oe(e)),di=(e,t,n)=>{switch(e.backing._tag){case"IArray":{yb(e.backing.array,0,t,n,e.length);break}case"IConcat":{di(e.left,t,n),di(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,s=n;for(;r<e.length;)t[s]=pn(e,r),r+=1,s+=1;break}}},wb=e=>{switch(e.backing._tag){case"IEmpty":return wf;case"IArray":return e.backing.array;default:{const t=new Array(e.length);return di(e,t,0),e.backing={_tag:"IArray",array:t},e.left=it,e.right=it,e.depth=0,t}}},Ut=wb,kb=e=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return ae({_tag:"IArray",array:$c(e.backing.array)});case"IConcat":return ae({_tag:"IConcat",left:xn(e.backing.right),right:xn(e.backing.left)});case"ISlice":return so($c(Ut(e)))}},xn=kb,so=e=>e.length===0?_t():e.length===1?Le(e[0]):ae({_tag:"IArray",array:e}),xb=e=>so(e),pn=d(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(t!==0)throw new Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw new Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?pn(e.left,t):pn(e.right,t-e.left.length);case"ISlice":return pn(e.backing.chunk,t+e.backing.offset)}}),vb=d(2,(e,t)=>Ye(e,Le(t))),Xe=d(2,(e,t)=>Ye(Le(t),e)),hi=d(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return it;switch(e.backing._tag){case"ISlice":return ae({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":return t>e.left.length?hi(e.right,t-e.left.length):ae({_tag:"IConcat",left:hi(e.left,t),right:e.right});default:return ae({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),Ye=d(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;const n=t.depth-e.depth;if(Math.abs(n)<=1)return ae({_tag:"IConcat",left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){const r=Ye(e.right,t);return ae({_tag:"IConcat",left:e.left,right:r})}else{const r=Ye(e.right.right,t);if(r.depth===e.depth-3){const s=ae({_tag:"IConcat",left:e.right.left,right:r});return ae({_tag:"IConcat",left:e.left,right:s})}else{const s=ae({_tag:"IConcat",left:e.left,right:e.right.left});return ae({_tag:"IConcat",left:s,right:r})}}else if(t.right.depth>=t.left.depth){const r=Ye(e,t.left);return ae({_tag:"IConcat",left:r,right:t.right})}else{const r=Ye(e,t.left.left);if(r.depth===t.depth-3){const s=ae({_tag:"IConcat",left:r,right:t.left.right});return ae({_tag:"IConcat",left:s,right:t.right})}else{const s=ae({_tag:"IConcat",left:t.left.right,right:t.right});return ae({_tag:"IConcat",left:r,right:s})}}}),Tb=e=>e.length===0,vn=e=>e.length>0,vf=e=>pn(e,0),Tn=vf,At=e=>hi(e,1),pi=Symbol.for("effect/Duration"),Tf=BigInt(0),Lc=BigInt(24),Wr=BigInt(60),mi=BigInt(1e3),Kc=BigInt(1e6),Dc=BigInt(1e9),Ob=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,St=e=>{if(Of(e))return e;if(Jt(e))return gi(e);if(Ws(e))return Jo(e);if(Array.isArray(e)&&e.length===2&&e.every(Jt))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?Nf:e[0]===1/0||e[1]===1/0?Ib:Jo(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(ut(e)){const t=Ob.exec(e);if(t){const[n,r,s]=t,o=Number(r);switch(s){case"nano":case"nanos":return Jo(BigInt(r));case"micro":case"micros":return Rb(BigInt(r));case"milli":case"millis":return gi(o);case"second":case"seconds":return Cb(o);case"minute":case"minutes":return jb(o);case"hour":case"hours":return Mb(o);case"day":case"days":return Ab(o);case"week":case"weeks":return Fb(o)}}}throw new Error("Invalid DurationInput")},Uc={_tag:"Millis",millis:0},Nb={_tag:"Infinity"},$b={[pi]:pi,[D](){return ne(this,al(this.value))},[L](e){return Of(e)&&Bb(this,e)},toString(){return`Duration(${Vb(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:Lb(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},ft=e=>{const t=Object.create($b);return Jt(e)?isNaN(e)||e<=0?t.value=Uc:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=Nb:e<=Tf?t.value=Uc:t.value={_tag:"Nanos",nanos:e},t},Of=e=>A(e,pi),Eb=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Tf;case"Infinity":return!1}},Nf=ft(0),Ib=ft(1/0),Jo=e=>ft(e),Rb=e=>ft(e*mi),gi=e=>ft(e),Cb=e=>ft(e*1e3),jb=e=>ft(e*6e4),Mb=e=>ft(e*36e5),Ab=e=>ft(e*864e5),Fb=e=>ft(e*6048e5),yi=e=>Kb(e,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),Pb=e=>{const t=St(e);switch(t.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},Lb=e=>{const t=St(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/Dc),Number(t.value.nanos%Dc)];case"Millis":return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},Kb=d(2,(e,t)=>{const n=St(e);switch(n.value._tag){case"Nanos":return t.onNanos(n.value.nanos);case"Infinity":return t.onMillis(1/0);case"Millis":return t.onMillis(n.value.millis)}}),Ta=d(3,(e,t,n)=>{const r=St(e),s=St(t);if(r.value._tag==="Infinity"||s.value._tag==="Infinity")return n.onMillis(yi(r),yi(s));if(r.value._tag==="Nanos"||s.value._tag==="Nanos"){const o=r.value._tag==="Nanos"?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),i=s.value._tag==="Nanos"?s.value.nanos:BigInt(Math.round(s.value.millis*1e6));return n.onNanos(o,i)}return n.onMillis(r.value.millis,s.value.millis)}),Db=(e,t)=>Ta(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r}),Ub=d(2,(e,t)=>Ta(e,t,{onMillis:(n,r)=>n<=r,onNanos:(n,r)=>n<=r})),qb=d(2,(e,t)=>Ta(e,t,{onMillis:(n,r)=>n>=r,onNanos:(n,r)=>n>=r})),Bb=d(2,(e,t)=>Db(St(e),St(t))),Jb=e=>{const t=St(e);if(t.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const n=Pb(t),r=n/Kc,s=r/mi,o=s/Wr,i=o/Wr,a=i/Lc;return{days:Number(a),hours:Number(i%Lc),minutes:Number(o%Wr),seconds:Number(s%Wr),millis:Number(r%mi),nanos:Number(n%Kc)}},Vb=e=>{const t=St(e);if(t.value._tag==="Infinity")return"Infinity";if(Eb(t))return"0";const n=Jb(t),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(" ")},zt=5,Oa=Math.pow(2,zt),zb=Oa-1,Hb=Oa/2,Wb=Oa/4;function Gb(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function On(e,t){return t>>>e&zb}function dn(e){return 1<<e}function $f(e,t){return Gb(e&t-1)}const Yb=(e,t)=>({value:e,previous:t});function mn(e,t,n,r){let s=r;if(!e){const o=r.length;s=new Array(o);for(let i=0;i<o;++i)s[i]=r[i]}return s[t]=n,s}function Ef(e,t,n){const r=n.length-1;let s=0,o=0,i=n;if(e)s=o=t;else for(i=new Array(r);s<t;)i[o++]=n[s++];for(++s;s<=r;)i[o++]=n[s++];return e&&(i.length=r),i}function Qb(e,t,n,r){const s=r.length;if(e){let c=s;for(;c>=t;)r[c--]=r[c];return r[t]=n,r}let o=0,i=0;const a=new Array(s+1);for(;o<t;)a[i++]=r[o++];for(a[t]=n;o<s;)a[++i]=r[o++];return a}class It{_tag="EmptyNode";modify(t,n,r,s,o,i){const a=r(N());return te(a)?new It:(++i.value,new qt(t,s,o,a))}}function Qe(e){return rl(e,"EmptyNode")}function Xb(e){return Qe(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function oo(e,t){return Qe(e)?!1:t===e.edit}class qt{edit;hash;key;value;_tag="LeafNode";constructor(t,n,r,s){this.edit=t,this.hash=n,this.key=r,this.value=s}modify(t,n,r,s,o,i){if(K(o,this.key)){const c=r(this.value);return c===this.value?this:te(c)?(--i.value,new It):oo(this,t)?(this.value=c,this):new qt(t,s,o,c)}const a=r(N());return te(a)?this:(++i.value,If(t,n,this.hash,this,s,new qt(t,s,o,a)))}}class Na{edit;hash;children;_tag="CollisionNode";constructor(t,n,r){this.edit=t,this.hash=n,this.children=r}modify(t,n,r,s,o,i){if(s===this.hash){const c=oo(this,t),u=this.updateCollisionList(c,t,this.hash,this.children,r,o,i);return u===this.children?this:u.length>1?new Na(t,this.hash,u):u[0]}const a=r(N());return te(a)?this:(++i.value,If(t,n,this.hash,this,s,new qt(t,s,o,a)))}updateCollisionList(t,n,r,s,o,i,a){const c=s.length;for(let f=0;f<c;++f){const h=s[f];if("key"in h&&K(i,h.key)){const p=h.value,m=o(p);return m===p?s:te(m)?(--a.value,Ef(t,f,s)):mn(t,f,new qt(n,r,i,m),s)}}const u=o(N());return te(u)?s:(++a.value,mn(t,c,new qt(n,r,i,u),s))}}class Nn{edit;mask;children;_tag="IndexedNode";constructor(t,n,r){this.edit=t,this.mask=n,this.children=r}modify(t,n,r,s,o,i){const a=this.mask,c=this.children,u=On(n,s),f=dn(u),h=$f(a,f),p=a&f,m=oo(this,t);if(!p){const F=new It().modify(t,n+zt,r,s,o,i);return F?c.length>=Hb?e_(t,u,F,a,c):new Nn(t,a|f,Qb(m,h,F,c)):this}const y=c[h],T=y.modify(t,n+zt,r,s,o,i);if(y===T)return this;let S=a,w;if(Qe(T)){if(S&=~f,!S)return new It;if(c.length<=2&&Xb(c[h^1]))return c[h^1];w=Ef(m,h,c)}else w=mn(m,h,T,c);return m?(this.mask=S,this.children=w,this):new Nn(t,S,w)}}class $a{edit;size;children;_tag="ArrayNode";constructor(t,n,r){this.edit=t,this.size=n,this.children=r}modify(t,n,r,s,o,i){let a=this.size;const c=this.children,u=On(n,s),f=c[u],h=(f||new It).modify(t,n+zt,r,s,o,i);if(f===h)return this;const p=oo(this,t);let m;if(Qe(f)&&!Qe(h))++a,m=mn(p,u,h,c);else if(!Qe(f)&&Qe(h)){if(--a,a<=Wb)return Zb(t,a,u,c);m=mn(p,u,new It,c)}else m=mn(p,u,h,c);return p?(this.size=a,this.children=m,this):new $a(t,a,m)}}function Zb(e,t,n,r){const s=new Array(t-1);let o=0,i=0;for(let a=0,c=r.length;a<c;++a)if(a!==n){const u=r[a];u&&!Qe(u)&&(s[o++]=u,i|=1<<a)}return new Nn(e,i,s)}function e_(e,t,n,r,s){const o=[];let i=r,a=0;for(let c=0;i;++c)i&1&&(o[c]=s[a++]),i>>>=1;return o[t]=n,new $a(e,a+1,o)}function t_(e,t,n,r,s,o){if(n===s)return new Na(e,n,[o,r]);const i=On(t,n),a=On(t,s);if(i===a)return c=>new Nn(e,dn(i)|dn(a),[c]);{const c=i<a?[r,o]:[o,r];return new Nn(e,dn(i)|dn(a),c)}}function If(e,t,n,r,s,o){let i,a=t;for(;;){const c=t_(e,a,n,r,s,o);if(typeof c=="function")i=Yb(c,i),a=a+zt;else{let u=c;for(;i!=null;)u=i.value(u),i=i.previous;return u}}}const Rf="effect/HashMap",bi=Symbol.for(Rf),n_={[bi]:bi,[Symbol.iterator](){return new io(this,(e,t)=>[e,t])},[D](){let e=k(Rf);for(const t of this)e^=g(k(t[0]),J(k(t[1])));return ne(this,e)},[L](e){if(o_(e)){if(e._size!==this._size)return!1;for(const t of this){const n=g(e,Ia(t[0],k(t[0])));if(te(n))return!1;if(!K(t[1],n.value))return!1}return!0}return!1},toString(){return ge(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(le)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},Ea=(e,t,n,r)=>{const s=Object.create(n_);return s._editable=e,s._edit=t,s._root=n,s._size=r,s};class io{map;f;v;constructor(t,n){this.map=t,this.f=n,this.v=Cf(this.map._root,this.f,void 0)}next(){if(te(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=Os(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new io(this.map,this.f)}}const Os=e=>e?jf(e[0],e[1],e[2],e[3],e[4]):N(),Cf=(e,t,n=void 0)=>{switch(e._tag){case"LeafNode":return we(e.value)?I({value:t(e.key,e.value.value),cont:n}):Os(n);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const r=e.children;return jf(r.length,r,0,t,n)}default:return Os(n)}},jf=(e,t,n,r,s)=>{for(;n<e;){const o=t[n++];if(o&&!Qe(o))return Cf(o,r,[e,t,n,r,s])}return Os(s)},r_=Ea(!1,0,new It,0),ao=()=>r_,s_=e=>{const t=Af(ao());for(const n of e)mr(t,n[0],n[1]);return l_(t)},o_=e=>A(e,bi),i_=e=>e&&Qe(e._root),a_=d(2,(e,t)=>Ia(e,t,k(t))),Ia=d(3,(e,t,n)=>{let r=e._root,s=0;for(;;)switch(r._tag){case"LeafNode":return K(t,r.key)?r.value:N();case"CollisionNode":{if(n===r.hash){const o=r.children;for(let i=0,a=o.length;i<a;++i){const c=o[i];if("key"in c&&K(t,c.key))return c.value}}return N()}case"IndexedNode":{const o=On(s,n),i=dn(o);if(r.mask&i){r=r.children[$f(r.mask,i)],s+=zt;break}return N()}case"ArrayNode":{if(r=r.children[On(s,n)],r){s+=zt;break}return N()}default:return N()}}),c_=d(2,(e,t)=>we(Ia(e,t,k(t)))),mr=d(3,(e,t,n)=>Ra(e,t,()=>I(n))),u_=d(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:Ea(e._editable,e._edit,t,n)),Mf=e=>new io(e,t=>t),_i=e=>e._size,Af=e=>Ea(!0,e._edit+1,e._root,e._size),l_=e=>(e._editable=!1,e),Ra=d(3,(e,t,n)=>f_(e,t,k(t),n)),f_=d(4,(e,t,n,r)=>{const s={value:e._size},o=e._root.modify(e._editable?e._edit:NaN,0,r,n,t,s);return g(e,u_(o,s.value))}),qc=d(2,(e,t)=>Ra(e,t,N)),d_=d(2,(e,t)=>co(e,ao(),(n,r,s)=>mr(n,s,t(r,s)))),h_=d(2,(e,t)=>co(e,void 0,(n,r,s)=>t(r,s))),co=d(3,(e,t,n)=>{const r=e._root;if(r._tag==="LeafNode")return we(r.value)?n(t,r.value.value,r.key):t;if(r._tag==="EmptyNode")return t;const s=[r.children];let o;for(;o=s.pop();)for(let i=0,a=o.length;i<a;){const c=o[i++];c&&!Qe(c)&&(c._tag==="LeafNode"?we(c.value)&&(t=n(t,c.value.value,c.key)):s.push(c.children))}return t}),Ff="effect/HashSet",Si=Symbol.for(Ff),p_={[Si]:Si,[Symbol.iterator](){return Mf(this._keyMap)},[D](){return ne(this,J(k(this._keyMap))(k(Ff)))},[L](e){return m_(e)?_i(this._keyMap)===_i(e._keyMap)&&K(this._keyMap,e._keyMap):!1},toString(){return ge(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(le)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},uo=e=>{const t=Object.create(p_);return t._keyMap=e,t},m_=e=>A(e,Si),g_=uo(ao()),lo=()=>g_,y_=e=>{const t=Ca(lo());for(const n of e)gr(t,n);return ja(t)},b_=(...e)=>{const t=Ca(lo());for(const n of e)gr(t,n);return ja(t)},__=d(2,(e,t)=>c_(e._keyMap,t)),S_=e=>_i(e._keyMap),Ca=e=>uo(Af(e._keyMap)),ja=e=>(e._keyMap._editable=!1,e),Pf=d(2,(e,t)=>{const n=Ca(e);return t(n),ja(n)}),gr=d(2,(e,t)=>e._keyMap._editable?(mr(t,!0)(e._keyMap),e):uo(mr(t,!0)(e._keyMap))),Lf=d(2,(e,t)=>e._keyMap._editable?(qc(t)(e._keyMap),e):uo(qc(t)(e._keyMap))),w_=d(2,(e,t)=>Pf(e,n=>{for(const r of t)Lf(n,r)})),k_=d(2,(e,t)=>Pf(lo(),n=>{x_(e,r=>gr(n,r));for(const r of t)gr(n,r)})),x_=d(2,(e,t)=>h_(e._keyMap,(n,r)=>t(r))),v_=d(3,(e,t,n)=>co(e._keyMap,t,(r,s,o)=>n(r,o))),Ht=lo,T_=y_,Ma=b_,O_=__,Kf=S_,dr=gr,Df=Lf,Bc=w_,yr=k_,Ns=v_,Jc=Symbol.for("effect/MutableRef"),N_={[Jc]:Jc,toString(){return ge(this.toJSON())},toJSON(){return{_id:"MutableRef",current:le(this.current)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},Uf=e=>{const t=Object.create(N_);return t.current=e,t},fo=e=>e.current,qf=d(2,(e,t)=>(e.current=t,e)),Aa="effect/FiberId",br=Symbol.for(Aa),$s="None",wi="Runtime",$_="Composite",E_=se(`${Aa}-${$s}`);let I_=class{[br]=br;_tag=$s;id=-1;startTimeMillis=-1;[D](){return E_}[L](t){return Bf(t)&&t._tag===$s}toString(){return ge(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[ee](){return this.toJSON()}};class R_{id;startTimeMillis;[br]=br;_tag=wi;constructor(t,n){this.id=t,this.startTimeMillis=n}[D](){return ne(this,se(`${Aa}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[L](t){return Bf(t)&&t._tag===wi&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return ge(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[ee](){return this.toJSON()}}const C_=new I_,Bf=e=>A(e,br),ki=e=>{switch(e._tag){case $s:return Ht();case wi:return Ma(e.id);case $_:return g(ki(e.left),yr(ki(e.right)))}},Vc=B(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>Uf(0)),Jf=e=>Array.from(ki(e)).map(n=>`#${n}`).join(","),j_=()=>{const e=fo(Vc);return g(Vc,qf(e+1)),new R_(e,Date.now())},$n=C_,M_=Jf,Vf=j_,Fa=ao,A_=s_,F_=i_,zf=a_,Hf=mr,Wf=Mf,P_=Ra,L_=d_,Gf=co,_r=Symbol.for("effect/List"),xi=e=>oe(e),K_=e=>km(ga(e),xi),D_=K_(K),U_={[_r]:_r,_tag:"Cons",toString(){return ge(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:xi(this).map(le)}},[ee](){return this.toJSON()},[L](e){return Qf(e)&&this._tag===e._tag&&D_(this,e)},[D](){return ne(this,Tr(xi(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();const n=t.head;return t=t.tail,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},pipe(){return R(this,arguments)}},Es=(e,t)=>{const n=Object.create(U_);return n.head=e,n.tail=t,n},q_=se("Nil"),B_={[_r]:_r,_tag:"Nil",toString(){return ge(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[ee](){return this.toJSON()},[D](){return q_},[L](e){return Qf(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return R(this,arguments)}},Yf=Object.create(B_),Qf=e=>A(e,_r),bt=e=>e._tag==="Nil",J_=e=>e._tag==="Cons",V_=()=>Yf,Wt=(e,t)=>Es(e,t),En=V_,Pa=e=>Es(e,Yf),z_=d(2,(e,t)=>W_(t,e)),H_=d(2,(e,t)=>Wt(t,e)),W_=d(2,(e,t)=>{if(bt(e))return t;if(bt(t))return e;{const n=Es(t.head,e);let r=n,s=t.tail;for(;!bt(s);){const o=Es(s.head,e);r.tail=o,r=o,s=s.tail}return n}}),G_=d(3,(e,t,n)=>{let r=t,s=e;for(;!bt(s);)r=n(r,s.head),s=s.tail;return r}),Y_=e=>{let t=En(),n=e;for(;!bt(n);)t=H_(t,n.head),n=n.tail;return t},La=(function(){function e(t){t&&Object.assign(this,t)}return e.prototype=la,e})(),Q_=Symbol.for("effect/DifferContextPatch");function zc(e){return e}const jr={...La.prototype,[Q_]:{_Value:zc,_Patch:zc}},X_=Object.assign(Object.create(jr),{_tag:"Empty"}),Z_=Object.create(X_),Xf=()=>Z_,eS=Object.assign(Object.create(jr),{_tag:"AndThen"}),tS=(e,t)=>{const n=Object.create(eS);return n.first=e,n.second=t,n},nS=Object.assign(Object.create(jr),{_tag:"AddService"}),rS=(e,t)=>{const n=Object.create(nS);return n.key=e,n.service=t,n},sS=Object.assign(Object.create(jr),{_tag:"RemoveService"}),oS=e=>{const t=Object.create(sS);return t.key=e,t},iS=Object.assign(Object.create(jr),{_tag:"UpdateService"}),aS=(e,t)=>{const n=Object.create(iS);return n.key=e,n.update=t,n},cS=(e,t)=>{const n=new Map(e.unsafeMap);let r=Xf();for(const[s,o]of t.unsafeMap.entries())if(n.has(s)){const i=n.get(s);n.delete(s),K(i,o)||(r=cs(aS(s,()=>o))(r))}else n.delete(s),r=cs(rS(s,o))(r);for(const[s]of n.entries())r=cs(oS(s))(r);return r},cs=d(2,(e,t)=>tS(e,t)),uS=d(2,(e,t)=>{if(e._tag==="Empty")return t;let n=!1,r=Le(e);const s=new Map(t.unsafeMap);for(;vn(r);){const i=Tn(r),a=At(r);switch(i._tag){case"Empty":{r=a;break}case"AddService":{s.set(i.key,i.service),r=a;break}case"AndThen":{r=Xe(Xe(a,i.second),i.first);break}case"RemoveService":{s.delete(i.key),r=a;break}case"UpdateService":{s.set(i.key,i.update(s.get(i.key))),n=!0,r=a;break}}}if(!n)return kn(s);const o=new Map;for(const[i]of t.unsafeMap)s.has(i)&&(o.set(i,s.get(i)),s.delete(i));for(const[i,a]of s)o.set(i,a);return kn(o)}),lS=Symbol.for("effect/DifferHashSetPatch");function Vo(e){return e}const ho={...La.prototype,[lS]:{_Value:Vo,_Key:Vo,_Patch:Vo}},fS=Object.assign(Object.create(ho),{_tag:"Empty"}),dS=Object.create(fS),Zf=()=>dS,hS=Object.assign(Object.create(ho),{_tag:"AndThen"}),pS=(e,t)=>{const n=Object.create(hS);return n.first=e,n.second=t,n},mS=Object.assign(Object.create(ho),{_tag:"Add"}),gS=e=>{const t=Object.create(mS);return t.value=e,t},yS=Object.assign(Object.create(ho),{_tag:"Remove"}),bS=e=>{const t=Object.create(yS);return t.value=e,t},_S=(e,t)=>{const[n,r]=Ns([e,Zf()],([s,o],i)=>O_(i)(s)?[Df(i)(s),o]:[s,vi(gS(i))(o)])(t);return Ns(r,(s,o)=>vi(bS(o))(s))(n)},vi=d(2,(e,t)=>pS(e,t)),SS=d(2,(e,t)=>{if(e._tag==="Empty")return t;let n=t,r=Le(e);for(;vn(r);){const s=Tn(r),o=At(r);switch(s._tag){case"Empty":{r=o;break}case"AndThen":{r=Xe(s.first)(Xe(s.second)(o));break}case"Add":{n=dr(s.value)(n),r=o;break}case"Remove":n=Df(s.value)(n),r=o}}return n}),wS=Symbol.for("effect/DifferReadonlyArrayPatch");function Hc(e){return e}const Mr={...La.prototype,[wS]:{_Value:Hc,_Patch:Hc}},kS=Object.assign(Object.create(Mr),{_tag:"Empty"}),xS=Object.create(kS),ed=()=>xS,vS=Object.assign(Object.create(Mr),{_tag:"AndThen"}),TS=(e,t)=>{const n=Object.create(vS);return n.first=e,n.second=t,n},OS=Object.assign(Object.create(Mr),{_tag:"Append"}),NS=e=>{const t=Object.create(OS);return t.values=e,t},$S=Object.assign(Object.create(Mr),{_tag:"Slice"}),ES=(e,t)=>{const n=Object.create($S);return n.from=e,n.until=t,n},IS=Object.assign(Object.create(Mr),{_tag:"Update"}),RS=(e,t)=>{const n=Object.create(IS);return n.index=e,n.patch=t,n},CS=e=>{let t=0,n=ed();for(;t<e.oldValue.length&&t<e.newValue.length;){const r=e.oldValue[t],s=e.newValue[t],o=e.differ.diff(r,s);K(o,e.differ.empty)||(n=us(n,RS(t,o))),t=t+1}return t<e.oldValue.length&&(n=us(n,ES(0,t))),t<e.newValue.length&&(n=us(n,NS(Jg(t)(e.newValue)))),n},us=d(2,(e,t)=>TS(e,t)),jS=d(3,(e,t,n)=>{if(e._tag==="Empty")return t;let r=t.slice(),s=Ge(e);for(;is(s);){const o=Re(s),i=Vt(s);switch(o._tag){case"Empty":{s=i;break}case"AndThen":{i.unshift(o.first,o.second),s=i;break}case"Append":{for(const a of o.values)r.push(a);s=i;break}case"Slice":{r=r.slice(o.from,o.until),s=i;break}case"Update":{r[o.index]=n.patch(o.patch,r[o.index]),s=i;break}}}return r}),MS=Symbol.for("effect/Differ"),AS={[MS]:{_P:Y,_V:Y},pipe(){return R(this,arguments)}},qn=e=>{const t=Object.create(AS);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},FS=()=>qn({empty:Xf(),combine:(e,t)=>cs(t)(e),diff:(e,t)=>cS(e,t),patch:(e,t)=>uS(t)(e)}),PS=()=>qn({empty:Zf(),combine:(e,t)=>vi(t)(e),diff:(e,t)=>_S(e,t),patch:(e,t)=>SS(t)(e)}),LS=e=>qn({empty:ed(),combine:(t,n)=>us(t,n),diff:(t,n)=>CS({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>jS(t,n,e)}),td=()=>KS((e,t)=>t),KS=e=>qn({empty:Y,combine:(t,n)=>t===Y?n:n===Y?t:r=>n(t(r)),diff:(t,n)=>K(t,n)?Y:zs(n),patch:(t,n)=>e(n,t(n))}),Sr=255,nd=8,Ti=e=>e&Sr,Oi=e=>e>>nd&Sr,Ar=(e,t)=>(e&Sr)+((t&e&Sr)<<nd),DS=Ar(0,0),US=e=>Ar(e,e),qS=e=>Ar(e,0),BS=d(2,(e,t)=>Ar(Ti(e)&~t,Oi(e))),JS=d(2,(e,t)=>e|t),VS=e=>~e>>>0&Sr,zS=0,Bn=1,HS=2,rd=4,Ni=16,sd=32,WS=e=>po(e,sd),GS=d(2,(e,t)=>e|t),Tt=e=>od(e)&&!QS(e),od=e=>po(e,Bn),po=d(2,(e,t)=>(e&t)!==0),id=(...e)=>e.reduce((t,n)=>t|n,0),YS=id(zS),Wc=e=>po(e,rd),QS=e=>po(e,Ni),ls=d(2,(e,t)=>Ar(e^t,t)),fs=d(2,(e,t)=>e&(VS(Ti(t))|Oi(t))|Ti(t)&Oi(t)),Gc=qn({empty:DS,diff:(e,t)=>ls(e,t),combine:(e,t)=>JS(t)(e),patch:(e,t)=>fs(t,e)}),XS=US,ad=qS,Yc=BS,cd=(e,t)=>({_tag:"Par",left:e,right:t}),Gr=(e,t)=>({_tag:"Seq",left:e,right:t}),ZS=e=>{let t=Pa(e),n=En();for(;;){const[r,s]=G_(t,[ud(),En()],([o,i],a)=>{const[c,u]=e0(a);return[o0(o,c),z_(i,u)]});if(n=t0(n,r),bt(s))return Y_(n);t=s}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},e0=e=>{let t=e,n=ud(),r=En(),s=En();for(;;)switch(t._tag){case"Empty":{if(bt(r))return[n,s];t=r.head,r=r.tail;break}case"Par":{r=Wt(t.right,r),t=t.left;break}case"Seq":{const o=t.left,i=t.right;switch(o._tag){case"Empty":{t=i;break}case"Par":{const a=o.left,c=o.right;t=cd(Gr(a,i),Gr(c,i));break}case"Seq":{const a=o.left,c=o.right;t=Gr(a,Gr(c,i));break}case"Single":{t=o,s=Wt(i,s);break}}break}case"Single":{if(n=s0(n,t),bt(r))return[n,s];t=r.head,r=r.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},t0=(e,t)=>{if(bt(e))return Pa(zo(t));if(i0(t))return e;const n=d0(e.head),r=a0(t);return n.length===1&&r.length===1&&K(n[0],r[0])?Wt(f0(e.head,zo(t)),e.tail):Wt(zo(t),e)},n0=Symbol.for("effect/RequestBlock/RequestBlockParallel"),r0={_R:e=>e};class Ka{map;[n0]=r0;constructor(t){this.map=t}}const ud=()=>new Ka(Fa()),s0=(e,t)=>new Ka(P_(e.map,t.dataSource,n=>kg(vl(n,vb(t.blockedRequest)),()=>Le(t.blockedRequest)))),o0=(e,t)=>new Ka(Gf(e.map,t.map,(n,r,s)=>Hf(n,s,Se(zf(n,s),{onNone:()=>r,onSome:o=>Ye(r,o)})))),i0=e=>F_(e.map),a0=e=>Array.from(Wf(e.map)),zo=e=>l0(L_(e.map,t=>Le(t))),c0=Symbol.for("effect/RequestBlock/RequestBlockSequential"),u0={_R:e=>e};class ld{map;[c0]=u0;constructor(t){this.map=t}}const l0=e=>new ld(e),f0=(e,t)=>new ld(Gf(t.map,e.map,(n,r,s)=>Hf(n,s,Se(zf(n,s),{onNone:()=>_t(),onSome:o=>Ye(o,r)})))),d0=e=>Array.from(Wf(e.map)),h0=e=>Array.from(e.map),Fr="Die",Gt="Empty",on="Fail",Jn="Interrupt",In="Parallel",Rn="Sequential",fd="effect/Cause",dd=Symbol.for(fd),p0={_E:e=>e},Vn={[dd]:p0,[D](){return g(k(fd),J(k($0(this))),ne(this))},[L](e){return m0(e)&&N0(this,e)},pipe(){return R(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:le(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:le(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:le(this.left),right:le(this.right)}}},toString(){return zn(this)},[ee](){return this.toJSON()}},Cn=(()=>{const e=Object.create(Vn);return e._tag=Gt,e})(),Is=e=>{const t=Object.create(Vn);return t._tag=on,t.error=e,t},at=e=>{const t=Object.create(Vn);return t._tag=Fr,t.defect=e,t},Ot=e=>{const t=Object.create(Vn);return t._tag=Jn,t.fiberId=e,t},mo=(e,t)=>{const n=Object.create(Vn);return n._tag=In,n.left=e,n.right=t,n},Ve=(e,t)=>{const n=Object.create(Vn);return n._tag=Rn,n.left=e,n.right=t,n},m0=e=>A(e,dd),g0=e=>e._tag===Gt,y0=e=>e._tag===on,b0=e=>e._tag===Gt?!0:jn(e,!0,(t,n)=>{switch(n._tag){case Gt:return I(t);case Fr:case on:case Jn:return I(!1);default:return N()}}),_0=e=>we(T0(e)),Da=e=>Ua(void 0,I0)(e),S0=e=>xn(jn(e,_t(),(t,n)=>n._tag===on?I(g(t,Xe(n.error))):N())),w0=e=>xn(jn(e,_t(),(t,n)=>n._tag===Fr?I(g(t,Xe(n.defect))):N())),k0=e=>jn(e,Ht(),(t,n)=>n._tag===Jn?I(g(t,dr(n.fiberId))):N()),x0=e=>hd(e,t=>t._tag===on?I(t.error):N()),v0=e=>{const t=x0(e);switch(t._tag){case"None":return V(e);case"Some":return P(t.value)}},T0=e=>hd(e,t=>t._tag===Jn?I(t.fiberId):N()),Qc=e=>pd(e,{onEmpty:Cn,onFail:()=>Cn,onDie:at,onInterrupt:Ot,onSequential:Ve,onParallel:mo}),O0=e=>pd(e,{onEmpty:Cn,onFail:at,onDie:at,onInterrupt:Ot,onSequential:Ve,onParallel:mo}),N0=(e,t)=>{let n=Le(e),r=Le(t);for(;vn(n)&&vn(r);){const[s,o]=g(Tn(n),jn([Ht(),_t()],([c,u],f)=>{const[h,p]=$i(f);return I([g(c,yr(h)),g(u,Ye(p))])})),[i,a]=g(Tn(r),jn([Ht(),_t()],([c,u],f)=>{const[h,p]=$i(f);return I([g(c,yr(h)),g(u,Ye(p))])}));if(!K(s,i))return!1;n=o,r=a}return!0},$0=e=>E0(Le(e),_t()),E0=(e,t)=>{for(;;){const[n,r]=g(e,Il([Ht(),_t()],([o,i],a)=>{const[c,u]=$i(a);return[g(o,yr(c)),g(i,Ye(u))]})),s=Kf(n)>0?g(t,Xe(n)):t;if(Tb(r))return xn(s);e=r,t=s}throw new Error(Gs("Cause.flattenCauseLoop"))},hd=d(2,(e,t)=>{const n=[e];for(;n.length>0;){const r=n.pop(),s=t(r);switch(s._tag){case"None":{switch(r._tag){case Rn:case In:{n.push(r.right),n.push(r.left);break}}break}case"Some":return s}}return N()}),$i=e=>{let t=e;const n=[];let r=Ht(),s=_t();for(;t!==void 0;)switch(t._tag){case Gt:{if(n.length===0)return[r,s];t=n.pop();break}case on:{if(r=dr(r,Bo(t._tag,t.error)),n.length===0)return[r,s];t=n.pop();break}case Fr:{if(r=dr(r,Bo(t._tag,t.defect)),n.length===0)return[r,s];t=n.pop();break}case Jn:{if(r=dr(r,Bo(t._tag,t.fiberId)),n.length===0)return[r,s];t=n.pop();break}case Rn:{switch(t.left._tag){case Gt:{t=t.right;break}case Rn:{t=Ve(t.left.left,Ve(t.left.right,t.right));break}case In:{t=mo(Ve(t.left.left,t.right),Ve(t.left.right,t.right));break}default:{s=Xe(s,t.right),t=t.left;break}}break}case In:{n.push(t.right),t=t.left;break}}throw new Error(Gs("Cause.evaluateCauseLoop"))},I0={emptyCase:Tc,failCase:ai,dieCase:ai,interruptCase:Tc,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},Xc="SequentialCase",Zc="ParallelCase",pd=d(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:s,onParallel:o,onSequential:i})=>Ua(e,void 0,{emptyCase:()=>n,failCase:(a,c)=>r(c),dieCase:(a,c)=>t(c),interruptCase:(a,c)=>s(c),sequentialCase:(a,c,u)=>i(c,u),parallelCase:(a,c,u)=>o(c,u)})),jn=d(3,(e,t,n)=>{let r=t,s=e;const o=[];for(;s!==void 0;){const i=n(r,s);switch(r=we(i)?i.value:r,s._tag){case Rn:{o.push(s.right),s=s.left;break}case In:{o.push(s.right),s=s.left;break}default:{s=void 0;break}}s===void 0&&o.length>0&&(s=o.pop())}return r}),Ua=d(3,(e,t,n)=>{const r=[e],s=[];for(;r.length>0;){const i=r.pop();switch(i._tag){case Gt:{s.push(V(n.emptyCase(t)));break}case on:{s.push(V(n.failCase(t,i.error)));break}case Fr:{s.push(V(n.dieCase(t,i.defect)));break}case Jn:{s.push(V(n.interruptCase(t,i.fiberId)));break}case Rn:{r.push(i.right),r.push(i.left),s.push(P({_tag:Xc}));break}case In:{r.push(i.right),r.push(i.left),s.push(P({_tag:Zc}));break}}}const o=[];for(;s.length>0;){const i=s.pop();switch(i._tag){case"Left":{switch(i.left._tag){case Xc:{const a=o.pop(),c=o.pop(),u=n.sequentialCase(t,a,c);o.push(u);break}case Zc:{const a=o.pop(),c=o.pop(),u=n.parallelCase(t,a,c);o.push(u);break}}break}case"Right":{o.push(i.right);break}}}if(o.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return o.pop()}),zn=(e,t)=>Da(e)?"All fibers interrupted without errors.":gd(e).map(function(n){return t?.renderErrorCause!==!0||n.cause===void 0?n.stack:`${n.stack} {
7
- ${md(n.cause," ")}
8
- }`}).join(`
9
- `),md=(e,t)=>{const n=e.stack.split(`
10
- `);let r=`${t}[cause]: ${n[0]}`;for(let s=1,o=n.length;s<o;s++)r+=`
11
- ${t}${n[s]}`;return e.cause&&(r+=` {
12
- ${md(e.cause,`${t} `)}
13
- ${t}}`),r};class Rs extends globalThis.Error{span=void 0;constructor(t){const n=typeof t=="object"&&t!==null,r=Error.stackTraceLimit;Error.stackTraceLimit=1,super(R0(t),n&&"cause"in t&&typeof t.cause<"u"?{cause:new Rs(t.cause)}:void 0),this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=r,this.name=t instanceof Error?t.name:"Error",n&&(Mn in t&&(this.span=t[Mn]),Object.keys(t).forEach(s=>{s in this||(this[s]=t[s])})),this.stack=M0(`${this.name}: ${this.message}`,t instanceof Error&&t.stack?t.stack:"",this.span)}}const R0=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&e instanceof Error)return e.message;try{if(A(e,"toString")&&xr(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return ul(e)},C0=/\((.*)\)/g,j0=B("effect/Tracer/spanToTrace",()=>new WeakMap),M0=(e,t,n)=>{const r=[e],s=t.startsWith(e)?t.slice(e.length).split(`
14
- `):t.split(`
15
- `);for(let o=1;o<s.length;o++){if(s[o].includes(" at new BaseEffectError")||s[o].includes(" at new YieldableError")){o++;continue}if(s[o].includes("Generator.next")||s[o].includes("effect_internal_function"))break;r.push(s[o].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(n){let o=n,i=0;for(;o&&o._tag==="Span"&&i<10;){const a=j0.get(o);if(typeof a=="function"){const c=a();if(typeof c=="string"){const u=c.matchAll(C0);let f=!1;for(const[,h]of u)f=!0,r.push(` at ${o.name} (${h})`);f||r.push(` at ${o.name} (${c.replace(/^at /,"")})`)}else r.push(` at ${o.name}`)}else r.push(` at ${o.name}`);o=st(o.parent),i++}}return r.join(`
16
- `)},Mn=Symbol.for("effect/SpanAnnotation"),gd=e=>Ua(e,void 0,{emptyCase:()=>[],dieCase:(t,n)=>[new Rs(n)],failCase:(t,n)=>[new Rs(n)],interruptCase:()=>[],parallelCase:(t,n,r)=>[...n,...r],sequentialCase:(t,n,r)=>[...n,...r]}),go="Pending",yd="Done",A0="effect/Deferred",F0=Symbol.for(A0),P0={_E:e=>e,_A:e=>e},L0=e=>({_tag:go,joiners:e}),K0=e=>({_tag:yd,effect:e});class Pr{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Pr(this.self)}}const bd=(e,t)=>{const n=new ke("Blocked");return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},D0=e=>{const t=new ke("RunBlocked");return t.effect_instruction_i0=e,t},An=Symbol.for("effect/Effect");class U0{patch;op;_op=ca;constructor(t,n){this.patch=t,this.op=n}}class ke{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[An]=bn;constructor(t){this._op=t}[L](t){return this===t}[D](){return ne(this,sa(this))}pipe(){return R(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:le(this.effect_instruction_i0),effect_instruction_i1:le(this.effect_instruction_i1),effect_instruction_i2:le(this.effect_instruction_i2)}}toString(){return ge(this.toJSON())}[ee](){return this.toJSON()}[Symbol.iterator](){return new Pr(new vr(this))}}class _d{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[An]=bn;constructor(t){this._op=t,this._tag=t}[L](t){return To(t)&&t._op==="Failure"&&K(this.effect_instruction_i0,t.effect_instruction_i0)}[D](){return g(se(this._tag),J(k(this.effect_instruction_i0)),ne(this))}get cause(){return this.effect_instruction_i0}pipe(){return R(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return ge(this.toJSON())}[ee](){return this.toJSON()}[Symbol.iterator](){return new Pr(new vr(this))}}class Sd{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[An]=bn;constructor(t){this._op=t,this._tag=t}[L](t){return To(t)&&t._op==="Success"&&K(this.effect_instruction_i0,t.effect_instruction_i0)}[D](){return g(se(this._tag),J(k(this.effect_instruction_i0)),ne(this))}get value(){return this.effect_instruction_i0}pipe(){return R(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:le(this.value)}}toString(){return ge(this.toJSON())}[ee](){return this.toJSON()}[Symbol.iterator](){return new Pr(new vr(this))}}const yo=e=>A(e,An),Ke=e=>{const t=new ke(dl);return t.effect_instruction_i0=e,t},q0=d(3,(e,t,n)=>So(r=>C(e,s=>C(kd(ce(()=>r(t(s)))),o=>ce(()=>n(s,o)).pipe(Fn({onFailure:i=>{switch(o._tag){case ze:return Ze(Ve(o.effect_instruction_i0,i));case He:return Ze(i)}},onSuccess:()=>o})))))),Lr=d(2,(e,t)=>C(e,()=>Q(t))),Kr=e=>Lr(e,void 0),wd=function(){const e=new ke(Qs);switch(arguments.length){case 2:{e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break}case 3:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break}case 4:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break}default:throw new Error(Gs("you're not supposed to end up here"))}return e},Cs=(e,t=$n)=>{const n=new ke(lr);let r;return n.effect_instruction_i0=s=>{r=e(s)},n.effect_instruction_i1=t,Od(n,s=>yo(r)?r:et)},B0=(e,t=$n)=>ce(()=>Cs(e,t)),Yt=(e,t=$n)=>wd(e,function(){let n,r;function s(c){n?n(c):r===void 0&&(r=c)}const o=new ke(lr);o.effect_instruction_i0=c=>{n=c,r&&c(r)},o.effect_instruction_i1=t;let i,a;return this.effect_instruction_i0.length!==1?(a=new AbortController,i=Ie(()=>this.effect_instruction_i0(s,a.signal))):i=Ie(()=>this.effect_instruction_i0(s)),i||a?Od(o,c=>(a&&a.abort(),i??et)):o}),Ei=d(2,(e,t)=>Ja(e,{onFailure:t,onSuccess:Q})),eu=Symbol.for("effect/OriginalAnnotation"),qa=(e,t)=>we(t)?new Proxy(e,{has(n,r){return r===Mn||r===eu||r in n},get(n,r){return r===Mn?t.value:r===eu?e:n[r]}}):e,tu=e=>wt(e)&&!(Mn in e)?Ke(t=>Ze(at(qa(e,Xa(t))))):Ze(at(e)),J0=e=>V0(()=>at(new ww(e))),js=e=>Ja(e,{onFailure:t=>Q(P(t)),onSuccess:t=>Q(V(t))}),kd=e=>W0(e,{onFailure:X,onSuccess:ie}),Ee=e=>wt(e)&&!(Mn in e)?Ke(t=>Ze(Is(qa(e,Xa(t))))):Ze(Is(e)),Ba=e=>C(j(e),Ee),Ze=e=>{const t=new _d(ze);return t.effect_instruction_i0=e,t},V0=e=>C(j(e),Ze),z0=Ke(e=>Q(e.id())),xd=e=>Ke(t=>e(t.id())),C=d(2,(e,t)=>{const n=new ke(bs);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),H0=e=>{const t=new ke("OnStep");return t.effect_instruction_i0=e,t},vd=e=>C(e,Y),W0=d(2,(e,t)=>Fn(e,{onFailure:n=>Q(t.onFailure(n)),onSuccess:n=>Q(t.onSuccess(n))})),Fn=d(2,(e,t)=>{const n=new ke(_s);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),Ja=d(2,(e,t)=>Fn(e,{onFailure:n=>{if(w0(n).length>0)return Ze(O0(n));const s=S0(n);return s.length>0?t.onFailure(vf(s)):Ze(n)},onSuccess:t.onSuccess})),$t=d(2,(e,t)=>ce(()=>{const n=oe(e),r=Zs(n.length);let s=0;return Lr(Ha({while:()=>s<n.length,body:()=>t(n[s],s),step:o=>{r[s++]=o}}),r)})),bo=d(2,(e,t)=>ce(()=>{const n=oe(e);let r=0;return Ha({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),Td=e=>{const t=new ke(Or);return t.effect_instruction_i0=XS(Bn),t.effect_instruction_i1=()=>e,t},Me=d(2,(e,t)=>C(e,n=>j(()=>t(n)))),Va=d(2,(e,t)=>Ja(e,{onFailure:n=>Ba(()=>t.onFailure(n)),onSuccess:n=>j(()=>t.onSuccess(n))})),_o=d(2,(e,t)=>Fn(e,{onFailure:n=>{const r=v0(n);switch(r._tag){case"Left":return Ba(()=>t(r.left));case"Right":return Ze(r.right)}},onSuccess:Q})),za=d(2,(e,t)=>So(n=>Fn(n(e),{onFailure:r=>{const s=X(r);return Fn(t(s),{onFailure:o=>X(Ve(r,o)),onSuccess:()=>s})},onSuccess:r=>{const s=ie(r);return wo(t(s),s)}}))),Od=d(2,(e,t)=>za(e,Kd({onFailure:n=>Da(n)?Kr(t(k0(n))):et,onSuccess:()=>et}))),Q=e=>{const t=new Sd(He);return t.effect_instruction_i0=e,t},ce=e=>{const t=new ke(Qs);return t.commit=e,t},j=e=>{const t=new ke(fl);return t.effect_instruction_i0=e,t},G0=d(e=>e.length===3||e.length===2&&!(wt(e[1])&&"onlyEffect"in e[1]),(e,t)=>C(e,n=>{const r=typeof t=="function"?t(n):t;return yo(r)?Lr(r,n):Rm(r)?Cs(s=>{r.then(o=>s(Q(n)),o=>s(Ee(new Ld(o,"An unknown error occurred in Effect.tap"))))}):Q(n)})),Y0=e=>Ke(t=>{const n=t.getFiberRef(Ri),r=g(n,ye(()=>t.scope()));return e(ko(Ri,I(r)))}),Nd=e=>{const t=new ke(Or);return t.effect_instruction_i0=ad(Bn),t.effect_instruction_i1=()=>e,t},So=e=>wd(e,function(){const t=new ke(Or);return t.effect_instruction_i0=ad(Bn),t.effect_instruction_i1=n=>od(n)?Ie(()=>this.effect_instruction_i0(Td)):Ie(()=>this.effect_instruction_i0(Nd)),t}),et=Q(void 0),Q0=e=>{const t=new ke(Or);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},Ha=e=>{const t=new ke(Ss);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},Wa=e=>{const t=new ke(os);return typeof e?.priority<"u"?pw(t,e.priority):t},$d=d(2,(e,t)=>C(e,n=>Me(t,r=>[n,r]))),Ed=d(2,(e,t)=>C(e,n=>Lr(t,n))),wo=d(2,(e,t)=>C(e,()=>t)),X0=e=>C(z0,t=>g(e,Id(t))),Id=d(2,(e,t)=>C(e.interruptAsFork(t),()=>e.await)),Z0={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return R(this,arguments)}},ew={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return R(this,arguments)}},tw={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return R(this,arguments)}},Rd={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return R(this,arguments)}},Cd={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return R(this,arguments)}},jd={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return R(this,arguments)}},nw={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return R(this,arguments)}},rw={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return R(this,arguments)}},sw="effect/FiberRef",ow=Symbol.for(sw),iw={_A:e=>e},Ga=e=>Ke(t=>ie(t.getFiberRef(e))),Ya=d(2,(e,t)=>C(Ga(e),t)),nu=d(2,(e,t)=>aw(e,()=>[void 0,t])),aw=d(2,(e,t)=>Ke(n=>{const[r,s]=t(n.getFiberRef(e));return n.setFiberRef(e,s),Q(r)})),ko=d(3,(e,t,n)=>q0(Ed(Ga(t),nu(t,n)),()=>e,r=>nu(t,r))),Ae=(e,t)=>Hn(e,{differ:td(),fork:t?.fork??Y,join:t?.join}),cw=e=>{const t=PS();return Hn(e,{differ:t,fork:t.empty})},uw=e=>{const t=LS(td());return Hn(e,{differ:t,fork:t.empty})},Md=e=>{const t=FS();return Hn(e,{differ:t,fork:t.empty})},Hn=(e,t)=>({...$r,[ow]:iw,initial:e,commit(){return Ga(this)},diff:(r,s)=>t.differ.diff(r,s),combine:(r,s)=>t.differ.combine(r,s),patch:r=>s=>t.differ.patch(r,s),fork:t.fork,join:t.join??((r,s)=>s)}),lw=e=>Hn(e,{differ:Gc,fork:Gc.empty}),Dr=B(Symbol.for("effect/FiberRef/currentContext"),()=>Md(va())),xo=B(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>Ae(0)),Ad=B(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>Ae(2048)),fw=B(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>Ae(Fa())),dw=B(Symbol.for("effect/FiberRef/currentLogLevel"),()=>Ae(Cd)),hw=B(Symbol.for("effect/FiberRef/currentLogSpan"),()=>Ae(En())),pw=d(2,(e,t)=>ko(e,xo,t)),mw=B(Symbol.for("effect/FiberRef/currentConcurrency"),()=>Ae("unbounded")),gw=B(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>Ae(!0)),yw=B(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>Ae(I(jd))),bw=B(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>Ae(I(Rd))),Ii=B(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>uw(Sn())),Ri=B(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>Ae(N(),{fork:()=>N(),join:(e,t)=>e})),Yr=B(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>Ae(Cn,{fork:()=>Cn,join:(e,t)=>e})),_w=(e,t)=>e.addFinalizer(()=>Kr(t)),Sw=(e,t)=>e.close(t),vo=(e,t)=>e.fork(t),Qa=(function(){class e extends globalThis.Error{commit(){return Ee(this)}toJSON(){const n={...this};return this.message&&(n.message=this.message),this.cause&&(n.cause=this.cause),n}[ee](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
17
- ${this.stack.split(`
18
- `).slice(1).join(`
19
- `)}`:this.toString():"Bun"in globalThis?zn(Is(this),{renderErrorCause:!0}):this}}return Object.assign(e.prototype,rg),e})(),Fd=(e,t)=>{class n extends Qa{_tag=t}return Object.assign(n.prototype,e),n.prototype.name=t,n},ru=Symbol.for("effect/Cause/errors/RuntimeException"),ww=Fd({[ru]:ru},"RuntimeException"),kw=Symbol.for("effect/Cause/errors/InterruptedException"),xw=e=>A(e,kw),su=Symbol.for("effect/Cause/errors/NoSuchElement"),Pd=Fd({[su]:su},"NoSuchElementException"),ou=Symbol.for("effect/Cause/errors/UnknownException"),Ld=(function(){class e extends Qa{_tag="UnknownException";error;constructor(n,r){super(r??"An unknown error occurred",{cause:n}),this.error=n}}return Object.assign(e.prototype,{[ou]:ou,name:"UnknownException"}),e})(),To=e=>yo(e)&&"_tag"in e&&(e._tag==="Success"||e._tag==="Failure"),vw=e=>e._tag==="Success",iu=(e,t)=>$w(e,t?.parallel?mo:Ve),Tw=e=>X(at(e)),au=e=>X(Is(e)),X=e=>{const t=new _d(ze);return t.effect_instruction_i0=e,t},Ow=e=>X(Ot(e)),Ho=d(2,(e,t)=>{switch(e._tag){case ze:return X(e.effect_instruction_i0);case He:return ie(t(e.effect_instruction_i0))}}),Kd=d(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case ze:return t(e.effect_instruction_i0);case He:return n(e.effect_instruction_i0)}}),ie=e=>{const t=new Sd(He);return t.effect_instruction_i0=e,t},Ft=ie(void 0),Nw=d(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case ze:switch(t._tag){case He:return X(e.effect_instruction_i0);case ze:return X(n(e.effect_instruction_i0,t.effect_instruction_i0))}case He:switch(t._tag){case He:return ie(r(e.effect_instruction_i0,t.effect_instruction_i0));case ze:return X(t.effect_instruction_i0)}}}),$w=(e,t)=>{const n=xf(e);return vn(n)?g(At(n),Il(g(Tn(n),Ho(Le)),(r,s)=>g(r,Nw(s,{onSuccess:(o,i)=>g(o,Xe(i)),onFailure:t}))),Ho(xn),Ho(r=>Ut(r)),I):N()},Ew=e=>({...$r,[F0]:P0,state:Uf(L0([])),commit(){return Dd(this)},blockingOn:e}),Dd=e=>B0(t=>{const n=fo(e.state);switch(n._tag){case yd:return t(n.effect);case go:return n.joiners.push(t),Iw(e,t)}},e.blockingOn),Ud=(e,t)=>{const n=fo(e.state);if(n._tag===go){qf(e.state,K0(t));for(let r=0,s=n.joiners.length;r<s;r++)n.joiners[r](t)}},Iw=(e,t)=>j(()=>{const n=fo(e.state);if(n._tag===go){const r=n.joiners.indexOf(t);r>=0&&n.joiners.splice(r,1)}}),Rw=Ke(e=>ie(e.currentContext)),Cw=()=>Rw,Ur=e=>C(Cw(),e),jw=d(2,(e,t)=>ko(Dr,t)(e)),Mw=d(2,(e,t)=>Ur(n=>jw(e,t(n)))),Xa=e=>{const t=e.currentSpan;return t!==void 0&&t._tag==="Span"?I(t):N()},Aw=vw,cu=Symbol.for("effect/MutableHashMap"),Fw={[cu]:cu,[Symbol.iterator](){return new Za(this)},toString(){return ge(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(le)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}};class Za{self;referentialIterator;bucketIterator;constructor(t){this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new Pw(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new Za(this.self)}}class Pw{backing;constructor(t){this.backing=t}currentBucket;next(){if(this.currentBucket===void 0){const n=this.backing.next();if(n.done)return n;this.currentBucket=n.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const Lw=()=>{const e=Object.create(Fw);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},jt=d(2,(e,t)=>{if(ys(t)===!1)return e.referential.has(t)?I(e.referential.get(t)):N();const n=t[D](),r=e.buckets.get(n);return r===void 0?N():Kw(e,r,t)}),Kw=(e,t,n,r=!1)=>{for(let s=0,o=t.length;s<o;s++)if(n[L](t[s][0])){const i=t[s][1];return r&&(t.splice(s,1),e.bucketsSize--),I(i)}return N()},tr=d(2,(e,t)=>we(jt(e,t))),nr=d(3,(e,t,n)=>{if(ys(t)===!1)return e.referential.set(t,n),e;const r=t[D](),s=e.buckets.get(r);return s===void 0?(e.buckets.set(r,[[t,n]]),e.bucketsSize++,e):(Dw(e,s,t),s.push([t,n]),e.bucketsSize++,e)}),Dw=(e,t,n)=>{for(let r=0,s=t.length;r<s;r++)if(n[L](t[r][0])){t.splice(r,1),e.bucketsSize--;return}},Uw="effect/Clock",uu=Symbol.for(Uw),ec=sn("effect/Clock"),qw=2**31-1,lu={unsafeSchedule(e,t){const n=yi(t);if(n>qw)return ai;let r=!1;const s=setTimeout(()=>{r=!0,e()},n);return()=>(clearTimeout(s),!r)}},fu=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*e;let t;return()=>(t===void 0&&(t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6))),t+BigInt(Math.round(performance.now()*1e6)))})(),Bw=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return fu;const t=fu()-e.bigint();return()=>t+e.bigint()})();class Jw{[uu]=uu;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return Bw()}currentTimeMillis=j(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=j(()=>this.unsafeCurrentTimeNanos());scheduler(){return Q(lu)}sleep(t){return Yt(n=>{const r=lu.unsafeSchedule(()=>n(et),t);return Kr(j(r))})}}const Vw=()=>new Jw,qd="And",Bd="Or",Jd="InvalidData",Vd="MissingData",zd="SourceUnavailable",Hd="Unsupported",zw="effect/ConfigError",du=Symbol.for(zw),Wn={_tag:"ConfigError",[du]:du},Wd=(e,t)=>{const n=Object.create(Wn);return n._op=qd,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},Gd=(e,t)=>{const n=Object.create(Wn);return n._op=Bd,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},Hw=(e,t,n={pathDelim:"."})=>{const r=Object.create(Wn);return r._op=Jd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Invalid data at ${g(this.path,Un(n.pathDelim))}: "${this.message}")`}}),r},Qt=(e,t,n={pathDelim:"."})=>{const r=Object.create(Wn);return r._op=Vd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Missing data at ${g(this.path,Un(n.pathDelim))}: "${this.message}")`}}),r},Ww=(e,t,n,r={pathDelim:"."})=>{const s=Object.create(Wn);return s._op=zd,s.path=e,s.message=t,s.cause=n,Object.defineProperty(s,"toString",{enumerable:!1,value(){return`(Source unavailable at ${g(this.path,Un(r.pathDelim))}: "${this.message}")`}}),s},Gw=(e,t,n={pathDelim:"."})=>{const r=Object.create(Wn);return r._op=Hd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${g(this.path,Un(n.pathDelim))}: "${this.message}")`}}),r},Pt=d(2,(e,t)=>{switch(e._op){case qd:return Wd(Pt(e.left,t),Pt(e.right,t));case Bd:return Gd(Pt(e.left,t),Pt(e.right,t));case Jd:return Hw([...t,...e.path],e.message);case Vd:return Qt([...t,...e.path],e.message);case zd:return Ww([...t,...e.path],e.message,e.cause);case Hd:return Gw([...t,...e.path],e.message)}}),Yw={_tag:"Empty"},Wo=d(2,(e,t)=>{let n=Pa(t),r=e;for(;J_(n);){const s=n.head;switch(s._tag){case"Empty":{n=n.tail;break}case"AndThen":{n=Wt(s.first,Wt(s.second,n.tail));break}case"MapName":{r=Kt(r,s.f),n=n.tail;break}case"Nested":{r=ks(r,s.name),n=n.tail;break}case"Unnested":{if(g(fr(r),Eg(s.name)))r=Vt(r),n=n.tail;else return P(Qt(r,`Expected ${s.name} to be in path in ConfigProvider#unnested`));break}}}return V(r)}),Qw="Constant",Xw="Fail",Zw="Fallback",ek="Described",tk="Lazy",nk="MapOrFail",rk="Nested",sk="Primitive",ok="Sequence",ik="HashMap",ak="ZipWith";var hu={};const Ms=(e,t)=>[...e,...t],ck="effect/ConfigProvider",pu=Symbol.for(ck),uk=sn("effect/ConfigProvider"),lk="effect/ConfigProviderFlat",mu=Symbol.for(lk),fk=e=>({[pu]:pu,pipe(){return R(this,arguments)},...e}),dk=e=>({[mu]:mu,patch:e.patch,load:(t,n,r=!0)=>e.load(t,n,r),enumerateChildren:e.enumerateChildren}),hk=e=>fk({load:t=>C(Be(e,Sn(),t,!1),n=>Se(fr(n),{onNone:()=>Ee(Qt(Sn(),`Expected a single value having structure: ${t}`)),onSome:Q})),flattened:e}),pk=e=>{const{pathDelim:t,seqDelim:n}=Object.assign({},{pathDelim:"_",seqDelim:","},e),r=c=>g(c,Un(t)),s=c=>c.split(t),o=()=>typeof process<"u"&&"env"in process&&typeof hu=="object"?hu:{};return hk(dk({load:(c,u,f=!0)=>{const h=r(c),p=o(),m=h in p?I(p[h]):N();return g(m,_o(()=>Qt(c,`Expected ${h} to exist in the process context`)),C(y=>_k(y,c,u,n,f)))},enumerateChildren:c=>j(()=>{const u=o(),p=Object.keys(u).map(m=>s(m.toUpperCase())).filter(m=>{for(let y=0;y<c.length;y++){const T=g(c,Nl(y)),S=m[y];if(S===void 0||T!==S)return!1}return!0}).flatMap(m=>m.slice(c.length,c.length+1));return T_(p)}),patch:Yw}))},mk=(e,t,n,r)=>{const s=Ic(n.length,c=>c>=r.length?N():I([e(c),c+1])),o=Ic(r.length,c=>c>=n.length?N():I([t(c),c+1])),i=Ms(n,s),a=Ms(r,o);return[i,a]},gk=(e,t)=>{let n=t;if(n._tag==="Nested"){const r=e.slice();for(;n._tag==="Nested";)r.push(n.name),n=n.config;return r}return e},Be=(e,t,n,r)=>{const s=n;switch(s._tag){case Qw:return Q(Ge(s.value));case ek:return ce(()=>Be(e,t,s.config,r));case Xw:return Ee(Qt(t,s.message));case Zw:return g(ce(()=>Be(e,t,s.first,r)),Ei(o=>s.condition(o)?g(Be(e,t,s.second,r),Ei(i=>Ee(Gd(o,i)))):Ee(o)));case tk:return ce(()=>Be(e,t,s.config(),r));case nk:return ce(()=>g(Be(e,t,s.original,r),C($t(o=>g(s.mapOrFail(o),_o(Pt(gk(t,s.original))))))));case rk:return ce(()=>Be(e,Ms(t,Ge(s.name)),s.config,r));case sk:return g(Wo(t,e.patch),C(o=>g(e.load(o,s,r),C(i=>{if(i.length===0){const a=g(Ug(o),ye(()=>"<n/a>"));return Ee(Qt([],`Expected ${s.description} with name ${a}`))}return Q(i)}))));case ok:return g(Wo(t,e.patch),C(o=>g(e.enumerateChildren(o),C(wk),C(i=>i.length===0?ce(()=>Me(Be(e,t,s.config,!0),Ge)):g($t(i,a=>Be(e,Ag(t,`[${a}]`),s.config,!0)),Me(a=>{const c=Yg(a);return c.length===0?Ge(Sn()):Ge(c)}))))));case ik:return ce(()=>g(Wo(t,e.patch),C(o=>g(e.enumerateChildren(o),C(i=>g(i,$t(a=>Be(e,Ms(o,Ge(a)),s.valueConfig,r)),Me(a=>a.length===0?Ge(Fa()):g(Sk(a),Kt(c=>A_(Ec(oe(i),c)))))))))));case ak:return ce(()=>g(Be(e,t,s.left,r),js,C(o=>g(Be(e,t,s.right,r),js,C(i=>{if(he(o)&&he(i))return Ee(Wd(o.left,i.left));if(he(o)&&gt(i))return Ee(o.left);if(gt(o)&&he(i))return Ee(i.left);if(gt(o)&&gt(i)){const a=g(t,Un(".")),c=yk(t,a),[u,f]=mk(c,c,g(o.right,Kt(V)),g(i.right,Kt(V)));return g(u,Ec(f),$t(([h,p])=>g($d(h,p),Me(([m,y])=>s.zip(m,y)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},yk=(e,t)=>n=>P(Qt(e,`The element at index ${n} in a sequence at path "${t}" was missing`)),bk=(e,t)=>e.split(new RegExp(`\\s*${xs(t)}\\s*`)),_k=(e,t,n,r,s)=>s?g(bk(e,r),$t(o=>n.parse(o.trim())),_o(Pt(t))):g(n.parse(e),Va({onFailure:Pt(t),onSuccess:Ge})),Sk=e=>Object.keys(e[0]).map(t=>e.map(n=>n[t])),wk=e=>g($t(e,xk),Va({onFailure:()=>Sn(),onSuccess:_n(wn)}),js,Me(gg)),kk=/^(\[(\d+)\])$/,xk=e=>{const t=e.match(kk);if(t!==null){const n=t[2];return g(n!==void 0&&n.length>0?I(n):N(),Dn(vk))}return N()},vk=e=>{const t=Number.parseInt(e);return Number.isNaN(t)?N():I(t)},gu=Symbol.for("effect/Console"),Yd=sn("effect/Console"),Tk={[gu]:gu,assert(e,...t){return j(()=>{console.assert(e,...t)})},clear:j(()=>{console.clear()}),count(e){return j(()=>{console.count(e)})},countReset(e){return j(()=>{console.countReset(e)})},debug(...e){return j(()=>{console.debug(...e)})},dir(e,t){return j(()=>{console.dir(e,t)})},dirxml(...e){return j(()=>{console.dirxml(...e)})},error(...e){return j(()=>{console.error(...e)})},group(e){return e?.collapsed?j(()=>console.groupCollapsed(e?.label)):j(()=>console.group(e?.label))},groupEnd:j(()=>{console.groupEnd()}),info(...e){return j(()=>{console.info(...e)})},log(...e){return j(()=>{console.log(...e)})},table(e,t){return j(()=>{console.table(e,t)})},time(e){return j(()=>console.time(e))},timeEnd(e){return j(()=>console.timeEnd(e))},timeLog(e,...t){return j(()=>{console.timeLog(e,...t)})},trace(...e){return j(()=>{console.trace(...e)})},warn(...e){return j(()=>{console.warn(...e)})},unsafe:console},Ok="effect/Random",yu=Symbol.for(Ok),Nk=sn("effect/Random");class $k{seed;[yu]=yu;PRNG;constructor(t){this.seed=t,this.PRNG=new Lm(t)}get next(){return j(()=>this.PRNG.number())}get nextBoolean(){return Me(this.next,t=>t>.5)}get nextInt(){return j(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(t,n){return Me(this.next,r=>(n-t)*r+t)}nextIntBetween(t,n){return j(()=>this.PRNG.integer(n-t)+t)}shuffle(t){return Ek(t,n=>this.nextIntBetween(0,n))}}const Ek=(e,t)=>ce(()=>g(j(()=>Array.from(e)),C(n=>{const r=[];for(let s=n.length;s>=2;s=s-1)r.push(s);return g(r,bo(s=>g(t(s),Me(o=>Ik(n,s-1,o)))),Lr(xf(n)))}))),Ik=(e,t,n)=>{const r=e[t];return e[t]=e[n],e[n]=r,e},Rk=e=>new $k(k(e)),bu=Symbol.for("effect/Tracer"),Ck=e=>({[bu]:bu,...e}),Qd=sn("effect/Tracer"),Xd=sn("effect/ParentSpan"),_u=(function(){const e="abcdef0123456789",t=e.length;return function(n){let r="";for(let s=0;s<n;s++)r+=e.charAt(Math.floor(Math.random()*t));return r}})();class jk{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(t,n,r,s,o,i){this.name=t,this.parent=n,this.context=r,this.startTime=o,this.kind=i,this.status={_tag:"Started",startTime:o},this.attributes=new Map,this.traceId=n._tag==="Some"?n.value.traceId:_u(32),this.spanId=_u(16),this.links=Array.from(s)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}}const Mk=Ck({span:(e,t,n,r,s,o)=>new jk(e,t,n,r,s,o),context:e=>e()}),Ak=g(va(),er(ec,Vw()),er(Yd,Tk),er(Nk,Rk(Math.random())),er(uk,pk()),er(Qd,Mk)),As=B(Symbol.for("effect/DefaultServices/currentServices"),()=>Md(Ak));function Fk(e){return new Rt(e)}function Pk(){return Fk(new Map)}const Su=Symbol.for("effect/FiberRefs");class Rt{locals;[Su]=Su;constructor(t){this.locals=t}pipe(){return R(this,arguments)}}const Lk=(e,t,n,r=!1)=>{const s=e;let o=t,i=n,a=r,c;for(;c===void 0;)if(be(o)&&be(i)){const u=Re(o)[0],f=Vt(o),h=Re(i)[0],p=Re(i)[1],m=Vt(i);u.startTimeMillis<h.startTimeMillis?(i=m,a=!0):u.startTimeMillis>h.startTimeMillis?o=f:u.id<h.id?(i=m,a=!0):u.id>h.id?o=f:c=[p,a]}else c=[s.initial,!0];return c},Kk=d(3,(e,t,n)=>{const r=new Map(e.locals);return n.locals.forEach((s,o)=>{const i=s[0][1];if(!s[0][0][L](t)){if(!r.has(o)){if(K(i,o.initial))return;r.set(o,[[t,o.join(o.initial,i)]]);return}const a=r.get(o),[c,u]=Lk(o,a,s);if(u){const f=o.diff(c,i),h=a[0][1],p=o.join(h,o.patch(f)(h));if(!K(h,p)){let m;const y=a[0][0];y[L](t)?m=[[y,p],...a.slice(1)]:m=[[t,p],...a],r.set(o,m)}}}}),new Rt(r)}),Dk=d(2,(e,t)=>{const n=new Map;return Zd(e,n,t),new Rt(n)}),Zd=(e,t,n)=>{e.locals.forEach((r,s)=>{const o=r[0][1],i=s.patch(s.fork)(o);K(o,i)?t.set(s,r):t.set(s,[[n,i],...r])})},eh=d(2,(e,t)=>{const n=new Map(e.locals);return n.delete(t),new Rt(n)}),Uk=d(2,(e,t)=>e.locals.has(t)?I(Re(e.locals.get(t))[1]):N()),wr=d(2,(e,t)=>g(Uk(e,t),ye(()=>t.initial))),Ci=d(2,(e,{fiberId:t,fiberRef:n,value:r})=>{if(e.locals.size===0)return new Rt(new Map([[n,[[t,r]]]]));const s=new Map(e.locals);return ji(s,t,n,r),new Rt(s)}),ji=(e,t,n,r)=>{const s=e.get(n)??[];let o;if(be(s)){const[i,a]=Re(s);if(i[L](t)){if(K(a,r))return;o=[[t,r],...s.slice(1)]}else o=[[t,r],...s]}else o=[[t,r]];e.set(n,o)},qk=d(2,(e,{entries:t,forkAs:n})=>{if(e.locals.size===0)return new Rt(new Map(t));const r=new Map(e.locals);return n!==void 0&&Zd(e,r,n),t.forEach(([s,o])=>{o.length===1?ji(r,o[0][0],s,o[0][1]):o.forEach(([i,a])=>{ji(r,i,s,a)})}),new Rt(r)}),Bk=wr,Jk=qk,Vk=Pk,zk=Z0,Hk=ew,Wk=tw,Gk=Rd,Yk=Cd,Qk=jd,Xk=nw,Zk=rw,ex=g(wn,en(e=>e.ordinal)),tx=Sg(ex),nx=e=>{switch(e){case"All":return zk;case"Debug":return Qk;case"Error":return Wk;case"Fatal":return Hk;case"Info":return Yk;case"Trace":return Xk;case"None":return Zk;case"Warning":return Gk}},th=e=>e.replace(/[\s="]/g,"_"),rx=e=>t=>`${th(t.label)}=${e-t.startTime}ms`,sx=Nr,ox=sg;class ix extends ox{}const nh="Empty",rh="Add",sh="Remove",oh="Update",ih="AndThen",ax={_tag:nh},cx=(e,t)=>{const n=new Map(e.locals);let r=ax;for(const[s,o]of t.locals.entries()){const i=Re(o)[1],a=n.get(s);if(a!==void 0){const c=Re(a)[1];K(c,i)||(r=Go({_tag:oh,fiberRef:s,patch:s.diff(c,i)})(r))}else r=Go({_tag:rh,fiberRef:s,value:i})(r);n.delete(s)}for(const[s]of n.entries())r=Go({_tag:sh,fiberRef:s})(r);return r},Go=d(2,(e,t)=>({_tag:ih,first:e,second:t})),ux=d(3,(e,t,n)=>{let r=n,s=Ge(e);for(;be(s);){const o=Re(s),i=Vt(s);switch(o._tag){case nh:{s=i;break}case rh:{r=Ci(r,{fiberId:t,fiberRef:o.fiberRef,value:o.value}),s=i;break}case sh:{r=eh(r,o.fiberRef),s=i;break}case oh:{const a=wr(r,o.fiberRef);r=Ci(r,{fiberId:t,fiberRef:o.fiberRef,value:o.fiberRef.patch(o.patch)(a)}),s=i;break}case ih:{s=ks(o.first)(ks(o.second)(i));break}}}return r}),ah="effect/MetricLabel",Mi=Symbol.for(ah);class lx{key;value;[Mi]=Mi;_hash;constructor(t,n){this.key=t,this.value=n,this._hash=se(ah+this.key+this.value)}[D](){return this._hash}[L](t){return dx(t)&&this.key===t.key&&this.value===t.value}pipe(){return R(this,arguments)}}const fx=(e,t)=>new lx(e,t),dx=e=>A(e,Mi),hx=e=>{let t,n;typeof e=="function"?t=e:(t=e.try,n=e.catch);const r=s=>n?Ba(()=>n(s)):Ee(new Ld(s,"An unknown error occurred in Effect.tryPromise"));return t.length>=1?Yt((s,o)=>{try{t(o).then(i=>s(Q(i)),i=>s(r(i)))}catch(i){s(r(i))}}):Yt(s=>{try{t().then(o=>s(Q(o)),o=>s(r(o)))}catch(o){s(r(o))}})},px="Sequential",mx="Parallel",gx="ParallelN",ch={_tag:px},yx={_tag:mx},bx=e=>({_tag:gx,parallelism:e}),Ai=ch,Fi=yx,Pi=bx,_x=cx,Sx=ux,Oo="effect/FiberStatus",Xt=Symbol.for(Oo),Fs="Done",wu="Running",ku="Suspended",wx=se(`${Oo}-${Fs}`);class kx{[Xt]=Xt;_tag=Fs;[D](){return wx}[L](t){return tc(t)&&t._tag===Fs}}class xx{runtimeFlags;[Xt]=Xt;_tag=wu;constructor(t){this.runtimeFlags=t}[D](){return g(k(Oo),J(k(this._tag)),J(k(this.runtimeFlags)),ne(this))}[L](t){return tc(t)&&t._tag===wu&&this.runtimeFlags===t.runtimeFlags}}class vx{runtimeFlags;blockingOn;[Xt]=Xt;_tag=ku;constructor(t,n){this.runtimeFlags=t,this.blockingOn=n}[D](){return g(k(Oo),J(k(this._tag)),J(k(this.runtimeFlags)),J(k(this.blockingOn)),ne(this))}[L](t){return tc(t)&&t._tag===ku&&this.runtimeFlags===t.runtimeFlags&&K(this.blockingOn,t.blockingOn)}}const Tx=new kx,Ox=e=>new xx(e),Nx=(e,t)=>new vx(e,t),tc=e=>A(e,Xt),$x=e=>e._tag===Fs,Ex=Tx,uh=Ox,Ix=Nx,Rx=$x,Cx=Symbol.for("effect/Micro"),Ps=Symbol.for("effect/Micro/MicroExit"),xu=Symbol.for("effect/Micro/MicroCause"),jx={_E:Y};class lh extends globalThis.Error{_tag;traces;[xu];constructor(t,n,r){const s=`MicroCause.${t}`;let o,i,a;if(n instanceof globalThis.Error){o=`(${s}) ${n.name}`,i=n.message;const c=i.split(`
20
- `).length;a=n.stack?`(${s}) ${n.stack.split(`
21
- `).slice(0,c+3).join(`
22
- `)}`:`${o}: ${i}`}else o=s,i=yn(n,0),a=`${o}: ${i}`;r.length>0&&(a+=`
23
- ${r.join(`
24
- `)}`),super(i),this._tag=t,this.traces=r,this[xu]=jx,this.name=o,this.stack=a}pipe(){return R(this,arguments)}toString(){return this.stack}[ee](){return this.stack}}class Mx extends lh{defect;constructor(t,n=[]){super("Die",t,n),this.defect=t}}const Ax=(e,t=[])=>new Mx(e,t);class Fx extends lh{constructor(t=[]){super("Interrupt","interrupted",t)}}const Px=(e=[])=>new Fx(e),Lx=e=>e._tag==="Interrupt",vu=Symbol.for("effect/Micro/MicroFiber"),Kx={_A:Y,_E:Y};class Dx{context;interruptible;[vu];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(t,n=!0){this.context=t,this.interruptible=n,this[vu]=Kx}getRef(t){return db(this.context,t)}addObserver(t){return this._exit?(t(this._exit),wm):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(ic))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const n=this.runLoop(t);if(n===Qr)return;const r=Tu.interruptChildren&&Tu.interruptChildren(this);if(r!==void 0)return this.evaluate(Ks(r,()=>n));this._exit=n;for(let s=0;s<this._observers.length;s++)this._observers[s](n);this._observers.length=0}runLoop(t){let n=!1,r=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!n&&this.getRef(ac).shouldYield(this)){n=!0;const s=r;r=Ks(Vx,()=>s)}if(r=r[Li](this),r===Qr){const s=this._yielded;return Ps in s?(this._yielded=void 0,s):Qr}}}catch(s){return A(r,Li)?Ki(s):Ki(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const r=n[Ls]&&n[Ls](this);if(r)return{[t]:r};if(n[t])return n}}_yielded=void 0;yieldWith(t){return this._yielded=t,Qr}children(){return this._children??=new Set}}const Tu=B("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),fh=Symbol.for("effect/Micro/identifier"),ue=Symbol.for("effect/Micro/args"),Li=Symbol.for("effect/Micro/evaluate"),Pn=Symbol.for("effect/Micro/successCont"),gn=Symbol.for("effect/Micro/failureCont"),Ls=Symbol.for("effect/Micro/ensureCont"),Qr=Symbol.for("effect/Micro/Yield"),Ux={_A:Y,_E:Y,_R:Y},qx={...sx,_op:"Micro",[Cx]:Ux,pipe(){return R(this,arguments)},[Symbol.iterator](){return new sl(new vr(this))},toJSON(){return{_id:"Micro",op:this[fh],...ue in this?{args:this[ue]}:void 0}},toString(){return ge(this)},[ee](){return ge(this)}};function Bx(e){return Ki("Micro.evaluate: Not implemented")}const No=e=>({...qx,[fh]:e.op,[Li]:e.eval??Bx,[Pn]:e.contA,[gn]:e.contE,[Ls]:e.ensure}),nc=e=>{const t=No(e);return function(){const n=Object.create(t);return n[ue]=e.single===!1?arguments:arguments[0],n}},dh=e=>{const t={...No(e),[Ps]:Ps,_tag:e.op,get[e.prop](){return this[ue]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[ue]}},[L](n){return Wx(n)&&n._tag===e.op&&K(this[ue],n[ue])},[D](){return ne(this,J(se(e.op))(k(this[ue])))}};return function(n){const r=Object.create(t);return r[ue]=n,r[Pn]=void 0,r[gn]=void 0,r[Ls]=void 0,r}},rc=dh({op:"Success",prop:"value",eval(e){const t=e.getCont(Pn);return t?t[Pn](this[ue],e):e.yieldWith(this)}}),hh=dh({op:"Failure",prop:"cause",eval(e){let t=e.getCont(gn);for(;Lx(this[ue])&&t&&e.interruptible;)t=e.getCont(gn);return t?t[gn](this[ue],e):e.yieldWith(this)}}),Jx=nc({op:"Yield",eval(e){let t=!1;return e.getRef(ac).scheduleTask(()=>{t||e.evaluate(Gx)},this[ue]??0),e.yieldWith(()=>{t=!0})}}),Vx=Jx(0),zx=rc(void 0),sc=nc({op:"WithMicroFiber",eval(e){return this[ue](e)}}),Ks=d(2,(e,t)=>{const n=Object.create(Hx);return n[ue]=e,n[Pn]=t,n}),Hx=No({op:"OnSuccess",eval(e){return e._stack.push(this),this[ue]}}),Wx=e=>A(e,Ps),ph=rc,oc=hh,ic=oc(Px()),Ki=e=>oc(Ax(e)),Gx=ph(void 0),Yx="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class mh{tasks=[];running=!1;scheduleTask(t,n){this.tasks.push(t),this.running||(this.running=!0,Yx(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){const t=this.tasks;this.tasks=[];for(let n=0,r=t.length;n<r;n++)t[n]()}shouldYield(t){return t.currentOpCount>=t.getRef(Zx)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const Qx=d(2,(e,t)=>sc(n=>{const r=n.context;return n.context=t(r),nv(e,()=>(n.context=r,zx))})),Xx=d(2,(e,t)=>Qx(e,bf(t)));class Zx extends _f()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class ac extends _f()("effect/Micro/currentScheduler",{defaultValue:()=>new mh}){}const ev=d(2,(e,t)=>{const n=Object.create(tv);return n[ue]=e,n[Pn]=t.onSuccess,n[gn]=t.onFailure,n}),tv=No({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[ue]}}),nv=d(2,(e,t)=>sv(n=>ev(n(e),{onFailure:r=>Ks(t(oc(r)),()=>hh(r)),onSuccess:r=>Ks(t(ph(r)),()=>rc(r))}))),gh=nc({op:"SetInterruptible",ensure(e){if(e.interruptible=this[ue],e._interrupted&&e.interruptible)return()=>ic}}),rv=e=>sc(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(gh(!1)),t._interrupted?ic:e)),sv=e=>sc(t=>t.interruptible?(t.interruptible=!1,t._stack.push(gh(!0)),e(rv)):e(Y)),ov=(e,t)=>{const n=new Dx(ac.context(new mh));return n.evaluate(e),n};class yh{buckets=[];scheduleTask(t,n){const r=this.buckets.length;let s,o=0;for(;o<r&&this.buckets[o][0]<=n;o++)s=this.buckets[o];s&&s[0]===n?s[1].push(t):o===r?this.buckets.push([n,[t]]):this.buckets.splice(o,0,[n,[t]])}}class iv{maxNextTickBeforeTimer;running=!1;tasks=new yh;constructor(t){this.maxNextTickBeforeTimer=t}starveInternal(t){const n=this.tasks.buckets;this.tasks.buckets=[];for(const[r,s]of n)for(let o=0;o<s.length;o++)s[o]();this.tasks.buckets.length===0?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(Ad)?t.getFiberRef(xo):!1}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running||(this.running=!0,this.starve())}}const bh=B(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new iv(2048));class _h{tasks=new yh;deferred=!1;scheduleTask(t,n){this.deferred?bh.scheduleTask(t,n):this.tasks.scheduleTask(t,n)}shouldYield(t){return t.currentOpCount>t.getFiberRef(Ad)?t.getFiberRef(xo):!1}flush(){for(;this.tasks.buckets.length>0;){const t=this.tasks.buckets;this.tasks.buckets=[];for(const[n,r]of t)for(let s=0;s<r.length;s++)r[s]()}this.deferred=!0}}const Sh=B(Symbol.for("effect/FiberRef/currentScheduler"),()=>Ae(bh)),wh=B(Symbol.for("effect/FiberRef/currentRequestMap"),()=>Ae(new Map)),Ou=(e,t,n,r)=>{switch(e){case void 0:return t();case"unbounded":return n();case"inherit":return Ya(mw,s=>s==="unbounded"?n():s>1?r(s):t());default:return e>1?r(e):t()}},cc="InterruptSignal",uc="Stateful",lc="Resume",fc="YieldNow",Yo=e=>({_tag:cc,cause:e}),ds=e=>({_tag:uc,onFiber:e}),un=e=>({_tag:lc,effect:e}),av=()=>({_tag:fc}),cv="effect/FiberScope",Ds=Symbol.for(cv);class uv{[Ds]=Ds;fiberId=$n;roots=new Set;add(t,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}class lv{fiberId;parent;[Ds]=Ds;constructor(t,n){this.fiberId=t,this.parent=n}add(t,n){this.parent.tell(ds(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const fv=e=>new lv(e.id(),e),dc=B(Symbol.for("effect/FiberScope/Global"),()=>new uv),dv="effect/Fiber",hv=Symbol.for(dv),pv={_E:e=>e,_A:e=>e},mv="effect/Fiber",gv=Symbol.for(mv),kh=e=>Ed(vd(e.await),e.inheritAll);({...$r});const Ct="effect/FiberCurrent",yv="effect/Logger",bv=Symbol.for(yv),_v={_Message:e=>e,_Output:e=>e},hc=e=>({[bv]:_v,log:e,pipe(){return R(this,arguments)}}),Sv=/^[^\s"=]*$/,wv=(e,t)=>({annotations:n,cause:r,date:s,fiberId:o,logLevel:i,message:a,spans:c})=>{const u=y=>y.match(Sv)?y:e(y),f=(y,T)=>`${th(y)}=${u(T)}`,h=(y,T)=>" "+f(y,T);let p=f("timestamp",s.toISOString());p+=h("level",i.label),p+=h("fiber",Jf(o));const m=jg(a);for(let y=0;y<m.length;y++)p+=h("message",yn(m[y],t));g0(r)||(p+=h("cause",zn(r,{renderErrorCause:!0})));for(const y of c)p+=" "+rx(s.getTime())(y);for(const[y,T]of n)p+=h(y,yn(T,t));return p},kv=e=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,xv=hc(wv(kv)),vv=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;vv&&process.stdout.isTTY;const xh="effect/MetricBoundaries",Di=Symbol.for(xh);class Tv{values;[Di]=Di;constructor(t){this.values=t,this._hash=g(se(xh),J(Tr(this.values)))}_hash;[D](){return this._hash}[L](t){return Ov(t)&&K(this.values,t.values)}pipe(){return R(this,arguments)}}const Ov=e=>A(e,Di),Nv=e=>{const t=g(e,Tl(Le(Number.POSITIVE_INFINITY)),Qg);return new Tv(t)},$v=e=>g(Cg(e.count-1,t=>e.start*Math.pow(e.factor,t)),so,Nv),Ev="effect/MetricKeyType",vh=Symbol.for(Ev),Th="effect/MetricKeyType/Counter",Ui=Symbol.for(Th),Iv="effect/MetricKeyType/Frequency",Rv=Symbol.for(Iv),Cv="effect/MetricKeyType/Gauge",jv=Symbol.for(Cv),Oh="effect/MetricKeyType/Histogram",qi=Symbol.for(Oh),Mv="effect/MetricKeyType/Summary",Av=Symbol.for(Mv),Nh={_In:e=>e,_Out:e=>e};class Fv{incremental;bigint;[vh]=Nh;[Ui]=Ui;constructor(t,n){this.incremental=t,this.bigint=n,this._hash=se(Th)}_hash;[D](){return this._hash}[L](t){return $h(t)}pipe(){return R(this,arguments)}}class Pv{boundaries;[vh]=Nh;[qi]=qi;constructor(t){this.boundaries=t,this._hash=g(se(Oh),J(k(this.boundaries)))}_hash;[D](){return this._hash}[L](t){return Eh(t)&&K(this.boundaries,t.boundaries)}pipe(){return R(this,arguments)}}const Lv=e=>new Fv(e?.incremental??!1,e?.bigint??!1),Kv=e=>new Pv(e),$h=e=>A(e,Ui),Dv=e=>A(e,Rv),Uv=e=>A(e,jv),Eh=e=>A(e,qi),qv=e=>A(e,Av),Bv="effect/MetricKey",Ih=Symbol.for(Bv),Jv={_Type:e=>e},Vv=ga(K);class pc{name;keyType;description;tags;[Ih]=Jv;constructor(t,n,r,s=[]){this.name=t,this.keyType=n,this.description=r,this.tags=s,this._hash=g(se(this.name+this.description),J(k(this.keyType)),J(Tr(this.tags)))}_hash;[D](){return this._hash}[L](t){return zv(t)&&this.name===t.name&&K(this.keyType,t.keyType)&&K(this.description,t.description)&&Vv(this.tags,t.tags)}pipe(){return R(this,arguments)}}const zv=e=>A(e,Ih),Hv=(e,t)=>new pc(e,Lv(t),Xs(t?.description)),Wv=(e,t,n)=>new pc(e,Kv(t),Xs(n)),Gv=d(2,(e,t)=>t.length===0?e:new pc(e.name,e.keyType,e.description,as(e.tags,t))),Yv="effect/MetricState",qr=Symbol.for(Yv),Rh="effect/MetricState/Counter",Bi=Symbol.for(Rh),Ch="effect/MetricState/Frequency",Ji=Symbol.for(Ch),jh="effect/MetricState/Gauge",Vi=Symbol.for(jh),Mh="effect/MetricState/Histogram",zi=Symbol.for(Mh),Ah="effect/MetricState/Summary",Hi=Symbol.for(Ah),Br={_A:e=>e};class Qv{count;[qr]=Br;[Bi]=Bi;constructor(t){this.count=t}[D](){return g(k(Rh),J(k(this.count)),ne(this))}[L](t){return cT(t)&&this.count===t.count}pipe(){return R(this,arguments)}}const Xv=ga(K);class Zv{occurrences;[qr]=Br;[Ji]=Ji;constructor(t){this.occurrences=t}_hash;[D](){return g(se(Ch),J(Tr(oe(this.occurrences.entries()))),ne(this))}[L](t){return uT(t)&&Xv(oe(this.occurrences.entries()),oe(t.occurrences.entries()))}pipe(){return R(this,arguments)}}class eT{value;[qr]=Br;[Vi]=Vi;constructor(t){this.value=t}[D](){return g(k(jh),J(k(this.value)),ne(this))}[L](t){return lT(t)&&this.value===t.value}pipe(){return R(this,arguments)}}class tT{buckets;count;min;max;sum;[qr]=Br;[zi]=zi;constructor(t,n,r,s,o){this.buckets=t,this.count=n,this.min=r,this.max=s,this.sum=o}[D](){return g(k(Mh),J(k(this.buckets)),J(k(this.count)),J(k(this.min)),J(k(this.max)),J(k(this.sum)),ne(this))}[L](t){return fT(t)&&K(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return R(this,arguments)}}class nT{error;quantiles;count;min;max;sum;[qr]=Br;[Hi]=Hi;constructor(t,n,r,s,o,i){this.error=t,this.quantiles=n,this.count=r,this.min=s,this.max=o,this.sum=i}[D](){return g(k(Ah),J(k(this.error)),J(k(this.quantiles)),J(k(this.count)),J(k(this.min)),J(k(this.max)),J(k(this.sum)),ne(this))}[L](t){return dT(t)&&this.error===t.error&&K(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return R(this,arguments)}}const rT=e=>new Qv(e),sT=e=>new Zv(e),oT=e=>new eT(e),iT=e=>new tT(e.buckets,e.count,e.min,e.max,e.sum),aT=e=>new nT(e.error,e.quantiles,e.count,e.min,e.max,e.sum),cT=e=>A(e,Bi),uT=e=>A(e,Ji),lT=e=>A(e,Vi),fT=e=>A(e,zi),dT=e=>A(e,Hi),hT="effect/MetricHook",pT=Symbol.for(hT),mT={_In:e=>e,_Out:e=>e},Jr=e=>({[pT]:mT,pipe(){return R(this,arguments)},...e}),Nu=BigInt(0),gT=e=>{let t=e.keyType.bigint?Nu:0;const n=e.keyType.incremental?e.keyType.bigint?s=>s>=Nu:s=>s>=0:s=>!0,r=s=>{n(s)&&(t=t+s)};return Jr({get:()=>rT(t),update:r,modify:r})},yT=e=>{const t=new Map;for(const r of e.keyType.preregisteredWords)t.set(r,0);const n=r=>{const s=t.get(r)??0;t.set(r,s+1)};return Jr({get:()=>sT(t),update:n,modify:n})},bT=(e,t)=>{let n=t;return Jr({get:()=>oT(n),update:r=>{n=r},modify:r=>{n=n+r}})},_T=e=>{const t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),s=new Float64Array(n);let o=0,i=0,a=Number.MAX_VALUE,c=Number.MIN_VALUE;g(t,_n(wn),Kt((h,p)=>{s[p]=h}));const u=h=>{let p=0,m=n;for(;p!==m;){const y=Math.floor(p+(m-p)/2),T=s[y];h<=T?m=y:p=y,m===p+1&&(h<=s[p]?m=p:p=m)}r[p]=r[p]+1,o=o+1,i=i+h,h<a&&(a=h),h>c&&(c=h)},f=()=>{const h=Zs(n);let p=0;for(let m=0;m<n;m++){const y=s[m],T=r[m];p=p+T,h[m]=[y,p]}return h};return Jr({get:()=>iT({buckets:f(),count:o,min:a,max:c,sum:i}),update:u,modify:u})},ST=e=>{const{error:t,maxAge:n,maxSize:r,quantiles:s}=e.keyType,o=g(s,_n(wn)),i=Zs(r);let a=0,c=0,u=0,f=0,h=0;const p=y=>{const T=[];let S=0;for(;S!==r-1;){const w=i[S];if(w!=null){const[F,v]=w,O=gi(y-F);qb(O,Nf)&&Ub(O,n)&&T.push(v)}S=S+1}return wT(t,o,_n(T,wn))},m=(y,T)=>{if(r>0){a=a+1;const S=a%r;i[S]=[T,y]}f=c===0?y:Math.min(f,y),h=c===0?y:Math.max(h,y),c=c+1,u=u+y};return Jr({get:()=>aT({error:t,quantiles:p(Date.now()),count:c,min:f,max:h,sum:u}),update:([y,T])=>m(y,T),modify:([y,T])=>m(y,T)})},wT=(e,t,n)=>{const r=n.length;if(!be(t))return Sn();const s=t[0],o=t.slice(1),i=$u(e,r,N(),0,s,n),a=Ge(i);return o.forEach(c=>{a.push($u(e,r,i.value,i.consumed,c,i.rest))}),Kt(a,c=>[c.quantile,c.value])},$u=(e,t,n,r,s,o)=>{let i=e,a=t,c=n,u=r,f=s,h=o,p=e,m=t,y=n,T=r,S=s,w=o;for(;;){if(!be(h))return{quantile:f,value:N(),consumed:u,rest:[]};if(f===1)return{quantile:f,value:I($l(h)),consumed:u+h.length,rest:[]};const F=Re(h),v=Bg(h,$=>$===F),O=f*a,E=i/2*O,x=u+v[0].length,q=Math.abs(x-O);if(x<O-E){p=i,m=a,y=fr(h),T=x,S=f,w=v[1],i=p,a=m,c=y,u=T,f=S,h=w;continue}if(x>O+E){const $=te(c)?I(F):c;return{quantile:f,value:$,consumed:u,rest:h}}switch(c._tag){case"None":{p=i,m=a,y=fr(h),T=x,S=f,w=v[1],i=p,a=m,c=y,u=T,f=S,h=w;continue}case"Some":{const $=Math.abs(O-c.value);if(q<$){p=i,m=a,y=fr(h),T=x,S=f,w=v[1],i=p,a=m,c=y,u=T,f=S,h=w;continue}return{quantile:f,value:I(c.value),consumed:u,rest:h}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},kT="effect/MetricPair",xT=Symbol.for(kT),vT={_Type:e=>e},TT=(e,t)=>({[xT]:vT,metricKey:e,metricState:t,pipe(){return R(this,arguments)}}),OT="effect/MetricRegistry",Eu=Symbol.for(OT);class NT{[Eu]=Eu;map=Lw();snapshot(){const t=[];for(const[n,r]of this.map)t.push(TT(n,r.get()));return t}get(t){const n=g(this.map,jt(t),st);if(n==null){if($h(t.keyType))return this.getCounter(t);if(Uv(t.keyType))return this.getGauge(t);if(Dv(t.keyType))return this.getFrequency(t);if(Eh(t.keyType))return this.getHistogram(t);if(qv(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(t){let n=g(this.map,jt(t),st);if(n==null){const r=gT(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getFrequency(t){let n=g(this.map,jt(t),st);if(n==null){const r=yT(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getGauge(t){let n=g(this.map,jt(t),st);if(n==null){const r=bT(t,t.keyType.bigint?BigInt(0):0);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getHistogram(t){let n=g(this.map,jt(t),st);if(n==null){const r=_T(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getSummary(t){let n=g(this.map,jt(t),st);if(n==null){const r=ST(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}}const $T=()=>new NT,ET="effect/Metric",IT=Symbol.for(ET),RT={_Type:e=>e,_In:e=>e,_Out:e=>e},Iu=B(Symbol.for("effect/Metric/globalMetricRegistry"),()=>$T()),Fh=function(e,t,n,r){const s=Object.assign(o=>G0(o,i=>AT(s,i)),{[IT]:RT,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return R(this,arguments)}});return s},$o=(e,t)=>Ph(Hv(e,t)),Ph=e=>{let t;const n=new WeakMap,r=s=>{if(s.length===0)return t!==void 0||(t=Iu.get(e)),t;let o=n.get(s);return o!==void 0||(o=Iu.get(Gv(e,s)),n.set(s,o)),o};return Fh(e.keyType,(s,o)=>r(o).update(s),s=>r(s).get(),(s,o)=>r(o).modify(s))},CT=(e,t,n)=>Ph(Wv(e,t,n)),jT=d(3,(e,t,n)=>MT(e,[fx(t,n)])),MT=d(2,(e,t)=>Fh(e.keyType,(n,r)=>e.unsafeUpdate(n,as(t,r)),n=>e.unsafeValue(as(t,n)),(n,r)=>e.unsafeModify(n,as(t,r)))),AT=d(2,(e,t)=>Ya(Ii,n=>j(()=>e.unsafeUpdate(t,n))));({...la});const FT=d(2,(e,t)=>Ya(wh,n=>j(()=>{if(n.has(e)){const r=n.get(e);r.state.completed||(r.state.completed=!0,Ud(r.result,t))}}))),PT="effect/Supervisor",Eo=Symbol.for(PT),mc={_T:e=>e};class Io{underlying;value0;[Eo]=mc;constructor(t,n){this.underlying=t,this.value0=n}get value(){return this.value0}onStart(t,n,r,s){this.underlying.onStart(t,n,r,s)}onEnd(t,n){this.underlying.onEnd(t,n)}onEffect(t,n){this.underlying.onEffect(t,n)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new Io(this,g(this.value,Me(t)))}zip(t){return new Ro(this,t)}}class Ro{left;right;_tag="Zip";[Eo]=mc;constructor(t,n){this.left=t,this.right=n}get value(){return $d(this.left.value,this.right.value)}onStart(t,n,r,s){this.left.onStart(t,n,r,s),this.right.onStart(t,n,r,s)}onEnd(t,n){this.left.onEnd(t,n),this.right.onEnd(t,n)}onEffect(t,n){this.left.onEffect(t,n),this.right.onEffect(t,n)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new Io(this,g(this.value,Me(t)))}zip(t){return new Ro(this,t)}}const Lh=e=>A(e,Eo)&&rl(e,"Zip");class LT{effect;[Eo]=mc;constructor(t){this.effect=t}get value(){return this.effect}onStart(t,n,r,s){}onEnd(t,n){}onEffect(t,n){}onSuspend(t){}onResume(t){}map(t){return new Io(this,g(this.value,Me(t)))}zip(t){return new Ro(this,t)}onRun(t,n){return t()}}const KT=e=>new LT(e),Co=B("effect/Supervisor/none",()=>KT(et)),DT=qn,Kh="Empty",Dh="AddSupervisor",Uh="RemoveSupervisor",qh="AndThen",hr={_tag:Kh},hs=(e,t)=>({_tag:qh,first:e,second:t}),UT=(e,t)=>qT(t,Le(e)),qT=(e,t)=>{let n=e,r=t;for(;vn(r);){const s=Tn(r);switch(s._tag){case Kh:{r=At(r);break}case Dh:{n=n.zip(s.supervisor),r=At(r);break}case Uh:{n=Wi(n,s.supervisor),r=At(r);break}case qh:{r=Xe(s.first)(Xe(s.second)(At(r)));break}}}return n},Wi=(e,t)=>K(e,t)?Co:Lh(e)?Wi(e.left,t).zip(Wi(e.right,t)):e,Us=e=>K(e,Co)?Ht():Lh(e)?g(Us(e.left),yr(Us(e.right))):Ma(e),BT=(e,t)=>{if(K(e,t))return hr;const n=Us(e),r=Us(t),s=g(r,Bc(n),Ns(hr,(i,a)=>hs(i,{_tag:Dh,supervisor:a}))),o=g(n,Bc(r),Ns(hr,(i,a)=>hs(i,{_tag:Uh,supervisor:a})));return hs(s,o)},JT=DT({empty:hr,patch:UT,combine:hs,diff:BT}),VT=$o("effect_fiber_started",{incremental:!0}),Ru=$o("effect_fiber_active"),zT=$o("effect_fiber_successes",{incremental:!0}),HT=$o("effect_fiber_failures",{incremental:!0}),WT=jT(CT("effect_fiber_lifetimes",$v({start:.5,factor:2,count:35})),"time_unit","milliseconds"),rr="Continue",GT="Done",Cu="Yield",YT={_E:e=>e,_A:e=>e},Xr=e=>{throw new Error(`BUG: FiberRuntime - ${yn(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},pt=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),mt=B("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),sr={[bs]:(e,t,n)=>Ie(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>ie(ie(n)),[_s]:(e,t,n)=>Ie(()=>t.effect_instruction_i2(n)),[ca]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),Tt(e.currentRuntimeFlags)&&e.isInterrupted()?X(e.getInterruptedCause()):ie(n)),[Ss]:(e,t,n)=>(Ie(()=>t.effect_instruction_i2(n)),Ie(()=>t.effect_instruction_i0())?(e.pushStack(t),Ie(()=>t.effect_instruction_i1())):et),[ss]:(e,t,n)=>{for(;;){const r=Ie(()=>t.effect_instruction_i0.next(n));if(r.done)return ie(r.value);const s=Dm(r.value);if(To(s)){if(s._tag==="Failure")return s}else return e.pushStack(t),s;n=s.value}}},QT={[cc]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),Tt(t)?X(r.cause):n),[lc]:(e,t,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[uc]:(e,t,n,r)=>(r.onFiber(e,uh(t)),n),[fc]:(e,t,n,r)=>C(Wa(),()=>n)},XT=e=>bo(ZS(e),t=>Bt(h0(t),([n,r])=>{const s=new Map,o=[];for(const a of r){o.push(Ut(a));for(const c of a)s.set(c.request,c)}const i=o.flat();return ko(dO(n.runAll(o),i,()=>i.forEach(a=>{a.listeners.interrupted=!0})),wh,s)},!1,!1)),ZT=ua();class Bh extends ix{[hv]=pv;[gv]=YT;_fiberRefs;_fiberId;_queue=new Array;_children=null;_observers=new Array;_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(t,n,r){if(super(),this.currentRuntimeFlags=r,this._fiberId=t,this._fiberRefs=n,Wc(r)){const s=this.getFiberRef(Ii);VT.unsafeUpdate(1,s),Ru.unsafeUpdate(1,s)}this.refreshRefCache()}commit(){return kh(this)}id(){return this._fiberId}resume(t){this.tell(un(t))}get status(){return this.ask((t,n)=>n)}get runtimeFlags(){return this.ask((t,n)=>Rx(n)?t.currentRuntimeFlags:n.runtimeFlags)}scope(){return fv(this)}get children(){return this.ask(t=>Array.from(t.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Yr)}fiberRefs(){return this.ask(t=>t.getFiberRefs())}ask(t){return ce(()=>{const n=Ew(this._fiberId);return this.tell(ds((r,s)=>{Ud(n,j(()=>t(r,s)))})),Dd(n)})}tell(t){this._queue.push(t),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return Yt(t=>{const n=r=>t(Q(r));return this.tell(ds((r,s)=>{r._exitValue!==null?n(this._exitValue):r.addObserver(n)})),j(()=>this.tell(ds((r,s)=>{r.removeObserver(n)})))},this.id())}get inheritAll(){return Ke((t,n)=>{const r=t.id(),s=t.getFiberRefs(),o=n.runtimeFlags,i=this.getFiberRefs(),a=Kk(s,r,i);t.setFiberRefs(a);const c=t.getFiberRef(Pu),u=g(ls(o,c),Yc(Bn),Yc(Ni));return Q0(u)})}get poll(){return j(()=>Xs(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(t){return j(()=>this.tell(Yo(Ot(t))))}unsafeInterruptAsFork(t){this.tell(Yo(Ot(t)))}addObserver(t){this._exitValue!==null?t(this._exitValue):this._observers.push(t)}removeObserver(t){this._observers=this._observers.filter(n=>n!==t)}getFiberRefs(){return this.setFiberRef(Pu,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(t){this._fiberRefs=eh(this._fiberRefs,t)}getFiberRef(t){return this._fiberRefs.locals.has(t)?this._fiberRefs.locals.get(t)[0][1]:t.initial}setFiberRef(t,n){this._fiberRefs=Ci(this._fiberRefs,{fiberId:this._fiberId,fiberRef:t,value:n}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(As),this.currentTracer=this.currentDefaultServices.unsafeMap.get(Qd.key),this.currentSupervisor=this.getFiberRef(fO),this.currentScheduler=this.getFiberRef(Sh),this.currentContext=this.getFiberRef(Dr),this.currentSpan=this.currentContext.unsafeMap.get(Xd.key)}setFiberRefs(t){this._fiberRefs=t,this.refreshRefCache()}addChild(t){this.getChildren().add(t)}removeChild(t){this.getChildren().delete(t)}transferChildren(t){const n=this._children;if(this._children=null,n!==null&&n.size>0)for(const r of n)r._exitValue===null&&t.add(this.currentRuntimeFlags,r)}drainQueueOnCurrentThread(){let t=!0;for(;t;){let n=rr;const r=globalThis[Ct];globalThis[Ct]=this;try{for(;n===rr;)n=this._queue.length===0?GT:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[Ct]=r}this._queue.length>0&&!this._running?(this._running=!0,n===Cu?(this.drainQueueLaterOnExecutor(),t=!1):t=!0):t=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(xo))}drainQueueWhileRunning(t,n){let r=n;for(;this._queue.length>0;){const s=this._queue.splice(0,1)[0];r=QT[s._tag](this,t,r,s)}return r}isInterrupted(){return!b0(this.getFiberRef(Yr))}addInterruptedCause(t){const n=this.getFiberRef(Yr);this.setFiberRef(Yr,Ve(n,t))}processNewInterruptSignal(t){this.addInterruptedCause(t),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let t=!1;for(const n of this._children)n.tell(Yo(Ot(this.id()))),t=!0;return t}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const t=this._children.values();this._children=null;let n=!1;return Ha({while:()=>!n,body:()=>{const s=t.next();return s.done?j(()=>{n=!0}):Kr(s.value.await)},step:()=>{}})}return null}reportExitValue(t){if(Wc(this.currentRuntimeFlags)){const n=this.getFiberRef(Ii),r=this.id().startTimeMillis,s=Date.now();switch(WT.unsafeUpdate(s-r,n),Ru.unsafeUpdate(-1,n),t._tag){case He:{zT.unsafeUpdate(1,n);break}case ze:{HT.unsafeUpdate(1,n);break}}}if(t._tag==="Failure"){const n=this.getFiberRef(yw);!Da(t.cause)&&n._tag==="Some"&&this.log("Fiber terminated with an unhandled error",t.cause,n)}}setExitValue(t){this._exitValue=t,this.reportExitValue(t);for(let n=this._observers.length-1;n>=0;n--)this._observers[n](t);this._observers=[]}getLoggers(){return this.getFiberRef(sO)}log(t,n,r){const s=we(r)?r.value:this.getFiberRef(dw),o=this.getFiberRef(eO);if(tx(o,s))return;const i=this.getFiberRef(hw),a=this.getFiberRef(fw),c=this.getLoggers(),u=this.getFiberRefs();if(Kf(c)>0){const f=gf(this.getFiberRef(As),ec),h=new Date(f.unsafeCurrentTimeMillis());Hm(u,()=>{for(const p of c)p.log({fiberId:this.id(),logLevel:s,message:t,cause:n,context:u,spans:i,annotations:a,date:h})})}}evaluateMessageWhileSuspended(t){switch(t._tag){case fc:return Cu;case cc:return this.processNewInterruptSignal(t.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(X(t.cause)),this._asyncInterruptor=null),rr;case lc:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(t.effect),rr;case uc:return t.onFiber(this,this._exitValue!==null?Ex:Ix(this.currentRuntimeFlags,this._asyncBlockingOn)),rr;default:return Xr(t)}}evaluateEffect(t){this.currentSupervisor.onResume(this);try{let n=Tt(this.currentRuntimeFlags)&&this.isInterrupted()?X(this.getInterruptedCause()):t;for(;n!==null;){const r=n,s=this.runLoop(r);if(s===pt){const o=mt.currentOp;mt.currentOp=null,o._op===os?WS(this.currentRuntimeFlags)?(this.tell(av()),this.tell(un(Ft)),n=null):n=Ft:o._op===lr&&(n=null)}else{this.currentRuntimeFlags=g(this.currentRuntimeFlags,GS(Ni));const o=this.interruptAllChildren();o!==null?n=C(o,()=>s):(this._queue.length===0?this.setExitValue(s):this.tell(un(s)),n=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(t){if(this._running)this.tell(un(t));else{this._running=!0;const n=globalThis[Ct];globalThis[Ct]=this;try{this.evaluateEffect(t)}finally{this._running=!1,globalThis[Ct]=n,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(t){this.tell(un(t))}patchRuntimeFlags(t,n){const r=fs(t,n);return globalThis[Ct]=this,this.currentRuntimeFlags=r,r}initiateAsync(t,n){let r=!1;const s=o=>{r||(r=!0,this.tell(un(o)))};Tt(t)&&(this._asyncInterruptor=s);try{n(s)}catch(o){s(Ze(at(o)))}}pushStack(t){this._stack.push(t),t._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const t=this._stack.pop();if(t)return t._op==="OnStep"&&this._steps.pop(),t}getNextSuccessCont(){let t=this.popStack();for(;t;){if(t._op!==Ko)return t;t=this.popStack()}}getNextFailCont(){let t=this.popStack();for(;t;){if(t._op!==bs&&t._op!==Ss&&t._op!==ss)return t;t=this.popStack()}}[Gm](t){return j(()=>yf(this.currentContext,t))}Left(t){return Ee(t.left)}None(t){return Ee(new Pd)}Right(t){return ie(t.right)}Some(t){return ie(t.value)}Micro(t){return Cs(n=>{let r=n;const s=ov(Xx(t,this.currentContext));return s.addObserver(o=>{if(o._tag==="Success")return r(ie(o.value));switch(o.cause._tag){case"Interrupt":return r(X(Ot($n)));case"Fail":return r(Ee(o.cause.error));case"Die":return r(tu(o.cause.defect))}}),Cs(o=>{r=i=>{o(et)},s.unsafeInterrupt()})})}[fl](t){const n=Ie(()=>t.effect_instruction_i0()),r=this.getNextSuccessCont();return r!==void 0?(r._op in sr||Xr(r),sr[r._op](this,r,n)):(mt.currentOp=ie(n),pt)}[He](t){const n=t,r=this.getNextSuccessCont();return r!==void 0?(r._op in sr||Xr(r),sr[r._op](this,r,n.effect_instruction_i0)):(mt.currentOp=n,pt)}[ze](t){const n=t.effect_instruction_i0,r=this.getNextFailCont();if(r!==void 0)switch(r._op){case Ko:case _s:return Tt(this.currentRuntimeFlags)&&this.isInterrupted()?X(Qc(n)):Ie(()=>r.effect_instruction_i1(n));case"OnStep":return Tt(this.currentRuntimeFlags)&&this.isInterrupted()?X(Qc(n)):ie(X(n));case ca:return this.patchRuntimeFlags(this.currentRuntimeFlags,r.patch),Tt(this.currentRuntimeFlags)&&this.isInterrupted()?X(Ve(n,this.getInterruptedCause())):X(n);default:Xr(r)}else return mt.currentOp=X(n),pt}[dl](t){return Ie(()=>t.effect_instruction_i0(this,uh(this.currentRuntimeFlags)))}Blocked(t){const n=this.getFiberRefs(),r=this.currentRuntimeFlags;if(this._steps.length>0){const s=[],o=this._steps[this._steps.length-1];let i=this.popStack();for(;i&&i._op!=="OnStep";)s.push(i),i=this.popStack();this.setFiberRefs(o.refs),this.currentRuntimeFlags=o.flags;const a=_x(o.refs,n),c=ls(o.flags,r);return ie(bd(t.effect_instruction_i0,Ke(u=>{for(;s.length>0;)u.pushStack(s.pop());return u.setFiberRefs(Sx(u.id(),u.getFiberRefs())(a)),u.currentRuntimeFlags=fs(c)(u.currentRuntimeFlags),t.effect_instruction_i1})))}return So(s=>C(Jh(D0(t.effect_instruction_i0)),()=>s(t.effect_instruction_i1)))}RunBlocked(t){return XT(t.effect_instruction_i0)}[Or](t){const n=t.effect_instruction_i0,r=this.currentRuntimeFlags,s=fs(r,n);if(Tt(s)&&this.isInterrupted())return X(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,n),t.effect_instruction_i1){const o=ls(s,r);return this.pushStack(new U0(o,t)),Ie(()=>t.effect_instruction_i1(r))}else return Ft}[bs](t){return this.pushStack(t),t.effect_instruction_i0}OnStep(t){return this.pushStack(t),t.effect_instruction_i0}[Ko](t){return this.pushStack(t),t.effect_instruction_i0}[_s](t){return this.pushStack(t),t.effect_instruction_i0}[lr](t){return this._asyncBlockingOn=t.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,t.effect_instruction_i0),mt.currentOp=t,pt}[os](t){return this._isYielding=!1,mt.currentOp=t,pt}[Ss](t){const n=t.effect_instruction_i0,r=t.effect_instruction_i1;return n()?(this.pushStack(t),r()):Ft}[ss](t){return sr[ss](this,t,void 0)}[Qs](t){return Ie(()=>t.commit())}runLoop(t){let n=t;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&HS)!==0&&this.currentSupervisor.onEffect(this,n),this._queue.length>0&&(n=this.drainQueueWhileRunning(this.currentRuntimeFlags,n)),!this._isYielding){this.currentOpCount+=1;const r=this.currentScheduler.shouldYield(this);if(r!==!1){this._isYielding=!0,this.currentOpCount=0;const s=n;n=C(Wa({priority:r}),()=>s)}}try{if(n=this.currentTracer.context(()=>{if(ZT!==n[An]._V){const r=this.getFiberRef(bw);if(r._tag==="Some"){const s=n[An]._V;this.log(`Executing an Effect versioned ${s} with a Runtime of version ${ua()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,Cn,r)}}return this[n._op](n)},this),n===pt){const r=mt.currentOp;return r._op===os||r._op===lr?pt:(mt.currentOp=null,r._op===He||r._op===ze?r:X(at(r)))}}catch(r){n!==pt&&!A(n,"_op")||!(n._op in this)?n=J0(`Not a valid effect: ${yn(n)}`):xw(r)?n=X(Ve(at(r),Ot($n))):n=tu(r)}}}run=()=>{this.drainQueueOnCurrentThread()}}const eO=B("effect/FiberRef/currentMinimumLogLevel",()=>Ae(nx("Info"))),tO=e=>hc(t=>{const n=Bk(t.context,As);gf(n,Yd).unsafe.log(e.log(t))}),nO=B(Symbol.for("effect/Logger/defaultLogger"),()=>tO(xv)),rO=B(Symbol.for("effect/Logger/tracerLogger"),()=>hc(({annotations:e,cause:t,context:n,fiberId:r,logLevel:s,message:o})=>{const i=Cr(wr(n,Dr),Xd);if(i._tag==="None"||i.value._tag==="ExternalSpan")return;const a=yf(wr(n,As),ec),c={};for(const[u,f]of e)c[u]=f;c["effect.fiberId"]=M_(r),c["effect.logLevel"]=s.label,t!==null&&t._tag!=="Empty"&&(c["effect.cause"]=zn(t,{renderErrorCause:!0})),i.value.event(yn(Array.isArray(o)&&o.length===1?o[0]:o),a.unsafeCurrentTimeNanos(),c)})),sO=B(Symbol.for("effect/FiberRef/currentLoggers"),()=>cw(Ma(nO,rO))),oO=d(e=>Em(e[0]),(e,t,n)=>Ke(r=>{const s=n?.batching===!0||n?.batching==="inherit"&&r.getFiberRef(gw);return n?.discard?Ou(n.concurrency,()=>ln(Ai,n?.concurrentFinalizers)(o=>s?Bt(e,(i,a)=>o(t(i,a)),!0,!1,1):bo(e,(i,a)=>o(t(i,a)))),()=>ln(Fi,n?.concurrentFinalizers)(o=>Bt(e,(i,a)=>o(t(i,a)),s,!1)),o=>ln(Pi(o),n?.concurrentFinalizers)(i=>Bt(e,(a,c)=>i(t(a,c)),s,!1,o))):Ou(n?.concurrency,()=>ln(Ai,n?.concurrentFinalizers)(o=>s?ju(e,1,(i,a)=>o(t(i,a)),!0):$t(e,(i,a)=>o(t(i,a)))),()=>ln(Fi,n?.concurrentFinalizers)(o=>iO(e,(i,a)=>o(t(i,a)),s)),o=>ln(Pi(o),n?.concurrentFinalizers)(i=>ju(e,o,(a,c)=>i(t(a,c)),s)))})),iO=(e,t,n)=>ce(()=>{const r=oe(e),s=new Array(r.length);return wo(Bt(r,(i,a)=>C(t(i,a),c=>j(()=>s[a]=c)),n,!1),Q(s))}),Bt=(e,t,n,r,s)=>So(o=>Y0(i=>Ke(a=>{let c=Array.from(e).reverse(),u=c.length;if(u===0)return et;let f=0,h=!1;const p=s?Math.min(c.length,s):c.length,m=new Set,y=new Array,T=()=>m.forEach($=>{$.currentScheduler.scheduleTask(()=>{$.unsafeInterruptAsFork(a.id())},0)}),S=new Array,w=new Array,F=new Array,v=()=>{const $=y.filter(({exit:z})=>z._tag==="Failure").sort((z,H)=>z.index<H.index?-1:z.index===H.index?0:1).map(({exit:z})=>z);return $.length===0&&$.push(Ft),$},O=($,z=!1)=>{const H=Nd(i($)),U=cO(H,a,a.currentRuntimeFlags,dc);return a.currentScheduler.scheduleTask(()=>{z&&U.unsafeInterruptAsFork(a.id()),U.resume(H)},0),U},E=()=>{r||(u-=c.length,c=[]),h=!0,T()},x=n?H0:kd,q=O(Yt($=>{const z=(U,Z)=>{U._op==="Blocked"?F.push(U):(y.push({index:Z,exit:U}),U._op==="Failure"&&!h&&E())},H=()=>{if(c.length>0){const U=c.pop();let Z=f++;const Fe=()=>{const de=c.pop();return Z=f++,C(Wa(),()=>C(x(o(t(de,Z))),je))},je=de=>c.length>0&&(z(de,Z),c.length>0)?Fe():Q(de),dt=C(x(o(t(U,Z))),je),xe=O(dt);S.push(xe),m.add(xe),h&&xe.currentScheduler.scheduleTask(()=>{xe.unsafeInterruptAsFork(a.id())},0),xe.addObserver(de=>{let ht;if(de._op==="Failure"?ht=de:ht=de.effect_instruction_i0,w.push(xe),m.delete(xe),z(ht,Z),y.length===u)$(Q(ye(iu(v(),{parallel:!0}),()=>Ft)));else if(F.length+y.length===u){const Gn=v(),$p=F.map(Yn=>Yn.effect_instruction_i0).reduce(cd);$(Q(bd($p,Bt([ye(iu(Gn,{parallel:!0}),()=>Ft),...F.map(Yn=>Yn.effect_instruction_i1)],Yn=>Yn,n,!0,s))))}else H()})}};for(let U=0;U<p;U++)H()}));return Kr(za(vd(o(kh(q))),Kd({onFailure:$=>{E();const z=F.length+1,H=Math.min(typeof s=="number"?s:F.length,F.length),U=Array.from(F);return Yt(Z=>{let Fe=0,je=0;const dt=(de,ht)=>Gn=>{Fe++,Fe===z&&Z(ie(X($))),U.length>0&&ht&&xe()},xe=()=>{O(U.pop(),!0).addObserver(dt(je,!0)),je++};q.addObserver(dt(je,!1)),je++;for(let de=0;de<H;de++)xe()})},onSuccess:()=>$t(w,$=>$.inheritAll)})))}))),ju=(e,t,n,r)=>ce(()=>{const s=oe(e),o=new Array(s.length);return wo(Bt(s,(a,c)=>Me(n(a,c),u=>o[c]=u),r,!1,t),Q(o))}),Jh=e=>uO(e,dc),aO=(e,t,n,r=null)=>{const s=Vh(e,t,n,r);return s.resume(e),s},cO=(e,t,n,r=null)=>Vh(e,t,n,r),Vh=(e,t,n,r=null)=>{const s=Vf(),o=t.getFiberRefs(),i=Dk(o,s),a=new Bh(s,i,n),c=wr(i,Dr),u=a.currentSupervisor;return u.onStart(c,e,I(t),a),a.addObserver(h=>u.onEnd(h,a)),(r!==null?r:g(t.getFiberRef(Ri),ye(()=>t.scope()))).add(n,a),a},uO=(e,t)=>Ke((n,r)=>Q(aO(e,n,r.runtimeFlags,t))),Mu=e=>Ur(t=>Se(Cr(t,Vr),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return C(vo(n,Fi),r=>gc(e,r))}}})),Au=e=>t=>Ur(n=>Se(Cr(n,Vr),{onNone:()=>t,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===e?t:C(vo(r,Pi(e)),s=>gc(t,s))})),ln=(e,t)=>n=>Ur(r=>Se(Cr(r,Vr),{onNone:()=>n(Y),onSome:s=>{if(t===!0){const o=e._tag==="Parallel"?Mu:e._tag==="Sequential"?Fu:Au(e.parallelism);switch(s.strategy._tag){case"Parallel":return o(n(Mu));case"Sequential":return o(n(Fu));case"ParallelN":return o(n(Au(s.strategy.parallelism)))}}else return n(Y)}})),Fu=e=>Ur(t=>Se(Cr(t,Vr),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return C(vo(n,Ai),r=>gc(e,r))}}})),Vr=sn("effect/Scope"),gc=d(2,(e,t)=>Mw(e,bf(gb(Vr,t)))),lO=e=>Hn(e,{differ:JT,fork:hr}),Pu=lw(YS),fO=lO(Co),dO=(e,t,n)=>xd(r=>C(C(Jh(Td(e)),s=>Yt(o=>{const i=t.map(u=>u.listeners.count),a=()=>{i.every(u=>u===0)&&t.every(u=>u.result.state.current._tag==="Pending"?!0:!!(u.result.state.current._tag==="Done"&&To(u.result.state.current.effect)&&u.result.state.current.effect._tag==="Failure"&&_0(u.result.state.current.effect.cause)))&&(c.forEach(u=>u()),n?.(),o(X0(s)))};s.addObserver(u=>{c.forEach(f=>f()),o(u)});const c=t.map((u,f)=>{const h=p=>{i[f]=p,a()};return u.listeners.addObserver(h),()=>u.listeners.removeObserver(h)});return a(),j(()=>{c.forEach(u=>u())})})),()=>ce(()=>{const s=t.flatMap(o=>o.state.completed?[]:[o]);return bo(s,o=>FT(o.request,Ow(r)))}))),hO=y0,pO=zn,mO=Sw,gO=vo,zr=e=>function(){if(arguments.length===1){const t=arguments[0];return(n,...r)=>e(t,n,...r)}return e.apply(this,arguments)},yc=zr((e,t,n)=>{const r=Vf(),s=[[Dr,[[r,e.context]]]];n?.scheduler&&s.push([Sh,[[r,n.scheduler]]]);let o=Jk(e.fiberRefs,{entries:s,forkAs:r});n?.updateRefs&&(o=n.updateRefs(o,r));const i=new Bh(r,o,e.runtimeFlags);let a=t;n?.scope&&(a=C(gO(n.scope,ch),u=>wo(_w(u,xd(f=>K(f,i.id())?et:Id(i,f))),za(t,f=>mO(u,f)))));const c=i.currentSupervisor;return c!==Co&&(c.onStart(e.context,a,N(),i),i.addObserver(u=>c.onEnd(u,i))),dc.add(e.runtimeFlags,i),n?.immediate===!1?i.resume(a):i.start(a),i}),yO=zr((e,t)=>{const n=wO(e)(t);if(n._tag==="Failure")throw zh(n.effect_instruction_i0);return n.effect_instruction_i0});class bO extends Error{fiber;_tag="AsyncFiberException";constructor(t){super(`Fiber #${t.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`),this.fiber=t,this.name=this._tag,this.stack=this.message}}const _O=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new bO(e);return Error.stackTraceLimit=t,n},Qo=Symbol.for("effect/Runtime/FiberFailure"),Zr=Symbol.for("effect/Runtime/FiberFailure/Cause");class SO extends Error{[Qo];[Zr];constructor(t){const n=gd(t)[0];super(n?.message||"An error has occurred"),this[Qo]=Qo,this[Zr]=t,this.name=n?`(FiberFailure) ${n.name}`:"FiberFailure",n?.stack&&(this.stack=n.stack)}toJSON(){return{_id:"FiberFailure",cause:this[Zr].toJSON()}}toString(){return"(FiberFailure) "+zn(this[Zr],{renderErrorCause:!0})}[ee](){return this.toString()}}const zh=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new SO(e);return Error.stackTraceLimit=t,n},Hh=e=>{const t=e;switch(t._op){case"Failure":case"Success":return t;case"Left":return au(t.left);case"Right":return ie(t.right);case"Some":return ie(t.value);case"None":return au(new Pd)}},wO=zr((e,t)=>{const n=Hh(t);if(n)return n;const r=new _h,s=yc(e)(t,{scheduler:r});r.flush();const o=s.unsafePoll();return o||Tw(qa(_O(s),Xa(s)))}),kO=zr((e,t,n)=>xO(e,t,n).then(r=>{switch(r._tag){case He:return r.effect_instruction_i0;case ze:throw zh(r.effect_instruction_i0)}})),xO=zr((e,t,n)=>new Promise(r=>{const s=Hh(t);s&&r(s);const o=yc(e)(t);o.addObserver(i=>{r(i)}),n?.signal!==void 0&&(n.signal.aborted?o.unsafeInterruptAsFork(o.id()):n.signal.addEventListener("abort",()=>{o.unsafeInterruptAsFork(o.id())},{once:!0}))}));class vO{context;runtimeFlags;fiberRefs;constructor(t,n,r){this.context=t,this.runtimeFlags=n,this.fiberRefs=r}pipe(){return R(this,arguments)}}const TO=e=>new vO(e.context,e.runtimeFlags,e.fiberRefs),OO=id(Bn,sd,rd),bc=TO({context:va(),runtimeFlags:OO,fiberRefs:Vk()}),NO=yc(bc),$O=kO(bc),EO=yO(bc),IO=(function(){const e=Symbol.for("effect/Data/Error/plainArgs");return{BaseEffectError:class extends Qa{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0),n&&(Object.assign(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError})(),RO=e=>{const t={BaseEffectError:class extends IO{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},CO=yo,ps=oO,jO=Q,es=ce,Ue=et,MO=Ei,AO=hx,Gi=Me,FO=Va,PO=_o,Mt=js,nt=C,LO=NO,KO=$O,Wh=EO;class ve{path;actual;issue;_tag="Pointer";constructor(t,n,r){this.path=t,this.actual=n,this.issue=r}}class Lu{actual;message;_tag="Unexpected";constructor(t,n){this.actual=t,this.message=n}}class or{ast;message;_tag="Missing";actual=void 0;constructor(t,n){this.ast=t,this.message=n}}class re{ast;actual;issues;output;_tag="Composite";constructor(t,n,r,s){this.ast=t,this.actual=n,this.issues=r,this.output=s}}class Xo{ast;actual;kind;issue;_tag="Refinement";constructor(t,n,r,s){this.ast=t,this.actual=n,this.kind=r,this.issue=s}}class Zo{ast;actual;kind;issue;_tag="Transformation";constructor(t,n,r,s){this.ast=t,this.actual=n,this.kind=r,this.issue=s}}class Nt{ast;actual;message;_tag="Type";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}class Ku{ast;actual;message;_tag="Forbidden";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}const Du=Symbol.for("effect/Schema/ParseErrorTypeId");class DO extends RO("ParseError"){[Du]=Du;get message(){return this.toString()}toString(){return ms.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[ee](){return this.toJSON()}}const UO=e=>new DO({issue:e}),Gh=V,Yh=P,$e=dg,Et=d(2,(e,t)=>$e(e)?pa(e,{onLeft:P,onRight:t}):nt(e,t)),rt=d(2,(e,t)=>$e(e)?mg(e,t):Gi(e,t)),ei=d(2,(e,t)=>$e(e)?pg(e,t):PO(e,t)),qO=d(2,(e,t)=>$e(e)?hg(e,{onLeft:t.onFailure,onRight:t.onSuccess}):FO(e,t)),Qh=d(2,(e,t)=>$e(e)?pa(e,{onLeft:t,onRight:V}):MO(e,t)),_c=(e,t)=>t===void 0||Jt(t)?e:e===void 0?t:{...e,...t},BO=(e,t,n)=>{const r=_e(e,t);return(s,o)=>r(s,_c(n,o))},Xh=(e,t,n)=>{const r=BO(e,t,n);return(s,o)=>wl(r(s,o),UO)},Zh=(e,t,n)=>{const r=_e(e,t);return(s,o)=>r(s,{..._c(n,o),isEffectAllowed:!0})},ep=(e,t)=>Xh(e.ast,!0,t),JO=(e,t)=>Zh(e.ast,!0,t),VO=(e,t)=>Zh(e.ast,!1,t),zO=(e,t)=>Xh(pe(e.ast),!0,t),HO=B(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),WO=B(Symbol.for("effect/ParseResult/encodeMemoMap"),()=>new WeakMap),_e=(e,t)=>{const n=t?HO:WO,r=n.get(e);if(r)return r;const s=GO(e,t),o=my(e),i=we(o)?(u,f)=>s(u,_c(f,o.value)):s,a=gy(e),c=t&&we(a)?(u,f)=>ur(Qh(i(u,f),a.value),e,u,f):i;return n.set(e,c),c},ti=e=>st(dy(e)),ni=e=>st(hy(e)),GO=(e,t)=>{switch(e._tag){case"Refinement":if(t){const n=_e(e.from,!0);return(r,s)=>{s=s??Uo;const o=s?.errors==="all",i=Et(Qh(n(r,s),a=>{const c=new Xo(e,r,"From",a);return o&&by(e)&&sp(a)?Se(e.filter(r,s,e),{onNone:()=>P(c),onSome:u=>P(new re(e,r,[c,new Xo(e,r,"Predicate",u)]))}):P(c)}),a=>Se(e.filter(a,s,e),{onNone:()=>V(a),onSome:c=>P(new Xo(e,r,"Predicate",c))}));return ur(i,e,r,s)}}else{const n=_e(pe(e),!0),r=_e(tp(e.from),!1);return(s,o)=>ur(Et(n(s,o),i=>r(i,o)),e,s,o)}case"Transformation":{const n=XO(e.transformation,t),r=t?_e(e.from,!0):_e(e.to,!1),s=t?_e(e.to,!0):_e(e.from,!1);return(o,i)=>ur(Et(ei(r(o,i),a=>new Zo(e,o,t?"Encoded":"Type",a)),a=>Et(ei(n(a,i??Uo,e,o),c=>new Zo(e,o,"Transformation",c)),c=>ei(s(c,i),u=>new Zo(e,o,t?"Type":"Encoded",u)))),e,o,i)}case"Declaration":{const n=t?e.decodeUnknown(...e.typeParameters):e.encodeUnknown(...e.typeParameters);return(r,s)=>ur(n(r,s??Uo,e),e,r,s)}case"Literal":return Pe(e,n=>n===e.literal);case"UniqueSymbol":return Pe(e,n=>n===e.symbol);case"UndefinedKeyword":return Pe(e,vm);case"NeverKeyword":return Pe(e,Om);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return V;case"StringKeyword":return Pe(e,ut);case"NumberKeyword":return Pe(e,Jt);case"BooleanKeyword":return Pe(e,na);case"BigIntKeyword":return Pe(e,Ws);case"SymbolKeyword":return Pe(e,ci);case"ObjectKeyword":return Pe(e,wt);case"Enums":return Pe(e,n=>e.enums.some(([r,s])=>s===n));case"TemplateLiteral":{const n=Yy(e);return Pe(e,r=>ut(r)&&n.test(r))}case"TupleType":{const n=e.elements.map(u=>_e(u.type,t)),r=e.rest.map(u=>_e(u.type,t));let s=e.elements.filter(u=>!u.isOptional);e.rest.length>0&&(s=s.concat(e.rest.slice(1)));const o=s.length,i=e.elements.length>0?e.elements.map((u,f)=>f).join(" | "):"never",a=ti(e),c=ni(e);return(u,f)=>{if(!Fg(u))return P(new Nt(e,u));const h=f?.errors==="all",p=[];let m=0;const y=[],T=u.length;for(let v=T;v<=o-1;v++){const O=new ve(v,u,new or(s[v-T]));if(h){p.push([m++,O]);continue}else return P(new re(e,u,O,y))}if(e.rest.length===0)for(let v=e.elements.length;v<=T-1;v++){const O=new ve(v,u,new Lu(u[v],`is unexpected, expected: ${i}`));if(h){p.push([m++,O]);continue}else return P(new re(e,u,O,y))}let S=0,w;for(;S<n.length;S++)if(T<S+1){if(e.elements[S].isOptional)continue}else{const v=n[S],O=v(u[S],f);if($e(O)){if(he(O)){const E=new ve(S,u,O.left);if(h){p.push([m++,E]);continue}else return P(new re(e,u,E,We(y)))}y.push([m++,O.right])}else{const E=m++,x=S;w||(w=[]),w.push(({es:q,output:$})=>nt(Mt(O),z=>{if(he(z)){const H=new ve(x,u,z.left);return h?(q.push([E,H]),Ue):P(new re(e,u,H,We($)))}return $.push([E,z.right]),Ue}))}}if(be(r)){const[v,...O]=r;for(;S<T-O.length;S++){const E=v(u[S],f);if($e(E))if(he(E)){const x=new ve(S,u,E.left);if(h){p.push([m++,x]);continue}else return P(new re(e,u,x,We(y)))}else y.push([m++,E.right]);else{const x=m++,q=S;w||(w=[]),w.push(({es:$,output:z})=>nt(Mt(E),H=>{if(he(H)){const U=new ve(q,u,H.left);return h?($.push([x,U]),Ue):P(new re(e,u,U,We(z)))}else return z.push([x,H.right]),Ue}))}}for(let E=0;E<O.length;E++)if(S+=E,!(T<S+1)){const x=O[E](u[S],f);if($e(x)){if(he(x)){const q=new ve(S,u,x.left);if(h){p.push([m++,q]);continue}else return P(new re(e,u,q,We(y)))}y.push([m++,x.right])}else{const q=m++,$=S;w||(w=[]),w.push(({es:z,output:H})=>nt(Mt(x),U=>{if(he(U)){const Z=new ve($,u,U.left);return h?(z.push([q,Z]),Ue):P(new re(e,u,Z,We(H)))}return H.push([q,U.right]),Ue}))}}}const F=({es:v,output:O})=>is(v)?P(new re(e,u,We(v),We(O))):V(We(O));if(w&&w.length>0){const v=w;return es(()=>{const O={es:ar(p),output:ar(y)};return nt(ps(v,E=>E(O),{concurrency:a,batching:c,discard:!0}),()=>F(O))})}return F({output:y,es:p})}}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Pe(e,Nm);const n=[],r={},s=[];for(const f of e.propertySignatures)n.push([_e(f.type,t),f]),r[f.name]=null,s.push(f.name);const o=e.indexSignatures.map(f=>[_e(f.parameter,t),_e(f.type,t),f.parameter]),i=ot.make(e.indexSignatures.map(f=>f.parameter).concat(s.map(f=>ci(f)?new ky(f):new vs(f)))),a=_e(i,t),c=ti(e),u=ni(e);return(f,h)=>{if(!Im(f))return P(new Nt(e,f));const p=h?.errors==="all",m=[];let y=0;const T=h?.onExcessProperty==="error",S=h?.onExcessProperty==="preserve",w={};let F;if(T||S){F=Reflect.ownKeys(f);for(const x of F){const q=a(x,h);if($e(q)&&he(q))if(T){const $=new ve(x,f,new Lu(f[x],`is unexpected, expected: ${String(i)}`));if(p){m.push([y++,$]);continue}else return P(new re(e,f,$,w))}else w[x]=f[x]}}let v;const O=h?.exact===!0;for(let x=0;x<n.length;x++){const q=n[x][1],$=q.name,z=Object.prototype.hasOwnProperty.call(f,$);if(!z){if(q.isOptional)continue;if(O){const Z=new ve($,f,new or(q));if(p){m.push([y++,Z]);continue}else return P(new re(e,f,Z,w))}}const H=n[x][0],U=H(f[$],h);if($e(U)){if(he(U)){const Z=new ve($,f,z?U.left:new or(q));if(p){m.push([y++,Z]);continue}else return P(new re(e,f,Z,w))}w[$]=U.right}else{const Z=y++,Fe=$;v||(v=[]),v.push(({es:je,output:dt})=>nt(Mt(U),xe=>{if(he(xe)){const de=new ve(Fe,f,z?xe.left:new or(q));return p?(je.push([Z,de]),Ue):P(new re(e,f,de,dt))}return dt[Fe]=xe.right,Ue}))}}for(let x=0;x<o.length;x++){const q=o[x],$=q[0],z=q[1],H=Cl(f,q[2]);for(const U of H){const Z=$(U,h);if($e(Z)&&gt(Z)){const Fe=z(f[U],h);if($e(Fe))if(he(Fe)){const je=new ve(U,f,Fe.left);if(p){m.push([y++,je]);continue}else return P(new re(e,f,je,w))}else Object.prototype.hasOwnProperty.call(r,U)||(w[U]=Fe.right);else{const je=y++,dt=U;v||(v=[]),v.push(({es:xe,output:de})=>nt(Mt(Fe),ht=>{if(he(ht)){const Gn=new ve(dt,f,ht.left);return p?(xe.push([je,Gn]),Ue):P(new re(e,f,Gn,de))}else return Object.prototype.hasOwnProperty.call(r,U)||(de[U]=ht.right),Ue}))}}}}const E=({es:x,output:q})=>{if(is(x))return P(new re(e,f,We(x),q));if(h?.propertyOrder==="original"){const $=F||Reflect.ownKeys(f);for(const H of s)$.indexOf(H)===-1&&$.push(H);const z={};for(const H of $)Object.prototype.hasOwnProperty.call(q,H)&&(z[H]=q[H]);return V(z)}return V(q)};if(v&&v.length>0){const x=v;return es(()=>{const q={es:ar(m),output:Object.assign({},w)};return nt(ps(x,$=>$(q),{concurrency:c,batching:u,discard:!0}),()=>E(q))})}return E({es:m,output:w})}}case"Union":{const n=YO(e.types,t),r=Reflect.ownKeys(n.keys),s=r.length,o=e.types.length,i=new Map;for(let u=0;u<o;u++)i.set(e.types[u],_e(e.types[u],t));const a=ti(e)??1,c=ni(e);return(u,f)=>{const h=[];let p=0,m=[];if(s>0)if(ra(u))for(let S=0;S<s;S++){const w=r[S],F=n.keys[w].buckets;if(Object.prototype.hasOwnProperty.call(u,w)){const v=String(u[w]);if(Object.prototype.hasOwnProperty.call(F,v))m=m.concat(F[v]);else{const{candidates:O,literals:E}=n.keys[w],x=ot.make(E),q=O.length===o?new Dt([new Te(w,x,!1,!0)],[]):ot.make(O);h.push([p++,new re(q,u,new ve(w,u,new Nt(x,u[w])))])}}else{const{candidates:v,literals:O}=n.keys[w],E=new Te(w,ot.make(O),!1,!0),x=v.length===o?new Dt([E],[]):ot.make(v);h.push([p++,new re(x,u,new ve(w,u,new or(E)))])}}else{const S=n.candidates.length===o?e:ot.make(n.candidates);h.push([p++,new Nt(S,u)])}n.otherwise.length>0&&(m=m.concat(n.otherwise));let y;for(let S=0;S<m.length;S++){const w=m[S],F=i.get(w)(u,f);if($e(F)&&(!y||y.length===0)){if(gt(F))return F;h.push([p++,F.left])}else{const v=p++;y||(y=[]),y.push(O=>es(()=>"finalResult"in O?Ue:nt(Mt(F),E=>(gt(E)?O.finalResult=E:O.es.push([v,E.left]),Ue))))}}const T=S=>is(S)?S.length===1&&S[0][1]._tag==="Type"?P(S[0][1]):P(new re(e,u,We(S))):P(new Nt(e,u));if(y&&y.length>0){const S=y;return es(()=>{const w={es:ar(h)};return nt(ps(S,F=>F(w),{concurrency:a,batching:c,discard:!0}),()=>"finalResult"in w?w.finalResult:T(w.es))})}return T(h)}}case"Suspend":{const n=jl(()=>_e(e.f(),t));return(r,s)=>n()(r,s)}}},Pe=(e,t)=>n=>t(n)?V(n):P(new Nt(e,n)),cr=(e,t)=>{switch(e._tag){case"Declaration":{const n=Ql(e);if(we(n))return cr(n.value,t);break}case"TypeLiteral":{const n=[];for(let r=0;r<e.propertySignatures.length;r++){const s=e.propertySignatures[r],o=t?Pc(s.type):pe(s.type);Mc(o)&&!s.isOptional&&n.push([s.name,o])}return n}case"TupleType":{const n=[];for(let r=0;r<e.elements.length;r++){const s=e.elements[r],o=t?Pc(s.type):pe(s.type);Mc(o)&&!s.isOptional&&n.push([r,o])}return n}case"Refinement":return cr(e.from,t);case"Suspend":return cr(e.f(),t);case"Transformation":return cr(t?e.from:e.to,t)}return[]},YO=(e,t)=>{const n={},r=[],s=[];for(let o=0;o<e.length;o++){const i=e[o],a=cr(i,t);if(a.length>0){s.push(i);for(let c=0;c<a.length;c++){const[u,f]=a[c],h=String(f.literal);n[u]=n[u]||{buckets:{},literals:[],candidates:[]};const p=n[u].buckets;if(Object.prototype.hasOwnProperty.call(p,h)){if(c<a.length-1)continue;p[h].push(i),n[u].literals.push(f),n[u].candidates.push(i)}else{p[h]=[i],n[u].literals.push(f),n[u].candidates.push(i);break}}}else r.push(i)}return{keys:n,otherwise:r,candidates:s}},tp=e=>wa(e)?tp(e.from):e,ur=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||$e(e))return e;const s=new _h,o=LO(e,{scheduler:s});s.flush();const i=o.unsafePoll();if(i){if(Aw(i))return V(i.value);const a=i.cause;return hO(a)?P(a.error):P(new Ku(t,n,pO(a)))}return P(new Ku(t,n,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))},QO=([e],[t])=>e>t?1:e<t?-1:0;function We(e){return e.sort(QO).map(t=>t[1])}const XO=(e,t)=>{switch(e._tag){case"FinalTransformation":return t?e.decode:e.encode;case"ComposeTransformation":return V;case"TypeLiteralTransformation":return n=>{let r=V(n);for(const s of e.propertySignatureTransformations){const[o,i]=t?[s.from,s.to]:[s.to,s.from],a=t?s.decode:s.encode;r=rt(r,u=>{const f=a(Object.prototype.hasOwnProperty.call(u,o)?I(u[o]):N());return delete u[o],we(f)&&(u[i]=f.value),u})}return r}}},Ne=(e,t=[])=>({value:e,forest:t}),ms={formatIssue:e=>rt(fn(e),ZO),formatIssueSync:e=>{const t=ms.formatIssue(e);return $e(t)?yg(t):Wh(t)},formatError:e=>ms.formatIssue(e.issue),formatErrorSync:e=>ms.formatIssueSync(e.issue)},ZO=e=>e.value+np(`
25
- `,e.forest),np=(e,t)=>{let n="";const r=t.length;let s;for(let o=0;o<r;o++){s=t[o];const i=o===r-1;n+=e+(i?"└":"├")+"─ "+s.value,n+=np(e+(r>1&&!i?"│ ":" "),s.forest)}return n},e1=e=>{switch(e){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},t1=e=>{switch(e){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},rp=e=>"ast"in e?I(e.ast):N(),Yi=V(void 0),n1=e=>rp(e).pipe(Dn(ly),Se({onNone:()=>Yi,onSome:t=>{const n=t(e);return ut(n)?V({message:n,override:!1}):CO(n)?Gi(n,r=>({message:r,override:!1})):ut(n.message)?V({message:n.message,override:n.override}):Gi(n.message,r=>({message:r,override:n.override}))}})),Sc=e=>t=>t._tag===e,sp=Sc("Composite"),Uu=Sc("Refinement"),qu=Sc("Transformation"),pr=e=>Et(n1(e),t=>t!==void 0?!t.override&&(sp(e)||Uu(e)&&e.kind==="From"||qu(e)&&e.kind!=="Transformation")?qu(e)||Uu(e)?pr(e.issue):Yi:V(t.message):Yi),op=e=>rp(e).pipe(Dn(py),vg(t=>t(e)),st);function r1(e){return Yl(e).pipe(yt(()=>Wl(e)),yt(()=>Gl(e)),yt(()=>eo(e)),ye(()=>`{ ${e.from} | filter }`))}function s1(e){return e.message!==void 0?e.message:`Expected ${wa(e.ast)?r1(e.ast):String(e.ast)}, actual ${Zt(e.actual)}`}const o1=e=>rt(pr(e),t=>t??op(e)??s1(e)),ts=e=>op(e)??String(e.ast),i1=e=>e.message??"is forbidden",a1=e=>e.message??"is unexpected",c1=e=>{const t=fy(e.ast);if(we(t)){const n=t.value();return ut(n)?V(n):n}return V(e.message??"is missing")},fn=e=>{switch(e._tag){case"Type":return rt(o1(e),Ne);case"Forbidden":return V(Ne(ts(e),[Ne(i1(e))]));case"Unexpected":return V(Ne(a1(e)));case"Missing":return rt(c1(e),Ne);case"Transformation":return Et(pr(e),t=>t!==void 0?V(Ne(t)):rt(fn(e.issue),n=>Ne(ts(e),[Ne(e1(e.kind),[n])])));case"Refinement":return Et(pr(e),t=>t!==void 0?V(Ne(t)):rt(fn(e.issue),n=>Ne(ts(e),[Ne(t1(e.kind),[n])])));case"Pointer":return rt(fn(e.issue),t=>Ne(Xg(e.path),[t]));case"Composite":return Et(pr(e),t=>{if(t!==void 0)return V(Ne(t));const n=ts(e);return Ml(e.issues)?rt(ps(e.issues,fn),r=>Ne(n,r)):rt(fn(e.issues),r=>Ne(n,[r]))})}},u1=d(e=>wt(e[0]),(e,...t)=>{const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}),l1=d(e=>wt(e[0]),(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n}),kr=Symbol.for("effect/Schema");function Oe(e){return class{[kr]=Bu;static ast=e;static annotations(n){return Oe(an(this.ast,n))}static pipe(){return R(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[kr]=Bu}}const Bu={_A:e=>e,_I:e=>e,_R:e=>e},Ju={typeConstructor:sy,schemaId:iy,message:Al,missingMessage:ya,identifier:ba,title:kt,description:Ir,examples:Fl,default:Pl,documentation:ay,jsonSchema:Ll,arbitrary:Kl,pretty:Dl,equivalence:Ul,concurrency:ql,batching:Bl,parseIssueTitle:Jl,parseOptions:Vl,decodingFallback:zl},Hr=e=>{if(!e)return{};const t={...e};for(const n in Ju)if(n in e){const r=Ju[n];t[r]=e[n],delete t[n]}return t},an=(e,t)=>ka(e,Hr(t)),xt=e=>Oe(pe(e.ast)),Qi=e=>A(e,kr)&&wt(e[kr]);function f1(e){return Sa(e)?ot.make(qy(e,t=>new vs(t))):new vs(e[0])}function ip(e,t=f1(e)){return class extends Oe(t){static annotations(r){return ip(this.literals,an(this.ast,r))}static literals=[...e]}}function De(...e){return be(e)?ip(e):up}const d1=(e,t,n)=>wc(e,new to(e.map(r=>r.ast),(...r)=>t.decode(...r.map(Oe)),(...r)=>t.encode(...r.map(Oe)),Hr(n))),h1=(e,t)=>{const n=()=>(s,o,i)=>e(s)?Gh(s):Yh(new Nt(i,s)),r=n;return wc([],new to([],n,r,Hr(t)))};function wc(e,t){return class extends Oe(t){static annotations(r){return wc(this.typeParameters,an(this.ast,r))}static typeParameters=[...e]}}const p1=function(){if(Array.isArray(arguments[0])){const n=arguments[0],r=arguments[1],s=arguments[2];return d1(n,r,s)}const e=arguments[0],t=arguments[1];return h1(e,t)};class ap extends Oe(vy){}class cp extends Oe(wy){}class up extends Oe(Zl){}class lp extends Oe(ef){}class b extends Oe(Iy){}class ct extends Oe(jy){}class Ln extends Oe(Ay){}const m1=e=>ot.make(e.map(t=>t.ast));function fp(e,t=m1(e)){return class extends Oe(t){static annotations(r){return fp(this.members,an(this.ast,r))}static members=[...e]}}function kc(...e){return Sa(e)?fp(e):be(e)?e[0]:up}const M=e=>kc(e,cp),ns=e=>kc(e,ap),ri=e=>kc(e,cp,ap),g1=(e,t)=>new _a(e.map(n=>Qi(n)?new nn(n.ast,!1):n.ast),t.map(n=>Qi(n)?new no(n.ast):n.ast),!0);function dp(e,t,n=g1(e,t)){return class extends Oe(n){static annotations(s){return dp(this.elements,this.rest,an(this.ast,s))}static elements=[...e];static rest=[...t]}}function hp(e,t){return class extends dp([],[e],t){static annotations(r){return hp(this.value,an(this.ast,r))}static value=e}}const G=e=>hp(e),Xi=e=>e?'"?:"':'":"';class qs extends nn{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(t,n,r,s,o){super(t,n,s),this.isReadonly=r,this.defaultValue=o}toString(){const t=Xi(this.isOptional),n=String(this.type);return`PropertySignature<${t}, ${n}, never, ${t}, ${n}>`}}class pp extends nn{isReadonly;fromKey;constructor(t,n,r,s,o){super(t,n,s),this.isReadonly=r,this.fromKey=o}}class jo extends nn{isReadonly;defaultValue;constructor(t,n,r,s,o){super(t,n,s),this.isReadonly=r,this.defaultValue=o}}const y1=e=>e===void 0?"never":ut(e)?JSON.stringify(e):String(e);class Mo{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(t,n,r,s){this.from=t,this.to=n,this.decode=r,this.encode=s}toString(){return`PropertySignature<${Xi(this.to.isOptional)}, ${this.to.type}, ${y1(this.from.fromKey)}, ${Xi(this.from.isOptional)}, ${this.from.type}>`}}const mp=(e,t)=>{switch(e._tag){case"PropertySignatureDeclaration":return new qs(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case"PropertySignatureTransformation":return new Mo(e.from,new jo(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},gp=Symbol.for("effect/PropertySignature"),yp=e=>A(e,gp);class Ao{ast;[kr];[gp]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(t){this.ast=t}pipe(){return R(this,arguments)}annotations(t){return new Ao(mp(this.ast,Hr(t)))}toString(){return String(this.ast)}}const Bs=e=>new Ao(e);class xc extends Ao{from;constructor(t,n){super(t),this.from=n}annotations(t){return new xc(mp(this.ast,Hr(t)),this.from)}}const rs=d(2,(e,t)=>{const n=e.ast;switch(n._tag){case"PropertySignatureDeclaration":return Bs(new qs(n.type,n.isOptional,n.isReadonly,n.annotations,t));case"PropertySignatureTransformation":return Bs(new Mo(n.from,new jo(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),vt=(e,t,n)=>Bs(new Mo(new pp(e.ast,!0,!0,{},void 0),new jo(t.ast,!1,!0,{},void 0),r=>I(n.decode(r)),Dn(n.encode))),Vu=(e,t,n)=>Bs(new Mo(new pp(e.ast,!0,!0,{},void 0),new jo(t.ast,!0,!0,{},void 0),n.decode,n.encode)),b1=(e,t)=>{const n=t?.exact,r=t?.default,s=t?.nullable,o=t?.as=="Option",i=t?.onNoneEncoding?yt(t.onNoneEncoding):Y;if(n){if(r)return s?rs(vt(M(e),xt(e),{decode:Se({onNone:r,onSome:a=>a===null?r():a}),encode:I}),r).ast:rs(vt(e,xt(e),{decode:Se({onNone:r,onSome:Y}),encode:I}),r).ast;if(o){const a=Hu(xt(e));return s?vt(M(e),a,{decode:Xn(Fo),encode:i}).ast:vt(e,a,{decode:Y,encode:Y}).ast}else return s?Vu(M(e),xt(e),{decode:Xn(Fo),encode:Y}).ast:new qs(e.ast,!0,!0,{},void 0)}else{if(r)return s?rs(vt(ri(e),xt(e),{decode:Se({onNone:r,onSome:a=>a??r()}),encode:I}),r).ast:rs(vt(ns(e),xt(e),{decode:Se({onNone:r,onSome:a=>a===void 0?r():a}),encode:I}),r).ast;if(o){const a=Hu(xt(e));return s?vt(ri(e),a,{decode:Xn(c=>c!=null),encode:i}).ast:vt(ns(e),a,{decode:Xn(Tm),encode:i}).ast}else return s?Vu(ri(e),ns(xt(e)),{decode:Xn(Fo),encode:Y}).ast:new qs(ns(e).ast,!0,!0,{},void 0)}},_=d(e=>Qi(e[0]),(e,t)=>new xc(b1(e,t),e)),_1=uf([ya]),S1=(e,t)=>{const n=Reflect.ownKeys(e),r=[];if(n.length>0){const o=[],i=[],a=[];for(let c=0;c<n.length;c++){const u=n[c],f=e[u];if(yp(f)){const h=f.ast;switch(h._tag){case"PropertySignatureDeclaration":{const p=h.type,m=h.isOptional,y=h.annotations;o.push(new Te(u,p,m,!0,_1(h))),i.push(new Te(u,pe(p),m,!0,y)),r.push(new Te(u,p,m,!0,y));break}case"PropertySignatureTransformation":{const p=h.from.fromKey??u;o.push(new Te(p,h.from.type,h.from.isOptional,!0,h.from.annotations)),i.push(new Te(u,h.to.type,h.to.isOptional,!0,h.to.annotations)),a.push(new Vy(p,u,h.decode,h.encode));break}}}else o.push(new Te(u,f.ast,!1,!0)),i.push(new Te(u,pe(f.ast),!1,!0)),r.push(new Te(u,f.ast,!1,!0))}if(be(a)){const c=[],u=[];for(const f of t){const{indexSignatures:h,propertySignatures:p}=Fc(f.key.ast,f.value.ast);p.forEach(m=>{o.push(m),i.push(new Te(m.name,pe(m.type),m.isOptional,m.isReadonly,m.annotations))}),h.forEach(m=>{c.push(m),u.push(new ro(m.parameter,pe(m.type),m.isReadonly))})}return new Jy(new Dt(o,c,{[li]:"Struct (Encoded side)"}),new Dt(i,u,{[li]:"Struct (Type side)"}),new zy(a))}}const s=[];for(const o of t){const{indexSignatures:i,propertySignatures:a}=Fc(o.key.ast,o.value.ast);a.forEach(c=>r.push(c)),i.forEach(c=>s.push(c))}return new Dt(r,s)},w1=(e,t)=>{const n=Reflect.ownKeys(e);for(const r of n){const s=e[r];if(t[r]===void 0&&yp(s)){const o=s.ast,i=o._tag==="PropertySignatureDeclaration"?o.defaultValue:o.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function bp(e,t,n=S1(e,t)){return class extends Oe(n){static annotations(s){return bp(this.fields,this.records,an(this.ast,s))}static fields={...e};static records=[...t];static make=(s,o)=>{const i=w1(e,{...s});return O1(o)?i:zO(this)(i)};static pick(...s){return W(u1(e,...s))}static omit(...s){return W(l1(e,...s))}}}function W(e,...t){return bp(e,t)}const k1=(e,t,n,r)=>qO(e,{onFailure:s=>new re(n,r,s),onSuccess:t}),x1=e=>e._tag==="None"?N():I(e.value),v1=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant("None")}),n.record({_tag:n.constant("Some"),value:e(n)})).map(x1),T1=e=>Se({onNone:()=>"none()",onSome:t=>`some(${e(t)})`}),zu=e=>(t,n,r)=>wg(t)?te(t)?Gh(N()):k1(e(t.value,n),I,r,t):Yh(new Nt(r,t)),Hu=e=>p1([e],{decode:t=>zu(JO(t)),encode:t=>zu(VO(t))},{typeConstructor:{_tag:"effect/Option"},pretty:T1,arbitrary:v1,equivalence:Og});function O1(e){return na(e)?e:e?.disableValidation??!1}const N1="/data/todos.json",$1="https://raggle.co/schemas/tasks.json",E1=De("task","bug","feature","chore","spike","epic","milestone"),I1=De("todo","in_progress","blocked","review","done","canceled"),R1=De("completed","duplicate","wont_do","not_reproducible","moved"),C1=De("blocks","blocked_by","related_to","duplicates","duplicated_by","parent_of","child_of"),_p=De("github","linear","jira","web"),j1=De("issue","pull_request","commit","repository","project","document","design","discussion","external"),M1=De("references","implemented_by","fixes","reported_by","spec","design","review","deployment","blocked_by"),A1=W({id:b,title:b}),F1=W({id:b,text:b,done:Ln}),P1=W({id:b,text:b,done:_(Ln,{default:()=>!1})}),L1=W({points:_(M(ct),{default:()=>null}),minutes:_(M(ct),{default:()=>null}),confidence:_(M(De("low","medium","high")),{default:()=>null})}),K1=W({type:C1,targetTaskId:b,description:_(M(b),{default:()=>null})}),D1=W({state:_(M(b),{default:()=>null}),draft:_(M(Ln),{default:()=>null}),checks:_(M(b),{default:()=>null}),updatedAt:_(M(b),{default:()=>null})}),U1=W({mode:_(De("manual","read","write"),{default:()=>"manual"}),checkedAt:_(M(b),{default:()=>null})}),q1=W({id:b,provider:_p,kind:j1,relation:M1,url:b,repository:_(M(b),{default:()=>null}),number:_(M(ct),{default:()=>null}),title:_(M(b),{default:()=>null}),snapshot:_(M(D1),{default:()=>null}),sync:_(M(U1),{default:()=>null})}),B1=W({id:b,authorId:_(M(b),{default:()=>null}),body:b,createdAt:b}),J1=W({id:b,title:b,outcome:b,decidedAt:_(M(b),{default:()=>null})}),V1=W({id:b,value:lp}),z1=W({id:b,title:b,total:ct,open:ct}),H1=W({id:_(b,{default:()=>""}),key:_(b,{default:()=>""}),index:_(ct,{default:()=>0}),rank:_(b,{default:()=>""}),name:b,description:_(M(b),{default:()=>""}),type:_(E1,{default:()=>"task"}),status:_(I1,{default:()=>"todo"}),resolution:_(M(R1),{default:()=>null}),done:_(Ln,{default:()=>!1}),priority:_(M(ct),{default:()=>5}),deadline:_(M(b),{default:()=>null}),overdue:_(Ln,{default:()=>!1}),reporterId:_(M(b),{default:()=>null}),assigneeIds:_(G(b),{default:()=>[]}),estimate:_(M(L1),{default:()=>null}),projectIds:_(G(b),{default:()=>[]}),cycleId:_(M(b),{default:()=>null}),milestoneIds:_(G(b),{default:()=>[]}),componentIds:_(G(b),{default:()=>[]}),areaIds:_(G(b),{default:()=>[]}),parentId:_(M(b),{default:()=>null}),relations:_(G(K1),{default:()=>[]}),links:_(G(q1),{default:()=>[]}),notes:_(G(b),{default:()=>[]}),acceptanceCriteria:_(G(P1),{default:()=>[]}),steps:_(G(F1),{default:()=>[]}),comments:_(G(B1),{default:()=>[]}),decisions:_(G(J1),{default:()=>[]}),createdAt:_(M(b),{default:()=>null}),updatedAt:_(M(b),{default:()=>null}),startedAt:_(M(b),{default:()=>null}),completedAt:_(M(b),{default:()=>null}),canceledAt:_(M(b),{default:()=>null}),tags:_(G(b),{default:()=>[]}),customFields:_(G(V1),{default:()=>[]}),reminder:_(lp,{default:()=>null}),source:_(A1,{default:()=>({id:"todos",title:"Todos"})})}),W1=W({id:b,name:b,email:_(M(b),{default:()=>null}),url:_(M(b),{default:()=>null})}),G1=W({id:b,name:b,description:_(M(b),{default:()=>null})}),Y1=W({id:b,name:b,startsAt:_(M(b),{default:()=>null}),endsAt:_(M(b),{default:()=>null})}),Q1=W({id:b,name:b}),X1=W({id:b,name:b,dueAt:_(M(b),{default:()=>null})}),Z1=W({id:b,name:b,ownerId:_(M(b),{default:()=>null})}),eN=W({id:b,provider:_p,name:b,repository:_(M(b),{default:()=>null}),baseUrl:_(M(b),{default:()=>null}),syncMode:_(De("manual","read","write"),{default:()=>"manual"})}),tN=W({id:b,name:b,type:De("text","number","date","select","multi_select","boolean","url"),options:_(G(b),{default:()=>[]})}),nN=W({id:b,name:b,trigger:De("status_changed","link_changed","deadline_overdue","task_created","task_updated"),enabled:_(Ln,{default:()=>!0}),description:_(M(b),{default:()=>null})}),Sp=W({$schema:b,version:De(1,2),project:W({name:b}),sources:G(z1),people:_(G(W1),{default:()=>[]}),projects:_(G(G1),{default:()=>[]}),cycles:_(G(Y1),{default:()=>[]}),milestones:_(G(X1),{default:()=>[]}),components:_(G(Z1),{default:()=>[]}),areas:_(G(Q1),{default:()=>[]}),integrations:_(G(eN),{default:()=>[]}),customFields:_(G(tN),{default:()=>[]}),automations:_(G(nN),{default:()=>[]}),tasks:G(H1),summary:W({open:ct,completed:ct,sources:ct})}),rN=en(bg,e=>!e.overdue),sN=en(xl,e=>e.priority),oN=en(ma,e=>e.jsonTodo.rank||"9999"),iN=en(ma,e=>e.dueDate??"9999"),aN=en(ma,e=>e.title.toLowerCase()),Wu={dataset:null,selectedSource:"*",filter:"open",tag:[],assignee:[],query:""},cN=e=>ep(Sp)(e),uN=(e={})=>AO({try:async()=>{const t=lN(e),n=await fetch(t);if(!n.ok)throw new Error(`Could not load ${t}.`);const r=await n.json(),s=ep(Sp)(r);bN(s);const o=e.schemaUrl??s.$schema??$1,i=await fetch(o);if(!i.ok)throw new Error(`Could not load todo schema at ${o}.`);const a=await i.json();if(a.$id&&mN(o)&&a.$id!==o)throw new Error(`Todo schema id mismatch: expected ${o}, got ${a.$id}.`);return s},catch:t=>t instanceof Error?t:new Error(String(t))}),lN=e=>{const t=new URL(e.dataUrl??N1,window.location.origin);return e.path&&t.searchParams.set("path",e.path),`${t.pathname}${t.search}`},fN=e=>jO(g(wp(e.dataset),Zn(t=>e.selectedSource==="*"||t.jsonTodo.source.id===e.selectedSource),Zn(t=>e.filter==="all"?!0:e.filter==="overdue"?t.overdue&&t.status!=="done":t.status===e.filter),Zn(t=>e.tag.length?t.tags.some(n=>e.tag.includes(n)):!0),Zn(t=>e.assignee.length?t.jsonTodo.assigneeIds.some(n=>e.assignee.includes(n)):!0),Zn(t=>{const n=e.query.trim().toLowerCase();return n?[t.key,t.title,t.description,t.source,t.type,t.status,...t.tags,...(t.steps??[]).map(r=>r.text),...(t.acceptanceCriteria??[]).map(r=>r.text),...(t.links??[]).flatMap(r=>[r.title,r.url,r.repository].filter(Boolean)),...t.notes??[]].filter(Boolean).join(" ").toLowerCase().includes(n):!0}),_n(_g(rN,[sN,oN,iN,aN])))),dN=e=>{const t=e?.tasks??[],n=s=>t.some(o=>o.assigneeIds.includes(s)),r=new Map;for(const s of e?.people??[])n(s.id)&&r.set(s.id,s.name);for(const s of t)for(const o of s.assigneeIds)r.has(o)||r.set(o,o);return[...r].map(([s,o])=>({id:s,name:o})).sort((s,o)=>s.name.localeCompare(o.name))},vc=e=>wp(e),hN=e=>{const t=Gu(e)?"done":pN(e)?"blocked":"open";return{id:e.id,key:e.key||e.id,title:e.name,description:e.description??void 0,type:e.type,steps:[...e.steps??[]],acceptanceCriteria:[...e.acceptanceCriteria??[]],links:[...e.links??[]],notes:[...e.notes??[]],relations:[...e.relations??[]],status:t,priority:gN(e.priority),dueDate:e.deadline??void 0,source:e.source.id,tags:[...e.tags],jsonTodo:e,overdue:!Gu(e)&&(e.overdue||yN(e.deadline))}},wp=e=>g(e?.tasks??[],Kt(hN)),Gu=e=>e.status==="done",pN=e=>e.status==="blocked"||e.relations.some(t=>t.type==="blocked_by"),mN=e=>/^https?:\/\//i.test(e),gN=e=>e===1||e===2||e===3||e===4||e===5?e:5,yN=e=>{if(!e)return!1;const t=new Date(`${e}T12:00:00`);if(Number.isNaN(t.valueOf()))return!1;const n=new Date;return n.setHours(0,0,0,0),t.setHours(0,0,0,0),t<n},bN=e=>{const t=[];for(const n of e.tasks)for(const r of n.links){const s=_N(r);s&&t.push(`${n.key||n.id} ${r.id}: ${s}`)}if(t.length)throw new Error(`Invalid todo links:
26
- ${t.map(n=>`- ${n}`).join(`
27
- `)}`)},_N=e=>{let t;try{t=new URL(e.url)}catch{return"url is not a valid absolute URL"}const n=t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1";return t.username||t.password?"url must not contain embedded credentials":t.protocol!=="https:"&&!(t.protocol==="http:"&&n)?"url must use https, except localhost development links":e.provider==="github"&&t.hostname!=="github.com"?"github links must use github.com":e.provider==="linear"&&t.hostname!=="linear.app"&&!t.hostname.endsWith(".linear.app")?"linear links must use linear.app":e.provider==="jira"&&!t.hostname.endsWith(".atlassian.net")&&t.hostname!=="jira.atlassian.com"?"jira links must use an Atlassian Jira host":null};function si({title:e,error:t,context:n,copyLabel:r="Copy error context",action:s}){const[o,i]=me.useState(!1),a=t.length>200||t.includes(`
28
- `);return l.jsxs("div",{className:"rounded-md border border-[#9c3a3a]/40 p-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx("p",{className:"m-0 text-sm font-semibold text-[#9c3a3a]",children:e}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s,l.jsx(Vs,{className:"text-[#9c3a3a] hover:text-[#6f2020]",context:n??t,label:r})]})]}),l.jsx("p",{className:`m-0 mt-1 text-[13px] text-[#9c3a3a] ${o||!a?"break-words whitespace-pre-wrap":"line-clamp-2"}`,children:t}),a?l.jsxs(Js,{className:"mt-1 -ml-2 text-[#9c3a3a] hover:text-[#6f2020]",onClick:()=>i(c=>!c),size:"sm",type:"button",variant:"ghost",children:[o?"Show less":"Show more",l.jsx(ta,{className:`size-3.5 transition-transform ${o?"rotate-180":""}`})]}):null]})}const oi=(e,t)=>["The Kennel Tasks view for this folder failed. Use the context below to","diagnose the cause, fix the data, then re-check the Tasks tab.","",`Folder: ${e}`,"","What failed:","The viewer decodes the merged tasks dataset against a strict schema","(https://raggle.co/schemas/tasks.json). todo.json passed file-level","validation, but at least one field violates the schema, so the decode","threw and the view renders nothing until that field is fixed.","","How to read the failure tree:",'- Bracketed keys are a JSON path into todo.json: ["tasks"] -> [7] ->',' ["resolution"] means tasks[7].resolution in the source file. The'," number is the task's position in the tasks array (tasks from linked"," folders come after the local file's). Leaves list every accepted",' value, and "Expected X, actual Y" shows what the field holds now.',"","Common causes:","- An enum field holds free text. resolution accepts only completed,"," duplicate, wont_do, not_reproducible, moved, or null; status and"," type are enums too. Move the sentence into a comments entry"," (id + body + createdAt) or into description, then set the field to",' an allowed value (finished work uses resolution: "completed").',"- A required field is missing. Each comments entry needs id, body,"," and createdAt (ISO date-time). Each task needs name.","- Shape mismatches: null where a string is required (or the reverse),"," dates not in YYYY-MM-DD, timestamps not ISO.","","How to fix and verify:","1. Edit todo.json in the folder above. Fix the exact field named in"," the failure tree; do not delete the task.","2. Confirm the fix by re-opening the Tasks tab, or decode the same"," payload the viewer uses:",` curl -fsS "<kennel-url>/api/plugins/tasks?path=${encodeURIComponent(e)}"`," then run decodeTodoDataset from @raggle-ai/tasks/todo-model on the"," returned .dataset value. Success = no throw.","3. A healthy Tasks tab shows no red error panel and open/completed"," counts that match todo.json.","","Failure:",t].join(`
29
- `),SN=e=>e instanceof Error&&e.message?e.message:void 0;function wN({issues:e}){return l.jsx(_m,{file:"todo.json",issues:e})}function kN({status:e,retry:t}){return e==="pending"?l.jsx("p",{role:"status",children:"Loading linked tasks… Local tasks remain available."}):e==="error"?l.jsxs("p",{role:"alert",children:["Linked tasks could not load."," ",l.jsx("button",{onClick:t,children:"Retry linked tasks"})]}):null}function xN(e){let t,n;if(e?.status==="available"&&e?.dataset)try{t=cN(e.dataset)}catch(r){n=r instanceof Error&&r.message?r.message:"Could not parse the task file."}return{dataset:t,decodeError:n}}async function vN(e,t){const n=await fetch("/api/tasks/toggle",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,id:t})});if(!n.ok){let s="Could not update task.";try{const o=await n.json();o.error?.message&&(s=o.error.message)}catch{}throw new Error(s)}return(await n.json()).done??!1}function TN(e,t){const n=Cp();return jp({mutationFn:r=>vN(e,r),onError:r=>{Mp.error(r instanceof Error?r.message:"Could not update task.")},onSuccess:()=>{n.invalidateQueries({queryKey:["folder",t,"tasks"]})}})}function kp({folder:e,folderId:t,request:n,subpath:r,noun:s}){const o=me.useRef(!1),i=Rp({enabled:!!e,gcTime:5*6e4,queryFn:({signal:p})=>{const m=o.current?{"x-kennel-retry-linked":"1"}:void 0;return o.current=!1,n(r,{signal:p,headers:m})},queryKey:["folder",t,"tasks",r],staleTime:15e3,refetchInterval:p=>p.state.data?.linkedStatus==="pending"?1e3:!1}),a=i.data,{dataset:c,decodeError:u}=me.useMemo(()=>xN(a),[a]),f=me.useMemo(()=>vc(c??null),[c]),h=TN(e,t);return{noun:s,folder:e,query:{...i,retryLinked:()=>{o.current=!0,i.refetch()}},data:a,dataset:c,decodeError:u,tasks:f,item:f[0]??null,toggle:p=>h.mutate(p),busy:h.isPending}}function ON(e,t){return l.jsx(Js,{className:"h-7 px-2 text-[13px] text-[#9c3a3a] hover:text-[#6f2020]",onClick:()=>{e.query.refetch()},size:"sm",type:"button",variant:"ghost",children:t})}function xp({page:e,header:t,extra:n,unavailableMessage:r,missingMessage:s,body:o}){const{data:i,dataset:a,decodeError:c,query:u}=e,f=SN(u.error)??`Could not load ${e.noun}.`,h=i?.status==="error",p=i?.status==="available",m=i?.linkedStatus;return l.jsxs("div",{className:`mx-auto grid w-full max-w-3xl min-w-0 grid-cols-1 gap-4 px-4
30
- py-5`,children:[t,l.jsx(kN,{status:m,retry:u.retryLinked}),n,u.isPending?l.jsxs("p",{className:"text-muted-foreground m-0 text-sm",children:["Loading ",e.noun,"…"]}):null,u.error?l.jsx(si,{action:ON(e,`Retry ${e.noun}`),context:()=>oi(e.folder,f),error:f,title:`Could not load ${e.noun}.`}):null,!u.error&&h&&i?.issues?.length?l.jsx(wN,{issues:i.issues}):null,!u.error&&h&&!i?.issues?.length?l.jsx(si,{error:i?.message??"todo.json could not be validated.",context:()=>oi(e.folder,i?.message??"todo.json could not be validated."),title:"todo.json could not be validated."}):null,c?l.jsx(si,{error:c,context:()=>oi(e.folder,c??""),title:"Task data is not valid."}):null,!u.isPending&&!u.error&&i&&!p&&!h?l.jsx("p",{className:"text-muted-foreground m-0 text-sm",children:r??`No ${e.noun} in this folder.`}):null,s&&!u.isPending&&!u.error&&p&&!e.item&&i?.linkedStatus!=="pending"&&!c?l.jsx("p",{className:"text-muted-foreground m-0 text-sm",children:s}):null,p&&a&&!c?o:null]})}const NN={1:"border-red-300 bg-red-100 text-red-800",2:"border-orange-300 bg-orange-100 text-orange-800",3:"border-amber-300 bg-amber-100 text-amber-800",4:"border-sky-300 bg-sky-100 text-sky-800",5:"border-slate-300 bg-slate-100 text-slate-700"},$N={open:"Open",blocked:"Blocked",done:"Done"};function EN({item:e,canToggle:t=!0,onToggle:n,documentHref:r}){const s=e.status==="done",o=e.status==="blocked",i=!!(e.overdue&&!s),a=e.description&&!e.steps?.length?IN(e.description):null,c=e.description&&a?.kind!=="steps"?e.description:void 0,u=e.dueDate?new Date(`${e.dueDate}T12:00:00`):null,f=u&&!Number.isNaN(u.valueOf())?new Intl.DateTimeFormat(void 0,{day:"numeric",month:"short"}).format(u):e.dueDate,h=vp(e,f);return l.jsxs("article",{className:`min-w-0 overflow-hidden rounded-lg border border-slate-200
31
- bg-white shadow-sm`,children:[l.jsxs("header",{className:["border-b px-4 py-4 sm:px-5",i?"border-red-200 bg-red-50/80":o?"border-violet-200 bg-violet-50/60":"border-slate-100 bg-slate-50/70"].join(" "),children:[l.jsxs("div",{className:`flex min-w-0 flex-wrap items-start justify-between gap-3
32
- sm:flex-nowrap`,children:[l.jsxs("div",{className:"min-w-0",children:[e.key?l.jsx("p",{className:"m-0 pb-1 font-mono text-xs text-slate-500",children:e.key}):null,l.jsx("h2",{className:["m-0 text-lg leading-tight font-semibold text-slate-950",s?"text-slate-400 line-through":""].join(" "),children:e.title}),c?l.jsx("p",{className:`mt-1.5 mb-0 max-w-3xl text-sm leading-6
33
- whitespace-pre-wrap text-slate-600`,children:c}):null]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[l.jsxs(Js,{type:"button",className:s?"":`border-emerald-500 bg-emerald-500 text-white
34
- hover:bg-emerald-600`,size:"sm",variant:s?"outline":"default",disabled:!t,onClick:()=>n(e.id),children:[o?l.jsx(lm,{className:"h-3.5 w-3.5"}):"✓",s?"Reopen":o?"Complete anyway":"Complete"]}),l.jsx(Vs,{className:"text-slate-500 hover:text-slate-900",context:h,label:`Copy full context for ${e.title}`})]})]}),l.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5 text-xs",children:[e.type?l.jsx(ir,{variant:"secondary",className:"font-normal capitalize",children:e.type}):null,l.jsxs(ir,{variant:"outline",className:NN[e.priority],children:["P",e.priority]}),f?l.jsxs(ir,{variant:"outline",className:[i?"border-red-300 bg-red-100 font-medium text-red-800":"border-amber-200 bg-amber-50 text-amber-700"].join(" "),children:["Due ",f]}):null,e.source?l.jsx("span",{className:"text-slate-400",title:`${e.source}/todo.json`,children:e.source.split("/").pop()}):null,e.tags.map(p=>l.jsxs(ir,{variant:"outline",className:"border-indigo-100 bg-indigo-50 text-indigo-700",children:["#",p]},p))]})]}),e.links?.length?l.jsx("div",{className:`flex flex-wrap items-center gap-1.5 border-b
35
- border-slate-100 px-4 py-2.5 sm:px-5`,children:e.links.map(p=>l.jsxs("a",{className:`inline-flex items-center gap-1.5 rounded-md border
36
- border-slate-200 bg-white px-2 py-1 text-xs text-slate-600
37
- no-underline transition-colors hover:bg-slate-50
38
- hover:text-slate-900`,href:p.url,rel:"noreferrer",target:"_blank",title:Qu(p),children:[l.jsx(jN,{link:p}),p.title??p.repository??Qu(p)]},p.id))}):null,l.jsxs("div",{className:"grid grid-cols-1 divide-y divide-slate-100",children:[e.acceptanceCriteria?.length?l.jsx(ii,{label:"Acceptance criteria",steps:e.acceptanceCriteria}):null,e.steps?.length?l.jsx(ii,{label:"Steps",steps:e.steps}):null,a?.kind==="steps"?l.jsx(ii,{label:a.intro??"Steps",steps:a.steps}):null,e.relations?.length?l.jsx(RN,{relations:e.relations}):null,e.notes?.length?l.jsx(CN,{notes:e.notes,source:e.source,documentHref:r}):null]})]})}const Yu=/^[-*]\s+\[(x|X| )\]\s+(.+)$/,IN=e=>{const t=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean),n=t.map((s,o)=>{const i=Yu.exec(s),a=i?.[1],c=i?.[2];return a&&c?{id:`description-step-${o}`,done:a.toLowerCase()==="x",text:c}:null}).filter(s=>s!=null);return n.length===0?{kind:"plain",text:e}:{kind:"steps",intro:(t.find(s=>!Yu.test(s))??"Steps").replace(/:$/,""),steps:n}};function ii({label:e,steps:t}){const n=t.filter(r=>r.done).length;return l.jsxs("section",{className:"px-4 py-3 sm:px-5",children:[l.jsxs("div",{className:"mb-2 flex items-baseline gap-2",children:[l.jsx("span",{className:`text-xs font-semibold tracking-wide text-slate-500
39
- uppercase`,children:e}),l.jsxs("span",{className:"text-xs text-slate-400",children:[n," of ",t.length]})]}),l.jsx("ul",{className:"m-0 list-none grid-cols-1 space-y-1.5 pl-0",children:t.map(r=>l.jsxs("li",{className:`grid grid-cols-[1.25rem_minmax(0,1fr)] items-start gap-2
40
- text-sm text-slate-600`,children:[l.jsx("span",{className:["mt-0.5 grid h-4 w-4 place-items-center rounded-full border",r.done?"border-emerald-500 bg-emerald-500 text-[10px] text-white":"border-slate-300 bg-white text-transparent"].join(" "),"aria-hidden":"true",children:"✓"}),l.jsx("span",{className:r.done?"text-slate-400 line-through":"",children:r.text})]},r.id))})]})}function RN({relations:e}){return l.jsxs("section",{className:"px-4 py-3 sm:px-5",children:[l.jsx("span",{className:"text-xs font-semibold tracking-wide text-slate-500 uppercase",children:"Related tasks"}),l.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.map((t,n)=>l.jsxs(ir,{className:"max-w-full gap-1 font-normal outline-none",variant:"outline",children:[t.type,l.jsx("span",{className:"font-mono text-[11px] text-slate-700",children:t.targetTaskId}),t.description?l.jsxs("span",{className:"truncate text-slate-400",children:["— ",t.description]}):null]},`${t.type}-${t.targetTaskId}-${n}`))})]})}function CN({notes:e,source:t,documentHref:n}){return l.jsxs("section",{className:"px-4 py-3 sm:px-5",children:[l.jsx("span",{className:"text-xs font-semibold tracking-wide text-slate-500 uppercase",children:"Notes"}),l.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:e.map(r=>{if(/^https?:\/\//i.test(r))return l.jsxs("a",{className:`inline-flex items-center gap-1 rounded-md border
41
- border-sky-200 bg-sky-50 px-1.5 py-0.5 text-xs text-sky-700
42
- no-underline hover:bg-sky-100`,href:r,rel:"noreferrer",target:"_blank",title:r,children:[l.jsx(tl,{className:"h-3 w-3"}),r.replace(/^https?:\/\//,"")]},r);const s=(r.split("#",1)[0]??"").trim(),o=s&&n?n(t,s):void 0,i=l.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border
43
- border-slate-200 bg-slate-50 px-1.5 py-0.5 font-mono text-[11px]
44
- text-slate-600`,title:r,children:[l.jsx(el,{className:"h-3 w-3"}),r]});return o?l.jsx("a",{className:"inline-flex items-center no-underline",href:o,title:`Open ${r}`,children:i},r):i})})]})}function jN({link:e}){return e.provider==="github"&&e.kind==="pull_request"?l.jsx(gm,{className:"h-3.5 w-3.5"}):e.provider==="github"&&e.kind==="commit"?l.jsx(pm,{className:"h-3.5 w-3.5"}):e.provider==="github"&&e.kind==="issue"?l.jsx(cm,{className:"h-3.5 w-3.5"}):e.provider==="github"?l.jsx(dm,{className:"h-3.5 w-3.5"}):e.kind==="document"||e.kind==="design"?l.jsx(el,{className:"h-3.5 w-3.5"}):e.kind==="discussion"?l.jsx(bm,{className:"h-3.5 w-3.5"}):e.provider==="web"?l.jsx(tl,{className:"h-3.5 w-3.5"}):l.jsx(Fp,{className:"h-3.5 w-3.5"})}const Qu=e=>{const t=e.provider==="web"?"external":e.provider,n=e.title??e.repository??e.url;return`${t} ${e.kind.replace(/_/g," ")}: ${n}`},vp=(e,t)=>["You are helping complete a todo item. Use the context below to identify the next concrete action, gather or update any required evidence, and produce a concise fix plan.","","Instructions for the LLM:","- Treat the todo title as the objective.","- Use the description and steps as the authoritative task context.","- Do not mark the task complete unless every unfinished step is resolved.","- If information is missing, state the exact missing input or file needed.","- Return: 1) current status, 2) next action, 3) commands/files to inspect or update, 4) completion criteria.","","Todo context:",e.key?`- Key: ${e.key}`:null,`- Title: ${e.title}`,e.type?`- Type: ${e.type}`:null,e.description?`- Description: ${e.description}`:null,`- Status: ${$N[e.status]}`,`- Priority: P${e.priority}`,t?`- Due: ${t}`:null,`- Source JSON: ${e.source}`,e.acceptanceCriteria?.length?"":null,e.acceptanceCriteria?.length?"Acceptance criteria:":null,e.acceptanceCriteria?.length?e.acceptanceCriteria.map(n=>`- [${n.done?"x":" "}] ${n.text}`).join(`
45
- `):null,e.steps?.length?"":null,e.steps?.length?"Steps:":null,e.steps?.length?e.steps.map(n=>`- [${n.done?"x":" "}] ${n.text}`).join(`
46
- `):null,e.relations?.length?"":null,e.relations?.length?"Task relations:":null,e.relations?.length?e.relations.map(n=>`- ${n.type}: ${n.targetTaskId}${n.description?` - ${n.description}`:""}`).join(`
47
- `):null,e.links?.length?"":null,e.links?.length?"External links:":null,e.links?.length?e.links.map(n=>`- ${n.provider}/${n.kind}/${n.relation}: ${n.title??n.repository??n.id} (${n.url})`).join(`
48
- `):null,e.notes?.length?"":null,e.notes?.length?"Accompanying notes and file references:":null,e.notes?.length?e.notes.map(n=>`- ${n}`).join(`
49
- `):null].filter(n=>n!=null).join(`
50
- `);function Tp({warnings:e,folder:t}){return e?.length?l.jsxs(Pp,{children:[l.jsx(Lp,{asChild:!0,children:l.jsxs(Js,{className:`h-7 shrink-0 gap-1.5 border-amber-300 bg-amber-50 px-2
51
- text-[13px] text-amber-700 hover:bg-amber-100`,size:"sm",variant:"outline","aria-label":`${e.length} todo.json warnings; open details`,children:[l.jsx(Ap,{"aria-hidden":"true",className:"size-3.5"}),"Warnings (",e.length,")"]})}),l.jsxs(Kp,{children:[l.jsx(Dp,{children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx(Up,{children:"todo.json warnings"}),l.jsx(qp,{children:"Advisory only — the task file is still valid and the counts are unaffected. Link notes to these tasks to clear the warnings."})]}),l.jsx(Vs,{context:()=>MN(e,t),label:"Copy fix instructions for an agent",variant:"outline",className:"mt-0.5 shrink-0 text-slate-500 hover:text-slate-900"})]})}),l.jsx("ul",{className:`m-0 max-h-72 list-disc space-y-1.5 overflow-y-auto pl-5
52
- text-sm text-amber-700`,children:e.map((n,r)=>l.jsxs("li",{children:[l.jsx("code",{className:"text-[13px]",children:n.path||"todo.json"}),n.path?": ":" — ",n.message]},r))})]})]}):null}const MN=(e,t)=>["You are fixing advisory warnings in a Kennel Tasks workspace.",t?`The viewed folder is: ${t}`:"Work inside the viewed folder.","","The todo.json task files are still valid — these warnings are advisory.","Fix every warning; the context below lists each one.","","Warnings:",...e.map(n=>`- ${n.path||"todo.json"}: ${n.message}`),"","Instructions for the LLM:",`- Read every todo.json under the folder: the root todo.json, plus the file
53
- named before the ': ' separator in each warning path. Do not invent tasks
54
- and do not change statuses, priorities, or deadlines.`,`- For "no notes; link the accompanying note file or https reference":
55
- create or update one accompanying markdown note next to that todo.json,
56
- then add a notes array entry to the task — a note path relative to the
57
- folder that owns the todo.json (optionally with a #Section heading) or an
58
- https URL.`,`- Connect things where possible: put the related file references (specs,
59
- evidence, other notes, and the task key such as 'Tracked as
60
- office/todo.json TODO-7') into the note's linked sections so task and
61
- note point at each other, and link existing workspace notes instead of
62
- creating duplicates.`,`- For "references a missing note file": point the entry at an existing
63
- file, or create the referenced note when it is clearly the intended
64
- companion for that task.`,`- Keep todo.json valid: notes entries must be non-empty strings holding
65
- a folder-relative path (never absolute or containing '..') or an https URL.`,`- Verify afterwards: re-open the Tasks tab and confirm the Warnings
66
- button is gone, or GET /api/plugins/tasks?path=<folder> and confirm the
67
- warnings array is empty.`].filter(n=>n!=null).join(`
68
- `);function AN({documentHref:e,folder:t,folderId:n,listHref:r,request:s,subpath:o}){const i=kp({folder:t,folderId:n,noun:"task",request:s,subpath:o});return l.jsx(xp,{body:i.item?l.jsx(EN,{item:i.item,documentHref:e,canToggle:!i.busy,onToggle:()=>{o&&i.toggle(o)}}):void 0,extra:l.jsx("div",{className:"flex justify-end",children:l.jsx(Tp,{warnings:i.data?.warnings,folder:t})}),header:l.jsxs("a",{className:`inline-flex w-fit items-center gap-2 rounded-md border
69
- border-[#dde1dc] bg-white px-3 py-1.5 text-sm text-[#4a554b]
70
- no-underline hover:bg-[#f3f5f2]`,href:r,children:[l.jsx(Bp,{className:"size-4"}),"Back to Tasks"]}),missingMessage:"Task not found.",page:i})}const FN="@";function PN(e,t){if(typeof e!="string"||!e)return;const n=typeof t.id=="string"&&t.id.trim()?t.id.trim():typeof t.key=="string"&&t.key.trim()?t.key.trim():void 0;if(n)return`${Vp(e)}${FN}${n}`}function Op({ariaLabel:e,className:t,label:n,selected:r,onChange:s,options:o,total:i}){const[a,c]=me.useState(!1),u=p=>r.includes(p),f=p=>s(u(p)?r.filter(m=>m!==p):[...r,p]),h=i??o.reduce((p,m)=>p+(m.count??0),0);return l.jsxs(zp,{open:a,onOpenChange:c,children:[l.jsxs(Hp,{"aria-label":e??n,className:hn(`flex h-8 items-center gap-1.5 rounded-md border border-slate-200
71
- bg-white px-3 text-sm font-medium text-slate-900 shadow-xs
72
- transition-colors outline-none hover:bg-slate-50
73
- focus-visible:border-slate-400 focus-visible:ring-[3px]
74
- focus-visible:ring-slate-200/60 disabled:cursor-not-allowed
75
- disabled:opacity-50`,t),children:[n,r.length?l.jsx("span",{className:`rounded-full bg-slate-900 px-1.5 text-[0.75rem]
76
- font-semibold text-white`,children:r.length}):null,l.jsx(ta,{"aria-hidden":"true",className:hn("size-4 text-slate-400 transition-transform",a&&"rotate-180")})]}),l.jsx(Wp,{children:l.jsx(Gp,{className:hn(`z-50 max-h-72 max-w-[calc(100vw-2rem)] min-w-[12rem]
77
- overflow-y-auto rounded-lg border border-slate-200 bg-white p-2
78
- text-slate-950 shadow-lg`,`data-[state=open]:animate-in data-[state=closed]:animate-out
79
- data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0
80
- data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
81
- data-[side=bottom]:slide-in-from-top-2
82
- data-[side=top]:slide-in-from-bottom-2`),align:"start",sideOffset:4,children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsxs("button",{"aria-pressed":r.length===0,onClick:()=>s([]),type:"button",className:Xu(r.length===0),children:["All",l.jsx("span",{className:Zu(r.length===0),children:h})]}),o.map(p=>{const m=u(p.value);return l.jsxs("button",{"aria-pressed":m,onClick:()=>f(p.value),type:"button",className:Xu(m),children:[m?l.jsx(ea,{"aria-hidden":"true",className:"size-3.5"}):null,p.label,typeof p.count=="number"?l.jsx("span",{className:Zu(m),children:p.count}):null]},p.value)})]})})})]})}const Xu=e=>`inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-xs
83
- font-medium transition-colors focus-visible:outline-2
84
- focus-visible:outline-slate-500 focus-visible:outline-offset-1 ${e?"border-slate-900 bg-slate-900 text-white":"border-slate-200 bg-white text-slate-600 hover:bg-slate-100"}`,Zu=e=>`rounded-full px-1.5 ${e?"bg-slate-700 text-slate-200":"bg-slate-100 text-slate-400"}`;function LN({dataset:e,value:t,onChange:n,className:r=""}){const s=me.useMemo(()=>dN(e),[e]);return s.length?l.jsx(Op,{ariaLabel:"Filter tasks by agent",className:r,label:"Agent",onChange:n,options:s.map(o=>({value:o.id,label:o.name})),selected:t}):null}function KN({ariaLabel:e,className:t,label:n,value:r,onChange:s,options:o,triggerClassName:i=""}){return l.jsxs("label",{className:["flex items-center gap-2",t].filter(Boolean).join(" "),children:[n?l.jsx("span",{className:`text-[0.78rem] font-medium tracking-wide text-slate-500
85
- uppercase`,children:n}):null,l.jsxs(Yp,{value:r,onValueChange:s,children:[l.jsxs(Qp,{"aria-label":e??n,className:hn(`flex h-8 items-center justify-between gap-2 rounded-md border
86
- border-slate-200 bg-white px-3 text-sm font-medium text-slate-900
87
- shadow-xs transition-[color,box-shadow] outline-none
88
- hover:bg-slate-50 focus-visible:border-slate-400
89
- focus-visible:ring-[3px] focus-visible:ring-slate-200/60
90
- disabled:cursor-not-allowed disabled:opacity-50`,i),children:[l.jsx(Xp,{}),l.jsx(Zp,{asChild:!0,children:l.jsx(ta,{className:"size-4 text-slate-400"})})]}),l.jsx(em,{children:l.jsx(tm,{className:hn(`z-50 max-h-(--radix-select-content-available-height) min-w-[9rem]
91
- overflow-x-hidden overflow-y-auto rounded-lg border
92
- border-slate-200 bg-white p-1 text-slate-950 shadow-lg`,`data-[state=open]:animate-in data-[state=closed]:animate-out
93
- data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0
94
- data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
95
- data-[side=bottom]:slide-in-from-top-2
96
- data-[side=top]:slide-in-from-bottom-2`),position:"popper",sideOffset:4,children:l.jsx(nm,{className:"w-full min-w-(--radix-select-trigger-width)",children:o.map(a=>l.jsxs(rm,{className:hn(`relative flex w-full cursor-default items-center gap-2
97
- rounded-md py-1.5 pr-8 pl-2 text-sm outline-none select-none
98
- data-[highlighted]:bg-slate-100
99
- data-[state=checked]:font-medium`),value:a.value,children:[l.jsx(sm,{children:a.label}),typeof a.count=="number"?l.jsx("span",{className:"ml-auto text-xs font-normal text-slate-400",children:a.count}):null,l.jsx(om,{className:"absolute right-2 flex items-center",children:l.jsx(ea,{className:"size-4 text-slate-700"})})]},a.value))})})})]})]})}const DN=[{value:"all",label:"All"},{value:"open",label:"Open"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"overdue",label:"Late"}];function UN({dataset:e,value:t,onChange:n,className:r=""}){const s=me.useMemo(()=>vc(e),[e]),o=me.useMemo(()=>({all:s.length,open:s.filter(i=>i.status==="open").length,done:s.filter(i=>i.status==="done").length,blocked:s.filter(i=>i.status==="blocked").length,overdue:s.filter(i=>i.overdue&&i.status!=="done").length}),[s]);return l.jsx(KN,{ariaLabel:"Filter tasks by status",className:r,onChange:i=>n(i),options:DN.map(i=>({...i,count:o[i.value]})),triggerClassName:"w-28",value:t})}function qN({dataset:e,value:t,onChange:n,className:r=""}){const s=me.useMemo(()=>{const o=vc(e);return[...new Set(o.flatMap(i=>i.tags).filter(Boolean))].sort((i,a)=>i.localeCompare(a)).map(i=>({tag:i,count:o.filter(a=>a.tags.includes(i)).length}))},[e]);return s.length?l.jsx(Op,{ariaLabel:"Filter tasks by tag",className:r,label:"Tag",onChange:n,options:s.map(o=>({value:o.tag,label:o.tag,count:o.count})),selected:t}):null}function BN({dataset:e,filter:t,onFilterChange:n,tag:r,onTagChange:s,assignee:o,onAssigneeChange:i,leading:a,trailing:c,className:u=""}){return l.jsxs("div",{className:["flex flex-wrap items-center gap-x-3 gap-y-2",u].filter(Boolean).join(" "),children:[a,l.jsx(UN,{dataset:e,onChange:n,value:t}),l.jsx(LN,{dataset:e,onChange:i,value:o}),l.jsx(qN,{dataset:e,onChange:s,value:r}),c?l.jsx("div",{className:"ml-auto flex shrink-0",children:c}):null]})}function JN({dataset:e=null,className:t="",filters:n=!1,leadingFilters:r,trailingFilters:s,itemHref:o,onToggle:i,...a}){const[c,u]=me.useState(Wu.filter),[f,h]=me.useState([]),[p,m]=me.useState([]),[y,T]=me.useState(null),[S,w]=me.useState(null),F=e??y;me.useEffect(()=>{if(e)return;let E=!1;return KO(Mt(uN({dataUrl:a.dataUrl,path:a.path,schemaUrl:a.schemaUrl}))).then(x=>{E||(x._tag==="Left"?w(x.left.message):(w(null),T(x.right)))}),()=>{E=!0}},[e,a.dataUrl,a.path,a.schemaUrl]);const v=me.useMemo(()=>{const E={...Wu,dataset:F,filter:c,tag:f,assignee:p};return Wh(fN(E))},[F,c,f,p]),O=!F&&!S;return l.jsx("main",{className:["min-h-full bg-transparent text-slate-950",t].filter(Boolean).join(" "),children:l.jsxs("section",{className:"mx-auto w-full max-w-3xl px-3 py-4 sm:px-5 sm:py-5",children:[S?l.jsx("p",{className:`mb-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2
100
- text-sm text-red-700`,children:S}):null,n?l.jsx(BN,{assignee:p,className:"mb-3",dataset:F,filter:c,leading:r,trailing:s,onAssigneeChange:m,onFilterChange:u,onTagChange:h,tag:f}):null,O?l.jsx("p",{className:"py-8 text-center text-sm text-slate-500",children:"Loading tasks…"}):v.length===0?l.jsx("p",{className:"py-8 text-center text-sm text-slate-500",children:zN(c,f)}):l.jsx("ol",{className:"space-y-2",children:v.map(E=>l.jsx(VN,{item:E,folderPath:a.path,itemHref:o,onToggle:i},E.id))})]})})}function VN({item:e,folderPath:t,itemHref:n,onToggle:r}){const s=HN(e),o=n?.(e),i=me.useCallback(()=>WN(e,t),[e,t]);return l.jsx("li",{className:["rounded-md border px-3 py-2",e.overdue?"border-red-400 bg-red-50":e.status==="blocked"?"border-rose-300 bg-rose-50/60":"border-slate-200 bg-white"].filter(Boolean).join(" "),children:l.jsxs("div",{className:"flex items-start gap-3",children:[r?l.jsx("button",{type:"button","aria-pressed":e.status==="done","aria-label":e.status==="done"?`Reopen ${e.title}`:`Complete ${e.title}`,title:e.status==="done"?"Reopen task":"Complete task",onClick:()=>r(e),className:["mt-0.5 grid h-5 w-5 shrink-0 place-items-center rounded-full","border transition-colors",e.status==="done"?"border-emerald-500 bg-emerald-500 text-white hover:bg-emerald-600":e.status==="blocked"?"border-rose-300 bg-rose-100 text-rose-600":"border-slate-300 bg-white text-transparent hover:border-emerald-500 hover:bg-emerald-50 hover:text-emerald-600"].join(" "),children:l.jsx(ea,{className:"h-3 w-3"})}):null,l.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[o?l.jsxs("a",{href:o,className:["inline-flex items-center gap-1 text-sm leading-5 font-medium","text-slate-900 no-underline hover:text-indigo-700",e.status==="done"?"text-slate-500 line-through":""].filter(Boolean).join(" "),children:[l.jsx("span",{children:e.title}),l.jsx(im,{"aria-hidden":"true",className:"h-3.5 w-3.5 text-slate-400"})]}):l.jsx("p",{className:["text-sm leading-5 font-medium text-slate-900",e.status==="done"?"text-slate-500 line-through":""].join(" "),children:e.title}),s.status||s.folder?l.jsxs("p",{className:"text-xs leading-4 text-slate-500",children:[s.status?l.jsx("span",{className:e.overdue?"font-medium text-red-600":"",children:s.status}):null,s.folder?l.jsxs("span",{children:[s.status?" • ":"",s.folder]}):null]}):null]}),l.jsx(Vs,{className:"shrink-0 text-slate-500 hover:text-slate-900",context:i,label:`Copy prompt for ${e.title}`})]})})}const zN=(e,t)=>{const n=e==="done"?"done":e==="blocked"?"blocked":e==="overdue"?"late":e==="all"?"":"open";if(t.length)return`No ${n?`${n} `:""}tasks with the selected tags`;switch(e){case"done":return"No done tasks";case"blocked":return"No blocked tasks";case"overdue":return"No late tasks";case"all":return"No tasks";default:return"No open tasks"}},HN=e=>({status:e.status==="blocked"?"Blocked":e.overdue?"Late":e.status==="done"?"Done":"",folder:e.jsonTodo.source.title.replace(/ tasks$/,"")}),WN=(e,t)=>{const n=t?`${t}/todo.json`:"todo.json",r=GN(e.jsonTodo);return[`The model is instructed to complete this specific todo: ${e.title}`,"",vp(e),"",`Todo JSON: ${n}`,r.length?"Read these relative files before you start:":null,r.length?r.map(s=>`- ${s}`).join(`
101
- `):null].filter(s=>!!s).join(`
102
- `)},GN=e=>XN(YN(e.customFields)),YN=e=>e.flatMap(t=>Np(t.id)?Zi(t.value):[]),Np=e=>/(file|path|read|context|source|doc)/i.test(e),Zi=e=>typeof e=="string"?QN(e)?[e]:[]:Array.isArray(e)?e.flatMap(t=>Zi(t)):e&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>Np(t)?Zi(n):[]):[],QN=e=>!!e&&!e.startsWith("/")&&!/^[a-z]+:\/\//i.test(e)&&/[./\\]/.test(e),XN=e=>[...new Set(e)];function ZN({folder:e,folderId:t,href:n,request:r}){const s=kp({folder:e,folderId:t,noun:"tasks",request:r,subpath:""}),o=Jp(s.tasks,{getFolder:c=>c.jsonTodo.source.id,rootFolder:e}),i=me.useMemo(()=>{if(s.dataset)return{...s.dataset,tasks:o.visibleItems.map(c=>c.jsonTodo)}},[s.dataset,o.visibleItems]),a=c=>PN(c.jsonTodo.source?.id,c.jsonTodo)??[c.id,c.key].find(u=>u);return l.jsx(xp,{body:i?l.jsx(JN,{dataset:i,trailingFilters:l.jsx(Tp,{warnings:s.data?.warnings,folder:e}),filters:!0,leadingFilters:o.choices.length>1?l.jsx(Ep,{ariaLabel:"Filter tasks by folder",choices:o.choices,onSelect:o.setSelected,selected:o.effectiveSelected,total:o.total}):void 0,itemHref:c=>{const u=a(c);return u?n(u):void 0},onToggle:c=>{const u=a(c);u&&s.toggle(u)}}):void 0,page:s,unavailableMessage:"No local task file in this folder."})}function e$(e){return e.subpath?l.jsx(AN,{...e}):l.jsx(ZN,{...e})}const q$={...Ip,component:e$};export{e$ as TasksPlugin,q$ as tasksClient};