@zaip-ai/cli 6.3.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1282) hide show
  1. package/README.md +13 -11
  2. package/dist/commands/init.d.ts +1 -0
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +18 -5
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/services/adapter-codex-config.d.ts +3 -0
  9. package/dist/services/adapter-codex-config.d.ts.map +1 -0
  10. package/dist/services/adapter-codex-config.js +119 -0
  11. package/dist/services/adapter-codex-config.js.map +1 -0
  12. package/dist/services/adapter-config-overlay.d.ts +8 -0
  13. package/dist/services/adapter-config-overlay.d.ts.map +1 -0
  14. package/dist/services/adapter-config-overlay.js +17 -0
  15. package/dist/services/adapter-config-overlay.js.map +1 -0
  16. package/dist/services/adapters.d.ts +3 -2
  17. package/dist/services/adapters.d.ts.map +1 -1
  18. package/dist/services/adapters.js +34 -143
  19. package/dist/services/adapters.js.map +1 -1
  20. package/dist/services/adapters.test.js +12 -0
  21. package/dist/services/adapters.test.js.map +1 -1
  22. package/dist/services/agent-adapters.d.ts +2 -98
  23. package/dist/services/agent-adapters.d.ts.map +1 -1
  24. package/dist/services/agent-adapters.js +30 -29
  25. package/dist/services/agent-adapters.js.map +1 -1
  26. package/dist/services/agent-adapters.test.js +4 -2
  27. package/dist/services/agent-adapters.test.js.map +1 -1
  28. package/dist/services/agent-guidance-types.d.ts +98 -0
  29. package/dist/services/agent-guidance-types.d.ts.map +1 -0
  30. package/dist/services/agent-guidance-types.js +4 -0
  31. package/dist/services/agent-guidance-types.js.map +1 -0
  32. package/dist/services/catalog-toml.d.ts +4 -0
  33. package/dist/services/catalog-toml.d.ts.map +1 -0
  34. package/dist/services/catalog-toml.js +10 -0
  35. package/dist/services/catalog-toml.js.map +1 -0
  36. package/dist/services/catalog-write-scope.d.ts +4 -0
  37. package/dist/services/catalog-write-scope.d.ts.map +1 -0
  38. package/dist/services/catalog-write-scope.js +18 -0
  39. package/dist/services/catalog-write-scope.js.map +1 -0
  40. package/dist/services/claude-settings-overlay.d.ts +4 -0
  41. package/dist/services/claude-settings-overlay.d.ts.map +1 -0
  42. package/dist/services/claude-settings-overlay.js +58 -0
  43. package/dist/services/claude-settings-overlay.js.map +1 -0
  44. package/dist/services/client-selection.d.ts +17 -0
  45. package/dist/services/client-selection.d.ts.map +1 -0
  46. package/dist/services/client-selection.js +67 -0
  47. package/dist/services/client-selection.js.map +1 -0
  48. package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
  49. package/dist/services/codex-conversation-lifecycle-hook.js +20 -9
  50. package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
  51. package/dist/services/codex-git-publication-template.d.ts +2 -0
  52. package/dist/services/codex-git-publication-template.d.ts.map +1 -0
  53. package/dist/services/codex-git-publication-template.js +120 -0
  54. package/dist/services/codex-git-publication-template.js.map +1 -0
  55. package/dist/services/codex-github-setup-template.d.ts +3 -0
  56. package/dist/services/codex-github-setup-template.d.ts.map +1 -0
  57. package/dist/services/codex-github-setup-template.js +176 -0
  58. package/dist/services/codex-github-setup-template.js.map +1 -0
  59. package/dist/services/codex-hook-activation.d.ts +1 -1
  60. package/dist/services/codex-hook-activation.d.ts.map +1 -1
  61. package/dist/services/codex-hook-activation.js +55 -10
  62. package/dist/services/codex-hook-activation.js.map +1 -1
  63. package/dist/services/codex-host-diagnostic.d.ts +10 -0
  64. package/dist/services/codex-host-diagnostic.d.ts.map +1 -0
  65. package/dist/services/codex-host-diagnostic.js +5 -0
  66. package/dist/services/codex-host-diagnostic.js.map +1 -0
  67. package/dist/services/codex-host-diagnostic.test.d.ts +2 -0
  68. package/dist/services/codex-host-diagnostic.test.d.ts.map +1 -0
  69. package/dist/services/codex-host-diagnostic.test.js +24 -0
  70. package/dist/services/codex-host-diagnostic.test.js.map +1 -0
  71. package/dist/services/codex-literal-read-sequence-template.d.ts.map +1 -1
  72. package/dist/services/codex-literal-read-sequence-template.js +97 -6
  73. package/dist/services/codex-literal-read-sequence-template.js.map +1 -1
  74. package/dist/services/codex-native-authority-policy-template.d.ts +2 -0
  75. package/dist/services/codex-native-authority-policy-template.d.ts.map +1 -0
  76. package/dist/services/codex-native-authority-policy-template.js +132 -0
  77. package/dist/services/codex-native-authority-policy-template.js.map +1 -0
  78. package/dist/services/codex-native-tool-authority-template.d.ts.map +1 -1
  79. package/dist/services/codex-native-tool-authority-template.js +147 -145
  80. package/dist/services/codex-native-tool-authority-template.js.map +1 -1
  81. package/dist/services/codex-node-options-template.d.ts +3 -0
  82. package/dist/services/codex-node-options-template.d.ts.map +1 -0
  83. package/dist/services/codex-node-options-template.js +30 -0
  84. package/dist/services/codex-node-options-template.js.map +1 -0
  85. package/dist/services/codex-pre-tool-cli-capture-template.d.ts.map +1 -1
  86. package/dist/services/codex-pre-tool-cli-capture-template.js +214 -10
  87. package/dist/services/codex-pre-tool-cli-capture-template.js.map +1 -1
  88. package/dist/services/codex-pre-tool-cloud-template.d.ts.map +1 -1
  89. package/dist/services/codex-pre-tool-cloud-template.js +149 -12
  90. package/dist/services/codex-pre-tool-cloud-template.js.map +1 -1
  91. package/dist/services/codex-pre-tool-dependencies.test-support.d.ts.map +1 -1
  92. package/dist/services/codex-pre-tool-dependencies.test-support.js +12 -0
  93. package/dist/services/codex-pre-tool-dependencies.test-support.js.map +1 -1
  94. package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
  95. package/dist/services/codex-pre-tool-hook-template.js +53 -138
  96. package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
  97. package/dist/services/codex-pre-tool-hook-template.test.js +13 -7
  98. package/dist/services/codex-pre-tool-hook-template.test.js.map +1 -1
  99. package/dist/services/codex-pre-tool-host-context-template.d.ts.map +1 -1
  100. package/dist/services/codex-pre-tool-host-context-template.js +23 -0
  101. package/dist/services/codex-pre-tool-host-context-template.js.map +1 -1
  102. package/dist/services/codex-pre-tool-policy-template.d.ts.map +1 -1
  103. package/dist/services/codex-pre-tool-policy-template.js +5 -3
  104. package/dist/services/codex-pre-tool-policy-template.js.map +1 -1
  105. package/dist/services/codex-pre-tool-release-review-template.d.ts.map +1 -1
  106. package/dist/services/codex-pre-tool-release-review-template.js +161 -2
  107. package/dist/services/codex-pre-tool-release-review-template.js.map +1 -1
  108. package/dist/services/codex-pre-tool-support-template.d.ts.map +1 -1
  109. package/dist/services/codex-pre-tool-support-template.js +88 -129
  110. package/dist/services/codex-pre-tool-support-template.js.map +1 -1
  111. package/dist/services/codex-release-publication-template.d.ts +2 -0
  112. package/dist/services/codex-release-publication-template.d.ts.map +1 -0
  113. package/dist/services/codex-release-publication-template.js +127 -0
  114. package/dist/services/codex-release-publication-template.js.map +1 -0
  115. package/dist/services/codex-repository-profile-template.d.ts +2 -0
  116. package/dist/services/codex-repository-profile-template.d.ts.map +1 -0
  117. package/dist/services/codex-repository-profile-template.js +84 -0
  118. package/dist/services/codex-repository-profile-template.js.map +1 -0
  119. package/dist/services/codex-rules.d.ts +1 -1
  120. package/dist/services/codex-rules.d.ts.map +1 -1
  121. package/dist/services/codex-rules.js +2 -2
  122. package/dist/services/codex-storage-handoff-template.d.ts +2 -0
  123. package/dist/services/codex-storage-handoff-template.d.ts.map +1 -0
  124. package/dist/services/codex-storage-handoff-template.js +18 -0
  125. package/dist/services/codex-storage-handoff-template.js.map +1 -0
  126. package/dist/services/codex-subagent-hook-template.d.ts +1 -1
  127. package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
  128. package/dist/services/codex-subagent-hook-template.js +7 -6
  129. package/dist/services/codex-subagent-hook-template.js.map +1 -1
  130. package/dist/services/codex-task-delivery-authority-template.d.ts +3 -0
  131. package/dist/services/codex-task-delivery-authority-template.d.ts.map +1 -0
  132. package/dist/services/codex-task-delivery-authority-template.js +244 -0
  133. package/dist/services/codex-task-delivery-authority-template.js.map +1 -0
  134. package/dist/services/codex-validation-runtime-template.js +1 -1
  135. package/dist/services/codex-windows-hook-command.js +2 -2
  136. package/dist/services/codex-windows-hook-command.js.map +1 -1
  137. package/dist/services/developer-identity-fixture.d.ts.map +1 -1
  138. package/dist/services/developer-identity-fixture.js +3 -2
  139. package/dist/services/developer-identity-fixture.js.map +1 -1
  140. package/dist/services/doctor.d.ts.map +1 -1
  141. package/dist/services/doctor.js +5 -1
  142. package/dist/services/doctor.js.map +1 -1
  143. package/dist/services/github-setup-status.d.ts +6 -3
  144. package/dist/services/github-setup-status.d.ts.map +1 -1
  145. package/dist/services/github-setup-status.js +9 -5
  146. package/dist/services/github-setup-status.js.map +1 -1
  147. package/dist/services/github-setup-status.test.js +69 -3
  148. package/dist/services/github-setup-status.test.js.map +1 -1
  149. package/dist/services/global-codex-config.d.ts.map +1 -1
  150. package/dist/services/global-codex-config.js +3 -0
  151. package/dist/services/global-codex-config.js.map +1 -1
  152. package/dist/services/global-codex-project-trust.d.ts +17 -0
  153. package/dist/services/global-codex-project-trust.d.ts.map +1 -0
  154. package/dist/services/global-codex-project-trust.js +221 -0
  155. package/dist/services/global-codex-project-trust.js.map +1 -0
  156. package/dist/services/global-codex-project-trust.test.d.ts +2 -0
  157. package/dist/services/global-codex-project-trust.test.d.ts.map +1 -0
  158. package/dist/services/global-codex-project-trust.test.js +219 -0
  159. package/dist/services/global-codex-project-trust.test.js.map +1 -0
  160. package/dist/services/install-agents-template.d.ts.map +1 -1
  161. package/dist/services/install-agents-template.js +97 -192
  162. package/dist/services/install-agents-template.js.map +1 -1
  163. package/dist/services/install-client-selection.d.ts +6 -0
  164. package/dist/services/install-client-selection.d.ts.map +1 -0
  165. package/dist/services/install-client-selection.js +24 -0
  166. package/dist/services/install-client-selection.js.map +1 -0
  167. package/dist/services/install-result.d.ts +6 -0
  168. package/dist/services/install-result.d.ts.map +1 -0
  169. package/dist/services/install-result.js +14 -0
  170. package/dist/services/install-result.js.map +1 -0
  171. package/dist/services/install-storage-boundary.d.ts +6 -0
  172. package/dist/services/install-storage-boundary.d.ts.map +1 -0
  173. package/dist/services/install-storage-boundary.js +173 -0
  174. package/dist/services/install-storage-boundary.js.map +1 -0
  175. package/dist/services/install-storage-boundary.test.d.ts +2 -0
  176. package/dist/services/install-storage-boundary.test.d.ts.map +1 -0
  177. package/dist/services/install-storage-boundary.test.js +110 -0
  178. package/dist/services/install-storage-boundary.test.js.map +1 -0
  179. package/dist/services/install-target-windows.test.d.ts +2 -0
  180. package/dist/services/install-target-windows.test.d.ts.map +1 -0
  181. package/dist/services/install-target-windows.test.js +39 -0
  182. package/dist/services/install-target-windows.test.js.map +1 -0
  183. package/dist/services/install-target.d.ts +6 -0
  184. package/dist/services/install-target.d.ts.map +1 -0
  185. package/dist/services/install-target.js +89 -0
  186. package/dist/services/install-target.js.map +1 -0
  187. package/dist/services/install-target.test.d.ts +2 -0
  188. package/dist/services/install-target.test.d.ts.map +1 -0
  189. package/dist/services/install-target.test.js +47 -0
  190. package/dist/services/install-target.test.js.map +1 -0
  191. package/dist/services/install-template-backup.d.ts +3 -0
  192. package/dist/services/install-template-backup.d.ts.map +1 -0
  193. package/dist/services/install-template-backup.js +46 -0
  194. package/dist/services/install-template-backup.js.map +1 -0
  195. package/dist/services/install-template-lock.d.ts +2 -0
  196. package/dist/services/install-template-lock.d.ts.map +1 -0
  197. package/dist/services/install-template-lock.js +32 -0
  198. package/dist/services/install-template-lock.js.map +1 -0
  199. package/dist/services/install-template-policy.d.ts +16 -0
  200. package/dist/services/install-template-policy.d.ts.map +1 -1
  201. package/dist/services/install-template-policy.js +73 -1
  202. package/dist/services/install-template-policy.js.map +1 -1
  203. package/dist/services/install-template-render.d.ts +11 -0
  204. package/dist/services/install-template-render.d.ts.map +1 -0
  205. package/dist/services/install-template-render.js +53 -0
  206. package/dist/services/install-template-render.js.map +1 -0
  207. package/dist/services/install-template-rule-files.d.ts +3 -0
  208. package/dist/services/install-template-rule-files.d.ts.map +1 -0
  209. package/dist/services/install-template-rule-files.js +24 -0
  210. package/dist/services/install-template-rule-files.js.map +1 -0
  211. package/dist/services/logger.d.ts.map +1 -1
  212. package/dist/services/logger.js +37 -10
  213. package/dist/services/logger.js.map +1 -1
  214. package/dist/services/logger.test.js +65 -16
  215. package/dist/services/logger.test.js.map +1 -1
  216. package/dist/services/project-config-upgrade.d.ts +3 -0
  217. package/dist/services/project-config-upgrade.d.ts.map +1 -0
  218. package/dist/services/project-config-upgrade.js +58 -0
  219. package/dist/services/project-config-upgrade.js.map +1 -0
  220. package/dist/services/runtime-template-deploy-policy.test.d.ts +2 -0
  221. package/dist/services/runtime-template-deploy-policy.test.d.ts.map +1 -0
  222. package/dist/services/runtime-template-deploy-policy.test.js +26 -0
  223. package/dist/services/runtime-template-deploy-policy.test.js.map +1 -0
  224. package/dist/services/runtime-template-test-support.d.ts +14 -0
  225. package/dist/services/runtime-template-test-support.d.ts.map +1 -1
  226. package/dist/services/runtime-template-test-support.js +18 -0
  227. package/dist/services/runtime-template-test-support.js.map +1 -1
  228. package/dist/services/runtime-template.test.js +14 -63
  229. package/dist/services/runtime-template.test.js.map +1 -1
  230. package/dist/services/sqlite-bootstrap.js +2 -2
  231. package/dist/services/sqlite-bootstrap.js.map +1 -1
  232. package/dist/services/stack-node.js +2 -2
  233. package/dist/services/stack-node.js.map +1 -1
  234. package/dist/services/stack-terraform.d.ts.map +1 -1
  235. package/dist/services/stack-terraform.js +5 -5
  236. package/dist/services/stack-terraform.js.map +1 -1
  237. package/dist/services/template-packed-path.test.d.ts +2 -0
  238. package/dist/services/template-packed-path.test.d.ts.map +1 -0
  239. package/dist/services/template-packed-path.test.js +30 -0
  240. package/dist/services/template-packed-path.test.js.map +1 -0
  241. package/dist/types.d.ts +8 -0
  242. package/dist/types.d.ts.map +1 -1
  243. package/package.json +2 -1
  244. package/templates/.agents/README-ENG.md +3 -1
  245. package/templates/.agents/README.md +3 -1
  246. package/templates/.agents/architecture/software-architecture.md +7 -1
  247. package/templates/.agents/config/agents/catalog.yaml +25 -12
  248. package/templates/.agents/config/agents/discovery.json +2 -2
  249. package/templates/.agents/config/autonomous-cloud-inputs.json +3 -3
  250. package/templates/.agents/config/clients/codex/agents/zaip-agent-analyst.toml +4 -2
  251. package/templates/.agents/config/clients/codex/agents/zaip-agent-auditor.toml +1 -1
  252. package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +6 -4
  253. package/templates/.agents/config/clients/codex/agents/zaip-agent-brand-strategist.toml +3 -1
  254. package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +6 -4
  255. package/templates/.agents/config/clients/codex/agents/zaip-agent-cloud-engineer.toml +5 -3
  256. package/templates/.agents/config/clients/codex/agents/zaip-agent-data-analyst.toml +3 -1
  257. package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +7 -4
  258. package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +1 -1
  259. package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +9 -6
  260. package/templates/.agents/config/clients/codex/agents/zaip-agent-general-operations.toml +3 -1
  261. package/templates/.agents/config/clients/codex/agents/zaip-agent-governance-compliance.toml +3 -1
  262. package/templates/.agents/config/clients/codex/agents/zaip-agent-growth-strategist.toml +3 -1
  263. package/templates/.agents/config/clients/codex/agents/zaip-agent-integrator.toml +1 -1
  264. package/templates/.agents/config/clients/codex/agents/zaip-agent-marketing-analyst.toml +5 -3
  265. package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +4 -4
  266. package/templates/.agents/config/clients/codex/agents/zaip-agent-refactoring-specialist.toml +3 -1
  267. package/templates/.agents/config/clients/codex/agents/zaip-agent-reviewer.toml +3 -3
  268. package/templates/.agents/config/clients/codex/agents/zaip-agent-sales-specialist.toml +3 -1
  269. package/templates/.agents/config/clients/codex/agents/zaip-agent-security-auditor.toml +1 -1
  270. package/templates/.agents/config/clients/codex/agents/zaip-agent-task-executor.toml +6 -3
  271. package/templates/.agents/config/clients/codex/agents/zaip-agent-website-developer.toml +7 -4
  272. package/templates/.agents/config/clients/codex/agents/zaip-agent-writer.toml +3 -1
  273. package/templates/.agents/config/project.yaml +7 -2
  274. package/templates/.agents/dashboard/.zaip-managed.json +326 -146
  275. package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-DZ2mnR6k.js +1 -0
  276. package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-BQOQCvcJ.js → DashboardHelpDialog-DnxpHJSo.js} +20 -10
  277. package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-CGET1J8Q.js → PricingSettingsDialog-DsFTUwhL.js} +1 -1
  278. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-86kLUrXm.js +3 -0
  279. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-Bw6xnXUN.js → TraceabilityWorkspace-BZ1rH1vl.js} +1 -1
  280. package/templates/.agents/dashboard/apps/frontend/dist/assets/{cost-monitor-C2AFYBu_.css → cost-monitor-BESDS3aE.css} +1 -1
  281. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-YfoKMzCQ.js +59 -0
  282. package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-BZf8HWmm.js → dashboard-localization-BVBhiAAS.js} +3 -1
  283. package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-CjGGux6h.js → icons-vendor-DSdQAua1.js} +1 -1
  284. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-4cl5FQBn.css +1 -0
  285. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-C4uiRYHu.js +2 -0
  286. package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-B9jZSAKf.js → react-vendor-rGvJzdn5.js} +1 -1
  287. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-DFY7ZDlu.css → traceability-s5SzQnzt.css} +1 -1
  288. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-vQx9R6BQ.js +1 -0
  289. package/templates/.agents/dashboard/apps/frontend/dist/index.html +9 -8
  290. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-fixture.mjs +117 -0
  291. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-lab.mjs +246 -0
  292. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-receipt.mjs +65 -0
  293. package/templates/.agents/dashboard/apps/frontend/index.html +1 -0
  294. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  295. package/templates/.agents/dashboard/apps/frontend/playwright.dom.config.ts +2 -2
  296. package/templates/.agents/dashboard/apps/frontend/src/AppLoadingPanels.tsx +10 -7
  297. package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +22 -19
  298. package/templates/.agents/dashboard/apps/frontend/src/CostCalculationGuidePage.tsx +16 -117
  299. package/templates/.agents/dashboard/apps/frontend/src/CostCharts.percentages.test.tsx +75 -0
  300. package/templates/.agents/dashboard/apps/frontend/src/CostTelemetryGuide.tsx +36 -0
  301. package/templates/.agents/dashboard/apps/frontend/src/DashboardToast.tsx +9 -0
  302. package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.dom.test.ts +1 -1
  303. package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +1 -0
  304. package/templates/.agents/dashboard/apps/frontend/src/ReconciliationFeedback.dom.test.ts +1 -1
  305. package/templates/.agents/dashboard/apps/frontend/src/ReconciliationFeedback.tsx +22 -19
  306. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.dom.e2e.ts +5 -2
  307. package/templates/.agents/dashboard/apps/frontend/src/WorkspaceStatus.dom.test.ts +86 -0
  308. package/templates/.agents/dashboard/apps/frontend/src/WorkspaceStatus.test.tsx +44 -0
  309. package/templates/.agents/dashboard/apps/frontend/src/WorkspaceStatus.tsx +37 -12
  310. package/templates/.agents/dashboard/apps/frontend/src/cost-guide-calculations.ts +118 -0
  311. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-sqlite-view.ts +3 -0
  312. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +15 -31
  313. package/templates/.agents/dashboard/apps/frontend/src/dashboard-http-transport.ts +30 -0
  314. package/templates/.agents/dashboard/apps/frontend/src/dashboard-runtime-status.ts +8 -1
  315. package/templates/.agents/dashboard/apps/frontend/src/main.tsx +1 -0
  316. package/templates/.agents/dashboard/apps/frontend/src/project-settings-model.ts +2 -0
  317. package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +17 -0
  318. package/templates/.agents/dashboard/apps/frontend/src/release-delivery.test.tsx +78 -0
  319. package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +0 -20
  320. package/templates/.agents/dashboard/apps/frontend/src/snapshot-observer.test.ts +112 -0
  321. package/templates/.agents/dashboard/apps/frontend/src/snapshot-observer.ts +147 -0
  322. package/templates/.agents/dashboard/apps/frontend/src/sqlite-compact-cost-adapter.ts +100 -0
  323. package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.test.ts +20 -0
  324. package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.ts +15 -0
  325. package/templates/.agents/dashboard/apps/frontend/src/styles-pricing.css +265 -0
  326. package/templates/.agents/dashboard/apps/frontend/src/styles.css +21 -265
  327. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +35 -0
  328. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +11 -87
  329. package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +26 -199
  330. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.navigation.test.tsx +1 -1
  331. package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.test.ts +65 -0
  332. package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.ts +17 -1
  333. package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +2 -2
  334. package/templates/.agents/dashboard/apps/frontend/src/use-operations-detail-export.ts +10 -0
  335. package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.dom.test.ts +108 -0
  336. package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.ts +18 -8
  337. package/templates/.agents/dashboard/apps/frontend/src/workspace-status.css +42 -0
  338. package/templates/.agents/dashboard/apps/frontend/vite.config.ts +1 -1
  339. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  340. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +11 -10
  341. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +39 -15
  342. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.test.ts +27 -0
  343. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.tsx +89 -83
  344. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.tsx +14 -24
  345. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +1 -27
  346. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +12 -63
  347. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.availability.test.ts +60 -0
  348. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +1 -15
  349. package/templates/.agents/dashboard/modules/cost-monitor/src/react/compact-cost-export-source.ts +85 -0
  350. package/templates/.agents/dashboard/modules/cost-monitor/src/react/compact-cost-page-range.test.ts +34 -0
  351. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-chart-presentation.ts +74 -0
  352. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-charts.css +117 -0
  353. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-group-table-totals.ts +29 -0
  354. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-export-sources.ts +19 -0
  355. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-state.ts +27 -0
  356. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor.css +6 -117
  357. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +3 -1
  358. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +9 -32
  359. package/templates/.agents/dashboard/modules/cost-monitor/src/server/cost-summary-metrics.ts +33 -0
  360. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  361. package/templates/.agents/dashboard/modules/operations/src/react/OperationsLocaleMenu.tsx +58 -0
  362. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewTopPanel.navigation.test.tsx +1 -1
  363. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +16 -47
  364. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.navigation.test.ts +1 -1
  365. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +4 -100
  366. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +25 -89
  367. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportColumns.ts +1 -0
  368. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportDuration.test.ts +105 -0
  369. package/templates/.agents/dashboard/modules/operations/src/react/export/export-duration-rows.ts +91 -0
  370. package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +4 -0
  371. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  372. package/templates/.agents/dashboard/modules/traceability/src/contracts.ts +11 -0
  373. package/templates/.agents/dashboard/modules/traceability/src/react/ReleaseDeliveryPanel.tsx +60 -0
  374. package/templates/.agents/dashboard/modules/traceability/src/react/TaskTracePanel.tsx +9 -57
  375. package/templates/.agents/dashboard/modules/traceability/src/react/release-delivery-panel.css +26 -0
  376. package/templates/.agents/dashboard/modules/traceability/src/react/trace-date-format.ts +33 -0
  377. package/templates/.agents/dashboard/modules/traceability/src/react/trace-stage-labels.ts +28 -0
  378. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  379. package/templates/.agents/dashboard/packages/contracts/package.json +2 -2
  380. package/templates/.agents/dashboard/packages/contracts/src/export.ts +2 -0
  381. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  382. package/templates/.agents/dashboard/packages/data-export/src/index.test.ts +30 -0
  383. package/templates/.agents/dashboard/packages/data-export/src/index.ts +10 -0
  384. package/templates/.agents/dashboard/packages/data-export/src/ooxml-stream.ts +50 -3
  385. package/templates/.agents/dashboard/packages/local-runtime/DIAGNOSTICS.md +2 -1
  386. package/templates/.agents/dashboard/packages/local-runtime/dashboard-build-fingerprint.mjs +1 -1
  387. package/templates/.agents/dashboard/packages/local-runtime/dashboard-diagnostics.mjs +4 -2
  388. package/templates/.agents/dashboard/packages/local-runtime/dashboard-diagnostics.test.mjs +1 -1
  389. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +310 -264
  390. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +266 -222
  391. package/templates/.agents/dashboard/packages/local-runtime/package.json +3 -3
  392. package/templates/.agents/dashboard/packages/local-runtime/scripts/verify-dashboard-executable-startup.mjs +4 -1
  393. package/templates/.agents/dashboard/packages/local-runtime/scripts/verify-dashboard-reconciliation-executable.mjs +4 -4
  394. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +310 -264
  395. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.test.ts +51 -0
  396. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +15 -1
  397. package/templates/.agents/dashboard/packages/local-runtime/src/dashboard-diagnostics.test.ts +1 -1
  398. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +3 -40
  399. package/templates/.agents/dashboard/packages/local-runtime/src/project-stack-labels.ts +40 -0
  400. package/templates/.agents/dashboard/packages/local-runtime/src/retained-worktree-capture.ts +81 -0
  401. package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +11 -2
  402. package/templates/.agents/dashboard/packages/local-runtime/src/server-hono-security.test.ts +40 -0
  403. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-routes.ts +33 -14
  404. package/templates/.agents/dashboard/packages/local-runtime/src/server-project-settings-routes.test.ts +83 -0
  405. package/templates/.agents/dashboard/packages/local-runtime/src/server-project-settings-routes.ts +41 -0
  406. package/templates/.agents/dashboard/packages/local-runtime/src/server-projections.ts +3 -19
  407. package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-diagnostics.test.ts +2 -2
  408. package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +61 -0
  409. package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-route.ts +2 -2
  410. package/templates/.agents/dashboard/packages/local-runtime/src/server-release-receipt.ts +71 -0
  411. package/templates/.agents/dashboard/packages/local-runtime/src/server-run-range.ts +18 -0
  412. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.ts +3 -36
  413. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-worker-receipt.ts +38 -0
  414. package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-release-delivery.ts +120 -0
  415. package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +5 -4
  416. package/templates/.agents/dashboard/packages/local-runtime/src/server-work-priority-route.ts +18 -0
  417. package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +1 -0
  418. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +6 -32
  419. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-summary-rollup.ts +47 -0
  420. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-financial-consistency.test.ts +133 -0
  421. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-financial-entity-page.ts +159 -0
  422. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-incremental-refresh.test.ts +12 -2
  423. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.ts +17 -0
  424. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-operation-pages.ts +71 -0
  425. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +5 -40
  426. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-temporal-dimension.ts +29 -7
  427. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-view-page.ts +7 -55
  428. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-every-root-execution-day-returns.test.ts +16 -24
  429. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-fixture.test-support.ts +27 -5
  430. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-filesystem.ts +20 -37
  431. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-keeps-orphan-telemetry-out-kanban-without.test.ts +9 -9
  432. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-marks-token-cost-telemetry-unavailable-when.test.ts +3 -3
  433. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider.test.ts +14 -20
  434. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuilds-disposable-snapshot-serves-zaip-records.test.ts +11 -1
  435. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +1 -1
  436. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-work-financial-summary.ts +38 -0
  437. package/templates/.agents/dashboard/packages/local-runtime/src/telemetry-reconciliation.integration.test.ts +223 -0
  438. package/templates/.agents/dashboard/packages/local-runtime/src/work-priority-contract.test.ts +5 -5
  439. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.test.mjs +59 -3
  440. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  441. package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +1 -1
  442. package/templates/.agents/dashboard/packages/windows-launcher/build-dashboard-launcher.ps1 +1 -1
  443. package/templates/.agents/dashboard/stack-dependencies.json +3 -3
  444. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  445. package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +1 -0
  446. package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +11 -15
  447. package/templates/.agents/dashboard/tests/e2e/specs/work-board-hydration.ts +40 -11
  448. package/templates/.agents/dashboard/zaip-dashboard-windows.exe +0 -0
  449. package/templates/.agents/design/.zaip-managed.json +498 -54
  450. package/templates/.agents/design/apps/catalog/dist/assets/index-BH6Fxbj0.css +1 -0
  451. package/templates/.agents/design/apps/catalog/dist/assets/index-BK0aBll9.css +1 -0
  452. package/templates/.agents/design/apps/catalog/dist/assets/index-Bzhb1wb_.js +76 -0
  453. package/templates/.agents/design/apps/catalog/dist/assets/index-CB-MTaWq.js +76 -0
  454. package/templates/.agents/design/apps/catalog/dist/assets/index-CIqfUcy8.js +76 -0
  455. package/templates/.agents/design/apps/catalog/dist/assets/index-Ccq-NOLA.js +76 -0
  456. package/templates/.agents/design/apps/catalog/dist/assets/index-Ch2eyD9C.js +76 -0
  457. package/templates/.agents/design/apps/catalog/dist/assets/index-Cy64ytQr.js +67 -0
  458. package/templates/.agents/design/apps/catalog/dist/assets/index-DfxEbFlq.js +76 -0
  459. package/templates/.agents/design/apps/catalog/dist/assets/index-Dqt6mTvD.js +76 -0
  460. package/templates/.agents/design/apps/catalog/dist/assets/index-rz8gOc0a.js +76 -0
  461. package/templates/.agents/design/apps/catalog/dist/index.html +2 -2
  462. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{CatalogShell-BJ8b4xZr.js → CatalogShell-D2YyQQrT.js} +1 -1
  463. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{Color-6AOWCN3U-CQLHzznn.js → Color-6AOWCN3U-BmCuNXMg.js} +1 -1
  464. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-DF9KC_gA.js +158 -0
  465. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DashboardFilters.stories-D17Q1egS.js +5 -0
  466. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DashboardFiltersSpecimen-CEBrLT2k.js +1 -0
  467. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{DesignSystem.stories-ED52wFjY.js → DesignSystem.stories-BibuRt_c.js} +1 -1
  468. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{DocsRenderer-JROSPFPF-BcLgM80v.js → DocsRenderer-JROSPFPF-GkfL8_gG.js} +4 -4
  469. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Maker.stories-Dv9Keun_.js +13 -0
  470. package/templates/.agents/design/apps/catalog/dist/storybook/assets/MakerSpecimen-DGwAKRi9.css +1 -0
  471. package/templates/.agents/design/apps/catalog/dist/storybook/assets/MakerSpecimen-mkkuFOp_.js +5 -0
  472. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{Primitives-DV6Bpudf.js → Primitives-n1UqmNvo.js} +1 -1
  473. package/templates/.agents/design/apps/catalog/dist/storybook/assets/ReconciliationSpecimen-BJnfyyG3.js +1 -0
  474. package/templates/.agents/design/apps/catalog/dist/storybook/assets/ReconciliationSpecimen.stories-CH-GF9Rk.js +13 -0
  475. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{WithTooltip-7X4HQR7L-BKNiAz_E.js → WithTooltip-7X4HQR7L-BPXo6OoG.js} +1 -1
  476. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{WorkspaceStatus.stories-BL19HGOo.js → WorkspaceStatus.stories-Cie1f_yU.js} +1 -1
  477. package/templates/.agents/design/apps/catalog/dist/storybook/assets/WorkspaceStatusSpecimen-GcYWBBSp.js +1 -0
  478. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{chunk-DRQKCCAG-DZBcXL-p.js → chunk-DRQKCCAG-Cn4_bvJJ.js} +1 -1
  479. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{chunk-W22LQPXL-CF3y2mfo.js → chunk-W22LQPXL-CQrULeB4.js} +1 -1
  480. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{components-BVjxMRGq.js → components-uiaDZHE7.js} +5 -5
  481. package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-DfjRffT7.js +1 -0
  482. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{iframe-CTWGZcEe.js → iframe-BgEb-d5o.js} +4 -4
  483. package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-D1JaPXfV.css +1 -0
  484. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{react-18-B9_a4mHb.js → react-18-BZ-Ne01c.js} +1 -1
  485. package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-CwpjKEyW.js +1 -0
  486. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{syntaxhighlighter-YFXUGROL-F_p8E2xc.js → syntaxhighlighter-YFXUGROL-BvuP8St2.js} +1 -1
  487. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{theming-fbSD9ZLF.js → theming-BGScn6Yf.js} +1 -1
  488. package/templates/.agents/design/apps/catalog/dist/storybook/iframe.html +2 -2
  489. package/templates/.agents/design/apps/catalog/dist/storybook/index.json +1 -1
  490. package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/a11y-2/manager-bundle.js +3 -3
  491. package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/docs-1/manager-bundle.js +4 -4
  492. package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +3 -3
  493. package/templates/.agents/design/apps/catalog/package.json +2 -2
  494. package/templates/.agents/design/apps/catalog/src/components/WorkspaceStatusSpecimen.tsx +32 -1
  495. package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +14 -3
  496. package/templates/.agents/design/apps/catalog/src/specimens/MAKER-HANDOFF.md +134 -0
  497. package/templates/.agents/design/apps/catalog/src/specimens/MakerSpecimen.test.tsx +143 -0
  498. package/templates/.agents/design/apps/catalog/src/specimens/MakerSpecimen.tsx +132 -0
  499. package/templates/.agents/design/apps/catalog/src/specimens/maker-fixtures.d.ts +15 -0
  500. package/templates/.agents/design/apps/catalog/src/specimens/maker-fixtures.js +86 -0
  501. package/templates/.agents/design/apps/catalog/src/specimens/maker-native.d.ts +1 -0
  502. package/templates/.agents/design/apps/catalog/src/specimens/maker-native.js +332 -0
  503. package/templates/.agents/design/apps/catalog/src/stories/Maker.stories.tsx +24 -0
  504. package/templates/.agents/design/apps/catalog/src/stories/WorkspaceStatus.stories.tsx +1 -0
  505. package/templates/.agents/design/apps/catalog/src/styles/maker-specimen.css +285 -0
  506. package/templates/.agents/design/design-system-maker/API.md +468 -0
  507. package/templates/.agents/design/design-system-maker/NOTICE.md +13 -0
  508. package/templates/.agents/design/design-system-maker/README.md +138 -0
  509. package/templates/.agents/design/design-system-maker/SOURCE-PROVENANCE.json +62 -0
  510. package/templates/.agents/design/design-system-maker/build.json +539 -0
  511. package/templates/.agents/design/design-system-maker/frontend/ADAPTATION.md +351 -0
  512. package/templates/.agents/design/design-system-maker/frontend/MAKER-REPAIR-HANDOFF.md +134 -0
  513. package/templates/.agents/design/design-system-maker/frontend/advanced/examples.js +30 -0
  514. package/templates/.agents/design/design-system-maker/frontend/advanced/index.html +75 -0
  515. package/templates/.agents/design/design-system-maker/frontend/advanced/index.js +30 -0
  516. package/templates/.agents/design/design-system-maker/frontend/catalog/filters.js +132 -0
  517. package/templates/.agents/design/design-system-maker/frontend/catalog/index.html +17 -0
  518. package/templates/.agents/design/design-system-maker/frontend/catalog/index.js +82 -0
  519. package/templates/.agents/design/design-system-maker/frontend/generate.html +74 -0
  520. package/templates/.agents/design/design-system-maker/frontend/generate.js +226 -0
  521. package/templates/.agents/design/design-system-maker/frontend/shared/api.js +112 -0
  522. package/templates/.agents/design/design-system-maker/frontend/shared/components.js +200 -0
  523. package/templates/.agents/design/design-system-maker/frontend/shared/diagnostic-view.js +218 -0
  524. package/templates/.agents/design/design-system-maker/frontend/shared/extraction-state.js +38 -0
  525. package/templates/.agents/design/design-system-maker/frontend/shared/failure-view.js +54 -0
  526. package/templates/.agents/design/design-system-maker/frontend/shared/frontend-scenarios-2.test.mjs +138 -0
  527. package/templates/.agents/design/design-system-maker/frontend/shared/frontend.test.mjs +357 -0
  528. package/templates/.agents/design/design-system-maker/frontend/shared/job-view.js +81 -0
  529. package/templates/.agents/design/design-system-maker/frontend/shared/model-hydration.js +26 -0
  530. package/templates/.agents/design/design-system-maker/frontend/shared/model.js +103 -0
  531. package/templates/.agents/design/design-system-maker/frontend/shared/palette-evidence.js +106 -0
  532. package/templates/.agents/design/design-system-maker/frontend/shared/palette-evidence.test.mjs +210 -0
  533. package/templates/.agents/design/design-system-maker/frontend/shared/palette-view.js +149 -0
  534. package/templates/.agents/design/design-system-maker/frontend/shared/preview.test.mjs +263 -0
  535. package/templates/.agents/design/design-system-maker/frontend/shared/report-view.js +267 -0
  536. package/templates/.agents/design/design-system-maker/frontend/shared/reprocess-dialog.js +192 -0
  537. package/templates/.agents/design/design-system-maker/frontend/shared/specimens.js +231 -0
  538. package/templates/.agents/design/design-system-maker/frontend/shared/viewer-actions.js +78 -0
  539. package/templates/.agents/design/design-system-maker/frontend/shared/viewer-detail.js +121 -0
  540. package/templates/.agents/design/design-system-maker/frontend/shared/viewer-summary.js +91 -0
  541. package/templates/.agents/design/design-system-maker/frontend/shared/visual-model.js +255 -0
  542. package/templates/.agents/design/design-system-maker/frontend/styles/advanced.css +128 -0
  543. package/templates/.agents/design/design-system-maker/frontend/styles/base.css +318 -0
  544. package/templates/.agents/design/design-system-maker/frontend/styles/catalog-filters.css +114 -0
  545. package/templates/.agents/design/design-system-maker/frontend/styles/diagnostic.css +298 -0
  546. package/templates/.agents/design/design-system-maker/frontend/styles/layout.css +320 -0
  547. package/templates/.agents/design/design-system-maker/frontend/styles/maker.css +7 -0
  548. package/templates/.agents/design/design-system-maker/frontend/styles/report.css +173 -0
  549. package/templates/.agents/design/design-system-maker/frontend/styles/reprocess-dialog.css +34 -0
  550. package/templates/.agents/design/design-system-maker/frontend/styles/specimen-foundations.css +363 -0
  551. package/templates/.agents/design/design-system-maker/frontend/styles/specimens.css +59 -0
  552. package/templates/.agents/design/design-system-maker/frontend/styles/viewer-summary.css +308 -0
  553. package/templates/.agents/design/design-system-maker/frontend/viewer/diagnostic.html +3 -0
  554. package/templates/.agents/design/design-system-maker/frontend/viewer/index.html +8 -0
  555. package/templates/.agents/design/design-system-maker/frontend/viewer/index.js +233 -0
  556. package/templates/.agents/design/design-system-maker/frontend/viewer/preview.html +3 -0
  557. package/templates/.agents/design/design-system-maker/frontend/viewer/specimen.js +88 -0
  558. package/templates/.agents/design/design-system-maker/launcher/Program.cs +117 -0
  559. package/templates/.agents/design/design-system-maker/runtime/chat-cli.mjs +27 -0
  560. package/templates/.agents/design/design-system-maker/runtime/chat-client.mjs +170 -0
  561. package/templates/.agents/design/design-system-maker/runtime/chat-contract.mjs +13 -0
  562. package/templates/.agents/design/design-system-maker/runtime/collection.mjs +269 -0
  563. package/templates/.agents/design/design-system-maker/runtime/contracts.mjs +383 -0
  564. package/templates/.agents/design/design-system-maker/runtime/design-codes.mjs +46 -0
  565. package/templates/.agents/design/design-system-maker/runtime/design-compose.mjs +118 -0
  566. package/templates/.agents/design/design-system-maker/runtime/design-markdown.mjs +154 -0
  567. package/templates/.agents/design/design-system-maker/runtime/import.mjs +137 -0
  568. package/templates/.agents/design/design-system-maker/runtime/io.mjs +121 -0
  569. package/templates/.agents/design/design-system-maker/runtime/job-progress.mjs +50 -0
  570. package/templates/.agents/design/design-system-maker/runtime/json-tokens.mjs +88 -0
  571. package/templates/.agents/design/design-system-maker/runtime/launch-identity.mjs +100 -0
  572. package/templates/.agents/design/design-system-maker/runtime/launch-protocol.mjs +88 -0
  573. package/templates/.agents/design/design-system-maker/runtime/launch-server.mjs +51 -0
  574. package/templates/.agents/design/design-system-maker/runtime/launch.mjs +107 -0
  575. package/templates/.agents/design/design-system-maker/runtime/local-actions.mjs +184 -0
  576. package/templates/.agents/design/design-system-maker/runtime/local-artifacts.mjs +228 -0
  577. package/templates/.agents/design/design-system-maker/runtime/local-request.mjs +100 -0
  578. package/templates/.agents/design/design-system-maker/runtime/lock.mjs +23 -0
  579. package/templates/.agents/design/design-system-maker/runtime/presentation.mjs +107 -0
  580. package/templates/.agents/design/design-system-maker/runtime/repository-source.mjs +200 -0
  581. package/templates/.agents/design/design-system-maker/runtime/reprocess-mode.mjs +17 -0
  582. package/templates/.agents/design/design-system-maker/runtime/request-contracts.mjs +121 -0
  583. package/templates/.agents/design/design-system-maker/runtime/serve.mjs +53 -0
  584. package/templates/.agents/design/design-system-maker/runtime/server.mjs +363 -0
  585. package/templates/.agents/design/design-system-maker/runtime/service-actions.mjs +59 -0
  586. package/templates/.agents/design/design-system-maker/runtime/service-host.mjs +32 -0
  587. package/templates/.agents/design/design-system-maker/runtime/service-projections.mjs +87 -0
  588. package/templates/.agents/design/design-system-maker/runtime/service.mjs +393 -0
  589. package/templates/.agents/design/design-system-maker/runtime/stop.mjs +38 -0
  590. package/templates/.agents/design/design-system-maker/runtime/trash.mjs +95 -0
  591. package/templates/.agents/design/design-system-maker/zaip-design-system-maker.exe +0 -0
  592. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  593. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  594. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +9 -7
  595. package/templates/.agents/requirements/comparative-audit.md +1 -1
  596. package/templates/.agents/requirements/context-engine.md +1 -1
  597. package/templates/.agents/requirements/cost-observability.md +3 -3
  598. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  599. package/templates/.agents/requirements/data-export.md +1 -1
  600. package/templates/.agents/requirements/design-system.md +1 -1
  601. package/templates/.agents/requirements/execution-engine.md +1 -1
  602. package/templates/.agents/requirements/kanban-dashboard.md +3 -3
  603. package/templates/.agents/requirements/landing-page-forms.md +39 -0
  604. package/templates/.agents/requirements/model-orchestration.md +1 -1
  605. package/templates/.agents/requirements/public-distribution.md +4 -4
  606. package/templates/.agents/requirements/site-performance.md +41 -0
  607. package/templates/.agents/requirements/software-architecture.md +1 -1
  608. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  609. package/templates/.agents/requirements/work-lifecycle.md +1 -1
  610. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  611. package/templates/.agents/rules/autonomy-decision.md +4 -1
  612. package/templates/.agents/rules/cloud-hostinger-autonomy.md +4 -1
  613. package/templates/.agents/rules/core.md +5 -2
  614. package/templates/.agents/rules/framework-maintenance.md +34 -0
  615. package/templates/.agents/rules/frontend-lite.md +2 -1
  616. package/templates/.agents/rules/github-deploy-auth.md +18 -0
  617. package/templates/.agents/rules/infisical-secrets.md +20 -0
  618. package/templates/.agents/rules/landing-page-forms.md +28 -0
  619. package/templates/.agents/rules/lead-measurement.md +20 -0
  620. package/templates/.agents/rules/local-sqlite-storage.md +2 -2
  621. package/templates/.agents/rules/local-state-storage.md +15 -0
  622. package/templates/.agents/rules/production-readiness.md +1 -1
  623. package/templates/.agents/rules/quality-assurance.md +36 -0
  624. package/templates/.agents/rules/repository-responsibility.md +38 -0
  625. package/templates/.agents/rules/security.md +1 -1
  626. package/templates/.agents/rules/site-performance.md +29 -0
  627. package/templates/.agents/rules/website-quality.md +31 -0
  628. package/templates/.agents/rules/workflow.md +1 -1
  629. package/templates/.agents/runtime/VERSION +1 -1
  630. package/templates/.agents/runtime/bin/historical-catalog-b6b6516200bdb412c92063e887ccef329d7c5193b5610cba5346e97c71301394.mjs +318 -0
  631. package/templates/.agents/runtime/bin/zaip.mjs +2262 -768
  632. package/templates/.agents/runtime/checksums.sha256 +7 -6
  633. package/templates/.agents/runtime/manifest.json +2 -1
  634. package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
  635. package/templates/.agents/runtime/provenance.json +5 -5
  636. package/templates/.agents/runtime/sbom.cdx.json +7 -7
  637. package/templates/.agents/skills/criar-pasta-obsidian/SKILL.md +2 -2
  638. package/templates/.agents/skills/criar-pasta-obsidian/scripts/generate-obsidian-vault.mjs +7 -24
  639. package/templates/.agents/skills/criar-pasta-obsidian/scripts/generate-obsidian-vault.test.mjs +4 -2
  640. package/templates/.agents/skills/criar-pasta-obsidian/scripts/obsidian-format.mjs +20 -0
  641. package/templates/.agents/skills/zaip-skill-adapters/SKILL.md +6 -0
  642. package/templates/.agents/skills/zaip-skill-application-observability/references/lead-measurement.md +52 -0
  643. package/templates/.agents/skills/zaip-skill-architecture-design/SKILL.md +3 -1
  644. package/templates/.agents/skills/zaip-skill-auth-tenancy/references/lead-measurement.md +42 -0
  645. package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +1 -1
  646. package/templates/.agents/skills/zaip-skill-author-skills/references/engineering-skill-index.md +4 -0
  647. package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +3 -0
  648. package/templates/.agents/skills/zaip-skill-author-skills/scripts/run-skill-tests.mjs +37 -7
  649. package/templates/.agents/skills/zaip-skill-author-skills/scripts/skill-test-plan.mjs +79 -0
  650. package/templates/.agents/skills/zaip-skill-author-skills/scripts/skill-test-plan.test.mjs +47 -0
  651. package/templates/.agents/skills/zaip-skill-backend/SKILL.md +2 -0
  652. package/templates/.agents/skills/zaip-skill-backend/references/deployment-environments.md +2 -2
  653. package/templates/.agents/skills/zaip-skill-change/references/observable-evidence.md +3 -3
  654. package/templates/.agents/skills/zaip-skill-cloud-engineering/SKILL.md +2 -0
  655. package/templates/.agents/skills/zaip-skill-cloudflare-access-setup/SKILL.md +16 -0
  656. package/templates/.agents/skills/zaip-skill-cloudflare-access-setup/agents/openai.yaml +4 -0
  657. package/templates/.agents/skills/zaip-skill-cloudflare-access-setup/references/account-token.md +90 -0
  658. package/templates/.agents/skills/zaip-skill-cloudflare-access-setup/scripts/preview-access.mjs +91 -0
  659. package/templates/.agents/skills/zaip-skill-cloudflare-access-setup/scripts/preview-access.test.mjs +44 -0
  660. package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/SKILL.md +4 -2
  661. package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workers-static-assets.md +1 -1
  662. package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workflow-templates.md +5 -5
  663. package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/scripts/cloudflare-github-deploy-contract.test.mjs +24 -5
  664. package/templates/.agents/skills/zaip-skill-config/SKILL.md +33 -8
  665. package/templates/.agents/skills/zaip-skill-config/agents/openai.yaml +2 -2
  666. package/templates/.agents/skills/zaip-skill-config/references/repository-profiles.md +83 -0
  667. package/templates/.agents/skills/zaip-skill-dashboard-sqlite/SKILL.md +2 -2
  668. package/templates/.agents/skills/zaip-skill-data-modeling/references/lead-measurement.md +37 -0
  669. package/templates/.agents/skills/zaip-skill-database-migrations/references/lead-measurement.md +35 -0
  670. package/templates/.agents/skills/zaip-skill-decisions/SKILL.md +1 -0
  671. package/templates/.agents/skills/zaip-skill-deployment-pipeline/SKILL.md +11 -0
  672. package/templates/.agents/skills/zaip-skill-design-maker/SKILL.md +28 -0
  673. package/templates/.agents/skills/zaip-skill-design-maker/agents/openai.yaml +4 -0
  674. package/templates/.agents/skills/zaip-skill-design-maker/references/chat-contract.md +46 -0
  675. package/templates/.agents/skills/zaip-skill-design-maker/references/compose.md +20 -0
  676. package/templates/.agents/skills/zaip-skill-design-maker/references/markdown.md +26 -0
  677. package/templates/.agents/skills/zaip-skill-design-maker/references/repository.md +24 -0
  678. package/templates/.agents/skills/zaip-skill-design-maker/references/url.md +24 -0
  679. package/templates/.agents/skills/zaip-skill-design-redesign/SKILL.md +41 -0
  680. package/templates/.agents/skills/zaip-skill-design-redesign/agents/openai.yaml +6 -0
  681. package/templates/.agents/skills/zaip-skill-design-reproduction/SKILL.md +47 -0
  682. package/templates/.agents/skills/zaip-skill-design-reproduction/agents/openai.yaml +6 -0
  683. package/templates/.agents/skills/zaip-skill-design-system/SKILL.md +6 -0
  684. package/templates/.agents/skills/zaip-skill-design-url-extraction/SKILL.md +50 -0
  685. package/templates/.agents/skills/zaip-skill-design-url-extraction/agents/openai.yaml +6 -0
  686. package/templates/.agents/skills/zaip-skill-design-url-extraction/references/capture-example.json +11 -0
  687. package/templates/.agents/skills/zaip-skill-design-url-extraction/references/runtime-workflow.md +127 -0
  688. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/SKILL.md +3 -1
  689. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.mjs +2 -1
  690. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-lease.mjs +3 -1
  691. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-storage.mjs +40 -0
  692. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-storage.test.mjs +87 -0
  693. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/scheduled-ready-queue-contract.test.mjs +1 -1
  694. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +11 -3
  695. package/templates/.agents/skills/zaip-skill-execution/references/autonomous-continuation.md +2 -0
  696. package/templates/.agents/skills/zaip-skill-execution/references/controlled-release-recovery.md +10 -4
  697. package/templates/.agents/skills/zaip-skill-execution/references/conversation-promotion.md +38 -0
  698. package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +3 -1
  699. package/templates/.agents/skills/zaip-skill-external-integrations/SKILL.md +2 -0
  700. package/templates/.agents/skills/zaip-skill-external-integrations/references/kommo.md +71 -0
  701. package/templates/.agents/skills/zaip-skill-figma-setup/SKILL.md +42 -0
  702. package/templates/.agents/skills/zaip-skill-figma-setup/agents/openai.yaml +6 -0
  703. package/templates/.agents/skills/zaip-skill-figma-setup/references/capability-contract.json +40 -0
  704. package/templates/.agents/skills/zaip-skill-figma-setup/references/figma-connection.md +60 -0
  705. package/templates/.agents/skills/zaip-skill-figma-setup/references/figma-handoff.md +71 -0
  706. package/templates/.agents/skills/zaip-skill-frontend/SKILL.md +30 -1
  707. package/templates/.agents/skills/zaip-skill-frontend-data-flows/SKILL.md +3 -0
  708. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +38 -5
  709. package/templates/.agents/skills/zaip-skill-github-deploy/references/authentication.md +15 -0
  710. package/templates/.agents/skills/zaip-skill-github-deploy/references/authorization.md +35 -0
  711. package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +21 -3
  712. package/templates/.agents/skills/zaip-skill-github-deploy/references/literal-read-sequence.md +28 -0
  713. package/templates/.agents/skills/zaip-skill-github-deploy/references/release-identity.md +4 -2
  714. package/templates/.agents/skills/zaip-skill-github-deploy/references/release-notes.md +4 -4
  715. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/application-content.mjs +82 -0
  716. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/application-content.test.mjs +184 -0
  717. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-publication-authority.mjs +63 -0
  718. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.mjs +42 -36
  719. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.test.mjs +4 -5
  720. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-auth.mjs +400 -0
  721. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-auth.test.mjs +192 -0
  722. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-constraints.test.mjs +159 -0
  723. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract-cli.test.mjs +32 -24
  724. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract-range.test-support.mjs +51 -0
  725. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.mjs +248 -281
  726. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.test.mjs +63 -56
  727. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-idempotent-intent.test.mjs +169 -0
  728. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-publication-intent.test.mjs +112 -5
  729. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-next-release.mjs +57 -0
  730. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-request-conditions.test.mjs +117 -0
  731. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-request-continuation.test.mjs +44 -0
  732. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-request-preservation.test.mjs +58 -0
  733. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-request.mjs +306 -0
  734. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/git-command.mjs +11 -0
  735. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/git-config-paths.mjs +10 -0
  736. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/git-destination.mjs +21 -0
  737. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/git-push-target.mjs +62 -0
  738. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/git-push-target.test.mjs +78 -0
  739. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +4 -2
  740. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/guarded-commits.mjs +132 -42
  741. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight-options.mjs +50 -0
  742. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight-worktree.test.mjs +52 -0
  743. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.mjs +70 -119
  744. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.test.mjs +11 -1
  745. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/project-restrictions.mjs +201 -0
  746. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/project-restrictions.test.mjs +154 -0
  747. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-authority-callbacks.test.mjs +46 -0
  748. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-conditions.mjs +193 -0
  749. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-intent.mjs +79 -0
  750. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-plan-binding.mjs +78 -0
  751. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-plan-refusal.mjs +30 -0
  752. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-project-policy.mjs +39 -0
  753. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-2457VC25.mjs +2 -0
  754. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-25VZXDBX.mjs +2 -0
  755. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-2JXOAZ2R.mjs +2 -0
  756. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-2OZK443Y.mjs +2 -0
  757. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-3BDTL55L.mjs +2 -0
  758. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-3MG57Y6I.mjs +2 -0
  759. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-3MQAJ6XX.mjs +2 -0
  760. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-3TUUBJPP.mjs +2 -0
  761. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-45Z34LBQ.mjs +140 -0
  762. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-4GJE2IXL.mjs +2 -0
  763. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-4HLOIRQU.mjs +2 -0
  764. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-55PSJJ75.mjs +2 -0
  765. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-5OTFTK2Y.mjs +2 -0
  766. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-7OFWNBZN.mjs +2 -0
  767. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-7R2IP55E.mjs +2 -0
  768. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-A35CQWF4.mjs +2 -0
  769. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-BC2LX3QU.mjs +2 -0
  770. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-C2Z26E6U.mjs +2 -0
  771. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-CHJGU2RU.mjs +2 -0
  772. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-CJ5ZQF6M.mjs +11 -0
  773. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-D4LGE7UI.mjs +2 -0
  774. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-D5OUJS46.mjs +2 -0
  775. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-D6RZM5OT.mjs +2 -0
  776. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-DOK2R3GV.mjs +2 -0
  777. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-EAHVOUKK.mjs +2 -0
  778. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-EQTZ3Y7R.mjs +2 -0
  779. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-FMNUSV2P.mjs +139 -0
  780. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-FZUNFGZV.mjs +2 -0
  781. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-GGBPBQ6D.mjs +2 -0
  782. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-HFDX2GP6.mjs +2 -0
  783. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-HZ2NRMAG.mjs +2 -0
  784. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-IJKPDKXC.mjs +2 -0
  785. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-JEOOTEUX.mjs +2 -0
  786. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-JF3E72HZ.mjs +2 -0
  787. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-KRHOCS3C.mjs +2 -0
  788. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-LG5MJS2A.mjs +2 -0
  789. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-LWS3QVJO.mjs +24 -0
  790. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-ML4PMB7C.mjs +2 -0
  791. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-MSCWMPU5.mjs +63 -0
  792. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-NORNV3B2.mjs +2 -0
  793. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-PBU2HSKP.mjs +2 -0
  794. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-PG6LGVVW.mjs +2 -0
  795. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-PGYGDY3J.mjs +2 -0
  796. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-QFUQW6LE.mjs +2 -0
  797. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-QI32NI7M.mjs +2 -0
  798. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-R4HD7XOO.mjs +2 -0
  799. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-REHSM3G2.mjs +2 -0
  800. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-S22YDVTM.mjs +2 -0
  801. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-S5P4ZNUQ.mjs +2 -0
  802. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-SCK2RF6V.mjs +2 -0
  803. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-SWFLYM3O.mjs +2 -0
  804. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-TA7RY5MY.mjs +2 -0
  805. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-TM5WG7GR.mjs +2 -0
  806. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-TMVJHK37.mjs +2 -0
  807. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-TPDQAH7C.mjs +2 -0
  808. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-U2KO7ULM.mjs +2 -0
  809. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-U3ISMYJU.mjs +2 -0
  810. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-UKSDAS73.mjs +2 -0
  811. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-UNTPHSZO.mjs +2 -0
  812. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-V4MIRRUB.mjs +2 -0
  813. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-WNXOXX3Z.mjs +2 -0
  814. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-WQGTDRK7.mjs +2 -0
  815. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-WZJIRYT6.mjs +2 -0
  816. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-XED4KYQL.mjs +2 -0
  817. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-XEXCFKHI.mjs +2 -0
  818. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-XJJFARY4.mjs +2 -0
  819. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-XQOFL3K3.mjs +2 -0
  820. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-YAWUSDPM.mjs +2 -0
  821. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-YEUY7TMM.mjs +2 -0
  822. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-Z5X23XXT.mjs +2 -0
  823. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-Z7H2BHYQ.mjs +2 -0
  824. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/lifecycle-records.mjs +2 -0
  825. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ar.mjs +2 -0
  826. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-az.mjs +2 -0
  827. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-be.mjs +2 -0
  828. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-bg.mjs +2 -0
  829. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-bn.mjs +2 -0
  830. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ca.mjs +2 -0
  831. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ckb.mjs +2 -0
  832. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-cs.mjs +2 -0
  833. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-da.mjs +2 -0
  834. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-de.mjs +2 -0
  835. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-el.mjs +2 -0
  836. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-en.mjs +2 -0
  837. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-eo.mjs +2 -0
  838. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-es.mjs +2 -0
  839. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-fa.mjs +2 -0
  840. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-fi.mjs +2 -0
  841. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-fr-CA.mjs +2 -0
  842. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-fr.mjs +2 -0
  843. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-gu.mjs +2 -0
  844. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-he.mjs +2 -0
  845. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-hi.mjs +2 -0
  846. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-hr.mjs +2 -0
  847. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-hu.mjs +2 -0
  848. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-hy.mjs +2 -0
  849. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-id.mjs +2 -0
  850. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-is.mjs +2 -0
  851. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-it.mjs +2 -0
  852. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ja.mjs +2 -0
  853. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ka.mjs +2 -0
  854. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-kh.mjs +2 -0
  855. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-km.mjs +2 -0
  856. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-kn.mjs +2 -0
  857. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ko.mjs +2 -0
  858. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-lt.mjs +2 -0
  859. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-mk.mjs +2 -0
  860. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ms.mjs +2 -0
  861. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ne.mjs +2 -0
  862. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-nl.mjs +2 -0
  863. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-nn.mjs +2 -0
  864. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-no.mjs +2 -0
  865. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ota.mjs +2 -0
  866. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-pl.mjs +2 -0
  867. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ps.mjs +2 -0
  868. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-pt-BR.mjs +2 -0
  869. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-pt.mjs +2 -0
  870. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ro.mjs +2 -0
  871. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ru.mjs +2 -0
  872. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-sk.mjs +2 -0
  873. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-sl.mjs +2 -0
  874. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-sv.mjs +2 -0
  875. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ta.mjs +2 -0
  876. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-tg.mjs +2 -0
  877. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-th.mjs +2 -0
  878. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-tk.mjs +2 -0
  879. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-tr.mjs +2 -0
  880. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ua.mjs +2 -0
  881. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-uk.mjs +2 -0
  882. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-ur.mjs +2 -0
  883. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-uz.mjs +2 -0
  884. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-vi.mjs +2 -0
  885. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-yo.mjs +2 -0
  886. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-zh-CN.mjs +2 -0
  887. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/locale-zh-TW.mjs +2 -0
  888. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/manifest.json +566 -0
  889. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/native-authority.mjs +2 -0
  890. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/proof.mjs +2 -0
  891. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/run-records.mjs +2 -0
  892. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/yaml-runtime.mjs +2 -0
  893. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/zod-runtime.mjs +2 -0
  894. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-schema.mjs +2 -0
  895. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof.test.mjs +79 -0
  896. package/templates/.agents/skills/zaip-skill-github-setup/SKILL.md +14 -11
  897. package/templates/.agents/skills/zaip-skill-github-setup/references/bounded-setup.md +42 -0
  898. package/templates/.agents/skills/zaip-skill-github-setup/scripts/setup.mjs +365 -0
  899. package/templates/.agents/skills/zaip-skill-github-setup-ssh-folder/SKILL.md +13 -3
  900. package/templates/.agents/skills/zaip-skill-github-setup-ssh-folder/references/operational-procedure.md +4 -4
  901. package/templates/.agents/skills/zaip-skill-google-ads-conversions/SKILL.md +18 -0
  902. package/templates/.agents/skills/zaip-skill-google-ads-conversions/agents/openai.yaml +4 -0
  903. package/templates/.agents/skills/zaip-skill-google-ads-conversions/references/implementation.md +61 -0
  904. package/templates/.agents/skills/zaip-skill-google-analytics/SKILL.md +24 -0
  905. package/templates/.agents/skills/zaip-skill-google-analytics/agents/openai.yaml +4 -0
  906. package/templates/.agents/skills/zaip-skill-google-analytics/references/implementation.md +64 -0
  907. package/templates/.agents/skills/zaip-skill-google-tag-manager/SKILL.md +24 -0
  908. package/templates/.agents/skills/zaip-skill-google-tag-manager/agents/openai.yaml +4 -0
  909. package/templates/.agents/skills/zaip-skill-google-tag-manager/references/implementation.md +71 -0
  910. package/templates/.agents/skills/zaip-skill-google-tag-manager/references/operator-checklist.md +51 -0
  911. package/templates/.agents/skills/zaip-skill-google-tag-manager/references/operator-fixtures.json +93 -0
  912. package/templates/.agents/skills/zaip-skill-google-tag-manager/scripts/check-runbook-links.mjs +103 -0
  913. package/templates/.agents/skills/zaip-skill-google-tag-manager/scripts/google-runbooks.test.mjs +247 -0
  914. package/templates/.agents/skills/zaip-skill-google-tag-manager/scripts/operator-model.mjs +221 -0
  915. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/SKILL.md +8 -2
  916. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/autonomous-cloud-inputs.example.json +3 -3
  917. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/autonomous-runner.md +4 -2
  918. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/cloudflare-agent-setup.md +23 -0
  919. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/cloudflare-dns.md +36 -0
  920. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/guia-iniciante-hostinger-vps.md +4 -4
  921. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/operational-contract.md +3 -3
  922. package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/vps-onboarding.md +97 -0
  923. package/templates/.agents/skills/zaip-skill-image-optimization/SKILL.md +31 -0
  924. package/templates/.agents/skills/zaip-skill-image-optimization/agents/openai.yaml +4 -0
  925. package/templates/.agents/skills/zaip-skill-image-optimization/references/adapters.md +36 -0
  926. package/templates/.agents/skills/zaip-skill-image-optimization/references/pipeline.md +35 -0
  927. package/templates/.agents/skills/zaip-skill-image-optimization/scripts/images.mjs +370 -0
  928. package/templates/.agents/skills/zaip-skill-image-optimization/scripts/images.test.mjs +385 -0
  929. package/templates/.agents/skills/zaip-skill-infisical/SKILL.md +20 -0
  930. package/templates/.agents/skills/zaip-skill-infisical/agents/openai.yaml +4 -0
  931. package/templates/.agents/skills/zaip-skill-infisical/assets/compose.yaml +62 -0
  932. package/templates/.agents/skills/zaip-skill-infisical/assets/terraform/infisical.tf +57 -0
  933. package/templates/.agents/skills/zaip-skill-infisical/references/credential-workflow.md +88 -0
  934. package/templates/.agents/skills/zaip-skill-infisical/references/first-initialization.md +51 -0
  935. package/templates/.agents/skills/zaip-skill-infisical/references/security-and-edition.md +19 -0
  936. package/templates/.agents/skills/zaip-skill-infisical/references/self-hosting.md +71 -0
  937. package/templates/.agents/skills/zaip-skill-infisical/references/terraform.md +54 -0
  938. package/templates/.agents/skills/zaip-skill-infisical/scripts/prepare-self-host.mjs +92 -0
  939. package/templates/.agents/skills/zaip-skill-infisical/scripts/prepare-self-host.test.mjs +69 -0
  940. package/templates/.agents/skills/zaip-skill-infisical/scripts/preview-terraform.mjs +70 -0
  941. package/templates/.agents/skills/zaip-skill-infisical/scripts/preview-terraform.test.mjs +51 -0
  942. package/templates/.agents/skills/zaip-skill-infisical/scripts/terraform-plan-integration.test.mjs +83 -0
  943. package/templates/.agents/skills/zaip-skill-landing-page-forms/SKILL.md +37 -0
  944. package/templates/.agents/skills/zaip-skill-landing-page-forms/agents/openai.yaml +4 -0
  945. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/accessibility.md +29 -0
  946. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/contact-then-qualification.example.json +83 -0
  947. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/contracts.md +70 -0
  948. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/examples.md +21 -0
  949. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/journey.md +30 -0
  950. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/multistep.example.json +84 -0
  951. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/single-screen.example.json +76 -0
  952. package/templates/.agents/skills/zaip-skill-landing-page-forms/references/verification.md +24 -0
  953. package/templates/.agents/skills/zaip-skill-landing-page-forms/scripts/validate-plan.mjs +306 -0
  954. package/templates/.agents/skills/zaip-skill-landing-page-forms/scripts/validate-plan.test.mjs +183 -0
  955. package/templates/.agents/skills/zaip-skill-lead-measurement/SKILL.md +32 -0
  956. package/templates/.agents/skills/zaip-skill-lead-measurement/agents/openai.yaml +4 -0
  957. package/templates/.agents/skills/zaip-skill-lead-measurement/references/architecture.md +51 -0
  958. package/templates/.agents/skills/zaip-skill-lead-measurement/references/authority.md +49 -0
  959. package/templates/.agents/skills/zaip-skill-lead-measurement/references/bant-contract.md +36 -0
  960. package/templates/.agents/skills/zaip-skill-lead-measurement/references/consent-contract.md +48 -0
  961. package/templates/.agents/skills/zaip-skill-lead-measurement/references/delivery-contract.md +65 -0
  962. package/templates/.agents/skills/zaip-skill-lead-measurement/references/event-contract.md +47 -0
  963. package/templates/.agents/skills/zaip-skill-lead-measurement/references/examples/escola.json +180 -0
  964. package/templates/.agents/skills/zaip-skill-lead-measurement/references/examples/moradigna-regression.json +158 -0
  965. package/templates/.agents/skills/zaip-skill-lead-measurement/references/examples/solar.json +165 -0
  966. package/templates/.agents/skills/zaip-skill-lead-measurement/references/identity-contract.md +53 -0
  967. package/templates/.agents/skills/zaip-skill-lead-measurement/references/implementation-plan.md +60 -0
  968. package/templates/.agents/skills/zaip-skill-lead-measurement/references/kommo-contract.md +83 -0
  969. package/templates/.agents/skills/zaip-skill-lead-measurement/references/meta-mapping.md +28 -0
  970. package/templates/.agents/skills/zaip-skill-lead-measurement/references/migration.md +65 -0
  971. package/templates/.agents/skills/zaip-skill-lead-measurement/references/operations.md +125 -0
  972. package/templates/.agents/skills/zaip-skill-lead-measurement/references/persistence-reference.md +65 -0
  973. package/templates/.agents/skills/zaip-skill-lead-measurement/references/questionnaire-v2.schema.json +136 -0
  974. package/templates/.agents/skills/zaip-skill-lead-measurement/references/synthetic-config.json +24 -0
  975. package/templates/.agents/skills/zaip-skill-lead-measurement/references/synthetic-event.json +19 -0
  976. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/check-questionnaire.mjs +314 -0
  977. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/check-questionnaire.test.mjs +338 -0
  978. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/consent-cases-core.mjs +144 -0
  979. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/consent-cases-privacy.mjs +183 -0
  980. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/consent-fixtures.mjs +60 -0
  981. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/consent-rollback-support.mjs +114 -0
  982. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/consent.mjs +222 -0
  983. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/consent.test.mjs +294 -0
  984. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-ledger.mjs +179 -0
  985. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2-case-fixtures.mjs +118 -0
  986. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2-cases.mjs +6 -0
  987. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2-contract-cases.mjs +218 -0
  988. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2-contract.mjs +182 -0
  989. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2-proof-support.mjs +104 -0
  990. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2-proof.mjs +272 -0
  991. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2-state-cases.mjs +248 -0
  992. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/delivery-v2.mjs +234 -0
  993. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/lead-measurement.mjs +277 -0
  994. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/lead-measurement.test.mjs +288 -0
  995. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/questionnaire-ast-cases.mjs +127 -0
  996. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/questionnaire-test-support.mjs +25 -0
  997. package/templates/.agents/skills/zaip-skill-lead-measurement/scripts/questionnaire-validation.mjs +155 -0
  998. package/templates/.agents/skills/zaip-skill-lifecycle-closure/SKILL.md +30 -2
  999. package/templates/.agents/skills/zaip-skill-lifecycle-closure/references/empty-usage-lock.md +56 -0
  1000. package/templates/.agents/skills/zaip-skill-lifecycle-closure/references/late-finalization.md +158 -0
  1001. package/templates/.agents/skills/zaip-skill-lifecycle-closure/references/local-catalog-closure.md +37 -0
  1002. package/templates/.agents/skills/zaip-skill-lifecycle-closure/references/post-publication-task-first.md +1 -1
  1003. package/templates/.agents/skills/zaip-skill-lifecycle-closure/scripts/empty-lock-native.cs +113 -0
  1004. package/templates/.agents/skills/zaip-skill-lifecycle-closure/scripts/empty-lock-native.ps1 +9 -0
  1005. package/templates/.agents/skills/zaip-skill-lifecycle-closure/scripts/recover-empty-usage-lock.mjs +194 -0
  1006. package/templates/.agents/skills/zaip-skill-local-credentials/SKILL.md +27 -0
  1007. package/templates/.agents/skills/zaip-skill-maintenance-enter/SKILL.md +8 -6
  1008. package/templates/.agents/skills/zaip-skill-maintenance-enter/scripts/maintenance.mjs +4 -4
  1009. package/templates/.agents/skills/zaip-skill-maintenance-enter/scripts/maintenance.test.mjs +2 -2
  1010. package/templates/.agents/skills/zaip-skill-maintenance-exit/SKILL.md +3 -3
  1011. package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +11 -0
  1012. package/templates/.agents/skills/zaip-skill-marketing/references/search-content.md +17 -0
  1013. package/templates/.agents/skills/zaip-skill-meta-conversions/SKILL.md +23 -0
  1014. package/templates/.agents/skills/zaip-skill-meta-conversions/agents/openai.yaml +4 -0
  1015. package/templates/.agents/skills/zaip-skill-meta-conversions/references/implementation.md +88 -0
  1016. package/templates/.agents/skills/zaip-skill-meta-conversions/references/synthetic-meta.json +27 -0
  1017. package/templates/.agents/skills/zaip-skill-meta-conversions/scripts/check-meta-links.mjs +88 -0
  1018. package/templates/.agents/skills/zaip-skill-meta-conversions/scripts/meta-model.mjs +369 -0
  1019. package/templates/.agents/skills/zaip-skill-meta-conversions/scripts/meta-model.test.mjs +394 -0
  1020. package/templates/.agents/skills/zaip-skill-performance-engineering/SKILL.md +26 -1
  1021. package/templates/.agents/skills/zaip-skill-performance-engineering/references/astro-islands.md +41 -0
  1022. package/templates/.agents/skills/zaip-skill-performance-engineering/references/controlled-runner.md +38 -0
  1023. package/templates/.agents/skills/zaip-skill-performance-engineering/references/google-diagnostics.md +46 -0
  1024. package/templates/.agents/skills/zaip-skill-performance-engineering/references/report-contract.md +99 -0
  1025. package/templates/.agents/skills/zaip-skill-performance-engineering/references/site-budgets.json +25 -0
  1026. package/templates/.agents/skills/zaip-skill-performance-engineering/references/site-performance.md +83 -0
  1027. package/templates/.agents/skills/zaip-skill-performance-engineering/references/third-party-performance.md +57 -0
  1028. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/assess-reports.mjs +42 -0
  1029. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/capture-site.mjs +155 -0
  1030. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/local-preview.mjs +84 -0
  1031. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/performance-report.mjs +142 -0
  1032. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/performance-report.test.mjs +122 -0
  1033. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/report-fixtures.test-support.mjs +51 -0
  1034. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/report-import.mjs +209 -0
  1035. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/report-import.test.mjs +164 -0
  1036. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/run-lighthouse.mjs +151 -0
  1037. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/series-gate.mjs +225 -0
  1038. package/templates/.agents/skills/zaip-skill-performance-engineering/scripts/series-gate.test.mjs +143 -0
  1039. package/templates/.agents/skills/zaip-skill-qa/SKILL.md +54 -0
  1040. package/templates/.agents/skills/zaip-skill-qa/agents/openai.yaml +4 -0
  1041. package/templates/.agents/skills/zaip-skill-qa/references/host-protocol.md +125 -0
  1042. package/templates/.agents/skills/zaip-skill-qa/references/landing-page-forms.md +23 -0
  1043. package/templates/.agents/skills/zaip-skill-qa/references/proof-adapters.md +92 -0
  1044. package/templates/.agents/skills/zaip-skill-qa/references/scenarios.md +73 -0
  1045. package/templates/.agents/skills/zaip-skill-qa/references/seo-geo.md +33 -0
  1046. package/templates/.agents/skills/zaip-skill-qa/references/site-performance.md +20 -0
  1047. package/templates/.agents/skills/zaip-skill-qa/scripts/observe-dashboard-ui.mjs +152 -0
  1048. package/templates/.agents/skills/zaip-skill-qa/scripts/observe-dashboard-ui.test.mjs +65 -0
  1049. package/templates/.agents/skills/zaip-skill-qa/scripts/qa-contract.test.mjs +203 -0
  1050. package/templates/.agents/skills/zaip-skill-qa/scripts/run-behavior-tests.mjs +369 -0
  1051. package/templates/.agents/skills/zaip-skill-qa/scripts/run-behavior-tests.test.mjs +168 -0
  1052. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/SKILL.md +33 -0
  1053. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +42 -62
  1054. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-native-window.mjs +115 -0
  1055. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-native-window.test.mjs +123 -0
  1056. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-optional-timing.test.mjs +34 -0
  1057. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-reviewed-pairs-fixture.mjs +130 -0
  1058. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-deduplicate-apply.mjs +106 -0
  1059. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +22 -45
  1060. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +0 -24
  1061. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +73 -9
  1062. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-reviewed-order.mjs +48 -0
  1063. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-reviewed-pairs.mjs +255 -0
  1064. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-reviewed-pairs.test.mjs +329 -0
  1065. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-token-snapshots.mjs +49 -0
  1066. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-token-snapshots.test.mjs +33 -0
  1067. package/templates/.agents/skills/zaip-skill-refactor-landing-page/SKILL.md +6 -0
  1068. package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +19 -1
  1069. package/templates/.agents/skills/zaip-skill-release-qualification/references/frozen-task-recovery.md +47 -0
  1070. package/templates/.agents/skills/zaip-skill-release-qualification/references/local-catalog.md +136 -0
  1071. package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +7 -5
  1072. package/templates/.agents/skills/zaip-skill-release-qualification/references/remote-validation.md +147 -0
  1073. package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +1 -0
  1074. package/templates/.agents/skills/zaip-skill-sales-methodology/references/bant-discovery.md +28 -0
  1075. package/templates/.agents/skills/zaip-skill-screenshot-intake/SKILL.md +40 -0
  1076. package/templates/.agents/skills/zaip-skill-screenshot-intake/agents/openai.yaml +6 -0
  1077. package/templates/.agents/skills/zaip-skill-screenshot-intake/references/request-example.json +36 -0
  1078. package/templates/.agents/skills/zaip-skill-screenshot-intake/references/runtime-workflow.md +110 -0
  1079. package/templates/.agents/skills/zaip-skill-search-observability/SKILL.md +27 -0
  1080. package/templates/.agents/skills/zaip-skill-search-observability/agents/openai.yaml +4 -0
  1081. package/templates/.agents/skills/zaip-skill-search-observability/references/report-template.md +32 -0
  1082. package/templates/.agents/skills/zaip-skill-search-observability/references/workflow.md +56 -0
  1083. package/templates/.agents/skills/zaip-skill-search-observability/scripts/search-report.mjs +139 -0
  1084. package/templates/.agents/skills/zaip-skill-search-observability/scripts/search-report.test.mjs +72 -0
  1085. package/templates/.agents/skills/zaip-skill-setup/SKILL.md +51 -44
  1086. package/templates/.agents/skills/zaip-skill-setup/agents/openai.yaml +1 -1
  1087. package/templates/.agents/skills/zaip-skill-setup/references/basic-onboarding.md +41 -0
  1088. package/templates/.agents/skills/zaip-skill-setup/references/codex-activation.md +40 -0
  1089. package/templates/.agents/skills/zaip-skill-setup/scripts/onboarding-contract.test.mjs +41 -0
  1090. package/templates/.agents/skills/zaip-skill-spec/SKILL.md +1 -0
  1091. package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +4 -3
  1092. package/templates/.agents/skills/zaip-skill-task/SKILL.md +1 -0
  1093. package/templates/.agents/skills/zaip-skill-task/references/commit-policy.md +1 -1
  1094. package/templates/.agents/skills/zaip-skill-testing-strategy/SKILL.md +18 -0
  1095. package/templates/.agents/skills/zaip-skill-testing-strategy/references/frontend-impact.md +81 -0
  1096. package/templates/.agents/skills/zaip-skill-testing-strategy/references/verification-adoption.md +31 -0
  1097. package/templates/.agents/skills/zaip-skill-testing-strategy/scripts/validation-plan.mjs +168 -0
  1098. package/templates/.agents/skills/zaip-skill-testing-strategy/scripts/validation-plan.test.mjs +146 -0
  1099. package/templates/.agents/skills/zaip-skill-tool-setup/scripts/tool-state.mjs +1 -1
  1100. package/templates/.agents/skills/zaip-skill-use-connectors/SKILL.md +8 -0
  1101. package/templates/.agents/skills/zaip-skill-use-connectors/scripts/select-connector.mjs +73 -0
  1102. package/templates/.agents/skills/zaip-skill-use-connectors/scripts/select-connector.test.mjs +85 -0
  1103. package/templates/.agents/skills/zaip-skill-visual-report/SKILL.md +41 -0
  1104. package/templates/.agents/skills/zaip-skill-visual-report/agents/openai.yaml +6 -0
  1105. package/templates/.agents/skills/zaip-skill-visual-report/references/fidelity-proof.md +56 -0
  1106. package/templates/.agents/skills/zaip-skill-visual-report/references/intake-state.md +64 -0
  1107. package/templates/.agents/skills/zaip-skill-visual-report/references/source-contract.md +79 -0
  1108. package/templates/.agents/skills/zaip-skill-visual-report/references/synthesis-template.md +67 -0
  1109. package/templates/.agents/skills/zaip-skill-visual-report/references/visual-contract.json +40 -0
  1110. package/templates/.agents/skills/zaip-skill-website-readiness/SKILL.md +73 -17
  1111. package/templates/.agents/skills/zaip-skill-website-readiness/agents/openai.yaml +2 -2
  1112. package/templates/.agents/skills/zaip-skill-website-readiness/references/capability-checklist.md +8 -4
  1113. package/templates/.agents/skills/zaip-skill-website-readiness/references/change-discovery.md +22 -0
  1114. package/templates/.agents/skills/zaip-skill-website-readiness/references/content-and-agents.md +25 -0
  1115. package/templates/.agents/skills/zaip-skill-website-readiness/references/crawler-policy.md +35 -0
  1116. package/templates/.agents/skills/zaip-skill-website-readiness/references/schema-matrix.md +23 -0
  1117. package/templates/.agents/skills/zaip-skill-website-readiness/references/search-evidence.md +36 -0
  1118. package/templates/.agents/skills/zaip-skill-website-readiness/references/site-quality.example.json +14 -0
  1119. package/templates/.agents/skills/zaip-skill-website-readiness/references/site-quality.md +109 -0
  1120. package/templates/.agents/skills/zaip-skill-website-readiness/references/site-validation.md +60 -0
  1121. package/templates/.agents/skills/zaip-skill-website-readiness/references/sources.md +37 -0
  1122. package/templates/.agents/skills/zaip-skill-website-readiness/references/visual-preservation.md +84 -0
  1123. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/agent-content.mjs +116 -0
  1124. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/agent-content.test.mjs +83 -0
  1125. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/audit-site.mjs +136 -0
  1126. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/html-facts.mjs +56 -0
  1127. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/index-directives.mjs +29 -0
  1128. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/quality-plan.mjs +62 -0
  1129. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/robots-policy.mjs +63 -0
  1130. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/search-policy.test.mjs +183 -0
  1131. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/site-audit.mjs +243 -0
  1132. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/site-audit.test.mjs +287 -0
  1133. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/sitemap-policy.mjs +111 -0
  1134. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/verify-site-design.mjs +130 -0
  1135. package/templates/.agents/skills/zaip-skill-website-readiness/scripts/visual-preservation.mjs +160 -0
  1136. package/templates/.agents/skills/zaip-skill-worktree-recovery/SKILL.md +70 -0
  1137. package/templates/.agents/skills/zaip-skill-worktree-recovery/agents/openai.yaml +4 -0
  1138. package/templates/.agents/skills/zaip-skill-worktree-recovery/references/complete-preservation.md +70 -0
  1139. package/templates/.agents/skills/zaip-skill-worktree-recovery/references/default-policy.md +53 -0
  1140. package/templates/.agents/skills/zaip-skill-worktree-recovery/references/lifecycle-roots.md +106 -0
  1141. package/templates/.agents/skills/zaip-skill-worktree-recovery/references/metadata-overlay.md +45 -0
  1142. package/templates/.agents/skills/zaip-skill-worktree-recovery/references/procedure.md +49 -0
  1143. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/complete-preservation.mjs +252 -0
  1144. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-local-archive.mjs +162 -0
  1145. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-local-git.mjs +111 -0
  1146. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-acl.ps1 +37 -0
  1147. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-activate.ps1 +66 -0
  1148. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-alias.mjs +202 -0
  1149. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-batches.mjs +88 -0
  1150. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-copy-session.mjs +84 -0
  1151. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-cutover.mjs +350 -0
  1152. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-files.mjs +109 -0
  1153. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-generation-posix.mjs +194 -0
  1154. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-generation.mjs +173 -0
  1155. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-journal.mjs +88 -0
  1156. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-layout.mjs +102 -0
  1157. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-lock.mjs +106 -0
  1158. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-migration.mjs +234 -0
  1159. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-observation-tail.mjs +148 -0
  1160. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-permissions.mjs +52 -0
  1161. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-plan.mjs +143 -0
  1162. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-preparation.mjs +110 -0
  1163. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-process-start.ps1 +7 -0
  1164. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-quiescence.ps1 +11 -0
  1165. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-receipt-lease.mjs +67 -0
  1166. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-reuse.mjs +68 -0
  1167. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/durable-state-telemetry-version.mjs +187 -0
  1168. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/git-process.mjs +85 -0
  1169. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/metadata-overlay.mjs +302 -0
  1170. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/metadata-secrets.mjs +44 -0
  1171. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/migrate-durable-state.mjs +49 -0
  1172. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/recovery.mjs +247 -0
  1173. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/retention-marker.mjs +44 -0
  1174. package/templates/.agents/skills/zaip-skill-worktree-recovery/scripts/worktree-proof.mjs +148 -0
  1175. package/templates/.agents/tools/api/kommo-crm/README.md +13 -9
  1176. package/templates/.agents/tools/cloud-onboarding-architecture.mjs +273 -0
  1177. package/templates/.agents/tools/cloud-onboarding-bootstrap.test.mjs +176 -0
  1178. package/templates/.agents/tools/cloud-onboarding-configure.mjs +146 -0
  1179. package/templates/.agents/tools/cloud-onboarding-credentials.mjs +279 -0
  1180. package/templates/.agents/tools/cloud-onboarding-files.mjs +190 -0
  1181. package/templates/.agents/tools/cloud-onboarding-files.test.mjs +72 -0
  1182. package/templates/.agents/tools/cloud-onboarding-generation.mjs +161 -0
  1183. package/templates/.agents/tools/cloud-onboarding-generation.test.mjs +129 -0
  1184. package/templates/.agents/tools/cloud-onboarding-policy.mjs +196 -0
  1185. package/templates/.agents/tools/cloud-onboarding-provider.mjs +228 -0
  1186. package/templates/.agents/tools/cloud-onboarding-provider.test.mjs +144 -0
  1187. package/templates/.agents/tools/cloud-onboarding-recovery.test.mjs +306 -0
  1188. package/templates/.agents/tools/cloud-onboarding-ssh.mjs +223 -0
  1189. package/templates/.agents/tools/cloud-onboarding-terraform.mjs +80 -0
  1190. package/templates/.agents/tools/cloud-onboarding-test-fixture.mjs +184 -0
  1191. package/templates/.agents/tools/cloud-onboarding-test-fixtures.mjs +117 -0
  1192. package/templates/.agents/tools/cloud-onboarding.mjs +196 -0
  1193. package/templates/.agents/tools/cloud-onboarding.ssh.integration.test.mjs +391 -0
  1194. package/templates/.agents/tools/cloud-onboarding.test.mjs +237 -0
  1195. package/templates/.agents/tools/cloud-runner-arguments.mjs +37 -0
  1196. package/templates/.agents/tools/cloud-runner-dns.mjs +234 -11
  1197. package/templates/.agents/tools/cloud-runner-dns.test.mjs +256 -0
  1198. package/templates/.agents/tools/cloud-runner-process.mjs +61 -0
  1199. package/templates/.agents/tools/cloud-runner-process.test.mjs +43 -0
  1200. package/templates/.agents/tools/cloud-runner.integration.test.mjs +19 -3
  1201. package/templates/.agents/tools/cloud-runner.mjs +49 -169
  1202. package/templates/.agents/tools/cloud-runner.test.mjs +7 -42
  1203. package/templates/.agents/tools/historical-local-archive.mjs +89 -0
  1204. package/templates/.agents/tools/infisical-bootstrap-windows.test.mjs +12 -0
  1205. package/templates/.agents/tools/infisical-bootstrap.mjs +240 -0
  1206. package/templates/.agents/tools/infisical-bootstrap.test-support.mjs +39 -0
  1207. package/templates/.agents/tools/infisical-bootstrap.test.mjs +193 -0
  1208. package/templates/.agents/tools/infisical-policy.mjs +134 -0
  1209. package/templates/.agents/tools/infisical-runner.mjs +349 -0
  1210. package/templates/.agents/tools/infisical-runner.test.mjs +266 -0
  1211. package/templates/.agents/tools/mcp/infra/cloudflare/README.md +3 -17
  1212. package/templates/.agents/tools/mcp/infra/cloudflare/manifest.yaml +6 -10
  1213. package/templates/.agents/tools/repository-cloud-boundary.test.mjs +41 -0
  1214. package/templates/.agents/tools/repository-policy.mjs +257 -0
  1215. package/templates/.agents/tools/repository-profile.mjs +116 -0
  1216. package/templates/.agents/tools/repository-profile.test.mjs +67 -0
  1217. package/templates/.agents/tools/secret-inventory.mjs +150 -0
  1218. package/templates/.agents/tools/secret-inventory.test.mjs +60 -0
  1219. package/templates/.agents/tools/visual-intake/cli.mjs +72 -0
  1220. package/templates/.agents/tools/visual-intake/fs.mjs +137 -0
  1221. package/templates/.agents/tools/visual-intake/lock.mjs +98 -0
  1222. package/templates/.agents/tools/visual-intake/report.mjs +69 -0
  1223. package/templates/.agents/tools/visual-intake/runtime.mjs +330 -0
  1224. package/templates/.agents/tools/visual-intake/schema.mjs +235 -0
  1225. package/templates/.agents/tools/visual-intake/transaction.mjs +206 -0
  1226. package/templates/.agents/tools/visual-url/browser-cdp.mjs +167 -0
  1227. package/templates/.agents/tools/visual-url/browser-page-evidence.mjs +111 -0
  1228. package/templates/.agents/tools/visual-url/browser-proxy.mjs +194 -0
  1229. package/templates/.agents/tools/visual-url/browser-rendered-sample.mjs +312 -0
  1230. package/templates/.agents/tools/visual-url/browser-source.mjs +398 -0
  1231. package/templates/.agents/tools/visual-url/capture.mjs +119 -0
  1232. package/templates/.agents/tools/visual-url/captured-visual.mjs +301 -0
  1233. package/templates/.agents/tools/visual-url/cli.mjs +29 -0
  1234. package/templates/.agents/tools/visual-url/color-candidates.mjs +161 -0
  1235. package/templates/.agents/tools/visual-url/colors.mjs +98 -0
  1236. package/templates/.agents/tools/visual-url/contrast.mjs +40 -0
  1237. package/templates/.agents/tools/visual-url/css-sample.mjs +109 -0
  1238. package/templates/.agents/tools/visual-url/design-lint.mjs +83 -0
  1239. package/templates/.agents/tools/visual-url/design-score.mjs +217 -0
  1240. package/templates/.agents/tools/visual-url/failure.mjs +56 -0
  1241. package/templates/.agents/tools/visual-url/files.mjs +176 -0
  1242. package/templates/.agents/tools/visual-url/generated-tokens.mjs +369 -0
  1243. package/templates/.agents/tools/visual-url/handoff.mjs +85 -0
  1244. package/templates/.agents/tools/visual-url/icon.mjs +110 -0
  1245. package/templates/.agents/tools/visual-url/local-source.mjs +63 -0
  1246. package/templates/.agents/tools/visual-url/parser.mjs +288 -0
  1247. package/templates/.agents/tools/visual-url/policy.mjs +201 -0
  1248. package/templates/.agents/tools/visual-url/proposal-markdown.mjs +39 -0
  1249. package/templates/.agents/tools/visual-url/proposal.mjs +388 -0
  1250. package/templates/.agents/tools/visual-url/report.mjs +305 -0
  1251. package/templates/.agents/tools/visual-url/runtime.mjs +218 -0
  1252. package/templates/.agents/tools/visual-url/safe-visual-value.mjs +49 -0
  1253. package/templates/.agents/tools/visual-url/transport.mjs +187 -0
  1254. package/templates/.agents/tools/visual-url/visual-model.mjs +393 -0
  1255. package/templates/.agents/zaip-aios/VERSION +1 -1
  1256. package/templates/.agents/zaip-aios/guides/06-execucao.md +1 -1
  1257. package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +1 -1
  1258. package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +2 -2
  1259. package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +60 -18
  1260. package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +8 -0
  1261. package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +2 -2
  1262. package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +2 -2
  1263. package/templates/infra/terraform/README.md +2 -0
  1264. package/templates/infra/terraform/infisical.tf +57 -0
  1265. package/templates/infra/terraform/terraform.tfvars.example +5 -0
  1266. package/templates/infra/terraform/variables.tf +1 -1
  1267. package/templates/scripts/validate-cloud-hostinger-contract.mjs +4 -1
  1268. package/templates/template-manifest.json +3905 -1127
  1269. package/templates/.agents/architecture/hostinger-cloudflare-terraform.md +0 -90
  1270. package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-uR-asJv_.js +0 -1
  1271. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-1gE8RHel.js +0 -3
  1272. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-B0Jwz_rk.js +0 -68
  1273. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DZhppOIk.css +0 -1
  1274. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DtLrd13g.js +0 -2
  1275. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DFpwb0TN.js +0 -1
  1276. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-kxWwSKin.js +0 -146
  1277. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DashboardFilters.stories-Chm_dXV7.js +0 -9
  1278. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DashboardFiltersSpecimen-9CaCbGIZ.js +0 -1
  1279. package/templates/.agents/design/apps/catalog/dist/storybook/assets/WorkspaceStatusSpecimen-DQnSS6s9.js +0 -1
  1280. package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-Do9sjqiW.js +0 -1
  1281. package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-0W0Gj_Gs.css +0 -1
  1282. package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-NrUxok8K.js +0 -1
@@ -0,0 +1,59 @@
1
+ import{n as e,t}from"./rolldown-runtime-Bh1tDfsg.js";var n=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(ee(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function te(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var re=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},N={map:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=N,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,re)}catch(e){re(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),r=t(((e,t)=>{t.exports=n()})),i=t((e=>{var t=r();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),a=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e(r(),1),s=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),c=t(((e,t)=>{t.exports=s()})),l=c(),u=new URL(`/assets/logo_novo_azul-BBx5pA2B.png`,``+import.meta.url).href;function d({filters:e,filtersActive:t=!1,snapshotUpdatedAt:n=null,loading:r,locale:i,onLocaleChange:a,onRefresh:s,repositoryName:c,settings:d,title:p}){let[y,b]=(0,o.useState)(!1),[x,S]=(0,o.useState)(!1),[C,w]=(0,o.useState)(!1),T=i===`pt-BR`?{filters:`Filtros`,language:`Idioma`,refresh:`Atualizar`,refreshing:`Atualizando…`,settings:`Configurações`,updated:`Última Atualização`,waiting:`Atualização indisponível`}:{filters:`Filters`,language:`Language`,refresh:`Refresh`,refreshing:`Refreshing…`,settings:`Settings`,updated:`Last Updated`,waiting:`Update unavailable`},E=n===null?T.waiting:`${T.updated} ${new Intl.DateTimeFormat(i,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(n))}`,D=e=>{a(e),S(!1)},O=c?.includes(`/`)?`https://github.com/${c}`:null;return(0,l.jsxs)(`nav`,{"aria-label":`${c?`${p} ${c}`:p} menu`,className:`dashboard-header`,children:[(0,l.jsxs)(`div`,{className:`dashboard-header-brand`,children:[(0,l.jsxs)(`strong`,{children:[(0,l.jsx)(`span`,{children:p}),c?O?(0,l.jsxs)(`a`,{"aria-label":`Abrir ${c} no GitHub`,className:`dashboard-header-repository`,href:O,rel:`noreferrer`,target:`_blank`,children:[(0,l.jsx)(h,{}),(0,l.jsx)(`span`,{children:c})]}):(0,l.jsxs)(`span`,{className:`dashboard-header-repository`,children:[(0,l.jsx)(h,{}),(0,l.jsx)(`span`,{children:c})]}):null]}),(0,l.jsx)(`small`,{children:E})]}),(0,l.jsx)(`img`,{alt:`ZAIP`,className:`dashboard-header-logo`,src:u}),(0,l.jsxs)(`div`,{className:`dashboard-header-actions`,children:[(0,l.jsx)(`button`,{"aria-label":T.refresh,className:`dashboard-header-icon dashboard-header-refresh`,disabled:r,onClick:s,type:`button`,children:(0,l.jsx)(m,{})}),(0,l.jsxs)(`div`,{className:`dashboard-header-anchor dashboard-header-filter-action`,children:[(0,l.jsxs)(`button`,{className:`dashboard-header-button${y||t?` is-active`:``}`,onClick:()=>{b(e=>!e),S(!1),w(!1)},type:`button`,children:[(0,l.jsx)(g,{}),` `,T.filters]}),y?(0,l.jsx)(`div`,{className:`dashboard-header-popup dashboard-header-filter-popup`,children:e}):null]}),(0,l.jsxs)(`div`,{className:`dashboard-header-anchor dashboard-header-locale-action`,children:[(0,l.jsxs)(`button`,{className:`dashboard-header-button${x?` is-active`:``}`,onClick:()=>{S(e=>!e),b(!1),w(!1)},type:`button`,children:[(0,l.jsx)(f,{locale:i}),i===`pt-BR`?`PT-BR`:`EN-US`,(0,l.jsx)(_,{})]}),x?(0,l.jsxs)(`div`,{className:`dashboard-header-popup dashboard-header-locale-popup`,children:[(0,l.jsxs)(`button`,{onClick:()=>D(`pt-BR`),type:`button`,children:[(0,l.jsx)(f,{locale:`pt-BR`}),` Português do Brasil`,i===`pt-BR`?(0,l.jsx)(`span`,{children:`✓`}):null]}),(0,l.jsxs)(`button`,{onClick:()=>D(`en-US`),type:`button`,children:[(0,l.jsx)(f,{locale:`en-US`}),` English`,i===`en-US`?(0,l.jsx)(`span`,{children:`✓`}):null]})]}):null]}),d===void 0?null:(0,l.jsxs)(`div`,{className:`dashboard-header-anchor dashboard-header-settings-action`,children:[(0,l.jsx)(`button`,{"aria-label":T.settings,className:`dashboard-header-icon${C?` is-active`:``}`,onClick:()=>{w(e=>!e),b(!1),S(!1)},type:`button`,children:(0,l.jsx)(v,{})}),C?(0,l.jsxs)(`div`,{className:`dashboard-header-popup dashboard-header-settings-popup`,children:[(0,l.jsxs)(`div`,{className:`dashboard-header-mobile-settings`,children:[(0,l.jsx)(`small`,{children:E}),(0,l.jsxs)(`button`,{disabled:r,onClick:s,type:`button`,children:[(0,l.jsx)(m,{}),` `,r?T.refreshing:T.refresh]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:T.language}),(0,l.jsxs)(`select`,{onChange:e=>a(e.target.value),value:i,children:[(0,l.jsx)(`option`,{value:`pt-BR`,children:`Português do Brasil`}),(0,l.jsx)(`option`,{value:`en-US`,children:`English`})]})]}),(0,l.jsxs)(`div`,{className:`dashboard-header-mobile-filters`,children:[(0,l.jsx)(`strong`,{children:T.filters}),e]})]}),(0,l.jsx)(`div`,{className:`dashboard-header-settings-content`,children:d})]}):null]})]})]})}function f({locale:e}){return e===`pt-BR`?(0,l.jsxs)(`svg`,{"aria-hidden":`true`,className:`dashboard-header-flag`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`rect`,{fill:`#18864b`,height:`24`,rx:`5`,width:`24`}),(0,l.jsx)(`path`,{d:`m12 3.8 8.2 8.2L12 20.2 3.8 12 12 3.8Z`,fill:`#f6d64a`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`12`,fill:`#1b4f9c`,r:`4.2`}),(0,l.jsx)(`path`,{d:`M8.8 11.2c1.9-1 4.5-1 6.4 0`,fill:`none`,stroke:`#fff`,strokeWidth:`.8`})]}):(0,l.jsxs)(`svg`,{"aria-hidden":`true`,className:`dashboard-header-flag`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`rect`,{fill:`#fff`,height:`24`,rx:`5`,width:`24`}),(0,l.jsx)(`path`,{d:`M0 3h24v3H0Zm0 6h24v3H0Zm0 6h24v3H0Z`,fill:`#bd3d44`}),(0,l.jsx)(`path`,{d:`M0 0h11v11H0Z`,fill:`#192f6b`})]})}function p({children:e,className:t=``}){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`dashboard-header-svg ${t}`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:e})}function m(){return(0,l.jsxs)(p,{children:[(0,l.jsx)(`path`,{d:`M21 12a9 9 0 0 1-15.2 6.5L3 16`}),(0,l.jsx)(`path`,{d:`M3 21v-5h5`}),(0,l.jsx)(`path`,{d:`M3 12a9 9 0 0 1 15.2-6.5L21 8`}),(0,l.jsx)(`path`,{d:`M21 3v5h-5`})]})}function h(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`dashboard-header-github`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{d:`M12 2C6.48 2 2 6.58 2 12.23c0 4.52 2.87 8.35 6.84 9.71.5.1.68-.22.68-.49 0-.24-.01-1.05-.02-1.9-2.78.62-3.37-1.2-3.37-1.2-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.9 1.57 2.34 1.12 2.91.86.09-.66.35-1.12.64-1.37-2.22-.26-4.56-1.14-4.56-5.06 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.71 0 0 .84-.28 2.75 1.05A9.32 9.32 0 0 1 12 6.97c.85 0 1.7.12 2.5.34 1.91-1.33 2.75-1.05 2.75-1.05.55 1.41.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.93-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.38-.01 2.49-.01 2.83 0 .27.18.59.69.49A10.25 10.25 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z`,fill:`currentColor`})})}function g(){return(0,l.jsx)(p,{children:(0,l.jsx)(`path`,{d:`M3 6h18M7 12h10m-7 6h4`})})}function _(){return(0,l.jsx)(p,{className:`dashboard-header-chevron`,children:(0,l.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function v(){return(0,l.jsxs)(p,{children:[(0,l.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.09a2 2 0 0 1 1 1.74v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2Z`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}var y=a();function b({rows:e,columns:t,rowKey:n,onRowClick:r,defaultSort:i=null,sortable:a=!1,showColumnInfo:s=!1,scrollLabel:c,locale:u=`pt-BR`,pageSize:d=100,emptyMessage:f=u===`pt-BR`?`Nenhum dado disponível.`:`No data available.`}){let[p,m]=(0,o.useState)(i),[h,g]=(0,o.useState)(0),[_,v]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(_===null)return;let e=()=>v(null);return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[_]);let b=(0,o.useMemo)(()=>t.filter(e=>!e.hidden),[t]),T=(0,o.useMemo)(()=>{if(p===null)return e;let n=t.find(e=>e.key===p.key);return n?[...e].sort((e,t)=>{let r=C(n.sortValue?.(e)??S(n.render(e)),n.sortValue?.(t)??S(n.render(t)));return p.direction===`asc`?r:-r}):e},[t,e,p]),E=d===null||d<=0?1:Math.max(1,Math.ceil(T.length/d)),D=Math.min(h,E-1),O=d===null||d<=0?T:T.slice(D*d,(D+1)*d);return(0,o.useEffect)(()=>g(0),[]),e.length===0?(0,l.jsx)(`p`,{className:`ui-empty`,children:f}):(0,l.jsxs)(`section`,{"aria-label":c,className:`ui-table-wrap`,role:c?`region`:void 0,tabIndex:c?0:void 0,children:[(0,l.jsxs)(`table`,{className:`ui-table`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsx)(`tr`,{children:b.map(e=>(0,l.jsx)(`th`,{"aria-sort":p?.key===e.key?p.direction===`asc`?`ascending`:`descending`:`none`,className:e.align===`right`?`is-number`:void 0,children:e.label&&(a||s)?(0,l.jsxs)(`span`,{className:`ui-table-heading`,children:[(0,l.jsx)(`span`,{className:`ui-table-label`,children:e.label}),a?(0,l.jsx)(`button`,{"aria-label":u===`pt-BR`?`Ordenar por ${e.label}`:`Sort by ${e.label}`,className:`ui-table-sort`,onClick:()=>m(t=>({key:e.key,direction:t?.key===e.key&&t.direction===`asc`?`desc`:`asc`})),type:`button`,children:(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`ui-table-sort-indicator`,children:p?.key===e.key?p.direction===`asc`?`↑`:`↓`:`↕`})}):null,s?(0,l.jsx)(`button`,{"aria-label":u===`pt-BR`?`Informação sobre ${e.label}`:`Information about ${e.label}`,className:`ui-table-info`,onBlur:()=>v(null),onFocus:t=>x(t.currentTarget,e.description??w(e.label,u),v),onMouseEnter:t=>x(t.currentTarget,e.description??w(e.label,u),v),onMouseLeave:()=>v(null),type:`button`,children:`i`}):null]}):e.label},e.key))})}),(0,l.jsx)(`tbody`,{children:O.map(e=>(0,l.jsx)(`tr`,{className:r===void 0?void 0:`ui-table-row-action`,onClick:r===void 0?void 0:()=>r(e),onKeyDown:r===void 0?void 0:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e))},tabIndex:r===void 0?void 0:0,children:b.map(t=>(0,l.jsx)(`td`,{className:t.align===`right`?`is-number`:void 0,children:t.render(e)},t.key))},n(e)))}),b.some(e=>e.footer!==void 0)?(0,l.jsx)(`tfoot`,{children:(0,l.jsx)(`tr`,{children:b.map(e=>(0,l.jsx)(`td`,{className:e.align===`right`?`is-number`:void 0,children:e.footer},e.key))})}):null]}),E>1?(0,l.jsxs)(`nav`,{"aria-label":u===`pt-BR`?`Paginação da tabela`:`Table pagination`,className:`ui-table-pagination`,children:[(0,l.jsx)(`button`,{disabled:D===0,onClick:()=>g(e=>Math.max(0,e-1)),type:`button`,children:u===`pt-BR`?`Anterior`:`Previous`}),(0,l.jsxs)(`span`,{children:[u===`pt-BR`?`Página`:`Page`,` `,D+1,` / `,E]}),(0,l.jsx)(`button`,{disabled:D+1>=E,onClick:()=>g(e=>Math.min(E-1,e+1)),type:`button`,children:u===`pt-BR`?`Próxima`:`Next`})]}):null,_&&typeof document<`u`?(0,y.createPortal)((0,l.jsx)(`div`,{className:`ui-table-tooltip`,role:`tooltip`,style:{bottom:_.bottom,left:_.left,top:_.top},children:_.text}),document.body):null]})}function x(e,t,n){let r=e.getBoundingClientRect();n({text:t,left:Math.min(Math.max(r.left+r.width/2,176),window.innerWidth-176),...window.innerHeight-r.bottom<260?{bottom:window.innerHeight-r.top+9}:{top:r.bottom+9}})}function S(e){return typeof e==`number`||typeof e==`string`?e:Array.isArray(e)?e.map(S).filter(Boolean).join(` `):e&&typeof e==`object`&&`props`in e?S(e.props?.children??null):null}function C(e,t){return e===null?t===null?0:1:t===null?-1:typeof e==`number`&&typeof t==`number`?e-t:new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}).compare(String(e),String(t))}function w(e,t){let n=e.toLocaleLowerCase(t);return t===`pt-BR`?`Mostra ${n} para cada linha. Clique no título para ordenar em ordem crescente ou decrescente.`:`Shows ${n} for each row. Click the column title to sort in ascending or descending order.`}function T(e,t=`pt-BR`){return e===null?`0`:e>=36e5?`${new Intl.NumberFormat(t,{maximumFractionDigits:1}).format(e/36e5)} h`:e>=6e4?`${Math.round(e/6e4)} min`:`${Math.round(e/1e3)} ${t===`pt-BR`?`seg`:`sec`}`}function E(e,t=`pt-BR`){return e===null?`0`:e<36e5?T(e,t):`${new Intl.NumberFormat(t,{maximumFractionDigits:1}).format(e/36e5)} h`}function D(e,t=`pt-BR`,n=1){if(e===null)return`0`;let r=[{threshold:0x38d7ea4c68000,suffix:`Q`},{threshold:0xe8d4a51000,suffix:`T`},{threshold:1e9,suffix:`B`},{threshold:1e6,suffix:`M`},{threshold:1e3,suffix:`mil`}].find(({threshold:t})=>Math.abs(e)>=t);return r?`${new Intl.NumberFormat(t,{maximumFractionDigits:n}).format(e/r.threshold)} ${r.suffix}`:new Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:n}).format(e)}function O(e,t=`pt-BR`,n){return e===null?`0`:new Intl.NumberFormat(t,{maximumFractionDigits:n}).format(e)}function k(e,t,n=`pt-BR`){return e===null?`0`:new Intl.NumberFormat(n,{style:`currency`,currency:t,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}function A(e,t=`pt-BR`){return e===null?t===`pt-BR`?`indisponível`:`unavailable`:new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(e))}function j(e,t=`pt-BR`){return new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:1}).format(e)}function ee({ariaLabel:e,metrics:t}){return(0,l.jsx)(`section`,{"aria-label":e,className:`period-average-summary`,children:(0,l.jsx)(`div`,{className:`period-average-grid`,children:t.map(e=>(0,l.jsxs)(`article`,{children:[(0,l.jsx)(`span`,{children:e.label}),(0,l.jsx)(`strong`,{children:e.value})]},e.label))})})}function M(e,t){return e===null?`0`:e===0?t===`pt-BR`?`0 seg`:`0 sec`:T(e,t)}function te(e){if(typeof e.source_duration_ms==`number`&&e.source_duration_ms>=0)return e.source_duration_ms;let t=e.duration_provenance;return typeof e.duration_ms==`number`&&e.duration_ms>=0&&(t===`observed`||t===`reconciled`||t===`legacy_inferred`)?e.duration_ms:null}function ne(e,t){return e.provenance===`in_progress`?t===`pt-BR`?`Em andamento`:`In progress`:e.durationMs===null||e.provenance===`unavailable`?t===`pt-BR`?`Sem atribuição temporal`:`No temporal attribution`:M(e.durationMs,t)}function re(e){let t=te(e);if(t!==null)return{durationMs:t,provenance:`factual`};if(e.status===`running`)return{durationMs:null,provenance:`in_progress`};let n=ie({...e,status:e.status??``});return n==null?{durationMs:null,provenance:`unavailable`}:{durationMs:n,provenance:`lifecycle_elapsed`}}function N(e){if(e.started_at===null||e.finished_at===null)return null;let t=Date.parse(e.started_at),n=Date.parse(e.finished_at);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?n-t:null}function ie(e){if([`completed`,`failed`,`cancelled`].includes(e.status))return N(e)}function ae(e,t){return e===void 0?`—`:M(e,t)}function oe({details:e,locale:t,onClose:n}){let r=I(t),i=e.kind===`change`||e.kind===`decision`?e.row.title:e.row.id;return(0,y.createPortal)((0,l.jsx)(`dialog`,{className:`operations-status-dialog-backdrop`,onMouseDown:e=>e.currentTarget===e.target&&n(),open:!0,children:(0,l.jsxs)(`section`,{"aria-label":`${r.details} ${fe(e.kind,t)}`,"aria-modal":`true`,className:`operations-status-dialog operations-entity-details`,role:`dialog`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:fe(e.kind,t)}),(0,l.jsx)(`h2`,{children:i}),(0,l.jsx)(`p`,{children:e.row.id})]}),(0,l.jsx)(`button`,{"aria-label":t===`pt-BR`?`Fechar`:`Close`,onClick:n,type:`button`,children:`×`})]}),(0,l.jsxs)(`div`,{className:`operations-entity-details-scroll`,children:[e.kind===`change`?(0,l.jsx)(P,{locale:t,row:e.row}):null,e.kind===`decision`?(0,l.jsx)(F,{locale:t,row:e.row}):null,e.kind===`execution`?(0,l.jsx)(se,{locale:t,row:e.row}):null,e.kind===`run`?(0,l.jsx)(ce,{locale:t,row:e.row}):null]})]})}),document.body)}function P({row:e,locale:t}){let n=I(t);return(0,l.jsx)(le,{items:[[n.status,e.status],[n.risk,e.risk],[n.origin,ue(e.source)],[n.created,A(e.created_at,t)],[n.tasks,String(e.task_ids.length)],[n.requirements,de(e.requirement_ids)],[n.acceptanceCriteria,de(e.acceptance_ids)],[n.result,e.result??`—`],[n.file,e.artifact_path]]})}function F({row:e,locale:t}){let n=I(t);return(0,l.jsx)(le,{items:[[n.origin,e.origin],[n.scopeType,e.scope_type],[n.scope,e.scope_id],[n.created,A(e.created_at,t)],[n.file,e.artifact_path]]})}function se({row:e,locale:t}){let n=I(t);return(0,l.jsx)(le,{items:[[n.status,e.status],[n.workStatus,e.work_status],[n.origin,ue(e.origin)],[n.created,A(e.created_at,t)],[n.tasksInDag,String(e.dag.nodes.length)],[t===`pt-BR`?`Invocações do orquestrador`:`Orchestrator invocations`,String(e.orchestrator_run_count)],[t===`pt-BR`?`Invocações delegadas`:`Delegated invocations`,String(e.subagent_run_count)],[t===`pt-BR`?`Tasks finalizadas`:`Finalized Tasks`,`${e.finalized_task_count}/${e.task_count} (${e.finalizer_run_count} ${t===`pt-BR`?`chamadas finalizadoras`:`finalizer calls`})`],[n.topologicalOrder,de(e.dag.topological_order)],[n.dependencies,e.dag.nodes.map(e=>`${e.task_id}: ${de(e.depends_on)}`).join(`
2
+ `)||`—`],[n.result,e.result??`—`],[n.file,e.artifact_path]]})}function ce({row:e,locale:t}){let n=I(t);return(0,l.jsx)(le,{items:[[n.status,e.status],[n.phase,e.phase],[n.entrypoint,e.entrypoint],[n.type,e.work_type],[t===`pt-BR`?`Tipo da chamada`:`Call type`,e.run_kind===`run`?t===`pt-BR`?`Invocação do orquestrador`:`Orchestrator invocation`:t===`pt-BR`?`Invocação delegada`:`Delegated invocation`],[t===`pt-BR`?`Propósito`:`Purpose`,e.run_purpose],[t===`pt-BR`?`Exige finalizador`:`Requires finalizer`,e.requires_finalizer?`sim`:`não`],[t===`pt-BR`?`Invocação pai`:`Parent invocation`,e.parent_run_id??`—`],[n.client,e.client],[n.agent,e.agent_name],[n.provider,e.provider??`—`],[t===`pt-BR`?`Modelo planejado`:`Planned model`,e.model],[t===`pt-BR`?`Effort planejado`:`Planned effort`,e.reasoning_effort??`—`],[t===`pt-BR`?`Modelo efetivo`:`Effective model`,e.effective_config_mixed?t===`pt-BR`?`Misto`:`Mixed`:e.effective_model??`—`],[t===`pt-BR`?`Effort efetivo`:`Effective effort`,e.effective_config_mixed?t===`pt-BR`?`Misto`:`Mixed`:e.effective_reasoning_effort??`—`],[`Task`,e.task_id??`—`],[`SPEC`,e.spec_id??`—`],[`PRD`,e.prd_id??`—`],[`Change`,e.change_id??`—`],[`Execution`,e.execution_id??`—`],[n.start,A(e.started_at,t)],[n.end,A(e.finished_at,t)],[n.duration,M(te(e),t)],[n.lifecycleElapsed,ae(ie(e),t)],[`Tokens`,D(e.usage.total.tokens.total,t)],[n.costBrl,k(e.usage.total.cost.brl,`BRL`,t)],[n.costUsd,k(e.usage.total.cost.usd,`USD`,t)],[n.file,e.artifact_path]]})}function le({items:e}){return(0,l.jsx)(`dl`,{className:`operations-entity-detail-grid`,children:e.map(([e,t])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`dt`,{children:e}),(0,l.jsx)(`dd`,{children:t})]},e))})}function ue(e){return e.type===`task`?`Task: ${e.task_id}`:e.type===`spec`?`SPEC: ${e.spec_id}`:e.type===`interaction`?`Conversation: ${e.conversation_id}`:`PRD: ${e.prd_id}${`spec_id`in e&&e.spec_id?` · SPEC: ${e.spec_id}`:``}`}function de(e){return e.length===0?`—`:e.join(`, `)}function fe(e,t){return(t===`pt-BR`?{change:`Mudança`,decision:`Decisão`,execution:`Execução ZAIP`,run:`Invocação de Agente`}:{change:`Change`,decision:`Decision`,execution:`Execution`,run:`Agent Invocation`})[e]}function I(e){return e===`pt-BR`?{details:`Detalhes de`,status:`Status`,risk:`Risco`,origin:`Origem`,created:`Criada`,tasks:`Tasks`,requirements:`Requisitos`,acceptanceCriteria:`Critérios de aceite`,result:`Resultado`,file:`Arquivo`,scopeType:`Tipo de escopo`,scope:`Escopo`,workStatus:`Status do trabalho`,tasksInDag:`Tasks na DAG`,topologicalOrder:`Ordem topológica`,dependencies:`Dependências`,phase:`Fase`,entrypoint:`Entrada`,type:`Tipo`,client:`Cliente`,agent:`Agente`,provider:`Provider`,model:`Modelo`,start:`Início`,end:`Fim`,duration:`Tempo`,lifecycleElapsed:`Tempo decorrido`,costBrl:`Custo BRL`,costUsd:`Custo USD`}:{details:`Details for`,status:`Status`,risk:`Risk`,origin:`Origin`,created:`Created`,tasks:`Tasks`,requirements:`Requirements`,acceptanceCriteria:`Acceptance criteria`,result:`Result`,file:`File`,scopeType:`Scope type`,scope:`Scope`,workStatus:`Work status`,tasksInDag:`Tasks in DAG`,topologicalOrder:`Topological order`,dependencies:`Dependencies`,phase:`Phase`,entrypoint:`Entrypoint`,type:`Type`,client:`Client`,agent:`Agent`,provider:`Provider`,model:`Model`,start:`Start`,end:`End`,duration:`Time`,lifecycleElapsed:`Elapsed time`,costBrl:`Cost BRL`,costUsd:`Cost USD`}}function pe(e,t){let n=e.filter(e=>e.kind===`interaction`&&e.origin.type===`interaction`),r=new Map;for(let e of n){let t=e.origin.type===`interaction`?e.origin.conversation_id:``;r.set(t,[...r.get(t)??[],e])}return[...r].map(([e,n])=>{let r=new Set(n.map(e=>e.id)),i=[...new Map(t.filter(t=>t.conversation_id===e||r.has(t.execution_id??``)).map(e=>[e.id,e])).values()],a=[...n.map(e=>e.created_at),...i.map(e=>e.started_at)].filter(e=>e!==null).sort().at(-1)??``,o=i.filter(e=>e.run_kind!==`subrun`&&e.parent_run_id==null).map(e=>re(e)),s=o.flatMap(({durationMs:e,provenance:t})=>t===`factual`&&e!==null?[e]:[]),c=o.flatMap(({durationMs:e,provenance:t})=>t===`lifecycle_elapsed`&&e!==null?[e]:[]),l=e=>{let t=e.filter(e=>e!==null);return t.length===0?null:t.reduce((e,t)=>e+t,0)},u=[...n].sort((e,t)=>(t.created_at??``).localeCompare(e.created_at??``))[0],d=i.map(e=>e.lifecycle_elapsed_ms).find(e=>e!==void 0),f=s.length>0?`factual`:c.length>0?`lifecycle_elapsed`:`unavailable`;return{id:e,latest_started_at:a??``,run_count:i.length,execution_count:n.length,status:u.status,duration_ms:s.length>0?s.reduce((e,t)=>e+t,0):c.length>0?c.reduce((e,t)=>e+t,0):null,duration_provenance:f,total_tokens:l(i.map(e=>e.usage?.total.tokens.total??null)),cost_brl:l(i.map(e=>e.usage?.total.cost.brl??null)),models:me(i.flatMap(e=>he(e.effective_model??e.model))),reasoning_efforts:me(i.flatMap(e=>he(e.effective_reasoning_effort??e.reasoning_effort))),...d===void 0?{}:{lifecycle_elapsed_ms:L(u.status)&&typeof d==`number`?d:null}}}).sort((e,t)=>t.latest_started_at.localeCompare(e.latest_started_at))}function L(e){return e===`completed`||e===`failed`||e===`cancelled`}function me(e){return[...new Set(e.filter(ge))].sort()}function he(e){return typeof e==`string`?e.split(`,`).map(e=>e.trim()):[]}function ge(e){return e!==``&&e.toLowerCase()!==`unknown`}function _e(e,t){return e.map((e,n)=>({row:e,index:n,timestamp:Date.parse(t(e)??``)})).sort((e,t)=>{let n=Number.isFinite(e.timestamp)?e.timestamp:-1/0;return(Number.isFinite(t.timestamp)?t.timestamp:-1/0)-n||e.index-t.index}).map(({row:e})=>e)}function ve({status:e}){return(0,l.jsx)(`span`,{className:`operations-table-status is-${e}`,children:e})}function R({risk:e}){return(0,l.jsx)(`span`,{className:`operations-table-risk is-${e}`,children:e})}function ye({entrypoint:e}){let t=e===`prd`?`PRD`:e===`spec`?`SPEC`:e===`task`?`Tarefa`:`Conversa`;return(0,l.jsx)(`span`,{className:`operations-table-entry is-${e}`,children:t})}function z({origin:e}){return(0,l.jsx)(`span`,{className:`operations-table-decision-origin is-${e}`,children:e})}function be({scopeType:e}){let t=e===`change`?`planning`:`execution`;return(0,l.jsx)(`span`,{className:`operations-table-stage is-${t}`,children:t===`planning`?`Planejamento`:`Execução`})}function B({rows:e,locale:t}){let[n,r]=(0,o.useState)(null);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b,{columns:[{key:`date`,label:`Data de criação`,render:e=>A(e.created_at)},{key:`title`,label:`Decisão`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.title}),(0,l.jsx)(`small`,{children:e.id})]})},{key:`origin`,label:`Origem`,render:e=>(0,l.jsx)(z,{origin:e.origin})},{key:`stage`,label:`Fase`,render:e=>(0,l.jsx)(be,{scopeType:e.scope_type})},{key:`scope`,label:`Escopo`,render:e=>`${e.scope_type}: ${e.scope_id}`}],locale:t,rowKey:e=>e.id,onRowClick:r,rows:_e(e,e=>e.created_at),showColumnInfo:!0,sortable:!0}),n?(0,l.jsx)(oe,{details:{kind:`decision`,row:n},locale:t,onClose:()=>r(null)}):null]})}function xe({rows:e,locale:t}){let[n,r]=(0,o.useState)(null);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b,{columns:[{key:`created`,label:`Criada`,render:e=>A(e.created_at)},{key:`title`,label:`Change`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.title}),(0,l.jsx)(`small`,{children:e.id})]})},{key:`status`,label:`Status`,render:e=>(0,l.jsx)(ve,{status:e.status})},{key:`risk`,label:`Risco`,render:e=>(0,l.jsx)(R,{risk:e.risk})},{key:`tasks`,label:`Tasks`,render:e=>e.task_ids.length,align:`right`},{key:`path`,label:`Arquivo`,render:e=>e.artifact_path}],locale:t,rowKey:e=>e.id,onRowClick:r,rows:_e(e,e=>e.created_at),showColumnInfo:!0,sortable:!0}),n?(0,l.jsx)(oe,{details:{kind:`change`,row:n},locale:t,onClose:()=>r(null)}):null]})}function Se({rows:e,locale:t,canonical:n=!0}){let[r,i]=(0,o.useState)(null),[a,s]=(0,o.useState)(`all`);if(!n||!Ae(e))return(0,l.jsx)(V,{locale:t,kind:`executions`});let c=_e(e.filter(e=>a===`all`||e.kind===a),e=>e.created_at);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`operations-execution-table`,children:[(0,l.jsx)(`div`,{className:`operations-toolbar operations-run-kind-toolbar`,children:(0,l.jsx)(`nav`,{"aria-label":t===`pt-BR`?`Tipo de execução`:`Execution type`,children:[`all`,`interaction`,`delivery`].map(e=>(0,l.jsx)(`button`,{className:a===e?`is-active`:void 0,onClick:()=>s(e),type:`button`,children:Ce(e,t)},e))})}),(0,l.jsx)(b,{columns:[{key:`created`,label:`Data de criação`,render:e=>A(e.created_at)},{key:`id`,label:t===`pt-BR`?`Execução`:`Execution`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:Ce(e.kind??`delivery`,t)}),(0,l.jsx)(`small`,{children:e.id})]})},{key:`status`,label:`Status`,render:e=>(0,l.jsx)(ve,{status:e.status})},{key:`origin`,label:`Origem`,render:e=>(0,l.jsx)(ye,{entrypoint:e.origin.type===`interaction`?`conversation`:e.origin.type})},{key:`duration`,label:t===`pt-BR`?`Tempo`:`Time`,render:e=>ne({durationMs:e.duration_ms,provenance:e.duration_ms===null&&e.status===`running`?`in_progress`:`factual`},t),align:`right`},{key:`tokens`,label:`Tokens`,render:e=>D(e.total_tokens??null,t),align:`right`},{key:`cost`,label:t===`pt-BR`?`Custo`:`Cost`,render:e=>k(e.cost_brl??null,`BRL`,t),align:`right`},{key:`runs`,label:t===`pt-BR`?`Invocações do orquestrador`:`Orchestrator invocations`,render:e=>we(e.orchestrator_run_count),align:`right`},{key:`finalizers`,label:t===`pt-BR`?`Finalizadores`:`Finalizers`,render:e=>`${we(e.finalized_task_count)}/${we(e.task_count)}`,align:`right`},{key:`tasks`,label:t===`pt-BR`?`Tarefas`:`Tasks`,render:e=>we(e.task_count),align:`right`},{key:`specs`,label:`SPEC`,render:e=>we(e.spec_count),align:`right`},{key:`prds`,label:`PRD`,render:e=>we(e.prd_count),align:`right`}],locale:t,rowKey:e=>e.id,onRowClick:i,rows:c,showColumnInfo:!0,sortable:!0})]}),r?(0,l.jsx)(oe,{details:{kind:`execution`,row:r},locale:t,onClose:()=>i(null)}):null]})}function Ce(e,t){return t===`pt-BR`?e===`all`?`Todas`:e===`interaction`?`Interações`:`Execuções de entrega`:e===`all`?`All`:e===`interaction`?`Interactions`:`Delivery executions`}function we(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function Te(e){return e.agent.toLowerCase()===`codex`?`codex`:e.agent_name||e.agent||`—`}function Ee(e){return(e.parent_run_id??e.task_id??e.conversation_id)||`—`}function De({rows:e,locale:t}){let[n,r]=(0,o.useState)(null),[i,a]=(0,o.useState)(`all`),s=_e(e.filter(e=>i===`all`||e.run_kind===i),e=>e.started_at),c=e=>e==null?`—`:new Intl.NumberFormat(t,{maximumFractionDigits:3}).format(e),u=e=>e==null?`—`:`${c(e)} / 1M`,d=e=>e==null?`—`:`${c(e)}×`,f=e=>e==null?`—`:k(e,`USD`,t),p=e=>e===`observed`?t===`pt-BR`?`Observada`:`Observed`:e===`reconciled`?t===`pt-BR`?`Reconciliada`:`Reconciled`:e===`estimated`?t===`pt-BR`?`Estimada por tokens`:`Token-estimated`:e===`legacy_inferred`?t===`pt-BR`?`Inferida histórica`:`Legacy inferred`:`—`;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`operations-toolbar operations-run-kind-toolbar`,children:(0,l.jsx)(`nav`,{"aria-label":t===`pt-BR`?`Tipo de chamada de agente`:`Agent call type`,children:[`all`,`run`,`subrun`].map(e=>(0,l.jsx)(`button`,{className:i===e?`is-active`:void 0,onClick:()=>a(e),type:`button`,children:e===`all`?t===`pt-BR`?`Todas`:`All`:e===`run`?t===`pt-BR`?`Invocações do orquestrador`:`Orchestrator invocations`:t===`pt-BR`?`Invocações delegadas`:`Delegated invocations`},e))})}),(0,l.jsx)(b,{columns:[{key:`created`,label:`Data de criação`,render:e=>A(e.started_at)},{key:`id`,label:t===`pt-BR`?`Invocação`:`Agent invocation`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.id}),(0,l.jsx)(`small`,{children:Ee(e)})]})},{key:`kind`,label:t===`pt-BR`?`Tipo`:`Type`,render:e=>e.run_kind===`run`?t===`pt-BR`?`Invocação do orquestrador`:`Orchestrator invocation`:t===`pt-BR`?`Invocação delegada`:`Delegated invocation`},{key:`agent`,label:t===`pt-BR`?`Agente`:`Agent`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:Te(e)}),(0,l.jsx)(`small`,{children:[e.agent_persona,e.agent_job].filter(Boolean).join(` · `)||`—`})]})},{key:`status`,label:`Status`,render:e=>(0,l.jsx)(ve,{status:e.status})},{key:`origin`,label:t===`pt-BR`?`Origem`:`Origin`,render:e=>(0,l.jsx)(ye,{entrypoint:e.entrypoint})},{key:`phase`,label:t===`pt-BR`?`Propósito`:`Purpose`,render:e=>Oe(e.run_purpose,t)},{key:`duration`,label:t===`pt-BR`?`Tempo total`:`Total time`,render:e=>ne(re(e),t)},{key:`duration_provenance`,label:t===`pt-BR`?`Fonte do tempo`:`Time source`,render:e=>{let n=re(e);return n.provenance===`lifecycle_elapsed`?t===`pt-BR`?`Tempo decorrido`:`Lifecycle elapsed`:n.provenance===`in_progress`?t===`pt-BR`?`Em andamento`:`In progress`:p(e.duration_provenance)}},{key:`llm_calls`,label:t===`pt-BR`?`Chamadas LLM`:`LLM calls`,render:e=>c(e.llm_call_count??e.call_count),align:`right`},{key:`provider`,label:`Provider`,render:e=>e.provider??`—`},{key:`model`,label:`Modelo`,render:e=>e.model||`—`},{key:`effort`,label:`Effort`,render:e=>e.effective_reasoning_effort??e.reasoning_effort??`—`},{key:`service_tier`,label:t===`pt-BR`?`Velocidade API`:`API speed`,render:e=>e.service_tier??`default`},{key:`input_tokens`,label:`Input`,render:e=>D(e.input_tokens??null,t),align:`right`},{key:`cached_tokens`,label:`Cache`,render:e=>D(e.cached_input_tokens??null,t),align:`right`},{key:`uncached_tokens`,label:t===`pt-BR`?`Input s/ cache`:`Uncached input`,render:e=>D(e.uncached_input_tokens??null,t),align:`right`},{key:`output_tokens`,label:`Output`,render:e=>D(e.output_tokens??null,t),align:`right`},{key:`reasoning_tokens`,label:`Reasoning`,render:e=>D(e.reasoning_tokens??null,t),align:`right`},{key:`tokens`,label:t===`pt-BR`?`Tokens totais`:`Total tokens`,render:e=>D(e.usage.total.tokens.total,t),align:`right`},{key:`input_rate`,label:t===`pt-BR`?`Tarifa input USD`:`Input rate USD`,render:e=>u(e.input_rate_usd_per_million),align:`right`},{key:`cached_rate`,label:t===`pt-BR`?`Tarifa cache USD`:`Cache rate USD`,render:e=>u(e.cached_input_rate_usd_per_million),align:`right`},{key:`output_rate`,label:t===`pt-BR`?`Tarifa output USD`:`Output rate USD`,render:e=>u(e.output_rate_usd_per_million),align:`right`},{key:`context_multiplier`,label:t===`pt-BR`?`Mult. contexto E/S`:`Context mult. I/O`,render:e=>`${d(e.context_input_multiplier)} / ${d(e.context_output_multiplier)}`},{key:`speed_multiplier`,label:t===`pt-BR`?`Mult. velocidade`:`Speed mult.`,render:e=>d(e.speed_cost_multiplier)},{key:`pricing_scenario`,label:t===`pt-BR`?`Cenário de preço`:`Pricing scenario`,render:e=>e.pricing_scenario===`standard_long_context_fallback`?t===`pt-BR`?`Standard (contexto longo)`:`Standard (long context)`:e.pricing_scenario??`—`},{key:`input_cost`,label:t===`pt-BR`?`Custo input USD`:`Input cost USD`,render:e=>f(e.input_cost_usd),align:`right`},{key:`cache_cost`,label:t===`pt-BR`?`Custo cache USD`:`Cache cost USD`,render:e=>f(e.cached_input_cost_usd),align:`right`},{key:`output_cost`,label:t===`pt-BR`?`Custo output USD`:`Output cost USD`,render:e=>f(e.output_cost_usd),align:`right`},{key:`reasoning_cost`,label:t===`pt-BR`?`Custo reasoning USD`:`Reasoning cost USD`,render:e=>f(e.reasoning_cost_usd),align:`right`},{key:`calculated_cost`,label:t===`pt-BR`?`Custo calculado USD`:`Calculated cost USD`,render:e=>f(e.calculated_cost_usd),align:`right`},{key:`canonical_cost`,label:t===`pt-BR`?`Custo canônico USD`:`Canonical cost USD`,render:e=>f(e.cost_usd),align:`right`},{key:`cost_variance`,label:t===`pt-BR`?`Diferença USD`:`Difference USD`,render:e=>f(e.cost_variance_usd),align:`right`},{key:`fx_rate`,label:`USD/BRL`,render:e=>c(e.fx_rate),align:`right`},{key:`cost`,label:t===`pt-BR`?`Custo total BRL`:`Total cost BRL`,render:e=>k(e.usage.total.cost.brl,`BRL`,t),align:`right`}],locale:t,rowKey:e=>e.id,onRowClick:r,rows:s,showColumnInfo:!0,sortable:!0}),n?(0,l.jsx)(oe,{details:{kind:`run`,row:n},locale:t,onClose:()=>r(null)}):null]})}function Oe(e,t){return t===`pt-BR`?{intake:`Entrada`,orchestration:`Orquestração`,execution:`Execução`,review:`Revisão`,audit:`Auditoria`,finalization:`Finalização`,observation:`Observação`}[e]:e}function ke({rows:e,executions:t,locale:n,canonical:r=!0}){if(!r||!je(t,e))return(0,l.jsx)(V,{locale:n,kind:`conversations`});let i=pe(t,e);return(0,l.jsx)(b,{columns:[{key:`created`,label:n===`pt-BR`?`Data e hora`:`Date and time`,render:e=>A(e.latest_started_at)},{key:`conversation`,label:n===`pt-BR`?`Conversa`:`Conversation`,render:e=>(0,l.jsx)(`strong`,{children:e.id})},{key:`status`,label:`Status`,render:e=>(0,l.jsx)(ve,{status:e.status})},{key:`runs`,label:n===`pt-BR`?`Invocações`:`Invocations`,render:e=>e.run_count,align:`right`},{key:`executions`,label:n===`pt-BR`?`Execuções`:`Executions`,render:e=>e.execution_count,align:`right`},{key:`duration`,label:n===`pt-BR`?`Tempo`:`Time`,render:e=>ne({durationMs:e.duration_ms,provenance:e.duration_ms===null&&e.status===`running`?`in_progress`:e.duration_provenance},n)},{key:`duration_provenance`,label:n===`pt-BR`?`Fonte do tempo`:`Time source`,render:e=>e.duration_provenance===`factual`?`Factual`:e.duration_provenance===`lifecycle_elapsed`?n===`pt-BR`?`Tempo decorrido`:`Lifecycle elapsed`:`—`},{key:`tokens`,label:`Tokens`,render:e=>D(e.total_tokens,n),align:`right`},{key:`cost`,label:n===`pt-BR`?`Custo`:`Cost`,render:e=>k(e.cost_brl,`BRL`,n),align:`right`},{key:`reasoning_efforts`,label:n===`pt-BR`?`Esforços`:`Reasoning efforts`,render:e=>e.reasoning_efforts.length>0?e.reasoning_efforts.join(`, `):`—`},{key:`models`,label:n===`pt-BR`?`Modelos`:`Models`,render:e=>e.models.length>0?e.models.join(`, `):`—`}],locale:n,rowKey:e=>e.id,rows:i,showColumnInfo:!0,sortable:!0})}function Ae(e){return e.every(e=>e.id.trim().length>0)}function je(e,t){return Ae(e)&&e.filter(e=>e.kind===`interaction`&&e.origin.type===`interaction`).every(e=>e.origin.conversation_id.trim().length>0)&&t.every(e=>e.id.trim().length>0&&(e.conversation_id?.trim().length??0)>0)}function V({kind:e,locale:t}){return(0,l.jsx)(`p`,{className:`operations-empty`,role:`status`,children:t===`pt-BR`?`Aguardando linhas canônicas de ${e===`conversations`?`conversas`:`execuções`}.`:`Waiting for canonical ${e} rows.`})}var Me=[`key`,`prds`,`specs`,`tasks`,`conversations`,`runs`,`tests`,`evidences`,`tokens`,`cost`,`duration_hours`],Ne=[`type`,`id`,`title`,`status`,`risk`,`developers`,`occurred_at`,`duration_hours`,`tokens`,`cost_brl`],Pe=[`id`,`kind`,`status`,`origin`,`task_id`,`conversation_id`,`created_at`,`finished_at`,`duration_hours`,`tokens`,`cost_brl`,`invocations`],H=[`run_id`,`execution_id`,`conversation_id`,`task_id`,`origin`,`run_role`,`run_purpose`,`phase`,`status`,`agent`,`provider`,`model`,`reasoning_effort`,`started_at`,`finished_at`,`duration_hours`,`input_tokens`,`cached_input_tokens`,`output_tokens`,`reasoning_tokens`,`total_tokens`,`estimated_usd`,`estimated_brl`],Fe=[`id`,`title`,`status`,`occurred_at`,`activities`,`invocations`,`duration_hours`,`tokens`,`cost_brl`],Ie=[`key`,`label`,`invocations`,`tasks`,`tokens`,`cost_usd`,`cost_brl`,`duration_hours`],Le=[`Persona`,`Cargo`,`Zaip Agentes`,`PRDs`,`SPECs`,`Tarefas`,`Runs`,`Testes`,`Evidências`,`Tempo`,`Tokens`,`Custos`],Re=[`model`,`prds`,`specs`,`tasks`,`conversations`,`runs`,`tests`,`evidences`,`duration_hours`,`tokens`,`costs`],ze=[`account_id`,`login_snapshot`,`prd_count`,`spec_count`,`task_count`,`run_count`,`test_count`,`evidence_count`,`total_duration_hours`,`total_tokens`,`total_cost_brl`,`duration_covered_runs`,`token_covered_runs`,`brl_covered_runs`],U=[`conversation_id`,`status`,`risk`,`started_at`,`finished_at`,`model`,`reasoning_effort`,`invocations`,`duration_hours`,`tokens`,`cost_brl`],Be=[`id`,`title`,`status`,`risk`,`source_type`,`source_id`,`requirement_ids_json`,`acceptance_ids_json`,`task_ids_json`,`occurred_at`],Ve=[`id`,`title`,`origin`,`scope_type`,`scope_id`,`occurred_at`];function He(e){return e.map(e=>Object.fromEntries(Ue(e).map(([e,t])=>{let n=Ge(e);return n===null?[e,typeof t==`object`&&t?JSON.stringify(t):t]:[n,typeof t==`number`?t/36e5:t]})))}function Ue(e){let t=We(e),n=Object.keys(t);return Me.some(e=>n.includes(e))?Me.filter(e=>n.includes(e)).map(e=>[e,t[e]]):Object.entries(e)}function We(e){return(`key`in e||`period_key`in e)&&(`prd_count`in e||`spec_count`in e||`run_count`in e||`total_run_count`in e||`costBrl`in e||`total_cost_brl`in e||`durationMs`in e||`operations_total_duration`in e||`tasksCreated`in e)?{key:e.key??e.period_key,prds:e.prds??e.prd_count,specs:e.specs??e.spec_count,tasks:e.tasks??e.tasksCreated??e.task_count,conversations:e.conversations??e.conversation_count??null,runs:e.runs??e.run_count??e.total_run_count??e.invocation_count,tests:e.tests??e.test_count??e.validation_count,evidences:e.evidences??e.evidence_count,duration_hours:typeof(e.durationMs??e.duration_ms??e.operations_total_duration??e.total_duration)==`number`?Number(e.durationMs??e.duration_ms??e.operations_total_duration??e.total_duration)/36e5:e.durationMs??e.duration_ms??e.operations_total_duration??e.total_duration??null,tokens:e.tokens??e.total_tokens,cost:e.cost??(`costBrl`in e?e.costBrl:`total_cost_brl`in e?e.total_cost_brl:e.estimated_brl)}:(Object.keys(e).some(e=>e!==`key`&&Me.includes(e)),e)}function Ge(e){return e===`durationMs`?`durationHours`:e.endsWith(`DurationMs`)?`${e.slice(0,-2)}Hours`:e===`duration_ms`?`duration_hours`:e.endsWith(`_duration_ms`)?`${e.slice(0,-2)}hours`:null}function Ke(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function W(e,t=`|`){return e.map(e=>gt(e)).join(t)}function qe(e,t){return typeof t==`bigint`?t.toString():t}var Je=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Ye(e){return new Je(e)}function Xe(e){return e==null}function Ze(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Qe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function $e(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function et(e){return $e(e._zod.def)??e._zod.def.shape}function tt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Qe(this,t,e),e},enumerable:!0,configurable:!0})}function nt(e,t,n){t in e?Qe(e,t,n):e[t]=n}function rt(e,t,n,r){let i=et(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?tt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):nt(e,a,r?r(n.value,a):n.value))}}function it(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?tt(e,n,()=>t[n]):nt(e,n,r.value))}}function at(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ot(e){return JSON.stringify(e)}function st(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ct=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function lt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ut=Ye(()=>{if(on.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function dt(e){if(lt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(lt(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ft(e){return dt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var pt=new Set([`string`,`number`,`symbol`]);function mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ht(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function gt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function _t(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var vt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},yt={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function bt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return rt(i,e,xt(e,t)),ht(e,at(n,{shape:i,checks:[]}))}function xt(e,t){let n=et(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function St(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(xt(e,t)),a={};return rt(a,e,Reflect.ownKeys(et(e)).filter(e=>!i.has(e))),ht(e,at(n,{shape:a,checks:[]}))}function Ct(e,t){if(!dt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=et(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ht(e,at(e._zod.def,{shape:wt(e,t)}))}function wt(e,t){let n={};return rt(n,e,Reflect.ownKeys(et(e))),it(n,t),n}function Tt(e,t){if(!dt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ht(e,at(e._zod.def,{shape:wt(e,t)}))}function Et(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return rt(n,e,Reflect.ownKeys(et(e))),rt(n,t,Reflect.ownKeys(et(t))),ht(e,at(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Dt(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(xt(t,n)):void 0,o={};return rt(o,t,Reflect.ownKeys(et(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),ht(t,at(t._zod.def,{shape:o,checks:[]}))}function Ot(e,t,n){let r=n?new Set(xt(t,n)):void 0,i={};return rt(i,t,Reflect.ownKeys(et(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),ht(t,at(t._zod.def,{shape:i}))}function kt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function At(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function jt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Mt(e){return typeof e==`string`?e:e?.message}function Nt(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Pt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ft(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Mt(e.inst?._zod.def?.error?.(e))??Mt(a?.(e))??Mt(t?.error?.(e))??Mt(n.customError?.(e))??Mt(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t===`inst`||t===`schema`||t===`continue`||t===`input`||t===`__proto__`||(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var It=/[\uD800-\uDBFF]/;function Lt(e){let t=e.length;if(!It.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Rt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function zt(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Bt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Vt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Gt(e,n,r.value)}}function Ht(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ut(e,t,n){return Ht(e,t,n,!1)}function Wt(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ht(this,n,r(this))},set(e){Ht(this,n,e)}})}return t}function Gt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ht(this,t,n.bind(this))},set(e){Ht(this,t,e)}})}function Kt(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var qt,Jt=!1,Yt={configurable:!0,get(){Jt=!0}};function K(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&qt!==e._zod){qt=void 0;return}qt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Yt);let e=Jt;Jt=!1;try{let r=n(this);return Jt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Jt||=e,r}catch(n){throw delete this[t],Jt||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Xt(e,t,n,r){let i=Kt(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Zt=`~constantCatch`;function Qt(e){let t=()=>e;return t[Zt]=!0,t}var $t,en={value:void 0,enumerable:!1},tn=`captureStackTrace`in Error?Error:null;function nn(e){let t=tn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return tn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){en.value=new a(r);try{Object.defineProperty(n,"_zod",en)}finally{en.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Vt(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?nn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var rn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},an=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};($t=globalThis).__zod_globalConfig??($t.__zod_globalConfig={});var on=globalThis.__zod_globalConfig;function sn(e){return e&&Object.assign(on,e),on}function cn(){let e=this._zod;return e.message??=JSON.stringify(e.def,qe,2),e.message}function ln(e){this._zod.message=e}var un={get:cn,set:ln,enumerable:!0,configurable:!0},dn={value:void 0,enumerable:!1},fn=new WeakSet([Object.prototype,Error.prototype]),pn=(e,t)=>{e.name=`$ZodError`,dn.value=t,Object.defineProperty(e,"issues",dn),dn.value=void 0,Object.defineProperty(e,"message",un);let n=Object.getPrototypeOf(e);fn.has(n)||(fn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},mn=q(`$ZodError`,pn);q(`$ZodError`,pn,void 0,{Parent:Error});function hn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function gn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?hn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function _n(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function vn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new rn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ft(e,o,sn())));throw ct(n,a?.callee??t),n}return s.value};return t},bn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ft(e,o,sn())));throw ct(n,a?.callee??t),n}return s.value};return t},xn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new rn;return a.issues.length?Sn(e,a.issues,i):{success:!0,data:a.value}};function Sn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ft(e,n,sn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Cn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Sn(e,a.issues,i):{success:!0,data:a.value}},wn=Symbol.for(`zod.compile.invalid`),Tn=Symbol.for(`zod.compile.fallback`),En=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==wn)return!0;if(r.definite===!0&&n===void 0)return!1}return Dn(e,t,n)});function Dn(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Tn]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new rn;return a.issues.length===0}var On=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},kn=e=>{let t=yn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,vn(n,a))};return n},An=e=>{let t=yn(e),n=(e,r,i,a)=>t(e,r,i,vn(n,a));return n},jn=e=>{let t=bn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,vn(n,a))};return n},Mn=e=>{let t=bn(e),n=async(e,r,i,a)=>await t(e,r,i,vn(n,a));return n},Nn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xn(e)(t,n,i)},Pn=e=>(t,n,r)=>xn(e)(t,n,r),Fn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Cn(e)(t,n,i)},In=e=>async(t,n,r)=>Cn(e)(t,n,r),Ln=/^[cC][0-9a-z]{6,}$/,Rn=/^[0-9a-z]+$/,zn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Bn=/^[0-9a-vA-V]{20}$/,Vn=/^[A-Za-z0-9]{27}$/,Hn=/^[a-zA-Z0-9_-]{21}$/;function Un(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Wn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Jn=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Yn(){return new RegExp(Jn,`u`)}var Xn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Qn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$n=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,er=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,nr=/^https?$/,rr=/^\+[1-9]\d{6,14}$/,ir=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function ar(e){return RegExp(`^${e}$`)}var or=ar(ir);function sr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cr(e){return RegExp(`^${sr(e)}$`)}function lr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${sr({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${sr({precision:e.precision})}`:n;return RegExp(`^${ir}T(?:${r})$`)}var ur=/^[\s\S]{0,}$/,dr=/^[^A-Z]*$/,fr=/^[^a-z]*$/,pr=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),mr=e=>{let t=e.value;return!Xe(t)&&t.length!==void 0},hr=q(`$ZodCheckMaxLength`,(e,t)=>{var n;pr.init(e,t),(n=e._zod.def).when??(n.when=mr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Lt(r):i)<=t.maximum)return;let a=Rt(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gr=q(`$ZodCheckMinLength`,(e,t)=>{var n;pr.init(e,t),(n=e._zod.def).when??(n.when=mr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Lt(r):i)>=t.minimum)return;let a=Rt(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_r=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;pr.init(e,t),(n=e._zod.def).when??(n.when=mr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Lt(r):i;if(a===t.length)return;let o=Rt(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),vr=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;pr.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),yr=q(`$ZodCheckRegex`,(e,t)=>{vr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),br=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=dr,vr.init(e,t)}),xr=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=fr,vr.init(e,t)}),Sr=q(`$ZodCheckIncludes`,(e,t)=>{pr.init(e,t);let n=mt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Cr=q(`$ZodCheckStartsWith`,(e,t)=>{pr.init(e,t);let n=RegExp(`^${mt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wr=q(`$ZodCheckEndsWith`,(e,t)=>{pr.init(e,t);let n=RegExp(`.*${mt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Tr=q(`$ZodCheckOverwrite`,(e,t)=>{pr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Er=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
4
+ `)}\n};`)(...Object.values(this.closed))}},Dr={major:4,minor:6,patch:6},J=q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dr;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=kt(t),a;for(let o of n){if(o._zod.def.when){if(At(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new rn;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Pt(t.issues,n,e),i||=kt(t,n))});else{if(t.issues.length===n)continue;Pt(t.issues,n,e),i||=kt(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(kt(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new rn;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new rn;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ut(this,`~standard`,Ar(this))},set"~standard"(e){Ht(this,`~standard`,e)}}),Or=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Ft(e,t,sn()))}:{value:e.value};async function kr(e,t){let n={async:!0};return Or(await e._zod.run({value:t,issues:[]},n),n)}function Ar(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Or(r,n)}catch{}return kr(e,t)},vendor:`zod`,version:1}}var jr=q(`$ZodString`,(e,t)=>{J.init(e,t),e._zod.pattern=t.pattern??ur,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Y=q(`$ZodStringFormat`,(e,t)=>{vr.init(e,t),jr.init(e,t)}),Mr=q(`$ZodGUID`,(e,t)=>{t.pattern??=Gn,Y.init(e,t)}),Nr=q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Kn(e)}else t.pattern??=Kn();Y.init(e,t)}),Pr=q(`$ZodEmail`,(e,t)=>{t.pattern??=qn,Y.init(e,t)});function Fr(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ir(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Fr(e)||2:Lr(e,t)}function Lr(e,t){if(!t.normalize&&t.protocol?.source===nr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Rr=/[\t\n\r]/g;function zr(e){return e.replace(Rr,``)}function Br(e,t){return t.lastIndex=0,t.test(e.hostname)}function Vr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Hr=q(`$ZodURL`,(e,t)=>{Y.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Ir(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=zr(r);return}t.hostname&&!Br(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Vr(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:zr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ur=q(`$ZodEmoji`,(e,t)=>{t.pattern??=Yn(),Y.init(e,t)}),Wr=q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Hn:Un(t.length),Y.init(e,t)}),Gr=q(`$ZodCUID`,(e,t)=>{t.pattern??=Ln,Y.init(e,t)}),Kr=q(`$ZodCUID2`,(e,t)=>{t.pattern??=Rn,Y.init(e,t)}),qr=q(`$ZodULID`,(e,t)=>{t.pattern??=zn,Y.init(e,t)}),Jr=q(`$ZodXID`,(e,t)=>{t.pattern??=Bn,Y.init(e,t)}),Yr=q(`$ZodKSUID`,(e,t)=>{t.pattern??=Vn,Y.init(e,t)}),Xr=q(`$ZodISODateTime`,(e,t)=>{t.pattern??=lr(t),Y.init(e,t)}),Zr=q(`$ZodISODate`,(e,t)=>{t.pattern??=or,Y.init(e,t)}),Qr=q(`$ZodISOTime`,(e,t)=>{t.pattern??=cr(t),Y.init(e,t)}),$r=q(`$ZodISODuration`,(e,t)=>{t.pattern??=Wn,Y.init(e,t)}),ei=q(`$ZodIPv4`,(e,t)=>{t.pattern??=Xn,Y.init(e,t)}),ti=/^[0-9a-fA-F:.]+$/;function ni(e){return ti.test(e)?Fr(`http://[${e}]`):!1}var ri=q(`$ZodIPv6`,(e,t)=>{t.pattern??=Zn,Y.init(e,t),e._zod.check=n=>{ni(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),ii=q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Qn,Y.init(e,t)});function ai(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ni(n)}var oi=q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=$n,Y.init(e,t),e._zod.check=n=>{ai(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function si(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ci=/^[0-9a-zA-Z+/]*={0,2}$/,li=q(`$ZodBase64`,(e,t)=>{t.pattern??=ci,Y.init(e,t),e._zod.check=n=>{si(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),ui=/^[A-Za-z0-9_-]*$/;function di(e){if(!ui.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return si(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var fi=q(`$ZodBase64URL`,(e,t)=>{t.pattern??=ui,Y.init(e,t),e._zod.check=n=>{di(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),pi=q(`$ZodE164`,(e,t)=>{t.pattern??=rr,Y.init(e,t)});function mi(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var hi=q(`$ZodJWT`,(e,t)=>{Y.init(e,t),e._zod.check=n=>{mi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),gi=q(`$ZodUnknown`,(e,t)=>{J.init(e,t),e._zod.parse=e=>e}),_i=q(`$ZodNever`,(e,t)=>{J.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function vi(e,t){let n=Nt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Nt(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Pt(n.issues,t,e),n}}return i(n,a)}}var yi=e=>Array.isArray(e)?e.length:-1;function bi(e,t,n){e.issues.length&&t.issues.push(...jt(n,e.issues)),t.value[n]=e.value}var xi=q(`$ZodArray`,(e,t)=>{J.init(e,t);let n=on.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>bi(t,r,e)));else if(bi(c,r,e),s&&c.issues.length!==0&&kt(c))break}return o.length?Promise.all(o).then(()=>r):r},vi(e,yi)});function Si(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...jt(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Ci=[];function wi(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ci,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=_t(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ti(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(kt(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Si(e,n,i,t,d,f))):Si(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ei=q(`$ZodObject`,(e,t)=>{J.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Ye(()=>wi(t));K(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Qe(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=lt,o=t.catchall,s,c=on.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(kt(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Si(n,t,e,r,a,o))):Si(s,t,e,r,a,o)}return o?Ti(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Di=q(`$ZodObjectJIT`,(e,t)=>{Ei.init(e,t);let n=e._zod.parse,r=Ye(()=>wi(t)),i=on.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Er([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
5
+ let ${e}_ab = false;
6
+ for (let i = 0; i < ${e}.issues.length; i++) {
7
+ const iss = ${e}.issues[i];
8
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
9
+ payload.issues.push(iss);
10
+ if (iss.continue !== true) ${e}_ab = true;
11
+ }
12
+ if (${e}_ab && ctx && ctx.abortEarly) {
13
+ payload.value = newResult;
14
+ return payload;
15
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:ot(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
16
+ const ${n}_present = ${i};
17
+ if (!${n}.issues.length || ${n}_present) {
18
+ if (${n}.issues.length) {${c(n,r)}
19
+ }
20
+
21
+ if (${e}) {
22
+ newResult[${r}] = ${n}.value;
23
+ }
24
+ }
25
+
26
+ `)}else f?(o.write(`
27
+ if (${n}.issues.length) {${c(n,r)}
28
+ }
29
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
30
+ if (${n}.value !== undefined || ${i}) {
31
+ newResult[${r}] = ${n}.value;
32
+ }
33
+ `)):o.write(`
34
+ const ${n}_present = ${i};
35
+ if (${n}.issues.length) {${c(n,r)}
36
+ }
37
+ if (!${n}_present && !${n}.issues.length) {
38
+ payload.issues.push({
39
+ code: "invalid_type",
40
+ expected: "nonoptional",
41
+ input: undefined,
42
+ path: [${r}]
43
+ });
44
+ if (ctx && ctx.abortEarly) {
45
+ payload.value = newResult;
46
+ return payload;
47
+ }
48
+ }
49
+
50
+ if (${n}_present) {
51
+ newResult[${r}] = ${n}.value;
52
+ }
53
+
54
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=lt,c=!on.jitless,l=c&&ut.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Ti([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Oi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!kt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ft(e,r,sn())))}),t)}var ki=q(`$ZodUnion`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),K(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),K(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),K(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Ze(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Oi(t,r,e,i)):Oi(o,r,e,i)}}),Ai=q(`$ZodIntersection`,(e,t)=>{J.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Mi(e,t,n)):Mi(e,i,a)}});function ji(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(dt(e)&&dt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=ji(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ji(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mi(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=ji(t.value,n.value);if(!c.valid){if(kt(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Ni=q(`$ZodEnum`,(e,t)=>{J.init(e,t);let n=Ke(t.entries),r=new Set(n);e._zod.values=r,K(e,`pattern`,e=>{let t=Ke(e.def.entries).filter(e=>pt.has(typeof e));return RegExp(t.length?`^(${t.map(e=>mt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Pi=q(`$ZodLiteral`,(e,t)=>{J.init(e,t);let n=new Set(t.values);e._zod.values=n,K(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?mt(e):e?mt(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Fi=q(`$ZodTransform`,(e,t)=>{J.init(e,t),e._zod.optin=`optional`,on.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new an(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new rn;return n.value=i,n}});function Ii(e,t){return e.value=t.issues.length?void 0:t.value,e}var Li=q(`$ZodOptional`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Ze(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Ii(e,t)):Ii(e,r)}return t.innerType._zod.run(e,n)}}),Ri=q(`$ZodExactOptional`,(e,t)=>{Li.init(e,t),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),zi=q(`$ZodNullable`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Ze(t.source)}|null)$`):void 0}),K(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Bi=q(`$ZodDefault`,(e,t)=>{J.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Vi(e,t)):Vi(r,t)}});function Vi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Hi=q(`$ZodPrefault`,(e,t)=>{J.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ui=q(`$ZodNonOptional`,(e,t)=>{J.init(e,t),K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Wi(t,e)):Wi(i,e)}});function Wi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Gi(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ft(e,r,sn()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Ki=q(`$ZodCatch`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Gi(e,r,t,n)):Gi(e,r,t,n)}}),qi=q(`$ZodPipe`,(e,t)=>{J.init(e,t),K(e,`values`,e=>e.def.in._zod.values),K(e,`optin`,e=>e.def.in._zod.optin),K(e,`optout`,e=>e.def.out._zod.optout),K(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ji(e,t.in,n)):Ji(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ji(e,t.out,n)):Ji(r,t.out,n)}});function Ji(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Yi=q(`$ZodReadonly`,(e,t)=>{J.init(e,t),K(e,`propValues`,e=>e.def.innerType._zod.propValues),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`optin`,e=>e.def.innerType?._zod?.optin),K(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Xi):Xi(r)}});function Xi(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Zi=q(`$ZodCustom`,(e,t)=>{pr.init(e,t),J.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Qi(t,n,r,e));Qi(i,n,r,e)}});function Qi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Bt(e))}}var $i=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ea=`~memo`,ta=[];function na(e){return typeof e==`object`&&!!e}function ra(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var ia=new WeakMap,aa=0,oa=1,sa=2;function ca(e,t,n){let r=ia.get(e);if(r!==void 0)return r?sa:aa;if(t.has(e))return sa;t.add(e);let i=aa,a=e=>{if(i!==sa&&e?._zod){let r=ca(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=aa;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?oa:o.value?._zod?ca(o.value,t,n):aa;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=$e(c);s(e?o(e,!0):oa),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?ca(r,t,!1):oa);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),la(e,i)}function la(e,t){return t!==oa&&ia.set(e,t===sa),t}function ua(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var da,fa=[],pa={alloc(e,t,n){let r=da;if(!r)return n;da=void 0;let i={value:n,issues:null};return r.set(t.value,i),fa.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ha(n,e.value))throw new $i;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=ca(e,new Set,!1);if(i===aa)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===sa||r?n=!0:r=!0}let l=s.value;if(!na(l))return t(s,c);let u=c[ea];u||(u={buckets:new WeakMap,backEdges:void 0},c[ea]=u);let d;i===c?d=a:(d=ua(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ra(f.issues)):(s.memo=!0,u.backEdges??=new WeakSet,u.backEdges.add(f.value)),s;da=d;let p=fa.length,m=t(s,c);da=void 0;let h=fa.length>p?fa.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ra(e.issues):ta),e)):(h&&(h.issues=m.issues.length?ra(m.issues):ta),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function ma(){return pa}function ha(e,t){let n=e[ea]?.backEdges;return n!==void 0&&na(t)&&n.has(t)}var ga=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(zt(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${gt(e.values[0])}`:`Invalid option: expected one of ${W(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${W(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function _a(){return{localeError:ga()}}var va,ya=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ba(){return new ya}(va=globalThis).__zod_globalRegistry??(va.__zod_globalRegistry=ba());var xa=globalThis.__zod_globalRegistry;function Sa(e){return e.checks&&=[...e.checks],e}function Ca(e,t){return new e(Sa({type:`string`,...G(t)}))}function wa(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...G(t)})}function Ta(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...G(t)})}function Ea(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...G(t)})}function Da(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...G(t)})}function Oa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...G(t)})}function ka(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...G(t)})}function Aa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...G(t)})}function ja(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...G(t)})}function Ma(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...G(t)})}function Na(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...G(t)})}function Pa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...G(t)})}function Fa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...G(t)})}function Ia(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...G(t)})}function La(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...G(t)})}function Ra(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...G(t)})}function za(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...G(t)})}function Ba(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...G(t)})}function Va(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...G(t)})}function Ha(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...G(t)})}function Ua(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...G(t)})}function Wa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...G(t)})}function Ga(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...G(t)})}function Ka(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...G(t)})}function qa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...G(t)})}function Ja(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...G(t)})}function Ya(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...G(t)})}function Xa(e){return new e({type:`unknown`})}function Za(e,t){return new e({type:`never`,...G(t)})}function Qa(e,t){return new hr({check:`max_length`,...G(t),maximum:e})}function $a(e,t){return new gr({check:`min_length`,...G(t),minimum:e})}function eo(e,t){return new _r({check:`length_equals`,...G(t),length:e})}function to(e,t){return new yr({check:`string_format`,format:`regex`,...G(t),pattern:e})}function no(e){return new br({check:`string_format`,format:`lowercase`,...G(e)})}function ro(e){return new xr({check:`string_format`,format:`uppercase`,...G(e)})}function io(e,t){return new Sr({check:`string_format`,format:`includes`,...G(t),includes:e})}function ao(e,t){return new Cr({check:`string_format`,format:`starts_with`,...G(t),prefix:e})}function oo(e,t){return new wr({check:`string_format`,format:`ends_with`,...G(t),suffix:e})}function so(e){return new Tr({check:`overwrite`,tx:e})}function co(e){return so(t=>t.normalize(e))}function lo(){return so(e=>e.trim())}function uo(){return so(e=>e.toLowerCase())}function fo(){return so(e=>e.toUpperCase())}function po(){return so(e=>st(e))}function mo(e,t,n){return new e({type:`array`,element:t,...G(n)})}function ho(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...G(n)})}function go(e,t){let n=_o(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Bt(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Bt(r))}},e(t.value,t)),t);return n}function _o(e,t){let n=new pr({check:`custom`,...G(t)});return n._zod.check=e,n}function vo(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Qe(e,t,n[t]);return e}function yo(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??xa,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function bo(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function xo(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,xo(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&vo(o.schema,c),t.io===`input`&&jo(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function So(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Co(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${So(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+So(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
55
+
56
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function wo(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;wo(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var To=new Set([`type`,`properties`,`required`,`additionalProperties`]),Eo=[`oneOf`,`anyOf`];function Do(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Oo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!To.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Do(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Qe(n,r,e.length===1?e[0]:Oo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Do(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function ko(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of To)if(t in e)return;let n=t.filter(e=>Eo.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Oo(t);else{let e=n[0],i=Eo.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Oo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,vo(e,r))}function Ao(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):vo(i,s),vo(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())wo(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])ko(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}vo(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Qe(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:No(t,`input`,e.processors),output:No(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function jo(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return jo(r.element,n);if(r.type===`set`)return jo(r.valueType,n);if(r.type===`lazy`)return jo(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return jo(r.innerType,n);if(r.type===`intersection`)return jo(r.left,n)||jo(r.right,n);if(r.type===`record`||r.type===`map`)return jo(r.keyType,n)||jo(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:jo(r.in,n)||jo(r.out,n);if(r.type===`object`){for(let e in r.shape)if(jo(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(jo(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(jo(e,n))return!0;return!!(r.rest&&jo(r.rest,n))}return!1}var Mo=(e,t={})=>n=>{let r=yo({...n,processors:t});return xo(e,r),Co(r,e),Ao(r,e)},No=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=yo({...i??{},target:a,io:t,processors:n});return xo(e,o),Co(o,e),Ao(o,e)},Po=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Fo=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Io=(e,t)=>{Po(e,`minimum`,t),Fo(e,`maximum`,t)},Lo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Ro=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},zo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Bo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Vo=(e,t)=>Po(e,`minimum`,t.minimum),Ho=(e,t)=>Fo(e,`maximum`,t.maximum),Uo=e=>(t,n)=>{Bo(t,n.format);let[r,i]=e[n.format];Po(t,`minimum`,r),Fo(t,`maximum`,i)},Wo={greater_than:(e,t)=>Po(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Fo(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Lo(e,t.value),number_format:Uo(vt),bigint_format:Uo(yt),min_length:Vo,max_length:Ho,length_equals:(e,t)=>Io(e,t.length),min_size:Vo,max_size:Ho,size_equals:(e,t)=>Io(e,t.size),string_format:(e,t)=>{Bo(e,t.format),t.pattern&&Ro(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>zo(e,t.mime)};function Go(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Wo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Po(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Po(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Fo(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Fo(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Lo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&zo(t,i.mime);for(let e of i.patterns??[])Ro(t,e);return t}var Ko={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},qo=new Map([[ci,er],[ui,tr]]),Jo=e=>qo.get(e)??e,Yo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Go(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ko[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Jo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Xo=(e,t,n,r)=>{n.not={}},Zo=(e,t,n,r)=>{let i=e._zod.def,a=Ke(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Qo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(bo(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(bo(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},$o=(e,t,n,r)=>{bo(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},es=(e,t,n,r)=>{bo(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ts=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Go(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=xo(a.element,t,{...r,path:[...r.path,`items`]})};function ns(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ns(t.out):t.type===`catch`?ns(t.innerType):e._zod.optin}var rs=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&bo(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Qe(i.properties,e,xo(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ns(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=xo(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},is=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>xo(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},as=(e,t,n,r)=>{let i=e._zod.def,a=xo(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=xo(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},os=(e,t,n,r)=>{let i=e._zod.def,a=xo(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ss=(e,t,n,r)=>{let i=e._zod.def;xo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},cs=Symbol();function ls(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(bo(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),cs):JSON.parse(o)}var us=(e,t,n,r)=>{let i=e._zod.def;xo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=ls(i.defaultValue,e,t,n,r);o!==cs&&(n.default=o)},ds=(e,t,n,r)=>{let i=e._zod.def;xo(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=ls(i.defaultValue,e,t,n,r);o!==cs&&(n._prefault=o)},fs=(e,t,n,r)=>{let i=e._zod.def;xo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{bo(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ps=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;xo(o,t,r);let s=t.seen.get(e);s.ref=o},ms=(e,t,n,r)=>{let i=e._zod.def;xo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},hs=(e,t,n,r)=>{let i=e._zod.def;xo(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},gs=new WeakSet([Object.prototype,Error.prototype]);function _s(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var vs=q(`ZodError`,(e,t)=>{mn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);gs.has(n)||(gs.add(n),_s(n,`format`,e=>t=>_n(e,t)),_s(n,`flatten`,e=>t=>gn(e,t)),_s(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,qe,2)}),_s(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,qe,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ys=yn(vs),bs=bn(vs),xs=xn(vs),Ss=Cn(vs),Cs=kn(vs),ws=An(vs),Ts=jn(vs),Es=Mn(vs),Ds=Nn(vs),Os=Pn(vs),ks=Fn(vs),As=In(vs);function js(){on.localeError||sn(_a())}function Ms(){on.memoizer||sn({memoizer:ma()})}var X=q(`ZodType`,(e,t)=>(js(),J.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(at(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ht(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Hc(e,t))},superRefine(e,t){return this.check(Uc(e,t))},overwrite(e){return this.check(so(e))},optional(){return wc(this)},exactOptional(){return Ec(this)},nullable(){return Oc(this)},nullish(){return wc(Oc(this))},nonoptional(e){return Pc(this,e)},array(){return uc(this)},or(e){return mc([this,e])},and(e){return gc(this,e)},transform(e){return Rc(this,Sc(e))},default(e){return Ac(this,e)},prefault(e){return Mc(this,e)},catch(e){return Ic(this,e)},pipe(e){return Rc(this,e)},readonly(){return Bc(this)},describe(e){let t=this.clone();return xa.add(t,{description:e}),t},meta(...e){if(e.length===0)return xa.get(this);let t=this.clone();return xa.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ut(this,`~standard`,{...Ar(this),jsonSchema:{input:No(this,`input`),output:No(this,`output`)}})},set"~standard"(e){Ht(this,`~standard`,e)},parse:function e(t,n){return ys(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await bs(this,t,n,{callee:e})},safeParse(e,t){return xs(this,e,t)},async safeParseAsync(e,t){return Ss(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ht(this,`spa`,e)},validate(e,t){return En(this,e,t)},validateAsync(e,t){return On(this,e,t)},encode:function e(t,n){return Cs(this,t,n,{callee:e})},decode:function e(t,n){return ws(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Ts(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Es(this,t,n,{callee:e})},safeEncode(e,t){return Ds(this,e,t)},safeDecode(e,t){return Os(this,e,t)},async safeEncodeAsync(e,t){return ks(this,e,t)},async safeDecodeAsync(e,t){return As(this,e,t)},toJSONSchema(e){return Mo(this,{})(e)},get description(){return xa.get(this)?.description},get _def(){return this._zod.def}}),Ns=q(`_ZodString`,(e,t)=>{jr.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r)},Wt({format:e=>Go(e).format??null,minLength:e=>Go(e).minimum??null,maxLength:e=>Go(e).maximum??null},{regex(...e){return this.check(to(...e))},includes(...e){return this.check(io(...e))},startsWith(...e){return this.check(ao(...e))},endsWith(...e){return this.check(oo(...e))},min(...e){return this.check($a(...e))},max(...e){return this.check(Qa(...e))},length(...e){return this.check(eo(...e))},nonempty(...e){return this.check($a(1,...e))},lowercase(e){return this.check(no(e))},uppercase(e){return this.check(ro(e))},trim(){return this.check(lo())},normalize(...e){return this.check(co(...e))},toLowerCase(){return this.check(uo())},toUpperCase(){return this.check(fo())},slugify(){return this.check(po())}})),Ps=q(`ZodString`,(e,t)=>{jr.init(e,t),Ns.init(e,t)},{email(e){return this.check(wa(Bs,e))},url(e){return this.check(Aa(Us,e))},jwt(e){return this.check(Ga(ic,e))},emoji(e){return this.check(ja(Ws,e))},guid(e){return this.check(Ta(Vs,e))},uuid(e){return this.check(Ea(Hs,e))},uuidv4(e){return this.check(Da(Hs,e))},uuidv6(e){return this.check(Oa(Hs,e))},uuidv7(e){return this.check(ka(Hs,e))},nanoid(e){return this.check(Ma(Gs,e))},cuid(e){return this.check(Na(Ks,e))},cuid2(e){return this.check(Pa(qs,e))},ulid(e){return this.check(Fa(Js,e))},base64(e){return this.check(Ha(tc,e))},base64url(e){return this.check(Ua(nc,e))},xid(e){return this.check(Ia(Ys,e))},ksuid(e){return this.check(La(Xs,e))},ipv4(e){return this.check(Ra(Zs,e))},ipv6(e){return this.check(za(Qs,e))},cidrv4(e){return this.check(Ba($s,e))},cidrv6(e){return this.check(Va(ec,e))},e164(e){return this.check(Wa(rc,e))},datetime(e){return this.check(Ka(Is,e))},date(e){return this.check(qa(Ls,e))},time(e){return this.check(Ja(Rs,e))},duration(e){return this.check(Ya(zs,e))}});function Fs(e){return Ca(Ps,e)}var Z=q(`ZodStringFormat`,(e,t)=>{Y.init(e,t),Ns.init(e,t)}),Is=q(`ZodISODateTime`,(e,t)=>{Xr.init(e,t),Z.init(e,t)}),Ls=q(`ZodISODate`,(e,t)=>{Zr.init(e,t),Z.init(e,t)}),Rs=q(`ZodISOTime`,(e,t)=>{Qr.init(e,t),Z.init(e,t)}),zs=q(`ZodISODuration`,(e,t)=>{$r.init(e,t),Z.init(e,t)}),Bs=q(`ZodEmail`,(e,t)=>{Pr.init(e,t),Z.init(e,t)}),Vs=q(`ZodGUID`,(e,t)=>{Mr.init(e,t),Z.init(e,t)}),Hs=q(`ZodUUID`,(e,t)=>{Nr.init(e,t),Z.init(e,t)}),Us=q(`ZodURL`,(e,t)=>{Hr.init(e,t),Z.init(e,t)}),Ws=q(`ZodEmoji`,(e,t)=>{Ur.init(e,t),Z.init(e,t)}),Gs=q(`ZodNanoID`,(e,t)=>{Wr.init(e,t),Z.init(e,t)}),Ks=q(`ZodCUID`,(e,t)=>{Gr.init(e,t),Z.init(e,t)}),qs=q(`ZodCUID2`,(e,t)=>{Kr.init(e,t),Z.init(e,t)}),Js=q(`ZodULID`,(e,t)=>{qr.init(e,t),Z.init(e,t)}),Ys=q(`ZodXID`,(e,t)=>{Jr.init(e,t),Z.init(e,t)}),Xs=q(`ZodKSUID`,(e,t)=>{Yr.init(e,t),Z.init(e,t)}),Zs=q(`ZodIPv4`,(e,t)=>{ei.init(e,t),Z.init(e,t)}),Qs=q(`ZodIPv6`,(e,t)=>{ri.init(e,t),Z.init(e,t)}),$s=q(`ZodCIDRv4`,(e,t)=>{ii.init(e,t),Z.init(e,t)}),ec=q(`ZodCIDRv6`,(e,t)=>{oi.init(e,t),Z.init(e,t)}),tc=q(`ZodBase64`,(e,t)=>{li.init(e,t),Z.init(e,t)}),nc=q(`ZodBase64URL`,(e,t)=>{fi.init(e,t),Z.init(e,t)}),rc=q(`ZodE164`,(e,t)=>{pi.init(e,t),Z.init(e,t)}),ic=q(`ZodJWT`,(e,t)=>{hi.init(e,t),Z.init(e,t)}),ac=q(`ZodUnknown`,(e,t)=>{gi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function oc(){return Xa(ac)}var sc=q(`ZodNever`,(e,t)=>{_i.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r)});function cc(e){return Za(sc,e)}var lc=q(`ZodArray`,(e,t)=>{Ms(),xi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.element=t.element},{min(e,t){return this.check($a(e,t))},nonempty(e){return this.check($a(1,e))},max(e,t){return this.check(Qa(e,t))},length(e,t){return this.check(eo(e,t))},unwrap(){return this.element}});function uc(e,t){return mo(lc,e,t)}var dc=q(`ZodObject`,(e,t)=>{Ms(),Di.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),Xt(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return vc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(at(this._zod.def,{catchall:e}))},passthrough(){return this.clone(at(this._zod.def,{catchall:oc()}))},loose(){return this.clone(at(this._zod.def,{catchall:oc()}))},strict(){return this.clone(at(this._zod.def,{catchall:cc()}))},strip(){return this.clone(at(this._zod.def,{catchall:void 0}))},extend(e){return Ct(this,e)},safeExtend(e){return Tt(this,e)},merge(e){return Et(this,e)},pick(e){return bt(this,e)},omit(e){return St(this,e)},partial(...e){return Dt(Cc,this,e[0])},exactPartial(...e){return Dt(Tc,this,e[0],`exactPartial`)},required(...e){return Ot(Nc,this,e[0])}});function fc(e,t){return new dc({type:`object`,shape:e??{},...G(t)})}var pc=q(`ZodUnion`,(e,t)=>{ki.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.options=t.options});function mc(e,t){return new pc({type:`union`,options:e,...G(t)})}var hc=q(`ZodIntersection`,(e,t)=>{Ai.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r)});function gc(e,t){return new hc({type:`intersection`,left:e,right:t})}var _c=q(`ZodEnum`,(e,t)=>{Ni.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new _c({...t,checks:[],...G(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new _c({...t,checks:[],...G(r),entries:i})}});function vc(e,t){return new _c({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...G(t)})}var yc=q(`ZodLiteral`,(e,t)=>{Pi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function bc(e,t){return new yc({type:`literal`,values:Array.isArray(e)?e:[e],...G(t)})}var xc=q(`ZodTransform`,(e,t)=>{Ms(),Fi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new an(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Bt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Bt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Sc(e){return new xc({type:`transform`,transform:e})}var Cc=q(`ZodOptional`,(e,t)=>{Li.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wc(e){return new Cc({type:`optional`,innerType:e})}var Tc=q(`ZodExactOptional`,(e,t)=>{Ri.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ec(e){return new Tc({type:`optional`,innerType:e})}var Dc=q(`ZodNullable`,(e,t)=>{zi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oc(e){return new Dc({type:`nullable`,innerType:e})}var kc=q(`ZodDefault`,(e,t)=>{Bi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ac(e,t){return new kc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ft(t)}})}var jc=q(`ZodPrefault`,(e,t)=>{Hi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mc(e,t){return new jc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ft(t)}})}var Nc=q(`ZodNonOptional`,(e,t)=>{Ui.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pc(e,t){return new Nc({type:`nonoptional`,innerType:e,...G(t)})}var Fc=q(`ZodCatch`,(e,t)=>{Ki.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ic(e,t){return new Fc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Qt(t)})}var Lc=q(`ZodPipe`,(e,t)=>{qi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r),e.in=t.in,e.out=t.out});function Rc(e,t){return new Lc({type:`pipe`,in:e,out:t})}var zc=q(`ZodReadonly`,(e,t)=>{Yi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ms(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bc(e){return new zc({type:`readonly`,innerType:e})}var Vc=q(`ZodCustom`,(e,t)=>{Zi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r)});function Hc(e,t={}){return ho(Vc,e,t)}function Uc(e,t){return go(e,t)}function Wc(e){if(!Number.isSafeInteger(e.totalRows)||e.totalRows<0)throw TypeError(`totalRows must be a non-negative safe integer`);return Object.freeze({...e,version:2,filters:Object.freeze({...e.filters})})}var Gc={health:`/api/v2/health`,snapshot:`/api/v2/snapshot`,refreshProjection:`/api/v2/refresh-projection`,reconcileOpenWork:`/api/v2/reconcile-open-work`,operations:`/api/v2/operations`,costMonitor:`/api/v2/cost-monitor`,agentCatalog:`/api/v2/agent-catalog`,projectSettings:`/api/v2/project-settings`,workPriority:`/api/v2/work-priority`,prd:e=>`/api/v2/prds/${encodeURIComponent(e)}`,spec:e=>`/api/v2/specs/${encodeURIComponent(e)}`,task:e=>`/api/v2/tasks/${encodeURIComponent(e)}`,taskTrace:e=>`/api/v2/tasks/${encodeURIComponent(e)}/trace`};fc({from:Fs().datetime({offset:!0}).nullable(),to:Fs().datetime({offset:!0}).nullable()}).strict();var Kc=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),qc=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Jc={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Yc=(0,o.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:s,...c},l)=>(0,o.createElement)(`svg`,{ref:l,...Jc,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:qc(`lucide`,i),...c},[...s.map(([e,t])=>(0,o.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Xc=(e,t)=>{let n=(0,o.forwardRef)(({className:n,...r},i)=>(0,o.createElement)(Yc,{ref:i,iconNode:t,className:qc(`lucide-${Kc(e)}`,n),...r}));return n.displayName=`${e}`,n},Zc=Xc(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Qc=Xc(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),$c=Xc(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),el=Xc(`CircleDot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),tl=Xc(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),nl=Xc(`Coins`,[[`circle`,{cx:`8`,cy:`8`,r:`6`,key:`3yglwk`}],[`path`,{d:`M18.09 10.37A6 6 0 1 1 10.34 18`,key:`t5s6rm`}],[`path`,{d:`M7 6h1v4`,key:`1obek4`}],[`path`,{d:`m16.71 13.88.7.71-2.82 2.82`,key:`1rbuyh`}]]),rl=Xc(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),il=Xc(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),al=Xc(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ol=Xc(`GitBranch`,[[`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`}]]),sl=Xc(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),cl=Xc(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),ll=Xc(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ul=Xc(`RotateCw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),dl=Xc(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),fl=Xc(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),pl=Xc(`Zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);function ml(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return typeof t.account_id==`string`&&(typeof t.login_snapshot==`string`||t.login_snapshot===null)}function hl(e){if(!Array.isArray(e))return`—`;let t=e.filter(ml);return t.length===0?`—`:t.map(({account_id:e,login_snapshot:t})=>t===null||t.length===0?e:`${t} (${e})`).join(`; `)}function gl({progress:e,keepOpen:t=!0}){return(0,l.jsxs)(`aside`,{"aria-live":`polite`,className:`export-progress`,role:`status`,children:[(0,l.jsx)(`strong`,{children:`Exportação em andamento`}),(0,l.jsx)(`progress`,{max:100,value:e,"aria-label":`Progresso da exportação`}),t&&(0,l.jsx)(`span`,{children:`Mantenha a página aberta.`}),(0,l.jsxs)(`span`,{children:[Math.round(e),`%`]})]})}function _l(){return(0,l.jsx)(`aside`,{"aria-live":`polite`,className:`export-success`,role:`status`,children:`Exportação concluída.`})}var vl=new TextEncoder,yl=4294967295,bl=Uint32Array.from({length:256},(e,t)=>{let n=t;for(let e=0;e<8;e++)n=n>>>1^(n&1?3988292384:0);return n>>>0}),xl=class{writable;metas=[];offset=0;closed=!1;constructor(e){this.writable=e}entry(e){let t=El(e),n=this.put(Ol(t)),r=4294967295,i=0,a=!1;return{ready:n,write:async e=>{if(await n,a)throw Error(`ZIP entry is already closed`);if(i+e.length>yl)throw RangeError(`ZIP32 entry size exceeded`);r=Nl(e,r),i+=e.length,await this.put(e)},close:async()=>{if(await n,a)return;a=!0;let o=(r^4294967295)>>>0;await this.put(kl(o,i)),this.metas.push({name:e,crc:o,size:i,offset:this.offset-i-16-t.length-30})},abort:e=>this.writable.abort?.(e)??Promise.resolve()}}async close(){if(this.closed)return;this.closed=!0;let e=this.offset;for(let e of this.metas)await this.put(Al(e));await this.put(jl(this.metas.length,this.offset-e,e)),await this.writable.close()}async abort(e){this.closed=!0,await this.writable.abort?.(e)}async put(e){if(this.offset+e.length>yl)throw RangeError(`ZIP32 size exceeded`);await this.writable.ready,await this.writable.write(e),this.offset+=e.length}};async function Sl(e){if(e.headers.length===0||e.headers.length>16384)throw RangeError(`XLSX supports columns A through XFD`);let t=wl(Cl(e.headers,e.rows)),n=[{name:`Context`,values:e.context},{name:`Financial summary`,values:e.financialSummary}].filter(e=>e.values!==void 0),r=n.map((e,t)=>`<Relationship Id="rId${t+3}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${t+2}.xml"/>`).join(``),i=n.map((e,t)=>`<sheet name="${e.name}" sheetId="${t+2}" r:id="rId${t+3}"/>`).join(``);await Tl([Dl(`[Content_Types].xml`,`<?xml version="1.0"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>`+n.map((e,t)=>`<Override PartName="/xl/worksheets/sheet${t+2}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join(``)+`</Types>`),Dl(`_rels/.rels`,`<?xml version="1.0"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`),Dl(`xl/workbook.xml`,`<?xml version="1.0"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="Export" sheetId="1" r:id="rId1"/>`+i+`</sheets></workbook>`),Dl(`xl/_rels/workbook.xml.rels`,`<?xml version="1.0"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>`+r+`</Relationships>`),Dl(`xl/styles.xml`,`<?xml version="1.0"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="2"><font/><font><b/></font></fonts><fills count="1"><fill><patternFill patternType="none"/></fill></fills><borders count="1"><border/></borders><cellStyleXfs count="1"><xf/></cellStyleXfs><cellXfs count="2"><xf fontId="0" fillId="0" borderId="0" xfId="0"/><xf fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/></cellXfs></styleSheet>`),{name:`xl/worksheets/sheet1.xml`,chunks:t},...n.map((e,t)=>({name:`xl/worksheets/sheet${t+2}.xml`,chunks:wl(Cl([`Field`,`Value`],(async function*(){for(let[t,n]of Object.entries(e.values))yield{values:[t,typeof n==`object`&&n?JSON.stringify(n):n]}})()))}))],e.writable)}async function*Cl(e,t){let n=Pl(e.length);yield El(`<?xml version="1.0"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews><sheetData><row r="1">`),yield El(e.map((e,t)=>Il(`${Pl(t+1)}1`,e,1)).join(``)),yield El(`</row>`);let r=1;for await(let e of t){if(++r>1000001)throw RangeError(`A worksheet cannot exceed 1,000,000 data rows`);yield El(`<row r="${r}">${e.values.map((e,t)=>Il(`${Pl(t+1)}${r}`,e,0)).join(``)}</row>`)}yield El(`</sheetData><autoFilter ref="A1:${n}1"/></worksheet>`)}async function*wl(e,t=64*1024){let n=[],r=0,i=()=>{let e=new Uint8Array(r),t=0;for(let r of n)e.set(r,t),t+=r.length;return n=[],r=0,e};for await(let a of e){if(a.length>=t){r&&(yield i()),yield a;continue}r+a.length>t&&r&&(yield i()),n.push(a),r+=a.length}r&&(yield i())}async function Tl(e,t){let n=new xl(t);try{for(let t of e){let e=n.entry(t.name);for await(let n of t.chunks)await e.write(n);await e.close()}await n.close()}catch(e){throw await n.abort(e),e}}var El=e=>vl.encode(e),Dl=(e,t)=>({name:e,chunks:(async function*(){yield El(t)})()}),Ol=e=>Ml(30,e,t=>{t.setUint32(0,67324752,!0),t.setUint16(4,20,!0),t.setUint16(6,8,!0),t.setUint16(26,e.length,!0)}),kl=(e,t)=>{let n=new Uint8Array(16),r=new DataView(n.buffer);return r.setUint32(0,134695760,!0),r.setUint32(4,e,!0),r.setUint32(8,t,!0),r.setUint32(12,t,!0),n},Al=e=>Ml(46,El(e.name),t=>{t.setUint32(0,33639248,!0),t.setUint16(4,20,!0),t.setUint16(6,20,!0),t.setUint16(8,8,!0),t.setUint32(16,e.crc,!0),t.setUint32(20,e.size,!0),t.setUint32(24,e.size,!0),t.setUint16(28,El(e.name).length,!0),t.setUint32(42,e.offset,!0)}),jl=(e,t,n)=>{let r=new Uint8Array(22),i=new DataView(r.buffer);return i.setUint32(0,101010256,!0),i.setUint16(8,e,!0),i.setUint16(10,e,!0),i.setUint32(12,t,!0),i.setUint32(16,n,!0),r},Ml=(e,t,n)=>{let r=new Uint8Array(e+t.length);return n(new DataView(r.buffer)),r.set(t,e),r},Nl=(e,t)=>{for(let n of e)t=(bl[(t^n)&255]??0)^t>>>8;return t>>>0},Pl=e=>{let t=``;for(;e;)e--,t=String.fromCharCode(65+e%26)+t,e=Math.floor(e/26);return t},Fl=e=>String(e??``).replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&apos;`})[e]??e),Il=(e,t,n)=>typeof t==`number`?`<c r="${e}" s="${n}"><v>${t}</v></c>`:`<c r="${e}" s="${n}" t="inlineStr"><is><t>${Fl(t)}</t></is></c>`;async function Ll(e){let t=e.maxRowsPerFile??1e6;if(!Number.isSafeInteger(t)||t<1||t>1e6)throw TypeError(`maxRowsPerFile must be from 1 through 1,000,000`);let n=Math.max(1,Math.ceil(e.snapshot.totalRows/t)),r=Rl(e.snapshot.pages())[Symbol.asyncIterator](),i=1,a=0,o=-1,s=async()=>{let s=i++,c=0;await Sl({headers:e.headers,rows:(async function*(){for(;c<t&&a<e.snapshot.totalRows;){let n=await r.next();if(n.done)throw RangeError(`Snapshot ended before totalRows`);c+=1,a+=1,yield{values:e.headers.map(e=>n.value[e])};let i=Math.floor(a/e.snapshot.totalRows*100);(i!==o||a===e.snapshot.totalRows||c===t)&&(o=i,e.progress?.({processed:a,total:e.snapshot.totalRows,percent:i,part:s}))}})(),writable:e.writable(s,n),context:{export_id:e.snapshot.id,exported_at:e.snapshot.createdAt,view:e.snapshot.view,filters:JSON.stringify(e.snapshot.filters),...e.snapshot.metadata},...e.snapshot.financialSummary===void 0?{}:{financialSummary:e.snapshot.financialSummary}})};if(e.snapshot.totalRows===0){await s(),e.progress?.({processed:0,total:0,percent:100,part:1});return}for(;a<e.snapshot.totalRows;)await s();if(!(await r.next()).done)throw RangeError(`Snapshot exceeded totalRows`)}async function*Rl(e){for await(let t of e)for(let e of t)yield e}var zl=!1,Bl=0;async function Vl(e,t){let n=globalThis.showSaveFilePicker;if(n===void 0)throw Error(`Seu navegador não suporta salvar o arquivo de exportação.`);let r=e?`.zip`:`.xlsx`;return n({id:`zaip_export_${Date.now().toString(36).slice(-8)}_${(Bl++%1679616).toString(36).padStart(4,`0`)}`,startIn:`downloads`,suggestedName:`${t}${r}`,types:[{description:e?`Arquivo ZIP`:`Pasta de trabalho Excel`,accept:{[e?`application/zip`:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`]:[r]}}]})}function Hl(e,t=new Date){let n=Object.fromEntries(new Intl.DateTimeFormat(`en-CA`,{timeZone:`America/Sao_Paulo`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(t).filter(e=>e.type!==`literal`).map(e=>[e.type,e.value]));return`${`${n.year}-${n.month}-${n.day}-${n.hour}-${n.minute}`}-${e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/gi,`-`).replace(/^-|-$/g,``).toLowerCase()||`export`}`}function Ul(e,t,n=new Date){return`${Hl(e,n)}-part-${t}.xlsx`}function Wl(e){let t=e.createWritable().then(e=>e.getWriter());return{get ready(){return t.then(e=>e.ready)},async write(e){await(await t).write(e.slice().buffer)},async close(){await(await t).close()},async abort(e){await(await t).abort(e)}}}function Gl(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===`AbortError`}var Kl=class{state={status:`idle`,progress:0,error:null,message:null,completedFiles:[]};listeners=new Set;subscribe(e){return this.listeners.add(e),e(this.state),()=>this.listeners.delete(e)}setState(e){this.state=e;for(let t of this.listeners)t(e)}async start(e){if(zl||this.state.status===`running`)throw Error(`An export is already running`);zl=!0;let t=!1,n=new Date,r=Hl(e.view,n),i=[];try{let a=e.snapshot.totalRows>1e6,o=await Vl(a,r),s=Wl(o);t=!0,this.setState({status:`running`,progress:0,error:null,message:`Mantenha a página aberta enquanto a exportação é concluída.`,completedFiles:i});let c=a?new xl(s):void 0;await Ll({snapshot:e.snapshot,headers:e.headers,writable:t=>{let r=Ul(e.view,t,n),i=c?.entry(r)??s;return{...i,async close(){await i.close()}}},progress:({percent:e})=>{this.setState({...this.state,progress:Math.max(this.state.progress,e)})}}),c!==void 0&&await c.close(),i.push(o.name),zl=!1,this.setState({...this.state,status:`completed`,progress:100,message:null})}catch(e){throw t?this.setState({...this.state,status:`failed`,error:e instanceof Error?e.message:String(e),message:null}):Gl(e)||this.setState({...this.state,status:`failed`,error:e instanceof Error?e.message:String(e)}),e}finally{zl=!1}}},ql=4e3;async function*Jl(e,t=He){let n=new Set;for await(let r of e.pages()){let e=r.filter(e=>{let t=typeof e.id==`string`?e.id:typeof e.run_id==`string`?e.run_id:typeof e.agent_invocation_id==`string`?e.agent_invocation_id:typeof e.key==`string`?e.key:JSON.stringify(e);return n.has(t)?!1:(n.add(t),!0)});e.length>0&&(yield t(e))}}function Yl(e){return e.map(e=>{let t=su(e.telemetry),n=su(su(e.usage)?.total),r=su(n?.tokens),i=su(n?.cost),a=su(e.metrics),o=su(a?.duration),s=su(a?.total_tokens),c=su(a?.cost),l=Q(e.duration_ms)??Q(t?.duration_ms)??Q(e.total_duration)??Ql(o);return{type:e.kind??e.entity_kind,id:e.id,title:e.title,status:e.work_status??e.status??e.lifecycle_status,risk:e.risk??null,developers:hl(e.developers),occurred_at:e.occurred_at??e.created_at??e.updated_at??null,duration_hours:l===null?null:l/36e5,tokens:Q(e.total_tokens)??Q(t?.tokens)??Q(r?.total)??Ql(s),cost_brl:Q(e.cost_brl)??Q(e.total_cost_brl)??Q(t?.cost_brl)??Q(i?.brl)??Ql(c)}})}function Xl(e){return e.map(e=>{let t=su(e.origin),n=typeof t?.type==`string`?t.type:typeof e.origin_type==`string`?e.origin_type:null,r=ou(e);return{id:e.id??e.execution_id??null,kind:e.kind??e.execution_kind??null,status:e.status??null,origin:n,task_id:e.task_id??(n===`task`?t?.task_id??null:null),conversation_id:e.conversation_id??(n===`interaction`?t?.conversation_id??null:null),created_at:e.created_at??e.started_at??null,finished_at:e.finished_at??null,duration_hours:r===null?null:r/36e5,tokens:Q(e.total_tokens),cost_brl:Q(e.cost_brl)??Q(e.total_cost_brl),invocations:Q(e.orchestrator_run_count)??Q(e.invocation_count)??null}})}function Zl(e){return e.map(e=>{let t=ou(e);return{run_id:e.run_id??e.agent_invocation_id??e.id??null,execution_id:e.execution_id??null,conversation_id:e.conversation_id??null,task_id:e.task_id??null,origin:e.origin??e.invocation_kind??null,run_role:e.run_role??e.zaip_agent_role??null,run_purpose:e.run_purpose??e.purpose??null,phase:e.phase??null,status:e.status??null,agent:e.agent??e.zaip_agent??null,provider:e.provider??null,model:e.model??null,reasoning_effort:e.reasoning_effort??null,started_at:e.started_at??e.source_started_at??e.occurred_at??null,finished_at:e.finished_at??e.source_finished_at??null,duration_hours:t===null?null:t/36e5,input_tokens:Q(e.input_tokens),cached_input_tokens:Q(e.cached_input_tokens),output_tokens:Q(e.output_tokens),reasoning_tokens:Q(e.reasoning_tokens),total_tokens:Q(e.total_tokens),estimated_usd:Q(e.estimated_usd)??Q(e.cost_usd),estimated_brl:Q(e.estimated_brl)??Q(e.cost_brl)}})}function Ql(e){return e?.complete===!1&&e.coverage_ratio===0?null:Q(e?.known_sum)}function $l(e){return e.map(e=>{let t=su(e.metrics),n=su(t?.duration),r=su(t?.total_tokens),i=su(t?.cost),a=n===null?Q(e.total_duration):Ql(n);return{id:e.id??null,title:e.title??null,status:e.status??null,occurred_at:e.occurred_at??null,activities:Q(e.activity_count),invocations:Q(e.run_count)??Q(e.invocation_count),duration_hours:a===null?null:a/36e5,tokens:r===null?Q(e.total_tokens):Ql(r),cost_brl:i===null?Q(e.total_cost_brl):Ql(i)}})}function eu(e){return e.map(e=>{let t=Q(e.duration_ms)??Q(e.total_duration);return{key:e.key??null,label:e.label??null,invocations:Q(e.run_count)??Q(e.invocation_count),tasks:Q(e.task_count),tokens:Q(e.total_tokens),cost_usd:Q(e.estimated_usd)??Q(e.total_cost_usd),cost_brl:Q(e.estimated_brl)??Q(e.total_cost_brl),duration_hours:t===null?null:t/36e5}})}function tu(e){return e.map(e=>{let t=Q(e.duration_ms)??Q(e.total_duration);return{Persona:e.persona??null,Cargo:e.job??null,"Zaip Agentes":e.label??e.key??null,PRDs:Q(e.prd_count)??0,SPECs:Q(e.spec_count)??0,Tarefas:Q(e.task_count)??0,Runs:Q(e.run_count)??Q(e.invocation_count)??0,Testes:Q(e.test_count)??Q(e.validation_count)??0,Evidências:Q(e.evidence_count)??0,Tempo:(t??0)/36e5,Tokens:Q(e.total_tokens)??0,Custos:Q(e.estimated_brl)??Q(e.total_cost_brl)??0}})}function nu(e){return e.map(e=>{let t=Q(e.duration_ms)??Q(e.total_duration);return{model:e.label??e.model??e.key??null,prds:Q(e.prd_count)??0,specs:Q(e.spec_count)??0,tasks:Q(e.task_count)??0,conversations:Q(e.conversation_count)??0,runs:Q(e.run_count)??Q(e.invocation_count)??0,tests:Q(e.test_count)??Q(e.validation_count)??0,evidences:Q(e.evidence_count)??0,duration_hours:t===null?0:t/36e5,tokens:Q(e.total_tokens)??0,costs:Q(e.estimated_brl)??Q(e.total_cost_brl)??0}})}function ru(e){return e.map(e=>{let t=Q(e.total_duration_ms);return{account_id:e.account_id??null,login_snapshot:e.login_snapshot??null,prd_count:Q(e.prd_count),spec_count:Q(e.spec_count),task_count:Q(e.task_count),run_count:Q(e.run_count),test_count:Q(e.test_count),evidence_count:Q(e.evidence_count),total_duration_hours:t===null?null:t/36e5,total_tokens:Q(e.total_tokens),total_cost_brl:Q(e.total_cost_brl),duration_covered_runs:Q(e.duration_covered_runs),token_covered_runs:Q(e.token_covered_runs),brl_covered_runs:Q(e.brl_covered_runs)}})}function iu(e){return e.map(e=>({conversation_id:e.conversation_id??e.id??null,status:e.status??null,risk:e.risk??null,started_at:e.started_at??null,finished_at:e.finished_at??null,model:e.model??null,reasoning_effort:e.reasoning_effort??null,invocations:Q(e.invocation_count),duration_hours:(Q(e.total_duration)??Q(e.duration_ms))===null?null:Number(Q(e.total_duration)??Q(e.duration_ms))/36e5,tokens:Q(e.total_tokens),cost_brl:Q(e.total_cost_brl)??Q(e.cost_brl)}))}function au(e,t){return e.map(e=>Object.fromEntries(t.map(t=>[t,e[t]??null])))}function ou(e){return Q(e.duration_ms)??Q(e.source_duration_ms)}function su(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Q(e){return typeof e==`number`?e:null}function cu(e,t){let n=[],r=new Set,i=/-(daily|monthly|annual|yearly)$/.test(e),a=/-work-(kanban|list)$/.test(e),o=/-executions$/.test(e),s=e===`cost-executions`,c=/-(?:agentCalls|agent-calls|runs)$/.test(e),l=e===`operations-conversations`,u=/-(?:tasks|specs|prds|conversations)$/.test(e)&&!l,d=e===`cost-models`,f=e===`cost-agents`,p=/-(?:agents|models|providers)$/.test(e),m=e===`cost-developers`,h=e===`operations-changes`,g=e===`operations-decisions`;i&&n.push(...Me),a&&n.push(...Ne),o&&!s&&n.push(...Pe),s&&n.push(...Fe),c&&n.push(...H),u&&n.push(...Fe),f?n.push(...Le):d?n.push(...Re):p&&n.push(...Ie),m&&n.push(...ze),l&&n.push(...U),h&&n.push(...Be),g&&n.push(...Ve);for(let e of n)r.add(e);if(!(a||s||o||c||u||p||m||l||h||g))for(let e of t)for(let[t]of Ue(e)){let e=Ge(t)??t;r.has(e)||(r.add(e),n.push(e))}return n.length===0&&n.push(`result`),n}function lu({filters:e,pageSource:t,rows:n,view:r}){let i=(0,o.useRef)(null);i.current===null&&(i.current=new Kl);let[a,s]=(0,o.useState)(i.current.state),[c,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(!1),[p,m]=(0,o.useState)(null);(0,o.useEffect)(()=>i.current?.subscribe(s),[]),(0,o.useEffect)(()=>{if(a.status!==`completed`){u(!1);return}u(!0);let e=setTimeout(()=>u(!1),ql);return()=>clearTimeout(e)},[a.status]);let h=cu(r,n),g=/-work-(kanban|list)$/.test(r),_=/-executions$/.test(r),v=r===`cost-executions`,y=/-(?:agentCalls|agent-calls|runs)$/.test(r),b=r===`operations-conversations`,x=/-(?:tasks|specs|prds|conversations)$/.test(r)&&!b,S=r===`cost-models`,C=r===`cost-agents`,w=/-(?:agents|models|providers)$/.test(r),T=r===`cost-developers`,E=r===`operations-changes`,D=r===`operations-decisions`,O=async()=>{let i=t===void 0?void 0:`prepare`in t?await t.prepare():t;return Wc({id:globalThis.crypto?.randomUUID?.()??`export-${Date.now()}`,createdAt:new Date().toISOString(),view:r,filters:e,metadata:{timezone:`America/Sao_Paulo`,missing_values:`Unavailable, not zero`,...g?{cost_semantics:`Cumulative item costs include descendants; do not sum hierarchy levels. Use Financial summary for distinct activities.`}:{},...i?.metadata},...i?.financialSummary===void 0?{}:{financialSummary:i.financialSummary},totalRows:i?.totalRows??n.length,pages:async function*(){if(i!==void 0){yield*Jl(i,g?Yl:b?iu:E?e=>au(e,Be):D?e=>au(e,Ve):v?$l:_?Xl:y?Zl:x?$l:C?tu:S?nu:w?eu:T?ru:He);return}for(let e=0;e<n.length;e+=500)yield(g?Yl:b?iu:E?e=>au(e,Be):D?e=>au(e,Ve):v?$l:_?Xl:y?Zl:x?$l:C?tu:S?nu:w?eu:T?ru:He)(n.slice(e,e+500))}})};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`button`,{"aria-label":`Exportar Excel`,className:`excel-export-action`,disabled:d||a.status===`running`,onClick:()=>{m(null),f(!0),O().then(e=>i.current?.start({snapshot:e,headers:h,view:r})).catch(e=>{m(e instanceof Error?e.message:String(e))}).finally(()=>f(!1))},type:`button`,children:[(0,l.jsx)(rl,{"aria-hidden":`true`,size:16}),`Exportar Excel`]}),d||a.status===`running`?(0,l.jsx)(gl,{progress:a.progress}):null,c?(0,l.jsx)(_l,{}):null,a.status===`failed`?(0,l.jsxs)(`p`,{role:`alert`,children:[`Falha ao exportar: `,a.error]}):null,p===null?null:(0,l.jsxs)(`p`,{role:`alert`,children:[`Falha ao preparar exportação: `,p]})]})}var uu=1e3,du=60*uu,fu=60*du,pu=24*fu,mu=7*pu,hu=30*pu,gu=6*fu,_u=new Set([`completed`,`blocked`,`failed`,`cancelled`]);function vu(e,t,n,r=Date.now()){if(e===null||_u.has(t))return null;let i=Date.parse(e);if(!Number.isFinite(i))return null;let a=Math.max(0,r-i),o=t===`executing`||t===`verifying`;return{label:yu(a,o,n),alert:o&&a>gu}}function yu(e,t,n){let r=n===`pt-BR`?`Há`:`Ago`,i=bu(e,t,n);return n===`pt-BR`?`${r} ${i}`:`${i} ${r}`}function bu(e,t,n){let r=Math.max(1,Math.round(e/uu));if(r<60)return`${r} seg`;let i=Math.round(e/du);if(i<60)return`${i} min`;let a=Math.round(e/fu);if(a<24)return`${a} h`;let o=Math.round(e/pu);if(t||o<7)return`${o} d`;let s=Math.round(e/mu);if(s<4)return n===`pt-BR`?`${s} sem`:`${s} w`;let c=Math.max(1,Math.round(e/hu));return n===`pt-BR`?c===1?`1 mês`:`${c} meses`:`${c} mo`}function xu(e,t){return Su(e,t,t===`pt-BR`?`Criada`:`Created`)}function Su(e,t,n){let r=new Date(e);return Number.isNaN(r.getTime())?``:`${n} · ${new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`medium`}).format(r)}`}function Cu(e,t=`pt-BR`){return e>=36e5?`${Math.round(e/36e5)} h`:e>=6e4?`${Math.round(e/6e4)} min`:`${Math.round(e/1e3)} ${t===`pt-BR`?`seg`:`sec`}`}function wu(e){return Cu(e)}function Tu(e,t){return e.filter(e=>e.kind===`spec`&&e.parent_id===t)}function Eu(e,t,n){let r=new Map(t.map(e=>[e.id,e])),i=new Map(e.planned_tasks.map(e=>[e.id,e]));return[...new Set([...e.planned_tasks.map(e=>e.id),...e.task_ids])].map(e=>({id:e,task:r.get(e)??null,preview:i.get(e)??null,usage:n.get(e)}))}var Du={durationMs:null,tokens:null,costBrl:null};function Ou(e){return{durationMs:e.duration_ms,tokens:e.usage.total.coverage.tokens>0?e.usage.total.tokens.total:null,costBrl:e.usage.total.coverage.brl>0?e.usage.total.cost.brl:null}}function ku({locale:e,usage:t}){return(0,l.jsx)(`dl`,{className:`operations-macro-usage-strip`,children:[{icon:(0,l.jsx)(tl,{size:17}),label:e===`pt-BR`?`Tempo total`:`Total time`,value:t.durationMs===null?`—`:Cu(t.durationMs,e)},{icon:(0,l.jsx)(pl,{size:17}),label:`Tokens`,value:D(t.tokens,e)},{icon:(0,l.jsx)(nl,{size:17}),label:e===`pt-BR`?`Custo`:`Cost`,value:k(t.costBrl,`BRL`,e)}].map(e=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:e.icon}),(0,l.jsx)(`dt`,{children:e.label}),(0,l.jsx)(`dd`,{children:e.value})]},e.label))})}function Au({locale:e,usage:t}){let n=[t.durationMs===null?`—`:Cu(t.durationMs,e),D(t.tokens,e),k(t.costBrl,`BRL`,e)];return(0,l.jsx)(`dl`,{className:`operations-macro-mini-usage`,children:(e===`pt-BR`?[`Tempo`,`Tokens`,`Custo`]:[`Time`,`Tokens`,`Cost`]).map((e,t)=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`dt`,{children:e}),(0,l.jsx)(`dd`,{children:n[t]})]},e))})}var ju={"en-US":{draft:`Definition (PRD + Requirements)`,planned:`Planned (SPEC + Changes)`,executing:`Executing (Tasks)`,verifying:`Verifying (Tests + Review)`,completed:`Completed`,blocked:`Blocked`,failed:`Failed`,cancelled:`Cancelled`},"pt-BR":{draft:`Definição (PRD + Requisitos)`,planned:`Planejamento (SPEC + Mudanças)`,executing:`Execução (Tarefas)`,verifying:`Verificação (Testes + Revisão)`,completed:`Concluído`,blocked:`Bloqueado`,failed:`Falhado`,cancelled:`Cancelado`}};function Mu(e,t){return ju[t][e]}function Nu(e,t){return t===`en-US`?e===`lite`?`Lite`:e===`standard`?`Standard`:`Critical`:e===`lite`?`Leve`:e===`standard`?`Padrão`:`Crítico`}var Pu=[`task`,`spec`,`prd`];function Fu(e,t){return t.find(t=>t.id===e.change_id)?.source.type??(e.spec_id===null?`task`:`spec`)}function Iu(e){return e===`task`?`Task-first`:e===`spec`?`SPEC`:`PRD`}function Lu(e,t,n){return t===``||Fu(e,n)===t}function Ru(){let[e,t]=(0,o.useState)(()=>Date.now());return(0,o.useEffect)(()=>{let e=window.setInterval(()=>t(Date.now()),1e3);return()=>window.clearInterval(e)},[]),e}function zu(e,t=e,n){let[r,i]=(0,o.useState)(10),a=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let o=a.current;if(o===null||r>=e&&e>=t)return;let s=new IntersectionObserver(a=>{a.some(e=>e.isIntersecting)&&(r<e?i(t=>Math.min(e,t+10)):e<t&&n?.())},{rootMargin:`320px 0px`});return s.observe(o),()=>s.disconnect()},[e,t,r,n]),{hasMore:r<e||e<t,sentinelRef:a,visibleCount:Math.min(r,e)}}function Bu(e,t=[]){let n=new Set(t.filter(e=>e.telemetry!==null&&e.telemetry!==void 0).map(e=>e.id)),r=new Map(t.flatMap(e=>e.telemetry===null||e.telemetry===void 0?[]:[[e.id,{durationMs:e.telemetry.duration_ms,tokens:e.telemetry.tokens,costBrl:e.telemetry.cost_brl}]]));for(let t of e){if(t.task_id===null||n.has(t.task_id))continue;let e=r.get(t.task_id)??{durationMs:null,tokens:null,costBrl:null};r.set(t.task_id,{durationMs:Vu(e.durationMs,t.phase===`execution`&&t.parent_run_id==null?te(t):null),tokens:Vu(e.tokens,t.usage.total.tokens.total),costBrl:Vu(e.costBrl,t.usage.total.cost.brl)})}return r}function Vu(e,t){return e===null&&t===null?null:(e??0)+(t??0)}var Hu=[`definition`,`planning`,`ready`,`executing`,`verifying`,`completed`,`blocked`,`cancelled`,`failed`];function Uu(e){return e.status===`completed`?`completed`:e.status===`cancelled`?`cancelled`:e.status===`failed`?`failed`:e.status===`blocked`?`blocked`:e.is_active===!0||e.status===`executing`?`executing`:e.status===`verifying`?`verifying`:(e.attempt_count??0)>0||e.started_at!=null||e.execution_started===!0?`executing`:e.status===`draft`?null:e.status===`planned`?`ready`:null}function Wu(e,t){if(e.lifecycle_status===`cancelled`)return`cancelled`;if(e.lifecycle_status===`failed`)return`failed`;if(e.lifecycle_status===`blocked`)return`blocked`;if(e.lifecycle_status===`delivered`||e.lifecycle_status===`completed`)return`completed`;if(e.lifecycle_status===`ready`)return`ready`;if(e.kind===`prd`&&e.lifecycle_status===`draft`)return`definition`;if(e.kind===`spec`&&e.lifecycle_status===`draft`)return`planning`;if(e.work_status===`cancelled`)return`cancelled`;if(e.work_status===`failed`)return`failed`;if(e.work_status===`blocked`)return`blocked`;if(e.work_status===`completed`)return`completed`;if(e.is_active||t.some(t=>e.task_ids.includes(t.id)&&t.is_active))return`executing`;if(e.lifecycle_status===`verifying`||e.work_status===`verifying`)return`verifying`;if(e.work_status===`executing`){let n=t.filter(t=>e.task_ids.includes(t.id));return n.length>0&&n.every(e=>e.status===`verifying`||e.status===`completed`)?`verifying`:`executing`}return e.lifecycle_status===`active`?`executing`:`planning`}function Gu(e,t){return t===`task`?e.kind===`task`&&e.row.spec_id!==null:t===`standalone-task`?e.kind===`task`&&e.row.spec_id===null:t===`all`||e.kind===t}function Ku(e,t,n){let r=e.kind===`prd`?t.filter(t=>t.parent_id===e.id):[],i=new Set(r.map(e=>e.id)),a=new Set(e.task_ids);if(e.kind===`spec`)for(let t of n)t.spec_id===e.id&&a.add(t.id);else{for(let e of r)for(let t of e.task_ids)a.add(t);for(let e of n)e.spec_id!==null&&i.has(e.spec_id)&&a.add(e.id)}let o=n.filter(e=>a.has(e.id));return{completedSpecs:r.filter(Ju).length,totalSpecs:r.length,completedTasks:Math.max(o.filter(e=>e.status===`completed`).length,e.quality?.completed_tasks??0),totalTasks:Math.max(o.length,a.size,e.planned_tasks.length,e.task_count??0)}}function qu(e,t){let n=`Tasks ${t.completedTasks}/${t.totalTasks}`;return e===`prd`?`SPECs ${t.completedSpecs}/${t.totalSpecs} · ${n}`:n}function Ju(e){return e.lifecycle_status===`delivered`||e.work_status===`completed`}function Yu(e,t){return{"pt-BR":{definition:`Definição (PRD + Requisitos)`,planning:`Planejamento (SPEC + Change)`,ready:`Pronto para Executar`,executing:`Execução`,verifying:`Verificação`,completed:`Concluído`,blocked:`Bloqueado`,cancelled:`Cancelado`,failed:`Falhado`},"en-US":{definition:`Definition (PRDs)`,planning:`Planning`,ready:`Ready to Execute`,executing:`Executing`,verifying:`Verifying`,completed:`Completed`,blocked:`Blocked`,cancelled:`Cancelled`,failed:`Failed`}}[t][e]}function Xu({label:e,locale:t,onClose:n,onOpenDocument:r,onOpenTrace:i,row:a,runs:s,specs:c,tasks:u}){let d=(0,o.useRef)(null),f=(0,o.useRef)(null),[p,m]=(0,o.useState)(e===`SPEC`?a:null),h=(0,o.useMemo)(()=>Tu(c,a.id),[a.id,c]),g=(0,o.useMemo)(()=>Bu(s),[s]);(0,o.useEffect)(()=>{let e=d.current;if(e!==null)return e.open||e.showModal(),()=>{e.open&&e.close()}},[]);let _=e=>{f.current?.scrollTo({top:0}),m(e)},v=e===`PRD`&&p===null,y=p??a,b=Eu(y,u,g);return(0,l.jsx)(`dialog`,{className:`operations-status-dialog-backdrop operations-macro-dialog-backdrop`,onCancel:e=>{e.preventDefault(),n()},onMouseDown:e=>{e.currentTarget===e.target&&n()},ref:d,children:(0,l.jsxs)(`section`,{"aria-label":`${t===`pt-BR`?`Detalhes do`:`Details for`} ${e}`,"aria-modal":`true`,className:`operations-macro-planning-dialog`,"data-kind":v?`prd`:`spec`,role:`dialog`,children:[(0,l.jsxs)(`header`,{className:`operations-macro-dialog-header`,children:[(0,l.jsxs)(`div`,{className:`operations-macro-heading`,children:[(0,l.jsx)(`span`,{className:`operations-macro-heading-icon`,"aria-hidden":`true`,children:v?(0,l.jsx)(sl,{size:23}):(0,l.jsx)(il,{size:23})}),(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`div`,{className:`operations-macro-kicker`,children:[(0,l.jsx)(`span`,{children:v?`PRD`:`SPEC`}),(0,l.jsx)(`i`,{}),(0,l.jsx)(`span`,{children:Yu(Wu(y,u),t)})]}),(0,l.jsx)(`h2`,{children:y.title}),(0,l.jsx)(`p`,{title:y.id,children:y.id})]})]}),r?(0,l.jsxs)(`button`,{className:`operations-macro-document-open`,onClick:()=>{n(),r(y.kind,y.id)},type:`button`,children:[(0,l.jsx)(al,{"aria-hidden":`true`,size:16}),t===`pt-BR`?`Ler ${v?`PRD`:`SPEC`} completa`:`Read full ${v?`PRD`:`SPEC`}`]}):null,(0,l.jsx)(`button`,{"aria-label":t===`pt-BR`?`Fechar`:`Close`,className:`operations-macro-close`,onClick:n,type:`button`,children:(0,l.jsx)(fl,{"aria-hidden":`true`,size:20})})]}),(0,l.jsxs)(`div`,{className:`operations-macro-dialog-scroll`,ref:f,children:[e===`PRD`&&p!==null?(0,l.jsxs)(`button`,{className:`operations-macro-back`,onClick:()=>_(null),type:`button`,children:[(0,l.jsx)(Zc,{"aria-hidden":`true`,size:16}),(0,l.jsxs)(`span`,{children:[t===`pt-BR`?`Voltar ao PRD`:`Back to PRD`,(0,l.jsx)(`small`,{children:a.title})]})]}):null,(0,l.jsx)(ku,{locale:t,usage:Ou(y)}),(0,l.jsx)(Zu,{locale:t,row:y}),v?(0,l.jsx)($u,{locale:t,onSelectSpec:_,specs:h,tasks:u}):(0,l.jsx)(ed,{locale:t,onOpenTrace:i,row:y,tasks:b,...e===`PRD`?{parentPrd:a}:{}})]})]})})}function Zu({locale:e,row:t}){return(0,l.jsx)(`dl`,{className:`operations-macro-overview-cards`,children:[{icon:(0,l.jsx)(cl,{size:17}),label:`Tasks`,value:t.task_count},{icon:(0,l.jsx)(dl,{size:17}),label:`Runs`,value:t.run_count},{icon:(0,l.jsx)(ol,{size:17}),label:e===`pt-BR`?`Execuções`:`Executions`,value:t.execution_count},{icon:(0,l.jsx)(el,{size:17}),label:e===`pt-BR`?`Estado`:`State`,value:Qu(t.lifecycle_status,e)}].map(e=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:e.icon}),(0,l.jsx)(`dt`,{children:e.label}),(0,l.jsx)(`dd`,{children:e.value})]},e.label))})}function Qu(e,t){return{"pt-BR":{draft:`Rascunho`,planned:`Planejado`,ready:`Pronto`,active:`Ativo`,executing:`Em execução`,verifying:`Em verificação`,delivered:`Entregue`,completed:`Concluído`,blocked:`Bloqueado`,failed:`Falhado`,cancelled:`Cancelado`},"en-US":{draft:`Draft`,planned:`Planned`,ready:`Ready`,active:`Active`,executing:`Executing`,verifying:`Verifying`,delivered:`Delivered`,completed:`Completed`,blocked:`Blocked`,failed:`Failed`,cancelled:`Cancelled`}}[t][e]??e}function $u({locale:e,onSelectSpec:t,specs:n,tasks:r}){return(0,l.jsxs)(`section`,{className:`operations-macro-section operations-prd-specs`,children:[(0,l.jsx)(td,{count:n.length,description:e===`pt-BR`?`Selecione uma SPEC para ver suas Tasks e abrir a rastreabilidade completa.`:`Select a SPEC to see its Tasks and open the complete trace.`,icon:(0,l.jsx)($c,{size:19}),title:e===`pt-BR`?`SPECs deste PRD`:`SPECs in this PRD`}),n.length>0?(0,l.jsx)(`div`,{className:`operations-prd-spec-grid`,children:n.map((n,i)=>(0,l.jsxs)(`button`,{onClick:()=>t(n),type:`button`,children:[(0,l.jsx)(`span`,{className:`operations-prd-spec-index`,children:String(i+1).padStart(2,`0`)}),(0,l.jsxs)(`div`,{className:`operations-prd-spec-copy`,children:[(0,l.jsx)(`span`,{children:Yu(Wu(n,r),e)}),(0,l.jsx)(`strong`,{children:n.title}),(0,l.jsx)(`code`,{title:n.id,children:n.id})]}),(0,l.jsx)(Au,{locale:e,usage:Ou(n)}),(0,l.jsxs)(`span`,{className:`operations-prd-spec-action`,children:[(0,l.jsxs)(`small`,{children:[Math.max(n.task_count,n.planned_tasks.length),` Tasks`]}),(0,l.jsx)(Qc,{"aria-hidden":`true`,size:18})]})]},n.id))}):(0,l.jsx)(nd,{text:e===`pt-BR`?`Este PRD ainda não possui SPEC vinculada.`:`This PRD does not have a linked SPEC yet.`})]})}function ed({locale:e,onOpenTrace:t,parentPrd:n,row:r,tasks:i}){return(0,l.jsxs)(l.Fragment,{children:[n?(0,l.jsxs)(`div`,{className:`operations-spec-parent`,children:[(0,l.jsx)(sl,{"aria-hidden":`true`,size:16}),(0,l.jsx)(`span`,{children:e===`pt-BR`?`Parte do PRD`:`Part of PRD`}),(0,l.jsx)(`strong`,{children:n.title})]}):null,(0,l.jsxs)(`section`,{className:`operations-macro-section operations-spec-tasks`,children:[(0,l.jsx)(td,{count:i.length,description:e===`pt-BR`?`Cada Task mantém sua telemetria e leva ao Trace completo do ciclo.`:`Each Task preserves its telemetry and opens the full lifecycle trace.`,icon:(0,l.jsx)(dl,{size:19}),title:e===`pt-BR`?`Fluxo de Tasks`:`Task flow`}),i.length>0?(0,l.jsx)(`div`,{className:`operations-spec-task-list`,children:i.map(({id:n,preview:r,task:i,usage:a},o)=>(0,l.jsxs)(`button`,{disabled:i===null,onClick:()=>{i!==null&&t(n)},type:`button`,children:[(0,l.jsxs)(`span`,{className:`operations-spec-task-sequence`,children:[(0,l.jsx)(`i`,{}),String(o+1).padStart(2,`0`)]}),(0,l.jsxs)(`div`,{className:`operations-spec-task-copy`,children:[(0,l.jsx)(`span`,{children:i?Mu(i.status,e):e===`pt-BR`?`Planejada`:`Planned`}),(0,l.jsx)(`strong`,{children:i?.title??r?.title??n}),i===null&&r?.objective?(0,l.jsx)(`small`,{children:r.objective}):null,(0,l.jsx)(`code`,{title:n,children:n})]}),(0,l.jsx)(Au,{locale:e,usage:a??Du}),(0,l.jsxs)(`span`,{className:`operations-spec-task-action`,children:[i?e===`pt-BR`?`Abrir Trace`:`Open Trace`:e===`pt-BR`?`Materializa ao finalizar`:`Materializes when finalized`,i?(0,l.jsx)(Qc,{"aria-hidden":`true`,size:17}):null]})]},n))}):(0,l.jsx)(nd,{text:e===`pt-BR`?`Esta SPEC ainda não possui Task materializada.`:`This SPEC does not have a materialized Task yet.`})]}),(0,l.jsxs)(`div`,{className:`operations-macro-document`,children:[(0,l.jsx)(al,{"aria-hidden":`true`,size:17}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:e===`pt-BR`?`Documento registrado`:`Registered document`}),(0,l.jsx)(`code`,{title:r.artifact_path,children:r.artifact_path})]})]})]})}function td({count:e,description:t,icon:n,title:r}){return(0,l.jsxs)(`header`,{className:`operations-macro-section-heading`,children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:n}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h3`,{children:r}),(0,l.jsx)(`p`,{children:t})]}),(0,l.jsx)(`strong`,{children:e})]})}function nd({text:e}){return(0,l.jsxs)(`div`,{className:`operations-macro-empty`,children:[(0,l.jsx)(il,{"aria-hidden":`true`,size:21}),(0,l.jsx)(`p`,{children:e})]})}var rd=`America/Sao_Paulo`,id={"2026-08-02":4809511,"2026-08-01":8894527,"2026-07-31":9472804,"2026-07-30":5167818,"2026-07-29":11336221,"2026-07-28":8262282,"2026-07-27":4862150,"2026-07-26":970899,"2026-07-25":7465970,"2026-07-24":9041538,"2026-07-23":19750,"2026-07-22":1371560,"2026-07-21":14992543,"2026-07-20":3168460,"2026-07-19":929990,"2026-07-18":9232700,"2026-07-17":16882853,"2026-07-16":20054785,"2026-07-15":35459620,"2026-07-14":24078852,"2026-07-13":22611635,"2026-07-12":8339738,"2026-07-11":1859980},ad={cutoff:`2026-08-02T03:14:00.000Z`,cutoffDay:`2026-08-02`,durationMs:Object.values(id).reduce((e,t)=>e+t,0),costXlsxSha256:`C3EE0495667289FB81DD8F9268697CEB7692433C14CB19934C89B5F39129902A`,operationsXlsxSha256:`94E9577A7CA27F7FDD277D81E34156296CB28FE39CF6D7636B259EBBB7E56BCC`};function od(e){return e!=null&&Date.parse(e)>=Date.parse(ad.cutoff)}function sd(e,t){if(e==null)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let r=new Intl.DateTimeFormat(`en-CA`,{timeZone:rd,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(n),i=e=>r.find(t=>t.type===e)?.value,a=i(`year`),o=i(`month`),s=i(`day`);return a===void 0||o===void 0||s===void 0?null:t===`year`?a:t===`month`?`${a}-${o}`:`${a}-${o}-${s}`}function cd(e,t,n=new Date){let r=e?.map(e=>e.key).filter((t,n,r)=>/^\d{4}-\d{2}-\d{2}$/.test(t)&&(e[n].estimated_brl!==null||e[n].estimated_usd!==null)).sort()[0];return r===void 0?t:{start:r,end:xd(n)}}function ld(e,t=new Date){let n=e.reduce((e,t)=>Math.min(e,Date.parse(t.created_at)),1/0);return{start:xd(Number.isFinite(n)?new Date(n):t),end:xd(t)}}function ud(e,t,n=new Date){if(e.length>0)return ld(e,n);let r=t.filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort();return r.length===0?ld(e,n):{start:r[0],end:r.at(-1)}}function dd(e,t=new Date){let n=_d(t),r=_d(t);if(e===`yesterday`)return r=vd(n,-1),gd(r,r);if(e===`this-week`)return gd(vd(n,-bd(n)),n);if(e===`last-week`){let e=vd(n,-bd(n));return gd(vd(e,-7),vd(e,-1))}return e===`this-month`?gd(new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1,12)),n):e===`last-month`?gd(new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()-1,1,12)),new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),0,12))):e===`last-3-months`?gd(yd(n,-3),n):e===`last-6-months`?gd(yd(n,-6),n):e===`this-year`?gd(new Date(Date.UTC(n.getUTCFullYear(),0,1,12)),n):e===`last-year`?gd(new Date(Date.UTC(n.getUTCFullYear()-1,0,1,12)),new Date(Date.UTC(n.getUTCFullYear()-1,11,31,12))):gd(n,n)}function fd(e,t,n){return pd(e??n,t)}function pd(e,t){if(e==null)return!1;let n=sd(e,`day`);return n!==null&&n>=t.start&&n<=t.end}function md(e,t,n){return t===`all`||pd(e,n)}function hd(e,t,n){return md(e.finished_at??e.started_at,t,n)}function gd(e,t){return{start:xd(e),end:xd(t)}}function _d(e){let t=sd(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Operations date anchor`);return new Date(`${t}T12:00:00.000Z`)}function vd(e,t){let n=new Date(e);return n.setUTCDate(n.getUTCDate()+t),n}function yd(e,t){let n=e.getUTCDate(),r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1,12)),i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+1,0,12)).getUTCDate();return r.setUTCDate(Math.min(n,i)),r}function bd(e){return(e.getUTCDay()+6)%7}function xd(e){let t=sd(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Operations date value`);return t}var Sd={"pt-BR":{all:`Todo o Período`,custom:`Personalizado`,today:`Hoje`,yesterday:`Ontem`,"this-week":`Esta Semana`,"last-week":`Semana Passada`,"this-month":`Este Mês`,"last-month":`Mês Passado`,"last-3-months":`Últimos 3 meses`,"last-6-months":`Últimos 6 meses`,"this-year":`Este Ano`,"last-year":`Último ano`},"en-US":{all:`All Time`,custom:`Custom`,today:`Today`,yesterday:`Yesterday`,"this-week":`This Week`,"last-week":`Last Week`,"this-month":`This Month`,"last-month":`Last Month`,"last-3-months":`Last 3 months`,"last-6-months":`Last 6 months`,"this-year":`This Year`,"last-year":`Last year`}},Cd=Object.keys(Sd[`pt-BR`]);function wd(e,t){return e===`all`?{disabled:!0,start:t.start,end:t.end}:{disabled:!1,start:t.start,end:t.end}}function Td({ariaLabelSuffix:e=``,dateRange:t,defaultDateRange:n,locale:r,onDateRangeChange:i,onPresetChange:a,preset:o}){let s=wd(o,t);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`label`,{className:`operations-toolbar-field operations-date-field`,children:[(0,l.jsx)(`span`,{children:r===`pt-BR`?`Data inicial`:`Start date`}),(0,l.jsx)(`input`,{"aria-label":`${r===`pt-BR`?`Data inicial`:`Start date`}${e}`,disabled:s.disabled,onInput:e=>{let n=e.currentTarget.value;i({start:n,end:n>t.end?n:t.end})},type:`date`,value:s.start})]}),(0,l.jsxs)(`label`,{className:`operations-toolbar-field operations-date-field`,children:[(0,l.jsx)(`span`,{children:r===`pt-BR`?`Data final`:`End date`}),(0,l.jsx)(`input`,{"aria-label":`${r===`pt-BR`?`Data final`:`End date`}${e}`,disabled:s.disabled,onInput:e=>{let n=e.currentTarget.value;i({start:n<t.start?n:t.start,end:n})},type:`date`,value:s.end})]}),(0,l.jsxs)(`label`,{className:`operations-toolbar-field operations-period-field`,children:[(0,l.jsx)(`span`,{children:r===`pt-BR`?`Período`:`Period`}),(0,l.jsx)(`select`,{"aria-label":`${r===`pt-BR`?`Período`:`Period`}${e}`,onChange:e=>{let r=e.target.value;if(r===`all`){a(r,n);return}if(r===`custom`){a(r,t);return}a(r,dd(r))},value:o,children:Cd.map(e=>(0,l.jsx)(`option`,{value:e,children:Sd[r][e]},e))})]})]})}function Ed({locale:e,query:t,status:n,risk:r,origin:i,onQuery:a,onStatus:o,onRisk:s,onOrigin:c}){let u=e===`pt-BR`?`Todos`:`All`;return(0,l.jsxs)(`div`,{className:`operations-entity-filters`,children:[(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:e===`pt-BR`?`Busca`:`Search`}),(0,l.jsx)(`input`,{"aria-label":e===`pt-BR`?`Busca`:`Search`,value:t,onChange:e=>a(e.target.value)})]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:`Status`}),(0,l.jsxs)(`select`,{"aria-label":`Status`,value:n,onChange:e=>o(e.target.value),children:[(0,l.jsx)(`option`,{value:``,children:u}),Hu.map(t=>(0,l.jsx)(`option`,{value:t,children:Yu(t,e)},t))]})]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:e===`pt-BR`?`Risco`:`Risk`}),(0,l.jsxs)(`select`,{"aria-label":e===`pt-BR`?`Risco`:`Risk`,value:r,onChange:e=>s(e.target.value),children:[(0,l.jsx)(`option`,{value:``,children:u}),[`lite`,`standard`,`critical`].map(t=>(0,l.jsx)(`option`,{value:t,children:Nu(t,e)},t))]})]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:e===`pt-BR`?`Origem`:`Origin`}),(0,l.jsxs)(`select`,{"aria-label":e===`pt-BR`?`Origem`:`Origin`,value:i,onChange:e=>c(e.target.value),children:[(0,l.jsx)(`option`,{value:``,children:u}),Pu.map(e=>(0,l.jsx)(`option`,{value:e,children:Iu(e)},e))]})]})]})}function Dd({locale:e}){return e===`pt-BR`?(0,l.jsxs)(`svg`,{"aria-hidden":`true`,className:`operations-locale-flag`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`rect`,{fill:`#18864b`,height:`24`,rx:`5`,width:`24`}),(0,l.jsx)(`path`,{d:`m12 3.8 8.2 8.2L12 20.2 3.8 12 12 3.8Z`,fill:`#f6d64a`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`12`,fill:`#1b4f9c`,r:`4.2`}),(0,l.jsx)(`path`,{d:`M8.8 11.2c1.9-1 4.5-1 6.4 0`,fill:`none`,stroke:`#fff`,strokeWidth:`.8`})]}):(0,l.jsxs)(`svg`,{"aria-hidden":`true`,className:`operations-locale-flag`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`rect`,{fill:`#fff`,height:`24`,rx:`5`,width:`24`}),(0,l.jsx)(`path`,{d:`M0 3h24v3H0Zm0 6h24v3H0Zm0 6h24v3H0Z`,fill:`#bd3d44`}),(0,l.jsx)(`path`,{d:`M0 0h11v11H0Z`,fill:`#192f6b`})]})}function Od(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`operations-nav-svg`,fill:`none`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{d:`M20 11a8.1 8.1 0 1 0 2 5.3M20 4v7h-7`})})}function kd(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`operations-nav-svg`,fill:`none`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{d:`M4 6h16M7 12h10m-7 6h4`})})}function Ad(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`operations-nav-svg operations-locale-chevron`,fill:`none`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function jd(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`operations-reset-icon`,fill:`none`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{d:`M3 12a9 9 0 1 0 3-6.7M3 4v6h6`})})}function Md(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,viewBox:`0 0 20 20`,children:(0,l.jsx)(`path`,{d:`m6 6 8 8M14 6l-8 8`})})}function Nd({locale:e,localeOpen:t,setLocaleOpen:n,setFiltersOpen:r,onLocaleChange:i}){return(0,l.jsxs)(`div`,{className:`operations-nav-popup-anchor`,children:[(0,l.jsxs)(`button`,{className:`operations-nav-button${t?` is-active`:``}`,onClick:()=>{n(e=>!e),r(!1)},type:`button`,children:[(0,l.jsx)(Dd,{locale:e}),e===`pt-BR`?`PT-BR`:`EN-US`,(0,l.jsx)(Ad,{})]}),t?(0,l.jsxs)(`div`,{className:`operations-nav-popup operations-locale-popup`,children:[(0,l.jsxs)(`button`,{onClick:()=>{i(`pt-BR`),n(!1)},type:`button`,children:[(0,l.jsx)(Dd,{locale:`pt-BR`}),` Português do Brasil`,e===`pt-BR`?(0,l.jsx)(`span`,{children:`✓`}):null]}),(0,l.jsxs)(`button`,{onClick:()=>{i(`en-US`),n(!1)},type:`button`,children:[(0,l.jsx)(Dd,{locale:`en-US`}),` English`,e===`en-US`?(0,l.jsx)(`span`,{children:`✓`}):null]})]}):null]})}var Pd={"pt-BR":{"work-kanban":`Visão de Quadro (Kanban)`,"work-list":`Visão de Lista`,changes:`Mudanças`,executions:`Execuções`,runs:`Invocações de agentes`,conversations:`Conversas`,decisions:`Decisões`,daily:`Diário`,monthly:`Mensal`,yearly:`Anual`},"en-US":{"work-kanban":`Work (Kanban)`,"work-list":`Work (List)`,changes:`Changes`,executions:`Executions`,runs:`Agent invocations`,conversations:`Conversations`,decisions:`Decisions`,daily:`Daily`,monthly:`Monthly`,yearly:`Annual`}};function Fd({locale:e,onChange:t,view:n}){return(0,l.jsx)(`nav`,{"aria-label":`Entidades do ciclo de trabalho`,children:[`work-kanban`,`work-list`].map(r=>(0,l.jsx)(`button`,{"aria-pressed":n===r,className:n===r?`is-active`:void 0,onClick:()=>t(r),type:`button`,children:Pd[e][r]},r))})}function Id({entityPage:e,locale:t,onChange:n}){return(0,l.jsxs)(`div`,{"aria-live":`polite`,className:`operations-page-controls`,children:[e.error?(0,l.jsx)(`span`,{children:e.error}):null,e.loading?(0,l.jsx)(`span`,{children:t===`pt-BR`?`Carregando…`:`Loading…`}):null,(0,l.jsx)(`button`,{disabled:e.loading||e.offset===0,onClick:()=>n?.(Math.max(0,e.offset-100)),type:`button`,children:t===`pt-BR`?`Anterior`:`Previous`}),(0,l.jsx)(`button`,{disabled:e.loading||e.total===null||e.offset+100>=e.total,onClick:()=>n?.(e.offset+100),type:`button`,children:t===`pt-BR`?`Próxima`:`Next`})]})}function Ld({state:e,error:t,locale:n}){return e===`loading`?(0,l.jsxs)(`div`,{"aria-busy":`true`,"aria-label":n===`pt-BR`?`Carregando itens da coluna`:`Loading column items`,className:`operations-column-skeleton`,role:`status`,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}):e===`error`?(0,l.jsx)(`p`,{className:`operations-empty`,role:`alert`,children:t}):e===`empty`?(0,l.jsx)(`p`,{className:`operations-empty`,children:n===`pt-BR`?`Sem itens`:`No items`}):null}function Rd(e,t){return e===`pt-BR`?`Abrir ${t}`:`Open ${t}`}function zd(e,t,n){return e>0?`content`:n?.error?`error`:n===void 0||n.loading||t>0?`loading`:`empty`}function Bd(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[e.row.id,e.row.title,e.kind].some(e=>e.toLocaleLowerCase().includes(n))):[...e]}function Vd({allPrds:e,allSpecs:t,allTasks:n,boardTotals:r,boardKindTotals:i,boardStates:a,changes:s,locale:c,onOpenDocument:u,onOpenTask:d,onPriorityChange:f,onLoadMore:p,onTypeChange:m,prds:h,runs:g,specs:_,tasks:v}){let y=Ru(),[b,x]=(0,o.useState)(`all`),[S,C]=(0,o.useState)(null),[w,T]=(0,o.useState)(null),[E,D]=(0,o.useState)(``),[O,k]=(0,o.useState)(null),[A,j]=(0,o.useState)(null),ee=(0,o.useMemo)(()=>Bu([],v),[v]),M=(0,o.useMemo)(()=>Jd([...e.map(e=>({kind:`prd`,row:e})),...t.map(e=>({kind:`spec`,row:e})),...n.map(e=>({kind:`task`,row:e}))],A),[e,t,n,A]),te=(0,o.useMemo)(()=>M.filter(e=>Gu(e,b)),[M,b]),ne=(0,o.useMemo)(()=>new Map([...h,..._].map(e=>[e.id,Ku(e,t,n)])),[t,n,h,_]),re=S===null?[]:te.filter(e=>qd(e,n)===S),N=e=>{C(null),e.kind===`task`?d(e.row.id):T(e.row)};return(0,l.jsxs)(`section`,{className:`operations-unified-work`,children:[(0,l.jsx)(Hd,{locale:c,onChange:e=>{x(e),m?.(e)},value:b}),(0,l.jsx)(`section`,{"aria-label":c===`pt-BR`?`Kanban de trabalho`:`Work Kanban`,className:`operations-board operations-work-board`,children:Hu.map(e=>{let t=te.filter(t=>qd(t,n)===e);return(0,l.jsx)(Ud,{changes:s,globalItems:M,items:t,locale:c,nowMs:y,onOpenColumn:()=>{D(``),C(e)},onLoadMore:p===void 0?void 0:()=>p(e),onOpenItem:N,onPriorityChange:async e=>{let t=A;j(e);try{await f(e)}catch{j(t)}},onDragEnd:()=>k(null),onDragStart:k,draggedId:O,progressByMacro:ne,stage:e,totalItems:b===`all`?i?.[e]?.all??r?.[e]??t.length:b===`task`||b===`standalone-task`||b===`prd`||b===`spec`?i?.[e]?.[b]??t.length:t.length,state:a?.[e],totalsByTask:ee},e)})}),S?(0,l.jsx)(Kd,{items:re,locale:c,onClose:()=>C(null),onOpenItem:N,onQueryChange:D,query:E,stage:S}):null,w?(0,l.jsx)(Xu,{label:w.kind===`prd`?`PRD`:`SPEC`,locale:c,onClose:()=>T(null),onOpenDocument:u,onOpenTrace:e=>{T(null),d(e)},row:w,runs:g,specs:t,tasks:n}):null]})}function Hd({locale:e,onChange:t,value:n}){let r=e===`pt-BR`?{task:`Tarefas`,all:`Tudo`,prd:`PRDs`,spec:`SPECs`,"standalone-task":`Tarefa Avulsa`}:{task:`Tasks`,all:`All`,prd:`PRDs`,spec:`SPECs`,"standalone-task":`Standalone Tasks`};return(0,l.jsx)(`nav`,{"aria-label":e===`pt-BR`?`Filtrar tipo de trabalho`:`Filter work type`,className:`operations-work-type-filters`,children:[`all`,`task`,`standalone-task`,`prd`,`spec`].map(e=>(0,l.jsx)(`button`,{className:n===e?`is-active`:void 0,onClick:()=>t(e),type:`button`,children:r[e]},e))})}function Ud({changes:e,globalItems:t,items:n,totalItems:r,state:i,locale:a,nowMs:o,onOpenColumn:s,onLoadMore:c,onOpenItem:u,onPriorityChange:d,onDragEnd:f,onDragStart:p,draggedId:m,progressByMacro:h,stage:g,totalsByTask:_}){let{hasMore:v,sentinelRef:y,visibleCount:b}=zu(n.length,r,c),x=zd(n.length,r,i);return(0,l.jsxs)(`article`,{className:`operations-column is-${g}`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsx)(`button`,{className:`operations-column-trigger`,onClick:s,type:`button`,children:Yu(g,a)}),(0,l.jsx)(`button`,{"aria-label":`${r} — ${Yu(g,a)}`,className:`operations-column-count`,onClick:s,type:`button`,children:r})]}),(0,l.jsxs)(`div`,{className:`operations-column-body`,children:[n.slice(0,b).map((r,i)=>(0,l.jsx)(Wd,{changes:e,item:r,locale:a,nowMs:o,onOpen:()=>u(r),onMove:e=>{let r=i+e;if(r<0||r>=n.length)return;let a=[...n];[a[i],a[r]]=[a[r],a[i]],d(Gd(t,n,a))},onDrop:()=>{let e=n.findIndex(e=>e.row.id===m);if(e<0||e===i)return;let r=[...n],[a]=r.splice(e,1);a!==void 0&&(r.splice(i,0,a),d(Gd(t,n,r)))},onDragEnd:f,onDragStart:()=>p(r.row.id),order:i+1,progress:h.get(r.row.id),stage:g,totalsByTask:_},r.row.id)),(0,l.jsx)(Ld,{error:i?.error,locale:a,state:x}),v?(0,l.jsx)(`div`,{"aria-live":`polite`,className:`operations-infinite-sentinel`,ref:y,role:i?.error?`alert`:`status`,children:i?.error?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{children:i.error}),(0,l.jsx)(`button`,{onClick:c,type:`button`,children:`Tentar novamente`})]}):i?.loading?`Carregando mais…`:`${b} de ${r} · carregando mais…`}):null]})]})}function Wd({changes:e,item:t,locale:n,nowMs:r,onOpen:i,onMove:a,onDrop:o,onDragEnd:s,onDragStart:c,order:u,progress:d,stage:f,totalsByTask:p}){let m=vu(t.row.created_at,Zd(f),n,r),h=t.kind===`task`?t.row:null,g=t.kind===`task`?null:t.row,_=h?Fu(h,e):t.kind,v=_===`task`?`Tarefa Avulsa`:t.kind.toUpperCase(),y=h?p.get(h.id):null,b=g?[g.duration_ms,g.usage.total.tokens.total,g.usage.total.cost.brl]:[y?.durationMs??null,y?.tokens??null,y?.costBrl??null];return(0,l.jsxs)(`article`,{className:`operations-task-card operations-work-card is-kind-${_}`,draggable:f===`ready`,onDragEnd:f===`ready`?s:void 0,onDragOver:f===`ready`?e=>e.preventDefault():void 0,onDragStart:f===`ready`?c:void 0,onDrop:f===`ready`?e=>{e.preventDefault(),o()}:void 0,children:[(0,l.jsxs)(`button`,{"aria-label":Rd(n,t.row.title),className:`operations-work-card-open`,onClick:i,type:`button`,children:[f===`ready`?(0,l.jsx)(`span`,{className:`operations-work-card-first-line`,children:(0,l.jsxs)(`span`,{className:`operations-work-order`,children:[`#`,u]})}):null,(0,l.jsx)(`span`,{className:`operations-work-kind is-${t.kind}`,children:v}),u===1&&f===`ready`?(0,l.jsx)(`span`,{className:`operations-work-next`,children:`Próximo`}):null,f===`ready`?null:(0,l.jsx)(`span`,{className:`operations-work-status is-${f}`,children:Qd(f,n)}),h?(0,l.jsx)(`span`,{className:`operations-risk is-${h.risk}`,children:Nu(h.risk,n)}):null,(0,l.jsx)(`strong`,{title:t.row.title,children:t.row.title})]}),f===`ready`?(0,l.jsxs)(`div`,{className:`operations-work-reorder`,children:[(0,l.jsx)(`button`,{"aria-label":n===`pt-BR`?`Mover acima`:`Move up`,onClick:()=>a(-1),type:`button`,children:`↑`}),(0,l.jsx)(`button`,{"aria-label":n===`pt-BR`?`Mover abaixo`:`Move down`,onClick:()=>a(1),type:`button`,children:`↓`})]}):null,(0,l.jsx)(`small`,{title:t.row.id,children:t.row.id}),t.row.created_at?(0,l.jsx)(`small`,{className:`operations-card-created`,children:xu(t.row.created_at,n)}):null,m?(0,l.jsx)(`span`,{className:`operations-elapsed-badge${m.alert?` is-alert`:``}`,children:m.label}):null,g?(0,l.jsx)(`span`,{className:`operations-work-card-counts`,children:qu(g.kind,d??{completedSpecs:0,totalSpecs:0,completedTasks:0,totalTasks:0})}):null,(0,l.jsx)(`dl`,{className:`operations-task-usage operations-macro-usage`,children:[[n===`pt-BR`?`Tempo`:`Time`,b[0]==null?`—`:Cu(b[0])],[`Tokens`,b[1]==null?`—`:D(b[1])],[n===`pt-BR`?`Custo`:`Cost`,b[2]==null?`—`:k(b[2],`BRL`)]].map(([e,t])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`dt`,{children:e}),(0,l.jsx)(`dd`,{children:t})]},e))})]})}function Gd(e,t,n){let r=new Set(t.map(e=>e.row.id)),i=n.map(e=>e.row.id),a=0;return e.map(e=>r.has(e.row.id)?i[a++]??e.row.id:e.row.id)}function Kd({items:e,locale:t,onClose:n,onOpenItem:r,onQueryChange:i,query:a,stage:o}){let s=Bd(e,a);return(0,y.createPortal)((0,l.jsx)(`dialog`,{className:`operations-status-dialog-backdrop`,onMouseDown:e=>e.currentTarget===e.target&&n(),open:!0,children:(0,l.jsxs)(`section`,{"aria-label":Yu(o,t),"aria-modal":`true`,className:`operations-status-dialog`,role:`dialog`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:t===`pt-BR`?`Coluna de trabalho`:`Work column`}),(0,l.jsx)(`h2`,{children:Yu(o,t)}),(0,l.jsxs)(`p`,{children:[e.length,` itens`]})]}),(0,l.jsx)(`button`,{"aria-label":t===`pt-BR`?`Fechar`:`Close`,onClick:n,type:`button`,children:`×`})]}),(0,l.jsxs)(`label`,{className:`operations-status-dialog-search`,children:[(0,l.jsx)(`span`,{children:t===`pt-BR`?`Buscar itens`:`Search items`}),(0,l.jsx)(`input`,{autoFocus:!0,onChange:e=>i(e.target.value),placeholder:t===`pt-BR`?`Título, ID ou tipo`:`Title, ID, or type`,type:`search`,value:a})]}),(0,l.jsxs)(`div`,{className:`operations-status-task-list`,children:[s.map(e=>(0,l.jsxs)(`button`,{onClick:()=>r(e),type:`button`,children:[(0,l.jsxs)(`span`,{className:`operations-status-task-main`,children:[(0,l.jsx)(`strong`,{children:e.row.title}),(0,l.jsx)(`small`,{children:e.row.id})]}),(0,l.jsx)(`span`,{className:`operations-work-kind is-${e.kind}`,children:e.kind===`task`?`TASK`:e.kind.toUpperCase()}),(0,l.jsxs)(`span`,{className:`operations-status-task-action`,children:[t===`pt-BR`?`Ver detalhes`:`View details`,` →`]})]},`${e.kind}:${e.row.id}`)),s.length===0?(0,l.jsx)(`p`,{className:`operations-empty`,children:t===`pt-BR`?`Nenhum item encontrado nesta coluna.`:`No items found in this column.`}):null]})]})}),document.body)}function qd(e,t){return e.kind===`task`?Uu(e.row):Wu(e.row,t)}function Jd(e,t=null){let n=t===null?null:new Map(t.map((e,t)=>[e,t]));return e.sort((e,t)=>Yd(n?.get(e.row.id)??e.row.manual_order,n?.get(t.row.id)??t.row.manual_order)||Xd(e).localeCompare(Xd(t))||e.row.id.localeCompare(t.row.id))}function Yd(e,t){return e!=null&&t!=null?e-t:e==null?t==null?0:1:-1}function Xd(e){return e.kind===`task`?e.row.updated_at:e.row.updated_at??e.row.created_at??``}function Zd(e){return e===`definition`?`draft`:e===`planning`||e===`ready`?`planned`:e===`blocked`?`blocked`:e}function Qd(e,t){return{"pt-BR":{definition:`Definição`,planning:`Planejamento`,ready:`Pronto para executar`,executing:`Executando`,verifying:`Em verificação`,completed:`Concluído`,blocked:`Bloqueado`,cancelled:`Cancelado`,failed:`Falhado`},"en-US":{definition:`Definition`,planning:`Planning`,ready:`Ready to execute`,executing:`Running`,verifying:`Verifying`,completed:`Completed`,blocked:`Blocked`,cancelled:`Cancelled`,failed:`Failed`}}[t][e]}function $d(e,t=`—`){return typeof e==`string`&&e.length>0?e:t}function ef(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function tf(e,t){let n=e.stage??e.status;return n===`draft`?t===`pt-BR`?`Rascunho`:`Draft`:Hu.includes(n)?Yu(n,t):$d(n)}function nf(e,t){let n=$d(e,``);return n===`task`||n===`standalone-task`||n===`prd`||n===`spec`?(t===`pt-BR`?{task:`Tarefas`,"standalone-task":`Tarefa Avulsa`,prd:`PRD`,spec:`SPEC`}:{task:`Tasks`,"standalone-task":`Standalone Task`,prd:`PRD`,spec:`SPEC`})[n]:$d(e)}function rf({loading:e,locale:t,onPageChange:n,onTypeChange:r,page:i}){return(0,l.jsxs)(`section`,{"aria-busy":e||void 0,className:`operations-unified-work operations-work-list`,children:[(0,l.jsx)(Hd,{locale:t,onChange:r,value:i.typeFilter}),(0,l.jsx)(`div`,{className:`operations-work-list-table`,children:(0,l.jsx)(b,{columns:[{key:`item`,label:`Item`,render:e=>(0,l.jsxs)(`span`,{className:`operations-work-list-identity`,children:[(0,l.jsx)(`strong`,{children:$d(e.title,$d(e.id))}),(0,l.jsx)(`small`,{children:$d(e.id)})]}),sortValue:e=>$d(e.title,$d(e.id))},{key:`status`,label:`Status`,render:e=>tf(e,t),sortValue:e=>tf(e,t)},{key:`type`,label:t===`pt-BR`?`Tipo`:`Type`,render:e=>nf(e.kind??e.entity_kind,t),sortValue:e=>$d(e.kind??e.entity_kind)},{key:`risk`,label:t===`pt-BR`?`Risco`:`Risk`,render:e=>$d(e.risk),sortValue:e=>$d(e.risk)},{key:`developers`,label:t===`pt-BR`?`Desenvolvedor`:`Developer`,render:e=>hl(e.developers),sortValue:e=>hl(e.developers)},{key:`time`,label:t===`pt-BR`?`Tempo`:`Time`,render:e=>{let t=ef(e.total_duration);return t===null?`—`:Cu(t)},sortValue:e=>ef(e.total_duration),align:`right`},{key:`tokens`,label:`Tokens`,render:e=>{let t=ef(e.total_tokens);return t===null?`—`:D(t)},sortValue:e=>ef(e.total_tokens),align:`right`},{key:`cost`,label:t===`pt-BR`?`Custo`:`Cost`,render:e=>{let t=ef(e.total_cost_brl);return t===null?`—`:k(t,`BRL`)},sortValue:e=>ef(e.total_cost_brl),align:`right`}],defaultSort:{key:`item`,direction:`asc`},emptyMessage:e?t===`pt-BR`?`Carregando itens…`:`Loading items…`:t===`pt-BR`?`Nenhum item de trabalho encontrado.`:`No work items found.`,locale:t,rowKey:e=>$d(e.id),rows:i.rows,scrollLabel:t===`pt-BR`?`Lista paginada de itens de trabalho.`:`Paged work item list.`,sortable:!0})}),(0,l.jsxs)(`nav`,{"aria-label":t===`pt-BR`?`Paginação da lista de trabalho`:`Work list pagination`,className:`ui-table-pagination`,children:[i.error?(0,l.jsx)(`span`,{role:`alert`,children:i.error}):null,e?(0,l.jsx)(`span`,{role:`status`,children:t===`pt-BR`?`Atualizando…`:`Updating…`}):null,(0,l.jsx)(`button`,{disabled:e||i.offset===0,onClick:()=>n(Math.max(0,i.offset-i.limit)),type:`button`,children:t===`pt-BR`?`Anterior`:`Previous`}),(0,l.jsx)(`output`,{"aria-live":`polite`,children:i.total===null?`…`:`${i.offset+(i.rows.length===0?0:1)}–${Math.min(i.offset+i.limit,i.total)} ${t===`pt-BR`?`de`:`of`} ${i.total}`}),(0,l.jsx)(`button`,{disabled:e||!i.hasMore,onClick:()=>n(i.offset+i.limit),type:`button`,children:t===`pt-BR`?`Próxima`:`Next`})]})]})}function af(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);return[...t.values()].filter(e=>(e.phase===void 0||e.phase===`execution`)&&(e.parent_run_id===void 0||e.parent_run_id===null))}function of(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);return[...t.values()]}function sf(e){return e!==null&&e>=0?e:null}function cf(e){return sf(e.source_duration_ms??null)}function lf(e){let t=e.filter(e=>e!==null);return t.length===0?null:t.reduce((e,t)=>e+t,0)}function uf(e){let t=af(e);return{runs:t,durationMs:lf(t.map(cf)),tokens:lf(t.map(e=>e.usage.total.tokens.total)),costBrl:lf(t.map(e=>e.usage.total.cost.brl))}}function df(e){let t=of(e);return{runs:t,durationMs:lf(t.map(cf)),tokens:lf(t.map(e=>e.usage.total.tokens.total)),costBrl:lf(t.map(e=>e.usage.total.cost.brl))}}function ff(e){let t=df(e);return{runs:t.runs,tokens:t.tokens,costBrl:t.costBrl}}function pf(e,t,n,r=!1,i){let a=new Map,o=new Map,s=new Map,c=gf(e.runs,t,r,i),l=new Set((e.evidences??[]).map(e=>e.id)),u=e=>{let t=a.get(e);if(t!==void 0)return t;let n={key:e,prds:0,specs:0,tasks:0,tasksCreated:0,tasksActive:0,taskDaysActive:0,runs:0,tests:0,evidences:0,durationMs:null,tokens:null,costBrl:null};return a.set(e,n),o.set(e,new Set),s.set(e,new Set),n},d=e=>{let n=wf(e,t);return n===null?null:u(n)};for(let t of e.prds){let e=d(t.created_at);e!==null&&(e.prds+=1)}for(let t of e.specs){let e=d(t.created_at);e!==null&&(e.specs+=1)}for(let t of e.tasks){let n=d(t.created_at);if(n===null)continue;n.tasks+=1,n.tasksCreated+=1,e.validations===void 0&&(n.tests+=t.test_count??0);let r=o.get(n.key);for(let e of t.result?.evidence_ids??[])l.has(e)||r?.add(e)}for(let t of e.evidences??[]){let e=d(t.observed_at);e!==null&&o.get(e.key)?.add(t.id)}let f=new Map;for(let t of e.validations??[]){let e=d(t.executed_at);if(e===null)continue;let n=f.get(e.key)??new Set;n.add(t.id),f.set(e.key,n)}for(let t of of(e.runs)){let e=d(t.started_at);e!==null&&(e.runs+=1,t.task_id!==null&&t.task_id!==void 0&&s.get(e.key)?.add(t.task_id),e.tokens=xf(e.tokens,t.usage.total.tokens.total),e.costBrl=xf(e.costBrl,n===void 0?t.usage.total.cost.brl:n(t.id)))}for(let[e,t]of o){let n=a.get(e);n!==void 0&&(n.evidences=t.size)}for(let[e,t]of f){let n=a.get(e);n!==void 0&&(n.tests=t.size)}for(let[e,t]of s){let n=a.get(e);n!==void 0&&(n.tasksActive=t.size,n.taskDaysActive=t.size)}for(let[e,t]of c)u(e).durationMs=t;return[...a.values()].sort((e,t)=>t.key.localeCompare(e.key))}function mf(e,t){let n=new Map;for(let[r,i]of Object.entries(e)){let e=wf(`${r}T12:00:00.000Z`,t);if(e===null)continue;let a=n.get(e)??{key:e,prds:0,specs:0,tasks:0,tasksCreated:0,tasksActive:0,taskDaysActive:0,runs:0,tests:0,evidences:0,durationMs:null,tokens:null,costBrl:null};a.prds+=i.prds,a.specs+=i.specs,a.tasks+=i.tasks,a.tasksCreated+=i.tasks,a.tasksActive=(a.tasksActive??0)+i.tasks,a.taskDaysActive+=i.tasks,a.runs+=i.runs,a.tests+=i.validations,a.evidences+=i.evidences,a.tokens=xf(a.tokens,hf(i.runs,i.usage.total_tokens)),a.costBrl=xf(a.costBrl,hf(i.runs,i.usage.cost)),a.durationMs=xf(a.durationMs,hf(i.runs,i.duration)),n.set(e,a)}return[...n.values()].sort((e,t)=>t.key.localeCompare(e.key))}function hf(e,t){return t===void 0||t.unknown>=e?null:t.known_sum}function gf(e,t,n,r){let i=new Map;for(let r of af(e)){if(n&&!od(r.started_at))continue;let e=cf(r);if(e===null)continue;let a=r.source_started_at??r.duration_started_at??r.started_at,o=Date.parse(a);if(!Number.isFinite(o))continue;let s=o+e,c=o;do{let e=wf(new Date(c).toISOString(),t);if(e===null)break;let n=Math.min(s,_f(e,t));if(i.set(e,(i.get(e)??0)+n-c),n>=s)break;c=n}while(c<=s)}if(n)for(let[e,n]of Object.entries(id)){let a=Date.parse(`${e}T12:00:00.000Z`);if(r?.from!==null&&r?.from!==void 0&&a<Date.parse(r.from)||r?.to!==null&&r?.to!==void 0&&a>Date.parse(r.to))continue;let o=wf(`${e}T12:00:00.000Z`,t);o!==null&&i.set(o,(i.get(o)??0)+n)}return i}function _f(e,t){let[n,r=1,i=1]=e.split(`-`).map(Number),a=new Date(Date.UTC(n,r-1,i));return t===`day`?a.setUTCDate(a.getUTCDate()+1):t===`month`?a.setUTCMonth(a.getUTCMonth()+1,1):a.setUTCFullYear(a.getUTCFullYear()+1,0,1),vf(a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate())}function vf(e,t,n){let r=Date.UTC(e,t-1,n),i=new Intl.DateTimeFormat(`en-US`,{timeZone:`America/Sao_Paulo`,timeZoneName:`longOffset`}).formatToParts(new Date(r)).find(e=>e.type===`timeZoneName`)?.value??`GMT`,a=/^GMT([+-])(\d{2}):(\d{2})$/.exec(i);return a===null?r:r-(Number(a[2])*60+Number(a[3]))*6e4*(a[1]===`+`?1:-1)}function yf(e){let t={prds:0,specs:0,tasks:0,tasksCreated:0,tasksActive:null,taskDaysActive:0,runs:0,tests:0,evidences:0,durationMs:null,tokens:null,costBrl:null};for(let n of e)t.prds+=n.prds,t.specs+=n.specs,t.tasks+=n.tasks,t.tasksCreated+=n.tasksCreated,t.taskDaysActive+=n.taskDaysActive,t.runs+=n.runs,t.tests+=n.tests,t.evidences+=n.evidences,t.durationMs=xf(t.durationMs,n.durationMs),t.tokens=xf(t.tokens,n.tokens),t.costBrl=xf(t.costBrl,n.costBrl);return t}function bf(e){let t=e.length;return{tasks:t===0?null:e.reduce((e,t)=>e+t.tasks,0)/t,specs:t===0?null:e.reduce((e,t)=>e+t.specs,0)/t,prds:t===0?null:e.reduce((e,t)=>e+t.prds,0)/t,durationMs:Cf(e.map(e=>e.durationMs),t),tokens:Sf(e.map(e=>e.tokens)),costBrl:Sf(e.map(e=>e.costBrl))}}function xf(e,t){return t===null?e:(e??0)+t}function Sf(e){let t=e.filter(e=>e!==null);return t.length===0?null:t.reduce((e,t)=>e+t,0)/t.length}function Cf(e,t){if(t===0)return null;let n=e.filter(e=>e!==null);return n.length===0?null:n.reduce((e,t)=>e+t,0)/t}function wf(e,t){return sd(e,t)}function Tf({currency:e,data:t,granularity:n,locale:r,resolveRunCost:i,includeLegacyEffort:a=!1,legacyRange:o,manifestDailyPeriods:s,factualCostPeriods:c}){let u=Ef(s===void 0||e===`USD`?pf(t,n,i,a,o):mf(s,n),e,c?.[n]),d=yf(u),f={...d,durationMs:Of(d.durationMs,d.tokens)},p=bf(u),m=r===`pt-BR`?`Total geral`:`Grand total`,h=D(f.tokens);return(0,l.jsxs)(`div`,{className:`operations-period-summary`,children:[(0,l.jsx)(ee,{ariaLabel:kf(n,r),metrics:[{label:Af(r===`pt-BR`?`Tarefas criadas`:`Tasks created`,n,r),value:O(p.tasks,r,1)},{label:Af(`SPECs`,n,r),value:O(p.specs,r,1)},{label:Af(`PRDs`,n,r),value:O(p.prds,r,1)},{label:Af(r===`pt-BR`?`Tempo`:`Time`,n,r),value:E(p.durationMs,r)},{label:Af(`Tokens`,n,r),value:D(p.tokens,r)},{label:Af(r===`pt-BR`?`Custo`:`Cost`,n,r),value:k(p.costBrl,e,r)}]}),(0,l.jsx)(b,{columns:[{key:`period`,label:Mf(n,r),render:e=>(0,l.jsx)(`strong`,{children:Nf(e.key,n,r)}),footer:m,sortValue:e=>e.key},jf(`prds`,`PRDs`,f.prds),jf(`specs`,`SPECs`,f.specs),jf(`tasks`,r===`pt-BR`?`Tarefas criadas`:`Tasks created`,f.tasks),jf(`runs`,`Runs`,f.runs),jf(`tests`,r===`pt-BR`?`Testes`:`Tests`,f.tests),jf(`evidences`,r===`pt-BR`?`Evidências`:`Evidence`,f.evidences),{key:`duration`,label:r===`pt-BR`?`Tempo`:`Time`,align:`right`,render:e=>T(e.durationMs),footer:(0,l.jsx)(`output`,{"aria-label":`${m} — ${r===`pt-BR`?`Tempo`:`Time`}: ${T(f.durationMs)}`,children:T(f.durationMs)}),sortValue:e=>e.durationMs},{key:`tokens`,label:`Tokens`,align:`right`,render:e=>D(e.tokens),footer:(0,l.jsx)(`output`,{"aria-label":`${m} — Tokens: ${h}`,children:h}),sortValue:e=>e.tokens},{key:`cost`,label:r===`pt-BR`?`Custos`:`Costs`,align:`right`,render:t=>k(t.costBrl,e,r),footer:(0,l.jsx)(`output`,{"aria-label":`${m} — ${r===`pt-BR`?`Custos`:`Costs`}: ${k(f.costBrl,e,r)}`,children:k(f.costBrl,e,r)}),sortValue:e=>e.costBrl}],emptyMessage:r===`pt-BR`?`Nenhum dado disponível para o período selecionado.`:`No data available for the selected period.`,defaultSort:{key:`period`,direction:`desc`},locale:r,rowKey:e=>e.key,rows:u,sortable:!0,showColumnInfo:!0})]})}function Ef(e,t,n){if(n===void 0)return[...e];let r=new Map(n.map(e=>[e.key,t===`USD`?e.estimated_usd:e.estimated_brl]));return e.map(e=>r.has(e.key)?{...e,costBrl:r.get(e.key)??null}:e)}function Df(e,t){if(t===void 0)return[...e];let n=new Map(t.map(e=>[e.key,e.duration_ms]));return e.map(e=>{if(e.durationMs!==null)return e;let t=n.get(e.key);return t==null?e:{...e,durationMs:t}})}function Of(e,t){return e===null&&t===0?0:e}function kf(e,t){return t===`en-US`?e===`day`?`Daily averages`:e===`month`?`Monthly averages`:`Annual averages`:e===`day`?`Médias por dia`:e===`month`?`Médias por mês`:`Médias por ano`}function Af(e,t,n){return n===`en-US`?`${e} ${t===`day`?`Daily average`:t===`month`?`Monthly average`:`Annual average`}`:`${e} ${t===`day`?`Médio por dia`:t===`month`?`Médio por mês`:`Médio por ano`}`}function jf(e,t,n){return{key:e,label:t,align:`right`,render:t=>t[e],footer:n,sortValue:t=>t[e]}}function Mf(e,t){return t===`en-US`?e===`day`?`Day`:e===`month`?`Month`:`Year`:e===`day`?`Dia`:e===`month`?`Mês`:`Ano`}function Nf(e,t,n){if(t===`month`||t===`year`)return e;let r=new Date(`${e}T12:00:00`);return new Intl.DateTimeFormat(n,{...t===`day`?{day:`2-digit`}:{},month:t===`day`?`2-digit`:`long`,year:`numeric`}).format(r)}function Pf({allSpecs:e,allTasks:t,changes:n,locale:r,onOpenDocument:i,onOpenTask:a,prds:s,runs:c,specs:u,tasks:d,onTypeChange:f}){let[p,m]=(0,o.useState)(`all`),[h,g]=(0,o.useState)(null),_=(0,o.useMemo)(()=>Lf({allSpecs:e,allTasks:t,changes:n,items:[...s.map(e=>({kind:`prd`,row:e})),...u.map(e=>({kind:`spec`,row:e})),...d.map(e=>({kind:`task`,row:e}))].filter(e=>Gu(e,p)),runs:c}),[e,t,n,s,c,u,d,p]);return(0,l.jsxs)(`section`,{className:`operations-unified-work operations-work-list`,children:[(0,l.jsx)(Hd,{locale:r,onChange:e=>{m(e),f?.(e)},value:p}),(0,l.jsx)(`div`,{className:`operations-work-list-table`,children:(0,l.jsx)(b,{columns:[{key:`item`,label:`Item`,render:({item:e})=>(0,l.jsxs)(`span`,{className:`operations-work-list-identity`,children:[(0,l.jsx)(`strong`,{children:e.row.title}),(0,l.jsx)(`small`,{children:e.row.id})]}),sortValue:({item:e})=>e.row.title},{key:`status`,label:`Status`,render:({stage:e})=>(0,l.jsx)(`span`,{className:`operations-status is-${e}`,children:If(e,r)}),sortValue:({stage:e})=>e},{key:`type`,label:r===`pt-BR`?`Tipo`:`Type`,render:({item:e})=>Bf(e.kind,r),sortValue:({item:e})=>e.kind},{key:`risk`,label:r===`pt-BR`?`Risco`:`Risk`,render:({risk:e})=>e?(0,l.jsx)(`span`,{className:`operations-risk is-${e}`,children:Nu(e,r)}):`—`,sortValue:({risk:e})=>e},{key:`developers`,label:r===`pt-BR`?`Desenvolvedor`:`Developer`,render:({item:e})=>hl(e.row.developers),sortValue:({item:e})=>hl(e.row.developers)},{key:`progress`,label:r===`pt-BR`?`Progresso`:`Progress`,render:({progress:e})=>e,sortValue:({item:e})=>e.kind===`task`?e.row.progress:e.row.quality.task_completion_rate},{key:`time`,label:r===`pt-BR`?`Tempo`:`Time`,render:({durationMs:e,stage:t})=>Ff(e,t,r),sortValue:({durationMs:e})=>e,align:`right`},{key:`tokens`,label:`Tokens`,render:({tokens:e})=>e===null?`—`:D(e),sortValue:({tokens:e})=>e,align:`right`},{key:`cost`,label:r===`pt-BR`?`Custo`:`Cost`,render:({costBrl:e})=>e===null?`—`:k(e,`BRL`),sortValue:({costBrl:e})=>e,align:`right`}],defaultSort:{key:`item`,direction:`asc`},emptyMessage:r===`pt-BR`?`Nenhum item de trabalho encontrado.`:`No work items found.`,locale:r,onRowClick:({item:e})=>{e.kind===`task`?a(e.row.id):g(e.row)},rowKey:({item:e})=>`${e.kind}:${e.row.id}`,rows:_,scrollLabel:r===`pt-BR`?`Tabela de itens de trabalho com rolagem horizontal para acessar todas as colunas.`:`Work items table with horizontal scrolling to access all columns.`,showColumnInfo:!0,sortable:!0})}),h?(0,l.jsx)(Xu,{label:h.kind===`prd`?`PRD`:`SPEC`,locale:r,onClose:()=>g(null),onOpenDocument:i,onOpenTrace:e=>{g(null),a(e)},row:h,runs:c,specs:e,tasks:t}):null]})}function Ff(e,t,n){return e===null?ne({durationMs:null,provenance:t===`executing`?`in_progress`:`unavailable`},n):Cu(e)}function If(e,t){return e===`draft`?t===`pt-BR`?`Rascunho`:`Draft`:e===`unstaged`?t===`pt-BR`?`Sem etapa`:`Unstaged`:Yu(e,t)}function Lf({allSpecs:e,allTasks:t,changes:n,items:r,runs:i}){return r.map(n=>{let r=n.kind===`task`?n.row:null,a=n.kind===`task`?null:n.row,o=i.filter(e=>r?e.task_id===r.id:a!==null&&(a.run_ids.includes(e.id)||e.prd_id===a.id||e.spec_id===a.id||e.task_id!==null&&a.task_ids.includes(e.task_id))),s=r===null?null:Vf(r,o),c=a?Ku(a,e,t):null,l=a,u=c;if(r===null){if(l===null||u===null)throw Error(`A non-task work item must include macro progress.`);return{item:n,stage:Wu(l,t),risk:null,progress:qu(l.kind,u),durationMs:l.duration_ms??(zf(l)?0:null),tokens:l.usage.total.tokens.total??null,costBrl:l.usage.total.cost.brl??null}}return{item:n,stage:Uu(r)??(r.status===`draft`?`draft`:`unstaged`),risk:r.risk??null,progress:`${Math.round(r.progress)}%`,durationMs:s?.durationMs??(Rf(r,o)?0:null),tokens:s?.tokens??null,costBrl:s?.costBrl??null}})}function Rf(e,t){return t.length===0&&e.execution_started===!1&&(e.execution_count===0||e.execution_count===void 0)&&(e.status===`planned`||e.status===`cancelled`)}function zf(e){return e.task_count===0&&e.execution_count===0&&e.run_count===0&&e.task_ids.length===0&&e.run_ids.length===0}function Bf(e,t){return e===`task`?t===`pt-BR`?`Tarefa`:`Task`:e.toUpperCase()}function Vf(e,t){return e.telemetry!==null&&e.telemetry!==void 0?{durationMs:e.telemetry.duration_ms,tokens:e.telemetry.tokens,costBrl:e.telemetry.cost_brl}:t.reduce((e,t)=>({durationMs:Hf(e.durationMs,t.phase===`execution`&&t.parent_run_id===null?te(t):null),tokens:Hf(e.tokens,t.usage.total.tokens.total),costBrl:Hf(e.costBrl,t.usage.total.cost.brl)}),{durationMs:null,tokens:null,costBrl:null})}function Hf(e,t){return e===null&&t===null?null:(e??0)+(t??0)}function Uf({boardKindTotals:e,boardStates:t,boardTotals:n,changes:r,conversationExecutions:i,conversationRuns:a,currency:o,data:s,entityPage:c,executions:u,factualCostPeriods:d,includeLegacyEffort:f,locale:p,onBoardTypeChange:m,onEntityPageChange:h,onLoadMoreBoard:g,onWorkListTypeChange:_,onWorkListPageChange:v,onOpenDocument:y,onOpenTask:b,onPriorityChange:x,prds:S,resolveRunCost:C,runs:w,specs:T,summaryPopulation:E,tasks:D,workListPage:O,view:k}){return(0,l.jsxs)(`section`,{className:`operations-content`,children:[k===`work-kanban`?(0,l.jsx)(Vd,{allPrds:s.prds,allSpecs:s.specs,allTasks:s.tasks,boardTotals:n,boardKindTotals:e,boardStates:t,changes:s.changes,locale:p,onOpenDocument:y,onOpenTask:b,onPriorityChange:x,onLoadMore:g,onTypeChange:m,prds:S,runs:s.runs,specs:T,tasks:D}):null,k===`work-list`?O?(0,l.jsx)(rf,{loading:O.loading,locale:p,onPageChange:e=>v?.(e),onTypeChange:e=>_?.(e),page:O}):(0,l.jsx)(Pf,{allSpecs:s.specs,allTasks:s.tasks,changes:s.changes,locale:p,onOpenDocument:y,onOpenTask:b,prds:S,runs:s.runs,specs:T,tasks:D,onTypeChange:_}):null,k===`changes`?(0,l.jsx)(xe,{locale:p,rows:r}):null,k===`executions`?(0,l.jsx)(Se,{canonical:c?.aggregation!==`page_partial`,locale:p,rows:u}):null,k===`runs`?(0,l.jsx)(De,{locale:p,rows:w}):null,k===`conversations`?(0,l.jsx)(ke,{canonical:c?.aggregation!==`page_partial`,executions:i,locale:p,rows:a}):null,c&&[`runs`,`executions`,`conversations`,`changes`,`decisions`].includes(k)?(0,l.jsx)(Id,{entityPage:c,locale:p,onChange:h}):null,k===`decisions`?(0,l.jsx)(B,{locale:p,rows:s.decisions}):null,k===`daily`||k===`monthly`||k===`yearly`?(0,l.jsx)(Tf,{data:E,currency:o,granularity:k===`daily`?`day`:k===`monthly`?`month`:`year`,locale:p,resolveRunCost:C,includeLegacyEffort:f,...d===void 0?{}:{factualCostPeriods:d},legacyRange:s.filters,...s.summary.periods===void 0?{}:{manifestDailyPeriods:s.summary.periods.daily}}):null]})}function Wf(e,t,n){return new Intl.NumberFormat(n,{style:`currency`,currency:t,maximumFractionDigits:0}).format(e)}function Gf(e,t){return e===null?t===`pt-BR`?`Indisponível`:`Unavailable`:T(e,t)}function Kf(e,t,n,r,i=!1){return e===null?t===0||i?`0`:Gf(null,r):n(e)}function qf(e,t,n){if(!(e!==null||t===null||t===0))return n===`pt-BR`?`Zero exibido por falta de medição; não é um valor observado.`:`Zero displayed because no measurement was recorded; this is not an observed value.`}function Jf(e,t,n,r){return t!==null||n===null||n===0?e:`${e} (${r===`pt-BR`?`sem medição`:`unmeasured`})`}function Yf({averageCost:e,averageDuration:t,averageTokens:n,costLabel:r,count:i,formatCost:a,formatDuration:o,formatTokens:s,locale:c,timeLabel:l,tokensLabel:u}){let d=r??(c===`pt-BR`?`Custo médio`:`Average cost`);return[[Jf(l,t,i,c),Kf(t,i,o,c,!0)],[Jf(u,n,i,c),Kf(n,i,s,c,!0)],[Jf(d,e,i,c),Kf(e,i,a,c,!0)]]}function Xf({eyebrow:e,label:t,locale:n,onClose:r,onOpenTask:i,onOpenDocument:a,items:o,state:s,kind:c=`task`,onLoadMore:u,page:d}){let f=d?.total??o.length,p=Zf(c,f,n);return(0,l.jsx)(`dialog`,{className:`operations-status-dialog-backdrop`,onMouseDown:e=>{e.currentTarget===e.target&&r()},open:!0,children:(0,l.jsxs)(`section`,{"aria-label":`${t} — ${f} ${p}`,"aria-modal":`true`,className:`operations-status-dialog`,role:`dialog`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:e}),(0,l.jsx)(`h2`,{children:t}),(0,l.jsxs)(`p`,{children:[f,` `,p]})]}),(0,l.jsx)(`button`,{"aria-label":n===`pt-BR`?`Fechar`:`Close`,onClick:r,type:`button`,children:`×`})]}),(0,l.jsxs)(`div`,{className:`operations-status-task-list`,children:[(d?.loading??s?.loading)&&o.length===0?(0,l.jsx)(`p`,{"aria-busy":`true`,"aria-live":`polite`,className:`operations-empty`,role:`status`,children:n===`pt-BR`?`Carregando itens…`:`Loading items…`}):null,d?.error??s?.error?(0,l.jsx)(`p`,{"aria-live":`assertive`,className:`operations-empty`,role:`alert`,children:d?.error??s?.error}):null,o.map(e=>(0,l.jsxs)(`button`,{onClick:()=>`change_id`in e?i(e.id):a(e.kind,e.id),type:`button`,children:[(0,l.jsxs)(`span`,{className:`operations-status-task-main`,children:[(0,l.jsx)(`strong`,{children:e.title}),(0,l.jsx)(`small`,{children:e.id})]}),(0,l.jsx)(`span`,{className:`change_id`in e?`operations-risk is-${e.risk}`:`operations-work-kind is-macro`,children:`change_id`in e?Nu(e.risk,n):e.kind.toUpperCase()}),(0,l.jsxs)(`span`,{className:`operations-status-task-action`,children:[n===`pt-BR`?`Ver detalhes`:`View details`,` →`]})]},e.id)),o.length===0&&!(d?.loading??s?.loading)?(0,l.jsx)(`p`,{className:`operations-empty`,children:n===`pt-BR`?`Nenhum${c===`task`?`a`:``} ${Zf(c,1,n)} neste status.`:`No ${Zf(c,2,n)} in this status.`}):null,u&&o.length<(d?.total??0)?(0,l.jsx)(`button`,{disabled:d?.loading,onClick:()=>u(o.length),type:`button`,children:d?.loading?n===`pt-BR`?`Carregando…`:`Loading…`:n===`pt-BR`?`Carregar mais`:`Load more`}):null]})]})})}function Zf(e,t,n){return e===`prd`?t===1?`PRD`:`PRDs`:e===`spec`?t===1?`SPEC`:`SPECs`:n===`pt-BR`?t===1?`tarefa`:`tarefas`:t===1?`task`:`tasks`}var Qf={definition:`#a78bfa`,planning:`#3f6fbd`,ready:`#38bdf8`,executing:`#fbbf24`,verifying:`#f87171`,completed:`#34d399`,blocked:`#64748b`,cancelled:`#64748b`,failed:`#64748b`},$f={lite:`#60a5fa`,standard:`#fbbf24`,critical:`#f87171`},ep={empty:`#60a5fa`,structured:`#fbbf24`,rework:`#f87171`};function tp(e){return e.reduce((e,t)=>t===null?e:(e??0)+t,null)}function np(e,t){return t===null||t===0?{durationMs:null,tokens:null,costBrl:null}:{durationMs:e.durationMs===null?null:e.durationMs/t,tokens:e.tokens===null?null:e.tokens/t,costBrl:e.costBrl===null?null:e.costBrl/t}}function rp(e){let t=null;for(let n of e){if(n.created_at===null)continue;let e=Date.parse(n.created_at);Number.isNaN(e)||(t===null||e>t.timestamp)&&(t={value:n.created_at,timestamp:e})}return t?.value??null}function ip(e,t,n){let r=new Map(e.map(e=>[e.id,{id:e.id,title:e.title,durationMs:e.telemetry?.duration_ms??null,tokens:e.telemetry?.tokens??null,costBrl:e.telemetry?.cost_brl??null,runCount:e.telemetry===null||e.telemetry===void 0?0:1}]));if(t.length===0)return[...r.values()];for(let e of r.values())e.durationMs=null,e.tokens=null,e.costBrl=null,e.runCount=0;for(let e of af(t)){if(e.task_id===null)continue;let t=r.get(e.task_id);if(t===void 0)continue;t.runCount+=1;let n=sf(e.duration_ms);n!==null&&(t.durationMs=(t.durationMs??0)+n)}for(let e of of(t)){if(e.task_id===null)continue;let t=r.get(e.task_id);if(t===void 0)continue;e.usage.total.tokens.total!==null&&(t.tokens=(t.tokens??0)+e.usage.total.tokens.total);let i=n?n(e.id):e.usage.total.cost.brl;i!==null&&(t.costBrl=(t.costBrl??0)+i)}return[...r.values()]}function ap(e,t,n){return e.map(e=>{let r=e.lifecycle_duration_coverage??e.duration_coverage;if(r!==void 0){let t=e.observed_lifecycle_duration_ms??e.observed_root_duration_ms??e.duration_ms??null;return{id:e.id,title:e.title,durationMs:t,durationProvenance:e.lifecycle_duration_provenance??(t===null?`unavailable`:`observed`),durationEligible:r.eligible_runs,durationKnown:r.known_runs,tokens:e.usage?.total.tokens.total??null,costBrl:e.usage?.total.cost.brl??null,runCount:e.run_count??e.root_execution_run_ids?.length??0}}if(t.length===0)return{id:e.id,title:e.title,durationMs:e.duration_ms??null,durationProvenance:e.duration_provenance??(e.duration_ms===null?`unavailable`:`observed`),durationEligible:null,durationKnown:null,tokens:e.usage?.total.tokens.total??null,costBrl:e.usage?.total.cost.brl??null,runCount:e.run_count??0};let i=new Set(e.run_ids),a=t=>i.has(t.id)||(e.kind===`spec`?t.spec_id===e.id:t.prd_id===e.id),o=af(t).filter(a),s=of(t).filter(a);return{id:e.id,title:e.title,durationMs:lf(o.map(e=>e.duration_ms)),durationProvenance:o.some(e=>e.duration_ms!==null)?`observed`:`unavailable`,durationEligible:o.length,durationKnown:o.filter(e=>e.duration_ms!==null).length,tokens:lf(s.map(e=>e.usage.total.tokens.total)),costBrl:lf(s.map(e=>n?n(e.id):e.usage.total.cost.brl)),runCount:s.length}})}function op(e,t){let n=t===`pt-BR`;return[{key:`empty`,label:n?`Sem tarefas`:`Without tasks`,color:ep.empty,count:e.filter(e=>e.task_count===0&&e.rework_run_count===0).length},{key:`structured`,label:n?`Com tarefas`:`With tasks`,color:ep.structured,count:e.filter(e=>e.task_count>0&&e.rework_run_count===0).length},{key:`rework`,label:n?`Com retrabalho`:`With rework`,color:ep.rework,count:e.filter(e=>e.rework_run_count>0).length}]}function sp(e,t){let n=e.filter(e=>e.durationMs!==null),r=t.filter(e=>e.durationMs!==null),i=n.length===0?null:n.reduce((e,t)=>e+(t.durationMs??0),0),a=r.length===0?null:r.reduce((e,t)=>e+(t.durationMs??0),0);return{durationMs:i,durationShare:i===null||a===null||a===0?0:i/a,runCount:e.reduce((e,t)=>e+t.runCount,0),tokens:lf(e.map(e=>e.tokens)),costBrl:lf(e.map(e=>e.costBrl))}}function cp(e,t=5){return e.toSorted((e,t)=>{let n=Number(t.durationMs!==null)-Number(e.durationMs!==null);if(n!==0)return n;let r=(t.durationMs??0)-(e.durationMs??0);if(r!==0)return r;let i=t.runCount-e.runCount;return i===0?e.id.localeCompare(t.id):i}).slice(0,Math.max(0,t))}function lp(e,t,n){return e===`specs`?t?.selected_counts?.specs??n:e===`prds`?t?.selected_counts?.prds??n:t?.task_count??n}function up(e){return{durationMs:tp(e.map(e=>e.durationMs)),tokens:tp(e.map(e=>e.tokens)),costBrl:tp(e.map(e=>e.costBrl))}}function dp(e,t,n){return e===`tasks`?n:t??null}function fp(e,t,n){return e?t??null:n}function pp({currency:e,factualSnapshotFact:t,factualSnapshotTotal:n,macroCostTotal:r,overviewView:i,resolvedRunTotal:a,operationsBrlTotal:o}){return i!==void 0&&i!==`tasks`?r??null:t===void 0?n===void 0?a===null?e===`BRL`?o:null:a:n:t.state===`unavailable`?null:t.knownSum}function mp(e,t){return t===`pt-BR`?`Custo Estimado`:`Estimated cost`}function hp(e,t,n){if(e?.state!==`partial`)return null;let{known:r,total:i}=e.coverage;return n===`pt-BR`?`${r} de ${i} runs com custo conhecido. Taxas estimadas: subtotal conhecido dividido pelas ${t}s e horas registradas do recorte; cobertura parcial, sem estimar custos ausentes.`:`${r} of ${i} runs have known cost. Estimated rates: known subtotal divided by the selected ${t}s and recorded hours; partial coverage, missing costs are not estimated.`}function gp(e,t,n){let r=n===`pt-BR`?`Custo médio`:`Average cost`;return e?.state===`partial`?`${r} — ${n===`pt-BR`?`cobertura parcial`:`partial coverage`} (${e.coverage.known}/${e.coverage.total} runs)`:r}function _p(e,t){return e?.state===`unavailable`?null:t}function vp(e,t,n,r,i,a,o){let s=t=>e?.state===`unavailable`||t===null||!Number.isFinite(t)?`—`:Wf(t,r,n);return`${s(a)} / ${t} (${s(o)} / ${n===`pt-BR`?`hora`:`hour`})`}function yp(e){return e.summary.overview_metrics}function bp(e,t,n,r){if(e===`tasks`){let e=new Set(t.map(e=>e.id));return r.filter(t=>t.task_id!==null&&e.has(t.task_id))}let i=new Set(n.map(e=>e.id)),a=new Set(n.flatMap(e=>e.run_ids));return r.filter(t=>a.has(t.id)||(e===`specs`?t.spec_id!==null&&i.has(t.spec_id):t.prd_id!==null&&i.has(t.prd_id)))}function xp({label:e,value:t,hint:n,description:r,featured:i=!1,onSelect:a}){let o=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{title:r,children:e}),(0,l.jsx)(`strong`,{children:t}),(0,l.jsx)(`small`,{children:n})]});return a===void 0?(0,l.jsx)(`article`,{"aria-description":r,"aria-label":`${e}: ${t}. ${n}`,className:`operations-kpi${i?` is-featured`:``}`,children:o}):(0,l.jsx)(`button`,{"aria-description":r,"aria-pressed":i,"aria-label":`${e}: ${t}. ${n}`,className:`operations-kpi is-selectable${i?` is-featured`:``}`,onClick:a,type:`button`,children:o})}function Sp(e){let t=e===`pt-BR`;return{overview:t?`Visão geral`:`Overview`,tasks:t?`Tarefas`:`Tasks`,completedTasks:t?`concluídas`:`completed`,completedSpecs:t?`concluídas`:`completed`,completedPrds:t?`concluídos`:`completed`,totalExecutionTime:t?`Tempo total de execução`:`Total execution time`,totalRuns:t?`runs totais`:`total runs`,cost:t?`Custo`:`Cost`,showTerminal:t?`Mostrar canceladas, bloqueadas e falhadas`:`Show cancelled, blocked, and failed`,hideTerminal:t?`Esconder canceladas, bloqueadas e falhadas`:`Hide cancelled, blocked, and failed`,statusHint:t?`Distribuição atual do fluxo`:`Current workflow distribution`,averageTime:t?`Tempo médio`:`Average time`,averageTokens:t?`Tokens médios`:`Average tokens`,averageCost:t?`Custo médio`:`Average cost`,topHint:t?`Maiores durações acumuladas`:`Longest accumulated durations`,accumulatedTime:t?`Tempo acumulado`:`Accumulated time`,associatedRuns:t?`runs associadas`:`associated runs`,concentration:t?`Concentração`:`Concentration`,totalMeasuredTime:t?`do tempo total medido`:`of total measured time`,topFiveCost:t?`Custo do Top 5`:`Top 5 cost`,tokensUnavailable:t?`Tokens indisponíveis`:`Tokens unavailable`}}function Cp(e){let t=new Set;for(let n of e){if(n.started_at===void 0)continue;let e=new Date(n.started_at);Number.isNaN(e.getTime())||t.add(`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`)}return t.size}function wp(e,t,n,r){if(t<=0)return`0`;if(e<=0)return r===`pt-BR`?`Sem tempo medido para calcular médias`:`No measured time for averages`;let i=Cu(e/t,r);if(n<=0)return`${i} / item`;let a=wu(e/n),o=r===`pt-BR`?`${n} dias`:`${n} ${n===1?`day`:`days`}`;return r===`pt-BR`?`${i} / tarefa (${a} / dia) (${o})`:`${i} / task (${a} / day) (${o})`}function Tp(e,t){let n=t===`pt-BR`;if(e===`tasks`)return{statusTitle:n?`Status das tarefas`:`Task status`,classificationTitle:n?`Classificação de Tarefa`:`Task classification`,classificationHint:n?`Mix por criticidade`:`Criticality mix`,averageTitle:n?`Média por tarefa`:`Average per task`,averageHint:n?`Runs agregadas`:`Runs aggregated per task`,latestLabel:n?`Última tarefa criada`:`Latest task created`,topTitle:n?`Top 5 tarefas`:`Top 5 tasks`,shortPlural:`tasks`,emptyTop:n?`Nenhuma tarefa com duração registrada.`:`No task has a recorded duration.`};let r=e===`specs`,i=r?`SPEC`:`PRD`,a=r?`SPECs`:`PRDs`;return{statusTitle:n?`Status das ${a}`:`${i} status`,classificationTitle:n?`Classificação de ${i}`:`${i} classification`,classificationHint:n?`Estrutura da entrega`:`Delivery structure`,averageTitle:n?`Média por ${i}`:`Average per ${i}`,averageHint:n?`Runs agregadas por ${i}`:`Runs aggregated per ${i}`,latestLabel:n?`Última ${i} criada`:`Latest ${i} created`,topTitle:`Top 5 ${a}`,shortPlural:a,emptyTop:n?`Nenhuma ${i} com duração registrada.`:`No ${i} has a recorded duration.`}}function Ep({title:e,hint:t,action:n}){return(0,l.jsxs)(`header`,{className:`operations-panel-header`,children:[(0,l.jsxs)(`div`,{className:`operations-panel-header-title`,children:[(0,l.jsx)(`h2`,{children:e}),n]}),(0,l.jsx)(`small`,{children:t})]})}function Dp(e,t){return Hu.map(n=>({key:n,label:Yu(n,t),color:Qf[n],count:e.filter(e=>Uu(e)===n).length}))}function Op(e,t,n){return Hu.map(r=>({key:r,label:Yu(r,n),color:Qf[r],count:e.filter(e=>Wu(e,t)===r).length}))}function kp(e,t){let n=0,r=e.map(e=>{let r=n+e.count/t*100,i=`${e.color} ${n}% ${r}%`;return n=r,i});return n===0?`rgba(36, 52, 72, 0.86)`:`conic-gradient(${r.join(`, `)})`}function Ap({costLoading:e=!1,locale:t,copy:n,text:r,statusStats:i,statusTotal:a,classificationStats:o,selectedCount:s,metricStats:c,latestCreatedAt:u,onStatusSelect:d,onClassificationSelect:f}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`article`,{className:`operations-panel operations-panel-wide`,children:[` `,(0,l.jsx)(Ep,{hint:r.statusHint,title:n.statusTitle}),` `,(0,l.jsxs)(`div`,{"aria-hidden":`true`,className:`operations-stacked-bar`,children:[` `,i.map(e=>(0,l.jsx)(`i`,{style:{background:e.color,flexGrow:e.count,display:e.count===0?`none`:void 0}},e.key)),` `]}),` `,(0,l.jsxs)(`div`,{className:`operations-legend-grid`,children:[` `,i.map(e=>{let n=(0,l.jsxs)(l.Fragment,{children:[` `,(0,l.jsx)(`i`,{style:{background:e.color}}),(0,l.jsx)(`span`,{children:e.label}),` `,(0,l.jsxs)(`span`,{className:`operations-legend-value`,children:[` `,(0,l.jsx)(`strong`,{children:e.count}),` `,(0,l.jsxs)(`small`,{children:[` `,j(a===0?0:e.count/a,t),` `]}),` `]}),` `]});return e.key===`unclassified`?(0,l.jsxs)(`div`,{className:`operations-legend-row`,children:[` `,n,` `]},e.key):(0,l.jsxs)(`button`,{"aria-label":`${e.label}: ${e.count}, ${j(a===0?0:e.count/a,t)}`,className:`operations-legend-row operations-status-filter`,onClick:()=>d(e.key),type:`button`,children:[` `,n,` `]},e.key)}),` `]})]}),(0,l.jsxs)(`article`,{className:`operations-panel operations-panel-risk`,children:[` `,(0,l.jsx)(Ep,{hint:n.classificationHint,title:n.classificationTitle}),` `,(0,l.jsxs)(`div`,{className:`operations-donut-wrap`,children:[` `,(0,l.jsx)(`div`,{"aria-hidden":`true`,className:`operations-donut`,style:{background:kp(o,Math.max(s??0,1))}}),` `,(0,l.jsxs)(`div`,{children:[` `,(0,l.jsx)(`strong`,{children:s??`—`}),` `,(0,l.jsx)(`span`,{children:n.shortPlural}),` `]}),` `]}),` `,(0,l.jsxs)(`div`,{className:`operations-legend-grid`,children:[` `,o.map(e=>{let n=(0,l.jsxs)(l.Fragment,{children:[` `,(0,l.jsx)(`i`,{style:{background:e.color}}),` `,(0,l.jsx)(`span`,{children:e.label}),` `,(0,l.jsxs)(`span`,{className:`operations-legend-value`,children:[` `,(0,l.jsx)(`strong`,{children:e.count}),` `,(0,l.jsxs)(`small`,{children:[` `,j(s===null||s===0?0:e.count/s,t),` `]}),` `]}),` `]});return e.key===`unclassified`?(0,l.jsxs)(`div`,{className:`operations-legend-row`,children:[` `,n,` `]},e.key):(0,l.jsxs)(`button`,{"aria-label":`${e.label}: ${e.count}, ${j(s===null||s===0?0:e.count/s,t)}`,className:`operations-legend-row operations-status-filter`,onClick:()=>f(e.key),type:`button`,children:[` `,n,` `]},e.key)}),` `]}),` `]}),(0,l.jsxs)(`article`,{className:`operations-panel operations-panel-type${t===`en-US`?` is-en-us`:``}`,children:[` `,(0,l.jsx)(Ep,{hint:n.averageHint,title:n.averageTitle}),` `,(0,l.jsxs)(`div`,{className:`operations-type-summary`,children:[` `,c.map(([t,n],r)=>(0,l.jsxs)(`div`,{"aria-busy":e&&r===2||void 0,children:[(0,l.jsx)(`span`,{children:t}),` `,(0,l.jsx)(`strong`,{children:e&&r===2?(0,l.jsx)(`i`,{className:`operations-skeleton-line`,"aria-hidden":`true`}):n}),` `]},t)),` `]}),` `,(0,l.jsxs)(`footer`,{className:`operations-latest-task-created`,children:[` `,(0,l.jsx)(`span`,{children:n.latestLabel}),` `,(0,l.jsxs)(`strong`,{children:[` `,u===null?`—`:A(u,t),` `]}),` `]}),` `]})]})}var jp=(e,t)=>e===null?`0`:T(e,t);function Mp({costLoading:e=!1,copy:t,currency:n,locale:r,maxDuration:i,onOpenMacro:a,onOpenTask:o,summary:s,text:c,topCost:u,topEntities:d,view:f}){let p=f===`specs`?`SPEC`:`PRD`;return(0,l.jsxs)(`article`,{className:`operations-panel`,children:[(0,l.jsxs)(`header`,{className:`operations-panel-header`,children:[(0,l.jsx)(`div`,{className:`operations-panel-header-title`,children:(0,l.jsx)(`h2`,{children:t.title})}),(0,l.jsx)(`small`,{children:t.hint})]}),d.length===0?(0,l.jsx)(`p`,{className:`operations-empty`,children:t.empty}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`operations-run-bars`,children:d.map((e,t)=>{let n=jp(e.durationMs,r);return(0,l.jsxs)(`button`,{"aria-label":f===`tasks`?`${r===`pt-BR`?`Abrir detalhes da tarefa`:`Open task details for`} ${e.title}: ${n}`:`${r===`pt-BR`?`Abrir detalhes da`:`Open details for`} ${p} ${e.title}: ${n}`,className:`operations-run-bar${e.durationMs===null?` is-duration-unavailable`:``}`,onClick:()=>{f===`tasks`?o(e.id):a(f===`specs`?`spec`:`prd`,e.id)},title:`${e.title}: ${n}`,type:`button`,children:[(0,l.jsx)(`strong`,{children:n}),(0,l.jsx)(`i`,{style:{height:e.durationMs===null?`0%`:`${Math.max(8,e.durationMs/i*100)}%`}}),(0,l.jsx)(`span`,{children:`#${t+1} ${e.id.slice(-4)}`})]},e.id)})}),(0,l.jsxs)(`div`,{className:`operations-top-task-metrics`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:c.accumulatedTime}),(0,l.jsx)(`strong`,{children:jp(s.durationMs,r)}),(0,l.jsx)(`small`,{children:`${s.runCount} ${c.associatedRuns}`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:c.concentration}),(0,l.jsx)(`strong`,{children:j(s.durationShare,r)}),(0,l.jsx)(`small`,{children:c.totalMeasuredTime})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:c.topFiveCost}),(0,l.jsx)(`strong`,{"aria-busy":e||void 0,children:e?(0,l.jsx)(`i`,{className:`operations-skeleton-line`,"aria-hidden":`true`}):u===null?jp(null,r):k(u,n,r)}),(0,l.jsx)(`small`,{children:`${D(s.tokens,r)} tokens`})]})]})]})]})}function Np({fact:e,unit:t,locale:n,currency:r,count:i,perItem:a,perHour:o,total:s,label:c,loading:u=!1}){return u?(0,l.jsxs)(`article`,{"aria-busy":`true`,"aria-label":n===`pt-BR`?`Carregando custo estimado`:`Loading estimated cost`,className:`operations-kpi`,role:`status`,children:[(0,l.jsx)(`span`,{children:c??(n===`pt-BR`?`Custo Estimado`:`Estimated Cost`)}),(0,l.jsx)(`strong`,{children:(0,l.jsx)(`i`,{className:`operations-skeleton-line is-value`,"aria-hidden":`true`})}),(0,l.jsx)(`small`,{children:(0,l.jsx)(`i`,{className:`operations-skeleton-line`,"aria-hidden":`true`})})]}):(0,l.jsx)(xp,{hint:vp(e,t,n,r,i,a,o),description:qf(s,i,n)??hp(e,t,n)??void 0,label:c??mp(e,n),value:Kf(s,i,e=>Wf(e,r,n),n,!0)})}function Pp(e,t,n){return e===`tasks`?n:e===`specs`?t===`pt-BR`?`Tempo observado por SPEC.`:`Observed time per SPEC.`:t===`pt-BR`?`Tempo de ciclo de vida (Runs-raiz, todas as fases).`:`Lifecycle time (root Runs, all phases).`}function Fp({currency:e,data:t,datePreset:n,locale:r,onDatePresetChange:i,onOpenTask:a,onOpenDocument:s,onOpenMacro:c,onLoadStatus:u,statusPage:d,onLoadStatusPage:f,classificationPage:p,onLoadClassificationPage:m,onLoadMacroMetrics:h,prds:g=t.prds,runs:_=t.runs,specs:v=t.specs,tasks:y=t.tasks,factualCostTotal:b,factualCostFact:x,costLoading:S=!1,resolveRunCost:C,includeLegacyEffort:w=!1}){let[E,O]=(0,o.useState)(`tasks`),[A,ee]=(0,o.useState)(null),[M,te]=(0,o.useState)(null),ne=y.filter(e=>e.status===`completed`).length,re=v.filter(e=>e.work_status===`completed`).length,N=g.filter(e=>e.work_status===`completed`).length,ie=Tp(E,r),ae=Sp(r),oe=E===`specs`?v:g,P=yp(t),F=E===`tasks`?void 0:P?.macro_metrics?.[E],se=lp(E,P,E===`tasks`?y.length:oe.length),ce=bp(E,y,oe,_),le=E===`tasks`?ip(y,ce,C):ap(oe,ce,C),ue=P?.task_status_counts,de=ue?[...Hu.map(e=>({key:e,label:Yu(e,r),color:Qf[e],count:e===`definition`?(ue.draft??0)+(ue.definition??0):e===`ready`?(ue.planned??0)+(ue.ready??0):ue[e]??0})),...ue.unclassified?[{key:`unclassified`,label:r===`pt-BR`?`Não classificado`:`Unclassified`,color:`var(--color-neutral-500)`,count:ue.unclassified}]:[]]:Dp(y,r),fe=F?Hu.map(e=>({key:e,label:Yu(e,r),color:Qf[e],count:F.status_counts[e]??0})):Op(oe,y,r),I=E===`tasks`?de:fe,pe=I.reduce((e,t)=>e+t.count,0),L=P?.task_risk_counts,me=[...Object.entries($f).map(([e,t])=>({key:e,label:Nu(e,r),color:t,count:L?L[e]??0:y.filter(t=>t.risk===e).length})),...L?.unclassified??y.filter(e=>e.risk===null).length?[{key:`unclassified`,label:r===`pt-BR`?`Não classificado`:`Unclassified`,color:`var(--color-neutral-500)`,count:L?.unclassified??y.filter(e=>e.risk===null).length}]:[]],he=E===`tasks`?me:F?op([],r).map(e=>({...e,count:F.classification_counts[e.key]??0})):op(oe,r),ge=uf(_),_e=ff(_),ve=P?.partial===!0,R=P?.task_count??y.length,ye=P?.spec_count??v.length,z=P?.prd_count??g.length,be=P?.completed_task_count??ne,B=P?.completed_spec_count??re,xe=P?.completed_prd_count??N,Se=R===null||R===0?0:be/R,Ce=ye===null||ye===0?0:B/ye,we=z===null||z===0?0:xe/z,Te=ge.runs,Ee=up(le),De=E===`tasks`?r===`pt-BR`?`tarefa`:`task`:ie.shortPlural,Oe=E===`tasks`?null:{durationMs:fp(F!==void 0,F?.total_duration_ms,Ee.durationMs),tokens:fp(F!==void 0,F?.total_tokens,Ee.tokens),costBrl:fp(F!==void 0,F?.total_cost_brl,Ee.costBrl)},ke=dp(E,Oe?.durationMs,P?.duration_ms??ge.durationMs),Ae=E===`tasks`?P?.execution_day_count??Cp(Te):0,je=dp(E,Oe?.tokens,P?.tokens??_e.tokens),V=E===`tasks`?R:se,Me=C===void 0?null:_e.runs.reduce((e,t)=>{let n=C(t.id);return n===null?e:(e??0)+n},null),Ne=E===`tasks`?void 0:e===`USD`?F?.total_cost_usd:F?.total_cost_brl,Pe=E===`tasks`||e===`USD`?null:tp(le.map(e=>e.costBrl)),H=pp({currency:e,factualSnapshotFact:E===`tasks`?x:void 0,factualSnapshotTotal:b,macroCostTotal:fp(F!==void 0,Ne,Pe),overviewView:E,resolvedRunTotal:Me,operationsBrlTotal:P?.cost_brl??_e.costBrl}),Fe=_p(E===`tasks`?x:void 0,H),Ie=ke===null||ke<=0||Fe===null?null:Fe*36e5/ke,Le=Fe===null||V===null||V===0?null:Fe/V,Re=je===null||V===null||V===0?null:je/V,ze=ke===null||ke<=0||je===null?null:je*36e5/ke,U=np(E===`tasks`?{durationMs:ke,tokens:je,costBrl:Fe}:{durationMs:fp(F!==void 0,F?.total_duration_ms,Ee.durationMs),tokens:fp(F!==void 0,F?.total_tokens,Ee.tokens),costBrl:fp(F!==void 0,Ne,e===`BRL`?Pe:Ee.costBrl)},se),Be=fp(F!==void 0,F?.average_duration_ms,U.durationMs),Ve=fp(F!==void 0,F?.average_tokens,U.tokens),He=E===`tasks`?U.costBrl:fp(F!==void 0,e===`USD`?F?.average_cost_usd:F?.average_cost_brl,U.costBrl),Ue=E===`tasks`?y.length===0?P?.latest_task_created_at??null:rp(y):F?.latest_created_at??rp(oe),We=Yf({averageCost:He,averageDuration:Be,averageTokens:Ve,costLabel:gp(E===`tasks`?x:void 0,se,r),count:se,formatCost:t=>k(t,e,r),formatDuration:e=>T(e,r),formatTokens:e=>D(e,r),locale:r,timeLabel:ae.averageTime,tokensLabel:ae.averageTokens}),Ge=(P?.top_tasks??[]).map(t=>({id:t.task_id,title:y.find(e=>e.id===t.task_id)?.title??t.task_id,durationMs:t.duration_ms,durationProvenance:t.duration_ms===null?`unavailable`:`observed`,tokens:t.total_tokens,costBrl:e===`USD`?t.total_cost_usd??null:t.cost_brl,runCount:t.run_count})),Ke=(F?.top_entities??[]).map(t=>({id:t.entity_id,title:t.title,durationMs:t.duration_ms,durationProvenance:t.duration_ms===null?`unavailable`:`observed`,tokens:t.total_tokens,costBrl:e===`USD`?t.total_cost_usd??null:t.cost_brl,runCount:t.run_count})),W=E===`tasks`&&_.length===0&&Ge.length>0?Ge:E!==`tasks`&&Ke.length>0?Ke:cp(le),qe=Math.max(1,...W.filter(e=>e.durationMs!==null).map(e=>e.durationMs??0)),Je=E===`tasks`&&_.length===0&&Ge.length>0?{...sp(W,W),durationShare:ke===null||ke===0?0:W.reduce((e,t)=>e+(t.durationMs??0),0)/ke}:E!==`tasks`&&Ke.length>0?{...sp(W,W),durationShare:F?.total_duration_ms===null||F?.total_duration_ms===void 0||F.total_duration_ms===0?0:W.reduce((e,t)=>e+(t.durationMs??0),0)/F.total_duration_ms}:sp(W,le),Ye=E===`tasks`&&_.length===0&&Ge.length>0||E!==`tasks`&&Ke.length>0,Xe=e===`USD`&&!Ye&&(_.length===0||C===void 0)?null:Je.costBrl,Ze=Pp(E,r,ae.topHint),Qe=e=>{O(e),ee(null),te(null),e!==`tasks`&&h?.()};return(0,l.jsxs)(`section`,{"aria-label":ae.overview,className:`operations-overview`,children:[` `,(0,l.jsxs)(`div`,{className:`operations-overview-controls`,children:[` `,(0,l.jsxs)(`label`,{className:`operations-overview-period`,children:[` `,(0,l.jsx)(`span`,{children:r===`pt-BR`?`Período`:`Period`}),` `,(0,l.jsxs)(`select`,{"aria-label":r===`pt-BR`?`Período`:`Period`,onChange:e=>i(e.target.value),value:n,children:[` `,(0,l.jsx)(`option`,{value:`today`,children:r===`pt-BR`?`Hoje`:`Today`}),(0,l.jsx)(`option`,{value:`yesterday`,children:r===`pt-BR`?`Ontem`:`Yesterday`}),` `,(0,l.jsx)(`option`,{value:`this-week`,children:r===`pt-BR`?`Esta Semana`:`This Week`}),` `,(0,l.jsx)(`option`,{value:`last-week`,children:r===`pt-BR`?`Semana Passada`:`Last Week`}),(0,l.jsx)(`option`,{value:`this-month`,children:r===`pt-BR`?`Este Mês`:`This Month`}),` `,(0,l.jsx)(`option`,{value:`last-month`,children:r===`pt-BR`?`Mês Passado`:`Last Month`}),` `,(0,l.jsxs)(`option`,{value:`last-3-months`,children:[` `,r===`pt-BR`?`Últimos 3 meses`:`Last 3 months`]}),` `,(0,l.jsxs)(`option`,{value:`last-6-months`,children:[` `,r===`pt-BR`?`Últimos 6 meses`:`Last 6 months`,` `]}),` `,(0,l.jsx)(`option`,{value:`this-year`,children:r===`pt-BR`?`Este Ano`:`This Year`}),(0,l.jsx)(`option`,{value:`last-year`,children:r===`pt-BR`?`Último ano`:`Last year`}),` `,(0,l.jsx)(`option`,{value:`all`,children:r===`pt-BR`?`Todo o Período`:`All Time`}),` `,(0,l.jsxs)(`option`,{disabled:!0,value:`custom`,children:[` `,r===`pt-BR`?`Personalizado`:`Custom`,` `]}),` `]})]}),` `]}),` `,(0,l.jsxs)(`div`,{className:`operations-kpi-grid`,children:[` `,(0,l.jsx)(xp,{featured:E===`tasks`,hint:ve&&be===null?r===`pt-BR`?`Resumo detalhado carregando…`:`Detailed summary loading…`:`${be} ${ae.completedTasks} (${j(Se,r)})`,label:ae.tasks,onSelect:()=>Qe(`tasks`),value:R===null?`—`:String(R)}),` `,(0,l.jsx)(xp,{featured:E===`specs`,hint:ve&&B===null?r===`pt-BR`?`Resumo detalhado carregando…`:`Detailed summary loading…`:`${B} ${ae.completedSpecs} (${j(Ce,r)})`,label:`SPECs`,onSelect:()=>Qe(`specs`),value:ye===null?`—`:String(ye)}),` `,(0,l.jsx)(xp,{featured:E===`prds`,hint:ve&&xe===null?r===`pt-BR`?`Resumo detalhado carregando…`:`Detailed summary loading…`:`${xe} ${ae.completedPrds} (${j(we,r)})`,label:`PRDs`,onSelect:()=>Qe(`prds`),value:z===null?`—`:String(z)}),` `,(0,l.jsx)(xp,{hint:wp(ke??0,V??0,Ae,r),label:E===`tasks`?ae.totalExecutionTime:r===`pt-BR`?`${ae.totalExecutionTime} de ${ie.shortPlural}`:`${ie.shortPlural} ${ae.totalExecutionTime.toLowerCase()}`,value:Kf(ke,V,e=>T(e,r),r,!0),description:qf(ke,V,r)}),` `,(0,l.jsx)(xp,{hint:Re===null||ze===null?V===0?r===`pt-BR`?`0 / ${De} (0 / hora)`:`0 / ${De} (0 / hour)`:r===`pt-BR`?`Sem tokens medidos para calcular médias`:`No measured tokens for averages`:r===`pt-BR`?`${D(Re,r)} / ${De} (${D(ze,r,0)} / hora)`:`${D(Re,r)} / ${De} (${D(ze,r,0)} / hour)`,label:E===`tasks`?r===`pt-BR`?`Tokens gastos`:`Spent tokens`:r===`pt-BR`?`Tokens gastos por ${ie.shortPlural}`:`${ie.shortPlural} tokens spent`,value:Kf(je,V,e=>D(e,r),r,!0),description:qf(je,V,r)}),` `,(0,l.jsx)(Np,{loading:S&&E===`tasks`,fact:E===`tasks`?x:void 0,unit:De,locale:r,currency:e,count:V,perItem:Le,perHour:Ie,total:H,label:E===`tasks`?void 0:r===`pt-BR`?`Custo de ${ie.shortPlural}`:`${ie.shortPlural} cost`}),` `]}),(0,l.jsxs)(`div`,{className:`operations-chart-grid`,children:[` `,(0,l.jsx)(Ap,{costLoading:S&&E===`tasks`,locale:r,copy:ie,text:ae,statusStats:I,statusTotal:pe,classificationStats:he,selectedCount:se,metricStats:We,latestCreatedAt:Ue,onStatusSelect:e=>{ee(e),u?.(e,E===`tasks`?`task`:E===`specs`?`spec`:`prd`,0)},onClassificationSelect:e=>{te(e),m?.(E===`tasks`?`task`:E===`specs`?`spec`:`prd`,e,0)}}),(0,l.jsx)(Mp,{costLoading:S&&E===`tasks`,copy:{empty:ie.emptyTop,hint:Ze,title:ie.topTitle},currency:e,locale:r,maxDuration:qe,onOpenMacro:c,onOpenTask:a,summary:Je,text:ae,topCost:Xe,topEntities:W,view:E}),` `]}),` `,A===null?null:(0,l.jsx)(Xf,{eyebrow:r===`pt-BR`?E===`tasks`?`Status das tarefas`:E===`specs`?`Status das SPECs`:`Status dos PRDs`:`${ie.shortPlural} status`,label:Yu(A,r),locale:r,onClose:()=>ee(null),onOpenTask:e=>{ee(null),a(e)},onOpenDocument:(e,t)=>{ee(null),s(e,t)},items:d?.(A,E===`tasks`?`task`:E===`specs`?`spec`:`prd`)?.items??[],kind:E===`tasks`?`task`:E===`specs`?`spec`:`prd`,onLoadMore:e=>f?.(A,E===`tasks`?`task`:E===`specs`?`spec`:`prd`,e),page:d?.(A,E===`tasks`?`task`:E===`specs`?`spec`:`prd`)}),` `,M===null?null:(0,l.jsx)(Xf,{eyebrow:r===`pt-BR`?ie.classificationTitle:`Classification`,label:E===`tasks`?Nu(M,r):he.find(e=>e.key===M)?.label??M,locale:r,onClose:()=>te(null),onOpenTask:e=>{te(null),a(e)},onOpenDocument:(e,t)=>{te(null),s(e,t)},items:p?.(E===`tasks`?`task`:E===`specs`?`spec`:`prd`,M)?.items??[],kind:E===`tasks`?`task`:E===`specs`?`spec`:`prd`,onLoadMore:e=>m?.(E===`tasks`?`task`:E===`specs`?`spec`:`prd`,M,e),page:p?.(E===`tasks`?`task`:E===`specs`?`spec`:`prd`,M)}),` `]})}function Ip({capabilityNavigation:e,currency:t,data:n,datePreset:r,dateRange:i,defaultDateRange:a,factualCostTotal:o,factualCostFact:s,costLoading:c,includeLegacyEffort:u,locale:d,onOpenTask:f,onOpenDocument:p,onOpenMacro:m,onLoadStatus:h,statusPage:g,onLoadStatusPage:_,classificationPage:v,onLoadClassificationPage:y,onLoadMacroMetrics:b,prds:x,query:S,resolveRunCost:C,runs:w,searchInputRef:T,setQuery:E,showFilterLoading:D,specs:O,tasks:k,updatePeriod:A}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Fp,{data:n,currency:t,factualCostTotal:o,factualCostFact:s,costLoading:c,datePreset:r,dateRange:i,locale:d,onDatePresetChange:e=>{D(),A(e,e===`all`?a:e===`custom`?i:dd(e))},onOpenTask:f,onOpenDocument:p,onOpenMacro:m,onLoadStatus:h,statusPage:g,onLoadStatusPage:_,classificationPage:v,onLoadClassificationPage:y,onLoadMacroMetrics:b,prds:x,runs:w,resolveRunCost:C,includeLegacyEffort:u,specs:O,tasks:k}),(0,l.jsxs)(`section`,{className:`dashboard-global-controls`,children:[e,(0,l.jsxs)(`div`,{className:`operations-toolbar-filters dashboard-global-filters`,children:[(0,l.jsxs)(`label`,{className:`operations-toolbar-field operations-search-field`,children:[(0,l.jsx)(`span`,{children:d===`pt-BR`?`Busca`:`Search`}),(0,l.jsxs)(`div`,{className:`operations-search-control`,children:[(0,l.jsx)(`input`,{"aria-label":d===`pt-BR`?`Busca`:`Search`,onChange:e=>{E(e.target.value)},placeholder:d===`pt-BR`?`Buscar por nome ou ID`:`Search by name or ID`,ref:T,value:S}),S?(0,l.jsx)(`button`,{"aria-label":d===`pt-BR`?`Limpar busca`:`Clear search`,className:`operations-search-clear`,onMouseDown:e=>e.preventDefault(),onClick:()=>{T.current?.focus(),E(``)},type:`button`,children:(0,l.jsx)(Md,{})}):null]})]}),(0,l.jsx)(Td,{dateRange:i,defaultDateRange:a,locale:d,onDateRangeChange:e=>{D(),A(`custom`,e)},onPresetChange:(e,t)=>{D(),A(e,t)},preset:r})]})]})]})}function Lp({locale:e}){return(0,l.jsxs)(`section`,{"aria-busy":`true`,"aria-label":e===`pt-BR`?`Carregando o período selecionado`:`Loading selected period`,className:`operations-content-skeleton`,role:`status`,children:[(0,l.jsx)(`div`,{className:`operations-skeleton-kpis`,"aria-hidden":`true`,children:[`tasks`,`specs`,`prds`,`duration`,`tokens`,`cost`].map(e=>(0,l.jsxs)(`article`,{className:`operations-skeleton-block`,children:[(0,l.jsx)(`i`,{className:`operations-skeleton-line is-short`}),(0,l.jsx)(`i`,{className:`operations-skeleton-line is-value`}),(0,l.jsx)(`i`,{className:`operations-skeleton-line`})]},e))}),(0,l.jsx)(`div`,{className:`operations-skeleton-panels`,"aria-hidden":`true`,children:[`status`,`classification`,`average`,`top`].map(e=>(0,l.jsxs)(`article`,{className:`operations-skeleton-block`,children:[(0,l.jsx)(`i`,{className:`operations-skeleton-line is-short`}),(0,l.jsx)(`i`,{className:`operations-skeleton-chart`})]},e))})]})}function Rp(e){return!e}function zp(e){return e===`work-list`?`all`:null}function Bp(e){let t=e.datePreset!==void 0&&e.dateRange!==void 0,n=e.datePreset??e.fallbackPreset;return{controlled:t,datePreset:n,dateRange:n===`all`&&e.allTimeRange!==void 0?e.allTimeRange:e.dateRange??e.fallbackRange}}function Vp(){let[e,t]=(0,o.useState)(!1),n=(0,o.useRef)(null),r=(0,o.useCallback)(()=>{t(!0),n.current!==null&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!1),220)},[]);return(0,o.useEffect)(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{filterLoading:e,showFilterLoading:r}}function Hp(e,t){return(0,o.useMemo)(()=>{let n=ud(e.tasks,Object.keys(e.summary.periods?.daily??{}));return cd(t?.day,n)},[e.summary.periods,e.tasks,t?.day])}function Up({loading:e,view:t,query:n,statusFilter:r,riskFilter:i,originFilter:a,onBoardFiltersChange:s,onWorkListFiltersChange:c,onEntityFiltersChange:l}){(0,o.useEffect)(()=>{if(e)return;if(t===`work-kanban`||t===`work-list`){let e=window.setTimeout(()=>{let e={query:n,status:r,risk:i,origin:a};t===`work-kanban`?s?.(e):c?.(e)},180);return()=>window.clearTimeout(e)}if(![`runs`,`conversations`,`executions`,`changes`,`decisions`].includes(t))return;let o=window.setTimeout(()=>{l?.(t,{query:n,status:r,risk:i})},180);return()=>window.clearTimeout(o)},[s,c,l,e,a,n,i,r,t])}function Wp(e,t,n){return e===`month`||e===`year`?Df(t,n):[...t]}function Gp({datePreset:e,matchesSelectedDate:t,prds:n,runs:r,specs:i,tasks:a}){let o=new Set(a.map(e=>e.id)),s=new Set([`completed`,`delivered`,`cancelled`,`failed`]),c=(n,i)=>e===`all`||!s.has(n.lifecycle_status)||t(n.updated_at??n.created_at)||n.task_ids.some(e=>o.has(e))||i===`spec`&&a.some(e=>e.spec_id===n.id)||r.some(e=>n.run_ids.includes(e.id)||(i===`spec`?e.spec_id===n.id:e.prd_id===n.id)),l=i.filter(e=>c(e,`spec`)),u=new Set(l.map(e=>e.id));return{specs:l,prds:n.filter(e=>c(e,`prd`)||i.some(t=>t.parent_id===e.id&&u.has(t.id)))}}function Kp(e,t){let n=e.trim().toLocaleLowerCase();return n.length===0||t.some(e=>e?.toLocaleLowerCase().includes(n))}function qp(e,t){return{prds:e.prds.filter(e=>t(e.created_at)),specs:e.specs.filter(e=>t(e.created_at)),tasks:e.tasks.filter(e=>t(e.created_at)),runs:e.runs.filter(e=>t(e.started_at)),...e.evidences===void 0?{}:{evidences:e.evidences.filter(e=>t(e.observed_at))},...e.validations===void 0?{}:{validations:e.validations.filter(e=>t(e.executed_at))}}}function Jp(e,t,n){return n.entityFilterActive?e.filter(e=>n.directRunMatch?.(e)===!0||e.task_id!==null&&t.taskIds.has(e.task_id)||e.spec_id!==null&&t.specIds.has(e.spec_id)||e.prd_id!==null&&t.prdIds.has(e.prd_id)):[...e]}function Yp({alternateContent:e,boardTotals:t,boardKindTotals:n,boardStates:r,boardExportSource:i,detailExportSource:a,capabilityNavigation:s,currency:c,data:u,dashboardTitle:f=`Dashboard ZAIP AIOS`,lastUpdatedAt:p=u.summary.latest_token_collected_at??null,loading:m,onLoadingChange:h,locale:g,onLocaleChange:_,onOpenDocument:v,onOpenMacro:y,onOpenTask:b,onPriorityChange:x,onLoadMacroMetrics:S,entityPage:C,onEntityPageChange:w,onEntityFiltersChange:T,onBoardFiltersChange:E,onWorkListFiltersChange:D,onBoardTypeChange:O,onWorkListTypeChange:k,onWorkListPageChange:A,workListPage:j,onLoadMoreBoard:ee,onLoadStatusPage:M,statusPage:te,classificationPage:ne,onLoadClassificationPage:re,datePreset:N,dateRange:ie,onDateChange:ae,onPeriodChange:oe,onRefresh:P,repositoryName:F,settings:se,factualCostTotal:ce,factualCostFact:le,costLoading:ue,factualCostPeriods:de,resolveRunCost:fe}){let[I,pe]=(0,o.useState)(`work-kanban`),[L,me]=(0,o.useState)(``),[he,ge]=(0,o.useState)(!1),[_e,ve]=(0,o.useState)(!1),[R,ye]=(0,o.useState)(``),[z,be]=(0,o.useState)(``),[B,xe]=(0,o.useState)(``),{filterLoading:Se,showFilterLoading:Ce}=Vp(),we=(0,o.useRef)(null),Te=Hp(u,de),Ee=(0,o.useMemo)(()=>dd(`this-month`),[]),[De,Oe]=(0,o.useState)(()=>Ee),[ke,Ae]=(0,o.useState)(`all`),je=Bp({datePreset:N,dateRange:ie,fallbackPreset:ke,fallbackRange:De,allTimeRange:Te}),V=je.controlled,Me=je.dateRange,Ne=je.datePreset,Pe=(0,o.useCallback)((e,t)=>{V||(Ae(e),Oe(t)),(ae??oe)?.(e,t)},[V,ae,oe]),H=typeof e==`function`?e({query:L,datePreset:Ne,...Ne===`all`?{}:{dateRange:Me}}):e,Fe=L===``&&R===``&&z===``&&B===``,Ie=()=>{Ce(),me(``),ye(``),be(``),xe(``),Pe(`all`,Ee)},Le=e=>{Ce();let t=zp(e);t!==null&&k?.(t),pe(e),ye(``),be(``),xe(``)};Up({loading:m,view:I,query:L,statusFilter:R,riskFilter:z,originFilter:B,onBoardFiltersChange:E,onWorkListFiltersChange:D,onEntityFiltersChange:T});let Re=(I===`work-kanban`||I===`work-list`)&&Hu.includes(R),ze=(0,o.useCallback)(e=>md(e,Ne,Me),[Ne,Me]),U=u.tasks.filter(e=>(!Re||Uu(e)===R)&&(!z||e.risk===z)&&Lu(e,B,u.changes)&&(Ne===`all`||fd(e.finished_at??e.updated_at,Me,e.updated_at))&&Kp(L,[e.id,e.title,e.short_name,e.objective,e.change_id,e.spec_id])),Be=u.changes.filter(e=>(!R||e.status===R)&&(!z||e.risk===z)&&ze(e.created_at)&&Kp(L,[e.id,e.title,e.source.type,e.artifact_path])),Ve=u.executions.filter(e=>(!R||e.status===R)&&ze(e.created_at)&&Kp(L,[e.id,e.status,e.work_status,e.origin.type,e.origin.type===`interaction`?e.origin.conversation_id:null,e.artifact_path])),He=u.runs.filter(e=>(!R||Re||e.status===R)&&hd(e,Ne,Me)),Ue=Gp({datePreset:Ne,matchesSelectedDate:ze,prds:u.prds,runs:He,specs:u.specs,tasks:U}),We=u.specs.filter(e=>(!Re||Wu(e,u.tasks)===R)&&!z&&!B&&Ue.specs.includes(e)&&Kp(L,[e.id,e.title,e.parent_id])),Ge=u.prds.filter(e=>(!Re||Wu(e,u.tasks)===R)&&!z&&!B&&Ue.prds.includes(e)&&Kp(L,[e.id,e.title,e.parent_id])),Ke=Jp(He,{taskIds:new Set(U.map(e=>e.id)),specIds:new Set(We.map(e=>e.id)),prdIds:new Set(Ge.map(e=>e.id))},{entityFilterActive:!!(L||Re||z||B),directRunMatch:e=>L.trim().length>0&&Kp(L,[e.id,e.task_id,e.spec_id,e.prd_id,e.change_id,e.execution_id,e.conversation_id,e.phase,e.agent,e.agent_name,e.model,e.effective_model])}),W=Ve.filter(e=>e.kind===`interaction`&&e.origin.type===`interaction`),qe=new Set(W.map(e=>e.origin.type===`interaction`?e.origin.conversation_id:``)),Je=Ke.filter(e=>e.entrypoint===`conversation`&&e.task_id===null&&e.conversation_id!==null&&qe.has(e.conversation_id)),Ye=u.decisions.filter(e=>ze(e.created_at)&&Kp(L,[e.id,e.title,e.scope_id,e.scope_type,e.artifact_path])),Xe=qp(u,ze),Ze=u.summary.periods?.daily,Qe=(0,o.useMemo)(()=>{if(I===`daily`||I===`monthly`||I===`yearly`){let e=I===`daily`?`day`:I===`monthly`?`month`:`year`;return Wp(e,Ef(Ze===void 0||c===`USD`?pf(Xe,e,fe,Fe,u.filters):mf(Object.fromEntries(Object.entries(Ze).filter(([e])=>ze(`${e}T12:00:00.000Z`))),e),c,de?.[e]),de?.[e]).map(e=>({key:e.key,prds:e.prds,specs:e.specs,tasks:e.tasksCreated,runs:e.runs,tests:e.tests,evidences:e.evidences,duration_hours:e.durationMs===null?null:e.durationMs/36e5,tokens:e.tokens,cost:e.costBrl}))}return I===`work-kanban`||I===`work-list`?[...Ge.map(({kind:e,...t})=>({kind:`prd`,...t})),...We.map(({kind:e,...t})=>({kind:`spec`,...t})),...U.map(e=>({kind:`task`,...e}))]:I===`changes`?Be:I===`decisions`?Ye:I===`executions`?Ve:I===`conversations`?Je:Ke},[Be,Je,Ye,Ve,de,Ge,fe,Ke,We,Xe,U,I,Fe,u.filters,Ze,ze,c]),$e=m||Se;return(0,o.useEffect)(()=>h?.($e),[$e,h]),(0,l.jsxs)(`main`,{className:`operations-page`,children:[(0,l.jsx)(d,{filters:(0,l.jsxs)(`div`,{className:`operations-global-filters`,"data-loading":$e||void 0,children:[(0,l.jsxs)(`div`,{className:`operations-filter-heading`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:g===`pt-BR`?`Filtrar dashboard`:`Filter dashboard`}),(0,l.jsx)(`small`,{children:g===`pt-BR`?`Os dados exibidos permanecem estáveis até uma atualização manual`:`Displayed data stays stable until a manual refresh`})]}),$e?(0,l.jsxs)(`span`,{className:`operations-filter-status`,role:`status`,children:[(0,l.jsx)(`i`,{}),` `,g===`pt-BR`?`Atualizando dados`:`Updating data`]}):null]}),H?null:(0,l.jsx)(Ed,{locale:g,query:L,status:R,risk:z,origin:B,onQuery:me,onStatus:ye,onRisk:be,onOrigin:xe}),(0,l.jsx)(Td,{ariaLabelSuffix:g===`pt-BR`?` nos filtros`:` in filters`,dateRange:Me,defaultDateRange:Te,locale:g,onDateRangeChange:e=>{Ce(),Pe(`custom`,e)},onPresetChange:(e,t)=>{Ce(),Pe(e,t)},preset:Ne}),(0,l.jsxs)(`button`,{className:`operations-clear-filters`,onClick:Ie,type:`button`,children:[(0,l.jsx)(jd,{}),g===`pt-BR`?`Limpar filtros`:`Clear filters`]})]}),filtersActive:!!(L||R||z||B||Me.start!==Te.start||Me.end!==Te.end),lastUpdatedAt:p,snapshotUpdatedAt:u.summary.projection_updated_at??null,loading:$e,locale:g,onLocaleChange:_,onRefresh:P,...F===void 0?{}:{repositoryName:F},settings:se,title:f}),(0,l.jsx)(`h1`,{className:`operations-sr-only`,children:`Operações`}),(0,l.jsxs)(`header`,{className:`operations-hero`,children:[(0,l.jsx)(`div`,{children:(0,l.jsx)(`small`,{className:`operations-last-updated`,children:p===null?g===`pt-BR`?`Aguardando atualização`:`Waiting for refresh`:`${g===`pt-BR`?`Atualizado`:`Updated`} ${new Intl.DateTimeFormat(g,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(p))}`})}),(0,l.jsxs)(`div`,{className:`operations-actions`,children:[(0,l.jsx)(`button`,{"aria-label":g===`pt-BR`?`Atualizar`:`Refresh`,className:`operations-nav-icon`,disabled:m,onClick:P,type:`button`,children:(0,l.jsx)(Od,{})}),(0,l.jsxs)(`div`,{className:`operations-nav-popup-anchor`,children:[(0,l.jsxs)(`button`,{className:`operations-nav-button${he?` is-active`:``}`,onClick:()=>{ge(e=>!e),ve(!1)},type:`button`,children:[(0,l.jsx)(kd,{}),` `,g===`pt-BR`?`Filtros`:`Filters`]}),he?(0,l.jsxs)(`div`,{className:`operations-nav-popup operations-filter-popup`,children:[(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:g===`pt-BR`?`Busca`:`Search`}),(0,l.jsx)(`input`,{onChange:e=>me(e.target.value),placeholder:g===`pt-BR`?`ID ou nome de ${Pd[g][I]}`:`${Pd[g][I]} ID or name`,value:L})]}),I===`work-kanban`||I===`work-list`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:`Status`}),(0,l.jsxs)(`select`,{onChange:e=>ye(e.target.value),value:R,children:[(0,l.jsx)(`option`,{value:``,children:g===`pt-BR`?`Todos`:`All`}),Hu.map(e=>(0,l.jsx)(`option`,{value:e,children:Yu(e,g)},e))]})]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:g===`pt-BR`?`Risco`:`Risk`}),(0,l.jsxs)(`select`,{onChange:e=>be(e.target.value),value:z,children:[(0,l.jsx)(`option`,{value:``,children:g===`pt-BR`?`Todos`:`All`}),(0,l.jsx)(`option`,{value:`lite`,children:Nu(`lite`,g)}),(0,l.jsx)(`option`,{value:`standard`,children:Nu(`standard`,g)}),(0,l.jsx)(`option`,{value:`critical`,children:Nu(`critical`,g)})]})]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:g===`pt-BR`?`Origem da tarefa`:`Task origin`}),(0,l.jsxs)(`select`,{onChange:e=>xe(e.target.value),value:B,children:[(0,l.jsx)(`option`,{value:``,children:g===`pt-BR`?`Todas`:`All`}),Pu.map(e=>(0,l.jsx)(`option`,{value:e,children:Iu(e)},e))]})]})]}):null,(0,l.jsx)(`button`,{onClick:Ie,type:`button`,children:g===`pt-BR`?`Limpar filtros`:`Clear filters`})]}):null]}),(0,l.jsx)(Nd,{locale:g,localeOpen:_e,setLocaleOpen:ve,setFiltersOpen:ge,onLocaleChange:_})]})]}),$e?(0,l.jsx)(`div`,{"aria-live":`polite`,className:`operations-loading-status`,role:`status`,children:g===`pt-BR`?`Carregando dados atualizados…`:`Loading updated data…`}):null,(0,l.jsx)(`div`,{"aria-busy":$e,className:$e?`operations-filtered is-loading`:`operations-filtered`,children:Rp(m)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ip,{capabilityNavigation:s,currency:c,data:u,datePreset:Ne,dateRange:Me,defaultDateRange:Te,includeLegacyEffort:Fe,locale:g,onOpenTask:b,onOpenDocument:v,onOpenMacro:y,onLoadStatus:M,prds:Ge,query:L,factualCostTotal:ce,factualCostFact:le,costLoading:ue,resolveRunCost:fe,runs:Ke,searchInputRef:we,setQuery:me,showFilterLoading:Ce,specs:We,tasks:U,statusPage:te,onLoadStatusPage:M,classificationPage:ne,onLoadClassificationPage:re,onLoadMacroMetrics:S,updatePeriod:Pe}),H??(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`section`,{className:`operations-toolbar`,children:[(0,l.jsx)(Fd,{locale:g,onChange:Le,view:I}),(0,l.jsx)(`div`,{className:`operations-tab-export`,children:(0,l.jsx)(lu,{filters:{query:L,status:R,risk:z,origin:B,dateRange:Me,datePreset:Ne},rows:Qe,pageSource:I===`work-kanban`?i?.({query:L,status:R,risk:z,origin:B}):a?.(I,{query:L,status:R,risk:z,origin:B,...I===`work-list`&&j!==void 0&&j.typeFilter!==`all`?{kind:j.typeFilter}:{}}),view:`operations-${I}`})})]}),I===`work-kanban`||I===`work-list`?(0,l.jsx)(`p`,{className:`cost-monitor-context`,children:g===`pt-BR`?`Custos dos itens são acumulados: PRDs e SPECs podem incluir as mesmas atividades das tarefas. Não some níveis da hierarquia. O resumo financeiro da exportação conta cada atividade uma única vez nos itens selecionados.`:`Item costs are cumulative: PRDs and SPECs may include the same activities as tasks. Do not sum hierarchy levels. The export financial summary counts each activity once across selected items.`}):null,(0,l.jsx)(Uf,{boardKindTotals:n,boardStates:r,boardTotals:t,changes:Be,conversationExecutions:W,conversationRuns:Je,currency:c,data:u,entityPage:C,executions:Ve,factualCostPeriods:de,includeLegacyEffort:Fe,locale:g,onBoardTypeChange:O,onEntityPageChange:w,onLoadMoreBoard:ee,onWorkListTypeChange:k,onWorkListPageChange:A,onOpenDocument:v,onOpenTask:b,onPriorityChange:x,prds:Ge,resolveRunCost:fe,runs:Ke,specs:We,summaryPopulation:Xe,tasks:U,workListPage:j,view:I})]})]}):(0,l.jsx)(Lp,{locale:g})})]})}function Xp({detail:e,error:t,label:n,loading:r=!1,locale:i,onClose:a,onRetry:o,preview:s}){let c=i===`pt-BR`;return(0,y.createPortal)((0,l.jsx)(`div`,{className:`operations-prd-document-backdrop`,onMouseDown:e=>{e.currentTarget===e.target&&a()},children:(0,l.jsxs)(`section`,{"aria-label":c?`${n} completa`:`Full ${n}`,"aria-modal":`true`,className:`operations-prd-document-dialog`,role:`dialog`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`span`,{children:[(0,l.jsx)(al,{"aria-hidden":`true`,size:16}),` `,n]}),(0,l.jsx)(`h2`,{children:e?.title??s.title}),(0,l.jsx)(`p`,{children:e?.id??s.id})]}),(0,l.jsx)(`button`,{"aria-label":c?`Fechar`:`Close`,onClick:a,type:`button`,children:(0,l.jsx)(fl,{"aria-hidden":`true`,size:20})})]}),(0,l.jsxs)(`div`,{className:`operations-prd-document-scroll`,children:[e?(0,l.jsx)($p,{content:e.body}):null,r?(0,l.jsx)(Zp,{locale:i}):null,t?(0,l.jsx)(Qp,{error:t,locale:i,onRetry:o}):null]}),(0,l.jsx)(`footer`,{children:e?.artifact_path??s.artifact_path})]})}),document.body)}function Zp({locale:e}){let t=e===`pt-BR`;return(0,l.jsxs)(`section`,{"aria-busy":`true`,"aria-live":`polite`,className:`operations-prd-document-loading`,children:[(0,l.jsxs)(`div`,{className:`operations-prd-document-loading-copy`,children:[(0,l.jsx)(ll,{"aria-hidden":`true`,className:`operations-prd-document-spinner`,size:20}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:t?`Carregando documento`:`Loading document`}),(0,l.jsx)(`p`,{children:t?`Preparando a leitura completa…`:`Preparing the full reader…`})]})]}),(0,l.jsxs)(`div`,{"aria-hidden":`true`,className:`operations-prd-document-skeleton`,children:[(0,l.jsx)(`i`,{}),(0,l.jsx)(`i`,{}),(0,l.jsx)(`i`,{}),(0,l.jsx)(`i`,{})]})]})}function Qp({error:e,locale:t,onRetry:n}){let r=t===`pt-BR`;return(0,l.jsxs)(`section`,{"aria-live":`assertive`,className:`operations-prd-document-error`,role:`alert`,children:[(0,l.jsx)(`strong`,{children:r?`Não foi possível carregar o documento.`:`Unable to load document.`}),(0,l.jsx)(`p`,{children:e}),n?(0,l.jsxs)(`button`,{onClick:n,type:`button`,children:[(0,l.jsx)(ul,{"aria-hidden":`true`,size:15}),` `,r?`Tentar novamente`:`Retry`]}):null]})}function $p({content:e}){return(0,l.jsx)(`article`,{className:`operations-prd-markdown`,children:em(e).map((e,t)=>{let n=`${e.kind}-${t}`;return e.kind===`heading`?(0,l.jsx)(`h${e.level}`,{children:rm(e.content)},n):e.kind===`paragraph`?(0,l.jsx)(`p`,{children:rm(e.content)},n):e.kind===`list`?(0,l.jsx)(e.ordered?`ol`:`ul`,{children:e.items.map(e=>(0,l.jsx)(`li`,{children:rm(e)},e))},n):e.kind===`quote`?(0,l.jsx)(`blockquote`,{children:rm(e.content)},n):e.kind===`code`?(0,l.jsx)(`pre`,{children:(0,l.jsx)(`code`,{"data-language":e.language??void 0,children:e.content})},n):e.kind===`table`?(0,l.jsx)(`div`,{className:`operations-prd-markdown-table`,children:(0,l.jsxs)(`table`,{children:[(0,l.jsx)(`thead`,{children:(0,l.jsx)(`tr`,{children:e.headers.map(e=>(0,l.jsx)(`th`,{children:rm(e)},e))})}),(0,l.jsx)(`tbody`,{children:e.rows.map(e=>(0,l.jsx)(`tr`,{children:e.map(e=>(0,l.jsx)(`td`,{children:rm(e)},e))},e.join(`|`)))})]})},n):(0,l.jsx)(`hr`,{},n)})})}function em(e){let t=e.replace(/\r\n/g,`
57
+ `).split(`
58
+ `),n=[],r=[],i=()=>{let e=r.join(` `).trim();e&&n.push({kind:`paragraph`,content:e}),r=[]};for(let e=0;e<t.length;e+=1){let a=t[e]??``,o=a.match(/^(#{1,3})\s+(.+)$/);if(o){i(),n.push({kind:`heading`,level:(o[1]??`#`).length,content:o[2]??``});continue}if(/^\s*(```|~~~)/.test(a)){i();let r=a.trim().slice(0,3),o=[],s=a.trim().slice(3).trim()||null;for(;++e<t.length&&!(t[e]??``).trim().startsWith(r);)o.push(t[e]??``);n.push({kind:`code`,content:o.join(`
59
+ `),language:s});continue}if(a.includes(`|`)&&e+1<t.length&&tm(t[e+1]??``)){i();let r=nm(a),o=[];for(e+=2;e<t.length&&(t[e]??``).includes(`|`);)o.push(nm(t[e]??``)),e+=1;--e,n.push({kind:`table`,headers:r,rows:o});continue}let s=a.match(/^\s*(?:([-*+])|(\d+)\.)\s+(.+)$/);if(s){i();let r=!!s[2],a=[s[3]??``];for(;e+1<t.length;){let n=(t[e+1]??``).match(/^\s*(?:([-*+])|(\d+)\.)\s+(.+)$/);if(!n||!!n[2]!==r)break;a.push(n[3]??``),e+=1}n.push({kind:`list`,ordered:r,items:a});continue}if(/^\s*>\s?/.test(a)){i(),n.push({kind:`quote`,content:a.replace(/^\s*>\s?/,``)});continue}if(/^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/.test(a)){i(),n.push({kind:`rule`});continue}if(!a.trim()){i();continue}r.push(a.trim())}return i(),n}function tm(e){return nm(e).every(e=>/^:?-{3,}:?$/.test(e.replace(/\s/g,``)))}function nm(e){return e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim())}function rm(e){return e.split(/(\*\*[^*]+\*\*|`[^`]+`|\*[^*]+\*|\[[^\]]+\]\([^\s)]+\))/g).map(e=>{if(e.startsWith(`**`)&&e.endsWith(`**`))return(0,l.jsx)(`strong`,{children:e.slice(2,-2)},e);if(e.startsWith("`")&&e.endsWith("`"))return(0,l.jsx)(`code`,{children:e.slice(1,-1)},e);if(e.startsWith(`*`)&&e.endsWith(`*`))return(0,l.jsx)(`em`,{children:e.slice(1,-1)},e);let t=e.match(/^\[([^\]]+)\]\(([^\s)]+)\)$/);return t?(0,l.jsx)(`a`,{href:t[2],rel:`noreferrer`,target:`_blank`,children:t[1]},e):(0,l.jsx)(o.Fragment,{children:e},e)})}function im(e,t){let n=new Map(e.map(e=>[e.key,e]));for(let e of t??[])n.has(e)||n.set(e,am(e));return[...n.values()].sort((e,t)=>t.latest_started_at.localeCompare(e.latest_started_at)||e.label.localeCompare(t.label))}function am(e){return{key:e,label:e,latest_started_at:``,run_count:0,task_count:0,prd_count:0,spec_count:0,evidence_count:0,test_count:0,event_count:0,total_tokens:0,estimated_usd:0,estimated_brl:0,duration_ms:0,duration:{known_sum:0,unknown:0,complete:!0,coverage_ratio:1},coverage:{events:0,tokens:0,usd:0,brl:0}}}function om(e){let t=e?.trim().toLowerCase();return!t||t===`unknown`||t===`codex`?`openai`:t}function sm(e){return e.length===0||e.some(e=>e===null)?null:e.reduce((e,t)=>e+(t??0),0)/e.length}function cm(e){let t=e.filter(e=>e!==null);return t.length===0?null:t.reduce((e,t)=>e+t,0)}function lm(e,t=`all_invocations`){let n=new Map;for(let t of e)n.has(t.run_id)||n.set(t.run_id,t);let r=[...n.values()];if(t===`all_invocations`)return r;let i=new Set(r.map(e=>e.run_id));return t===`all_execution`?r.filter(e=>e.phase===`execution`):r.filter(e=>e.phase===`execution`&&(e.parent_run_id===null||!i.has(e.parent_run_id)))}function um(e,t=`all_invocations`){let n=lm(e,t),r=n.filter(e=>e.duration_ms!==null),i=n.length-r.length;return{known_sum:r.reduce((e,t)=>e+t.duration_ms,0),unknown:i,complete:i===0,coverage_ratio:n.length===0?1:r.length/n.length}}var dm={events:0,tokens:0,usd:0,brl:0};function fm(e,t){let n=new Map;for(let e of t)e.task_id!==null&&n.set(e.task_id,[...n.get(e.task_id)??[],e]);let r=e.filter(e=>n.has(e.id)).map(e=>mm(e,n.get(e.id)??[])),i=new Set(e.map(e=>e.id)),a=[...n].filter(([e])=>!i.has(e)).map(([e,t])=>pm(e,t)),o=t.filter(e=>e.task_id===null),s=o.length===0?[]:[pm(`Sem tarefa vinculada`,o)];return[...r,...a,...s].sort((e,t)=>t.latest_started_at.localeCompare(e.latest_started_at))}function pm(e,t){return{...mm({id:e,title:e,created_at:t[0]?.started_at??``,test_count:0},t),label:`Tarefa histórica: ${e}`,latest_started_at:t.reduce((e,t)=>t.started_at>e?t.started_at:e,``)}}function mm(e,t){let n=um(t);return{key:e.id,label:e.title,latest_started_at:e.created_at,run_count:t.length,task_count:1,tasksCreated:1,tasksActive:1,prd_count:0,spec_count:0,evidence_count:0,test_count:e.test_count??0,event_count:t.reduce((e,t)=>e+(t.event_count??0),0),total_tokens:cm(t.map(e=>e.total_tokens)),estimated_usd:cm(t.map(e=>e.estimated_usd)),estimated_brl:cm(t.map(e=>e.estimated_brl)),duration_ms:n.known_sum,duration:n,coverage:t.reduce((e,t)=>({events:e.events+t.coverage.events,tokens:e.tokens+t.coverage.tokens,usd:e.usd+t.coverage.usd,brl:e.brl+t.coverage.brl}),dm),coverage_counts:{source:`run_rows`,granularity:`event`,events:t.reduce((e,t)=>e+t.coverage.events,0),tokens:null,usd:null,brl:null,metrics:{tokens:hm(t,e=>e.total_tokens),usd:hm(t,e=>e.estimated_usd),brl:hm(t,e=>e.estimated_brl)}}}}function hm(e,t){let n=e.filter(e=>t(e)!==null).length;return{eligible_runs:e.length,known_runs:n,unknown_runs:e.length-n}}async function gm({currency:e,filters:t,from:n,refresh:r,to:i,signal:a,fetcher:o=fetch}){let s=new URLSearchParams({currency:e});if(s.set(`scope`,`summary`),n!==void 0&&s.set(`from`,n),i!==void 0&&s.set(`to`,i),t){let e=[[`provider`,t.provider],[`phase`,t.phase],[`agent`,t.agent],[`model`,t.model],[`status`,t.status],[`query`,t.query],[`priority`,t.priority],[`risk`,t.risk],[`origin`,t.origin],[`workType`,t.workType]];for(let[t,n]of e)n&&s.set(t,n)}r&&s.set(`refresh`,r);let c=await o(`/api/v2/cost-monitor?${s.toString()}`,{...a===void 0?{}:{signal:a}});if(!c.ok){let e=(await c.text()).trim();throw Error(e||`Cost Monitor period request failed (${c.status})`)}return await c.json()}async function _m({currency:e,filters:t,from:n,refresh:r,to:i,signal:a,fetcher:o=fetch}){let s=ym({currency:e,...t===void 0?{}:{filters:t},...n===void 0?{}:{from:n},...r===void 0?{}:{refresh:r},...i===void 0?{}:{to:i}});s.set(`scope`,`detail`);let c=await o(`/api/v2/cost-monitor?${s.toString()}`,{...a===void 0?{}:{signal:a}});if(!c.ok)throw Error((await c.text()).trim()||`Cost Monitor detail request failed (${c.status})`);return await c.json()}async function vm({currency:e,filters:t,from:n,limit:r=10,offset:i,refresh:a,to:o,signal:s,fetcher:c=fetch}){let l=ym({currency:e,...t===void 0?{}:{filters:t},...n===void 0?{}:{from:n},...a===void 0?{}:{refresh:a},...o===void 0?{}:{to:o}});l.set(`scope`,`runs`),l.set(`offset`,String(Math.max(0,i))),l.set(`limit`,String(Math.max(1,r)));let u=await c(`/api/v2/cost-monitor?${l.toString()}`,{...s===void 0?{}:{signal:s}});if(!u.ok){let e=(await u.text()).trim();throw Error(e||`Cost Monitor run page request failed (${u.status})`)}let d=await u.json();return{page_only:!0,runs:d.runs,run_page:d.run_page??{offset:i,limit:r,total:null,has_more:!1}}}function ym({currency:e,filters:t,from:n,refresh:r,to:i}){let a=new URLSearchParams({currency:e});if(n!==void 0&&a.set(`from`,n),i!==void 0&&a.set(`to`,i),t){let e=[[`provider`,t.provider],[`phase`,t.phase],[`agent`,t.agent],[`model`,t.model],[`status`,t.status]];for(let[t,n]of e)n&&a.set(t,n);t.query&&a.set(`query`,t.query)}return r&&a.set(`refresh`,r),a}var bm=`month`;function xm(e,t=new Date){if(Number.isNaN(t.getTime()))throw RangeError(`Invalid Cost Monitor period anchor`);let n=sd(t.toISOString(),`day`);if(n===null)throw RangeError(`Invalid Cost Monitor period anchor`);if(e===`all`)return;if(e===`month`)return{from:`${n.slice(0,7)}-01`,to:n};let r=new Date(`${n}T12:00:00.000Z`);return r.setUTCDate(r.getUTCDate()-(Number(e)-1)),{from:sd(r.toISOString(),`day`)??n,to:n}}function Sm({currency:e,data:t,dateRange:n,filters:r,lastUpdatedAt:i,loadPeriod:a,period:s,snapshotBacked:c=!1}){let[l,u]=(0,o.useState)(null),[d,f]=(0,o.useState)(null),[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(null),_=(0,o.useRef)(!0),v=(0,o.useRef)(0),y=(0,o.useRef)(a);y.current=a;let b=n===void 0?c&&s===`month`?void 0:xm(s):{from:n.start,to:n.end},x=b?.from,S=b?.to,C=Cm({filters:r,period:s,snapshotBacked:c});return(0,o.useEffect)(()=>{let n=++v.current;if(!C){_.current=!1,m(!1),g(null),u(null),f(null);return}if(_.current&&Object.values(r).every(e=>e===``)){_.current=!1;return}_.current=!1;let a=new AbortController;return m(!0),g(null),y.current({currency:e,filters:r,...x===void 0||S===void 0?{}:{from:x,to:S},refresh:i,signal:a.signal}).then(e=>{a.signal.aborted||(f(t),u(e))}).catch(e=>{a.signal.aborted||g(e instanceof Error?e.message:String(e))}).finally(()=>{!a.signal.aborted&&n===v.current&&m(!1)}),()=>a.abort()},[e,t,r,i,x,S,C]),{activeData:wm(t,l,d),periodError:h,periodLoading:p}}function Cm({filters:e,period:t,snapshotBacked:n}){return!(n&&t===`month`&&Object.values(e).every(e=>e===``))}function wm(e,t,n){return t!==null&&n===e?t:e}var Tm={query:``,provider:``,phase:``,origin:``,workType:``,agent:``,model:``,status:``,priority:``,risk:``};function Em({available:e,hideQuery:t=!1,locale:n,value:r,onChange:i}){let a=(e,t)=>i({...r,[e]:t}),o=n===`en-US`?{search:`Search costs`,placeholder:`Invocation, task, model…`,agent:`Agent`,model:`Model`,priority:`Priority`,risk:`Risk`,phase:`Phase`,origin:`Origin`,work:`Work`,all:`All`,clear:`Clear`}:{search:`Buscar custos`,placeholder:`Invocação, tarefa, modelo…`,agent:`Agente`,model:`Modelo`,priority:`Prioridade`,risk:`Risco`,phase:`Fase`,origin:`Entrada`,work:`Trabalho`,all:`Todos`,clear:`Limpar`};return(0,l.jsxs)(`section`,{className:`cost-filters`,children:[t?null:(0,l.jsx)(`input`,{"aria-label":o.search,onChange:e=>a(`query`,e.target.value),placeholder:o.placeholder,value:r.query}),(0,l.jsx)(Dm,{allLabel:o.all,label:`Provider`,onChange:e=>a(`provider`,e),options:e.providers,value:r.provider}),(0,l.jsx)(Dm,{allLabel:o.all,label:o.agent,onChange:e=>a(`agent`,e),options:e.agents,value:r.agent}),(0,l.jsx)(Dm,{allLabel:o.all,label:o.model,onChange:e=>a(`model`,e),options:e.models,value:r.model}),(0,l.jsx)(Dm,{label:`Status`,allLabel:o.all,onChange:e=>a(`status`,e),options:e.statuses,value:r.status}),(0,l.jsx)(Dm,{allLabel:o.all,label:o.priority,onChange:e=>a(`priority`,e),options:e.priorities,value:r.priority}),(0,l.jsx)(Dm,{allLabel:o.all,label:o.risk,onChange:e=>a(`risk`,e),options:e.risks,value:r.risk}),(0,l.jsx)(Dm,{allLabel:o.all,label:o.phase,onChange:e=>a(`phase`,e),options:e.phases,value:r.phase}),(0,l.jsx)(Dm,{allLabel:o.all,label:o.origin,onChange:e=>a(`origin`,e),options:e.origins,value:r.origin}),(0,l.jsx)(Dm,{allLabel:o.all,label:o.work,onChange:e=>a(`workType`,e),options:e.work_types,value:r.workType}),(0,l.jsx)(`button`,{onClick:()=>i(Tm),type:`button`,children:o.clear})]})}function Dm({allLabel:e=`Todos`,label:t,value:n,options:r,onChange:i}){return(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:t}),(0,l.jsxs)(`select`,{"aria-label":t,onChange:e=>i(e.target.value),value:n,children:[(0,l.jsx)(`option`,{value:``,children:e}),r.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))]})]})}function Om(e,t=`all_invocations`){return lm(e,t)}function km(e,t){return e===`fast`?t===`pt-BR`?`Priority (derivado de Fast)`:`Priority (derived from Fast)`:e===`priority`?`Priority (API)`:e==="default"?`Standard (API)`:`-`}function Am(e){return{primary:e.model,detail:e.provider===null||e.provider===`unknown`?`-`:e.provider}}function jm(e,t,n){return e===`pt-BR`?t:n}function Mm(e){let t=e.filter(e=>typeof e==`number`);return t.length===0?null:t.reduce((e,t)=>e+t,0)}var Nm=e=>Mm(Om(e).map(e=>e.duration_ms)),Pm=(e,t)=>e.some(e=>{let n=t(e);return n!==null&&n!==0&&n!==``}),Fm=(e,t)=>new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2}).format(e??0),Im=(e,t)=>`R$ ${Fm(e,t)}`,Lm=(e,t)=>new Intl.NumberFormat(t,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}).format(e??0),Rm=e=>{let t=e?.trim()??``;return t===``||t.toLowerCase()===`unknown`?null:t},zm=(e,t,n)=>n===`pt-BR`?{low:`Leve`,medium:`Médio`,high:`Alto`,xhigh:`Extra alto`,max:`Ultra`,default:`Padrão`,priority:`Rápido`}[e]??e:e,Bm=(e,t,n)=>e===null||t===null?`0`:`${e.toLocaleString(`en-US`,{maximumFractionDigits:3})}\u00d7 / ${t.toLocaleString(`en-US`,{maximumFractionDigits:3})}\u00d7`,Vm=(e,t,n)=>{let r=Rm(e);if(r!==null)return zm(r,`effort`,n);let i=Rm(t);if(i===null)return`-`;let a=zm(i,`effort`,n);return n===`pt-BR`?`${a} (solicitado; efetivo -)`:`${a} (requested; effective -)`},Hm=(e,t)=>{let n=Rm(e);return n===null?t===`pt-BR`?`Padrão`:`Standard`:zm(n,`speed`,t)},Um=e=>e===`pt-BR`?`Tabela de custos por invocação com rolagem horizontal`:`Agent invocation costs table with horizontal scrolling`,Wm=e=>e===`pt-BR`?`Tabela de custos agrupados com rolagem horizontal`:`Grouped costs table with horizontal scrolling`,Gm=(e,t)=>!e||Number.isNaN(Date.parse(e))?`—`:new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(e)),Km=(e,t,n)=>{if(t===`annual`)return e.slice(0,4);if(t===`monthly`)return e.slice(0,7);let r=new Date(`${e}T12:00:00.000Z`);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat(n,{dateStyle:`short`,timeZone:`UTC`}).format(r)},qm=({locale:e,duration:t,tokens:n,cost:r,currency:i})=>e===`pt-BR`?`Total geral \u2014 Tempo: ${t}; Tokens: ${n}; ${i}: ${r}`:`Grand total \u2014 Time: ${t}; Tokens: ${n}; Cost (${i}): ${r}`;function Jm({rows:e,locale:t,pagination:n,subtotal:r,onOpenTrace:i}){let a=(e,t)=>t(e.known_sum??0),o=e=>Ym(e)===null?`0`:a(e.metrics.duration,e=>e===0?`0`:T(e,t)),s=(e,t)=>{if(r!==null)return a(e,t)},c=r!==null,u=e=>new Intl.NumberFormat(t).format(e),d=c?r===null?`Total`:`${t===`pt-BR`?`Subtotal filtrado`:`Filtered subtotal`} · ${u(r.entity_count)} ${t===`pt-BR`?`registros`:`records`}`:void 0,f=!c||r===null?void 0:s(r.metrics.cost_brl,e=>k(e,`BRL`,t));return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b,{columns:[{key:`occurredAt`,label:t===`pt-BR`?`Última atividade`:`Last activity`,render:e=>Gm(e.occurred_at,t),footer:d},{key:`entity`,label:t===`pt-BR`?`Registro`:`Record`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.title}),(0,l.jsx)(`small`,{children:e.id})]}),footer:!c||r===null?void 0:u(r.entity_count)},{key:`status`,label:`Status`,render:e=>e.status??`—`},{key:`activities`,label:t===`pt-BR`?`Atividades`:`Activities`,render:e=>e.activity_count==null?`—`:u(e.activity_count),align:`right`,description:t===`pt-BR`?`Runs registrados, incluindo atividades históricas sem identificação de invocação de agente. O consumo pode estar indisponível.`:`Runs including historical activities without an agent invocation identifier.`,footer:!c||r?.activity_count===void 0?void 0:s(r.activity_count,u)},{key:`runs`,label:t===`pt-BR`?`Invocações`:`Invocations`,render:e=>new Intl.NumberFormat(t).format(e.run_count),align:`right`,footer:!c||r===null?void 0:s(r.run_count,u)},{key:`duration`,label:t===`pt-BR`?`Tempo observado`:`Observed time`,render:o,align:`right`,footer:!c||r===null?void 0:s(r.metrics.duration,e=>e===0?`0`:T(e,t))},{key:`tokens`,label:`Tokens`,render:e=>a(e.metrics.total_tokens,e=>D(e,t)),align:`right`,footer:!c||r===null?void 0:s(r.metrics.total_tokens,e=>D(e,t))},{key:`cost`,label:t===`pt-BR`?`Custo registrado`:`Recorded cost`,render:e=>a(e.metrics.cost,n=>e.cost_currency===`BRL`||e.cost_currency===`USD`?k(n,e.cost_currency,t):new Intl.NumberFormat(t).format(n)),align:`right`,footer:f},...i===void 0?[]:[{key:`trace`,label:``,render:e=>(0,l.jsx)(`button`,{onClick:()=>i(e.id),type:`button`,children:t===`pt-BR`?`Abrir`:`Open`})}]],locale:t,pageSize:null,rowKey:e=>e.id,rows:e,sortable:!0}),r!==null&&((r.unattributed_activity_count??0)>0||(r.orphan_activity_count??0)>0)?(0,l.jsxs)(`p`,{className:`cost-monitor-context`,children:[t===`pt-BR`?`Fora das linhas deste agrupamento: `:`Outside this grouping's rows: `,t===`pt-BR`?`sem vínculo`:`unattributed`,` `,k(r.unattributed_cost_brl??0,`BRL`,t),` · `,t===`pt-BR`?`referência sem registro canônico`:`reference without canonical record`,` `,k(r.orphan_cost_brl??0,`BRL`,t),`.`]}):null,(0,l.jsx)(Zm,{locale:t,pagination:n})]})}function Ym(e){let t=e.metrics.duration;return t.known_sum===0&&!t.complete&&t.coverage_ratio===0?null:t.known_sum}function Xm(e){return e}function Zm({locale:e,pagination:t}){let n=t.total===0?0:t.offset+1,r=t.total===null?t.offset+t.limit:Math.min(t.offset+t.limit,t.total),i=Math.max(0,t.offset-t.limit),a=t.offset+t.limit;return(0,l.jsxs)(`nav`,{"aria-label":e===`pt-BR`?`Paginação dos dados agregados`:`Aggregate data pagination`,className:`ui-table-pagination`,children:[(0,l.jsx)(`button`,{disabled:t.loading||t.offset===0,onClick:()=>t.onChange(i),type:`button`,children:e===`pt-BR`?`Anterior`:`Previous`}),(0,l.jsx)(`span`,{"aria-live":`polite`,children:t.loading?e===`pt-BR`?`Carregando dados…`:`Loading data…`:t.total===null?`${n}–${r}${t.has_more?`+`:``}`:`${n}–${r} ${e===`pt-BR`?`de`:`of`} ${t.total}`}),(0,l.jsx)(`button`,{disabled:t.loading||!t.has_more&&(t.total===null||a>=t.total),onClick:()=>t.onChange(a),type:`button`,children:e===`pt-BR`?`Próxima`:`Next`}),t.error?(0,l.jsxs)(`span`,{role:`status`,children:[t.error,` `,(0,l.jsx)(`button`,{onClick:t.onRetry,type:`button`,children:e===`pt-BR`?`Tentar novamente`:`Retry`})]}):null]})}function Qm(e,t,n){return new Intl.NumberFormat(n,{style:`percent`,maximumFractionDigits:1}).format(t>0?(e??0)/t:0)}function $m(e,t){return e===null||e===0?`0`:T(e,t)}function eh(e,t){return D(e??0,t)}function th(e,t,n){return k(e??0,t,n)}function nh(e){return e===`pt-BR`?{analyticsView:`Visão analítica`,trend:`TENDÊNCIA`,dailyCost:`Custo diário`,sevenDays:`7 dias`,dailyCostChart:`Custo diário dos últimos 7 dias`,distribution:`DISTRIBUIÇÃO`,costByModel:`Custo por modelo`,composition:`COMPOSIÇÃO`,tokenMix:`Mix de tokens`,phases:`FASES`,totalsByPhase:`Totais por fase`,inputWithoutCache:`Input sem cache`,cachedInput:`Cache`,visibleOutput:`Output visível`,reasoning:`Raciocínio`,total:`Total (input + output)`}:{analyticsView:`Analytics overview`,trend:`TREND`,dailyCost:`Daily cost`,sevenDays:`7 days`,dailyCostChart:`Daily cost for the last 7 days`,distribution:`DISTRIBUTION`,costByModel:`Cost by model`,composition:`COMPOSITION`,tokenMix:`Token mix`,phases:`PHASES`,totalsByPhase:`Totals by phase`,inputWithoutCache:`Uncached input`,cachedInput:`Cached input`,visibleOutput:`Visible output`,reasoning:`Reasoning`,total:`Total (input + output)`}}function rh(e,t){return t===`en-US`?e===`conversation`?`Conversation`:e===`planning`?`Planning`:`Execution`:e===`conversation`?`Conversa`:e===`planning`?`Planejamento`:`Execução`}var ih=[`#00b0f0`,`#5ea7ff`,`#a78bfa`,`#f5c451`,`#fb7185`,`#94a3b8`];function ah({rows:e,daily:t,models:n,summaryUsage:r,currency:i,locale:a}){let o=nh(a),s=[`conversation`,`planning`,`execution`].map(t=>({phase:t,metrics:sh(t,e,r,i)})),c=s.reduce((e,{metrics:t})=>({duration:e.duration+(t.duration??0),tokens:e.tokens+(t.tokens??0),cost:e.cost+(t.cost??0)}),{duration:0,tokens:0,cost:0}),u=oh(e,r,o),d=lh(n,i),f=Math.max(1,...d.map(e=>ch(e,i)??0)),{trendPoints:p,segments:m}=mh(ph(t,i));return(0,l.jsxs)(`section`,{className:`cost-chart-grid`,"aria-label":o.analyticsView,children:[(0,l.jsxs)(`article`,{className:`cost-chart cost-chart-trend`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`small`,{children:o.trend}),(0,l.jsx)(`h2`,{children:o.dailyCost})]}),(0,l.jsx)(`strong`,{children:o.sevenDays})]}),(0,l.jsxs)(`div`,{className:`cost-trend-plot`,children:[(0,l.jsxs)(`svg`,{className:`cost-line-chart`,role:`img`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,l.jsx)(`title`,{children:o.dailyCostChart}),(0,l.jsx)(`defs`,{children:(0,l.jsxs)(`linearGradient`,{id:`cost-area`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,l.jsx)(`stop`,{stopColor:`#00b0f0`,stopOpacity:`.34`}),(0,l.jsx)(`stop`,{offset:`1`,stopColor:`#00b0f0`,stopOpacity:`0`})]})}),m.map(e=>{let t=e[0],n=e[e.length-1],r=e.map(e=>`${e.x},${e.y}`).join(` `);return(0,l.jsxs)(`g`,{children:[(0,l.jsx)(`polygon`,{fill:`url(#cost-area)`,points:`${t.x},100 ${r} ${n.x},100`}),(0,l.jsx)(`polyline`,{fill:`none`,points:r,stroke:`#00b0f0`,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),e.length===1&&(0,l.jsx)(`circle`,{cx:t.x,cy:t.y,r:`1`,fill:`#00b0f0`})]},t.key)})]}),p.map((e,t)=>(0,l.jsx)(`span`,{className:`cost-trend-value${t===0?` is-first`:t===p.length-1?` is-last`:``}`,style:{left:`${e.x}%`,top:`${e.y}%`},children:th(e.value,i,a)},e.key))]}),(0,l.jsx)(`div`,{className:`cost-trend-days`,children:p.map(e=>(0,l.jsx)(`span`,{children:hh(e.date,a)},e.key))})]}),(0,l.jsxs)(`article`,{className:`cost-chart cost-chart-model`,children:[(0,l.jsx)(`header`,{children:(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`small`,{children:o.distribution}),(0,l.jsx)(`h2`,{children:o.costByModel})]})}),(0,l.jsx)(`div`,{className:`cost-bar-list`,children:d.slice(0,6).map((e,t)=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{children:e.label}),(0,l.jsx)(`i`,{children:(0,l.jsx)(`b`,{style:{width:`${(ch(e,i)??0)/f*100}%`,background:ih[t]}})}),(0,l.jsx)(`strong`,{children:th(ch(e,i),i,a)})]},e.key))})]}),(0,l.jsxs)(`article`,{className:`cost-chart`,children:[(0,l.jsx)(`header`,{children:(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`small`,{children:o.composition}),(0,l.jsx)(`h2`,{children:o.tokenMix})]})}),(0,l.jsx)(`div`,{className:`token-mix`,children:u.map(([e,t],n)=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`i`,{style:{background:ih[n]}}),(0,l.jsx)(`span`,{children:e}),(0,l.jsx)(`strong`,{children:eh(t,a)})]},e))})]}),(0,l.jsxs)(`article`,{className:`cost-chart cost-chart-phases`,children:[(0,l.jsx)(`header`,{children:(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`small`,{children:o.phases}),(0,l.jsx)(`h2`,{children:o.totalsByPhase})]})}),(0,l.jsx)(`p`,{className:`cost-monitor-context`,children:a===`pt-BR`?`As fases dividem o consumo. A aba Conversas reúne todas as fases vinculadas a cada conversa; seus valores não são equivalentes à fase Conversa.`:`Phases partition usage. The Conversations tab includes every phase linked to each conversation; its totals differ from the Conversation phase.`}),(0,l.jsx)(`div`,{className:`phase-strip`,children:s.map(({phase:e,metrics:t},n)=>(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`div`,{className:`phase-name`,children:[(0,l.jsx)(`i`,{style:{background:ih[n]}}),(0,l.jsx)(`span`,{children:rh(e,a)})]}),(0,l.jsxs)(`dl`,{className:`phase-metrics`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`dt`,{children:a===`pt-BR`?`Tempo`:`Time`}),(0,l.jsxs)(`dd`,{children:[$m(t.duration,a),` (`,Qm(t.duration,c.duration,a),`)`]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`dt`,{children:`Tokens`}),(0,l.jsxs)(`dd`,{children:[eh(t.tokens,a),` (`,Qm(t.tokens,c.tokens,a),`)`]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`dt`,{children:a===`pt-BR`?`Custo`:`Cost`}),(0,l.jsxs)(`dd`,{children:[th(t.cost,i,a),` (`,Qm(t.cost,c.cost,a),`)`]})]})]})]},e))})]})]})}function oh(e,t,n){let r=t?.total.tokens,i=r?.input??gh(e.map(e=>e.input_tokens)),a=uh(r?.cached_input??gh(e.map(e=>e.cached_input_tokens)),i),o=r?.output??gh(e.map(e=>e.output_tokens)),s=uh(r?.reasoning??gh(e.map(e=>e.reasoning_tokens)),o),c=fh(i,o,r?.total??gh(e.map(e=>e.total_tokens)));return[[n.inputWithoutCache,dh(i,a)],[n.cachedInput,a],[n.visibleOutput,dh(o,s)],[n.reasoning,s],[n.total,c]]}function sh(e,t,n,r){let i=t.filter(t=>t.phase===e),a=n?.[e];return{duration:a?.duration_ms??gh(i.map(e=>e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`legacy_inferred`?e.duration_ms:null)),tokens:a?.tokens.total??gh(i.map(e=>e.total_tokens)),cost:(r===`BRL`?a?.cost.brl:a?.cost.usd)??gh(i.map(e=>r===`BRL`?e.estimated_brl:e.estimated_usd))}}function ch(e,t){return t===`BRL`?e.estimated_brl:e.estimated_usd}function lh(e,t){return e.filter(e=>ch(e,t)!==null).sort((e,n)=>{let r=(ch(n,t)??0)-(ch(e,t)??0);return r===0?e.key.localeCompare(n.key):r})}function uh(e,t){return e===null||t===null||e>t?null:e}function dh(e,t){return e===null||t===null?null:e-t}function fh(e,t,n){return e!==null&&t!==null?e+t:n}function ph(e,t){let n=new Map(e.map(e=>[e.key,ch(e,t)]));return[...n.keys()].sort().slice(-7).map(e=>({date:new Date(`${e}T12:00:00`),key:e,value:n.get(e)}))}function mh(e){let t=Math.max(1,...e.map(e=>e.value??0)),n=e.map((n,r)=>({...n,x:r/Math.max(1,e.length-1)*100,y:n.value===null?82:82-n.value/t*58})),r=[],i=[];for(let e of n)e.value===null?(i.length&&r.push(i),i=[]):i.push(e);return i.length&&r.push(i),{trendPoints:n,segments:r}}function hh(e,t){return new Intl.DateTimeFormat(t,{weekday:`short`,day:`2-digit`,month:`2-digit`}).format(e).replace(`.`,``)}function gh(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0):null}function _h(e,t){let n=e.length;return{tasks:yh(e.map(e=>e.task_count),n),specs:yh(e.map(e=>e.spec_count),n),prds:yh(e.map(e=>e.prd_count),n),durationMs:yh(e.map(e=>e.duration_ms),n),tokens:vh(e.map(e=>e.total_tokens)),cost:vh(e.map(e=>t===`BRL`?e.estimated_brl:e.estimated_usd))}}function vh(e){let t=e.filter(e=>e!==null);return t.length===0?null:t.reduce((e,t)=>e+t,0)/t.length}function yh(e,t){return t===0||e.every(e=>e===null)?null:e.reduce((e,t)=>e+(t??0),0)/t}function bh(e,t,n){let r=new Map(e.map(e=>[e.key,{...e,task_count:0,tasksActive:0,taskDaysActive:0,tasksCreated:0}])),i=new Map,a=new Set((t.evidences??[]).map(e=>e.id)),o=e=>{let t=xh(e,n);if(t===null)return null;let i=r.get(t);if(i!==void 0)return i;let a={key:t,label:t,latest_started_at:Sh(t,n),run_count:0,task_count:0,tasksCreated:0,tasksActive:0,taskDaysActive:0,event_count:0,total_tokens:null,estimated_usd:null,estimated_brl:null,duration_ms:null,duration:{known_sum:0,unknown:0,complete:!0,coverage_ratio:1},coverage:{events:0,tokens:0,usd:0,brl:0},prd_count:0,spec_count:0,evidence_count:0,test_count:0};return r.set(t,a),a};for(let e of t.prds){let t=o(e.created_at);t!==null&&(t.prd_count=(t.prd_count??0)+1)}for(let e of t.specs){let t=o(e.created_at);t!==null&&(t.spec_count=(t.spec_count??0)+1)}for(let e of t.tasks){let n=o(e.created_at);if(n===null)continue;n.task_count=(n.task_count??0)+1,n.tasksCreated=(n.tasksCreated??0)+1,t.validations===void 0&&(n.test_count=(n.test_count??0)+(e.test_count??0));let r=i.get(n.key)??new Set;for(let t of e.result?.evidence_ids??[])a.has(t)||r.add(t);i.set(n.key,r)}for(let e of t.evidences??[]){let t=o(e.observed_at);if(t===null)continue;let n=i.get(t.key)??new Set;n.add(e.id),i.set(t.key,n)}for(let[e,t]of i){let n=r.get(e);n!==void 0&&(n.evidence_count=t.size)}let s=new Map;for(let e of t.validations??[]){let t=o(e.executed_at);if(t===null)continue;let n=s.get(t.key)??new Set;n.add(e.id),s.set(t.key,n)}for(let[e,t]of s){let n=r.get(e);n!==void 0&&(n.test_count=t.size)}return[...r.values()].sort((e,t)=>t.key.localeCompare(e.key))}function xh(e,t){return sd(e,t===`daily`?`day`:t===`monthly`?`month`:`year`)}function Sh(e,t){return t===`annual`?`${e}-01-01T00:00:00.000Z`:t===`monthly`?`${e}-01T00:00:00.000Z`:`${e}T00:00:00.000Z`}function Ch({currency:e,locale:t,loading:n=!1,average:r,period:i,rows:a}){if(n)return(0,l.jsx)(`p`,{role:`status`,children:t===`pt-BR`?`Carregando médias…`:`Loading averages…`});let o=r===void 0?_h(a,e):r??{tasks:null,specs:null,prds:null,durationMs:null,tokens:null,cost:null};return(0,l.jsx)(ee,{ariaLabel:wh(i,t),metrics:[{label:Th(t===`pt-BR`?`Tarefas`:`Tasks`,i,t),value:o.tasks===null?`0`:O(o.tasks,t,1)},{label:Th(`SPECs`,i,t),value:o.specs===null?`0`:O(o.specs,t,1)},{label:Th(`PRDs`,i,t),value:o.prds===null?`0`:O(o.prds,t,1)},{label:Th(t===`pt-BR`?`Tempo`:`Time`,i,t),value:o.durationMs===null?`0`:E(o.durationMs,t)},{label:Th(`Tokens`,i,t),value:o.tokens===null?`0`:D(o.tokens,t)},{label:Th(t===`pt-BR`?`Custo`:`Cost`,i,t),value:o.cost===null?`0`:k(o.cost,e,t)}]})}function wh(e,t){return t===`en-US`?e===`daily`?`Daily averages`:e===`monthly`?`Monthly averages`:`Annual averages`:e===`daily`?`Médias por dia`:e===`monthly`?`Médias por mês`:`Médias por ano`}function Th(e,t,n){return n===`en-US`?`${e} ${t===`daily`?`Daily average`:t===`monthly`?`Monthly average`:`Annual average`}`:`${e} ${t===`daily`?`Médio por dia`:t===`monthly`?`Médio por mês`:`Médio por ano`}`}function $(e,t){let n=e===`pt-BR`?`Valor da projeção SQLite/API desta Invocação de Agente. O zero exibido para um fato não medido não altera o valor canônico nulo.`:`Value from this Agent Invocation's SQLite/API projection. A displayed zero for an unmeasured fact does not change its canonical null value.`;return`${({duration:[`Tempo factual da invocação, quando capturado ou reconciliado.`,`Factual invocation duration, when captured or reconciled.`],inputTokens:[`Input total informado pela fonte; inclui a parcela de cache.`,`Source-reported total input; includes the cached portion.`],cachedInputTokens:[`Parcela de cache já incluída no input total.`,`Cached portion already included in total input.`],outputTokens:[`Output total informado pela fonte; inclui a parcela de raciocínio.`,`Source-reported total output; includes the reasoning portion.`],reasoningTokens:[`Parcela de raciocínio já incluída no output total.`,`Reasoning portion already included in total output.`],totalTokens:[`Soma de entrada e saída quando ambas são conhecidas; caso contrário, total informado pela fonte.`,`Input plus output when both are known; otherwise the source-reported total.`],inputRate:[`Tarifa efetiva de entrada em USD por milhão de tokens.`,`Effective input rate in USD per million tokens.`],cacheRate:[`Tarifa efetiva de entrada em cache em USD por milhão de tokens.`,`Effective cached-input rate in USD per million tokens.`],outputRate:[`Tarifa efetiva de saída em USD por milhão de tokens.`,`Effective output rate in USD per million tokens.`],reasoningRate:[`Tarifa efetiva de raciocínio em USD por milhão de tokens.`,`Effective reasoning rate in USD per million tokens.`],contextMultiplier:[`Multiplicadores de contexto de entrada/saída aplicados aos segmentos internos.`,`Input/output context multipliers applied to internal segments.`],inputCost:[`Custo USD de entrada calculado com tokens e tarifa efetiva.`,`Input USD cost calculated from tokens and the effective rate.`],cacheCost:[`Custo USD da entrada em cache calculado com tokens e tarifa efetiva.`,`Cached-input USD cost calculated with tokens and the effective rate.`],outputCost:[`Custo USD de saída calculado com tokens e tarifa efetiva.`,`Output USD cost calculated with tokens and the effective rate.`],reasoningCost:[`Custo USD de raciocínio calculado com tokens e tarifa efetiva.`,`Reasoning USD cost calculated with tokens and the effective rate.`],standardCost:[`Custo USD no cenário Standard, antes do acréscimo de velocidade.`,`USD cost in the Standard scenario, before the speed uplift.`],speedUplift:[`Acréscimo USD do cenário Priority/Fast, já incluído no custo efetivo.`,`USD uplift from the Priority/Fast scenario, already included in the effective cost.`],finalUsd:[`Custo final estimado da API em USD, somando os componentes de custo desta invocação.`,`Estimated final API cost in USD, summing this invocation's cost components.`],fxRate:[`Câmbio BRL/USD atual aplicado para converter o custo final atual.`,`Current BRL/USD exchange rate used to convert the current final cost.`],recordedFxRate:[`Câmbio BRL/USD registrado no período da atividade.`,`BRL/USD exchange rate recorded for the activity period.`],recordedBrl:[`Custo final BRL registrado no período, preservado para auditoria histórica.`,`Final BRL cost recorded in the period, retained for historical audit.`],cost:[`Custo final atual: USD estimado ou sua conversão BRL pelo câmbio atual selecionado.`,`Current final cost: estimated USD or its BRL conversion at the selected current exchange rate.`]}[t]??[`Métrica numérica desta invocação.`,`Numeric metric for this invocation.`])[e===`pt-BR`?0:1]} ${n}`}function Eh(){return(0,l.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`})]})}function Dh({locale:e,pagination:t}){let n=t.total===0?0:t.offset+1,r=t.total===null?t.offset+t.limit:Math.min(t.offset+t.limit,t.total),i=Math.max(0,t.offset-t.limit),a=t.offset+t.limit;return(0,l.jsxs)(`nav`,{"aria-label":e===`pt-BR`?`Paginação das invocações`:`Invocation pagination`,className:`ui-table-pagination`,children:[(0,l.jsx)(`button`,{disabled:t.loading||t.offset===0,onClick:()=>t.onChange(i),type:`button`,children:e===`pt-BR`?`Anterior`:`Previous`}),(0,l.jsx)(`span`,{"aria-live":`polite`,children:t.loading?e===`pt-BR`?`Carregando invocações…`:`Loading invocations…`:t.total===null?`${n}–${r}${t.has_more?`+`:``}`:`${n}–${r} ${e===`pt-BR`?`de`:`of`} ${t.total}`}),(0,l.jsx)(`button`,{disabled:t.loading||!t.has_more&&(t.total===null||a>=t.total),onClick:()=>t.onChange(a),type:`button`,children:e===`pt-BR`?`Próxima`:`Next`}),t.error?(0,l.jsxs)(`span`,{role:`status`,children:[t.error,` `,(0,l.jsx)(`button`,{onClick:t.onRetry,type:`button`,children:e===`pt-BR`?`Tentar novamente`:`Retry`})]}):null]})}var Oh={clip:`rect(0, 0, 0, 0)`,height:1,margin:-1,overflow:`hidden`,position:`absolute`,whiteSpace:`nowrap`,width:1};function kh(e,t){return e===null?`—`:new Intl.NumberFormat(t,{maximumFractionDigits:0}).format(e)}function Ah(e,t){return e===null||e===0?`0`:T(e,t)}function jh(e,t){return e===null?`—`:k(e,`BRL`,t)}function Mh(e,t){return D(e,t)}function Nh(e,t,n,r){if(t>=n)return e;let i=r===`pt-BR`?`Valor parcial: telemetria conhecida em ${t} de ${n} runs.`:`Partial value: telemetry is known for ${t} of ${n} runs.`;return(0,l.jsxs)(`span`,{title:i,children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:e}),(0,l.jsx)(`span`,{style:Oh,children:`${i} ${e}`})]})}function Ph({locale:e,rows:t}){return(0,l.jsx)(b,{columns:[{key:`developer`,label:e===`pt-BR`?`Desenvolvedor`:`Developer`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.login_snapshot??e.account_id}),(0,l.jsxs)(`small`,{children:[`#`,e.account_id]})]}),sortValue:e=>e.login_snapshot??e.account_id},{key:`prds`,label:`PRDs`,render:t=>kh(t.prd_count,e),align:`right`},{key:`specs`,label:`SPECs`,render:t=>kh(t.spec_count,e),align:`right`},{key:`tasks`,label:e===`pt-BR`?`Tarefas`:`Tasks`,render:t=>kh(t.task_count,e),align:`right`},{key:`runs`,label:`Runs`,render:t=>kh(t.run_count,e),align:`right`},{key:`tests`,label:e===`pt-BR`?`Testes`:`Tests`,render:t=>kh(t.test_count,e),align:`right`},{key:`evidences`,label:e===`pt-BR`?`Evidências`:`Evidence`,render:t=>kh(t.evidence_count,e),align:`right`},{key:`duration`,label:e===`pt-BR`?`Tempo`:`Time`,render:t=>Nh(Ah(t.total_duration_ms,e),t.duration_covered_runs,t.run_count,e),sortValue:e=>e.total_duration_ms,align:`right`},{key:`tokens`,label:`Tokens`,render:t=>Nh(Mh(t.total_tokens,e),t.token_covered_runs,t.run_count,e),sortValue:e=>e.total_tokens,align:`right`},{key:`cost`,label:e===`pt-BR`?`Custos`:`Costs`,render:t=>Nh(jh(t.total_cost_brl,e),t.brl_covered_runs,t.run_count,e),sortValue:e=>e.total_cost_brl,align:`right`}],defaultSort:{key:`cost`,direction:`desc`},emptyMessage:e===`pt-BR`?`Nenhum dado disponível.`:`No data available.`,locale:e,pageSize:10,rowKey:e=>e.account_id,rows:t,scrollLabel:e===`pt-BR`?`Métricas por desenvolvedor`:`Developer metrics`,showColumnInfo:!0,sortable:!0})}function Fh(e,t){let n=e.trim().toLowerCase();return n.length===0||n===`unknown`?t===`pt-BR`?`Sem modelo/provedor atribuído`:`No model/provider assigned`:e}function Ih(e,t){return e===null?`—`:new Intl.NumberFormat(t,{maximumFractionDigits:0}).format(e)}function Lh(e,t){return Ih(e,t)}function Rh(e,t){return e===null?`—`:D(e,t)}function zh(e,t,n){return e===null?`—`:k(e,t,n)}function Bh(e,t){return e===null?`—`:e===0?`0`:T(e,t)}var Vh=(e,t)=>Ih(e,t),Hh=(e,t,n)=>zh(e,t,n),Uh=(e,t)=>Bh(e,t),Wh=(e,t)=>Fm(e,t),Gh=(e,t)=>Lm(e,t),Kh=(e,t)=>Im(e,t),qh=(e,t,n)=>Bm(e,t,n);function Jh(e,t){return e.known_sum<=0&&!e.complete||e.known_sum<=0?`0`:T(e.known_sum,t)}function Yh(e){return e.known_sum>0||e.coverage_ratio>0}function Xh(e,t){return t?e===`pt-BR`?`Subtotal da página`:`Page subtotal`:`Total`}function Zh(e,t,n){return e===`BRL`?t:n}function Qh(e){return e.prd_id===null?e.spec_id===null?{label:`Tarefa avulsa`,tone:`task`}:{label:`SPEC`,tone:`spec`}:{label:`PRD`,tone:`prd`}}function $h(e){return e.conversation_count??null}function eg(e){return{runs:e.reduce((e,t)=>e+t.run_count,0),tasks:Mm(e.map(e=>e.task_count)),prds:Mm(e.map(e=>e.prd_count)),specs:Mm(e.map(e=>e.spec_count)),evidences:Mm(e.map(e=>e.evidence_count)),tests:Mm(e.map(e=>e.test_count)),conversations:Mm(e.map($h)),durationKnownMs:e.reduce((e,t)=>e+t.duration.known_sum,0),durationPartial:e.some(e=>!e.duration.complete),tokens:Mm(e.map(e=>e.total_tokens)),usd:Mm(e.map(e=>e.estimated_usd)),brl:Mm(e.map(e=>e.estimated_brl))}}function tg(e,t,n){let r=t===`pt-BR`?`Zero exibido por falta de medição; não é um valor observado.`:`Zero displayed because no measurement was recorded; this is not an observed value.`,i=e=>(0,l.jsx)(`output`,{"aria-label":`${e}. ${r}`,title:r,children:e});return{description:n===void 0?void 0:r,duration:e=>n!==void 0&&!Yh(e)?`0`:Jh(e,t),currency:r=>zh(n===void 0?r:r??0,e,t),disclose:(e,t)=>n!==void 0&&t?i(e):e}}function ng(e,t,n){let r=eg(e);return t===void 0?{...r,conversations:n===void 0?r.conversations:null}:{runs:t.run_count,tasks:t.task_count,prds:t.prd_count,specs:t.spec_count,evidences:t.evidence_count,tests:t.test_count,conversations:$h(t),durationKnownMs:t.duration.known_sum,durationPartial:!t.duration.complete,tokens:t.total_tokens,usd:t.estimated_usd,brl:t.estimated_brl}}function rg({rows:e,currency:t,locale:n,onOpenTrace:r,period:i,showDateTime:a=!0,showAgentIdentity:o=!1,showInvocationTasks:s=!1,showModelLifecycleDetails:c=!1,dateHeading:u,labelHeading:d,totals:f,loading:p=!1}){let m=e=>Lh(o||c?e??0:e,n),h=tg(t,n,i),g=h.description===void 0?{}:{description:h.description},_=ng(e,f,i),v=h.duration(f?.duration??{known_sum:_.durationKnownMs,unknown:+!!_.durationPartial,complete:!_.durationPartial,coverage_ratio:+!_.durationPartial}),y=Rh(c?_.tokens??0:_.tokens,n),x=h.currency(t===`BRL`?_.brl:_.usd),S=qm({locale:n,duration:v,tokens:y,cost:x,currency:t}),C=n===`pt-BR`?`Total geral`:`Grand total`;return(0,l.jsx)(b,{columns:[{key:`latestStartedAt`,label:u??(n===`pt-BR`?`Data e hora`:`Date and time`),render:e=>Gm(e.latest_started_at,n),hidden:!a,footer:a?(0,l.jsx)(`output`,{"aria-label":C,children:`Total`}):void 0},...o?[{key:`persona`,label:`Persona`,render:e=>e.persona??``},{key:`job`,label:n===`pt-BR`?`Cargo`:`Job`,render:e=>e.job??``}]:[],{key:`label`,label:i===void 0?d??(n===`pt-BR`?`Grupo`:`Group`):og(i,n),render:e=>{if(i!==void 0)return(0,l.jsx)(`strong`,{children:Km(e.key,i,n)});let t=Fh(e.label,n),r=t!==e.label;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:t}),r||e.key===e.label?null:(0,l.jsx)(`small`,{children:e.key})]})},sortValue:e=>e.key,footer:a?void 0:(0,l.jsx)(`output`,{"aria-label":C,children:`Total`})},...i===void 0&&!o&&!c?[{key:`runs`,label:n===`pt-BR`?`Invocações`:`Agent invocations`,render:e=>e.run_count,align:`right`,footer:_.runs},...o?[]:[{key:`tasks`,label:o||s?n===`pt-BR`?`Tarefas com invocação`:`Tasks with invocations`:n===`pt-BR`?`Tarefas criadas`:`Tasks created`,render:e=>e.task_count??0,align:`right`,footer:_.tasks}]]:[{key:`prds`,label:`PRDs`,render:e=>m(e.prd_count),sortValue:e=>e.prd_count??0,align:`right`,footer:m(_.prds),description:jm(n,o?`PRDs com criação atribuída ao agente por Run registrado. Conta apenas vínculos observados, sem duplicar IDs.`:`PRDs criados por vínculo canônico com um único modelo financeiro observado. Sem essa prova, o indicador exibido é 0.`,`PRDs created through a canonical link to one observed financial model. Without that evidence, the displayed indicator is 0.`)},{key:`specs`,label:`SPECs`,render:e=>m(e.spec_count),sortValue:e=>e.spec_count??0,align:`right`,footer:m(_.specs),description:jm(n,o?`SPECs com criação atribuída ao agente por Run registrado. Conta apenas vínculos observados, sem duplicar IDs.`:`SPECs criadas por vínculo canônico com um único modelo financeiro observado. Sem essa prova, o indicador exibido é 0.`,`SPECs created through a canonical link to one observed financial model. Without that evidence, the displayed indicator is 0.`)},{key:`tasks`,label:o?n===`pt-BR`?`Tarefas`:`Tasks`:c?`Tasks`:n===`pt-BR`?`Tarefas criadas`:`Tasks created`,render:e=>m(e.task_count),sortValue:e=>e.task_count??0,align:`right`,footer:m(_.tasks),description:jm(n,o?`Tasks distintas em que o agente participou no período. Uma Task pode contar em vários agentes; o total soma essas participações entre agentes. Sem participação, mostra 0.`:`Tasks contam apenas quando creation_run_id tem um único modelo financeiro observável. Participação posterior não é criação; ausência ou multi-modelo exibe 0.`,`Tasks count only when creation_run_id has one observed financial model. Later participation is not creation; missing or multi-model linkage displays 0.`)},...c||i!==void 0?[{key:`conversations`,label:n===`pt-BR`?`Conversas com atividade`:`Conversations with activity`,render:e=>Lh($h(e),n),sortValue:e=>$h(e)??0,align:`right`,footer:Lh(_.conversations,n),description:jm(n,i===void 0?`Conversas canônicas, incluindo turns unassisted legados. Cada ID conta uma vez por modelo; um modelo múltiplo pode repetir. Run com Task e conversa de origem não cria Task adicional.`:`Conversas distintas com atividade no período, em todas as fases. Uma conversa ativa em vários dias conta uma vez no total do período. Ausência de dados é exibida como traço.`,`Canonical conversations, including legacy unassisted turns. Each ID counts once per model; a multi-model conversation may repeat. A Run with a Task and source conversation does not create an additional Task.`)}]:[],{key:`runs`,label:`Runs`,render:e=>e.run_count,sortValue:e=>e.run_count,align:`right`,footer:_.runs,description:jm(n,o?`Chamadas observadas atribuídas ao agente no período selecionado.`:`Runs financeiros observados neste modelo, sem distribuir ou duplicar custo, tokens e tempo entre modelos.`,`Observed financial Runs for this model, without allocating or duplicating cost, tokens, or time across models.`)},{key:`tests`,label:n===`pt-BR`?`Testes`:`Tests`,render:e=>m(e.test_count),sortValue:e=>e.test_count??0,align:`right`,footer:m(_.tests),description:jm(n,o?`Registros de testes distintos vinculados ao Run do agente no período. Revisões e outras validações não são contadas como testes.`:`Validações canônicas cuja artifact_run_id coincide com a Run registradora deste modelo; ausência de prova exibe 0.`,`Canonical validations whose artifact_run_id matches this model's registering Run; missing evidence displays 0.`)},{key:`evidences`,label:n===`pt-BR`?`Evidências`:`Evidence`,render:e=>m(e.evidence_count),sortValue:e=>e.evidence_count??0,align:`right`,footer:m(_.evidences),description:jm(n,o?`Evidências distintas vinculadas ao Run do agente no período. Conta apenas vínculos registrados.`:`Evidências canônicas cuja artifact_run_id coincide com a Run registradora deste modelo; o total não duplica a mesma evidência. Sem prova, exibe 0.`,`Canonical evidence whose artifact_run_id matches this model's registering Run; the total does not duplicate the same evidence. Missing proof displays 0.`)}],{key:`duration`,label:`Tempo`,render:e=>i!==void 0&&!Yh(e.duration)?h.disclose(`0`,!0):h.duration(e.duration),sortValue:e=>Yh(e.duration)?e.duration.known_sum:c?0:null,align:`right`,footer:(0,l.jsx)(`output`,{"aria-label":S,children:v}),...g},{key:`tokens`,label:`Tokens`,render:e=>{let t=Rh(c?e.total_tokens??0:e.total_tokens,n);return h.disclose(t,e.total_tokens===null)},sortValue:e=>c?e.total_tokens??0:e.total_tokens,align:`right`,footer:(0,l.jsx)(`output`,{"aria-label":S,children:y}),...g},{key:`cost`,label:o||c||i!==void 0?n===`pt-BR`?`Custos`:`Costs`:i===void 0?n===`pt-BR`?`Custo`:`Cost`:n===`pt-BR`?`Custos`:`Costs`,render:e=>{let n=t===`BRL`?e.estimated_brl:e.estimated_usd;return h.disclose(h.currency(n),n===null)},sortValue:e=>c?Zh(t,e.estimated_brl,e.estimated_usd)??0:Zh(t,e.estimated_brl,e.estimated_usd),align:`right`,footer:(0,l.jsx)(`output`,{"aria-label":S,children:x}),...g},...r?[{key:`trace`,label:``,render:e=>(0,l.jsx)(`button`,{"aria-label":`Abrir detalhes`,className:`cost-row-action`,onClick:t=>{t.stopPropagation(),r(e.key)},type:`button`,children:(0,l.jsx)(Eh,{})})}]:[]],defaultSort:o?{key:`cost`,direction:`desc`}:i===void 0?null:{key:`label`,direction:`desc`},locale:n,emptyMessage:p?n===`pt-BR`?`Carregando…`:`Loading…`:n===`pt-BR`?`Nenhum dado disponível.`:`No data available.`,pageSize:100,rowKey:e=>e.key,onRowClick:r===void 0?void 0:e=>r(e.key),rows:e,scrollLabel:Wm(n),showColumnInfo:!0,sortable:!0})}function ig({rows:e,onOpenRun:t,currency:n,locale:r,compact:i=!1,pagination:a}){let o=Xh(r,a!==void 0),s=t=>Mm(e.map(e=>e[t])),c=Mm(e.map(ag)),u=Nm(e),d=(0,l.jsx)(b,{columns:[{key:`startedAt`,label:r===`pt-BR`?`Data e hora`:`Date and time`,render:e=>Gm(e.started_at,r),footer:o},{key:`run`,label:r===`pt-BR`?`Invocação`:`Agent invocation`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.run_id}),(0,l.jsx)(`small`,{children:e.task_title})]})},{key:`origin`,label:r===`pt-BR`?`Origem`:`Origin`,render:e=>{let t=Qh(e);return(0,l.jsx)(`span`,{className:`cost-run-origin cost-run-origin-${t.tone}`,children:t.label})}},{key:`duration`,label:r===`pt-BR`?`Tempo`:`Time`,description:$(r,`duration`),render:e=>Uh(e.duration_ms,r),sortValue:e=>e.duration_ms,align:`right`,footer:Uh(u,r)},{key:`agent`,label:r===`pt-BR`?`Agente`:`Agent`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.agent_name}),(0,l.jsx)(`small`,{children:`${e.run_kind===`run`?r===`pt-BR`?`Invocação do orquestrador`:`Orchestrator invocation`:r===`pt-BR`?`Invocação delegada`:`Delegated invocation`} · ${e.run_purpose}`})]})},{key:`model`,label:`Modelo`,render:e=>{let t=Am(e);return t.detail===`-`?(0,l.jsx)(`strong`,{children:t.primary}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:t.primary}),(0,l.jsx)(`small`,{children:t.detail})]})}},{key:`effort`,label:r===`pt-BR`?`Esforço`:`Effort`,render:e=>Vm(e.effective_reasoning_effort,e.reasoning_effort,r)},{key:`speed`,label:r===`pt-BR`?`Velocidade`:`Speed`,render:e=>Hm(e.service_tier,r)},{key:`inputTokens`,label:r===`pt-BR`?`Input total`:`Total input`,description:$(r,`inputTokens`),render:e=>Vh(e.input_tokens,r),sortValue:e=>e.input_tokens,align:`right`,footer:Vh(s(`input_tokens`),r)},{key:`cachedInputTokens`,label:r===`pt-BR`?`Tokens cache`:`Cached tokens`,description:$(r,`cachedInputTokens`),render:e=>Vh(e.cached_input_tokens,r),sortValue:e=>e.cached_input_tokens,align:`right`,footer:Vh(s(`cached_input_tokens`),r)},{key:`outputTokens`,label:r===`pt-BR`?`Output total`:`Total output`,description:$(r,`outputTokens`),render:e=>Vh(e.output_tokens,r),sortValue:e=>e.output_tokens,align:`right`,footer:Vh(s(`output_tokens`),r)},{key:`reasoningTokens`,label:r===`pt-BR`?`Tokens raciocínio`:`Reasoning tokens`,description:$(r,`reasoningTokens`),render:e=>Vh(e.reasoning_tokens,r),sortValue:e=>e.reasoning_tokens,align:`right`,footer:Vh(s(`reasoning_tokens`),r)},{key:`totalTokens`,label:`Total tokens`,description:$(r,`totalTokens`),render:e=>Vh(ag(e),r),sortValue:e=>ag(e),align:`right`,footer:Vh(c,r)},{key:`inputRate`,label:`USD/M entrada`,description:$(r,`inputRate`),render:e=>Wh(e.input_rate_usd_per_million,r),align:`right`},{key:`cacheRate`,label:`USD/M cache`,description:$(r,`cacheRate`),render:e=>Wh(e.cached_input_rate_usd_per_million,r),align:`right`},{key:`outputRate`,label:`USD/M saída`,description:$(r,`outputRate`),render:e=>Wh(e.output_rate_usd_per_million,r),align:`right`},{key:`reasoningRate`,label:`USD/M raciocínio`,description:$(r,`reasoningRate`),render:e=>Wh(e.reasoning_rate_usd_per_million,r),align:`right`},{key:`contextMultiplier`,label:`Mult. contexto E/S`,description:$(r,`contextMultiplier`),render:e=>qh(e.context_input_multiplier,e.context_output_multiplier,r),align:`right`},{key:`speedMultiplier`,label:r===`pt-BR`?`Cenário velocidade API`:`API speed scenario`,description:jm(r,`Cenário de preço efetivo observado nesta Invocação de Agente. Priority/Fast pode elevar as tarifas em relação ao cenário Standard.`,`Effective pricing scenario observed in this Agent Invocation. Priority/Fast may increase rates compared with the Standard scenario.`),render:e=>km(e.service_tier,r),align:`right`,hidden:!(t=>!i||Pm(e,t))(e=>e.service_tier)},{key:`inputCost`,label:`USD entrada`,description:$(r,`inputCost`),render:e=>Gh(e.input_cost_usd,r),align:`right`,footer:Gh(s(`input_cost_usd`),r)},{key:`cacheCost`,label:`USD cache`,description:$(r,`cacheCost`),render:e=>Gh(e.cached_input_cost_usd,r),align:`right`,footer:Gh(s(`cached_input_cost_usd`),r)},{key:`outputCost`,label:`USD saída`,description:$(r,`outputCost`),render:e=>Gh(e.output_cost_usd,r),align:`right`,footer:Gh(s(`output_cost_usd`),r)},{key:`reasoningCost`,label:`USD raciocínio`,description:$(r,`reasoningCost`),render:e=>Gh(e.reasoning_cost_usd,r),align:`right`,footer:Gh(s(`reasoning_cost_usd`),r)},{key:`standardCost`,label:`USD padrão`,description:$(r,`standardCost`),render:e=>Gh(e.standard_cost_usd,r),align:`right`,footer:Gh(s(`standard_cost_usd`),r)},{key:`speedUplift`,label:`USD acréscimo rápido`,description:$(r,`speedUplift`),render:e=>Gh(e.speed_uplift_usd,r),align:`right`,footer:Gh(s(`speed_uplift_usd`),r)},{key:`finalUsd`,label:r===`pt-BR`?`USD estimado API`:`Estimated API USD`,description:$(r,`finalUsd`),render:e=>Gh(e.estimated_usd,r),align:`right`,footer:Gh(s(`estimated_usd`),r)},{key:`fxRate`,label:r===`pt-BR`?`Cotação atual`:`Current exchange rate`,description:$(r,`fxRate`),render:e=>Kh(e.fx_rate,r),align:`right`},{key:`recordedFxRate`,label:r===`pt-BR`?`Cotação no período`:`Period exchange rate`,description:$(r,`recordedFxRate`),render:e=>Kh(e.recorded_fx_rate,r),align:`right`},{key:`recordedBrl`,label:r===`pt-BR`?`Custo Final no Período`:`Period final cost`,description:$(r,`recordedBrl`),render:e=>Hh(e.recorded_brl,`BRL`,r),align:`right`,footer:Hh(s(`recorded_brl`),`BRL`,r)},{key:`cost`,label:r===`pt-BR`?`Custo Final atual`:`Current final cost`,description:$(r,`cost`),render:e=>Hh(n===`BRL`?e.estimated_brl:e.estimated_usd,n,r),sortValue:e=>Zh(n,e.estimated_brl,e.estimated_usd),align:`right`,footer:Hh(s(n===`BRL`?`estimated_brl`:`estimated_usd`),n,r)},{key:`trace`,label:``,render:e=>(0,l.jsx)(`button`,{"aria-label":`Abrir detalhes da invocação`,className:`cost-row-action`,onClick:n=>{n.stopPropagation(),t(e.run_id)},type:`button`,children:(0,l.jsx)(Eh,{})})}],locale:r,pageSize:a?null:100,rowKey:e=>e.run_id,onRowClick:e=>t(e.run_id),rows:e,scrollLabel:Um(r),showColumnInfo:!0,sortable:!0});return a?(0,l.jsxs)(l.Fragment,{children:[d,(0,l.jsx)(Dh,{locale:r,pagination:a})]}):d}function ag(e){return e.input_tokens!==null&&e.output_tokens!==null?e.input_tokens+e.output_tokens:e.total_tokens}function og(e,t){return t===`en-US`?e===`daily`?`Day`:e===`monthly`?`Month`:`Year`:e===`daily`?`Dia`:e===`monthly`?`Mês`:`Ano`}function sg({rows:e,currency:t,details:n,locale:r,totalDurationMs:i,onOpenTrace:a}){let[s,c]=(0,o.useState)(null),u=e=>c(e),d=e.reduce((e,t)=>e+t.task_count,0),f=e.reduce((e,t)=>e+t.run_count,0),p=ug(e.map(e=>e.duration_ms??cg(e,n?.runs??[]))),m=e.reduce((e,t)=>e+(t.usage.total.tokens.total??0),0),h=e.reduce((e,n)=>e+(t===`BRL`?n.usage.total.cost.brl??0:n.usage.total.cost.usd??0),0);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b,{columns:[{key:`createdAt`,label:r===`pt-BR`?`Data e hora`:`Date and time`,render:e=>e.created_at?Gm(e.created_at,r):`—`,footer:`Total`},{key:`entity`,label:`Entidade`,render:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:e.title}),(0,l.jsx)(`small`,{children:e.id})]})},{key:`status`,label:`Status`,render:e=>e.work_status},{key:`tasks`,label:`Tasks`,render:e=>e.task_count,align:`right`,footer:d},{key:`runs`,label:`Runs`,render:e=>e.run_count,align:`right`,footer:f},{key:`duration`,label:r===`pt-BR`?`Tempo`:`Time`,render:e=>{let t=e.duration_ms??cg(e,n?.runs??[]);return t===null||t===0?`0`:T(t,r)},align:`right`,footer:i==null?p===null||p===0?`0`:T(p,r):T(i,r)},{key:`tokens`,label:`Tokens`,render:e=>D(e.usage.total.tokens.total,r),align:`right`,footer:D(m,r)},{key:`cost`,label:`Custo`,render:e=>k(t===`BRL`?e.usage.total.cost.brl:e.usage.total.cost.usd,t,r),sortValue:e=>Zh(t,e.usage.total.cost.brl,e.usage.total.cost.usd),align:`right`,footer:k(h,t,r)},{key:`rework`,label:`Retrabalho`,render:e=>j(e.quality.rework_rate),align:`right`},{key:`actions`,label:``,render:e=>(0,l.jsx)(`button`,{"aria-label":`${r===`pt-BR`?`Abrir detalhes do`:`Open details for`} ${e.kind.toUpperCase()}`,className:`cost-row-action`,onClick:t=>{t.stopPropagation(),u(e)},type:`button`,children:(0,l.jsx)(dg,{})})}],locale:r,pageSize:100,rowKey:e=>e.id,onRowClick:u,rows:e,showColumnInfo:!0,sortable:!0}),s?(0,l.jsx)(Xu,{label:s.kind===`prd`?`PRD`:`SPEC`,locale:r,onClose:()=>c(null),onOpenTrace:e=>{c(null),a(e)},row:s,runs:n?.runs??[],specs:n?.specs??e.filter(e=>e.kind===`spec`),tasks:n?.tasks??[]}):null]})}function cg(e,t=[]){if(t.length===0)return null;let n=new Set(e.run_ids),r=new Map;for(let e of t)r.has(e.id)||r.set(e.id,e);let i=[...r.values()],a=t=>n.has(t.id)||(e.kind===`prd`?t.prd_id===e.id:t.spec_id===e.id),o=i.filter(e=>e.phase===`execution`&&(e.parent_run_id===null||!r.has(e.parent_run_id))&&a(e)),s=o.map(lg);return o.length===0||s.some(e=>e===null)?null:ug(s)}function lg(e){return typeof e.source_duration_ms==`number`?e.source_duration_ms:(e.duration_provenance===`observed`||e.duration_provenance===`legacy_inferred`||e.duration_provenance===`reconciled`)&&typeof e.duration_ms==`number`?e.duration_ms:null}function ug(e){let t=e.filter(e=>e!==null);return t.length===0?null:t.reduce((e,t)=>e+t,0)}function dg(){return(0,l.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`})]})}function fg(e,t){return e.query||t}function pg(e,t){return e===t}function mg(e,t){return e!==null&&e.slice(0,e.lastIndexOf(`\0`))===t.slice(0,t.lastIndexOf(`\0`))}function hg({locale:e,page:t}){return t.total_count===0?e===`pt-BR`?`Nenhum resultado`:`No results`:`${t.offset+1}–${Math.min(t.offset+t.limit,t.total_count)} ${e===`pt-BR`?`de`:`of`} ${t.total_count}`}function gg({active:e=!0,view:t,range:n,globalQuery:r,limit:i=50,filters:a,revision:s,load:c}){let[l,u]=(0,o.useState)(0),[d,f]=(0,o.useState)(null),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(null),[y,b]=(0,o.useState)(0),x=(0,o.useRef)(0),S=(0,o.useRef)(c);S.current=c;let C=fg(a,r),w=`${Object.values(a).join(`\0`)}\u0000${C}`,T=`${t}\u0000${i}\u0000${n?.from??``}\u0000${n?.to??``}\u0000${w}`,E=`${T}\u0000${l}\u0000${s}`,D=(0,o.useRef)({filters:a,limit:i,query:C,range:n,view:t});return D.current={filters:a,limit:i,query:C,range:n,view:t},(0,o.useEffect)(()=>{u(0)},[T]),(0,o.useEffect)(()=>{let t=++x.current;if(!e||!S.current){f(null),m(null),v(null),g(!1);return}let n=new AbortController,r=D.current;return g(!0),v(null),S.current({view:r.view,offset:l,limit:r.limit,...r.query?{query:r.query}:{},filters:r.filters,...r.range??{},signal:n.signal}).then(e=>{!n.signal.aborted&&t===x.current&&(f(e),m(E))}).catch(e=>{!n.signal.aborted&&t===x.current&&v(e instanceof Error?e.message:String(e))}).finally(()=>{!n.signal.aborted&&t===x.current&&g(!1)}),()=>n.abort()},[e,y,l,E]),{error:_,page:pg(p,E)?d:null,stalePage:mg(p,E)?d:null,loading:h,offset:l,retry:()=>b(e=>e+1),setOffset:u}}function _g({canonicalDurationTotal:e,compactPage:t,compactPageError:n,compactPageLoading:r,compactPageOffset:i,currency:a,detailError:o,detailLoading:s,developerPanel:c,dimensionalDetailPending:u,dimensionalRows:d,groups:f,groupPage:p,groupPageLoading:m,groupPageOffset:h,locale:g,macroDetails:_,onOpenRun:v,onOpenTrace:y,pagedRunRows:b,retryCompactPage:x,retryRunPage:S,rows:C,runPageData:w,runPageError:T,runPageLoading:E,runPageOffset:D,serverPagingEligible:O,setCompactPageOffset:k,setGroupPageOffset:A,setDetailAttempt:j,setRunPageOffset:ee,summaryUsage:M,summaryTotals:te,useAggregateGroups:ne,usingCompactPage:re,view:N,visibleExecutions:ie,visiblePrds:ae,visibleSpecs:oe}){let P=[`daily`,`monthly`,`annual`,`agents`,`models`,`providers`].includes(N)&&p!==null?(0,l.jsxs)(`nav`,{"aria-label":g===`pt-BR`?`Paginação de grupos`:`Group pagination`,className:`cost-page-controls`,children:[(0,l.jsx)(`button`,{disabled:m||h===0,onClick:()=>A(Math.max(0,h-p.limit)),type:`button`,children:g===`pt-BR`?`Anterior`:`Previous`}),(0,l.jsx)(`output`,{"aria-live":`polite`,children:hg({locale:g,page:p})}),(0,l.jsx)(`button`,{disabled:m||!p.has_more,onClick:()=>A(h+p.limit),type:`button`,children:g===`pt-BR`?`Próxima`:`Next`})]}):null;return(0,l.jsxs)(`section`,{"aria-busy":m||r||E||void 0,className:`cost-content cost-content-${N} ${N===`overview`?`cost-content-overview`:``}`,children:[s||u?(0,l.jsx)(`p`,{role:`status`,children:g===`pt-BR`?`Carregando dados…`:`Loading data…`}):null,o?(0,l.jsxs)(`p`,{role:`status`,children:[o,` `,(0,l.jsx)(`button`,{onClick:()=>j(e=>e+1),type:`button`,children:g===`pt-BR`?`Tentar novamente`:`Retry`})]}):null,N===`overview`&&!u&&!s&&o===null?(0,l.jsx)(ah,{currency:a,daily:f.daily,locale:g,models:f.models,rows:d,...ne?{summaryUsage:M}:{}}):null,N===`developers`?c:null,N===`agentCalls`?(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(ig,{currency:a,locale:g,onOpenRun:v,rows:O&&w!==null?b:C,...O&&(w?.run_page!==void 0||E||T!==null)?{pagination:{...w?.run_page??{offset:D,limit:10,total:null,has_more:!1},error:T,loading:E,onChange:ee,onRetry:S}}:{}})}):null,re?(0,l.jsx)(Jm,{locale:g,...N===`tasks`?{onOpenTrace:y}:{},pagination:{offset:t?.offset??i,limit:t?.limit??50,total:t?.total??null,has_more:t?.has_more??!1,loading:r,error:n,onChange:k,onRetry:x},rows:t?.rows??[],subtotal:t?.subtotal??null}):null,N===`executions`&&!re?(0,l.jsx)(Se,{locale:g,rows:ie}):null,N===`conversations`&&!re?(0,l.jsx)(rg,{currency:a,labelHeading:g===`pt-BR`?`Conversa`:`Conversation`,locale:g,rows:f.conversations}):null,N===`tasks`&&!re?(0,l.jsx)(rg,{currency:a,dateHeading:g===`pt-BR`?`Criada em`:`Created at`,labelHeading:g===`pt-BR`?`Tarefa`:`Task`,locale:g,onOpenTrace:y,rows:f.tasks}):null,N===`prds`&&!re?(0,l.jsx)(sg,{currency:a,locale:g,onOpenTrace:y,rows:ae,totalDurationMs:e,..._?{details:_}:{}}):null,N===`specs`&&!re?(0,l.jsx)(sg,{currency:a,locale:g,onOpenTrace:y,rows:oe,totalDurationMs:e,..._?{details:_}:{}}):null,[`providers`,`agents`,`models`].map(e=>N===e&&!u&&!s&&o===null?(0,l.jsxs)(`div`,{children:[(0,l.jsx)(rg,{currency:a,labelHeading:e===`models`?g===`pt-BR`?`Modelo LLM`:`LLM model`:e===`agents`?g===`pt-BR`?`Zaip Agentes`:`ZAIP agents`:g===`pt-BR`?`Provedor`:`Providers`,locale:g,loading:m,rows:f[e],...p?.totals===void 0?{}:{totals:p.totals},...e===`agents`?{showDateTime:!1,showAgentIdentity:!0}:e===`models`?{showDateTime:!1,showModelLifecycleDetails:!0}:e===`providers`?{showDateTime:!1,showInvocationTasks:!0}:{}},e),P]},e):null),N===`daily`||N===`monthly`||N===`annual`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ch,{currency:a,locale:g,loading:m,...p===null?{}:{average:p.period_averages?.[a]??null},period:N,rows:f[N]}),(0,l.jsx)(rg,{currency:a,locale:g,loading:m,period:N,rows:f[N],showDateTime:!1,totals:p?.totals??te}),P]}):null]})}function vg({groupError:e,locale:t,periodError:n,retryGroup:r}){return(0,l.jsxs)(l.Fragment,{children:[n?(0,l.jsx)(`p`,{className:`cost-period-error`,role:`status`,children:t===`pt-BR`?`Não foi possível carregar o período selecionado: ${n}`:`Could not load the selected period: ${n}`}):null,e?(0,l.jsxs)(`p`,{className:`cost-period-error`,role:`status`,children:[t===`pt-BR`?`Não foi possível carregar esta aba: ${e}`:`Could not load this tab: ${e}`,(0,l.jsx)(`button`,{onClick:r,type:`button`,children:t===`pt-BR`?`Tentar novamente`:`Try again`})]}):null]})}function yg({locale:e}){return e===`pt-BR`?(0,l.jsxs)(`svg`,{"aria-hidden":`true`,className:`cost-locale-flag`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`rect`,{fill:`#18864b`,height:`24`,rx:`5`,width:`24`}),(0,l.jsx)(`path`,{d:`m12 3.8 8.2 8.2L12 20.2 3.8 12 12 3.8Z`,fill:`#f6d64a`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`12`,fill:`#1b4f9c`,r:`4.2`}),(0,l.jsx)(`path`,{d:`M8.8 11.2c1.9-1 4.5-1 6.4 0`,fill:`none`,stroke:`#fff`,strokeWidth:`.8`})]}):(0,l.jsxs)(`svg`,{"aria-hidden":`true`,className:`cost-locale-flag`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`rect`,{fill:`#fff`,height:`24`,rx:`5`,width:`24`}),(0,l.jsx)(`path`,{d:`M0 3h24v3H0Zm0 6h24v3H0Zm0 6h24v3H0Zm0 6h24v3H0Z`,fill:`#bd3d44`}),(0,l.jsx)(`path`,{d:`M0 0h11v11H0Z`,fill:`#192f6b`}),(0,l.jsx)(`path`,{d:`m2.3 2.1.5 1 .9.1-.7.7.2 1-.9-.5-.9.5.2-1-.7-.7.9-.1.5-1Zm4 0 .5 1 .9.1-.7.7.2 1-.9-.5-.9.5.2-1-.7-.7.9-.1.5-1Z`,fill:`#fff`})]})}function bg(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`cost-locale-chevron`,fill:`none`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{d:`m6 9 6 6 6-6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`})})}function xg(){return(0,l.jsx)(`svg`,{"aria-hidden":`true`,className:`cost-filter-icon`,fill:`none`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{d:`M3 6h18M7 12h10m-7 6h4`})})}function Sg(){return(0,l.jsxs)(`svg`,{"aria-hidden":`true`,className:`cost-settings-icon`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,l.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.09a2 2 0 0 1 1 1.74v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2Z`}),(0,l.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}var Cg=new URL(`/assets/logo_novo_azul-BBx5pA2B.png`,``+import.meta.url).href;function wg(e,t){return e===t?null:t}function Tg({currency:e,filters:t,loading:n,locale:r,onCurrencyChange:i,onFiltersChange:a,onLocaleChange:o,onPopupChange:s,onPeriodChange:c,onRefresh:u,period:d,popup:f,text:p,updatedLabel:m,filtersAvailable:h}){let g=f===`filters`,_=f===`locale`,v=f===`settings`,y=e=>{o(e)};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`nav`,{"aria-label":`Navegação do Cost Monitor`,className:`cost-monitor-nav`,children:[(0,l.jsxs)(`div`,{className:`cost-monitor-brand`,children:[(0,l.jsx)(`strong`,{className:`cost-monitor-title`,children:p.title}),(0,l.jsx)(`small`,{className:`cost-last-updated`,children:m})]}),(0,l.jsx)(`img`,{alt:`ZAIP`,className:`cost-monitor-logo`,src:Cg}),(0,l.jsxs)(`div`,{className:`cost-nav-actions`,children:[(0,l.jsx)(`button`,{"aria-label":p.refresh,className:`cost-nav-icon cost-refresh-action`,disabled:n,onClick:u,type:`button`,children:`↻`}),(0,l.jsxs)(`div`,{className:`cost-nav-popup-anchor cost-filter-action`,children:[(0,l.jsxs)(`button`,{className:g?`cost-nav-button is-active`:`cost-nav-button`,onClick:()=>s(wg(f,`filters`)),type:`button`,children:[(0,l.jsx)(xg,{}),` `,p.filters]}),g?(0,l.jsx)(`div`,{className:`cost-nav-popup cost-nav-filter-popup`,children:(0,l.jsx)(Em,{available:h,hideQuery:!1,locale:r,onChange:a,value:t})}):null]}),(0,l.jsxs)(`div`,{className:`cost-nav-popup-anchor cost-locale-action`,children:[(0,l.jsxs)(`button`,{className:_?`cost-nav-button is-active`:`cost-nav-button`,onClick:()=>s(wg(f,`locale`)),type:`button`,children:[(0,l.jsx)(yg,{locale:r}),r===`pt-BR`?`PT-BR`:`EN-US`,(0,l.jsx)(bg,{})]}),_?(0,l.jsxs)(`div`,{className:`cost-nav-popup cost-nav-locale-popup`,children:[(0,l.jsxs)(`button`,{onClick:()=>y(`pt-BR`),type:`button`,children:[(0,l.jsx)(yg,{locale:`pt-BR`}),` Português do Brasil `,r===`pt-BR`?`✓`:``]}),(0,l.jsxs)(`button`,{onClick:()=>y(`en-US`),type:`button`,children:[(0,l.jsx)(yg,{locale:`en-US`}),` English `,r===`en-US`?`✓`:``]})]}):null]}),(0,l.jsxs)(`div`,{className:`cost-nav-popup-anchor cost-settings-action`,children:[(0,l.jsx)(`button`,{"aria-label":p.settings,className:v?`cost-nav-icon is-active`:`cost-nav-icon`,onClick:()=>s(wg(f,`settings`)),type:`button`,children:(0,l.jsx)(Sg,{})}),v?(0,l.jsxs)(`div`,{className:`cost-nav-popup cost-nav-settings-popup`,children:[(0,l.jsxs)(`div`,{className:`cost-mobile-settings`,children:[(0,l.jsx)(`small`,{className:`cost-mobile-updated`,children:m}),(0,l.jsxs)(`button`,{disabled:n,onClick:u,type:`button`,children:[`↻`,` `,n?r===`pt-BR`?`Atualizando…`:`Refreshing…`:p.refresh]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:r===`pt-BR`?`Idioma`:`Language`}),(0,l.jsxs)(`select`,{onChange:e=>y(e.target.value),value:r,children:[(0,l.jsx)(`option`,{value:`pt-BR`,children:`Português do Brasil`}),(0,l.jsx)(`option`,{value:`en-US`,children:`English`})]})]}),(0,l.jsxs)(`div`,{className:`cost-mobile-filters`,children:[(0,l.jsx)(`strong`,{children:p.filters}),(0,l.jsx)(Em,{available:h,hideQuery:!1,locale:r,onChange:a,value:t})]})]}),(0,l.jsxs)(`label`,{children:[(0,l.jsx)(`span`,{children:p.currency}),(0,l.jsxs)(`select`,{onChange:e=>i(e.target.value),value:e,children:[(0,l.jsx)(`option`,{value:`BRL`,children:`BRL · R$`}),(0,l.jsx)(`option`,{value:`USD`,children:`USD · $`})]})]})]}):null]})]})]}),(0,l.jsxs)(`header`,{className:`cost-hero`,children:[(0,l.jsx)(`p`,{className:`cost-hero-description`,children:p.subtitle}),(0,l.jsxs)(`label`,{className:`cost-period`,children:[(0,l.jsx)(`span`,{children:p.period}),(0,l.jsxs)(`select`,{onChange:e=>c(e.target.value),value:d,children:[(0,l.jsx)(`option`,{value:`all`,children:p.allTime}),(0,l.jsx)(`option`,{value:`7`,children:p.last7}),(0,l.jsx)(`option`,{value:`30`,children:p.last30}),(0,l.jsx)(`option`,{value:`90`,children:p.last90}),(0,l.jsx)(`option`,{value:`month`,children:p.thisMonth})]})]})]})]})}function Eg({overview:e,currency:t,locale:n}){let r=n===`pt-BR`,i=t===`BRL`?e.estimated_brl:e.estimated_usd;return(0,l.jsx)(`section`,{"aria-label":`Resumo de custos`,className:`cost-summary`,children:[[r?`Custo estimado`:`Estimated cost`,k(i,t,n),r?`Período atual`:`Current period`],[`Tokens`,D(e.total_tokens,n),r?`${D(e.known_tokens_per_cycle,n)} tokens/ciclo`:`${D(e.known_tokens_per_cycle,n)} tokens/cycle`],[r?`BRL registrado`:`Recorded BRL`,k(e.recorded_brl,`BRL`,n),r?`Histórico fixado no registro`:`Historical value fixed when recorded`],[r?`Tarefas criadas`:`Tasks created`,String(e.task_count),r?`${e.task_count} no período`:`${e.task_count} in period`],[r?`Invocações de Agentes`:`Agent Invocations`,String(e.run_count),r?`${e.event_count} segmentos de uso`:`${e.event_count} usage segments`]].map(([e,t,n])=>(0,l.jsxs)(`article`,{children:[(0,l.jsx)(`span`,{children:e}),(0,l.jsx)(`strong`,{children:t}),(0,l.jsx)(`small`,{children:n})]},e))})}function Dg({usingCompactPage:e,compactKind:t,loadReadModelPage:n,filters:r,compactPageRange:i,globalFilters:a}){return e&&t!==null&&n!==void 0?{prepare:async()=>{let e=await n({kind:t,offset:0,limit:50,filters:r,...i===void 0?{}:i,...a?.query?{query:a.query}:{}});return{totalRows:e.total,metadata:{source:e.data_source,snapshot_id:e.snapshot_id,source_latest_at:e.source_latest_at,filters:r,period:i??`all`,cost_semantics:t===`conversations`?`All phases linked to each conversation, not only the Conversation phase`:`Known costs attributed to each canonical entity`,subtotal:e.subtotal},pages:async function*(){let o=e,s=new Set;for(;;){let c=o.rows.filter(e=>s.has(e.id)?!1:(s.add(e.id),!0)).map(Xm);c.length>0&&(yield c);let l=o.offset+o.rows.length;if(l>=o.total||!o.has_more)return;if(o=await n({kind:t,offset:l,limit:o.limit,filters:r,...i===void 0?{}:i,...a?.query?{query:a.query}:{}}),e.snapshot_id!==null&&o.snapshot_id!==e.snapshot_id)throw Error(`Os dados mudaram durante a exportação. Atualize a página e exporte novamente.`)}}}}}:void 0}function Og(e,t){let n=t.query.trim().toLowerCase();return(!n||[e.run_id,e.task_title,e.model,e.requested_model,e.agent,e.agent_name].some(e=>e.toLowerCase().includes(n)))&&(!t.provider||om(e.provider)===t.provider)&&(!t.agent||e.agent_name===t.agent)&&(!t.model||e.model===t.model)&&(!t.status||e.task_status===t.status)&&(!t.priority||e.priority===t.priority)&&(!t.risk||e.risk===t.risk)&&(!t.phase||e.phase===t.phase)&&(!t.origin||e.origin===t.origin)&&(!t.workType||e.work_type===t.workType)}function kg(e,t){if(!t)return!0;let n=t.query.trim().toLocaleLowerCase(),r=!n||[e.run_id,e.task_id,e.task_title,e.provider,e.agent,e.agent_name,e.model,e.requested_model,e.phase].some(e=>e?.toLocaleLowerCase().includes(n));if(t.dateRange===void 0)return r;let i=sd(e.started_at,`day`)??e.started_at.slice(0,10);return i>=t.dateRange.start&&i<=t.dateRange.end&&r}function Ag(e,t,n=t,r=`all_invocations`){let i=Om(e,r),a=new Map;for(let n of e)a.set(t(n),[...a.get(t(n))??[],n]);return[...a].map(([e,t])=>{let a=um(i.filter(e=>t.includes(e)),r===`all_execution`?`all_execution`:`all_invocations`),o=new Set(t.flatMap(e=>e.task_id?[e.task_id]:[])).size;return{duration_ms:a.complete?a.known_sum:null,duration:a,key:e,label:n(t[0]),latest_started_at:t.reduce((e,t)=>t.started_at>e?t.started_at:e,t[0]?.started_at??``),run_count:t.length,task_count:o,tasksActive:o,taskDaysActive:o,prd_count:0,spec_count:0,evidence_count:0,test_count:0,event_count:t.reduce((e,t)=>e+(t.event_count??0),0),total_tokens:cm(t.map(e=>e.total_tokens)),estimated_usd:cm(t.map(e=>e.estimated_usd)),estimated_brl:cm(t.map(e=>e.estimated_brl)),coverage:t.reduce((e,t)=>({events:e.events+t.coverage.events,tokens:e.tokens+t.coverage.tokens,usd:e.usd+t.coverage.usd,brl:e.brl+t.coverage.brl}),{events:0,tokens:0,usd:0,brl:0})}}).sort((e,t)=>t.latest_started_at.localeCompare(e.latest_started_at))}function jg(e,t){if(t===void 0)return!0;let n=t.query.trim().toLowerCase();if(n&&![e.id??``,e.title??``].some(e=>e.toLowerCase().includes(n)))return!1;if(t.dateRange===void 0)return!0;if(e.created_at===null)return!1;let r=sd(e.created_at,`day`)??e.created_at.slice(0,10);return r>=t.dateRange.start&&r<=t.dateRange.end}async function Mg({from:e,to:t,signal:n,fetcher:r=fetch}){let i=new URLSearchParams;e&&i.set(`from`,e),t&&i.set(`to`,t);let a=await r(`/api/v2/developers${i.size===0?``:`?${i}`}`,{...n===void 0?{}:{signal:n}});if(!a.ok)throw Error(`HTTP ${a.status}`);return(await a.json()).rows??[]}function Ng({from:e,to:t,locale:n}){let[r,i]=(0,o.useState)({loading:!0,error:null,rows:[]});return(0,o.useEffect)(()=>{let n=new AbortController;return i(e=>({...e,loading:!0,error:null})),Mg({...e===void 0?{}:{from:e},...t===void 0?{}:{to:t},signal:n.signal}).then(e=>i({loading:!1,error:null,rows:e})).catch(e=>{e.name!==`AbortError`&&i({loading:!1,error:e instanceof Error?e.message:`unknown`,rows:[]})}),()=>n.abort()},[e,t]),r.loading?(0,l.jsx)(`p`,{className:`operations-empty`,role:`status`,children:n===`pt-BR`?`Carregando desenvolvedores…`:`Loading developers…`}):r.error?(0,l.jsxs)(`p`,{className:`operations-empty`,role:`alert`,children:[n===`pt-BR`?`Não foi possível carregar desenvolvedores.`:`Could not load developers.`,` `,r.error]}):(0,l.jsx)(Ph,{locale:n,rows:r.rows})}function Pg({locale:e,range:t,view:n}){return n===`developers`?(0,l.jsx)(Ng,{locale:e,...t===void 0?{}:t}):null}function Fg({locale:e,selectedRun:t,onClose:n}){return t?(0,l.jsx)(oe,{details:{kind:`run`,row:t},locale:e,onClose:n}):null}var Ig={"pt-BR":{back:`Voltar - Dashboard`,title:`ZAIP Cost Monitor`,subtitle:`Visão Git-native de Custos, Tokens e Tempo de cada Tarefa, SPEC ou PRD.`,refresh:`Atualizar`,refreshing:`Atualizando…`,filters:`Filtros`,settings:`Configurações`,language:`Idioma`,currency:`Moeda`,kicker:`ZAIP-AIOS • COST MONITOR`,heading:`Custos e tokens`,intro:`Telemetria derivada localmente, atribuída por invocação de agente, tarefa, fase e origem.`,period:`Período`,allTime:`Todo o período`,last7:`Últimos 7 dias`,last30:`Últimos 30 dias`,last90:`Últimos 90 dias`,thisMonth:`Este mês`,noData:`Sem dados no filtro atual.`,tabs:{overview:`Visão geral`,models:`Modelos LLM`,agentCalls:`Invocações de Agentes`,executions:`Execuções`,conversations:`Conversas`,tasks:`Tarefas`,prds:`PRD`,specs:`SPEC`,providers:`Provedores`,agents:`Zaip Agentes`,daily:`Diário`,monthly:`Mensal`,annual:`Anual`,developers:`Desenvolvedores`}},"en-US":{back:`Back - Dashboard`,title:`ZAIP Cost Monitor`,subtitle:`Git-native view of Costs, Tokens and Time for each Task, SPEC, or PRD.`,refresh:`Refresh`,refreshing:`Refreshing…`,filters:`Filters`,settings:`Settings`,language:`Language`,currency:`Currency`,kicker:`ZAIP-AIOS • COST MONITOR`,heading:`Costs and tokens`,intro:`Locally derived telemetry attributed by agent invocation, task, phase, and origin.`,period:`Period`,allTime:`All time`,last7:`Last 7 days`,last30:`Last 30 days`,last90:`Last 90 days`,thisMonth:`This month`,noData:`No data for the current filter.`,tabs:{overview:`Overview`,models:`Models`,agentCalls:`Agent Invocations`,executions:`Executions`,conversations:`Conversations`,tasks:`Tasks`,prds:`PRDs`,specs:`SPECs`,providers:`Providers`,agents:`Agents`,daily:`Daily`,monthly:`Monthly`,annual:`Annual`,developers:`Developers`}}};function Lg(e){return e===`pt-BR`?`BRL`:`USD`}function Rg(e){let{developerAttributionRange:t,filters:n,globalFilters:r,groupPageRange:i,loadGroupPage:a,view:o}=e;return{developerExportSource:o===`developers`?{prepare:async()=>{let e=await Mg({...t===void 0?{}:t});return{totalRows:e.length,pages:async function*(){yield e}}}}:void 0,costGroupExportSource:(o===`daily`||o===`monthly`||o===`annual`||o===`agents`||o===`models`||o===`providers`)&&a!==void 0?{prepare:async()=>{let e=n.query||r?.query||``,t=await a({view:o,offset:0,limit:50,filters:n,...e?{query:e}:{},...i===void 0?{}:i});return{totalRows:t.total_count,metadata:{source:`cost-${o}`,snapshot_id:t.snapshot_id??null,snapshot_updated_at:t.snapshot_updated_at??null,filters:{...n,query:e},period:i??`all`,distinct_conversations:t.totals?.conversation_count??null,conversation_semantics:`Distinct conversations with activity in the selected period; daily counts must not be summed`},pages:async function*(){let r=t;for(;;){if(r.rows.length===0)return;yield r.rows;let s=r.offset+r.rows.length;if(s>=r.total_count||!r.has_more)return;r=await a({view:o,offset:s,limit:r.limit,filters:n,...e?{query:e}:{},...i===void 0?{}:i});let c=t.snapshot_id??t.snapshot_updated_at;if(c!=null&&c!==(r.snapshot_id??r.snapshot_updated_at))throw Error(`Os dados mudaram durante a exportação. Atualize a página e exporte novamente.`)}}}}}:void 0}}function zg(e,t){return e.find(e=>e.id===t)??null}function Bg(e,t){return e===t}function Vg(e,t){return t??e}function Hg(e,t,n){t(e),n(Lg(e))}function Ug(e,t,n){let r=zg(t,e);r&&n(r)}function Wg(e){let t=(0,o.useRef)({data:e,revision:0});return t.current.data!==e&&(t.current={data:e,revision:t.current.revision+1}),t.current.revision}var Gg=e=>e===`daily`||e===`monthly`||e===`annual`||e===`agents`||e===`models`||e===`providers`?e:null;function Kg(e,t){if(e.length===0)return{...t,run_count:0,task_count:0,event_count:0,total_tokens:null,estimated_usd:null,estimated_brl:null,recorded_usd:null,recorded_brl:null,average_run_cost_usd:null,average_run_cost_brl:null,average_run_duration_ms:null,known_tokens_per_cycle:null,top_10_token_share:null,coverage:{events:0,tokens:0,usd:0,brl:0}};let n=e.reduce((e,t)=>({events:e.events+t.coverage.events,tokens:e.tokens+t.coverage.tokens,usd:e.usd+t.coverage.usd,brl:e.brl+t.coverage.brl}),{events:0,tokens:0,usd:0,brl:0}),r=e.filter(e=>e.total_tokens!==null),i=r.reduce((e,t)=>e+(t.total_tokens??0),0),a=r.reduce((e,t)=>e+(t.event_count??0),0),o=[...r].sort((e,t)=>(t.total_tokens??0)-(e.total_tokens??0)).slice(0,10).reduce((e,t)=>e+(t.total_tokens??0),0);return{task_count:new Set(e.flatMap(e=>e.task_id?[e.task_id]:[])).size,run_count:e.length,event_count:e.reduce((e,t)=>e+(t.event_count??0),0),total_tokens:cm(e.map(e=>e.total_tokens)),estimated_usd:cm(e.map(e=>e.estimated_usd)),estimated_brl:cm(e.map(e=>e.estimated_brl)),recorded_usd:cm(e.map(e=>e.recorded_usd)),recorded_brl:cm(e.map(e=>e.recorded_brl)),average_run_cost_usd:sm(e.map(e=>e.estimated_usd)),average_run_cost_brl:sm(e.map(e=>e.estimated_brl)),average_run_duration_ms:qg(Om(e).map(e=>e.duration_ms)),known_tokens_per_cycle:a===0?null:i/a,top_10_token_share:i===0?null:o/i,coverage:n}}function qg(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0)/t.length:null}var Jg=`daily`,Yg=[`daily`,`monthly`,`annual`,`developers`,`overview`,`executions`,`agentCalls`,`agents`,`models`,`providers`,`tasks`,`specs`,`prds`,`conversations`];function Xg({embedded:e,globalDateRange:t,period:n,runPageRange:r}){if(!(e&&t===void 0&&n===`month`))return r}function Zg(e){return Xg(e)}function Qg(e){return e===`tasks`||e===`specs`||e===`prds`||e===`executions`||e===`conversations`?e:null}function $g(e,t){return e!==null&&e.slice(0,e.lastIndexOf(`\0`))===t.slice(0,t.lastIndexOf(`\0`))}function e_({view:e,load:t,limit:n=50,range:r,query:i,filters:a,revision:s}){let[c,l]=(0,o.useState)(0),[u,d]=(0,o.useState)(null),[f,p]=(0,o.useState)(null),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(null),[v,y]=(0,o.useState)(0),b=(0,o.useRef)(0),x=(0,o.useRef)(t);x.current=t;let S=t!==void 0,C=r?.from,w=r?.to,T=Object.values(a).join(`\0`),E=`${e}\u0000${n}\u0000${i??``}\u0000${C??``}\u0000${w??``}\u0000${T}`,D=`${E}\u0000${c}\u0000${s}`,O=(0,o.useRef)({filters:a,limit:n,query:i,rangeFrom:C,rangeTo:w});return O.current={filters:a,limit:n,query:i,rangeFrom:C,rangeTo:w},(0,o.useEffect)(()=>{l(0)},[E]),(0,o.useEffect)(()=>{let t=Qg(e);if(t===null||!S){d(null),_(null),h(!1);return}let n=new AbortController,r=++b.current;h(!0),_(null);let i=x.current;if(i===void 0)return;let a=O.current;return i({kind:t,offset:c,limit:a.limit,...a.rangeFrom===void 0||a.rangeTo===void 0?{}:{from:a.rangeFrom,to:a.rangeTo},...a.query?{query:a.query}:{},filters:a.filters,signal:n.signal}).then(e=>{!n.signal.aborted&&r===b.current&&(d({...e,rows:e.rows.map(Xm)}),p(D))}).catch(e=>{!n.signal.aborted&&r===b.current&&_(e instanceof Error?e.message:String(e))}).finally(()=>{!n.signal.aborted&&r===b.current&&h(!1)}),()=>n.abort()},[v,S,c,D,e]),{compactPageOffset:c,setCompactPageOffset:l,compactPage:f===D?u:null,staleCompactPage:$g(f,D)?u:null,compactPageLoading:m,compactPageError:g,retryCompactPage:()=>y(e=>e+1)}}function t_({view:e,eligible:t,currency:n,filters:r,globalQuery:i,limit:a=10,range:s,refresh:c,revision:l,load:u}){let[d,f]=(0,o.useState)(0),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(null),[y,b]=(0,o.useState)(0),x=(0,o.useRef)(0),S=(0,o.useRef)(u);S.current=u;let C=s?.from,w=s?.to,T={...r,query:r.query||i},E=`${Object.values(T).join(`\0`)}\u0000${C??``}\u0000${w??``}`,D=`${e}\u0000${t}\u0000${n}\u0000${a}\u0000${E}\u0000${c??``}\u0000${l}`,O=(0,o.useRef)({view:e,eligible:t,currency:n,effectiveFilters:T,rangeFrom:C,rangeTo:w,refresh:c,limit:a});return O.current={view:e,eligible:t,currency:n,effectiveFilters:T,rangeFrom:C,rangeTo:w,refresh:c,limit:a},(0,o.useEffect)(()=>{f(0)},[E]),(0,o.useEffect)(()=>{let e=O.current;if(e.view!==`agentCalls`||!e.eligible){m(null),v(null),g(!1);return}let t=new AbortController,n=++x.current;return g(!0),v(null),(S.current??vm)({currency:e.currency,filters:e.effectiveFilters,...e.rangeFrom===void 0||e.rangeTo===void 0?{}:{from:e.rangeFrom,to:e.rangeTo},offset:d,limit:e.limit,refresh:e.refresh,signal:t.signal}).then(e=>{!t.signal.aborted&&Bg(n,x.current)&&m(e)}).catch(e=>{!t.signal.aborted&&Bg(n,x.current)&&v(e instanceof Error?e.message:String(e))}).finally(()=>{!t.signal.aborted&&Bg(n,x.current)&&g(!1)}),()=>t.abort()},[y,d,D]),{runPageOffset:d,setRunPageOffset:f,runPageData:p,runPageLoading:h,runPageError:_,retryRunPage:()=>b(e=>e+1)}}function n_(e){return e!==`overview`}function r_({embedded:e,globalDateRange:t,runPageRange:n}){return e&&t===void 0?void 0:n}function i_(e,t){let n=new Set(t.flatMap(e=>e.execution_id===null?[]:[e.execution_id]));return e.filter(e=>n.has(e.id))}function a_(e,t=``){return t===``||e.query===``}function o_({capabilityNavigation:e,data:t,dashboardTitle:n=`Dashboard ZAIP AIOS`,embedded:r=!1,globalFilters:i,lastUpdatedAt:a,locale:s,loading:c,onLoadingChange:u,onLocaleChange:f,onOpenTrace:p,onActiveDataChange:m,onRefresh:h,loadDetail:g=_m,loadRunPage:_,loadReadModelPage:v,loadGroupPage:y,loadPeriod:b=gm,operations:x,repositoryName:S,currency:C,onCurrencyChange:w}){let[T,E]=(0,o.useState)(Jg),[D,O]=(0,o.useState)(Tm),[k,A]=(0,o.useState)(`BRL`),j=C??k,ee=e=>{A(e),w?.(e)},[M,te]=(0,o.useState)(bm),[ne,re]=(0,o.useState)(null),[N,ie]=(0,o.useState)(null),[ae,oe]=(0,o.useState)(null),[P,F]=(0,o.useState)(!1),[se,ce]=(0,o.useState)(null),[le,ue]=(0,o.useState)(0),de=Wg(t),fe=(0,o.useRef)(g);fe.current=g;let I=Ig[s],pe=(0,o.useMemo)(()=>({...D,query:D.query||i?.query||``}),[D,i?.query]),{activeData:L,periodError:me,periodLoading:he}=Sm({currency:j,data:t,...i===void 0?{}:{dateRange:i.dateRange},filters:pe,lastUpdatedAt:a,loadPeriod:b,period:M,snapshotBacked:r}),ge=Object.values(D).some(e=>e!==``),_e=i?.dateRange===void 0?xm(M):{from:i.dateRange.start,to:i.dateRange.end},ve=Xg({embedded:r,globalDateRange:i?.dateRange,hasLocalCostFilters:ge,period:M,runPageRange:_e}),R=r_({embedded:r,...i?.dateRange===void 0?{}:{globalDateRange:i.dateRange},..._e===void 0?{}:{runPageRange:_e}}),ye=Zg({embedded:r,globalDateRange:i?.dateRange,hasLocalCostFilters:ge,period:M,runPageRange:_e}),z=Gg(T),be=gg({active:z!==null,view:z??`daily`,...ve===void 0?{}:{range:ve},globalQuery:i?.query??``,filters:D,limit:10,revision:de,...z===null?{}:{load:y}}),B=be.page??be.stalePage,{compactPageOffset:xe,setCompactPageOffset:Se,compactPage:Ce,staleCompactPage:we,compactPageLoading:Te,compactPageError:Ee,retryCompactPage:De}=e_({view:T,load:v,limit:10,range:ye,query:i?.query,filters:D,revision:de}),Oe=a_(D,i?.query??``),{runPageOffset:ke,setRunPageOffset:Ae,runPageData:je,runPageLoading:V,runPageError:Me,retryRunPage:Ne}=t_({view:T,eligible:T===`agentCalls`&&Oe,currency:j,filters:D,globalQuery:i?.query??``,limit:10,range:ve,refresh:a,revision:de,load:_});(0,o.useEffect)(()=>u?.(c||he||V||be.loading||Te||P),[Te,P,be.loading,c,u,he,V]),(0,o.useEffect)(()=>()=>u?.(!1),[u]),(0,o.useEffect)(()=>{ge||m?.(L)},[L,ge,m]);let Pe=a===null?s===`pt-BR`?`Aguardando atualização`:`Waiting for refresh`:`${s===`pt-BR`?`Atualizado`:`Updated`} ${new Intl.DateTimeFormat(s,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(a))}`,H=(0,o.useMemo)(()=>L.runs.filter(e=>Og(e,D)&&kg(e,i)).sort((e,t)=>t.started_at.localeCompare(e.started_at)),[L.runs,D,i]),Fe=_e?.from,Ie=_e?.to;(0,o.useEffect)(()=>{oe(null),F(!1),ce(null)},[j,le,D,a,Fe,Ie]);let Le=(0,o.useMemo)(()=>je?.runs??[],[je?.runs]),Re=(0,o.useMemo)(()=>Vg(H,ae?.runs).filter(e=>Og(e,D)&&kg(e,i)).sort((e,t)=>t.started_at.localeCompare(e.started_at)),[ae?.runs,D,i,H]),ze=(0,o.useMemo)(()=>{if(x===void 0)return;let e=new Set(H.map(e=>e.run_id));return{...x,runs:x.runs.filter(t=>e.has(t.id))}},[x,H]),U=(0,o.useMemo)(()=>({prds:L.prds.filter(e=>jg(e,i)),specs:L.specs.filter(e=>jg(e,i)),tasks:(x?.tasks??[]).filter(e=>jg(e,i)),evidences:(x?.evidences??[]).filter(e=>jg({created_at:e.observed_at},i)),validations:(x?.validations??[]).filter(e=>jg({created_at:e.executed_at},i))}),[L.prds,L.specs,i,x?.evidences,x?.tasks,x?.validations]),Be=U.prds,Ve=U.specs,He=L.aggregate_only===!0&&Re.length===0,Ue=(0,o.useMemo)(()=>He?L.groups:{conversations:Ag(Re,e=>e.conversation_id??e.task_title??e.run_id,void 0,`all_invocations`),tasks:fm(U.tasks,Re),providers:Ag(Re,e=>om(e.provider),void 0,`all_invocations`),agents:im(Ag(Re,e=>e.agent_name),L.configured_agents),models:Ag(Re,e=>e.model),daily:bh(Ag(H,e=>{let t=e.finished_at??e.started_at;return sd(t,`day`)??t.slice(0,10)},void 0,`all_invocations`),U,`daily`),monthly:bh(Ag(H,e=>{let t=e.finished_at??e.started_at;return sd(t,`month`)??t.slice(0,7)},void 0,`all_invocations`),U,`monthly`),annual:bh(Ag(H,e=>{let t=e.finished_at??e.started_at;return sd(t,`year`)??t.slice(0,4)},void 0,`all_invocations`),U,`annual`)},[L.configured_agents,U,Re,H,He,L.groups]),We=(0,o.useMemo)(()=>z===null?Ue:{...Ue,[z]:B===null?[]:z===`agents`&&y===void 0?im(B.rows,L.configured_agents):[...B.rows]},[L.configured_agents,B,Ue,z,y]),Ge=He?L.overview:{...Kg(H,L.overview),task_count:U.tasks.length},Ke=Ue.annual.reduce((e,t)=>e+t.duration.known_sum,0),W=x?.summary.overview_metrics,qe=W?W.duration_ms:Ke,Je={run_count:Ge.run_count,task_count:W?.task_count??Ge.task_count,prd_count:W?.prd_count??W?.selected_counts?.prds??0,spec_count:W?.spec_count??W?.selected_counts?.specs??0,evidence_count:0,test_count:0,event_count:Ge.event_count,total_tokens:W?.tokens??Ge.total_tokens,estimated_usd:Ge.estimated_usd,estimated_brl:W?.cost_brl??Ge.estimated_brl,duration_ms:qe,duration:{known_sum:qe??0,unknown:+(qe===null),complete:qe!==null,coverage_ratio:qe===null?0:1}},Ye=(0,o.useMemo)(()=>i_(x?.executions??[],H),[x?.executions,H]),Xe=Qg(T),Ze=Xe!==null&&v!==void 0,Qe=(0,o.useMemo)(()=>Ze?Ce?.rows??we?.rows??[]:T===`developers`?[]:T===`executions`?Ye:T===`conversations`?Ue.conversations:T===`tasks`?Ue.tasks:T===`prds`?Be:T===`specs`?Ve:T===`providers`||T===`agents`||T===`daily`||T===`monthly`||T===`annual`?Ue[T]:H,[Ce?.rows,Ue,H,Ze,we?.rows,T,Ye,Be,Ve]),$e=Dg({usingCompactPage:Ze,compactKind:Xe,loadReadModelPage:v,filters:D,compactPageRange:ye,globalFilters:i}),et=T===`agentCalls`&&Oe&&_!==void 0?{prepare:async()=>{let e={...D,query:D.query||i?.query||``},t=await _({currency:j,filters:e,...ve===void 0?{}:ve,limit:100,offset:0,refresh:a});return{totalRows:t.run_page.total??t.runs.length,pages:async function*(){let n=t;for(;;){if(n.runs.length===0)return;yield n.runs;let t=n.run_page.offset+n.runs.length;if(n.run_page.total!==null&&t>=n.run_page.total||!n.run_page.has_more)return;n=await _({currency:j,filters:e,...ve===void 0?{}:ve,limit:100,offset:t,refresh:a})}}}}}:void 0,{developerExportSource:tt,costGroupExportSource:nt}=Rg({developerAttributionRange:R,filters:D,globalFilters:i,groupPageRange:ve,loadGroupPage:y,view:T}),rt=e=>Hg(e,f,ee),it=e=>Ug(e,x?.runs??[],ie);return(0,l.jsxs)(r?`section`:`main`,{className:r?`cost-page cost-page-embedded`:`cost-page`,children:[r?null:(0,l.jsx)(d,{filters:(0,l.jsx)(Em,{available:t.filters_available,hideQuery:r,locale:s,onChange:O,value:D}),filtersActive:Object.values(D).some(Boolean),lastUpdatedAt:a,snapshotUpdatedAt:x?.summary.projection_updated_at??null,loading:c||he,locale:s,onLocaleChange:rt,onRefresh:h,settings:(0,l.jsxs)(`label`,{children:[` `,(0,l.jsx)(`span`,{children:I.currency}),` `,(0,l.jsxs)(`select`,{onChange:e=>ee(e.target.value),value:j,children:[(0,l.jsx)(`option`,{value:`BRL`,children:`BRL · R$`}),` `,(0,l.jsx)(`option`,{value:`USD`,children:`USD · $`}),` `]}),` `]}),...S===void 0?{}:{repositoryName:S},title:n}),` `,(0,l.jsx)(vg,{groupError:z===null?null:be.error,locale:s,periodError:me,retryGroup:be.retry}),` `,r?null:(0,l.jsx)(Tg,{currency:j,filters:D,filtersAvailable:t.filters_available,loading:c,locale:s,onCurrencyChange:ee,onFiltersChange:O,onLocaleChange:rt,onPopupChange:re,onPeriodChange:te,onRefresh:h,period:M,popup:ne,text:I,updatedLabel:Pe}),` `,r?null:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Eg,{currency:j,locale:s,overview:Ge}),` `,e,` `]}),` `,(0,l.jsxs)(`div`,{className:`cost-tabs-bar`,children:[` `,(0,l.jsxs)(`nav`,{"aria-label":`Visões de custo`,className:`cost-tabs`,children:[` `,Yg.map(e=>(0,l.jsxs)(`button`,{"aria-pressed":T===e,className:T===e?`is-active`:void 0,onClick:()=>{E(e)},type:`button`,children:[` `,I.tabs[e],` `]},e)),` `]}),` `,n_(T)?(0,l.jsxs)(`div`,{className:`cost-tab-export`,children:[` `,(0,l.jsx)(lu,{filters:{...i,...pe,period:M},pageSource:$e??et??tt??nt,rows:Qe,view:`cost-${T}`}),` `]}):null]}),` `,(0,l.jsx)(_g,{canonicalDurationTotal:Ke,compactPage:Ce??we,compactPageError:Ee,compactPageLoading:Te,compactPageOffset:xe,currency:j,detailError:se,detailLoading:P,developerPanel:(0,l.jsx)(Pg,{locale:s,range:R,view:T}),dimensionalDetailPending:!1,dimensionalRows:Re,groups:We,groupPage:z===null?null:B,groupPageLoading:z!==null&&be.loading,groupPageOffset:be.offset,setGroupPageOffset:be.setOffset,locale:s,macroDetails:ze,onOpenRun:it,onOpenTrace:p,pagedRunRows:Le,retryCompactPage:De,retryRunPage:Ne,rows:H,runPageData:je,runPageError:Me,runPageLoading:V,runPageOffset:ke,serverPagingEligible:Oe,setCompactPageOffset:Se,setDetailAttempt:ue,setRunPageOffset:Ae,summaryUsage:L.usage,summaryTotals:Je,useAggregateGroups:He,usingCompactPage:Ze,view:T,visibleExecutions:Ye,visiblePrds:Be,visibleSpecs:Ve}),` `,(0,l.jsx)(Fg,{locale:s,onClose:()=>ie(null),selectedRun:N}),` `]})}export{T as C,r as E,k as S,a as T,vc as _,sd as a,oe as b,dl as c,tl as d,$c as f,Gc as g,Xc as h,dd as i,ll as l,Zc as m,Xp as n,Xu as o,Qc as p,Yp as r,fl as s,o_ as t,ol as u,bc as v,c as w,D as x,fc as y};