@zaip-ai/cli 1.0.7 → 1.3.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 (444) hide show
  1. package/README.md +6 -4
  2. package/dist/services/adapters.d.ts +1 -1
  3. package/dist/services/adapters.d.ts.map +1 -1
  4. package/dist/services/adapters.js +15 -5
  5. package/dist/services/adapters.js.map +1 -1
  6. package/dist/services/adapters.test.js +1 -1
  7. package/dist/services/agent-adapters.d.ts +9 -0
  8. package/dist/services/agent-adapters.d.ts.map +1 -1
  9. package/dist/services/agent-adapters.js +39 -4
  10. package/dist/services/agent-adapters.js.map +1 -1
  11. package/dist/services/agent-adapters.test.js +13 -1
  12. package/dist/services/agent-adapters.test.js.map +1 -1
  13. package/dist/services/codex-config-template.d.ts +2 -1
  14. package/dist/services/codex-config-template.d.ts.map +1 -1
  15. package/dist/services/codex-config-template.js +13 -2
  16. package/dist/services/codex-config-template.js.map +1 -1
  17. package/dist/services/codex-rules.d.ts +1 -1
  18. package/dist/services/codex-rules.d.ts.map +1 -1
  19. package/dist/services/codex-rules.js +31 -7
  20. package/dist/services/codex-rules.js.map +1 -1
  21. package/dist/services/codex-subagent-hook-template.d.ts +1 -1
  22. package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
  23. package/dist/services/codex-subagent-hook-template.js +4 -1
  24. package/dist/services/codex-subagent-hook-template.js.map +1 -1
  25. package/dist/services/doctor.d.ts.map +1 -1
  26. package/dist/services/doctor.js +3 -1
  27. package/dist/services/doctor.js.map +1 -1
  28. package/dist/services/global-codex-config.d.ts +6 -3
  29. package/dist/services/global-codex-config.d.ts.map +1 -1
  30. package/dist/services/global-codex-config.js +82 -13
  31. package/dist/services/global-codex-config.js.map +1 -1
  32. package/dist/services/global-codex-config.test.js +57 -10
  33. package/dist/services/global-codex-config.test.js.map +1 -1
  34. package/dist/services/install-agents-template.d.ts.map +1 -1
  35. package/dist/services/install-agents-template.js +15 -2
  36. package/dist/services/install-agents-template.js.map +1 -1
  37. package/dist/services/logger.js +1 -1
  38. package/dist/services/logger.js.map +1 -1
  39. package/dist/services/logger.test.js +3 -3
  40. package/dist/services/logger.test.js.map +1 -1
  41. package/dist/services/runtime-template.test.js +21 -5
  42. package/dist/services/runtime-template.test.js.map +1 -1
  43. package/dist/services/template-manifest.d.ts.map +1 -1
  44. package/dist/services/template-manifest.js +7 -0
  45. package/dist/services/template-manifest.js.map +1 -1
  46. package/package.json +1 -1
  47. package/templates/.agents/architecture/software-architecture.md +131 -0
  48. package/templates/.agents/branding/brandbook.docx +0 -0
  49. package/templates/.agents/branding/brandbook.md +60 -0
  50. package/templates/.agents/config/agents/catalog.yaml +310 -10
  51. package/templates/.agents/config/clients/codex/agents/zaip-agent-brand-strategist.toml +30 -0
  52. package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +5 -5
  53. package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +2 -2
  54. package/templates/.agents/config/clients/codex/agents/zaip-agent-general-operations.toml +30 -0
  55. package/templates/.agents/config/clients/codex/agents/zaip-agent-governance-compliance.toml +30 -0
  56. package/templates/.agents/config/clients/codex/agents/zaip-agent-growth-strategist.toml +30 -0
  57. package/templates/.agents/config/clients/codex/agents/zaip-agent-marketing-analyst.toml +8 -8
  58. package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +5 -3
  59. package/templates/.agents/config/clients/codex/agents/zaip-agent-sales-specialist.toml +30 -0
  60. package/templates/.agents/config/project.yaml +1 -1
  61. package/templates/.agents/dashboard/.tmp-run-list.json +254 -0
  62. package/templates/.agents/dashboard/.zaip-managed.json +775 -163
  63. package/templates/.agents/dashboard/DATA-DICTIONARY.md +2227 -0
  64. package/templates/.agents/dashboard/README.md +48 -97
  65. package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-DxR_pgSV.js +1 -0
  66. package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-4jZLTWE_.js +2156 -0
  67. package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-CKcsqb-r.js +1 -0
  68. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-BomxqCBU.css +1 -0
  69. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-DmmJD2Th.js +3 -0
  70. package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BwtitWa_.js +1 -0
  71. package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-CaKwQP43.css +1 -0
  72. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-BZ5WdaMN.css +1 -0
  73. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-N5Csr0RP.js +68 -0
  74. package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-C98LGC-Q.js → dashboard-localization-CLJ0lT9v.js} +1 -1
  75. package/templates/.agents/dashboard/apps/frontend/dist/assets/icons-vendor-C0fj2uU9.js +1 -0
  76. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-C4aIB1PV.js +2 -0
  77. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DK_enB5Z.css +1 -0
  78. package/templates/.agents/dashboard/apps/frontend/dist/assets/react-vendor-BEsJ-FYH.js +9 -0
  79. package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-D9-fqq9M.js +1 -0
  80. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-B6y6Gw12.js +1 -0
  81. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DFY7ZDlu.css +1 -0
  82. package/templates/.agents/dashboard/apps/frontend/dist/index.html +9 -2
  83. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  84. package/templates/.agents/dashboard/apps/frontend/src/App.tsx +1129 -600
  85. package/templates/.agents/dashboard/apps/frontend/src/AppLoadingBoundary.tsx +48 -0
  86. package/templates/.agents/dashboard/apps/frontend/src/AppLoadingPanels.tsx +2 -0
  87. package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +247 -0
  88. package/templates/.agents/dashboard/apps/frontend/src/AppRequestGuards.tsx +95 -0
  89. package/templates/.agents/dashboard/apps/frontend/src/AppSetupRoutes.tsx +87 -0
  90. package/templates/.agents/dashboard/apps/frontend/src/CostCalculationGuidePage.tsx +641 -0
  91. package/templates/.agents/dashboard/apps/frontend/src/DashboardAlternateContent.tsx +159 -0
  92. package/templates/.agents/dashboard/apps/frontend/src/DashboardCapabilityNav.tsx +13 -13
  93. package/templates/.agents/dashboard/apps/frontend/src/DashboardGlobalSettings.tsx +56 -0
  94. package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +266 -315
  95. package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +151 -0
  96. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.test.ts +37 -0
  97. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.tsx +114 -12
  98. package/templates/.agents/dashboard/apps/frontend/src/app-preferences.ts +15 -0
  99. package/templates/.agents/dashboard/apps/frontend/src/app-session-token.ts +20 -0
  100. package/templates/.agents/dashboard/apps/frontend/src/cost-calculation-guide.css +267 -0
  101. package/templates/.agents/dashboard/apps/frontend/src/cost-calculation-guide.test.ts +69 -0
  102. package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +85 -0
  103. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +133 -0
  104. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +453 -13
  105. package/templates/.agents/dashboard/apps/frontend/src/dashboard-localization.ts +1 -1
  106. package/templates/.agents/dashboard/apps/frontend/src/main.tsx +1 -0
  107. package/templates/.agents/dashboard/apps/frontend/src/operations-detail-hydration.test.ts +55 -0
  108. package/templates/.agents/dashboard/apps/frontend/src/operations-detail-hydration.ts +36 -0
  109. package/templates/.agents/dashboard/apps/frontend/src/operations-entity-page-projection.test.ts +126 -0
  110. package/templates/.agents/dashboard/apps/frontend/src/operations-entity-page-projection.ts +181 -0
  111. package/templates/.agents/dashboard/apps/frontend/src/operations-period-contract.test.ts +138 -0
  112. package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +105 -0
  113. package/templates/.agents/dashboard/apps/frontend/src/operations-period.test.ts +6 -3
  114. package/templates/.agents/dashboard/apps/frontend/src/operations-period.ts +9 -5
  115. package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +26 -0
  116. package/templates/.agents/dashboard/apps/frontend/src/period-transition-overlay.css +44 -0
  117. package/templates/.agents/dashboard/apps/frontend/src/project-settings-model.ts +121 -62
  118. package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +482 -3
  119. package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +84 -17
  120. package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +78 -0
  121. package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +234 -39
  122. package/templates/.agents/dashboard/apps/frontend/src/snapshot-notice.ts +15 -0
  123. package/templates/.agents/dashboard/apps/frontend/src/sqlite-cost-adapters.ts +26 -0
  124. package/templates/.agents/dashboard/apps/frontend/src/styles.css +14 -2
  125. package/templates/.agents/dashboard/apps/frontend/src/traceability-workspace.css +38 -2
  126. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +253 -0
  127. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +380 -0
  128. package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +175 -0
  129. package/templates/.agents/dashboard/apps/frontend/src/use-app-operations-pages.ts +395 -0
  130. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +141 -0
  131. package/templates/.agents/dashboard/apps/frontend/src/use-idle-cost-prefetch.ts +45 -0
  132. package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.test.ts +46 -0
  133. package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.ts +36 -0
  134. package/templates/.agents/dashboard/apps/frontend/vite.config.ts +58 -5
  135. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  136. package/templates/.agents/dashboard/modules/cost-monitor/src/contracts.ts +47 -6
  137. package/templates/.agents/dashboard/modules/cost-monitor/src/duration-estimate.ts +13 -0
  138. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +134 -0
  139. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +290 -0
  140. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.test.ts +133 -19
  141. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.tsx +134 -43
  142. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.tsx +137 -19
  143. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.test.ts +2 -0
  144. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.tsx +13 -10
  145. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +328 -0
  146. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +302 -6
  147. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +627 -400
  148. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostSummary.tsx +5 -13
  149. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +370 -72
  150. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +467 -326
  151. package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.test.ts +17 -0
  152. package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.tsx +25 -6
  153. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-copy.ts +0 -2
  154. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-helpers.ts +17 -0
  155. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-responsive.css +6 -3
  156. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-row-filters.ts +123 -0
  157. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-summary.ts +8 -3
  158. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-views.ts +32 -0
  159. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor.css +55 -14
  160. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-presentation.ts +121 -0
  161. package/templates/.agents/dashboard/modules/cost-monitor/src/react/index.ts +3 -0
  162. package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.test.ts +68 -0
  163. package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +33 -5
  164. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +119 -0
  165. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.test.ts +12 -0
  166. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +146 -0
  167. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +118 -0
  168. package/templates/.agents/dashboard/modules/cost-monitor/src/server/aggregate.test.ts +2 -2
  169. package/templates/.agents/dashboard/modules/cost-monitor/src/server/aggregate.ts +5 -3
  170. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-pricing-fallback.test.ts +53 -0
  171. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.basics.test.ts +34 -0
  172. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test.ts +168 -161
  173. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.ts +188 -29
  174. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.test.ts +757 -0
  175. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +784 -0
  176. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-terminal-day.test.ts +100 -0
  177. package/templates/.agents/dashboard/modules/cost-monitor/src/server/index.ts +1 -0
  178. package/templates/.agents/dashboard/modules/cost-monitor/src/server/refactor-map-xr9l.json +61 -0
  179. package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-monitor-projection-agents.test.ts +31 -0
  180. package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-summary-projection-duration.test.ts +414 -0
  181. package/templates/.agents/dashboard/modules/cost-monitor/src/task-cost-groups.test.ts +41 -0
  182. package/templates/.agents/dashboard/modules/cost-monitor/src/task-cost-groups.ts +55 -11
  183. package/templates/.agents/dashboard/modules/operations/package.json +2 -1
  184. package/templates/.agents/dashboard/modules/operations/src/contracts.ts +185 -0
  185. package/templates/.agents/dashboard/modules/operations/src/duration-population.test.ts +63 -1
  186. package/templates/.agents/dashboard/modules/operations/src/duration-population.ts +60 -5
  187. package/templates/.agents/dashboard/modules/operations/src/react/EntityDetailsDialog.tsx +14 -3
  188. package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.test.ts +44 -1
  189. package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +345 -18
  190. package/templates/.agents/dashboard/modules/operations/src/react/MacroPlanningDialog.tsx +1 -0
  191. package/templates/.agents/dashboard/modules/operations/src/react/OperationDateFilters.test.ts +9 -5
  192. package/templates/.agents/dashboard/modules/operations/src/react/OperationDateFilters.tsx +2 -2
  193. package/templates/.agents/dashboard/modules/operations/src/react/OperationsMainContent.tsx +168 -0
  194. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +95 -6
  195. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +367 -14
  196. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +562 -131
  197. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +353 -355
  198. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageNavigation.tsx +65 -0
  199. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +169 -0
  200. package/templates/.agents/dashboard/modules/operations/src/react/PeriodSummaryTable.tsx +73 -8
  201. package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.test.tsx +32 -0
  202. package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.tsx +62 -6
  203. package/templates/.agents/dashboard/modules/operations/src/react/TaskBoard.test.ts +55 -0
  204. package/templates/.agents/dashboard/modules/operations/src/react/TaskBoard.tsx +27 -19
  205. package/templates/.agents/dashboard/modules/operations/src/react/TaskDetailsDialog.tsx +105 -42
  206. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.priority.test.ts +19 -0
  207. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +265 -36
  208. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +171 -8
  209. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +98 -68
  210. package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.test.ts +72 -1
  211. package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.ts +78 -17
  212. package/templates/.agents/dashboard/modules/operations/src/react/execution-metrics.ts +6 -4
  213. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +431 -1
  214. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +574 -20
  215. package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +42 -4
  216. package/templates/.agents/dashboard/modules/operations/src/react/export/xlsx-runtime-e2e.test.ts +248 -0
  217. package/templates/.agents/dashboard/modules/operations/src/react/macro-planning-dialog-content.css +49 -0
  218. package/templates/.agents/dashboard/modules/operations/src/react/macro-planning-dialog.css +93 -50
  219. package/templates/.agents/dashboard/modules/operations/src/react/manual-work-priority.test.ts +82 -0
  220. package/templates/.agents/dashboard/modules/operations/src/react/operation-date-range.test.ts +29 -2
  221. package/templates/.agents/dashboard/modules/operations/src/react/operation-date-range.ts +22 -1
  222. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.test.ts +77 -4
  223. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.ts +67 -5
  224. package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +54 -0
  225. package/templates/.agents/dashboard/modules/operations/src/react/operations-global-filters.test.ts +22 -0
  226. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +149 -12
  227. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +27 -0
  228. package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +176 -0
  229. package/templates/.agents/dashboard/modules/operations/src/react/operations-period-scope.test.ts +160 -0
  230. package/templates/.agents/dashboard/modules/operations/src/react/operations-period-scope.ts +47 -0
  231. package/templates/.agents/dashboard/modules/operations/src/react/operations-query.ts +10 -0
  232. package/templates/.agents/dashboard/modules/operations/src/react/operations-responsive.css +3 -0
  233. package/templates/.agents/dashboard/modules/operations/src/react/operations-view-labels.ts +28 -0
  234. package/templates/.agents/dashboard/modules/operations/src/react/operations-view-order.test.ts +21 -7
  235. package/templates/.agents/dashboard/modules/operations/src/react/operations.css +42 -0
  236. package/templates/.agents/dashboard/modules/operations/src/react/period-summary-population.test.ts +54 -0
  237. package/templates/.agents/dashboard/modules/operations/src/react/period-summary-population.ts +32 -0
  238. package/templates/.agents/dashboard/modules/operations/src/react/period-summary.test.ts +241 -6
  239. package/templates/.agents/dashboard/modules/operations/src/react/period-summary.ts +148 -6
  240. package/templates/.agents/dashboard/modules/operations/src/react/popup-localization.test.ts +1 -1
  241. package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.css +132 -0
  242. package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.css.test.ts +13 -0
  243. package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.header.test.ts +16 -0
  244. package/templates/.agents/dashboard/modules/operations/src/react/use-infinite-column.ts +11 -5
  245. package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +7 -4
  246. package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.ts +5 -84
  247. package/templates/.agents/dashboard/modules/operations/src/server/build-operations-projection.test.ts +291 -15
  248. package/templates/.agents/dashboard/modules/operations/src/server/build-operations-projection.ts +182 -472
  249. package/templates/.agents/dashboard/modules/operations/src/server/canonical-compat.test.ts +40 -0
  250. package/templates/.agents/dashboard/modules/operations/src/server/canonical-compat.ts +19 -6
  251. package/templates/.agents/dashboard/modules/operations/src/server/canonical-run-projection.ts +31 -6
  252. package/templates/.agents/dashboard/modules/operations/src/server/daily-duration-projection.ts +220 -0
  253. package/templates/.agents/dashboard/modules/operations/src/server/execution-duration-projection.ts +28 -0
  254. package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.test.ts +39 -2
  255. package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.ts +25 -13
  256. package/templates/.agents/dashboard/modules/operations/src/server/filter.test.ts +3 -3
  257. package/templates/.agents/dashboard/modules/operations/src/server/filter.ts +7 -2
  258. package/templates/.agents/dashboard/modules/operations/src/server/index.ts +3 -0
  259. package/templates/.agents/dashboard/modules/operations/src/server/macro.ts +3 -12
  260. package/templates/.agents/dashboard/modules/operations/src/server/manifest-usage.ts +65 -0
  261. package/templates/.agents/dashboard/modules/operations/src/server/operations-projection-aggregates.ts +297 -0
  262. package/templates/.agents/dashboard/modules/operations/src/server/quick-daily-operations-projection.ts +330 -0
  263. package/templates/.agents/dashboard/modules/operations/src/server/quick-operations-projection.test.ts +505 -0
  264. package/templates/.agents/dashboard/modules/operations/src/server/quick-operations-projection.ts +609 -0
  265. package/templates/.agents/dashboard/modules/operations/src/server/runs.ts +18 -19
  266. package/templates/.agents/dashboard/modules/operations/src/work-board-model.ts +76 -0
  267. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  268. package/templates/.agents/dashboard/modules/traceability/src/server/build-task-trace.ts +3 -1
  269. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  270. package/templates/.agents/dashboard/packages/branding/src/index.ts +1 -1
  271. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  272. package/templates/.agents/dashboard/packages/contracts/src/index.ts +2 -0
  273. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  274. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +1759 -0
  275. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs.metafile.json +7333 -0
  276. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +1611 -0
  277. package/templates/.agents/dashboard/packages/local-runtime/package.json +8 -3
  278. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-dashboard.mjs +20 -0
  279. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +114 -0
  280. package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +31 -0
  281. package/templates/.agents/dashboard/packages/local-runtime/scripts/source-size-runtime-scripts/sqlite-read-model-fixture.mjs +397 -0
  282. package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-read-model.mjs +589 -0
  283. package/templates/.agents/dashboard/packages/local-runtime/scripts/test-unix-launchers.mjs +53 -0
  284. package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +203 -0
  285. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +1646 -107
  286. package/templates/.agents/dashboard/packages/local-runtime/src/agent-adapter-sync.ts +30 -0
  287. package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.test.ts +3 -2
  288. package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.ts +5 -0
  289. package/templates/.agents/dashboard/packages/local-runtime/src/manifest-runs.ts +72 -33
  290. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +339 -4
  291. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +392 -1
  292. package/templates/.agents/dashboard/packages/local-runtime/src/runtime.mjs +5 -5
  293. package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +110 -0
  294. package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +189 -0
  295. package/templates/.agents/dashboard/packages/local-runtime/src/server-cross-layer-parity.test.ts +245 -0
  296. package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models-route.ts +64 -0
  297. package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models.test.ts +204 -0
  298. package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models.ts +194 -0
  299. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.test.ts +163 -0
  300. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.ts +354 -0
  301. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-runs-route.test.ts +74 -0
  302. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-runs-route.ts +113 -0
  303. package/templates/.agents/dashboard/packages/local-runtime/src/server-overview.test.ts +68 -0
  304. package/templates/.agents/dashboard/packages/local-runtime/src/server-period.ts +47 -0
  305. package/templates/.agents/dashboard/packages/local-runtime/src/server-projections.ts +483 -0
  306. package/templates/.agents/dashboard/packages/local-runtime/src/server-settings.test.ts +5 -2
  307. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +178 -84
  308. package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +149 -0
  309. package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +675 -267
  310. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +1212 -309
  311. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.test.ts +53 -0
  312. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.ts +722 -0
  313. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +3743 -0
  314. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +7017 -0
  315. package/templates/.agents/dashboard/packages/local-runtime/src/work-priority-contract.test.ts +33 -0
  316. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-history.mjs +41 -0
  317. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-processes.mjs +210 -0
  318. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +514 -190
  319. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +324 -24
  320. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  321. package/templates/.agents/dashboard/packages/windows-launcher/LauncherVerificationBehaviorTests.cs +206 -0
  322. package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +95 -8
  323. package/templates/.agents/dashboard/packages/windows-launcher/build-dashboard-launcher.ps1 +2 -2
  324. package/templates/.agents/dashboard/packages/windows-launcher/run-launcher-verification-tests.ps1 +22 -0
  325. package/templates/.agents/dashboard/read-model.dbml +2201 -0
  326. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  327. package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +1 -1
  328. package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +216 -41
  329. package/templates/.agents/dashboard/work-priority.json +34 -0
  330. package/templates/.agents/dashboard/zaip-dashboard-linux.sh +45 -0
  331. package/templates/.agents/dashboard/zaip-dashboard-mac.command +3 -0
  332. package/templates/.agents/dashboard/zaip-dashboard-windows.exe +0 -0
  333. package/templates/.agents/design/.zaip-managed.json +3 -3
  334. package/templates/.agents/design/apps/catalog/package.json +1 -1
  335. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  336. package/templates/.agents/growth/estrategia-bootstrap-90-dias.md +169 -0
  337. package/templates/.agents/growth/strategy.md +27 -0
  338. package/templates/.agents/marketing/estrategia-marketing-zaip-90-dias.md +197 -0
  339. package/templates/.agents/marketing/strategy.md +29 -0
  340. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  341. package/templates/.agents/requirements/comparative-audit.md +1 -1
  342. package/templates/.agents/requirements/context-engine.md +1 -1
  343. package/templates/.agents/requirements/cost-observability.md +1 -1
  344. package/templates/.agents/requirements/dashboard-launch.md +24 -0
  345. package/templates/.agents/requirements/data-export.md +1 -1
  346. package/templates/.agents/requirements/design-system.md +1 -1
  347. package/templates/.agents/requirements/execution-engine.md +1 -1
  348. package/templates/.agents/requirements/kanban-dashboard.md +4 -3
  349. package/templates/.agents/requirements/model-orchestration.md +1 -1
  350. package/templates/.agents/requirements/public-distribution.md +9 -6
  351. package/templates/.agents/requirements/software-architecture.md +1 -1
  352. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  353. package/templates/.agents/requirements/work-lifecycle.md +9 -3
  354. package/templates/.agents/requirements/zaip-strategic-95.md +4 -4
  355. package/templates/.agents/rules/autonomy-decision.md +15 -0
  356. package/templates/.agents/rules/core.md +1 -1
  357. package/templates/.agents/rules/run-lifecycle-closure.md +1 -1
  358. package/templates/.agents/rules/specialist-routing.md +19 -0
  359. package/templates/.agents/rules/workflow.md +1 -1
  360. package/templates/.agents/runtime/VERSION +1 -1
  361. package/templates/.agents/runtime/bin/zaip.mjs +118 -67
  362. package/templates/.agents/runtime/checksums.sha256 +6 -4
  363. package/templates/.agents/runtime/manifest.json +3 -1
  364. package/templates/.agents/runtime/pnpm-lock.sha256 +1 -0
  365. package/templates/.agents/runtime/provenance.json +11 -0
  366. package/templates/.agents/runtime/sbom.cdx.json +1929 -39
  367. package/templates/.agents/sales/playbook.md +32 -0
  368. package/templates/.agents/sales/roteiro-comercial-zaip.md +252 -0
  369. package/templates/.agents/skills/zaip-aios/SKILL.md +1 -1
  370. package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +22 -0
  371. package/templates/.agents/skills/zaip-skill-brand-governance/agents/openai.yaml +4 -0
  372. package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-framework.md +39 -0
  373. package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-standards.md +30 -0
  374. package/templates/.agents/skills/zaip-skill-dashboard-sqlite/SKILL.md +25 -0
  375. package/templates/.agents/skills/zaip-skill-dashboard-sqlite/agents/openai.yaml +4 -0
  376. package/templates/.agents/skills/zaip-skill-enforce-architecture/SKILL.md +2 -0
  377. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/SKILL.md +18 -0
  378. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/agents/openai.yaml +6 -0
  379. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.mjs +71 -0
  380. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.test.mjs +60 -0
  381. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/scheduled-ready-queue-contract.test.mjs +111 -0
  382. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +2 -2
  383. package/templates/.agents/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +3 -1
  384. package/templates/.agents/skills/zaip-skill-general-operations/SKILL.md +12 -0
  385. package/templates/.agents/skills/zaip-skill-general-operations/agents/openai.yaml +4 -0
  386. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +9 -7
  387. package/templates/.agents/skills/zaip-skill-github-deploy/agents/openai.yaml +2 -2
  388. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +11 -38
  389. package/templates/.agents/skills/zaip-skill-governance-compliance/SKILL.md +12 -0
  390. package/templates/.agents/skills/zaip-skill-governance-compliance/agents/openai.yaml +4 -0
  391. package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +21 -0
  392. package/templates/.agents/skills/zaip-skill-growth-strategy-revops/agents/openai.yaml +4 -0
  393. package/templates/.agents/skills/zaip-skill-growth-strategy-revops/references/growth-revops-framework.md +25 -0
  394. package/templates/.agents/skills/zaip-skill-instalar-agendamento/SKILL.md +17 -0
  395. package/templates/.agents/skills/zaip-skill-instalar-agendamento/agents/openai.yaml +6 -0
  396. package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +9 -3
  397. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +99 -93
  398. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +132 -23
  399. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +149 -1
  400. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +76 -19
  401. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.test.mjs +217 -7
  402. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/source-size-telemetry/model-identity-reconciliation.mjs +77 -0
  403. package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +20 -0
  404. package/templates/.agents/skills/zaip-skill-sales-methodology/agents/openai.yaml +4 -0
  405. package/templates/.agents/skills/zaip-skill-sales-methodology/references/sales-process-framework.md +77 -0
  406. package/templates/.agents/skills/zaip-skill-setup/SKILL.md +5 -0
  407. package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +96 -0
  408. package/templates/.agents/skills/zaip-skill-sqlite-read-model/agents/openai.yaml +4 -0
  409. package/templates/.agents/skills/zaip-skill-sqlite-read-model/scripts/ensure-node.mjs +41 -0
  410. package/templates/.agents/zaip-aios/INDEX.md +11 -0
  411. package/templates/.agents/zaip-aios/README.md +38 -8
  412. package/templates/.agents/zaip-aios/VERSION +1 -1
  413. package/templates/.agents/zaip-aios/guides/09-agentes-e-squads.md +43 -6
  414. package/templates/.agents/zaip-aios/guides/10-seguranca.md +21 -7
  415. package/templates/.agents/zaip-aios/guides/17-como-o-custo-e-calculado.md +32 -0
  416. package/templates/.agents/zaip-aios/guides/18-catalogo-de-agentes.md +76 -0
  417. package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +72 -0
  418. package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +330 -0
  419. package/templates/.agents/zaip-aios/guides/21-telemetria-monitor-custos.md +52 -0
  420. package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +69 -0
  421. package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +483 -0
  422. package/templates/.agents/zaip-aios/guides/24-calculo-de-custos-openai.md +85 -0
  423. package/templates/.agents/zaip-aios/guides/25-fontes-de-precos-openai.md +18 -0
  424. package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +44 -0
  425. package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +167 -0
  426. package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +144 -0
  427. package/templates/.agents/zaip-aios/guides/assets/diagrams/lifecycles-task-spec-prd.png +0 -0
  428. package/templates/.agents/zaip-aios/guides/assets/diagrams/prd-lifecycle.png +0 -0
  429. package/templates/.agents/zaip-aios/guides/assets/diagrams/spec-lifecycle.png +0 -0
  430. package/templates/.agents/zaip-aios/guides/assets/diagrams/task-lifecycle.png +0 -0
  431. package/templates/template-manifest.json +1082 -215
  432. package/templates/.agents/dashboard/apps/frontend/dist/assets/AgentCatalogSettingsPage-CLYIi7Vo.js +0 -1
  433. package/templates/.agents/dashboard/apps/frontend/dist/assets/AgentCatalogSettingsPage-DTDNVQGX.css +0 -1
  434. package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-Cv-JcoxP.js +0 -1320
  435. package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-CzEggcRb.js +0 -1
  436. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-05YKn6Z4.js +0 -3
  437. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-YO3yqtgV.css +0 -1
  438. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8AzCnl3a.js +0 -77
  439. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DdBYQ_8D.css +0 -1
  440. package/templates/.agents/dashboard/apps/frontend/src/AgentCatalogSettingsPage.tsx +0 -617
  441. package/templates/.agents/dashboard/apps/frontend/src/agent-catalog-settings-page.css +0 -660
  442. package/templates/.agents/dashboard/apps/frontend/src/agent-catalog-settings.test.ts +0 -249
  443. package/templates/.agents/dashboard/dashboard.config.json +0 -4
  444. package/templates/.agents/dashboard/zaip-dashboard.exe +0 -0
@@ -0,0 +1,1759 @@
1
+ "use strict";var D$=Object.create;var fc=Object.defineProperty;var U$=Object.getOwnPropertyDescriptor;var z$=Object.getOwnPropertyNames;var F$=Object.getPrototypeOf,q$=Object.prototype.hasOwnProperty;var P=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(i){throw n=[i],i}};var N=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},ey=(e,t)=>{for(var n in t)fc(e,n,{get:t[n],enumerable:!0})},ty=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of z$(t))!q$.call(e,r)&&r!==n&&fc(e,r,{get:()=>t[r],enumerable:!(i=U$(t,r))||i.enumerable});return e};var He=(e,t,n)=>(n=e!=null?D$(F$(e)):{},ty(t||!e||!e.__esModule?fc(n,"default",{value:e,enumerable:!0}):n,e)),V$=e=>ty(fc({},"__esModule",{value:!0}),e);var Pi=N(Rt=>{"use strict";var Ry;Object.defineProperty(Rt,"__esModule",{value:!0});Rt.globalConfig=Rt.$ZodEncodeError=Rt.$ZodAsyncError=Rt.$brand=Rt.NEVER=void 0;Rt.$constructor=DC;Rt.config=UC;Rt.NEVER=Object.freeze({status:"aborted"});function DC(e,t,n){function i(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,l);let c=a.prototype,d=Object.keys(c);for(let u=0;u<d.length;u++){let _=d[u];_ in s||(s[_]=c[_].bind(s))}}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function a(s){var l;let c=n?.Parent?new o:this;i(c,s),(l=c._zod).deferred??(l.deferred=[]);for(let d of c._zod.deferred)d();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Rt.$brand=Symbol("zod_brand");var G_=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};Rt.$ZodAsyncError=G_;var X_=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};Rt.$ZodEncodeError=X_;(Ry=globalThis).__zod_globalConfig??(Ry.__zod_globalConfig={});Rt.globalConfig=globalThis.__zod_globalConfig;function UC(e){return e&&Object.assign(Rt.globalConfig,e),Rt.globalConfig}});var ue=N(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.Class=re.BIGINT_FORMAT_RANGES=re.NUMBER_FORMAT_RANGES=re.primitiveTypes=re.propertyKeyTypes=re.getParsedType=re.allowsEval=re.captureStackTrace=void 0;re.assertEqual=FC;re.assertNotEqual=qC;re.assertIs=VC;re.assertNever=WC;re.assert=ZC;re.getEnumValues=BC;re.joinValues=HC;re.jsonStringifyReplacer=JC;re.cached=Cy;re.nullish=KC;re.cleanRegex=GC;re.floatSafeRemainder=XC;re.defineLazy=YC;re.objectClone=QC;re.assignProp=ni;re.mergeDefs=Lr;re.cloneDef=eI;re.getElementAtPath=tI;re.promiseAllObject=nI;re.randomString=rI;re.esc=iI;re.slugify=oI;re.isObject=Y_;re.isPlainObject=kc;re.shallowClone=aI;re.numKeys=sI;re.escapeRegex=lI;re.clone=ri;re.normalizeParams=uI;re.createTransparentProxy=dI;re.stringifyPrimitive=Iy;re.optionalKeys=_I;re.pick=pI;re.omit=fI;re.extend=mI;re.safeExtend=gI;re.merge=hI;re.partial=yI;re.required=vI;re.aborted=bI;re.explicitlyAborted=SI;re.prefixIssues=kI;re.unwrapMessage=Aa;re.finalizeIssue=wI;re.getSizableOrigin=EI;re.getLengthableOrigin=AI;re.parsedType=TI;re.issue=xI;re.cleanEnum=OI;re.base64ToUint8Array=Ny;re.uint8ArrayToBase64=Py;re.base64urlToUint8Array=RI;re.uint8ArrayToBase64url=$I;re.hexToUint8Array=CI;re.uint8ArrayToHex=II;var zC=Pi();function FC(e){return e}function qC(e){return e}function VC(e){}function WC(e){throw new Error("Unexpected value in exhaustive check")}function ZC(e){}function BC(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function HC(e,t="|"){return e.map(n=>Iy(n)).join(t)}function JC(e,t){return typeof t=="bigint"?t.toString():t}function Cy(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function KC(e){return e==null}function GC(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function XC(e,t){let n=e/t,i=Math.round(n),r=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var $y=Symbol("evaluating");function YC(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==$y)return i===void 0&&(i=$y,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function QC(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ni(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Lr(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function eI(e){return Lr(e._zod.def)}function tI(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function nI(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function rI(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function iI(e){return JSON.stringify(e)}function oI(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}re.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Y_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}re.allowsEval=Cy(()=>{if(zC.globalConfig.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function kc(e){if(Y_(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Y_(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function aI(e){return kc(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function sI(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var cI=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};re.getParsedType=cI;re.propertyKeyTypes=new Set(["string","number","symbol"]);re.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function lI(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ri(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function uI(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 new 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 dI(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function Iy(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function _I(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}re.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};re.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pI(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Lr(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=n.shape[s])}return ni(this,"shape",a),a},checks:[]});return ri(e,o)}function fI(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Lr(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return ni(this,"shape",a),a},checks:[]});return ri(e,o)}function mI(e,t){if(!kc(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=Lr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return ni(this,"shape",o),o}});return ri(e,r)}function gI(e,t){if(!kc(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Lr(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ni(this,"shape",i),i}});return ri(e,n)}function hI(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Lr(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return ni(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ri(e,n)}function yI(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Lr(t._zod.def,{get shape(){let s=t._zod.def.shape,l={...s};if(n)for(let c in n){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=e?new e({type:"optional",innerType:s[c]}):s[c])}else for(let c in s)l[c]=e?new e({type:"optional",innerType:s[c]}):s[c];return ni(this,"shape",l),l},checks:[]});return ri(t,a)}function vI(e,t,n){let i=Lr(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:r[a]}))}else for(let a in r)o[a]=new e({type:"nonoptional",innerType:r[a]});return ni(this,"shape",o),o}});return ri(t,i)}function bI(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 SI(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 kI(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Aa(e){return typeof e=="string"?e:e?.message}function wI(e,t,n){let i=e.message?e.message:Aa(e.inst?._zod.def?.error?.(e))??Aa(t?.error?.(e))??Aa(n.customError?.(e))??Aa(n.localeError?.(e))??"Invalid input",{inst:r,continue:o,input:a,...s}=e;return s.path??(s.path=[]),s.message=i,t?.reportInput&&(s.input=a),s}function EI(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function AI(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function TI(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function xI(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function OI(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ny(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function Py(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function RI(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Ny(t+n)}function $I(e){return Py(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function CI(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function II(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Q_=class{constructor(...t){}};re.Class=Q_});var ep=N(Tt=>{"use strict";var NI=Tt&&Tt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),PI=Tt&&Tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),MI=Tt&&Tt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&NI(t,e,n);return PI(t,e),t};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.$ZodRealError=Tt.$ZodError=void 0;Tt.flattenError=jI;Tt.formatError=DI;Tt.treeifyError=UI;Tt.toDotPath=jy;Tt.prettifyError=zI;var My=Pi(),LI=MI(ue()),Ly=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,LI.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};Tt.$ZodError=(0,My.$constructor)("$ZodError",Ly);Tt.$ZodRealError=(0,My.$constructor)("$ZodError",Ly,{Parent:Error});function jI(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function DI(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>i({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)n._errors.push(t(a));else{let l=n,c=0;for(;c<s.length;){let d=s[c];c===s.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(a))):l[d]=l[d]||{_errors:[]},l=l[d],c++}}}};return i(e),n}function UI(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var a,s;for(let l of r.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>i({issues:c},[...o,...l.path]));else if(l.code==="invalid_key")i({issues:l.issues},[...o,...l.path]);else if(l.code==="invalid_element")i({issues:l.issues},[...o,...l.path]);else{let c=[...o,...l.path];if(c.length===0){n.errors.push(t(l));continue}let d=n,u=0;for(;u<c.length;){let _=c[u],p=u===c.length-1;typeof _=="string"?(d.properties??(d.properties={}),(a=d.properties)[_]??(a[_]={errors:[]}),d=d.properties[_]):(d.items??(d.items=[]),(s=d.items)[_]??(s[_]={errors:[]}),d=d.items[_]),p&&d.errors.push(t(l)),u++}}};return i(e),n}function jy(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function zI(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${jy(i.path)}`);return t.join(`
2
+ `)}});var np=N(te=>{"use strict";var FI=te&&te.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),qI=te&&te.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),tp=te&&te.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&FI(t,e,n);return qI(t,e),t};Object.defineProperty(te,"__esModule",{value:!0});te.safeDecodeAsync=te._safeDecodeAsync=te.safeEncodeAsync=te._safeEncodeAsync=te.safeDecode=te._safeDecode=te.safeEncode=te._safeEncode=te.decodeAsync=te._decodeAsync=te.encodeAsync=te._encodeAsync=te.decode=te._decode=te.encode=te._encode=te.safeParseAsync=te._safeParseAsync=te.safeParse=te._safeParse=te.parseAsync=te._parseAsync=te.parse=te._parse=void 0;var Eo=tp(Pi()),Jt=tp(ep()),Ao=tp(ue()),VI=e=>(t,n,i,r)=>{let o=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Eo.$ZodAsyncError;if(a.issues.length){let s=new(r?.Err??e)(a.issues.map(l=>Ao.finalizeIssue(l,o,Eo.config())));throw Ao.captureStackTrace(s,r?.callee),s}return a.value};te._parse=VI;te.parse=(0,te._parse)(Jt.$ZodRealError);var WI=e=>async(t,n,i,r)=>{let o=i?{...i,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(r?.Err??e)(a.issues.map(l=>Ao.finalizeIssue(l,o,Eo.config())));throw Ao.captureStackTrace(s,r?.callee),s}return a.value};te._parseAsync=WI;te.parseAsync=(0,te._parseAsync)(Jt.$ZodRealError);var ZI=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new Eo.$ZodAsyncError;return o.issues.length?{success:!1,error:new(e??Jt.$ZodError)(o.issues.map(a=>Ao.finalizeIssue(a,r,Eo.config())))}:{success:!0,data:o.value}};te._safeParse=ZI;te.safeParse=(0,te._safeParse)(Jt.$ZodRealError);var BI=e=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Ao.finalizeIssue(a,r,Eo.config())))}:{success:!0,data:o.value}};te._safeParseAsync=BI;te.safeParseAsync=(0,te._safeParseAsync)(Jt.$ZodRealError);var HI=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,te._parse)(e)(t,n,r)};te._encode=HI;te.encode=(0,te._encode)(Jt.$ZodRealError);var JI=e=>(t,n,i)=>(0,te._parse)(e)(t,n,i);te._decode=JI;te.decode=(0,te._decode)(Jt.$ZodRealError);var KI=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,te._parseAsync)(e)(t,n,r)};te._encodeAsync=KI;te.encodeAsync=(0,te._encodeAsync)(Jt.$ZodRealError);var GI=e=>async(t,n,i)=>(0,te._parseAsync)(e)(t,n,i);te._decodeAsync=GI;te.decodeAsync=(0,te._decodeAsync)(Jt.$ZodRealError);var XI=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,te._safeParse)(e)(t,n,r)};te._safeEncode=XI;te.safeEncode=(0,te._safeEncode)(Jt.$ZodRealError);var YI=e=>(t,n,i)=>(0,te._safeParse)(e)(t,n,i);te._safeDecode=YI;te.safeDecode=(0,te._safeDecode)(Jt.$ZodRealError);var QI=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return(0,te._safeParseAsync)(e)(t,n,r)};te._safeEncodeAsync=QI;te.safeEncodeAsync=(0,te._safeEncodeAsync)(Jt.$ZodRealError);var e0=e=>async(t,n,i)=>(0,te._safeParseAsync)(e)(t,n,i);te._safeDecodeAsync=e0;te.safeDecodeAsync=(0,te._safeDecodeAsync)(Jt.$ZodRealError)});var wc=N(j=>{"use strict";var t0=j&&j.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),n0=j&&j.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r0=j&&j.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&t0(t,e,n);return n0(t,e),t};Object.defineProperty(j,"__esModule",{value:!0});j.sha256_base64url=j.sha256_base64=j.sha256_hex=j.sha1_base64url=j.sha1_base64=j.sha1_hex=j.md5_base64url=j.md5_base64=j.md5_hex=j.hex=j.uppercase=j.lowercase=j.undefined=j.null=j.boolean=j.number=j.integer=j.bigint=j.string=j.date=j.e164=j.httpProtocol=j.domain=j.hostname=j.base64url=j.base64=j.cidrv6=j.cidrv4=j.mac=j.ipv6=j.ipv4=j.browserEmail=j.idnEmail=j.unicodeEmail=j.rfc5322Email=j.html5Email=j.email=j.uuid7=j.uuid6=j.uuid4=j.uuid=j.guid=j.extendedDuration=j.duration=j.nanoid=j.ksuid=j.xid=j.ulid=j.cuid2=j.cuid=void 0;j.sha512_base64url=j.sha512_base64=j.sha512_hex=j.sha384_base64url=j.sha384_base64=j.sha384_hex=void 0;j.emoji=s0;j.time=l0;j.datetime=u0;var i0=r0(ue());j.cuid=/^[cC][0-9a-z]{6,}$/;j.cuid2=/^[0-9a-z]+$/;j.ulid=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;j.xid=/^[0-9a-vA-V]{20}$/;j.ksuid=/^[A-Za-z0-9]{27}$/;j.nanoid=/^[a-zA-Z0-9_-]{21}$/;j.duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;j.extendedDuration=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;j.guid=/^([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})$/;var o0=e=>e?new 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)$/;j.uuid=o0;j.uuid4=(0,j.uuid)(4);j.uuid6=(0,j.uuid)(6);j.uuid7=(0,j.uuid)(7);j.email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;j.html5Email=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;j.rfc5322Email=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;j.unicodeEmail=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;j.idnEmail=j.unicodeEmail;j.browserEmail=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;var a0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function s0(){return new RegExp(a0,"u")}j.ipv4=/^(?:(?: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])$/;j.ipv6=/^(([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}|:))$/;var c0=e=>{let t=i0.escapeRegex(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)};j.mac=c0;j.cidrv4=/^((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])$/;j.cidrv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;j.base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;j.base64url=/^[A-Za-z0-9_-]*$/;j.hostname=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;j.domain=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;j.httpProtocol=/^https?$/;j.e164=/^\+[1-9]\d{6,14}$/;var Dy="(?:(?:\\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])))";j.date=new RegExp(`^${Dy}$`);function Uy(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function l0(e){return new RegExp(`^${Uy(e)}$`)}function u0(e){let t=Uy({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${Dy}T(?:${i})$`)}var d0=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};j.string=d0;j.bigint=/^-?\d+n?$/;j.integer=/^-?\d+$/;j.number=/^-?\d+(?:\.\d+)?$/;j.boolean=/^(?:true|false)$/i;var _0=/^null$/i;j.null=_0;var p0=/^undefined$/i;j.undefined=p0;j.lowercase=/^[^A-Z]*$/;j.uppercase=/^[^a-z]*$/;j.hex=/^[0-9a-fA-F]*$/;function Ta(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function xa(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}j.md5_hex=/^[0-9a-fA-F]{32}$/;j.md5_base64=Ta(22,"==");j.md5_base64url=xa(22);j.sha1_hex=/^[0-9a-fA-F]{40}$/;j.sha1_base64=Ta(27,"=");j.sha1_base64url=xa(27);j.sha256_hex=/^[0-9a-fA-F]{64}$/;j.sha256_base64=Ta(43,"=");j.sha256_base64url=xa(43);j.sha384_hex=/^[0-9a-fA-F]{96}$/;j.sha384_base64=Ta(64,"");j.sha384_base64url=xa(64);j.sha512_hex=/^[0-9a-fA-F]{128}$/;j.sha512_base64=Ta(86,"==");j.sha512_base64url=xa(86)});var Ec=N(ie=>{"use strict";var f0=ie&&ie.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),m0=ie&&ie.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),rp=ie&&ie.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&f0(t,e,n);return m0(t,e),t};Object.defineProperty(ie,"__esModule",{value:!0});ie.$ZodCheckOverwrite=ie.$ZodCheckMimeType=ie.$ZodCheckProperty=ie.$ZodCheckEndsWith=ie.$ZodCheckStartsWith=ie.$ZodCheckIncludes=ie.$ZodCheckUpperCase=ie.$ZodCheckLowerCase=ie.$ZodCheckRegex=ie.$ZodCheckStringFormat=ie.$ZodCheckLengthEquals=ie.$ZodCheckMinLength=ie.$ZodCheckMaxLength=ie.$ZodCheckSizeEquals=ie.$ZodCheckMinSize=ie.$ZodCheckMaxSize=ie.$ZodCheckBigIntFormat=ie.$ZodCheckNumberFormat=ie.$ZodCheckMultipleOf=ie.$ZodCheckGreaterThan=ie.$ZodCheckLessThan=ie.$ZodCheck=void 0;var ct=rp(Pi()),ip=rp(wc()),mt=rp(ue());ie.$ZodCheck=ct.$constructor("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var Fy={number:"number",bigint:"bigint",object:"date"};ie.$ZodCheckLessThan=ct.$constructor("$ZodCheckLessThan",(e,t)=>{ie.$ZodCheck.init(e,t);let n=Fy[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});ie.$ZodCheckGreaterThan=ct.$constructor("$ZodCheckGreaterThan",(e,t)=>{ie.$ZodCheck.init(e,t);let n=Fy[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});ie.$ZodCheckMultipleOf=ct.$constructor("$ZodCheckMultipleOf",(e,t)=>{ie.$ZodCheck.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):mt.floatSafeRemainder(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}});ie.$ZodCheckNumberFormat=ct.$constructor("$ZodCheckNumberFormat",(e,t)=>{ie.$ZodCheck.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=mt.NUMBER_FORMAT_RANGES[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=r,s.maximum=o,n&&(s.pattern=ip.integer)}),e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});ie.$ZodCheckBigIntFormat=ct.$constructor("$ZodCheckBigIntFormat",(e,t)=>{ie.$ZodCheck.init(e,t);let[n,i]=mt.BIGINT_FORMAT_RANGES[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});ie.$ZodCheckMaxSize=ct.$constructor("$ZodCheckMaxSize",(e,t)=>{var n;ie.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!mt.nullish(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:mt.getSizableOrigin(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});ie.$ZodCheckMinSize=ct.$constructor("$ZodCheckMinSize",(e,t)=>{var n;ie.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!mt.nullish(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:mt.getSizableOrigin(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});ie.$ZodCheckSizeEquals=ct.$constructor("$ZodCheckSizeEquals",(e,t)=>{var n;ie.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!mt.nullish(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=i=>{let r=i.value,o=r.size;if(o===t.size)return;let a=o>t.size;i.issues.push({origin:mt.getSizableOrigin(r),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}});ie.$ZodCheckMaxLength=ct.$constructor("$ZodCheckMaxLength",(e,t)=>{var n;ie.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!mt.nullish(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;if(r.length<=t.maximum)return;let a=mt.getLengthableOrigin(r);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});ie.$ZodCheckMinLength=ct.$constructor("$ZodCheckMinLength",(e,t)=>{var n;ie.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!mt.nullish(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;if(r.length>=t.minimum)return;let a=mt.getLengthableOrigin(r);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}});ie.$ZodCheckLengthEquals=ct.$constructor("$ZodCheckLengthEquals",(e,t)=>{var n;ie.$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!mt.nullish(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=i=>{let r=i.value,o=r.length;if(o===t.length)return;let a=mt.getLengthableOrigin(r),s=o>t.length;i.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}});ie.$ZodCheckStringFormat=ct.$constructor("$ZodCheckStringFormat",(e,t)=>{var n,i;ie.$ZodCheck.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})});ie.$ZodCheckRegex=ct.$constructor("$ZodCheckRegex",(e,t)=>{ie.$ZodCheckStringFormat.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})}});ie.$ZodCheckLowerCase=ct.$constructor("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ip.lowercase),ie.$ZodCheckStringFormat.init(e,t)});ie.$ZodCheckUpperCase=ct.$constructor("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ip.uppercase),ie.$ZodCheckStringFormat.init(e,t)});ie.$ZodCheckIncludes=ct.$constructor("$ZodCheckIncludes",(e,t)=>{ie.$ZodCheck.init(e,t);let n=mt.escapeRegex(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}});ie.$ZodCheckStartsWith=ct.$constructor("$ZodCheckStartsWith",(e,t)=>{ie.$ZodCheck.init(e,t);let n=new RegExp(`^${mt.escapeRegex(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}});ie.$ZodCheckEndsWith=ct.$constructor("$ZodCheckEndsWith",(e,t)=>{ie.$ZodCheck.init(e,t);let n=new RegExp(`.*${mt.escapeRegex(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function zy(e,t,n){e.issues.length&&t.issues.push(...mt.prefixIssues(n,e.issues))}ie.$ZodCheckProperty=ct.$constructor("$ZodCheckProperty",(e,t)=>{ie.$ZodCheck.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>zy(r,n,t.property));zy(i,n,t.property)}});ie.$ZodCheckMimeType=ct.$constructor("$ZodCheckMimeType",(e,t)=>{ie.$ZodCheck.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}});ie.$ZodCheckOverwrite=ct.$constructor("$ZodCheckOverwrite",(e,t)=>{ie.$ZodCheck.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var ap=N(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.Doc=void 0;var op=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
3
+ `).filter(a=>a),r=Math.min(...i.map(a=>a.length-a.trimStart().length)),o=i.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,n=this?.args,r=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,r.join(`
4
+ `))}};Ac.Doc=op});var sp=N(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.version=void 0;Tc.version={major:4,minor:4,patch:3}});var up=N(A=>{"use strict";var g0=A&&A.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),h0=A&&A.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Cc=A&&A.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&g0(t,e,n);return h0(t,e),t};Object.defineProperty(A,"__esModule",{value:!0});A.$ZodTuple=A.$ZodIntersection=A.$ZodDiscriminatedUnion=A.$ZodXor=A.$ZodUnion=A.$ZodObjectJIT=A.$ZodObject=A.$ZodArray=A.$ZodDate=A.$ZodVoid=A.$ZodNever=A.$ZodUnknown=A.$ZodAny=A.$ZodNull=A.$ZodUndefined=A.$ZodSymbol=A.$ZodBigIntFormat=A.$ZodBigInt=A.$ZodBoolean=A.$ZodNumberFormat=A.$ZodNumber=A.$ZodCustomStringFormat=A.$ZodJWT=A.$ZodE164=A.$ZodBase64URL=A.$ZodBase64=A.$ZodCIDRv6=A.$ZodCIDRv4=A.$ZodMAC=A.$ZodIPv6=A.$ZodIPv4=A.$ZodISODuration=A.$ZodISOTime=A.$ZodISODate=A.$ZodISODateTime=A.$ZodKSUID=A.$ZodXID=A.$ZodULID=A.$ZodCUID2=A.$ZodCUID=A.$ZodNanoID=A.$ZodEmoji=A.$ZodURL=A.$ZodEmail=A.$ZodUUID=A.$ZodGUID=A.$ZodStringFormat=A.$ZodString=A.clone=A.$ZodType=void 0;A.$ZodCustom=A.$ZodLazy=A.$ZodPromise=A.$ZodFunction=A.$ZodTemplateLiteral=A.$ZodReadonly=A.$ZodPreprocess=A.$ZodCodec=A.$ZodPipe=A.$ZodNaN=A.$ZodCatch=A.$ZodSuccess=A.$ZodNonOptional=A.$ZodPrefault=A.$ZodDefault=A.$ZodNullable=A.$ZodExactOptional=A.$ZodOptional=A.$ZodTransform=A.$ZodFile=A.$ZodLiteral=A.$ZodEnum=A.$ZodSet=A.$ZodMap=A.$ZodRecord=void 0;A.isValidBase64=lp;A.isValidBase64URL=nv;A.isValidJWT=rv;var Ic=Cc(Ec()),G=Cc(Pi()),y0=ap(),To=np(),De=Cc(wc()),X=Cc(ue()),v0=sp();A.$ZodType=G.$constructor("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=v0.version;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(a,s,l)=>{let c=X.aborted(a),d;for(let u of s){if(u._zod.def.when){if(X.explicitlyAborted(a)||!u._zod.def.when(a))continue}else if(c)continue;let _=a.issues.length,p=u._zod.check(a);if(p instanceof Promise&&l?.async===!1)throw new G.$ZodAsyncError;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,a.issues.length!==_&&(c||(c=X.aborted(a,_)))});else{if(a.issues.length===_)continue;c||(c=X.aborted(a,_))}}return d?d.then(()=>a):a},o=(a,s,l)=>{if(X.aborted(a))return a.aborted=!0,a;let c=r(s,i,l);if(c instanceof Promise){if(l.async===!1)throw new G.$ZodAsyncError;return c.then(d=>e._zod.parse(d,l))}return e._zod.parse(c,l)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let c=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return c instanceof Promise?c.then(d=>o(d,a,s)):o(c,a,s)}let l=e._zod.parse(a,s);if(l instanceof Promise){if(s.async===!1)throw new G.$ZodAsyncError;return l.then(c=>r(c,i,s))}return r(l,i,s)}}X.defineLazy(e,"~standard",()=>({validate:r=>{try{let o=(0,To.safeParse)(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return(0,To.safeParseAsync)(e,r).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))});var b0=ue();Object.defineProperty(A,"clone",{enumerable:!0,get:function(){return b0.clone}});A.$ZodString=G.$constructor("$ZodString",(e,t)=>{A.$ZodType.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??De.string(e._zod.bag),e._zod.parse=(n,i)=>{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}});A.$ZodStringFormat=G.$constructor("$ZodStringFormat",(e,t)=>{Ic.$ZodCheckStringFormat.init(e,t),A.$ZodString.init(e,t)});A.$ZodGUID=G.$constructor("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=De.guid),A.$ZodStringFormat.init(e,t)});A.$ZodUUID=G.$constructor("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=De.uuid(i))}else t.pattern??(t.pattern=De.uuid());A.$ZodStringFormat.init(e,t)});A.$ZodEmail=G.$constructor("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=De.email),A.$ZodStringFormat.init(e,t)});A.$ZodURL=G.$constructor("$ZodURL",(e,t)=>{A.$ZodStringFormat.init(e,t),e._zod.check=n=>{try{let i=n.value.trim();if(!t.normalize&&t.protocol?.source===De.httpProtocol.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}let r=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.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&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}});A.$ZodEmoji=G.$constructor("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=De.emoji()),A.$ZodStringFormat.init(e,t)});A.$ZodNanoID=G.$constructor("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=De.nanoid),A.$ZodStringFormat.init(e,t)});A.$ZodCUID=G.$constructor("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=De.cuid),A.$ZodStringFormat.init(e,t)});A.$ZodCUID2=G.$constructor("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=De.cuid2),A.$ZodStringFormat.init(e,t)});A.$ZodULID=G.$constructor("$ZodULID",(e,t)=>{t.pattern??(t.pattern=De.ulid),A.$ZodStringFormat.init(e,t)});A.$ZodXID=G.$constructor("$ZodXID",(e,t)=>{t.pattern??(t.pattern=De.xid),A.$ZodStringFormat.init(e,t)});A.$ZodKSUID=G.$constructor("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=De.ksuid),A.$ZodStringFormat.init(e,t)});A.$ZodISODateTime=G.$constructor("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=De.datetime(t)),A.$ZodStringFormat.init(e,t)});A.$ZodISODate=G.$constructor("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=De.date),A.$ZodStringFormat.init(e,t)});A.$ZodISOTime=G.$constructor("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=De.time(t)),A.$ZodStringFormat.init(e,t)});A.$ZodISODuration=G.$constructor("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=De.duration),A.$ZodStringFormat.init(e,t)});A.$ZodIPv4=G.$constructor("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=De.ipv4),A.$ZodStringFormat.init(e,t),e._zod.bag.format="ipv4"});A.$ZodIPv6=G.$constructor("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=De.ipv6),A.$ZodStringFormat.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}});A.$ZodMAC=G.$constructor("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=De.mac(t.delimiter)),A.$ZodStringFormat.init(e,t),e._zod.bag.format="mac"});A.$ZodCIDRv4=G.$constructor("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=De.cidrv4),A.$ZodStringFormat.init(e,t)});A.$ZodCIDRv6=G.$constructor("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=De.cidrv6),A.$ZodStringFormat.init(e,t),e._zod.check=n=>{let i=n.value.split("/");try{if(i.length!==2)throw new Error;let[r,o]=i;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function lp(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}A.$ZodBase64=G.$constructor("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=De.base64),A.$ZodStringFormat.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{lp(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function nv(e){if(!De.base64url.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return lp(n)}A.$ZodBase64URL=G.$constructor("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=De.base64url),A.$ZodStringFormat.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{nv(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}});A.$ZodE164=G.$constructor("$ZodE164",(e,t)=>{t.pattern??(t.pattern=De.e164),A.$ZodStringFormat.init(e,t)});function rv(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}A.$ZodJWT=G.$constructor("$ZodJWT",(e,t)=>{A.$ZodStringFormat.init(e,t),e._zod.check=n=>{rv(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});A.$ZodCustomStringFormat=G.$constructor("$ZodCustomStringFormat",(e,t)=>{A.$ZodStringFormat.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}});A.$ZodNumber=G.$constructor("$ZodNumber",(e,t)=>{A.$ZodType.init(e,t),e._zod.pattern=e._zod.bag.pattern??De.number,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let o=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}});A.$ZodNumberFormat=G.$constructor("$ZodNumberFormat",(e,t)=>{Ic.$ZodCheckNumberFormat.init(e,t),A.$ZodNumber.init(e,t)});A.$ZodBoolean=G.$constructor("$ZodBoolean",(e,t)=>{A.$ZodType.init(e,t),e._zod.pattern=De.boolean,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});A.$ZodBigInt=G.$constructor("$ZodBigInt",(e,t)=>{A.$ZodType.init(e,t),e._zod.pattern=De.bigint,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}});A.$ZodBigIntFormat=G.$constructor("$ZodBigIntFormat",(e,t)=>{Ic.$ZodCheckBigIntFormat.init(e,t),A.$ZodBigInt.init(e,t)});A.$ZodSymbol=G.$constructor("$ZodSymbol",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}});A.$ZodUndefined=G.$constructor("$ZodUndefined",(e,t)=>{A.$ZodType.init(e,t),e._zod.pattern=De.undefined,e._zod.values=new Set([void 0]),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}});A.$ZodNull=G.$constructor("$ZodNull",(e,t)=>{A.$ZodType.init(e,t),e._zod.pattern=De.null,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}});A.$ZodAny=G.$constructor("$ZodAny",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=n=>n});A.$ZodUnknown=G.$constructor("$ZodUnknown",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=n=>n});A.$ZodNever=G.$constructor("$ZodNever",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});A.$ZodVoid=G.$constructor("$ZodVoid",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}});A.$ZodDate=G.$constructor("$ZodDate",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});function qy(e,t,n){e.issues.length&&t.issues.push(...X.prefixIssues(n,e.issues)),t.value[n]=e.value}A.$ZodArray=G.$constructor("$ZodArray",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let o=[];for(let a=0;a<r.length;a++){let s=r[a],l=t.element._zod.run({value:s,issues:[]},i);l instanceof Promise?o.push(l.then(c=>qy(c,n,a))):qy(l,n,a)}return o.length?Promise.all(o).then(()=>n):n}});function $c(e,t,n,i,r,o){let a=n in i;if(e.issues.length){if(r&&o&&!a)return;t.issues.push(...X.prefixIssues(n,e.issues))}if(!a&&!r){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?a&&(t.value[n]=void 0):t.value[n]=e.value}function iv(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let n=X.optionalKeys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ov(e,t,n,i,r,o){let a=[],s=r.keySet,l=r.catchall._zod,c=l.def.type,d=l.optin==="optional",u=l.optout==="optional";for(let _ in t){if(_==="__proto__"||s.has(_))continue;if(c==="never"){a.push(_);continue}let p=l.run({value:t[_],issues:[]},i);p instanceof Promise?e.push(p.then(v=>$c(v,n,_,t,d,u))):$c(p,n,_,t,d,u)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}A.$ZodObject=G.$constructor("$ZodObject",(e,t)=>{if(A.$ZodType.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...s};return Object.defineProperty(t,"shape",{value:l}),l}})}let i=X.cached(()=>iv(t));X.defineLazy(e._zod,"propValues",()=>{let s=t.shape,l={};for(let c in s){let d=s[c]._zod;if(d.values){l[c]??(l[c]=new Set);for(let u of d.values)l[c].add(u)}}return l});let r=X.isObject,o=t.catchall,a;e._zod.parse=(s,l)=>{a??(a=i.value);let c=s.value;if(!r(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),s;s.value={};let d=[],u=a.shape;for(let _ of a.keys){let p=u[_],v=p._zod.optin==="optional",f=p._zod.optout==="optional",h=p._zod.run({value:c[_],issues:[]},l);h instanceof Promise?d.push(h.then(k=>$c(k,s,_,c,v,f))):$c(h,s,_,c,v,f)}return o?ov(d,c,s,l,i.value,e):d.length?Promise.all(d).then(()=>s):s}});A.$ZodObjectJIT=G.$constructor("$ZodObjectJIT",(e,t)=>{A.$ZodObject.init(e,t);let n=e._zod.parse,i=X.cached(()=>iv(t)),r=_=>{let p=new y0.Doc(["shape","payload","ctx"]),v=i.value,f=O=>{let g=X.esc(O);return`shape[${g}]._zod.run({ value: input[${g}], issues: [] }, ctx)`};p.write("const input = payload.value;");let h=Object.create(null),k=0;for(let O of v.keys)h[O]=`key_${k++}`;p.write("const newResult = {};");for(let O of v.keys){let g=h[O],b=X.esc(O),T=_[O],I=T?._zod?.optin==="optional",R=T?._zod?.optout==="optional";p.write(`const ${g} = ${f(O)};`),I&&R?p.write(`
5
+ if (${g}.issues.length) {
6
+ if (${b} in input) {
7
+ payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${b}, ...iss.path] : [${b}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${g}.value === undefined) {
15
+ if (${b} in input) {
16
+ newResult[${b}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${b}] = ${g}.value;
20
+ }
21
+
22
+ `):I?p.write(`
23
+ if (${g}.issues.length) {
24
+ payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
25
+ ...iss,
26
+ path: iss.path ? [${b}, ...iss.path] : [${b}]
27
+ })));
28
+ }
29
+
30
+ if (${g}.value === undefined) {
31
+ if (${b} in input) {
32
+ newResult[${b}] = undefined;
33
+ }
34
+ } else {
35
+ newResult[${b}] = ${g}.value;
36
+ }
37
+
38
+ `):p.write(`
39
+ const ${g}_present = ${b} in input;
40
+ if (${g}.issues.length) {
41
+ payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
42
+ ...iss,
43
+ path: iss.path ? [${b}, ...iss.path] : [${b}]
44
+ })));
45
+ }
46
+ if (!${g}_present && !${g}.issues.length) {
47
+ payload.issues.push({
48
+ code: "invalid_type",
49
+ expected: "nonoptional",
50
+ input: undefined,
51
+ path: [${b}]
52
+ });
53
+ }
54
+
55
+ if (${g}_present) {
56
+ if (${g}.value === undefined) {
57
+ newResult[${b}] = undefined;
58
+ } else {
59
+ newResult[${b}] = ${g}.value;
60
+ }
61
+ }
62
+
63
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");let w=p.compile();return(O,g)=>w(_,O,g)},o,a=X.isObject,s=!G.globalConfig.jitless,l=X.allowsEval,c=s&&l.value,d=t.catchall,u;e._zod.parse=(_,p)=>{u??(u=i.value);let v=_.value;return a(v)?s&&c&&p?.async===!1&&p.jitless!==!0?(o||(o=r(t.shape)),_=o(_,p),d?ov([],v,_,p,u,e):_):n(_,p):(_.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),_)}});function Vy(e,t,n,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let r=e.filter(o=>!X.aborted(o));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>X.finalizeIssue(a,i,G.config())))}),t)}A.$ZodUnion=G.$constructor("$ZodUnion",(e,t)=>{A.$ZodType.init(e,t),X.defineLazy(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),X.defineLazy(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),X.defineLazy(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),X.defineLazy(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${i.map(r=>X.cleanRegex(r.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let o=!1,a=[];for(let s of t.options){let l=s._zod.run({value:i.value,issues:[]},r);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}return o?Promise.all(a).then(s=>Vy(s,i,e,r)):Vy(a,i,e,r)}});function Wy(e,t,n,i){let r=e.filter(o=>o.issues.length===0);return r.length===1?(t.value=r[0].value,t):(r.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>X.finalizeIssue(a,i,G.config())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}A.$ZodXor=G.$constructor("$ZodXor",(e,t)=>{A.$ZodUnion.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,r)=>{if(n)return n(i,r);let o=!1,a=[];for(let s of t.options){let l=s._zod.run({value:i.value,issues:[]},r);l instanceof Promise?(a.push(l),o=!0):a.push(l)}return o?Promise.all(a).then(s=>Wy(s,i,e,r)):Wy(a,i,e,r)}});A.$ZodDiscriminatedUnion=G.$constructor("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,A.$ZodUnion.init(e,t);let n=e._zod.parse;X.defineLazy(e._zod,"propValues",()=>{let r={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,l]of Object.entries(a)){r[s]||(r[s]=new Set);for(let c of l)r[s].add(c)}}return r});let i=X.cached(()=>{let r=t.options,o=new Map;for(let a of r){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let l of s){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,a)}}return o});e._zod.parse=(r,o)=>{let a=r.value;if(!X.isObject(a))return r.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),r;let s=i.value.get(a?.[t.discriminator]);return s?s._zod.run(r,o):t.unionFallback||o.direction==="backward"?n(r,o):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()),input:a,path:[t.discriminator],inst:e}),r)}});A.$ZodIntersection=G.$constructor("$ZodIntersection",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,o=t.left._zod.run({value:r,issues:[]},i),a=t.right._zod.run({value:r,issues:[]},i);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,c])=>Zy(n,l,c)):Zy(n,o,a)}});function cp(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(X.isPlainObject(e)&&X.isPlainObject(t)){let n=Object.keys(t),i=Object.keys(e).filter(o=>n.indexOf(o)!==-1),r={...e,...t};for(let o of i){let a=cp(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r[o]=a.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],o=t[i],a=cp(r,o);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Zy(e,t,n){let i=new Map,r;for(let s of t.issues)if(s.code==="unrecognized_keys"){r??(r=s);for(let l of s.keys)i.has(l)||i.set(l,{}),i.get(l).l=!0}else e.issues.push(s);for(let s of n.issues)if(s.code==="unrecognized_keys")for(let l of s.keys)i.has(l)||i.set(l,{}),i.get(l).r=!0;else e.issues.push(s);let o=[...i].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(o.length&&r&&e.issues.push({...r,keys:o}),X.aborted(e))return e;let a=cp(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}A.$ZodTuple=G.$constructor("$ZodTuple",(e,t)=>{A.$ZodType.init(e,t);let n=t.items;e._zod.parse=(i,r)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=[];let a=[],s=By(n,"optin"),l=By(n,"optout");if(!t.rest){if(o.length<s)return i.issues.push({code:"too_small",minimum:s,inclusive:!0,input:o,inst:e,origin:"array"}),i;o.length>n.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:o,inst:e,origin:"array"})}let c=new Array(n.length);for(let d=0;d<n.length;d++){let u=n[d]._zod.run({value:o[d],issues:[]},r);u instanceof Promise?a.push(u.then(_=>{c[d]=_})):c[d]=u}if(t.rest){let d=n.length-1,u=o.slice(n.length);for(let _ of u){d++;let p=t.rest._zod.run({value:_,issues:[]},r);p instanceof Promise?a.push(p.then(v=>Hy(v,i,d))):Hy(p,i,d)}}return a.length?Promise.all(a).then(()=>Jy(c,i,n,o,l)):Jy(c,i,n,o,l)}});function By(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!=="optional")return n+1;return 0}function Hy(e,t,n){e.issues.length&&t.issues.push(...X.prefixIssues(n,e.issues)),t.value[n]=e.value}function Jy(e,t,n,i,r){for(let o=0;o<n.length;o++){let a=e[o],s=o<i.length;if(a.issues.length){if(!s&&o>=r){t.value.length=o;break}t.issues.push(...X.prefixIssues(o,a.issues))}t.value[o]=a.value}for(let o=t.value.length-1;o>=i.length&&(n[o]._zod.optout==="optional"&&t.value[o]===void 0);o--)t.value.length=o;return t}A.$ZodRecord=G.$constructor("$ZodRecord",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!X.isPlainObject(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let o=[],a=t.keyType._zod.values;if(a){n.value={};let s=new Set;for(let c of a)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){s.add(typeof c=="number"?c.toString():c);let d=t.keyType._zod.run({value:c,issues:[]},i);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>X.finalizeIssue(p,i,G.config())),input:c,path:[c],inst:e});continue}let u=d.value,_=t.valueType._zod.run({value:r[c],issues:[]},i);_ instanceof Promise?o.push(_.then(p=>{p.issues.length&&n.issues.push(...X.prefixIssues(c,p.issues)),n.value[u]=p.value})):(_.issues.length&&n.issues.push(...X.prefixIssues(c,_.issues)),n.value[u]=_.value)}let l;for(let c in r)s.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:l})}else{n.value={};for(let s of Reflect.ownKeys(r)){if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,s))continue;let l=t.keyType._zod.run({value:s,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&De.number.test(s)&&l.issues.length){let u=t.keyType._zod.run({value:Number(s),issues:[]},i);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");u.issues.length===0&&(l=u)}if(l.issues.length){t.mode==="loose"?n.value[s]=r[s]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>X.finalizeIssue(u,i,G.config())),input:s,path:[s],inst:e});continue}let d=t.valueType._zod.run({value:r[s],issues:[]},i);d instanceof Promise?o.push(d.then(u=>{u.issues.length&&n.issues.push(...X.prefixIssues(s,u.issues)),n.value[l.value]=u.value})):(d.issues.length&&n.issues.push(...X.prefixIssues(s,d.issues)),n.value[l.value]=d.value)}}return o.length?Promise.all(o).then(()=>n):n}});A.$ZodMap=G.$constructor("$ZodMap",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let o=[];n.value=new Map;for(let[a,s]of r){let l=t.keyType._zod.run({value:a,issues:[]},i),c=t.valueType._zod.run({value:s,issues:[]},i);l instanceof Promise||c instanceof Promise?o.push(Promise.all([l,c]).then(([d,u])=>{Ky(d,u,n,a,r,e,i)})):Ky(l,c,n,a,r,e,i)}return o.length?Promise.all(o).then(()=>n):n}});function Ky(e,t,n,i,r,o,a){e.issues.length&&(X.propertyKeyTypes.has(typeof i)?n.issues.push(...X.prefixIssues(i,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:o,issues:e.issues.map(s=>X.finalizeIssue(s,a,G.config()))})),t.issues.length&&(X.propertyKeyTypes.has(typeof i)?n.issues.push(...X.prefixIssues(i,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:o,key:i,issues:t.issues.map(s=>X.finalizeIssue(s,a,G.config()))})),n.value.set(e.value,t.value)}A.$ZodSet=G.$constructor("$ZodSet",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let o=[];n.value=new Set;for(let a of r){let s=t.valueType._zod.run({value:a,issues:[]},i);s instanceof Promise?o.push(s.then(l=>Gy(l,n))):Gy(s,n)}return o.length?Promise.all(o).then(()=>n):n}});function Gy(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}A.$ZodEnum=G.$constructor("$ZodEnum",(e,t)=>{A.$ZodType.init(e,t);let n=X.getEnumValues(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(r=>X.propertyKeyTypes.has(typeof r)).map(r=>typeof r=="string"?X.escapeRegex(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{let a=r.value;return i.has(a)||r.issues.push({code:"invalid_value",values:n,input:a,inst:e}),r}});A.$ZodLiteral=G.$constructor("$ZodLiteral",(e,t)=>{if(A.$ZodType.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?X.escapeRegex(i):i?X.escapeRegex(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,r)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),i}});A.$ZodFile=G.$constructor("$ZodFile",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return r instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}});A.$ZodTransform=G.$constructor("$ZodTransform",(e,t)=>{A.$ZodType.init(e,t),e._zod.optin="optional",e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new G.$ZodEncodeError(e.constructor.name);let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then(a=>(n.value=a,n.fallback=!0,n));if(r instanceof Promise)throw new G.$ZodAsyncError;return n.value=r,n.fallback=!0,n}});function Xy(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}A.$ZodOptional=G.$constructor("$ZodOptional",(e,t)=>{A.$ZodType.init(e,t),e._zod.optin="optional",e._zod.optout="optional",X.defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),X.defineLazy(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${X.cleanRegex(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){let r=n.value,o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(a=>Xy(a,r)):Xy(o,r)}return n.value===void 0?n:t.innerType._zod.run(n,i)}});A.$ZodExactOptional=G.$constructor("$ZodExactOptional",(e,t)=>{A.$ZodOptional.init(e,t),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),X.defineLazy(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)});A.$ZodNullable=G.$constructor("$ZodNullable",(e,t)=>{A.$ZodType.init(e,t),X.defineLazy(e._zod,"optin",()=>t.innerType._zod.optin),X.defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),X.defineLazy(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${X.cleanRegex(n.source)}|null)$`):void 0}),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)});A.$ZodDefault=G.$constructor("$ZodDefault",(e,t)=>{A.$ZodType.init(e,t),e._zod.optin="optional",X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Yy(o,t)):Yy(r,t)}});function Yy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}A.$ZodPrefault=G.$constructor("$ZodPrefault",(e,t)=>{A.$ZodType.init(e,t),e._zod.optin="optional",X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))});A.$ZodNonOptional=G.$constructor("$ZodNonOptional",(e,t)=>{A.$ZodType.init(e,t),X.defineLazy(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Qy(o,e)):Qy(r,e)}});function Qy(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}A.$ZodSuccess=G.$constructor("$ZodSuccess",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new G.$ZodEncodeError("ZodSuccess");let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.issues.length===0,n)):(n.value=r.issues.length===0,n)}});A.$ZodCatch=G.$constructor("$ZodCatch",(e,t)=>{A.$ZodType.init(e,t),e._zod.optin="optional",X.defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>X.finalizeIssue(a,i,G.config()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(o=>X.finalizeIssue(o,i,G.config()))},input:n.value}),n.issues=[],n.fallback=!0),n)}});A.$ZodNaN=G.$constructor("$ZodNaN",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)});A.$ZodPipe=G.$constructor("$ZodPipe",(e,t)=>{A.$ZodType.init(e,t),X.defineLazy(e._zod,"values",()=>t.in._zod.values),X.defineLazy(e._zod,"optin",()=>t.in._zod.optin),X.defineLazy(e._zod,"optout",()=>t.out._zod.optout),X.defineLazy(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){let o=t.out._zod.run(n,i);return o instanceof Promise?o.then(a=>xc(a,t.in,i)):xc(o,t.in,i)}let r=t.in._zod.run(n,i);return r instanceof Promise?r.then(o=>xc(o,t.out,i)):xc(r,t.out,i)}});function xc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}A.$ZodCodec=G.$constructor("$ZodCodec",(e,t)=>{A.$ZodType.init(e,t),X.defineLazy(e._zod,"values",()=>t.in._zod.values),X.defineLazy(e._zod,"optin",()=>t.in._zod.optin),X.defineLazy(e._zod,"optout",()=>t.out._zod.optout),X.defineLazy(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if((i.direction||"forward")==="forward"){let o=t.in._zod.run(n,i);return o instanceof Promise?o.then(a=>Oc(a,t,i)):Oc(o,t,i)}else{let o=t.out._zod.run(n,i);return o instanceof Promise?o.then(a=>Oc(a,t,i)):Oc(o,t,i)}}});function Oc(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);return r instanceof Promise?r.then(o=>Rc(e,o,t.out,n)):Rc(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(o=>Rc(e,o,t.in,n)):Rc(e,r,t.in,n)}}function Rc(e,t,n,i){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},i)}A.$ZodPreprocess=G.$constructor("$ZodPreprocess",(e,t)=>{A.$ZodPipe.init(e,t)});A.$ZodReadonly=G.$constructor("$ZodReadonly",(e,t)=>{A.$ZodType.init(e,t),X.defineLazy(e._zod,"propValues",()=>t.innerType._zod.propValues),X.defineLazy(e._zod,"values",()=>t.innerType._zod.values),X.defineLazy(e._zod,"optin",()=>t.innerType?._zod?.optin),X.defineLazy(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(ev):ev(r)}});function ev(e){return e.value=Object.freeze(e.value),e}A.$ZodTemplateLiteral=G.$constructor("$ZodTemplateLiteral",(e,t)=>{A.$ZodType.init(e,t);let n=[];for(let i of t.parts)if(typeof i=="object"&&i!==null){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let r=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!r)throw new Error(`Invalid template literal part: ${i._zod.traits}`);let o=r.startsWith("^")?1:0,a=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(o,a))}else if(i===null||X.primitiveTypes.has(typeof i))n.push(X.escapeRegex(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(i,r)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"string",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),i)});A.$ZodFunction=G.$constructor("$ZodFunction",(e,t)=>(A.$ZodType.init(e,t),e._def=t,e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return function(...i){let r=e._def.input?(0,To.parse)(e._def.input,i):i,o=Reflect.apply(n,this,r);return e._def.output?(0,To.parse)(e._def.output,o):o}},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return async function(...i){let r=e._def.input?await(0,To.parseAsync)(e._def.input,i):i,o=await Reflect.apply(n,this,r);return e._def.output?await(0,To.parseAsync)(e._def.output,o):o}},e._zod.parse=(n,i)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let i=e.constructor;return Array.isArray(n[0])?new i({type:"function",input:new A.$ZodTuple({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new i({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let i=e.constructor;return new i({type:"function",input:e._def.input,output:n})},e));A.$ZodPromise=G.$constructor("$ZodPromise",(e,t)=>{A.$ZodType.init(e,t),e._zod.parse=(n,i)=>Promise.resolve(n.value).then(r=>t.innerType._zod.run({value:r,issues:[]},i))});A.$ZodLazy=G.$constructor("$ZodLazy",(e,t)=>{A.$ZodType.init(e,t),X.defineLazy(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),X.defineLazy(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),X.defineLazy(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),X.defineLazy(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),X.defineLazy(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,i)=>e._zod.innerType._zod.run(n,i)});A.$ZodCustom=G.$constructor("$ZodCustom",(e,t)=>{Ic.$ZodCheck.init(e,t),A.$ZodType.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then(o=>tv(o,n,i,e));tv(r,n,i,e)}});function tv(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(r.params=i._zod.def.params),t.issues.push(X.issue(r))}}});var sv=N((An,av)=>{"use strict";var S0=An&&An.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),k0=An&&An.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),w0=An&&An.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&S0(t,e,n);return k0(t,e),t};Object.defineProperty(An,"__esModule",{value:!0});An.default=A0;var Nc=w0(ue()),E0=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(r){return e[r]??null}let n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Nc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${r.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`}case"invalid_value":return r.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Nc.stringifyPrimitive(r.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${Nc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${r.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${n[o.format]??r.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${r.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${r.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${r.keys.length>1?"\u0629":""}: ${Nc.joinValues(r.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function A0(){return{localeError:E0()}}av.exports=An.default});var lv=N((Tn,cv)=>{"use strict";var T0=Tn&&Tn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),x0=Tn&&Tn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),O0=Tn&&Tn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&T0(t,e,n);return x0(t,e),t};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.default=$0;var Pc=O0(ue()),R0=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Pc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${r.expected}, daxil olan ${s}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o}, daxil olan ${s}`}case"invalid_value":return r.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Pc.stringifyPrimitive(r.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${Pc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[o.format]??r.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${r.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${r.keys.length>1?"lar":""}: ${Pc.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${r.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function $0(){return{localeError:R0()}}cv.exports=Tn.default});var _v=N((xn,dv)=>{"use strict";var C0=xn&&xn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),I0=xn&&xn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),N0=xn&&xn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&C0(t,e,n);return I0(t,e),t};Object.defineProperty(xn,"__esModule",{value:!0});xn.default=M0;var Mc=N0(ue());function uv(e,t,n,i){let r=Math.abs(e),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?n:i}var P0=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(r){return e[r]??null}let n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},i={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Mc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${r.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Mc.stringifyPrimitive(r.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${Mc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),l=uv(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),l=uv(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${r.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${Mc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${r.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function M0(){return{localeError:P0()}}dv.exports=xn.default});var fv=N((On,pv)=>{"use strict";var L0=On&&On.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),j0=On&&On.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),D0=On&&On.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&L0(t,e,n);return j0(t,e),t};Object.defineProperty(On,"__esModule",{value:!0});On.default=z0;var Lc=D0(ue()),U0=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Lc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${Lc.stringifyPrimitive(r.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${Lc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${r.minimum.toString()} ${a.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${a} ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${r.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u043E\u0432\u0435":""}: ${Lc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function z0(){return{localeError:U0()}}pv.exports=On.default});var gv=N((Rn,mv)=>{"use strict";var F0=Rn&&Rn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),q0=Rn&&Rn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),V0=Rn&&Rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&F0(t,e,n);return q0(t,e),t};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.default=Z0;var jc=V0(ue()),W0=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n={regex:"entrada",email:"adre\xE7a electr\xF2nica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=jc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${r.expected}, s'ha rebut ${s}`:`Tipus inv\xE0lid: s'esperava ${o}, s'ha rebut ${s}`}case"invalid_value":return r.values.length===1?`Valor inv\xE0lid: s'esperava ${jc.stringifyPrimitive(r.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${jc.joinValues(r.values," o ")}`;case"too_big":{let o=r.inclusive?"com a m\xE0xim":"menys de",a=t(r.origin);return a?`Massa gran: s'esperava que ${r.origin??"el valor"} contingu\xE9s ${o} ${r.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"com a m\xEDnim":"m\xE9s de",a=t(r.origin);return a?`Massa petit: s'esperava que ${r.origin} contingu\xE9s ${o} ${r.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${r.origin} fos ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${n[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${jc.joinValues(r.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${r.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${r.origin}`;default:return"Entrada inv\xE0lida"}}};function Z0(){return{localeError:W0()}}mv.exports=Rn.default});var yv=N(($n,hv)=>{"use strict";var B0=$n&&$n.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),H0=$n&&$n.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),J0=$n&&$n.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&B0(t,e,n);return H0(t,e),t};Object.defineProperty($n,"__esModule",{value:!0});$n.default=G0;var Dc=J0(ue()),K0=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(r){return e[r]??null}let n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",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:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Dc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${r.expected}, obdr\u017Eeno ${s}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o}, obdr\u017Eeno ${s}`}case"invalid_value":return r.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Dc.stringifyPrimitive(r.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${Dc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${n[o.format]??r.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${r.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${Dc.joinValues(r.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${r.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${r.origin}`;default:return"Neplatn\xFD vstup"}}};function G0(){return{localeError:K0()}}hv.exports=$n.default});var bv=N((Cn,vv)=>{"use strict";var X0=Cn&&Cn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),Y0=Cn&&Cn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Q0=Cn&&Cn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&X0(t,e,n);return Y0(t,e),t};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.default=tN;var Uc=Q0(ue()),eN=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(r){return e[r]??null}let n={regex:"input",email:"e-mailadresse",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 dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},i={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Uc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ugyldigt input: forventede instanceof ${r.expected}, fik ${s}`:`Ugyldigt input: forventede ${o}, fik ${s}`}case"invalid_value":return r.values.length===1?`Ugyldig v\xE6rdi: forventede ${Uc.stringifyPrimitive(r.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${Uc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=i[r.origin]??r.origin;return a?`For stor: forventede ${s??"value"} ${a.verb} ${o} ${r.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=i[r.origin]??r.origin;return a?`For lille: forventede ${s} ${a.verb} ${o} ${r.minimum.toString()} ${a.unit}`:`For lille: forventede ${s} havde ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${n[o.format]??r.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${Uc.joinValues(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${r.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${r.origin}`;default:return"Ugyldigt input"}}};function tN(){return{localeError:eN()}}vv.exports=Cn.default});var kv=N((In,Sv)=>{"use strict";var nN=In&&In.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),rN=In&&In.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),iN=In&&In.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&nN(t,e,n);return rN(t,e),t};Object.defineProperty(In,"__esModule",{value:!0});In.default=aN;var zc=iN(ue()),oN=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},i={nan:"NaN",number:"Zahl",array:"Array"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=zc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${r.expected}, erhalten ${s}`:`Ung\xFCltige Eingabe: erwartet ${o}, erhalten ${s}`}case"invalid_value":return r.values.length===1?`Ung\xFCltige Eingabe: erwartet ${zc.stringifyPrimitive(r.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${zc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ist`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ist`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${n[o.format]??r.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${zc.joinValues(r.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${r.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${r.origin}`;default:return"Ung\xFCltige Eingabe"}}};function aN(){return{localeError:oN()}}Sv.exports=In.default});var Ev=N((Nn,wv)=>{"use strict";var sN=Nn&&Nn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),cN=Nn&&Nn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),lN=Nn&&Nn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&sN(t,e,n);return cN(t,e),t};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.default=dN;var Fc=lN(ue()),uN=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(r){return e[r]??null}let n={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",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 \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Fc.parsedType(r.input),s=i[a]??a;return typeof r.expected=="string"&&/^[A-Z]/.test(r.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${r.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`}case"invalid_value":return r.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${Fc.stringifyPrimitive(r.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${Fc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${r.maximum.toString()} ${a.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${r.minimum.toString()} ${a.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${o.prefix}"`:o.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${o.suffix}"`:o.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${o.includes}"`:o.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${o.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${n[o.format]??r.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${r.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${r.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${r.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${Fc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${r.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${r.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function dN(){return{localeError:uN()}}wv.exports=Nn.default});var dp=N((Pn,Av)=>{"use strict";var _N=Pn&&Pn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),pN=Pn&&Pn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),fN=Pn&&Pn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&_N(t,e,n);return pN(t,e),t};Object.defineProperty(Pn,"__esModule",{value:!0});Pn.default=gN;var qc=fN(ue()),mN=()=>{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(r){return e[r]??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",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=qc.parsedType(r.input),s=i[a]??a;return`Invalid input: expected ${o}, received ${s}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${qc.stringifyPrimitive(r.values[0])}`:`Invalid option: expected one of ${qc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${a.unit}`:`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${qc.joinValues(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return r.options&&Array.isArray(r.options)&&r.options.length>0?`Invalid discriminator value. Expected ${r.options.map(a=>`'${a}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function gN(){return{localeError:mN()}}Av.exports=Pn.default});var xv=N((Mn,Tv)=>{"use strict";var hN=Mn&&Mn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),yN=Mn&&Mn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),vN=Mn&&Mn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&hN(t,e,n);return yN(t,e),t};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.default=SN;var Vc=vN(ue()),bN=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(r){return e[r]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},i={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Vc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${r.expected}, ricevi\u011Dis ${s}`:`Nevalida enigo: atendi\u011Dis ${o}, ricevi\u011Dis ${s}`}case"invalid_value":return r.values.length===1?`Nevalida enigo: atendi\u011Dis ${Vc.stringifyPrimitive(r.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${Vc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${o}${r.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Tro malgranda: atendi\u011Dis ke ${r.origin} havu ${o}${r.minimum.toString()} ${a.unit}`:`Tro malgranda: atendi\u011Dis ke ${r.origin} estu ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${n[o.format]??r.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${r.divisor}`;case"unrecognized_keys":return`Nekonata${r.keys.length>1?"j":""} \u015Dlosilo${r.keys.length>1?"j":""}: ${Vc.joinValues(r.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${r.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${r.origin}`;default:return"Nevalida enigo"}}};function SN(){return{localeError:bN()}}Tv.exports=Mn.default});var Rv=N((Ln,Ov)=>{"use strict";var kN=Ln&&Ln.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),wN=Ln&&Ln.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EN=Ln&&Ln.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&kN(t,e,n);return wN(t,e),t};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=TN;var Wc=EN(ue()),AN=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(r){return e[r]??null}let n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Wc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${r.expected}, recibido ${s}`:`Entrada inv\xE1lida: se esperaba ${o}, recibido ${s}`}case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: se esperaba ${Wc.stringifyPrimitive(r.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${Wc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Demasiado peque\xF1o: se esperaba que ${s} tuviera ${o}${r.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${s} fuera ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${n[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Llave${r.keys.length>1?"s":""} desconocida${r.keys.length>1?"s":""}: ${Wc.joinValues(r.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${i[r.origin]??r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${i[r.origin]??r.origin}`;default:return"Entrada inv\xE1lida"}}};function TN(){return{localeError:AN()}}Ov.exports=Ln.default});var Cv=N((jn,$v)=>{"use strict";var xN=jn&&jn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),ON=jn&&jn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),RN=jn&&jn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&xN(t,e,n);return ON(t,e),t};Object.defineProperty(jn,"__esModule",{value:!0});jn.default=CN;var Zc=RN(ue()),$N=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(r){return e[r]??null}let n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Zc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${r.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return r.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Zc.stringifyPrimitive(r.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${Zc.joinValues(r.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[o.format]??r.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${r.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${r.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${Zc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${r.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${r.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function CN(){return{localeError:$N()}}$v.exports=jn.default});var Nv=N((Dn,Iv)=>{"use strict";var IN=Dn&&Dn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),NN=Dn&&Dn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),PN=Dn&&Dn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&IN(t,e,n);return NN(t,e),t};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.default=LN;var Bc=PN(ue()),MN=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(r){return e[r]??null}let n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Bc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Virheellinen tyyppi: odotettiin instanceof ${r.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${s}`}case"invalid_value":return r.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Bc.stringifyPrimitive(r.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${Bc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${o}${r.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${o}${r.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${n[o.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${Bc.joinValues(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function LN(){return{localeError:MN()}}Iv.exports=Dn.default});var Mv=N((Un,Pv)=>{"use strict";var jN=Un&&Un.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),DN=Un&&Un.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),UN=Un&&Un.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&jN(t,e,n);return DN(t,e),t};Object.defineProperty(Un,"__esModule",{value:!0});Un.default=FN;var Hc=UN(ue()),zN=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n={regex:"entr\xE9e",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},i={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Hc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Entr\xE9e invalide : instanceof ${r.expected} attendu, ${s} re\xE7u`:`Entr\xE9e invalide : ${o} attendu, ${s} re\xE7u`}case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : ${Hc.stringifyPrimitive(r.values[0])} attendu`:`Option invalide : une valeur parmi ${Hc.joinValues(r.values,"|")} attendue`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Trop grand : ${i[r.origin]??"valeur"} doit ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${i[r.origin]??"valeur"} doit \xEAtre ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Trop petit : ${i[r.origin]??"valeur"} doit ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : ${i[r.origin]??"valeur"} doit \xEAtre ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${n[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${Hc.joinValues(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};function FN(){return{localeError:zN()}}Pv.exports=Un.default});var jv=N((zn,Lv)=>{"use strict";var qN=zn&&zn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),VN=zn&&zn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),WN=zn&&zn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&qN(t,e,n);return VN(t,e),t};Object.defineProperty(zn,"__esModule",{value:!0});zn.default=BN;var Jc=WN(ue()),ZN=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n={regex:"entr\xE9e",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Jc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Entr\xE9e invalide : attendu instanceof ${r.expected}, re\xE7u ${s}`:`Entr\xE9e invalide : attendu ${o}, re\xE7u ${s}`}case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : attendu ${Jc.stringifyPrimitive(r.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${Jc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u2264":"<",a=t(r.origin);return a?`Trop grand : attendu que ${r.origin??"la valeur"} ait ${o}${r.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${r.origin??"la valeur"} soit ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u2265":">",a=t(r.origin);return a?`Trop petit : attendu que ${r.origin} ait ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${r.origin} soit ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${n[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${Jc.joinValues(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};function BN(){return{localeError:ZN()}}Lv.exports=zn.default});var Uv=N((Fn,Dv)=>{"use strict";var HN=Fn&&Fn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),JN=Fn&&Fn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),KN=Fn&&Fn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&HN(t,e,n);return JN(t,e),t};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.default=XN;var Kc=KN(ue()),GN=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},n=c=>c?e[c]:void 0,i=c=>{let d=n(c);return d?d.label:c??e.unknown.label},r=c=>`\u05D4${i(c)}`,o=c=>(n(c)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",a=c=>c?t[c]??null:null,s={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return c=>{switch(c.code){case"invalid_type":{let d=c.expected,u=l[d??""]??i(d),_=Kc.parsedType(c.input),p=l[_]??e[_]?.label??_;return/^[A-Z]/.test(c.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${c.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${u}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(c.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${Kc.stringifyPrimitive(c.values[0])}`;let d=c.values.map(p=>Kc.stringifyPrimitive(p));if(c.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d[0]} \u05D0\u05D5 ${d[1]}`;let u=d[d.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d.slice(0,-1).join(", ")} \u05D0\u05D5 ${u}`}case"too_big":{let d=a(c.origin),u=r(c.origin??"value");if(c.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${c.maximum.toString()} ${d?.unit??""} ${c.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(c.origin==="number"){let v=c.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${c.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${c.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${v}`}if(c.origin==="array"||c.origin==="set"){let v=c.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",f=c.inclusive?`${c.maximum} ${d?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${c.maximum} ${d?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${u} ${v} \u05DC\u05D4\u05DB\u05D9\u05DC ${f}`.trim()}let _=c.inclusive?"<=":"<",p=o(c.origin??"value");return d?.unit?`${d.longLabel} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.maximum.toString()} ${d.unit}`:`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.maximum.toString()}`}case"too_small":{let d=a(c.origin),u=r(c.origin??"value");if(c.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${c.minimum.toString()} ${d?.unit??""} ${c.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(c.origin==="number"){let v=c.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${c.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${c.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${u} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${v}`}if(c.origin==="array"||c.origin==="set"){let v=c.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(c.minimum===1&&c.inclusive){let h=(c.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${u} ${v} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`}let f=c.inclusive?`${c.minimum} ${d?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${c.minimum} ${d?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${u} ${v} \u05DC\u05D4\u05DB\u05D9\u05DC ${f}`.trim()}let _=c.inclusive?">=":">",p=o(c.origin??"value");return d?.unit?`${d.shortLabel} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.minimum.toString()} ${d.unit}`:`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${u} ${p} ${_}${c.minimum.toString()}`}case"invalid_format":{let d=c;if(d.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${d.prefix}"`;if(d.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${d.suffix}"`;if(d.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${d.includes}"`;if(d.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${d.pattern}`;let u=s[d.format],_=u?.label??d.format,v=(u?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${_} \u05DC\u05D0 ${v}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${c.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${c.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${c.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${Kc.joinValues(c.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${r(c.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function XN(){return{localeError:GN()}}Dv.exports=Fn.default});var Fv=N((qn,zv)=>{"use strict";var YN=qn&&qn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),QN=qn&&qn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),eP=qn&&qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&YN(t,e,n);return QN(t,e),t};Object.defineProperty(qn,"__esModule",{value:!0});qn.default=nP;var Gc=eP(ue()),tP=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(r){return e[r]??null}let n={regex:"unos",email:"email adresa",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 datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},i={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Gc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${r.expected}, a primljeno je ${s}`:`Neispravan unos: o\u010Dekuje se ${o}, a primljeno je ${s}`}case"invalid_value":return r.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${Gc.stringifyPrimitive(r.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${Gc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Preveliko: o\u010Dekivano da ${s??"vrijednost"} ima ${o}${r.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${s??"vrijednost"} bude ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=i[r.origin]??r.origin;return a?`Premalo: o\u010Dekivano da ${s} ima ${o}${r.minimum.toString()} ${a.unit}`:`Premalo: o\u010Dekivano da ${s} bude ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${o.prefix}"`:o.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${o.suffix}"`:o.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${o.includes}"`:o.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${o.pattern}`:`Neispravna ${n[o.format]??r.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${r.divisor}`;case"unrecognized_keys":return`Neprepoznat${r.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${Gc.joinValues(r.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${i[r.origin]??r.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${i[r.origin]??r.origin}`;default:return"Neispravan unos"}}};function nP(){return{localeError:tP()}}zv.exports=qn.default});var Vv=N((Vn,qv)=>{"use strict";var rP=Vn&&Vn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),iP=Vn&&Vn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),oP=Vn&&Vn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&rP(t,e,n);return iP(t,e),t};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.default=sP;var Xc=oP(ue()),aP=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n={regex:"bemenet",email:"email c\xEDm",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 id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},i={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Xc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${r.expected}, a kapott \xE9rt\xE9k ${s}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o}, a kapott \xE9rt\xE9k ${s}`}case"invalid_value":return r.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Xc.stringifyPrimitive(r.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${Xc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`T\xFAl nagy: ${r.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${r.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${r.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} m\xE9rete t\xFAl kicsi ${o}${r.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} t\xFAl kicsi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[o.format]??r.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${r.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${Xc.joinValues(r.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${r.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${r.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function sP(){return{localeError:aP()}}qv.exports=Vn.default});var Bv=N((Wn,Zv)=>{"use strict";var cP=Wn&&Wn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),lP=Wn&&Wn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),uP=Wn&&Wn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&cP(t,e,n);return lP(t,e),t};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.default=_P;var Yc=uP(ue());function Wv(e,t,n){return Math.abs(e)===1?t:n}function xo(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],n=e[e.length-1];return e+(t.includes(n)?"\u0576":"\u0568")}var dP=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(r){return e[r]??null}let n={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},i={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Yc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${r.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${o}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`}case"invalid_value":return r.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${Yc.stringifyPrimitive(r.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${Yc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),l=Wv(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${xo(r.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${r.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${xo(r.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),l=Wv(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${xo(r.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${r.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${xo(r.origin)} \u056C\u056B\u0576\u056B ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${o.prefix}"-\u0578\u057E`:o.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${o.suffix}"-\u0578\u057E`:o.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${o.includes}"`:o.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${o.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${n[o.format]??r.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${r.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${r.keys.length>1?"\u0576\u0565\u0580":""}. ${Yc.joinValues(r.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${xo(r.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${xo(r.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function _P(){return{localeError:dP()}}Zv.exports=Wn.default});var Jv=N((Zn,Hv)=>{"use strict";var pP=Zn&&Zn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),fP=Zn&&Zn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),mP=Zn&&Zn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&pP(t,e,n);return fP(t,e),t};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.default=hP;var Qc=mP(ue()),gP=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Qc.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Input tidak valid: diharapkan instanceof ${r.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${o}, diterima ${s}`}case"invalid_value":return r.values.length===1?`Input tidak valid: diharapkan ${Qc.stringifyPrimitive(r.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${Qc.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: diharapkan ${r.origin} memiliki ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${r.origin} menjadi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${n[o.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${Qc.joinValues(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function hP(){return{localeError:gP()}}Hv.exports=Zn.default});var Gv=N((Bn,Kv)=>{"use strict";var yP=Bn&&Bn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),vP=Bn&&Bn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),bP=Bn&&Bn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&yP(t,e,n);return vP(t,e),t};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.default=kP;var el=bP(ue()),SP=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(r){return e[r]??null}let n={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},i={nan:"NaN",number:"n\xFAmer",array:"fylki"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=el.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera instanceof ${r.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera ${o}`}case"invalid_value":return r.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${el.stringifyPrimitive(r.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${el.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin??"gildi"} hafi ${o}${r.maximum.toString()} ${a.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin??"gildi"} s\xE9 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin} hafi ${o}${r.minimum.toString()} ${a.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin} s\xE9 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${n[o.format]??r.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${r.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${r.keys.length>1?"ir lyklar":"ur lykill"}: ${el.joinValues(r.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${r.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${r.origin}`;default:return"Rangt gildi"}}};function kP(){return{localeError:SP()}}Kv.exports=Bn.default});var Yv=N((Hn,Xv)=>{"use strict";var wP=Hn&&Hn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),EP=Hn&&Hn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),AP=Hn&&Hn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&wP(t,e,n);return EP(t,e),t};Object.defineProperty(Hn,"__esModule",{value:!0});Hn.default=xP;var tl=AP(ue()),TP=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"numero",array:"vettore"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=tl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Input non valido: atteso instanceof ${r.expected}, ricevuto ${s}`:`Input non valido: atteso ${o}, ricevuto ${s}`}case"invalid_value":return r.values.length===1?`Input non valido: atteso ${tl.stringifyPrimitive(r.values[0])}`:`Opzione non valida: atteso uno tra ${tl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Troppo grande: ${r.origin??"valore"} deve avere ${o}${r.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${r.origin??"valore"} deve essere ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Troppo piccolo: ${r.origin} deve avere ${o}${r.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${r.origin} deve essere ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Input non valido: ${n[o.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${tl.joinValues(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function xP(){return{localeError:TP()}}Xv.exports=Hn.default});var eb=N((Jn,Qv)=>{"use strict";var OP=Jn&&Jn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),RP=Jn&&Jn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$P=Jn&&Jn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&OP(t,e,n);return RP(t,e),t};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.default=IP;var nl=$P(ue()),CP=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(r){return e[r]??null}let n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},i={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=nl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${r.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${o}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return r.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${nl.stringifyPrimitive(r.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${nl.joinValues(r.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=r.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=t(r.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${a.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=r.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=t(r.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${a.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${r.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${r.keys.length>1?"\u7FA4":""}: ${nl.joinValues(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function IP(){return{localeError:CP()}}Qv.exports=Jn.default});var nb=N((Kn,tb)=>{"use strict";var NP=Kn&&Kn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),PP=Kn&&Kn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),MP=Kn&&Kn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&NP(t,e,n);return PP(t,e),t};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.default=jP;var rl=MP(ue()),LP=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(r){return e[r]??null}let n={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},i={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=rl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${r.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`}case"invalid_value":return r.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${rl.stringifyPrimitive(r.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${rl.joinValues(r.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${r.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${r.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${rl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${r.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${r.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function jP(){return{localeError:LP()}}tb.exports=Kn.default});var _p=N((Gn,rb)=>{"use strict";var DP=Gn&&Gn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),UP=Gn&&Gn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),zP=Gn&&Gn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&DP(t,e,n);return UP(t,e),t};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.default=qP;var il=zP(ue()),FP=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(r){return e[r]??null}let n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},i={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=il.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${r.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`}case"invalid_value":return r.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${il.stringifyPrimitive(r.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${il.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${r.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${il.joinValues(r.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function qP(){return{localeError:FP()}}rb.exports=Gn.default});var ob=N((Oo,ib)=>{"use strict";var VP=Oo&&Oo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.default=ZP;var WP=VP(_p());function ZP(){return(0,WP.default)()}ib.exports=Oo.default});var sb=N((Xn,ab)=>{"use strict";var BP=Xn&&Xn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),HP=Xn&&Xn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),JP=Xn&&Xn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&BP(t,e,n);return HP(t,e),t};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.default=GP;var ol=JP(ue()),KP=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(r){return e[r]??null}let n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ol.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${r.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`}case"invalid_value":return r.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${ol.stringifyPrimitive(r.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${ol.joinValues(r.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=r.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),l=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()}${l} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()} ${o}${a}`}case"too_small":{let o=r.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),l=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()}${l} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()} ${o}${a}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[o.format]??r.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${r.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${ol.joinValues(r.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${r.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${r.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function GP(){return{localeError:KP()}}ab.exports=Xn.default});var ub=N((Yn,lb)=>{"use strict";var XP=Yn&&Yn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),YP=Yn&&Yn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),QP=Yn&&Yn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&XP(t,e,n);return YP(t,e),t};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.default=tM;var al=QP(ue()),Oa=e=>e.charAt(0).toUpperCase()+e.slice(1);function cb(e){let t=Math.abs(e),n=t%10,i=t%100;return i>=11&&i<=19||n===0?"many":n===1?"one":"few"}var eM=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(r,o,a,s){let l=e[r]??null;return l===null?l:{unit:l.unit[o],verb:l.verb[s][a?"inclusive":"notInclusive"]}}let n={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},i={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=al.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Gautas tipas ${s}, o tik\u0117tasi - instanceof ${r.expected}`:`Gautas tipas ${s}, o tik\u0117tasi - ${o}`}case"invalid_value":return r.values.length===1?`Privalo b\u016Bti ${al.stringifyPrimitive(r.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${al.joinValues(r.values,"|")} pasirinkim\u0173`;case"too_big":{let o=i[r.origin]??r.origin,a=t(r.origin,cb(Number(r.maximum)),r.inclusive??!1,"smaller");if(a?.verb)return`${Oa(o??r.origin??"reik\u0161m\u0117")} ${a.verb} ${r.maximum.toString()} ${a.unit??"element\u0173"}`;let s=r.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Oa(o??r.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${r.maximum.toString()} ${a?.unit}`}case"too_small":{let o=i[r.origin]??r.origin,a=t(r.origin,cb(Number(r.minimum)),r.inclusive??!1,"bigger");if(a?.verb)return`${Oa(o??r.origin??"reik\u0161m\u0117")} ${a.verb} ${r.minimum.toString()} ${a.unit??"element\u0173"}`;let s=r.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Oa(o??r.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${r.minimum.toString()} ${a?.unit}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${n[o.format]??r.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${r.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${r.keys.length>1?"i":"as"} rakt${r.keys.length>1?"ai":"as"}: ${al.joinValues(r.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=i[r.origin]??r.origin;return`${Oa(o??r.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function tM(){return{localeError:eM()}}lb.exports=Yn.default});var _b=N((Qn,db)=>{"use strict";var nM=Qn&&Qn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),rM=Qn&&Qn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),iM=Qn&&Qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&nM(t,e,n);return rM(t,e),t};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.default=aM;var sl=iM(ue()),oM=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(r){return e[r]??null}let n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},i={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=sl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${r.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${sl.stringifyPrimitive(r.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${sl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${sl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${r.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${r.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function aM(){return{localeError:oM()}}db.exports=Qn.default});var fb=N((er,pb)=>{"use strict";var sM=er&&er.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),cM=er&&er.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),lM=er&&er.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&sM(t,e,n);return cM(t,e),t};Object.defineProperty(er,"__esModule",{value:!0});er.default=dM;var cl=lM(ue()),uM=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"nombor"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=cl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Input tidak sah: dijangka instanceof ${r.expected}, diterima ${s}`:`Input tidak sah: dijangka ${o}, diterima ${s}`}case"invalid_value":return r.values.length===1?`Input tidak sah: dijangka ${cl.stringifyPrimitive(r.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${cl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: dijangka ${r.origin??"nilai"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: dijangka ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${r.origin} adalah ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${n[o.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${cl.joinValues(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function dM(){return{localeError:uM()}}pb.exports=er.default});var gb=N((tr,mb)=>{"use strict";var _M=tr&&tr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),pM=tr&&tr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),fM=tr&&tr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&_M(t,e,n);return pM(t,e),t};Object.defineProperty(tr,"__esModule",{value:!0});tr.default=gM;var ll=fM(ue()),mM=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(r){return e[r]??null}let n={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},i={nan:"NaN",number:"getal"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ll.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ongeldige invoer: verwacht instanceof ${r.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${o}, ontving ${s}`}case"invalid_value":return r.values.length===1?`Ongeldige invoer: verwacht ${ll.stringifyPrimitive(r.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${ll.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin),s=r.origin==="date"?"laat":r.origin==="string"?"lang":"groot";return a?`Te ${s}: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${s}: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} is`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin),s=r.origin==="date"?"vroeg":r.origin==="string"?"kort":"klein";return a?`Te ${s}: verwacht dat ${r.origin} ${o}${r.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${s}: verwacht dat ${r.origin} ${o}${r.minimum.toString()} is`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${n[o.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${ll.joinValues(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function gM(){return{localeError:mM()}}mb.exports=tr.default});var yb=N((nr,hb)=>{"use strict";var hM=nr&&nr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),yM=nr&&nr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),vM=nr&&nr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&hM(t,e,n);return yM(t,e),t};Object.defineProperty(nr,"__esModule",{value:!0});nr.default=SM;var ul=vM(ue()),bM=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(r){return e[r]??null}let n={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"tall",array:"liste"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ul.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ugyldig input: forventet instanceof ${r.expected}, fikk ${s}`:`Ugyldig input: forventet ${o}, fikk ${s}`}case"invalid_value":return r.values.length===1?`Ugyldig verdi: forventet ${ul.stringifyPrimitive(r.values[0])}`:`Ugyldig valg: forventet en av ${ul.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${n[o.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${ul.joinValues(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function SM(){return{localeError:bM()}}hb.exports=nr.default});var bb=N((rr,vb)=>{"use strict";var kM=rr&&rr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),wM=rr&&rr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EM=rr&&rr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&kM(t,e,n);return wM(t,e),t};Object.defineProperty(rr,"__esModule",{value:!0});rr.default=TM;var dl=EM(ue()),AM=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n={regex:"giren",email:"epostag\xE2h",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 heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},i={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=dl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`F\xE2sit giren: umulan instanceof ${r.expected}, al\u0131nan ${s}`:`F\xE2sit giren: umulan ${o}, al\u0131nan ${s}`}case"invalid_value":return r.values.length===1?`F\xE2sit giren: umulan ${dl.stringifyPrimitive(r.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${dl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=r;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[o.format]??r.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${r.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${r.keys.length>1?"s":""}: ${dl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${r.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function TM(){return{localeError:AM()}}vb.exports=rr.default});var kb=N((ir,Sb)=>{"use strict";var xM=ir&&ir.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),OM=ir&&ir.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),RM=ir&&ir.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&xM(t,e,n);return OM(t,e),t};Object.defineProperty(ir,"__esModule",{value:!0});ir.default=CM;var _l=RM(ue()),$M=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(r){return e[r]??null}let n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=_l.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${r.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return r.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${_l.stringifyPrimitive(r.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${_l.joinValues(r.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0648\u064A`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[o.format]??r.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${r.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${r.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${_l.joinValues(r.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${r.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${r.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function CM(){return{localeError:$M()}}Sb.exports=ir.default});var Eb=N((or,wb)=>{"use strict";var IM=or&&or.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),NM=or&&or.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),PM=or&&or.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&IM(t,e,n);return NM(t,e),t};Object.defineProperty(or,"__esModule",{value:!0});or.default=LM;var pl=PM(ue()),MM=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(r){return e[r]??null}let n={regex:"wyra\u017Cenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},i={nan:"NaN",number:"liczba",array:"tablica"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=pl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${r.expected}, otrzymano ${s}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o}, otrzymano ${s}`}case"invalid_value":return r.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${pl.stringifyPrimitive(r.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${pl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[o.format]??r.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${pl.joinValues(r.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${r.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${r.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function LM(){return{localeError:MM()}}wb.exports=or.default});var Tb=N((ar,Ab)=>{"use strict";var jM=ar&&ar.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),DM=ar&&ar.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),UM=ar&&ar.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&jM(t,e,n);return DM(t,e),t};Object.defineProperty(ar,"__esModule",{value:!0});ar.default=FM;var fl=UM(ue()),zM=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",number:"n\xFAmero",null:"nulo"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=fl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Tipo inv\xE1lido: esperado instanceof ${r.expected}, recebido ${s}`:`Tipo inv\xE1lido: esperado ${o}, recebido ${s}`}case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: esperado ${fl.stringifyPrimitive(r.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${fl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Muito grande: esperado que ${r.origin??"valor"} tivesse ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${r.origin??"valor"} fosse ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Muito pequeno: esperado que ${r.origin} tivesse ${o}${r.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${r.origin} fosse ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${n[o.format]??r.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${fl.joinValues(r.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${r.origin}`;default:return"Campo inv\xE1lido"}}};function FM(){return{localeError:zM()}}Ab.exports=ar.default});var Ob=N((sr,xb)=>{"use strict";var qM=sr&&sr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),VM=sr&&sr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),WM=sr&&sr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&qM(t,e,n);return VM(t,e),t};Object.defineProperty(sr,"__esModule",{value:!0});sr.default=BM;var ml=WM(ue()),ZM=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(r){return e[r]??null}let n={regex:"intrare",email:"adres\u0103 de email",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:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},i={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=ml.parsedType(r.input),s=i[a]??a;return`Intrare invalid\u0103: a\u0219teptat ${o}, primit ${s}`}case"invalid_value":return r.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${ml.stringifyPrimitive(r.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${ml.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Prea mare: a\u0219teptat ca ${r.origin??"valoarea"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${r.origin??"valoarea"} s\u0103 fie ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Prea mic: a\u0219teptat ca ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Prea mic: a\u0219teptat ca ${r.origin} s\u0103 fie ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${o.prefix}"`:o.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${o.suffix}"`:o.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${o.includes}"`:o.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${o.pattern}`:`Format invalid: ${n[o.format]??r.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${r.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${ml.joinValues(r.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${r.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${r.origin}`;default:return"Intrare invalid\u0103"}}};function BM(){return{localeError:ZM()}}xb.exports=sr.default});var Cb=N((cr,$b)=>{"use strict";var HM=cr&&cr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),JM=cr&&cr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),KM=cr&&cr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&HM(t,e,n);return JM(t,e),t};Object.defineProperty(cr,"__esModule",{value:!0});cr.default=XM;var gl=KM(ue());function Rb(e,t,n,i){let r=Math.abs(e),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?n:i}var GM=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=gl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${gl.stringifyPrimitive(r.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${gl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),l=Rb(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),l=Rb(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${r.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0438":""}: ${gl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function XM(){return{localeError:GM()}}$b.exports=cr.default});var Nb=N((lr,Ib)=>{"use strict";var YM=lr&&lr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),QM=lr&&lr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),eL=lr&&lr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&YM(t,e,n);return QM(t,e),t};Object.defineProperty(lr,"__esModule",{value:!0});lr.default=nL;var hl=eL(ue()),tL=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n={regex:"vnos",email:"e-po\u0161tni naslov",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 datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},i={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=hl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${r.expected}, prejeto ${s}`:`Neveljaven vnos: pri\u010Dakovano ${o}, prejeto ${s}`}case"invalid_value":return r.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${hl.stringifyPrimitive(r.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${hl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} imelo ${o}${r.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${r.origin} imelo ${o}${r.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${n[o.format]??r.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${hl.joinValues(r.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function nL(){return{localeError:tL()}}Ib.exports=lr.default});var Mb=N((ur,Pb)=>{"use strict";var rL=ur&&ur.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),iL=ur&&ur.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),oL=ur&&ur.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&rL(t,e,n);return iL(t,e),t};Object.defineProperty(ur,"__esModule",{value:!0});ur.default=sL;var yl=oL(ue()),aL=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(r){return e[r]??null}let n={regex:"regulj\xE4rt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},i={nan:"NaN",number:"antal",array:"lista"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=yl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${r.expected}, fick ${s}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${o}, fick ${s}`}case"invalid_value":return r.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${yl.stringifyPrimitive(r.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${yl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${n[o.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${yl.joinValues(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${r.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function sL(){return{localeError:aL()}}Pb.exports=ur.default});var jb=N((dr,Lb)=>{"use strict";var cL=dr&&dr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),lL=dr&&dr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),uL=dr&&dr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&cL(t,e,n);return lL(t,e),t};Object.defineProperty(dr,"__esModule",{value:!0});dr.default=_L;var vl=uL(ue()),dL=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(r){return e[r]??null}let n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",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 \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=vl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${r.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`}case"invalid_value":return r.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${vl.stringifyPrimitive(r.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${vl.joinValues(r.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${r.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${r.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${vl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function _L(){return{localeError:dL()}}Lb.exports=dr.default});var Ub=N((_r,Db)=>{"use strict";var pL=_r&&_r.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),fL=_r&&_r.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),mL=_r&&_r.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&pL(t,e,n);return fL(t,e),t};Object.defineProperty(_r,"__esModule",{value:!0});_r.default=hL;var bl=mL(ue()),gL=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(r){return e[r]??null}let n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},i={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=bl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${r.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`}case"invalid_value":return r.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${bl.stringifyPrimitive(r.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${bl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[o.format]??r.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${r.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${bl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function hL(){return{localeError:gL()}}Db.exports=_r.default});var Fb=N((pr,zb)=>{"use strict";var yL=pr&&pr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),vL=pr&&pr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),bL=pr&&pr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&yL(t,e,n);return vL(t,e),t};Object.defineProperty(pr,"__esModule",{value:!0});pr.default=kL;var Sl=bL(ue()),SL=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(r){return e[r]??null}let n={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Sl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${r.expected}, al\u0131nan ${s}`:`Ge\xE7ersiz de\u011Fer: beklenen ${o}, al\u0131nan ${s}`}case"invalid_value":return r.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Sl.stringifyPrimitive(r.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${Sl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${o}${r.maximum.toString()} ${a.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${n[o.format]??r.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${r.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${r.keys.length>1?"lar":""}: ${Sl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${r.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function kL(){return{localeError:SL()}}zb.exports=pr.default});var pp=N((fr,qb)=>{"use strict";var wL=fr&&fr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),EL=fr&&fr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),AL=fr&&fr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&wL(t,e,n);return EL(t,e),t};Object.defineProperty(fr,"__esModule",{value:!0});fr.default=xL;var kl=AL(ue()),TL=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=kl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${r.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${kl.stringifyPrimitive(r.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${kl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} \u0431\u0443\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0456":""}: ${kl.joinValues(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${r.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function xL(){return{localeError:TL()}}qb.exports=fr.default});var Wb=N((Ro,Vb)=>{"use strict";var OL=Ro&&Ro.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.default=$L;var RL=OL(pp());function $L(){return(0,RL.default)()}Vb.exports=Ro.default});var Bb=N((mr,Zb)=>{"use strict";var CL=mr&&mr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),IL=mr&&mr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),NL=mr&&mr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&CL(t,e,n);return IL(t,e),t};Object.defineProperty(mr,"__esModule",{value:!0});mr.default=ML;var wl=NL(ue()),PL=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(r){return e[r]??null}let n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},i={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=wl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${r.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return r.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${wl.stringifyPrimitive(r.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${wl.joinValues(r.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${r.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u06D2 ${o}${r.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u0627 ${o}${r.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${r.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${r.keys.length>1?"\u0632":""}: ${wl.joinValues(r.keys,"\u060C ")}`;case"invalid_key":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function ML(){return{localeError:PL()}}Zb.exports=mr.default});var Jb=N((gr,Hb)=>{"use strict";var LL=gr&&gr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),jL=gr&&gr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),DL=gr&&gr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&LL(t,e,n);return jL(t,e),t};Object.defineProperty(gr,"__esModule",{value:!0});gr.default=zL;var El=DL(ue()),UL=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(r){return e[r]??null}let n={regex:"kirish",email:"elektron pochta manzili",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 sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},i={nan:"NaN",number:"raqam",array:"massiv"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=El.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${r.expected}, qabul qilingan ${s}`:`Noto\u2018g\u2018ri kirish: kutilgan ${o}, qabul qilingan ${s}`}case"invalid_value":return r.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${El.stringifyPrimitive(r.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${El.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Juda katta: kutilgan ${r.origin??"qiymat"} ${o}${r.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${r.origin??"qiymat"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Juda kichik: kutilgan ${r.origin} ${o}${r.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto\u2018g\u2018ri satr: "${o.includes}" ni o\u2018z ichiga olishi kerak`:o.format==="regex"?`Noto\u2018g\u2018ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${n[o.format]??r.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${r.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${r.keys.length>1?"lar":""}: ${El.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${r.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function zL(){return{localeError:UL()}}Hb.exports=gr.default});var Gb=N((hr,Kb)=>{"use strict";var FL=hr&&hr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),qL=hr&&hr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),VL=hr&&hr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&FL(t,e,n);return qL(t,e),t};Object.defineProperty(hr,"__esModule",{value:!0});hr.default=ZL;var Al=VL(ue()),WL=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(r){return e[r]??null}let n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",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:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},i={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Al.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${r.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`}case"invalid_value":return r.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Al.stringifyPrimitive(r.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${Al.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${n[o.format]??r.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${r.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${Al.joinValues(r.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function ZL(){return{localeError:WL()}}Kb.exports=hr.default});var Yb=N((yr,Xb)=>{"use strict";var BL=yr&&yr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),HL=yr&&yr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),JL=yr&&yr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&BL(t,e,n);return HL(t,e),t};Object.defineProperty(yr,"__esModule",{value:!0});yr.default=GL;var Tl=JL(ue()),KL=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(r){return e[r]??null}let n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},i={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Tl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${r.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`}case"invalid_value":return r.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Tl.stringifyPrimitive(r.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${Tl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${n[o.format]??r.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${r.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${Tl.joinValues(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${r.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function GL(){return{localeError:KL()}}Xb.exports=yr.default});var eS=N((vr,Qb)=>{"use strict";var XL=vr&&vr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),YL=vr&&vr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),QL=vr&&vr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&XL(t,e,n);return YL(t,e),t};Object.defineProperty(vr,"__esModule",{value:!0});vr.default=tj;var xl=QL(ue()),ej=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(r){return e[r]??null}let n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",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 \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},i={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=xl.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${r.expected}\uFF0C\u4F46\u6536\u5230 ${s}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o}\uFF0C\u4F46\u6536\u5230 ${s}`}case"invalid_value":return r.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${xl.stringifyPrimitive(r.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${xl.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${n[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${r.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${r.keys.length>1?"\u5011":""}\uFF1A${xl.joinValues(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function tj(){return{localeError:ej()}}Qb.exports=vr.default});var nS=N((br,tS)=>{"use strict";var nj=br&&br.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),rj=br&&br.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ij=br&&br.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&nj(t,e,n);return rj(t,e),t};Object.defineProperty(br,"__esModule",{value:!0});br.default=aj;var Ol=ij(ue()),oj=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(r){return e[r]??null}let n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",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:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},i={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return r=>{switch(r.code){case"invalid_type":{let o=i[r.expected]??r.expected,a=Ol.parsedType(r.input),s=i[a]??a;return/^[A-Z]/.test(r.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${r.expected}, \xE0m\u1ECD\u0300 a r\xED ${s}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o}, \xE0m\u1ECD\u0300 a r\xED ${s}`}case"invalid_value":return r.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${Ol.stringifyPrimitive(r.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${Ol.joinValues(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${r.origin??"iye"} ${a.verb} ${o}${r.maximum} ${a.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${r.maximum}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${r.origin} ${a.verb} ${o}${r.minimum} ${a.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${r.minimum}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${o.prefix}"`:o.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${o.suffix}"`:o.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${o.includes}"`:o.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${o.pattern}`:`A\u1E63\xEC\u1E63e: ${n[o.format]??r.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${r.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${Ol.joinValues(r.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${r.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${r.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function aj(){return{localeError:oj()}}tS.exports=br.default});var fp=N(F=>{"use strict";var ye=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(F,"__esModule",{value:!0});F.zhCN=F.vi=F.uz=F.ur=F.uk=F.ua=F.tr=F.th=F.ta=F.sv=F.sl=F.ru=F.ro=F.pt=F.pl=F.ps=F.ota=F.no=F.nl=F.ms=F.mk=F.lt=F.ko=F.km=F.kh=F.ka=F.ja=F.it=F.is=F.id=F.hy=F.hu=F.hr=F.he=F.frCA=F.fr=F.fi=F.fa=F.es=F.eo=F.en=F.el=F.de=F.da=F.cs=F.ca=F.bg=F.be=F.az=F.ar=void 0;F.yo=F.zhTW=void 0;var sj=sv();Object.defineProperty(F,"ar",{enumerable:!0,get:function(){return ye(sj).default}});var cj=lv();Object.defineProperty(F,"az",{enumerable:!0,get:function(){return ye(cj).default}});var lj=_v();Object.defineProperty(F,"be",{enumerable:!0,get:function(){return ye(lj).default}});var uj=fv();Object.defineProperty(F,"bg",{enumerable:!0,get:function(){return ye(uj).default}});var dj=gv();Object.defineProperty(F,"ca",{enumerable:!0,get:function(){return ye(dj).default}});var _j=yv();Object.defineProperty(F,"cs",{enumerable:!0,get:function(){return ye(_j).default}});var pj=bv();Object.defineProperty(F,"da",{enumerable:!0,get:function(){return ye(pj).default}});var fj=kv();Object.defineProperty(F,"de",{enumerable:!0,get:function(){return ye(fj).default}});var mj=Ev();Object.defineProperty(F,"el",{enumerable:!0,get:function(){return ye(mj).default}});var gj=dp();Object.defineProperty(F,"en",{enumerable:!0,get:function(){return ye(gj).default}});var hj=xv();Object.defineProperty(F,"eo",{enumerable:!0,get:function(){return ye(hj).default}});var yj=Rv();Object.defineProperty(F,"es",{enumerable:!0,get:function(){return ye(yj).default}});var vj=Cv();Object.defineProperty(F,"fa",{enumerable:!0,get:function(){return ye(vj).default}});var bj=Nv();Object.defineProperty(F,"fi",{enumerable:!0,get:function(){return ye(bj).default}});var Sj=Mv();Object.defineProperty(F,"fr",{enumerable:!0,get:function(){return ye(Sj).default}});var kj=jv();Object.defineProperty(F,"frCA",{enumerable:!0,get:function(){return ye(kj).default}});var wj=Uv();Object.defineProperty(F,"he",{enumerable:!0,get:function(){return ye(wj).default}});var Ej=Fv();Object.defineProperty(F,"hr",{enumerable:!0,get:function(){return ye(Ej).default}});var Aj=Vv();Object.defineProperty(F,"hu",{enumerable:!0,get:function(){return ye(Aj).default}});var Tj=Bv();Object.defineProperty(F,"hy",{enumerable:!0,get:function(){return ye(Tj).default}});var xj=Jv();Object.defineProperty(F,"id",{enumerable:!0,get:function(){return ye(xj).default}});var Oj=Gv();Object.defineProperty(F,"is",{enumerable:!0,get:function(){return ye(Oj).default}});var Rj=Yv();Object.defineProperty(F,"it",{enumerable:!0,get:function(){return ye(Rj).default}});var $j=eb();Object.defineProperty(F,"ja",{enumerable:!0,get:function(){return ye($j).default}});var Cj=nb();Object.defineProperty(F,"ka",{enumerable:!0,get:function(){return ye(Cj).default}});var Ij=ob();Object.defineProperty(F,"kh",{enumerable:!0,get:function(){return ye(Ij).default}});var Nj=_p();Object.defineProperty(F,"km",{enumerable:!0,get:function(){return ye(Nj).default}});var Pj=sb();Object.defineProperty(F,"ko",{enumerable:!0,get:function(){return ye(Pj).default}});var Mj=ub();Object.defineProperty(F,"lt",{enumerable:!0,get:function(){return ye(Mj).default}});var Lj=_b();Object.defineProperty(F,"mk",{enumerable:!0,get:function(){return ye(Lj).default}});var jj=fb();Object.defineProperty(F,"ms",{enumerable:!0,get:function(){return ye(jj).default}});var Dj=gb();Object.defineProperty(F,"nl",{enumerable:!0,get:function(){return ye(Dj).default}});var Uj=yb();Object.defineProperty(F,"no",{enumerable:!0,get:function(){return ye(Uj).default}});var zj=bb();Object.defineProperty(F,"ota",{enumerable:!0,get:function(){return ye(zj).default}});var Fj=kb();Object.defineProperty(F,"ps",{enumerable:!0,get:function(){return ye(Fj).default}});var qj=Eb();Object.defineProperty(F,"pl",{enumerable:!0,get:function(){return ye(qj).default}});var Vj=Tb();Object.defineProperty(F,"pt",{enumerable:!0,get:function(){return ye(Vj).default}});var Wj=Ob();Object.defineProperty(F,"ro",{enumerable:!0,get:function(){return ye(Wj).default}});var Zj=Cb();Object.defineProperty(F,"ru",{enumerable:!0,get:function(){return ye(Zj).default}});var Bj=Nb();Object.defineProperty(F,"sl",{enumerable:!0,get:function(){return ye(Bj).default}});var Hj=Mb();Object.defineProperty(F,"sv",{enumerable:!0,get:function(){return ye(Hj).default}});var Jj=jb();Object.defineProperty(F,"ta",{enumerable:!0,get:function(){return ye(Jj).default}});var Kj=Ub();Object.defineProperty(F,"th",{enumerable:!0,get:function(){return ye(Kj).default}});var Gj=Fb();Object.defineProperty(F,"tr",{enumerable:!0,get:function(){return ye(Gj).default}});var Xj=Wb();Object.defineProperty(F,"ua",{enumerable:!0,get:function(){return ye(Xj).default}});var Yj=pp();Object.defineProperty(F,"uk",{enumerable:!0,get:function(){return ye(Yj).default}});var Qj=Bb();Object.defineProperty(F,"ur",{enumerable:!0,get:function(){return ye(Qj).default}});var eD=Jb();Object.defineProperty(F,"uz",{enumerable:!0,get:function(){return ye(eD).default}});var tD=Gb();Object.defineProperty(F,"vi",{enumerable:!0,get:function(){return ye(tD).default}});var nD=Yb();Object.defineProperty(F,"zhCN",{enumerable:!0,get:function(){return ye(nD).default}});var rD=eS();Object.defineProperty(F,"zhTW",{enumerable:!0,get:function(){return ye(rD).default}});var iD=nS();Object.defineProperty(F,"yo",{enumerable:!0,get:function(){return ye(iD).default}})});var Ra=N(pn=>{"use strict";var rS;Object.defineProperty(pn,"__esModule",{value:!0});pn.globalRegistry=pn.$ZodRegistry=pn.$input=pn.$output=void 0;pn.registry=iS;pn.$output=Symbol("ZodOutput");pn.$input=Symbol("ZodInput");var Rl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let i={...this.get(n)??{}};delete i.id;let r={...i,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};pn.$ZodRegistry=Rl;function iS(){return new Rl}(rS=globalThis).__zod_globalRegistry??(rS.__zod_globalRegistry=iS());pn.globalRegistry=globalThis.__zod_globalRegistry});var cS=N(M=>{"use strict";var oD=M&&M.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),aD=M&&M.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Il=M&&M.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&oD(t,e,n);return aD(t,e),t};Object.defineProperty(M,"__esModule",{value:!0});M.TimePrecision=void 0;M._string=sD;M._coercedString=cD;M._email=lD;M._guid=uD;M._uuid=dD;M._uuidv4=_D;M._uuidv6=pD;M._uuidv7=fD;M._url=mD;M._emoji=gD;M._nanoid=hD;M._cuid=yD;M._cuid2=vD;M._ulid=bD;M._xid=SD;M._ksuid=kD;M._ipv4=wD;M._ipv6=ED;M._mac=AD;M._cidrv4=TD;M._cidrv6=xD;M._base64=OD;M._base64url=RD;M._e164=$D;M._jwt=CD;M._isoDateTime=ID;M._isoDate=ND;M._isoTime=PD;M._isoDuration=MD;M._number=LD;M._coercedNumber=jD;M._int=DD;M._float32=UD;M._float64=zD;M._int32=FD;M._uint32=qD;M._boolean=VD;M._coercedBoolean=WD;M._bigint=ZD;M._coercedBigint=BD;M._int64=HD;M._uint64=JD;M._symbol=KD;M._undefined=GD;M._null=XD;M._any=YD;M._unknown=QD;M._never=eU;M._void=tU;M._date=nU;M._coercedDate=rU;M._nan=iU;M._lt=oS;M._lte=$a;M._max=$a;M._lte=$a;M._max=$a;M._gt=aS;M._gte=Ca;M._min=Ca;M._gte=Ca;M._min=Ca;M._positive=oU;M._negative=aU;M._nonpositive=sU;M._nonnegative=cU;M._multipleOf=lU;M._maxSize=uU;M._minSize=dU;M._size=_U;M._maxLength=pU;M._minLength=fU;M._length=mU;M._regex=gU;M._lowercase=hU;M._uppercase=yU;M._includes=vU;M._startsWith=bU;M._endsWith=SU;M._property=kU;M._mime=wU;M._overwrite=$o;M._normalize=EU;M._trim=AU;M._toLowerCase=TU;M._toUpperCase=xU;M._slugify=OU;M._array=RU;M._union=$U;M._xor=CU;M._discriminatedUnion=IU;M._intersection=NU;M._tuple=PU;M._record=MU;M._map=LU;M._set=jU;M._enum=DU;M._nativeEnum=UU;M._literal=zU;M._file=FU;M._transform=qU;M._optional=VU;M._nullable=WU;M._default=ZU;M._nonoptional=BU;M._success=HU;M._catch=JU;M._pipe=KU;M._readonly=GU;M._templateLiteral=XU;M._lazy=YU;M._promise=QU;M._custom=e1;M._refine=t1;M._superRefine=n1;M._check=sS;M.describe=r1;M.meta=i1;M._stringbool=o1;M._stringFormat=a1;var it=Il(Ec()),Cl=Il(Ra()),$l=Il(up()),J=Il(ue());function sD(e,t){return new e({type:"string",...J.normalizeParams(t)})}function cD(e,t){return new e({type:"string",coerce:!0,...J.normalizeParams(t)})}function lD(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...J.normalizeParams(t)})}function uD(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function dD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function _D(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J.normalizeParams(t)})}function pD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J.normalizeParams(t)})}function fD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J.normalizeParams(t)})}function mD(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...J.normalizeParams(t)})}function gD(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...J.normalizeParams(t)})}function hD(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function yD(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function vD(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...J.normalizeParams(t)})}function bD(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function SD(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function kD(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...J.normalizeParams(t)})}function wD(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...J.normalizeParams(t)})}function ED(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...J.normalizeParams(t)})}function AD(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...J.normalizeParams(t)})}function TD(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J.normalizeParams(t)})}function xD(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J.normalizeParams(t)})}function OD(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...J.normalizeParams(t)})}function RD(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...J.normalizeParams(t)})}function $D(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...J.normalizeParams(t)})}function CD(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...J.normalizeParams(t)})}M.TimePrecision={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function ID(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J.normalizeParams(t)})}function ND(e,t){return new e({type:"string",format:"date",check:"string_format",...J.normalizeParams(t)})}function PD(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...J.normalizeParams(t)})}function MD(e,t){return new e({type:"string",format:"duration",check:"string_format",...J.normalizeParams(t)})}function LD(e,t){return new e({type:"number",checks:[],...J.normalizeParams(t)})}function jD(e,t){return new e({type:"number",coerce:!0,checks:[],...J.normalizeParams(t)})}function DD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...J.normalizeParams(t)})}function UD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...J.normalizeParams(t)})}function zD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...J.normalizeParams(t)})}function FD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...J.normalizeParams(t)})}function qD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...J.normalizeParams(t)})}function VD(e,t){return new e({type:"boolean",...J.normalizeParams(t)})}function WD(e,t){return new e({type:"boolean",coerce:!0,...J.normalizeParams(t)})}function ZD(e,t){return new e({type:"bigint",...J.normalizeParams(t)})}function BD(e,t){return new e({type:"bigint",coerce:!0,...J.normalizeParams(t)})}function HD(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...J.normalizeParams(t)})}function JD(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...J.normalizeParams(t)})}function KD(e,t){return new e({type:"symbol",...J.normalizeParams(t)})}function GD(e,t){return new e({type:"undefined",...J.normalizeParams(t)})}function XD(e,t){return new e({type:"null",...J.normalizeParams(t)})}function YD(e){return new e({type:"any"})}function QD(e){return new e({type:"unknown"})}function eU(e,t){return new e({type:"never",...J.normalizeParams(t)})}function tU(e,t){return new e({type:"void",...J.normalizeParams(t)})}function nU(e,t){return new e({type:"date",...J.normalizeParams(t)})}function rU(e,t){return new e({type:"date",coerce:!0,...J.normalizeParams(t)})}function iU(e,t){return new e({type:"nan",...J.normalizeParams(t)})}function oS(e,t){return new it.$ZodCheckLessThan({check:"less_than",...J.normalizeParams(t),value:e,inclusive:!1})}function $a(e,t){return new it.$ZodCheckLessThan({check:"less_than",...J.normalizeParams(t),value:e,inclusive:!0})}function aS(e,t){return new it.$ZodCheckGreaterThan({check:"greater_than",...J.normalizeParams(t),value:e,inclusive:!1})}function Ca(e,t){return new it.$ZodCheckGreaterThan({check:"greater_than",...J.normalizeParams(t),value:e,inclusive:!0})}function oU(e){return aS(0,e)}function aU(e){return oS(0,e)}function sU(e){return $a(0,e)}function cU(e){return Ca(0,e)}function lU(e,t){return new it.$ZodCheckMultipleOf({check:"multiple_of",...J.normalizeParams(t),value:e})}function uU(e,t){return new it.$ZodCheckMaxSize({check:"max_size",...J.normalizeParams(t),maximum:e})}function dU(e,t){return new it.$ZodCheckMinSize({check:"min_size",...J.normalizeParams(t),minimum:e})}function _U(e,t){return new it.$ZodCheckSizeEquals({check:"size_equals",...J.normalizeParams(t),size:e})}function pU(e,t){return new it.$ZodCheckMaxLength({check:"max_length",...J.normalizeParams(t),maximum:e})}function fU(e,t){return new it.$ZodCheckMinLength({check:"min_length",...J.normalizeParams(t),minimum:e})}function mU(e,t){return new it.$ZodCheckLengthEquals({check:"length_equals",...J.normalizeParams(t),length:e})}function gU(e,t){return new it.$ZodCheckRegex({check:"string_format",format:"regex",...J.normalizeParams(t),pattern:e})}function hU(e){return new it.$ZodCheckLowerCase({check:"string_format",format:"lowercase",...J.normalizeParams(e)})}function yU(e){return new it.$ZodCheckUpperCase({check:"string_format",format:"uppercase",...J.normalizeParams(e)})}function vU(e,t){return new it.$ZodCheckIncludes({check:"string_format",format:"includes",...J.normalizeParams(t),includes:e})}function bU(e,t){return new it.$ZodCheckStartsWith({check:"string_format",format:"starts_with",...J.normalizeParams(t),prefix:e})}function SU(e,t){return new it.$ZodCheckEndsWith({check:"string_format",format:"ends_with",...J.normalizeParams(t),suffix:e})}function kU(e,t,n){return new it.$ZodCheckProperty({check:"property",property:e,schema:t,...J.normalizeParams(n)})}function wU(e,t){return new it.$ZodCheckMimeType({check:"mime_type",mime:e,...J.normalizeParams(t)})}function $o(e){return new it.$ZodCheckOverwrite({check:"overwrite",tx:e})}function EU(e){return $o(t=>t.normalize(e))}function AU(){return $o(e=>e.trim())}function TU(){return $o(e=>e.toLowerCase())}function xU(){return $o(e=>e.toUpperCase())}function OU(){return $o(e=>J.slugify(e))}function RU(e,t,n){return new e({type:"array",element:t,...J.normalizeParams(n)})}function $U(e,t,n){return new e({type:"union",options:t,...J.normalizeParams(n)})}function CU(e,t,n){return new e({type:"union",options:t,inclusive:!1,...J.normalizeParams(n)})}function IU(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...J.normalizeParams(i)})}function NU(e,t,n){return new e({type:"intersection",left:t,right:n})}function PU(e,t,n,i){let r=n instanceof $l.$ZodType,o=r?i:n,a=r?n:null;return new e({type:"tuple",items:t,rest:a,...J.normalizeParams(o)})}function MU(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...J.normalizeParams(i)})}function LU(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...J.normalizeParams(i)})}function jU(e,t,n){return new e({type:"set",valueType:t,...J.normalizeParams(n)})}function DU(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:i,...J.normalizeParams(n)})}function UU(e,t,n){return new e({type:"enum",entries:t,...J.normalizeParams(n)})}function zU(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...J.normalizeParams(n)})}function FU(e,t){return new e({type:"file",...J.normalizeParams(t)})}function qU(e,t){return new e({type:"transform",transform:t})}function VU(e,t){return new e({type:"optional",innerType:t})}function WU(e,t){return new e({type:"nullable",innerType:t})}function ZU(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():J.shallowClone(n)}})}function BU(e,t,n){return new e({type:"nonoptional",innerType:t,...J.normalizeParams(n)})}function HU(e,t){return new e({type:"success",innerType:t})}function JU(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}function KU(e,t,n){return new e({type:"pipe",in:t,out:n})}function GU(e,t){return new e({type:"readonly",innerType:t})}function XU(e,t,n){return new e({type:"template_literal",parts:t,...J.normalizeParams(n)})}function YU(e,t){return new e({type:"lazy",getter:t})}function QU(e,t){return new e({type:"promise",innerType:t})}function e1(e,t,n){let i=J.normalizeParams(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function t1(e,t,n){return new e({type:"custom",check:"custom",fn:t,...J.normalizeParams(n)})}function n1(e,t){let n=sS(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(J.issue(r,i.value,n._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=i.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),i.issues.push(J.issue(o))}},e(i.value,i)),t);return n}function sS(e,t){let n=new it.$ZodCheck({check:"custom",...J.normalizeParams(t)});return n._zod.check=e,n}function r1(e){let t=new it.$ZodCheck({check:"describe"});return t._zod.onattach=[n=>{let i=Cl.globalRegistry.get(n)??{};Cl.globalRegistry.add(n,{...i,description:e})}],t._zod.check=()=>{},t}function i1(e){let t=new it.$ZodCheck({check:"meta"});return t._zod.onattach=[n=>{let i=Cl.globalRegistry.get(n)??{};Cl.globalRegistry.add(n,{...i,...e})}],t._zod.check=()=>{},t}function o1(e,t){let n=J.normalizeParams(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(p=>typeof p=="string"?p.toLowerCase():p),r=r.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(i),a=new Set(r),s=e.Codec??$l.$ZodCodec,l=e.Boolean??$l.$ZodBoolean,c=e.String??$l.$ZodString,d=new c({type:"string",error:n.error}),u=new l({type:"boolean",error:n.error}),_=new s({type:"pipe",in:d,out:u,transform:((p,v)=>{let f=p;return n.case!=="sensitive"&&(f=f.toLowerCase()),o.has(f)?!0:a.has(f)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:v.value,inst:_,continue:!1}),{})}),reverseTransform:((p,v)=>p===!0?i[0]||"true":r[0]||"false"),error:n.error});return _}function a1(e,t,n,i={}){let r=J.normalizeParams(i),o={...J.normalizeParams(i),check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:s=>n.test(s),...r};return n instanceof RegExp&&(o.pattern=n),new e(o)}});var Ia=N(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.createStandardJSONSchemaMethod=tn.createToJSONSchemaMethod=void 0;tn.initializeContext=mp;tn.process=Nl;tn.extractDefs=gp;tn.finalize=hp;var s1=Ra();function mp(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??s1.globalRegistry,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Nl(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let _=a.schema,p=t.processors[r.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);p(e,t,_,d)}let u=e._zod.parent;u&&(a.ref||(a.ref=u),Nl(u,t,d),t.seen.get(u).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Mt(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function gp(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let l=i.get(s);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(s,a[0])}}let r=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let u=e.external.registry.get(a[0])?.id,_=e.external.uri??(v=>v);if(u)return{ref:_(u)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${_("__shared")}#/${s}/${p}`}}if(a[1]===n)return{ref:"#"};let c=`#/${s}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:c+d}},o=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:c}=r(a);s.def={...s.schema},c&&(s.defId=c);let d=s.schema;for(let u in d)delete d[u];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
64
+
65
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){o(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(t!==a[0]&&c){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&e.reused==="ref"){o(a);continue}}}function hp(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=s=>{let l=e.seen.get(s);if(l.ref===null)return;let c=l.def??l.schema,d={...c},u=l.ref;if(l.ref=null,u){i(u);let p=e.seen.get(u),v=p.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(v)):Object.assign(c,v),Object.assign(c,d),s._zod.parent===u)for(let h in c)h==="$ref"||h==="allOf"||h in d||delete c[h];if(v.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let _=s._zod.parent;if(_&&_!==u){i(_);let p=e.seen.get(_);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let v in c)v==="$ref"||v==="allOf"||v in p.def&&JSON.stringify(c[v])===JSON.stringify(p.def[v])&&delete c[v]}e.override({zodSchema:s,jsonSchema:c,path:l.path??[]})};for(let s of[...e.seen.entries()].reverse())i(s[0]);let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(s)}Object.assign(r,n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let a=e.external?.defs??{};for(let s of e.seen.entries()){let l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,a[l.defId]=l.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?r.$defs=a:r.definitions=a);try{let s=JSON.parse(JSON.stringify(r));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:(0,tn.createStandardJSONSchemaMethod)(t,"input",e.processors),output:(0,tn.createStandardJSONSchemaMethod)(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Mt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Mt(i.element,n);if(i.type==="set")return Mt(i.valueType,n);if(i.type==="lazy")return Mt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Mt(i.innerType,n);if(i.type==="intersection")return Mt(i.left,n)||Mt(i.right,n);if(i.type==="record"||i.type==="map")return Mt(i.keyType,n)||Mt(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Mt(i.in,n)||Mt(i.out,n);if(i.type==="object"){for(let r in i.shape)if(Mt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Mt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Mt(r,n))return!0;return!!(i.rest&&Mt(i.rest,n))}return!1}var c1=(e,t={})=>n=>{let i=mp({...n,processors:t});return Nl(e,i),gp(i,e),hp(i,e)};tn.createToJSONSchemaMethod=c1;var l1=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},a=mp({...r??{},target:o,io:t,processors:n});return Nl(e,a),gp(a,e),hp(a,e)};tn.createStandardJSONSchemaMethod=l1});var Na=N(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.allProcessors=D.lazyProcessor=D.optionalProcessor=D.promiseProcessor=D.readonlyProcessor=D.pipeProcessor=D.catchProcessor=D.prefaultProcessor=D.defaultProcessor=D.nonoptionalProcessor=D.nullableProcessor=D.recordProcessor=D.tupleProcessor=D.intersectionProcessor=D.unionProcessor=D.objectProcessor=D.arrayProcessor=D.setProcessor=D.mapProcessor=D.transformProcessor=D.functionProcessor=D.customProcessor=D.successProcessor=D.fileProcessor=D.templateLiteralProcessor=D.nanProcessor=D.literalProcessor=D.enumProcessor=D.dateProcessor=D.unknownProcessor=D.anyProcessor=D.neverProcessor=D.voidProcessor=D.undefinedProcessor=D.nullProcessor=D.symbolProcessor=D.bigintProcessor=D.booleanProcessor=D.numberProcessor=D.stringProcessor=void 0;D.toJSONSchema=X1;var Ze=Ia(),u1=ue(),d1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_1=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:a,format:s,patterns:l,contentEncoding:c}=e._zod.bag;if(typeof o=="number"&&(r.minLength=o),typeof a=="number"&&(r.maxLength=a),s&&(r.format=d1[s]??s,r.format===""&&delete r.format,s==="time"&&delete r.format),c&&(r.contentEncoding=c),l&&l.size>0){let d=[...l];d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(u=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:u.source}))])}};D.stringProcessor=_1;var p1=(e,t,n,i)=>{let r=n,{minimum:o,maximum:a,format:s,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;typeof s=="string"&&s.includes("int")?r.type="integer":r.type="number";let u=typeof d=="number"&&d>=(o??Number.NEGATIVE_INFINITY),_=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";u?p?(r.minimum=d,r.exclusiveMinimum=!0):r.exclusiveMinimum=d:typeof o=="number"&&(r.minimum=o),_?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:typeof a=="number"&&(r.maximum=a),typeof l=="number"&&(r.multipleOf=l)};D.numberProcessor=p1;var f1=(e,t,n,i)=>{n.type="boolean"};D.booleanProcessor=f1;var m1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};D.bigintProcessor=m1;var g1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")};D.symbolProcessor=g1;var h1=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"};D.nullProcessor=h1;var y1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")};D.undefinedProcessor=y1;var v1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")};D.voidProcessor=v1;var b1=(e,t,n,i)=>{n.not={}};D.neverProcessor=b1;var S1=(e,t,n,i)=>{};D.anyProcessor=S1;var k1=(e,t,n,i)=>{};D.unknownProcessor=k1;var w1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")};D.dateProcessor=w1;var E1=(e,t,n,i)=>{let r=e._zod.def,o=(0,u1.getEnumValues)(r.entries);o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),n.enum=o};D.enumProcessor=E1;var A1=(e,t,n,i)=>{let r=e._zod.def,o=[];for(let a of r.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),o.every(a=>typeof a=="boolean")&&(n.type="boolean"),o.every(a=>a===null)&&(n.type="null"),n.enum=o};D.literalProcessor=A1;var T1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")};D.nanProcessor=T1;var x1=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source};D.templateLiteralProcessor=x1;var O1=(e,t,n,i)=>{let r=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:l}=e._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),l?l.length===1?(o.contentMediaType=l[0],Object.assign(r,o)):(Object.assign(r,o),r.anyOf=l.map(c=>({contentMediaType:c}))):Object.assign(r,o)};D.fileProcessor=O1;var R1=(e,t,n,i)=>{n.type="boolean"};D.successProcessor=R1;var $1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};D.customProcessor=$1;var C1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")};D.functionProcessor=C1;var I1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};D.transformProcessor=I1;var N1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")};D.mapProcessor=N1;var P1=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")};D.setProcessor=P1;var M1=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(r.minItems=a),typeof s=="number"&&(r.maxItems=s),r.type="array",r.items=(0,Ze.process)(o.element,t,{...i,path:[...i.path,"items"]})};D.arrayProcessor=M1;var L1=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object",r.properties={};let a=o.shape;for(let c in a)r.properties[c]=(0,Ze.process)(a[c],t,{...i,path:[...i.path,"properties",c]});let s=new Set(Object.keys(a)),l=new Set([...s].filter(c=>{let d=o.shape[c]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(r.required=Array.from(l)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=(0,Ze.process)(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)};D.objectProcessor=L1;var j1=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,a=r.options.map((s,l)=>(0,Ze.process)(s,t,{...i,path:[...i.path,o?"oneOf":"anyOf",l]}));o?n.oneOf=a:n.anyOf=a};D.unionProcessor=j1;var D1=(e,t,n,i)=>{let r=e._zod.def,o=(0,Ze.process)(r.left,t,{...i,path:[...i.path,"allOf",0]}),a=(0,Ze.process)(r.right,t,{...i,path:[...i.path,"allOf",1]}),s=c=>"allOf"in c&&Object.keys(c).length===1,l=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];n.allOf=l};D.intersectionProcessor=D1;var U1=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((_,p)=>(0,Ze.process)(_,t,{...i,path:[...i.path,a,p]})),c=o.rest?(0,Ze.process)(o.rest,t,{...i,path:[...i.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=l,c&&(r.items=c)):t.target==="openapi-3.0"?(r.items={anyOf:l},c&&r.items.anyOf.push(c),r.minItems=l.length,c||(r.maxItems=l.length)):(r.items=l,c&&(r.additionalItems=c));let{minimum:d,maximum:u}=e._zod.bag;typeof d=="number"&&(r.minItems=d),typeof u=="number"&&(r.maxItems=u)};D.tupleProcessor=U1;var z1=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let a=o.keyType,l=a._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let d=(0,Ze.process)(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let u of l)r.patternProperties[u.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=(0,Ze.process)(o.keyType,t,{...i,path:[...i.path,"propertyNames"]})),r.additionalProperties=(0,Ze.process)(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]});let c=a._zod.values;if(c){let d=[...c].filter(u=>typeof u=="string"||typeof u=="number");d.length>0&&(r.required=d)}};D.recordProcessor=z1;var F1=(e,t,n,i)=>{let r=e._zod.def,o=(0,Ze.process)(r.innerType,t,i),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]};D.nullableProcessor=F1;var q1=(e,t,n,i)=>{let r=e._zod.def;(0,Ze.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType};D.nonoptionalProcessor=q1;var V1=(e,t,n,i)=>{let r=e._zod.def;(0,Ze.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))};D.defaultProcessor=V1;var W1=(e,t,n,i)=>{let r=e._zod.def;(0,Ze.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))};D.prefaultProcessor=W1;var Z1=(e,t,n,i)=>{let r=e._zod.def;(0,Ze.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let a;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a};D.catchProcessor=Z1;var B1=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?r.out:r.in:r.out;(0,Ze.process)(a,t,i);let s=t.seen.get(e);s.ref=a};D.pipeProcessor=B1;var H1=(e,t,n,i)=>{let r=e._zod.def;(0,Ze.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0};D.readonlyProcessor=H1;var J1=(e,t,n,i)=>{let r=e._zod.def;(0,Ze.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType};D.promiseProcessor=J1;var K1=(e,t,n,i)=>{let r=e._zod.def;(0,Ze.process)(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType};D.optionalProcessor=K1;var G1=(e,t,n,i)=>{let r=e._zod.innerType;(0,Ze.process)(r,t,i);let o=t.seen.get(e);o.ref=r};D.lazyProcessor=G1;D.allProcessors={string:D.stringProcessor,number:D.numberProcessor,boolean:D.booleanProcessor,bigint:D.bigintProcessor,symbol:D.symbolProcessor,null:D.nullProcessor,undefined:D.undefinedProcessor,void:D.voidProcessor,never:D.neverProcessor,any:D.anyProcessor,unknown:D.unknownProcessor,date:D.dateProcessor,enum:D.enumProcessor,literal:D.literalProcessor,nan:D.nanProcessor,template_literal:D.templateLiteralProcessor,file:D.fileProcessor,success:D.successProcessor,custom:D.customProcessor,function:D.functionProcessor,transform:D.transformProcessor,map:D.mapProcessor,set:D.setProcessor,array:D.arrayProcessor,object:D.objectProcessor,union:D.unionProcessor,intersection:D.intersectionProcessor,tuple:D.tupleProcessor,record:D.recordProcessor,nullable:D.nullableProcessor,nonoptional:D.nonoptionalProcessor,default:D.defaultProcessor,prefault:D.prefaultProcessor,catch:D.catchProcessor,pipe:D.pipeProcessor,readonly:D.readonlyProcessor,promise:D.promiseProcessor,optional:D.optionalProcessor,lazy:D.lazyProcessor};function X1(e,t){if("_idmap"in e){let i=e,r=(0,Ze.initializeContext)({...t,processors:D.allProcessors}),o={};for(let l of i._idmap.entries()){let[c,d]=l;(0,Ze.process)(d,r)}let a={},s={registry:i,uri:t?.uri,defs:o};r.external=s;for(let l of i._idmap.entries()){let[c,d]=l;(0,Ze.extractDefs)(r,d),a[c]=(0,Ze.finalize)(r,d)}if(Object.keys(o).length>0){let l=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let n=(0,Ze.initializeContext)({...t,processors:D.allProcessors});return(0,Ze.process)(e,n),(0,Ze.extractDefs)(n,e),(0,Ze.finalize)(n,e)}});var lS=N(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.JSONSchemaGenerator=void 0;var Y1=Na(),Pl=Ia(),yp=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=(0,Pl.initializeContext)({processors:Y1.allProcessors,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return(0,Pl.process)(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),(0,Pl.extractDefs)(this.ctx,t);let i=(0,Pl.finalize)(this.ctx,t),{"~standard":r,...o}=i;return o}};Ml.JSONSchemaGenerator=yp});var dS=N(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0})});var Vt=N(Ue=>{"use strict";var _S=Ue&&Ue.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),Q1=Ue&&Ue.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Sr=Ue&&Ue.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&_S(t,e,n)},Ll=Ue&&Ue.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&_S(t,e,n);return Q1(t,e),t};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.JSONSchema=Ue.JSONSchemaGenerator=Ue.toJSONSchema=Ue.locales=Ue.regexes=Ue.util=void 0;Sr(Pi(),Ue);Sr(np(),Ue);Sr(ep(),Ue);Sr(up(),Ue);Sr(Ec(),Ue);Sr(sp(),Ue);Ue.util=Ll(ue());Ue.regexes=Ll(wc());Ue.locales=Ll(fp());Sr(Ra(),Ue);Sr(ap(),Ue);Sr(cS(),Ue);Sr(Ia(),Ue);var ez=Na();Object.defineProperty(Ue,"toJSONSchema",{enumerable:!0,get:function(){return ez.toJSONSchema}});var tz=lS();Object.defineProperty(Ue,"JSONSchemaGenerator",{enumerable:!0,get:function(){return tz.JSONSchemaGenerator}});Ue.JSONSchema=Ll(dS())});var jl=N(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.slugify=de.toUpperCase=de.toLowerCase=de.trim=de.normalize=de.overwrite=de.mime=de.property=de.endsWith=de.startsWith=de.includes=de.uppercase=de.lowercase=de.regex=de.length=de.minLength=de.maxLength=de.size=de.minSize=de.maxSize=de.multipleOf=de.nonnegative=de.nonpositive=de.negative=de.positive=de.gte=de.gt=de.lte=de.lt=void 0;var Be=Vt();Object.defineProperty(de,"lt",{enumerable:!0,get:function(){return Be._lt}});Object.defineProperty(de,"lte",{enumerable:!0,get:function(){return Be._lte}});Object.defineProperty(de,"gt",{enumerable:!0,get:function(){return Be._gt}});Object.defineProperty(de,"gte",{enumerable:!0,get:function(){return Be._gte}});Object.defineProperty(de,"positive",{enumerable:!0,get:function(){return Be._positive}});Object.defineProperty(de,"negative",{enumerable:!0,get:function(){return Be._negative}});Object.defineProperty(de,"nonpositive",{enumerable:!0,get:function(){return Be._nonpositive}});Object.defineProperty(de,"nonnegative",{enumerable:!0,get:function(){return Be._nonnegative}});Object.defineProperty(de,"multipleOf",{enumerable:!0,get:function(){return Be._multipleOf}});Object.defineProperty(de,"maxSize",{enumerable:!0,get:function(){return Be._maxSize}});Object.defineProperty(de,"minSize",{enumerable:!0,get:function(){return Be._minSize}});Object.defineProperty(de,"size",{enumerable:!0,get:function(){return Be._size}});Object.defineProperty(de,"maxLength",{enumerable:!0,get:function(){return Be._maxLength}});Object.defineProperty(de,"minLength",{enumerable:!0,get:function(){return Be._minLength}});Object.defineProperty(de,"length",{enumerable:!0,get:function(){return Be._length}});Object.defineProperty(de,"regex",{enumerable:!0,get:function(){return Be._regex}});Object.defineProperty(de,"lowercase",{enumerable:!0,get:function(){return Be._lowercase}});Object.defineProperty(de,"uppercase",{enumerable:!0,get:function(){return Be._uppercase}});Object.defineProperty(de,"includes",{enumerable:!0,get:function(){return Be._includes}});Object.defineProperty(de,"startsWith",{enumerable:!0,get:function(){return Be._startsWith}});Object.defineProperty(de,"endsWith",{enumerable:!0,get:function(){return Be._endsWith}});Object.defineProperty(de,"property",{enumerable:!0,get:function(){return Be._property}});Object.defineProperty(de,"mime",{enumerable:!0,get:function(){return Be._mime}});Object.defineProperty(de,"overwrite",{enumerable:!0,get:function(){return Be._overwrite}});Object.defineProperty(de,"normalize",{enumerable:!0,get:function(){return Be._normalize}});Object.defineProperty(de,"trim",{enumerable:!0,get:function(){return Be._trim}});Object.defineProperty(de,"toLowerCase",{enumerable:!0,get:function(){return Be._toLowerCase}});Object.defineProperty(de,"toUpperCase",{enumerable:!0,get:function(){return Be._toUpperCase}});Object.defineProperty(de,"slugify",{enumerable:!0,get:function(){return Be._slugify}})});var Pa=N(tt=>{"use strict";var nz=tt&&tt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),rz=tt&&tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pS=tt&&tt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&nz(t,e,n);return rz(t,e),t};Object.defineProperty(tt,"__esModule",{value:!0});tt.ZodISODuration=tt.ZodISOTime=tt.ZodISODate=tt.ZodISODateTime=void 0;tt.datetime=iz;tt.date=oz;tt.time=az;tt.duration=sz;var nn=pS(Vt()),Dl=pS(Ma());tt.ZodISODateTime=nn.$constructor("ZodISODateTime",(e,t)=>{nn.$ZodISODateTime.init(e,t),Dl.ZodStringFormat.init(e,t)});function iz(e){return nn._isoDateTime(tt.ZodISODateTime,e)}tt.ZodISODate=nn.$constructor("ZodISODate",(e,t)=>{nn.$ZodISODate.init(e,t),Dl.ZodStringFormat.init(e,t)});function oz(e){return nn._isoDate(tt.ZodISODate,e)}tt.ZodISOTime=nn.$constructor("ZodISOTime",(e,t)=>{nn.$ZodISOTime.init(e,t),Dl.ZodStringFormat.init(e,t)});function az(e){return nn._isoTime(tt.ZodISOTime,e)}tt.ZodISODuration=nn.$constructor("ZodISODuration",(e,t)=>{nn.$ZodISODuration.init(e,t),Dl.ZodStringFormat.init(e,t)});function sz(e){return nn._isoDuration(tt.ZodISODuration,e)}});var vp=N(rn=>{"use strict";var cz=rn&&rn.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),lz=rn&&rn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),mS=rn&&rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&cz(t,e,n);return lz(t,e),t};Object.defineProperty(rn,"__esModule",{value:!0});rn.ZodRealError=rn.ZodError=void 0;var Ul=mS(Vt()),uz=Vt(),fS=mS(ue()),gS=(e,t)=>{uz.$ZodError.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Ul.formatError(e,n)},flatten:{value:n=>Ul.flattenError(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fS.jsonStringifyReplacer,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fS.jsonStringifyReplacer,2)}},isEmpty:{get(){return e.issues.length===0}}})};rn.ZodError=Ul.$constructor("ZodError",gS);rn.ZodRealError=Ul.$constructor("ZodError",gS,{Parent:Error})});var bp=N(ze=>{"use strict";var dz=ze&&ze.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),_z=ze&&ze.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pz=ze&&ze.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&dz(t,e,n);return _z(t,e),t};Object.defineProperty(ze,"__esModule",{value:!0});ze.safeDecodeAsync=ze.safeEncodeAsync=ze.safeDecode=ze.safeEncode=ze.decodeAsync=ze.encodeAsync=ze.decode=ze.encode=ze.safeParseAsync=ze.safeParse=ze.parseAsync=ze.parse=void 0;var on=pz(Vt()),an=vp();ze.parse=on._parse(an.ZodRealError);ze.parseAsync=on._parseAsync(an.ZodRealError);ze.safeParse=on._safeParse(an.ZodRealError);ze.safeParseAsync=on._safeParseAsync(an.ZodRealError);ze.encode=on._encode(an.ZodRealError);ze.decode=on._decode(an.ZodRealError);ze.encodeAsync=on._encodeAsync(an.ZodRealError);ze.decodeAsync=on._decodeAsync(an.ZodRealError);ze.safeEncode=on._safeEncode(an.ZodRealError);ze.safeDecode=on._safeDecode(an.ZodRealError);ze.safeEncodeAsync=on._safeEncodeAsync(an.ZodRealError);ze.safeDecodeAsync=on._safeDecodeAsync(an.ZodRealError)});var Ma=N(m=>{"use strict";var fz=m&&m.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),mz=m&&m.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),La=m&&m.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&fz(t,e,n);return mz(t,e),t};Object.defineProperty(m,"__esModule",{value:!0});m.ZodLiteral=m.ZodEnum=m.ZodSet=m.ZodMap=m.ZodRecord=m.ZodTuple=m.ZodIntersection=m.ZodDiscriminatedUnion=m.ZodXor=m.ZodUnion=m.ZodObject=m.ZodArray=m.ZodDate=m.ZodVoid=m.ZodNever=m.ZodUnknown=m.ZodAny=m.ZodNull=m.ZodUndefined=m.ZodSymbol=m.ZodBigIntFormat=m.ZodBigInt=m.ZodBoolean=m.ZodNumberFormat=m.ZodNumber=m.ZodCustomStringFormat=m.ZodJWT=m.ZodE164=m.ZodBase64URL=m.ZodBase64=m.ZodCIDRv6=m.ZodCIDRv4=m.ZodIPv6=m.ZodMAC=m.ZodIPv4=m.ZodKSUID=m.ZodXID=m.ZodULID=m.ZodCUID2=m.ZodCUID=m.ZodNanoID=m.ZodEmoji=m.ZodURL=m.ZodUUID=m.ZodGUID=m.ZodEmail=m.ZodStringFormat=m.ZodString=m._ZodString=m.ZodType=void 0;m.stringbool=m.meta=m.describe=m.ZodCustom=m.ZodFunction=m.ZodPromise=m.ZodLazy=m.ZodTemplateLiteral=m.ZodReadonly=m.ZodPreprocess=m.ZodCodec=m.ZodPipe=m.ZodNaN=m.ZodCatch=m.ZodSuccess=m.ZodNonOptional=m.ZodPrefault=m.ZodDefault=m.ZodNullable=m.ZodExactOptional=m.ZodOptional=m.ZodTransform=m.ZodFile=void 0;m.string=Fl;m.email=gz;m.guid=hz;m.uuid=yz;m.uuidv4=vz;m.uuidv6=bz;m.uuidv7=Sz;m.url=kz;m.httpUrl=wz;m.emoji=Ez;m.nanoid=Az;m.cuid=Tz;m.cuid2=xz;m.ulid=Oz;m.xid=Rz;m.ksuid=$z;m.ipv4=Cz;m.mac=Iz;m.ipv6=Nz;m.cidrv4=Pz;m.cidrv6=Mz;m.base64=Lz;m.base64url=jz;m.e164=Dz;m.jwt=Uz;m.stringFormat=zz;m.hostname=Fz;m.hex=qz;m.hash=Vz;m.number=yS;m.int=kp;m.float32=Wz;m.float64=Zz;m.int32=Bz;m.uint32=Hz;m.boolean=vS;m.bigint=Jz;m.int64=Kz;m.uint64=Gz;m.symbol=Xz;m.undefined=Yz;m.null=bS;m.any=Qz;m.unknown=Co;m.never=Ep;m.void=eF;m.date=tF;m.array=Wl;m.keyof=nF;m.object=rF;m.strictObject=iF;m.looseObject=oF;m.union=Ap;m.xor=aF;m.discriminatedUnion=sF;m.intersection=SS;m.tuple=kS;m.record=wS;m.partialRecord=cF;m.looseRecord=lF;m.map=uF;m.set=dF;m.enum=Tp;m.nativeEnum=_F;m.literal=pF;m.file=fF;m.transform=xp;m.optional=ql;m.exactOptional=ES;m.nullable=Vl;m.nullish=mF;m._default=AS;m.prefault=TS;m.nonoptional=xS;m.success=gF;m.catch=OS;m.nan=hF;m.pipe=wp;m.codec=yF;m.invertCodec=vF;m.readonly=RS;m.templateLiteral=bF;m.lazy=$S;m.promise=SF;m._function=Zl;m.function=Zl;m._function=Zl;m.function=Zl;m.check=kF;m.custom=wF;m.refine=CS;m.superRefine=IS;m.instanceof=EF;m.json=TF;m.preprocess=xF;var E=La(Vt()),Ne=Vt(),xe=La(Na()),Sp=Ia(),ke=La(jl()),zl=La(Pa()),sn=La(bp()),hS=new WeakMap;function ja(e,t,n){let i=Object.getPrototypeOf(e),r=hS.get(i);if(r||(r=new Set,hS.set(i,r)),!r.has(t)){r.add(t);for(let o in n){let a=n[o];Object.defineProperty(i,o,{configurable:!0,enumerable:!1,get(){let s=a.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}m.ZodType=E.$constructor("ZodType",(e,t)=>(E.$ZodType.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:(0,Sp.createStandardJSONSchemaMethod)(e,"input"),output:(0,Sp.createStandardJSONSchemaMethod)(e,"output")}}),e.toJSONSchema=(0,Sp.createToJSONSchemaMethod)(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>sn.parse(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>sn.safeParse(e,n,i),e.parseAsync=async(n,i)=>sn.parseAsync(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>sn.safeParseAsync(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>sn.encode(e,n,i),e.decode=(n,i)=>sn.decode(e,n,i),e.encodeAsync=async(n,i)=>sn.encodeAsync(e,n,i),e.decodeAsync=async(n,i)=>sn.decodeAsync(e,n,i),e.safeEncode=(n,i)=>sn.safeEncode(e,n,i),e.safeDecode=(n,i)=>sn.safeDecode(e,n,i),e.safeEncodeAsync=async(n,i)=>sn.safeEncodeAsync(e,n,i),e.safeDecodeAsync=async(n,i)=>sn.safeDecodeAsync(e,n,i),ja(e,"ZodType",{check(...n){let i=this.def;return this.clone(Ne.util.mergeDefs(i,{checks:[...i.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return E.clone(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(CS(n,i))},superRefine(n,i){return this.check(IS(n,i))},overwrite(n){return this.check(ke.overwrite(n))},optional(){return ql(this)},exactOptional(){return ES(this)},nullable(){return Vl(this)},nullish(){return ql(Vl(this))},nonoptional(n){return xS(this,n)},array(){return Wl(this)},or(n){return Ap([this,n])},and(n){return SS(this,n)},transform(n){return wp(this,xp(n))},default(n){return AS(this,n)},prefault(n){return TS(this,n)},catch(n){return OS(this,n)},pipe(n){return wp(this,n)},readonly(){return RS(this)},describe(n){let i=this.clone();return E.globalRegistry.add(i,{description:n}),i},meta(...n){if(n.length===0)return E.globalRegistry.get(this);let i=this.clone();return E.globalRegistry.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return E.globalRegistry.get(e)?.description},configurable:!0}),e));m._ZodString=E.$constructor("_ZodString",(e,t)=>{E.$ZodString.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.stringProcessor(e,i,r,o);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ja(e,"_ZodString",{regex(...i){return this.check(ke.regex(...i))},includes(...i){return this.check(ke.includes(...i))},startsWith(...i){return this.check(ke.startsWith(...i))},endsWith(...i){return this.check(ke.endsWith(...i))},min(...i){return this.check(ke.minLength(...i))},max(...i){return this.check(ke.maxLength(...i))},length(...i){return this.check(ke.length(...i))},nonempty(...i){return this.check(ke.minLength(1,...i))},lowercase(i){return this.check(ke.lowercase(i))},uppercase(i){return this.check(ke.uppercase(i))},trim(){return this.check(ke.trim())},normalize(...i){return this.check(ke.normalize(...i))},toLowerCase(){return this.check(ke.toLowerCase())},toUpperCase(){return this.check(ke.toUpperCase())},slugify(){return this.check(ke.slugify())}})});m.ZodString=E.$constructor("ZodString",(e,t)=>{E.$ZodString.init(e,t),m._ZodString.init(e,t),e.email=n=>e.check(E._email(m.ZodEmail,n)),e.url=n=>e.check(E._url(m.ZodURL,n)),e.jwt=n=>e.check(E._jwt(m.ZodJWT,n)),e.emoji=n=>e.check(E._emoji(m.ZodEmoji,n)),e.guid=n=>e.check(E._guid(m.ZodGUID,n)),e.uuid=n=>e.check(E._uuid(m.ZodUUID,n)),e.uuidv4=n=>e.check(E._uuidv4(m.ZodUUID,n)),e.uuidv6=n=>e.check(E._uuidv6(m.ZodUUID,n)),e.uuidv7=n=>e.check(E._uuidv7(m.ZodUUID,n)),e.nanoid=n=>e.check(E._nanoid(m.ZodNanoID,n)),e.guid=n=>e.check(E._guid(m.ZodGUID,n)),e.cuid=n=>e.check(E._cuid(m.ZodCUID,n)),e.cuid2=n=>e.check(E._cuid2(m.ZodCUID2,n)),e.ulid=n=>e.check(E._ulid(m.ZodULID,n)),e.base64=n=>e.check(E._base64(m.ZodBase64,n)),e.base64url=n=>e.check(E._base64url(m.ZodBase64URL,n)),e.xid=n=>e.check(E._xid(m.ZodXID,n)),e.ksuid=n=>e.check(E._ksuid(m.ZodKSUID,n)),e.ipv4=n=>e.check(E._ipv4(m.ZodIPv4,n)),e.ipv6=n=>e.check(E._ipv6(m.ZodIPv6,n)),e.cidrv4=n=>e.check(E._cidrv4(m.ZodCIDRv4,n)),e.cidrv6=n=>e.check(E._cidrv6(m.ZodCIDRv6,n)),e.e164=n=>e.check(E._e164(m.ZodE164,n)),e.datetime=n=>e.check(zl.datetime(n)),e.date=n=>e.check(zl.date(n)),e.time=n=>e.check(zl.time(n)),e.duration=n=>e.check(zl.duration(n))});function Fl(e){return E._string(m.ZodString,e)}m.ZodStringFormat=E.$constructor("ZodStringFormat",(e,t)=>{E.$ZodStringFormat.init(e,t),m._ZodString.init(e,t)});m.ZodEmail=E.$constructor("ZodEmail",(e,t)=>{E.$ZodEmail.init(e,t),m.ZodStringFormat.init(e,t)});function gz(e){return E._email(m.ZodEmail,e)}m.ZodGUID=E.$constructor("ZodGUID",(e,t)=>{E.$ZodGUID.init(e,t),m.ZodStringFormat.init(e,t)});function hz(e){return E._guid(m.ZodGUID,e)}m.ZodUUID=E.$constructor("ZodUUID",(e,t)=>{E.$ZodUUID.init(e,t),m.ZodStringFormat.init(e,t)});function yz(e){return E._uuid(m.ZodUUID,e)}function vz(e){return E._uuidv4(m.ZodUUID,e)}function bz(e){return E._uuidv6(m.ZodUUID,e)}function Sz(e){return E._uuidv7(m.ZodUUID,e)}m.ZodURL=E.$constructor("ZodURL",(e,t)=>{E.$ZodURL.init(e,t),m.ZodStringFormat.init(e,t)});function kz(e){return E._url(m.ZodURL,e)}function wz(e){return E._url(m.ZodURL,{protocol:E.regexes.httpProtocol,hostname:E.regexes.domain,...Ne.util.normalizeParams(e)})}m.ZodEmoji=E.$constructor("ZodEmoji",(e,t)=>{E.$ZodEmoji.init(e,t),m.ZodStringFormat.init(e,t)});function Ez(e){return E._emoji(m.ZodEmoji,e)}m.ZodNanoID=E.$constructor("ZodNanoID",(e,t)=>{E.$ZodNanoID.init(e,t),m.ZodStringFormat.init(e,t)});function Az(e){return E._nanoid(m.ZodNanoID,e)}m.ZodCUID=E.$constructor("ZodCUID",(e,t)=>{E.$ZodCUID.init(e,t),m.ZodStringFormat.init(e,t)});function Tz(e){return E._cuid(m.ZodCUID,e)}m.ZodCUID2=E.$constructor("ZodCUID2",(e,t)=>{E.$ZodCUID2.init(e,t),m.ZodStringFormat.init(e,t)});function xz(e){return E._cuid2(m.ZodCUID2,e)}m.ZodULID=E.$constructor("ZodULID",(e,t)=>{E.$ZodULID.init(e,t),m.ZodStringFormat.init(e,t)});function Oz(e){return E._ulid(m.ZodULID,e)}m.ZodXID=E.$constructor("ZodXID",(e,t)=>{E.$ZodXID.init(e,t),m.ZodStringFormat.init(e,t)});function Rz(e){return E._xid(m.ZodXID,e)}m.ZodKSUID=E.$constructor("ZodKSUID",(e,t)=>{E.$ZodKSUID.init(e,t),m.ZodStringFormat.init(e,t)});function $z(e){return E._ksuid(m.ZodKSUID,e)}m.ZodIPv4=E.$constructor("ZodIPv4",(e,t)=>{E.$ZodIPv4.init(e,t),m.ZodStringFormat.init(e,t)});function Cz(e){return E._ipv4(m.ZodIPv4,e)}m.ZodMAC=E.$constructor("ZodMAC",(e,t)=>{E.$ZodMAC.init(e,t),m.ZodStringFormat.init(e,t)});function Iz(e){return E._mac(m.ZodMAC,e)}m.ZodIPv6=E.$constructor("ZodIPv6",(e,t)=>{E.$ZodIPv6.init(e,t),m.ZodStringFormat.init(e,t)});function Nz(e){return E._ipv6(m.ZodIPv6,e)}m.ZodCIDRv4=E.$constructor("ZodCIDRv4",(e,t)=>{E.$ZodCIDRv4.init(e,t),m.ZodStringFormat.init(e,t)});function Pz(e){return E._cidrv4(m.ZodCIDRv4,e)}m.ZodCIDRv6=E.$constructor("ZodCIDRv6",(e,t)=>{E.$ZodCIDRv6.init(e,t),m.ZodStringFormat.init(e,t)});function Mz(e){return E._cidrv6(m.ZodCIDRv6,e)}m.ZodBase64=E.$constructor("ZodBase64",(e,t)=>{E.$ZodBase64.init(e,t),m.ZodStringFormat.init(e,t)});function Lz(e){return E._base64(m.ZodBase64,e)}m.ZodBase64URL=E.$constructor("ZodBase64URL",(e,t)=>{E.$ZodBase64URL.init(e,t),m.ZodStringFormat.init(e,t)});function jz(e){return E._base64url(m.ZodBase64URL,e)}m.ZodE164=E.$constructor("ZodE164",(e,t)=>{E.$ZodE164.init(e,t),m.ZodStringFormat.init(e,t)});function Dz(e){return E._e164(m.ZodE164,e)}m.ZodJWT=E.$constructor("ZodJWT",(e,t)=>{E.$ZodJWT.init(e,t),m.ZodStringFormat.init(e,t)});function Uz(e){return E._jwt(m.ZodJWT,e)}m.ZodCustomStringFormat=E.$constructor("ZodCustomStringFormat",(e,t)=>{E.$ZodCustomStringFormat.init(e,t),m.ZodStringFormat.init(e,t)});function zz(e,t,n={}){return E._stringFormat(m.ZodCustomStringFormat,e,t,n)}function Fz(e){return E._stringFormat(m.ZodCustomStringFormat,"hostname",E.regexes.hostname,e)}function qz(e){return E._stringFormat(m.ZodCustomStringFormat,"hex",E.regexes.hex,e)}function Vz(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=E.regexes[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return E._stringFormat(m.ZodCustomStringFormat,i,r,t)}m.ZodNumber=E.$constructor("ZodNumber",(e,t)=>{E.$ZodNumber.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.numberProcessor(e,i,r,o),ja(e,"ZodNumber",{gt(i,r){return this.check(ke.gt(i,r))},gte(i,r){return this.check(ke.gte(i,r))},min(i,r){return this.check(ke.gte(i,r))},lt(i,r){return this.check(ke.lt(i,r))},lte(i,r){return this.check(ke.lte(i,r))},max(i,r){return this.check(ke.lte(i,r))},int(i){return this.check(kp(i))},safe(i){return this.check(kp(i))},positive(i){return this.check(ke.gt(0,i))},nonnegative(i){return this.check(ke.gte(0,i))},negative(i){return this.check(ke.lt(0,i))},nonpositive(i){return this.check(ke.lte(0,i))},multipleOf(i,r){return this.check(ke.multipleOf(i,r))},step(i,r){return this.check(ke.multipleOf(i,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function yS(e){return E._number(m.ZodNumber,e)}m.ZodNumberFormat=E.$constructor("ZodNumberFormat",(e,t)=>{E.$ZodNumberFormat.init(e,t),m.ZodNumber.init(e,t)});function kp(e){return E._int(m.ZodNumberFormat,e)}function Wz(e){return E._float32(m.ZodNumberFormat,e)}function Zz(e){return E._float64(m.ZodNumberFormat,e)}function Bz(e){return E._int32(m.ZodNumberFormat,e)}function Hz(e){return E._uint32(m.ZodNumberFormat,e)}m.ZodBoolean=E.$constructor("ZodBoolean",(e,t)=>{E.$ZodBoolean.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.booleanProcessor(e,n,i,r)});function vS(e){return E._boolean(m.ZodBoolean,e)}m.ZodBigInt=E.$constructor("ZodBigInt",(e,t)=>{E.$ZodBigInt.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.bigintProcessor(e,i,r,o),e.gte=(i,r)=>e.check(ke.gte(i,r)),e.min=(i,r)=>e.check(ke.gte(i,r)),e.gt=(i,r)=>e.check(ke.gt(i,r)),e.gte=(i,r)=>e.check(ke.gte(i,r)),e.min=(i,r)=>e.check(ke.gte(i,r)),e.lt=(i,r)=>e.check(ke.lt(i,r)),e.lte=(i,r)=>e.check(ke.lte(i,r)),e.max=(i,r)=>e.check(ke.lte(i,r)),e.positive=i=>e.check(ke.gt(BigInt(0),i)),e.negative=i=>e.check(ke.lt(BigInt(0),i)),e.nonpositive=i=>e.check(ke.lte(BigInt(0),i)),e.nonnegative=i=>e.check(ke.gte(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(ke.multipleOf(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function Jz(e){return E._bigint(m.ZodBigInt,e)}m.ZodBigIntFormat=E.$constructor("ZodBigIntFormat",(e,t)=>{E.$ZodBigIntFormat.init(e,t),m.ZodBigInt.init(e,t)});function Kz(e){return E._int64(m.ZodBigIntFormat,e)}function Gz(e){return E._uint64(m.ZodBigIntFormat,e)}m.ZodSymbol=E.$constructor("ZodSymbol",(e,t)=>{E.$ZodSymbol.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.symbolProcessor(e,n,i,r)});function Xz(e){return E._symbol(m.ZodSymbol,e)}m.ZodUndefined=E.$constructor("ZodUndefined",(e,t)=>{E.$ZodUndefined.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.undefinedProcessor(e,n,i,r)});function Yz(e){return E._undefined(m.ZodUndefined,e)}m.ZodNull=E.$constructor("ZodNull",(e,t)=>{E.$ZodNull.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nullProcessor(e,n,i,r)});function bS(e){return E._null(m.ZodNull,e)}m.ZodAny=E.$constructor("ZodAny",(e,t)=>{E.$ZodAny.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.anyProcessor(e,n,i,r)});function Qz(){return E._any(m.ZodAny)}m.ZodUnknown=E.$constructor("ZodUnknown",(e,t)=>{E.$ZodUnknown.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.unknownProcessor(e,n,i,r)});function Co(){return E._unknown(m.ZodUnknown)}m.ZodNever=E.$constructor("ZodNever",(e,t)=>{E.$ZodNever.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.neverProcessor(e,n,i,r)});function Ep(e){return E._never(m.ZodNever,e)}m.ZodVoid=E.$constructor("ZodVoid",(e,t)=>{E.$ZodVoid.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.voidProcessor(e,n,i,r)});function eF(e){return E._void(m.ZodVoid,e)}m.ZodDate=E.$constructor("ZodDate",(e,t)=>{E.$ZodDate.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.dateProcessor(e,i,r,o),e.min=(i,r)=>e.check(ke.gte(i,r)),e.max=(i,r)=>e.check(ke.lte(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function tF(e){return E._date(m.ZodDate,e)}m.ZodArray=E.$constructor("ZodArray",(e,t)=>{E.$ZodArray.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.arrayProcessor(e,n,i,r),e.element=t.element,ja(e,"ZodArray",{min(n,i){return this.check(ke.minLength(n,i))},nonempty(n){return this.check(ke.minLength(1,n))},max(n,i){return this.check(ke.maxLength(n,i))},length(n,i){return this.check(ke.length(n,i))},unwrap(){return this.element}})});function Wl(e,t){return E._array(m.ZodArray,e,t)}function nF(e){let t=e._zod.def.shape;return Tp(Object.keys(t))}m.ZodObject=E.$constructor("ZodObject",(e,t)=>{E.$ZodObjectJIT.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.objectProcessor(e,n,i,r),Ne.util.defineLazy(e,"shape",()=>t.shape),ja(e,"ZodObject",{keyof(){return Tp(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Co()})},loose(){return this.clone({...this._zod.def,catchall:Co()})},strict(){return this.clone({...this._zod.def,catchall:Ep()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Ne.util.extend(this,n)},safeExtend(n){return Ne.util.safeExtend(this,n)},merge(n){return Ne.util.merge(this,n)},pick(n){return Ne.util.pick(this,n)},omit(n){return Ne.util.omit(this,n)},partial(...n){return Ne.util.partial(m.ZodOptional,this,n[0])},required(...n){return Ne.util.required(m.ZodNonOptional,this,n[0])}})});function rF(e,t){let n={type:"object",shape:e??{},...Ne.util.normalizeParams(t)};return new m.ZodObject(n)}function iF(e,t){return new m.ZodObject({type:"object",shape:e,catchall:Ep(),...Ne.util.normalizeParams(t)})}function oF(e,t){return new m.ZodObject({type:"object",shape:e,catchall:Co(),...Ne.util.normalizeParams(t)})}m.ZodUnion=E.$constructor("ZodUnion",(e,t)=>{E.$ZodUnion.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.unionProcessor(e,n,i,r),e.options=t.options});function Ap(e,t){return new m.ZodUnion({type:"union",options:e,...Ne.util.normalizeParams(t)})}m.ZodXor=E.$constructor("ZodXor",(e,t)=>{m.ZodUnion.init(e,t),E.$ZodXor.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.unionProcessor(e,n,i,r),e.options=t.options});function aF(e,t){return new m.ZodXor({type:"union",options:e,inclusive:!1,...Ne.util.normalizeParams(t)})}m.ZodDiscriminatedUnion=E.$constructor("ZodDiscriminatedUnion",(e,t)=>{m.ZodUnion.init(e,t),E.$ZodDiscriminatedUnion.init(e,t)});function sF(e,t,n){return new m.ZodDiscriminatedUnion({type:"union",options:t,discriminator:e,...Ne.util.normalizeParams(n)})}m.ZodIntersection=E.$constructor("ZodIntersection",(e,t)=>{E.$ZodIntersection.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.intersectionProcessor(e,n,i,r)});function SS(e,t){return new m.ZodIntersection({type:"intersection",left:e,right:t})}m.ZodTuple=E.$constructor("ZodTuple",(e,t)=>{E.$ZodTuple.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.tupleProcessor(e,n,i,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function kS(e,t,n){let i=t instanceof E.$ZodType,r=i?n:t,o=i?t:null;return new m.ZodTuple({type:"tuple",items:e,rest:o,...Ne.util.normalizeParams(r)})}m.ZodRecord=E.$constructor("ZodRecord",(e,t)=>{E.$ZodRecord.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.recordProcessor(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function wS(e,t,n){return!t||!t._zod?new m.ZodRecord({type:"record",keyType:Fl(),valueType:e,...Ne.util.normalizeParams(t)}):new m.ZodRecord({type:"record",keyType:e,valueType:t,...Ne.util.normalizeParams(n)})}function cF(e,t,n){let i=E.clone(e);return i._zod.values=void 0,new m.ZodRecord({type:"record",keyType:i,valueType:t,...Ne.util.normalizeParams(n)})}function lF(e,t,n){return new m.ZodRecord({type:"record",keyType:e,valueType:t,mode:"loose",...Ne.util.normalizeParams(n)})}m.ZodMap=E.$constructor("ZodMap",(e,t)=>{E.$ZodMap.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.mapProcessor(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(E._minSize(...n)),e.nonempty=n=>e.check(E._minSize(1,n)),e.max=(...n)=>e.check(E._maxSize(...n)),e.size=(...n)=>e.check(E._size(...n))});function uF(e,t,n){return new m.ZodMap({type:"map",keyType:e,valueType:t,...Ne.util.normalizeParams(n)})}m.ZodSet=E.$constructor("ZodSet",(e,t)=>{E.$ZodSet.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.setProcessor(e,n,i,r),e.min=(...n)=>e.check(E._minSize(...n)),e.nonempty=n=>e.check(E._minSize(1,n)),e.max=(...n)=>e.check(E._maxSize(...n)),e.size=(...n)=>e.check(E._size(...n))});function dF(e,t){return new m.ZodSet({type:"set",valueType:e,...Ne.util.normalizeParams(t)})}m.ZodEnum=E.$constructor("ZodEnum",(e,t)=>{E.$ZodEnum.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xe.enumProcessor(e,i,r,o),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let a of i)if(n.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new m.ZodEnum({...t,checks:[],...Ne.util.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let a of i)if(n.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new m.ZodEnum({...t,checks:[],...Ne.util.normalizeParams(r),entries:o})}});function Tp(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new m.ZodEnum({type:"enum",entries:n,...Ne.util.normalizeParams(t)})}function _F(e,t){return new m.ZodEnum({type:"enum",entries:e,...Ne.util.normalizeParams(t)})}m.ZodLiteral=E.$constructor("ZodLiteral",(e,t)=>{E.$ZodLiteral.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.literalProcessor(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pF(e,t){return new m.ZodLiteral({type:"literal",values:Array.isArray(e)?e:[e],...Ne.util.normalizeParams(t)})}m.ZodFile=E.$constructor("ZodFile",(e,t)=>{E.$ZodFile.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.fileProcessor(e,n,i,r),e.min=(n,i)=>e.check(E._minSize(n,i)),e.max=(n,i)=>e.check(E._maxSize(n,i)),e.mime=(n,i)=>e.check(E._mime(Array.isArray(n)?n:[n],i))});function fF(e){return E._file(m.ZodFile,e)}m.ZodTransform=E.$constructor("ZodTransform",(e,t)=>{E.$ZodTransform.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.transformProcessor(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new E.$ZodEncodeError(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(Ne.util.issue(o,n.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Ne.util.issue(a))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=r,n.fallback=!0,n)}});function xp(e){return new m.ZodTransform({type:"transform",transform:e})}m.ZodOptional=E.$constructor("ZodOptional",(e,t)=>{E.$ZodOptional.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.optionalProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function ql(e){return new m.ZodOptional({type:"optional",innerType:e})}m.ZodExactOptional=E.$constructor("ZodExactOptional",(e,t)=>{E.$ZodExactOptional.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.optionalProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function ES(e){return new m.ZodExactOptional({type:"optional",innerType:e})}m.ZodNullable=E.$constructor("ZodNullable",(e,t)=>{E.$ZodNullable.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nullableProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Vl(e){return new m.ZodNullable({type:"nullable",innerType:e})}function mF(e){return ql(Vl(e))}m.ZodDefault=E.$constructor("ZodDefault",(e,t)=>{E.$ZodDefault.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.defaultProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function AS(e,t){return new m.ZodDefault({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ne.util.shallowClone(t)}})}m.ZodPrefault=E.$constructor("ZodPrefault",(e,t)=>{E.$ZodPrefault.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.prefaultProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function TS(e,t){return new m.ZodPrefault({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ne.util.shallowClone(t)}})}m.ZodNonOptional=E.$constructor("ZodNonOptional",(e,t)=>{E.$ZodNonOptional.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nonoptionalProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function xS(e,t){return new m.ZodNonOptional({type:"nonoptional",innerType:e,...Ne.util.normalizeParams(t)})}m.ZodSuccess=E.$constructor("ZodSuccess",(e,t)=>{E.$ZodSuccess.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.successProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function gF(e){return new m.ZodSuccess({type:"success",innerType:e})}m.ZodCatch=E.$constructor("ZodCatch",(e,t)=>{E.$ZodCatch.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.catchProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function OS(e,t){return new m.ZodCatch({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}m.ZodNaN=E.$constructor("ZodNaN",(e,t)=>{E.$ZodNaN.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.nanProcessor(e,n,i,r)});function hF(e){return E._nan(m.ZodNaN,e)}m.ZodPipe=E.$constructor("ZodPipe",(e,t)=>{E.$ZodPipe.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.pipeProcessor(e,n,i,r),e.in=t.in,e.out=t.out});function wp(e,t){return new m.ZodPipe({type:"pipe",in:e,out:t})}m.ZodCodec=E.$constructor("ZodCodec",(e,t)=>{m.ZodPipe.init(e,t),E.$ZodCodec.init(e,t)});function yF(e,t,n){return new m.ZodCodec({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function vF(e){let t=e._zod.def;return new m.ZodCodec({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}m.ZodPreprocess=E.$constructor("ZodPreprocess",(e,t)=>{m.ZodPipe.init(e,t),E.$ZodPreprocess.init(e,t)});m.ZodReadonly=E.$constructor("ZodReadonly",(e,t)=>{E.$ZodReadonly.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.readonlyProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function RS(e){return new m.ZodReadonly({type:"readonly",innerType:e})}m.ZodTemplateLiteral=E.$constructor("ZodTemplateLiteral",(e,t)=>{E.$ZodTemplateLiteral.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.templateLiteralProcessor(e,n,i,r)});function bF(e,t){return new m.ZodTemplateLiteral({type:"template_literal",parts:e,...Ne.util.normalizeParams(t)})}m.ZodLazy=E.$constructor("ZodLazy",(e,t)=>{E.$ZodLazy.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.lazyProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function $S(e){return new m.ZodLazy({type:"lazy",getter:e})}m.ZodPromise=E.$constructor("ZodPromise",(e,t)=>{E.$ZodPromise.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.promiseProcessor(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function SF(e){return new m.ZodPromise({type:"promise",innerType:e})}m.ZodFunction=E.$constructor("ZodFunction",(e,t)=>{E.$ZodFunction.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.functionProcessor(e,n,i,r)});function Zl(e){return new m.ZodFunction({type:"function",input:Array.isArray(e?.input)?kS(e?.input):e?.input??Wl(Co()),output:e?.output??Co()})}m.ZodCustom=E.$constructor("ZodCustom",(e,t)=>{E.$ZodCustom.init(e,t),m.ZodType.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xe.customProcessor(e,n,i,r)});function kF(e){let t=new E.$ZodCheck({check:"custom"});return t._zod.check=e,t}function wF(e,t){return E._custom(m.ZodCustom,e??(()=>!0),t)}function CS(e,t={}){return E._refine(m.ZodCustom,e,t)}function IS(e,t){return E._superRefine(e,t)}m.describe=E.describe;m.meta=E.meta;function EF(e,t={}){let n=new m.ZodCustom({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...Ne.util.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var AF=(...e)=>E._stringbool({Codec:m.ZodCodec,Boolean:m.ZodBoolean,String:m.ZodString},...e);m.stringbool=AF;function TF(e){let t=$S(()=>Ap([Fl(e),yS(),vS(),bS(),Wl(t),wS(Fl(),t)]));return t}function xF(e,t){return new m.ZodPreprocess({type:"pipe",in:xp(e),out:t})}});var LS=N(kt=>{"use strict";var OF=kt&&kt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),RF=kt&&kt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$F=kt&&kt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&OF(t,e,n);return RF(t,e),t};Object.defineProperty(kt,"__esModule",{value:!0});kt.ZodFirstPartyTypeKind=kt.config=kt.$brand=kt.ZodIssueCode=void 0;kt.setErrorMap=CF;kt.getErrorMap=IF;var PS=$F(Vt());kt.ZodIssueCode={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var MS=Vt();Object.defineProperty(kt,"$brand",{enumerable:!0,get:function(){return MS.$brand}});Object.defineProperty(kt,"config",{enumerable:!0,get:function(){return MS.config}});function CF(e){PS.config({customError:e})}function IF(){return PS.config().customError}var NS;NS||(kt.ZodFirstPartyTypeKind=NS={})});var DS=N(jr=>{"use strict";var NF=jr&&jr.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),PF=jr&&jr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Op=jr&&jr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&NF(t,e,n);return PF(t,e),t};Object.defineProperty(jr,"__esModule",{value:!0});jr.fromJSONSchema=qF;var MF=Ra(),LF=Op(jl()),jF=Op(Pa()),DF=Op(Ma()),ne={...DF,...LF,iso:jF},UF=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function zF(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function FF(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function jS(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return ne.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return ne.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=FF(r,t),a=$t(o,t);return t.refs.set(r,a),t.processing.delete(r),a}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return ne.null();if(r.length===0)return ne.never();if(r.length===1)return ne.literal(r[0]);if(r.every(a=>typeof a=="string"))return ne.enum(r);let o=r.map(a=>ne.literal(a));return o.length<2?o[0]:ne.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return ne.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let a={...e,type:o};return jS(a,t)});return r.length===0?ne.never():r.length===1?r[0]:ne.union(r)}if(!n)return ne.any();let i;switch(n){case"string":{let r=ne.string();if(e.format){let o=e.format;o==="email"?r=r.check(ne.email()):o==="uri"||o==="uri-reference"?r=r.check(ne.url()):o==="uuid"||o==="guid"?r=r.check(ne.uuid()):o==="date-time"?r=r.check(ne.iso.datetime()):o==="date"?r=r.check(ne.iso.date()):o==="time"?r=r.check(ne.iso.time()):o==="duration"?r=r.check(ne.iso.duration()):o==="ipv4"?r=r.check(ne.ipv4()):o==="ipv6"?r=r.check(ne.ipv6()):o==="mac"?r=r.check(ne.mac()):o==="cidr"?r=r.check(ne.cidrv4()):o==="cidr-v6"?r=r.check(ne.cidrv6()):o==="base64"?r=r.check(ne.base64()):o==="base64url"?r=r.check(ne.base64url()):o==="e164"?r=r.check(ne.e164()):o==="jwt"?r=r.check(ne.jwt()):o==="emoji"?r=r.check(ne.emoji()):o==="nanoid"?r=r.check(ne.nanoid()):o==="cuid"?r=r.check(ne.cuid()):o==="cuid2"?r=r.check(ne.cuid2()):o==="ulid"?r=r.check(ne.ulid()):o==="xid"?r=r.check(ne.xid()):o==="ksuid"&&(r=r.check(ne.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?ne.number().int():ne.number();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=ne.boolean();break}case"null":{i=ne.null();break}case"object":{let r={},o=e.properties||{},a=new Set(e.required||[]);for(let[l,c]of Object.entries(o)){let d=$t(c,t);r[l]=a.has(l)?d:d.optional()}if(e.propertyNames){let l=$t(e.propertyNames,t),c=e.additionalProperties&&typeof e.additionalProperties=="object"?$t(e.additionalProperties,t):ne.any();if(Object.keys(r).length===0){i=ne.record(l,c);break}let d=ne.object(r).passthrough(),u=ne.looseRecord(l,c);i=ne.intersection(d,u);break}if(e.patternProperties){let l=e.patternProperties,c=Object.keys(l),d=[];for(let _ of c){let p=$t(l[_],t),v=ne.string().regex(new RegExp(_));d.push(ne.looseRecord(v,p))}let u=[];if(Object.keys(r).length>0&&u.push(ne.object(r).passthrough()),u.push(...d),u.length===0)i=ne.object({}).passthrough();else if(u.length===1)i=u[0];else{let _=ne.intersection(u[0],u[1]);for(let p=2;p<u.length;p++)_=ne.intersection(_,u[p]);i=_}break}let s=ne.object(r);e.additionalProperties===!1?i=s.strict():typeof e.additionalProperties=="object"?i=s.catchall($t(e.additionalProperties,t)):i=s.passthrough();break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let a=r.map(l=>$t(l,t)),s=o&&typeof o=="object"&&!Array.isArray(o)?$t(o,t):void 0;s?i=ne.tuple(a).rest(s):i=ne.tuple(a),typeof e.minItems=="number"&&(i=i.check(ne.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(ne.maxLength(e.maxItems)))}else if(Array.isArray(o)){let a=o.map(l=>$t(l,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?$t(e.additionalItems,t):void 0;s?i=ne.tuple(a).rest(s):i=ne.tuple(a),typeof e.minItems=="number"&&(i=i.check(ne.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(ne.maxLength(e.maxItems)))}else if(o!==void 0){let a=$t(o,t),s=ne.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),i=s}else i=ne.array(ne.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function $t(e,t){if(typeof e=="boolean")return e?ne.any():ne.never();let n=jS(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(c=>$t(c,t)),l=ne.union(s);n=i?ne.intersection(n,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(c=>$t(c,t)),l=ne.xor(s);n=i?ne.intersection(n,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:ne.any();else{let s=i?n:$t(e.allOf[0],t),l=i?0:1;for(let c=l;c<e.allOf.length;c++)s=ne.intersection(s,$t(e.allOf[c],t));n=s}e.nullable===!0&&t.version==="openapi-3.0"&&(n=ne.nullable(n)),e.readOnly===!0&&(n=ne.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of o)s in e&&(r[s]=e[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in e&&(r[s]=e[s]);for(let s of Object.keys(e))UF.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function qF(e,t){if(typeof e=="boolean")return e?ne.any():ne.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=zF(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??MF.globalRegistry};return $t(n,o)}});var zS=N(Kt=>{"use strict";var VF=Kt&&Kt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),WF=Kt&&Kt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),US=Kt&&Kt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&VF(t,e,n);return WF(t,e),t};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.string=ZF;Kt.number=BF;Kt.boolean=HF;Kt.bigint=JF;Kt.date=KF;var Da=US(Vt()),Ua=US(Ma());function ZF(e){return Da._coercedString(Ua.ZodString,e)}function BF(e){return Da._coercedNumber(Ua.ZodNumber,e)}function HF(e){return Da._coercedBoolean(Ua.ZodBoolean,e)}function JF(e){return Da._coercedBigint(Ua.ZodBigInt,e)}function KF(e){return Da._coercedDate(Ua.ZodDate,e)}});var Rp=N(ae=>{"use strict";var FS=ae&&ae.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),GF=ae&&ae.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Bl=ae&&ae.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&FS(t,e,n);return GF(t,e),t},za=ae&&ae.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&FS(t,e,n)},XF=ae&&ae.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ae,"__esModule",{value:!0});ae.coerce=ae.iso=ae.ZodISODuration=ae.ZodISOTime=ae.ZodISODate=ae.ZodISODateTime=ae.locales=ae.fromJSONSchema=ae.toJSONSchema=ae.NEVER=ae.util=ae.TimePrecision=ae.flattenError=ae.formatError=ae.prettifyError=ae.treeifyError=ae.regexes=ae.clone=ae.$brand=ae.$input=ae.$output=ae.config=ae.registry=ae.globalRegistry=ae.core=void 0;ae.core=Bl(Vt());za(Ma(),ae);za(jl(),ae);za(vp(),ae);za(bp(),ae);za(LS(),ae);var YF=Vt(),QF=XF(dp());(0,YF.config)((0,QF.default)());var Lt=Vt();Object.defineProperty(ae,"globalRegistry",{enumerable:!0,get:function(){return Lt.globalRegistry}});Object.defineProperty(ae,"registry",{enumerable:!0,get:function(){return Lt.registry}});Object.defineProperty(ae,"config",{enumerable:!0,get:function(){return Lt.config}});Object.defineProperty(ae,"$output",{enumerable:!0,get:function(){return Lt.$output}});Object.defineProperty(ae,"$input",{enumerable:!0,get:function(){return Lt.$input}});Object.defineProperty(ae,"$brand",{enumerable:!0,get:function(){return Lt.$brand}});Object.defineProperty(ae,"clone",{enumerable:!0,get:function(){return Lt.clone}});Object.defineProperty(ae,"regexes",{enumerable:!0,get:function(){return Lt.regexes}});Object.defineProperty(ae,"treeifyError",{enumerable:!0,get:function(){return Lt.treeifyError}});Object.defineProperty(ae,"prettifyError",{enumerable:!0,get:function(){return Lt.prettifyError}});Object.defineProperty(ae,"formatError",{enumerable:!0,get:function(){return Lt.formatError}});Object.defineProperty(ae,"flattenError",{enumerable:!0,get:function(){return Lt.flattenError}});Object.defineProperty(ae,"TimePrecision",{enumerable:!0,get:function(){return Lt.TimePrecision}});Object.defineProperty(ae,"util",{enumerable:!0,get:function(){return Lt.util}});Object.defineProperty(ae,"NEVER",{enumerable:!0,get:function(){return Lt.NEVER}});var eq=Na();Object.defineProperty(ae,"toJSONSchema",{enumerable:!0,get:function(){return eq.toJSONSchema}});var tq=DS();Object.defineProperty(ae,"fromJSONSchema",{enumerable:!0,get:function(){return tq.fromJSONSchema}});ae.locales=Bl(fp());var Hl=Pa();Object.defineProperty(ae,"ZodISODateTime",{enumerable:!0,get:function(){return Hl.ZodISODateTime}});Object.defineProperty(ae,"ZodISODate",{enumerable:!0,get:function(){return Hl.ZodISODate}});Object.defineProperty(ae,"ZodISOTime",{enumerable:!0,get:function(){return Hl.ZodISOTime}});Object.defineProperty(ae,"ZodISODuration",{enumerable:!0,get:function(){return Hl.ZodISODuration}});ae.iso=Bl(Pa());ae.coerce=Bl(zS())});var Xe=N(Wt=>{"use strict";var qS=Wt&&Wt.__createBinding||(Object.create?(function(e,t,n,i){i===void 0&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}):(function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]})),nq=Wt&&Wt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),rq=Wt&&Wt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&qS(t,e,n);return nq(t,e),t},iq=Wt&&Wt.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&qS(t,e,n)};Object.defineProperty(Wt,"__esModule",{value:!0});Wt.z=void 0;var VS=rq(Rp());Wt.z=VS;iq(Rp(),Wt);Wt.default=VS});var Ee,$G,oq,CG,IG,WS=P(()=>{"use strict";Ee=He(Xe(),1),$G=Ee.z.object({provider:Ee.z.string().min(1),models:Ee.z.array(Ee.z.string().min(1)).min(1),reasoning_efforts:Ee.z.array(Ee.z.enum(["low","medium","high","xhigh"])).min(1),velocities:Ee.z.array(Ee.z.literal("standard")).length(1),streaming:Ee.z.boolean(),cancellation:Ee.z.boolean(),checkpointing:Ee.z.boolean(),resume:Ee.z.boolean(),tool_calls:Ee.z.boolean(),structured_output:Ee.z.boolean(),max_parallel_invocations:Ee.z.number().int().positive()}).strict().superRefine((e,t)=>{e.resume&&!e.checkpointing&&t.addIssue({code:"custom",message:"Resume requires checkpointing"})}),oq=Ee.z.object({role:Ee.z.enum(["system","user","assistant","tool"]),content:Ee.z.string(),name:Ee.z.string().min(1).nullable().default(null)}).strict(),CG=Ee.z.object({schema_version:Ee.z.literal(1),invocation_id:Ee.z.string().regex(/^INV-[A-Z0-9-]+$/),agent_id:Ee.z.string().min(1),model:Ee.z.string().min(1),reasoning_effort:Ee.z.enum(["low","medium","high","xhigh"]),velocity:Ee.z.literal("standard"),input:Ee.z.object({messages:Ee.z.array(oq).min(1),context_refs:Ee.z.array(Ee.z.string().min(1)),tools:Ee.z.array(Ee.z.string().min(1)),response_format:Ee.z.enum(["text","json"])}).strict(),budget:Ee.z.object({max_output_tokens:Ee.z.number().int().positive(),timeout_ms:Ee.z.number().int().positive().nullable(),max_tool_calls:Ee.z.number().int().nonnegative()}).strict(),metadata:Ee.z.record(Ee.z.string(),Ee.z.string()),resume_from:Ee.z.string().min(1).nullable()}).strict(),IG=Ee.z.object({invocation_id:Ee.z.string().regex(/^INV-[A-Z0-9-]+$/),reason:Ee.z.enum(["user","budget","timeout","shutdown","superseded"]),requested_at:Ee.z.string().datetime()}).strict()});var Se,Dr,BS,ZS,aq,sq,$p=P(()=>{"use strict";Se=He(Xe(),1),Dr={schema_version:Se.z.literal(1),invocation_id:Se.z.string().regex(/^INV-[A-Z0-9-]+$/),sequence:Se.z.number().int().nonnegative(),occurred_at:Se.z.string().datetime()},BS=Se.z.object({checkpoint_id:Se.z.string().regex(/^CHK-[A-Z0-9-]+$/),opaque_token:Se.z.string().min(1),resumable_until:Se.z.string().datetime().nullable(),state_hash:Se.z.string().regex(/^[a-f0-9]{64}$/)}).strict(),ZS=Se.z.object({input_tokens:Se.z.number().int().nonnegative(),cached_input_tokens:Se.z.number().int().nonnegative(),output_tokens:Se.z.number().int().nonnegative(),reasoning_tokens:Se.z.number().int().nonnegative(),source:Se.z.enum(["provider","estimated","unavailable"])}).strict(),aq=Se.z.object({code:Se.z.enum(["authentication","authorization","invalid_request","rate_limit","provider_unavailable","timeout","budget_exceeded","tool_error","protocol_error","unknown"]),message:Se.z.string().min(1),retryable:Se.z.boolean(),retry_after_ms:Se.z.number().int().nonnegative().nullable(),provider_code:Se.z.string().nullable()}).strict(),sq=Se.z.discriminatedUnion("type",[Se.z.object({...Dr,type:Se.z.literal("invocation.started")}).strict(),Se.z.object({...Dr,type:Se.z.literal("output.delta"),delta:Se.z.string().min(1)}).strict(),Se.z.object({...Dr,type:Se.z.literal("tool.requested"),call_id:Se.z.string().min(1),name:Se.z.string().min(1),arguments:Se.z.unknown()}).strict(),Se.z.object({...Dr,type:Se.z.literal("tool.completed"),call_id:Se.z.string().min(1),output:Se.z.unknown()}).strict(),Se.z.object({...Dr,type:Se.z.literal("checkpoint.created"),checkpoint:BS}).strict(),Se.z.object({...Dr,type:Se.z.literal("usage.updated"),usage:ZS}).strict(),Se.z.object({...Dr,type:Se.z.literal("invocation.completed"),output:Se.z.string(),usage:ZS}).strict(),Se.z.object({...Dr,type:Se.z.literal("invocation.failed"),error:aq}).strict(),Se.z.object({...Dr,type:Se.z.literal("invocation.cancelled"),reason:Se.z.string().min(1)}).strict()])});var HS=P(()=>{"use strict";$p()});var Cp=P(()=>{"use strict";WS();$p();HS()});function lq(e){return`${e.nome}_${e.cargo}_zaip_agent`}function ii(e){return hq.parse(e)}var _e,jt,JS,cq,uq,dq,_q,KS,pq,fq,Jl,mq,gq,hq,GS=P(()=>{"use strict";_e=He(Xe(),1),jt=_e.z.array(_e.z.string().min(1)).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:"custom",message:"Values must be unique"})}),JS=_e.z.string().regex(/^[a-z0-9]+(?:_[a-z0-9]+)*$/),cq=_e.z.object({nome:JS,cargo:JS,foto_url:_e.z.url().refine(e=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Persona photo URL must use http or https").optional()}).strict();uq=jt.length(1).superRefine((e,t)=>{for(let[n,i]of e.entries())/^[a-z0-9_]+$/.test(i)||t.addIssue({code:"custom",path:[n],message:"Codex nicknames must be lowercase snake_case"})}),dq=_e.z.string().regex(/^zaip-agent-[a-z0-9-]+$/,'Codex agent name must use the "zaip-agent-NOME" format'),_q=_e.z.string().regex(/^[a-z0-9_]+$/,"Codex task name must use lowercase snake_case"),KS=_e.z.enum(["orchestrator","analyst","task-executor","execution-finalizer","builder","reviewer","integrator","auditor"]),pq=_e.z.enum(["id","codex_name","codex_task_name"]),fq=_e.z.object({kind:pq,value:_e.z.string().min(1),deprecated_at:_e.z.iso.date(),remove_after:_e.z.iso.date(),replacement:_e.z.string().regex(/^agent-[a-z0-9-]+$/)}).strict().superRefine((e,t)=>{(e.kind==="id"?/^agent-[a-z0-9-]+$/.test(e.value):e.kind==="codex_name"?/^zaip-agent-[a-z0-9-]+$/.test(e.value):/^[a-z0-9_]+$/.test(e.value))||t.addIssue({code:"custom",path:["value"],message:`Alias value does not match identity kind ${e.kind}`}),e.remove_after<=e.deprecated_at&&t.addIssue({code:"custom",path:["remove_after"],message:"Alias removal date must be after its deprecation date"})}),Jl=_e.z.object({allow:jt,deny:jt}).strict().superRefine((e,t)=>{let n=e.allow.filter(i=>e.deny.includes(i));n.length>0&&t.addIssue({code:"custom",message:`Permission both allowed and denied: ${n.join(", ")}`})}),mq=_e.z.object({id:_e.z.string().regex(/^agent-[a-z0-9-]+$/),version:_e.z.number().int().positive(),purpose:_e.z.string().min(1),use_when:jt.min(1),do_not_use:jt.min(1),codex_name:dq,codex_task_name:_q,persona:cq,nickname_candidates:uq,compatibility:_e.z.object({aliases:_e.z.array(fq)}).strict().optional(),role:KS,priority:_e.z.number().int().nonnegative().default(100),inherits:_e.z.string().regex(/^agent-[a-z0-9-]+$/).nullable().default(null),capabilities:jt.min(1),execution_eligibility:_e.z.array(_e.z.enum(["interaction","delivery"])),tools:jt,skills:jt,write_scopes:jt,permissions:_e.z.object({filesystem:Jl,network:Jl,shell:Jl,deployment:Jl}).strict(),model:_e.z.object({required_capabilities:jt,preferred:jt,reasoning_effort:_e.z.enum(["low","medium","high","xhigh","ultra"]).optional()}).strict(),budget:_e.z.object({soft_cycles:_e.z.number().int().positive()}).strict(),contract:_e.z.object({inputs:jt.min(1),outputs:jt.min(1),evidence:jt.min(1)}).strict(),review:_e.z.object({can_approve:_e.z.boolean(),cannot_review_roles:_e.z.array(KS)}).strict(),escalation:jt}).strict().superRefine((e,t)=>{let n=e.nickname_candidates[0];e.codex_task_name!==n&&t.addIssue({code:"custom",path:["codex_task_name"],message:`Codex task name must equal the primary nickname candidate: ${n}`});let i=lq(e.persona);e.nickname_candidates[0]!==i&&t.addIssue({code:"custom",path:["nickname_candidates"],message:`nickname_candidates must contain only the derived persona nickname: ${i}`})}),gq=_e.z.object({id:_e.z.string().regex(/^squad-[a-z0-9-]+$/),version:_e.z.number().int().positive(),purpose:_e.z.string().min(1),members:_e.z.array(_e.z.string().regex(/^agent-[a-z0-9-]+$/)).min(2),max_parallelism:_e.z.number().int().positive(),delegation:_e.z.array(_e.z.object({from:_e.z.string().regex(/^agent-[a-z0-9-]+$/),to:_e.z.string().regex(/^agent-[a-z0-9-]+$/),capability:_e.z.string().min(1)}).strict()),review_policy:_e.z.object({independent:_e.z.literal(!0),executor_roles:_e.z.array(_e.z.enum(["analyst","builder","task-executor"])).min(1),reviewer_roles:_e.z.array(_e.z.enum(["reviewer","auditor"])).min(1)}).strict(),escalation:_e.z.array(_e.z.string().regex(/^agent-[a-z0-9-]+$/)).min(1)}).strict(),hq=_e.z.object({schema_version:_e.z.literal(1),agents:_e.z.array(mq).min(1),squads:_e.z.array(gq).min(1)}).strict()});function Ip(e){let t=[],n=new Map,i=new Set,r=new Set;for(let l of e.agents)n.has(l.id)&&t.push({rule:"duplicate-id",subject:l.id,message:"Duplicate Agent id"}),i.has(l.codex_name)&&t.push({rule:"duplicate-codex-name",subject:l.codex_name,message:"Duplicate Codex agent name"}),i.add(l.codex_name),r.has(l.codex_task_name)&&t.push({rule:"duplicate-codex-task-name",subject:l.codex_task_name,message:"Duplicate Codex task name"}),r.add(l.codex_task_name),n.set(l.id,l);let o=new Set(e.agents.flatMap(l=>[l.id,l.codex_name,l.codex_task_name])),a=new Map;for(let l of e.agents)for(let c of l.compatibility?.aliases??[]){let d=a.get(c.value);o.has(c.value)||d!==void 0?t.push({rule:"identity-alias-collision",subject:c.value,message:d===void 0?`Agent alias collides with a canonical identity: ${c.value}`:`Agent alias is ambiguous between ${d} and ${l.id}: ${c.value}`}):a.set(c.value,l.id),(c.replacement!==l.id||!n.has(c.replacement))&&t.push({rule:"invalid-identity-replacement",subject:c.value,message:`Agent alias replacement must be its owning canonical id: ${l.id}`})}let s=new Set;for(let l of e.squads)s.has(l.id)&&t.push({rule:"duplicate-id",subject:l.id,message:"Duplicate Squad id"}),s.add(l.id),yq(l,n,t);for(let l of e.agents){if(l.inherits!==null){let c=n.get(l.inherits);c===void 0?t.push({rule:"unknown-agent",subject:l.id,message:`Inherited Agent does not exist: ${l.inherits}`}):vq(l,c,t)}for(let c of l.escalation)n.has(c)||t.push({rule:"unknown-agent",subject:l.id,message:`Escalation target does not exist: ${c}`})}return t}function yq(e,t,n){for(let s of[...e.members,...e.escalation])t.has(s)||n.push({rule:"unknown-agent",subject:e.id,message:`Unknown member: ${s}`});let i=new Map,r=new Set;for(let s of e.delegation){e.members.includes(s.from)||n.push({rule:"invalid-delegation-source",subject:e.id,message:`Delegation source is not a squad member: ${s.from}`}),t.has(s.to)?e.members.includes(s.to)||n.push({rule:"invalid-delegation-target",subject:e.id,message:`Delegation target is not a squad member: ${s.to}`}):n.push({rule:"invalid-delegation-target",subject:e.id,message:`Delegation target does not exist: ${s.to}`}),s.from===s.to&&n.push({rule:"delegation-cycle",subject:e.id,message:`Self delegation: ${s.from}`}),i.set(s.from,[...i.get(s.from)??[],s.to]),r.add(s.to);let l=t.get(s.to);l!==void 0&&!l.capabilities.includes(s.capability)&&n.push({rule:"missing-capability",subject:s.to,message:`Delegation target lacks ${s.capability}`})}for(let s of e.members)s!=="agent-orchestrator"&&!r.has(s)&&n.push({rule:"unreachable-agent",subject:s,message:`Squad member has no inbound delegation route: ${s}`});for(let s of e.members)if(XS(s,i,new Set,new Set)){n.push({rule:"delegation-cycle",subject:e.id,message:"Delegation graph contains a cycle"});break}let o=e.members.map(s=>t.get(s)).filter(s=>s?.role==="builder"),a=e.members.map(s=>t.get(s)).filter(s=>s?.role==="reviewer"||s?.role==="auditor");o.some(s=>a.some(l=>l?.id===s?.id))&&n.push({rule:"self-review",subject:e.id,message:"Builder is also the reviewer"})}function vq(e,t,n){for(let i of["filesystem","network","shell","deployment"]){let r=e.permissions[i].allow.filter(o=>!t.permissions[i].allow.includes(o));r.length>0&&n.push({rule:"privilege-escalation",subject:e.id,message:`${i} inheritance adds authority: ${r.join(", ")}`})}}function XS(e,t,n,i){if(n.has(e))return!0;if(i.has(e))return!1;n.add(e);for(let r of t.get(e)??[])if(XS(r,t,n,i))return!0;return n.delete(e),i.add(e),!1}var Np=P(()=>{"use strict"});var YS=P(()=>{"use strict";Np()});var QS=P(()=>{"use strict";GS();YS();Np()});var Qe,Pp=P(()=>{"use strict";Qe=class{now(){return new Date}}});function Aq(e){let t=Lp.parse(e.risk_signals);return t.production_impact||t.external_action||t.irreversible_change||t.security_or_critical_data||t.data_migration||t.broad_audit?Io("critical","CRITICAL_EXPLICIT_IMPACT"):t.rollback==="complex"?Io("critical","CRITICAL_COMPLEX_ROLLBACK"):e.ambiguity==="high"&&e.transversality==="cross_system"?Io("critical","CRITICAL_AMBIGUOUS_CROSS_SYSTEM"):e.rework==="structural"&&e.rework_cost==="high"?Io("critical","CRITICAL_STRUCTURAL_REWORK"):e.complexity==="simple"&&e.transversality==="local"&&e.ambiguity==="low"&&e.rework==="none"&&e.rework_cost==="low"&&e.bounded&&t.rollback==="trivial"&&t.verification_scope==="scoped"?Io("lite","LITE_BOUNDED_LOCAL"):Io("standard","STANDARD_GOVERNED")}function Io(e,t){return{risk:e,policy_version:ek,reasons:[t]}}var pe,bq,Sq,ek,tk,nk,Mp,Kl,kq,wq,Eq,Lp,Gl,Mi,XG,rk,No=P(()=>{"use strict";pe=He(Xe(),1),bq=["gpt-5.6-luna","gpt-5.6-terra","gpt-5.6-sol"],Sq=["low","medium","high","xhigh"],ek="task-risk-v1",tk=pe.z.enum(bq),nk=pe.z.enum(Sq),Mp=pe.z.literal("standard"),Kl=pe.z.object({model:pe.z.string().min(1).optional(),reasoning_effort:pe.z.string().min(1).optional(),velocity:pe.z.string().min(1).optional()}).strict().refine(e=>e.model!==void 0||e.reasoning_effort!==void 0||e.velocity!==void 0,"Model selection override must define at least one field"),kq=pe.z.enum(["discovery","planning","replanning","implementation","testing","integration","review","audit","finalization","rework"]),wq=pe.z.enum(["full_stack_boundary","shared_contracts_3_plus","critical_data_or_security","rollout_and_rollback","repeated_structural_repair","architectural_review_finding","prepared_plan_invalidated","material_architectural_tradeoffs"]),Eq=pe.z.object({phase:kq,agent_role:pe.z.string().min(1),complexity:pe.z.enum(["simple","standard","complex"]),risk:pe.z.enum(["lite","standard","critical"]),transversality:pe.z.enum(["local","multi_module","cross_system"]),ambiguity:pe.z.enum(["low","medium","high"]),rework:pe.z.enum(["none","localized","structural"]),rework_cost:pe.z.enum(["low","medium","high"]),bounded:pe.z.boolean(),high_volume:pe.z.boolean().default(!1),xhigh_triggers:pe.z.array(wq).default([])}).strict(),Lp=pe.z.object({production_impact:pe.z.boolean(),external_action:pe.z.boolean(),irreversible_change:pe.z.boolean(),security_or_critical_data:pe.z.boolean(),data_migration:pe.z.boolean(),broad_audit:pe.z.boolean(),rollback:pe.z.enum(["trivial","planned","complex"]),verification_scope:pe.z.enum(["scoped","package","cross_scope","full"])}).strict(),Gl=Eq.omit({agent_role:!0,risk:!0}).extend({risk_signals:Lp}).strict(),Mi=Gl.extend({risk:pe.z.enum(["lite","standard","critical"]),risk_signals:Lp,risk_policy_version:pe.z.literal(ek),risk_reasons:pe.z.array(pe.z.enum(["CRITICAL_EXPLICIT_IMPACT","CRITICAL_COMPLEX_ROLLBACK","CRITICAL_AMBIGUOUS_CROSS_SYSTEM","CRITICAL_STRUCTURAL_REWORK","LITE_BOUNDED_LOCAL","STANDARD_GOVERNED"])).min(1)}).strict().superRefine((e,t)=>{let n=Aq(e);e.risk!==n.risk&&t.addIssue({code:"custom",path:["risk"],message:`Task risk must be ${n.risk} for the persisted signals`}),JSON.stringify(e.risk_reasons)!==JSON.stringify(n.reasons)&&t.addIssue({code:"custom",path:["risk_reasons"],message:`Task risk reasons must be ${n.reasons.join(",")}`})}),XG=pe.z.object({models:pe.z.array(pe.z.string().min(1)).min(1),reasoning_efforts:pe.z.array(pe.z.string().min(1)).min(1),velocities:pe.z.array(pe.z.string().min(1)).min(1)}).strict(),rk=pe.z.object({mode:pe.z.literal("auto"),default_model:pe.z.literal("gpt-5.6-terra"),default_effort:pe.z.literal("medium"),default_velocity:Mp,allowed_models:pe.z.tuple([pe.z.literal("gpt-5.6-luna"),pe.z.literal("gpt-5.6-terra"),pe.z.literal("gpt-5.6-sol")]),allowed_efforts:pe.z.tuple([pe.z.literal("low"),pe.z.literal("medium"),pe.z.literal("high"),pe.z.literal("xhigh")]),max_auto_effort:pe.z.literal("xhigh"),automatic_sources:pe.z.tuple([pe.z.literal("spec"),pe.z.literal("prd")]),notice:pe.z.enum(["always","mismatch"])}).strict()});var Pe=N(xt=>{"use strict";var jp=Symbol.for("yaml.alias"),ik=Symbol.for("yaml.document"),Xl=Symbol.for("yaml.map"),ok=Symbol.for("yaml.pair"),Dp=Symbol.for("yaml.scalar"),Yl=Symbol.for("yaml.seq"),Ur=Symbol.for("yaml.node.type"),Tq=e=>!!e&&typeof e=="object"&&e[Ur]===jp,xq=e=>!!e&&typeof e=="object"&&e[Ur]===ik,Oq=e=>!!e&&typeof e=="object"&&e[Ur]===Xl,Rq=e=>!!e&&typeof e=="object"&&e[Ur]===ok,ak=e=>!!e&&typeof e=="object"&&e[Ur]===Dp,$q=e=>!!e&&typeof e=="object"&&e[Ur]===Yl;function sk(e){if(e&&typeof e=="object")switch(e[Ur]){case Xl:case Yl:return!0}return!1}function Cq(e){if(e&&typeof e=="object")switch(e[Ur]){case jp:case Xl:case Dp:case Yl:return!0}return!1}var Iq=e=>(ak(e)||sk(e))&&!!e.anchor;xt.ALIAS=jp;xt.DOC=ik;xt.MAP=Xl;xt.NODE_TYPE=Ur;xt.PAIR=ok;xt.SCALAR=Dp;xt.SEQ=Yl;xt.hasAnchor=Iq;xt.isAlias=Tq;xt.isCollection=sk;xt.isDocument=xq;xt.isMap=Oq;xt.isNode=Cq;xt.isPair=Rq;xt.isScalar=ak;xt.isSeq=$q});var Fa=N(Up=>{"use strict";var gt=Pe(),Zt=Symbol("break visit"),ck=Symbol("skip children"),kr=Symbol("remove node");function Ql(e,t){let n=lk(t);gt.isDocument(e)?Po(null,e.contents,n,Object.freeze([e]))===kr&&(e.contents=null):Po(null,e,n,Object.freeze([]))}Ql.BREAK=Zt;Ql.SKIP=ck;Ql.REMOVE=kr;function Po(e,t,n,i){let r=uk(e,t,n,i);if(gt.isNode(r)||gt.isPair(r))return dk(e,i,r),Po(e,r,n,i);if(typeof r!="symbol"){if(gt.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let a=Po(o,t.items[o],n,i);if(typeof a=="number")o=a-1;else{if(a===Zt)return Zt;a===kr&&(t.items.splice(o,1),o-=1)}}}else if(gt.isPair(t)){i=Object.freeze(i.concat(t));let o=Po("key",t.key,n,i);if(o===Zt)return Zt;o===kr&&(t.key=null);let a=Po("value",t.value,n,i);if(a===Zt)return Zt;a===kr&&(t.value=null)}}return r}async function eu(e,t){let n=lk(t);gt.isDocument(e)?await Mo(null,e.contents,n,Object.freeze([e]))===kr&&(e.contents=null):await Mo(null,e,n,Object.freeze([]))}eu.BREAK=Zt;eu.SKIP=ck;eu.REMOVE=kr;async function Mo(e,t,n,i){let r=await uk(e,t,n,i);if(gt.isNode(r)||gt.isPair(r))return dk(e,i,r),Mo(e,r,n,i);if(typeof r!="symbol"){if(gt.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let a=await Mo(o,t.items[o],n,i);if(typeof a=="number")o=a-1;else{if(a===Zt)return Zt;a===kr&&(t.items.splice(o,1),o-=1)}}}else if(gt.isPair(t)){i=Object.freeze(i.concat(t));let o=await Mo("key",t.key,n,i);if(o===Zt)return Zt;o===kr&&(t.key=null);let a=await Mo("value",t.value,n,i);if(a===Zt)return Zt;a===kr&&(t.value=null)}}return r}function lk(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function uk(e,t,n,i){if(typeof n=="function")return n(e,t,i);if(gt.isMap(t))return n.Map?.(e,t,i);if(gt.isSeq(t))return n.Seq?.(e,t,i);if(gt.isPair(t))return n.Pair?.(e,t,i);if(gt.isScalar(t))return n.Scalar?.(e,t,i);if(gt.isAlias(t))return n.Alias?.(e,t,i)}function dk(e,t,n){let i=t[t.length-1];if(gt.isCollection(i))i.items[e]=n;else if(gt.isPair(i))e==="key"?i.key=n:i.value=n;else if(gt.isDocument(i))i.contents=n;else{let r=gt.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}Up.visit=Ql;Up.visitAsync=eu});var zp=N(pk=>{"use strict";var _k=Pe(),Nq=Fa(),Pq={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Mq=e=>e.replace(/[!,[\]{}]/g,t=>Pq[t]),qa=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,a]=i;return this.tags[o]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let a=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,a),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}let[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(a){return n(String(a)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+Mq(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(t&&i.length>0&&_k.isNode(t.contents)){let o={};Nq.visit(t.contents,(a,s)=>{_k.isNode(s)&&s.tag&&(o[s.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,a]of i)o==="!!"&&a==="tag:yaml.org,2002:"||(!t||r.some(s=>s.startsWith(a)))&&n.push(`%TAG ${o} ${a}`);return n.join(`
66
+ `)}};qa.defaultYaml={explicit:!1,version:"1.2"};qa.defaultTags={"!!":"tag:yaml.org,2002:"};pk.Directives=qa});var tu=N(Va=>{"use strict";var fk=Pe(),Lq=Fa();function jq(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function mk(e){let t=new Set;return Lq.visit(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function gk(e,t){for(let n=1;;++n){let i=`${e}${n}`;if(!t.has(i))return i}}function Dq(e,t){let n=[],i=new Map,r=null;return{onAnchor:o=>{n.push(o),r??(r=mk(e));let a=gk(t,r);return r.add(a),a},setAnchors:()=>{for(let o of n){let a=i.get(o);if(typeof a=="object"&&a.anchor&&(fk.isScalar(a.node)||fk.isCollection(a.node)))a.node.anchor=a.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=o,s}}},sourceObjects:i}}Va.anchorIsValid=jq;Va.anchorNames=mk;Va.createNodeAnchors=Dq;Va.findNewAnchor=gk});var Fp=N(hk=>{"use strict";function Wa(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r){let a=i[r],s=Wa(e,i,String(r),a);s===void 0?delete i[r]:s!==a&&(i[r]=s)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let o=i.get(r),a=Wa(e,i,r,o);a===void 0?i.delete(r):a!==o&&i.set(r,a)}else if(i instanceof Set)for(let r of Array.from(i)){let o=Wa(e,i,r,r);o===void 0?i.delete(r):o!==r&&(i.delete(r),i.add(o))}else for(let[r,o]of Object.entries(i)){let a=Wa(e,i,r,o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}return e.call(t,n,i)}hk.applyReviver=Wa});var oi=N(vk=>{"use strict";var Uq=Pe();function yk(e,t,n){if(Array.isArray(e))return e.map((i,r)=>yk(i,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!Uq.hasAnchor(e))return e.toJSON(t,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=o=>{i.res=o,delete n.onCreate};let r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!n?.keep?Number(e):e}vk.toJS=yk});var nu=N(Sk=>{"use strict";var zq=Fp(),bk=Pe(),Fq=oi(),qp=class{constructor(t){Object.defineProperty(this,bk.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){if(!bk.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},s=Fq.toJS(this,"",a);if(typeof r=="function")for(let{count:l,res:c}of a.anchors.values())r(c,l);return typeof o=="function"?zq.applyReviver(o,{"":s},"",s):s}};Sk.NodeBase=qp});var Za=N(kk=>{"use strict";var qq=tu(),Vq=Fa(),Lo=Pe(),Wq=nu(),Zq=oi(),Vp=class extends Wq.NodeBase{constructor(t){super(Lo.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],Vq.visit(t,{Node:(o,a)=>{(Lo.isAlias(a)||Lo.hasAnchor(a))&&i.push(a)}}),n&&(n.aliasResolveCache=i));let r;for(let o of i){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(t,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:o}=n,a=this.resolve(r,n);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let s=i.get(a);if(s||(Zq.toJS(a,null,n),s=i.get(a)),s?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(o>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ru(r,a,i)),s.count*s.aliasCount>o)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return s.res}toString(t,n,i){let r=`*${this.source}`;if(t){if(qq.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${r} `}return r}};function ru(e,t,n){if(Lo.isAlias(t)){let i=t.resolve(e),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(Lo.isCollection(t)){let i=0;for(let r of t.items){let o=ru(e,r,n);o>i&&(i=o)}return i}else if(Lo.isPair(t)){let i=ru(e,t.key,n),r=ru(e,t.value,n);return Math.max(i,r)}return 1}kk.Alias=Vp});var ft=N(Wp=>{"use strict";var Bq=Pe(),Hq=nu(),Jq=oi(),Kq=e=>!e||typeof e!="function"&&typeof e!="object",ai=class extends Hq.NodeBase{constructor(t){super(Bq.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:Jq.toJS(this.value,t,n)}toString(){return String(this.value)}};ai.BLOCK_FOLDED="BLOCK_FOLDED";ai.BLOCK_LITERAL="BLOCK_LITERAL";ai.PLAIN="PLAIN";ai.QUOTE_DOUBLE="QUOTE_DOUBLE";ai.QUOTE_SINGLE="QUOTE_SINGLE";Wp.Scalar=ai;Wp.isScalarValue=Kq});var Ba=N(Ek=>{"use strict";var Gq=Za(),Li=Pe(),wk=ft(),Xq="tag:yaml.org,2002:";function Yq(e,t,n){if(t){let i=n.filter(o=>o.tag===t),r=i.find(o=>!o.format)??i[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(i=>i.identify?.(e)&&!i.format)}function Qq(e,t,n){if(Li.isDocument(e)&&(e=e.contents),Li.isNode(e))return e;if(Li.isPair(e)){let u=n.schema[Li.MAP].createNode?.(n.schema,null,n);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:o,schema:a,sourceObjects:s}=n,l;if(i&&e&&typeof e=="object"){if(l=s.get(e),l)return l.anchor??(l.anchor=r(e)),new Gq.Alias(l.anchor);l={anchor:null,node:null},s.set(e,l)}t?.startsWith("!!")&&(t=Xq+t.slice(2));let c=Yq(e,t,a.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new wk.Scalar(e);return l&&(l.node=u),u}c=e instanceof Map?a[Li.MAP]:Symbol.iterator in Object(e)?a[Li.SEQ]:a[Li.MAP]}o&&(o(c),delete n.onTagObj);let d=c?.createNode?c.createNode(n.schema,e,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,e,n):new wk.Scalar(e);return t?d.tag=t:c.default||(d.tag=c.tag),l&&(l.node=d),d}Ek.createNode=Qq});var ou=N(iu=>{"use strict";var eV=Ba(),wr=Pe(),tV=nu();function Zp(e,t,n){let i=n;for(let r=t.length-1;r>=0;--r){let o=t[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let a=[];a[o]=i,i=a}else i=new Map([[o,i]])}return eV.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Ak=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Bp=class extends tV.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(i=>wr.isNode(i)||wr.isPair(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Ak(t))this.add(n);else{let[i,...r]=t,o=this.get(i,!0);if(wr.isCollection(o))o.addIn(r,n);else if(o===void 0&&this.schema)this.set(i,Zp(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(t){let[n,...i]=t;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(wr.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){let[i,...r]=t,o=this.get(i,!0);return r.length===0?!n&&wr.isScalar(o)?o.value:o:wr.isCollection(o)?o.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!wr.isPair(n))return!1;let i=n.value;return i==null||t&&wr.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[n,...i]=t;if(i.length===0)return this.has(n);let r=this.get(n,!0);return wr.isCollection(r)?r.hasIn(i):!1}setIn(t,n){let[i,...r]=t;if(r.length===0)this.set(i,n);else{let o=this.get(i,!0);if(wr.isCollection(o))o.setIn(r,n);else if(o===void 0&&this.schema)this.set(i,Zp(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};iu.Collection=Bp;iu.collectionFromPath=Zp;iu.isEmptyPath=Ak});var Ha=N(au=>{"use strict";var nV=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Hp(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var rV=(e,t,n)=>e.endsWith(`
67
+ `)?Hp(n,t):n.includes(`
68
+ `)?`
69
+ `+Hp(n,t):(e.endsWith(" ")?"":" ")+n;au.indentComment=Hp;au.lineComment=rV;au.stringifyComment=nV});var xk=N(Ja=>{"use strict";var iV="flow",Jp="block",su="quoted";function oV(e,t,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:o=20,onFold:a,onOverflow:s}={}){if(!r||r<0)return e;r<o&&(o=0);let l=Math.max(1+o,1+r-t.length);if(e.length<=l)return e;let c=[],d={},u=r-t.length;typeof i=="number"&&(i>r-Math.max(2,o)?c.push(0):u=r-i);let _,p,v=!1,f=-1,h=-1,k=-1;n===Jp&&(f=Tk(e,f,t.length),f!==-1&&(u=f+l));for(let O;O=e[f+=1];){if(n===su&&O==="\\"){switch(h=f,e[f+1]){case"x":f+=3;break;case"u":f+=5;break;case"U":f+=9;break;default:f+=1}k=f}if(O===`
70
+ `)n===Jp&&(f=Tk(e,f,t.length)),u=f+t.length+l,_=void 0;else{if(O===" "&&p&&p!==" "&&p!==`
71
+ `&&p!==" "){let g=e[f+1];g&&g!==" "&&g!==`
72
+ `&&g!==" "&&(_=f)}if(f>=u)if(_)c.push(_),u=_+l,_=void 0;else if(n===su){for(;p===" "||p===" ";)p=O,O=e[f+=1],v=!0;let g=f>k+1?f-2:h-1;if(d[g])return e;c.push(g),d[g]=!0,u=g+l,_=void 0}else v=!0}p=O}if(v&&s&&s(),c.length===0)return e;a&&a();let w=e.slice(0,c[0]);for(let O=0;O<c.length;++O){let g=c[O],b=c[O+1]||e.length;g===0?w=`
73
+ ${t}${e.slice(0,b)}`:(n===su&&d[g]&&(w+=`${e[g]}\\`),w+=`
74
+ ${t}${e.slice(g+1,b)}`)}return w}function Tk(e,t,n){let i=t,r=t+1,o=e[r];for(;o===" "||o===" ";)if(t<r+n)o=e[++t];else{do o=e[++t];while(o&&o!==`
75
+ `);i=t,r=t+1,o=e[r]}return i}Ja.FOLD_BLOCK=Jp;Ja.FOLD_FLOW=iV;Ja.FOLD_QUOTED=su;Ja.foldFlowLines=oV});var Ga=N(Ok=>{"use strict";var fn=ft(),si=xk(),lu=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),uu=e=>/^(%|---|\.\.\.)/m.test(e);function aV(e,t,n){if(!t||t<0)return!1;let i=t-n,r=e.length;if(r<=i)return!1;for(let o=0,a=0;o<r;++o)if(e[o]===`
76
+ `){if(o-a>i)return!0;if(a=o+1,r-a<=i)return!1}return!0}function Ka(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=t,r=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(uu(e)?" ":""),a="",s=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(a+=n.slice(s,l)+"\\ ",l+=1,s=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{a+=n.slice(s,l);let d=n.substr(l+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(l,6)}l+=5,s=l+1}break;case"n":if(i||n[l+2]==='"'||n.length<r)l+=1;else{for(a+=n.slice(s,l)+`
77
+
78
+ `;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)a+=`
79
+ `,l+=2;a+=o,n[l+2]===" "&&(a+="\\"),l+=1,s=l+1}break;default:l+=1}return a=s?a+n.slice(s):n,i?a:si.foldFlowLines(a,o,si.FOLD_QUOTED,lu(t,!1))}function Kp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
80
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Ka(e,t);let n=t.indent||(uu(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
81
+ ${n}`)+"'";return t.implicitKey?i:si.foldFlowLines(i,n,si.FOLD_FLOW,lu(t,!1))}function jo(e,t){let{singleQuote:n}=t.options,i;if(n===!1)i=Ka;else{let r=e.includes('"'),o=e.includes("'");r&&!o?i=Kp:o&&!r?i=Ka:i=n?Kp:Ka}return i(e,t)}var Gp;try{Gp=new RegExp(`(^|(?<!
82
+ ))
83
+ +(?!
84
+ |$)`,"g")}catch{Gp=/\n+(?!\n|$)/g}function cu({comment:e,type:t,value:n},i,r,o){let{blockQuote:a,commentString:s,lineWidth:l}=i.options;if(!a||/\n[\t ]+$/.test(n))return jo(n,i);let c=i.indent||(i.forceBlockIndent||uu(n)?" ":""),d=a==="literal"?!0:a==="folded"||t===fn.Scalar.BLOCK_FOLDED?!1:t===fn.Scalar.BLOCK_LITERAL?!0:!aV(n,l,c.length);if(!n)return d?`|
85
+ `:`>
86
+ `;let u,_;for(_=n.length;_>0;--_){let b=n[_-1];if(b!==`
87
+ `&&b!==" "&&b!==" ")break}let p=n.substring(_),v=p.indexOf(`
88
+ `);v===-1?u="-":n===p||v!==p.length-1?(u="+",o&&o()):u="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
89
+ `&&(p=p.slice(0,-1)),p=p.replace(Gp,`$&${c}`));let f=!1,h,k=-1;for(h=0;h<n.length;++h){let b=n[h];if(b===" ")f=!0;else if(b===`
90
+ `)k=h;else break}let w=n.substring(0,k<h?k+1:h);w&&(n=n.substring(w.length),w=w.replace(/\n+/g,`$&${c}`));let g=(f?c?"2":"1":"")+u;if(e&&(g+=" "+s(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!d){let b=n.replace(/\n+/g,`
91
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),T=!1,I=lu(i,!0);a!=="folded"&&t!==fn.Scalar.BLOCK_FOLDED&&(I.onOverflow=()=>{T=!0});let R=si.foldFlowLines(`${w}${b}${p}`,c,si.FOLD_BLOCK,I);if(!T)return`>${g}
92
+ ${c}${R}`}return n=n.replace(/\n+/g,`$&${c}`),`|${g}
93
+ ${c}${w}${n}${p}`}function sV(e,t,n,i){let{type:r,value:o}=e,{actualString:a,implicitKey:s,indent:l,indentStep:c,inFlow:d}=t;if(s&&o.includes(`
94
+ `)||d&&/[[\]{},]/.test(o))return jo(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return s||d||!o.includes(`
95
+ `)?jo(o,t):cu(e,t,n,i);if(!s&&!d&&r!==fn.Scalar.PLAIN&&o.includes(`
96
+ `))return cu(e,t,n,i);if(uu(o)){if(l==="")return t.forceBlockIndent=!0,cu(e,t,n,i);if(s&&l===c)return jo(o,t)}let u=o.replace(/\n+/g,`$&
97
+ ${l}`);if(a){let _=f=>f.default&&f.tag!=="tag:yaml.org,2002:str"&&f.test?.test(u),{compat:p,tags:v}=t.doc.schema;if(v.some(_)||p?.some(_))return jo(o,t)}return s?u:si.foldFlowLines(u,l,si.FOLD_FLOW,lu(t,!1))}function cV(e,t,n,i){let{implicitKey:r,inFlow:o}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==fn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(s=fn.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case fn.Scalar.BLOCK_FOLDED:case fn.Scalar.BLOCK_LITERAL:return r||o?jo(a.value,t):cu(a,t,n,i);case fn.Scalar.QUOTE_DOUBLE:return Ka(a.value,t);case fn.Scalar.QUOTE_SINGLE:return Kp(a.value,t);case fn.Scalar.PLAIN:return sV(a,t,n,i);default:return null}},c=l(s);if(c===null){let{defaultKeyType:d,defaultStringType:u}=t.options,_=r&&d||u;if(c=l(_),c===null)throw new Error(`Unsupported default string type ${_}`)}return c}Ok.stringifyString=cV});var Xa=N(Xp=>{"use strict";var lV=tu(),ci=Pe(),uV=Ha(),dV=Ga();function _V(e,t){let n=Object.assign({blockQuote:!0,commentString:uV.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function pV(e,t){if(t.tag){let r=e.filter(o=>o.tag===t.tag);if(r.length>0)return r.find(o=>o.format===t.format)??r[0]}let n,i;if(ci.isScalar(t)){i=t.value;let r=e.filter(o=>o.identify?.(i));if(r.length>1){let o=r.filter(a=>a.test);o.length>0&&(r=o)}n=r.find(o=>o.format===t.format)??r.find(o=>!o.format)}else i=t,n=e.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function fV(e,t,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],o=(ci.isScalar(e)||ci.isCollection(e))&&e.anchor;o&&lV.anchorIsValid(o)&&(n.add(o),r.push(`&${o}`));let a=e.tag??(t.default?null:t.tag);return a&&r.push(i.directives.tagString(a)),r.join(" ")}function mV(e,t,n,i){if(ci.isPair(e))return e.toString(t,n,i);if(ci.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,o=ci.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>r=l});r??(r=pV(t.doc.schema.tags,o));let a=fV(o,r,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let s=typeof r.stringify=="function"?r.stringify(o,t,n,i):ci.isScalar(o)?dV.stringifyString(o,t,n,i):o.toString(t,n,i);return a?ci.isScalar(o)||s[0]==="{"||s[0]==="["?`${a} ${s}`:`${a}
98
+ ${t.indent}${s}`:s}Xp.createStringifyContext=_V;Xp.stringify=mV});var Ik=N(Ck=>{"use strict";var zr=Pe(),Rk=ft(),$k=Xa(),Ya=Ha();function gV({key:e,value:t},n,i,r){let{allNullValues:o,doc:a,indent:s,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:u}}=n,_=zr.isNode(e)&&e.comment||null;if(u){if(_)throw new Error("With simple keys, key nodes cannot have comments");if(zr.isCollection(e)||!zr.isNode(e)&&typeof e=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let p=!u&&(!e||_&&t==null&&!n.inFlow||zr.isCollection(e)||(zr.isScalar(e)?e.type===Rk.Scalar.BLOCK_FOLDED||e.type===Rk.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(u||!o),indent:s+l});let v=!1,f=!1,h=$k.stringify(e,n,()=>v=!0,()=>f=!0);if(!p&&!n.inFlow&&h.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||t==null)return v&&i&&i(),h===""?"?":p?`? ${h}`:h}else if(o&&!u||t==null&&p)return h=`? ${h}`,_&&!v?h+=Ya.lineComment(h,n.indent,c(_)):f&&r&&r(),h;v&&(_=null),p?(_&&(h+=Ya.lineComment(h,n.indent,c(_))),h=`? ${h}
99
+ ${s}:`):(h=`${h}:`,_&&(h+=Ya.lineComment(h,n.indent,c(_))));let k,w,O;zr.isNode(t)?(k=!!t.spaceBefore,w=t.commentBefore,O=t.comment):(k=!1,w=null,O=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!_&&zr.isScalar(t)&&(n.indentAtStart=h.length+1),f=!1,!d&&l.length>=2&&!n.inFlow&&!p&&zr.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let g=!1,b=$k.stringify(t,n,()=>g=!0,()=>f=!0),T=" ";if(_||k||w){if(T=k?`
100
+ `:"",w){let I=c(w);T+=`
101
+ ${Ya.indentComment(I,n.indent)}`}b===""&&!n.inFlow?T===`
102
+ `&&O&&(T=`
103
+
104
+ `):T+=`
105
+ ${n.indent}`}else if(!p&&zr.isCollection(t)){let I=b[0],R=b.indexOf(`
106
+ `),U=R!==-1,V=n.inFlow??t.flow??t.items.length===0;if(U||!V){let y=!1;if(U&&(I==="&"||I==="!")){let S=b.indexOf(" ");I==="&"&&S!==-1&&S<R&&b[S+1]==="!"&&(S=b.indexOf(" ",S+1)),(S===-1||R<S)&&(y=!0)}y||(T=`
107
+ ${n.indent}`)}}else(b===""||b[0]===`
108
+ `)&&(T="");return h+=T+b,n.inFlow?g&&i&&i():O&&!g?h+=Ya.lineComment(h,n.indent,c(O)):f&&r&&r(),h}Ck.stringifyPair=gV});var Qp=N(Yp=>{"use strict";var Nk=require("process");function hV(e,...t){e==="debug"&&console.log(...t)}function yV(e,t){(e==="debug"||e==="warn")&&(typeof Nk.emitWarning=="function"?Nk.emitWarning(t):console.warn(t))}Yp.debug=hV;Yp.warn=yV});var mu=N(fu=>{"use strict";var pu=Pe(),Pk=ft(),du="<<",_u={identify:e=>e===du||typeof e=="symbol"&&e.description===du,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Pk.Scalar(Symbol(du)),{addToJSMap:Mk}),stringify:()=>du},vV=(e,t)=>(_u.identify(t)||pu.isScalar(t)&&(!t.type||t.type===Pk.Scalar.PLAIN)&&_u.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===_u.tag&&n.default);function Mk(e,t,n){let i=Lk(e,n);if(pu.isSeq(i))for(let r of i.items)ef(e,t,r);else if(Array.isArray(i))for(let r of i)ef(e,t,r);else ef(e,t,i)}function ef(e,t,n){let i=Lk(e,n);if(!pu.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,e,Map);for(let[o,a]of r)t instanceof Map?t.has(o)||t.set(o,a):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function Lk(e,t){return e&&pu.isAlias(t)?t.resolve(e.doc,e):t}fu.addMergeToJSMap=Mk;fu.isMergeKey=vV;fu.merge=_u});var nf=N(Uk=>{"use strict";var bV=Qp(),jk=mu(),SV=Xa(),Dk=Pe(),tf=oi();function kV(e,t,{key:n,value:i}){if(Dk.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(jk.isMergeKey(e,n))jk.addMergeToJSMap(e,t,i);else{let r=tf.toJS(n,"",e);if(t instanceof Map)t.set(r,tf.toJS(i,r,e));else if(t instanceof Set)t.add(r);else{let o=wV(n,r,e),a=tf.toJS(i,o,e);o in t?Object.defineProperty(t,o,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[o]=a}}return t}function wV(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Dk.isNode(e)&&n?.doc){let i=SV.createStringifyContext(n.doc,{});i.anchors=new Set;for(let o of n.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=e.toString(i);if(!n.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),bV.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}Uk.addPairToJSMap=kV});var li=N(rf=>{"use strict";var zk=Ba(),EV=Ik(),AV=nf(),gu=Pe();function TV(e,t,n){let i=zk.createNode(e,void 0,n),r=zk.createNode(t,void 0,n);return new hu(i,r)}var hu=class e{constructor(t,n=null){Object.defineProperty(this,gu.NODE_TYPE,{value:gu.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return gu.isNode(n)&&(n=n.clone(t)),gu.isNode(i)&&(i=i.clone(t)),new e(n,i)}toJSON(t,n){let i=n?.mapAsMap?new Map:{};return AV.addPairToJSMap(n,i,this)}toString(t,n,i){return t?.doc?EV.stringifyPair(this,t,n,i):JSON.stringify(this)}};rf.Pair=hu;rf.createPair=TV});var of=N(qk=>{"use strict";var ji=Pe(),Fk=Xa(),yu=Ha();function xV(e,t,n){return(t.inFlow??e.flow?RV:OV)(e,t,n)}function OV({comment:e,items:t},n,{blockItemPrefix:i,flowChars:r,itemIndent:o,onChompKeep:a,onComment:s}){let{indent:l,options:{commentString:c}}=n,d=Object.assign({},n,{indent:o,type:null}),u=!1,_=[];for(let v=0;v<t.length;++v){let f=t[v],h=null;if(ji.isNode(f))!u&&f.spaceBefore&&_.push(""),vu(n,_,f.commentBefore,u),f.comment&&(h=f.comment);else if(ji.isPair(f)){let w=ji.isNode(f.key)?f.key:null;w&&(!u&&w.spaceBefore&&_.push(""),vu(n,_,w.commentBefore,u))}u=!1;let k=Fk.stringify(f,d,()=>h=null,()=>u=!0);h&&(k+=yu.lineComment(k,o,c(h))),u&&h&&(u=!1),_.push(i+k)}let p;if(_.length===0)p=r.start+r.end;else{p=_[0];for(let v=1;v<_.length;++v){let f=_[v];p+=f?`
109
+ ${l}${f}`:`
110
+ `}}return e?(p+=`
111
+ `+yu.indentComment(c(e),l),s&&s()):u&&a&&a(),p}function RV({items:e},t,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:o,flowCollectionPadding:a,options:{commentString:s}}=t;i+=o;let l=Object.assign({},t,{indent:i,inFlow:!0,type:null}),c=!1,d=0,u=[];for(let v=0;v<e.length;++v){let f=e[v],h=null;if(ji.isNode(f))f.spaceBefore&&u.push(""),vu(t,u,f.commentBefore,!1),f.comment&&(h=f.comment);else if(ji.isPair(f)){let w=ji.isNode(f.key)?f.key:null;w&&(w.spaceBefore&&u.push(""),vu(t,u,w.commentBefore,!1),w.comment&&(c=!0));let O=ji.isNode(f.value)?f.value:null;O?(O.comment&&(h=O.comment),O.commentBefore&&(c=!0)):f.value==null&&w?.comment&&(h=w.comment)}h&&(c=!0);let k=Fk.stringify(f,l,()=>h=null);c||(c=u.length>d||k.includes(`
112
+ `)),v<e.length-1?k+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=u.reduce((w,O)=>w+O.length+2,2)+(k.length+2)>t.options.lineWidth)),c&&(k+=",")),h&&(k+=yu.lineComment(k,i,s(h))),u.push(k),d=u.length}let{start:_,end:p}=n;if(u.length===0)return _+p;if(!c){let v=u.reduce((f,h)=>f+h.length+2,2);c=t.options.lineWidth>0&&v>t.options.lineWidth}if(c){let v=_;for(let f of u)v+=f?`
113
+ ${o}${r}${f}`:`
114
+ `;return`${v}
115
+ ${r}${p}`}else return`${_}${a}${u.join(" ")}${a}${p}`}function vu({indent:e,options:{commentString:t}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=yu.indentComment(t(i),e);n.push(o.trimStart())}}qk.stringifyCollection=xV});var di=N(sf=>{"use strict";var $V=of(),CV=nf(),IV=ou(),ui=Pe(),bu=li(),NV=ft();function Qa(e,t){let n=ui.isScalar(t)?t.value:t;for(let i of e)if(ui.isPair(i)&&(i.key===t||i.key===n||ui.isScalar(i.key)&&i.key.value===n))return i}var af=class extends IV.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ui.MAP,t),this.items=[]}static from(t,n,i){let{keepUndefined:r,replacer:o}=i,a=new this(t),s=(l,c)=>{if(typeof o=="function")c=o.call(n,l,c);else if(Array.isArray(o)&&!o.includes(l))return;(c!==void 0||r)&&a.items.push(bu.createPair(l,c,i))};if(n instanceof Map)for(let[l,c]of n)s(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))s(l,n[l]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){let i;ui.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new bu.Pair(t,t?.value):i=new bu.Pair(t.key,t.value);let r=Qa(this.items,i.key),o=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);ui.isScalar(r.value)&&NV.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(o){let a=this.items.findIndex(s=>o(i,s)<0);a===-1?this.items.push(i):this.items.splice(a,0,i)}else this.items.push(i)}delete(t){let n=Qa(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let r=Qa(this.items,t)?.value;return(!n&&ui.isScalar(r)?r.value:r)??void 0}has(t){return!!Qa(this.items,t)}set(t,n){this.add(new bu.Pair(t,n),!0)}toJSON(t,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let o of this.items)CV.addPairToJSMap(n,r,o);return r}toString(t,n,i){if(!t)return JSON.stringify(this);for(let r of this.items)if(!ui.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),$V.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}};sf.YAMLMap=af;sf.findPair=Qa});var Do=N(Wk=>{"use strict";var PV=Pe(),Vk=di(),MV={collection:"map",default:!0,nodeClass:Vk.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return PV.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Vk.YAMLMap.from(e,t,n)};Wk.map=MV});var _i=N(Zk=>{"use strict";var LV=Ba(),jV=of(),DV=ou(),ku=Pe(),UV=ft(),zV=oi(),cf=class extends DV.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(ku.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=Su(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let i=Su(t);if(typeof i!="number")return;let r=this.items[i];return!n&&ku.isScalar(r)?r.value:r}has(t){let n=Su(t);return typeof n=="number"&&n<this.items.length}set(t,n){let i=Su(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[i];ku.isScalar(r)&&UV.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(t,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let o of this.items)i.push(zV.toJS(o,String(r++),n));return i}toString(t,n,i){return t?jV.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n)){let a=0;for(let s of n){if(typeof r=="function"){let l=n instanceof Set?s:String(a++);s=r.call(n,l,s)}o.items.push(LV.createNode(s,void 0,i))}}return o}};function Su(e){let t=ku.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Zk.YAMLSeq=cf});var Uo=N(Hk=>{"use strict";var FV=Pe(),Bk=_i(),qV={collection:"seq",default:!0,nodeClass:Bk.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return FV.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Bk.YAMLSeq.from(e,t,n)};Hk.seq=qV});var es=N(Jk=>{"use strict";var VV=Ga(),WV={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),VV.stringifyString(e,t,n,i)}};Jk.string=WV});var wu=N(Xk=>{"use strict";var Kk=ft(),Gk={identify:e=>e==null,createNode:()=>new Kk.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Kk.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Gk.test.test(e)?e:t.options.nullStr};Xk.nullTag=Gk});var lf=N(Qk=>{"use strict";var ZV=ft(),Yk={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ZV.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Yk.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};Qk.boolTag=Yk});var zo=N(ew=>{"use strict";function BV({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let a=o.indexOf(".");a<0&&(a=o.length,o+=".");let s=t-(o.length-a-1);for(;s-- >0;)o+="0"}return o}ew.stringifyNumber=BV});var df=N(Eu=>{"use strict";var HV=ft(),uf=zo(),JV={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:uf.stringifyNumber},KV={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():uf.stringifyNumber(e)}},GV={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new HV.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:uf.stringifyNumber};Eu.float=GV;Eu.floatExp=KV;Eu.floatNaN=JV});var pf=N(Tu=>{"use strict";var tw=zo(),Au=e=>typeof e=="bigint"||Number.isInteger(e),_f=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function nw(e,t,n){let{value:i}=e;return Au(i)&&i>=0?n+i.toString(t):tw.stringifyNumber(e)}var XV={identify:e=>Au(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>_f(e,2,8,n),stringify:e=>nw(e,8,"0o")},YV={identify:Au,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>_f(e,0,10,n),stringify:tw.stringifyNumber},QV={identify:e=>Au(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>_f(e,2,16,n),stringify:e=>nw(e,16,"0x")};Tu.int=YV;Tu.intHex=QV;Tu.intOct=XV});var iw=N(rw=>{"use strict";var e2=Do(),t2=wu(),n2=Uo(),r2=es(),i2=lf(),ff=df(),mf=pf(),o2=[e2.map,n2.seq,r2.string,t2.nullTag,i2.boolTag,mf.intOct,mf.int,mf.intHex,ff.floatNaN,ff.floatExp,ff.float];rw.schema=o2});var sw=N(aw=>{"use strict";var a2=ft(),s2=Do(),c2=Uo();function ow(e){return typeof e=="bigint"||Number.isInteger(e)}var xu=({value:e})=>JSON.stringify(e),l2=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:xu},{identify:e=>e==null,createNode:()=>new a2.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:xu},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:xu},{identify:ow,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>ow(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:xu}],u2={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},d2=[s2.map,c2.seq].concat(l2,u2);aw.schema=d2});var hf=N(cw=>{"use strict";var ts=require("buffer"),gf=ft(),_2=Ga(),p2={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof ts.Buffer=="function")return ts.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},i,r,o){if(!n)return"";let a=n,s;if(typeof ts.Buffer=="function")s=a instanceof ts.Buffer?a.toString("base64"):ts.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<a.length;++c)l+=String.fromCharCode(a[c]);s=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=gf.Scalar.BLOCK_LITERAL),t!==gf.Scalar.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(s.length/l),d=new Array(c);for(let u=0,_=0;u<c;++u,_+=l)d[u]=s.substr(_,l);s=d.join(t===gf.Scalar.BLOCK_LITERAL?`
116
+ `:" ")}return _2.stringifyString({comment:e,type:t,value:s},i,r,o)}};cw.binary=p2});var $u=N(Ru=>{"use strict";var Ou=Pe(),yf=li(),f2=ft(),m2=_i();function lw(e,t){if(Ou.isSeq(e))for(let n=0;n<e.items.length;++n){let i=e.items[n];if(!Ou.isPair(i)){if(Ou.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let r=i.items[0]||new yf.Pair(new f2.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
117
+ ${r.key.commentBefore}`:i.commentBefore),i.comment){let o=r.value??r.key;o.comment=o.comment?`${i.comment}
118
+ ${o.comment}`:i.comment}i=r}e.items[n]=Ou.isPair(i)?i:new yf.Pair(i)}}else t("Expected a sequence for this tag");return e}function uw(e,t,n){let{replacer:i}=n,r=new m2.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof i=="function"&&(a=i.call(t,String(o++),a));let s,l;if(Array.isArray(a))if(a.length===2)s=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let c=Object.keys(a);if(c.length===1)s=c[0],l=a[s];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else s=a;r.items.push(yf.createPair(s,l,n))}return r}var g2={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:lw,createNode:uw};Ru.createPairs=uw;Ru.pairs=g2;Ru.resolvePairs=lw});var Sf=N(bf=>{"use strict";var dw=Pe(),vf=oi(),ns=di(),h2=_i(),_w=$u(),Di=class e extends h2.YAMLSeq{constructor(){super(),this.add=ns.YAMLMap.prototype.add.bind(this),this.delete=ns.YAMLMap.prototype.delete.bind(this),this.get=ns.YAMLMap.prototype.get.bind(this),this.has=ns.YAMLMap.prototype.has.bind(this),this.set=ns.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,a;if(dw.isPair(r)?(o=vf.toJS(r.key,"",n),a=vf.toJS(r.value,o,n)):o=vf.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,a)}return i}static from(t,n,i){let r=_w.createPairs(t,n,i),o=new this;return o.items=r.items,o}};Di.tag="tag:yaml.org,2002:omap";var y2={collection:"seq",identify:e=>e instanceof Map,nodeClass:Di,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=_w.resolvePairs(e,t),i=[];for(let{key:r}of n.items)dw.isScalar(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Di,n)},createNode:(e,t,n)=>Di.from(e,t,n)};bf.YAMLOMap=Di;bf.omap=y2});var hw=N(kf=>{"use strict";var pw=ft();function fw({value:e,source:t},n){return t&&(e?mw:gw).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var mw={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new pw.Scalar(!0),stringify:fw},gw={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new pw.Scalar(!1),stringify:fw};kf.falseTag=gw;kf.trueTag=mw});var yw=N(Cu=>{"use strict";var v2=ft(),wf=zo(),b2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:wf.stringifyNumber},S2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():wf.stringifyNumber(e)}},k2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new v2.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:wf.stringifyNumber};Cu.float=k2;Cu.floatExp=S2;Cu.floatNaN=b2});var bw=N(is=>{"use strict";var vw=zo(),rs=e=>typeof e=="bigint"||Number.isInteger(e);function Iu(e,t,n,{intAsBigInt:i}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return r==="-"?BigInt(-1)*a:a}let o=parseInt(e,n);return r==="-"?-1*o:o}function Ef(e,t,n){let{value:i}=e;if(rs(i)){let r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return vw.stringifyNumber(e)}var w2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Iu(e,2,2,n),stringify:e=>Ef(e,2,"0b")},E2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Iu(e,1,8,n),stringify:e=>Ef(e,8,"0")},A2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Iu(e,0,10,n),stringify:vw.stringifyNumber},T2={identify:rs,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Iu(e,2,16,n),stringify:e=>Ef(e,16,"0x")};is.int=A2;is.intBin=w2;is.intHex=T2;is.intOct=E2});var Tf=N(Af=>{"use strict";var Mu=Pe(),Nu=li(),Pu=di(),Ui=class e extends Pu.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Mu.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Nu.Pair(t.key,null):n=new Nu.Pair(t,null),Pu.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let i=Pu.findPair(this.items,t);return!n&&Mu.isPair(i)?Mu.isScalar(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=Pu.findPair(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new Nu.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof r=="function"&&(a=r.call(n,a,a)),o.items.push(Nu.createPair(a,null,i));return o}};Ui.tag="tag:yaml.org,2002:set";var x2={collection:"map",identify:e=>e instanceof Set,nodeClass:Ui,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Ui.from(e,t,n),resolve(e,t){if(Mu.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ui,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Af.YAMLSet=Ui;Af.set=x2});var Of=N(Lu=>{"use strict";var O2=zo();function xf(e,t){let n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=a=>t?BigInt(a):Number(a),o=i.replace(/_/g,"").split(":").reduce((a,s)=>a*r(60)+r(s),r(0));return n==="-"?r(-1)*o:o}function Sw(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return O2.stringifyNumber(e);let i="";t<0&&(i="-",t*=n(-1));let r=n(60),o=[t%r];return t<60?o.unshift(0):(t=(t-o[0])/r,o.unshift(t%r),t>=60&&(t=(t-o[0])/r,o.unshift(t))),i+o.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var R2={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>xf(e,n),stringify:Sw},$2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>xf(e,!1),stringify:Sw},kw={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(kw.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,a,s]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,i-1,r,o||0,a||0,s||0,l),d=t[8];if(d&&d!=="Z"){let u=xf(d,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Lu.floatTime=$2;Lu.intTime=R2;Lu.timestamp=kw});var Aw=N(Ew=>{"use strict";var C2=Do(),I2=wu(),N2=Uo(),P2=es(),M2=hf(),ww=hw(),Rf=yw(),ju=bw(),L2=mu(),j2=Sf(),D2=$u(),U2=Tf(),$f=Of(),z2=[C2.map,N2.seq,P2.string,I2.nullTag,ww.trueTag,ww.falseTag,ju.intBin,ju.intOct,ju.int,ju.intHex,Rf.floatNaN,Rf.floatExp,Rf.float,M2.binary,L2.merge,j2.omap,D2.pairs,U2.set,$f.intTime,$f.floatTime,$f.timestamp];Ew.schema=z2});var Mw=N(Nf=>{"use strict";var Rw=Do(),F2=wu(),$w=Uo(),q2=es(),V2=lf(),Cf=df(),If=pf(),W2=iw(),Z2=sw(),Cw=hf(),os=mu(),Iw=Sf(),Nw=$u(),Tw=Aw(),Pw=Tf(),Du=Of(),xw=new Map([["core",W2.schema],["failsafe",[Rw.map,$w.seq,q2.string]],["json",Z2.schema],["yaml11",Tw.schema],["yaml-1.1",Tw.schema]]),Ow={binary:Cw.binary,bool:V2.boolTag,float:Cf.float,floatExp:Cf.floatExp,floatNaN:Cf.floatNaN,floatTime:Du.floatTime,int:If.int,intHex:If.intHex,intOct:If.intOct,intTime:Du.intTime,map:Rw.map,merge:os.merge,null:F2.nullTag,omap:Iw.omap,pairs:Nw.pairs,seq:$w.seq,set:Pw.set,timestamp:Du.timestamp},B2={"tag:yaml.org,2002:binary":Cw.binary,"tag:yaml.org,2002:merge":os.merge,"tag:yaml.org,2002:omap":Iw.omap,"tag:yaml.org,2002:pairs":Nw.pairs,"tag:yaml.org,2002:set":Pw.set,"tag:yaml.org,2002:timestamp":Du.timestamp};function H2(e,t,n){let i=xw.get(t);if(i&&!e)return n&&!i.includes(os.merge)?i.concat(os.merge):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{let o=Array.from(xw.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)r=r.concat(o);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(os.merge)),r.reduce((o,a)=>{let s=typeof a=="string"?Ow[a]:a;if(!s){let l=JSON.stringify(a),c=Object.keys(Ow).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(s)||o.push(s),o},[])}Nf.coreKnownTags=B2;Nf.getTags=H2});var Lf=N(Lw=>{"use strict";var Pf=Pe(),J2=Do(),K2=Uo(),G2=es(),Uu=Mw(),X2=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Mf=class e{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:a,toStringDefaults:s}){this.compat=Array.isArray(t)?Uu.getTags(t,"compat"):t?Uu.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?Uu.coreKnownTags:{},this.tags=Uu.getTags(n,this.name,i),this.toStringOptions=s??null,Object.defineProperty(this,Pf.MAP,{value:J2.map}),Object.defineProperty(this,Pf.SCALAR,{value:G2.string}),Object.defineProperty(this,Pf.SEQ,{value:K2.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?X2:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Lw.Schema=Mf});var Dw=N(jw=>{"use strict";var Y2=Pe(),jf=Xa(),as=Ha();function Q2(e,t){let n=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");let r=jf.createStringifyContext(e,t),{commentString:o}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=o(e.commentBefore);n.unshift(as.indentComment(l,""))}let a=!1,s=null;if(e.contents){if(Y2.isNode(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){let d=o(e.contents.commentBefore);n.push(as.indentComment(d,""))}r.forceBlockIndent=!!e.comment,s=e.contents.comment}let l=s?void 0:()=>a=!0,c=jf.stringify(e.contents,r,()=>s=null,l);s&&(c+=as.lineComment(c,"",o(s))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(jf.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let l=o(e.comment);l.includes(`
119
+ `)?(n.push("..."),n.push(as.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&a&&(l=l.replace(/^\n+/,"")),l&&((!a||s)&&n[n.length-1]!==""&&n.push(""),n.push(as.indentComment(o(l),"")))}return n.join(`
120
+ `)+`
121
+ `}jw.stringifyDocument=Q2});var ss=N(Uw=>{"use strict";var eW=Za(),Fo=ou(),cn=Pe(),tW=li(),nW=oi(),rW=Lf(),iW=Dw(),Df=tu(),oW=Fp(),aW=Ba(),Uf=zp(),zf=class e{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,cn.NODE_TYPE,{value:cn.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=o;let{version:a}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Uf.Directives({version:a}),this.setSchema(a,i),this.contents=t===void 0?null:this.createNode(t,r,i)}clone(){let t=Object.create(e.prototype,{[cn.NODE_TYPE]:{value:cn.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=cn.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){qo(this.contents)&&this.contents.add(t)}addIn(t,n){qo(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let i=Df.anchorNames(this);t.anchor=!n||i.has(n)?Df.findNewAnchor(n||"a",i):n}return new eW.Alias(t.anchor)}createNode(t,n,i){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){let h=w=>typeof w=="number"||w instanceof String||w instanceof Number,k=n.filter(h).map(String);k.length>0&&(n=n.concat(k)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:a,flow:s,keepUndefined:l,onTagObj:c,tag:d}=i??{},{onAnchor:u,setAnchors:_,sourceObjects:p}=Df.createNodeAnchors(this,a||"a"),v={aliasDuplicateObjects:o??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:p},f=aW.createNode(t,d,v);return s&&cn.isCollection(f)&&(f.flow=!0),_(),f}createPair(t,n,i={}){let r=this.createNode(t,null,i),o=this.createNode(n,null,i);return new tW.Pair(r,o)}delete(t){return qo(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Fo.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):qo(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return cn.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Fo.isEmptyPath(t)?!n&&cn.isScalar(this.contents)?this.contents.value:this.contents:cn.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return cn.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Fo.isEmptyPath(t)?this.contents!==void 0:cn.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Fo.collectionFromPath(this.schema,[t],n):qo(this.contents)&&this.contents.set(t,n)}setIn(t,n){Fo.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=Fo.collectionFromPath(this.schema,Array.from(t),n):qo(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Uf.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Uf.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new rW.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:a}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=nW.toJS(this.contents,n??"",s);if(typeof o=="function")for(let{count:c,res:d}of s.anchors.values())o(d,c);return typeof a=="function"?oW.applyReviver(a,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return iW.stringifyDocument(this,t)}};function qo(e){if(cn.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Uw.Document=zf});var us=N(ls=>{"use strict";var cs=class extends Error{constructor(t,n,i,r){super(),this.name=t,this.code=i,this.message=r,this.pos=n}},Ff=class extends cs{constructor(t,n,i){super("YAMLParseError",t,n,i)}},qf=class extends cs{constructor(t,n,i){super("YAMLWarning",t,n,i)}},sW=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(s=>t.linePos(s));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let o=r-1,a=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(o>=60&&a.length>80){let s=Math.min(o-39,a.length-79);a="\u2026"+a.substring(s),o-=s-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(a.substring(0,o))){let s=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);s.length>80&&(s=s.substring(0,79)+`\u2026
122
+ `),a=s+a}if(/[^ ]/.test(a)){let s=1,l=n.linePos[1];l?.line===i&&l.col>r&&(s=Math.max(1,Math.min(l.col-r,80-o)));let c=" ".repeat(o)+"^".repeat(s);n.message+=`:
123
+
124
+ ${a}
125
+ ${c}
126
+ `}};ls.YAMLError=cs;ls.YAMLParseError=Ff;ls.YAMLWarning=qf;ls.prettifyError=sW});var ds=N(zw=>{"use strict";function cW(e,{flow:t,indicator:n,next:i,offset:r,onError:o,parentIndent:a,startOnNewline:s}){let l=!1,c=s,d=s,u="",_="",p=!1,v=!1,f=null,h=null,k=null,w=null,O=null,g=null,b=null;for(let R of e)switch(v&&(R.type!=="space"&&R.type!=="newline"&&R.type!=="comma"&&o(R.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),f&&(c&&R.type!=="comment"&&R.type!=="newline"&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),f=null),R.type){case"space":!t&&(n!=="doc-start"||i?.type!=="flow-collection")&&R.source.includes(" ")&&(f=R),d=!0;break;case"comment":{d||o(R,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let U=R.source.substring(1)||" ";u?u+=_+U:u=U,_="",c=!1;break}case"newline":c?u?u+=R.source:(!g||n!=="seq-item-ind")&&(l=!0):_+=R.source,c=!0,p=!0,(h||k)&&(w=R),d=!0;break;case"anchor":h&&o(R,"MULTIPLE_ANCHORS","A node can have at most one anchor"),R.source.endsWith(":")&&o(R.offset+R.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=R,b??(b=R.offset),c=!1,d=!1,v=!0;break;case"tag":{k&&o(R,"MULTIPLE_TAGS","A node can have at most one tag"),k=R,b??(b=R.offset),c=!1,d=!1,v=!0;break}case n:(h||k)&&o(R,"BAD_PROP_ORDER",`Anchors and tags must be after the ${R.source} indicator`),g&&o(R,"UNEXPECTED_TOKEN",`Unexpected ${R.source} in ${t??"collection"}`),g=R,c=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){O&&o(R,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),O=R,c=!1,d=!1;break}default:o(R,"UNEXPECTED_TOKEN",`Unexpected ${R.type} token`),c=!1,d=!1}let T=e[e.length-1],I=T?T.offset+T.source.length:r;return v&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f&&(c&&f.indent<=a||i?.type==="block-map"||i?.type==="block-seq")&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:O,found:g,spaceBefore:l,comment:u,hasNewline:p,anchor:h,tag:k,newlineAfterProp:w,end:I,start:b??I}}zw.resolveProps=cW});var zu=N(Fw=>{"use strict";function Vf(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
127
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(Vf(t.key)||Vf(t.value))return!0}return!1;default:return!0}}Fw.containsNewline=Vf});var Wf=N(qw=>{"use strict";var lW=zu();function uW(e,t,n){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&lW.containsNewline(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}qw.flowIndentCheck=uW});var Zf=N(Ww=>{"use strict";var Vw=Pe();function dW(e,t,n){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let r=typeof i=="function"?i:(o,a)=>o===a||Vw.isScalar(o)&&Vw.isScalar(a)&&o.value===a.value;return t.some(o=>r(o.key,n))}Ww.mapIncludes=dW});var Gw=N(Kw=>{"use strict";var Zw=li(),_W=di(),Bw=ds(),pW=zu(),Hw=Wf(),fW=Zf(),Jw="All mapping items must start at the same column";function mW({composeNode:e,composeEmptyNode:t},n,i,r,o){let a=o?.nodeClass??_W.YAMLMap,s=new a(n.schema);n.atRoot&&(n.atRoot=!1);let l=i.offset,c=null;for(let d of i.items){let{start:u,key:_,sep:p,value:v}=d,f=Bw.resolveProps(u,{indicator:"explicit-key-ind",next:_??p?.[0],offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0}),h=!f.found;if(h){if(_&&(_.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in _&&_.indent!==i.indent&&r(l,"BAD_INDENT",Jw)),!f.anchor&&!f.tag&&!p){c=f.end,f.comment&&(s.comment?s.comment+=`
128
+ `+f.comment:s.comment=f.comment);continue}(f.newlineAfterProp||pW.containsNewline(_))&&r(_??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else f.found?.indent!==i.indent&&r(l,"BAD_INDENT",Jw);n.atKey=!0;let k=f.end,w=_?e(n,_,f,r):t(n,k,u,null,f,r);n.schema.compat&&Hw.flowIndentCheck(i.indent,_,r),n.atKey=!1,fW.mapIncludes(n,s.items,w)&&r(k,"DUPLICATE_KEY","Map keys must be unique");let O=Bw.resolveProps(p??[],{indicator:"map-value-ind",next:v,offset:w.range[2],onError:r,parentIndent:i.indent,startOnNewline:!_||_.type==="block-scalar"});if(l=O.end,O.found){h&&(v?.type==="block-map"&&!O.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&f.start<O.found.offset-1024&&r(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let g=v?e(n,v,O,r):t(n,l,p,null,O,r);n.schema.compat&&Hw.flowIndentCheck(i.indent,v,r),l=g.range[2];let b=new Zw.Pair(w,g);n.options.keepSourceTokens&&(b.srcToken=d),s.items.push(b)}else{h&&r(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),O.comment&&(w.comment?w.comment+=`
129
+ `+O.comment:w.comment=O.comment);let g=new Zw.Pair(w);n.options.keepSourceTokens&&(g.srcToken=d),s.items.push(g)}}return c&&c<l&&r(c,"IMPOSSIBLE","Map comment with trailing content"),s.range=[i.offset,l,c??l],s}Kw.resolveBlockMap=mW});var Yw=N(Xw=>{"use strict";var gW=_i(),hW=ds(),yW=Wf();function vW({composeNode:e,composeEmptyNode:t},n,i,r,o){let a=o?.nodeClass??gW.YAMLSeq,s=new a(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=i.offset,c=null;for(let{start:d,value:u}of i.items){let _=hW.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!_.found)if(_.anchor||_.tag||u)u?.type==="block-seq"?r(_.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=_.end,_.comment&&(s.comment=_.comment);continue}let p=u?e(n,u,_,r):t(n,_.end,d,null,_,r);n.schema.compat&&yW.flowIndentCheck(i.indent,u,r),l=p.range[2],s.items.push(p)}return s.range=[i.offset,l,c??l],s}Xw.resolveBlockSeq=vW});var Vo=N(Qw=>{"use strict";function bW(e,t,n,i){let r="";if(e){let o=!1,a="";for(let s of e){let{source:l,type:c}=s;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";r?r+=a+d:r=d,a="";break}case"newline":r&&(a+=l),o=!0;break;default:i(s,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:r,offset:t}}Qw.resolveEnd=bW});var rE=N(nE=>{"use strict";var SW=Pe(),kW=li(),eE=di(),wW=_i(),EW=Vo(),tE=ds(),AW=zu(),TW=Zf(),Bf="Block collections are not allowed within flow collections",Hf=e=>e&&(e.type==="block-map"||e.type==="block-seq");function xW({composeNode:e,composeEmptyNode:t},n,i,r,o){let a=i.start.source==="{",s=a?"flow map":"flow sequence",l=o?.nodeClass??(a?eE.YAMLMap:wW.YAMLSeq),c=new l(n.schema);c.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let h=0;h<i.items.length;++h){let k=i.items[h],{start:w,key:O,sep:g,value:b}=k,T=tE.resolveProps(w,{flow:s,indicator:"explicit-key-ind",next:O??g?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!T.found){if(!T.anchor&&!T.tag&&!g&&!b){h===0&&T.comma?r(T.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):h<i.items.length-1&&r(T.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),T.comment&&(c.comment?c.comment+=`
130
+ `+T.comment:c.comment=T.comment),u=T.end;continue}!a&&n.options.strict&&AW.containsNewline(O)&&r(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)T.comma&&r(T.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(T.comma||r(T.start,"MISSING_CHAR",`Missing , between ${s} items`),T.comment){let I="";e:for(let R of w)switch(R.type){case"comma":case"space":break;case"comment":I=R.source.substring(1);break e;default:break e}if(I){let R=c.items[c.items.length-1];SW.isPair(R)&&(R=R.value??R.key),R.comment?R.comment+=`
131
+ `+I:R.comment=I,T.comment=T.comment.substring(I.length+1)}}if(!a&&!g&&!T.found){let I=b?e(n,b,T,r):t(n,T.end,g,null,T,r);c.items.push(I),u=I.range[2],Hf(b)&&r(I.range,"BLOCK_IN_FLOW",Bf)}else{n.atKey=!0;let I=T.end,R=O?e(n,O,T,r):t(n,I,w,null,T,r);Hf(O)&&r(R.range,"BLOCK_IN_FLOW",Bf),n.atKey=!1;let U=tE.resolveProps(g??[],{flow:s,indicator:"map-value-ind",next:b,offset:R.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(U.found){if(!a&&!T.found&&n.options.strict){if(g)for(let S of g){if(S===U.found)break;if(S.type==="newline"){r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}T.start<U.found.offset-1024&&r(U.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else b&&("source"in b&&b.source?.[0]===":"?r(b,"MISSING_CHAR",`Missing space after : in ${s}`):r(U.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let V=b?e(n,b,U,r):U.found?t(n,U.end,g,null,U,r):null;V?Hf(b)&&r(V.range,"BLOCK_IN_FLOW",Bf):U.comment&&(R.comment?R.comment+=`
132
+ `+U.comment:R.comment=U.comment);let y=new kW.Pair(R,V);if(n.options.keepSourceTokens&&(y.srcToken=k),a){let S=c;TW.mapIncludes(n,S.items,R)&&r(I,"DUPLICATE_KEY","Map keys must be unique"),S.items.push(y)}else{let S=new eE.YAMLMap(n.schema);S.flow=!0,S.items.push(y);let x=(V??R).range;S.range=[R.range[0],x[1],x[2]],c.items.push(S)}u=V?V.range[2]:U.end}}let _=a?"}":"]",[p,...v]=i.end,f=u;if(p?.source===_)f=p.offset+p.source.length;else{let h=s[0].toUpperCase()+s.substring(1),k=d?`${h} must end with a ${_}`:`${h} in block collection must be sufficiently indented and end with a ${_}`;r(u,d?"MISSING_CHAR":"BAD_INDENT",k),p&&p.source.length!==1&&v.unshift(p)}if(v.length>0){let h=EW.resolveEnd(v,f,n.options.strict,r);h.comment&&(c.comment?c.comment+=`
133
+ `+h.comment:c.comment=h.comment),c.range=[i.offset,f,h.offset]}else c.range=[i.offset,f,f];return c}nE.resolveFlowCollection=xW});var oE=N(iE=>{"use strict";var OW=Pe(),RW=ft(),$W=di(),CW=_i(),IW=Gw(),NW=Yw(),PW=rE();function Jf(e,t,n,i,r,o){let a=n.type==="block-map"?IW.resolveBlockMap(e,t,n,i,o):n.type==="block-seq"?NW.resolveBlockSeq(e,t,n,i,o):PW.resolveFlowCollection(e,t,n,i,o),s=a.constructor;return r==="!"||r===s.tagName?(a.tag=s.tagName,a):(r&&(a.tag=r),a)}function MW(e,t,n,i,r){let o=i.tag,a=o?t.directives.tagName(o.source,_=>r(o,"TAG_RESOLVE_FAILED",_)):null;if(n.type==="block-seq"){let{anchor:_,newlineAfterProp:p}=i,v=_&&o?_.offset>o.offset?_:o:_??o;v&&(!p||p.offset<v.offset)&&r(v,"MISSING_CHAR","Missing newline after block sequence props")}let s=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!a||a==="!"||a===$W.YAMLMap.tagName&&s==="map"||a===CW.YAMLSeq.tagName&&s==="seq")return Jf(e,t,n,r,a);let l=t.schema.tags.find(_=>_.tag===a&&_.collection===s);if(!l){let _=t.schema.knownTags[a];if(_?.collection===s)t.schema.tags.push(Object.assign({},_,{default:!1})),l=_;else return _?r(o,"BAD_COLLECTION_TYPE",`${_.tag} used for ${s} collection, but expects ${_.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Jf(e,t,n,r,a)}let c=Jf(e,t,n,r,a,l),d=l.resolve?.(c,_=>r(o,"TAG_RESOLVE_FAILED",_),t.options)??c,u=OW.isNode(d)?d:new RW.Scalar(d);return u.range=c.range,u.tag=a,l?.format&&(u.format=l.format),u}iE.composeCollection=MW});var Gf=N(aE=>{"use strict";var Kf=ft();function LW(e,t,n){let i=t.offset,r=jW(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let o=r.mode===">"?Kf.Scalar.BLOCK_FOLDED:Kf.Scalar.BLOCK_LITERAL,a=t.source?DW(t.source):[],s=a.length;for(let f=a.length-1;f>=0;--f){let h=a[f][1];if(h===""||h==="\r")s=f;else break}if(s===0){let f=r.chomp==="+"&&a.length>0?`
134
+ `.repeat(Math.max(1,a.length-1)):"",h=i+r.length;return t.source&&(h+=t.source.length),{value:f,type:o,comment:r.comment,range:[i,h,h]}}let l=t.indent+r.indent,c=t.offset+r.length,d=0;for(let f=0;f<s;++f){let[h,k]=a[f];if(k===""||k==="\r")r.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&n(c+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=h.length),d=f,l===0&&!e.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=h.length+k.length+1}for(let f=a.length-1;f>=s;--f)a[f][0].length>l&&(s=f+1);let u="",_="",p=!1;for(let f=0;f<d;++f)u+=a[f][0].slice(l)+`
135
+ `;for(let f=d;f<s;++f){let[h,k]=a[f];c+=h.length+k.length+1;let w=k[k.length-1]==="\r";if(w&&(k=k.slice(0,-1)),k&&h.length<l){let g=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(c-k.length-(w?2:1),"BAD_INDENT",g),h=""}o===Kf.Scalar.BLOCK_LITERAL?(u+=_+h.slice(l)+k,_=`
136
+ `):h.length>l||k[0]===" "?(_===" "?_=`
137
+ `:!p&&_===`
138
+ `&&(_=`
139
+
140
+ `),u+=_+h.slice(l)+k,_=`
141
+ `,p=!0):k===""?_===`
142
+ `?u+=`
143
+ `:_=`
144
+ `:(u+=_+k,_=" ",p=!1)}switch(r.chomp){case"-":break;case"+":for(let f=s;f<a.length;++f)u+=`
145
+ `+a[f][0].slice(l);u[u.length-1]!==`
146
+ `&&(u+=`
147
+ `);break;default:u+=`
148
+ `}let v=i+r.length+t.source.length;return{value:u,type:o,comment:r.comment,range:[i,v,v]}}function jW({offset:e,props:t},n,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],o=r[0],a=0,s="",l=-1;for(let _=1;_<r.length;++_){let p=r[_];if(!s&&(p==="-"||p==="+"))s=p;else{let v=Number(p);!a&&v?a=v:l===-1&&(l=e+_)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,d="",u=r.length;for(let _=1;_<t.length;++_){let p=t[_];switch(p.type){case"space":c=!0;case"newline":u+=p.source.length;break;case"comment":n&&!c&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let v=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",v);let f=p.source;f&&typeof f=="string"&&(u+=f.length)}}}return{mode:o,indent:a,chomp:s,comment:d,length:u}}function DW(e){let t=e.split(/\n( *)/),n=t[0],i=n.match(/^( *)/),o=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let a=1;a<t.length;a+=2)o.push([t[a],t[a+1]]);return o}aE.resolveBlockScalar=LW});var Yf=N(cE=>{"use strict";var Xf=ft(),UW=Vo();function zW(e,t,n){let{offset:i,type:r,source:o,end:a}=e,s,l,c=(_,p,v)=>n(i+_,p,v);switch(r){case"scalar":s=Xf.Scalar.PLAIN,l=FW(o,c);break;case"single-quoted-scalar":s=Xf.Scalar.QUOTE_SINGLE,l=qW(o,c);break;case"double-quoted-scalar":s=Xf.Scalar.QUOTE_DOUBLE,l=VW(o,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let d=i+o.length,u=UW.resolveEnd(a,d,t,n);return{value:l,type:s,comment:u.comment,range:[i,d,u.offset]}}function FW(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),sE(e)}function qW(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),sE(e.slice(1,-1)).replace(/''/g,"'")}function sE(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
149
+ `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
150
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let r=i[1],o=" ",a=t.lastIndex;for(n.lastIndex=a;i=n.exec(e);)i[1]===""?o===`
151
+ `?r+=o:o=`
152
+ `:(r+=o+i[1],o=" "),a=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=a,i=s.exec(e),r+o+(i?.[1]??"")}function VW(e,t){let n="";for(let i=1;i<e.length-1;++i){let r=e[i];if(!(r==="\r"&&e[i+1]===`
153
+ `))if(r===`
154
+ `){let{fold:o,offset:a}=WW(e,i);n+=o,i=a}else if(r==="\\"){let o=e[++i],a=ZW[o];if(a)n+=a;else if(o===`
155
+ `)for(o=e[i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="\r"&&e[i+1]===`
156
+ `)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let s=o==="x"?2:o==="u"?4:8;n+=BW(e,i+1,s,t),i+=s}else{let s=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),n+=s}}else if(r===" "||r===" "){let o=i,a=e[i+1];for(;a===" "||a===" ";)a=e[++i+1];a!==`
157
+ `&&!(a==="\r"&&e[i+2]===`
158
+ `)&&(n+=i>o?e.slice(o,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function WW(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===`
159
+ `||i==="\r")&&!(i==="\r"&&e[t+2]!==`
160
+ `);)i===`
161
+ `&&(n+=`
162
+ `),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}var ZW={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
163
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function BW(e,t,n,i){let r=e.substr(t,n),a=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(a)}catch{let s=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}cE.resolveFlowScalar=zW});var dE=N(uE=>{"use strict";var zi=Pe(),lE=ft(),HW=Gf(),JW=Yf();function KW(e,t,n,i){let{value:r,type:o,comment:a,range:s}=t.type==="block-scalar"?HW.resolveBlockScalar(e,t,i):JW.resolveFlowScalar(t,e.options.strict,i),l=n?e.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[zi.SCALAR]:l?c=GW(e.schema,r,l,n,i):t.type==="scalar"?c=XW(e,r,t,i):c=e.schema[zi.SCALAR];let d;try{let u=c.resolve(r,_=>i(n??t,"TAG_RESOLVE_FAILED",_),e.options);d=zi.isScalar(u)?u:new lE.Scalar(u)}catch(u){let _=u instanceof Error?u.message:String(u);i(n??t,"TAG_RESOLVE_FAILED",_),d=new lE.Scalar(r)}return d.range=s,d.source=r,o&&(d.type=o),l&&(d.tag=l),c.format&&(d.format=c.format),a&&(d.comment=a),d}function GW(e,t,n,i,r){if(n==="!")return e[zi.SCALAR];let o=[];for(let s of e.tags)if(!s.collection&&s.tag===n)if(s.default&&s.test)o.push(s);else return s;for(let s of o)if(s.test?.test(t))return s;let a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[zi.SCALAR])}function XW({atKey:e,directives:t,schema:n},i,r,o){let a=n.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(i))||n[zi.SCALAR];if(n.compat){let s=n.compat.find(l=>l.default&&l.test?.test(i))??n[zi.SCALAR];if(a.tag!==s.tag){let l=t.tagString(a.tag),c=t.tagString(s.tag),d=`Value may be parsed as either ${l} or ${c}`;o(r,"TAG_RESOLVE_FAILED",d,!0)}}return a}uE.composeScalar=KW});var pE=N(_E=>{"use strict";function YW(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let r=t[i];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++i];r?.type==="space";)e+=r.source.length,r=t[++i];break}}return e}_E.emptyScalarPosition=YW});var gE=N(em=>{"use strict";var QW=Za(),eZ=Pe(),tZ=oE(),fE=dE(),nZ=Vo(),rZ=pE(),iZ={composeNode:mE,composeEmptyNode:Qf};function mE(e,t,n,i){let r=e.atKey,{spaceBefore:o,comment:a,anchor:s,tag:l}=n,c,d=!0;switch(t.type){case"alias":c=oZ(e,t,i),(s||l)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=fE.composeScalar(e,t,l,i),s&&(c.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=tZ.composeCollection(iZ,e,t,n,i),s&&(c.anchor=s.source.substring(1))}catch(u){let _=u instanceof Error?u.message:String(u);i(t,"RESOURCE_EXHAUSTION",_)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",u),d=!1}}return c??(c=Qf(e,t.offset,void 0,null,n,i)),s&&c.anchor===""&&i(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!eZ.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?c.comment=a:c.commentBefore=a),e.options.keepSourceTokens&&d&&(c.srcToken=t),c}function Qf(e,t,n,i,{spaceBefore:r,comment:o,anchor:a,tag:s,end:l},c){let d={type:"scalar",offset:rZ.emptyScalarPosition(t,n,i),indent:-1,source:""},u=fE.composeScalar(e,d,s,c);return a&&(u.anchor=a.source.substring(1),u.anchor===""&&c(a,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=l),u}function oZ({options:e},{offset:t,source:n,end:i},r){let o=new QW.Alias(n.substring(1));o.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+n.length,s=nZ.resolveEnd(i,a,e.strict,r);return o.range=[t,a,s.offset],s.comment&&(o.comment=s.comment),o}em.composeEmptyNode=Qf;em.composeNode=mE});var vE=N(yE=>{"use strict";var aZ=ss(),hE=gE(),sZ=Vo(),cZ=ds();function lZ(e,t,{offset:n,start:i,value:r,end:o},a){let s=Object.assign({_directives:t},e),l=new aZ.Document(void 0,s),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=cZ.resolveProps(i,{indicator:"doc-start",next:r??o?.[0],offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?hE.composeNode(c,r,d,a):hE.composeEmptyNode(c,d.end,i,null,d,a);let u=l.contents.range[2],_=sZ.resolveEnd(o,u,!1,a);return _.comment&&(l.comment=_.comment),l.range=[n,u,_.offset],l}yE.composeDoc=lZ});var nm=N(kE=>{"use strict";var uZ=require("process"),dZ=zp(),_Z=ss(),_s=us(),bE=Pe(),pZ=vE(),fZ=Vo();function ps(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function SE(e){let t="",n=!1,i=!1;for(let r=0;r<e.length;++r){let o=e[r];switch(o[0]){case"#":t+=(t===""?"":i?`
164
+
165
+ `:`
166
+ `)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var tm=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,o)=>{let a=ps(n);o?this.warnings.push(new _s.YAMLWarning(a,i,r)):this.errors.push(new _s.YAMLParseError(a,i,r))},this.directives=new dZ.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:i,afterEmptyLine:r}=SE(this.prelude);if(i){let o=t.contents;if(n)t.comment=t.comment?`${t.comment}
167
+ ${i}`:i;else if(r||t.directives.docStart||!o)t.commentBefore=i;else if(bE.isCollection(o)&&!o.flow&&o.items.length>0){let a=o.items[0];bE.isPair(a)&&(a=a.key);let s=a.commentBefore;a.commentBefore=s?`${i}
168
+ ${s}`:i}else{let a=o.commentBefore;o.commentBefore=a?`${i}
169
+ ${a}`:i}}if(n){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:SE(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,i=-1){for(let r of t)yield*this.next(r);yield*this.end(n,i)}*next(t){switch(uZ.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,i,r)=>{let o=ps(t);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",i,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=pZ.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new _s.YAMLParseError(ps(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new _s.YAMLParseError(ps(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=fZ.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
170
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new _s.YAMLParseError(ps(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),r=new _Z.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};kE.Composer=tm});var AE=N(Fu=>{"use strict";var mZ=Gf(),gZ=Yf(),hZ=us(),wE=Ga();function yZ(e,t=!0,n){if(e){let i=(r,o,a)=>{let s=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(s,o,a);else throw new hZ.YAMLParseError([s,s+1],o,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return gZ.resolveFlowScalar(e,t,i);case"block-scalar":return mZ.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function vZ(e,t){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:a="PLAIN"}=t,s=wE.stringifyString({type:a,value:e},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:i,source:`
171
+ `}];switch(s[0]){case"|":case">":{let c=s.indexOf(`
172
+ `),d=s.substring(0,c),u=s.substring(c+1)+`
173
+ `,_=[{type:"block-scalar-header",offset:o,indent:i,source:d}];return EE(_,l)||_.push({type:"newline",offset:-1,indent:i,source:`
174
+ `}),{type:"block-scalar",offset:o,indent:i,props:_,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:s,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:s,end:l};default:return{type:"scalar",offset:o,indent:i,source:s,end:l}}}function bZ(e,t,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:o=!1,type:a}=n,s="indent"in e?e.indent:null;if(i&&typeof s=="number"&&(s+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let l=wE.stringifyString({type:a,value:t},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":SZ(e,l);break;case'"':rm(e,l,"double-quoted-scalar");break;case"'":rm(e,l,"single-quoted-scalar");break;default:rm(e,l,"scalar")}}function SZ(e,t){let n=t.indexOf(`
175
+ `),i=t.substring(0,n),r=t.substring(n+1)+`
176
+ `;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=r}else{let{offset:o}=e,a="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:o,indent:a,source:i}];EE(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:a,source:`
177
+ `});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:a,props:s,source:r})}}function EE(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function rm(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let o of i)o.offset+=r;delete e.props,Object.assign(e,{type:n,source:t,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
178
+ `};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let i="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:n,indent:i,source:t,end:r})}}}Fu.createScalarToken=vZ;Fu.resolveAsScalar=yZ;Fu.setScalarValue=bZ});var xE=N(TE=>{"use strict";var kZ=e=>"type"in e?Vu(e):qu(e);function Vu(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Vu(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=qu(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=qu(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=qu(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function qu({start:e,key:t,sep:n,value:i}){let r="";for(let o of e)r+=o.source;if(t&&(r+=Vu(t)),n)for(let o of n)r+=o.source;return i&&(r+=Vu(i)),r}TE.stringify=kZ});var CE=N($E=>{"use strict";var im=Symbol("break visit"),wZ=Symbol("skip children"),OE=Symbol("remove item");function Fi(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),RE(Object.freeze([]),e,t)}Fi.BREAK=im;Fi.SKIP=wZ;Fi.REMOVE=OE;Fi.itemAtPath=(e,t)=>{let n=e;for(let[i,r]of t){let o=n?.[i];if(o&&"items"in o)n=o.items[r];else return}return n};Fi.parentCollection=(e,t)=>{let n=Fi.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function RE(e,t,n){let i=n(t,e);if(typeof i=="symbol")return i;for(let r of["key","value"]){let o=t[r];if(o&&"items"in o){for(let a=0;a<o.items.length;++a){let s=RE(Object.freeze(e.concat([[r,a]])),o.items[a],n);if(typeof s=="number")a=s-1;else{if(s===im)return im;s===OE&&(o.items.splice(a,1),a-=1)}}typeof i=="function"&&r==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}$E.visit=Fi});var Wu=N(Bt=>{"use strict";var om=AE(),EZ=xE(),AZ=CE(),am="\uFEFF",sm="",cm="",lm="",TZ=e=>!!e&&"items"in e,xZ=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function OZ(e){switch(e){case am:return"<BOM>";case sm:return"<DOC>";case cm:return"<FLOW_END>";case lm:return"<SCALAR>";default:return JSON.stringify(e)}}function RZ(e){switch(e){case am:return"byte-order-mark";case sm:return"doc-mode";case cm:return"flow-error-end";case lm:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
179
+ `:case`\r
180
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Bt.createScalarToken=om.createScalarToken;Bt.resolveAsScalar=om.resolveAsScalar;Bt.setScalarValue=om.setScalarValue;Bt.stringify=EZ.stringify;Bt.visit=AZ.visit;Bt.BOM=am;Bt.DOCUMENT=sm;Bt.FLOW_END=cm;Bt.SCALAR=lm;Bt.isCollection=TZ;Bt.isScalar=xZ;Bt.prettyToken=OZ;Bt.tokenType=RZ});var _m=N(NE=>{"use strict";var fs=Wu();function mn(e){switch(e){case void 0:case" ":case`
181
+ `:case"\r":case" ":return!0;default:return!1}}var IE=new Set("0123456789ABCDEFabcdef"),$Z=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Zu=new Set(",[]{}"),CZ=new Set(` ,[]{}
182
+ \r `),um=e=>!e||CZ.has(e),dm=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
183
+ `?!0:n==="\r"?this.buffer[t+1]===`
184
+ `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+t];if(n==="\r"){let r=this.buffer[i+t+1];if(r===`
185
+ `||!r&&!this.atEnd)return t+i+1}return n===`
186
+ `||i>=this.indentNext||!n&&!this.atEnd?t+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&mn(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
187
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===fs.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){n=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield fs.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&mn(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!mn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&mn(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(um),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,i=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&mn(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield fs.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(um),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||mn(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
188
+ `,this.pos);if(r!==-1){for(;r!==-1;){let o=this.continueScalar(r+1);if(o===-1)break;r=i.indexOf(`
189
+ `,o)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>mn(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){case" ":n+=1;break;case`
190
+ `:t=o,n=0;break;case"\r":{let a=this.buffer[o+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
191
+ `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(t+1);if(o===-1)break;t=this.buffer.indexOf(`
192
+ `,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
193
+ `;)i=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let o=t-1,a=this.buffer[o];a==="\r"&&(a=this.buffer[--o]);let s=o;for(;a===" ";)a=this.buffer[--o];if(a===`
194
+ `&&o>=this.pos&&o+1+n>s)t=o;else break}while(!0);return yield fs.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let o=this.buffer[i+1];if(mn(o)||t&&Zu.has(o))break;n=i}else if(mn(r)){let o=this.buffer[i+1];if(r==="\r"&&(o===`
195
+ `?(i+=1,r=`
196
+ `,o=this.buffer[i+1]):n=i),o==="#"||t&&Zu.has(o))break;if(r===`
197
+ `){let a=this.continueScalar(i+1);if(a===-1)break;i=Math.max(i,a-2)}}else{if(t&&Zu.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield fs.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(um),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(mn(i)||n&&Zu.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!mn(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if($Z.has(n))n=this.buffer[++t];else if(n==="%"&&IE.has(this.buffer[t+1])&&IE.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
198
+ `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
199
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};NE.Lexer=dm});var fm=N(PE=>{"use strict";var pm=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=this.lineStarts.length;for(;n<i;){let o=n+i>>1;this.lineStarts[o]<t?n=o+1:i=o}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}};PE.LineCounter=pm});var gm=N(UE=>{"use strict";var IZ=require("process"),ME=Wu(),NZ=_m();function pi(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function LE(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function DE(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Bu(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Wo(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Hu(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function jE(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!pi(t.start,"explicit-key-ind")&&!pi(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,DE(t.value)?t.value.end?Hu(t.value.end,t.sep):t.value.end=t.sep:Hu(t.start,t.sep),delete t.sep)}var mm=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new NZ.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,n))yield*this.next(i);n||(yield*this.end())}*next(t){if(this.source=t,IZ.env.LOG_TOKENS&&console.log("|",ME.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=ME.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&jE(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&LE(r.start)===-1&&(n.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{LE(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Bu(this.peek(2)),i=Wo(n),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
200
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
201
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Hu(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&n.sep&&!n.value){let a=[];for(let s=0;s<n.sep.length;++s){let l=n.sep[s];switch(l.type){case"newline":a.push(s);break;case"space":break;case"comment":l.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(o=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(pi(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(DE(n.key)&&!pi(n.sep,"newline")){let a=Wo(n.start),s=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:s,sep:l}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(pi(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=Wo(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:o,key:null,sep:[this.sourceToken]}):pi(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);r||n.value?(t.items.push({start:o,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!pi(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:o});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Hu(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||pi(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=Bu(i),o=Wo(r);jE(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
202
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
203
+ `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Bu(t),i=Wo(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Bu(t),i=Wo(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};UE.Parser=mm});var WE=N(gs=>{"use strict";var zE=nm(),PZ=ss(),ms=us(),MZ=Qp(),LZ=Pe(),jZ=fm(),FE=gm();function qE(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new jZ.LineCounter||null,prettyErrors:t}}function DZ(e,t={}){let{lineCounter:n,prettyErrors:i}=qE(t),r=new FE.Parser(n?.addNewLine),o=new zE.Composer(t),a=Array.from(o.compose(r.parse(e)));if(i&&n)for(let s of a)s.errors.forEach(ms.prettifyError(e,n)),s.warnings.forEach(ms.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},o.streamInfo())}function VE(e,t={}){let{lineCounter:n,prettyErrors:i}=qE(t),r=new FE.Parser(n?.addNewLine),o=new zE.Composer(t),a=null;for(let s of o.compose(r.parse(e),!0,e.length))if(!a)a=s;else if(a.options.logLevel!=="silent"){a.errors.push(new ms.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(a.errors.forEach(ms.prettifyError(e,n)),a.warnings.forEach(ms.prettifyError(e,n))),a}function UZ(e,t,n){let i;typeof t=="function"?i=t:n===void 0&&t&&typeof t=="object"&&(n=t);let r=VE(e,n);if(!r)return null;if(r.warnings.forEach(o=>MZ.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function zZ(e,t,n){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}return LZ.isDocument(e)&&!i?e.toString(n):new PZ.Document(e,i,n).toString(n)}gs.parse=UZ;gs.parseAllDocuments=DZ;gs.parseDocument=VE;gs.stringify=zZ});var ym=N(Ve=>{"use strict";var FZ=nm(),qZ=ss(),VZ=Lf(),hm=us(),WZ=Za(),fi=Pe(),ZZ=li(),BZ=ft(),HZ=di(),JZ=_i(),KZ=Wu(),GZ=_m(),XZ=fm(),YZ=gm(),Ju=WE(),ZE=Fa();Ve.Composer=FZ.Composer;Ve.Document=qZ.Document;Ve.Schema=VZ.Schema;Ve.YAMLError=hm.YAMLError;Ve.YAMLParseError=hm.YAMLParseError;Ve.YAMLWarning=hm.YAMLWarning;Ve.Alias=WZ.Alias;Ve.isAlias=fi.isAlias;Ve.isCollection=fi.isCollection;Ve.isDocument=fi.isDocument;Ve.isMap=fi.isMap;Ve.isNode=fi.isNode;Ve.isPair=fi.isPair;Ve.isScalar=fi.isScalar;Ve.isSeq=fi.isSeq;Ve.Pair=ZZ.Pair;Ve.Scalar=BZ.Scalar;Ve.YAMLMap=HZ.YAMLMap;Ve.YAMLSeq=JZ.YAMLSeq;Ve.CST=KZ;Ve.Lexer=GZ.Lexer;Ve.LineCounter=XZ.LineCounter;Ve.Parser=YZ.Parser;Ve.parse=Ju.parse;Ve.parseAllDocuments=Ju.parseAllDocuments;Ve.parseDocument=Ju.parseDocument;Ve.stringify=Ju.stringify;Ve.visit=ZE.visit;Ve.visitAsync=ZE.visitAsync});function ht(e){let t=(0,Ku.parseDocument)(e,{strict:!0,uniqueKeys:!0});if(t.errors.length>0)throw new vm(t.errors.map(n=>n.message).join("; "));return t.toJS({maxAliasCount:QZ})}function Fr(e){return(0,Ku.stringify)(e,{lineWidth:0,aliasDuplicateObjects:!1})}var Ku,QZ,vm,hs=P(()=>{"use strict";Ku=He(ym(),1),QZ=10,vm=class extends Error{name="YamlContractError"}});function t6(e){return e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||e.endsWith("/")||/^[A-Za-z]:/.test(e)?!1:e.split("/").every(t=>t.length>0&&t!=="."&&t!=="..")}function BE(e){return H.z.record(H.z.string().min(1),e).superRefine((t,n)=>{for(let i of Object.keys(t))t6(i)||n.addIssue({code:"custom",path:[i],message:"Managed file path must be canonical and workspace-relative"})})}function qr(e){let t=HE.parse(e),n=t.zaip?.enabled??t["zaip-aios"]?.enabled,{"zaip-aios":i,...r}=t;return n===void 0?r:{...r,zaip:{enabled:n}}}function o6(e){let t=H.z.union([KE,Xu]).parse(e);return t.lock_version===2?t:Xu.parse({...t,lock_version:2,managed_files:Object.fromEntries(Object.entries(t.managed_files).map(([n,i])=>[n,i.sha256]))})}var H,gn,ed,Gu,e6,n6,r6,i6,HE,JE,KE,Xu,bY,SY,Yu,Qu,bm=P(()=>{"use strict";H=He(Xe(),1);No();hs();gn=".agents/config/project.yaml",ed=".agents/config/framework.lock.yaml",Gu=H.z.string().regex(/^[a-f0-9]{64}$/i,"Expected a SHA-256 checksum"),e6=H.z.string().min(1).superRefine((e,t)=>{try{new Intl.DateTimeFormat("en",{timeZone:e}).format()}catch{t.addIssue({code:"custom",message:"Expected a valid IANA timezone"})}});n6=H.z.object({sha256:Gu}).strict();r6=BE(n6),i6=BE(Gu),HE=H.z.object({schema_version:H.z.literal(1),zaip:H.z.object({enabled:H.z.boolean()}).strict().optional(),"zaip-aios":H.z.object({enabled:H.z.boolean()}).strict().optional(),project:H.z.object({id:H.z.string().min(1),name:H.z.string().min(1),timezone:e6}).strict(),stack:H.z.object({id:H.z.string().min(1),language:H.z.string().min(1).optional(),api:H.z.string().min(1).optional(),query_builder:H.z.string().min(1).optional(),extensions:H.z.array(H.z.string().min(1)).min(1).optional(),layout:H.z.object({frontend:H.z.string().min(1),backend:H.z.string().min(1),site:H.z.string().min(1),modules:H.z.string().min(1),packages:H.z.string().min(1),e2e:H.z.string().min(1)}).strict().optional(),source_limits:H.z.object({warning_lines:H.z.number().int().positive(),error_lines:H.z.number().int().positive()}).strict().optional(),invariants:H.z.array(H.z.string().min(1)).min(1).optional(),commands:H.z.object({test:H.z.string().min(1),typecheck:H.z.string().min(1)}).strict().optional(),overrides:H.z.record(H.z.string(),H.z.unknown())}).strict(),clients:H.z.object({codex:H.z.boolean(),claude:H.z.boolean()}).strict(),tracking:H.z.object({enabled:H.z.boolean(),currency:H.z.string().regex(/^[A-Z]{3}$/,"Expected an ISO 4217 currency code"),storage_mode:H.z.enum(["tracked_sanitized","local_only"])}).strict(),model_orchestration:H.z.discriminatedUnion("mode",[H.z.object({mode:H.z.literal("manual"),default_model:H.z.literal("manual"),default_effort:H.z.literal("manual"),default_velocity:H.z.literal("manual"),notice:H.z.enum(["always","mismatch"])}).strict(),H.z.object({mode:H.z.literal("off"),default_model:H.z.string().min(1),default_effort:H.z.string().min(1),default_velocity:H.z.string().min(1),notice:H.z.enum(["always","mismatch"])}).strict(),rk]).optional(),execution:H.z.discriminatedUnion("runtime",[H.z.object({runtime:H.z.literal("manual")}).strict(),H.z.object({runtime:H.z.literal("autonomous"),autonomous:H.z.object({provider:H.z.enum(["codex","claude"]),model:H.z.string().min(1),max_parallelism:H.z.number().int().min(1).max(8),lease_ms:H.z.number().int().min(5e3).max(36e5),max_phase_attempts:H.z.number().int().positive().nullable().optional(),max_total_invocations:H.z.number().int().positive().nullable().optional()}).strict()}).strict()]).optional(),assurance:H.z.object({version:H.z.literal(1),standard_depth:H.z.enum(["auto","base","elevated"]),require_final_commit:H.z.boolean()}).strict().optional(),context:H.z.object({canonical_roots:H.z.array(H.z.string().min(1)).min(1),projection_roots:H.z.array(H.z.string().min(1))}).strict().optional()}).strict().superRefine((e,t)=>{let n=e.zaip?.enabled,i=e["zaip-aios"]?.enabled;n!==void 0&&i!==void 0&&n!==i&&t.addIssue({code:"custom",path:["zaip","enabled"],message:"Conflicting ZAIP activation keys: zaip.enabled and legacy zaip-aios.enabled must agree"})}),JE={framework:H.z.object({version:H.z.string().min(1),distribution_sha256:Gu.nullable()}).strict(),layout:H.z.object({version:H.z.union([H.z.literal(2),H.z.literal(3)])}).strict(),resolved_profile:H.z.object({id:H.z.string().min(1).nullable(),sha256:Gu.nullable()}).strict()},KE=H.z.object({lock_version:H.z.literal(1),...JE,managed_files:r6}).strict(),Xu=H.z.object({lock_version:H.z.literal(2),...JE,managed_files:i6}).strict(),bY=H.z.toJSONSchema(HE),SY=H.z.toJSONSchema(H.z.union([KE,Xu]));Yu=class{constructor(t,n=gn){this.filesystem=t;this.path=n}filesystem;path;async read(){return qr(ht(await this.filesystem.readText(this.path)))}async write(t){await this.filesystem.writeTextAtomic(this.path,Fr(qr(t)))}},Qu=class{constructor(t,n=ed){this.filesystem=t;this.path=n}filesystem;path;async read(){return o6(ht(await this.filesystem.readText(this.path)))}async write(t){await this.filesystem.writeTextAtomic(this.path,Fr(Xu.parse(t)))}}});function Sm(e){let t=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/([a-z\d])([A-Z])/g,"$1-$2").toUpperCase().replace(/[^A-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-").slice(0,48).replace(/-+$/g,"");if(t.length===0)throw new TypeError("shortName must contain at least one letter or number");return t}function qi(e=4){if(!Number.isSafeInteger(e)||e<2||e>16)throw new RangeError("collision code length must be between 2 and 16");let t=(0,XE.randomBytes)(e);return Array.from(t,n=>GE[n%GE.length]).join("")}function Vi(e,t,n={}){let i=n.clock??new Qe,r=n.timeZone??"America/Sao_Paulo",o=(n.collisionCode??qi()).toUpperCase();if(!/^[A-Z2-9]{2,16}$/.test(o))throw new TypeError("collisionCode must contain 2-16 unambiguous uppercase characters");let a=new Intl.DateTimeFormat("en-CA",{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(i.now()),s=l=>{let c=a.find(d=>d.type===l)?.value;if(c===void 0)throw new Error(`Unable to format ID date part: ${l}`);return c};return[e,s("year"),s("month"),s("day"),s("hour"),s("minute"),Sm(t),o].join("-")}var XE,GE,km=P(()=>{"use strict";XE=require("node:crypto");Pp();GE="23456789ABCDEFGHJKLMNPQRSTUVWXYZ"});function a6(e){return Je.posix.isAbsolute(e)||Je.win32.isAbsolute(e)||/^[A-Za-z]:/.test(e)}function s6(e){return e.split(/[\\/]+/).some(t=>t==="..")}function ys(e){return e instanceof Error&&"code"in e}async function c6(e,t){if(process.platform!=="win32"){await(0,Ce.rename)(e,t);return}for(let n=0;n<5;n+=1)try{await(0,Ce.rm)(t,{force:!0}),await(0,Ce.rename)(e,t);return}catch(i){if(!l6(i)||n===4)throw i;await u6(25*(n+1))}}function l6(e){return ys(e)&&["EPERM","EBUSY","EACCES"].includes(e.code??"")}async function u6(e){await new Promise(t=>setTimeout(t,e))}var Ce,Je,Vr,mi,YE=P(()=>{"use strict";Ce=require("node:fs/promises"),Je=require("node:path");km();Vr=class extends Error{name="WorkspacePathError"},mi=class{root;appendQueues=new Map;constructor(t){this.root=(0,Je.resolve)(t)}resolve(t){if(a6(t)||s6(t))throw new Vr("Expected a path relative to the workspace root");let n=(0,Je.resolve)(this.root,t),i=(0,Je.relative)(this.root,n);if(i===".."||i.startsWith(`..${Je.sep}`)||(0,Je.isAbsolute)(i))throw new Vr(`Path escapes workspace root: ${t}`);return n}async exists(t){try{let n=this.resolve(t);return await this.assertPhysicalContainment(n),await(0,Ce.stat)(n),!0}catch(n){if(ys(n)&&n.code==="ENOENT")return!1;throw n}}async readText(t){let n=this.resolve(t);return await this.assertPhysicalContainment(n),(0,Ce.readFile)(n,"utf8")}async readBytes(t){let n=this.resolve(t);return await this.assertPhysicalContainment(n),(0,Ce.readFile)(n)}async readTextFrom(t,n){if(!Number.isSafeInteger(n)||n<0)throw new RangeError("Expected a non-negative byte offset");let i=this.resolve(t);await this.assertPhysicalContainment(i);let r=await(0,Ce.open)(i,"r");try{let o=await r.stat(),a=Math.min(n,o.size),s=Buffer.allocUnsafe(o.size-a);return s.byteLength>0&&await r.read(s,0,s.byteLength,a),{content:s.toString("utf8"),nextOffset:o.size}}finally{await r.close()}}async listFiles(t,n=""){let i=this.resolve(t);return await this.assertPhysicalContainment(i),await this.exists(t)?(await(0,Ce.readdir)(i,{recursive:!0,withFileTypes:!0})).filter(o=>o.isFile()).map(o=>(0,Je.relative)(this.root,(0,Je.resolve)(o.parentPath,o.name)).replace(/\\/g,"/")).filter(o=>o.endsWith(n)).sort():[]}async listDirectories(t){let n=this.resolve(t);return await this.assertPhysicalContainment(n),await this.exists(t)?(await(0,Ce.readdir)(n,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>(0,Je.relative)(this.root,(0,Je.resolve)(n,r.name)).replace(/\\/g,"/")).sort():[]}async writeTextAtomic(t,n){let i=this.resolve(t),r=`${i}.${qi(6)}.tmp`;await this.assertPhysicalContainment(i),await(0,Ce.mkdir)((0,Je.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i);try{await(0,Ce.writeFile)(r,n,{encoding:"utf8",flag:"wx"}),await c6(r,i)}finally{await(0,Ce.rm)(r,{force:!0})}}async appendText(t,n){let i=this.resolve(t),o=(this.appendQueues.get(i)??Promise.resolve()).catch(()=>{}).then(async()=>{await this.assertPhysicalContainment(i),await(0,Ce.mkdir)((0,Je.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i),await(0,Ce.appendFile)(i,n,{encoding:"utf8",flush:!0})});this.appendQueues.set(i,o);try{await o}finally{this.appendQueues.get(i)===o&&this.appendQueues.delete(i)}}async writeTextExclusive(t,n){let i=this.resolve(t);await this.assertPhysicalContainment(i),await(0,Ce.mkdir)((0,Je.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i),await(0,Ce.writeFile)(i,n,{encoding:"utf8",flag:"wx",flush:!0})}async writeTextAtomicExclusive(t,n){let i=this.resolve(t),r=`${i}.${qi(6)}.tmp`;await this.assertPhysicalContainment(i),await(0,Ce.mkdir)((0,Je.dirname)(i),{recursive:!0}),await this.assertPhysicalContainment(i);try{await(0,Ce.writeFile)(r,n,{encoding:"utf8",flag:"wx",flush:!0}),await(0,Ce.link)(r,i)}finally{await(0,Ce.rm)(r,{force:!0})}}async removeFile(t){let n=this.resolve(t);await this.assertPhysicalContainment(n),await(0,Ce.rm)(n,{force:!0})}async removeFileIfContentMatches(t,n){let i=`${t}.${qi(16)}.compare-delete`;try{await this.moveFileAtomic(t,i)}catch(s){if(ys(s)&&s.code==="ENOENT")return!1;throw s}if(await this.readText(i)===n)return await this.removeFile(i),!0;let o=this.resolve(i),a=this.resolve(t);try{await(0,Ce.link)(o,a),await this.removeFile(i)}catch(s){throw ys(s)&&s.code==="EEXIST"?new Vr(`Conditional delete observed a replacement; captured file retained at ${i}`):s}return!1}async collectCompareDeleteTombstones(t){let n=[];for(let i of await this.listFiles(t)){let r=/^(.*)\.[A-Z0-9]{16}\.compare-delete$/.exec(i);if(r===null)continue;let o=r[1];o!==void 0&&await this.exists(o)&&(await this.removeFile(i),n.push(i))}return n}async moveFileAtomic(t,n){let i=this.resolve(t),r=this.resolve(n);await this.assertPhysicalContainment(i),await this.assertPhysicalContainment(r),await(0,Ce.mkdir)((0,Je.dirname)(r),{recursive:!0}),await this.assertPhysicalContainment(r),await(0,Ce.rename)(i,r)}async assertPhysicalContainment(t){let n=await(0,Ce.realpath)(this.root),i=t,r=null;for(;;)try{i=await(0,Ce.realpath)(i);break}catch(a){if(!ys(a)||a.code!=="ENOENT")throw a;if(r=a,i===this.root)throw new Vr(`Cannot resolve workspace root for: ${t}`,{cause:r});let s=(0,Je.dirname)(i);if(s===i)throw new Vr(`Cannot resolve workspace ancestor for: ${t}`,{cause:r});i=s}let o=(0,Je.relative)(n,i);if(o===".."||o.startsWith(`..${Je.sep}`)||(0,Je.isAbsolute)(o))throw new Vr(`Physical path escapes workspace root: ${t}`)}}});var QE,eA,xY,tA=P(()=>{"use strict";QE=require("node:child_process"),eA=require("node:util"),xY=(0,eA.promisify)(QE.execFile)});function Ct(e,t){let n=e.replace(/^\uFEFF/,"").replace(/\r\n/g,`
204
+ `);if(!n.startsWith(`${td}
205
+ `))throw new Zo("Markdown document must begin with YAML frontmatter");let i=n.indexOf(`
206
+ ${td}
207
+ `,4);if(i===-1)throw new Zo("Markdown frontmatter is not closed");let r=n.slice(4,i),o=(0,nd.parseDocument)(r,{strict:!0,uniqueKeys:!0});if(o.errors.length>0)throw new Zo(`Invalid YAML frontmatter: ${o.errors.map(s=>s.message).join("; ")}`);let a=t.safeParse(o.toJS({maxAliasCount:d6}));if(!a.success)throw new Zo(`Invalid metadata: ${a.error.message}`);return{metadata:a.data,body:n.slice(i+5).replace(/^\n/,"").replace(/\s+$/g,"")}}function ln(e){let t=(0,nd.stringify)(e.metadata,{lineWidth:0,aliasDuplicateObjects:!1}).trimEnd(),n=e.body.trim();return`${td}
208
+ ${t}
209
+ ${td}
210
+
211
+ ${n}
212
+ `}var nd,td,d6,Zo,wm=P(()=>{"use strict";nd=He(ym(),1),td="---",d6=10,Zo=class extends Error{name="MarkdownContractError"}});var yt,CY,IY,nA=P(()=>{"use strict";yt=He(Xe(),1);wm();CY=yt.z.object({id:yt.z.string().regex(/^RULE-[A-Z0-9-]+$/),load:yt.z.enum(["always","auto","file_match","manual"]),globs:yt.z.array(yt.z.string().min(1)).default([]),priority:yt.z.enum(["critical","high","medium","low"]),max_context_tokens:yt.z.number().int().positive(),requires:yt.z.array(yt.z.string().regex(/^RULE-[A-Z0-9-]+$/))}).strict().superRefine((e,t)=>{e.load==="file_match"&&e.globs.length===0&&t.addIssue({code:"custom",path:["globs"],message:"file_match Rules require at least one glob"})}),IY=yt.z.object({schema_version:yt.z.literal(2),id:yt.z.string().regex(/^REQUIREMENTS-[A-Z0-9-]+$/),area:yt.z.string().regex(/^[a-z][a-z0-9-]*$/),title:yt.z.string().min(1),status:yt.z.enum(["proposed","active","deprecated"]),version:yt.z.number().int().positive(),source_change:yt.z.string().min(1).nullable(),source_release:yt.z.string().regex(/^\d+\.\d+\.\d+$/).optional()}).strict().superRefine((e,t)=>{e.source_change===null&&e.source_release===void 0&&t.addIssue({code:"custom",path:["source_release"],message:"released Requirements require source_release when source_change is null"}),e.source_change!==null&&e.source_release!==void 0&&t.addIssue({code:"custom",path:["source_release"],message:"source_release is only valid when source_change is null"})})});var ve,_6,p6,f6,MY,LY,rA,m6,g6,h6,y6,v6,rd,jY,DY,iA=P(()=>{"use strict";ve=He(Xe(),1);hs();_6=["codex_host_native","provider_subprocess"],p6=["frontier","balanced","fast_scan","review"],f6=["subagents","worktrees","sandbox","approvals","skills","mcp"],MY=ve.z.enum(_6),LY=ve.z.enum(p6),rA=ve.z.enum(f6),m6=ve.z.array(rA).min(1).refine(e=>new Set(e).size===e.length,{message:"native_surfaces must be unique"}),g6=ve.z.object({locator:ve.z.string().min(1),candidate_sha256:ve.z.string().regex(/^[a-f0-9]{64}$/)}).strict(),h6=ve.z.object({capability_id:ve.z.string().regex(/^CAP-[A-Z0-9-]+$/),current_state:ve.z.literal("implemented"),previous_states:ve.z.tuple([ve.z.literal("declared")]),evidence:ve.z.array(g6).length(0)}).strict(),y6=ve.z.object({tier:ve.z.literal(1),enabled:ve.z.literal(!0),optional:ve.z.literal(!1),invokes_provider_subprocess:ve.z.literal(!1),authority:ve.z.literal("host"),native_surfaces:m6,capability_bindings:ve.z.record(rA,h6)}).strict().superRefine((e,t)=>{let n=Object.keys(e.capability_bindings).sort(),i=[...e.native_surfaces].sort();JSON.stringify(n)!==JSON.stringify(i)&&t.addIssue({code:"custom",path:["capability_bindings"],message:"every native surface requires exactly one conformance/maturity binding"})}),v6=ve.z.object({tier:ve.z.union([ve.z.literal(2),ve.z.literal(3)]),enabled:ve.z.boolean(),optional:ve.z.literal(!0),invokes_provider_subprocess:ve.z.literal(!0),authority:ve.z.literal("framework"),native_surfaces:ve.z.array(ve.z.never()).length(0),opt_in:ve.z.object({required:ve.z.literal(!0),allowed_sources:ve.z.array(ve.z.enum(["project_config","human_decision"])).min(1).refine(e=>new Set(e).size===e.length,{message:"opt-in sources must be unique"})}).strict()}).strict(),rd=ve.z.object({selection:ve.z.enum(["host_available","inherit_host"]),reasoning:ve.z.enum(["low","medium","high"]),intent:ve.z.string().min(1)}).strict(),jY=ve.z.object({schema_version:ve.z.literal(1),host_id:ve.z.literal("codex"),candidate_sha256:ve.z.null(),default_mode:ve.z.literal("codex_host_native"),modes:ve.z.object({codex_host_native:y6,provider_subprocess:v6}).strict(),model_classes:ve.z.object({frontier:rd,balanced:rd,fast_scan:rd,review:rd}).strict()}).strict(),DY=ve.z.object({enabled:ve.z.literal(!0),source:ve.z.enum(["project_config","human_decision"]),provenance:ve.z.object({reference:ve.z.string().min(1),recorded_at:ve.z.string().datetime({offset:!0})}).strict()}).strict()});var oA=P(()=>{"use strict";iA()});function Em(e,t){return`${b6}/${e}/${t}.json`}var b6,aA=P(()=>{"use strict";b6=".local/claims"});function S6(e){return Am.parse(e)}var nt,Am,WY,id,Tm=P(()=>{"use strict";nt=He(Xe(),1);hs();Am=nt.z.object({schema_version:nt.z.literal(1),project:nt.z.object({id:nt.z.string().min(1),name:nt.z.string().min(1),timezone:nt.z.string().min(1).default("America/Sao_Paulo")}),framework:nt.z.object({version:nt.z.string().min(1)}),layout:nt.z.object({version:nt.z.literal(1),managed_namespace:nt.z.string().min(1).default(".agents/managed"),project_namespace:nt.z.string().min(1).default(".agents/project")}).default({version:1,managed_namespace:".agents/managed",project_namespace:".agents/project"}),profile:nt.z.object({id:nt.z.string().min(1).default("zaip-aios-stack")}),paths:nt.z.object({specs:nt.z.string().min(1).default(".agents/specs"),changes:nt.z.string().min(1).default(".agents/changes"),tasks:nt.z.string().min(1).default(".agents/tasks"),decisions:nt.z.string().min(1).default(".agents/decisions"),runs:nt.z.string().min(1).default(".agents/runs")}).default({specs:".agents/specs",changes:".agents/changes",tasks:".agents/tasks",decisions:".agents/decisions",runs:".agents/runs"}),agents:nt.z.array(nt.z.enum(["codex","claude"])).default(["codex","claude"])}).strict(),WY=nt.z.toJSONSchema(Am);id=class{constructor(t,n=".agents/manifest.yaml"){this.filesystem=t;this.path=n}filesystem;path;async read(){return S6(ht(await this.filesystem.readText(this.path)))}async write(t){await this.filesystem.writeTextAtomic(this.path,Fr(Am.parse(t)))}}});function vs(e){let t=e.match(/^([A-Z]+(?:-[A-Z]+)*)-(\d{4})-(\d{2})-(\d{2})-\d{2}-\d{2}-/);if(t?.[1]===void 0||t[2]===void 0||t[3]===void 0||t[4]===void 0)throw new TypeError(`ID does not contain the canonical date: ${e}`);let[,n,i,r,o]=t,a=new Date(`${i}-${r}-${o}T00:00:00.000Z`);if(Number.isNaN(a.getTime())||String(a.getUTCFullYear()).padStart(4,"0")!==i||String(a.getUTCMonth()+1).padStart(2,"0")!==r||String(a.getUTCDate()).padStart(2,"0")!==o)throw new TypeError(`ID contains an invalid canonical date: ${e}`);return{prefix:n,year:i,month:r,day:o}}function Wi(e){let{year:t,month:n}=vs(e);return{year:t,month:n}}function bs(e,t){let{year:n,month:i}=Wi(t);return`${e}/${n}/${i}/${t}.md`}function sA(e,t){let{year:n,month:i}=Wi(t);return`${e}/${n}/${i}`}function xm(e,t){let{year:n,month:i,day:r}=vs(t);return`${e}/${n}/${i}/${r}`}var Om=P(()=>{"use strict"});var cA=P(()=>{"use strict"});var lA=P(()=>{"use strict";cA()});var uA=P(()=>{"use strict"});var dA=P(()=>{"use strict";uA()});var _A=P(()=>{"use strict"});var Rm,k6,pA=P(()=>{"use strict";Rm=class{#e;constructor(t){let n=new Map;for(let i of t){let r=n.get(i.from)??new Set;r.add(i.to),n.set(i.from,r)}this.#e=n}canTransition(t,n){return this.#e.get(t)?.has(n)??!1}assertTransition(t,n){if(!this.canTransition(t,n))throw new Error(`Invalid state transition: ${t} -> ${n}`)}nextStates(t){return[...this.#e.get(t)??[]]}},k6=new Rm([{from:"draft",to:"planned"},{from:"draft",to:"cancelled"},{from:"planned",to:"executing"},{from:"planned",to:"cancelled"},{from:"executing",to:"verifying"},{from:"executing",to:"blocked"},{from:"executing",to:"cancelled"},{from:"verifying",to:"completed"},{from:"verifying",to:"failed"},{from:"verifying",to:"blocked"},{from:"verifying",to:"cancelled"},{from:"blocked",to:"executing"},{from:"blocked",to:"cancelled"}])});async function mA(e){let[t,n]=await Promise.all([e.exists(gn),e.exists(ed)]);if(t!==n){let i=t?ed:gn;throw new Im(`Partial V2 configuration; missing ${i}`)}if(t&&n){let[i,r]=await Promise.all([new Yu(e).read(),new Qu(e).read()]);return E6(i,r)}if(await e.exists(".agents/manifest.yaml"))return A6(await new id(e).read());throw new Nm("Workspace has neither complete V2 config nor a legacy V1 manifest")}function E6(e,t){let n=t.layout.version,i=n===3?".agents/records":".agents/data";return{version:n,source:"project-config",project:e.project,projectConfig:e,frameworkLock:t,legacyManifest:null,supports:()=>!0,entityRoot:r=>`${i}/${jm[r]}`,activePath(r,o){yA(r,o);let a=this.entityRoot(r),s=n===3?sA(a,o):xm(a,o);return r==="change"?`${s}/${o}/change.md`:r==="execution"?`${s}/${o}/execution.md`:r==="run"?`${s}/${o}.jsonl`:`${s}/${o}.md`},legacyReadRoot(r){return n===3?`.agents/data/${jm[r]}`:hA($m,r)},legacyReadCandidate(r,o,a){return n===3?{path:Cm(".agents/data",r,o),readOnly:!0}:fA($m,r,o,a)},legacyReadCandidates(r,o,a){if(n===3)return[{path:Cm(".agents/records",r,o),readOnly:!0},{path:Cm(".agents/data",r,o),readOnly:!0}];let s=fA($m,r,o,a);return s===null?[]:[s]}}}function Cm(e,t,n){yA(t,n);let i=xm(`${e}/${jm[t]}`,n);return t==="change"?`${i}/${n}/change.md`:t==="execution"?`${i}/${n}/execution.md`:t==="run"?`${i}/${n}.jsonl`:`${i}/${n}.md`}function A6(e){let t={spec:od(`${e.paths.specs}/capabilities`),change:od(e.paths.changes),task:od(e.paths.tasks),run:od(e.paths.runs)};return{version:1,source:"legacy-manifest",project:e.project,projectConfig:null,frameworkLock:null,legacyManifest:e,supports:n=>n!=="prd"&&n!=="execution",entityRoot(n){let i=hA(t,n);if(i===null)throw Dm(n,1);return i},activePath(n,i,r){if(!this.supports(n))throw Dm(n,1);return gA(t,n,i,r)},legacyReadRoot:()=>null,legacyReadCandidate:()=>null,legacyReadCandidates:()=>[]}}async function T6(e,t,n,i,r){let o=t.activePath(n,i,r),a=t.legacyReadCandidates(n,i,r),[s,...l]=await Promise.all([e.exists(o),...a.map(f=>e.exists(f.path))]),c=a.filter((f,h)=>l[h]).map(f=>f.path),d=c[0]??a[0]?.path??null,u=c.length>0;if(!s&&!u)return{state:"missing",activePath:o,legacyPath:d};if(s&&!u)return{state:"active-only",activePath:o,legacyPath:d};let _=await Promise.all([...s?[e.readText(o)]:[],...c.map(f=>e.readText(f))]);if(!s){let[f,...h]=_;return{state:h.every(k=>k===f)?"legacy-only":"duplicate-divergent",activePath:o,legacyPath:d}}let[p,...v]=_;return{state:v.every(f=>f===p)?"duplicate-identical":"duplicate-divergent",activePath:o,legacyPath:d}}async function Ss(e,t,n,i,r){let o=await T6(e,t,n,i,r);if(o.state==="duplicate-divergent")throw new Lm(`Divergent ${n} ${i} exists in active and legacy layouts: ${o.activePath}, ${o.legacyPath}`);return o.state==="missing"?null:o.state==="legacy-only"?o.legacyPath:o.activePath}function fA(e,t,n,i){return t==="prd"||t==="execution"||t==="spec"&&i?.legacyCapability===void 0?null:{path:gA(e,t,n,i),readOnly:!0}}function gA(e,t,n,i){if(vA(t,n),t==="prd"||t==="execution")throw Dm(t,1);if(t==="spec"){let r=i?.legacyCapability;if(r===void 0||!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(r))throw new Wr("Legacy spec lookup requires a canonical legacyCapability");return`${e.spec}/${r}/spec.md`}if(Wi(n),t==="change"){let{year:r,month:o}=Wi(n);return`${e.change}/${r}/${o}/${n}/proposal.md`}return t==="task"?bs(e.task,n):bs(e.run,n)}function hA(e,t){return t==="prd"||t==="execution"?null:e[t]}function yA(e,t){vA(e,t),vs(t)}function vA(e,t){let n=w6[e];if(!t.startsWith(`${n}-`))throw new Mm(`Expected ${e} id to start with ${n}-: ${t}`)}function od(e){if(e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||e.endsWith("/")||/^[A-Za-z]:/.test(e)||e.split("/").some(t=>t.length===0||t==="."||t===".."))throw new Wr(`Workspace layout path is not canonical: ${e}`);return e}function Dm(e,t){return new Pm(`Layout V${t} does not support ${e}`)}var Wr,Im,Nm,Pm,Mm,Lm,w6,jm,$m,bA=P(()=>{"use strict";bm();Tm();Om();Wr=class extends Error{name="WorkspaceLayoutError"},Im=class extends Wr{name="PartialWorkspaceConfigError"},Nm=class extends Wr{name="WorkspaceLayoutNotFoundError"},Pm=class extends Wr{name="UnsupportedLayoutEntityError"},Mm=class extends Wr{name="ArtifactKindMismatchError"},Lm=class extends Wr{name="InactiveLayoutConflictError"},w6={prd:"PRD",spec:"SPEC",change:"CHG",task:"TASK",execution:"EXEC",run:"RUN"},jm={prd:"prds",spec:"specs",change:"changes",task:"tasks",execution:"executions",run:"runs"},$m={spec:".agents/specs/capabilities",change:".agents/changes",task:".agents/tasks",run:".agents/runs"}});var vt=P(()=>{"use strict";Cp();QS();Pp();bm();YE();tA();nA();oA();km();aA();Tm();wm();No();Om();lA();dA();_A();pA();bA();hs()});var Um=P(()=>{"use strict";vt()});function ad(e,t,n){let i=`${e} ${t} ${n}`.toLowerCase();return i.includes("claude")||i.includes("anthropic")?"anthropic":i.includes("gpt")||i.includes("openai")||i.includes("codex")?"openai":null}function SA(e){let t=Math.max(e.inputTokens-e.cachedInputTokens,0),n=zm(t/1e6*e.inputRate*e.inputMultiplier),i=zm(e.cachedInputTokens/1e6*(e.cachedInputRate??0)*e.inputMultiplier),r=zm(e.outputTokens/1e6*e.outputRate*e.outputMultiplier);return{inputUsd:n,cachedInputUsd:i,outputUsd:r,reasoningUsd:0}}var zm,kA=P(()=>{"use strict";zm=e=>Math.round(e*1e6)/1e6});function qm(e){let t=a=>typeof a=="object"&&a!==null&&!Array.isArray(a),n=a=>typeof a=="number"&&Number.isFinite(a)?a:null,i=a=>a.length===0||a.some(s=>s===null)?null:a.reduce((s,l)=>s+(l??0),0),r=e.map(a=>t(a.historical_cost)?a.historical_cost:null),o=e.map(a=>t(a.time)?a.time:null);return{invocation_count:e.length,cost:{estimated_usd:i(r.map(a=>a===null?null:n(a.estimated_usd))),estimated_brl:i(r.map(a=>a===null?null:n(a.estimated_brl))),observed_count:r.filter(a=>a!==null).length,unavailable_count:r.filter(a=>a===null).length},time:{duration_ms:i(o.map(a=>a===null?null:n(a.duration_ms))),latency_ms:i(o.map(a=>a===null?null:n(a.latency_ms))),duration_observed_count:o.filter(a=>a!==null&&n(a.duration_ms)!==null).length,latency_observed_count:o.filter(a=>a!==null&&n(a.latency_ms)!==null).length},groups:x6(e)}}function x6(e){let t=new Map;for(let r of e)typeof r.agent_invocation_id=="string"&&t.set(r.agent_invocation_id,r);return{...Object.fromEntries(Object.entries({phases:"phase",tasks:"task_id",specs:"spec_id",prds:"prd_id",executions:"execution_id",agents:"zaip_agent"}).map(([r,o])=>[r,Fm(t.values(),a=>typeof a[o]=="string"?[a[o]]:[])])),providers:Fm(t.values(),r=>wA(r,"provider")),models:Fm(t.values(),r=>wA(r,"model"))}}function Fm(e,t){let n=new Map;for(let i of e)for(let r of new Set(t(i)))n.set(r,(n.get(r)??0)+1);return Object.fromEntries([...n.entries()].sort())}function wA(e,t){return Array.isArray(e.usage_segments)?e.usage_segments.flatMap(n=>typeof n=="object"&&n!==null&&t in n&&typeof n[t]=="string"?[n[t]]:[]):[]}var Vm=P(()=>{"use strict"});var Wm=P(()=>{"use strict"});var EA=P(()=>{"use strict"});var AA=P(()=>{"use strict";Zr()});function TA(e,t=null){let n=$6(e).filter(r=>t===null||I6(r,t)),i=C6(n);return{scope_id:t,run_count:n.length,run_coverage:{usage:sd(n,r=>r.effective_usage_records.length>0),tokens:sd(n,r=>r.effective_usage_records.some(o=>xA(o)!==null)),usd:sd(n,r=>r.effective_usage_records.some(o=>o.cost.usd!==null)),brl:sd(n,r=>r.effective_usage_records.some(o=>o.cost.brl!==null))},attribution:{attributed_runs:n.filter(r=>r.run.attribution_status==="attributed").length,legacy_unattributed_runs:n.filter(r=>r.run.attribution_status==="legacy_unattributed").length},conversation:gi(i.filter(({event:r})=>r.phase==="conversation")),planning:gi(i.filter(({event:r})=>r.phase==="planning")),execution:gi(i.filter(({event:r})=>r.phase==="execution")),total:gi(i),work_types:{new:gi(i.filter(({run:r})=>r.run.work_type==="new")),rework:gi(i.filter(({run:r})=>r.run.work_type==="rework"))},cohorts:{v2_live:gi(i.filter(({run:r})=>r.run.attribution_status==="attributed")),legacy_imported:gi(i.filter(({run:r})=>r.run.attribution_status==="legacy_unattributed"))}}}function sd(e,t){let n=e.filter(t).length,i=e.length-n;return{known_runs:n,unknown_runs:i,complete:i===0,coverage_ratio:e.length===0?1:n/e.length}}function $6(e){let t=new Map;for(let n of e){let i=t.get(n.run.run_id);if(i!==void 0){if(JSON.stringify(i.records)!==JSON.stringify(n.records))throw new Error(`Divergent duplicate Run V2 fold: ${n.run.run_id}`);continue}t.set(n.run.run_id,n)}return[...t.values()]}function C6(e){let t=new Map;for(let n of e)for(let i of n.effective_usage_records){let r=t.get(i.event_id);if(r!==void 0){if(JSON.stringify(r.event)!==JSON.stringify(i))throw new Error(`Divergent duplicate usage event: ${i.event_id}`);continue}t.set(i.event_id,{run:n,event:i})}return[...t.values()]}function I6(e,t){return[e.run.run_id,e.run.conversation_id,e.run.execution_id,e.run.task_id,e.run.spec_id,e.run.prd_id,e.run.change_id].includes(t)}function gi(e){let t=e.map(({event:o})=>o),n=t.map(o=>xA(o)),i={input:t.map(o=>o.tokens.input),cached_input:t.map(o=>o.tokens.cached_input),output:t.map(o=>o.tokens.output),reasoning:t.map(o=>o.tokens.reasoning),total:n},r={usd:t.map(o=>o.cost.usd),brl:t.map(o=>o.cost.brl)};return{usage_event_count:t.length,tokens:{input:Bi(t.map(o=>o.tokens.input)),cached_input:Bi(t.map(o=>o.tokens.cached_input)),output:Bi(t.map(o=>o.tokens.output)),reasoning:Bi(t.map(o=>o.tokens.reasoning)),total:Bi(n)},cost:{usd:Bi(t.map(o=>o.cost.usd)),brl:Bi(t.map(o=>o.cost.brl))},coverage:{events:t.length,tokens:n.filter(o=>o!==null).length,usd:t.filter(o=>o.cost.usd!==null).length,brl:t.filter(o=>o.cost.brl!==null).length},known:{tokens:{input:Zi(i.input),cached_input:Zi(i.cached_input),output:Zi(i.output),reasoning:Zi(i.reasoning),total:Zi(i.total)},cost:{usd:Zi(r.usd),brl:Zi(r.brl)}}}}function Zi(e){let t=e.filter(i=>i!==null),n=e.length-t.length;return{known_sum:t.reduce((i,r)=>i+r,0),unknown_event_count:n,complete:n===0,coverage_ratio:e.length===0?1:t.length/e.length}}function xA(e){if(e.tokens.total!==null)return e.tokens.total;let{input:t,output:n}=e.tokens;return t===null||n===null?null:t+n}function Bi(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}var OA=P(()=>{"use strict"});var We,Bo,N6,M9,RA=P(()=>{"use strict";We=He(Xe(),1),Bo=We.z.number().finite().nonnegative().nullable(),N6=We.z.object({task_id:We.z.string().min(1),completed:We.z.boolean(),completed_at:We.z.string().min(1).nullable(),attempt:We.z.number().int().nonnegative().nullable(),attempt_id:We.z.string().min(1).nullable().optional(),equivalence_key:We.z.string().min(1).nullable().optional(),model:We.z.string().min(1).nullable(),reasoning_effort:We.z.enum(["low","medium","high","xhigh"]).nullable(),baseline_task_id:We.z.string().min(1).nullable(),baseline_attempt_id:We.z.string().min(1).nullable().optional(),baseline_equivalence_id:We.z.string().min(1).nullable(),observed_cost_usd:Bo,baseline_observed_cost_usd:Bo,quality_score:Bo,quality_floor:Bo,rework_count:We.z.number().int().nonnegative().nullable(),billed_amount:Bo.optional(),billed_currency:We.z.string().min(1).nullable().optional(),billed_provenance:We.z.enum(["observed","inferred","unavailable"]).nullable().optional(),billed_source_id:We.z.string().min(1).nullable().optional(),billed_at:We.z.string().min(1).nullable().optional(),baseline_billed_amount:Bo.optional(),baseline_billed_currency:We.z.string().min(1).nullable().optional(),baseline_billed_provenance:We.z.enum(["observed","inferred","unavailable"]).nullable().optional(),baseline_billed_source_id:We.z.string().min(1).nullable().optional(),baseline_billed_at:We.z.string().min(1).nullable().optional()}).strict(),M9=We.z.object({timezone:We.z.string().min(1),interval:We.z.object({start:We.z.string().min(1),end:We.z.string().min(1)}).strict(),equivalence_key:We.z.string().min(1).nullable().optional(),tasks:We.z.array(N6)}).strict()});var $A=P(()=>{"use strict"});var CA=P(()=>{"use strict"});var IA=P(()=>{"use strict";CA()});async function Zm(e,t){let n=Ho(t.from),i=Ho(t.to,!0);if(n>i)throw new RangeError("Manifest query from must not be after to");let r=t.offset??0,o=t.limit??100;if(!Number.isSafeInteger(r)||r<0||!Number.isSafeInteger(o)||o<1||o>500)throw new RangeError("Manifest page pagination is invalid");let a=t.filters??{},s=v=>Object.keys(a).every(f=>(a[f]?.length??0)===0||(v[f]??[]).some(h=>a[f]?.includes(h))),l=[],c=new Date(n);for(c.setUTCDate(1),c.setUTCHours(0,0,0,0);c.getTime()<=i;){let v=c.getUTCFullYear(),f=c.getUTCMonth()+1,h=`.agents/records/telemetry/${v}/${String(f).padStart(2,"0")}`,k=`${h}/manifest.json`;c.setUTCMonth(c.getUTCMonth()+1);let w=e.listFiles===void 0?await e.exists(k)?[k]:[]:await e.listFiles(h,"manifest.json");for(let O of w){let g=await PA(e,O,t.cache),b=JSON.parse(g),{manifest_hash:T,...I}=b;if(typeof T!="string"||!Array.isArray(b.chunks)||await MA(JSON.stringify(I))!==T)throw new Error(`Invalid invocation manifest: ${O}`);for(let R of b.chunks)!P6(R)||Ho(R.from)>i||Ho(R.to,!0)<n||R.dimensions!==void 0&&!s(R.dimensions)||l.push(R)}}let d=new Map,u=r+o+1,_=0;for(let v of l.sort((f,h)=>h.to.localeCompare(f.to)||h.path.localeCompare(f.path))){let f=[...d.values()].sort(NA)[u-1]?.occurred_at;if(f!==void 0&&v.to<f)break;let h=await PA(e,v.path,t.cache);if(await MA(h)!==v.content_sha256)throw new Error(`Invocation chunk hash mismatch: ${v.path}`);let k=h.split(/\r?\n/).filter(Boolean);if(k.length!==v.summary_count)throw new Error(`Invocation chunk summary count mismatch: ${v.path}`);let w=new Set(v.summary_hashes);for(let O of k){let g=JSON.parse(O);if(!M6(g)||!w.has(g.summary_hash))throw new Error(`Invalid Invocation Summary in ${v.path}`);if(Ho(g.occurred_at)<n||Ho(g.occurred_at)>i||!s(L6(g)))continue;let b=d.get(g.agent_invocation_id);if(b!==void 0&&b.summary_hash!==g.summary_hash)throw new Error(`Divergent Invocation Summary: ${g.agent_invocation_id}`);d.set(g.agent_invocation_id,g)}_+=1}let p=[...d.values()].sort(NA);return{summaries:p.slice(r,r+o),offset:r,limit:o,has_more:p.length>r+o,total:null,chunk_count:_}}function Ho(e,t=!1){let n=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T${t?"23:59:59.999":"00:00:00.000"}Z`:e);if(!Number.isFinite(n))throw new RangeError(`Invalid manifest query timestamp: ${e}`);return n}function NA(e,t){return t.occurred_at.localeCompare(e.occurred_at)||e.agent_invocation_id.localeCompare(t.agent_invocation_id)}function P6(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.content_sha256=="string"&&typeof e.summary_count=="number"&&Array.isArray(e.summary_hashes)}function M6(e){return typeof e=="object"&&e!==null&&typeof e.agent_invocation_id=="string"&&typeof e.occurred_at=="string"&&typeof e.summary_hash=="string"&&Array.isArray(e.usage_segments)}function L6(e){return{providers:e.usage_segments.flatMap(t=>t.provider===null?[]:[t.provider]),models:e.usage_segments.flatMap(t=>t.model===null?[]:[t.model]),zaip_agents:e.zaip_agent===null?[]:[e.zaip_agent],phases:e.phase===null?[]:[e.phase],purposes:e.purpose===null?[]:[e.purpose],statuses:e.status===null?[]:[e.status],executions:e.execution_id===null?[]:[e.execution_id],tasks:e.task_id===null?[]:[e.task_id],specs:e.spec_id===null?[]:[e.spec_id],prds:e.prd_id===null?[]:[e.prd_id],changes:e.change_id===null?[]:[e.change_id]}}async function PA(e,t,n){let i=n?.get(t);if(i!==void 0)return i;let r=await e.readText(t);return n?.set(t,r),r}async function MA(e){return[...new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e)))].map(t=>t.toString(16).padStart(2,"0")).join("")}var LA=P(()=>{"use strict"});async function DA(e,t){let n=O=>typeof O=="object"&&O!==null&&!Array.isArray(O),i=async O=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(O)))].map(g=>g.toString(16).padStart(2,"0")).join(""),r=(O,g=!1)=>{let b=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(O)?`${O}T${g?"23:59:59.999":"00:00:00.000"}Z`:O);if(!Number.isFinite(b))throw new RangeError(`Invalid manifest query timestamp: ${O}`);return b},o=r(t.from),a=r(t.to,!0);if(o>a)throw new RangeError("Manifest query from must not be after to");let s=t.page??1,l=t.page_size??100;if(!Number.isSafeInteger(s)||s<1||!Number.isSafeInteger(l)||l<1||l>500)throw new RangeError("Manifest query pagination is invalid");let c=new Map,d=[],u=[],_=0,p=0,v=t.filters??{},f=O=>Object.keys(v).every(g=>(v[g]?.length??0)===0||(O[g]??[]).some(b=>v[g]?.includes(b))),h=new Date(o);for(h.setUTCDate(1),h.setUTCHours(0,0,0,0);h.getTime()<=a;){t.signal?.throwIfAborted();let O=h.getUTCFullYear(),g=h.getUTCMonth()+1,b=`.agents/records/telemetry/${O}/${String(g).padStart(2,"0")}`,T=`${b}/manifest.json`;h.setUTCMonth(h.getUTCMonth()+1);let I=e.listFiles===void 0?await e.exists(T)?[T]:[]:await e.listFiles(b,"manifest.json");for(let R of I){let U=t.cache?.get(R)??await e.readText(R);t.cache?.set(R,U);let V=JSON.parse(U);if(!n(V)||typeof V.manifest_hash!="string"||!Array.isArray(V.chunks)||!n(V.period)||V.period.year!==O||V.period.month!==g)throw new Error(`Invalid invocation manifest: ${R}`);let{manifest_hash:y,...S}=V;if(await i(JSON.stringify(S))!==y)throw new Error(`Invocation manifest hash mismatch: ${R}`);_+=1,typeof V.source_latest_at=="string"&&d.push(V.source_latest_at),typeof V.lag_ms=="number"&&u.push(V.lag_ms);for(let x of V.chunks){if(!n(x)||typeof x.path!="string"||typeof x.from!="string"||typeof x.to!="string"||typeof x.content_sha256!="string"||!Array.isArray(x.summary_hashes)||r(x.from)>a||r(x.to,!0)<o||n(x.dimensions)&&!f(x.dimensions))continue;t.signal?.throwIfAborted();let W=t.cache?.get(x.path)??await e.readText(x.path);if(t.cache?.set(x.path,W),await i(W)!==x.content_sha256)throw new Error(`Invocation chunk hash mismatch: ${x.path}`);let ce=W.split(/\r?\n/).filter(Boolean);if(typeof x.summary_count=="number"&&ce.length!==x.summary_count)throw new Error(`Invocation chunk summary count mismatch: ${x.path}`);let ee=new Set(x.summary_hashes.filter(ge=>typeof ge=="string"));for(let ge of ce){let L=JSON.parse(ge);if(!n(L)||typeof L.agent_invocation_id!="string"||typeof L.occurred_at!="string"||typeof L.summary_hash!="string")throw new Error(`Invalid Invocation Summary in ${x.path}`);if(!ee.has(L.summary_hash))throw new Error(`Invocation Summary hash mismatch: ${L.agent_invocation_id}`);let le=r(L.occurred_at),B=Array.isArray(L.usage_segments)?L.usage_segments.filter(n):[],me={providers:B.flatMap(Me=>typeof Me.provider=="string"?[Me.provider]:[]),models:B.flatMap(Me=>typeof Me.model=="string"?[Me.model]:[]),zaip_agents:typeof L.zaip_agent=="string"?[L.zaip_agent]:[],phases:typeof L.phase=="string"?[L.phase]:[],purposes:typeof L.purpose=="string"?[L.purpose]:[],statuses:typeof L.status=="string"?[L.status]:[],executions:typeof L.execution_id=="string"?[L.execution_id]:[],tasks:typeof L.task_id=="string"?[L.task_id]:[],specs:typeof L.spec_id=="string"?[L.spec_id]:[],prds:typeof L.prd_id=="string"?[L.prd_id]:[],changes:typeof L.change_id=="string"?[L.change_id]:[]};if(le<o||le>a||!f(me))continue;let Ie=c.get(L.agent_invocation_id);if(Ie?.summary_hash!==void 0&&Ie.summary_hash!==L.summary_hash)throw new Error(`Divergent Invocation Summary: ${L.agent_invocation_id}`);c.set(L.agent_invocation_id,L)}p+=1}}}let k=[...c.values()].sort((O,g)=>String(g.occurred_at).localeCompare(String(O.occurred_at))||String(O.agent_invocation_id).localeCompare(String(g.agent_invocation_id))),w=(s-1)*l;return{summaries:k.slice(w,w+l),total:k.length,page:s,page_size:l,has_more:w+l<k.length,manifest_count:_,chunk_count:p,source_latest_at:d.sort().at(-1)??null,lag_ms:u.length===0?null:Math.max(...u),aggregate:qm(k)}}function jA(e){return Math.round(e*1e6)/1e6}function Gi(e){let t=e.provider??ad(e.model,"",""),n=e.model.toLowerCase(),i=b=>{let T=b.toLowerCase();if(n===T)return!0;let I=n.slice(T.length);return I.startsWith("@")||I.startsWith(":")||I.startsWith("/")||/^-\d{4}-\d{2}-\d{2}(?:$|[.:@/])/.test(I)},r=e.catalog.models.find(b=>i(b.id)||b.aliases.some(T=>i(T)));if(!r||t!==null&&r.provider!==t)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:null,pricing_source:null,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let o=e.usage.cached_input,a=e.usage.input,s=e.usage.output;if(a===null||o===null||s===null)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let l=e.usage.reasoning??0,c=r.long_context_threshold_tokens!==null&&(e.usage.input??0)>r.long_context_threshold_tokens,d=c?r.long_context_input_multiplier:1,u=c?r.long_context_output_multiplier:1,_=e.serviceTier==="priority"||e.serviceTier==="fast";if(_&&c)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let p=_?r.priority_input_per_million_usd??null:r.input_per_million_usd,v=_?r.priority_output_per_million_usd??null:r.output_per_million_usd;if(p===null||v===null)return{estimated_usd:null,estimated_brl:null,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null};let{inputUsd:f,cachedInputUsd:h,outputUsd:k,reasoningUsd:w}=SA({inputTokens:a,cachedInputTokens:o,outputTokens:s,reasoningTokens:l,inputRate:p,cachedInputRate:_?r.priority_cached_input_per_million_usd??null:r.cached_input_per_million_usd,outputRate:v,reasoningRate:_?r.priority_reasoning_per_million_usd??null:r.reasoning_per_million_usd,inputMultiplier:d,outputMultiplier:u}),O=jA(f+h+k+w),g=e.fxRate===null||e.fxRate===void 0?null:jA(O*e.fxRate.rate);return{estimated_usd:O,estimated_brl:g,fx_rate:e.fxRate?.rate??null,pricing_model:r.id,pricing_source:r.source_label,input_usd:f,cached_input_usd:h,output_usd:k,reasoning_usd:w}}var Q,Hi,D6,Ki,Ji,UA,zA,U6,O6,R6,hi,Zr=P(()=>{"use strict";Q=He(Xe(),1);Um();kA();Vm();Wm();Um();EA();AA();OA();RA();$A();IA();Wm();LA();Vm();Hi=Q.z.string().datetime({offset:!0}).or(Q.z.string().datetime()),D6=Q.z.object({id:Q.z.string().min(1),provider:Q.z.enum(["openai","anthropic"]),aliases:Q.z.array(Q.z.string().min(1)).default([]),input_per_million_usd:Q.z.number().nonnegative(),cached_input_per_million_usd:Q.z.number().nonnegative().nullable().default(null),output_per_million_usd:Q.z.number().nonnegative(),reasoning_per_million_usd:Q.z.number().nonnegative().nullable().default(null),priority_input_per_million_usd:Q.z.number().nonnegative().nullable().optional(),priority_cached_input_per_million_usd:Q.z.number().nonnegative().nullable().optional(),priority_output_per_million_usd:Q.z.number().nonnegative().nullable().optional(),priority_reasoning_per_million_usd:Q.z.number().nonnegative().nullable().optional(),reasoning_billed_separately:Q.z.boolean().default(!1),long_context_threshold_tokens:Q.z.number().int().positive().nullable().default(null),long_context_input_multiplier:Q.z.number().positive().default(1),long_context_output_multiplier:Q.z.number().positive().default(1),source_label:Q.z.string().min(1),source_url:Q.z.string().url(),notes:Q.z.array(Q.z.string()).default([])}).strict(),Ki=Q.z.object({schema_version:Q.z.literal(1),updated_at:Hi,source:Q.z.string().min(1),disclaimer:Q.z.string().min(1),models:Q.z.array(D6)}).strict(),Ji=Q.z.object({schema_version:Q.z.literal(1),base:Q.z.literal("USD"),quote:Q.z.literal("BRL"),rate:Q.z.number().positive(),as_of:Hi,source_label:Q.z.string().min(1),source_url:Q.z.string().url()}).strict(),UA=Q.z.object({input:Q.z.number().int().nonnegative().nullable(),cached_input:Q.z.number().int().nonnegative().nullable().default(null),output:Q.z.number().int().nonnegative().nullable(),reasoning:Q.z.number().int().nonnegative().nullable(),total:Q.z.number().int().nonnegative().nullable().default(null),source:Q.z.preprocess(e=>e==="client"?"provider_reported":e,Q.z.enum(["provider_reported","estimated","unavailable"]))}).strict(),zA=Q.z.object({estimated_usd:Q.z.number().nonnegative().nullable(),estimated_brl:Q.z.number().nonnegative().nullable(),fx_rate:Q.z.number().positive().nullable(),pricing_model:Q.z.string().nullable(),pricing_source:Q.z.string().nullable(),input_usd:Q.z.number().nonnegative().nullable().default(null),cached_input_usd:Q.z.number().nonnegative().nullable().default(null),output_usd:Q.z.number().nonnegative().nullable().default(null),reasoning_usd:Q.z.number().nonnegative().nullable().default(null)}).strict(),U6=Q.z.object({cycle_count:Q.z.number().int().nonnegative().nullable(),source:Q.z.enum(["repository","local-codex","manual","unavailable"]),segment_key:Q.z.string().nullable()}).strict(),O6=Q.z.object({schema_version:Q.z.literal(1),recorded_at:Hi,run_id:Q.z.string().startsWith("RUN-"),task_id:Q.z.string().startsWith("TASK-"),spec_id:Q.z.string().nullable(),change_id:Q.z.string().nullable(),task_title:Q.z.string().nullable(),task_status:Q.z.string().nullable(),client:Q.z.string().min(1),agent:Q.z.string().min(1),provider:Q.z.enum(["openai","anthropic"]).nullable(),model:Q.z.string().min(1),status:Q.z.enum(["running","completed","failed"]),started_at:Hi,finished_at:Hi.nullable(),duration_ms:Q.z.number().int().nonnegative().nullable(),token_usage:UA,estimated_cost:zA,telemetry:U6,source_segment_key:Q.z.string().nullable()}).strict(),R6=Q.z.object({schema_version:Q.z.literal(1),recorded_at:Hi,run_id:Q.z.string().startsWith("RUN-"),task_id:Q.z.string().startsWith("TASK-"),cycle_index:Q.z.number().int().nonnegative(),provider:Q.z.enum(["openai","anthropic"]).nullable(),model:Q.z.string().min(1),timestamp:Hi,source:Q.z.enum(["local-codex","manual"]),source_segment_key:Q.z.string().nullable(),token_usage:UA,estimated_cost:zA}).strict();hi=class{constructor(t,n=".agents/config/pricing/models.json",i=".agents/config/pricing/fx"){this.filesystem=t;this.modelsPath=n;this.fxBasePath=i}filesystem;modelsPath;fxBasePath;async readCatalog(){try{return Ki.parse(JSON.parse(await this.filesystem.readText(this.modelsPath)))}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return Ki.parse({schema_version:1,updated_at:new Date().toISOString(),source:"missing-local-pricing",disclaimer:"Tabela de pre\xC3\xA7os ausente no workspace.",models:[]});throw t}}async readLatestFxRate(){let t=`${this.fxBasePath}/current-usd-brl.json`;try{return Ji.parse(JSON.parse(await this.filesystem.readText(t)))}catch{}let n=[...await this.filesystem.listFiles(this.fxBasePath,".json")].sort().reverse();for(let i of n)try{return Ji.parse(JSON.parse(await this.filesystem.readText(i)))}catch{}return null}async writeCurrentFxRate(t){let n=Ji.parse({schema_version:1,base:"USD",quote:"BRL",rate:t,as_of:new Date().toISOString(),source_label:"Dashboard manual override",source_url:"https://www.bcb.gov.br/"});return await this.filesystem.writeTextAtomic(`${this.fxBasePath}/current-usd-brl.json`,`${JSON.stringify(n,null,2)}
213
+ `),n}}});function cd(e){return Math.max(F6,Math.floor(e/36e5)*36e5)}function ld(e){return e!=null&&Date.parse(e)>=Date.parse(Gt.cutoff)}function Ot(e,t){if(e==null)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let i=new Intl.DateTimeFormat("en-CA",{timeZone:z6,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(n),r=l=>i.find(c=>c.type===l)?.value,o=r("year"),a=r("month"),s=r("day");return o===void 0||a===void 0||s===void 0?null:t==="year"?o:t==="month"?`${o}-${a}`:`${o}-${a}-${s}`}var z6,Br,Gt,F6,Jo=P(()=>{"use strict";z6="America/Sao_Paulo",Br={"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},Gt={cutoff:"2026-08-02T03:14:00.000Z",cutoffDay:"2026-08-02",durationMs:Object.values(Br).reduce((e,t)=>e+t,0),costXlsxSha256:"C3EE0495667289FB81DD8F9268697CEB7692433C14CB19934C89B5F39129902A",operationsXlsxSha256:"94E9577A7CA27F7FDD277D81E34156296CB28FE39CF6D7636B259EBBB7E56BCC"},F6=76*36e5});function Es(e){let t=new Map;for(let i of e)t.has(i.id)||t.set(i.id,i);return[...t.values()].filter(i=>(i.phase===void 0||i.phase==="execution")&&i.parent_run_id==null)}function Hr(e){return o4(Es(e))}function o4(e){let t=e.flatMap(o=>{let a=typeof o.source_duration_ms=="number"&&o.source_duration_ms>=0?o.source_duration_ms:o.duration_ms,s=o.source_started_at??o.duration_started_at??o.started_at,l=Date.parse(s);return typeof a=="number"&&a>=0&&Number.isFinite(l)?[{start:l,end:l+a}]:[]}).sort((o,a)=>o.start-a.start);if(t.length===0)return null;let n=0,i=t[0].start,r=t[0].end;for(let o of t.slice(1))o.start<=r?r=Math.max(r,o.end):(n+=r-i,i=o.start,r=o.end);return n+r-i}var As=P(()=>{"use strict"});function s4(e){let t=e.alternatives.map(i=>`- ${i}`).join(`
214
+ `)||"Nenhuma.",n=e.consequences.map(i=>`- ${i}`).join(`
215
+ `)||"Nenhuma.";return`# ${e.title}
216
+
217
+ ## Decis\xE3o
218
+
219
+ ${e.decision}
220
+
221
+ ## Contexto
222
+
223
+ ${e.context}
224
+
225
+ ## Motivo
226
+
227
+ ${e.reason}
228
+
229
+ ## Alternativas
230
+
231
+ ${t}
232
+
233
+ ## Consequ\xEAncias
234
+
235
+ ${n}`}function c4(e){return e instanceof Error&&"code"in e}var Gm,dt,XA,YA,a4,Km,Yo,md,Xm=P(()=>{"use strict";Gm=require("node:path");vt();dt=He(Xe(),1),XA=dt.z.string().datetime({offset:!0}).or(dt.z.string().datetime()),YA=dt.z.string().regex(/^DEC-(?:HUMAN|AI)-/),a4=dt.z.enum(["architecture","contract","database","security","dependency","network","infrastructure","cost","implementation","rollback"]),Km=dt.z.object({schema_version:dt.z.literal(2),id:YA,title:dt.z.string().min(1),scope_type:dt.z.enum(["change","execution"]),scope_id:dt.z.string().min(1),origin:dt.z.enum(["human","agent"]),category:a4,context:dt.z.string().min(1),decision:dt.z.string().min(1),reason:dt.z.string().min(1),alternatives:dt.z.array(dt.z.string().min(1)),consequences:dt.z.array(dt.z.string().min(1)),reversible:dt.z.boolean(),rollback:dt.z.string().min(1),confidence:dt.z.number().min(0).max(1).nullable(),created_at:XA,confirmed_at:XA.nullable()}).strict().superRefine((e,t)=>{let n=e.scope_type==="change"?"CHG-":"EXEC-";e.scope_id.startsWith(n)||t.addIssue({code:"custom",path:["scope_id"],message:`${e.scope_type} decision requires ${n} scope_id`});let i=e.origin==="human"?"DEC-HUMAN-":"DEC-AI-";e.id.startsWith(i)||t.addIssue({code:"custom",path:["id"],message:`${e.origin} decision requires ${i} id`}),e.origin==="human"&&e.confidence!==null&&t.addIssue({code:"custom",path:["confidence"],message:"Human decisions do not use agent confidence"}),e.origin==="agent"&&e.confidence===null&&t.addIssue({code:"custom",path:["confidence"],message:"Agent decisions require confidence"}),e.origin==="human"&&e.confirmed_at===null&&t.addIssue({code:"custom",path:["confirmed_at"],message:"Human decisions require explicit confirmation provenance"})}),Yo=class extends Error{name="DecisionV2ConflictError"},md=class{constructor(t,n){this.filesystem=t;this.layout=n;if(n.version===1)throw new Error("Decision V2 requires a modern WorkspaceLayout")}filesystem;layout;async record(t){if(t.origin==="human"&&t.confirmed!==!0)throw new Error("Human decisions require confirmed: true from the caller");let n=t.clock??new Qe,i=n.now().toISOString(),r=t.id??Vi(t.origin==="human"?"DEC-HUMAN":"DEC-AI",t.shortName,{clock:n,...t.collisionCode===void 0?{}:{collisionCode:t.collisionCode},...t.timeZone===void 0?{}:{timeZone:t.timeZone}}),o=Km.parse({schema_version:2,id:r,title:t.title,scope_type:t.scopeType,scope_id:t.scopeId,origin:t.origin,category:t.category,context:t.context,decision:t.decision,reason:t.reason,alternatives:[...t.alternatives],consequences:[...t.consequences],reversible:t.reversible,rollback:t.rollback,confidence:t.confidence,created_at:i,confirmed_at:t.confirmed===!0?i:null}),a=this.path(o.scope_type,o.scope_id,o.id),s=ln({metadata:o,body:s4(o)});try{return await this.filesystem.writeTextExclusive(a,s),o}catch(l){if(!c4(l)||l.code!=="EEXIST")throw l;let c=await this.read(o.scope_type,o.scope_id,o.id);if(JSON.stringify(c)===JSON.stringify(o))return c;throw new Yo(`Divergent Decision V2 already exists: ${o.id}`)}}async read(t,n,i){let r=this.path(t,n,i),o=Ct(await this.filesystem.readText(r),Km).metadata;if(o.scope_type!==t||o.scope_id!==n||o.id!==i)throw new Yo(`Decision V2 metadata does not match its path: ${r}`);return o}async list(t){let i=(t?await this.filesystem.listFiles(this.decisionDirectory(t.type,t.id),".md"):(await Promise.all(["change","execution"].map(o=>this.filesystem.listFiles(this.layout.entityRoot(o),".md")))).flat()).filter(o=>/\/decisions\/DEC-(?:HUMAN|AI)-[^/]+\.md$/.test(o)).sort();return(await Promise.all(i.map(async o=>{let a=Ct(await this.filesystem.readText(o),Km).metadata;if(Gm.posix.basename(o,".md")!==a.id)throw new Yo(`Decision V2 id does not match filename: ${o}`);if(this.path(a.scope_type,a.scope_id,a.id)!==o)throw new Yo(`Decision V2 owner does not match path: ${o}`);return a}))).sort((o,a)=>o.created_at.localeCompare(a.created_at)||o.id.localeCompare(a.id))}path(t,n,i){return YA.parse(i),`${this.decisionDirectory(t,n)}/${i}.md`}decisionDirectory(t,n){let i=this.layout.activePath(t,n);return`${Gm.posix.dirname(i)}/decisions`}}});function eT(e,t){return e.entrypoint==="task"&&e.execution_id!==null&&e.task_id!==null&&e.change_id===null&&t.execution_id===e.execution_id&&t.task_id===e.task_id}var Xt,l4,QA,Ym=P(()=>{"use strict";Xt=He(Xe(),1),l4=Xt.z.string().datetime({offset:!0}).or(Xt.z.string().datetime()),QA=Xt.z.object({schema_version:Xt.z.literal(2),event_id:Xt.z.string().min(1).max(200),run_id:Xt.z.string().startsWith("RUN-"),sequence:Xt.z.number().int().positive(),occurred_at:l4,type:Xt.z.literal("run.attribution.recovered"),phase:Xt.z.literal("execution"),execution_id:Xt.z.string().startsWith("EXEC-"),task_id:Xt.z.string().startsWith("TASK-"),change_id:Xt.z.string().startsWith("CHG-")}).strict()});function Qm(e,t){return e.coverage==="partial"&&t.coverage==="complete"&&e.call_id===t.call_id&&e.agent_invocation_id===t.agent_invocation_id&&e.source_call_key===t.source_call_key&&JSON.stringify(e.tokens)===JSON.stringify(t.tokens)}function eg(e,t,n){return e.type==="usage.recorded"&&e.retrospective_correction===!0&&e.activity_kind==="retrospective_local_remeasurement"&&e.supersedes_event_id!==null&&n.has(e.supersedes_event_id)&&e.phase===t.phase}function gd(e,t){let n={conversation:0,planning:1,execution:2};if(n[t]<n[e])throw new Error(`Run V2 phase cannot move backward from ${e} to ${t}`)}var tT=P(()=>{"use strict"});function ig(e){return e.run_role==="owner"?"orchestrator":e.run_role==="contributor"?"subagent":e.run_role!==void 0?e.run_role:e.phase!=="execution"?"intake":e.parent_run_id===null?"orchestrator":"subagent"}function bT(e){return e.parent_run_id===null?"run":"subrun"}function ST(e){return e.run_purpose!==void 0?e.run_purpose:e.phase!=="execution"?"intake":e.agent==="agent-finalizer"||e.agent==="agent-task-finalizer"?"finalization":e.agent==="agent-reviewer"?"review":e.agent==="agent-auditor"?"audit":e.parent_run_id===null||ig(e)==="orchestrator"?"orchestration":"execution"}function kT(e){return e.requires_finalizer===!0}var $,Ar,hd,yd,_4,nT,rT,iT,oT,aT,tg,Xi,sT,U3,p4,cT,ng,lT,rg,uT,Yi,f4,dT,_T,pT,fT,mT,m4,gT,hT,yT,vT,g4,vd,bd=P(()=>{"use strict";vt();$=He(Xe(),1);Ym();tT();Xm();Ar=$.z.string().datetime({offset:!0}).or($.z.string().datetime()),hd=$.z.enum(["conversation","planning","execution"]),yd=$.z.string().startsWith("RUN-"),_4=$.z.string().startsWith("CONV-"),nT=$.z.string().startsWith("EXEC-").nullable(),rT=$.z.string().startsWith("TASK-").nullable(),iT=$.z.string().startsWith("SPEC-").nullable(),oT=$.z.string().startsWith("PRD-").nullable(),aT=$.z.string().startsWith("CHG-").nullable(),tg=yd.nullable(),Xi=$.z.string().regex(/^(?:AINV|INV)-/).max(200),sT=$.z.string().startsWith("MCALL-").max(200),U3=$.z.enum(["intake","orchestrator","subagent"]),p4=$.z.enum(["intake","orchestrator","subagent","owner","contributor"]),cT=$.z.enum(["intake","orchestration","execution","review","audit","finalization"]),ng=$.z.enum(["low","medium","high","xhigh"]),lT=$.z.enum(["orchestrator","delegated"]),rg=$.z.object({input:$.z.number().int().nonnegative().nullable(),cached_input:$.z.number().int().nonnegative().nullable(),output:$.z.number().int().nonnegative().nullable(),reasoning:$.z.number().int().nonnegative().nullable(),total:$.z.number().int().nonnegative().nullable(),source:$.z.enum(["provider_reported","estimated","unavailable"])}).strict().superRefine((e,t)=>{e.input!==null&&e.cached_input!==null&&e.cached_input>e.input&&t.addIssue({code:"custom",path:["cached_input"],message:"cached_input cannot exceed input"}),e.total!==null&&e.input!==null&&e.output!==null&&e.total<e.input+e.output&&t.addIssue({code:"custom",path:["total"],message:"total cannot be lower than input + output"})}),uT=$.z.object({usd:$.z.number().nonnegative().nullable(),brl:$.z.number().nonnegative().nullable(),fx_rate:$.z.number().positive().nullable().optional()}).strict(),Yi={schema_version:$.z.literal(2),event_id:$.z.string().min(1).max(200),run_id:yd,sequence:$.z.number().int().positive(),occurred_at:Ar},f4=$.z.object({intent:$.z.enum(["conversation","continue","refine","rework","new_work"]),classification_source:$.z.enum(["agent","explicit","fallback"]),confidence:$.z.number().min(0).max(1),reason_codes:$.z.array($.z.string().regex(/^[a-z][a-z0-9-]{0,63}$/)).min(1).max(12)}).strict(),dT=$.z.object({...Yi,type:$.z.literal("run.started"),attribution_status:$.z.enum(["attributed","legacy_unattributed"]),phase:hd,run_role:p4.optional(),run_purpose:cT.optional(),requires_finalizer:$.z.boolean().optional(),execution_kind:$.z.enum(["interaction","delivery"]).optional(),execution_eligibility:$.z.array($.z.enum(["interaction","delivery"])).optional(),entrypoint:$.z.enum(["conversation","task","spec","prd"]),work_type:$.z.enum(["new","rework"]),storage_mode:$.z.enum(["tracked_sanitized","local_only"]),client:$.z.string().min(1).max(100),agent:$.z.string().min(1).max(100),agent_name:$.z.string().min(1).max(100).nullable().optional(),agent_identity_warning:$.z.object({code:$.z.literal("deprecated-agent-identity"),kind:$.z.enum(["id","codex_name","codex_task_name"]),requested:$.z.string().min(1),canonical_id:$.z.string().min(1),deprecated_at:$.z.iso.date(),remove_after:$.z.iso.date()}).strict().optional(),provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200),reasoning_effort:ng.nullable().optional(),client_thread_id:$.z.string().min(1).max(200).nullable().optional(),client_turn_id:$.z.string().min(1).max(200).nullable().optional(),conversation_id:_4,execution_id:nT,task_id:rT,spec_id:iT,prd_id:oT,change_id:aT,parent_run_id:tg,continuation_of_run_id:tg,retry_of_run_id:tg,agent_invocation_id:Xi.optional(),root_agent_invocation_id:Xi.optional(),parent_agent_invocation_id:Xi.nullable().optional(),invocation_kind:lT.optional(),delegation_depth:$.z.number().int().nonnegative().optional(),intake:f4.nullable().optional()}).strict().superRefine((e,t)=>{e.phase==="execution"&&e.execution_id===null&&e.attribution_status!=="legacy_unattributed"&&t.addIssue({code:"custom",path:["execution_id"],message:"Execution phase requires execution_id"}),{conversation:e.conversation_id,task:e.task_id,spec:e.spec_id,prd:e.prd_id}[e.entrypoint]===null&&t.addIssue({code:"custom",path:[`${e.entrypoint}_id`],message:`${e.entrypoint} entrypoint requires its scope id`}),e.run_role==="orchestrator"&&e.parent_run_id!==null&&t.addIssue({code:"custom",path:["parent_run_id"],message:"orchestrator Run cannot have parent_run_id"}),e.run_role==="subagent"&&e.parent_run_id===null&&t.addIssue({code:"custom",path:["parent_run_id"],message:"subagent Sub-Run requires parent_run_id"});let i=e.agent_invocation_id!==void 0;i&&(e.root_agent_invocation_id===void 0||e.parent_agent_invocation_id===void 0||e.invocation_kind===void 0||e.delegation_depth===void 0)&&t.addIssue({code:"custom",path:["agent_invocation_id"],message:"Agent Invocation identity must be complete when present"}),i&&e.invocation_kind==="orchestrator"&&(e.parent_agent_invocation_id!==null||e.root_agent_invocation_id!==e.agent_invocation_id||e.delegation_depth!==0)&&t.addIssue({code:"custom",path:["invocation_kind"],message:"orchestrator Agent Invocation must be its root at depth zero"}),i&&e.invocation_kind==="delegated"&&(e.parent_agent_invocation_id===null||e.delegation_depth===0)&&t.addIssue({code:"custom",path:["parent_agent_invocation_id"],message:"delegated Agent Invocation requires a parent and positive depth"});for(let[r,o]of[["parent_run_id",e.parent_run_id],["continuation_of_run_id",e.continuation_of_run_id],["retry_of_run_id",e.retry_of_run_id]])o===e.run_id&&t.addIssue({code:"custom",path:[r],message:`${r} cannot reference itself`})}),_T=$.z.object({...Yi,type:$.z.literal("usage.recorded"),phase:hd,activity_kind:$.z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),classification_source:$.z.enum(["explicit","current_context","default","legacy_inferred"]),tokens:rg,cost:uT,provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),source_segment_key:$.z.string().min(1).max(500).nullable(),model_call_id:sT.nullable().optional(),runtime:$.z.object({reasoning_effort:$.z.string().min(1).max(40).nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict().optional(),supersedes_event_id:$.z.string().min(1).max(200).nullable(),retrospective_correction:$.z.literal(!0).optional(),source_occurred_at:Ar.optional(),source_started_at:Ar.optional(),source_finished_at:Ar.optional(),duration_ms:$.z.number().int().nonnegative().nullable().optional(),duration_provenance:$.z.enum(["observed","reconciled","legacy_inferred","estimated","unavailable"]).nullable().optional(),context_stats:$.z.object({initial_pack_tokens:$.z.number().int().nonnegative().nullable(),tool_output_tokens:$.z.number().int().nonnegative().nullable(),files_opened:$.z.number().int().nonnegative().nullable(),snippets_opened:$.z.number().int().nonnegative().nullable()}).strict().optional()}).strict(),pT=$.z.object({...Yi,type:$.z.literal("model.call.observed"),call_id:sT,agent_invocation_id:Xi,coverage:$.z.enum(["complete","partial","unavailable"]),tokens:rg,cost:uT,provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),source_call_key:$.z.string().min(1).max(500).nullable(),source_occurred_at:Ar.optional(),source_started_at:Ar.optional(),source_finished_at:Ar.optional(),runtime:$.z.object({reasoning_effort:$.z.string().min(1).max(40).nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict().optional()}).strict(),fT=$.z.object({schema_version:$.z.literal(1),run_id:yd,execution_id:nT.nullable().default(null),task_id:rT.nullable().default(null),spec_id:iT.nullable().default(null),prd_id:oT.nullable().default(null),change_id:aT.nullable().default(null),zaip_agent:$.z.string().min(1).max(100).nullable().default(null),phase:hd.nullable().default(null),purpose:cT.nullable().default(null),agent_invocation_id:Xi,root_agent_invocation_id:Xi,parent_agent_invocation_id:Xi.nullable(),invocation_kind:lT,delegation_depth:$.z.number().int().nonnegative(),client:$.z.enum(["codex","codex-desktop","codex-subagent"]),thread_id:$.z.string().min(1).max(200).nullable(),turn_id:$.z.string().min(1).max(200).nullable(),agent_path:$.z.string().min(1).max(500).nullable()}).strict().superRefine((e,t)=>{e.invocation_kind==="orchestrator"&&(e.parent_agent_invocation_id!==null||e.root_agent_invocation_id!==e.agent_invocation_id||e.delegation_depth!==0)&&t.addIssue({code:"custom",path:["invocation_kind"],message:"orchestrator telemetry correlation must be its root at depth zero"}),e.invocation_kind==="delegated"&&(e.parent_agent_invocation_id===null||e.delegation_depth===0)&&t.addIssue({code:"custom",path:["parent_agent_invocation_id"],message:"delegated telemetry correlation requires a parent and positive depth"}),e.client==="codex-subagent"&&(e.thread_id!==null||e.agent_path===null&&e.turn_id===null)&&t.addIssue({code:"custom",path:["agent_path"],message:"Codex subagent telemetry requires agent_path or turn_id and no root thread_id"}),e.client!=="codex-subagent"&&e.thread_id===null&&e.turn_id===null&&t.addIssue({code:"custom",path:["thread_id"],message:"Codex root telemetry requires thread_id or turn_id"})}),mT=$.z.object({correlation:fT,event_kind:$.z.enum(["response","usage","terminal","error"]),source:$.z.enum(["codex_app_server","codex_session_fallback","unavailable"]),source_event_key:$.z.string().min(1).max(500),source_method:$.z.enum(["item/completed","rawResponse/completed","thread/tokenUsage/updated","error","turn/completed"]).optional(),stream_boundary:$.z.enum(["item_completed","response_completed","usage_updated","error","turn_completed"]).optional(),source_occurred_at:Ar.nullable(),captured_at:Ar,coverage:$.z.enum(["complete","partial","unavailable"]),tokens:rg.nullable(),provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),runtime:$.z.object({reasoning_effort:$.z.string().min(1).max(40).nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict(),status:$.z.enum(["completed","failed","cancelled"]).nullable(),will_retry:$.z.boolean().nullable().optional(),latency_ms:$.z.number().int().nonnegative().nullable(),historical_cost:$.z.object({estimated_usd:$.z.number().nonnegative().nullable(),estimated_brl:$.z.number().nonnegative().nullable(),fx_rate:$.z.number().positive().nullable(),pricing_model:$.z.string().nullable(),pricing_source:$.z.string().nullable(),input_usd:$.z.number().nonnegative().nullable(),cached_input_usd:$.z.number().nonnegative().nullable(),output_usd:$.z.number().nonnegative().nullable(),reasoning_usd:$.z.number().nonnegative().nullable()}).strict().nullable().optional(),context_stats:$.z.object({initial_pack_tokens:$.z.number().int().nonnegative().nullable(),tool_output_tokens:$.z.number().int().nonnegative().nullable(),files_opened:$.z.number().int().nonnegative().nullable(),snippets_opened:$.z.number().int().nonnegative().nullable()}).strict().nullable(),discarded_counts:$.z.object({prompt:$.z.number().int().nonnegative(),response_text:$.z.number().int().nonnegative(),reasoning:$.z.number().int().nonnegative(),secrets:$.z.number().int().nonnegative()}).strict()}).strict().superRefine((e,t)=>{e.source==="codex_session_fallback"&&e.coverage==="complete"&&t.addIssue({code:"custom",path:["coverage"],message:"Codex session fallback coverage must be partial or unavailable"}),e.source==="unavailable"&&e.coverage!=="unavailable"&&t.addIssue({code:"custom",path:["coverage"],message:"Unavailable source requires unavailable coverage"}),e.source==="unavailable"&&(e.provider!==null||e.model!==null||e.runtime.reasoning_effort!==null||e.runtime.service_tier!==null||e.latency_ms!==null)&&t.addIssue({code:"custom",path:["source"],message:"Unavailable source cannot contain effective runtime observations"}),e.coverage==="unavailable"&&e.tokens!==null&&e.tokens.source!=="unavailable"&&t.addIssue({code:"custom",path:["tokens","source"],message:"Unavailable coverage cannot contain observed tokens"}),e.event_kind==="terminal"&&e.status===null&&t.addIssue({code:"custom",path:["status"],message:"Terminal telemetry requires status"}),e.event_kind==="error"&&(e.will_retry===!0&&e.status!==null||e.will_retry!==!0&&e.status!=="failed")&&t.addIssue({code:"custom",path:["status"],message:"Retrying errors require null status; terminal errors require failed status"})}),m4=$.z.object({schema_version:$.z.literal(1),event_id:$.z.string().startsWith("CEVT-").max(200),checksum_sha256:$.z.string().regex(/^[a-f0-9]{64}$/),compaction:$.z.object({status:$.z.enum(["pending","compacted"]),compacted_at:Ar.nullable()}).strict(),event:mT}).strict(),gT=$.z.string().startsWith("INV-").max(200),hT=$.z.object({...Yi,type:$.z.literal("model.selection.recorded"),invocation_id:gT,requested:$.z.object({model:$.z.string().min(1).max(200),reasoning_effort:ng.nullable(),velocity:$.z.literal("standard")}).strict(),selection:$.z.object({source:$.z.enum(["execution-override","task-override","auto-policy","project-default"]),policy_version:$.z.number().int().positive(),reasons:$.z.array($.z.string().regex(/^[a-z][a-z0-9-]{0,63}$/)).min(1).max(20)}).strict()}).strict(),yT=$.z.object({...Yi,type:$.z.literal("provider.invocation.finished"),invocation_id:gT,status:$.z.enum(["completed","failed","cancelled"]),effective:$.z.object({provider:$.z.string().min(1).max(100).nullable(),model:$.z.string().min(1).max(200).nullable(),reasoning_effort:ng.nullable(),service_tier:$.z.string().min(1).max(40).nullable()}).strict(),latency_ms:$.z.number().int().nonnegative().nullable()}).strict(),vT=$.z.object({...Yi,type:$.z.literal("run.finished"),phase:hd,status:$.z.enum(["completed","failed","cancelled"]),duration_ms:$.z.number().int().nonnegative().nullable().default(null),duration_provenance:$.z.enum(["observed","reconciled","legacy_inferred","estimated","unavailable"]).nullable().default(null)}).strict(),g4=$.z.object({...Yi,type:$.z.literal("run.finalization.decided"),finalizer_run_id:yd,outcome:$.z.enum(["completed","blocked","failed","cancelled"]),summary:$.z.string().min(1).max(4e3),evidence_ids:$.z.array($.z.string().min(1).max(200)).max(100),changed_files:$.z.array($.z.string().min(1).max(500)).max(1e4).default([])}).strict(),vd=$.z.discriminatedUnion("type",[dT,_T,pT,hT,yT,QA,g4,vT])});var W3,og=P(()=>{"use strict";bd();W3=64*1024});var ag=P(()=>{"use strict";vt();og();sg();og()});function TT(e){let t=new Map,n=[];for(let i of e){if(i.source_segment_key===null){n.push(i);continue}let r=t.get(i.source_segment_key);if(r===void 0){t.set(i.source_segment_key,i),n.push(i);continue}if(!xT(i,r))throw new Error(`Divergent duplicate source segment: ${i.source_segment_key}`)}return n}function xT(e,t){return JSON.stringify(AT(e))===JSON.stringify(AT(t))}function AT(e){return{phase:e.phase,activity_kind:e.activity_kind,classification_source:e.classification_source,tokens:e.tokens,cost:e.cost,provider:e.provider,model:e.model,source_segment_key:e.source_segment_key,model_call_id:e.model_call_id??null}}var OT=P(()=>{"use strict"});function Ts(e){let t=[],n=null;for(let i of e.split(/\r?\n/).map(r=>r.trim()).filter(Boolean)){let r=JSON.parse(i),o=Array.isArray(r)?w4(r,n):r,a=vd.parse(o);n??=a.run_id,t.push(a)}return t}function xs(e){let t=new Map;for(let h of e){let k=vd.parse(h),w=t.get(k.event_id);if(w!==void 0){if(JSON.stringify(w)!==JSON.stringify(k))throw new Error(`Divergent duplicate Run V2 event: ${k.event_id}`);continue}t.set(k.event_id,k)}let n=[...t.values()].sort((h,k)=>h.sequence-k.sequence);if(n.length===0||n[0]?.type!=="run.started")throw new Error("Run V2 stream must start with run.started");let i=n[0],r=i.phase,o=null,a=null,s=null,l=new Map,c=new Map,d=new Map,u=new Map,_=new Map;for(let[h,k]of n.entries()){if(k.run_id!==i.run_id)throw new Error("Run V2 stream mixes run ids");if(k.sequence!==h+1)throw new Error("Run V2 sequence must be contiguous");let w=l.get(k.sequence);if(w!==void 0&&w!==k.event_id)throw new Error(`Run V2 sequence is duplicated: ${k.sequence}`);if(l.set(k.sequence,k.event_id),h>0&&k.type==="run.started")throw new Error("Run V2 has multiple starts");if(o!==null&&!eg(k,o,c))throw new Error("Run V2 contains a non-retrospective record after run.finished");if(k.type==="usage.recorded"){if(gd(r,k.phase),k.phase==="execution"&&i.execution_id===null&&i.attribution_status!=="legacy_unattributed")throw new Error("Execution phase requires execution_id");if(k.supersedes_event_id!==null&&!c.has(k.supersedes_event_id))throw new Error(`Superseded usage event must occur earlier: ${k.supersedes_event_id}`);c.set(k.event_id,k),r=k.phase}if(k.type==="run.attribution.recovered"){if(!eT(i,k))throw new Error("Run attribution recovery does not match its immutable start header");if(s!==null)throw new Error("Run V2 has multiple attribution recoveries");gd(r,k.phase),r=k.phase,s=k}if(k.type==="model.selection.recorded"){if(E4(i,n.slice(0,h),{invocationId:k.invocation_id,requested:k.requested,selection:k.selection}),d.has(k.invocation_id))throw new Error(`Duplicate model selection for invocation: ${k.invocation_id}`);d.set(k.invocation_id,k)}if(k.type==="provider.invocation.finished"){if(!d.has(k.invocation_id))throw new Error(`Provider invocation requires earlier model selection: ${k.invocation_id}`);if(u.has(k.invocation_id))throw new Error(`Duplicate provider terminal for invocation: ${k.invocation_id}`);u.set(k.invocation_id,k)}if(k.type==="model.call.observed"){let O=_.get(k.call_id);if(O!==void 0&&JSON.stringify(O)!==JSON.stringify(k)&&!Qm(O,k))throw new Error(`Divergent duplicate Model Call: ${k.call_id}`);_.set(k.call_id,k)}if(k.type==="run.finalization.decided"){if(a!==null)throw new Error("Run V2 has multiple finalization decisions");a=k}if(k.type==="run.finished"){if(k.phase!==r)throw new Error("run.finished phase must match the latest phase");o=k}}let p=n.filter(h=>h.type==="usage.recorded"),v=new Set(p.map(h=>h.supersedes_event_id).filter(h=>h!==null)),f=TT(p.filter(h=>!v.has(h.event_id)));return{run:s===null?i:{...i,phase:s.phase,execution_id:s.execution_id,task_id:s.task_id,change_id:s.change_id},status:o?.status??"running",finished:o,finalization_decision:a,attribution_recovery:s,records:n,usage_records:p,effective_usage_records:f,model_selection_records:[...d.values()],provider_invocation_records:[...u.values()],model_call_records:[..._.values()]}}function w4(e,t){if(e[0]!==3||t===null)throw new Error("Run delta requires transport version 3 and a preceding run.started header");if(e[1]==="f")return{schema_version:2,type:"run.finished",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],phase:e[5],status:e[6]};if(e[1]==="a")return{schema_version:2,type:"run.attribution.recovered",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],phase:e[5],execution_id:e[6],task_id:e[7],change_id:e[8]};if(e[1]==="d"&&Array.isArray(e[8]))return{schema_version:2,type:"run.finalization.decided",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],finalizer_run_id:e[5],outcome:e[6],summary:e[7],evidence_ids:e[8],changed_files:Array.isArray(e[9])?e[9]:[]};if(e[1]==="m"&&Array.isArray(e[6])&&Array.isArray(e[7])){let d=e[6],u=e[7];return{schema_version:2,type:"model.selection.recorded",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],invocation_id:e[5],requested:{model:d[0],reasoning_effort:d[1],velocity:d[2]},selection:{source:u[0],policy_version:u[1],reasons:u[2]}}}if(e[1]==="p"&&Array.isArray(e[7])){let d=e[7];return{schema_version:2,type:"provider.invocation.finished",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],invocation_id:e[5],status:e[6],effective:{provider:d[0],model:d[1],reasoning_effort:d[2],service_tier:d[3]},latency_ms:e[8]}}if(e[1]==="c"&&Array.isArray(e[8])&&Array.isArray(e[9])){let d=e[8],u=e[9],_=e[16];return{schema_version:2,type:"model.call.observed",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],call_id:e[5],agent_invocation_id:e[6],coverage:e[7],tokens:{input:d[0],cached_input:d[1],output:d[2],reasoning:d[3],total:d[4],source:d[5]},cost:{usd:u[0],brl:u[1],fx_rate:u[2]??null},provider:e[10],model:e[11],source_call_key:e[12],...e[13]===null?{}:{source_occurred_at:e[13]},...e[14]===null||e[14]===void 0?{}:{source_started_at:e[14]},...e[15]===null||e[15]===void 0?{}:{source_finished_at:e[15]},..._===null||!Array.isArray(_)?{}:{runtime:{reasoning_effort:_[0],service_tier:_[1]}}}}if(e[1]!=="u"||!Array.isArray(e[8])||!Array.isArray(e[9]))throw new Error("Invalid Run transport v3 delta");let n=e[8],i=e[9],r=e[15],o=e[16],a=e[17],s=e[18],l=e[19],c=e[20];return{schema_version:2,type:"usage.recorded",run_id:t,event_id:e[2],sequence:e[3],occurred_at:e[4],phase:e[5],activity_kind:e[6],classification_source:e[7],tokens:{input:n[0],cached_input:n[1],output:n[2],reasoning:n[3],total:n[4],source:n[5]},cost:{usd:i[0],brl:i[1],fx_rate:i[2]??null},provider:e[10],model:e[11],source_segment_key:e[12],...c==null?{}:{model_call_id:c},supersedes_event_id:e[13],...e[14]===null?{}:{source_occurred_at:e[14]},...a==null?{}:{source_started_at:a},...s==null?{}:{source_finished_at:s},...l===!0?{retrospective_correction:!0}:{},...r===null||!Array.isArray(r)?{}:{context_stats:{initial_pack_tokens:r[0],tool_output_tokens:r[1],files_opened:r[2],snippets_opened:r[3]}},...o===null||!Array.isArray(o)?{}:{runtime:{reasoning_effort:o[0],service_tier:o[1]}}}}function E4(e,t,n){if(e.model!=="unknown"&&n.requested.model!==e.model)throw new Error(`Agent Run model is immutable: expected ${e.model}, received ${n.requested.model}`);if(e.reasoning_effort!==void 0&&e.reasoning_effort!==null&&n.requested.reasoning_effort!==e.reasoning_effort)throw new Error(`Agent Run reasoning effort is immutable: expected ${e.reasoning_effort}, received ${n.requested.reasoning_effort}`);let i=t.find(r=>r.type==="model.selection.recorded");if(i!==void 0){if(JSON.stringify(i.requested)!==JSON.stringify(n.requested))throw new Error(`Agent Run calls must inherit one model configuration: ${e.run_id}`);if(JSON.stringify(i.selection)!==JSON.stringify(n.selection))throw new Error(`Agent Run calls must inherit one selection decision: ${e.run_id}`)}}var RT=P(()=>{"use strict";Ym();bd();OT();ag()});var $T=P(()=>{"use strict"});var sg=P(()=>{"use strict";Xm();ag();bd();RT();$T()});var fe,Sd,A4,m5,g5,Os=P(()=>{"use strict";vt();fe=He(Xe(),1);sg();Sd=fe.z.string().datetime({offset:!0}),A4=fe.z.preprocess(e=>e==="client"?"provider_reported":e,fe.z.enum(["provider_reported","estimated","unavailable"])),m5=fe.z.object({id:fe.z.string().regex(/^DEC-(?:HUMAN|AI)-/),title:fe.z.string().min(1),origin:fe.z.enum(["human","agent"]),category:fe.z.enum(["architecture","contract","database","security","dependency","network","infrastructure","cost","implementation"]),status:fe.z.enum(["active","superseded","rejected"]),task:fe.z.string().startsWith("TASK-").nullable(),change:fe.z.string().startsWith("CHG-").nullable(),context:fe.z.string().min(1),decision:fe.z.string().min(1),reason:fe.z.string().min(1),alternatives:fe.z.array(fe.z.string()),consequences:fe.z.array(fe.z.string()),reversible:fe.z.boolean(),rollback:fe.z.string(),confidence:fe.z.number().min(0).max(1).nullable(),created_at:Sd,confirmed_at:Sd.nullable()}).strict(),g5=fe.z.object({id:fe.z.string().startsWith("RUN-"),task:fe.z.string().startsWith("TASK-"),status:fe.z.enum(["running","completed","failed"]),client:fe.z.string().min(1),agent:fe.z.string().min(1),model:fe.z.string().min(1),started_at:Sd,finished_at:Sd.nullable(),duration_ms:fe.z.number().int().nonnegative().nullable(),provider:fe.z.string().min(1).nullable().default(null),token_usage:fe.z.object({input:fe.z.number().int().nonnegative().nullable(),cached_input:fe.z.number().int().nonnegative().nullable().default(null),output:fe.z.number().int().nonnegative().nullable(),reasoning:fe.z.number().int().nonnegative().nullable(),total:fe.z.number().int().nonnegative().nullable().default(null),source:A4}),cost:fe.z.object({estimated_usd:fe.z.number().nonnegative().nullable(),estimated_brl:fe.z.number().nonnegative().nullable(),fx_rate:fe.z.number().positive().nullable(),pricing_model:fe.z.string().nullable(),pricing_source:fe.z.string().nullable(),input_usd:fe.z.number().nonnegative().nullable().default(null),cached_input_usd:fe.z.number().nonnegative().nullable().default(null),output_usd:fe.z.number().nonnegative().nullable().default(null),reasoning_usd:fe.z.number().nonnegative().nullable().default(null)}).default({estimated_usd:null,estimated_brl:null,fx_rate:null,pricing_model:null,pricing_source:null,input_usd:null,cached_input_usd:null,output_usd:null,reasoning_usd:null}),telemetry:fe.z.object({cycle_count:fe.z.number().int().nonnegative().nullable(),source:fe.z.enum(["repository","local-codex","manual","unavailable"]),segment_key:fe.z.string().nullable()}).default({cycle_count:null,source:"unavailable",segment_key:null}),commands:fe.z.array(fe.z.string()),gates:fe.z.array(fe.z.string()),decisions:fe.z.array(fe.z.string()),evidence:fe.z.array(fe.z.string())}).strict()});function hn(e){let t=e.data;return e.kind==="evidence"?typeof t?.observed_at=="string"?t.observed_at:null:e.kind==="validation"?typeof t?.executed_at=="string"?t.executed_at:null:e.kind==="run"?typeof t?.source_started_at=="string"?t.source_started_at:typeof t?.started_at=="string"?t.started_at:e.updated_at:typeof t?.created_at=="string"?t.created_at:e.updated_at}function Dt(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let i=new Intl.DateTimeFormat("en-CA",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(n),r=l=>i.find(c=>c.type===l)?.value,o=r("year"),a=r("month"),s=r("day");return o===void 0||a===void 0||s===void 0?null:t==="year"?o:t==="month"?`${o}-${a}`:`${o}-${a}-${s}`}function Qi(e,t="execution"){let n=e.filter(c=>cg(c,t)).map(c=>{let d=NT(c),u=c.data?.source_started_at??c.data?.started_at;if(typeof d!="number"||d<0||typeof u!="string")return null;let _=Date.parse(u);return Number.isFinite(_)?{start:_,end:_+d}:null}),i=n.filter(c=>c!==null),r=n.length-i.length,o=i.toSorted((c,d)=>c.start-d.start),a=0,s=Number.NaN,l=Number.NaN;for(let c of o)!Number.isFinite(s)||c.start>l?(Number.isFinite(s)&&(a+=l-s),s=c.start,l=c.end):l=Math.max(l,c.end);return Number.isFinite(s)&&(a+=l-s),{known_sum:a,unknown:r,complete:r===0,coverage_ratio:n.length===0?1:i.length/n.length}}function IT(e,t){let n=new Map,i=r=>{let o=n.get(r)??{intervals:[],known:0,unknown:0};return n.set(r,o),o};for(let r of e.filter(o=>cg(o,"execution"))){let o=r.data?.source_started_at??r.data?.started_at,a=NT(r);if(typeof o!="string")continue;let s=Date.parse(o),l=Dt(o,t);if(!Number.isFinite(s)||l===null||typeof a!="number"||a<0){l!==null&&(i(l).unknown+=1);continue}let c=s+a,d=s;do{let u=Dt(new Date(d).toISOString(),t);if(u===null)break;let _=x4(u,t),p=Math.min(c,_.end),v=i(u);if(v.intervals.push({start:Math.max(s,_.start),end:p}),v.known+=1,p>=c)break;d=p}while(d<=c)}return Object.fromEntries([...n].map(([r,o])=>{let a=o.known+o.unknown;return[r,{known_sum:T4(o.intervals),unknown:o.unknown,complete:o.unknown===0,coverage_ratio:a===0?1:o.known/a}]}))}function NT(e){let t=e.data?.source_duration_ms;if(typeof t=="number")return t;let n=e.data?.duration_ms;return typeof n=="number"?n:null}function cg(e,t){return(t===null||e.data?.phase===t)&&(e.data?.parent_run_id===null||e.data?.parent_run_id===void 0)}function T4(e){let t=e.toSorted((o,a)=>o.start-a.start),n=0,i=Number.NaN,r=Number.NaN;for(let o of t)!Number.isFinite(i)||o.start>r?(Number.isFinite(i)&&(n+=r-i),i=o.start,r=o.end):r=Math.max(r,o.end);return Number.isFinite(i)?n+r-i:n}function x4(e,t){let[n,i="01",r="01"]=e.split("-"),o={year:Number(n),month:Number(i),day:Number(r)},a=new Date(Date.UTC(o.year,o.month-1,o.day));return t==="day"?a.setUTCDate(a.getUTCDate()+1):t==="month"?a.setUTCMonth(a.getUTCMonth()+1,1):a.setUTCFullYear(a.getUTCFullYear()+1,0,1),{start:CT(o.year,o.month,o.day),end:CT(a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate())}}function CT(e,t,n){let i=Date.UTC(e,t-1,n),o=new Intl.DateTimeFormat("en-US",{timeZone:"America/Sao_Paulo",timeZoneName:"longOffset"}).formatToParts(new Date(i)).find(l=>l.type==="timeZoneName")?.value??"GMT",a=/^GMT([+-])(\d{2}):(\d{2})$/.exec(o);if(a===null)return i;let s=(Number(a[2])*60+Number(a[3]))*6e4*(a[1]==="+"?1:-1);return i-s}function lg(e){let t=new Intl.DateTimeFormat("en-CA",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"});return new Set(e.filter(n=>cg(n,"execution")).map(n=>n.data?.source_started_at??n.data?.started_at).filter(n=>typeof n=="string").map(n=>t.format(new Date(n)))).size}var Rs=P(()=>{"use strict"});function MT(e){let t=e.data?.source_duration_ms;if(typeof t=="number")return t;let n=e.data?.duration_ms;return typeof n=="number"?n:null}function LT(e){return e.filter(t=>t.kind==="task").map(t=>({id:t.id,status:t.status,risk:t.risk,updated_at:t.updated_at,finished_at:typeof t.data?.finished_at=="string"?t.data.finished_at:null})).sort((t,n)=>t.id.localeCompare(n.id))}function jT(e){let t=e.filter(l=>l.kind==="prd"||l.kind==="spec"),n=t.filter(l=>l.kind==="spec"),i=e.filter(l=>l.kind==="change"),r=e.filter(l=>l.kind==="task"),o=e.filter(l=>l.kind==="execution"),a=e.filter(l=>l.kind==="run"),s=new Map(t.map(l=>[l.id,l]));return t.map(l=>{let c=new Set(l.kind==="spec"?[l.id]:n.filter(b=>ot(b.data,"prd_id")===l.id).map(b=>b.id)),d=new Set(i.filter(b=>{let T=vi(b.data,"source"),I=ot(T,"type");return l.kind==="prd"&&I==="prd"&&ot(T,"prd_id")===l.id||(I==="spec"||I==="prd")&&c.has(ot(T,"spec_id")??"")}).map(b=>b.id)),u=new Set(r.filter(b=>d.has(ot(b.data,"change_id")??"")).map(b=>b.id));for(let b of $4(l,s))u.add(b);let _=new Set(o.filter(b=>{let T=vi(b.data,"origin"),I=ot(T,"type");return l.kind==="prd"&&I==="prd"&&ot(T,"prd_id")===l.id||I==="spec"&&c.has(ot(T,"spec_id")??"")?!0:I4(b.data).some(R=>u.has(R))}).map(b=>b.id)),p=new Set([l,...n.filter(b=>c.has(b.id))].map(b=>ot(b.data,"creation_run_id")).filter(b=>b!==null)),v=a.filter(b=>{let T=b.data;return p.has(b.id)||c.has(ot(T,"spec_id")??"")||l.kind==="prd"&&ot(T,"prd_id")===l.id||u.has(ot(T,"task_id")??"")||_.has(ot(T,"execution_id")??"")}),f=[...new Map(v.map(b=>[b.id,b])).values()],h=f.filter(b=>b.data?.phase==="execution"&&b.data.parent_run_id==null),k=Qi(f),w=O4(f),O=h.filter(b=>{let T=MT(b),I=b.data?.source_started_at??b.data?.started_at;return typeof T=="number"&&T>=0&&typeof I=="string"&&Number.isFinite(Date.parse(I))}),g=o.filter(b=>_.has(b.id)).map(b=>b.status??"");return{id:l.id,title:l.title??l.id,kind:l.kind,parent_id:l.kind==="spec"?ot(l.data,"prd_id"):null,lifecycle_status:l.status??"draft",work_status:R4(l.status,g),created_at:ot(l.data,"created_at")??l.updated_at,updated_at:l.updated_at,task_count:u.size,run_count:f.length,rework_run_count:f.filter(b=>ot(b.data,"work_type")==="rework").length,canonical_run_ids:f.map(b=>b.id).sort(),root_execution_run_ids:h.map(b=>b.id).sort(),duration_ms:O.length===0?null:k.known_sum,observed_root_duration_ms:O.length===0?null:k.known_sum,observed_lifecycle_duration_ms:w.known_runs===0?null:w.known_sum,duration_coverage:{eligible_runs:h.length,known_runs:O.length,unknown_runs:h.length-O.length,coverage_ratio:h.length===0?1:O.length/h.length},duration_provenance:O.length===0?"unavailable":"observed",lifecycle_duration_coverage:w.coverage,lifecycle_duration_provenance:w.known_runs===0?"unavailable":"observed",total_tokens:PT(f.map(b=>b.usage?.total_tokens??null)),cost:PT(f.map(b=>b.usage?.cost??null))}}).sort((l,c)=>l.id.localeCompare(c.id))}function O4(e){let t=e.filter(c=>c.data?.parent_run_id==null),n=[],i=0;for(let c of t){let d=MT(c),u=c.data?.source_started_at??c.data?.started_at,_=typeof u=="string"?Date.parse(u):Number.NaN;typeof d!="number"||d<0||!Number.isFinite(_)||(i+=1,n.push({start:_,end:_+d}))}let r=n.toSorted((c,d)=>c.start-d.start),o=0,a=Number.NaN,s=Number.NaN;for(let c of r)!Number.isFinite(a)||c.start>s?(Number.isFinite(a)&&(o+=s-a),a=c.start,s=c.end):s=Math.max(s,c.end);Number.isFinite(a)&&(o+=s-a);let l=t.length;return{known_sum:o,known_runs:i,coverage:{eligible_runs:l,known_runs:i,unknown_runs:l-i,coverage_ratio:l===0?1:i/l}}}function R4(e,t){return e==="delivered"?"completed":e==="blocked"?"blocked":e==="failed"?"failed":e==="cancelled"?"cancelled":t.some(n=>n==="running"||n==="paused")?"executing":t.includes("verifying")?"verifying":t.length>0&&t.every(n=>n==="completed")?e==="active"?"verifying":"completed":e==="active"?"executing":t.includes("blocked")?"blocked":t.includes("failed")?"failed":"planning"}function $4(e,t){let n=C4(vi(e.data,"prepared_plan"));if(n.length>0||e.kind!=="spec")return n;let i=ot(e.data,"prd_id"),r=i===null?void 0:t.get(i),o=vi(vi(r?.data??null,"prepared_plan"),"blueprints"),a=new Set(kd(o,"changes").filter(s=>ot(vi(s,"source"),"spec_id")===e.id).map(s=>ot(s,"id")).filter(s=>s!==null));return kd(o,"tasks").filter(s=>a.has(ot(s,"change_id")??"")).map(s=>ot(s,"id")).filter(s=>s!==null)}function C4(e){return kd(vi(e,"blueprints"),"tasks").map(t=>ot(t,"id")).filter(t=>t!==null)}function I4(e){return kd(vi(e,"dag"),"nodes").map(t=>ot(t,"task_id")).filter(t=>t!==null)}function vi(e,t){let n=e?.[t];return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function kd(e,t){let n=e?.[t];return Array.isArray(n)?n.filter(i=>typeof i=="object"&&i!==null&&!Array.isArray(i)):[]}function ot(e,t){return typeof e?.[t]=="string"?e[t]:null}function PT(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}var DT=P(()=>{"use strict";Rs()});function wd(e){return e.map(t=>{let n=t.data,i=typeof n?.started_at=="string"?n.started_at:t.updated_at,r=n?.entrypoint_usage!==null&&typeof n?.entrypoint_usage=="object"&&"total"in n.entrypoint_usage?n.entrypoint_usage.total:null,o=r!==null&&typeof r=="object"&&"events"in r?r.events:null;return{id:t.id,started_at:i,finished_at:typeof n?.terminal_finished_at=="string"?n.terminal_finished_at:typeof n?.finished_at=="string"?n.finished_at:null,task_id:typeof n?.task_id=="string"?n.task_id:null,execution_id:typeof n?.execution_id=="string"?n.execution_id:null,conversation_id:typeof n?.conversation_id=="string"?n.conversation_id:typeof n?.client_thread_id=="string"?n.client_thread_id:null,agent:typeof n?.agent=="string"?n.agent:null,agent_name:typeof n?.agent_name=="string"?n.agent_name:typeof n?.agent=="string"?n.agent:null,provider:typeof n?.provider=="string"?n.provider:null,model:typeof n?.effective_model=="string"?n.effective_model:typeof n?.model=="string"?n.model:null,spec_id:typeof n?.spec_id=="string"?n.spec_id:null,prd_id:typeof n?.prd_id=="string"?n.prd_id:null,change_id:typeof n?.change_id=="string"?n.change_id:null,run_kind:n?.run_kind==="run"||n?.run_kind==="subrun"?n.run_kind:null,phase:typeof n?.phase=="string"?n.phase:null,parent_run_id:typeof n?.parent_run_id=="string"?n.parent_run_id:null,status:t.status,duration_ms:typeof n?.source_duration_ms=="number"&&n.source_duration_ms>=0?n.source_duration_ms:typeof n?.duration_ms=="number"&&n.duration_ms>=0?n.duration_ms:null,duration_started_at:typeof n?.source_started_at=="string"?n.source_started_at:i,total_tokens:t.usage?.total_tokens??null,cost:t.usage?.cost??null,currency:t.usage?.currency??null,events:typeof o=="number"&&Number.isFinite(o)?o:null}}).sort((t,n)=>n.started_at.localeCompare(t.started_at))}function ug(e){let t=new Map;for(let n of wd(e)){if(n.task_id===null)continue;let i=t.get(n.task_id)??{task_id:n.task_id,duration_ms:0,total_tokens:0,cost:0,run_count:0,intervals:[]};if(n.phase==="execution"&&n.parent_run_id===null&&n.duration_ms!==null&&typeof n.duration_started_at=="string"){let r=Date.parse(n.duration_started_at);Number.isFinite(r)&&i.intervals.push({start:r,end:r+n.duration_ms})}i.total_tokens+=n.total_tokens??0,i.cost+=n.cost??0,i.run_count+=1,t.set(n.task_id,i)}return[...t.values()].map(({intervals:n,...i})=>({...i,duration_ms:N4(n)})).sort((n,i)=>i.duration_ms-n.duration_ms||n.task_id.localeCompare(i.task_id)).slice(0,5)}function dg(e,t){let n=wd(e).map(o=>o[t]),i=n.filter(o=>o!==null),r=n.length-i.length;return{known_sum:i.reduce((o,a)=>o+a,0),unknown:r,complete:r===0,coverage_ratio:n.length===0?1:i.length/n.length}}function N4(e){let t=0,n=Number.NaN,i=Number.NaN;for(let r of e.toSorted((o,a)=>o.start-a.start))!Number.isFinite(n)||r.start>i?(Number.isFinite(n)&&(t+=i-n),n=r.start,i=r.end):i=Math.max(i,r.end);return Number.isFinite(n)&&(t+=i-n),t}var UT=P(()=>{"use strict"});function P4(e,t=16){let n=0;for(let i of e)n=n*31+i.charCodeAt(0)>>>0;return n%t}function FT(e,t,n=16){let i=Object.fromEntries(zT.map(o=>[o,Array.from({length:n},(a,s)=>`${t}/${o}/${s.toString(16).padStart(2,"0")}.json`)])),r=new Map;for(let o of zT){let a=Object.entries(e.days).flatMap(([s,l])=>l[o].map(c=>({day:s,value:c})));for(let s=0;s<n;s+=1){let l=i[o][s];r.set(l,{schema_version:1,collection:o,shard:s,rows:a.filter(({value:c})=>P4(c.id,n)===s)})}}return{manifest:{schema_version:1,snapshot_id:e.updated_at,source_latest_at:e.source_latest_at,shard_count:n,overview_path:`${t}/overview.json`,collections:i},overview:{schema_version:1,days:Object.fromEntries(Object.entries(e.days).map(([o,a])=>[o,a.overview]))},shards:r}}function qT(e,t,n){let i=Object.fromEntries(Object.entries(t.days).map(([r,o])=>[r,{overview:o,tasks:[],specs:[],prds:[],executions:[],conversations:[]}]));for(let r of n)for(let o of r.rows){let a=i[o.day];a!==void 0&&(a[r.collection]=[...a[r.collection],o.value])}return{schema_version:1,updated_at:e.snapshot_id,source_latest_at:e.source_latest_at,days:i}}var zT,VT=P(()=>{"use strict";zT=["tasks","specs","prds","executions","conversations"]});async function HT(e,t){if(!await e.exists(Qo))return null;let n=JSON.parse(await e.readText(Qo)),i=t===void 0?Object.values(n.collections).flat():t==="overview"?[]:n.collections[t],[r,...o]=await Promise.all([e.readText(n.overview_path).then(a=>JSON.parse(a)),...i.map(a=>e.readText(a).then(s=>JSON.parse(s)))]);return qT(n,r,o)}async function JT(e,t){let n=await e.exists(Qo)?JSON.parse(await e.readText(Qo)):null,i=FT(t,eo),r={},o=[];for(let[u,_]of Object.entries(i.manifest.collections))r[u]=_.map(p=>{let v=i.shards.get(p),f=_g(v),h=`${eo}/${u}/${v.shard.toString(16).padStart(2,"0")}-${ZT(f)}.json`;return o.push(WT(e,h,f)),h});let a=_g(i.overview),s=`${eo}/overview-${ZT(a)}.json`;o.push(WT(e,s,a)),await Promise.all(o);let l={...i.manifest,overview_path:s,collections:r};await e.writeTextAtomic(Qo,_g(l));let c=new Set([Qo,l.overview_path,...Object.values(l.collections).flat(),...n===null?[]:[n.overview_path,...Object.values(n.collections).flat()]]),d=await e.listFiles(eo,".json");await Promise.all(d.filter(u=>!c.has(u)).map(u=>e.removeFile(u)))}async function WT(e,t,n){await e.exists(t)||await e.writeTextAtomic(t,n)}function _g(e){return`${JSON.stringify(e,null,2)}
236
+ `}function ZT(e){return(0,BT.createHash)("sha256").update(e).digest("hex").slice(0,16)}var BT,eo,Qo,KT=P(()=>{"use strict";BT=require("node:crypto");VT();eo=".agents/records/lifecycle/views",Qo=`${eo}/manifest.json`});function XT(e,t,n,i,r,o){let a=r!==null&&o.size>0,s=a?Object.fromEntries(Object.entries(r.days).filter(([f])=>!o.has(f.slice(0,7)))):{},l=e.filter(f=>{if(f.kind!=="run")return!1;if(!a)return!0;let h=hn(f);return h!==null&&o.has(Dt(h,"month")??"")}),c=new Map(e.map(f=>[f.id,f])),d=M4(e),u=L4(e,l,d),_=new Map;for(let f of l){let h=hn(f);if(h===null)continue;let k=Dt(h,"day");if(k===null)continue;let w=Ke(f.data,"execution_id"),O=w===null?void 0:c.get(w),g=fg(O?.data,"origin"),b=Ke(f.data,"task_id")??Ke(g,"task_id"),T=Ke(f.data,"spec_id")??Ke(g,"spec_id")??(b===null?null:d.taskToSpec.get(b)??null),I=Ke(f.data,"prd_id")??Ke(g,"prd_id"),R=b===null?void 0:d.taskToPrd.get(b),U=T===null?void 0:d.specToPrd.get(T),V=I??R??U??null,y=Ke(f.data,"conversation_id")??Ke(f.data,"client_thread_id")??Ke(g,"conversation_id");for(let[S,x]of[["task",b],["spec",T],["prd",V],["execution",w],["conversation",y]])x===null||!u.has(`${S}:${x}`)||GT(_,k,S,x,f)}for(let f of u.values()){if(f.created_at===null)continue;let h=Dt(f.created_at,"day");h!==null&&GT(_,h,f.kind,f.id,null)}let p=Object.keys(t).filter(f=>!a||o.has(f.slice(0,7))).sort(),v=Object.fromEntries(p.map(f=>{let h=t[f];if(h===void 0)throw new Error(`Missing overview for selected day: ${f}`);let k=_.get(f),w=O=>[...k?.get(O)??new Map].flatMap(([g,b])=>{let T=u.get(`${O}:${g}`);return T===void 0?[]:[D4(T,f,b)]}).sort(j4);return[f,{overview:h,tasks:w("task"),specs:w("spec"),prds:w("prd"),executions:w("execution"),conversations:w("conversation")}]}));return{schema_version:1,updated_at:n,source_latest_at:i,days:{...s,...v}}}function M4(e){let t=new Map,n=new Map,i=new Map;for(let a of e)if(a.kind==="change"){let s=fg(a.data,"source"),l=Ke(s,"spec_id"),c=Ke(s,"prd_id");l!==null&&t.set(a.id,l),c!==null&&n.set(a.id,c)}else if(a.kind==="spec"){let s=Ke(a.data,"prd_id");s!==null&&i.set(a.id,s)}let r=new Map,o=new Map;for(let a of e.filter(s=>s.kind==="task")){let s=Ke(a.data,"change_id"),l=Ke(a.data,"spec_id")??(s===null?null:t.get(s)??null),c=Ke(a.data,"prd_id"),d=s===null?void 0:n.get(s),u=l===null?void 0:i.get(l),_=c??d??u??null;l!==null&&r.set(a.id,l),_!==null&&o.set(a.id,_)}return{taskToSpec:r,taskToPrd:o,specToPrd:i}}function L4(e,t,n){let i=new Map;for(let r of e){if(!["task","spec","prd","execution"].includes(r.kind))continue;let o=r.kind,a=r.data??{},s=fg(a,"origin"),l=o==="task"?n.taskToSpec.get(r.id)??n.taskToPrd.get(r.id)??null:o==="spec"?n.specToPrd.get(r.id)??null:o==="execution"?Ke(s,"task_id")??Ke(s,"spec_id")??Ke(s,"prd_id"):null,c=o==="task"?Ke(a,"finished_at")??r.updated_at:r.updated_at;i.set(`${o}:${r.id}`,pg(r.id,o,r.title,r.status,r.risk,hn(r),c,l))}for(let r of t){let o=Ke(r.data,"execution_id"),a=Ke(r.data,"conversation_id")??Ke(r.data,"client_thread_id"),s=hn(r);if(o!==null&&!i.has(`execution:${o}`)&&i.set(`execution:${o}`,pg(o,"execution",null,r.status,null,s,s,Ke(r.data,"task_id"))),a!==null){let l=`conversation:${a}`,c=i.get(l);(c===void 0||s!==null&&(c.created_at===null||s<c.created_at))&&i.set(l,pg(a,"conversation",null,r.status,null,s,s,o))}}return i}function pg(e,t,n,i,r,o,a,s){return{id:e,title:n??e,kind:t,status:i,risk:r,created_at:o,window_at:a??o??new Date(0).toISOString(),parent_id:s}}function GT(e,t,n,i,r){let o=e.get(t)??new Map,a=o.get(n)??new Map,s=a.get(i)??[];r!==null&&s.push(r),a.set(i,s),o.set(n,a),e.set(t,o)}function Ke(e,t){return typeof e=="object"&&e!==null&&typeof e[t]=="string"?e[t]:null}function fg(e,t){if(typeof e!="object"||e===null)return null;let n=e[t];return typeof n=="object"&&n!==null?n:null}function j4(e,t){return t.occurred_at.localeCompare(e.occurred_at)||e.id.localeCompare(t.id)}function D4(e,t,n){let i=F4(n),r=e.kind==="conversation"?null:"execution";return{id:e.id,title:e.title,kind:e.kind,status:e.status,risk:e.risk,occurred_at:hn(i.at(0)??{kind:"task",updated_at:`${t}T00:00:00.000Z`})??`${t}T00:00:00.000Z`,window_at:e.window_at,parent_id:e.parent_id,run_count:i.length,cost_currency:z4(i),lifecycle_elapsed_ms:U4(i,r),metrics:q4(i,r)}}function U4(e,t){let n=e.filter(u=>(t===null||u.data?.phase===t)&&(u.data?.parent_run_id===null||u.data?.parent_run_id===void 0));if(n.length===0)return null;let i=new Set(["completed","failed","cancelled"]),r=n.flatMap(u=>{if(!i.has(u.status??""))return[];let _=Ke(u.data,"started_at"),p=Ke(u.data,"finished_at"),v=_===null?Number.NaN:Date.parse(_),f=p===null?Number.NaN:Date.parse(p);return Number.isFinite(v)&&Number.isFinite(f)&&f>=v?[{start:v,end:f}]:[]});if(r.length!==n.length)return null;let o=r.toSorted((u,_)=>u.start-_.start),[a,...s]=o;if(a===void 0)return null;let l=0,c=a.start,d=a.end;for(let u of s)u.start>d?(l+=d-c,c=u.start,d=u.end):d=Math.max(d,u.end);return l+d-c}function z4(e){let t=new Set(e.flatMap(i=>i.usage?.currency?[i.usage.currency]:[])),[n]=t;return t.size===1?n??null:null}function F4(e){let t=new Set;return e.filter(n=>{let i=Ke(n.data,"source_segment_key")??n.id;return t.has(i)?!1:(t.add(i),!0)})}function q4(e,t){let n=i=>{let r=e.map(i),o=r.filter(s=>s!==null),a=r.length-o.length;return{known_sum:o.reduce((s,l)=>s+l,0),unknown:a,complete:a===0,coverage_ratio:r.length===0?1:o.length/r.length}};return{duration:Qi(e,t),total_tokens:n(i=>i.usage?.total_tokens??null),cost:n(i=>i.usage?.cost??null)}}var YT=P(()=>{"use strict";Rs()});var QT=P(()=>{"use strict"});var ex=P(()=>{"use strict"});var tx=P(()=>{"use strict";QT();ex()});function nx(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return t%rx}function J4(e,t,n=null,i=new Set){let r={},o={},a={};for(let _ of e)if(r[_.kind]=(r[_.kind]??0)+1,_.status!==null){o[_.status]=(o[_.status]??0)+1;let p=a[_.kind]??{};p[_.status]=(p[_.status]??0)+1,a[_.kind]=p}let s=e.filter(_=>_.kind==="run"),l=ox(s),d=n?.run_metrics!==void 0&&i.size>0?G4(e,n,i):{daily:ta(e,"day"),monthly:ta(e,"month"),annual:ta(e,"year")},u=e.map(_=>_.updated_at).sort().at(-1)??null;return{schema_version:1,updated_at:t,freshness:{source_latest_at:u,lag_ms:u===null?null:Math.max(0,Date.parse(t)-Date.parse(u))},counts:{total:e.length,by_kind:r,by_status:o,by_kind_status:a},usage:l,duration:Qi(s),execution_day_count:lg(s),events:dg(s,"events"),run_metrics:wd(s),task_metrics:LT(e),macro_metrics:jT(e),task_status_counts:Od(e,"status"),task_risk_counts:Od(e,"risk"),top_tasks:ug(s),latest_task_created_at:ax(e),periods:d}}function K4(e){let{run_metrics:t,daily_read_models:n,...i}=e;return i}function G4(e,t,n){let i=new Set([...n].map(s=>s.slice(0,4))),r=e.filter(s=>{let l=hn(s),c=l===null?null:Dt(l,"month");return c!==null&&n.has(c)}),o=e.filter(s=>{let l=hn(s),c=l===null?null:Dt(l,"year");return c!==null&&i.has(c)}),a=(s,l)=>Object.fromEntries(Object.entries(s).filter(([c])=>!l(c)));return{daily:{...a(t.periods.daily,s=>n.has(s.slice(0,7))),...ta(r,"day")},monthly:{...a(t.periods.monthly,s=>n.has(s)),...ta(r,"month")},annual:{...a(t.periods.annual,s=>i.has(s)),...ta(o,"year")}}}function X4(e){let t=hn(e),n=t===null?null:Dt(t,"month");if(n===null)return[];let i=e.kind==="run"?e.data?.source_duration_ms:null,r=t===null?Number.NaN:Date.parse(t);if(typeof i!="number"||i<=0||!Number.isFinite(r))return[n];let o=Dt(new Date(r+Math.max(0,i-1)).toISOString(),"month");return o===null||o===n?[n]:[n,o]}function ox(e){let t=i=>{let r=e.map(s=>s.usage?.[i]??null),o=r.filter(s=>s!==null),a=r.length-o.length;return{known_sum:o.reduce((s,l)=>s+l,0),unknown:a,complete:a===0,coverage_ratio:r.length===0?1:o.length/r.length}},n=new Set(e.map(i=>i.usage?.currency).filter(i=>i!==null));return{input_tokens:t("input_tokens"),output_tokens:t("output_tokens"),total_tokens:t("total_tokens"),cost:{...t("cost"),currency:n.size===1?[...n][0]??null:null}}}function ta(e,t){let n=new Map,i=IT(e.filter(r=>r.kind==="run"),t);for(let r of e){let o=hn(r);if(o===null)continue;let a=Dt(o,t);a!==null&&n.set(a,[...n.get(a)??[],r])}return Object.fromEntries([...new Set([...n.keys(),...Object.keys(i)])].sort((r,o)=>r.localeCompare(o)).map(r=>{let o=n.get(r)??[],a=o.filter(s=>s.kind==="run");return[r,{prds:o.filter(s=>s.kind==="prd").length,specs:o.filter(s=>s.kind==="spec").length,tasks:o.filter(s=>s.kind==="task").length,validations:o.filter(s=>s.kind==="validation").length,evidences:o.filter(s=>s.kind==="evidence").length,runs:a.length,usage:ox(a),duration:i[r]??Qi(a),execution_day_count:lg(a),events:dg(a,"events"),task_status_counts:Od(o,"status"),task_risk_counts:Od(o,"risk"),top_tasks:ug(a),latest_task_created_at:ax(o)}]}))}function Od(e,t){let n={};for(let i of e){if(i.kind!=="task")continue;let r=i[t];r!==null&&(n[r]=(n[r]??0)+1)}return n}function ax(e){return e.filter(t=>t.kind==="task").map(t=>typeof t.data?.created_at=="string"?t.data.created_at:t.updated_at).sort().at(-1)??null}function Y4(e,t){let n=new Set(["prd","spec","change","task","execution","run"]),i=new Set(["completed","delivered","cancelled","superseded","failed","rolled_back","passed"]);return{schema_version:1,updated_at:t,items:e.filter(r=>n.has(r.kind)&&r.status!==null&&!i.has(r.status)).sort((r,o)=>o.updated_at.localeCompare(r.updated_at)).map(({usage:r,data:o,...a})=>a)}}function to(e){return`${JSON.stringify(e,null,2)}
237
+ `}function Q4(e){try{return process.kill(e,0),!0}catch(t){return xd(t)&&t.code==="EPERM"}}function xd(e){return e instanceof Error&&"code"in e}function eB(e){return new Promise(t=>setTimeout(t,e))}var Le,yn,Ed,mg,$s,Ad,rx,gg,hg,yg,Td,ix,ea,V4,W4,Z4,B4,H4,vg,Ut,bi=P(()=>{"use strict";Le=He(Xe(),1);DT();UT();KT();YT();Rs();tx();Rs();yn=".agents/records/lifecycle",Ed=`${yn}/manifest.json`,mg=`${yn}/entity-snapshot.json`,$s=`${yn}/entity-state.json`,Ad=`${yn}/indexes`,rx=16,gg=`${yn}/summary.json`,hg=`${yn}/overview.json`,yg=`${yn}/active-work.json`,Td=".local/locks/lifecycle-manifest.lock",ix=Le.z.enum(["prd","spec","change","task","execution","run","decision","validation","evidence"]),ea=ix.options,V4=Le.z.enum(["parent","child","references","evidence","requirement"]),W4=Le.z.enum(["explicit","derived"]),Z4=Le.z.object({target_id:Le.z.string().min(1),type:V4,direction:Le.z.enum(["outbound","inbound"]),provenance:W4,source_locator:Le.z.string().min(1).nullable().default(null)}).strict(),B4=Le.z.object({input_tokens:Le.z.number().int().nonnegative().nullable().default(null),output_tokens:Le.z.number().int().nonnegative().nullable().default(null),cached_input_tokens:Le.z.number().int().nonnegative().nullable().default(null),total_tokens:Le.z.number().int().nonnegative().nullable().default(null),cost:Le.z.number().nonnegative().nullable().default(null),currency:Le.z.string().min(1).nullable().default(null)}).strict(),H4=Le.z.object({kind:ix,id:Le.z.string().min(1),title:Le.z.string().min(1).nullable().default(null),status:Le.z.string().min(1).nullable().default(null),risk:Le.z.string().min(1).nullable().default(null),priority:Le.z.string().min(1).nullable().default(null),updated_at:Le.z.string().datetime({offset:!0}),relations:Le.z.array(Le.z.string().min(1)).default([]),relation_edges:Le.z.array(Z4).optional(),usage:B4.nullable().default(null),data:Le.z.record(Le.z.string(),Le.z.unknown()).nullable().default(null)}).strict(),vg=Le.z.object({schema_version:Le.z.literal(1),event_id:Le.z.string().min(1),occurred_at:Le.z.string().datetime({offset:!0}),operation:Le.z.enum(["upsert","remove"]),entity:H4}).strict(),Ut=class{constructor(t){this.filesystem=t}filesystem;async append(t){return this.appendMany([t])}async appendMany(t){let n=t.map(i=>vg.parse(i));return this.withLock(async()=>{let i=new Map;for(let r of n){let o=r.occurred_at.slice(0,7);i.set(o,[...i.get(o)??[],r])}return await Promise.all([...i].map(([r,o])=>this.filesystem.appendText(`${yn}/chunks/${r}.jsonl`,`${o.map(a=>JSON.stringify(a)).join(`
238
+ `)}
239
+ `))),this.refreshUnlocked()})}async refresh(){return this.withLock(()=>this.refreshUnlocked())}async refreshUnlocked(){let t=await this.readJson(Ed,{schema_version:1,updated_at:new Date(0).toISOString(),offsets:{}}),n=await this.readStates(),[i,r]=await Promise.all([this.readSummary(),this.readDailyReadModels()]),o=new Set,a=new Set,s=await this.filesystem.exists($s)||(await Promise.all(ea.map(f=>this.filesystem.exists(this.aggregateStatePath(f))))).some(Boolean);if(s)for(let f of ea)for(let h=0;h<rx;h+=1)o.add(`${f}:${h}`);let l=await this.filesystem.listFiles(`${yn}/chunks`,".jsonl");for(let f of l){let h=t.offsets[f]??0,k=await this.filesystem.readTextFrom(f,h);for(let w of k.content.split(/\r?\n/).filter(Boolean)){let O=vg.parse(JSON.parse(w)),g=n[O.entity.kind],b=g.entities[O.entity.id];for(let T of[b,O.entity])if(T!==void 0)for(let I of X4(T))a.add(I);O.operation==="remove"?delete g.entities[O.entity.id]:g.entities[O.entity.id]=O.entity,o.add(`${O.entity.kind}:${nx(O.entity.id)}`)}t.offsets[f]=k.nextOffset}if(o.size===0&&!s&&r!==null&&i!==null)return i;let c=new Date().toISOString();t.updated_at=c;let d=ea.flatMap(f=>Object.values(n[f].entities)),u=J4(d,c,i,a),_=XT(d,u.periods.daily,c,u.freshness.source_latest_at,r,a),p=u,v=Y4(d,c);return await Promise.all([this.filesystem.writeTextAtomic(Ed,to(t)),this.filesystem.writeTextAtomic(mg,to({schema_version:1,updated_at:c,entities:Object.fromEntries(d.map(f=>[`${f.kind}:${f.id}`,f]))})),...[...o].map(f=>{let[h,k]=f.split(":"),w=Number(k),O=Object.fromEntries(Object.entries(n[h].entities).filter(([g])=>nx(g)===w));return this.filesystem.writeTextAtomic(this.statePath(h,w),to({schema_version:1,entities:O}))}),this.filesystem.writeTextAtomic(gg,to(p)),this.filesystem.writeTextAtomic(hg,to(K4(p))),this.writeDailyReadModels(_),this.filesystem.writeTextAtomic(yg,to(v))]),await this.filesystem.exists($s)&&await this.filesystem.removeFile($s),await Promise.all(ea.map(async f=>{let h=this.aggregateStatePath(f);await this.filesystem.exists(h)&&await this.filesystem.removeFile(h)})),p}async replace(t){return this.withLock(async()=>{let n=new Date().toISOString(),i=`${yn}/chunks/${n.slice(0,7)}.jsonl`,r=t.map(l=>JSON.stringify(vg.parse(l))).join(`
240
+ `),o=await this.filesystem.listFiles(`${yn}/chunks`,".jsonl"),a=await this.filesystem.listFiles(Ad,".json"),s=await this.filesystem.listFiles(eo,".json");return await Promise.all(o.filter(l=>l!==i).map(l=>this.filesystem.removeFile(l))),await Promise.all([this.filesystem.writeTextAtomic(i,r.length===0?"":`${r}
241
+ `),this.filesystem.writeTextAtomic(Ed,to({schema_version:1,updated_at:new Date(0).toISOString(),offsets:{}})),this.filesystem.removeFile(mg),this.filesystem.removeFile($s),...a.map(l=>this.filesystem.removeFile(l)),...s.map(l=>this.filesystem.removeFile(l))]),this.refreshUnlocked()})}async readSummary(){return await this.filesystem.exists(gg)?JSON.parse(await this.filesystem.readText(gg)):null}async readOverview(){return await this.filesystem.exists(hg)?JSON.parse(await this.filesystem.readText(hg)):this.readSummary()}async readDailyReadModels(t){return await HT(this.filesystem,t)??(await this.readSummary())?.daily_read_models??null}async writeDailyReadModels(t){await JT(this.filesystem,t)}async readActiveWork(){return await this.filesystem.exists(yg)?JSON.parse(await this.filesystem.readText(yg)):null}async readEntities(t){let[n,i]=await Promise.all([this.readJson(Ed,null),this.readJson(mg,null)]);if(n!==null&&i!==null&&i.schema_version===1&&i.updated_at===n.updated_at){let o=Object.values(i.entities);return t===void 0?o:o.filter(a=>a.kind===t)}if(t!==void 0)return Object.values((await this.readKindState(t)).entities);let r=await this.readStates();return ea.flatMap(o=>Object.values(r[o].entities))}statePath(t,n){return`${Ad}/${t}/${n.toString(16).padStart(2,"0")}.json`}aggregateStatePath(t){return`${Ad}/${t}.json`}async readStates(){let t=Object.fromEntries(await Promise.all(ea.map(async i=>[i,await this.readKindState(i)]))),n=await this.readJson($s,null);for(let i of Object.values(n?.entities??{}))t[i.kind].entities[i.id]=i;return t}async readKindState(t){let n=await this.readJson(this.aggregateStatePath(t),null);if(n!==null)return n;let i=await this.filesystem.listFiles(`${Ad}/${t}`,".json"),r=await Promise.all(i.map(o=>this.readJson(o,null)));return{schema_version:1,entities:Object.assign({},...r.map(o=>o?.entities??{}))}}async readJson(t,n){try{return JSON.parse(await this.filesystem.readText(t))}catch(i){if(xd(i)&&i.code==="ENOENT")return n;throw i}}async withLock(t){for(let n=0;n<80;n+=1)try{await this.filesystem.writeTextExclusive(Td,`${JSON.stringify({pid:process.pid,acquired_at:new Date().toISOString()})}
242
+ `);try{return await t()}finally{await this.filesystem.removeFile(Td)}}catch(i){if(!xd(i)||i.code!=="EEXIST")throw i;if(await this.removeStaleLock())continue;await eB(Math.min(100,10+n*2))}throw new Error("Lifecycle manifest is busy; retry the operation")}async removeStaleLock(){try{let t=JSON.parse(await this.filesystem.readText(Td));if(typeof t.pid!="number"||!Q4(t.pid))return await this.filesystem.removeFile(Td),!0}catch(t){return!!(xd(t)&&t.code==="ENOENT")}return!1}}});var sx=P(()=>{"use strict"});var bg,q5,cx=P(()=>{"use strict";bg=["objective","requirement_ids","acceptance_ids","write_scopes"],q5={simple:{level:"simple",requiredFields:[...bg,"verification"],optionalFields:["risk_notes","rollback"],maximumUnresolvedQuestions:0},standard:{level:"standard",requiredFields:[...bg,"included_scope","excluded_scope","design","risks","verification","rollback"],optionalFields:["rollout","open_questions"],maximumUnresolvedQuestions:2},complex:{level:"complex",requiredFields:[...bg,"problem","outcomes","included_scope","excluded_scope","architecture","security","dag","budgets","risks","rollout","rollback","verification","independent_reviewer"],optionalFields:["open_questions"],maximumUnresolvedQuestions:3}}});var lx=P(()=>{"use strict";sx();cx()});var Oe,Rd,H5,J5,Sg=P(()=>{"use strict";Oe=He(Xe(),1),Rd=Oe.z.enum(["test","eval","check","review","spec_review","quality_review","mutation","integration","cross_spec_e2e"]),H5=Oe.z.object({schema_version:Oe.z.literal(2),assurance_version:Oe.z.literal(1),profile:Oe.z.enum(["task-lite","task-standard-2","task-standard-3","task-critical"]),risk:Oe.z.enum(["lite","standard","critical"]),minimum_validation_artifacts:Oe.z.number().int().positive(),maximum_validation_artifacts:Oe.z.number().int().positive().nullable(),minimum_evidence_artifacts:Oe.z.number().int().positive(),maximum_evidence_artifacts:Oe.z.number().int().positive().nullable(),minimum_distinct_modalities:Oe.z.number().int().positive(),complete_acceptance_coverage:Oe.z.literal(!0),evidence_per_acceptance:Oe.z.boolean(),requires_independent_verifier:Oe.z.boolean(),requires_mutation_discrimination:Oe.z.boolean(),minimum_mutation_kill_ratio:Oe.z.number().min(0).max(1).nullable(),requires_rollback:Oe.z.boolean(),requires_final_commit_evidence:Oe.z.boolean(),requires_test:Oe.z.boolean(),required_modalities:Oe.z.array(Rd)}).strict().superRefine((e,t)=>{e.maximum_validation_artifacts!==null&&e.maximum_validation_artifacts<e.minimum_validation_artifacts&&t.addIssue({code:"custom",path:["maximum_validation_artifacts"],message:"maximum validation artifacts cannot be lower than the minimum"}),e.maximum_evidence_artifacts!==null&&e.maximum_evidence_artifacts<e.minimum_evidence_artifacts&&t.addIssue({code:"custom",path:["maximum_evidence_artifacts"],message:"maximum Evidence artifacts cannot be lower than the minimum"})}),J5=Oe.z.object({schema_version:Oe.z.literal(2),assurance_version:Oe.z.literal(1),profile:Oe.z.enum(["spec-delivery","prd-delivery"]),origin:Oe.z.enum(["spec","prd"]),minimum_parent_validation_artifacts:Oe.z.number().int().positive(),minimum_parent_evidence_artifacts:Oe.z.number().int().positive(),minimum_distinct_modalities:Oe.z.number().int().positive(),complete_acceptance_coverage:Oe.z.literal(!0),requires_acceptance_matrix:Oe.z.literal(!0),requires_independent_verifier:Oe.z.literal(!0),integration_modality:Oe.z.enum(["integration","cross_spec_e2e"]),evidence_per_acceptance:Oe.z.boolean(),evidence_per_outcome:Oe.z.boolean(),requires_mutation_discrimination:Oe.z.boolean(),minimum_mutation_kill_ratio:Oe.z.number().min(0).max(1).nullable(),requires_rollback:Oe.z.boolean(),requires_final_commit_evidence:Oe.z.boolean(),required_modalities:Oe.z.array(Rd).min(3)}).strict()});function na(e){return qe.z.array(e).superRefine((t,n)=>{let i=new Set;for(let[r,o]of t.entries())i.has(o)&&n.addIssue({code:"custom",path:[r],message:`duplicate value: ${o}`}),i.add(o)})}function fx(e,t,n){e==="not_applicable"&&t===null&&n.addIssue({code:"custom",path:["not_applicable_reason"],message:"not-applicable artifacts require a reason"}),e!=="not_applicable"&&t!==null&&n.addIssue({code:"custom",path:["not_applicable_reason"],message:"applicable artifacts cannot retain a not-applicable reason"})}function tB(e){return e==="review"||e==="spec_review"||e==="quality_review"}var qe,dx,_x,px,ux,X5,Y5,mx=P(()=>{"use strict";qe=He(Xe(),1);Sg();dx=qe.z.string().datetime({offset:!0}),_x=qe.z.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/).nullable(),px=na(qe.z.string().startsWith("AC-")).min(1),ux={test:"TEST-",eval:"EVAL-",check:"CHECK-",review:"REVIEW-",spec_review:"REVIEW-SPEC-",quality_review:"REVIEW-QUALITY-",mutation:"MUT-",integration:"INT-",cross_spec_e2e:"E2E-"},X5=qe.z.object({schema_version:qe.z.literal(2),id:qe.z.string().min(1),kind:Rd,task_id:qe.z.string().startsWith("TASK-"),change_id:qe.z.string().startsWith("CHG-"),execution_id:qe.z.string().startsWith("EXEC-"),run_id:qe.z.string().startsWith("RUN-"),acceptance_ids:px,executed_at:dx,command:qe.z.string().min(1).nullable(),status:qe.z.enum(["passed","failed","not_applicable"]),asserted_outcomes:na(qe.z.string().min(1)).min(1),locators:na(qe.z.string().min(1)).min(1),author_id:qe.z.string().min(1),commit_sha:_x,not_applicable_reason:qe.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{e.id.startsWith(ux[e.kind])||t.addIssue({code:"custom",path:["id"],message:`${e.kind} validation id must start with ${ux[e.kind]}`}),!tB(e.kind)&&e.command===null&&t.addIssue({code:"custom",path:["command"],message:`${e.kind} validation requires its executed command`}),fx(e.status,e.not_applicable_reason,t)}),Y5=qe.z.object({schema_version:qe.z.literal(2),id:qe.z.string().startsWith("EVD-"),task_id:qe.z.string().startsWith("TASK-"),change_id:qe.z.string().startsWith("CHG-"),execution_id:qe.z.string().startsWith("EXEC-"),run_id:qe.z.string().startsWith("RUN-"),acceptance_ids:px,outcome_ids:na(qe.z.string().startsWith("OUT-")).default([]),validation_artifact_ids:na(qe.z.string().min(1)).min(1),observed_at:dx,status:qe.z.enum(["passed","not_applicable"]),summary:qe.z.string().min(1),locators:na(qe.z.string().min(1)).min(1),commit_sha:_x,not_applicable_reason:qe.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{fx(e.status,e.not_applicable_reason,t)})});var gx=P(()=>{"use strict"});var hx=P(()=>{"use strict"});var yx=P(()=>{"use strict";mx();gx();Sg();hx()});var vx=P(()=>{"use strict"});var bx=P(()=>{"use strict";vx()});function kx(e){return(0,Sx.createHash)("sha256").update(JSON.stringify(kg(e))).digest("hex")}function kg(e){return Array.isArray(e)?e.map(kg):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>[t,kg(n)])):e}var Sx,wx=P(()=>{"use strict";Sx=require("node:crypto")});async function Id(e,t,n){if(e===null)throw new TypeError("SPEC requires an implementation stack snapshot before prepare or execute");let i=n.projectConfig?.stack;if(i===void 0)throw new TypeError("SPEC stack validation requires .agents/config/project.yaml");if(e.stack_profile!==i.id)throw new TypeError(`SPEC stack_profile ${e.stack_profile} does not match project stack.id ${i.id}`);if($d(e.stack_overrides)!==$d(i.overrides))throw new TypeError("SPEC stack_overrides do not match project stack.overrides");for(let r of e.stack_components){if(!await t.exists(r.version_source))throw new TypeError(`SPEC stack component ${r.name} has missing version source ${r.version_source}`);if(!(await t.readText(r.version_source)).includes(r.version))throw new TypeError(`SPEC stack component ${r.name} version source ${r.version_source} does not contain exact version ${r.version}`)}}function $d(e){return Array.isArray(e)?`[${e.map($d).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${$d(n)}`).join(",")}}`:JSON.stringify(e)}var Yt,nB,rB,iB,Cd,ra=P(()=>{"use strict";Yt=He(Xe(),1),nB=Yt.z.string().min(1).superRefine((e,t)=>{(e.toLowerCase()==="latest"||/[<>=~^*|,\s]/.test(e)||/(?:^|[.-])[xX](?:$|[.-])/.test(e))&&t.addIssue({code:"custom",message:"Expected an exact resolved version, not a range, wildcard, or moving tag"})}),rB=Yt.z.string().min(1).superRefine((e,t)=>{(e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||/^[A-Za-z]:/.test(e)||e.split("/").some(n=>n.length===0||n==="."||n===".."))&&t.addIssue({code:"custom",message:"version_source must be a canonical workspace-relative file path"})}),iB=Yt.z.object({name:Yt.z.string().min(1),kind:Yt.z.enum(["language","runtime","framework","library","persistence","database","tooling","platform"]),version:nB,version_source:rB}).strict(),Cd=Yt.z.object({stack_profile:Yt.z.string().min(1),stack_overrides:Yt.z.record(Yt.z.string(),Yt.z.unknown()),stack_description:Yt.z.string().min(20),stack_components:Yt.z.array(iB).min(1)}).strict().superRefine((e,t)=>{e.stack_components.some(i=>i.kind==="language")||t.addIssue({code:"custom",path:["stack_components"],message:"SPEC implementation requires at least one exact programming language"});let n=e.stack_description.toLocaleLowerCase("en");for(let[i,r]of e.stack_components.entries())(!n.includes(r.name.toLocaleLowerCase("en"))||!n.includes(r.version.toLocaleLowerCase("en")))&&t.addIssue({code:"custom",path:["stack_components",i],message:`stack_description must mention ${r.name} ${r.version}`})})});var vn,zt,ia,no,Si,oa,It,aa,ki,ro,Ex,wg=P(()=>{"use strict";vn=He(Xe(),1),zt=vn.z.string().datetime({offset:!0}),ia=vn.z.string().regex(/^[a-f0-9]{64}$/),no=vn.z.string().startsWith("PRD-"),Si=vn.z.string().startsWith("SPEC-"),oa=vn.z.string().startsWith("CHG-"),It=vn.z.string().startsWith("TASK-"),aa=vn.z.string().startsWith("EXEC-"),ki=vn.z.string().startsWith("REQ-"),ro=vn.z.string().startsWith("AC-"),Ex=vn.z.string().startsWith("OUT-")});function Is(e){return ca.parse({revision:e.revision,hash:e.hash,execution_id:e.execution_id})}function Ix(e){let t=[],n=new Map(e.blueprints.changes.map(c=>[c.id,c])),i=new Map(e.blueprints.tasks.map(c=>[c.id,c])),r=new Map((e.blueprints.specs??[]).map(c=>[c.id,c]));Cs(e.blueprints.changes.map(c=>c.key),"duplicate-key",["blueprints","changes"],t),Cs((e.blueprints.specs??[]).map(c=>c.id),"duplicate-id",["blueprints","specs"],t),Cs(e.blueprints.tasks.map(c=>c.key),"duplicate-key",["blueprints","tasks"],t),Cs([...e.blueprints.changes,...e.blueprints.tasks].map(c=>c.id),"duplicate-id",["blueprints"],t);for(let[c,d]of e.blueprints.tasks.entries()){d.model_profile!==void 0&&d.risk!==d.model_profile.risk&&t.push({rule:"risk-classification",path:["blueprints","tasks",c,"risk"],message:`Task risk ${d.risk} does not match classified risk ${d.model_profile.risk}`});let u=n.get(d.change_id);if(u===void 0){t.push({rule:"missing-change",path:["blueprints","tasks",c,"change_id"],message:`${d.change_id} does not resolve`});continue}for(let _ of d.requirement_ids)u.requirement_ids.includes(_)||t.push({rule:"requirement-outside-change",path:["blueprints","tasks",c,"requirement_ids"],message:`${_} is absent from ${u.id}`});for(let _ of d.acceptance_ids)u.acceptance_ids.includes(_)||t.push({rule:"acceptance-outside-change",path:["blueprints","tasks",c,"acceptance_ids"],message:`${_} is absent from ${u.id}`})}for(let[c,d]of e.blueprints.changes.entries())[...i.values()].some(u=>u.change_id===d.id)||t.push({rule:"change-without-task",path:["blueprints","changes",c],message:`${d.id} has no task`}),pB(e.source,d.source)||t.push({rule:"source-mismatch",path:["blueprints","changes",c,"source"],message:`${d.id} source does not match the prepared plan source`}),e.source.type==="prd"&&d.source.type==="prd"&&d.source.spec_id===null&&t.push({rule:"prd-change-without-spec",path:["blueprints","changes",c,"source","spec_id"],message:`${d.id} must belong to a SPEC of ${e.source.prd_id}`}),e.source.type==="prd"&&d.source.type==="prd"&&d.source.spec_id!==null&&e.blueprints.specs!==void 0&&!r.has(d.source.spec_id)&&t.push({rule:"missing-spec-blueprint",path:["blueprints","changes",c,"source","spec_id"],message:`${d.source.spec_id} requires a composite SPEC blueprint`});if(e.blueprints.specs!==void 0&&e.source.type==="prd"){let c=e.source.prd_id,d=new Set(e.blueprints.changes.flatMap(_=>_.source.type==="prd"&&_.source.prd_id===c?[_.source.spec_id]:[]));for(let[_,p]of e.blueprints.specs.entries()){d.has(p.id)||t.push({rule:"orphan-spec-blueprint",path:["blueprints","specs",_,"id"],message:`${p.id} has no PRD Change`});for(let v of p.requirement_ids)e.blueprints.changes.some(f=>f.source.type==="prd"&&f.source.spec_id===p.id&&f.requirement_ids.includes(v))||t.push({rule:"orphan-spec-blueprint",path:["blueprints","specs",_,"requirement_ids"],message:`${v} is not used by ${p.id}`});for(let v of p.acceptance_ids)e.blueprints.changes.some(f=>f.source.type==="prd"&&f.source.spec_id===p.id&&f.acceptance_ids.includes(v))||t.push({rule:"orphan-spec-blueprint",path:["blueprints","specs",_,"acceptance_ids"],message:`${v} is not used by ${p.id}`})}let u=new Map(e.blueprints.tasks.map(_=>{let p=n.get(_.change_id);return[_.id,p?.source.type==="prd"?p.source.spec_id:null]}));for(let[_,p]of e.dag.nodes.entries())for(let v of p.depends_on){let f=u.get(p.task_id),h=u.get(v);f!==null&&h!==null&&f!==h&&t.push({rule:"cross-spec-dependency",path:["dag","nodes",_,"depends_on"],message:`${p.task_id} crosses SPEC boundary; compose it into one SPEC instead`})}for(let _=0;_<e.blueprints.specs.length;_+=1)for(let p=_+1;p<e.blueprints.specs.length;p+=1){let v=e.blueprints.specs[_],f=e.blueprints.specs[p];if(v===void 0||f===void 0)continue;let h=v.included_scope.find(k=>f.included_scope.some(w=>Ax(k,w)));h!==void 0&&t.push({rule:"overlapping-spec-scope",path:["blueprints","specs"],message:`${v.id} and ${f.id} overlap at ${h}; compose them into one SPEC`})}}e.source.type==="spec"&&e.blueprints.specs!==void 0&&(e.blueprints.specs.length!==1||e.blueprints.specs[0]?.id!==e.source.spec_id)&&t.push({rule:"missing-spec-blueprint",path:["blueprints","specs"],message:`SPEC plan must contain exactly its source blueprint ${e.source.spec_id}`}),e.source.type==="task"&&!i.has(e.source.task_id)&&t.push({rule:"missing-task",path:["source","task_id"],message:`${e.source.task_id} does not resolve`});let o=new Map(e.dag.nodes.map(c=>[c.task_id,c]));Cs(e.dag.nodes.map(c=>c.task_id),"duplicate-id",["dag","nodes"],t);for(let c of i.values())o.has(c.id)||t.push({rule:"missing-task",path:["dag","nodes"],message:`${c.id} is missing from the DAG`});for(let[c,d]of e.dag.nodes.entries()){i.has(d.task_id)||t.push({rule:"missing-task",path:["dag","nodes",c,"task_id"],message:`${d.task_id} does not resolve`});for(let u of d.depends_on)u===d.task_id?t.push({rule:"self-dependency",path:["dag","nodes",c,"depends_on"],message:`${d.task_id} depends on itself`}):i.has(u)||t.push({rule:"missing-dependency",path:["dag","nodes",c,"depends_on"],message:`${u} does not resolve`})}let a=dB(e.dag.nodes);if(a.length!==i.size?t.push({rule:"cycle",path:["dag"],message:"DAG contains a cycle"}):JSON.stringify(a)!==JSON.stringify(e.dag.topological_order)&&t.push({rule:"topological-order",path:["dag","topological_order"],message:"topological_order is not canonical"}),a.length===i.size){let c=_B(e.dag.nodes),d=[...i.values()];for(let u=0;u<d.length;u+=1)for(let _=u+1;_<d.length;_+=1){let p=d[u],v=d[_];if(p===void 0||v===void 0)continue;let f=p.write_scopes.find(k=>v.write_scopes.some(w=>Ax(k,w)));if(f===void 0)continue;c.get(p.id)?.has(v.id)===!0||c.get(v.id)?.has(p.id)===!0||t.push({rule:"overlapping-write-scope",path:["blueprints","tasks"],message:`${p.id} and ${v.id} may overlap at ${f}; add a DAG dependency`})}}let{hash:s,...l}=e;return kx(l)!==e.hash&&t.push({rule:"hash",path:["hash"],message:"prepared plan hash does not match"}),t}function dB(e){let t=new Set(e.map(a=>a.task_id)),n=new Map(e.map(a=>[a.task_id,0])),i=new Map;for(let a of e)for(let s of new Set(a.depends_on))!t.has(s)||s===a.task_id||(n.set(a.task_id,(n.get(a.task_id)??0)+1),i.set(s,[...i.get(s)??[],a.task_id]));let r=[...n].filter(([,a])=>a===0).map(([a])=>a).sort(),o=[];for(;r.length>0;){let a=r.shift();o.push(a);for(let s of(i.get(a)??[]).sort()){let l=(n.get(s)??0)-1;n.set(s,l),l===0&&(r.push(s),r.sort())}}return o}function Nx(e,t){if(e.source.type!=="prd"||e.source.prd_id!==t)throw new TypeError(`Prepared plan source must be prd ${t}`);let n=e.blueprints.changes.map(i=>{if(i.source.type!=="prd"||i.source.prd_id!==t||i.source.spec_id===null)throw new TypeError(`Every PRD Change must belong to a SPEC of ${t}`);return i.source.spec_id});return[...new Set(n)].sort()}function _B(e){let t=new Map(e.map(r=>[r.task_id,r.depends_on])),n=new Map,i=(r,o)=>{let a=n.get(r);if(a!==void 0)return a;if(o.has(r))return new Set;let s=new Set;for(let l of t.get(r)??[]){s.add(l);for(let c of i(l,new Set([...o,r])))s.add(c)}return n.set(r,s),s};for(let r of t.keys())i(r,new Set);return n}function Ax(e,t){if(e===t)return!0;let n=e.search(/[*?]/),i=t.search(/[*?]/);if(n===-1&&i===-1)return!1;let r=e.slice(0,n===-1?e.length:n).replace(/\/$/,""),o=t.slice(0,i===-1?t.length:i).replace(/\/$/,"");return r===o||r.startsWith(`${o}/`)||o.startsWith(`${r}/`)}function pB(e,t){return e.type!==t.type?!1:e.type==="task"&&t.type==="task"?e.task_id===t.task_id:e.type==="spec"&&t.type==="spec"?e.spec_id===t.spec_id:e.type==="prd"&&t.type==="prd"&&e.prd_id===t.prd_id}function Cs(e,t,n,i){let r=new Set;for(let o of e)r.has(o)&&i.push({rule:t,path:n,message:`Duplicate value: ${o}`}),r.add(o)}function Qt(e,t,n){let i=new Set;for(let r of e)i.has(r)&&n.addIssue({code:"custom",path:[t],message:`Duplicate value: ${r}`}),i.add(r)}var Y,sa,oB,ca,la,Ag,Tg,Tx,aB,xg,xx,Eg,Ox,Rx,$x,sB,cB,Cx,lB,uB,Jr,Ns=P(()=>{"use strict";vt();Y=He(Xe(),1);wx();ra();wg();sa=Y.z.enum(["lite","standard","critical"]),oB=Y.z.enum(["low","medium","high","urgent"]),ca=Y.z.object({revision:Y.z.number().int().positive(),hash:ia,execution_id:aa}).strict();la=Y.z.discriminatedUnion("type",[Y.z.object({type:Y.z.literal("task"),task_id:It}).strict(),Y.z.object({type:Y.z.literal("spec"),spec_id:Si}).strict(),Y.z.object({type:Y.z.literal("prd"),prd_id:no}).strict()]),Ag=Y.z.discriminatedUnion("type",[Y.z.object({type:Y.z.literal("task"),task_id:It}).strict(),Y.z.object({type:Y.z.literal("spec"),spec_id:Si}).strict(),Y.z.object({type:Y.z.literal("prd"),prd_id:no,spec_id:Si.nullable()}).strict()]),Tg=Y.z.discriminatedUnion("type",[Y.z.object({type:Y.z.literal("none"),reason:Y.z.string().min(1)}).strict(),Y.z.object({type:Y.z.literal("update"),requirement_ids:Y.z.array(ki).min(1)}).strict()]),Tx=Y.z.object({model:tk,reasoning_effort:nk,velocity:Mp.optional()}).strict(),aB=Tx.extend({client:Y.z.string().min(1),provider:Y.z.string().min(1)}).strict(),xg=Y.z.object({failure_policy:Y.z.enum(["stop_on_terminal_failure","continue_independent"]),max_parallelism:Y.z.number().int().positive(),independent_branches:Y.z.boolean().optional(),max_cost_usd:Y.z.number().nonnegative().nullable().optional(),max_operational_retries:Y.z.number().int().nonnegative(),max_repair_cycles_per_task:Y.z.number().int().nonnegative(),soft_model_cycle_budget:Y.z.number().int().positive().optional(),soft_input_token_budget:Y.z.number().int().positive().optional(),context_refresh_after_cycles:Y.z.number().int().positive().optional(),verification_mode:Y.z.enum(["scoped","full"]).optional(),runtime_defaults:aB.optional()}).strict(),xx=Y.z.string().regex(/^[a-z][a-z0-9-]*$/),Eg=Y.z.string().min(1).superRefine((e,t)=>{(e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.startsWith("./")||/^[A-Za-z]:/.test(e)||e.split("/").some(n=>n.length===0||n==="."||n===".."))&&t.addIssue({code:"custom",message:"write_scope must be workspace-relative"})}),Ox=Y.z.object({key:xx,id:oa,title:Y.z.string().min(1),short_name:Y.z.string().min(1),risk:sa,source:Ag,requirement_ids:Y.z.array(ki).min(1),acceptance_ids:Y.z.array(ro).min(1),requirement_impact:Tg}).strict().superRefine((e,t)=>{Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t)}),Rx=Y.z.object({id:Si,title:Y.z.string().min(1),short_name:Y.z.string().min(1),objective:Y.z.string().min(1),summary:Y.z.string().min(1),risk:sa,included_scope:Y.z.array(Eg).min(1),excluded_scope:Y.z.array(Eg),requirement_ids:Y.z.array(ki).min(1),acceptance_ids:Y.z.array(ro).min(1),implementation:Cd,rollout:Y.z.string().min(1),fallback:Y.z.string().min(1),model_signals:Gl}).strict().superRefine((e,t)=>{Qt(e.included_scope,"included_scope",t),Qt(e.excluded_scope,"excluded_scope",t),Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t)}),$x={key:xx,id:It,change_id:oa,title:Y.z.string().min(1),short_name:Y.z.string().min(1),objective:Y.z.string().min(1),priority:oB,owner:Y.z.string().min(1).nullable(),requirement_ids:Y.z.array(ki).min(1),acceptance_ids:Y.z.array(ro).min(1),write_scopes:Y.z.array(Eg),runtime:Tx.optional()},sB=Y.z.object({...$x,risk:sa,model_profile:Mi.optional()}).strict().superRefine((e,t)=>{Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t),Qt(e.write_scopes,"write_scopes",t)}),cB=Y.z.object({...$x,risk:sa.optional(),model_signals:Gl.optional(),model_profile:Mi.optional()}).strict().superRefine((e,t)=>{Qt(e.requirement_ids,"requirement_ids",t),Qt(e.acceptance_ids,"acceptance_ids",t),Qt(e.write_scopes,"write_scopes",t)}),Cx=Y.z.object({task_id:It,depends_on:Y.z.array(It)}).strict().superRefine((e,t)=>{e.depends_on.includes(e.task_id)&&t.addIssue({code:"custom",path:["depends_on"],message:"self dependency"}),Qt(e.depends_on,"depends_on",t)}),lB=Y.z.object({revision:Y.z.number().int().positive(),source:la,execution_id:aa,prepared_at:zt,policy:xg,blueprints:Y.z.object({specs:Y.z.array(Rx).min(1).optional(),changes:Y.z.array(Ox).min(1),tasks:Y.z.array(cB).min(1)}).strict(),dag:Y.z.object({nodes:Y.z.array(Cx).min(1)}).strict()}).strict(),uB=lB.extend({schema_version:Y.z.literal(2),blueprints:Y.z.object({specs:Y.z.array(Rx).min(1).optional(),changes:Y.z.array(Ox).min(1),tasks:Y.z.array(sB).min(1)}).strict(),dag:Y.z.object({nodes:Y.z.array(Cx).min(1),topological_order:Y.z.array(It).min(1)}).strict(),hash:ia}).strict(),Jr=uB.superRefine((e,t)=>{for(let n of Ix(e))t.addIssue({code:"custom",path:[...n.path],message:n.message})})});function kB(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t=e;return Object.hasOwn(t,"outcome_ids")||typeof t.id!="string"||!Array.isArray(t.outcomes)?e:{...t,outcome_ids:Og(t.id,t.outcomes)}}function Og(e,t){let n=e.replace(/^PRD-/,"OUT-");return t.map((i,r)=>`${n}-${String(r+1).padStart(2,"0")}`)}var q,fB,wi,Kr,Ei,Ps,mB,gB,Ms,hB,yB,vB,bB,SB,un,Nd=P(()=>{"use strict";q=He(Xe(),1);Ns();ra();wg();Ns();ra();fB=q.z.object({schema_version:q.z.literal(2),id:no,revision:q.z.number().int().positive(),title:q.z.string().min(1),status:q.z.enum(["draft","ready","active","delivered","blocked","failed","cancelled"]),status_reason:q.z.string().min(1).nullable().default(null),outcome_status:q.z.enum(["unmeasured","measuring","met","not_met","inconclusive"]),problem:q.z.string().min(1),audiences:q.z.array(q.z.string().min(1)),outcomes:q.z.array(q.z.string().min(1)),outcome_ids:q.z.array(Ex),constraints:q.z.array(q.z.string().min(1)),non_goals:q.z.array(q.z.string().min(1)),prepared_plan:Jr.nullable(),plan_ref:ca.nullable().default(null),creation_run_id:q.z.string().startsWith("RUN-").nullable().default(null),rework_of_prd_id:no.nullable().default(null),tags:q.z.array(q.z.string().min(1)).default([]),created_at:zt,updated_at:zt}).strict().superRefine((e,t)=>{e.prepared_plan!==null&&e.plan_ref!==null&&t.addIssue({code:"custom",message:"PRD cannot contain prepared_plan and plan_ref"}),e.outcome_ids.length!==e.outcomes.length&&t.addIssue({code:"custom",path:["outcome_ids"],message:"PRD outcome_ids must identify every declared outcome exactly once"}),new Set(e.outcome_ids).size!==e.outcome_ids.length&&t.addIssue({code:"custom",path:["outcome_ids"],message:"PRD outcome_ids must be unique"})}),wi=q.z.preprocess(kB,fB),Kr=q.z.object({schema_version:q.z.literal(2),id:Si,prd_id:no.nullable(),revision:q.z.number().int().positive(),title:q.z.string().min(1),status:q.z.enum(["draft","ready","active","delivered","blocked","failed","cancelled"]),status_reason:q.z.string().min(1).nullable().default(null),objective:q.z.string().min(1),included_scope:q.z.array(q.z.string().min(1)),excluded_scope:q.z.array(q.z.string().min(1)),requirement_ids:q.z.array(ki),acceptance_ids:q.z.array(ro),implementation:Cd.nullable().default(null),prepared_plan:Jr.nullable(),plan_ref:ca.nullable().default(null),creation_run_id:q.z.string().startsWith("RUN-").nullable().default(null),created_at:zt,updated_at:zt}).strict().superRefine((e,t)=>{e.prepared_plan!==null&&e.plan_ref!==null&&t.addIssue({code:"custom",message:"SPEC cannot contain prepared_plan and plan_ref"})}),Ei=q.z.object({schema_version:q.z.literal(2),id:oa,revision:q.z.number().int().positive(),title:q.z.string().min(1),status:q.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),status_reason:q.z.string().min(1).nullable().optional(),risk:sa,source:Ag,requirement_ids:q.z.array(ki).min(1),acceptance_ids:q.z.array(ro).min(1),requirement_impact:Tg,task_ids:q.z.array(It).min(1),plan_revision:q.z.number().int().positive().nullable(),plan_hash:ia.nullable(),created_at:zt,updated_at:zt,started_at:zt.nullable(),finished_at:zt.nullable(),result:q.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{let n=e.plan_revision===null&&e.plan_hash===null;e.status==="draft"||(e.status==="blocked"||e.status==="cancelled")&&n?n||t.addIssue({code:"custom",message:"draft Change cannot contain a prepared plan"}):(n||e.plan_revision===null||e.plan_hash===null)&&t.addIssue({code:"custom",message:`${e.status} Change requires plan_revision and plan_hash`}),["completed","failed","cancelled"].includes(e.status)&&(e.finished_at===null||e.result===null)&&t.addIssue({code:"custom",message:"terminal Change requires finished_at and result"}),["executing","verifying","completed"].includes(e.status)&&e.started_at===null&&t.addIssue({code:"custom",message:`${e.status} Change requires started_at`})}),Ps=q.z.object({task_id:It,change_id:oa,depends_on:q.z.array(It)}).strict(),mB=q.z.object({max_total_invocations:q.z.number().int().positive().nullable(),cancelled:q.z.boolean().default(!1),finalizer_scope:q.z.enum(["spec","parent"]).default("spec")}).strict(),gB=q.z.record(Si,mB).optional(),Ms={schema_version:q.z.literal(2),id:aa,parent_execution_id:aa.nullable().optional(),revision:q.z.number().int().positive(),status:q.z.enum(["planned","running","paused","verifying","completed","failed","blocked","cancelled"]),status_reason:q.z.string().min(1).nullable().optional(),policy:xg,spec_execution_policies:gB,created_at:zt,updated_at:zt,started_at:zt.nullable(),finished_at:zt.nullable(),result:q.z.string().min(1).nullable()},hB=q.z.object({...Ms,kind:q.z.literal("delivery").optional(),client_turn_id:q.z.string().min(1).max(200).nullable().optional(),origin:la,plan_revision:q.z.number().int().positive(),plan_hash:ia,dag:q.z.object({nodes:q.z.array(Ps).min(1),topological_order:q.z.array(It).min(1)}).strict()}).strict(),yB=q.z.object({...Ms,kind:q.z.literal("delivery"),client_turn_id:q.z.string().min(1).max(200),origin:la,status:q.z.enum(["planned","blocked"]),plan_revision:q.z.null(),plan_hash:q.z.null(),dag:q.z.object({nodes:q.z.array(Ps).length(0),topological_order:q.z.array(It).length(0)}).strict()}).strict(),vB=q.z.object({...Ms,kind:q.z.literal("delivery"),client_turn_id:q.z.string().min(1).max(200).nullable().optional(),origin:la,status:q.z.literal("cancelled"),plan_revision:q.z.null(),plan_hash:q.z.null(),dag:q.z.object({nodes:q.z.array(Ps).length(0),topological_order:q.z.array(It).length(0)}).strict()}).strict(),bB=q.z.object({...Ms,kind:q.z.literal("interaction"),client_turn_id:q.z.string().min(1).max(200),origin:q.z.object({type:q.z.literal("interaction"),conversation_id:q.z.string().startsWith("CONV-")}).strict(),plan_revision:q.z.null(),plan_hash:q.z.null(),dag:q.z.object({nodes:q.z.array(Ps).length(0),topological_order:q.z.array(It).length(0)}).strict()}).strict(),SB=q.z.object({...Ms,kind:q.z.literal("interaction"),client_turn_id:q.z.string().min(1).max(200).nullable().optional(),origin:la,plan_revision:q.z.null(),plan_hash:q.z.null(),dag:q.z.object({nodes:q.z.array(Ps).length(0),topological_order:q.z.array(It).length(0)}).strict()}).strict(),un=q.z.union([bB,SB,vB,yB,hB]).superRefine((e,t)=>{e.status==="blocked"&&e.status_reason==null&&t.addIssue({code:"custom",message:"blocked Execution requires status_reason"}),["completed","failed","cancelled"].includes(e.status)&&(e.finished_at===null||e.result===null)&&t.addIssue({code:"custom",message:"terminal Execution requires finished_at and result"}),["running","paused","verifying","completed"].includes(e.status)&&e.started_at===null&&t.addIssue({code:"custom",message:`${e.status} Execution requires started_at`})})});function Lx(e){return un.parse({schema_version:2,id:e.id,revision:1,kind:"interaction",client_turn_id:e.clientTurnId,origin:e.origin,status:"running",status_reason:null,plan_revision:null,plan_hash:null,policy:e.policy,dag:{nodes:[],topological_order:[]},created_at:e.now,updated_at:e.now,started_at:e.now,finished_at:null,result:null})}function jx(e){return un.parse({schema_version:2,id:e.id,revision:1,kind:"delivery",client_turn_id:e.clientTurnId,origin:e.origin,status:"planned",status_reason:null,plan_revision:null,plan_hash:null,policy:e.policy,dag:{nodes:[],topological_order:[]},created_at:e.now,updated_at:e.now,started_at:null,finished_at:null,result:null})}function Px(e){let t;try{t=JSON.parse(e)}catch{throw new Ai("Invalid persisted client turn claim")}if(t.schema_version!==1||typeof t.client_turn_id!="string"||typeof t.execution_id!="string"||t.kind!=="interaction"&&t.kind!=="delivery"||typeof t.origin!="object"||t.origin===null)throw new Ai("Invalid persisted client turn claim");return{schema_version:1,client_turn_id:t.client_turn_id,execution_id:t.execution_id,kind:t.kind,origin:t.origin}}function Rg(e){return e instanceof Error&&"code"in e&&e.code==="EEXIST"}var Mx,Ai,Pd,$g=P(()=>{"use strict";Mx=require("node:crypto");vt();Nd();Ai=class extends Error{name="ExecutionClientTurnConflictError"},Pd=class{constructor(t,n){this.filesystem=t;this._layout=n}filesystem;_layout;async claimIdentity(t,n,i,r,o){let a=o.filter(u=>u.client_turn_id===t);if(a.length>1)throw new Ai(`Client turn resolves to multiple Executions: ${t}`);let s=a[0];s!==void 0&&this.assertExpectedExecution(s,i,r);let l={schema_version:1,client_turn_id:t,execution_id:s?.id??n,kind:i,origin:r},c=this.claimPath(t);try{return await this.filesystem.writeTextExclusive(c,`${JSON.stringify(l)}
243
+ `),l.execution_id}catch(u){if(!Rg(u))throw u}let d=Px(await this.filesystem.readText(c));return this.assertCompatibleClaim(d,t,i,r),d.execution_id}async claimExplicitIdentity(t,n,i,r){let o={schema_version:1,client_turn_id:t,execution_id:n,kind:i,origin:r},a=this.claimPath(t);try{return await this.filesystem.writeTextExclusive(a,`${JSON.stringify(o)}
244
+ `),n}catch(l){if(!Rg(l))throw l}let s=Px(await this.filesystem.readText(a));return this.assertCompatibleClaim(s,t,i,r),s.execution_id}async createExecution(t,n,i,r,o,a){try{return await this.filesystem.writeTextExclusive(r,o),t}catch(s){if(!Rg(s))throw s;return this.assertExpectedExecution(await a(),n,i)}}assertExpectedExecution(t,n,i){if(t.kind!==n||JSON.stringify(t.origin)!==JSON.stringify(i))throw new Ai(`Client turn ${t.client_turn_id??"unknown"} resolves to incompatible ${t.kind??"legacy-delivery"} Execution ${t.id}`);return t}claimPath(t){let n=(0,Mx.createHash)("sha256").update(t).digest("hex");return Em("execution-client-turn",n)}assertCompatibleClaim(t,n,i,r){if(t.client_turn_id!==n||t.kind!==i||JSON.stringify(t.origin)!==JSON.stringify(r))throw new Ai(`Client turn ${n} is already claimed by incompatible Execution ${t.execution_id}`)}}});function Dx(e){return`# ${e.title}
245
+
246
+ ## Problema
247
+
248
+ ${e.problem}
249
+
250
+ ## Outcomes
251
+
252
+ ${Ls(e.outcomes)}
253
+
254
+ ## Restri\xE7\xF5es
255
+
256
+ ${Ls(e.constraints)}
257
+
258
+ ## Fora de escopo
259
+
260
+ ${Ls(e.non_goals)}`}function Ux(e){let t=e.implementation,n=t===null?"N\xE3o resolvida. Consulte `stack` e `stack.overrides` em `.agents/config/project.yaml` antes de preparar esta SPEC.":`Profile: ${t.stack_profile}
261
+
262
+ ${t.stack_description}
263
+
264
+ ${t.stack_components.map(i=>`- ${i.kind}: ${i.name} ${i.version} (${i.version_source})`).join(`
265
+ `)}`;return`# ${e.title}
266
+
267
+ ## Objetivo
268
+
269
+ ${e.objective}
270
+
271
+ ## Escopo
272
+
273
+ ${Ls(e.included_scope)}
274
+
275
+ ## Fora de escopo
276
+
277
+ ${Ls(e.excluded_scope)}
278
+
279
+ ## Stack de implementa\xE7\xE3o
280
+
281
+ ${n}`}function Ls(e){return e.length===0?"Nenhum.":e.map(t=>`- ${t}`).join(`
282
+ `)}var zx=P(()=>{"use strict"});function Cg(e,t,n,i){let r=new Intl.DateTimeFormat("en-CA",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(n.now()),o=a=>{let s=r.find(l=>l.type===a)?.value;if(s===void 0)throw new Error(`Unable to format ID date part: ${a}`);return s};return[e,o("year"),o("month"),o("day"),o("hour"),o("minute"),Sm(t),qi()].join("-")}var Fx=P(()=>{"use strict";vt()});function qx(e){return`# ${e}
283
+
284
+ ## Plano
285
+
286
+ Plano preparado e aguardando execu\xE7\xE3o.
287
+
288
+ ## Implementa\xE7\xE3o
289
+
290
+ Ainda n\xE3o executada.
291
+
292
+ ## Decis\xF5es
293
+
294
+ Nenhuma decis\xE3o registrada.
295
+
296
+ ## Evid\xEAncias
297
+
298
+ Nenhuma evid\xEAncia registrada.
299
+
300
+ ## Evals
301
+
302
+ Ainda n\xE3o executados.
303
+
304
+ ## Testes
305
+
306
+ Ainda n\xE3o executados.
307
+
308
+ ## Resultado
309
+
310
+ Aguardando execu\xE7\xE3o.`}function Wx(e,t){return e.id===t.id&&e.title===t.title&&e.risk===t.risk&&JSON.stringify(e.source)===JSON.stringify(t.source)&&e.requirement_ids.every(n=>t.requirement_ids.includes(n))&&e.acceptance_ids.every(n=>t.acceptance_ids.includes(n))&&e.task_ids.every(n=>t.task_ids.includes(n))}function wB(e,t){return e.status==="planned"&&Wx(e,t)&&e.plan_revision===t.plan_revision&&e.plan_hash===t.plan_hash&&JSON.stringify(e.requirement_impact)===JSON.stringify(t.requirement_impact)}function Vx(e){return`# Execution ${e.id}
311
+
312
+ ## Plano
313
+
314
+ DAG e pol\xEDtica est\xE3o persistidas no frontmatter.
315
+
316
+ ## Progresso
317
+
318
+ Estado atual: ${e.status}.
319
+
320
+ ## Resultado
321
+
322
+ ${e.result??e.status_reason??"Ainda n\xE3o conclu\xEDda."}`}async function js(e,t,n,i){let r=await e.listFiles(t,n);return Promise.all(r.map(async o=>Ct(await e.readText(o),i).metadata))}function Md(e,t,n,i){if(!e[t].includes(n))throw new Error(`Invalid ${i} transition: ${t} -> ${n}`)}function Ld(e){if(e.version===1)throw new TypeError("V2 repositories require a modern WorkspaceLayout")}async function jd(e,t,n,i){let r=await Ss(e,t,n,i);if(r===null)throw new Error(`${n} not found: ${i}`);return r}var io,oo,ao,so,EB,AB,TB,xB,Zx=P(()=>{"use strict";vt();$g();zx();Fx();$g();Ns();ra();Nd();io=class{constructor(t,n){this.filesystem=t;this.layout=n;Ld(n)}filesystem;layout;async create(t){let n=t.clock??new Qe,i=n.now().toISOString(),r=t.id??Cg("PRD",t.shortName,n,this.layout.project.timezone),o=[...t.outcomes??[]],a=wi.parse({schema_version:2,id:r,revision:1,title:t.title,status:"draft",status_reason:null,outcome_status:"unmeasured",problem:t.problem,audiences:[...t.audiences??[]],outcomes:o,outcome_ids:t.outcomeIds??Og(r,o),constraints:[...t.constraints??[]],non_goals:[...t.nonGoals??[]],prepared_plan:null,plan_ref:null,creation_run_id:t.creationRunId??null,rework_of_prd_id:t.reworkOfPrdId??null,tags:[...t.tags??[]],created_at:i,updated_at:i});return await this.write(a,Dx(a),!0),a}async createReworkSuccessor(t,n){let{prd:i}=await this.read(t);if(i.status!=="cancelled")throw new TypeError(`PRD ${t} must be cancelled before rework`);return this.create({...n,reworkOfPrdId:i.id,tags:["rework"]})}async read(t){let n=await jd(this.filesystem,this.layout,"prd",t),i=Ct(await this.filesystem.readText(n),wi);return{prd:i.metadata,body:i.body}}async list(){return js(this.filesystem,this.layout.entityRoot("prd"),".md",wi)}async setPreparedPlan(t,n){let i=Jr.parse(n),r=await this.read(t);if(!new Set(["draft","ready"]).has(r.prd.status))throw new TypeError(`PRD ${t} cannot be prepared from status ${r.prd.status}`);let o=Nx(i,t);if(o.length===0)throw new TypeError(`PRD ${t} requires at least one SPEC`);let a=await js(this.filesystem,this.layout.entityRoot("spec"),".md",Kr),s=new Map(a.map(c=>[c.id,c]));for(let c of o){let d=s.get(c);if(d===void 0)throw new TypeError(`PRD SPEC does not resolve: ${c}`);if(d.prd_id!==t)throw new TypeError(`SPEC ${c} does not belong to PRD ${t}`);if(["active","delivered","cancelled"].includes(d.status))throw new TypeError(`SPEC ${c} cannot be prepared from status ${d.status}`);await Id(d.implementation,this.filesystem,this.layout)}let l=wi.parse({...r.prd,revision:r.prd.revision+1,prepared_plan:i,plan_ref:null,updated_at:i.prepared_at});return await this.write(l,r.body),l}async transition(t,n,i=new Qe,r=null){let o=await this.read(t);Md(EB,o.prd.status,n,"PRD");let a=typeof i=="string"?new Qe:i,s=typeof i=="string"?i:r,l=wi.parse({...o.prd,revision:o.prd.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?s??`PRD moved to ${n}.`:null,updated_at:a.now().toISOString()});return await this.write(l,o.body),l}async normalizePreparedPlan(t,n){let i=await this.read(t);if(i.prd.plan_ref?.hash===n.hash)return i.prd;if(i.prd.prepared_plan?.hash!==n.hash)throw new Error(`PRD ${t} does not contain PreparedPlan ${n.hash}`);let r=wi.parse({...i.prd,revision:i.prd.revision+1,prepared_plan:null,plan_ref:Is(n),updated_at:new Date().toISOString()});return await this.write(r,i.body),r}path(t){return this.layout.activePath("prd",t)}async write(t,n,i=!1){await this.filesystem[i?"writeTextAtomicExclusive":"writeTextAtomic"](this.path(t.id),ln({metadata:wi.parse(t),body:n}))}},oo=class{constructor(t,n){this.filesystem=t;this.layout=n;Ld(n)}filesystem;layout;async create(t){let n=t.clock??new Qe,i=n.now().toISOString(),r=Kr.parse({schema_version:2,id:t.id??Cg("SPEC",t.shortName,n,this.layout.project.timezone),prd_id:t.prdId??null,revision:1,title:t.title,status:"draft",status_reason:null,objective:t.objective,included_scope:[...t.includedScope??[]],excluded_scope:[...t.excludedScope??[]],requirement_ids:[...t.requirementIds??[]],acceptance_ids:[...t.acceptanceIds??[]],implementation:t.implementation??null,prepared_plan:null,plan_ref:null,creation_run_id:t.creationRunId??null,created_at:i,updated_at:i});return await this.write(r,Ux(r),!0),r}async read(t){let n=await jd(this.filesystem,this.layout,"spec",t),i=Ct(await this.filesystem.readText(n),Kr);return{spec:i.metadata,body:i.body}}async list(){return js(this.filesystem,this.layout.entityRoot("spec"),".md",Kr)}async setPreparedPlan(t,n){let i=Jr.parse(n);if(i.source.type!=="spec"||i.source.spec_id!==t)throw new TypeError(`Prepared plan source must be spec ${t}`);let r=await this.read(t);if(!new Set(["draft","ready"]).has(r.spec.status))throw new TypeError(`SPEC ${t} cannot be prepared from status ${r.spec.status}`);await Id(r.spec.implementation,this.filesystem,this.layout);let o=Kr.parse({...r.spec,revision:r.spec.revision+1,prepared_plan:i,plan_ref:null,updated_at:i.prepared_at});return await this.write(o,r.body),o}async transition(t,n,i=new Qe,r=null){let o=await this.read(t);Md(AB,o.spec.status,n,"DeliverySpec");let a=typeof i=="string"?new Qe:i,s=typeof i=="string"?i:r;["active","delivered"].includes(n)&&await Id(o.spec.implementation,this.filesystem,this.layout);let l=Kr.parse({...o.spec,revision:o.spec.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?s??`SPEC moved to ${n}.`:null,updated_at:a.now().toISOString()});return await this.write(l,o.body),l}async normalizePreparedPlan(t,n){let i=await this.read(t);if(i.spec.plan_ref?.hash===n.hash)return i.spec;if(i.spec.prepared_plan?.hash!==n.hash)throw new Error(`SPEC ${t} does not contain PreparedPlan ${n.hash}`);let r=Kr.parse({...i.spec,revision:i.spec.revision+1,prepared_plan:null,plan_ref:Is(n),updated_at:new Date().toISOString()});return await this.write(r,i.body),r}path(t){return this.layout.activePath("spec",t)}async write(t,n,i=!1){await this.filesystem[i?"writeTextAtomicExclusive":"writeTextAtomic"](this.path(t.id),ln({metadata:Kr.parse(t),body:n}))}},ao=class{constructor(t,n){this.filesystem=t;this.layout=n;Ld(n)}filesystem;layout;async read(t){let n=await jd(this.filesystem,this.layout,"change",t),i=Ct(await this.filesystem.readText(n),Ei);return{change:i.metadata,body:i.body}}async createDraft(t){let i=(t.clock??new Qe).now().toISOString(),r=Ei.parse({schema_version:2,id:t.id,revision:1,title:t.title,status:"draft",risk:t.risk,source:{type:"task",task_id:t.taskId},requirement_ids:[...t.requirementIds],acceptance_ids:[...t.acceptanceIds],requirement_impact:{type:"none",reason:"Awaiting prepared plan."},task_ids:[t.taskId],plan_revision:null,plan_hash:null,created_at:i,updated_at:i,started_at:null,finished_at:null,result:null});return await this.filesystem.writeTextExclusive(this.path(r.id),this.serialize(r)),r}async promoteDraft(t,n){let i=await this.read(t);if(i.change.status==="planned"&&wB(i.change,n))return i.change;if(i.change.status!=="draft"||!Wx(i.change,n))throw new TypeError(`Change ${t} does not match its Task draft`);let r=Ei.parse({...n,revision:i.change.revision+1,created_at:i.change.created_at,updated_at:n.updated_at});return await this.write(r),r}async list(){return js(this.filesystem,this.layout.entityRoot("change"),"change.md",Ei)}async transition(t,n,i=null,r=new Qe,o=null){let a=await this.read(t);Md(TB,a.change.status,n,"Change");let s=r.now().toISOString(),l=["completed","failed","cancelled"].includes(n),c=Ei.parse({...a.change,revision:a.change.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?o??i??`Change moved to ${n}.`:null,updated_at:s,started_at:n==="executing"&&a.change.started_at===null?s:a.change.started_at,finished_at:l?s:null,result:l?i:null});return await this.write(c,a.body),c}async write(t,n=qx(t.title)){await this.filesystem.writeTextAtomic(this.path(t.id),this.serialize(t,n))}serialize(t,n=qx(t.title)){return ln({metadata:Ei.parse(t),body:n})}path(t){return this.layout.activePath("change",t)}},so=class{constructor(t,n){this.filesystem=t;this.layout=n;Ld(n),this.clientTurnClaims=new Pd(t,n)}filesystem;layout;clientTurnClaims;async read(t){let n=await jd(this.filesystem,this.layout,"execution",t),i=Ct(await this.filesystem.readText(n),un);return{execution:i.metadata,body:i.body}}async list(){return js(this.filesystem,this.layout.entityRoot("execution"),"execution.md",un)}async createInteraction(t){let n={type:"interaction",conversation_id:t.conversationId},i=await this.clientTurnClaims.claimIdentity(t.clientTurnId,t.id,"interaction",n,await this.list()),r=await this.read(i).catch(()=>null);if(r!==null)return this.clientTurnClaims.assertExpectedExecution(r.execution,"interaction",n);let a=(t.clock??new Qe).now().toISOString(),s=Lx({id:i,clientTurnId:t.clientTurnId,origin:n,policy:t.policy,now:a});return this.clientTurnClaims.createExecution(s,"interaction",n,this.path(s.id),this.serialize(s),async()=>(await this.read(s.id)).execution)}async createDeliveryIntake(t){let n=await this.clientTurnClaims.claimIdentity(t.clientTurnId,t.id,"delivery",t.origin,await this.list()),i=await this.read(n).catch(()=>null);if(i!==null)return this.clientTurnClaims.assertExpectedExecution(i.execution,"delivery",t.origin);let o=(t.clock??new Qe).now().toISOString(),a=jx({id:n,clientTurnId:t.clientTurnId,origin:t.origin,policy:t.policy,now:o});return this.clientTurnClaims.createExecution(a,"delivery",t.origin,this.path(a.id),this.serialize(a),async()=>(await this.read(a.id)).execution)}async promoteDeliveryIntake(t,n){let i=await this.read(t);if(i.execution.plan_hash===n.plan_hash)return i.execution;if(i.execution.kind!=="delivery"||i.execution.plan_hash!==null||i.execution.plan_revision!==null||JSON.stringify(i.execution.origin)!==JSON.stringify(n.origin))throw new TypeError(`Execution ${t} is not a matching delivery intake`);let r=un.parse({...n,kind:"delivery",client_turn_id:i.execution.client_turn_id,revision:i.execution.revision+1,created_at:i.execution.created_at});return await this.write(r),r}async claimClientTurn(t,n){let i=await this.read(t),r=i.execution.kind??"delivery",o=await this.clientTurnClaims.claimExplicitIdentity(n,t,r,i.execution.origin);if(o!==t){let s=await this.read(o);return this.clientTurnClaims.assertExpectedExecution(s.execution,r,i.execution.origin)}if(i.execution.kind==="interaction"){if(i.execution.client_turn_id!==n)throw new Error(`Interaction Execution ${t} belongs to another client turn`);return i.execution}if(i.execution.client_turn_id===n)return i.execution;if(i.execution.client_turn_id!=null)throw new Error(`Delivery Execution ${t} already belongs to another client turn`);let a=un.parse({...i.execution,revision:i.execution.revision+1,kind:"delivery",client_turn_id:n,updated_at:new Date().toISOString()});return await this.write(a),a}async linkChildExecution(t,n){if(t===n)throw new TypeError("Execution cannot be its own parent");let[i,r]=await Promise.all([this.read(t),this.read(n)]);if(i.execution.origin.type!=="spec"||r.execution.origin.type!=="prd")throw new TypeError("Child Execution must originate from a SPEC under a PRD Execution");if(i.execution.parent_execution_id===n)return i.execution;if(i.execution.parent_execution_id!=null)throw new TypeError(`Execution ${t} is already linked to ${i.execution.parent_execution_id}`);if(["completed","failed","cancelled"].includes(r.execution.status))throw new TypeError(`Parent Execution ${n} is terminal`);let o=un.parse({...i.execution,parent_execution_id:n,revision:i.execution.revision+1,updated_at:new Date().toISOString()});return await this.write(o),o}async normalizeBody(t){let n=await this.read(t);return await this.write(n.execution),n.execution}async transition(t,n,i=null,r=new Qe,o=null){let a=await this.read(t);Md(xB,a.execution.status,n,"Execution");let s=r.now().toISOString(),l=["completed","failed","cancelled"].includes(n),c=un.parse({...a.execution,revision:a.execution.revision+1,status:n,status_reason:["blocked","failed","cancelled"].includes(n)?o??i??`Execution moved to ${n}.`:null,updated_at:s,started_at:n==="running"&&a.execution.started_at===null?s:a.execution.started_at,finished_at:l?s:null,result:l?i:null});return await this.write(c),c}async write(t,n=Vx(t)){await this.filesystem.writeTextAtomic(this.path(t.id),this.serialize(t,n))}serialize(t,n=Vx(t)){return ln({metadata:un.parse(t),body:n})}path(t){return this.layout.activePath("execution",t)}};EB={draft:["ready","blocked","failed","cancelled"],ready:["active","blocked","failed","cancelled"],active:["delivered","blocked","failed","cancelled"],blocked:["active","failed","cancelled"],delivered:[],failed:[],cancelled:[]},AB={draft:["ready","blocked","failed","cancelled"],ready:["active","blocked","failed","cancelled"],active:["delivered","blocked","failed","cancelled"],blocked:["active","failed","cancelled"],delivered:[],failed:[],cancelled:[]},TB={draft:["planned","blocked","cancelled"],planned:["executing","blocked","failed","cancelled"],executing:["verifying","failed","blocked","cancelled"],verifying:["completed","failed","blocked","cancelled"],blocked:["executing","cancelled"],completed:[],failed:["executing"],cancelled:[]},xB={planned:["running","blocked","failed","cancelled"],running:["paused","verifying","failed","blocked","cancelled"],paused:["running","cancelled"],verifying:["completed","failed","blocked","cancelled"],blocked:["running","cancelled"],completed:[],failed:["running"],cancelled:[]}});var Bx=P(()=>{"use strict";Ns();ra();Zx();Nd()});var at,OB,Dd,B8,H8,Ds=P(()=>{"use strict";vt();at=He(Xe(),1);lx();yx();bx();Bx();OB=["lite","standard","critical"],Dd=at.z.string().datetime({offset:!0}),B8=at.z.object({id:at.z.string().startsWith("SPEC-"),capability:at.z.string().min(1),title:at.z.string().min(1),status:at.z.enum(["active","deprecated"]).default("active"),version:at.z.number().int().positive().default(1),updated_at:Dd}).strict(),H8=at.z.object({id:at.z.string().startsWith("CHG-"),title:at.z.string().min(1),status:at.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),risk:at.z.enum(OB),capabilities:at.z.array(at.z.string().startsWith("SPEC-")),requirements:at.z.array(at.z.string().startsWith("REQ-")),tasks:at.z.array(at.z.string().startsWith("TASK-")),human_decisions:at.z.array(at.z.string().startsWith("DEC-HUMAN-")),agent_decisions:at.z.array(at.z.string().startsWith("DEC-AI-")),created_at:Dd,updated_at:Dd,completed_at:Dd.nullable().default(null)}).strict()});var Hx=P(()=>{"use strict"});var Ig=P(()=>{"use strict";Hx()});var Jx=P(()=>{"use strict"});var Kx=P(()=>{"use strict";Jx()});var co,Gx=P(()=>{"use strict";co=["validate","develop","review","fix","verify","close"]});var Us=P(()=>{"use strict";Gx()});var Xx=P(()=>{"use strict"});var Yx=P(()=>{"use strict";Xx()});var Qx=P(()=>{"use strict"});var eO=P(()=>{"use strict"});var Ng=P(()=>{"use strict"});var Ud=P(()=>{"use strict"});var Pg=P(()=>{"use strict"});var xQ,tO=P(()=>{"use strict";No();Ig();Us();Ng();Ud();Pg();xQ=5*6e4});var C,Mg,nO,$B,CB,IB,zd,NB,PB,MB,LB,jB,DB,UB,zB,FB,CQ,Fd=P(()=>{"use strict";C=He(Xe(),1);No();Us();Mg=C.z.string().datetime(),nO=C.z.object({id:C.z.string().min(1),acceptance_ids:C.z.array(C.z.string().min(1))}).strict(),$B=C.z.object({soft_cycles:C.z.number().int().positive(),max_attempts:C.z.number().int().positive().nullable()}).strict(),CB=C.z.object({phase:C.z.enum(co),event_id:C.z.string().min(1),state_hash:C.z.string().regex(/^[a-f0-9]{64}$/),cycles:C.z.number().int().nonnegative(),input_tokens:C.z.number().int().nonnegative().nullable(),measurement_source:C.z.enum(["provider-uncached-input","observable-context-fallback","unavailable"]),checkpoint_required:C.z.boolean()}).strict(),IB=C.z.object({schema_version:C.z.literal(1),id:C.z.string().min(1),phase:C.z.enum(co),status:C.z.enum(["running","blocked","completed"]),revision:C.z.number().int().positive(),acceptance_ids:C.z.array(C.z.string().min(1)).min(1),budgets:C.z.object(Object.fromEntries(co.map(e=>[e,$B]))),attempts:C.z.object(Object.fromEntries(co.map(e=>[e,C.z.number().int().nonnegative()]))),checkpoints:C.z.array(CB),evidence:C.z.array(nO),processed_event_ids:C.z.array(C.z.string().min(1)),blocker:C.z.string().min(1).nullable()}).strict(),zd=C.z.enum(["execution_override","task_override","automatic_policy","project_defaults"]),NB=C.z.enum(["EXECUTION_OVERRIDE","TASK_OVERRIDE","XHIGH_ELIGIBLE","SIMPLE_BOUNDED_WORK","SOL_PLANNING_OR_REVIEW","SOL_AMBIGUOUS_OR_TRANSVERSAL","SOL_STRUCTURAL_REWORK","TERRA_IMPLEMENTATION_BASELINE","PROJECT_DEFAULTS","RISK_ASSURANCE_ONLY"]),PB=C.z.object({model:C.z.string().min(1),reasoning_effort:C.z.enum(["low","medium","high","xhigh"]),velocity:C.z.literal("standard"),origin:zd,sources:C.z.object({model:zd,reasoning_effort:zd,velocity:zd}).strict(),policy_version:C.z.string().min(1),reasons:C.z.array(NB).min(1)}).strict(),MB=C.z.object({invocation_id:C.z.string().regex(/^INV-[A-Z0-9-]+$/),run_id:C.z.string().min(1).nullable().default(null),phase:C.z.enum(co),role:C.z.enum(["builder","verifier","finalizer"]),checkpoint_id:C.z.string().min(1).nullable(),checkpoint_hash:C.z.string().regex(/^[a-f0-9]{64}$/).nullable(),selection:PB.nullable().default(null)}).strict(),LB=C.z.object({rework:C.z.enum(["localized","structural"]),rework_cost:C.z.enum(["medium","high"]),findings:C.z.array(C.z.string().min(1)).default([]),complexity:C.z.enum(["simple","standard","complex"]),transversality:C.z.enum(["local","multi_module","cross_system"]),ambiguity:C.z.enum(["low","medium","high"]),bounded:C.z.boolean(),high_volume:C.z.boolean(),xhigh_triggers:C.z.array(C.z.enum(["full_stack_boundary","shared_contracts_3_plus","critical_data_or_security","rollout_and_rollback","repeated_structural_repair","architectural_review_finding","prepared_plan_invalidated","material_architectural_tradeoffs"]))}).strict(),jB=C.z.object({task_id:C.z.string().min(1),status:C.z.enum(["available","unavailable","quality_below_floor"]),evidence_ids:C.z.array(C.z.string().min(1)),validation_ids:C.z.array(C.z.string().min(1)),rework_count:C.z.number().int().nonnegative().nullable(),quality_score:C.z.number().nonnegative().nullable(),quality_floor:C.z.number().nonnegative().nullable(),cost_delta_usd:C.z.number().nullable(),economy_status:C.z.enum(["available","unavailable"])}).strict(),DB=C.z.object({baseline_task_id:C.z.string().min(1).nullable(),baseline_equivalence_id:C.z.string().min(1).nullable(),model:C.z.string().min(1).nullable(),reasoning_effort:C.z.enum(["low","medium","high","xhigh"]).nullable(),context_budget_tokens:C.z.number().int().nonnegative().nullable(),cached_context_tokens:C.z.number().int().nonnegative().nullable(),early_stop_reason:C.z.string().min(1).nullable(),retry_count:C.z.number().int().nonnegative().nullable(),rework_count:C.z.number().int().nonnegative().nullable(),observed_cost_usd:C.z.number().nonnegative().nullable(),baseline_observed_cost_usd:C.z.number().nonnegative().nullable(),quality_score:C.z.number().nonnegative().nullable(),quality_floor:C.z.number().nonnegative().nullable()}).strict(),UB=C.z.object({provider:C.z.enum(["codex","claude"]),host_authentication_available:C.z.boolean(),requires_external_provider:C.z.boolean(),requires_remote_operation:C.z.boolean()}).strict(),zB=C.z.object({identity:C.z.string().min(1),replay_key:C.z.string().regex(/^[a-f0-9]{64}$/),validation_ids:C.z.array(C.z.string().min(1)),evidence_ids:C.z.array(C.z.string().min(1))}).strict(),FB=C.z.object({id:C.z.string().min(1),change_id:C.z.string().min(1),title:C.z.string().min(1),objective:C.z.string().min(1),risk:C.z.enum(["lite","standard","critical"]),priority:C.z.number().int(),depends_on:C.z.array(C.z.string().min(1)),acceptance_ids:C.z.array(C.z.string().min(1)).min(1),write_scopes:C.z.array(C.z.string().min(1)),child_execution_id:C.z.string().min(1).optional(),builder:C.z.object({id:C.z.string().min(1),model:C.z.string().min(1),reasoning_effort:C.z.enum(["low","medium","high","xhigh"]).optional(),tools:C.z.array(C.z.string()).optional(),execution_eligibility:C.z.array(C.z.enum(["interaction","delivery"])).optional()}).optional(),verifier:C.z.object({id:C.z.string().min(1),model:C.z.string().min(1),reasoning_effort:C.z.enum(["low","medium","high","xhigh"]).optional(),tools:C.z.array(C.z.string()).optional(),execution_eligibility:C.z.array(C.z.enum(["interaction","delivery"])).optional()}).optional(),commit:C.z.object({agent:C.z.enum(["CODEX","CLAUDE"]),execution_id:C.z.string().min(1),change_id:C.z.string().min(1),task_id:C.z.string().min(1),title:C.z.string().min(1),prd_id:C.z.string().min(1).nullable(),spec_id:C.z.string().min(1).nullable()}).strict().optional(),runtime:Kl.optional(),model_profile:Mi.optional(),outcome_measurement:DB.optional(),status:C.z.enum(["planned","running","completed","failed","blocked"]),worktree_path:C.z.string().min(1).nullable(),integration_commit:C.z.string().min(1).nullable(),changed_files:C.z.array(C.z.string().min(1)).default([]),task_run_id:C.z.string().min(1).nullable().default(null),finalizer_approved:C.z.boolean().default(!1),active_invocation:MB.nullable(),rework_profile:LB.nullable().default(null),sdc:IB,validation_ids:C.z.array(C.z.string().min(1)),evidence:C.z.array(nO),outcome_projection:jB.nullable().default(null),validation_attempts:C.z.array(zB).default([]),last_error:C.z.string().min(1).nullable()}).strict(),CQ=C.z.object({schema_version:C.z.literal(1),execution_id:C.z.string().min(1),source:C.z.enum(["task","spec","prd"]),operational_context:UB.default({provider:"codex",host_authentication_available:!1,requires_external_provider:!1,requires_remote_operation:!1}),status:C.z.enum(["running","completed","failed","blocked"]),revision:C.z.number().int().nonnegative(),created_at:Mg,updated_at:Mg,execution_started_at:Mg.nullable().default(null),invocation_count:C.z.number().int().nonnegative().default(0),stalled_cycles:C.z.number().int().nonnegative().default(0),handoff_worktree_path:C.z.string().min(1).nullable().default(null),handoff_branch:C.z.string().min(1).nullable().default(null),handoff_commit:C.z.string().min(1).nullable().default(null),tasks:C.z.array(FB).min(1),last_error:C.z.string().min(1).nullable()}).strict()});var Lg=P(()=>{"use strict"});var rO=P(()=>{"use strict";Cp();No();Us();Qx();eO();tO();Ud();Fd();Lg()});var iO=P(()=>{"use strict"});var oO=P(()=>{"use strict";vt();Fd()});var aO=P(()=>{"use strict";rO();iO();oO();Ng();Ud();Fd();Lg();Pg()});var sO=P(()=>{"use strict";Ds()});var cO=P(()=>{"use strict";sO()});function jg(e){let t=e.status==="draft"?"Rascunho aguardando classifica\xE7\xE3o; pode possuir Run de conversa, mas nenhum Change ou Execution foi criado.":e.plan_hash===null?`Captura encerrada como ${e.status} sem materializar Change ou Execution.`:`Plano ${e.plan_revision??"-"} materializado em ${e.change_id}; estado atual: ${e.status}.`,n=e.result?.summary??e.status_reason??"Ainda n\xE3o conclu\xEDda.",i=e.result?.evidence_ids.length?e.result.evidence_ids.map(r=>`- ${r}`).join(`
323
+ `):"Nenhuma evid\xEAncia registrada.";return`# ${e.title}
324
+
325
+ ## Objetivo
326
+
327
+ ${e.objective}
328
+
329
+ ## Plano
330
+
331
+ ${t}
332
+
333
+ ## Evid\xEAncias
334
+
335
+ ${i}
336
+
337
+ ## Resultado
338
+
339
+ ${n}`}function zs(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Fs(e,t,n){let i=new Set;for(let r of e)i.has(r)&&n.addIssue({code:"custom",path:[t],message:`Duplicate value: ${r}`}),i.add(r)}var lO=P(()=>{"use strict"});var je,qd,VB,uO,WB,ZB,BB,HB,lo,ua,JB,dO=P(()=>{"use strict";vt();Ds();je=He(Xe(),1);lO();qd=je.z.string().datetime({offset:!0}),VB=je.z.string().regex(/^[a-f0-9]{64}$/),uO=je.z.string().startsWith("TASK-"),WB=je.z.string().startsWith("CHG-"),ZB=je.z.string().startsWith("REQ-"),BB=je.z.string().startsWith("AC-"),HB=je.z.preprocess(e=>typeof e=="string"?{summary:e,changed_files:[],evidence_ids:[],completed_run_id:null}:e,je.z.object({summary:je.z.string().min(1),changed_files:je.z.array(je.z.string().min(1)),evidence_ids:je.z.array(je.z.string().startsWith("EVD-")),completed_run_id:je.z.string().startsWith("RUN-").nullable()}).strict()),lo=je.z.object({schema_version:je.z.literal(2),id:uO,revision:je.z.number().int().positive(),change_id:WB,title:je.z.string().min(1),short_name:je.z.string().min(1),objective:je.z.string().min(1),status:je.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),status_reason:je.z.string().min(1).nullable().optional(),attempt_count:je.z.number().int().nonnegative().optional(),risk:je.z.enum(["lite","standard","critical"]),priority:je.z.enum(["low","medium","high","urgent"]),owner:je.z.string().min(1).nullable(),requirement_ids:je.z.array(ZB).min(1),acceptance_ids:je.z.array(BB).min(1),depends_on:je.z.array(uO),write_scopes:je.z.array(je.z.string().min(1)),runtime:Kl.optional(),model_profile:Mi.optional(),plan_revision:je.z.number().int().positive().nullable(),plan_hash:VB.nullable(),prepared_plan:Jr.optional(),plan_ref:ca.optional(),created_at:qd,updated_at:qd,started_at:qd.nullable(),finished_at:qd.nullable(),result:HB.nullable()}).strict().superRefine((e,t)=>{let n=e.plan_revision===null&&e.plan_hash===null;e.status==="draft"||n&&["blocked","failed","cancelled"].includes(e.status)?(!n||e.prepared_plan!==void 0||e.plan_ref!==void 0)&&t.addIssue({code:"custom",message:`${e.status} Task without materialization cannot contain a prepared plan`}):(e.plan_revision===null||e.plan_hash===null)&&t.addIssue({code:"custom",message:`${e.status} Task requires plan_revision and plan_hash`}),e.prepared_plan!==void 0&&e.plan_ref!==void 0&&t.addIssue({code:"custom",message:"Task cannot contain prepared_plan and plan_ref"}),e.plan_ref!==void 0&&e.plan_ref.hash!==e.plan_hash&&t.addIssue({code:"custom",path:["plan_ref"],message:"plan_ref must match plan_hash"}),e.prepared_plan!==void 0&&(e.prepared_plan.source.type!=="task"||e.prepared_plan.source.task_id!==e.id||e.prepared_plan.hash!==e.plan_hash)&&t.addIssue({code:"custom",path:["prepared_plan"],message:"prepared_plan must belong to the Task and match plan_hash"}),["completed","failed","cancelled"].includes(e.status)&&(e.finished_at===null||e.result===null)&&t.addIssue({code:"custom",message:"terminal Task requires finished_at and result"}),["executing","verifying","completed"].includes(e.status)&&e.started_at===null&&t.addIssue({code:"custom",message:`${e.status} Task requires started_at`}),e.status==="completed"&&(e.result?.completed_run_id===null||e.result?.evidence_ids.length===0)&&t.addIssue({code:"custom",path:["result"],message:"completed Task requires completed_run_id and at least one Evidence"}),Fs(e.requirement_ids,"requirement_ids",t),Fs(e.acceptance_ids,"acceptance_ids",t),Fs(e.depends_on,"depends_on",t),Fs(e.write_scopes,"write_scopes",t)}),ua=class{constructor(t,n){this.filesystem=t;this.layout=n;if(n.version===1)throw new TypeError("TaskV2Repository requires a modern WorkspaceLayout")}filesystem;layout;async read(t){let n=await Ss(this.filesystem,this.layout,"task",t);if(n===null)throw new Error(`task not found: ${t}`);let i=Ct(await this.filesystem.readText(n),lo);return{task:i.metadata,body:i.body}}async list(){let t=await this.filesystem.listFiles(this.layout.entityRoot("task"),".md");return Promise.all(t.map(async n=>Ct(await this.filesystem.readText(n),lo).metadata))}async createDraft(t){let i=(t.clock??new Qe).now().toISOString(),r=lo.parse({schema_version:2,id:t.id,revision:1,change_id:t.changeId,title:t.title,short_name:t.shortName,objective:t.objective,status:"draft",attempt_count:0,risk:t.risk,priority:t.priority,owner:t.owner??null,requirement_ids:[...t.requirementIds],acceptance_ids:[...t.acceptanceIds],depends_on:[...t.dependsOn??[]],write_scopes:[...t.writeScopes??[]],plan_revision:null,plan_hash:null,created_at:i,updated_at:i,started_at:null,finished_at:null,result:null});return await this.filesystem.writeTextExclusive(this.path(r.id),this.serialize(r)),r}async setPreparedPlan(t,n){let i=Jr.parse(n);if(i.source.type!=="task"||i.source.task_id!==t)throw new TypeError(`Prepared plan source must be task ${t}`);let r=await this.read(t);if(r.task.status==="planned"&&r.task.prepared_plan?.hash===i.hash)return r.task;if(r.task.status!=="draft")throw new Error(`Task ${t} must be draft before prepare`);let o=i.blueprints.tasks.find(c=>c.id===t);if(o===void 0)throw new Error(`Prepared plan does not contain Task ${t}`);let a=[o.change_id===r.task.change_id?null:"change_id",o.title===r.task.title?null:"title",o.short_name===r.task.short_name?null:"short_name",o.objective===r.task.objective?null:"objective",o.risk===r.task.risk?null:"risk",o.priority===r.task.priority?null:"priority",o.owner===r.task.owner?null:"owner",zs(o.requirement_ids,r.task.requirement_ids)?null:"requirement_ids",zs(o.acceptance_ids,r.task.acceptance_ids)?null:"acceptance_ids",zs(o.write_scopes,r.task.write_scopes)?null:"write_scopes"].filter(c=>c!==null),s=i.dag.nodes.find(c=>c.task_id===t);if((s===void 0||!zs(s.depends_on,r.task.depends_on))&&a.push("depends_on"),a.length>0)throw new Error(`Prepared plan diverges from Task draft: ${a.join(", ")}`);let l=lo.parse({...r.task,revision:r.task.revision+1,status:"planned",plan_revision:i.revision,plan_hash:i.hash,prepared_plan:i,updated_at:i.prepared_at});return await this.write(l),l}async write(t,n=jg(t)){await this.filesystem.writeTextAtomic(this.path(t.id),this.serialize(t,n))}async normalizePreparedPlan(t,n){let i=await this.read(t);if(i.task.plan_ref?.hash===n.hash)return i.task;if(i.task.prepared_plan?.hash!==n.hash)throw new Error(`Task ${t} does not contain PreparedPlan ${n.hash}`);let{prepared_plan:r,...o}=i.task,a=lo.parse({...o,revision:i.task.revision+1,plan_ref:Is(n),updated_at:new Date().toISOString()});return await this.write(a),a}async normalizeBody(t){let n=await this.read(t);return await this.write(n.task),n.task}serialize(t,n=jg(t)){return ln({metadata:lo.parse(t),body:n})}async transition(t,n,i=null,r=new Qe,o=null){let a=await this.read(t);if(!JB[a.task.status].includes(n))throw new Error(`Invalid Task transition: ${a.task.status} -> ${n}`);let s=r.now().toISOString(),l=["completed","failed","cancelled"].includes(n),c=lo.parse({...a.task,revision:a.task.revision+1,status:n,attempt_count:n==="executing"?(a.task.attempt_count??0)+1:a.task.attempt_count,status_reason:["blocked","failed","cancelled"].includes(n)?o??i?.summary??`Task moved to ${n}.`:null,updated_at:s,started_at:n==="executing"&&a.task.started_at===null?s:a.task.started_at,finished_at:l?s:null,result:l?i:null});return await this.write(c),c}path(t){return this.layout.activePath("task",t)}},JB={draft:["planned","blocked","failed","cancelled"],planned:["executing","blocked","failed","cancelled"],executing:["verifying","failed","blocked","cancelled"],verifying:["executing","completed","failed","blocked","cancelled"],blocked:["executing","cancelled"],completed:[],failed:["executing"],cancelled:[]}});var _t,Dg,B7,Ug=P(()=>{"use strict";vt();_t=He(Xe(),1);Ig();Kx();Us();Yx();aO();cO();dO();Dg=_t.z.string().datetime({offset:!0}),B7=_t.z.object({id:_t.z.string().startsWith("TASK-"),title:_t.z.string().min(1),short_name:_t.z.string().min(1),status:_t.z.enum(["draft","planned","executing","verifying","completed","failed","blocked","cancelled"]),risk:_t.z.enum(["lite","standard","critical"]),priority:_t.z.enum(["low","medium","high","urgent"]),owner:_t.z.string().min(1).nullable().default(null),progress:_t.z.number().int().min(0).max(100),spec:_t.z.string().startsWith("SPEC-"),change:_t.z.string().startsWith("CHG-"),requirements:_t.z.array(_t.z.string().startsWith("REQ-")),depends_on:_t.z.array(_t.z.string().startsWith("TASK-")),human_decisions:_t.z.array(_t.z.string().startsWith("DEC-HUMAN-")),agent_decisions:_t.z.array(_t.z.string().startsWith("DEC-AI-")),created_at:Dg,started_at:Dg.nullable(),finished_at:Dg.nullable()}).strict()});function Vd(e){return new Set(e.filter(t=>t.status!=="planned").flatMap(t=>t.dag.nodes.map(n=>n.task_id)))}var zg=P(()=>{"use strict"});function _O(e){let t=new Map,n=(i,r)=>i===null&&r===null?null:(i??0)+(r??0);for(let i of e){if(i.task_id===null)continue;let r=t.get(i.task_id)??{duration_ms:null,tokens:null,cost_brl:null};t.set(i.task_id,{duration_ms:n(r.duration_ms,i.phase==="execution"&&i.parent_run_id==null?i.duration_ms:null),tokens:n(r.tokens,i.usage.total.tokens.total),cost_brl:n(r.cost_brl,i.usage.total.cost.brl)})}return t}function qs(e,t){let n=e.filter(a=>a.status==="completed").length,i=t.filter(a=>a.status!=="running"),r=i.filter(a=>a.status==="completed").length,o=t.filter(a=>a.work_type==="rework").length;return{completed_tasks:n,task_completion_rate:e.length===0?0:n/e.length,terminal_runs:i.length,successful_runs:r,terminal_success_rate:i.length===0?0:r/i.length,rework_rate:t.length===0?0:o/t.length}}var Fg=P(()=>{"use strict"});function Wd(e){let t=e?.source_started_at??null,n=e?.source_finished_at??e?.source_occurred_at??null;return{source_started_at:t,source_finished_at:n,source_duration_ms:t===null||n===null?null:Math.max(0,Date.parse(n)-Date.parse(t)),capture_lag_ms:n===null||e===void 0?null:Math.max(0,Date.parse(e.occurred_at)-Date.parse(n))}}function Zd(e,t,n,i){let r=Date.parse(e),o=c=>{let d=c==null?Number.NaN:Date.parse(c);return Number.isFinite(d)?d:null},a=(c,d)=>{let u=o(c),_=o(d);return u!==null&&_!==null&&_>=u&&_>=r},s=[];for(let c of[...n,...i]){let d=c.source_started_at,u=c.source_finished_at;if(d!==void 0&&u!==void 0&&a(d,u)){s.push({...c,source_finished_at:u});continue}c.activity_kind==="retrospective_local_reconciliation"&&typeof c.source_occurred_at=="string"&&(o(c.source_occurred_at)??Number.NEGATIVE_INFINITY)>=r&&s.push({...c,source_started_at:e,source_finished_at:c.source_occurred_at})}s.sort((c,d)=>Date.parse(c.occurred_at)-Date.parse(d.occurred_at));let l=s.at(-1);return Wd(l===void 0?void 0:{occurred_at:l.occurred_at,source_occurred_at:l.source_occurred_at??void 0,source_started_at:l.source_started_at,source_finished_at:l.source_finished_at})}function pO(e){function t(n,i){let r=new Set([...i===null?[]:e.prds.filter(c=>c.id===i).map(c=>c.creation_run_id),...e.specs.filter(c=>n.has(c.id)).map(c=>c.creation_run_id)].filter(c=>c!=null)),o=new Set(e.changes.filter(c=>i!==null&&c.source.type==="prd"&&c.source.prd_id===i||(c.source.type==="spec"||c.source.type==="prd")&&c.source.spec_id!==null&&c.source.spec_id!==void 0&&n.has(c.source.spec_id)).map(c=>c.id)),a=new Set(e.tasks.filter(c=>o.has(c.change_id)).map(c=>c.id)),s=new Set(e.executions.filter(c=>i!==null&&c.origin.type==="prd"&&c.origin.prd_id===i||c.origin.type==="spec"&&c.origin.spec_id!==void 0&&n.has(c.origin.spec_id)||c.dag.nodes.some(d=>a.has(d.task_id))).map(c=>c.id)),l=e.runs.filter(c=>{let d=c.fold.run.spec_id!==null&&n.has(c.fold.run.spec_id)||c.fold.run.task_id!==null&&a.has(c.fold.run.task_id)||r.has(c.fold.run.run_id);return i===null?d:d||c.fold.run.prd_id===i||c.fold.run.execution_id!==null&&s.has(c.fold.run.execution_id)});return{changeIds:o,taskIds:a,executionIds:s,runs:l}}return{forSpec:n=>t(new Set([n]),null),forPrd:n=>t(new Set(e.specs.filter(i=>i.prd_id===n).map(i=>i.id)),n)}}var qg=P(()=>{"use strict"});function fO(e){let t=TA(e.map(n=>n.cost));return{conversation:da(t.conversation),planning:da(t.planning),execution:da(t.execution),total:da(t.total),new_work:da(t.work_types.new),rework:da(t.work_types.rework)}}function da(e){return{events:e.usage_event_count,tokens:e.tokens,cost:e.cost,coverage:e.coverage}}function Hd(e){return{human:e.filter(t=>t.origin==="human").length,agent:e.filter(t=>t.origin==="agent").length}}function Jd(e,t){let n=[e.conversation,e.planning,e.execution],i=Object.values(t).map(r=>r.total);return{phase_tokens_match_total:Bd(n.map(r=>r.tokens.total),e.total.tokens.total),phase_usd_match_total:Bd(n.map(r=>r.cost.usd),e.total.cost.usd),phase_brl_match_total:Bd(n.map(r=>r.cost.brl),e.total.cost.brl),origin_tokens_match_total:Bd(i.map(r=>r.tokens.total),e.total.tokens.total)}}function Bd(e,t){let n=e.filter(i=>i!==null);return t===null?n.length===0:Math.abs(n.reduce((i,r)=>i+r,0)-t)<1e-9}function Kd(e){return e==="completed"?100:e==="verifying"?80:e==="executing"?50:["blocked","failed","cancelled"].includes(e)?0:10}function mO(e){return e==="planned"?"planning":["running","paused","verifying"].includes(e)?"executing":e}function gO(e,t){if(e==="delivered")return"completed";if(e==="blocked")return"blocked";if(e==="failed")return"failed";if(e==="cancelled")return"cancelled";let n=t.flatMap(i=>i===void 0?[]:[i.status]);return n.some(i=>["running","paused"].includes(i))?"executing":n.includes("verifying")?"verifying":n.length>0&&n.every(i=>i==="completed")?e==="active"?"verifying":"completed":e==="active"?"executing":n.includes("blocked")?"blocked":n.includes("failed")?"failed":(n.includes("planned")||["draft","ready"].includes(e),"planning")}function Vs(e){return e.filter(t=>t!==null).map(t=>new Date(t).toISOString()).sort().at(-1)??null}var Ws=P(()=>{"use strict";Zr()});function hO(e){let t=e.fold.finished?.occurred_at??null,n=e.fold.effective_usage_records.findLast(l=>l.runtime)?.runtime,i=e.fold.effective_usage_records.at(-1),r=Zd(e.fold.run.occurred_at,t,e.fold.effective_usage_records,e.fold.records),o=e.fold.finished,a=typeof r.source_duration_ms=="number"&&r.source_duration_ms>=0?r.source_duration_ms:typeof o?.duration_ms=="number"&&o.duration_ms>=0&&(o.duration_provenance==="observed"||o.duration_provenance==="reconciled"||o.duration_provenance==="legacy_inferred")?o.duration_ms:null,s=typeof r.source_duration_ms=="number"&&r.source_duration_ms>=0?"observed":a===null?"unavailable":o?.duration_provenance??"unavailable";return{id:e.fold.run.run_id,artifact_path:e.artifactPath,status:e.fold.status,phase:e.fold.records.findLast(l=>"phase"in l)?.phase??e.fold.run.phase,entrypoint:e.fold.run.entrypoint,work_type:e.fold.run.work_type,run_role:ig(e.fold.run),run_kind:bT(e.fold.run),run_purpose:ST(e.fold.run),requires_finalizer:kT(e.fold.run),parent_run_id:e.fold.run.parent_run_id,client:e.fold.run.client,agent:e.fold.run.agent,agent_name:KB(e.fold.run.agent,e.fold.run.agent_name),provider:i?.provider??e.fold.run.provider,model:e.fold.run.model,reasoning_effort:e.fold.run.reasoning_effort??null,...GB(e.fold),...XB(e.fold),service_tier:n?.service_tier??null,conversation_id:e.fold.run.conversation_id,execution_id:e.fold.run.execution_id,task_id:e.fold.run.task_id,spec_id:e.fold.run.spec_id,prd_id:e.fold.run.prd_id,change_id:e.fold.run.change_id,started_at:e.fold.run.occurred_at,finished_at:t,duration_ms:a,duration_started_at:a===null?null:o?.started_at??e.fold.run.occurred_at,duration_provenance:s,...r,pricing_segments:e.fold.effective_usage_records.map(l=>({phase:l.phase,provider:l.provider,model:l.model,service_tier:l.runtime?.service_tier??n?.service_tier??null,input_tokens:l.tokens.input,cached_input_tokens:l.tokens.cached_input,output_tokens:l.tokens.output,reasoning_tokens:l.tokens.reasoning,total_tokens:l.tokens.total,recorded_usd:l.cost.usd,recorded_brl:l.cost.brl,recorded_fx_rate:l.cost.fx_rate??null})),usage:fO([e])}}function KB(e,t){if(e==="codex")return"codex";let n=t??e;return n.startsWith("agent-")?`zaip-agent-${n.slice(6)}`:n}function GB(e){let t=new Set([...e.provider_invocation_records.map(i=>i.effective.model),...e.effective_usage_records.map(i=>i.model)].filter(i=>i!==null)),n=new Set([...e.provider_invocation_records.map(i=>i.effective.reasoning_effort),...e.effective_usage_records.map(i=>i.runtime?.reasoning_effort??null)].filter(i=>i!==null));return{effective_model:t.size===1?[...t][0]??null:null,effective_reasoning_effort:n.size===1?[...n][0]??null:null,effective_config_mixed:t.size>1||n.size>1}}function XB(e){let t=new Set([...e.model_selection_records.map(n=>n.invocation_id),...e.provider_invocation_records.map(n=>n.invocation_id)]);return t.size===0?{call_count:null,terminal_call_count:null,failed_call_count:null,cancelled_call_count:null}:{call_count:t.size,terminal_call_count:e.provider_invocation_records.length,failed_call_count:e.provider_invocation_records.filter(n=>n.status==="failed").length,cancelled_call_count:e.provider_invocation_records.filter(n=>n.status==="cancelled").length}}function yO(e,t){return e!==null&&e>=0?e:null}var Vg=P(()=>{"use strict";Os();qg();Ws()});function Tr(e){return e.map(t=>typeof t.source_duration_ms=="number"&&t.source_duration_ms>=0?{...t,duration_ms:t.source_duration_ms,duration_provenance:"observed",estimation_basis:null}:typeof t.duration_ms=="number"&&t.duration_ms>=0&&(t.duration_provenance==="observed"||t.duration_provenance==="reconciled"||t.duration_provenance==="legacy_inferred")?{...t,estimation_basis:null}:{...t,duration_ms:null,duration_provenance:"unavailable",estimation_basis:null})}var Gd=P(()=>{"use strict"});function bO(e,t){let n=new Set(e.dag.nodes.map(_=>_.task_id)),i=new Map(t.changes.map(_=>[_.id,_])),r=new Map(t.specs.map(_=>[_.id,_])),o=new Set,a=new Set,s=_=>{o.add(_);let p=r.get(_),v=p?.prd_id??p?.parent_id??null;v!==null&&a.add(v)};e.origin.type==="spec"&&s(e.origin.spec_id),e.origin.type==="prd"&&a.add(e.origin.prd_id);for(let _ of t.tasks){if(!n.has(_.id))continue;let p=i.get(_.change_id)?.source;p&&((p.type==="spec"||p.type==="prd")&&p.spec_id&&s(p.spec_id),p.type==="prd"&&p.prd_id&&a.add(p.prd_id))}let l=t.runs.filter(_=>_.execution_id===e.id||_.task_id!==null&&n.has(_.task_id)),c=l.flatMap(_=>_.call_count===null?[]:[_.call_count]),d=l.filter(_=>_.run_purpose==="finalization"||_.agent==="agent-finalizer"||_.agent==="agent-task-finalizer"),u=new Set(d.flatMap(_=>_.status==="completed"&&_.task_id!==null?[_.task_id]:[]));return{agent_call_count:l.length,orchestrator_run_count:l.filter(_=>_.parent_run_id===null).length,subagent_run_count:l.filter(_=>_.parent_run_id!==null).length,finalizer_run_count:d.length,finalized_task_count:u.size,llm_call_count:c.reduce((_,p)=>_+p,0),llm_call_count_complete:c.length===l.length,task_count:n.size,spec_count:o.size,prd_count:a.size,duration_ms:YB(l.filter(_=>_.parent_run_id===null)),total_tokens:vO(l.map(_=>_.usage?.tokens.total??null)),cost_brl:vO(l.map(_=>_.usage?.cost.brl??null))}}function vO(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}function YB(e){let t=e.flatMap(n=>typeof n.source_duration_ms=="number"&&n.source_duration_ms>=0?[n.source_duration_ms]:typeof n.duration_ms=="number"&&n.duration_ms>=0&&(n.duration_provenance==="observed"||n.duration_provenance==="reconciled"||n.duration_provenance==="legacy_inferred")?[n.duration_ms]:[]);return t.length===0?null:t.reduce((n,i)=>n+i,0)}var SO=P(()=>{"use strict"});function Xd(e){let t=kO(e.from??null,"from"),n=kO(e.to??null,"to");if(t!==null&&n!==null&&t>n)throw new Error("from must not be after to");return{from:t,to:n}}function kO(e,t){if(e===null||e.length===0)return null;let n=/^\d{4}-\d{2}-\d{2}$/.test(e)?t==="to"?`${e}T23:59:59.999-03:00`:`${e}T00:00:00.000-03:00`:e,i=Date.parse(n);if(Number.isNaN(i))throw new Error(`${t} must be an ISO timestamp`);return new Date(i).toISOString()}var Wg=P(()=>{"use strict"});function dn(e){let t=n=>{let i=e.map(n),r=o=>{let a=o.filter(s=>s!==null);return a.length===0?null:a.reduce((s,l)=>s+l,0)};return{events:i.reduce((o,a)=>o+a.events,0),tokens:{input:r(i.map(o=>o.tokens.input)),cached_input:r(i.map(o=>o.tokens.cached_input)),output:r(i.map(o=>o.tokens.output)),reasoning:r(i.map(o=>o.tokens.reasoning)),total:r(i.map(o=>o.tokens.total))},cost:{usd:r(i.map(o=>o.cost.usd)),brl:r(i.map(o=>o.cost.brl))},coverage:{events:i.reduce((o,a)=>o+a.coverage.events,0),tokens:i.reduce((o,a)=>o+a.coverage.tokens,0),usd:i.reduce((o,a)=>o+a.coverage.usd,0),brl:i.reduce((o,a)=>o+a.coverage.brl,0)}}};return{conversation:t(n=>n.usage.conversation),planning:t(n=>n.usage.planning),execution:t(n=>n.usage.execution),total:t(n=>n.usage.total),new_work:t(n=>n.usage.new_work),rework:t(n=>n.usage.rework)}}function Yd(e){let t=Tr(e.runs),n=Es(t),i=dn(t),r={conversation:dn(t.filter(o=>o.entrypoint==="conversation")),task:dn(t.filter(o=>o.entrypoint==="task")),spec:dn(t.filter(o=>o.entrypoint==="spec")),prd:dn(t.filter(o=>o.entrypoint==="prd"))};return{...e,runs:t,origins:r,summary:{...e.summary,run_count:t.length,execution_duration_ms:Hr(n)??0,execution_day_count:new Set(n.map(o=>o.started_at.slice(0,10))).size,source_latest_at:Vs([e.summary.source_latest_at,...t.map(o=>o.finished_at??o.started_at)]),quality:qs(e.tasks,t),reconciliation:Jd(i,r),usage:i}}}function Bg(e){let t=[...e.taskIds].flatMap(r=>{let o=e.tasks.get(r);return o===void 0?[]:[o]}),n=e.decisions.filter(r=>r.scope_type==="change"&&e.changeIds.has(r.scope_id)||r.scope_type==="execution"&&e.executionIds.has(r.scope_id)),i=Hg(e.runs);return{id:e.id,title:e.title,created_at:e.createdAt,updated_at:e.updatedAt,kind:e.kind,parent_id:e.parentId,artifact_path:e.artifactPath,lifecycle_status:e.lifecycleStatus,work_status:gO(e.lifecycleStatus,[...e.executionIds].map(r=>e.executions.get(r))),execution_ids:[...e.executionIds].sort(),task_ids:[...e.taskIds].sort(),planned_tasks:[...e.plannedTasks],canonical_run_ids:i.canonicalRuns.map(r=>r.id).sort(),run_ids:i.canonicalRuns.map(r=>r.id).sort(),root_execution_run_ids:i.rootExecutionRuns.map(r=>r.id).sort(),execution_count:e.executionIds.size,task_count:Math.max(e.taskIds.size,e.plannedTasks.length),run_count:i.canonicalRuns.length,duration_ms:i.observedRootDuration,observed_root_duration_ms:i.observedRootDuration,observed_lifecycle_duration_ms:i.observedLifecycleDuration,duration_coverage:{eligible_runs:i.rootExecutionRuns.length,known_runs:i.knownRootRuns.length,unknown_runs:i.rootExecutionRuns.length-i.knownRootRuns.length,coverage_ratio:i.rootExecutionRuns.length===0?1:i.knownRootRuns.length/i.rootExecutionRuns.length},duration_provenance:i.observedRootDuration===null?"unavailable":"observed",lifecycle_duration_coverage:i.lifecycleCoverage,lifecycle_duration_provenance:i.observedLifecycleDuration===null?"unavailable":"observed",decisions:Hd(n),rework_run_count:i.canonicalRuns.filter(r=>r.work_type==="rework").length,quality:qs(t,i.canonicalRuns),usage:dn(i.canonicalRuns)}}function Hg(e){let t=[...new Map(e.map(a=>[a.id,a])).values()],n=t.filter(a=>a.phase==="execution"&&a.parent_run_id==null),i=n.filter(a=>Zg(a)!==null),r=t.filter(a=>a.parent_run_id==null),o=r.filter(a=>Zg(a)!==null);return{canonicalRuns:t,rootExecutionRuns:n,knownRootRuns:i,observedRootDuration:Hr(n),observedLifecycleDuration:QB(r),lifecycleCoverage:{eligible_runs:r.length,known_runs:o.length,unknown_runs:r.length-o.length,coverage_ratio:r.length===0?1:o.length/r.length}}}function QB(e){let t=e.flatMap(a=>{let s=Zg(a),l=Date.parse(a.source_started_at??a.duration_started_at??a.started_at);return s!==null&&Number.isFinite(l)?[{start:l,end:l+s}]:[]}).toSorted((a,s)=>a.start-s.start),n=t[0];if(n===void 0)return null;let i=0,r=n.start,o=n.end;for(let a of t.slice(1))a.start<=o?o=Math.max(o,a.end):(i+=o-r,r=a.start,o=a.end);return i+o-r}function Zg(e){return typeof e.source_duration_ms=="number"&&e.source_duration_ms>=0?e.source_duration_ms:typeof e.duration_ms=="number"&&e.duration_ms>=0&&(e.duration_provenance==="observed"||e.duration_provenance==="reconciled"||e.duration_provenance==="legacy_inferred")?e.duration_ms:null}function wO(e){function t(n,i){let r=new Set([...i===null?[]:e.prds.filter(c=>c.id===i).map(c=>c.creation_run_id),...e.specs.filter(c=>n.has(c.id)).map(c=>c.creation_run_id)].filter(c=>c!=null)),o=new Set(e.changes.filter(c=>i!==null&&c.source.type==="prd"&&c.source.prd_id===i||(c.source.type==="spec"||c.source.type==="prd")&&c.source.spec_id!==null&&c.source.spec_id!==void 0&&n.has(c.source.spec_id)).map(c=>c.id)),a=new Set(e.tasks.filter(c=>o.has(c.change_id)).map(c=>c.id)),s=new Set(e.executions.filter(c=>i!==null&&c.origin.type==="prd"&&c.origin.prd_id===i||c.origin.type==="spec"&&n.has(c.origin.spec_id)||c.dag.nodes.some(d=>a.has(d.task_id))).map(c=>c.id)),l=e.runs.filter(c=>c.spec_id!==null&&n.has(c.spec_id)||c.task_id!==null&&a.has(c.task_id)||r.has(c.id)||i!==null&&(c.prd_id===i||c.execution_id!==null&&s.has(c.execution_id)));return{changeIds:o,taskIds:a,executionIds:s,runs:l}}return{forSpec:n=>t(new Set([n]),null),forPrd:n=>t(new Set(e.specs.filter(i=>i.prd_id===n).map(i=>i.id)),n)}}var Jg=P(()=>{"use strict";As();Fg();Gd();Ws()});function EO(e,t){let n=new Map(e.map(r=>[r.id,Kg(r.prepared_plan)])),i=new Map(t.map(r=>{let o=Kg(r.prepared_plan);if(o.length>0||r.prd_id===null)return[r.id,o];let a=e.find(s=>s.id===r.prd_id);return[r.id,a===void 0?[]:Kg(a.prepared_plan,r.id)]}));return{byPrd:n,bySpec:i}}function AO(e){let t=new Map;for(let n of e){if(n.kind==="interaction")continue;let i=new Set(n.dag.nodes.map(r=>r.task_id));n.origin.type==="task"&&i.add(n.origin.task_id);for(let r of i)t.set(r,new Set([...t.get(r)??[],n.id]))}return new Map([...t].map(([n,i])=>[n,[...i].sort()]))}function Kg(e,t){if(e==null||e.blueprints===void 0)return[];let n=new Map(e.blueprints.changes.map(r=>[r.id,r.source.type==="spec"||r.source.type==="prd"?r.source.spec_id??null:null])),i=new Map(e.dag.nodes.map(r=>[r.task_id,r.depends_on]));return e.blueprints.tasks.filter(r=>t===void 0||n.get(r.change_id)===t).map(r=>({id:r.id,title:r.title,objective:r.objective,depends_on:i.get(r.id)??[]}))}var TO=P(()=>{"use strict"});function OO(e){return typeof e=="number"&&e>0?Math.round(e*36e5/4e6):null}function Qd(e,t){let n=e.filter(o=>(o.total_tokens??0)>0);if(n.length<7||t<n.length)return e.map(o=>xO(o));let i=n.reduce((o,a)=>o+(a.total_tokens??0),0),r=0;return e.map(o=>{if(!n.includes(o))return xO(o);let a=n.at(-1)===o?t-r:1+Math.floor((t-n.length)*(o.total_tokens??0)/i);return r+=a,{...o,duration:{known_sum:a,unknown:0,complete:!0,coverage_ratio:1}}})}function Gg(e,t){let n=Qd(e.map(([r,o])=>({key:r,total_tokens:o.usage.total_tokens.known_sum,estimated_brl:o.usage.cost.known_sum,duration:uo(r,o).value})),t),i=new Map(n.map(r=>[r.key,r.duration]));return Object.fromEntries(e.map(([r,o])=>[r,{...o,duration:i.get(r)??uo(r,o).value}]))}function xO(e){if((e.total_tokens??0)<=0||e.duration.known_sum>0)return e;let t=OO(e.total_tokens);return t===null?e:{...e,duration:{known_sum:t,unknown:0,complete:!0,coverage_ratio:1}}}function Zs(e){let t=e.filter(i=>(i.phase===void 0||i.phase==="execution")&&i.parent_run_id==null),n=new Map;for(let i of t){let r=i.duration_started_at??i.started_at;if(!ld(r)||r===null)continue;let o=Date.parse(r),a=Ot(r,"day");if(!Number.isFinite(o)||a===null)continue;if(i.duration_ms===null||i.duration_ms<0){let l=n.get(a)??{intervals:[],known:0,unknown:0};l.unknown+=1,n.set(a,l);continue}let s=o+i.duration_ms;for(let l=o;l<=s;){let c=Ot(new Date(l).toISOString(),"day");if(c===null)break;let d=Math.min(s,tH(c)),u=n.get(c)??{intervals:[],known:0,unknown:0};if(u.intervals.push({start:l,end:d}),u.known+=1,n.set(c,u),d>=s)break;l=d}}return new Map([...n].map(([i,r])=>{let o=r.known+r.unknown;return[i,{value:{known_sum:nH(r.intervals),unknown:r.unknown,complete:r.unknown===0,coverage_ratio:o===0?1:r.known/o},population:{eligible_runs:o,known_runs:r.known,unknown_runs:r.unknown}}]}))}function uo(e,t,n,i=!1){let r=Br[e]??0,o=e>=Gt.cutoffDay?n:void 0;if(i&&r===0&&o===void 0)return eH();let a=i?o?.value:e<Gt.cutoffDay?void 0:t.duration,s=a?.unknown??0,l=i?o?.population.eligible_runs??0:t.runs,c=i?o?.population.known_runs??0:t.runs-s;return{value:{known_sum:r+(a?.known_sum??0),unknown:s,complete:s===0,coverage_ratio:l===0?1:c/l},population:{eligible_runs:l,known_runs:c,unknown_runs:s}}}function eH(){return{value:{known_sum:0,unknown:0,complete:!0,coverage_ratio:1},population:{eligible_runs:0,known_runs:0,unknown_runs:0}}}function tH(e){let[t,n,i]=e.split("-").map(Number),r=new Date(Date.UTC(t,n-1,i+1)),o=new Intl.DateTimeFormat("en-US",{timeZone:"America/Sao_Paulo",timeZoneName:"longOffset"}).formatToParts(r).find(s=>s.type==="timeZoneName")?.value??"GMT",a=/^GMT([+-])(\d{2}):(\d{2})$/.exec(o);return a===null?r.getTime():r.getTime()-(Number(a[2])*60+Number(a[3]))*6e4*(a[1]==="+"?1:-1)}function nH(e){let t=0,n=Number.NaN,i=Number.NaN;for(let r of e.toSorted((o,a)=>o.start-a.start))!Number.isFinite(n)||r.start>i?(Number.isFinite(n)&&(t+=i-n),n=r.start,i=r.end):i=Math.max(i,r.end);return Number.isFinite(n)?t+i-n:t}var Xg=P(()=>{"use strict";Jo()});function rH(e,t){return(t.from===null||e>=t.from.slice(0,10))&&(t.to===null||e<=t.to.slice(0,10))}function RO(e,t){let n=u=>{let _=e.reduce((f,[,h])=>f+u(h).known_sum,0),p=e.reduce((f,[,h])=>f+u(h).unknown,0),v=e.reduce((f,[,h])=>f+h.runs,0);return{value:v===p?null:_,coverage:v===0?1:(v-p)/v}},i=e.map(([u,_])=>{let p=u<=Gt.cutoffDay?Br[u]??0:0,v=u<Gt.cutoffDay?void 0:_.duration;return{known_sum:p+(v?.known_sum??0),unknown:v?.unknown??0,runs:_.runs}}),r=i.reduce((u,_)=>u+_.known_sum,0),o=i.reduce((u,_)=>u+_.unknown,0),a=i.reduce((u,_)=>u+_.runs,0),s=a===o&&r===0?null:r,l={value:t.from===null&&t.to===null&&s!==null?cd(s):s,coverage:a===0?1:(a-o)/a},c=n(u=>u.usage.total_tokens),d=n(u=>u.usage.cost);return{duration_ms:l.value,tokens:c.value,cost_brl:d.value,coverage:{duration:l.coverage,tokens:c.coverage,cost:d.coverage},execution_day_count:i.filter(u=>u.known_sum>0).length}}function e_(e,t){if(e===null)return[];let n=new Map;for(let[i,r]of Object.entries(e.days)){if(!rH(i,t))continue;let o=r.tasks.length>0?r.tasks:r.specs.length>0?r.specs:r.prds;for(let a of o){let s=n.get(a.id);if(s===void 0){n.set(a.id,structuredClone(a));continue}s.run_count+=a.run_count;for(let l of["duration","total_tokens","cost"])s.metrics[l].known_sum+=a.metrics[l].known_sum,s.metrics[l].unknown+=a.metrics[l].unknown,s.metrics[l].complete=s.metrics[l].unknown===0,s.metrics[l].coverage_ratio=s.run_count===0?1:(s.run_count-s.metrics[l].unknown)/s.run_count;(a.window_at??a.occurred_at)>(s.window_at??s.occurred_at)&&(s.status=a.status,s.risk=a.risk,a.window_at!==void 0&&(s.window_at=a.window_at))}}return[...n.values()]}function $O(e){let t={},n={};for(let i of e){let r=i.status??"unclassified",o=i.risk??"unclassified";t[r]=(t[r]??0)+1,n[o]=(n[o]??0)+1}return{total:e.length,statuses:t,risks:n}}function Yg(e,t,n){let i=sH(),r={...i,tokens:{...i.tokens,total:_o(e.metrics.total_tokens)},cost:{...i.cost,brl:_o(e.metrics.cost)}};return{id:e.id,title:e.title??e.id,created_at:e.occurred_at,updated_at:e.window_at??null,kind:t,parent_id:e.parent_id,artifact_path:"",lifecycle_status:e.status??"unavailable",work_status:iH(e.status),execution_ids:[],task_ids:[],planned_tasks:[],canonical_run_ids:[],run_ids:[],root_execution_run_ids:[],execution_count:0,task_count:n,run_count:e.run_count,duration_ms:_o(e.metrics.duration),observed_root_duration_ms:_o(e.metrics.duration),observed_lifecycle_duration_ms:null,duration_coverage:oH(e),duration_provenance:e.metrics.duration.complete?"observed":"unavailable",lifecycle_duration_coverage:aH(),lifecycle_duration_provenance:"unavailable",decisions:{human:0,agent:0},rework_run_count:0,quality:{completed_tasks:0,task_completion_rate:0,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},usage:cH(i,r)}}function CO(e){let t=e.status,n=["completed","blocked","failed","cancelled"].includes(t??"");return{schema_version:2,id:e.id,revision:0,change_id:"",title:e.title??e.id,short_name:e.id,objective:"",status:t==="draft"||t==="planned"||t==="executing"||t==="verifying"||t==="completed"||t==="failed"||t==="blocked"||t==="cancelled"?t:"draft",attempt_count:t==="planned"||t==="draft"?0:null,risk:e.risk==="lite"||e.risk==="standard"||e.risk==="critical"?e.risk:"standard",priority:"medium",owner:null,requirement_ids:[],acceptance_ids:[],depends_on:[],write_scopes:[],created_at:e.occurred_at,updated_at:e.window_at??e.occurred_at,started_at:t==="executing"||t==="verifying"||n?e.occurred_at:null,finished_at:n?e.window_at??e.occurred_at:null,result:null,artifact_path:"",progress:n?1:0,spec_id:e.parent_id,execution_started:t==="executing"||t==="verifying"||n,execution_ids:[],execution_count:0,telemetry:{duration_ms:_o(e.metrics.duration),tokens:_o(e.metrics.total_tokens),cost_brl:_o(e.metrics.cost)},test_count:0}}function IO(e){return e.map(t=>({task_id:t.id,duration_ms:t.metrics.duration.known_sum,total_tokens:t.metrics.total_tokens.known_sum,cost_brl:t.metrics.cost.known_sum,run_count:t.run_count})).sort((t,n)=>n.duration_ms-t.duration_ms||t.task_id.localeCompare(n.task_id)).slice(0,5)}function _o(e){return e.known_sum===0&&e.unknown>0?null:e.known_sum}function iH(e){return e==="delivered"?"completed":["planning","executing","verifying","completed","blocked","failed","cancelled"].includes(e??"")?e:"planning"}function oH(e){return{eligible_runs:e.run_count,known_runs:e.run_count-e.metrics.duration.unknown,unknown_runs:e.metrics.duration.unknown,coverage_ratio:e.metrics.duration.coverage_ratio}}function aH(){return{eligible_runs:0,known_runs:0,unknown_runs:0,coverage_ratio:1}}function sH(){return{events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}}}function cH(e,t){return{conversation:e,planning:e,execution:e,total:t,new_work:e,rework:e}}var NO=P(()=>{"use strict";Jo()});function Qg(e,t,n=!0){let i=[...new Map(e.map(c=>[c.id,c])).values()],r=n?i.filter(c=>r_(c.finished_at??c.started_at,t)):i,o=r.filter(c=>c.phase==="execution"&&c.parent_run_id==null),a=eh(o,t),s=c=>{let d=c.filter(u=>u!==null);return d.length===0?null:Math.round(d.reduce((u,_)=>u+_,0)*1e9)/1e9},l=c=>c.length===0?1:c.filter(d=>d!==null).length/c.length;return{duration_ms:a===void 0||a.coverage_ratio===0?null:a.known_sum,tokens:s(r.map(c=>c.total_tokens)),cost_brl:s(r.map(c=>c.cost)),coverage:{duration:a?.coverage_ratio??1,tokens:l(r.map(c=>c.total_tokens)),cost:l(r.map(c=>c.cost))},execution_day_count:new Set(o.map(c=>Ot(c.duration_started_at??c.started_at,"day")).filter(c=>c!==null)).size}}function eh(e,t){let n=Zs(e),r=[...new Set([...Object.keys(Br),...n.keys()])].filter(c=>t_(c,t)).map(c=>uo(c,{runs:0},n.get(c),!0).value);if(r.length===0)return;let o=r.reduce((c,d)=>c+d.unknown,0),a=r.reduce((c,d)=>c+d.known_sum,0),s=[...n].filter(([c])=>t_(c,t)).reduce((c,[,d])=>c+d.population.eligible_runs,0),l=[...n].filter(([c])=>t_(c,t)).reduce((c,[,d])=>c+d.population.known_runs,0);return{known_sum:a,unknown:o,complete:o===0,coverage_ratio:s===0?1:l/s}}function t_(e,t){return(t.from===null||e>=t.from.slice(0,10))&&(t.to===null||e<=t.to.slice(0,10))}async function Hs(e,t,n={},i={}){if(t.version===1)throw new Error("Operations projection requires a modern WorkspaceLayout");let r=new Ut(e),o=Xd(n),[a,s,l,c]=await Promise.all([r.readDailyReadModels("overview"),r.readDailyReadModels("tasks"),r.readDailyReadModels("specs"),r.readDailyReadModels("prds")]);if(a===null)throw new Error("Lifecycle daily overview is not initialized");let d=Object.entries(a.days).filter(([S])=>t_(S,o)).map(([S,x])=>[S,x.overview]),u=RO(d,o),_={runs:d.reduce((S,[,x])=>S+x.runs,0)},p=hH(),v={...p,tokens:{...p.tokens,total:u.tokens},cost:{...p.cost,brl:u.cost_brl}},f=u.coverage,h=Gg(d,u.duration_ms??0),k=e_(s,o),w=e_(c,o),O=e_(l,o),g=$O(k),b=g.statuses,T=g.risks,I=new Map;for(let S of k)S.parent_id!==null&&I.set(S.parent_id,(I.get(S.parent_id)??0)+1);let R=new Map(O.map(S=>[S.id,S.parent_id])),U=w.map(S=>Yg(S,"prd",k.filter(x=>x.parent_id===S.id).length+[...I].filter(([x])=>R.get(x)===S.id).reduce((x,[,W])=>x+W,0))),V=O.map(S=>Yg(S,"spec",I.get(S.id)??0)),y=IO(k);return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",filters:o,summary:{prd_count:U.length,spec_count:V.length,execution_count:0,task_count:g.total,run_count:_.runs,overview_metrics:{duration_ms:u.duration_ms,execution_day_count:u.execution_day_count,tokens:u.tokens,cost_brl:u.cost_brl,prd_count:U.length,spec_count:V.length,selected_counts:{prds:U.length,specs:V.length},task_count:g.total,completed_prd_count:U.filter(S=>S.work_status==="completed").length,completed_spec_count:V.filter(S=>S.work_status==="completed").length,completed_task_count:b.completed??0,task_status_counts:b,task_risk_counts:T,top_tasks:y,latest_task_created_at:k.map(S=>S.occurred_at).sort().at(-1)??null,coverage:{duration:f.duration,tokens:f.tokens,cost:f.cost},data_source:"lifecycle_manifest_summary",partial:!0},decisions:{human:0,agent:0},source_latest_at:a.source_latest_at,quality:{completed_tasks:0,task_completion_rate:0,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},reconciliation:{phase_tokens_match_total:!1,phase_usd_match_total:!1,phase_brl_match_total:!1,origin_tokens_match_total:!1},usage:Bs(p,v),periods:{daily:h}},origins:{conversation:Bs(p,p),task:Bs(p,p),spec:Bs(p,p),prd:Bs(p,p)},prds:U,specs:V,tasks:i.includeBoardTasks?k.map(CO):[],changes:[],executions:[],runs:[],decisions:[],evidences:[],validations:[]}}function lH(e,t){return Object.fromEntries(e.map(([n,i])=>{let r=eh(t.filter(dH),{from:n,to:n});return[n,{...i,...r===void 0?{}:{duration:r}}]}))}function uH(e,t){let n={},i={},r=0;for(let o of e){let s=o.finished_at??(typeof o.data?.finished_at=="string"?o.data.finished_at:null)??o.updated_at;if(!r_(s,t))continue;r+=1;let l=o.status??"unclassified",c=o.risk??"unclassified";n[l]=(n[l]??0)+1,i[c]=(i[c]??0)+1}return{total:r,statuses:n,risks:i}}function r_(e,t){let n=new Date(e).toISOString();return(t.from===null||n>=t.from)&&(t.to===null||n<=t.to)}function PO(e,t){let n=new Map;for(let i of e){if(i.task_id===null||!t.has(i.task_id))continue;let r=n.get(i.task_id)??{task_id:i.task_id,duration_ms:0,total_tokens:0,cost_brl:0,run_count:0,runs:[]};r.runs.push(i),r.total_tokens+=i.total_tokens??0,r.cost_brl+=i.cost??0,r.run_count+=1,n.set(i.task_id,r)}return[...n.values()].map(({runs:i,...r})=>({...r,duration_ms:Hr(i)??0})).sort((i,r)=>r.duration_ms-i.duration_ms||i.task_id.localeCompare(r.task_id)).slice(0,5)}function dH(e){return e.phase==="execution"&&e.parent_run_id==null}function _H(e,t,n){let i=t===null?null:Ot(t,"day"),r=n===null?null:Ot(n,"day");return Object.entries(pH(e)).filter(([o])=>(i===null||o>=i)&&(r===null||o<=r))}function pH(e){let t=[...new Map((e.run_metrics??[]).map(o=>[o.id,o])).values()],n=Object.values(e.periods.daily).reduce((o,a)=>o+a.runs,0);if(t.length===0||t.length!==n)return e.periods.daily;let i=new Map;for(let o of t){let a=Ot(o.finished_at??o.started_at,"day");a!==null&&i.set(a,[...i.get(a)??[],o])}let r=new Set([...Object.keys(e.periods.daily),...i.keys()]);return Object.fromEntries([...r].map(o=>{let a=e.periods.daily[o]??fH(e.usage.cost.currency),s=i.get(o)??[];return[o,{...a,runs:s.length,usage:{...a.usage,total_tokens:n_(s.map(l=>l.total_tokens)),cost:{...n_(s.map(l=>l.cost)),currency:a.usage.cost.currency??e.usage.cost.currency}},events:n_(s.map(l=>l.events))}]}))}function n_(e){let t=e.filter(i=>i!==null),n=e.length-t.length;return{known_sum:t.reduce((i,r)=>i+r,0),unknown:n,complete:n===0,coverage_ratio:e.length===0?1:t.length/e.length}}function fH(e){let t=n_([]);return{prds:0,specs:0,tasks:0,validations:0,evidences:0,runs:0,usage:{input_tokens:t,output_tokens:t,total_tokens:t,cost:{...t,currency:e}},events:t}}function mH(e,t,n){return PO((e.run_metrics??[]).filter(i=>r_(i.finished_at??i.started_at,t)),n)}function gH(e,t){return r_(e.updated_at,t)}function hH(){return{events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}}}function Bs(e,t){return{conversation:e,planning:e,execution:e,total:t,new_work:e,rework:e}}function yH(e){let t=n=>e.length===0?1:n/e.length;return{duration:t(e.filter(n=>n.duration_ms!==null).length),tokens:t(e.filter(n=>n.total_tokens!==null).length),cost:t(e.filter(n=>n.cost!==null).length)}}var th=P(()=>{"use strict";bi();Jo();As();Xg();Wg();NO()});function MO(e){return[...e].sort((t,n)=>n.started_at.localeCompare(t.started_at)||n.id.localeCompare(t.id))}var LO=P(()=>{"use strict"});async function jO(e,t,n){if(t.version===1)throw new TypeError("Operations projection requires a modern layout");let i=(await Promise.all(bH(t.entityRoot("run"),n).map(o=>e.listFiles(o,".jsonl")))).flat();return(await vH(i,32,async o=>{let a=xs(Ts(await e.readText(o))),s=a.finished?.occurred_at??a.run.occurred_at;return(n.from!==null||n.to!==null)&&!SH(s,n)?null:{fold:a,artifactPath:o,cost:{run:a.run,records:a.records,effective_usage_records:a.effective_usage_records}}})).filter(o=>o!==null).sort((o,a)=>o.fold.run.run_id.localeCompare(a.fold.run.run_id))}async function vH(e,t,n){let i=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);i.push(...await Promise.all(o.map(n)))}return i}function bH(e,t){return[e]}function SH(e,t){let n=new Date(e).toISOString();return(t.from===null||n>=t.from)&&(t.to===null||n<=t.to)}var DO=P(()=>{"use strict";Os()});async function i_(e,t,n){let i=new Map(t.map(o=>[o.id,0])),r=new Map;for(let o of t)r.set(o.change_id,[...r.get(o.change_id)??[],o]);for(let[o,a]of r){let s=n(o).replace(/\\/g,"/"),l=s.slice(0,s.lastIndexOf("/")),c;try{c=await e.listFiles(l)}catch{continue}let d=c.filter(u=>u.replace(/\\/g,"/").includes("/artifacts/tests/")&&/\.(?:md|json|jsonl|txt|log)$/i.test(u));for(let u of d){let _;try{_=await e.readText(u)}catch{continue}for(let p of a)_.includes(p.id)&&i.set(p.id,(i.get(p.id)??0)+1)}}return i}var nh=P(()=>{"use strict"});function FO(e,t){let n=Qg(e.map(i=>({id:i.id,started_at:i.started_at,finished_at:i.finished_at??null,phase:i.phase??null,parent_run_id:i.parent_run_id??null,duration_started_at:i.source_started_at??i.duration_started_at??null,duration_ms:i.source_duration_ms!==null&&i.source_duration_ms!==void 0?i.source_duration_ms:i.duration_ms,total_tokens:i.usage.total.tokens.total,cost:i.usage.total.cost.brl})),t,!1);return{duration_ms:n.duration_ms,execution_day_count:n.execution_day_count,tokens:n.tokens,cost_brl:n.cost_brl}}async function Ks(e,t,n={},i={}){if(t.version===1)throw new Error("Operations projection requires a modern WorkspaceLayout");let r=Xd(n),o=new Ut(e),a=new io(e,t),s=new oo(e,t),l=new ao(e,t),c=new so(e,t),d=new ua(e,t),u=new md(e,t),[_,p]=await Promise.all([o.readEntities(),i.overviewOnly?Promise.resolve([]):jO(e,t,r)]);if(_.length===0&&await o.readSummary()===null&&!await e.exists(".agents/records/lifecycle/.gitkeep"))throw new Error("Lifecycle manifest is not initialized; run `zaip manifest rebuild --confirm-full-scan`");let v=Js(_,"prd"),f=Js(_,"spec"),h=Js(_,"change"),k=Js(_,"execution"),w=Js(_,"task"),O=EH(_),g=wH(_),b=kH(_),T=p.map(hO),I=v.filter(z=>zO(z.status,z.updated_at,r)),R=f.filter(z=>zO(z.status,z.updated_at,r)),U=h.filter(z=>rh(z,r)),V=k.filter(z=>rh(z,r)),y=w.filter(z=>rh(z,r)),S=O.filter(z=>_a(z.created_at,r)),x=g.filter(z=>_a(z.observed_at,r)),W=b.filter(z=>_a(z.executed_at,r)),ce=T.filter(z=>_a(z.finished_at??z.started_at,r)),ee=Tr(ce),ge=new Map(h.map(z=>[z.id,z])),L=new Map(w.map(z=>[z.id,z])),le=new Map(k.map(z=>[z.id,z])),B=wO({changes:h,tasks:w,executions:k,prds:v,specs:f,runs:ee}),me=i.overviewOnly||i.skipTestArtifacts?new Map:await i_(e,y,z=>l.path(z)),Ie=Vd(k),Me=AO(k),Te=_O(ee),Z=EO(v,f),oe=I.map(z=>{let Ye=B.forPrd(z.id);return Bg({id:z.id,title:z.title,createdAt:z.created_at,updatedAt:z.updated_at,kind:"prd",parentId:null,artifactPath:a.path(z.id),lifecycleStatus:z.status,...Ye,decisions:O,executions:le,tasks:L,plannedTasks:Z.byPrd.get(z.id)??[]})}),he=R.map(z=>{let Ye=B.forSpec(z.id);return Bg({id:z.id,title:z.title,createdAt:z.created_at,updatedAt:z.updated_at,kind:"spec",parentId:z.prd_id,artifactPath:s.path(z.id),lifecycleStatus:z.status,...Ye,decisions:O,executions:le,tasks:L,plannedTasks:Z.bySpec.get(z.id)??[]})}),Re=y.map(z=>{let Ye=ge.get(z.change_id);return{...z,attempt_count:z.attempt_count??null,artifact_path:d.path(z.id),progress:Kd(z.status),test_count:me.get(z.id)??0,spec_id:Ye?.source.type==="spec"||Ye?.source.type==="prd"?Ye.source.spec_id:null,execution_started:Ie.has(z.id),execution_ids:Me.get(z.id)??[],execution_count:Me.get(z.id)?.length??0,telemetry:Te.get(z.id)??null}}),Fe=dn(ee),bt=Es(ee),St=FO(ee,r),Pt=i.overviewOnly?await Hs(e,t,r):null,Ii=UO(y,z=>z.status),yo=UO(y,z=>z.risk),lc=qO(I,R),uc={prd_count:oe.length,spec_count:he.length,selected_counts:{prds:oe.length,specs:he.length},task_count:y.length,completed_prd_count:lc.prds,completed_spec_count:lc.specs,completed_task_count:Ii.completed??0,task_status_counts:Ii,task_risk_counts:yo,latest_task_created_at:Vs(y.map(z=>z.created_at))},dc={conversation:dn(ee.filter(z=>z.entrypoint==="conversation")),task:dn(ee.filter(z=>z.entrypoint==="task")),spec:dn(ee.filter(z=>z.entrypoint==="spec")),prd:dn(ee.filter(z=>z.entrypoint==="prd"))};return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",filters:r,summary:{prd_count:oe.length,spec_count:he.length,execution_count:V.length,task_count:y.length,run_count:ee.length,execution_duration_ms:Hr(bt)??0,execution_day_count:new Set(bt.map(z=>z.started_at.slice(0,10))).size,overview_metrics:Pt?.summary.overview_metrics===void 0?{...St,...uc,data_source:"run_records",partial:!1}:{...Pt.summary.overview_metrics,...uc,partial:!1},decisions:Hd(S),source_latest_at:Pt?.summary.source_latest_at??Vs([...I.map(z=>z.updated_at),...R.map(z=>z.updated_at),...U.map(z=>z.updated_at),...V.map(z=>z.updated_at),...y.map(z=>z.updated_at),...S.map(z=>z.created_at),...ee.map(z=>z.finished_at??z.started_at)]),quality:qs(y,ee),reconciliation:Jd(Fe,dc),usage:Pt?.summary.usage??Fe},origins:dc,prds:oe,specs:he,tasks:Re,changes:i.overviewOnly&&!i.includeOverviewChanges?[]:U.map(z=>({...z,artifact_path:l.path(z.id)})),executions:i.overviewOnly?[]:V.map(z=>({...z,kind:z.kind??"delivery",client_turn_id:z.client_turn_id??null,...bO(z,{runs:ee.map(Ye=>({agent:Ye.agent,call_count:Ye.call_count,duration_ms:Ye.duration_ms,...Ye.duration_provenance===void 0?{}:{duration_provenance:Ye.duration_provenance},execution_id:Ye.execution_id,finished_at:Ye.finished_at,parent_run_id:Ye.parent_run_id,run_purpose:Ye.run_purpose,source_duration_ms:Ye.source_duration_ms??null,started_at:Ye.started_at,status:Ye.status,task_id:Ye.task_id,usage:Ye.usage.total})),tasks:y,changes:U,specs:R}),artifact_path:c.path(z.id),work_status:mO(z.status)})),runs:i.overviewOnly?[]:MO(ee),evidences:x,validations:W,decisions:i.overviewOnly?[]:S.map(z=>({id:z.id,title:z.title,origin:z.origin,scope_type:z.scope_type,scope_id:z.scope_id,artifact_path:u.path(z.scope_type,z.scope_id,z.id),created_at:z.created_at}))}}function qO(e,t){return{prds:e.filter(n=>n.status==="delivered").length,specs:t.filter(n=>n.status==="delivered").length}}function UO(e,t){return e.reduce((n,i)=>{let r=t(i);return n[r]=(n[r]??0)+1,n},{})}function kH(e){return e.flatMap(t=>{let n=t.data;return t.kind!=="validation"||n===null||typeof n.executed_at!="string"?[]:[{id:t.id,task_id:typeof n.task_id=="string"?n.task_id:null,executed_at:n.executed_at}]})}function wH(e){return e.flatMap(t=>{let n=t.data;return t.kind!=="evidence"||n===null||typeof n.observed_at!="string"?[]:[{id:t.id,task_id:typeof n.task_id=="string"?n.task_id:null,observed_at:n.observed_at}]})}function Js(e,t){return e.flatMap(n=>n.kind===t&&n.data!==null?[{...n.data,id:n.id,title:n.title??n.data.title,status:n.status??n.data.status,risk:n.risk??n.data.risk,priority:n.priority??n.data.priority,updated_at:n.updated_at}]:[])}function EH(e){return e.flatMap(t=>{if(t.kind!=="decision"||t.data===null)return[];let n=t.data;return n.origin!=="human"&&n.origin!=="agent"||n.scope_type!=="change"&&n.scope_type!=="execution"||typeof n.scope_id!="string"||typeof n.created_at!="string"?[]:[{id:t.id,title:t.title??t.id,origin:n.origin,scope_type:n.scope_type,scope_id:n.scope_id,created_at:n.created_at}]})}function rh(e,t){return _a(e.finished_at??e.updated_at,t)}function zO(e,t,n){return _a(t,n)}function _a(e,t){let n=new Date(e).toISOString();return(t.from===null||n>=t.from)&&(t.to===null||n<=t.to)}var VO=P(()=>{"use strict";Os();bi();Ds();Ug();As();zg();Fg();Vg();Gd();SO();Wg();Jg();TO();th();LO();DO();nh();Ws();qg();Vg();Gd();Jg()});async function ih(e,t,n){if(t.version===1)throw new Error("Task detail requires a modern WorkspaceLayout");let i=new ua(e,t),r=new ao(e,t),o=new so(e,t),{task:a,body:s}=await i.read(n),{change:l}=await r.read(a.change_id),c=l.source.type==="spec"||l.source.type==="prd"?l.source.spec_id:null,d=await i_(e,[a],v=>r.path(v)),u=await o.list(),_=Vd(u),p=u.filter(v=>v.kind!=="interaction"&&(v.origin.type==="task"&&v.origin.task_id===a.id||v.dag.nodes.some(f=>f.task_id===a.id))).map(v=>v.id).sort();return{task:{...a,attempt_count:a.attempt_count??null,artifact_path:i.path(a.id),progress:Kd(a.status),spec_id:c,execution_started:_.has(a.id),execution_ids:p,execution_count:p.length,test_count:d.get(a.id)??0},body:s,artifact_path:i.path(a.id)}}async function oh(e,t,n){if(t.version===1)throw new Error("PRD detail requires a modern WorkspaceLayout");let i=new io(e,t),{prd:r,body:o}=await i.read(n);return{id:r.id,title:r.title,body:o,artifact_path:i.path(r.id)}}async function ah(e,t,n){if(t.version===1)throw new Error("SPEC detail requires a modern WorkspaceLayout");let i=new oo(e,t),{spec:r,body:o}=await i.read(n);return{id:r.id,title:r.title,body:o,artifact_path:i.path(r.id)}}var WO=P(()=>{"use strict";Ds();Ug();zg();nh();Ws()});var ZO={};ey(ZO,{aggregateOverviewRunMetrics:()=>Qg,aggregateTopTasks:()=>PO,buildOperationsProjection:()=>Ks,buildQuickOperationsProjection:()=>Hs,coverageFromRuns:()=>yH,createDescendantQueries:()=>pO,deliveredMacroCounts:()=>qO,effectiveOperationsDurationMs:()=>yO,estimatedTokenDurationMs:()=>OO,hybridDailyDuration:()=>uo,hybridLegacyDurationMetric:()=>eh,latestObservedSourceTiming:()=>Zd,macroInWindow:()=>gH,manifestDailyPeriods:()=>_H,normalizeDailyPeriods:()=>Gg,normalizeTokenBackedDailyDuration:()=>Qd,observedExecutionElapsedMs:()=>Hr,observedMacroRunTelemetry:()=>Hg,observedSourceTiming:()=>Wd,overviewMetricTotals:()=>FO,projectExecutionDurations:()=>Tr,readPrdDetail:()=>oh,readSpecDetail:()=>ah,readTaskDetail:()=>ih,recalculateOperationsRunSummary:()=>Yd,rootExecutionDurationByDay:()=>Zs,summaryTopTasks:()=>mH,taskCountsInWindow:()=>uH,withExecutionDurations:()=>lH});var Gs=P(()=>{"use strict";As();VO();Xg();th();WO()});var UK={};ey(UK,{SqliteReadModelFileSystem:()=>Et,app:()=>jK,createDashboardApp:()=>Kh,dashboardWorkspaceKey:()=>T_,defaultDashboardApp:()=>Jh,githubRepositoryFromRemote:()=>A_,manifestRun:()=>Mh,mergeManifestRuns:()=>ic,openWorkIds:()=>xK,projectAllTimeTopTasks:()=>T$,projectionPeriodFilter:()=>Nt,rebuildSqliteReadModel:()=>ac,reconciliationResult:()=>zh,validateSqliteReadModelSchema:()=>oc});module.exports=V$(UK);var cc=require("node:crypto"),A$=require("node:fs/promises"),Bh=require("node:path");var ny="x-hono-already-sent";var bc=require("node:http"),Pr=require("node:http2"),L_=require("node:stream");var ry=e=>((...t)=>{if(typeof t[0]=="function"){let[n,i]=t;return async function(o,a){let s=await n(o),l=await e(o,s,i);if(l)return l;await a()}}else{let[n,i,r]=t;return(async()=>{let o=await e(n,i,r);if(!o)throw new Error("Failed to upgrade WebSocket");return o})()}});var kn=class extends Error{constructor(e,t){super(e,t),this.name="RequestError"}},W$=/^\/[!#$&-;=?-\[\]_a-z~]*$/,Z$=/\/\.\.?(?:[/?#]|$)/,B$=/^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/,H$=(e,t,n)=>{let i=`${e}://${t}${n}`;if(B$.test(t)){if(n.length===0)return i+"/";if(n.charCodeAt(0)!==47)throw new kn("Invalid URL");return!W$.test(n)||Z$.test(n)?new URL(i).href:i}else{let r=new URL(i);if(r.hostname.length!==t.length&&r.hostname!==(t.includes(":")?t.replace(/:\d+$/,""):t).toLowerCase())throw new kn("Invalid host header");return r.href}},J$=e=>e instanceof kn?e:new kn(e.message,{cause:e}),K$=global.Request,ko=class extends K${constructor(e,t){if(typeof e=="object"&&ti in e){let n=t!==void 0&&"body"in t&&t.body!=null;if(e[Mr]&&!n)throw new TypeError("Cannot construct a Request with a Request object that has already been used.");e=e[ti]()}typeof t?.body?.getReader<"u"&&(t.duplex??="half"),super(e,t)}},dy=e=>{let t=[],n=e.rawHeaders;for(let i=0,r=n.length;i<r;i+=2){let o=n[i];o.charCodeAt(0)!==58&&t.push([o,n[i+1]])}return new Headers(t)},_y=Symbol("wrapBodyStream"),G$=new Set(["latin1","binary","hex","base64","base64url"]),X$=e=>e===null||G$.has(e),M_=Symbol("bodyBufferedBeforeDisconnect"),j_=Symbol("bodyBufferedLengthBeforeDisconnect"),py=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??"utf8"),V_=e=>!(e instanceof Pr.Http2ServerRequest)&&!!e.complete&&!!e.readableAborted&&typeof e.read=="function"&&X$(e.readableEncoding),iy=e=>{if(e.readableDidRead||!V_(e))return;let t=e;t[j_]??=e.readableLength},gc=(e,t)=>{if(e.readableDidRead&&!t||!V_(e))return;let n=e;if(n[M_]!==void 0)return n[M_];let i,r=e.errored;if(r&&r.code!=="ECONNRESET")i=r;else if(n[j_]!==void 0&&e.readableLength!==n[j_])i=hc();else{let o=t??[],a=e.read();a!==null&&o.push(py(a,e.readableEncoding));let s=o.length===1?o[0]:Buffer.concat(o);i=s;let l=e.headers["content-length"];if(typeof l=="string"&&/^\d+$/.test(l)){let c=Number(l);Number.isSafeInteger(c)&&s.length!==c&&(i=hc())}}return n[M_]=i,i},oy=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},Y$=(e,t,n,i,r)=>{let o={method:e,headers:n,signal:r.signal};if(e==="TRACE"){o.method="GET";let a=new ko(t,o);return Object.defineProperty(a,"method",{get(){return"TRACE"}}),a}if(!(e==="GET"||e==="HEAD"))if("rawBody"in i&&i.rawBody instanceof Buffer)o.body=new ReadableStream({start(a){a.enqueue(i.rawBody),a.close()}});else if(i[_y]){let a;o.body=new ReadableStream({async pull(s){try{if(!a){let d=gc(i);if(d!==void 0){oy(s,d);return}}a||=L_.Readable.toWeb(i).getReader();let{done:l,value:c}=await a.read();l?s.close():s.enqueue(c)}catch(l){s.error(l)}}})}else{let a=gc(i);a!==void 0?o.body=new ReadableStream({start(s){oy(s,a)}}):o.body=L_.Readable.toWeb(i)}return new ko(t,o)},ti=Symbol("getRequestCache"),Ir=Symbol("requestCache"),wo=Symbol("incomingKey"),wa=Symbol("urlKey"),fy=Symbol("methodKey"),my=Symbol("headersKey"),Sa=Symbol("abortControllerKey"),D_=Symbol("getAbortController"),U_=Symbol("abortRequest"),ei=Symbol("bodyBuffer"),mc=Symbol("bodyReadPromise"),Mr=Symbol("bodyConsumedDirectly"),ay=Symbol("bodyLockReader"),ka=Symbol("abortReason"),hc=()=>new TypeError("Body is unusable"),Ea=()=>Promise.reject(hc()),Q$=new TextDecoder,eC=e=>{if(e[Mr])return Ea();e[Mr]=!0},tC=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),nC=e=>(e[my]||=dy(e[wo])).get("content-type")||"",rC=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,iC=e=>{if(typeof e!="string"||e.length===0)return"GET";switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return e}let t=e.toUpperCase();switch(t){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return t;default:return e}},oC=e=>{if(!rC.test(e))return new TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t==="CONNECT"||t==="TRACK"||t==="TRACE"&&e!=="TRACE")return new TypeError(`'${e}' HTTP method is unsupported.`)},W_=(e,t,n)=>{if(e[Mr])return Ea();let i=e.method;if(i==="GET"||i==="HEAD")return e[ti]()[t]();let r=oC(i);if(r)return Promise.reject(r);if(e[Ir]&&i!=="TRACE")return e[Ir][t]();let o=eC(e);if(o)return o;let a=aC(e);if(a){let s=Promise.resolve(n(a,e));return e[ei]=void 0,s}return sC(e).then(s=>{let l=n(s,e);return e[ei]=void 0,l})},aC=e=>{let t=e[wo];if("rawBody"in t&&t.rawBody instanceof Buffer)return t.rawBody},sy=(e,t)=>{if(t.errored)return t.errored;let n=e[ka];return n!==void 0?n instanceof Error?n:new Error(String(n)):new Error("Client connection prematurely closed.")},sC=e=>{if(e[ei])return Promise.resolve(e[ei]);if(e[mc])return e[mc];let t=e[wo];if(t.readableDidRead)return Ea();let n=gc(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[ei]=n,Promise.resolve(n));let i=new Promise((r,o)=>{let a=[],s=!1,l=f=>{s||(s=!0,v(),f())},c=f=>{let h=t.errored??f;return!V_(t)||h&&h.code!=="ECONNRESET"?!1:(l(()=>{let k=gc(t,a);k instanceof Error?o(k):k===void 0?o(f??sy(e,t)):(e[ei]=k,r(k))}),!0)},d=f=>{a.push(py(f,t.readableEncoding))},u=()=>{l(()=>{let f=a.length===1?a[0]:Buffer.concat(a);e[ei]=f,r(f)})},_=f=>{c(f)||l(()=>{o(f)})},p=()=>{if(t.readableEnded){u();return}c()||l(()=>{o(sy(e,t))})},v=()=>{t.off("data",d),t.off("end",u),t.off("error",_),t.off("close",p),e[mc]=void 0};t.on("data",d),t.on("end",u),t.on("error",_),t.on("close",p),queueMicrotask(()=>{s||(t.readableEnded?u():t.errored?_(t.errored):t.destroyed&&p())})});return e[mc]=i,i},En={get method(){return this[fy]},get url(){return this[wa]},get headers(){return this[my]||=dy(this[wo])},[U_](e){this[ka]===void 0&&(this[ka]=e);let t=this[Sa];t&&!t.signal.aborted&&t.abort(e)},[D_](){return this[Sa]||=new AbortController,this[ka]!==void 0&&!this[Sa].signal.aborted&&this[Sa].abort(this[ka]),this[Sa]},[ti](){let e=this[D_]();if(this[Ir])return this[Ir];let t=this.method;if(this[Mr]&&!(t==="GET"||t==="HEAD")){this[ei]=void 0;let n={method:t==="TRACE"?"GET":t,headers:this.headers,signal:e.signal};t!=="TRACE"&&(n.body=new ReadableStream({start(r){r.close()}}),n.duplex="half");let i=new ko(this[wa],n);return t==="TRACE"&&Object.defineProperty(i,"method",{get(){return"TRACE"}}),this[Ir]=i}return this[Ir]=Y$(this.method,this[wa],this.headers,this[wo],e)},get body(){if(!this[Mr])return this[ti]().body;let e=this[ti]();return!this[ay]&&e.body&&(this[ay]=e.body.getReader()),e.body},get bodyUsed(){return this[Mr]?!0:this[Ir]?this[Ir].bodyUsed:!1}};Object.defineProperty(En,"signal",{get(){return this[D_]().signal}});["cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","keepalive"].forEach(e=>{Object.defineProperty(En,e,{get(){return this[ti]()[e]}})});["clone","formData"].forEach(e=>{Object.defineProperty(En,e,{value:function(){if(this[Mr]){if(e==="clone")throw hc();return Ea()}return this[ti]()[e]()}})});Object.defineProperty(En,"text",{value:function(){return W_(this,"text",e=>Q$.decode(e))}});Object.defineProperty(En,"arrayBuffer",{value:function(){return W_(this,"arrayBuffer",e=>tC(e))}});Object.defineProperty(En,"blob",{value:function(){return W_(this,"blob",(e,t)=>{let n=nC(t),i=n?{headers:{"content-type":n}}:void 0;return new Response(e,i).blob()})}});Object.defineProperty(En,"json",{value:function(){return this[Mr]?Ea():this.text().then(JSON.parse)}});Object.defineProperty(En,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Ir]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(En,ko.prototype);var cC=(e,t)=>{let n=Object.create(En);n[wo]=e,n[fy]=iC(e.method);let i=e.url||"";if(i[0]!=="/"&&(i.startsWith("http://")||i.startsWith("https://"))){if(e instanceof Pr.Http2ServerRequest)throw new kn("Absolute URL for :path is not allowed in HTTP/2");try{n[wa]=new URL(i).href}catch(a){throw new kn("Invalid absolute URL",{cause:a})}return n}let r=(e instanceof Pr.Http2ServerRequest?e.authority:e.headers.host)||t;if(!r)throw new kn("Missing host header");let o;if(e instanceof Pr.Http2ServerRequest){if(o=e.scheme,!(o==="http"||o==="https"))throw new kn("Unsupported scheme")}else o=e.socket&&e.socket.encrypted?"https":"http";try{n[wa]=H$(o,r,i)}catch(a){throw a instanceof kn?a:new kn("Invalid URL",{cause:a})}return n},Qr="text/plain; charset=UTF-8",z_=Symbol("responseCache"),So=Symbol("getResponseCache"),Nr=Symbol("cache"),Z_=global.Response,wn=class gy{#e;#t;[So](){let t=this[Nr],n=t&&t[2]instanceof Headers?t[2]:void 0;return delete this[Nr],this[z_]||=new Z_(this.#e,n?{status:this.#t?.status,statusText:this.#t?.statusText,headers:n}:this.#t)}constructor(t,n){let i;if(this.#e=t,n instanceof gy){let r=n[z_];if(r){this.#t=r,this[So]();return}else this.#t=n.#t,i=new Headers(n.headers)}else this.#t=n;(t==null||typeof t=="string"||typeof t?.getReader<"u"||t instanceof Blob||t instanceof Uint8Array)&&(this[Nr]=[n?.status||200,t??null,i||n?.headers])}get headers(){let t=this[Nr];return t?(t[2]instanceof Headers||(t[2]=new Headers(t[2]||(t[1]===null?void 0:{"content-type":Qr}))),t[2]):this[So]().headers}get status(){return this[Nr]?.[0]??this[So]().status}get ok(){let t=this.status;return t>=200&&t<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(wn.prototype,e,{get(){return this[So]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(wn.prototype,e,{value:function(){return this[So]()[e]()}})});Object.defineProperty(wn.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[z_]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(wn,Z_);Object.setPrototypeOf(wn.prototype,Z_.prototype);var lC=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,uC=e=>e instanceof URL?e.href:lC.test(e)?e:new URL(e).href,dC=new Set([301,302,303,307,308]);Object.defineProperty(wn,"redirect",{value:function(t,n=302){if(!dC.has(n))throw new RangeError("Invalid status code");return new wn(null,{status:n,headers:{location:uC(t)}})},writable:!0,configurable:!0});Object.defineProperty(wn,"json",{value:function(t,n){let i=JSON.stringify(t);if(i===void 0)throw new TypeError("The data is not JSON serializable");let r=n?.headers,o;return r?(o=new Headers(r),o.has("content-type")||o.set("content-type","application/json")):o={"content-type":"application/json"},new wn(i,{status:n?.status??200,statusText:n?.statusText,headers:o})},writable:!0,configurable:!0});async function _C(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function hy(e,t,n){let i=s=>{e.cancel(s).catch(()=>{})};return t.on("close",i),t.on("error",i),(n??e.read()).then(a,r),e.closed.finally(()=>{t.off("close",i),t.off("error",i)});function r(s){s&&t.destroy(s)}function o(){e.read().then(a,r)}function a({done:s,value:l}){try{if(s)t.end();else if(!t.write(l))t.once("drain",o);else return e.read().then(a,r)}catch(c){r(c)}}}function cy(e,t){if(e.locked)throw new TypeError("ReadableStream is locked.");return t.destroyed?void 0:hy(e.getReader(),t)}var F_=(e,t)=>{let n={};if(e instanceof Headers||(e=new Headers(e??void 0)),e.has("set-cookie")){let i=[];for(let[r,o]of e)r==="set-cookie"?i.push(o):n[r]=o;i.length>0&&(n["set-cookie"]=i)}else for(let[i,r]of e)n[i]=r;return t&&(n["content-type"]??=t),n},yc=Symbol("outgoingEnded"),ly=Symbol("incomingDraining"),pC=500,fC=64*1024*1024,yy=e=>{let t=e;if(e.destroyed||t[ly])return;if(t[ly]=!0,e instanceof Pr.Http2ServerRequest){try{e.stream?.close?.(Pr.constants.NGHTTP2_NO_ERROR)}catch{}return}let n=0,i=()=>{clearTimeout(o),e.off("data",a),e.off("end",i),e.off("error",i)},r=()=>{i();let s=e.socket;s&&!s.destroyed&&s.destroySoon()},o=setTimeout(r,pC);o.unref?.();let a=s=>{n+=s.length,n>fC&&r()};e.on("data",a),e.on("end",i),e.on("error",i),e.resume()},mC=(e,t,n,i)=>()=>{t.errored?(iy(t),e[U_](t.errored.toString())):n.writableFinished||(iy(t),e[U_]("Client connection prematurely closed.")),i&&!t.readableEnded&&setTimeout(()=>{t.readableEnded||setTimeout(()=>{yy(t)})})},gC=e=>{if(!(Nr in e))return!1;let t=e[Nr][1];return t===null||typeof t=="string"||t instanceof Uint8Array},hC=()=>new Response(null,{status:400}),vy=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),vc=(e,t)=>{let n=e instanceof Error?e:new Error("unknown error",{cause:e});n.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),t.headersSent||t.writeHead(500,{"Content-Type":"text/plain"}),t.end(`Error: ${n.message}`),t.destroy(n))},q_=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},by=async(e,t)=>{let[n,i,r]=e[Nr];if(!r){i===null?(t.writeHead(n),t.end()):typeof i=="string"?(t.writeHead(n,{"Content-Type":Qr,"Content-Length":Buffer.byteLength(i)}),t.end(i)):i instanceof Uint8Array?(t.writeHead(n,{"Content-Type":Qr,"Content-Length":i.byteLength}),t.end(i)):i instanceof Blob?(t.writeHead(n,{"Content-Type":Qr,"Content-Length":i.size}),t.end(new Uint8Array(await i.arrayBuffer()))):(t.writeHead(n,{"Content-Type":Qr}),q_(t),await cy(i,t)?.catch(a=>vc(a,t))),t[yc]?.();return}let o=!1;if(r instanceof Headers)o=r.has("content-length"),r=F_(r,i===null?void 0:Qr);else if(Array.isArray(r)){let a=new Headers(r);o=a.has("content-length"),r=F_(a,i===null?void 0:Qr)}else for(let a in r)if(a.length===14&&a.toLowerCase()==="content-length"){o=!0;break}o||(typeof i=="string"?r["Content-Length"]=Buffer.byteLength(i):i instanceof Uint8Array?r["Content-Length"]=i.byteLength:i instanceof Blob&&(r["Content-Length"]=i.size)),t.writeHead(n,r),i==null?t.end():typeof i=="string"||i instanceof Uint8Array?t.end(i):i instanceof Blob?t.end(new Uint8Array(await i.arrayBuffer())):(q_(t),await cy(i,t)?.catch(a=>vc(a,t))),t[yc]?.()},Sy=e=>typeof e.then=="function",yC=async(e,t,n={})=>{if(Sy(e))if(n.errorHandler)try{e=await e}catch(r){let o=await n.errorHandler(r);if(!o)return;e=o}else e=await e.catch(vy);if(Nr in e)return by(e,t);let i=F_(e.headers,e.body===null?void 0:Qr);if(e.body){let r=e.body.getReader(),o=[],a=!1,s;if(i["transfer-encoding"]!=="chunked"){let l=2;for(let c=0;c<l;c++){s||=r.read();let d=await _C(s).catch(u=>{console.error(u),a=!0});if(!d){if(c===1){await new Promise(u=>setTimeout(u)),l=3;continue}break}if(s=void 0,d.value&&o.push(d.value),d.done){a=!0;break}}a&&!("content-length"in i)&&(i["content-length"]=o.reduce((c,d)=>c+d.length,0))}t.writeHead(e.status,i),o.forEach(l=>{t.write(l)}),a?t.end():(o.length===0&&q_(t),await hy(r,t,s))}else i[ny]||(t.writeHead(e.status,i),t.end());t[yc]?.()},vC=(e,t={})=>{let n=t.autoCleanupIncoming??!0;return t.overrideGlobalObjects!==!1&&global.Request!==ko&&(Object.defineProperty(global,"Request",{value:ko}),Object.defineProperty(global,"Response",{value:wn})),async(i,r)=>{let o,a,s=!1,l=!1,c=()=>{!a||l||(l=!0,r.on("close",mC(a,i,r,s)))};try{if(a=cC(i,t.hostname),s=n&&!(i.method==="GET"||i.method==="HEAD"),s&&(i[_y]=!0,i instanceof Pr.Http2ServerRequest&&(r[yc]=()=>{i.readableEnded||setTimeout(()=>{i.readableEnded||setTimeout(()=>{i.destroy(),r.destroy()})})})),o=e(a,{incoming:i,outgoing:r}),!Sy(o)&&gC(o))return s&&!i.readableEnded&&r.once("finish",()=>{i.readableEnded||yy(i)}),by(o,r);c()}catch(d){if(o)return vc(d,r);if(t.errorHandler){if(c(),o=await t.errorHandler(a?d:J$(d)),!o)return}else a?o=vy(d):o=hC()}try{return await yC(o,r,t)}catch(d){return vc(d,r)}}},bC=globalThis.CloseEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get wasClean(){return this.#e.wasClean??!1}get code(){return this.#e.code??0}get reason(){return this.#e.reason??""}},SC=globalThis.ErrorEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get message(){return this.#e.message??""}get filename(){return this.#e.filename??""}get lineno(){return this.#e.lineno??0}get colno(){return this.#e.colno??0}get error(){return this.#e.error??null}},kC=()=>Symbol("connection"),ky=Symbol("CONNECTION_SYMBOL_KEY"),wy=Symbol("WAIT_FOR_WEBSOCKET_SYMBOL"),wC=new Set(["connection","content-length","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade","sec-websocket-accept","sec-websocket-extensions","sec-websocket-protocol"]),Ey=(e,t)=>{t&&t.forEach((n,i)=>{wC.has(i.toLowerCase())||e.push(`${i}: ${n}`)})},uy=(e,t,n)=>{let i=["Connection: close","Content-Length: 0"];Ey(i,n),e.end(`HTTP/1.1 ${t.toString()} ${bc.STATUS_CODES[t]??""}\r
340
+ ${i.join(`\r
341
+ `)}\r
342
+ \r
343
+ `)},EC=e=>{let t=e.socket.encrypted?"https":"http",n=new URL(e.url??"/",`${t}://${e.headers.host??"localhost"}`),i=new Headers;for(let r in e.headers){let o=e.headers[r];o&&i.append(r,Array.isArray(o)?o[0]:o)}return new Request(n,{headers:i})},AC=e=>{let{server:t,fetchCallback:n,wss:i}=e,r=new Map;i.on("connection",(s,l)=>{let c=r.get(l);c&&(c.resolve(s),r.delete(l))});let o=s=>{let l=r.get(s);l&&(r.delete(s),l.reject(new Error("WebSocket handshake aborted")))},a=(s,l)=>new Promise((c,d)=>{r.set(s,{resolve:c,reject:d,connectionSymbol:l})});t.on("upgrade",async(s,l,c)=>{if(s.headers.upgrade?.toLowerCase()!=="websocket")return;let d={incoming:s,outgoing:void 0,wss:i,[wy]:a},u=400,_;try{let h=await n(EC(s),d);h instanceof Response&&(u=h.status,_=h.headers)}catch{t.listenerCount("upgrade")===1&&uy(l,500);return}let p=r.get(s);if(!p||p.connectionSymbol!==d[ky]){o(s),t.listenerCount("upgrade")===1&&uy(l,u,_);return}let v=h=>{Ey(h,_)},f=()=>o(s);l.once("close",f),i.on("headers",v);try{i.handleUpgrade(s,l,c,h=>{l.off("close",f),i.emit("connection",h,s)})}finally{i.off("headers",v)}}),t.on("close",()=>{i.close()})},BK=ry(async(e,t,n)=>{if(e.req.header("upgrade")?.toLowerCase()!=="websocket")return;let i=e.env,r=i[wy];if(!r||!i.incoming)return new Response(null,{status:500});let o=kC();return i[ky]=o,(async()=>{let a;try{a=await r(i.incoming,o)}catch{return}let s=[],l=(u,_)=>{s.push([u,_])};a.on("message",l);let c={binaryType:"arraybuffer",close(u,_){a.close(u,_)},protocol:a.protocol,raw:a,get readyState(){return a.readyState},send(u,_){a.send(u,{compress:_?.compress})},url:new URL(e.req.url)};try{t?.onOpen?.(new Event("open"),c)}catch(u){(n?.onError??console.error)(u)}let d=(u,_)=>{let p=Array.isArray(u)?u:[u];for(let v of p)try{t?.onMessage?.(new MessageEvent("message",{data:_?v instanceof ArrayBuffer?v:v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength):typeof v=="string"?v:Buffer.from(v).toString("utf-8")}),c)}catch(f){(n?.onError??console.error)(f)}};a.off("message",l);for(let u of s)d(...u);a.on("message",(u,_)=>{d(u,_)}),a.on("close",(u,_)=>{try{t?.onClose?.(new bC("close",{code:u,reason:_.toString()}),c)}catch(p){(n?.onError??console.error)(p)}}),a.on("error",u=>{try{t?.onError?.(new SC("error",{error:u}),c)}catch(_){(n?.onError??console.error)(_)}})})(),new Response}),TC=e=>{let t=e.fetch,n=vC(t,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming}),i=(e.createServer||bc.createServer)(e.serverOptions||{},n);if(e.websocket&&e.websocket.server){if(e.websocket.server.options.noServer!==!0)throw new Error("WebSocket server must be created with { noServer: true } option");AC({server:i,fetchCallback:t,wss:e.websocket.server})}return i},Ay=(e,t)=>{let n=TC(e);return n.listen(e?.port??3e3,e.hostname,()=>{let i=n.address();t&&t(i)}),n};var Ty=require("node:stream"),xy=require("node:process"),xC=()=>{let[e,t]=xy.versions.node.split(".").map(n=>parseInt(n));return e>=23||e===22&&t>=7||e===20&&t>=18},OC=xC(),B_=(e,t=OC)=>{if(t)return Ty.Readable.toWeb(e);let n,i=!1,r=()=>{e.off("data",a),e.off("error",s),e.off("end",l),e.off("close",l)},o=c=>{i||(i=!0,r(),c?.())},a=c=>{i||!n||(n.enqueue(c),(n.desiredSize??0)<=0&&e.pause())},s=c=>{o(()=>{n?.error(c)})},l=()=>{o(()=>{n?.close()})};return new ReadableStream({start(c){n=c,e.on("data",a),e.on("error",s),e.on("end",l),e.on("close",l),e.pause()},pull(){i||e.resume()},cancel(){o();let c=()=>{};e.on("error",c),e.once("close",()=>e.off("error",c)),e.destroy()}})};var Oy=(e,t=$C)=>{let n=/\.([a-zA-Z0-9]+?)$/,i=e.match(n);if(i)return t[i[1].toLowerCase()]};var RC={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css; charset=utf-8",csv:"text/csv; charset=utf-8",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html; charset=utf-8",html:"text/html; charset=utf-8",ico:"image/x-icon",ics:"text/calendar; charset=utf-8",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript; charset=utf-8",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript; charset=utf-8",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml; charset=utf-8",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain; charset=utf-8",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml; charset=utf-8",xml:"application/xml; charset=utf-8",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},$C=RC;var Ni=require("node:fs"),J_=require("node:path"),CC=/^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i,K_={br:".br",zstd:".zst",gzip:".gz"},IC=Object.keys(K_),H_=e=>{let t;try{t=(0,Ni.statSync)(e)}catch{}return t},NC=/^(?:bytes=)?(?!-$)(\d*)-(\d*)$/,PC=e=>{let t=e.match(NC);if(!t)return;let[,n,i]=t;return n===""?{type:"suffix",length:Number(i)}:i===""?{type:"open-ended",start:Number(n)}:{type:"bounded",start:Number(n),end:Number(i)}},MC=(e,t)=>{if(t===0)return;if(e.type==="suffix")return e.length===0?void 0:{start:Math.max(t-e.length,0),end:t-1};let n=e.type==="bounded"?Math.min(e.end,t-1):t-1;if(!(e.start>=t||e.start>n))return{start:e.start,end:n}},LC=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},jC=e=>LC(e,decodeURI),Sc=(e={root:""})=>{let t=e.root||"",n=e.path;return t!==""&&!(0,Ni.existsSync)(t)&&console.error(`serveStatic: root path '${t}' is not found, are you sure it's correct?`),async(i,r)=>{if(i.finalized)return r();let o;if(n)o=n;else try{if(o=jC(i.req.path),/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}|\\/.test(o))throw new Error}catch{return await e.onNotFound?.(i.req.path,i),r()}let a=(0,J_.join)(t,!n&&e.rewriteRequestPath?e.rewriteRequestPath(o,i):o),s=H_(a);if(s&&s.isDirectory()){let _=e.index??"index.html";a=(0,J_.join)(a,_),s=H_(a)}if(!s)return await e.onNotFound?.(a,i),r();let l=Oy(a);if(i.header("Content-Type",l||"application/octet-stream"),e.precompressed&&(!l||l==="application/octet-stream"||CC.test(l))){let _=new Set(i.req.header("Accept-Encoding")?.split(",").map(p=>p.trim()));for(let p of IC){if(!_.has(p))continue;let v=H_(a+K_[p]);if(v){i.header("Content-Encoding",p),i.header("Vary","Accept-Encoding",{append:!0}),s=v,a=a+K_[p];break}}}let c,d=s.size,u=i.req.header("range")||"";if(i.header("Last-Modified",s.mtime.toUTCString()),i.req.method=="HEAD"||i.req.method=="OPTIONS")i.header("Content-Length",d.toString()),i.status(200),c=i.body(null);else if(!u)i.header("Content-Length",d.toString()),c=i.body(B_((0,Ni.createReadStream)(a)),200);else{i.header("Accept-Ranges","bytes");let _=MC(PC(u)??{type:"open-ended",start:0},d);if(!_)i.header("Content-Range",`bytes */${d}`),c=i.body(null,416);else{let{start:p,end:v}=_,f=v-p+1,h=(0,Ni.createReadStream)(a,{start:p,end:v});i.header("Content-Length",f.toString()),i.header("Content-Range",`bytes ${p}-${v}/${d}`),c=i.body(B_(h),206)}}return await e.onFound?.(a,i),c}};vt();Zr();Zr();Jo();function FA(e,t){let n=new Map(e.map(i=>[i.key,i]));for(let i of t??[])n.has(i)||n.set(i,q6(i));return[...n.values()].sort((i,r)=>r.latest_started_at.localeCompare(i.latest_started_at)||i.label.localeCompare(r.label))}function q6(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 Ko(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}function ks(e,t="all_invocations"){let n=new Map;for(let a of e)n.has(a.run_id)||n.set(a.run_id,a);let i=[...n.values()];if(t==="all_invocations")return i;let r=new Set(i.map(a=>a.run_id));return t==="all_execution"?i.filter(a=>a.phase==="execution"):i.filter(a=>a.phase==="execution"&&(a.parent_run_id===null||!r.has(a.parent_run_id)))}function ud(e,t="all_invocations"){let n=ks(e,t),i=n.filter(o=>o.duration_ms!==null),r=n.length-i.length;return{known_sum:i.reduce((o,a)=>o+a.duration_ms,0),unknown:r,complete:r===0,coverage_ratio:n.length===0?1:i.length/n.length}}var ws="token_budget_v1:4_000_000_tokens_per_hour";function Go(e){return typeof e!="number"||e<=0?null:Math.round(e*36e5/4e6)}function dd(e){let t=e?.trim().toLowerCase();return!t||t==="unknown"||t==="codex"?"openai":t}var V6={events:0,tokens:0,usd:0,brl:0};function VA(e,t){let n=new Map;for(let l of t)l.task_id!==null&&n.set(l.task_id,[...n.get(l.task_id)??[],l]);let i=e.filter(l=>n.has(l.id)).map(l=>WA(l,n.get(l.id)??[])),r=new Set(e.map(l=>l.id)),o=[...n].filter(([l])=>!r.has(l)).map(([l,c])=>qA(l,c)),a=t.filter(l=>l.task_id===null),s=a.length===0?[]:[qA("Sem tarefa vinculada",a)];return[...i,...o,...s].sort((l,c)=>c.latest_started_at.localeCompare(l.latest_started_at))}function qA(e,t){return{...WA({id:e,title:e,created_at:t[0]?.started_at??"",test_count:0},t),label:`Tarefa hist\xF3rica: ${e}`,latest_started_at:t.reduce((n,i)=>i.started_at>n?i.started_at:n,"")}}function WA(e,t){let n=ud(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((i,r)=>i+(r.event_count??0),0),total_tokens:Ko(t.map(i=>i.total_tokens)),estimated_usd:Ko(t.map(i=>i.estimated_usd)),estimated_brl:Ko(t.map(i=>i.estimated_brl)),duration_ms:n.known_sum,duration:n,coverage:t.reduce((i,r)=>({events:i.events+r.coverage.events,tokens:i.tokens+r.coverage.tokens,usd:i.usd+r.coverage.usd,brl:i.brl+r.coverage.brl}),V6),coverage_counts:{source:"run_rows",granularity:"event",events:t.reduce((i,r)=>i+r.coverage.events,0),tokens:null,usd:null,brl:null,metrics:{tokens:Bm(t,i=>i.total_tokens),usd:Bm(t,i=>i.estimated_usd),brl:Bm(t,i=>i.estimated_brl)}}}}function Bm(e,t){let n=e.filter(i=>t(i)!==null).length;return{eligible_runs:e.length,known_runs:n,unknown_runs:e.length-n}}function Xo(e,t,n=r=>r,i="all_invocations"){let r=[...new Set(e.map(t))],o=new Set(ks(e,i).map(a=>a.run_id));return r.map(a=>{let s=e.filter(c=>t(c)===a),l=ud(s.filter(c=>o.has(c.run_id)),i);return{key:a,label:n(a),latest_started_at:s.reduce((c,d)=>d.started_at>c?d.started_at:c,s[0]?.started_at??""),run_count:s.length,task_count:new Set(s.flatMap(c=>c.task_id===null?[]:[c.task_id])).size,tasksActive:new Set(s.flatMap(c=>c.task_id===null?[]:[c.task_id])).size,taskDaysActive:new Set(s.flatMap(c=>c.task_id===null?[]:[c.task_id])).size,prd_count:0,spec_count:0,evidence_count:0,test_count:0,event_count:s.reduce((c,d)=>c+(d.event_count??0),0),total_tokens:Hm(s.map(c=>c.total_tokens)),estimated_usd:Hm(s.map(c=>c.estimated_usd)),estimated_brl:Hm(s.map(c=>c.estimated_brl)),duration_ms:l.known_sum,duration:l,coverage:W6(s)}}).sort(Z6)}function Hm(e){return Ko(e)}function _d(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)/t.length}function W6(e){return e.reduce((t,n)=>({events:t.events+n.coverage.events,tokens:t.tokens+n.coverage.tokens,usd:t.usd+n.coverage.usd,brl:t.brl+n.coverage.brl}),{events:0,tokens:0,usd:0,brl:0})}function Z6(e,t){return t.latest_started_at.localeCompare(e.latest_started_at)}function pd(e,t,n){if(e.schema_version!==2)throw new TypeError("Cost Monitor accepts only OperationsProjection V2");let i=t?.currency??"BRL",r=Er(n?.agentNames??[]),o=e.runs,a=new Map(e.runs.map(g=>[g.id,g])),s=o,l=s,c=new Map(e.tasks.map(g=>[g.id,g])),d=l.map(g=>{let b=g.task_id===null?void 0:c.get(g.task_id),T=a.get(g.id),I=T?.usage.total.cost??{usd:null,brl:null},R=(T?.pricing_segments??[]).map(ee=>ee.recorded_fx_rate??HA(ee.recorded_usd??null,ee.recorded_brl??null)).filter(ee=>ee!==null),U=g.usage.total,V=U.coverage.tokens>0,y=U.coverage.usd>0,S=U.coverage.brl>0,x=t?X6(g,t):null,W=V?GA(T?.usage.total.tokens??U.tokens):null,ce=r4(g,W);return{run_id:g.id,execution_id:g.execution_id,conversation_id:g.conversation_id,task_id:g.task_id,task_title:b?.title??g.task_id??g.conversation_id,task_status:b?.status??g.status,priority:b?.priority??"none",risk:b?.risk??"none",spec_id:g.spec_id,prd_id:g.prd_id,change_id:g.change_id,parent_run_id:g.parent_run_id,run_role:g.run_role,run_kind:g.run_kind,run_purpose:g.run_purpose,requires_finalizer:g.requires_finalizer,client:g.client,agent:g.agent,agent_name:G6(g,n),provider:dd(g.provider),model:g.effective_model??g.model,requested_model:g.model,reasoning_effort:g.reasoning_effort??null,effective_reasoning_effort:g.effective_reasoning_effort,service_tier:g.service_tier??null,call_count:g.call_count,status:g.status,phase:K6(g),origin:g.entrypoint,work_type:g.work_type,started_at:g.started_at,finished_at:g.finished_at,...ce,estimation_basis:ce.duration_provenance==="estimated"?ws:g.estimation_basis??null,source_started_at:g.source_started_at??null,source_finished_at:g.source_finished_at??null,capture_lag_ms:g.capture_lag_ms??null,event_count:U.events,input_tokens:U.tokens.input,cached_input_tokens:U.tokens.cached_input,output_tokens:U.tokens.output,reasoning_tokens:U.tokens.reasoning,total_tokens:W,uncached_input_tokens:U.tokens.input===null?null:Math.max(U.tokens.input-(U.tokens.cached_input??0),0),visible_output_tokens:U.tokens.output===null?null:Math.max(U.tokens.output-(U.tokens.reasoning??0),0),input_rate_usd_per_million:x?.rates.input??null,cached_input_rate_usd_per_million:x?.rates.cached??null,output_rate_usd_per_million:x?.rates.output??null,reasoning_rate_usd_per_million:x?.rates.reasoning??null,context_input_multiplier:x?.context.input??null,context_output_multiplier:x?.context.output??null,speed_cost_multiplier:x?.speedMultiplier??null,standard_cost_usd:x?.standardUsd??null,speed_uplift_usd:x?.upliftUsd??null,input_cost_usd:x?.components.input??null,cached_input_cost_usd:x?.components.cached??null,output_cost_usd:x?.components.output??null,reasoning_cost_usd:x?.components.reasoning??null,fx_rate:i==="BRL"?t?.fxRate?.rate??null:null,estimated_usd:y?I.usd:null,estimated_brl:S?I.brl:null,recorded_usd:y?I.usd:null,recorded_brl:S?I.brl:null,recorded_fx_rate:n4(R)??HA(I.usd,I.brl),coverage:U.coverage,artifact_path:g.artifact_path}}),u=J6(B6(H6(d),e)),_=(g,b,T)=>Xo(u,g,b,T),p=yi(s),v={conversation:yi(s.filter(g=>g.entrypoint==="conversation")),task:yi(s.filter(g=>g.entrypoint==="task")),spec:yi(s.filter(g=>g.entrypoint==="spec")),prd:yi(s.filter(g=>g.entrypoint==="prd"))},f=p.total,h=u.filter(g=>g.total_tokens!==null),k=h.reduce((g,b)=>g+(b.total_tokens??0),0),w=h.reduce((g,b)=>g+(b.event_count??0),0),O=[...h].sort((g,b)=>(b.total_tokens??0)-(g.total_tokens??0)).slice(0,10).reduce((g,b)=>g+(b.total_tokens??0),0);return{schema_version:2,layout_version:2,readonly:!0,legacy_effort_baseline:{cutoff:Gt.cutoff,duration_ms:Gt.durationMs},source:e.source,currency:i,pricing:{catalog_updated_at:t?.catalog.updated_at??null,fx_rate:i==="BRL"?t?.fxRate?.rate??null:null,conversion_applied:t!==void 0&&i==="BRL"&&t.fxRate!==null},filters:e.filters,overview:{task_count:new Set(u.flatMap(g=>g.task_id===null?[]:[g.task_id])).size,run_count:u.length,event_count:u.reduce((g,b)=>g+(b.event_count??0),0),total_tokens:f.tokens.total,estimated_usd:f.cost.usd,estimated_brl:f.cost.brl,recorded_usd:BA(s.map(g=>a.get(g.id)?.usage.total.cost.usd??null)),recorded_brl:BA(s.map(g=>a.get(g.id)?.usage.total.cost.brl??null)),average_run_cost_usd:_d(u.map(g=>g.estimated_usd)),average_run_cost_brl:_d(u.map(g=>g.estimated_brl)),average_run_duration_ms:_d(ks(u).map(g=>g.duration_ms)),known_tokens_per_cycle:w===0?null:k/w,top_10_token_share:k===0?null:O/k,coverage:f.coverage},filters_available:{providers:Er(u.map(g=>dd(g.provider))),agents:Er(u.map(g=>g.agent_name)),models:Er(u.map(g=>g.model)),statuses:Er(u.map(g=>g.task_status)),priorities:Er(u.map(g=>g.priority)),risks:Er(u.map(g=>g.risk)),phases:Er(u.map(g=>g.phase)),origins:Er(u.map(g=>g.origin)),work_types:Er(u.map(g=>g.work_type))},configured_agents:r,usage:p,origins:v,prds:JA(e.prds,s,u),specs:JA(e.specs,s,u),runs:[...u].sort((g,b)=>b.started_at.localeCompare(g.started_at)),groups:{conversations:Xo(u,g=>g.conversation_id,void 0,"all_invocations"),tasks:VA(e.tasks,u),providers:_(g=>dd(g.provider)),agents:FA(_(g=>g.agent_name),r),models:_(g=>g.model),daily:Jm(Xo(u,g=>{let b=g.finished_at??g.started_at;return Ot(b,"day")??b.slice(0,10)},void 0,"all_invocations"),e.tasks,"day"),monthly:Jm(Xo(u,g=>{let b=g.finished_at??g.started_at;return Ot(b,"month")??b.slice(0,7)},void 0,"all_invocations"),e.tasks,"month"),annual:Jm(Xo(u,g=>{let b=g.finished_at??g.started_at;return Ot(b,"year")??b.slice(0,4)},void 0,"all_invocations"),e.tasks,"year")}}}function B6(e,t){let n=t.summary.overview_metrics?.duration_ms;if(typeof n!="number"||n<0)return[...e];let i=t.filters.from===null&&t.filters.to===null?Math.round(n/36e5)*36e5:n,r=e.filter(c=>(c.total_tokens??0)>0);if(r.length===0)return[...e];if(i<r.length)return[...e];let o=r.reduce((c,d)=>c+(d.total_tokens??0),0),a=i>=r.length?1:0,s=Math.max(0,i-a*r.length),l=0;return e.map(c=>{if(!r.includes(c))return{...c,duration_ms:null,duration_provenance:"unavailable",estimation_basis:null};let u=r.at(-1)===c?i-l:a+Math.floor(s*(c.total_tokens??0)/o);return l+=u,{...c,duration_ms:u,duration_provenance:"estimated",estimation_basis:"operations_canonical_budget_v1:proportional_tokens"}})}function H6(e){return e.map(t=>{if((t.total_tokens??0)<=0||(t.duration_ms??0)>0)return t;let n=Go(t.total_tokens);return n===null||n<=0?t:{...t,duration_ms:n,duration_provenance:"estimated",estimation_basis:ws}})}function J6(e){let t=e.find(n=>(n.total_tokens??0)>0&&(n.duration_ms??0)<=0);if(t!==void 0)throw new TypeError(`Cost Monitor invariant violated: ${t.run_id} has tokens without positive duration`);return[...e]}function Jm(e,t,n){let i=new Map(e.map(r=>[r.key,{...r,tasksActive:r.tasksActive??r.task_count,taskDaysActive:r.tasksActive??r.task_count,tasksCreated:0}]));for(let r of t){let o=Ot(r.created_at,n);if(o===null)continue;let a=i.get(o);a!==void 0&&(a.tasksCreated=(a.tasksCreated??0)+1)}return[...i.values()]}function K6(e){return e.entrypoint==="task"&&e.phase==="conversation"?"planning":e.phase}function G6(e,t){if(e.agent==="codex")return"codex";let n=t?.agentNamesById?.[e.agent];if(n!==void 0)return n;if(e.agent==="agent-orchestrator")return t?.agentNamesByRole?.orchestrator??"zaip-agent-orchestrator";if(e.agent_name.trim()===e.agent){let i=t?.agentNamesByRole?.[e.run_role];if(i!==void 0)return i}return e.agent_name!=="codex",e.agent_name}function X6(e,t){let n=e.pricing_segments??[],i=n.length>0?n.map(f=>({provider:f.provider,model:f.model??e.effective_model??e.model,serviceTier:f.service_tier??e.service_tier??"default",usage:e4(f)})):[{provider:e.provider,model:e.effective_model??e.model,serviceTier:e.service_tier??"default",usage:t4(e.usage.total)}],r=i.map(f=>Gi({provider:f.provider==="openai"||f.provider==="anthropic"?f.provider:null,model:f.model,serviceTier:f.serviceTier,usage:f.usage,catalog:t.catalog,fxRate:null})),o=i.map(f=>Gi({provider:f.provider==="openai"||f.provider==="anthropic"?f.provider:null,model:f.model,serviceTier:"default",usage:f.usage,catalog:t.catalog,fxRate:null})),a=ZA(r.map(f=>f.estimated_usd)),s=ZA(o.map(f=>f.estimated_usd)),l=a,c=l===null&&s!==null,d=Y6(i,t.catalog),u=Q6(t.catalog,i.map(f=>f.model)),_=i.some(f=>f.serviceTier==="priority"||f.serviceTier==="fast"),p=(f,h)=>_&&!c?h:f,v=i.some(f=>u?.long_context_threshold_tokens!==null&&u?.long_context_threshold_tokens!==void 0&&(f.usage.input??0)>u.long_context_threshold_tokens);return{rates:{input:u?p(u.input_per_million_usd,u.priority_input_per_million_usd??null):null,cached:u?p(u.cached_input_per_million_usd,u.priority_cached_input_per_million_usd??null):null,output:u?p(u.output_per_million_usd,u.priority_output_per_million_usd??null):null,reasoning:u?p(u.reasoning_per_million_usd??u.output_per_million_usd,u.priority_reasoning_per_million_usd??u.priority_output_per_million_usd??null):null},context:{input:u?v?u.long_context_input_multiplier:1:null,output:u?v?u.long_context_output_multiplier:1:null},speedMultiplier:l!==null&&s!==null&&s>0?Math.round(l/s*1e3)/1e3:null,standardUsd:s,upliftUsd:l!==null&&s!==null?fd(l-s):null,components:{input:d?.input??null,cached:d?.cached??null,output:d?.output??null,reasoning:d?.reasoning??null}}}function Y6(e,t){let n=0,i=0,r=0;for(let o of e){let a=KA(t,o.model);if(a===null||o.provider!==null&&o.provider!==a.provider||o.usage.input===null||o.usage.cached_input===null||o.usage.output===null)return null;let s=a.long_context_threshold_tokens!==null&&o.usage.input>a.long_context_threshold_tokens,l=o.serviceTier==="priority"||o.serviceTier==="fast",c=a.priority_input_per_million_usd,d=a.priority_output_per_million_usd,u=l&&!s&&c!==null&&c!==void 0&&d!==null&&d!==void 0,_=u&&c!==null&&c!==void 0?c:a.input_per_million_usd,p=u?a.priority_cached_input_per_million_usd??0:a.cached_input_per_million_usd??0,v=u&&d!==null&&d!==void 0?d:a.output_per_million_usd,f=s?a.long_context_input_multiplier:1,h=s?a.long_context_output_multiplier:1,k=Math.max(o.usage.input-o.usage.cached_input,0);n+=k/1e6*_*f,i+=o.usage.cached_input/1e6*p*f,r+=o.usage.output/1e6*v*h}return{input:n,cached:i,output:r,reasoning:0}}function KA(e,t){let n=t.toLowerCase();return e.models.find(i=>i.id.toLowerCase()===n||i.aliases.some(r=>r.toLowerCase()===n))??null}function Q6(e,t){let n=t.map(r=>KA(e,r));if(n.some(r=>r===null))return null;let i=n[0];return!i||n.some(r=>r?.id!==i.id)?null:i}function e4(e){return{input:e.input_tokens,cached_input:e.cached_input_tokens,output:e.output_tokens,reasoning:e.reasoning_tokens,total:e.total_tokens,source:"provider_reported"}}function t4(e){return{input:e.tokens.input,cached_input:e.tokens.cached_input,output:e.tokens.output,reasoning:e.tokens.reasoning,total:e.tokens.total,source:"provider_reported"}}function ZA(e){return e.length===0||e.some(t=>t===null)?null:fd(e.reduce((t,n)=>t+n,0))}function BA(e){let t=e.filter(n=>n!==null);return t.length===0?null:fd(t.reduce((n,i)=>n+i,0))}function fd(e){return Math.round(e*1e6)/1e6}function HA(e,t){return e!==null&&e>0&&t!==null?fd(t/e):null}function n4(e){if(e.length===0)return null;let t=e[0]??null;return e.every(n=>n===t)?t:null}function r4(e,t){if(typeof e.source_duration_ms=="number"&&e.source_duration_ms>=0)return{duration_ms:e.source_duration_ms,duration_provenance:"observed"};if(typeof e.duration_ms=="number"&&e.duration_ms>=0&&(e.duration_provenance==="observed"||e.duration_provenance==="reconciled"||e.duration_provenance==="legacy_inferred"))return{duration_ms:e.duration_ms,duration_provenance:e.duration_provenance};let n=Go(t);return n!==null?{duration_ms:n,duration_provenance:"estimated"}:{duration_ms:null,duration_provenance:"unavailable"}}function yi(e){return Object.fromEntries(["conversation","planning","execution","total","new_work","rework"].map(n=>[n,i4(e.map(i=>i.usage[n]))]))}function i4(e){let t=n=>{let i=n.filter(r=>r!==null);return i.length===0?null:i.reduce((r,o)=>r+o,0)};return{events:e.reduce((n,i)=>n+i.events,0),duration_ms:t(e.map(n=>n.duration_ms??null)),tokens:{input:t(e.map(n=>n.tokens.input)),cached_input:t(e.map(n=>n.tokens.cached_input)),output:t(e.map(n=>n.tokens.output)),reasoning:t(e.map(n=>n.tokens.reasoning)),total:t(e.map(n=>GA(n.tokens)))},cost:{usd:t(e.map(n=>n.cost.usd)),brl:t(e.map(n=>n.cost.brl))},coverage:{events:e.reduce((n,i)=>n+i.coverage.events,0),tokens:e.reduce((n,i)=>n+i.coverage.tokens,0),usd:e.reduce((n,i)=>n+i.coverage.usd,0),brl:e.reduce((n,i)=>n+i.coverage.brl,0)}}}function GA(e){return e.input!==null&&e.output!==null?e.input+e.output:e.total}function JA(e,t,n){let i=e.map(l=>{let c=new Set(l.run_ids),d=t.filter(u=>c.has(u.id)||l.kind==="prd"&&u.prd_id===l.id||l.kind==="spec"&&u.spec_id===l.id);return{...l,usage:yi(d)}}),r=n.reduce((l,c)=>l+(c.duration_ms??0),0),o=i.filter(l=>(l.usage.total.tokens.total??0)>0),a=o.reduce((l,c)=>l+(c.usage.total.tokens.total??0),0),s=0;return i.map(l=>{if(!o.includes(l))return{...l,duration_ms:null};let d=o.at(-1)===l?r-s:Math.round(r*(l.usage.total.tokens.total??0)/a);return s+=d,{...l,duration_ms:d}})}function Er(e){return[...new Set(e)].sort()}Jo();Gs();function ph(e,t,n,i){let r=(e.run_metrics??[]).map(xH),o=r.filter(S=>{let x=Ot(S.finished_at??S.started_at,"day");return x!==null&&HO(x,t.filters.from,t.filters.to)}).map(TH),a=t.schema_version===2?pd({...t,tasks:t.tasks??[],runs:o},void 0):null,s=S=>S.filter(x=>{let W=x.key.trim().toLowerCase();return W.length>0&&!["mixed","unknown","unavailable"].includes(W)}),l=e.run_metrics!==void 0,c=e.cost_monitor_daily_duration!==void 0||e.canonical_daily_duration_ms!==void 0,d=new Map(Object.entries($H(e)));for(let S of Object.keys(e.cost_monitor_daily_duration??{}))d.has(S)||d.set(S,_h());if(!l&&!c)for(let S of Object.keys(Br))d.has(S)||d.set(S,_h());let u=[...d].filter(([S])=>HO(S,t.filters.from,t.filters.to)),_=IH(r),p=e.cost_monitor_daily_duration,v=(S,x)=>{if(p!==void 0){let W=p[S];return W===void 0?lh():{value:{known_sum:W.known_sum,unknown:W.eligible_runs-W.known_runs,complete:W.eligible_runs===W.known_runs,coverage_ratio:W.eligible_runs===0?1:W.known_runs/W.eligible_runs},population:Ti(W.eligible_runs,W.known_runs)}}if(e.canonical_daily_duration_ms!==void 0){let W=e.canonical_daily_duration_ms[S];return W===void 0?lh():{value:{known_sum:W,unknown:0,complete:!0,coverage_ratio:1},population:Ti(x.runs,x.runs)}}return l?_.get(S)??lh():AH(S,x)},f=u.reduce((S,[x,W])=>S+v(x,W).value.known_sum,0),h=!l&&!c&&t.filters.from===null&&t.filters.to===null?cd(f):f,k=new Map((e.daily_rows??[]).map(S=>[S.key,S])),w=u.map(([S,x])=>CH(S,x,i,v(S,x),k.get(S))),O=c?w:RH(w.map(OH),h),g=O.reduce((S,x)=>S+x.run_count,0),b=O.reduce((S,x)=>S+x.event_count,0),T=!c&&o.every(S=>S.usage.total.tokens.total===null)?null:uh(O.map(S=>S.total_tokens)),I=!c&&o.every(S=>S.usage.total.cost.brl===null)?null:uh(O.map(S=>S.estimated_brl)),R=uh(O.map(S=>S.estimated_usd)),U=NH(e.run_metrics??[]),V=t.summary.overview_metrics?.task_count??t.summary.task_count,y={events:g,tokens:O.reduce((S,x)=>S+x.coverage.tokens,0),usd:O.reduce((S,x)=>S+x.coverage.usd,0),brl:O.reduce((S,x)=>S+x.coverage.brl,0)};return{schema_version:2,layout_version:t.layout_version,readonly:!0,source:".agents/records",aggregate_only:!0,data_source:l||c?"run_records":"lifecycle_manifest_summary",legacy_effort_baseline:!l&&!c&&t.filters.from===null&&t.filters.to===null?{cutoff:Gt.cutoff,duration_ms:Gt.durationMs}:null,currency:n,pricing:{catalog_updated_at:null,fx_rate:i,conversion_applied:i!==null},filters:t.filters,overview:{task_count:V,run_count:g,event_count:b,total_tokens:T,estimated_usd:R,estimated_brl:I,recorded_usd:null,recorded_brl:null,average_run_cost_usd:g===0||R===null?null:R/g,average_run_cost_brl:g===0||I===null?null:I/g,average_run_duration_ms:U,known_tokens_per_cycle:g===0||T===null?null:T/g,top_10_token_share:null,coverage:y},filters_available:{providers:a?.filters_available.providers??[],agents:a?.filters_available.agents??[],models:a?.filters_available.models??[],statuses:a?.filters_available.statuses??[],priorities:a?.filters_available.priorities??[],risks:a?.filters_available.risks??[],phases:a?.filters_available.phases??[],origins:a?.filters_available.origins??[],work_types:a?.filters_available.work_types??[]},configured_agents:a?.configured_agents??[],usage:e.aggregate_usage??a?.usage??yi(o),origins:PH(),prds:a?.prds??t.prds,specs:a?.specs??t.specs,runs:[],groups:{conversations:[],tasks:[],providers:s(a?.groups.providers??[]),agents:a?.groups.agents??[],models:s(e.model_groups??a?.groups.models??[]),daily:O,monthly:BO(O,7),annual:BO(O,4)}}}function AH(e,t){return uo(e,t)}function _h(){let e={known_sum:0,unknown:0,complete:!0,coverage_ratio:1};return{prds:0,specs:0,tasks:0,validations:0,evidences:0,runs:0,usage:{total_tokens:e,cost:{...e,currency:"BRL"}}}}function TH(e){let t={events:0,duration_ms:null,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},n={...t,events:e.events??0,duration_ms:e.source_duration_ms??null,tokens:{...t.tokens,input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:null,brl:e.currency==="BRL"?e.cost:null},coverage:{events:e.events??0,tokens:e.total_tokens===null?0:1,usd:0,brl:e.cost===null?0:1}},i=e.phase==="conversation"||e.phase==="planning"?e.phase:"execution";return{id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status==="failed"||e.status==="cancelled"||e.status==="running"?e.status:"completed",phase:i,entrypoint:e.task_id===null?"conversation":"task",work_type:"new",run_role:e.run_kind==="subrun"?"subagent":"orchestrator",run_kind:e.run_kind??"run",run_purpose:"execution",requires_finalizer:!1,parent_run_id:e.parent_run_id,client:"unknown",agent:e.agent??"unknown",agent_name:e.agent_name??e.agent??"unknown",provider:e.provider??"unavailable",model:e.model??"unknown",reasoning_effort:null,effective_model:e.model??null,effective_reasoning_effort:null,effective_config_mixed:!1,call_count:null,terminal_call_count:null,failed_call_count:0,cancelled_call_count:0,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id??null,task_id:e.task_id,spec_id:e.spec_id??null,prd_id:e.prd_id??null,change_id:e.change_id??null,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.source_duration_ms??null,...e.duration_provenance===void 0?{}:{duration_provenance:e.duration_provenance},...e.estimation_basis===void 0?{}:{estimation_basis:e.estimation_basis},usage:{conversation:i==="conversation"?n:t,planning:i==="planning"?n:t,execution:i==="execution"?n:t,total:n,new_work:n,rework:t}}}function xH(e){if(e.duration_ms!==null)return{...e,duration_provenance:e.duration_provenance??"unavailable",estimation_basis:e.duration_provenance==="estimated"?e.estimation_basis??null:null};let t=Go(e.total_tokens);return t===null?{...e,duration_provenance:"unavailable",estimation_basis:null}:{...e,duration_ms:t,duration_provenance:"estimated",estimation_basis:ws}}function OH(e){if((e.total_tokens??0)<=0||(e.duration_ms??0)>0)return e;let t=Go(e.total_tokens);if(t===null||t<=0)return e;let n=e.coverage_counts;return{...e,duration_ms:t,duration:{known_sum:t,unknown:0,complete:!0,coverage_ratio:1},...n===void 0?{}:{coverage_counts:{...n,...n.metrics===void 0?{}:{metrics:{...n.metrics,duration:{eligible_runs:e.run_count,known_runs:e.run_count,unknown_runs:0}}}}}}}function RH(e,t){return Qd(e,t).map(n=>({...n,duration_ms:n.duration.complete?n.duration.known_sum:null}))}function $H(e){let t=[...new Map((e.run_metrics??[]).map(r=>[r.id,r])).values()];if(e.run_metrics===void 0)return e.periods.daily;let n=new Map;for(let r of t){let o=Ot(r.started_at,"day");o!==null&&n.set(o,[...n.get(o)??[],r])}let i=new Set([...Object.keys(e.periods.daily),...n.keys()]);return Object.fromEntries([...i].map(r=>{let o=e.periods.daily[r]??_h(),a=n.get(r)??[],s=sh(a.map(d=>d.total_tokens)),l=sh(a.map(d=>d.cost)),c=sh(a.map(d=>d.events));return[r,{...o,runs:a.length,usage:{total_tokens:s,cost:{...l,currency:a.find(d=>d.currency!==null)?.currency??o.usage.cost.currency}},events:c}]}))}function sh(e){let t=e.filter(i=>i!==null),n=e.length-t.length;return{known_sum:t.reduce((i,r)=>i+r,0),unknown:n,complete:n===0,coverage_ratio:e.length===0?1:t.length/e.length}}function CH(e,t,n,i,r){let o=t.usage.cost.known_sum===0&&t.usage.cost.unknown>0?null:t.usage.cost.known_sum,a=r===void 0?o:r.total_cost_brl,s=r===void 0?a!==null&&n!==null&&n>0?a/n:null:r.total_cost_usd,l=t.events?.known_sum??0,c=JO(t.runs,t.usage.total_tokens.unknown),d=JO(t.runs,t.usage.cost.unknown);return{key:e,label:e,latest_started_at:`${e}T23:59:59.999-03:00`,run_count:t.runs,task_count:t.tasks,tasksCreated:t.tasks,tasksActive:t.tasks,taskDaysActive:t.tasks,prd_count:t.prds,spec_count:t.specs,evidence_count:t.evidences,test_count:t.validations,event_count:l,total_tokens:t.usage.total_tokens.known_sum===0&&t.usage.total_tokens.unknown>0?null:t.usage.total_tokens.known_sum,estimated_usd:s,estimated_brl:a,duration_ms:i.population.known_runs>0?i.value.known_sum:null,duration:i.value,coverage:{events:t.runs,tokens:c,usd:d,brl:d},coverage_counts:{source:"period_summary",granularity:t.events===void 0?"unavailable":"event",events:t.events?.known_sum??null,tokens:null,usd:null,brl:null,metrics:{duration:i.population,tokens:Ti(t.runs,c),usd:Ti(t.runs,d),brl:Ti(t.runs,d)}}}}function BO(e,t){let n=new Map;for(let i of e){let r=i.key.slice(0,t);n.set(r,[...n.get(r)??[],i])}return[...n].map(([i,r])=>{let o=r[0],a=r.reduce((u,_)=>u+_.duration.known_sum,0),s=r.reduce((u,_)=>u+_.duration.unknown,0),l=r.reduce((u,_)=>u+(_.coverage_counts?.metrics?.duration?.eligible_runs??0),0),c=r.reduce((u,_)=>u+(_.coverage_counts?.metrics?.duration?.known_runs??0),0),d=r.reduce((u,_)=>u+_.run_count,0);return{...o,key:i,label:i,latest_started_at:r.map(u=>u.latest_started_at).sort().at(-1)??o.latest_started_at,run_count:d,task_count:r.reduce((u,_)=>u+(_.task_count??0),0),tasksCreated:r.reduce((u,_)=>u+(_.tasksCreated??0),0),tasksActive:r.reduce((u,_)=>u+(_.tasksActive??0),0),taskDaysActive:r.reduce((u,_)=>u+(_.taskDaysActive??0),0),prd_count:r.reduce((u,_)=>u+_.prd_count,0),spec_count:r.reduce((u,_)=>u+_.spec_count,0),evidence_count:r.reduce((u,_)=>u+_.evidence_count,0),test_count:r.reduce((u,_)=>u+_.test_count,0),event_count:r.reduce((u,_)=>u+_.event_count,0),total_tokens:dh(r.map(u=>u.total_tokens)),estimated_usd:dh(r.map(u=>u.estimated_usd)),estimated_brl:dh(r.map(u=>u.estimated_brl)),duration_ms:s===0?a:null,duration:{known_sum:a,unknown:s,complete:s===0,coverage_ratio:l===0?1:c/l},coverage:{events:r.reduce((u,_)=>u+_.coverage.events,0),tokens:r.reduce((u,_)=>u+_.coverage.tokens,0),usd:r.reduce((u,_)=>u+_.coverage.usd,0),brl:r.reduce((u,_)=>u+_.coverage.brl,0)},...o.coverage_counts===void 0?{}:{coverage_counts:{...o.coverage_counts,metrics:{duration:Ti(l,c),tokens:ch(r,"tokens"),usd:ch(r,"usd"),brl:ch(r,"brl")}}}}}).sort((i,r)=>r.key.localeCompare(i.key))}function ch(e,t){let n=e.map(i=>i.coverage_counts?.metrics?.[t]);return Ti(n.reduce((i,r)=>i+(r?.eligible_runs??0),0),n.reduce((i,r)=>i+(r?.known_runs??0),0))}function IH(e){return Zs(e)}function NH(e){let t=e.filter(n=>n.phase==="execution"&&n.parent_run_id==null&&ld(n.duration_started_at??n.started_at)&&n.duration_ms!==null&&n.duration_ms>=0);return t.length===0?null:t.reduce((n,i)=>n+i.duration_ms,0)/t.length}function lh(){return{value:{known_sum:0,unknown:0,complete:!0,coverage_ratio:1},population:Ti(0,0)}}function HO(e,t,n){let i=a=>a===null?null:/^\d{4}-\d{2}-\d{2}$/.test(a)?a:Ot(a,"day"),r=i(t),o=i(n);return(r===null||e>=r)&&(o===null||e<=o)}function uh(e){let t=e.filter(n=>n!==null);return t.length===0?null:t.reduce((n,i)=>n+i,0)}function dh(e){return e.some(t=>t===null)?null:e.reduce((t,n)=>t+(n??0),0)}function JO(e,t){return Math.max(0,e-t)}function Ti(e,t){return{eligible_runs:e,known_runs:t,unknown_runs:e-t}}function pa(){return{events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}}}function PH(){let e=()=>({conversation:pa(),planning:pa(),execution:pa(),total:pa(),new_work:pa(),rework:pa()});return{conversation:e(),task:e(),spec:e(),prd:e()}}Zr();Gs();var fa=require("node:crypto");bi();var MH=25e4;async function GO(e,t,n){if(t.version===1)throw new Error("Task trace requires a modern WorkspaceLayout");let i=await new Ut(e).readEntities(),r=i.find(g=>g.kind==="task"&&g.id===n);if(r===void 0)throw new Error(`Task ${n} was not found in the lifecycle manifest`);let o=xr(r,"change_id")??Xs(r,"CHG-")??r.id,a=i.find(g=>g.kind==="change"&&g.id===o),s=KO(a,"spec_id")??Xs(r,"SPEC-")??Xs(a,"SPEC-"),l=KO(a,"prd_id")??Xs(r,"PRD-")??Xs(a,"PRD-"),c=new Set([r.id,o]);s!==null&&c.add(s),l!==null&&c.add(l);let d=new Set([...r.relations,...a?.relations??[]].filter(g=>/^(?:REQ|AC)-/.test(g))),u=i.filter(g=>zH(g,c)),_=u.filter(g=>g.kind==="run"&&xr(g,"task_id")===r.id),p=new Set;for(let g of u)g.kind!=="decision"&&g.kind!=="evidence"&&g.kind!=="validation"&&p.add(t.activePath(g.kind,g.id));p.add(t.activePath("task",r.id)),o.startsWith("CHG-")&&p.add(t.activePath("change",o)),s!==null&&p.add(t.activePath("spec",s)),l!==null&&p.add(t.activePath("prd",l));let v=new Set(p),f=await Promise.all(LH(p).map(g=>e.listFiles(g)));for(let g of f.flat())v.add(g);let h=[],k=xr(r,"finished_at");for(let g of v){if(!/\.(?:md|json|jsonl|txt|log)$/i.test(g)||!await e.exists(g))continue;let b=await e.readText(g);if(b.length>MH||!(!g.includes("/requirements/")||[...d].some(W=>b.includes(W))))continue;let R=gh(g),U=a_(b),V=(R.kind==="evidence"||R.kind==="test"||R.kind==="eval"||R.kind==="check")&&b.includes(r.id);if((R.kind==="evidence"||R.kind==="test"||R.kind==="eval"||R.kind==="check")&&!V)continue;let y={id:(0,fa.createHash)("sha256").update(g).digest("hex").slice(0,16),path:g,title:HH(g,b),...R,content:b,recorded_at:U.recorded_at??(V?k:null),updated_at:U.updated_at??(V?k:null)};h.push(y);let S=qH(y);S!==null&&h.push(S);let x=VH(y,r.id);x!==null&&h.push(x)}for(let g of ZH(r,d,h))h.push(g);for(let g of WH(r,h))h.push(g);h.sort((g,b)=>fh[g.stage]-fh[b.stage]||g.path.localeCompare(b.path));let w=new Set(h.map(g=>g.stage)),O=mh(h);return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",task_id:r.id,task_title:r.title??r.id,task_risk:r.risk==="lite"||r.risk==="standard"||r.risk==="critical"?r.risk:null,task_created_at:xr(r,"created_at"),task_progress:FH(r.status),spec_id:s,prd_id:l,change_id:o,usage:jH(_),documents:h,stages:O,coverage:{stages_with_documents:w.size,stages_with_timestamps:O.filter(g=>g.status==="recorded").length,total_stages:6,evidence_count:h.filter(g=>g.kind==="evidence").length,test_count:h.filter(g=>g.kind==="test").length}}}function LH(e){let t=new Set;for(let n of e){if(!n.endsWith("/change.md")&&!n.endsWith("/execution.md"))continue;let i=n.slice(0,n.lastIndexOf("/"));t.add(`${i}/decisions`);for(let r of["evidence","tests","evals","checks"])t.add(`${i}/artifacts/${r}`)}return[...t].sort()}function jH(e,t=Date.now()){let n=e.map(s=>DH(s)?UH(s,t):null),i=e.map(s=>s.usage?.total_tokens??null),r=e.map(s=>s.usage?.cost??null),o=new Set(e.map(s=>s.usage?.currency).filter(s=>s==="BRL"||s==="USD")),a=o.size===1?[...o][0]??null:null;return{run_count:e.length,duration_ms:o_(n),total_tokens:o_(i),cost:o.size<=1?{...o_(r),currency:a}:{...o_(e.map(()=>null)),currency:null}}}function DH(e){return xr(e,"phase")==="execution"&&xr(e,"parent_run_id")===null}function o_(e){let t=e.filter(n=>n!==null);return{value:t.length===0?null:t.reduce((n,i)=>n+i,0),known_runs:t.length,unknown_runs:e.length-t.length,coverage_ratio:e.length===0?1:t.length/e.length}}function UH(e,t){let n=xr(e,"started_at"),i=xr(e,"finished_at");if(n===null)return null;let r=Date.parse(n),o=i===null?null:Date.parse(i),a=o===null&&e.status==="running"?t-r:(o??Number.NaN)-r;return Number.isFinite(a)?Math.max(0,a):null}function mh(e){return Object.keys(fh).map(t=>{let n=e.filter(r=>r.stage===t),i=n.flatMap(r=>[r.recorded_at,r.updated_at]).filter(r=>r!==null).sort(XO);return{stage:t,status:n.length===0?"pending":i.length===0?"missing_timestamp":"recorded",first_recorded_at:i.at(0)??null,last_recorded_at:i.at(-1)??null,document_count:n.length,test_count:n.filter(r=>r.kind==="test").length}})}function zH(e,t){return t.has(e.id)||e.relations.some(n=>t.has(n))}function FH(e){return e==="completed"?100:e==="verifying"?80:e==="executing"?50:e==="blocked"||e==="failed"||e==="cancelled"?0:10}function xr(e,t){let n=e.data?.[t];return typeof n=="string"&&n.length>0?n:null}function Xs(e,t){return e?.relations.find(n=>n.startsWith(t))??null}function KO(e,t){let n=e?.data?.source;if(typeof n!="object"||n===null)return null;let i=n[t];return typeof i=="string"&&i.length>0?i:null}var fh={definition:0,planning:1,execution:2,decisions:3,verification:4,evidence:5};function gh(e){return e.includes("/prds/")?{stage:"definition",kind:"prd"}:e.includes("/requirements/")?{stage:"definition",kind:"requirement"}:e.includes("/specs/")?{stage:"planning",kind:"spec"}:e.includes("/decisions/")?{stage:"decisions",kind:"decision"}:e.includes("/artifacts/evidence/")?{stage:"evidence",kind:"evidence"}:e.includes("/artifacts/tests/")?{stage:"verification",kind:"test"}:e.includes("/artifacts/evals/")?{stage:"verification",kind:"eval"}:e.includes("/artifacts/checks/")?{stage:"verification",kind:"check"}:e.includes("/tasks/")?{stage:"execution",kind:"task"}:e.includes("/executions/")?{stage:"execution",kind:"execution"}:e.includes("/runs/")?{stage:"execution",kind:"run"}:e.includes("/changes/")?{stage:"planning",kind:"change"}:{stage:"evidence",kind:"evidence"}}function a_(e){let t=[...e.matchAll(/\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})\b/g)].map(n=>n[0]).filter(n=>Number.isFinite(Date.parse(n))).sort(XO);return{recorded_at:t.at(0)??null,updated_at:t.at(-1)??null}}function XO(e,t){return Date.parse(e)-Date.parse(t)}function qH(e){if(e.kind!=="change")return null;let t=e.content.match(/^## Decis(?:ões|oes)\s*\r?\n([\s\S]*?)(?=^##\s|\s*$)/m)?.[1]?.trim();return t===void 0||t.length===0||/^Nenhuma decis(?:ão|ao) registrada\.?$/i.test(t)?null:{id:(0,fa.createHash)("sha256").update(`${e.path}#decisions`).digest("hex").slice(0,16),path:`${e.path}#decisions`,title:`Decis\xF5es \u2014 ${e.title}`,stage:"decisions",kind:"decision",content:t,...a_(t)}}function VH(e,t){return e.kind!=="evidence"||!e.content.includes(t)||!/(?:test|vitest|typecheck|biome|build|lint|check|eval)/i.test(e.content)||!/(?:passed|passing|aprovad[oa]|exit\s*code\s*[:=]?\s*0|\bPASS\b)/i.test(e.content)?null:{...e,id:(0,fa.createHash)("sha256").update(`${e.path}#verification`).digest("hex").slice(0,16),path:`${e.path}#verification`,title:`Verifica\xE7\xE3o \u2014 ${e.title}`,stage:"verification",kind:"check"}}function WH(e,t){let n=e.data?.result;if(typeof n!="object"||n===null)return[];let i=n.evidence_ids;if(!Array.isArray(i))return[];let r=xr(e,"finished_at");return i.filter(o=>typeof o=="string"&&o.length>0).filter(o=>!t.some(a=>a.kind==="evidence"&&a.content.includes(o))).map(o=>({id:(0,fa.createHash)("sha256").update(`${e.id}#evidence/${o}`).digest("hex").slice(0,16),path:`${BH(e.id)}#evidence/${o}`,title:o,stage:"evidence",kind:"evidence",content:`Task: ${e.id}
344
+ Evidence reference: ${o}`,recorded_at:r,updated_at:r}))}function ZH(e,t,n){let i=xr(e,"finished_at");return[...t].filter(r=>!n.some(o=>o.content.includes(r))).sort().map(r=>({id:(0,fa.createHash)("sha256").update(`${e.id}#requirement/${r}`).digest("hex").slice(0,16),path:`.agents/requirements#${r}`,title:r,stage:"definition",kind:"requirement",content:`Task: ${e.id}
345
+ Requirement reference: ${r}`,recorded_at:i,updated_at:i}))}function BH(e){return`.agents/records/tasks/${e}.md`}function HH(e,t){return t.match(/^#\s+(.+)$/m)?.[1]?.trim()??e.split("/").at(-1)??e}bi();var hh=(e,t,n)=>(i,r)=>{let o=-1;return a(0);async function a(s){if(s<=o)throw new Error("next() called multiple times");o=s;let l,c=!1,d;if(e[s]?(d=e[s][0][0],i.req.routeIndex=s):d=s===e.length&&r||void 0,d)try{l=await d(i,()=>a(s+1))}catch(u){if(u instanceof Error&&t)i.error=u,l=await t(u,i),c=!0;else throw u}else i.finalized===!1&&n&&(l=await n(i));return l&&(i.finalized===!1||c)&&(i.res=l),i}};var YO=Symbol();var QO=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,i=>i.toLowerCase())}}).formData();var s_=e=>"headers"in e,tR=async(e,t=Object.create(null))=>{let{all:n=!1,dot:i=!1}=t,a=(s_(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();return a==="multipart/form-data"||a==="application/x-www-form-urlencoded"?JH(e,{all:n,dot:i}):{}};async function JH(e,t){if(!s_(e)&&e.bodyCache.formData)return eR(await e.bodyCache.formData,t);let n=s_(e)?e.headers:e.raw.headers,i=await e.arrayBuffer(),r=QO(i,n.get("Content-Type")||"");s_(e)||(e.bodyCache.formData=r);let o=await r;return o?eR(o,t):{}}function eR(e,t){let n=Object.create(null);return e.forEach((i,r)=>{t.all||r.endsWith("[]")?KH(n,r,i):n[r]=i}),t.dot&&Object.entries(n).forEach(([i,r])=>{i.includes(".")&&(GH(n,i,r),delete n[i])}),n}var KH=(e,t,n)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]:t.endsWith("[]")?e[t]=[n]:e[t]=n},GH=(e,t,n)=>{if(/(?:^|\.)__proto__\./.test(t))return;let i=e,r=t.split(".");r.forEach((o,a)=>{a===r.length-1?i[o]=n:((!i[o]||typeof i[o]!="object"||Array.isArray(i[o])||i[o]instanceof File)&&(i[o]=Object.create(null)),i=i[o])})};var vh=e=>{let t=e.split("/");return t[0]===""&&t.shift(),t},nR=e=>{let{groups:t,path:n}=XH(e),i=vh(n);return YH(i,t)},XH=e=>{let t=[];return e=e.replace(/\{[^}]+\}/g,(n,i)=>{let r=`@${i}`;return t.push([r,n]),r}),{groups:t,path:e}},YH=(e,t)=>{for(let n=t.length-1;n>=0;n--){let[i]=t[n];for(let r=e.length-1;r>=0;r--)if(e[r].includes(i)){e[r]=e[r].replace(i,t[n][1]);break}}return e},c_={},rR=(e,t)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let i=`${e}#${t}`;return c_[i]||(n[2]?c_[i]=t&&t[0]!==":"&&t[0]!=="*"?[i,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:c_[i]=[e,n[1],!0]),c_[i]}return null},ma=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},QH=e=>ma(e,decodeURI),bh=e=>{let t=e.url,n=t.indexOf("/",t.indexOf(":")+4),i=n;for(;i<t.length;i++){let r=t.charCodeAt(i);if(r===37){let o=t.indexOf("?",i),a=t.indexOf("#",i),s=o===-1?a===-1?void 0:a:a===-1?o:Math.min(o,a),l=t.slice(n,s);return QH(l.includes("%25")?l.replace(/%25/g,"%2525"):l)}else if(r===63||r===35)break}return t.slice(n,i)};var iR=e=>{let t=bh(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},xi=(e,t,...n)=>(n.length&&(t=xi(t,...n)),`${e?.[0]==="/"?"":"/"}${e}${t==="/"?"":`${e?.at(-1)==="/"?"":"/"}${t?.[0]==="/"?t.slice(1):t}`}`),l_=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let t=e.split("/"),n=[],i="";return t.forEach(r=>{if(r!==""&&!/\:/.test(r))i+="/"+r;else if(/\:/.test(r))if(/\?/.test(r)){n.length===0&&i===""?n.push("/"):n.push(i);let o=r.replace("?","");i+="/"+o,n.push(i)}else i+="/"+r}),n.filter((r,o,a)=>a.indexOf(r)===o)},yh=e=>/[%+]/.test(e)?(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),e.indexOf("%")!==-1?ma(e,Ys):e):e,oR=(e,t,n)=>{let i;if(!n&&t&&!/[%+]/.test(t)){let a=e.indexOf("?",8);if(a===-1)return;for(e.startsWith(t,a+1)||(a=e.indexOf(`&${t}`,a+1));a!==-1;){let s=e.charCodeAt(a+t.length+1);if(s===61){let l=a+t.length+2,c=e.indexOf("&",l);return yh(e.slice(l,c===-1?void 0:c))}else if(s==38||isNaN(s))return"";a=e.indexOf(`&${t}`,a+1)}if(i=/[%+]/.test(e),!i)return}let r=Object.create(null);i??=/[%+]/.test(e);let o=e.indexOf("?",8);for(;o!==-1;){let a=e.indexOf("&",o+1),s=e.indexOf("=",o);s>a&&a!==-1&&(s=-1);let l=e.slice(o+1,s===-1?a===-1?void 0:a:s);if(i&&(l=yh(l)),o=a,l==="")continue;let c;s===-1?c="":(c=e.slice(s+1,a===-1?void 0:a),i&&(c=yh(c))),n?(r[l]&&Array.isArray(r[l])||(r[l]=[]),r[l].push(c)):r[l]??=c}return t?r[t]:r},aR=oR,sR=(e,t)=>oR(e,t,!0),Ys=decodeURIComponent;var cR=e=>ma(e,Ys),lR=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",n=[[]]){this.raw=e,this.path=t,this.#t=n,this.#e={}}param(e){return e?this.#n(e):this.#o()}#n(e){let t=this.#t[0][this.routeIndex][1][e],n=this.#i(t);return n&&/\%/.test(n)?cR(n):n}#o(){let e={},t=Object.keys(this.#t[0][this.routeIndex][1]);for(let n of t){let i=this.#i(this.#t[0][this.routeIndex][1][n]);i!==void 0&&(e[n]=/\%/.test(i)?cR(i):i)}return e}#i(e){return this.#t[1]?this.#t[1][e]:e}query(e){return aR(this.url,e)}queries(e){return sR(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((n,i)=>{t[i]=n}),t}async parseBody(e){return tR(this,e)}#r=e=>{let{bodyCache:t,raw:n}=this,i=t[e];if(i)return i;let r=Object.keys(t)[0];return r?t[r].then(o=>(r==="json"&&(o=JSON.stringify(o)),new Response(o)[e]())):t[e]=n[e]()};json(){return this.#r("text").then(e=>JSON.parse(e))}text(){return this.#r("text")}arrayBuffer(){return this.#r("arrayBuffer")}bytes(){return this.#r("arrayBuffer").then(e=>new Uint8Array(e))}blob(){return this.#r("blob")}formData(){return this.#r("formData")}addValidatedData(e,t){this.#e[e]=t}valid(e){return this.#e[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[YO](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}};var uR={Stringify:1,BeforeStream:2,Stream:3},eJ=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n};var Sh=async(e,t,n,i,r)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let o=e.callbacks;if(!o?.length)return Promise.resolve(e);r?r[0]+=e:r=[e];let a=Promise.all(o.map(s=>s({phase:t,buffer:r,context:i}))).then(s=>Promise.all(s.filter(Boolean).map(l=>Sh(l,t,!1,i,r))).then(()=>r[0]));return n?eJ(await a,o):a};var tJ="text/plain; charset=UTF-8",kh=(e,t)=>({"Content-Type":e,...t}),Qs=(e,t)=>new Response(e,t),wh=class{#e;#t;env={};#n;finalized=!1;error;#o;#i;#r;#u;#c;#l;#s;#d;#_;constructor(e,t){this.#e=e,t&&(this.#i=t.executionCtx,this.env=t.env,this.#l=t.notFoundHandler,this.#_=t.path,this.#d=t.matchResult)}get req(){return this.#t??=new lR(this.#e,this.#_,this.#d),this.#t}get event(){if(this.#i&&"respondWith"in this.#i)return this.#i;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#i)return this.#i;throw Error("This context has no ExecutionContext")}get res(){return this.#r||=Qs(null,{headers:this.#s??=new Headers})}set res(e){if(this.#r&&e){e=Qs(e.body,e);for(let[t,n]of this.#r.headers.entries())if(t!=="content-type")if(t==="set-cookie"){let i=this.#r.headers.getSetCookie();e.headers.delete("set-cookie");for(let r of i)e.headers.append("set-cookie",r)}else e.headers.set(t,n)}this.#r=e,this.finalized=!0}render=(...e)=>(this.#c??=t=>this.html(t),this.#c(...e));setLayout=e=>this.#u=e;getLayout=()=>this.#u;setRenderer=e=>{this.#c=e};header=(e,t,n)=>{this.finalized&&(this.#r=Qs(this.#r.body,this.#r));let i=this.#r?this.#r.headers:this.#s??=new Headers;t===void 0?i.delete(e):n?.append?i.append(e,t):i.set(e,t)};status=e=>{this.#o=e};set=(e,t)=>{this.#n??=new Map,this.#n.set(e,t)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#a(e,t,n){let i=this.#r?new Headers(this.#r.headers):this.#s??new Headers;if(typeof t=="object"&&"headers"in t){let o=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(let[a,s]of o)a.toLowerCase()==="set-cookie"?i.append(a,s):i.set(a,s)}if(n)for(let[o,a]of Object.entries(n))if(typeof a=="string")i.set(o,a);else{i.delete(o);for(let s of a)i.append(o,s)}let r=typeof t=="number"?t:t?.status??this.#o;return Qs(e,{status:r,headers:i})}newResponse=(...e)=>this.#a(...e);body=(e,t,n)=>this.#a(e,t,n);text=(e,t,n)=>!this.#s&&!this.#o&&!t&&!n&&!this.finalized?new Response(e):this.#a(e,t,kh(tJ,n));json=(e,t,n)=>this.#a(JSON.stringify(e),t,kh("application/json",n));html=(e,t,n)=>{let i=r=>this.#a(r,t,kh("text/html; charset=UTF-8",n));return typeof e=="object"?Sh(e,uR.Stringify,!1,{}).then(i):i(e)};redirect=(e,t)=>{let n=String(e);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,t??302)};notFound=()=>(this.#l??=()=>Qs(),this.#l(this))};var rt="ALL",dR="all",_R=["get","post","put","delete","options","patch"],u_="Can not add a route since the matcher is already built.",d_=class extends Error{};var pR="__COMPOSED_HANDLER";var nJ=e=>e.text("404 Not Found",404),fR=(e,t)=>{if("getResponse"in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},mR=class gR{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(t={}){[..._R,dR].forEach(o=>{this[o]=(a,...s)=>(typeof a=="string"?this.#e=a:this.#o(o,this.#e,a),s.forEach(l=>{this.#o(o,this.#e,l)}),this)}),this.on=(o,a,...s)=>{for(let l of[a].flat()){this.#e=l;for(let c of[o].flat())s.map(d=>{this.#o(c.toUpperCase(),this.#e,d)})}return this},this.use=(o,...a)=>(typeof o=="string"?this.#e=o:(this.#e="*",a.unshift(o)),a.forEach(s=>{this.#o(rt,this.#e,s)}),this);let{strict:i,...r}=t;Object.assign(this,r),this.getPath=i??!0?t.getPath??bh:iR}#t(){let t=new gR({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#n=this.#n,t.routes=this.routes,t}#n=nJ;errorHandler=fR;route(t,n){let i=this.basePath(t);return n.routes.map(r=>{let o;n.errorHandler===fR?o=r.handler:(o=async(a,s)=>(await hh([],n.errorHandler)(a,()=>r.handler(a,s))).res,o[pR]=r.handler),i.#o(r.method,r.path,o,r.basePath)}),this}basePath(t){let n=this.#t();return n._basePath=xi(this._basePath,t),n}onError=t=>(this.errorHandler=t,this);notFound=t=>(this.#n=t,this);mount(t,n,i){let r,o;i&&(typeof i=="function"?o=i:(o=i.optionHandler,i.replaceRequest===!1?r=l=>l:r=i.replaceRequest));let a=o?l=>{let c=o(l);return Array.isArray(c)?c:[c]}:l=>{let c;try{c=l.executionCtx}catch{}return[l.env,c]};r||=(()=>{let l=xi(this._basePath,t),c=l==="/"?0:l.length;return d=>{let u=new URL(d.url);return u.pathname=this.getPath(d).slice(c)||"/",new Request(u,d)}})();let s=async(l,c)=>{let d=await n(r(l.req.raw),...a(l));if(d)return d;await c()};return this.#o(rt,xi(t,"*"),s),this}#o(t,n,i,r){t=t.toUpperCase(),n=xi(this._basePath,n);let o={basePath:r!==void 0?xi(this._basePath,r):this._basePath,path:n,method:t,handler:i};this.router.add(t,n,[i,o]),this.routes.push(o)}#i(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t}#r(t,n,i,r){if(r==="HEAD")return(async()=>new Response(null,await this.#r(t,n,i,"GET")))();let o=this.getPath(t,{env:i}),a=this.router.match(r,o),s=new wh(t,{path:o,matchResult:a,env:i,executionCtx:n,notFoundHandler:this.#n});if(a[0].length===1){let c;try{c=a[0][0][0][0](s,async()=>{s.res=await this.#n(s)})}catch(d){return this.#i(d,s)}return c instanceof Promise?c.then(d=>d||(s.finalized?s.res:this.#n(s))).catch(d=>this.#i(d,s)):c??this.#n(s)}let l=hh(a[0],this.errorHandler,this.#n);return(async()=>{try{let c=await l(s);if(!c.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return this.#i(c,s)}})()}fetch=(t,...n)=>this.#r(t,n[1],n[0],t.method);request=(t,n,i,r)=>t instanceof Request?this.fetch(n?new Request(t,n):t,i,r):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${xi("/",t)}`,n),i,r));fire=()=>{addEventListener("fetch",t=>{t.respondWith(this.#r(t.request,t,void 0,t.request.method))})}};var __=[];function Eh(e,t){let n=this.buildAllMatchers(),i=((r,o)=>{let a=n[r]||n[rt],s=a[2][o];if(s)return s;let l=o.match(a[0]);if(!l)return[[],__];let c=l.indexOf("",1);return[a[1][c],l]});return this.match=i,i(e,t)}var p_="[^/]+",ec=".*",tc="(?:|/.*)",po=Symbol(),rJ=new Set(".\\+*[^]$()");function iJ(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1||e===ec||e===tc?1:t===ec||t===tc?-1:e===p_?1:t===p_?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var hR=class Ah{#e;#t;#n=Object.create(null);insert(t,n,i,r,o){if(t.length===0){if(this.#e!==void 0)throw po;if(o)return;this.#e=n;return}let[a,...s]=t,l=a==="*"?s.length===0?["","",ec]:["","",p_]:a==="/*"?["","",tc]:a.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),c;if(l){let d=l[1],u=l[2]||p_;if(d&&l[2]&&(u===".*"||(u=u.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(u))))throw po;if(c=this.#n[u],!c){if(Object.keys(this.#n).some(_=>_!==ec&&_!==tc))throw po;if(o)return;c=this.#n[u]=new Ah,d!==""&&(c.#t=r.varIndex++)}!o&&d!==""&&i.push([d,c.#t])}else if(c=this.#n[a],!c){if(Object.keys(this.#n).some(d=>d.length>1&&d!==ec&&d!==tc))throw po;if(o)return;c=this.#n[a]=new Ah}c.insert(s,n,i,r,o)}buildRegExpStr(){let n=Object.keys(this.#n).sort(iJ).map(i=>{let r=this.#n[i];return(typeof r.#t=="number"?`(${i})@${r.#t}`:rJ.has(i)?`\\${i}`:i)+r.buildRegExpStr()});return typeof this.#e=="number"&&n.unshift(`#${this.#e}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}};var yR=class{#e={varIndex:0};#t=new hR;insert(e,t,n){let i=[],r=[];for(let a=0;;){let s=!1;if(e=e.replace(/\{[^}]+\}/g,l=>{let c=`@\\${a}`;return r[a]=[c,l],a++,s=!0,c}),!s)break}let o=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=r.length-1;a>=0;a--){let[s]=r[a];for(let l=o.length-1;l>=0;l--)if(o[l].indexOf(s)!==-1){o[l]=o[l].replace(s,r[a][1]);break}}return this.#t.insert(o,t,i,this.#e,n),i}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0,n=[],i=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(r,o,a)=>o!==void 0?(n[++t]=Number(o),"$()"):(a!==void 0&&(i[Number(a)]=++t),"")),[new RegExp(`^${e}`),n,i]}};var oJ=[/^$/,[],Object.create(null)],vR=Object.create(null);function bR(e){return vR[e]??=new RegExp(e==="*"?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(t,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function aJ(){vR=Object.create(null)}function sJ(e){let t=new yR,n=[];if(e.length===0)return oJ;let i=e.map(c=>[!/\*|\/:/.test(c[0]),...c]).sort(([c,d],[u,_])=>c?1:u?-1:d.length-_.length),r=Object.create(null);for(let c=0,d=-1,u=i.length;c<u;c++){let[_,p,v]=i[c];_?r[p]=[v.map(([h])=>[h,Object.create(null)]),__]:d++;let f;try{f=t.insert(p,d,_)}catch(h){throw h===po?new d_(p):h}_||(n[d]=v.map(([h,k])=>{let w=Object.create(null);for(k-=1;k>=0;k--){let[O,g]=f[k];w[O]=g}return[h,w]}))}let[o,a,s]=t.buildRegExp();for(let c=0,d=n.length;c<d;c++)for(let u=0,_=n[c].length;u<_;u++){let p=n[c][u]?.[1];if(!p)continue;let v=Object.keys(p);for(let f=0,h=v.length;f<h;f++)p[v[f]]=s[p[v[f]]]}let l=[];for(let c in a)l[c]=n[a[c]];return[o,l,r]}function ga(e,t){if(e){for(let n of Object.keys(e).sort((i,r)=>r.length-i.length))if(bR(n).test(t))return[...e[n]]}}var f_=class{name="RegExpRouter";#e;#t;constructor(){this.#e={[rt]:Object.create(null)},this.#t={[rt]:Object.create(null)}}add(e,t,n){let i=this.#e,r=this.#t;if(!i||!r)throw new Error(u_);i[e]||[i,r].forEach(s=>{s[e]=Object.create(null),Object.keys(s[rt]).forEach(l=>{s[e][l]=[...s[rt][l]]})}),t==="/*"&&(t="*");let o=(t.match(/\/:/g)||[]).length;if(/\*$/.test(t)){let s=bR(t);e===rt?Object.keys(i).forEach(l=>{i[l][t]||=ga(i[l],t)||ga(i[rt],t)||[]}):i[e][t]||=ga(i[e],t)||ga(i[rt],t)||[],Object.keys(i).forEach(l=>{(e===rt||e===l)&&Object.keys(i[l]).forEach(c=>{s.test(c)&&i[l][c].push([n,o])})}),Object.keys(r).forEach(l=>{(e===rt||e===l)&&Object.keys(r[l]).forEach(c=>s.test(c)&&r[l][c].push([n,o]))});return}let a=l_(t)||[t];for(let s=0,l=a.length;s<l;s++){let c=a[s];Object.keys(r).forEach(d=>{(e===rt||e===d)&&(r[d][c]||=[...ga(i[d],c)||ga(i[rt],c)||[]],r[d][c].push([n,o-l+s+1]))})}}match=Eh;buildAllMatchers(){let e=Object.create(null);return Object.keys(this.#t).concat(Object.keys(this.#e)).forEach(t=>{e[t]||=this.#n(t)}),this.#e=this.#t=void 0,aJ(),e}#n(e){let t=[],n=e===rt;return[this.#e,this.#t].forEach(i=>{let r=i[e]?Object.keys(i[e]).map(o=>[o,i[e][o]]):[];r.length!==0?(n||=!0,t.push(...r)):e!==rt&&t.push(...Object.keys(i[rt]).map(o=>[o,i[rt][o]]))}),n?sJ(t):null}};var Th=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,n){if(!this.#t)throw new Error(u_);this.#t.push([e,t,n])}match(e,t){if(!this.#t)throw new Error("Fatal error");let n=this.#e,i=this.#t,r=n.length,o=0,a;for(;o<r;o++){let s=n[o];try{for(let l=0,c=i.length;l<c;l++)s.add(...i[l]);a=s.match(e,t)}catch(l){if(l instanceof d_)continue;throw l}this.match=s.match.bind(s),this.#e=[s],this.#t=void 0;break}if(o===r)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#t||this.#e.length!==1)throw new Error("No active router has been determined yet.");return this.#e[0]}};var nc=Object.create(null),cJ=e=>{for(let t in e)return!0;return!1},SR=class kR{#e;#t;#n;#o=0;#i=nc;constructor(t,n,i){if(this.#t=i||Object.create(null),this.#e=[],t&&n){let r=Object.create(null);r[t]={handler:n,possibleKeys:[],score:0},this.#e=[r]}this.#n=[]}insert(t,n,i){this.#o=++this.#o;let r=this,o=nR(n),a=[];for(let s=0,l=o.length;s<l;s++){let c=o[s],d=o[s+1],u=rR(c,d),_=Array.isArray(u)?u[0]:c;if(_ in r.#t){r=r.#t[_],u&&a.push(u[1]);continue}r.#t[_]=new kR,u&&(r.#n.push(u),a.push(u[1])),r=r.#t[_]}return r.#e.push({[t]:{handler:i,possibleKeys:a.filter((s,l,c)=>c.indexOf(s)===l),score:this.#o}}),r}#r(t,n,i,r,o){for(let a=0,s=n.#e.length;a<s;a++){let l=n.#e[a],c=l[i]||l[rt],d={};if(c!==void 0&&(c.params=Object.create(null),t.push(c),r!==nc||o&&o!==nc))for(let u=0,_=c.possibleKeys.length;u<_;u++){let p=c.possibleKeys[u],v=d[c.score];c.params[p]=o?.[p]&&!v?o[p]:r[p]??o?.[p],d[c.score]=!0}}}search(t,n){let i=[];this.#i=nc;let o=[this],a=vh(n),s=[],l=a.length,c=null;for(let d=0;d<l;d++){let u=a[d],_=d===l-1,p=[];for(let f=0,h=o.length;f<h;f++){let k=o[f],w=k.#t[u];w&&(w.#i=k.#i,_?(w.#t["*"]&&this.#r(i,w.#t["*"],t,k.#i),this.#r(i,w,t,k.#i)):p.push(w));for(let O=0,g=k.#n.length;O<g;O++){let b=k.#n[O],T=k.#i===nc?{}:{...k.#i};if(b==="*"){let y=k.#t["*"];y&&(this.#r(i,y,t,k.#i),y.#i=T,p.push(y));continue}let[I,R,U]=b;if(!u&&!(U instanceof RegExp))continue;let V=k.#t[I];if(U instanceof RegExp){if(c===null){c=new Array(l);let x=n[0]==="/"?1:0;for(let W=0;W<l;W++)c[W]=x,x+=a[W].length+1}let y=n.substring(c[d]),S=U.exec(y);if(S){if(T[R]=S[0],this.#r(i,V,t,k.#i,T),S[0].length===y.length&&V.#t["*"]&&this.#r(i,V.#t["*"],t,k.#i,T),cJ(V.#t)){V.#i=T;let x=S[0].match(/\//)?.length??0;(s[x]||=[]).push(V)}continue}}(U===!0||U.test(u))&&(T[R]=u,_?(this.#r(i,V,t,T,k.#i),V.#t["*"]&&this.#r(i,V.#t["*"],t,T,k.#i)):(V.#i=T,p.push(V)))}}let v=s.shift();o=v?p.concat(v):p}return i.length>1&&i.sort((d,u)=>d.score-u.score),[i.map(({handler:d,params:u})=>[d,u])]}};var xh=class{name="TrieRouter";#e;constructor(){this.#e=new SR}add(e,t,n){let i=l_(t);if(i){for(let r=0,o=i.length;r<o;r++)this.#e.insert(e,i[r],n);return}this.#e.insert(e,t,n)}match(e,t){return this.#e.search(e,t)}};var Oh=class extends mR{constructor(e={}){super(e),this.router=e.router??new Th({routers:[new f_,new xh]})}};var lJ=/^[\w!#$%&'*.^`|~+-]+$/,uJ=/^[!#-:<>-[\]-~]+$/,dJ=/^[ !#-:<-[\]-~]*$/,wR=e=>{let t=0,n=e.length;for(;t<n;){let i=e.charCodeAt(t);if(i!==32&&i!==9)break;t++}for(;n>t;){let i=e.charCodeAt(n-1);if(i!==32&&i!==9)break;n--}return t===0&&n===e.length?e:e.slice(t,n)},Rh=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};let n=e.split(";"),i=Object.create(null);for(let r of n){let o=r.indexOf("=");if(o===-1)continue;let a=wR(r.substring(0,o));if(t&&t!==a||!uJ.test(a)||a in i)continue;let s=wR(r.substring(o+1));if(s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1)),dJ.test(s)&&(i[a]=s.indexOf("%")!==-1?ma(s,Ys):s,t))break}return i};var _J=(e,t,n={})=>{if(!lJ.test(e))throw new Error("Invalid cookie name");let i=`${e}=${t}`;if(e.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}for(let r of["domain","path","sameSite","priority"])if(n[r]&&/[;\r\n]/.test(n[r]))throw new Error(`${r} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge=="number"&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");i+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host"&&(i+=`; Domain=${n.domain}`),n.path&&(i+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");i+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(i+="; HttpOnly"),n.secure&&(i+="; Secure"),n.sameSite&&(i+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(i+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");i+="; Partitioned"}return i},m_=(e,t,n)=>(t=encodeURIComponent(t),_J(e,t,n));var ER=(e,t,n)=>{let i=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!i)return;let o=t;return n==="secure"?o="__Secure-"+t:n==="host"&&(o="__Host-"+t),Rh(i,o)[o]}return i?Rh(i):{}};var pJ=(e,t,n)=>{let i;return n?.prefix==="secure"?i=m_("__Secure-"+e,t,{path:"/",...n,secure:!0}):n?.prefix==="host"?i=m_("__Host-"+e,t,{...n,path:"/",secure:!0,domain:void 0}):i=m_(e,t,{path:"/",...n}),i},AR=(e,t,n,i)=>{let r=pJ(t,n,i);e.header("Set-Cookie",r,{append:!0})};var xR=require("node:child_process"),OR=require("node:path"),RR=require("node:util"),TR=(0,RR.promisify)(xR.execFile);async function $R(e){let t=(0,OR.resolve)(e,".agents","runtime","bin","zaip.mjs"),n={cwd:e,encoding:"utf8",windowsHide:!0,timeout:12e4,maxBuffer:10*1024*1024};await TR(process.execPath,[t,"adapters","build","--json"],n);let{stdout:i}=await TR(process.execPath,[t,"adapters","check","--json"],n),r=JSON.parse(i);return{valid:r.valid===!0,drifted:Array.isArray(r.drifted)?r.drifted.filter(o=>typeof o=="string"):[]}}var Ch=require("node:util");vt();var g_=".agents/config/agents/catalog.yaml",Ih=["agent-orchestrator","agent-builder","agent-task-executor","agent-analyst","agent-finalizer","agent-reviewer","agent-integrator","agent-auditor","agent-text-summarizer","agent-data-analyst","agent-refactoring-specialist","agent-frontend","agent-backend","agent-website-developer","agent-designer","agent-cloud-engineer","agent-security-auditor","agent-marketing-analyst","agent-brand-strategist","agent-growth-strategist","agent-sales-specialist","agent-general-operations","agent-governance-compliance"],fJ=new Set(Ih),Ft=class extends Error{constructor(n,i){super(n);this.status=i}status;name="AgentCatalogUpdateError"};async function NR(e){let t=await MR(e);return{catalog:await yJ(e),framework_agent_ids:Ih,...t,sync:{required:!0,valid:null,drifted:[]}}}async function PR(e,t,n){let i=await e.readText(g_),r=ii(ht(i)),o=await MR(e),a=mJ(r,t,o);await e.writeTextAtomic(g_,Fr(a));try{let s=await n();if(!s.valid||s.drifted.length>0)throw new Error(`Adapter parity failed; drifted: ${s.drifted.join(", ")||"unknown"}`);return{catalog:a,framework_agent_ids:Ih,...o,sync:{required:!0,valid:!0,drifted:[]}}}catch(s){await e.writeTextAtomic(g_,i);try{await n()}catch{}throw new Ft(`Agent catalog was not saved because adapter synchronization failed: ${s instanceof Error?s.message:String(s)}`,500)}}function mJ(e,t,n){if(!$h(t)||!Array.isArray(t.agents))throw new Ft("Request body must contain an agents array",400);if(Object.keys(t).some(o=>o!=="agents"))throw new Ft("Only the agents collection may be updated",400);let i;try{let o=t.agents.map(a=>gJ(a));i=ii({schema_version:e.schema_version,agents:o,squads:e.squads})}catch(o){throw new Ft(o instanceof Error?o.message:String(o),400)}vJ(e,i),SJ(e,i),bJ(e,i),n!==void 0&&hJ(i,n);let r=Ip(i);if(r.length>0)throw new Ft(r.map(o=>`${o.rule}: ${o.message}`).join("; "),409);return i}function gJ(e){if(!$h(e)||!$h(e.persona))return e;let t=e.persona.nome,n=e.persona.cargo;if(typeof t!="string"||typeof n!="string")return e;let i=`${t}_${n}_zaip_agent`;return{...e,codex_task_name:i,nickname_candidates:[i]}}async function MR(e){let n=qr(ht(await e.readText(".agents/config/project.yaml"))).model_orchestration;return n?.mode==="auto"?{default_model:n.default_model,default_reasoning_effort:n.default_effort,allowed_models:n.allowed_models,allowed_reasoning_efforts:n.allowed_efforts}:{default_model:n?.default_model??null,default_reasoning_effort:n?.default_effort??null,allowed_models:[],allowed_reasoning_efforts:[]}}function hJ(e,t){for(let n of e.agents){let i=n.model.preferred.find(r=>r!=="policy-selected"&&!t.allowed_models.includes(r));if(t.allowed_models.length>0&&i!==void 0)throw new Ft(`Agent ${n.id} uses a model outside project.allowed_models: ${i}`,400);if(n.model.reasoning_effort!==void 0&&t.allowed_reasoning_efforts.length>0&&!t.allowed_reasoning_efforts.includes(n.model.reasoning_effort))throw new Ft(`Agent ${n.id} uses reasoning effort outside project.allowed_efforts: ${n.model.reasoning_effort}`,400)}}async function yJ(e){return ii(ht(await e.readText(g_)))}function vJ(e,t){for(let n of fJ){let i=e.agents.find(o=>o.id===n),r=t.agents.find(o=>o.id===n);if(i===void 0||r===void 0)throw new Ft(`Framework agent cannot be removed: ${n}`,409);if(!(0,Ch.isDeepStrictEqual)(CR(i),CR(r)))throw new Ft(`Framework agent ${n} only allows persona name and role changes`,409)}}function CR(e){let{persona:t,codex_task_name:n,nickname_candidates:i,...r}=e;return{...r,persona:{nome:"protected",cargo:"protected"},codex_task_name:"protected_protected_zaip_agent",nickname_candidates:["protected_protected_zaip_agent"],model:{...e.model,preferred:[],reasoning_effort:void 0}}}function bJ(e,t){for(let n of e.agents){let i=t.agents.find(r=>r.id===n.id);if(i!==void 0&&!(0,Ch.isDeepStrictEqual)(IR(n),IR(i)))throw new Ft(`Existing agent ${n.id} only allows persona name and role changes`,409)}}function IR(e){let{persona:t,codex_task_name:n,nickname_candidates:i,...r}=e;return{...r,persona:{...t,nome:"protected",cargo:"protected"}}}function SJ(e,t){for(let n of e.agents){let i=t.agents.find(r=>r.id===n.id);if(i!==void 0&&n.codex_name!==i.codex_name)throw new Ft(`Technical identity is stable and cannot be changed: ${n.id}`,409)}}function $h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}vt();var kJ=".agents/config/agents/catalog.yaml",wJ=".codex/config.toml",EJ=".agents/config/framework.lock.yaml",AJ=".local/dashboard-sqlite/read-model.sqlite",LR=".agents/architecture/software-architecture.md",TJ=[{id:"software_architecture",label:"Arquitetura de Software",artifact:LR},{id:"design_system",label:"Design system",artifact:".agents/design/DESIGN.md"},{id:"brandbook",label:"Brandbook",artifact:".agents/branding/brandbook.md"},{id:"marketing_strategy",label:"Estrat\xE9gia de Marketing",artifact:".agents/marketing/strategy.md"},{id:"sales_playbook",label:"Playbook de Sales",artifact:".agents/sales/playbook.md"},{id:"growth_strategy",label:"Estrat\xE9gia de Growth",artifact:".agents/growth/strategy.md"}];async function jR(e){return qr(ht(await e.readText(gn)))}async function DR(e){let[t,n,i,r,o,a]=await Promise.all([e.readText(kJ).then(ht).then(ii),xJ(e),e.exists(AJ),OJ(e),RJ(e,".agents/rules"),$J(e)]);return{framework_version:n,metrics:[{id:"agents",label:"Agentes",value:t.agents.length},{id:"squads",label:"Squads",value:t.squads.length},{id:"skills",label:"Skills",value:r},{id:"rules",label:"Rules",value:o},{id:"hooks",label:"Hooks",value:a},{id:"database",label:"Database",value:i?"Ativo":"Inativo"}],stack_components:await CJ(e),areas:await Promise.all(TJ.map(async s=>({...s,available:await e.exists(s.artifact)})))}}async function xJ(e){try{let t=Ri(ht(await e.readText(EJ))),n=Ri(t.framework).version;return typeof n=="string"&&n.trim()?n.trim():null}catch{return null}}async function OJ(e){let t=await e.listDirectories(".agents/skills");return(await Promise.all(t.map(i=>e.exists(`${i}/SKILL.md`)))).filter(Boolean).length}async function RJ(e,t){let n=`${t}/`;return(await e.listFiles(t,".md")).filter(r=>!r.slice(n.length).includes("/")).length}async function $J(e){try{let t=await e.readText(wJ);return new Set([...t.matchAll(/^\s*\[\[hooks\.([A-Za-z0-9_-]+)\]\]\s*$/gm)].map(i=>i[1])).size}catch{return 0}}async function CJ(e){let[t,n,i]=await Promise.all([Nh(e,"package.json"),Nh(e,".agents/dashboard/packages/local-runtime/package.json"),Nh(e,".agents/dashboard/apps/frontend/package.json")]);return[Oi("Node.js",process.versions.node,`Runtime observado: ${process.execPath}`,"exact"),Oi("TypeScript",fo(t,"typescript"),"package.json","exact"),Oi("Vite",fo(t,"vite"),"package.json","exact"),Oi("Astro",fo(t,"astro"),"package.json","exact"),Oi("Redis",fo(t,"redis"),"package.json","exact"),Oi("BullMQ",fo(t,"bullmq"),"package.json","exact"),Oi("Hono",fo(n,"hono"),".agents/dashboard/packages/local-runtime/package.json","exact"),Oi("React",fo(i,"react"),".agents/dashboard/apps/frontend/package.json","exact")]}async function Nh(e,t){try{let n=JSON.parse(await e.readText(t));return typeof n=="object"&&n!==null?n:{}}catch{return{}}}function fo(e,t){return e.dependencies?.[t]??e.devDependencies?.[t]??null}function Oi(e,t,n,i){return t===null?{name:e,version:null,source:null,verification:"unavailable"}:{name:e,version:t,source:n,verification:i}}async function UR(e,t){let n=await e.readText(gn),i=qr(ht(n)),r=qr(t);if(r.tracking.storage_mode!=="tracked_sanitized")throw new TypeError("This project requires Git-native tracked_sanitized storage.");let o=qr({...r,clients:i.clients,tracking:i.tracking,model_orchestration:i.model_orchestration,stack:{...r.stack,overrides:{...i.stack.overrides,...r.stack.overrides}}});await e.writeTextAtomic(gn,Fr(o));try{await e.writeTextAtomic(LR,PJ(o))}catch(a){throw await e.writeTextAtomic(gn,n),new Error("Project settings were rolled back because the software architecture summary could not be updated.",{cause:a})}return o}var IJ={primary_language:"Linguagem principal",backend_runtime:"Runtime backend",backend_api:"Framework backend / API",query_builder:"Query builder",database:"Banco de dados",auth_storage:"Autentica\xE7\xE3o e Storage",cache_messaging:"Cache e mensageria",async_queue:"Filas e processamento ass\xEDncrono",backend_infrastructure:"Infraestrutura backend",web_framework:"Framework do Web App",web_language:"Linguagem do Web App",web_build:"Build do Web App",frontend_hosting:"Hospedagem do frontend",site_framework:"Framework do site",site_language:"Linguagem do site",site_islands:"Componentes interativos",site_build:"Build do site",site_hosting:"Hospedagem do site"},NJ={backend_data_and_managed_services:"Dados e servi\xE7os gerenciados",backend_api_and_business_rules:"APIs e regras de neg\xF3cio",backend_async_processing:"Filas e processamento ass\xEDncrono",backend_infrastructure:"Infraestrutura backend"};function PJ(e){let t=Ri(e.stack.overrides),n=Ri(t.components),i=Ri(t.languages),r=Ri(t.architecture),o=Object.entries(IJ).map(([u,_])=>{let p=Ri(n[u]);return`| ${_} | ${wt(p.name,"N\xE3o definido")} | ${wt(p.version,"N\xE3o fixada")} | ${wt(p.reference,"\u2014")} |`}),a=Object.entries(e.stack.layout??{}).map(([u,_])=>`| ${wt(u)} | ${wt(_)} |`),s=Object.entries(e.stack.commands??{}).map(([u,_])=>`| ${wt(u)} | \`${MJ(_)}\` |`),l=Object.entries(r).flatMap(([u,_])=>[`### ${NJ[u]??LJ(u)}`,"",...rc(h_(_)),""]),c=e.execution?.runtime==="autonomous"?["- **Runtime:** autonomous",`- **Provider:** ${wt(e.execution.autonomous.provider)}`,`- **Modelo-base:** ${wt(e.execution.autonomous.model)}`,`- **Paralelismo m\xE1ximo:** ${e.execution.autonomous.max_parallelism}`,`- **Lease configurado:** ${e.execution.autonomous.lease_ms} ms`,`- **Limite total de invoca\xE7\xF5es:** ${e.execution.autonomous.max_total_invocations??"N\xE3o definido"}`]:[`- **Runtime:** ${e.execution?.runtime??"manual (padr\xE3o impl\xEDcito)"}`],d=e.assurance===void 0?["- N\xE3o configurada."]:[`- **Vers\xE3o:** ${e.assurance.version}`,`- **Profundidade padr\xE3o:** ${wt(e.assurance.standard_depth)}`,`- **Exigir commit final:** ${e.assurance.require_final_commit?"Sim":"N\xE3o"}`];return["---","schema_version: 1","kind: software-architecture",`generated_from: ${gn}`,"---","","# Arquitetura de Software","",`> Proje\xE7\xE3o gerada automaticamente pela p\xE1gina de configura\xE7\xF5es a partir de \`${gn}\`. N\xE3o edite este arquivo manualmente.`,"","## Projeto","",`- **Nome:** ${wt(e.project.name)}`,`- **ID:** ${wt(e.project.id)}`,`- **Timezone:** ${wt(e.project.timezone)}`,"","## Perfil t\xE9cnico","",`- **Stack profile:** ${wt(e.stack.id)}`,`- **Linguagem:** ${wt(e.stack.language,"N\xE3o definida")}`,`- **API:** ${wt(e.stack.api,"N\xE3o definida")}`,`- **Query builder:** ${wt(e.stack.query_builder,"N\xE3o definido")}`,"","## Execu\xE7\xE3o","",...c,"","## Assurance","",...d,"","## Componentes e vers\xF5es","","| Responsabilidade | Tecnologia | Vers\xE3o exata | Pacote / imagem / servi\xE7o |","| --- | --- | --- | --- |",...o,"","## Superf\xEDcies","","### Web App \u2014 Frontend","",...rc(h_(i.frontend)),"","### Backend","",...rc(h_(i.backend)),"","### Site e Landing Pages","",...rc(h_(i.site)),"","## Decis\xF5es de arquitetura","",...l.length>0?l:["- Nenhuma decis\xE3o adicional registrada.",""],"## Layout do c\xF3digo","","| Papel | Caminho |","| --- | --- |",...a.length>0?a:["| N\xE3o definido | \u2014 |"],"","## Invariantes","",...rc(e.stack.invariants??[]),"","## Comandos de valida\xE7\xE3o","","| Comando | Execu\xE7\xE3o |","| --- | --- |",...s.length>0?s:["| N\xE3o definido | \u2014 |"],""].join(`
346
+ `)}function Ri(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{}}function h_(e){return Array.isArray(e)?e.flatMap(t=>{if(typeof t=="string"&&t.length>0)return[t];let n=Object.entries(Ri(t));return n.length===1&&typeof n[0]?.[1]=="string"?[`${n[0][0]}: ${n[0][1]}`]:[]}):[]}function rc(e){return e.length>0?e.map(t=>`- ${wt(t)}`):["- N\xE3o definido."]}function wt(e,t="\u2014"){return typeof e!="string"||e.trim().length===0?t:e.trim().replaceAll("|","\\|").replaceAll(/\r?\n/g," ")}function MJ(e){return wt(e).replaceAll("`","\\`")}function LJ(e){let t=e.replaceAll("_"," ");return t.charAt(0).toUpperCase()+t.slice(1)}function y_(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"?"definition":e.status==="planned"?"ready":null}function v_(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(n=>e.task_ids.includes(n.id)&&n.is_active))return"executing";if(e.lifecycle_status==="verifying"||e.work_status==="verifying")return"verifying";if(e.work_status==="executing"){let n=t.filter(i=>e.task_ids.includes(i.id));return n.some(i=>i.status==="verifying")&&n.every(i=>i.status==="verifying"||i.status==="completed")?"verifying":"executing"}return e.lifecycle_status==="active"?"executing":"planning"}function zR(e){return{query:(e.req.query("query")??"").trim().toLocaleLowerCase(),status:e.req.query("status")??"",risk:e.req.query("risk")??"",origin:e.req.query("origin")??"",kind:e.req.query("kind")??""}}function FR(e){if(e===void 0||!["definition","planning","ready","executing","verifying","completed","blocked","cancelled","failed"].includes(e))throw new Error("A valid Kanban stage is required");return e}function qR(e,t,n,i,r,o){let a=new Map(e.changes.map(w=>[w.id,w.source.type])),s=w=>o.query===""||w.some(O=>O?.toLocaleLowerCase().includes(o.query)),l=w=>(o.status===""||y_(w)===o.status)&&(o.risk===""||w.risk===o.risk)&&(o.origin===""||(a.get(w.change_id)??(w.spec_id===null?"task":"spec"))===o.origin)&&s([w.id,w.title,w.short_name,w.objective,w.change_id,w.spec_id]),c=w=>o.risk===""&&o.origin===""&&(o.status===""||v_(w,e.tasks)===o.status)&&s([w.id,w.title,w.parent_id]),d=e.tasks.filter(l),u=e.prds.filter(c),_=e.specs.filter(c),v=[...u.map(w=>({kind:"prd",row:w})),..._.map(w=>({kind:"spec",row:w})),...d.map(w=>({kind:"task",row:w}))].filter(w=>(w.kind==="task"?y_(w.row):v_(w.row,e.tasks))===t).toSorted((w,O)=>{let g=new Map(r.map((b,T)=>[b,T]));return(g.get(w.row.id)??Number.MAX_SAFE_INTEGER)-(g.get(O.row.id)??Number.MAX_SAFE_INTEGER)||String(O.row.updated_at??"").localeCompare(String(w.row.updated_at??""))||w.row.id.localeCompare(O.row.id)}).filter(w=>(w.kind==="task"?y_(w.row):v_(w.row,e.tasks))===t),f=o.kind===""?v:o.kind==="standalone-task"?v.filter(w=>w.kind==="task"&&w.row.spec_id===null):o.kind==="task"?v.filter(w=>w.kind==="task"&&w.row.spec_id!==null):v.filter(w=>w.kind===o.kind),h=f.slice(n,n+i),k=new Set(h.map(w=>w.row.id));return{stage:t,offset:n,total:f.length,totals_by_kind:{all:v.length,task:v.filter(w=>w.kind==="task"&&w.row.spec_id!==null).length,"standalone-task":v.filter(w=>w.kind==="task"&&w.row.spec_id===null).length,prd:v.filter(w=>w.kind==="prd").length,spec:v.filter(w=>w.kind==="spec").length},prds:h.filter(w=>w.kind==="prd").map(w=>w.row),specs:h.filter(w=>w.kind==="spec").map(w=>w.row),tasks:h.filter(w=>w.kind==="task").map(w=>w.row),changes:e.changes.filter(w=>w.task_ids.some(O=>k.has(O)))}}function VR(e,t,n,i,r){let o=c=>c.rework_run_count>0?"rework":c.task_count>0?"structured":"empty",s=(t==="task"?e.tasks.filter(c=>c.risk===n):(t==="spec"?e.specs:e.prds).filter(c=>o(c)===n)).toSorted((c,d)=>String(d.updated_at??d.created_at??"").localeCompare(String(c.updated_at??c.created_at??""))||c.id.localeCompare(d.id)),l=s.slice(i,i+r);return{offset:i,total:s.length,prds:t==="prd"?l:[],specs:t==="spec"?l:[],tasks:t==="task"?l:[],changes:t==="task"?e.changes.filter(c=>l.some(d=>c.task_ids.includes(d.id))):[]}}bi();bi();function b_(e,t,n,i,r,o,a=null){let s=Object.entries(e.days).sort(([w],[O])=>O.localeCompare(w)),l=n.from===null?null:WR(n.from),c=n.to===null?null:WR(n.to),d=s.filter(([w])=>(l===null||w>=l)&&(c===null||w<=c)),_=(t==="overview"?d.map(([w,O])=>({day:w,...O.overview})):jJ(t,ZR(d.flatMap(([,w])=>w[t])),ZR(s.flatMap(([,w])=>w[t])),n)).filter(w=>zJ(w,i)),p=UJ(a),v=p===null?_:_.filter(w=>`${BR(w)}\0${HR(w)}`<p),f=p===null?r:0,h=v.slice(f,f+o),k=h.at(-1);return{data_source:"lifecycle_daily_read_models",snapshot_id:e.updated_at,source_latest_at:e.source_latest_at,kind:t,offset:f,limit:o,total:_.length,has_more:f+o<v.length,next_cursor:k===void 0||f+o>=v.length?null:DJ(BR(k),HR(k)),rows:h}}function WR(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:Dt(e,"day")}function jJ(e,t,n,i){if(e!=="tasks"&&e!=="specs"&&e!=="prds")return[...t];let r=new Set(["completed","delivered","failed","cancelled","superseded","rolled_back"]),o=new Map(n.map(c=>[c.id,c])),a=t.filter(c=>{let d=o.get(c.id)??c;if(d.status===null||!r.has(d.status)||c.run_count>0)return!0;let u=d.window_at??d.occurred_at;return(i.from===null||u>=i.from)&&(i.to===null||u<=i.to)}),s=new Set(a.map(c=>c.id)),l=()=>({known_sum:0,unknown:0,complete:!0,coverage_ratio:1});return[...a,...n.filter(c=>!s.has(c.id)&&(c.status===null||!r.has(c.status))).map(c=>({...c,run_count:0,cost_currency:null,metrics:{duration:l(),total_tokens:l(),cost:l()}}))].sort((c,d)=>d.occurred_at.localeCompare(c.occurred_at)||c.id.localeCompare(d.id))}function ZR(e){let t=new Map;for(let n of e){let i=t.get(n.id);if(i===void 0){t.set(n.id,structuredClone(n));continue}let r=i.run_count;if(n.run_count>0){let o=n.lifecycle_elapsed_ms??null;if(r===0)i.lifecycle_elapsed_ms=o;else{let a=i.lifecycle_elapsed_ms??null;i.lifecycle_elapsed_ms=a===null||o===null?null:a+o}}i.run_count+=n.run_count;for(let o of["duration","total_tokens","cost"]){let a=i.metrics[o],s=n.metrics[o];a.known_sum+=s.known_sum,a.unknown+=s.unknown,a.complete=a.unknown===0;let l=i.run_count;a.coverage_ratio=l===0?1:Math.max(0,Math.min(1,(l-a.unknown)/l))}}return[...t.values()].sort((n,i)=>i.occurred_at.localeCompare(n.occurred_at)||n.id.localeCompare(i.id))}function BR(e){let t=e;return typeof t.occurred_at=="string"?t.occurred_at:typeof t.day=="string"?t.day:""}function HR(e){let t=e;return typeof t.id=="string"?t.id:typeof t.day=="string"?t.day:""}function DJ(e,t){return encodeURIComponent(JSON.stringify([e,t]))}function UJ(e){if(e===null)return null;try{let t=JSON.parse(decodeURIComponent(e));return Array.isArray(t)&&typeof t[0]=="string"&&typeof t[1]=="string"?`${t[0]}\0${t[1]}`:null}catch{return null}}function zJ(e,t){return t.status&&e.status!==t.status||t.risk&&e.risk!==t.risk?!1:t.query?Object.values(e).some(n=>typeof n=="string"&&n.toLocaleLowerCase().includes(t.query)):!0}var JR=require("node:path");function KR(e,t){if(t!=="executions"&&t!=="conversations")return[...e];let n=new Map;for(let i of e){let r=t==="executions"?i.execution_id:i.conversation_id;if(r==null)continue;let o=n.get(r)??{...i,id:r,duration_ms:null,total_tokens:null,cost:null};i.phase==="execution"&&i.parent_run_id===null&&i.duration_ms!==null&&(o.duration_ms=(o.duration_ms??0)+i.duration_ms),i.total_tokens!==null&&(o.total_tokens=(o.total_tokens??0)+i.total_tokens),i.cost!==null&&(o.cost=(o.cost??0)+i.cost),i.started_at<o.started_at&&(o.started_at=i.started_at),(o.finished_at===null||i.finished_at!==null&&i.finished_at>o.finished_at)&&(o.finished_at=i.finished_at),n.set(r,o)}return[...n.values()].sort((i,r)=>r.started_at.localeCompare(i.started_at))}function GR(e,t,n,i){return e.flatMap(r=>{let o=r.data,a=typeof o?.created_at=="string"?o.created_at:null;if(a===null||n!==null&&a<n||i!==null&&a>i)return[];let s=o?.source;if(s===null||typeof s!="object"||!("type"in s))return[];let l=s;return l.type==="task"&&typeof l.task_id=="string"||l.type==="spec"&&typeof l.spec_id=="string"||l.type==="prd"&&typeof l.prd_id=="string"?[{id:r.id,title:r.title??(typeof o?.title=="string"?o.title:r.id),created_at:a,status:r.status??(typeof o?.status=="string"?o.status:"unclassified"),risk:r.risk??(typeof o?.risk=="string"?o.risk:"unclassified"),source:l,requirement_ids:Ph(o?.requirement_ids),acceptance_ids:Ph(o?.acceptance_ids),task_ids:Ph(o?.task_ids),result:typeof o?.result=="string"?o.result:null,artifact_path:t.activePath("change",r.id)}]:[]}).sort((r,o)=>o.created_at.localeCompare(r.created_at))}function XR(e,t,n,i){return e.flatMap(r=>{let o=r.data,a=typeof o?.created_at=="string"?o.created_at:null;return a===null||n!==null&&a<n||i!==null&&a>i||o?.origin!=="human"&&o?.origin!=="agent"||o?.scope_type!=="change"&&o?.scope_type!=="execution"||typeof o?.scope_id!="string"?[]:[{id:r.id,title:r.title??(typeof o?.title=="string"?o.title:r.id),origin:o.origin,scope_type:o.scope_type,scope_id:o.scope_id,artifact_path:`${JR.posix.dirname(t.activePath(o.scope_type,o.scope_id))}/decisions/${r.id}.md`,created_at:a}]}).sort((r,o)=>o.created_at.localeCompare(r.created_at))}function Ph(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function mo(e){return{query:(e.req.query("query")??"").trim().toLocaleLowerCase(),status:(e.req.query("status")??"").trim(),risk:(e.req.query("risk")??"").trim()}}function YR(e,t){return e.filter(n=>t.status&&n.status!==t.status?!1:t.query?[n.id,n.task_id,n.execution_id,n.conversation_id,n.parent_run_id,n.run_kind,n.phase,n.agent].some(i=>typeof i=="string"&&i.toLocaleLowerCase().includes(t.query)):!0)}function QR(e,t){return e.filter(n=>t.status&&n.status!==t.status||t.risk&&n.risk!==t.risk?!1:t.query?[n.id,n.title,n.status,n.risk,n.source,n.origin,n.scope_type,n.scope_id].flatMap(i=>typeof i=="object"&&i!==null?Object.values(i):[i]).some(i=>typeof i=="string"&&i.toLocaleLowerCase().includes(t.query)):!0)}function Nt(e){let t=e.req.query("from")??null,n=e.req.query("to")??null;return{from:e$(t,"start"),to:e$(n,"end")}}function e$(e,t){if(e===null||!/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let n=t$(e);if(t==="start")return new Date(n).toISOString();let[i,r,o]=e.split("-").map(Number),a=new Date(Date.UTC(i,r-1,o+1)).toISOString().slice(0,10);return new Date(t$(a)-1).toISOString()}function t$(e){let[t,n,i]=e.split("-").map(Number),r=Date.UTC(t,n-1,i),o=r-n$(r);return o=r-n$(o),o}function n$(e){let n=new Intl.DateTimeFormat("en-US",{timeZone:"America/Sao_Paulo",timeZoneName:"longOffset"}).formatToParts(new Date(e)).find(o=>o.type==="timeZoneName")?.value??"GMT",i=/^GMT([+-])(\d{2}):(\d{2})$/.exec(n);if(i===null)return 0;let r=Number(i[2])*60+Number(i[3]);return(i[1]==="+"?1:-1)*r*6e4}function r$(e,t,n,i){e.on(["GET","HEAD"],"/api/v2/operations/read-models",async r=>{let o=r.req.query("kind");if(!["overview","tasks","specs","prds","executions","conversations"].includes(o))return i(r,{error:"Unsupported daily read model"},400,!1);let a=Math.max(0,Number.parseInt(r.req.query("offset")??"0",10)||0),s=Math.min(200,Math.max(1,Number.parseInt(r.req.query("limit")??"20",10)||20)),{from:l,to:c}=Nt(r),d=mo(r),u=await n(`operations:read-model:${o}:${l??""}:${c??""}:${a}:${s}:${r.req.query("cursor")??""}:${d.query}:${d.status}:${d.risk}`,async()=>{let _=await new Ut(t).readDailyReadModels(o);return _===null?{data_source:"lifecycle_daily_read_models",snapshot_id:null,source_latest_at:null,kind:o,offset:a,limit:s,total:0,has_more:!1,next_cursor:null,rows:[]}:b_(_,o,{from:l,to:c},d,a,s,r.req.query("cursor")??null)});return i(r,u,200,!0)})}bi();function i$(e,t,n,i){e.on(["GET","HEAD"],"/api/v2/operations/runs",async r=>{let o=Math.max(0,Number.parseInt(r.req.query("offset")??"0",10)||0),a=Math.min(200,Math.max(1,Number.parseInt(r.req.query("limit")??"100",10)||100)),{from:s,to:l}=Nt(r),c=r.req.query("kind")??"runs",d=mo(r),u=await n(`operations:runs:${c}:${s??""}:${l??""}:${o}:${a}:${d.query}:${d.status}:${d.risk}`,async()=>{if(c==="executions"||c==="conversations"){let f=await new Ut(t).readDailyReadModels(c);if(f!==null){let h=b_(f,c,{from:s,to:l},d,o,a);return FJ(c,h,h.rows)}}let p=(JSON.parse(await t.readText(".agents/records/lifecycle/summary.json")).run_metrics??[]).filter(f=>(s===null||f.started_at>=s)&&(l===null||f.started_at<=l)&&(c==="runs"||c==="conversations"&&f.phase==="conversation"&&f.conversation_id!==null||c==="executions"&&f.execution_id!==null)),v=YR(KR(p,c),d);return{data_source:"lifecycle_manifest_summary",kind:c,offset:o,limit:a,total:v.length,rows:v.slice(o,o+a)}});return i(r,u,200,!0)})}function FJ(e,t,n){let i=r=>r.complete||r.known_sum>0?r.known_sum:null;return{data_source:t.data_source,kind:e,offset:t.offset,limit:t.limit,total:t.total,rows:n.map(r=>({id:r.id,started_at:r.occurred_at,finished_at:null,task_id:r.kind==="execution"?r.parent_id:null,execution_id:r.kind==="execution"?r.id:r.parent_id,conversation_id:r.kind==="conversation"?r.id:null,parent_run_id:null,run_kind:"run",phase:r.kind,status:r.status,duration_ms:i(r.metrics.duration),lifecycle_elapsed_ms:r.lifecycle_elapsed_ms??null,total_tokens:i(r.metrics.total_tokens),cost:i(r.metrics.cost),currency:r.cost_currency}))}}Zr();Gs();function ic(e,t){let n=new Map(e.map(i=>[i.id,i]));for(let i of t.map(r=>Mh(r,t))){let r=n.get(i.id);if(r===void 0){n.set(i.id,i);continue}n.set(i.id,{...i,...r,usage:qJ(r.usage,i.usage),provider:r.provider??i.provider,model:r.model==="unknown"?i.model:r.model,reasoning_effort:r.reasoning_effort??i.reasoning_effort,service_tier:r.service_tier??i.service_tier??null,call_count:r.call_count??i.call_count,terminal_call_count:r.terminal_call_count??i.terminal_call_count,...(r.pricing_segments?.length??0)>0?{pricing_segments:r.pricing_segments}:i.pricing_segments===void 0?{}:{pricing_segments:i.pricing_segments},...r.duration_ms!==null&&(r.source_duration_ms===null||r.source_duration_ms===0)?{duration_ms:r.duration_ms,source_duration_ms:null,source_started_at:null,source_finished_at:null,capture_lag_ms:null}:VJ(r)})}return[...n.values()]}function qJ(e,t){let n=(i,r)=>({...r,...i,tokens:{...r.tokens,...i.tokens,input:i.tokens.input??r.tokens.input,cached_input:i.tokens.cached_input??r.tokens.cached_input,output:i.tokens.output??r.tokens.output,reasoning:i.tokens.reasoning??r.tokens.reasoning,total:i.tokens.total??r.tokens.total},cost:{...r.cost,...i.cost,usd:i.cost.usd??r.cost.usd,brl:i.cost.brl??r.cost.brl}});return{conversation:n(e.conversation,t.conversation),planning:n(e.planning,t.planning),execution:n(e.execution,t.execution),total:n(e.total,t.total),new_work:n(e.new_work,t.new_work),rework:n(e.rework,t.rework)}}function VJ(e){return{duration_ms:e.duration_ms,...typeof e.source_duration_ms=="number"?{duration_provenance:"observed"}:e.duration_provenance===void 0?{}:{duration_provenance:e.duration_provenance},estimation_basis:typeof e.source_duration_ms=="number"?null:e.estimation_basis??null,source_duration_ms:e.source_duration_ms??null,source_started_at:e.source_started_at??null,source_finished_at:e.source_finished_at??null,capture_lag_ms:e.capture_lag_ms??null}}function Mh(e,t){let n=Array.isArray(e.usage_segments)?e.usage_segments:[],i=u=>n.length===0||n.some(_=>!ZJ(_.tokens?.[u]))?null:n.reduce((_,p)=>_+(p.tokens?.[u]??0),0),r=e.quantitative_metrics.tokens_total,o=e.quantitative_metrics.estimated_usd,a=e.quantitative_metrics.estimated_brl,s={events:e.source_event_count,tokens:{input:i("input"),cached_input:i("cached_input"),output:i("output"),reasoning:i("reasoning"),total:r.known_sum},cost:{usd:e.historical_cost?.estimated_usd??o.known_sum,brl:e.historical_cost?.estimated_brl??a.known_sum},coverage:{events:e.source_event_count,tokens:r.complete,usd:o.complete,brl:a.complete}},l={...s,events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},c=e.phase==="execution"?s:l,d=e.invocation_kind==="delegated";return{id:e.run_id,artifact_path:`.agents/records/runs/${e.run_id}`,status:e.status??"completed",phase:e.phase??"execution",entrypoint:e.task_id===null?"conversation":"task",work_type:"new",run_role:d?"subagent":"orchestrator",run_kind:d?"subrun":"run",run_purpose:WJ(e.purpose,d),requires_finalizer:!1,parent_run_id:t.find(u=>u.agent_invocation_id===e.parent_agent_invocation_id)?.run_id??null,client:"codex",agent:e.zaip_agent??"unknown",agent_name:e.zaip_agent??"unknown",provider:n.find(u=>typeof u.provider=="string")?.provider??null,model:n.find(u=>typeof u.model=="string")?.model??"unknown",reasoning_effort:n.find(u=>typeof u.reasoning_effort=="string")?.reasoning_effort??null,effective_model:null,effective_reasoning_effort:null,effective_config_mixed:!1,service_tier:n.find(u=>typeof u.service_tier=="string")?.service_tier??null,call_count:e.llm_call_count,terminal_call_count:e.llm_call_count,failed_call_count:e.status==="failed"?e.llm_call_count:0,cancelled_call_count:e.status==="cancelled"?e.llm_call_count:0,conversation_id:e.agent_invocation_id,execution_id:e.execution_id,task_id:e.task_id,spec_id:e.spec_id,prd_id:e.prd_id,change_id:e.change_id,started_at:e.occurred_at,finished_at:e.status===null?null:e.occurred_at,duration_ms:e.time.duration_ms,source_duration_ms:e.time.duration_ms,source_started_at:null,source_finished_at:e.time.source_latest_at,pricing_segments:n.map(u=>({phase:"execution",provider:u.provider,model:u.model,service_tier:u.service_tier,input_tokens:u.tokens?.input??null,cached_input_tokens:u.tokens?.cached_input??null,output_tokens:u.tokens?.output??null,reasoning_tokens:u.tokens?.reasoning??null,total_tokens:u.tokens?.total??null})),usage:{conversation:l,planning:l,execution:c,total:s,new_work:s,rework:l}}}function WJ(e,t){return e==="intake"||e==="orchestration"||e==="execution"||e==="review"||e==="audit"||e==="finalization"?e:t?"execution":"orchestration"}function ZJ(e){return typeof e=="number"&&Number.isFinite(e)}vt();Zr();function Gr(e){return e.req.query("currency")==="USD"?"USD":"BRL"}function lt(e,t){let n=e.req.query(t);return n===void 0||n===""?[]:n.split(",").filter(Boolean)}async function Lh(e,t){let n=new Map,i=new Map,r=1,o=!0;for(;o;){let a=await DA(e,{...t,cache:n,page:r,page_size:500});for(let s of a.summaries)BJ(s)&&i.set(s.agent_invocation_id,s);o=a.has_more,r+=1}return[...i.values()]}function BJ(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.agent_invocation_id=="string"&&typeof t.root_agent_invocation_id=="string"&&(t.parent_agent_invocation_id===null||typeof t.parent_agent_invocation_id=="string")&&(t.invocation_kind==="orchestrator"||t.invocation_kind==="delegated")&&typeof t.run_id=="string"&&typeof t.quantitative_metrics=="object"&&t.quantitative_metrics!==null&&typeof t.time=="object"&&t.time!==null&&Array.isArray(t.usage_segments)}async function o$(e){try{let t=ii(ht(await e.readText(".agents/config/agents/catalog.yaml"))).agents;return{agentNames:t.map(n=>n.codex_name),agentNamesById:Object.fromEntries(t.map(n=>[n.id,n.codex_name])),agentNamesByRole:Object.fromEntries(t.map(n=>[n.role,n.codex_name]))}}catch{return{agentNames:[],agentNamesById:{},agentNamesByRole:{}}}}var HJ=".agents/dashboard/work-priority.json";async function k_(e,t,n,i=!1,r=!1){let o=await Ks(e,t,n,{overviewOnly:i,includeOverviewChanges:r}),a=JJ(o,await w_(e,E_(o)));if(i||n.from===null||n.to===null)return a;let s=await Lh(e,{from:n.from,to:n.to});return s.length===0?a:Yd({...a,runs:Tr(c$(a.runs,s))})}async function w_(e,t){try{let n=jh(JSON.parse(await e.readText(HJ)),!1);return t===void 0?n:{...n,item_ids:n.item_ids.filter(i=>t.has(i))}}catch{return{schema_version:1,item_ids:[],updated_at:null}}}function E_(e){return new Set([...e.prds.map(t=>t.id),...e.specs.map(t=>t.id),...e.tasks.map(t=>t.id)])}function jh(e,t=!0){let n=typeof e=="object"&&e!==null?e:{};return{schema_version:1,item_ids:Array.isArray(n.item_ids)?[...new Set(n.item_ids.filter(r=>typeof r=="string"&&r.length>0))]:[],updated_at:typeof n.updated_at=="string"&&!t?n.updated_at:new Date().toISOString()}}function JJ(e,t){let n=new Map(t.item_ids.map((r,o)=>[r,o])),i=r=>n.get(r)??null;return{...e,prds:e.prds.map(r=>({...r,manual_order:i(r.id)})),specs:e.specs.map(r=>({...r,manual_order:i(r.id)})),tasks:e.tasks.map(r=>({...r,manual_order:i(r.id)}))}}async function ha(e,t,n){let i=new hi(e),[r,o]=await Promise.all([i.readCatalog(),n==="BRL"?i.readLatestFxRate():Promise.resolve(null)]),a=await o$(e);return pd(t,{catalog:r,fxRate:o,currency:n},a)}async function s$(e,t,n){let i=n.req.query("from")??null,r=n.req.query("to")??null;if(i===null||r===null)return ha(e,t,Gr(n));let o={providers:lt(n,"provider"),models:lt(n,"model"),zaip_agents:lt(n,"agent"),phases:lt(n,"phase"),statuses:lt(n,"status")},a=await Lh(e,{from:i,to:r,filters:o});if(a.length===0)return ha(e,t,Gr(n));let s=Tr(c$(t.runs,a));return ha(e,{...t,runs:s},Gr(n))}function c$(e,t){let n=new Set(e.map(i=>i.id));return ic(e,t.filter(i=>n.has(i.run_id)))}async function l$(e,t,n,i,r,o){let a=await GJ(e,i.from,i.to),{from:s,to:l}=a,c={providers:lt(n,"provider"),models:lt(n,"model"),zaip_agents:lt(n,"agent"),phases:lt(n,"phase"),statuses:lt(n,"status")},d=c.providers.length>0||c.models.length>0||c.zaip_agents.length>0||c.statuses.length>0,[u,_,p]=await Promise.all([Promise.resolve().then(()=>(Gs(),ZO)).then(({buildQuickOperationsProjection:b})=>b(e,t,{from:s,to:l})),Zm(e,{from:s,to:l,filters:c,offset:r,limit:o}),e.readText(".agents/records/lifecycle/summary.json").then(b=>JSON.parse(b))]),v=(p.run_metrics??[]).filter(b=>XJ(b.finished_at??b.started_at,s,l)).sort((b,T)=>(T.finished_at??T.started_at).localeCompare(b.finished_at??b.started_at)||b.id.localeCompare(T.id)),f=c.phases.length===0?v:v.filter(b=>b.phase!==null&&c.phases.includes(b.phase)),h=new Set(_.summaries.map(b=>b.run_id)),k=d?f.filter(b=>h.has(b.id)).map(a$):f.slice(r,r+o).map(a$),w=KJ(k,_.summaries),O=Tr(w),g=await ha(e,{...u,runs:O},Gr(n));return{...g,page_only:!0,overview:{...g.overview,run_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},groups:{conversations:[],tasks:[],providers:[],agents:[],models:[],daily:[],monthly:[],annual:[]},run_page:{offset:r,limit:o,total:d?null:f.length,has_more:d?_.has_more:r+o<f.length}}}function KJ(e,t){let n=new Set(e.map(o=>o.id)),i=ic(e,t.filter(o=>n.has(o.run_id))),r=new Map(i.map(o=>[o.id,o]));return e.map(o=>r.get(o.id)??o)}function a$(e){let t={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},n={...t,events:e.events??0,tokens:{...t.tokens,total:e.total_tokens},cost:{usd:null,brl:e.currency==="BRL"?e.cost:null},coverage:{events:e.events??0,tokens:e.total_tokens===null?0:1,usd:0,brl:e.cost===null?0:1}};return{id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status==="failed"||e.status==="cancelled"||e.status==="running"?e.status:"completed",phase:e.phase??"execution",entrypoint:e.task_id===null?"conversation":"task",work_type:"new",run_role:e.run_kind==="subrun"?"subagent":"orchestrator",run_kind:e.run_kind??"run",run_purpose:"execution",requires_finalizer:!1,parent_run_id:e.parent_run_id,client:"unknown",agent:e.agent??"unknown",agent_name:e.agent_name??e.agent??"unknown",provider:e.provider,model:e.model??"unknown",reasoning_effort:null,effective_model:e.model,effective_reasoning_effort:null,effective_config_mixed:!1,call_count:null,terminal_call_count:null,failed_call_count:0,cancelled_call_count:0,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id,task_id:e.task_id,spec_id:e.spec_id,prd_id:e.prd_id,change_id:e.change_id,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.duration_ms,usage:{conversation:t,planning:t,execution:n,total:n,new_work:n,rework:t}}}async function GJ(e,t,n){if(t!==null&&n!==null)return{from:t,to:n};let i=await e.readText(".agents/records/lifecycle/summary.json").then(l=>JSON.parse(l)),r=Object.keys(i.periods?.daily??{}).sort(),o=r.at(0),a=r.at(-1),s=new Date().toISOString().slice(0,10);return{from:S_(t??o??s,"start"),to:S_(n??a??s,"end")}}function XJ(e,t,n){let i=Date.parse(e),r=Date.parse(S_(t,"start")),o=Date.parse(S_(n,"end"));return Number.isFinite(i)&&Number.isFinite(r)&&Number.isFinite(o)&&i>=r&&i<=o}function S_(e,t){return/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T${t==="start"?"00:00:00.000":"23:59:59.999"}Z`:e}async function Dh(e){return new hi(e).readLatestFxRate()}function u$(e){return["provider","model","agent","phase","status"].every(t=>(e.req.queries(t)?.length??0)===0)}var _$=require("node:child_process"),p$=require("node:crypto"),Uh=require("node:path"),f$=require("node:util"),d$=".agents/dashboard/dashboard.config.json",m$=(0,f$.promisify)(_$.execFile);async function g$(e,t){let n=process.env.ZAIP_DASHBOARD_TITLE?.trim()||"Dashboard Zaip AIOS SQLite",i="auto";try{if(await e.exists(d$)){let r=JSON.parse(await e.readText(d$));typeof r.title=="string"&&r.title.trim()&&(n=r.title.trim()),typeof r.github_repository=="string"&&(i=r.github_repository.trim())}}catch{}if(i.toLowerCase()!=="auto")return{title:n,repository_name:A_(i)??""};try{let{stdout:r}=await m$("git",["-C",t,"remote","get-url","origin"],{encoding:"utf8",windowsHide:!0});return{title:n,repository_name:A_(r)??""}}catch{return{title:n,repository_name:""}}}function A_(e){let t=e.trim(),n=t.match(/github\.com(?::|\/)([^/\s]+)\/([^/\s]+?)(?:\.git)?$/i)??t.match(/^([^/:\s]+)\/([^/\s]+?)(?:\.git)?$/);return n?`${n[1]}/${n[2]}`:null}function T_(e){return(0,p$.createHash)("sha256").update(`${(0,Uh.resolve)(e)}:dashboard-sqlite`).digest("hex").slice(0,16)}async function h$(e,t){if(!await e.exists(".agents/runtime/bin/zaip.mjs"))return{reconciled_ids:[],blocked:[],not_reconciled:[]};let n=(0,Uh.resolve)(t,".agents","runtime","bin","zaip.mjs"),{stdout:i}=await m$(process.execPath,[n,"run","reconcile","--open","--json"],{cwd:t,windowsHide:!0,timeout:12e4,maxBuffer:10*1024*1024});return zh(JSON.parse(i))}function zh(e){let t=new Set,n=new Map,i=new Map,r=(u,_,p)=>{typeof _=="string"&&u.set(_,typeof p=="string"&&p.trim()?p:null)},o=typeof e=="object"&&e!==null?e:{},a=Array.isArray(o.reconciliations)?o.reconciliations:[];for(let u of a){if(typeof u!="object"||u===null)continue;let _=u,p=_.error,v=["tasks","changes","executions","specs","prds"].flatMap(f=>Array.isArray(_[f])?_[f]:[]);for(let f of v){if(typeof f!="object"||f===null)continue;let h=f;_.status==="closed"&&["completed","blocked","cancelled","failed"].includes(h.status)&&typeof h.id=="string"&&t.add(h.id),h.status==="blocked"?r(n,h.id,h.status_reason??p):_.status==="deferred"&&r(i,h.id,p)}}(Array.isArray(o.orphaned_executions)?o.orphaned_executions:[]).forEach(u=>{r(n,u,"Execution orphaned after the reconciliation grace period.")}),(Array.isArray(o.reconciliation_errors)?o.reconciliation_errors:[]).forEach(u=>{if(typeof u!="object"||u===null)return;let _=u;r(i,_.run_id,_.error)}),(Array.isArray(o.unresolved_running_run_ids)?o.unresolved_running_run_ids:[]).forEach(u=>{r(i,u,"Invocation is still running.")});let d=u=>[...u.entries()].map(([_,p])=>({id:_,reason:p})).sort((_,p)=>_.id.localeCompare(p.id));return{reconciled_ids:[...t].sort(),blocked:d(n),not_reconciled:d(i)}}var bn=require("node:crypto"),et=require("node:fs/promises"),st=require("node:path"),Ci=require("node:sqlite");vt();Zr();Os();var b$=".local/dashboard-sqlite/read-model.sqlite",YJ=new Set([".json",".jsonl",".md",".yaml",".yml",".txt"]),go="60",QJ=["zaip_aios_activities","zaip_dim_llm_model","zaip_dim_provider","zaip_dim_zaip_agent","cost_invocation_dimension_facts"],eK=["zaip_activities_agent_run","zaip_activities_relationships","zaip_activities_task_day","zaip_activities_spec_day","zaip_activities_prd_day","zaip_activities_agent","zaip_activities_run_id","zaip_activities_run_hierarchy","zaip_activities_period","zaip_activities_period_invocation","zaip_activities_status","zaip_activities_payload","cost_dimension_facts_day_model","cost_dimension_facts_day_provider","cost_dimension_facts_invocation"],tK=["zaip_vw_read_model_metadata","zaip_vw_operations_overview","zaip_vw_cost_overview","zaip_vw_cost_models","zaip_vw_cost_providers","zaip_vw_operations_agent_invocations"],Wh=2*36e5;function Xr(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0&&!["unavailable","unknown","mixed"].includes(t.toLowerCase())?t:null}function nK(){let e=new Intl.DateTimeFormat("en-CA",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date),t=Object.fromEntries(e.map(i=>[i.type,i.value])),n=`${t.year}-${t.month}-${t.day}`;return{from:`${t.year}-${t.month}-01`,to:n}}function rK(e){let t=["model","provider"],n=new Set(e.prepare("SELECT provider FROM zaip_dim_provider").all().map(u=>u.provider)),i=e.prepare(`SELECT activity_row_id, agent_invocation_id, task_id, duration_ms,
347
+ source_event_count, provider, model, total_tokens, cost_usd, cost_brl
348
+ FROM zaip_aios_activities WHERE payload_type IS NULL`).all(),r=e.prepare(`SELECT agent_invocation_id, provider, model, total_tokens, cost_usd, cost_brl
349
+ FROM invocation_usage_segments`).all(),o=new Map(i.filter(u=>typeof u.agent_invocation_id=="string").map(u=>[String(u.agent_invocation_id),u])),a=new Map(t.map(u=>[u,new Map])),s=(u,_)=>{let p=a.get(u),v=p.get(_);if(v!==void 0)return v;let f={key:_,label:_,invocation_count:0,task_count:0,total_duration:null,source_event_count:null,total_tokens:null,total_cost_usd:null,total_cost_brl:null};return p.set(_,f),f},l=(u,_,p)=>{typeof p=="number"&&(u[_]=(u[_]??0)+p)},c=new Map;for(let u of r){let _=String(u.agent_invocation_id??"");if(_.length===0)continue;let p=c.get(_);p===void 0?c.set(_,[u]):p.push(u)}for(let[u,_]of c){let p=o.get(u);if(p!==void 0)for(let v of t){let f=_.filter(k=>Xr(k[v])!==null&&Xr(k.provider)!==null&&n.has(Xr(k.provider))&&(typeof k.total_tokens=="number"||typeof k.cost_usd=="number"||typeof k.cost_brl=="number")),h=[...new Set(f.map(k=>Xr(k[v])))];if(h.length===0){let k=s(v,"unavailable");k.invocation_count+=1,typeof p.duration_ms=="number"&&(k.total_duration=(k.total_duration??0)+p.duration_ms),typeof p.source_event_count=="number"&&(k.source_event_count=(k.source_event_count??0)+p.source_event_count),l(k,"total_tokens",p.total_tokens),l(k,"total_cost_usd",p.cost_usd),l(k,"total_cost_brl",p.cost_brl)}for(let k of f){let w=s(v,Xr(k[v]));l(w,"total_tokens",k.total_tokens),l(w,"total_cost_usd",k.cost_usd),l(w,"total_cost_brl",k.cost_brl)}if(h.length===1){let k=s(v,h[0]);k.invocation_count+=1,typeof p.duration_ms=="number"&&(k.total_duration=(k.total_duration??0)+p.duration_ms),typeof p.source_event_count=="number"&&(k.source_event_count=(k.source_event_count??0)+p.source_event_count)}}}let d=new Map(t.map(u=>[u,new Map]));for(let[u,_]of c){let p=o.get(u)?.task_id;if(typeof p=="string")for(let v of t){let f=d.get(v),h=f.get(p)??new Set;for(let k of _){let w=Xr(k[v]),O=Xr(k.provider),g=typeof k.total_tokens=="number"||typeof k.cost_usd=="number"||typeof k.cost_brl=="number";w!==null&&O!==null&&n.has(O)&&g&&h.add(w)}f.set(p,h)}}for(let u of t)for(let _ of d.get(u).values())for(let p of _)s(u,p).task_count+=1;for(let u of i){if(typeof u.agent_invocation_id=="string"||!(typeof u.total_tokens=="number"||typeof u.cost_usd=="number"||typeof u.cost_brl=="number"))continue;let p=Xr(u.provider);if(!(p===null||!n.has(p)))for(let v of t){let f=Xr(u[v])??"unavailable",h=s(v,f);h.invocation_count+=1,typeof u.task_id=="string"&&(h.task_count+=1),typeof u.duration_ms=="number"&&(h.total_duration=(h.total_duration??0)+u.duration_ms),typeof u.source_event_count=="number"&&(h.source_event_count=(h.source_event_count??0)+u.source_event_count),l(h,"total_tokens",u.total_tokens),l(h,"total_cost_usd",u.cost_usd),l(h,"total_cost_brl",u.cost_brl)}}return Object.fromEntries(t.map(u=>[u,[...a.get(u).values()].sort((_,p)=>(p.total_cost_brl??-1)-(_.total_cost_brl??-1)||_.key.localeCompare(p.key))]))}function iK(e){return e===".agents/config/project.yaml"||e===".agents/config/framework.lock.yaml"||e===".agents/config/agents/catalog.yaml"||e===".agents/config/clients.yaml"||e.startsWith(".agents/config/pricing/")||e.startsWith(".agents/records/runs/")&&e.endsWith(".jsonl")||/^\.agents\/records\/(tasks|specs|prds)\/.*\.md$/.test(e)||/^\.agents\/records\/executions\/.*\/execution\.md$/.test(e)?!0:/^\.agents\/records\/changes\/.*\/(change\.md|decisions\/.*\.md|artifacts\/(evidence|validations)\/.*\.md)$/.test(e)}function oK(e){let t=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(e)?.[1];if(t===void 0)return null;try{let n=ht(t);return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function y$(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ut(e){return typeof e=="string"&&e.length>0?e:null}function Fh(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function aK(e){let t=[],n=[],i=[];for(let r of e){let o=oK(r.content);if(o===null)continue;let a=ut(o.id),s=ut(o.created_at);if(!(a===null||s===null||Number.isNaN(Date.parse(s)))){if(/^\.agents\/records\/executions\/.*\/execution\.md$/.test(r.path)){let l=y$(o.origin),c=ut(l?.type),d=c==="interaction"?ut(l?.conversation_id):c==="task"?ut(l?.task_id):c==="spec"?ut(l?.spec_id):c==="prd"?ut(l?.prd_id):null;t.push({id:a,status:ut(o.status),kind:ut(o.kind),originType:c,originId:d,createdAt:s,finishedAt:ut(o.finished_at),sourcePath:r.path});continue}if(/^\.agents\/records\/changes\/.*\/change\.md$/.test(r.path)){let l=y$(o.source),c=ut(l?.type),d=c==="task"?ut(l?.task_id):c==="spec"?ut(l?.spec_id):c==="prd"?ut(l?.prd_id):null;if(c===null||d===null)continue;n.push({id:a,title:ut(o.title)??a,status:ut(o.status)??"unclassified",risk:ut(o.risk)??"unclassified",sourceType:c,sourceId:d,sourceSpecId:ut(l?.spec_id),sourcePrdId:ut(l?.prd_id),requirementIds:Fh(o.requirement_ids),acceptanceIds:Fh(o.acceptance_ids),taskIds:Fh(o.task_ids),result:ut(o.result),createdAt:s,sourcePath:r.path});continue}if(/^\.agents\/records\/(changes|executions)\/.*\/decisions\/.*\.md$/.test(r.path)){let l=o.origin,c=o.scope_type,d=ut(o.scope_id);if(l!=="human"&&l!=="agent"||c!=="change"&&c!=="execution"||d===null)continue;i.push({id:a,title:ut(o.title)??a,origin:l,scopeType:c,scopeId:d,createdAt:s,sourcePath:r.path})}}}return{executions:t,changes:n,decisions:i}}function sK(e){let t=new Map;for(let n of e){let i=/^\.agents\/records\/(tasks|specs|prds|changes|executions|conversations)\//.exec(n.path);if(i===null)continue;let r=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(n.content)?.[1];if(r===void 0)continue;let o=l=>{let c=new RegExp(`^${l}:\\s*(.+?)\\s*$`,"m").exec(r)?.[1]?.trim();return c===void 0||c==="null"?null:c.replace(/^['"]|['"]$/g,"")},a=o("id");if(a===null)continue;let s=i[1]?.slice(0,-1);s!==void 0&&t.set(`${s}:${a}`,{kind:s,id:a,title:o("title"),status:o("status"),stage:o("stage"),risk:o("risk"),occurredAt:o("created_at")??o("started_at")??o("recorded_at")})}return t}function cK(e,t){let n=new Map;for(let i of(e??"").split(/^ {2}- id: /m).slice(1)){let r=i.slice(0,i.indexOf(`
350
+ `)).trim(),o=/\bcodex_name:\s*([^\s#]+)/.exec(i)?.[1]??null;if(o===null)continue;let a=/persona:\s*\{\s*nome:\s*([^,}\s]+),\s*cargo:\s*([^,}\s]+)\s*\}/.exec(i),s=/\brole:\s*([^\s#]+)/.exec(i)?.[1]??null,l={catalogId:r,persona:a?.[1]??null,job:a?.[2]??null,role:s},c=new Set([o,r]);for(let d of i.matchAll(/^ {8}- kind:\s*(?:id|codex_name|codex_task_name)\s*\r?\n {10}value:\s*([^\s#]+)/gm)){let u=d[1];u!==void 0&&c.add(u)}for(let d of[...c])d.startsWith("agent-")&&c.add(`zaip-${d}`);for(let d of c)n.set(d,l)}return/^ {2}- id:\s*codex\s*$/m.test(t??"")&&n.set("codex",{catalogId:"client:codex",persona:"codex",job:"client_host",role:"host"}),n}function lK(e){return e.prd_id!==null&&e.execution_id===null||e.spec_id!==null&&e.execution_id===null||e.phase==="planning"||e.purpose==="planning"?"planning":e.execution_id!==null||e.task_id!==null||e.phase==="execution"||e.purpose==="implementation"?"development":"conversation"}function ya(e,t){let n=e.map(i=>i.tokens[t]).filter(i=>typeof i=="number");return n.length===0?null:n.reduce((i,r)=>i+r,0)}function $i(e){let t=[...new Set(e.filter(n=>typeof n=="string"&&n.length>0&&n!=="unavailable"))];return t.length===0?null:t.length===1?t[0]:"mixed"}function x_(e,t,n){return e==="openai"||e==="anthropic"?e:e==="unavailable"||t==="unavailable"||t===null?null:ad(t,n,"")}function uK(e){return typeof e.duration_ms=="number"&&(e.duration_provenance==="observed"||e.duration_provenance==="reconciled"||e.duration_provenance==="legacy_inferred")}function dK(e){let t=e.flatMap(r=>{let o=r.source_started_at,a=r.source_finished_at,s=typeof o=="string"?Date.parse(o):Number.NaN,l=typeof a=="string"?Date.parse(a):Number.NaN;return typeof o=="string"&&typeof a=="string"&&Number.isFinite(s)&&Number.isFinite(l)&&l>s&&l-s<=Wh?[{start:o,end:a,startMs:s,endMs:l}]:[]});if(t.length===0)return null;let n=t.reduce((r,o)=>o.startMs<r.startMs?o:r),i=t.reduce((r,o)=>o.endMs>r.endMs?o:r);return i.endMs-n.startMs<=Wh?{start:n.start,end:i.end,duration:i.endMs-n.startMs}:null}function _K(e,t){let n=dK(e);if(n!==null)return{source:n.duration,effective:n.duration,provenance:"reconciled",sourceStartedAt:n.start,sourceFinishedAt:n.end};if(typeof t.finished?.duration_ms=="number"&&t.finished.duration_provenance!=="estimated"&&t.finished.duration_provenance!=="unavailable")return{source:t.finished.duration_ms,effective:t.finished.duration_ms,provenance:t.finished.duration_provenance??"observed",sourceStartedAt:null,sourceFinishedAt:null};let i=e.filter(uK);if(i.length>0){let a=i.reduce((l,c)=>l+(c.duration_ms??0),0),s=$i(i.map(l=>l.duration_provenance))??"observed";return{source:a,effective:a,provenance:s,sourceStartedAt:null,sourceFinishedAt:null}}let r=Date.parse(t.run.occurred_at),o=typeof t.finished?.occurred_at=="string"?Date.parse(t.finished.occurred_at):Number.NaN;return Number.isFinite(r)&&Number.isFinite(o)&&o>r&&o-r<=Wh?{source:null,effective:o-r,provenance:"reconciled",sourceStartedAt:null,sourceFinishedAt:null}:{source:null,effective:null,provenance:null,sourceStartedAt:null,sourceFinishedAt:null}}function pK(e){return e.flatMap(t=>{try{return[Ji.parse(JSON.parse(t.content))]}catch{return[]}}).sort((t,n)=>n.as_of.localeCompare(t.as_of))[0]??null}function fK(e,t,n,i){let r=0,o=0,a=!1,s=!1,l=!1,c=[],d=[];for(let _ of e){if(typeof _.cost.usd=="number"&&(r+=_.cost.usd,a=!0),typeof _.cost.brl=="number"&&(o+=_.cost.brl,s=!0),typeof _.cost.usd=="number"&&typeof _.cost.brl=="number"||_.tokens.total===null)continue;if(_.tokens.total===0){a=!0,s=!0;continue}let p=_.model??t.run.model;if(p===null||p==="unavailable")continue;let v=Gi({provider:x_(_.provider,p,t.run.client),model:p,usage:_.tokens,catalog:n,fxRate:i,serviceTier:_.runtime?.service_tier??null});typeof _.cost.usd!="number"&&v.estimated_usd!==null&&(r+=v.estimated_usd,a=!0,l=!0),typeof _.cost.brl!="number"&&v.estimated_brl!==null&&(o+=v.estimated_brl,s=!0,l=!0),v.pricing_model!==null&&c.push(v.pricing_model),v.pricing_source!==null&&d.push(v.pricing_source)}let u=ya(e,"total");return{usd:a?Math.round(r*1e6)/1e6:null,brl:s?Math.round(o*1e6)/1e6:null,method:u===0?"zero_no_llm_usage":l?"token_pricing_estimate":a||s?"canonical_recorded":null,pricingModel:$i(c),pricingSource:$i(d),fxRate:s?i?.rate??null:null}}function mK(e,t){if(t===null)return null;let n=t.toLowerCase(),i=r=>{let o=r.toLowerCase();if(n===o)return!0;let a=n.slice(o.length);return a.startsWith("@")||a.startsWith(":")||a.startsWith("/")||/^-\d{4}-\d{2}-\d{2}(?:$|[.:@/])/.test(a)};return e.models.find(r=>i(r.id)||r.aliases.some(o=>i(o)))??null}function gK(e,t,n,i){let r=e.model??t.run.model,o=x_(e.provider,r,t.run.client),a=e.runtime?.service_tier??null,s=mK(n,r),l=r===null?null:Gi({provider:o,model:r,usage:e.tokens,catalog:n,fxRate:i,serviceTier:a}),c=r===null?null:Gi({provider:o,model:r,usage:e.tokens,catalog:n,fxRate:i,serviceTier:"default"}),d=s?.long_context_threshold_tokens!==null&&s?.long_context_threshold_tokens!==void 0&&(e.tokens.input??0)>s.long_context_threshold_tokens,u=a==="priority"||a==="fast",_=u&&!d,p=s?_?s.priority_input_per_million_usd??null:s.input_per_million_usd:null,v=s?_?s.priority_cached_input_per_million_usd??null:s.cached_input_per_million_usd:null,f=s?_?s.priority_output_per_million_usd??null:s.output_per_million_usd:null,h=s?_?s.priority_reasoning_per_million_usd??s.priority_output_per_million_usd??null:s.reasoning_per_million_usd??s.output_per_million_usd:null,k=l?.estimated_usd!==null&&l!==null?l:c,w=k?.estimated_usd??null,O=c?.estimated_usd??null,g=e.cost.usd,b=g??w,T=e.cost.brl??l?.estimated_brl??(b!==null&&i!==null?Math.round(b*i.rate*1e6)/1e6:null);return{provider:o,model:r,serviceTier:a,uncachedInputTokens:e.tokens.input===null?null:Math.max(e.tokens.input-(e.tokens.cached_input??0),0),visibleOutputTokens:e.tokens.output===null?null:Math.max(e.tokens.output-(e.tokens.reasoning??0),0),inputRate:p,cachedRate:v,outputRate:f,reasoningRate:h,contextInputMultiplier:s?d?s.long_context_input_multiplier:1:null,contextOutputMultiplier:s?d?s.long_context_output_multiplier:1:null,speedCostMultiplier:w!==null&&O!==null&&O>0?Math.round(w/O*1e3)/1e3:null,pricingScenario:u&&d?"standard_long_context_fallback":u?"priority":"standard",standardUsd:O,speedUpliftUsd:w!==null&&O!==null?Math.round((w-O)*1e6)/1e6:null,inputUsd:k?.input_usd??null,cachedInputUsd:k?.cached_input_usd??null,outputUsd:k?.output_usd??null,reasoningUsd:k?.reasoning_usd??null,calculatedUsd:w,recordedUsd:g,effectiveUsd:b,effectiveBrl:T,varianceUsd:g!==null&&w!==null?Math.round((g-w)*1e6)/1e6:null,pricingModel:k?.pricing_model??null,pricingSource:k?.pricing_source??null,fxRate:e.cost.fx_rate??i?.rate??null}}function _n(e){let t=Object.fromEntries(new Intl.DateTimeFormat("en",{timeZone:"America/Sao_Paulo",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(e)).filter(n=>n.type!=="literal").map(n=>[n.type,n.value]));return`${t.year}-${t.month}-${t.day}`}function hK(e){let t=new Set;for(let r of e){t.add(r.startMs),t.add(r.endMs);for(let o=r.startMs;o<r.endMs;){let a=Date.parse(`${_n(new Date(o).toISOString())}T03:00:00.000Z`)+864e5;if(a>=r.endMs)break;t.add(a),o=a}}let n=[...t].sort((r,o)=>r-o),i=new Map;for(let r=0;r<n.length-1;r+=1){let o=n[r],a=n[r+1],s=e.filter(d=>d.startMs<a&&d.endMs>o);if(s.length===0||a<=o)continue;let l=(a-o)/s.length,c=_n(new Date(o).toISOString());for(let d of s){let u=`${d.activityRowId}:${c}`,_=i.get(u);i.set(u,{activityRowId:d.activityRowId,day:c,value:(_?.value??0)+l})}}return[...i.values()]}function Ht(e){return e==null?null:/^\d{4}-\d{2}-\d{2}$/.test(e)?e:_n(e)}function yK(e,t){let n=e.includes("/artifacts/evidence/")?"evidence":e.includes("/artifacts/validations/")?"validation":null;if(n===null)return null;let i=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t)?.[1]??"",r=a=>{let s=new RegExp(`^${a}:\\s*['"]?(.+?)['"]?\\s*$`,"m").exec(i)?.[1]?.trim();return s===void 0||s==="null"?null:s},o=r("observed_at")??r("executed_at")??r("created_at")??r("recorded_at");return o===null||Number.isNaN(Date.parse(o))?null:{kind:n,id:r("id")??e.slice(e.lastIndexOf("/")+1,-3),occurredAt:o,occurredDaySp:_n(o)}}function Zh(e){return(0,st.resolve)(process.env.ZAIP_SQLITE_DB_PATH??(0,st.resolve)(e,b$))}function oc(e){let t=new Ci.DatabaseSync(e,{readOnly:!0});try{let n=t.prepare("PRAGMA integrity_check").get();if(n.integrity_check!=="ok")throw new Error(`SQLite integrity check failed for ${e}: ${n.integrity_check??"unknown"}`);let i=t.prepare("SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view', 'index')").all(),r=i.filter(u=>u.type==="table").map(u=>u.name).sort(),o=[...QJ].sort();if(r.length!==o.length||r.some((u,_)=>u!==o[_]))throw new Error(`SQLite schema ${go} requires exactly five persisted tables; found ${r.join(", ")||"none"}`);let a=new Set(i.map(u=>u.name)),s=tK.filter(u=>!a.has(u));if(s.length>0)throw new Error(`SQLite schema is missing required views: ${s.join(", ")}`);let l=i.filter(u=>u.type==="view").map(u=>u.name);if(l.some(u=>!u.startsWith("zaip_vw_")))throw new Error("SQLite persisted views must use the zaip_vw_ namespace");let c=eK.filter(u=>!a.has(u));if(c.length>0)throw new Error(`SQLite schema is missing required indexes: ${c.join(", ")}`);let d=t.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("schema_version")?.value;if(d!==go)throw new Error(`SQLite schema version must be ${go}; found ${d??"missing"}`);return{schemaVersion:d,tableCount:r.length,viewCount:l.length,indexCount:i.filter(u=>u.type==="index"&&!u.name.startsWith("sqlite_")).length}}finally{t.close()}}async function ac(e,t={}){let n=Zh(e),i=performance.now(),r=await kK(e),o=(b,T,I)=>{process.env.ZAIP_DASHBOARD_LAUNCH_PROGRESS==="1"&&process.stderr.write(`${JSON.stringify({event:"dashboard_sqlite_rebuild_progress",phase:b,percent:T,detail:I})}
351
+ `)},{fingerprint:a}=r,s=Math.round(performance.now()-i),l=qh(n,a);if(l!==null)return oc(n),{files:l,path:n,cache:"generation",fingerprint_ms:s,materialize_ms:0};let c=(0,st.join)(process.env.ZAIP_SQLITE_CACHE_DIR??(0,st.join)((0,st.dirname)(n),"cache"),`v${go}-${(0,bn.createHash)("sha256").update(a).digest("hex")}.sqlite`),d=qh(c,a);if(d!==null){let b=performance.now();return await Vh(c,n),oc(n),{files:d,path:n,cache:"seed",fingerprint_ms:s,materialize_ms:Math.round(performance.now()-b)}}if(!t.forceCanonical&&process.env.ZAIP_SQLITE_PREFER_LAST_VALID_SEED==="1"){let b=await bK((0,st.dirname)(c));if(b!==null){let T=performance.now();return await Vh(b.path,n),{files:b.files,path:n,cache:"stale_seed",fingerprint_ms:s,materialize_ms:Math.round(performance.now()-T)}}}o("source_inventory",52,`Encontradas ${r.candidates.length} fontes can\xF4nicas.`),await(0,et.mkdir)((0,st.dirname)(c),{recursive:!0});let u=`${c}.${process.pid}.${(0,bn.randomUUID)()}.tmp`,_=new Ci.DatabaseSync(u),p=0;try{_.exec("PRAGMA journal_mode=DELETE; BEGIN IMMEDIATE;");try{_.exec(`
352
+ CREATE TEMP TABLE files (path TEXT PRIMARY KEY, content TEXT NOT NULL, mtime_ms INTEGER NOT NULL, size_bytes INTEGER NOT NULL, content_sha256 TEXT NOT NULL, artifact_kind TEXT, artifact_id TEXT, artifact_occurred_at TEXT, artifact_occurred_day_sp TEXT);
353
+ CREATE TEMP TABLE read_model_source_state (source_path TEXT PRIMARY KEY, source_hash TEXT NOT NULL, mtime_ms INTEGER NOT NULL, size_bytes INTEGER NOT NULL, source_kind TEXT NOT NULL, last_processed_at TEXT NOT NULL);
354
+ CREATE TEMP TABLE read_model_metadata (key TEXT PRIMARY KEY, value TEXT NOT NULL);
355
+ CREATE TEMP TABLE canonical_work_items (entity_kind TEXT NOT NULL, id TEXT NOT NULL, title TEXT, status TEXT, stage TEXT, risk TEXT, occurred_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, PRIMARY KEY(entity_kind, id));
356
+ CREATE TEMP TABLE canonical_executions (id TEXT PRIMARY KEY, status TEXT, kind TEXT, origin_type TEXT, origin_id TEXT, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, finished_at TEXT, source_path TEXT NOT NULL);
357
+ CREATE TEMP TABLE canonical_changes (id TEXT PRIMARY KEY, title TEXT NOT NULL, status TEXT NOT NULL, risk TEXT NOT NULL, source_type TEXT NOT NULL, source_id TEXT NOT NULL, source_spec_id TEXT, source_prd_id TEXT, requirement_ids_json TEXT NOT NULL, acceptance_ids_json TEXT NOT NULL, task_ids_json TEXT NOT NULL, result TEXT, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, source_path TEXT NOT NULL);
358
+ CREATE TEMP TABLE canonical_decisions (id TEXT PRIMARY KEY, title TEXT NOT NULL, origin TEXT NOT NULL, scope_type TEXT NOT NULL, scope_id TEXT NOT NULL, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, source_path TEXT NOT NULL);
359
+ CREATE TEMP TABLE canonical_run_index (run_id TEXT PRIMARY KEY, occurred_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, task_id TEXT, phase TEXT, run_role TEXT NOT NULL, duration_ms REAL, source_event_count INTEGER NOT NULL, zaip_agent TEXT, provider TEXT, model TEXT, status TEXT);
360
+ CREATE TEMP TABLE invocation_usage_segments (
361
+ agent_invocation_id TEXT NOT NULL, provider TEXT, model TEXT, service_tier TEXT, reasoning_effort TEXT,
362
+ input_tokens REAL, cached_input_tokens REAL, uncached_input_tokens REAL,
363
+ output_tokens REAL, reasoning_tokens REAL, visible_output_tokens REAL, total_tokens REAL,
364
+ input_rate_usd_per_million REAL, cached_input_rate_usd_per_million REAL,
365
+ output_rate_usd_per_million REAL, reasoning_rate_usd_per_million REAL,
366
+ context_input_multiplier REAL, context_output_multiplier REAL, speed_cost_multiplier REAL, pricing_scenario TEXT,
367
+ standard_cost_usd REAL, speed_uplift_usd REAL,
368
+ input_cost_usd REAL, cached_input_cost_usd REAL, output_cost_usd REAL, reasoning_cost_usd REAL,
369
+ calculated_cost_usd REAL, recorded_cost_usd REAL, cost_variance_usd REAL,
370
+ cost_usd REAL, cost_brl REAL, cost_method TEXT, pricing_model TEXT, pricing_source TEXT, fx_rate REAL
371
+ );
372
+ CREATE TABLE zaip_aios_activities (
373
+ activity_row_id TEXT PRIMARY KEY, activity_source_kind TEXT NOT NULL, activity_key TEXT NOT NULL,
374
+ source_path TEXT NOT NULL, source_hash TEXT NOT NULL, source_occurred_at TEXT, recorded_at TEXT NOT NULL, version_activity_id TEXT,
375
+ source_last_event_id TEXT, source_last_sequence INTEGER,
376
+ work_item_kind TEXT, title TEXT, work_item_status TEXT, work_stage TEXT, risk TEXT,
377
+ run_role TEXT NOT NULL, root_run_id TEXT NOT NULL, parent_run_id TEXT,
378
+ agent_run_id TEXT, root_agent_run_id TEXT, parent_agent_run_id TEXT, agent_run_role TEXT, delegation_depth INTEGER,
379
+ agent_invocation_id TEXT, root_agent_invocation_id TEXT, parent_agent_invocation_id TEXT, invocation_kind TEXT,
380
+ execution_id TEXT, task_id TEXT, spec_id TEXT, prd_id TEXT, change_id TEXT, conversation_id TEXT, run_id TEXT,
381
+ occurred_at TEXT, occurred_day_sp TEXT, execution_kind TEXT, entrypoint TEXT, work_type TEXT, phase TEXT, purpose TEXT, status TEXT, activity_kind TEXT,
382
+ zaip_agent TEXT, zaip_agent_persona TEXT, zaip_agent_job TEXT, zaip_agent_role TEXT, agent_catalog_id TEXT, agent_catalog_hash TEXT,
383
+ client TEXT, provider TEXT, model TEXT, service_tier TEXT, reasoning_effort TEXT,
384
+ source_duration_ms REAL, source_started_at TEXT, source_finished_at TEXT, duration_ms REAL, duration_provenance TEXT, input_tokens REAL, cached_input_tokens REAL, output_tokens REAL, reasoning_tokens REAL, total_tokens REAL, token_source TEXT, usage_event_count INTEGER, llm_call_count INTEGER,
385
+ cost_usd REAL, cost_brl REAL, cost_method TEXT, pricing_model TEXT, pricing_source TEXT, fx_rate REAL, source_event_count INTEGER,
386
+ root_run_duration REAL, sub_run_duration REAL,
387
+ payload_type TEXT, payload_json TEXT
388
+ );`),_.exec(`
389
+ CREATE TABLE zaip_dim_zaip_agent (
390
+ zaip_agent TEXT PRIMARY KEY, catalog_id TEXT, persona TEXT, job TEXT, role TEXT, catalog_hash TEXT
391
+ );
392
+ CREATE TABLE zaip_dim_llm_model (
393
+ model TEXT PRIMARY KEY
394
+ );
395
+ CREATE TABLE zaip_dim_provider (
396
+ provider TEXT PRIMARY KEY
397
+ );
398
+ `),_.exec(`CREATE TEMP TABLE attributed_token_active_facts (
399
+ activity_row_id TEXT NOT NULL,
400
+ occurred_day_sp TEXT NOT NULL,
401
+ attributed_token_active_ms REAL NOT NULL,
402
+ PRIMARY KEY(activity_row_id, occurred_day_sp)
403
+ );`);let b=_.prepare("INSERT INTO files(path, content, mtime_ms, size_bytes, content_sha256, artifact_kind, artifact_id, artifact_occurred_at, artifact_occurred_day_sp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"),T=_.prepare("INSERT INTO read_model_source_state(source_path, source_hash, mtime_ms, size_bytes, source_kind, last_processed_at) VALUES (?, ?, ?, ?, ?, ?)"),I=0,R=0,U=32;for(let K=0;K<r.candidates.length;K+=U){let we=r.candidates.slice(K,K+U),se=await Promise.all(we.map(qt=>(0,et.readFile)(qt.path,"utf8")));for(let qt=0;qt<we.length;qt+=1){let vo=we[qt],Or=se[qt];if(vo===void 0||Or===void 0)continue;let{source:Rr,mtimeMs:bo,size:At}=vo,$r=(0,bn.createHash)("sha256").update(Or).digest("hex"),_c=Rr.includes("/runs/")?"run":Rr.includes("/artifacts/evidence/")?"evidence":Rr.includes("/artifacts/validations/")?"validation":Rr.startsWith(".agents/config/")?"config":"entity",Yr=yK(Rr,Or);b.run(Rr,Or,bo,At,$r,Yr?.kind??null,Yr?.id??null,Yr?.occurredAt??null,Yr?.occurredDaySp??null),T.run(Rr,$r,bo,At,_c,new Date().toISOString()),I+=1}let pt=52+Math.round((K+we.length)/r.candidates.length*20);o("source_import",pt,`Lidas ${Math.min(K+we.length,r.candidates.length)} de ${r.candidates.length} fontes.`)}o("projection_build",74,"Organizando fatos e proje\xE7\xF5es do banco local.");let V=sK(_.prepare("SELECT path, content FROM files WHERE path LIKE '.agents/records/%'").all()),y=_.prepare("INSERT INTO canonical_work_items(entity_kind, id, title, status, stage, risk, occurred_at, occurred_day_sp) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");for(let K of V.values())K.kind!=="task"&&K.kind!=="spec"&&K.kind!=="prd"||K.occurredAt===null||Number.isNaN(Date.parse(K.occurredAt))||y.run(K.kind,K.id,K.title,K.status,K.stage,K.risk,K.occurredAt,_n(K.occurredAt));let S=aK(_.prepare("SELECT path, content FROM files WHERE path LIKE '.agents/records/%'").all()),x=_.prepare("INSERT INTO canonical_executions(id, status, kind, origin_type, origin_id, created_at, occurred_day_sp, finished_at, source_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");for(let K of S.executions)x.run(K.id,K.status,K.kind,K.originType,K.originId,K.createdAt,_n(K.createdAt),K.finishedAt,K.sourcePath);let W=_.prepare("INSERT INTO canonical_changes(id, title, status, risk, source_type, source_id, source_spec_id, source_prd_id, requirement_ids_json, acceptance_ids_json, task_ids_json, result, created_at, occurred_day_sp, source_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");for(let K of S.changes)W.run(K.id,K.title,K.status,K.risk,K.sourceType,K.sourceId,K.sourceSpecId,K.sourcePrdId,JSON.stringify(K.requirementIds),JSON.stringify(K.acceptanceIds),JSON.stringify(K.taskIds),K.result,K.createdAt,_n(K.createdAt),K.sourcePath);let ce=_.prepare("INSERT INTO canonical_decisions(id, title, origin, scope_type, scope_id, created_at, occurred_day_sp, source_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");for(let K of S.decisions)ce.run(K.id,K.title,K.origin,K.scopeType,K.scopeId,K.createdAt,_n(K.createdAt),K.sourcePath);let ee=_.prepare("SELECT content FROM files WHERE path = ?").get(".agents/config/agents/catalog.yaml")?.content,ge=_.prepare("SELECT content FROM files WHERE path = ?").get(".agents/config/clients.yaml")?.content,L=cK(ee,ge),le=ee===void 0?null:(0,bn.createHash)("sha256").update(ee).digest("hex"),B=_.prepare("SELECT content FROM files WHERE path = ?").get(".agents/config/pricing/models.json")?.content,me=Ki.parse(JSON.parse(B??'{"schema_version":1,"updated_at":"1970-01-01T00:00:00.000Z","source":"missing","disclaimer":"missing","models":[]}')),Ie=pK(_.prepare("SELECT path, content FROM files WHERE path LIKE '.agents/config/pricing/fx/%.json'").all()),Me=_.prepare("SELECT path, content, content_sha256 FROM files WHERE path LIKE '.agents/records/runs/%.jsonl' ORDER BY path").all(),Te=new Map(Me.map(K=>{let we=xs(Ts(K.content));return[we.run.run_id,{row:K,fold:we}]})),Z=K=>{let we=K,se=new Set;for(;we.run.parent_run_id!==null&&!se.has(we.run.run_id);){se.add(we.run.run_id);let pt=Te.get(we.run.parent_run_id)?.fold;if(pt===void 0)break;we=pt}return we.run.run_id},oe=["activity_row_id","activity_source_kind","activity_key","source_path","source_hash","source_occurred_at","recorded_at","version_activity_id","source_last_event_id","source_last_sequence","work_item_kind","title","work_item_status","work_stage","risk","run_role","root_run_id","parent_run_id","agent_run_id","root_agent_run_id","parent_agent_run_id","agent_run_role","delegation_depth","agent_invocation_id","root_agent_invocation_id","parent_agent_invocation_id","invocation_kind","execution_id","task_id","spec_id","prd_id","change_id","conversation_id","run_id","occurred_at","occurred_day_sp","execution_kind","entrypoint","work_type","phase","purpose","status","activity_kind","zaip_agent","zaip_agent_persona","zaip_agent_job","zaip_agent_role","agent_catalog_id","agent_catalog_hash","client","provider","model","service_tier","reasoning_effort","source_duration_ms","source_started_at","source_finished_at","duration_ms","duration_provenance","input_tokens","cached_input_tokens","output_tokens","reasoning_tokens","total_tokens","token_source","usage_event_count","llm_call_count","cost_usd","cost_brl","cost_method","pricing_model","pricing_source","fx_rate","source_event_count","root_run_duration","sub_run_duration","payload_type","payload_json"],he=_.prepare(`INSERT INTO zaip_aios_activities(${oe.join(",")}) VALUES (${oe.map(()=>"?").join(",")})`),Re=_.prepare("INSERT INTO attributed_token_active_facts(activity_row_id, occurred_day_sp, attributed_token_active_ms) VALUES (?, ?, ?)"),Fe=_.prepare("INSERT INTO invocation_usage_segments VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),bt=_.prepare("INSERT INTO canonical_run_index(run_id, occurred_at, occurred_day_sp, task_id, phase, run_role, duration_ms, source_event_count, zaip_agent, provider, model, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),St=0,Pt=0,Ii=[];for(let{row:K,fold:we}of Te.values()){let se=we.run,pt=we.effective_usage_records,qt=se.agent_invocation_id??null,vo=qt!==null,Or=se.parent_run_id===null?"root":"subrun",Rr=vo?se.parent_agent_invocation_id===null?"root":"subagent":null,bo=ya(pt,"total"),At=_K(pt,we),$r=fK(pt,we,me,Ie),_c=pt.filter($e=>typeof $e.tokens.total=="number"||typeof $e.cost.usd=="number"||typeof $e.cost.brl=="number"),Yr=$i(_c.map($e=>$e.model??se.model))??(se.model==="unavailable"?null:se.model),Yh=$i(_c.map($e=>x_($e.provider,$e.model??se.model,se.client)))??x_(se.provider,Yr,se.client),I_=se.agent_name??se.agent;if(bt.run(se.run_id,se.occurred_at,_n(se.occurred_at),se.task_id,se.phase,Or,At.effective,we.records.length,I_,Yh,Yr,we.status),bo===null){Pt+=1;continue}let pc=L.get(I_)??L.get(se.agent),ba=se.task_id===null?se.spec_id===null?se.prd_id===null?null:V.get(`prd:${se.prd_id}`):V.get(`spec:${se.spec_id}`):V.get(`task:${se.task_id}`),Qh=new Set([...we.model_call_records.map($e=>$e.call_id),...pt.map($e=>$e.model_call_id).filter($e=>typeof $e=="string")]),N_=we.records.at(-1),P_=`ACTV-${(0,bn.createHash)("sha256").update(`run:${se.run_id}`).digest("hex").slice(0,24)}`,j$={activity_row_id:P_,activity_source_kind:vo?"agent_run":"unassisted_turn",activity_key:`run:${se.run_id}`,source_path:K.path,source_hash:K.content_sha256,source_occurred_at:pt.map($e=>$e.source_occurred_at).filter($e=>typeof $e=="string").sort()[0]??se.occurred_at,recorded_at:N_.occurred_at,version_activity_id:null,source_last_event_id:N_.event_id,source_last_sequence:N_.sequence,work_item_kind:ba?.kind??null,title:ba?.title??null,work_item_status:ba?.status??null,work_stage:ba?.stage??null,risk:ba?.risk??null,run_role:Or,root_run_id:Z(we),parent_run_id:se.parent_run_id,agent_run_id:qt,root_agent_run_id:se.root_agent_invocation_id??qt,parent_agent_run_id:se.parent_agent_invocation_id??null,agent_run_role:Rr,delegation_depth:se.delegation_depth??null,agent_invocation_id:qt,root_agent_invocation_id:se.root_agent_invocation_id??qt,parent_agent_invocation_id:se.parent_agent_invocation_id??null,invocation_kind:se.invocation_kind??null,execution_id:se.execution_id,task_id:se.task_id,spec_id:se.spec_id,prd_id:se.prd_id,change_id:se.change_id,conversation_id:se.conversation_id,run_id:se.run_id,occurred_at:se.occurred_at,occurred_day_sp:_n(se.occurred_at),execution_kind:se.execution_kind??null,entrypoint:se.entrypoint,work_type:se.work_type,phase:se.phase,purpose:se.run_purpose??null,status:we.status,activity_kind:lK({execution_id:se.execution_id,task_id:se.task_id,spec_id:se.spec_id,prd_id:se.prd_id,phase:se.phase,purpose:se.run_purpose??null}),zaip_agent:I_,zaip_agent_persona:pc?.persona??null,zaip_agent_job:pc?.job??null,zaip_agent_role:pc?.role??null,agent_catalog_id:pc?.catalogId??null,agent_catalog_hash:le,client:se.client,provider:Yh,model:Yr,service_tier:$i(pt.map($e=>$e.runtime?.service_tier??null)),reasoning_effort:$i(pt.map($e=>$e.runtime?.reasoning_effort??null))??se.reasoning_effort??null,source_duration_ms:At.source,source_started_at:At.sourceStartedAt,source_finished_at:At.sourceFinishedAt,duration_ms:At.effective,duration_provenance:At.provenance,input_tokens:ya(pt,"input"),cached_input_tokens:ya(pt,"cached_input"),output_tokens:ya(pt,"output"),reasoning_tokens:ya(pt,"reasoning"),total_tokens:bo,token_source:$i(pt.map($e=>$e.tokens.source)),usage_event_count:pt.length,llm_call_count:Qh.size>0?Qh.size:null,cost_usd:$r.usd,cost_brl:$r.brl,cost_method:$r.method,pricing_model:$r.pricingModel,pricing_source:$r.pricingSource,fx_rate:$r.fxRate,source_event_count:we.records.length,root_run_duration:Or==="root"?At.effective:null,sub_run_duration:Or==="subrun"?At.effective:null,payload_type:null,payload_json:null};if(he.run(...oe.map($e=>j$[$e]??null)),bo>0&&At.effective!==null&&At.effective>=0){let $e=Date.parse(At.sourceStartedAt??se.occurred_at),Cr=Date.parse(At.sourceFinishedAt??"")||$e+At.effective;Number.isFinite($e)&&Number.isFinite(Cr)&&Cr>$e?Ii.push({activityRowId:P_,startMs:$e,endMs:Cr}):At.effective===0&&Re.run(P_,_n(se.occurred_at),0)}if(qt!==null)for(let $e of pt){let Cr=$e.tokens,Ge=gK($e,we,me,Ie);Fe.run(qt,$e.provider??null,$e.model??null,Ge.serviceTier,$e.runtime?.reasoning_effort??null,Cr.input,Cr.cached_input,Ge.uncachedInputTokens,Cr.output,Cr.reasoning,Ge.visibleOutputTokens,Cr.total,Ge.inputRate,Ge.cachedRate,Ge.outputRate,Ge.reasoningRate,Ge.contextInputMultiplier,Ge.contextOutputMultiplier,Ge.speedCostMultiplier,Ge.pricingScenario,Ge.standardUsd,Ge.speedUpliftUsd,Ge.inputUsd,Ge.cachedInputUsd,Ge.outputUsd,Ge.reasoningUsd,Ge.calculatedUsd,Ge.recordedUsd,Ge.varianceUsd,Ge.effectiveUsd,Ge.effectiveBrl,Ge.recordedUsd!==null?"canonical_recorded":"token_pricing_estimate",Ge.pricingModel,Ge.pricingSource,Ge.fxRate)}vo||(St+=1)}for(let K of hK(Ii))Re.run(K.activityRowId,K.day,K.value);_.exec(`UPDATE zaip_aios_activities
404
+ SET duration_ms = (
405
+ SELECT SUM(f.attributed_token_active_ms)
406
+ FROM attributed_token_active_facts f
407
+ WHERE f.activity_row_id=zaip_aios_activities.activity_row_id
408
+ ),
409
+ duration_provenance = CASE
410
+ WHEN EXISTS (SELECT 1 FROM attributed_token_active_facts f WHERE f.activity_row_id=zaip_aios_activities.activity_row_id)
411
+ THEN 'attributed_token_active' ELSE NULL END;`);let yo=Te.size,lc=_.prepare("SELECT COUNT(*) AS count FROM zaip_aios_activities WHERE agent_invocation_id IS NOT NULL").get().count;_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("source_file_count",String(I)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("excluded_source_count",String(R));let uc=_.prepare("SELECT COUNT(DISTINCT occurred_day_sp) AS count FROM zaip_aios_activities WHERE occurred_day_sp IS NOT NULL").get().count,dc=_.prepare("SELECT COUNT(*) AS count FROM zaip_aios_activities").get().count,z=_.prepare("SELECT COUNT(*) AS count FROM zaip_aios_activities WHERE activity_source_kind = 'agent_run'").get().count;_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("daily_aggregate_count",String(uc)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("activity_count",String(dc)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("canonical_run_count",String(yo)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("excluded_unknown_token_run_count",String(Pt)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("agent_run_count",String(z)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("telemetry_summary_count","0"),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("unassisted_activity_count",String(St)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("unassisted_turn_count",String(St)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("agent_invocation_count",String(lc)),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("schema_version",go),_.prepare("INSERT INTO read_model_metadata(key, value) VALUES (?, ?)").run("source_fingerprint",a);let Ye=_.prepare("INSERT OR IGNORE INTO zaip_dim_llm_model(model) VALUES (?)"),C$=_.prepare("INSERT OR IGNORE INTO zaip_dim_provider(provider) VALUES (?)");for(let K of me.models)Ye.run(K.id),C$.run(K.provider);let I$=rK(_),Sn=(K,we)=>_.exec(`INSERT INTO zaip_aios_activities(
412
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
413
+ recorded_at, run_role, root_run_id, payload_type, payload_json
414
+ ) SELECT
415
+ 'TECH-' || lower(hex(randomblob(16))), 'technical_payload', '${K}:' || row_key,
416
+ 'sqlite://${K}', '', datetime('now'), 'technical', 'technical', '${K}', payload_json
417
+ FROM (${we});`);Sn("metadata","SELECT key AS row_key, json_object('key', key, 'value', value) AS payload_json FROM read_model_metadata"),Sn("source_state","SELECT source_path AS row_key, json_object('source_path', source_path, 'source_hash', source_hash, 'mtime_ms', mtime_ms, 'size_bytes', size_bytes, 'source_kind', source_kind, 'last_processed_at', last_processed_at) AS payload_json FROM read_model_source_state"),Sn("file","SELECT path AS row_key, json_object('path', path, 'content', content, 'mtime_ms', mtime_ms, 'size_bytes', size_bytes, 'content_sha256', content_sha256, 'artifact_kind', artifact_kind, 'artifact_id', artifact_id, 'artifact_occurred_at', artifact_occurred_at, 'artifact_occurred_day_sp', artifact_occurred_day_sp) AS payload_json FROM files"),Sn("work_item","SELECT entity_kind || ':' || id AS row_key, json_object('entity_kind', entity_kind, 'id', id, 'title', title, 'status', status, 'stage', stage, 'risk', risk, 'occurred_at', occurred_at, 'occurred_day_sp', occurred_day_sp) AS payload_json FROM canonical_work_items"),Sn("execution","SELECT id AS row_key, json_object('id', id, 'status', status, 'kind', kind, 'origin_type', origin_type, 'origin_id', origin_id, 'created_at', created_at, 'occurred_day_sp', occurred_day_sp, 'finished_at', finished_at, 'source_path', source_path) AS payload_json FROM canonical_executions"),Sn("change","SELECT id AS row_key, json_object('id', id, 'title', title, 'status', status, 'risk', risk, 'source_type', source_type, 'source_id', source_id, 'source_spec_id', source_spec_id, 'source_prd_id', source_prd_id, 'requirement_ids_json', requirement_ids_json, 'acceptance_ids_json', acceptance_ids_json, 'task_ids_json', task_ids_json, 'result', result, 'created_at', created_at, 'occurred_day_sp', occurred_day_sp, 'source_path', source_path) AS payload_json FROM canonical_changes"),Sn("decision","SELECT id AS row_key, json_object('id', id, 'title', title, 'origin', origin, 'scope_type', scope_type, 'scope_id', scope_id, 'created_at', created_at, 'occurred_day_sp', occurred_day_sp, 'source_path', source_path) AS payload_json FROM canonical_decisions"),Sn("run_index","SELECT run_id AS row_key, json_object('run_id', run_id, 'occurred_at', occurred_at, 'occurred_day_sp', occurred_day_sp, 'task_id', task_id, 'phase', phase, 'run_role', run_role, 'duration_ms', duration_ms, 'source_event_count', source_event_count, 'zaip_agent', zaip_agent, 'provider', provider, 'model', model, 'status', status) AS payload_json FROM canonical_run_index"),Sn("usage_segment","SELECT agent_invocation_id || ':' || rowid AS row_key, json_object('agent_invocation_id', agent_invocation_id, 'provider', provider, 'model', model, 'service_tier', service_tier, 'reasoning_effort', reasoning_effort, 'input_tokens', input_tokens, 'cached_input_tokens', cached_input_tokens, 'uncached_input_tokens', uncached_input_tokens, 'output_tokens', output_tokens, 'reasoning_tokens', reasoning_tokens, 'visible_output_tokens', visible_output_tokens, 'total_tokens', total_tokens, 'input_rate_usd_per_million', input_rate_usd_per_million, 'cached_input_rate_usd_per_million', cached_input_rate_usd_per_million, 'output_rate_usd_per_million', output_rate_usd_per_million, 'reasoning_rate_usd_per_million', reasoning_rate_usd_per_million, 'context_input_multiplier', context_input_multiplier, 'context_output_multiplier', context_output_multiplier, 'speed_cost_multiplier', speed_cost_multiplier, 'pricing_scenario', pricing_scenario, 'standard_cost_usd', standard_cost_usd, 'speed_uplift_usd', speed_uplift_usd, 'input_cost_usd', input_cost_usd, 'cached_input_cost_usd', cached_input_cost_usd, 'output_cost_usd', output_cost_usd, 'reasoning_cost_usd', reasoning_cost_usd, 'calculated_cost_usd', calculated_cost_usd, 'recorded_cost_usd', recorded_cost_usd, 'cost_variance_usd', cost_variance_usd, 'cost_usd', cost_usd, 'cost_brl', cost_brl, 'cost_method', cost_method, 'pricing_model', pricing_model, 'pricing_source', pricing_source, 'fx_rate', fx_rate) AS payload_json FROM invocation_usage_segments"),Sn("duration_allocation","SELECT activity_row_id || ':' || occurred_day_sp AS row_key, json_object('activity_row_id', activity_row_id, 'occurred_day_sp', occurred_day_sp, 'attributed_token_active_ms', attributed_token_active_ms) AS payload_json FROM attributed_token_active_facts");let N$=_.prepare("INSERT OR IGNORE INTO zaip_dim_zaip_agent(zaip_agent, catalog_id, persona, job, role, catalog_hash) VALUES (?, ?, ?, ?, ?, ?)");for(let[K,we]of L)N$.run(K,we.catalogId,we.persona,we.job,we.role,le);let P$=_.prepare(`INSERT INTO zaip_aios_activities(
418
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
419
+ recorded_at, run_role, root_run_id, payload_type, payload_json
420
+ ) VALUES (?, 'technical_payload', ?, ?, '', datetime('now'), 'technical', 'technical', 'cost_dimension_aggregate_v1', ?)`);for(let K of["model","provider"])for(let we of I$[K])P$.run(`TECH-${(0,bn.randomUUID)().toLowerCase()}`,`cost_dimension_aggregate_v1:${K}:${we.key}`,`sqlite://cost_dimension_aggregate_v1/${K}`,JSON.stringify({schema_version:1,dimension:K,...we}));let Gh=`
421
+ CREATE INDEX zaip_activities_agent_run ON zaip_aios_activities(activity_source_kind, agent_run_id, occurred_day_sp, occurred_at DESC);
422
+ CREATE INDEX zaip_activities_relationships ON zaip_aios_activities(task_id, spec_id, prd_id, execution_id, conversation_id);
423
+ CREATE INDEX zaip_activities_task_day ON zaip_aios_activities(payload_type, task_id, occurred_day_sp) WHERE task_id IS NOT NULL;
424
+ CREATE INDEX zaip_activities_spec_day ON zaip_aios_activities(payload_type, spec_id, occurred_day_sp) WHERE spec_id IS NOT NULL;
425
+ CREATE INDEX zaip_activities_prd_day ON zaip_aios_activities(payload_type, prd_id, occurred_day_sp) WHERE prd_id IS NOT NULL;
426
+ CREATE INDEX zaip_activities_agent ON zaip_aios_activities(zaip_agent, zaip_agent_persona, zaip_agent_job, provider, model);
427
+ CREATE UNIQUE INDEX zaip_activities_run_id ON zaip_aios_activities(run_id);
428
+ CREATE INDEX zaip_activities_run_hierarchy ON zaip_aios_activities(root_run_id, parent_run_id, run_role);
429
+ CREATE INDEX zaip_activities_period ON zaip_aios_activities(occurred_day_sp, occurred_at DESC);
430
+ -- Dimension residuals first restrict the visible period, then group
431
+ -- usage by invocation. This composite index avoids a temporary
432
+ -- grouping B-tree on Models/Providers filtered reads.
433
+ CREATE INDEX zaip_activities_period_invocation ON zaip_aios_activities(occurred_day_sp, agent_invocation_id)
434
+ WHERE agent_invocation_id IS NOT NULL;
435
+ CREATE INDEX zaip_activities_status ON zaip_aios_activities(activity_source_kind, status, phase);
436
+ CREATE INDEX zaip_activities_payload ON zaip_aios_activities(payload_type, activity_key);
437
+ CREATE VIEW files AS SELECT json_extract(payload_json, '$.path') AS path, json_extract(payload_json, '$.content') AS content, json_extract(payload_json, '$.mtime_ms') AS mtime_ms, json_extract(payload_json, '$.size_bytes') AS size_bytes, json_extract(payload_json, '$.content_sha256') AS content_sha256, json_extract(payload_json, '$.artifact_kind') AS artifact_kind, json_extract(payload_json, '$.artifact_id') AS artifact_id, json_extract(payload_json, '$.artifact_occurred_at') AS artifact_occurred_at, json_extract(payload_json, '$.artifact_occurred_day_sp') AS artifact_occurred_day_sp FROM zaip_aios_activities WHERE payload_type='file';
438
+ CREATE VIEW read_model_source_state AS SELECT json_extract(payload_json, '$.source_path') AS source_path, json_extract(payload_json, '$.source_hash') AS source_hash, json_extract(payload_json, '$.mtime_ms') AS mtime_ms, json_extract(payload_json, '$.size_bytes') AS size_bytes, json_extract(payload_json, '$.source_kind') AS source_kind, json_extract(payload_json, '$.last_processed_at') AS last_processed_at FROM zaip_aios_activities WHERE payload_type='source_state';
439
+ CREATE VIEW read_model_metadata AS SELECT json_extract(payload_json, '$.key') AS key, json_extract(payload_json, '$.value') AS value FROM zaip_aios_activities WHERE payload_type='metadata';
440
+ CREATE VIEW canonical_work_items AS SELECT json_extract(payload_json, '$.entity_kind') AS entity_kind, json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.title') AS title, json_extract(payload_json, '$.status') AS status, json_extract(payload_json, '$.stage') AS stage, json_extract(payload_json, '$.risk') AS risk, json_extract(payload_json, '$.occurred_at') AS occurred_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp FROM zaip_aios_activities WHERE payload_type='work_item';
441
+ CREATE VIEW canonical_executions AS SELECT json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.status') AS status, json_extract(payload_json, '$.kind') AS kind, json_extract(payload_json, '$.origin_type') AS origin_type, json_extract(payload_json, '$.origin_id') AS origin_id, json_extract(payload_json, '$.created_at') AS created_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.finished_at') AS finished_at, json_extract(payload_json, '$.source_path') AS source_path FROM zaip_aios_activities WHERE payload_type='execution';
442
+ CREATE VIEW canonical_changes AS SELECT json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.title') AS title, json_extract(payload_json, '$.status') AS status, json_extract(payload_json, '$.risk') AS risk, json_extract(payload_json, '$.source_type') AS source_type, json_extract(payload_json, '$.source_id') AS source_id, json_extract(payload_json, '$.source_spec_id') AS source_spec_id, json_extract(payload_json, '$.source_prd_id') AS source_prd_id, json_extract(payload_json, '$.requirement_ids_json') AS requirement_ids_json, json_extract(payload_json, '$.acceptance_ids_json') AS acceptance_ids_json, json_extract(payload_json, '$.task_ids_json') AS task_ids_json, json_extract(payload_json, '$.result') AS result, json_extract(payload_json, '$.created_at') AS created_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.source_path') AS source_path FROM zaip_aios_activities WHERE payload_type='change';
443
+ CREATE VIEW canonical_decisions AS SELECT json_extract(payload_json, '$.id') AS id, json_extract(payload_json, '$.title') AS title, json_extract(payload_json, '$.origin') AS origin, json_extract(payload_json, '$.scope_type') AS scope_type, json_extract(payload_json, '$.scope_id') AS scope_id, json_extract(payload_json, '$.created_at') AS created_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.source_path') AS source_path FROM zaip_aios_activities WHERE payload_type='decision';
444
+ CREATE VIEW canonical_run_index AS SELECT json_extract(payload_json, '$.run_id') AS run_id, json_extract(payload_json, '$.occurred_at') AS occurred_at, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.task_id') AS task_id, json_extract(payload_json, '$.phase') AS phase, json_extract(payload_json, '$.run_role') AS run_role, json_extract(payload_json, '$.duration_ms') AS duration_ms, json_extract(payload_json, '$.source_event_count') AS source_event_count, json_extract(payload_json, '$.zaip_agent') AS zaip_agent, json_extract(payload_json, '$.provider') AS provider, json_extract(payload_json, '$.model') AS model, json_extract(payload_json, '$.status') AS status FROM zaip_aios_activities WHERE payload_type='run_index';
445
+ CREATE VIEW invocation_usage_segments AS SELECT json_extract(payload_json, '$.agent_invocation_id') AS agent_invocation_id, json_extract(payload_json, '$.provider') AS provider, json_extract(payload_json, '$.model') AS model, json_extract(payload_json, '$.service_tier') AS service_tier, json_extract(payload_json, '$.reasoning_effort') AS reasoning_effort, json_extract(payload_json, '$.input_tokens') AS input_tokens, json_extract(payload_json, '$.cached_input_tokens') AS cached_input_tokens, json_extract(payload_json, '$.uncached_input_tokens') AS uncached_input_tokens, json_extract(payload_json, '$.output_tokens') AS output_tokens, json_extract(payload_json, '$.reasoning_tokens') AS reasoning_tokens, json_extract(payload_json, '$.visible_output_tokens') AS visible_output_tokens, json_extract(payload_json, '$.total_tokens') AS total_tokens, json_extract(payload_json, '$.input_rate_usd_per_million') AS input_rate_usd_per_million, json_extract(payload_json, '$.cached_input_rate_usd_per_million') AS cached_input_rate_usd_per_million, json_extract(payload_json, '$.output_rate_usd_per_million') AS output_rate_usd_per_million, json_extract(payload_json, '$.reasoning_rate_usd_per_million') AS reasoning_rate_usd_per_million, json_extract(payload_json, '$.context_input_multiplier') AS context_input_multiplier, json_extract(payload_json, '$.context_output_multiplier') AS context_output_multiplier, json_extract(payload_json, '$.speed_cost_multiplier') AS speed_cost_multiplier, json_extract(payload_json, '$.pricing_scenario') AS pricing_scenario, json_extract(payload_json, '$.standard_cost_usd') AS standard_cost_usd, json_extract(payload_json, '$.speed_uplift_usd') AS speed_uplift_usd, json_extract(payload_json, '$.input_cost_usd') AS input_cost_usd, json_extract(payload_json, '$.cached_input_cost_usd') AS cached_input_cost_usd, json_extract(payload_json, '$.output_cost_usd') AS output_cost_usd, json_extract(payload_json, '$.reasoning_cost_usd') AS reasoning_cost_usd, json_extract(payload_json, '$.calculated_cost_usd') AS calculated_cost_usd, json_extract(payload_json, '$.recorded_cost_usd') AS recorded_cost_usd, json_extract(payload_json, '$.cost_variance_usd') AS cost_variance_usd, json_extract(payload_json, '$.cost_usd') AS cost_usd, json_extract(payload_json, '$.cost_brl') AS cost_brl, json_extract(payload_json, '$.cost_method') AS cost_method, json_extract(payload_json, '$.pricing_model') AS pricing_model, json_extract(payload_json, '$.pricing_source') AS pricing_source, json_extract(payload_json, '$.fx_rate') AS fx_rate FROM zaip_aios_activities WHERE payload_type='usage_segment';
446
+ CREATE VIEW attributed_token_active_facts AS SELECT json_extract(payload_json, '$.activity_row_id') AS activity_row_id, json_extract(payload_json, '$.occurred_day_sp') AS occurred_day_sp, json_extract(payload_json, '$.attributed_token_active_ms') AS attributed_token_active_ms FROM zaip_aios_activities WHERE payload_type='duration_allocation';
447
+ CREATE VIEW canonical_artifacts AS SELECT artifact_kind, artifact_id, artifact_occurred_at AS occurred_at, artifact_occurred_day_sp AS occurred_day_sp, path AS source_path FROM files WHERE artifact_kind IS NOT NULL AND artifact_occurred_at IS NOT NULL;
448
+ CREATE VIEW activities AS
449
+ SELECT a.*, f.attributed_token_active_ms
450
+ FROM zaip_aios_activities a
451
+ LEFT JOIN (
452
+ SELECT activity_row_id, SUM(attributed_token_active_ms) AS attributed_token_active_ms
453
+ FROM attributed_token_active_facts GROUP BY activity_row_id
454
+ ) f USING(activity_row_id)
455
+ WHERE a.payload_type IS NULL;
456
+ CREATE VIEW attributed_token_active AS
457
+ SELECT f.activity_row_id, f.occurred_day_sp, f.attributed_token_active_ms,
458
+ a.run_id, a.execution_id, a.task_id, a.spec_id, a.prd_id, a.conversation_id,
459
+ a.zaip_agent, a.provider, a.model, a.phase, a.status
460
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id);
461
+ CREATE VIEW agent_runs AS SELECT * FROM activities WHERE activity_source_kind = 'agent_run';
462
+ CREATE VIEW root_runs AS SELECT * FROM activities WHERE run_role = 'root';
463
+ CREATE VIEW sub_runs AS SELECT * FROM activities WHERE run_role = 'subrun';
464
+ CREATE VIEW invocations AS SELECT activity_row_id, activity_key, version_activity_id, source_occurred_at, root_agent_run_id AS root_agent_invocation_id, parent_agent_run_id AS parent_agent_invocation_id, execution_id, task_id, spec_id, prd_id, change_id, conversation_id, run_id, occurred_at, occurred_day_sp, invocation_kind, delegation_depth, zaip_agent, zaip_agent_persona, zaip_agent_job, zaip_agent_role, client, provider, model, phase, purpose, status, source_started_at, source_finished_at, attributed_token_active_ms, attributed_token_active_ms AS duration_ms, CASE WHEN attributed_token_active_ms IS NOT NULL THEN 'observed' ELSE 'unavailable' END AS duration_provenance, CASE WHEN attributed_token_active_ms IS NOT NULL THEN 'attributed_token_active' ELSE NULL END AS duration_fact_provenance, input_tokens, cached_input_tokens, output_tokens, reasoning_tokens, total_tokens, token_source, cost_usd, cost_brl, cost_method, pricing_model, pricing_source, fx_rate, service_tier, reasoning_effort, source_event_count, usage_event_count, llm_call_count, agent_run_id AS agent_invocation_id FROM agent_runs;
465
+ CREATE VIEW invocation_usage AS SELECT agent_invocation_id, agent_invocation_id AS usage_index, provider, model, service_tier, reasoning_effort, input_tokens, cached_input_tokens, uncached_input_tokens, output_tokens, reasoning_tokens, visible_output_tokens, total_tokens, input_rate_usd_per_million, cached_input_rate_usd_per_million, output_rate_usd_per_million, reasoning_rate_usd_per_million, context_input_multiplier, context_output_multiplier, speed_cost_multiplier, pricing_scenario, standard_cost_usd, speed_uplift_usd, input_cost_usd, cached_input_cost_usd, output_cost_usd, reasoning_cost_usd, calculated_cost_usd, recorded_cost_usd, cost_variance_usd, cost_usd, cost_brl, cost_method, pricing_model, pricing_source, fx_rate FROM invocation_usage_segments;
466
+ -- Flatten the small financial dimension fact once during rebuild.
467
+ -- Models/Providers must never execute JSON extraction for each paint.
468
+ CREATE TABLE cost_invocation_dimension_facts AS
469
+ SELECT i.agent_invocation_id, date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') AS occurred_day_sp,
470
+ CASE WHEN u.model IS NULL OR trim(u.model)='' OR u.model='unavailable' THEN 'unavailable' ELSE u.model END AS model,
471
+ CASE WHEN u.provider IS NULL OR trim(u.provider)='' OR u.provider='unavailable' THEN 'unavailable' ELSE u.provider END AS provider,
472
+ u.input_tokens, u.cached_input_tokens, u.output_tokens, u.reasoning_tokens,
473
+ u.total_tokens, u.cost_usd, u.cost_brl, i.attributed_token_active_ms AS duration_ms, 0 AS residual
474
+ FROM invocations i JOIN invocation_usage u USING(agent_invocation_id)
475
+ WHERE u.total_tokens IS NOT NULL OR u.cost_usd IS NOT NULL OR u.cost_brl IS NOT NULL;
476
+ CREATE INDEX cost_dimension_facts_day_model ON cost_invocation_dimension_facts(occurred_day_sp, model);
477
+ CREATE INDEX cost_dimension_facts_day_provider ON cost_invocation_dimension_facts(occurred_day_sp, provider);
478
+ CREATE INDEX cost_dimension_facts_invocation ON cost_invocation_dimension_facts(agent_invocation_id);
479
+ INSERT INTO cost_invocation_dimension_facts
480
+ SELECT i.agent_invocation_id, date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') AS occurred_day_sp, 'unavailable', 'unavailable',
481
+ i.input_tokens-COALESCE(s.input_tokens,0), i.cached_input_tokens-COALESCE(s.cached_input_tokens,0),
482
+ i.output_tokens-COALESCE(s.output_tokens,0), i.reasoning_tokens-COALESCE(s.reasoning_tokens,0),
483
+ i.total_tokens-COALESCE(s.total_tokens,0), i.cost_usd-COALESCE(s.cost_usd,0),
484
+ i.cost_brl-COALESCE(s.cost_brl,0), i.attributed_token_active_ms, 1
485
+ FROM invocations i LEFT JOIN (
486
+ SELECT agent_invocation_id, SUM(input_tokens) input_tokens, SUM(cached_input_tokens) cached_input_tokens,
487
+ SUM(output_tokens) output_tokens, SUM(reasoning_tokens) reasoning_tokens, SUM(total_tokens) total_tokens,
488
+ SUM(cost_usd) cost_usd, SUM(cost_brl) cost_brl
489
+ FROM cost_invocation_dimension_facts GROUP BY agent_invocation_id
490
+ ) s USING(agent_invocation_id)
491
+ WHERE i.total_tokens<>COALESCE(s.total_tokens,0) OR i.cost_usd<>COALESCE(s.cost_usd,0) OR i.cost_brl<>COALESCE(s.cost_brl,0);
492
+ -- Financial activities outside Agent Invocation telemetry are still
493
+ -- factual Cost Monitor facts. Give them a stable synthetic key and
494
+ -- retain them as the explicit no-dimension population.
495
+ INSERT INTO cost_invocation_dimension_facts
496
+ SELECT 'activity:' || a.activity_row_id, a.occurred_day_sp, 'unavailable', 'unavailable',
497
+ a.input_tokens, a.cached_input_tokens, a.output_tokens, a.reasoning_tokens,
498
+ a.total_tokens, a.cost_usd, a.cost_brl, f.attributed_token_active_ms, 1
499
+ FROM zaip_aios_activities a
500
+ LEFT JOIN attributed_token_active_facts f USING(activity_row_id)
501
+ WHERE a.payload_type IS NULL AND a.activity_source_kind <> 'agent_run'
502
+ AND (a.total_tokens IS NOT NULL OR a.cost_usd IS NOT NULL OR a.cost_brl IS NOT NULL)
503
+ AND NOT EXISTS (SELECT 1 FROM cost_invocation_dimension_facts d WHERE d.agent_invocation_id='activity:' || a.activity_row_id);
504
+ CREATE VIEW work_items AS SELECT entity_kind, id, title, status, risk, occurred_at, occurred_day_sp FROM canonical_work_items UNION ALL SELECT 'task', task_id, COALESCE(MAX(title), task_id), MAX(work_item_status), MAX(risk), MIN(occurred_at), MIN(occurred_day_sp) FROM activities WHERE task_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='task' AND c.id=activities.task_id) GROUP BY task_id UNION ALL SELECT 'spec', spec_id, COALESCE(MAX(title), spec_id), MAX(work_item_status), MAX(risk), MIN(occurred_at), MIN(occurred_day_sp) FROM activities WHERE spec_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='spec' AND c.id=activities.spec_id) GROUP BY spec_id UNION ALL SELECT 'prd', prd_id, COALESCE(MAX(title), prd_id), MAX(work_item_status), MAX(risk), MIN(occurred_at), MIN(occurred_day_sp) FROM activities WHERE prd_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='prd' AND c.id=activities.prd_id) GROUP BY prd_id;
505
+ CREATE VIEW tasks AS SELECT id, title, status, risk, occurred_at, occurred_day_sp FROM work_items WHERE entity_kind = 'task';
506
+ CREATE VIEW specs AS SELECT id, title, status, risk, occurred_at, occurred_day_sp FROM work_items WHERE entity_kind = 'spec';
507
+ CREATE VIEW prds AS SELECT id, title, status, risk, occurred_at, occurred_day_sp FROM work_items WHERE entity_kind = 'prd';
508
+ CREATE VIEW executions AS
509
+ SELECT id, status, created_at AS occurred_at, occurred_day_sp FROM canonical_executions
510
+ UNION ALL
511
+ SELECT execution_id, MAX(status), MIN(occurred_at), MIN(occurred_day_sp)
512
+ FROM activities
513
+ WHERE execution_id IS NOT NULL
514
+ AND NOT EXISTS (SELECT 1 FROM canonical_executions c WHERE c.id=activities.execution_id)
515
+ GROUP BY execution_id;
516
+ CREATE VIEW conversations AS
517
+ SELECT origin_id AS id, MAX(status) AS status, MIN(created_at) AS occurred_at, MIN(occurred_day_sp) AS occurred_day_sp
518
+ FROM canonical_executions WHERE origin_type='interaction' AND origin_id IS NOT NULL GROUP BY origin_id
519
+ UNION ALL
520
+ SELECT conversation_id, MAX(status), MIN(occurred_at), MIN(occurred_day_sp)
521
+ FROM activities
522
+ WHERE conversation_id IS NOT NULL
523
+ AND NOT EXISTS (SELECT 1 FROM canonical_executions c WHERE c.origin_type='interaction' AND c.origin_id=activities.conversation_id)
524
+ GROUP BY conversation_id;
525
+ CREATE VIEW decisions AS SELECT id, title, origin, scope_type, scope_id, NULL AS status, NULL AS risk, created_at AS occurred_at, occurred_day_sp, source_path FROM canonical_decisions;
526
+ CREATE VIEW changes AS SELECT id, title, status, risk, source_type, source_id, requirement_ids_json, acceptance_ids_json, task_ids_json, result, created_at AS occurred_at, occurred_day_sp, source_path FROM canonical_changes;
527
+ CREATE VIEW dimensions AS SELECT 'zaip_agent' AS dimension, zaip_agent AS value FROM agent_runs WHERE zaip_agent IS NOT NULL UNION SELECT 'provider', provider FROM agent_runs WHERE provider IS NOT NULL UNION SELECT 'model', model FROM agent_runs WHERE model IS NOT NULL UNION SELECT 'status', status FROM zaip_aios_activities WHERE status IS NOT NULL;
528
+ CREATE VIEW daily_aggregate_cache AS
529
+ WITH RECURSIVE raw_intervals AS (
530
+ SELECT
531
+ (julianday(COALESCE(source_started_at, occurred_at)) - 2440587.5) * 86400000.0 AS start_ms,
532
+ (julianday(COALESCE(source_finished_at, occurred_at)) - 2440587.5) * 86400000.0 AS source_end_ms,
533
+ duration_ms
534
+ FROM invocations
535
+ WHERE total_tokens IS NOT NULL AND duration_ms IS NOT NULL AND duration_ms > 0
536
+ ), measurable_intervals AS (
537
+ SELECT start_ms,
538
+ CASE WHEN source_end_ms > start_ms THEN source_end_ms ELSE start_ms + duration_ms END AS end_ms
539
+ FROM raw_intervals
540
+ ), split_intervals(day, start_ms, end_ms, segment_end_ms) AS (
541
+ -- America/Sao_Paulo has used UTC-03:00 throughout the canonical
542
+ -- dashboard period. Split before unioning so a day cannot exceed
543
+ -- its local 24-hour boundary even when Runs span midnight.
544
+ SELECT date(start_ms / 1000.0, 'unixepoch', '-3 hours'), start_ms, end_ms,
545
+ MIN(end_ms, strftime('%s', date(start_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0)
546
+ FROM measurable_intervals
547
+ UNION ALL
548
+ SELECT date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours'), segment_end_ms, end_ms,
549
+ MIN(end_ms, strftime('%s', date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0)
550
+ FROM split_intervals WHERE segment_end_ms < end_ms
551
+ ), intervals AS (
552
+ SELECT day, start_ms, segment_end_ms AS end_ms FROM split_intervals
553
+ ), ordered AS (
554
+ SELECT *, MAX(end_ms) OVER (PARTITION BY day ORDER BY start_ms, end_ms ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS prior_end_ms
555
+ FROM intervals
556
+ ), grouped AS (
557
+ SELECT *, SUM(CASE WHEN prior_end_ms IS NULL OR start_ms > prior_end_ms THEN 1 ELSE 0 END)
558
+ OVER (PARTITION BY day ORDER BY start_ms, end_ms) AS interval_group
559
+ FROM ordered
560
+ ), merged AS (
561
+ SELECT day, interval_group, MIN(start_ms) AS start_ms, MAX(end_ms) AS end_ms
562
+ FROM grouped GROUP BY day, interval_group
563
+ ), operations_daily_duration AS (
564
+ SELECT occurred_day_sp AS day, SUM(attributed_token_active_ms) AS total_duration
565
+ FROM attributed_token_active_facts GROUP BY occurred_day_sp
566
+ ), work_item_days AS (
567
+ SELECT entity_kind AS kind, id, occurred_day_sp AS day FROM canonical_work_items
568
+ UNION ALL SELECT 'task', task_id, MIN(occurred_day_sp) FROM activities WHERE task_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='task' AND c.id=activities.task_id) GROUP BY task_id
569
+ UNION ALL SELECT 'spec', spec_id, MIN(occurred_day_sp) FROM activities WHERE spec_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='spec' AND c.id=activities.spec_id) GROUP BY spec_id
570
+ UNION ALL SELECT 'prd', prd_id, MIN(occurred_day_sp) FROM activities WHERE prd_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM canonical_work_items c WHERE c.entity_kind='prd' AND c.id=activities.prd_id) GROUP BY prd_id
571
+ ), work_item_daily AS (
572
+ SELECT day,
573
+ SUM(CASE WHEN kind='prd' THEN 1 ELSE 0 END) AS prd_count,
574
+ SUM(CASE WHEN kind='spec' THEN 1 ELSE 0 END) AS spec_count,
575
+ SUM(CASE WHEN kind='task' THEN 1 ELSE 0 END) AS task_count
576
+ FROM work_item_days GROUP BY day
577
+ ), artifact_daily AS (
578
+ SELECT occurred_day_sp AS day,
579
+ SUM(CASE WHEN artifact_kind='validation' THEN 1 ELSE 0 END) AS validation_count,
580
+ SUM(CASE WHEN artifact_kind='evidence' THEN 1 ELSE 0 END) AS evidence_count
581
+ FROM canonical_artifacts GROUP BY occurred_day_sp
582
+ ), activity_daily AS (
583
+ SELECT date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours') AS day,
584
+ COUNT(*) AS activity_count,
585
+ SUM(CASE WHEN activity_source_kind='agent_run' THEN 1 ELSE 0 END) AS invocation_count,
586
+ SUM(llm_call_count) AS llm_call_count,
587
+ SUM(root_run_duration) AS total_root_run_duration,
588
+ SUM(sub_run_duration) AS total_sub_run_duration,
589
+ SUM(total_tokens) AS total_tokens,
590
+ SUM(cost_usd) AS total_cost_usd,
591
+ SUM(cost_brl) AS total_cost_brl
592
+ FROM activities
593
+ GROUP BY date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours')
594
+ ), cost_monitor_financial_daily AS (
595
+ -- Cost Monitor retains every canonical activity with a financial
596
+ -- observation. Historical telemetry can predate
597
+ -- agent_invocation_id, so restricting this population to
598
+ -- invocations would silently discard those facts.
599
+ SELECT date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours') AS day,
600
+ COUNT(*) AS invocation_count,
601
+ SUM(total_tokens) AS total_tokens,
602
+ SUM(cost_usd) AS total_cost_usd,
603
+ SUM(cost_brl) AS total_cost_brl
604
+ FROM activities
605
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
606
+ GROUP BY date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours')
607
+ ), cost_monitor_raw_intervals AS (
608
+ -- Only complete source intervals from the Cost Monitor financial
609
+ -- population are factual. Run duration and token estimates never
610
+ -- fill this measure.
611
+ SELECT activity_row_id AS activity_id,
612
+ (julianday(source_started_at) - 2440587.5) * 86400000.0 AS start_ms,
613
+ (julianday(source_finished_at) - 2440587.5) * 86400000.0 AS end_ms
614
+ FROM activities
615
+ WHERE (total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL)
616
+ AND source_started_at IS NOT NULL
617
+ AND source_finished_at IS NOT NULL
618
+ AND julianday(source_finished_at) > julianday(source_started_at)
619
+ ), cost_monitor_split_intervals AS (
620
+ -- Split at America/Sao_Paulo day boundaries before unioning. This
621
+ -- makes the factual daily measure bounded by one local day.
622
+ SELECT date(start_ms / 1000.0, 'unixepoch', '-3 hours') AS day,
623
+ activity_id, start_ms, end_ms,
624
+ MIN(end_ms, strftime('%s', date(start_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0) AS segment_end_ms
625
+ FROM cost_monitor_raw_intervals
626
+ UNION ALL
627
+ SELECT date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours'),
628
+ activity_id, segment_end_ms, end_ms,
629
+ MIN(end_ms, strftime('%s', date(segment_end_ms / 1000.0, 'unixepoch', '-3 hours', '+1 day') || ' 03:00:00') * 1000.0)
630
+ FROM cost_monitor_split_intervals WHERE segment_end_ms < end_ms
631
+ ), cost_monitor_ordered_intervals AS (
632
+ SELECT day, start_ms, segment_end_ms AS end_ms,
633
+ MAX(segment_end_ms) OVER (PARTITION BY day ORDER BY start_ms, segment_end_ms ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS prior_end_ms
634
+ FROM cost_monitor_split_intervals
635
+ ), cost_monitor_grouped_intervals AS (
636
+ SELECT *, SUM(CASE WHEN prior_end_ms IS NULL OR start_ms > prior_end_ms THEN 1 ELSE 0 END)
637
+ OVER (PARTITION BY day ORDER BY start_ms, end_ms) AS interval_group
638
+ FROM cost_monitor_ordered_intervals
639
+ ), cost_monitor_merged_intervals AS (
640
+ SELECT day, interval_group, MIN(start_ms) AS start_ms, MAX(end_ms) AS end_ms
641
+ FROM cost_monitor_grouped_intervals GROUP BY day, interval_group
642
+ ), cost_monitor_daily_duration AS (
643
+ -- Tempo is the shared attributed activity fact. Financial
644
+ -- coverage is reported independently below; an incomplete price
645
+ -- record must never erase an observed temporal fact.
646
+ SELECT occurred_day_sp AS day, SUM(attributed_token_active_ms) AS total_duration
647
+ FROM attributed_token_active_facts GROUP BY occurred_day_sp
648
+ ), cost_monitor_duration_coverage AS (
649
+ SELECT day, COUNT(DISTINCT activity_id) AS eligible_runs,
650
+ COUNT(DISTINCT activity_id) AS known_runs
651
+ FROM cost_monitor_split_intervals GROUP BY day
652
+ UNION ALL
653
+ SELECT date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours'),
654
+ COUNT(DISTINCT activity_row_id), 0
655
+ FROM activities
656
+ WHERE (total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL)
657
+ AND NOT (
658
+ source_started_at IS NOT NULL
659
+ AND source_finished_at IS NOT NULL
660
+ AND julianday(source_finished_at) > julianday(source_started_at)
661
+ )
662
+ GROUP BY date(COALESCE(source_started_at, source_occurred_at, occurred_at), '-3 hours')
663
+ ), cost_monitor_daily_coverage AS (
664
+ SELECT day, SUM(eligible_runs) AS eligible_runs, SUM(known_runs) AS known_runs
665
+ FROM cost_monitor_duration_coverage GROUP BY day
666
+ ), run_daily AS (
667
+ SELECT occurred_day_sp AS day,
668
+ SUM(CASE WHEN run_role='root' THEN 1 ELSE 0 END) AS root_run_count,
669
+ SUM(CASE WHEN run_role='subrun' THEN 1 ELSE 0 END) AS sub_run_count,
670
+ COUNT(*) AS total_run_count,
671
+ SUM(source_event_count) AS source_event_count
672
+ FROM canonical_run_index GROUP BY occurred_day_sp
673
+ ), days AS (
674
+ SELECT day FROM work_item_daily UNION SELECT day FROM artifact_daily
675
+ UNION SELECT day FROM activity_daily UNION SELECT day FROM cost_monitor_financial_daily
676
+ UNION SELECT day FROM cost_monitor_daily_duration UNION SELECT day FROM cost_monitor_daily_coverage UNION SELECT day FROM run_daily
677
+ UNION SELECT day FROM operations_daily_duration
678
+ )
679
+ SELECT d.day,
680
+ COALESCE(w.prd_count, 0) AS prd_count,
681
+ COALESCE(w.spec_count, 0) AS spec_count,
682
+ COALESCE(w.task_count, 0) AS task_count,
683
+ COALESCE(a.validation_count, 0) AS validation_count,
684
+ COALESCE(a.evidence_count, 0) AS evidence_count,
685
+ COALESCE(i.activity_count, 0) AS activity_count,
686
+ COALESCE(r.root_run_count, 0) AS root_run_count,
687
+ COALESCE(r.sub_run_count, 0) AS sub_run_count,
688
+ COALESCE(r.total_run_count, 0) AS total_run_count,
689
+ COALESCE(i.invocation_count, 0) AS invocation_count,
690
+ COALESCE(f.invocation_count, 0) AS cost_monitor_invocation_count,
691
+ i.llm_call_count,
692
+ COALESCE(r.source_event_count, 0) AS source_event_count,
693
+ i.total_root_run_duration,
694
+ i.total_sub_run_duration,
695
+ o.total_duration AS operations_total_duration,
696
+ COALESCE(dcm.total_duration, o.total_duration) AS cost_monitor_total_duration,
697
+ coverage.eligible_runs AS cost_monitor_duration_eligible_runs,
698
+ coverage.known_runs AS cost_monitor_duration_known_runs,
699
+ o.total_duration AS total_duration,
700
+ f.total_tokens,
701
+ f.total_cost_usd,
702
+ f.total_cost_brl
703
+ FROM days d
704
+ LEFT JOIN work_item_daily w USING(day)
705
+ LEFT JOIN artifact_daily a USING(day)
706
+ LEFT JOIN activity_daily i USING(day)
707
+ LEFT JOIN cost_monitor_financial_daily f USING(day)
708
+ LEFT JOIN cost_monitor_daily_duration dcm USING(day)
709
+ LEFT JOIN cost_monitor_daily_coverage coverage USING(day)
710
+ LEFT JOIN run_daily r USING(day)
711
+ LEFT JOIN operations_daily_duration o USING(day);
712
+ -- SPEC/PRD rows have the same canonical population as the big
713
+ -- numbers. A macro without direct invocation remains visible with
714
+ -- factual NULL usage/cost/time, never a fabricated zero.
715
+ CREATE VIEW cost_monitor_group_daily_cache AS SELECT occurred_day_sp AS day, 'execution' AS group_kind, execution_id AS group_value, COUNT(*) AS invocation_count, SUM(llm_call_count) AS llm_call_count, SUM(duration_ms) AS total_duration, SUM(input_tokens) AS total_input_tokens, SUM(cached_input_tokens) AS total_cached_input_tokens, SUM(output_tokens) AS total_output_tokens, SUM(reasoning_tokens) AS total_reasoning_tokens, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM invocations WHERE execution_id IS NOT NULL GROUP BY occurred_day_sp, execution_id UNION ALL SELECT occurred_day_sp, 'zaip_agent', zaip_agent, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE zaip_agent IS NOT NULL GROUP BY occurred_day_sp, zaip_agent UNION ALL SELECT occurred_day_sp, 'provider', provider, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE provider IS NOT NULL GROUP BY occurred_day_sp, provider UNION ALL SELECT occurred_day_sp, 'model', model, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE model IS NOT NULL GROUP BY occurred_day_sp, model UNION ALL SELECT occurred_day_sp, 'task', task_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE task_id IS NOT NULL GROUP BY occurred_day_sp, task_id UNION ALL SELECT occurred_day_sp, 'spec', spec_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE spec_id IS NOT NULL GROUP BY occurred_day_sp, spec_id UNION ALL SELECT occurred_day_sp, 'prd', prd_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE prd_id IS NOT NULL GROUP BY occurred_day_sp, prd_id UNION ALL SELECT occurred_day_sp, 'conversation', conversation_id, COUNT(*), SUM(llm_call_count), SUM(duration_ms), SUM(input_tokens), SUM(cached_input_tokens), SUM(output_tokens), SUM(reasoning_tokens), SUM(total_tokens), SUM(cost_usd), SUM(cost_brl) FROM invocations WHERE conversation_id IS NOT NULL GROUP BY occurred_day_sp, conversation_id;
716
+ CREATE VIEW daily_aggregates AS SELECT * FROM daily_aggregate_cache;
717
+ CREATE VIEW overview AS
718
+ SELECT 'day' AS period_kind, day AS period_key, day AS start_day, day AS end_day, prd_count, spec_count, task_count, validation_count, evidence_count, activity_count, root_run_count, sub_run_count, total_run_count, invocation_count, cost_monitor_invocation_count, llm_call_count, source_event_count, total_root_run_duration, total_sub_run_duration, operations_total_duration, cost_monitor_total_duration, total_duration, total_tokens, total_cost_usd, total_cost_brl FROM daily_aggregates
719
+ UNION ALL
720
+ SELECT 'month', substr(day, 1, 7), MIN(day), MAX(day), SUM(prd_count), SUM(spec_count), SUM(task_count), SUM(validation_count), SUM(evidence_count), SUM(activity_count), SUM(root_run_count), SUM(sub_run_count), SUM(total_run_count), SUM(invocation_count), SUM(cost_monitor_invocation_count), SUM(llm_call_count), SUM(source_event_count), SUM(total_root_run_duration), SUM(total_sub_run_duration), SUM(operations_total_duration), SUM(cost_monitor_total_duration), SUM(total_duration), SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl) FROM daily_aggregates GROUP BY substr(day, 1, 7)
721
+ UNION ALL
722
+ SELECT 'year', substr(day, 1, 4), MIN(day), MAX(day), SUM(prd_count), SUM(spec_count), SUM(task_count), SUM(validation_count), SUM(evidence_count), SUM(activity_count), SUM(root_run_count), SUM(sub_run_count), SUM(total_run_count), SUM(invocation_count), SUM(cost_monitor_invocation_count), SUM(llm_call_count), SUM(source_event_count), SUM(total_root_run_duration), SUM(total_sub_run_duration), SUM(operations_total_duration), SUM(cost_monitor_total_duration), SUM(total_duration), SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl) FROM daily_aggregates GROUP BY substr(day, 1, 4);
723
+ CREATE VIEW overview_daily AS SELECT * FROM overview WHERE period_kind = 'day';
724
+ CREATE VIEW overview_monthly AS SELECT * FROM overview WHERE period_kind = 'month';
725
+ CREATE VIEW overview_annual AS SELECT * FROM overview WHERE period_kind = 'year';
726
+ CREATE VIEW operations_overview AS SELECT period_kind, period_key, start_day, end_day, prd_count, spec_count, task_count, validation_count, evidence_count, total_run_count, invocation_count, llm_call_count, operations_total_duration, total_tokens, total_cost_usd, total_cost_brl FROM overview;
727
+ -- Cost Monitor deliberately projects its measurable invocation
728
+ -- population rather than Operations' broader Run/activity totals.
729
+ CREATE VIEW cost_monitor_overview AS SELECT period_kind, period_key, cost_monitor_invocation_count AS total_run_count, cost_monitor_invocation_count AS invocation_count, llm_call_count, source_event_count, cost_monitor_total_duration, total_tokens, total_cost_usd, total_cost_brl FROM overview;
730
+ CREATE VIEW task_summary AS SELECT t.id, t.title, t.status, t.risk, t.occurred_at, t.occurred_day_sp, COUNT(i.run_id) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM tasks t LEFT JOIN activities i ON i.task_id = t.id GROUP BY t.id, t.title, t.status, t.risk, t.occurred_at, t.occurred_day_sp;
731
+ CREATE VIEW spec_summary AS SELECT s.id, s.title, s.status, s.risk, s.occurred_at, s.occurred_day_sp, COUNT(i.run_id) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM specs s LEFT JOIN activities i ON i.spec_id = s.id GROUP BY s.id, s.title, s.status, s.risk, s.occurred_at, s.occurred_day_sp;
732
+ CREATE VIEW prd_summary AS SELECT p.id, p.title, p.status, p.risk, p.occurred_at, p.occurred_day_sp, COUNT(i.run_id) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM prds p LEFT JOIN activities i ON i.prd_id = p.id GROUP BY p.id, p.title, p.status, p.risk, p.occurred_at, p.occurred_day_sp;
733
+ CREATE VIEW cost_monitor_group_daily AS SELECT * FROM cost_monitor_group_daily_cache;
734
+ CREATE VIEW vw_overview AS SELECT * FROM overview;
735
+ CREATE VIEW vw_overview_daily AS SELECT * FROM overview WHERE period_kind = 'day';
736
+ CREATE VIEW vw_overview_monthly AS SELECT * FROM overview WHERE period_kind = 'month';
737
+ CREATE VIEW vw_overview_annual AS SELECT * FROM overview WHERE period_kind = 'year';
738
+ CREATE VIEW vw_task_summary AS SELECT * FROM task_summary;
739
+ CREATE VIEW vw_spec_summary AS SELECT * FROM spec_summary;
740
+ CREATE VIEW vw_prd_summary AS SELECT * FROM prd_summary;
741
+ CREATE VIEW vw_task_summary_daily AS SELECT occurred_day_sp AS day, COUNT(*) AS task_count, SUM(llm_call_count) AS llm_call_count FROM task_summary GROUP BY occurred_day_sp;
742
+ CREATE VIEW vw_spec_summary_daily AS SELECT occurred_day_sp AS day, COUNT(*) AS spec_count, SUM(llm_call_count) AS llm_call_count FROM spec_summary GROUP BY occurred_day_sp;
743
+ CREATE VIEW vw_prd_summary_daily AS SELECT occurred_day_sp AS day, COUNT(*) AS prd_count, SUM(llm_call_count) AS llm_call_count FROM prd_summary GROUP BY occurred_day_sp;
744
+ CREATE VIEW vw_task_status_daily AS SELECT occurred_day_sp AS day, status, COUNT(*) AS task_count FROM task_summary GROUP BY occurred_day_sp, status;
745
+ CREATE VIEW vw_task_risk_daily AS SELECT occurred_day_sp AS day, risk, COUNT(*) AS task_count FROM task_summary GROUP BY occurred_day_sp, risk;
746
+ -- The Operations work-list export reads this public union directly.
747
+ -- Keep the known aggregate facts from each entity summary so its
748
+ -- snapshot is equivalent to the metrics shown by the work views.
749
+ CREATE VIEW vw_entities AS SELECT 'task' AS entity_kind, id, title, status, risk, occurred_at, occurred_day_sp, invocation_count, total_duration, total_tokens, total_cost_usd, total_cost_brl FROM task_summary UNION ALL SELECT 'spec', id, title, status, risk, occurred_at, occurred_day_sp, invocation_count, total_duration, total_tokens, total_cost_usd, total_cost_brl FROM spec_summary UNION ALL SELECT 'prd', id, title, status, risk, occurred_at, occurred_day_sp, invocation_count, total_duration, total_tokens, total_cost_usd, total_cost_brl FROM prd_summary;
750
+ CREATE VIEW vw_cost_group_daily AS SELECT * FROM cost_monitor_group_daily_cache;
751
+ -- Narrow temporal Cost surfaces. Do not route the visible Cost
752
+ -- tables through the three-grain overview union: it expands every
753
+ -- daily interval pipeline twice and prevents the outer from/to filter
754
+ -- from remaining a simple period predicate. These views expose only
755
+ -- the columns consumed by Daily, Monthly and Annual.
756
+ CREATE VIEW vw_cost_daily AS
757
+ SELECT day AS period_key, day AS start_day, day AS end_day,
758
+ cost_monitor_invocation_count AS total_run_count,
759
+ cost_monitor_invocation_count AS invocation_count,
760
+ llm_call_count, source_event_count,
761
+ cost_monitor_total_duration AS total_duration,
762
+ total_tokens, total_cost_usd, total_cost_brl
763
+ FROM daily_aggregate_cache;
764
+ CREATE VIEW vw_cost_monthly AS
765
+ SELECT substr(day, 1, 7) AS period_key, MIN(day) AS start_day, MAX(day) AS end_day,
766
+ SUM(cost_monitor_invocation_count) AS total_run_count,
767
+ SUM(cost_monitor_invocation_count) AS invocation_count,
768
+ SUM(llm_call_count) AS llm_call_count, SUM(source_event_count) AS source_event_count,
769
+ SUM(cost_monitor_total_duration) AS total_duration,
770
+ SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
771
+ FROM daily_aggregate_cache GROUP BY substr(day, 1, 7);
772
+ CREATE VIEW vw_cost_annual AS
773
+ SELECT substr(day, 1, 4) AS period_key, MIN(day) AS start_day, MAX(day) AS end_day,
774
+ SUM(cost_monitor_invocation_count) AS total_run_count,
775
+ SUM(cost_monitor_invocation_count) AS invocation_count,
776
+ SUM(llm_call_count) AS llm_call_count, SUM(source_event_count) AS source_event_count,
777
+ SUM(cost_monitor_total_duration) AS total_duration,
778
+ SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
779
+ FROM daily_aggregate_cache GROUP BY substr(day, 1, 4);
780
+ CREATE VIEW vw_cost_overview AS
781
+ -- MATERIALIZED keeps the expensive factual daily interval pipeline
782
+ -- to one evaluation for this three-grain overview response.
783
+ WITH daily AS MATERIALIZED (
784
+ SELECT day, cost_monitor_invocation_count, llm_call_count,
785
+ source_event_count, cost_monitor_total_duration,
786
+ cost_monitor_duration_eligible_runs, cost_monitor_duration_known_runs,
787
+ total_tokens, total_cost_usd, total_cost_brl
788
+ FROM daily_aggregate_cache
789
+ )
790
+ SELECT 'day' AS period_kind, day AS period_key,
791
+ cost_monitor_invocation_count AS total_run_count,
792
+ cost_monitor_invocation_count AS invocation_count,
793
+ llm_call_count, source_event_count,
794
+ cost_monitor_total_duration AS cost_monitor_total_duration,
795
+ total_tokens, total_cost_usd, total_cost_brl, day AS start_day, day AS end_day,
796
+ cost_monitor_total_duration AS total_duration
797
+ FROM daily
798
+ UNION ALL
799
+ SELECT 'month', substr(day, 1, 7), SUM(cost_monitor_invocation_count), SUM(cost_monitor_invocation_count),
800
+ SUM(llm_call_count), SUM(source_event_count),
801
+ SUM(cost_monitor_total_duration),
802
+ SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl), MIN(day), MAX(day),
803
+ SUM(cost_monitor_total_duration)
804
+ FROM daily GROUP BY substr(day, 1, 7)
805
+ UNION ALL
806
+ SELECT 'year', substr(day, 1, 4), SUM(cost_monitor_invocation_count), SUM(cost_monitor_invocation_count),
807
+ SUM(llm_call_count), SUM(source_event_count),
808
+ SUM(cost_monitor_total_duration),
809
+ SUM(total_tokens), SUM(total_cost_usd), SUM(total_cost_brl), MIN(day), MAX(day),
810
+ SUM(cost_monitor_total_duration)
811
+ FROM daily GROUP BY substr(day, 1, 4);
812
+ CREATE VIEW vw_cost_executions AS SELECT i.execution_id, i.execution_id AS title, e.status, NULL AS risk, MIN(i.occurred_at) AS occurred_at, MIN(i.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(*) AS invocation_count FROM invocations i LEFT JOIN executions e ON e.id = i.execution_id WHERE i.execution_id IS NOT NULL GROUP BY i.execution_id, e.status;
813
+ CREATE VIEW vw_cost_agent_invocations AS
814
+ SELECT i.*,
815
+ COUNT(u.usage_index) AS pricing_segment_count,
816
+ CASE WHEN COUNT(DISTINCT COALESCE(u.provider, '') || '|' || COALESCE(u.model, '') || '|' || COALESCE(u.service_tier, 'default') || '|' || COALESCE(CAST(u.context_input_multiplier AS TEXT), '') || '|' || COALESCE(CAST(u.context_output_multiplier AS TEXT), '')) > 1 THEN 1 ELSE 0 END AS pricing_mixed,
817
+ SUM(u.uncached_input_tokens) AS uncached_input_tokens,
818
+ SUM(u.visible_output_tokens) AS visible_output_tokens,
819
+ CASE COUNT(DISTINCT u.input_rate_usd_per_million) WHEN 1 THEN MIN(u.input_rate_usd_per_million) ELSE NULL END AS input_rate_usd_per_million,
820
+ CASE COUNT(DISTINCT u.cached_input_rate_usd_per_million) WHEN 1 THEN MIN(u.cached_input_rate_usd_per_million) ELSE NULL END AS cached_input_rate_usd_per_million,
821
+ CASE COUNT(DISTINCT u.output_rate_usd_per_million) WHEN 1 THEN MIN(u.output_rate_usd_per_million) ELSE NULL END AS output_rate_usd_per_million,
822
+ CASE COUNT(DISTINCT u.reasoning_rate_usd_per_million) WHEN 1 THEN MIN(u.reasoning_rate_usd_per_million) ELSE NULL END AS reasoning_rate_usd_per_million,
823
+ CASE COUNT(DISTINCT u.context_input_multiplier) WHEN 1 THEN MIN(u.context_input_multiplier) ELSE NULL END AS context_input_multiplier,
824
+ CASE COUNT(DISTINCT u.context_output_multiplier) WHEN 1 THEN MIN(u.context_output_multiplier) ELSE NULL END AS context_output_multiplier,
825
+ CASE COUNT(DISTINCT u.speed_cost_multiplier) WHEN 1 THEN MIN(u.speed_cost_multiplier) ELSE NULL END AS speed_cost_multiplier,
826
+ CASE COUNT(DISTINCT u.pricing_scenario) WHEN 1 THEN MIN(u.pricing_scenario) ELSE 'mixed' END AS pricing_scenario,
827
+ SUM(u.standard_cost_usd) AS standard_cost_usd,
828
+ SUM(u.speed_uplift_usd) AS speed_uplift_usd,
829
+ SUM(u.input_cost_usd) AS input_cost_usd,
830
+ SUM(u.cached_input_cost_usd) AS cached_input_cost_usd,
831
+ SUM(u.output_cost_usd) AS output_cost_usd,
832
+ SUM(u.reasoning_cost_usd) AS reasoning_cost_usd,
833
+ SUM(u.calculated_cost_usd) AS calculated_cost_usd,
834
+ SUM(u.recorded_cost_usd) AS recorded_cost_usd,
835
+ CASE COUNT(DISTINCT CASE WHEN u.recorded_cost_usd IS NOT NULL THEN u.fx_rate END)
836
+ WHEN 1 THEN MIN(CASE WHEN u.recorded_cost_usd IS NOT NULL THEN u.fx_rate END)
837
+ ELSE NULL
838
+ END AS recorded_fx_rate,
839
+ SUM(CASE WHEN u.recorded_cost_usd IS NOT NULL THEN u.cost_brl END) AS recorded_brl,
840
+ (SELECT json_extract(fx.content, '$.rate')
841
+ FROM files fx
842
+ WHERE fx.path LIKE '.agents/config/pricing/fx/%.json'
843
+ ORDER BY CASE WHEN fx.path LIKE '%/current-usd-brl.json' THEN 0 ELSE 1 END,
844
+ json_extract(fx.content, '$.as_of') DESC
845
+ LIMIT 1) AS current_fx_rate,
846
+ SUM(u.cost_variance_usd) AS cost_variance_usd,
847
+ CASE COUNT(DISTINCT u.pricing_model) WHEN 1 THEN MIN(u.pricing_model) ELSE NULL END AS audit_pricing_model,
848
+ CASE COUNT(DISTINCT u.pricing_source) WHEN 1 THEN MIN(u.pricing_source) ELSE NULL END AS audit_pricing_source
849
+ FROM invocations i LEFT JOIN invocation_usage u USING(agent_invocation_id)
850
+ GROUP BY i.agent_invocation_id;
851
+ CREATE VIEW vw_cost_zaip_agents AS SELECT zaip_agent, SUM(llm_call_count) AS llm_call_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl, COUNT(*) AS invocation_count FROM invocations GROUP BY zaip_agent;
852
+ CREATE VIEW vw_cost_models AS WITH usage AS (SELECT model, agent_invocation_id, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl FROM invocation_usage GROUP BY model, agent_invocation_id), calls AS (SELECT i.agent_invocation_id, CASE WHEN (SELECT COUNT(DISTINCT m.model) FROM invocation_usage m WHERE m.agent_invocation_id = i.agent_invocation_id AND m.model IS NOT NULL) = 1 THEN i.llm_call_count END AS llm_call_count FROM invocations i) SELECT u.model, SUM(c.llm_call_count) AS llm_call_count, SUM(u.total_tokens) AS total_tokens, SUM(u.cost_usd) AS cost_usd, SUM(u.cost_brl) AS cost_brl, COUNT(*) AS invocation_count FROM usage u JOIN calls c USING(agent_invocation_id) GROUP BY u.model;
853
+ CREATE VIEW vw_cost_providers AS WITH usage AS (SELECT provider, agent_invocation_id, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl FROM invocation_usage GROUP BY provider, agent_invocation_id), calls AS (SELECT i.agent_invocation_id, CASE WHEN (SELECT COUNT(DISTINCT p.provider) FROM invocation_usage p WHERE p.agent_invocation_id = i.agent_invocation_id AND p.provider IS NOT NULL) = 1 THEN i.llm_call_count END AS llm_call_count FROM invocations i) SELECT u.provider, SUM(c.llm_call_count) AS llm_call_count, SUM(u.total_tokens) AS total_tokens, SUM(u.cost_usd) AS cost_usd, SUM(u.cost_brl) AS cost_brl, COUNT(*) AS invocation_count FROM usage u JOIN calls c USING(agent_invocation_id) GROUP BY u.provider;
854
+ CREATE VIEW vw_cost_tasks AS SELECT i.task_id, COALESCE(MAX(t.title), i.task_id) AS title, MAX(t.status) AS status, MAX(t.risk) AS risk, MIN(i.occurred_at) AS occurred_at, MIN(i.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(*) AS invocation_count FROM invocations i LEFT JOIN tasks t ON t.id = i.task_id WHERE i.task_id IS NOT NULL GROUP BY i.task_id;
855
+ CREATE VIEW vw_cost_specs AS SELECT s.id AS spec_id, s.title, s.status, s.risk, COALESCE(MIN(i.occurred_at), s.occurred_at) AS occurred_at, COALESCE(MIN(i.occurred_day_sp), s.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(i.agent_invocation_id) AS invocation_count FROM specs s LEFT JOIN invocations i ON i.spec_id = s.id GROUP BY s.id, s.title, s.status, s.risk, s.occurred_at, s.occurred_day_sp;
856
+ CREATE VIEW vw_cost_prds AS SELECT p.id AS prd_id, p.title, p.status, p.risk, COALESCE(MIN(i.occurred_at), p.occurred_at) AS occurred_at, COALESCE(MIN(i.occurred_day_sp), p.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(i.agent_invocation_id) AS invocation_count FROM prds p LEFT JOIN invocations i ON i.prd_id = p.id GROUP BY p.id, p.title, p.status, p.risk, p.occurred_at, p.occurred_day_sp;
857
+ CREATE VIEW vw_cost_conversations AS SELECT i.conversation_id, i.conversation_id AS title, MAX(c.status) AS status, NULL AS risk, MIN(i.occurred_at) AS occurred_at, MIN(i.occurred_day_sp) AS occurred_day_sp, SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl, COUNT(*) AS invocation_count FROM invocations i LEFT JOIN conversations c ON c.id = i.conversation_id WHERE i.conversation_id IS NOT NULL GROUP BY i.conversation_id;
858
+ CREATE VIEW vw_operations_work_list AS SELECT * FROM vw_entities;
859
+ -- Full work summary retains historical activity coverage for internal
860
+ -- entity summaries. It is not the Kanban population.
861
+ CREATE VIEW vw_operations_work_summary AS
862
+ WITH task_lineage AS (
863
+ SELECT DISTINCT
864
+ CAST(task.value AS TEXT) AS task_id,
865
+ COALESCE(c.source_spec_id, CASE WHEN c.source_type='spec' THEN c.source_id END) AS spec_id,
866
+ COALESCE(c.source_prd_id, CASE WHEN c.source_type='prd' THEN c.source_id END) AS prd_id
867
+ FROM canonical_changes c, json_each(c.task_ids_json) AS task
868
+ ), lineage_cardinality AS (
869
+ -- Parent creation Runs are not observed Task Runs. They can be
870
+ -- displayed on a child only when exactly one canonical Task owns
871
+ -- that lineage, preventing a shared macro total from being copied
872
+ -- into sibling cards.
873
+ SELECT spec_id, prd_id, COUNT(*) AS task_count
874
+ FROM task_lineage
875
+ GROUP BY spec_id, prd_id
876
+ ), entity_activity AS (
877
+ SELECT 'task' AS entity_kind, task_id AS entity_id, * FROM activities WHERE task_id IS NOT NULL
878
+ UNION ALL SELECT 'spec', spec_id, * FROM activities WHERE spec_id IS NOT NULL
879
+ UNION ALL SELECT 'prd', prd_id, * FROM activities WHERE prd_id IS NOT NULL
880
+ UNION ALL
881
+ SELECT 'task', l.task_id, a.*
882
+ FROM task_lineage l
883
+ JOIN lineage_cardinality cardinality
884
+ ON cardinality.spec_id IS l.spec_id AND cardinality.prd_id IS l.prd_id
885
+ JOIN activities a
886
+ ON a.task_id IS NULL
887
+ AND (
888
+ (l.spec_id IS NOT NULL AND a.spec_id = l.spec_id)
889
+ OR (
890
+ l.spec_id IS NULL
891
+ AND l.prd_id IS NOT NULL
892
+ AND a.spec_id IS NULL
893
+ AND a.prd_id = l.prd_id
894
+ )
895
+ )
896
+ WHERE cardinality.task_count = 1
897
+ AND NOT EXISTS (SELECT 1 FROM activities direct WHERE direct.task_id = l.task_id)
898
+ ), financial AS (
899
+ SELECT entity_kind, entity_id,
900
+ COUNT(*) AS invocation_count,
901
+ SUM(llm_call_count) AS llm_call_count,
902
+ SUM(total_tokens) AS total_tokens,
903
+ SUM(cost_usd) AS total_cost_usd,
904
+ SUM(cost_brl) AS total_cost_brl
905
+ FROM entity_activity GROUP BY entity_kind, entity_id
906
+ ), durations AS (
907
+ SELECT entity_kind, entity_id, ROUND(SUM(duration_ms)) AS total_duration
908
+ FROM entity_activity GROUP BY entity_kind, entity_id
909
+ )
910
+ SELECT w.entity_kind, w.id, w.title, w.status, w.risk, w.occurred_at, w.occurred_day_sp,
911
+ f.invocation_count, f.llm_call_count, d.total_duration,
912
+ f.total_tokens, f.total_cost_usd, f.total_cost_brl
913
+ FROM work_items w
914
+ LEFT JOIN financial f ON f.entity_kind=w.entity_kind AND f.entity_id=w.id
915
+ LEFT JOIN durations d ON d.entity_kind=w.entity_kind AND d.entity_id=w.id;
916
+ -- Kanban is a lifecycle surface: it lists only canonical records.
917
+ -- Telemetry-only identifiers remain Cost Monitor facts but cannot
918
+ -- create a synthetic operational card.
919
+ CREATE VIEW vw_operations_work_kanban AS
920
+ SELECT summary.*
921
+ FROM canonical_work_items canonical
922
+ JOIN vw_operations_work_summary summary
923
+ ON summary.entity_kind=canonical.entity_kind AND summary.id=canonical.id;
924
+ CREATE VIEW vw_operations_executions AS
925
+ WITH metrics AS (
926
+ SELECT i.execution_id,
927
+ CASE COUNT(DISTINCT t.risk) WHEN 0 THEN NULL WHEN 1 THEN MIN(t.risk) ELSE 'mixed' END AS risk,
928
+ MIN(i.occurred_at) AS telemetry_started_at,
929
+ SUM(i.llm_call_count) AS llm_call_count,
930
+ SUM(i.duration_ms) AS duration_ms,
931
+ CASE WHEN COUNT(i.duration_ms) > 0 THEN 'observed' ELSE 'unavailable' END AS duration_provenance,
932
+ SUM(i.total_tokens) AS total_tokens,
933
+ SUM(i.cost_brl) AS total_cost_brl,
934
+ COUNT(*) AS invocation_count
935
+ FROM invocations i LEFT JOIN tasks t ON t.id=i.task_id
936
+ WHERE i.execution_id IS NOT NULL GROUP BY i.execution_id
937
+ )
938
+ SELECT c.id AS execution_id, c.status, m.risk,
939
+ c.created_at AS started_at, c.finished_at,
940
+ c.kind AS execution_kind, c.origin_type,
941
+ CASE WHEN c.origin_type='task' THEN c.origin_id END AS task_id,
942
+ CASE WHEN c.origin_type='interaction' THEN c.origin_id END AS conversation_id,
943
+ m.llm_call_count, m.duration_ms, COALESCE(m.duration_provenance, 'unavailable') AS duration_provenance,
944
+ CASE WHEN c.status IN ('completed', 'failed', 'cancelled') AND c.finished_at IS NOT NULL THEN MAX(0, CAST((julianday(c.finished_at) - julianday(c.created_at)) * 86400000 AS INTEGER)) ELSE NULL END AS lifecycle_elapsed_ms,
945
+ m.total_tokens, m.total_cost_brl,
946
+ COALESCE(m.invocation_count, 0) AS invocation_count,
947
+ c.source_path
948
+ FROM canonical_executions c LEFT JOIN metrics m ON m.execution_id=c.id
949
+ UNION ALL
950
+ SELECT i.execution_id, MAX(i.status),
951
+ CASE COUNT(DISTINCT t.risk) WHEN 0 THEN NULL WHEN 1 THEN MIN(t.risk) ELSE 'mixed' END,
952
+ MIN(i.occurred_at), MAX(i.occurred_at), NULL, NULL, MAX(i.task_id), MAX(i.conversation_id),
953
+ SUM(i.llm_call_count), SUM(i.duration_ms), CASE WHEN COUNT(i.duration_ms) > 0 THEN 'observed' ELSE 'unavailable' END, NULL, SUM(i.total_tokens), SUM(i.cost_brl), COUNT(*), NULL
954
+ FROM invocations i LEFT JOIN tasks t ON t.id=i.task_id
955
+ WHERE i.execution_id IS NOT NULL
956
+ AND NOT EXISTS (SELECT 1 FROM canonical_executions c WHERE c.id=i.execution_id)
957
+ GROUP BY i.execution_id;
958
+ CREATE VIEW vw_operations_agent_invocations AS
959
+ SELECT c.*,
960
+ date(COALESCE(c.source_started_at, c.source_occurred_at, c.occurred_at), '-3 hours') AS source_day_sp,
961
+ t.risk
962
+ FROM vw_cost_agent_invocations c LEFT JOIN tasks t ON t.id=c.task_id;
963
+ CREATE VIEW vw_operations_conversations AS
964
+ SELECT i.conversation_id, c.status,
965
+ CASE COUNT(DISTINCT t.risk) WHEN 0 THEN NULL WHEN 1 THEN MIN(t.risk) ELSE 'mixed' END AS risk,
966
+ MIN(i.occurred_at) AS started_at, MAX(i.occurred_at) AS finished_at,
967
+ SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration,
968
+ CASE WHEN COUNT(i.duration_ms) > 0 THEN 'observed' ELSE 'unavailable' END AS duration_provenance,
969
+ SUM(i.total_tokens) AS total_tokens, SUM(i.cost_brl) AS total_cost_brl,
970
+ GROUP_CONCAT(DISTINCT CASE WHEN i.model IS NULL OR trim(i.model) = '' OR lower(i.model) = 'unknown' THEN NULL ELSE i.model END) AS model,
971
+ GROUP_CONCAT(DISTINCT CASE WHEN i.reasoning_effort IS NULL OR trim(i.reasoning_effort) = '' OR lower(i.reasoning_effort) = 'unknown' THEN NULL ELSE i.reasoning_effort END) AS reasoning_effort,
972
+ COUNT(*) AS invocation_count
973
+ FROM invocations i LEFT JOIN conversations c ON c.id=i.conversation_id LEFT JOIN tasks t ON t.id=i.task_id
974
+ WHERE i.conversation_id IS NOT NULL GROUP BY i.conversation_id, c.status
975
+ UNION ALL
976
+ SELECT c.id, c.status, NULL, c.occurred_at, NULL, NULL, NULL, 'unavailable', NULL, NULL, NULL, NULL, 0
977
+ FROM conversations c
978
+ WHERE NOT EXISTS (SELECT 1 FROM invocations i WHERE i.conversation_id=c.id);
979
+ CREATE VIEW vw_operations_decisions AS SELECT * FROM decisions;
980
+ CREATE VIEW vw_operations_changes AS SELECT * FROM changes;
981
+ CREATE VIEW vw_operations_daily AS SELECT period_key AS day, * FROM operations_overview WHERE period_kind = 'day';
982
+ CREATE VIEW vw_operations_monthly AS SELECT * FROM operations_overview WHERE period_kind = 'month';
983
+ CREATE VIEW vw_operations_annual AS SELECT * FROM operations_overview WHERE period_kind = 'year';
984
+ CREATE VIEW vw_first_fold_overview AS SELECT * FROM vw_overview_daily;
985
+ CREATE VIEW vw_first_fold_task_status AS SELECT * FROM vw_task_status_daily;
986
+ CREATE VIEW vw_first_fold_task_risk AS SELECT * FROM vw_task_risk_daily;
987
+ CREATE VIEW vw_first_fold_top_tasks AS SELECT t.*, c.total_duration, c.total_tokens, c.total_cost_usd, c.total_cost_brl FROM task_summary t LEFT JOIN (SELECT task_id, SUM(llm_call_count) AS llm_call_count, SUM(duration_ms) AS total_duration, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM invocations GROUP BY task_id) c ON c.task_id = t.id ORDER BY c.total_duration DESC;
988
+ CREATE VIEW vw_first_fold_overview_all_time AS
989
+ WITH totals AS (
990
+ SELECT MIN(day) AS start_day, MAX(day) AS end_day,
991
+ SUM(total_run_count) AS total_run_count,
992
+ SUM(invocation_count) AS agent_invocation_count,
993
+ SUM(llm_call_count) AS llm_call_count,
994
+ ROUND(SUM(total_duration)) AS total_duration_ms,
995
+ SUM(total_tokens) AS total_tokens,
996
+ SUM(total_cost_usd) AS total_cost_usd,
997
+ SUM(total_cost_brl) AS total_cost_brl,
998
+ SUM(CASE WHEN total_duration IS NOT NULL THEN 1 ELSE 0 END) AS execution_day_count
999
+ FROM daily_aggregates
1000
+ ), task_totals AS (
1001
+ SELECT COUNT(*) AS task_count,
1002
+ SUM(CASE WHEN status='completed' THEN 1 ELSE 0 END) AS completed_task_count,
1003
+ MAX(occurred_at) AS latest_task_created_at
1004
+ FROM task_summary
1005
+ ), spec_totals AS (
1006
+ SELECT COUNT(*) AS spec_count,
1007
+ SUM(CASE WHEN status IN ('completed','delivered') THEN 1 ELSE 0 END) AS completed_spec_count
1008
+ FROM spec_summary
1009
+ ), prd_totals AS (
1010
+ SELECT COUNT(*) AS prd_count,
1011
+ SUM(CASE WHEN status IN ('completed','delivered') THEN 1 ELSE 0 END) AS completed_prd_count
1012
+ FROM prd_summary
1013
+ )
1014
+ SELECT 'all' AS period_key, totals.start_day, totals.end_day,
1015
+ task_totals.task_count, task_totals.completed_task_count,
1016
+ spec_totals.spec_count, spec_totals.completed_spec_count,
1017
+ prd_totals.prd_count, prd_totals.completed_prd_count,
1018
+ totals.total_run_count, totals.agent_invocation_count, totals.llm_call_count,
1019
+ totals.total_duration_ms, totals.total_tokens,
1020
+ totals.total_cost_usd, totals.total_cost_brl, totals.execution_day_count,
1021
+ task_totals.latest_task_created_at
1022
+ FROM totals CROSS JOIN task_totals CROSS JOIN spec_totals CROSS JOIN prd_totals;
1023
+ CREATE VIEW vw_first_fold_task_status_all_time AS
1024
+ WITH counts AS (
1025
+ SELECT COALESCE(status, 'draft') AS status, COUNT(*) AS task_count
1026
+ FROM task_summary GROUP BY COALESCE(status, 'draft')
1027
+ ), total AS (SELECT SUM(task_count) AS task_count FROM counts)
1028
+ SELECT counts.status, counts.task_count,
1029
+ CASE WHEN total.task_count = 0 THEN 0.0 ELSE CAST(counts.task_count AS REAL) / total.task_count END AS task_percentage
1030
+ FROM counts CROSS JOIN total;
1031
+ CREATE VIEW vw_first_fold_task_risk_all_time AS
1032
+ WITH counts AS (
1033
+ SELECT COALESCE(risk, 'standard') AS risk, COUNT(*) AS task_count
1034
+ FROM task_summary GROUP BY COALESCE(risk, 'standard')
1035
+ ), total AS (SELECT SUM(task_count) AS task_count FROM counts)
1036
+ SELECT counts.risk, counts.task_count,
1037
+ CASE WHEN total.task_count = 0 THEN 0.0 ELSE CAST(counts.task_count AS REAL) / total.task_count END AS task_percentage
1038
+ FROM counts CROSS JOIN total;
1039
+ CREATE VIEW vw_first_fold_task_metrics_all_time AS
1040
+ SELECT overview.task_count,
1041
+ CASE WHEN overview.task_count = 0 OR overview.total_duration_ms IS NULL THEN NULL ELSE overview.total_duration_ms / overview.task_count END AS average_duration_ms_per_task,
1042
+ CASE WHEN overview.task_count = 0 OR overview.total_tokens IS NULL THEN NULL ELSE overview.total_tokens / overview.task_count END AS average_tokens_per_task,
1043
+ CASE WHEN overview.task_count = 0 OR overview.total_cost_usd IS NULL THEN NULL ELSE overview.total_cost_usd / overview.task_count END AS average_cost_usd_per_task,
1044
+ CASE WHEN overview.task_count = 0 OR overview.total_cost_brl IS NULL THEN NULL ELSE overview.total_cost_brl / overview.task_count END AS average_cost_brl_per_task,
1045
+ overview.latest_task_created_at
1046
+ FROM vw_first_fold_overview_all_time overview;
1047
+ CREATE VIEW vw_first_fold_spec_status_all_time AS
1048
+ WITH counts AS (
1049
+ SELECT CASE
1050
+ WHEN status='cancelled' THEN 'cancelled'
1051
+ WHEN status='failed' THEN 'failed'
1052
+ WHEN status='blocked' THEN 'blocked'
1053
+ WHEN status IN ('delivered','completed') THEN 'completed'
1054
+ WHEN status='ready' THEN 'ready'
1055
+ WHEN status='draft' THEN 'planning'
1056
+ WHEN status='verifying' THEN 'verifying'
1057
+ WHEN status IN ('active','executing') THEN 'executing'
1058
+ ELSE 'planning'
1059
+ END AS stage, COUNT(*) AS entity_count
1060
+ FROM spec_summary GROUP BY stage
1061
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1062
+ SELECT counts.stage, counts.entity_count,
1063
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1064
+ FROM counts CROSS JOIN total;
1065
+ CREATE VIEW vw_first_fold_prd_status_all_time AS
1066
+ WITH counts AS (
1067
+ SELECT CASE
1068
+ WHEN status='cancelled' THEN 'cancelled'
1069
+ WHEN status='failed' THEN 'failed'
1070
+ WHEN status='blocked' THEN 'blocked'
1071
+ WHEN status IN ('delivered','completed') THEN 'completed'
1072
+ WHEN status='ready' THEN 'ready'
1073
+ WHEN status='draft' THEN 'definition'
1074
+ WHEN status='verifying' THEN 'verifying'
1075
+ WHEN status IN ('active','executing') THEN 'executing'
1076
+ ELSE 'definition'
1077
+ END AS stage, COUNT(*) AS entity_count
1078
+ FROM prd_summary GROUP BY stage
1079
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1080
+ SELECT counts.stage, counts.entity_count,
1081
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1082
+ FROM counts CROSS JOIN total;
1083
+ CREATE VIEW vw_first_fold_spec_classification_all_time AS
1084
+ WITH rollup AS (
1085
+ SELECT s.id, COUNT(DISTINCT a.task_id) AS task_count,
1086
+ SUM(CASE WHEN a.work_type='rework' AND a.run_role='root' THEN 1 ELSE 0 END) AS rework_run_count
1087
+ FROM spec_summary s LEFT JOIN activities a ON a.spec_id=s.id GROUP BY s.id
1088
+ ), counts AS (
1089
+ SELECT CASE WHEN rework_run_count>0 THEN 'rework' WHEN task_count>0 THEN 'structured' ELSE 'empty' END AS classification,
1090
+ COUNT(*) AS entity_count
1091
+ FROM rollup GROUP BY classification
1092
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1093
+ SELECT counts.classification, counts.entity_count,
1094
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1095
+ FROM counts CROSS JOIN total;
1096
+ CREATE VIEW vw_first_fold_prd_classification_all_time AS
1097
+ WITH rollup AS (
1098
+ SELECT p.id, COUNT(DISTINCT a.task_id) AS task_count,
1099
+ SUM(CASE WHEN a.work_type='rework' AND a.run_role='root' THEN 1 ELSE 0 END) AS rework_run_count
1100
+ FROM prd_summary p LEFT JOIN activities a ON a.prd_id=p.id GROUP BY p.id
1101
+ ), counts AS (
1102
+ SELECT CASE WHEN rework_run_count>0 THEN 'rework' WHEN task_count>0 THEN 'structured' ELSE 'empty' END AS classification,
1103
+ COUNT(*) AS entity_count
1104
+ FROM rollup GROUP BY classification
1105
+ ), total AS (SELECT SUM(entity_count) AS entity_count FROM counts)
1106
+ SELECT counts.classification, counts.entity_count,
1107
+ CASE WHEN total.entity_count=0 THEN 0.0 ELSE CAST(counts.entity_count AS REAL)/total.entity_count END AS entity_percentage
1108
+ FROM counts CROSS JOIN total;
1109
+ CREATE VIEW vw_first_fold_spec_metrics_all_time AS
1110
+ WITH usage AS (
1111
+ SELECT spec_id,
1112
+ COUNT(*) AS total_run_count,
1113
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1114
+ SUM(total_tokens) AS total_tokens,
1115
+ SUM(cost_usd) AS total_cost_usd,
1116
+ SUM(cost_brl) AS total_cost_brl
1117
+ FROM activities WHERE spec_id IS NOT NULL GROUP BY spec_id
1118
+ )
1119
+ SELECT COUNT(*) AS entity_count,
1120
+ SUM(usage.total_run_count) AS total_run_count,
1121
+ SUM(usage.total_duration_ms) AS total_duration_ms,
1122
+ SUM(usage.total_tokens) AS total_tokens,
1123
+ SUM(usage.total_cost_usd) AS total_cost_usd,
1124
+ SUM(usage.total_cost_brl) AS total_cost_brl,
1125
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_duration_ms)/COUNT(*) END AS average_duration_ms,
1126
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_tokens)/COUNT(*) END AS average_tokens,
1127
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_usd)/COUNT(*) END AS average_cost_usd,
1128
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_brl)/COUNT(*) END AS average_cost_brl,
1129
+ MAX(s.occurred_at) AS latest_created_at
1130
+ FROM spec_summary s LEFT JOIN usage ON usage.spec_id=s.id;
1131
+ CREATE VIEW vw_first_fold_prd_metrics_all_time AS
1132
+ WITH usage AS (
1133
+ SELECT prd_id,
1134
+ COUNT(*) AS total_run_count,
1135
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1136
+ SUM(total_tokens) AS total_tokens,
1137
+ SUM(cost_usd) AS total_cost_usd,
1138
+ SUM(cost_brl) AS total_cost_brl
1139
+ FROM activities WHERE prd_id IS NOT NULL GROUP BY prd_id
1140
+ )
1141
+ SELECT COUNT(*) AS entity_count,
1142
+ SUM(usage.total_run_count) AS total_run_count,
1143
+ SUM(usage.total_duration_ms) AS total_duration_ms,
1144
+ SUM(usage.total_tokens) AS total_tokens,
1145
+ SUM(usage.total_cost_usd) AS total_cost_usd,
1146
+ SUM(usage.total_cost_brl) AS total_cost_brl,
1147
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_duration_ms)/COUNT(*) END AS average_duration_ms,
1148
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_tokens)/COUNT(*) END AS average_tokens,
1149
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_usd)/COUNT(*) END AS average_cost_usd,
1150
+ CASE WHEN COUNT(*)=0 THEN NULL ELSE SUM(usage.total_cost_brl)/COUNT(*) END AS average_cost_brl,
1151
+ MAX(p.occurred_at) AS latest_created_at
1152
+ FROM prd_summary p LEFT JOIN usage ON usage.prd_id=p.id;
1153
+ CREATE VIEW vw_first_fold_top_specs_all_time AS
1154
+ WITH usage AS (
1155
+ SELECT spec_id,
1156
+ COUNT(*) AS total_run_count,
1157
+ SUM(llm_call_count) AS llm_call_count,
1158
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1159
+ SUM(total_tokens) AS total_tokens,
1160
+ SUM(cost_usd) AS total_cost_usd,
1161
+ SUM(cost_brl) AS total_cost_brl
1162
+ FROM activities WHERE spec_id IS NOT NULL GROUP BY spec_id
1163
+ ), ranked AS (
1164
+ SELECT s.id AS entity_id, s.title, s.status, usage.total_run_count, usage.llm_call_count,
1165
+ usage.total_duration_ms, usage.total_tokens, usage.total_cost_usd, usage.total_cost_brl,
1166
+ ROW_NUMBER() OVER (ORDER BY usage.total_duration_ms IS NOT NULL DESC, usage.total_duration_ms DESC, usage.total_run_count DESC, s.id) AS rank
1167
+ FROM spec_summary s LEFT JOIN usage ON usage.spec_id=s.id
1168
+ ), total AS (SELECT SUM(total_duration_ms) AS total_duration_ms FROM ranked)
1169
+ SELECT ranked.rank, ranked.entity_id, ranked.title, ranked.status,
1170
+ COALESCE(ranked.total_run_count,0) AS total_run_count, ranked.llm_call_count,
1171
+ ranked.total_duration_ms, ranked.total_tokens, ranked.total_cost_usd, ranked.total_cost_brl,
1172
+ CASE WHEN total.total_duration_ms IS NULL OR total.total_duration_ms=0 OR ranked.total_duration_ms IS NULL THEN 0.0 ELSE ranked.total_duration_ms/total.total_duration_ms END AS duration_share
1173
+ FROM ranked CROSS JOIN total WHERE ranked.rank<=5 ORDER BY ranked.rank;
1174
+ CREATE VIEW vw_first_fold_top_prds_all_time AS
1175
+ WITH usage AS (
1176
+ SELECT prd_id,
1177
+ COUNT(*) AS total_run_count,
1178
+ SUM(llm_call_count) AS llm_call_count,
1179
+ ROUND(SUM(duration_ms)) AS total_duration_ms,
1180
+ SUM(total_tokens) AS total_tokens,
1181
+ SUM(cost_usd) AS total_cost_usd,
1182
+ SUM(cost_brl) AS total_cost_brl
1183
+ FROM activities WHERE prd_id IS NOT NULL GROUP BY prd_id
1184
+ ), ranked AS (
1185
+ SELECT p.id AS entity_id, p.title, p.status, usage.total_run_count, usage.llm_call_count,
1186
+ usage.total_duration_ms, usage.total_tokens, usage.total_cost_usd, usage.total_cost_brl,
1187
+ ROW_NUMBER() OVER (ORDER BY usage.total_duration_ms IS NOT NULL DESC, usage.total_duration_ms DESC, usage.total_run_count DESC, p.id) AS rank
1188
+ FROM prd_summary p LEFT JOIN usage ON usage.prd_id=p.id
1189
+ ), total AS (SELECT SUM(total_duration_ms) AS total_duration_ms FROM ranked)
1190
+ SELECT ranked.rank, ranked.entity_id, ranked.title, ranked.status,
1191
+ COALESCE(ranked.total_run_count,0) AS total_run_count, ranked.llm_call_count,
1192
+ ranked.total_duration_ms, ranked.total_tokens, ranked.total_cost_usd, ranked.total_cost_brl,
1193
+ CASE WHEN total.total_duration_ms IS NULL OR total.total_duration_ms=0 OR ranked.total_duration_ms IS NULL THEN 0.0 ELSE ranked.total_duration_ms/total.total_duration_ms END AS duration_share
1194
+ FROM ranked CROSS JOIN total WHERE ranked.rank<=5 ORDER BY ranked.rank;
1195
+ CREATE VIEW vw_first_fold_top_tasks_all_time AS
1196
+ WITH duration AS (
1197
+ SELECT a.task_id, ROUND(SUM(f.attributed_token_active_ms)) AS total_duration_ms
1198
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id)
1199
+ WHERE a.task_id IS NOT NULL AND a.phase='execution' GROUP BY a.task_id
1200
+ ), usage AS (
1201
+ SELECT task_id, COUNT(*) AS total_run_count, SUM(llm_call_count) AS llm_call_count,
1202
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl
1203
+ FROM activities WHERE task_id IS NOT NULL AND phase='execution' GROUP BY task_id
1204
+ ), ranked AS (
1205
+ SELECT t.id AS task_id, t.title, t.status, t.risk,
1206
+ usage.total_run_count, usage.llm_call_count, duration.total_duration_ms,
1207
+ usage.total_tokens, usage.total_cost_usd, usage.total_cost_brl,
1208
+ ROW_NUMBER() OVER (ORDER BY duration.total_duration_ms DESC, t.id) AS rank
1209
+ FROM duration JOIN task_summary t ON t.id=duration.task_id
1210
+ LEFT JOIN usage ON usage.task_id=duration.task_id
1211
+ ), total AS (SELECT SUM(total_duration_ms) AS total_duration_ms FROM ranked)
1212
+ SELECT ranked.rank, ranked.task_id, ranked.title, ranked.status, ranked.risk,
1213
+ ranked.total_run_count, ranked.llm_call_count, ranked.total_duration_ms,
1214
+ ranked.total_tokens, ranked.total_cost_usd, ranked.total_cost_brl,
1215
+ CASE WHEN total.total_duration_ms IS NULL OR total.total_duration_ms = 0 THEN 0.0 ELSE ranked.total_duration_ms / total.total_duration_ms END AS duration_share
1216
+ FROM ranked CROSS JOIN total WHERE ranked.rank <= 5 ORDER BY ranked.rank;
1217
+ CREATE VIEW vw_first_fold_task_summary AS SELECT * FROM vw_task_summary;
1218
+ CREATE VIEW vw_first_fold_spec_summary AS SELECT * FROM vw_spec_summary;
1219
+ CREATE VIEW vw_first_fold_prd_summary AS SELECT * FROM vw_prd_summary;
1220
+ CREATE VIEW cost_monitor_daily AS SELECT * FROM vw_cost_daily;
1221
+ CREATE VIEW cost_monitor_monthly AS SELECT * FROM vw_cost_monthly;
1222
+ CREATE VIEW cost_monitor_annual AS SELECT * FROM vw_cost_annual;
1223
+ CREATE VIEW cost_monitor_overview_view AS SELECT * FROM vw_cost_overview;
1224
+ CREATE VIEW cost_monitor_executions AS SELECT * FROM vw_cost_executions;
1225
+ CREATE VIEW cost_monitor_agent_invocations AS SELECT * FROM vw_cost_agent_invocations;
1226
+ CREATE VIEW cost_monitor_zaip_agents AS SELECT * FROM vw_cost_zaip_agents;
1227
+ CREATE VIEW cost_monitor_models AS SELECT * FROM vw_cost_models;
1228
+ CREATE VIEW cost_monitor_providers AS SELECT * FROM vw_cost_providers;
1229
+ CREATE VIEW cost_monitor_tasks AS SELECT * FROM vw_cost_tasks;
1230
+ CREATE VIEW cost_monitor_specs AS SELECT * FROM vw_cost_specs;
1231
+ CREATE VIEW cost_monitor_prds AS SELECT * FROM vw_cost_prds;
1232
+ CREATE VIEW cost_monitor_conversations AS SELECT * FROM vw_cost_conversations;
1233
+ CREATE VIEW operations_work_list AS SELECT * FROM vw_operations_work_list;
1234
+ CREATE VIEW operations_work_summary AS SELECT * FROM vw_operations_work_summary;
1235
+ CREATE VIEW operations_work_kanban AS SELECT * FROM vw_operations_work_kanban;
1236
+ CREATE VIEW operations_executions AS SELECT * FROM vw_operations_executions;
1237
+ CREATE VIEW operations_agent_invocations AS SELECT * FROM vw_operations_agent_invocations;
1238
+ CREATE VIEW operations_conversations AS SELECT * FROM vw_operations_conversations;
1239
+ CREATE VIEW operations_decisions AS SELECT * FROM vw_operations_decisions;
1240
+ CREATE VIEW operations_changes AS SELECT * FROM vw_operations_changes;
1241
+ CREATE VIEW operations_daily AS SELECT * FROM vw_operations_daily;
1242
+ CREATE VIEW operations_monthly AS SELECT * FROM vw_operations_monthly;
1243
+ CREATE VIEW operations_annual AS SELECT * FROM vw_operations_annual;
1244
+ CREATE VIEW first_fold_overview AS SELECT * FROM vw_first_fold_overview;
1245
+ CREATE VIEW first_fold_task_status AS SELECT * FROM vw_first_fold_task_status;
1246
+ CREATE VIEW first_fold_task_risk AS SELECT * FROM vw_first_fold_task_risk;
1247
+ CREATE VIEW first_fold_top_tasks AS SELECT * FROM vw_first_fold_top_tasks;
1248
+ CREATE VIEW first_fold_overview_all_time AS SELECT * FROM vw_first_fold_overview_all_time;
1249
+ CREATE VIEW first_fold_task_status_all_time AS SELECT * FROM vw_first_fold_task_status_all_time;
1250
+ CREATE VIEW first_fold_task_risk_all_time AS SELECT * FROM vw_first_fold_task_risk_all_time;
1251
+ CREATE VIEW first_fold_task_metrics_all_time AS SELECT * FROM vw_first_fold_task_metrics_all_time;
1252
+ CREATE VIEW first_fold_top_tasks_all_time AS SELECT * FROM vw_first_fold_top_tasks_all_time;
1253
+ CREATE VIEW first_fold_spec_status_all_time AS SELECT * FROM vw_first_fold_spec_status_all_time;
1254
+ CREATE VIEW first_fold_spec_classification_all_time AS SELECT * FROM vw_first_fold_spec_classification_all_time;
1255
+ CREATE VIEW first_fold_spec_metrics_all_time AS SELECT * FROM vw_first_fold_spec_metrics_all_time;
1256
+ CREATE VIEW first_fold_top_specs_all_time AS SELECT * FROM vw_first_fold_top_specs_all_time;
1257
+ CREATE VIEW first_fold_prd_status_all_time AS SELECT * FROM vw_first_fold_prd_status_all_time;
1258
+ CREATE VIEW first_fold_prd_classification_all_time AS SELECT * FROM vw_first_fold_prd_classification_all_time;
1259
+ CREATE VIEW first_fold_prd_metrics_all_time AS SELECT * FROM vw_first_fold_prd_metrics_all_time;
1260
+ CREATE VIEW first_fold_top_prds_all_time AS SELECT * FROM vw_first_fold_top_prds_all_time;
1261
+ CREATE VIEW first_fold_task AS SELECT * FROM vw_first_fold_task_summary;
1262
+ CREATE VIEW first_fold_spec AS SELECT * FROM vw_first_fold_spec_summary;
1263
+ CREATE VIEW first_fold_prd AS SELECT * FROM vw_first_fold_prd_summary;
1264
+ CREATE VIEW task_summary_daily AS SELECT * FROM vw_task_summary_daily;
1265
+ CREATE VIEW spec_summary_daily AS SELECT * FROM vw_spec_summary_daily;
1266
+ CREATE VIEW prd_summary_daily AS SELECT * FROM vw_prd_summary_daily;
1267
+ CREATE VIEW task_status_daily AS SELECT * FROM vw_task_status_daily;
1268
+ CREATE VIEW task_risk_daily AS SELECT * FROM vw_task_risk_daily;
1269
+ COMMIT;`,M$=[...Gh.matchAll(/\bCREATE VIEW ([A-Za-z_][A-Za-z0-9_]*)/g)].map(K=>K[1]).filter(K=>K!==void 0).reduce((K,we)=>{let se=we.startsWith("vw_")?we.slice(3):we;return K.replace(new RegExp(`\\b${we}\\b`,"g"),`zaip_vw_${se}`)},Gh),Xh=new Set,L$=M$.replace(/\bCREATE VIEW ([A-Za-z_][A-Za-z0-9_]*)[\s\S]*?;/g,(K,we)=>Xh.has(we)?"":(Xh.add(we),K));_.exec(L$),o("projection_finalize",80,"Finalizando \xEDndices e a c\xF3pia local do dashboard."),p=I}catch(b){throw _.exec("ROLLBACK;"),b}}finally{_.close()}try{await(0,et.rename)(u,c)}catch(b){if(qh(c,a)===null)throw await(0,et.rm)(u,{force:!0}),b;await(0,et.rm)(u,{force:!0})}let v=performance.now();await Vh(c,n);let f=new Et(e),h=f.firstFoldViewportAllTime(),k=nK(),w={from_day:k.from,to_day:k.to,source_latest_day:f.firstFoldRelevantLatestDay(),aggregate:f.firstFoldAggregate(k),pages:{task:f.summaryPage("task",k,0,1e4).rows,spec:f.summaryPage("spec",k,0,1e4).rows,prd:f.summaryPage("prd",k,0,1e4).rows},top_tasks:f.topTasks(k)};f.close();let O=JSON.stringify(h),g=JSON.stringify(w);for(let b of[c,n]){let T=new Ci.DatabaseSync(b);try{T.prepare(`INSERT INTO zaip_aios_activities(
1270
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
1271
+ recorded_at, run_role, root_run_id, payload_type, payload_json
1272
+ ) VALUES (?, 'technical_payload', 'first_fold_viewport_cache:all_time',
1273
+ 'sqlite://first_fold_viewport_cache/all_time', '', datetime('now'), 'technical', 'technical',
1274
+ 'first_fold_viewport_cache', ?)`).run(`TECH-${(0,bn.randomUUID)().toLowerCase()}`,O),T.prepare(`INSERT INTO zaip_aios_activities(
1275
+ activity_row_id, activity_source_kind, activity_key, source_path, source_hash,
1276
+ recorded_at, run_role, root_run_id, payload_type, payload_json
1277
+ ) VALUES (?, 'technical_payload', 'first_fold_monthly_quick_cache:default',
1278
+ 'sqlite://first_fold_monthly_quick_cache/default', '', datetime('now'), 'technical', 'technical',
1279
+ 'first_fold_monthly_quick_cache', ?)`).run(`TECH-${(0,bn.randomUUID)().toLowerCase()}`,g)}finally{T.close()}}return o("snapshot_ready",86,"A c\xF3pia privada do banco local est\xE1 pronta."),oc(n),await vK((0,st.dirname)(c),c),{files:p,path:n,cache:"rebuilt",fingerprint_ms:s,materialize_ms:Math.round(performance.now()-v)}}async function vK(e,t){let n=await(0,et.readdir)(e,{withFileTypes:!0}).catch(()=>[]),i=await Promise.all(n.filter(r=>r.isFile()&&r.name.endsWith(".sqlite")&&(0,st.resolve)(e,r.name)!==t).map(async r=>({path:(0,st.resolve)(e,r.name),mtime:(await(0,et.stat)((0,st.resolve)(e,r.name))).mtimeMs})));for(let r of i.sort((o,a)=>a.mtime-o.mtime).slice(1))await(0,et.rm)(r.path,{force:!0}).catch(()=>{});for(let r of n){if(!r.isFile()||!r.name.includes(".sqlite.")||!r.name.includes(".tmp"))continue;let o=(0,st.resolve)(e,r.name);Date.now()-(await(0,et.stat)(o)).mtimeMs>6e4&&await(0,et.rm)(o,{force:!0}).catch(()=>{})}}function qh(e,t){try{let n=new Ci.DatabaseSync(e,{readOnly:!0}),i=n.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("source_fingerprint")?.value,r=n.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("schema_version")?.value,o=Number(n.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("source_file_count")?.value??0);return n.close(),i===t&&r===go?o:null}catch{return null}}async function bK(e){let t=await(0,et.readdir)(e,{withFileTypes:!0}).catch(()=>[]),n=await Promise.all(t.filter(i=>i.isFile()&&i.name.endsWith(".sqlite")).map(async i=>({path:(0,st.join)(e,i.name),mtime:(await(0,et.stat)((0,st.join)(e,i.name))).mtimeMs})));for(let i of n.sort((r,o)=>o.mtime-r.mtime)){let r=SK(i.path);if(r!==null)return{path:i.path,files:r}}return null}function SK(e){try{let t=new Ci.DatabaseSync(e,{readOnly:!0}),n=t.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("schema_version")?.value,i=Number(t.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key = ?").get("source_file_count")?.value??0);return t.close(),n===go?i:null}catch{return null}}function v$(e){let t=e.prepare("SELECT name FROM sqlite_master WHERE type = 'view' AND name LIKE 'zaip_vw_%'").all();for(let{name:n}of t){let i=n.slice(8),r=o=>`"${o.replaceAll('"','""')}"`;e.exec(`CREATE TEMP VIEW ${r(i)} AS SELECT * FROM main.${r(n)}`)}}async function Vh(e,t){await(0,et.mkdir)((0,st.dirname)(t),{recursive:!0});let n=`${t}.${process.pid}.${(0,bn.randomUUID)()}.tmp`;await(0,et.copyFile)(e,n);try{await(0,et.rename)(n,t)}catch(i){throw await(0,et.rm)(n,{force:!0}),i}}async function kK(e){let t=(await Promise.all([".agents/records",".agents/config"].map(i=>S$((0,st.resolve)(e,i))))).flat().filter(i=>YJ.has(i.slice(i.lastIndexOf(".")).toLowerCase())&&iK((0,st.relative)(e,i).replaceAll("\\","/"))).sort(),n=await Promise.all(t.map(async i=>{let r=await(0,et.stat)(i);return{path:i,source:(0,st.relative)(e,i).replaceAll("\\","/"),mtimeMs:Math.trunc(r.mtimeMs),size:r.size}}));return{fingerprint:n.map(i=>`${i.source}:${i.mtimeMs}:${i.size}`).join("|"),candidates:n}}var O_={cost_monitor_daily:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_monthly:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_annual:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_overview_view:{date:"period_key",id:"period_key",order:"period_key DESC"},cost_monitor_executions:{date:null,id:"execution_id",order:"invocation_count DESC, execution_id DESC"},cost_monitor_agent_invocations:{date:"occurred_day_sp",id:"agent_invocation_id",order:"occurred_at DESC, agent_invocation_id DESC"},cost_monitor_zaip_agents:{date:null,id:"zaip_agent",order:"invocation_count DESC, zaip_agent"},cost_monitor_models:{date:null,id:"model",order:"invocation_count DESC, model"},cost_monitor_providers:{date:null,id:"provider",order:"invocation_count DESC, provider"},cost_monitor_tasks:{date:null,id:"task_id",order:"invocation_count DESC, task_id"},cost_monitor_specs:{date:null,id:"spec_id",order:"invocation_count DESC, spec_id"},cost_monitor_prds:{date:null,id:"prd_id",order:"invocation_count DESC, prd_id"},cost_monitor_conversations:{date:null,id:"conversation_id",order:"invocation_count DESC, conversation_id"},operations_work_list:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_work_kanban:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_executions:{date:null,id:"execution_id",order:"started_at DESC, execution_id DESC"},operations_agent_invocations:{date:"source_day_sp",id:"agent_invocation_id",order:"occurred_at DESC, agent_invocation_id DESC"},operations_conversations:{date:null,id:"conversation_id",order:"started_at DESC, conversation_id DESC"},operations_decisions:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_changes:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},operations_daily:{date:"day",id:"day",order:"day DESC"},operations_monthly:{date:"period_key",id:"period_key",order:"period_key DESC"},operations_annual:{date:"period_key",id:"period_key",order:"period_key DESC"},first_fold_overview:{date:"start_day",id:"period_key",order:"period_key DESC"},first_fold_task_status:{date:"day",id:"status",order:"day DESC, status"},first_fold_task_risk:{date:"day",id:"risk",order:"day DESC, risk"},first_fold_top_tasks:{date:"occurred_day_sp",id:"id",order:"total_duration DESC, id DESC"},first_fold_overview_all_time:{date:null,id:"period_key",order:"period_key"},first_fold_task_status_all_time:{date:null,id:"status",order:"status"},first_fold_task_risk_all_time:{date:null,id:"risk",order:"risk"},first_fold_task_metrics_all_time:{date:null,id:null,order:"task_count DESC"},first_fold_top_tasks_all_time:{date:null,id:"task_id",order:"rank"},first_fold_spec_status_all_time:{date:null,id:"stage",order:"stage"},first_fold_spec_classification_all_time:{date:null,id:"classification",order:"classification"},first_fold_spec_metrics_all_time:{date:null,id:null,order:"entity_count DESC"},first_fold_top_specs_all_time:{date:null,id:"entity_id",order:"rank"},first_fold_prd_status_all_time:{date:null,id:"stage",order:"stage"},first_fold_prd_classification_all_time:{date:null,id:"classification",order:"classification"},first_fold_prd_metrics_all_time:{date:null,id:null,order:"entity_count DESC"},first_fold_top_prds_all_time:{date:null,id:"entity_id",order:"rank"},first_fold_task:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},first_fold_spec:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"},first_fold_prd:{date:"occurred_day_sp",id:"id",order:"occurred_at DESC, id DESC"}};async function S$(e){let t=await(0,et.readdir)(e,{withFileTypes:!0}).catch(()=>[]);return(await Promise.all(t.map(async i=>{let r=(0,st.join)(e,i.name);return i.isDirectory()?S$(r):i.isFile()?[r]:[]}))).flat()}var Et=class extends mi{executionDurationCache=new Map;dailyAggregateRowsCache=null;firstFoldAllTimeCache=null;firstFoldTopTasksAllTimeCache=null;firstFoldViewportCache=null;firstFoldMonthlyQuickCache=void 0;firstFoldViewportTimings={};metadataValues=null;unfilteredViewPageCache=new Map;viewPageResultCache=new Map;operationsWorkListPageCache=null;dailyAggregateRows(){return this.dailyAggregateRowsCache===null&&(this.dailyAggregateRowsCache=this.database.prepare("SELECT * FROM daily_aggregate_cache ORDER BY day").all()),this.dailyAggregateRowsCache}operationsWorkListRows(){return this.operationsWorkListPageCache??=this.database.prepare("SELECT * FROM operations_work_list ORDER BY occurred_at DESC, id DESC").all(),this.operationsWorkListPageCache}unfilteredViewRows(t){let n=this.unfilteredViewPageCache.get(t);if(n!==void 0)return n;let i=O_[t].order,r=this.database.prepare(`SELECT * FROM ${t} ORDER BY ${i}`).all();return this.unfilteredViewPageCache.set(t,r),r}database;constructor(t){super(t),this.database=new Ci.DatabaseSync(Zh(t),{readOnly:!0}),v$(this.database)}async exists(t){let n=this.database.prepare("SELECT 1 FROM files WHERE path = ? LIMIT 1").get(t),i=this.database.prepare("SELECT 1 FROM files WHERE path LIKE ? LIMIT 1").get(`${t.replace(/\/$/,"")}/%`);return n!==void 0||i!==void 0}async readText(t){let n=this.database.prepare("SELECT content FROM files WHERE path = ?").get(t);if(n?.content===void 0)throw Object.assign(new Error(`SQLite read model is missing ${t}`),{code:"ENOENT"});return n.content}async readBytes(t){return Buffer.from(await this.readText(t),"utf8")}async readTextFrom(t,n){let i=await this.readText(t),r=Buffer.from(i,"utf8");return{content:r.subarray(Math.min(n,r.byteLength)).toString("utf8"),nextOffset:r.byteLength}}async listFiles(t,n=""){let i=`${t.replace(/\/$/,"")}/%`;return this.database.prepare("SELECT path FROM files WHERE path LIKE ? ORDER BY path").all(i).map(o=>o.path).filter(o=>o.endsWith(n))}async listDirectories(t){let n=`${t.replace(/\/$/,"")}/`,i=this.database.prepare("SELECT path FROM files WHERE path LIKE ?").all(`${n}%`);return[...new Set(i.map(r=>r.path.slice(n.length).split("/")[0]).filter(Boolean).map(r=>`${t.replace(/\/$/,"")}/${r}`))].sort()}close(){this.database.close()}reopen(){this.database=new Ci.DatabaseSync(Zh(this.root),{readOnly:!0}),v$(this.database),this.executionDurationCache.clear(),this.dailyAggregateRowsCache=null,this.firstFoldAllTimeCache=null,this.firstFoldTopTasksAllTimeCache=null,this.firstFoldViewportCache=null,this.firstFoldMonthlyQuickCache=void 0,this.firstFoldViewportTimings={},this.metadataValues=null,this.viewPageResultCache.clear()}refresh(){this.database.close(),this.reopen()}async rebuildAndRefresh(t){this.database.close();try{await t()}finally{this.reopen()}this.viewPage("cost_monitor_daily",{limit:1,offset:0})}executionDurationByDay(t,n=null){let i=t.from?.slice(0,10)??null,r=t.to?.slice(0,10)??null,o=JSON.stringify({...t,from:i,to:r,taskId:n}),a=this.executionDurationCache.get(o);if(a!==void 0)return new Map(a);let s=["(? IS NULL OR f.occurred_day_sp >= ?)","(? IS NULL OR f.occurred_day_sp <= ?)","(? IS NULL OR a.task_id = ?)"],l=[i,i,r,r,n,n],c=(t.providers??[]).filter(f=>f!=="unavailable"),d=(t.models??[]).filter(f=>f!=="unavailable");if(t.providers?.includes("unavailable")===!0||t.models?.includes("unavailable")===!0){let f=(h,k)=>{if(k===void 0||k.length===0)return;let w=k.filter(b=>b!=="unavailable"),O=w.length===0?"0":`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=a.agent_run_id AND u.${h} IN (${w.map(()=>"?").join(",")}))`;w.length>0&&l.push(...w);let g=`NOT EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=a.agent_run_id AND u.${h} IS NOT NULL AND u.${h} <> 'unavailable')`;s.push(k.includes("unavailable")?`(${O} OR ${g})`:O)};f("provider",t.providers),f("model",t.models)}else if(c.length>0||d.length>0){let f=[];c.length>0&&(f.push(`u.provider IN (${c.map(()=>"?").join(",")})`),l.push(...c)),d.length>0&&(f.push(`u.model IN (${d.map(()=>"?").join(",")})`),l.push(...d)),s.push(`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=a.agent_run_id AND ${f.join(" AND ")})`)}let _=[["zaip_agent",t.agents],["phase",t.phases],["status",t.statuses]];for(let[f,h]of _)h===void 0||h.length===0||(s.push(`a.${f} IN (${h.map(()=>"?").join(",")})`),l.push(...h));let p=this.database.prepare(`SELECT f.occurred_day_sp AS day, SUM(f.attributed_token_active_ms) AS duration_ms
1280
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id)
1281
+ WHERE ${s.join(" AND ")} GROUP BY f.occurred_day_sp`).all(...l),v=new Map(p.map(f=>[f.day,Number(f.duration_ms)]));return this.executionDurationCache.set(o,v),new Map(v)}canonicalRunCountByDay(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=["(? IS NULL OR occurred_day_sp >= ?)","(? IS NULL OR occurred_day_sp <= ?)"],o=[n,n,i,i],a=(t.providers??[]).filter(u=>u!=="unavailable"),s=(t.models??[]).filter(u=>u!=="unavailable");if(t.providers?.includes("unavailable")===!0||t.models?.includes("unavailable")===!0){let u=(_,p)=>{if(p===void 0||p.length===0)return;let v=p.filter(k=>k!=="unavailable"),f=v.length===0?"0":`EXISTS (SELECT 1 FROM invocations i JOIN invocation_usage u USING(agent_invocation_id) WHERE i.run_id=canonical_run_index.run_id AND u.${_} IN (${v.map(()=>"?").join(",")}))`;v.length>0&&o.push(...v);let h=`NOT EXISTS (SELECT 1 FROM invocations i JOIN invocation_usage u USING(agent_invocation_id) WHERE i.run_id=canonical_run_index.run_id AND u.${_} IS NOT NULL AND u.${_} <> 'unavailable')`;r.push(p.includes("unavailable")?`(${f} OR ${h})`:f)};u("provider",t.providers),u("model",t.models)}else if(a.length>0||s.length>0){let u=[];a.length>0&&(u.push(`u.provider IN (${a.map(()=>"?").join(",")})`),o.push(...a)),s.length>0&&(u.push(`u.model IN (${s.map(()=>"?").join(",")})`),o.push(...s)),r.push(`EXISTS (SELECT 1 FROM invocations i JOIN invocation_usage u USING(agent_invocation_id) WHERE i.run_id=canonical_run_index.run_id AND ${u.join(" AND ")})`)}let c=[["zaip_agent",t.agents],["phase",t.phases],["status",t.statuses]];for(let[u,_]of c)_===void 0||_.length===0||(r.push(`${u} IN (${_.map(()=>"?").join(",")})`),o.push(..._));let d=this.database.prepare(`SELECT occurred_day_sp AS day, COUNT(*) AS count FROM canonical_run_index WHERE ${r.join(" AND ")} GROUP BY occurred_day_sp`).all(...o);return new Map(d.map(u=>[u.day,Number(u.count)]))}dailyPeriods(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=this.executionDurationByDay(t),o=this.dailyAggregateRows().filter(l=>{let c=String(l.day);return(n===null||c>=n)&&(i===null||c<=i)}),a=new Map(o.map(l=>[String(l.day),l])),s=[...new Set([...a.keys(),...r.keys()])].sort();return Object.fromEntries(s.map(l=>{let c=a.get(l)??{},d=Number(c.total_run_count??0),u=Number(c.activity_count??0),_=Math.max(0,d-u);return[l,{prds:Number(c.prd_count??0),specs:Number(c.spec_count??0),tasks:Number(c.task_count??0),validations:Number(c.validation_count??0),evidences:Number(c.evidence_count??0),runs:Number(c.total_run_count??0),usage:{total_tokens:{known_sum:Number(c.total_tokens??0),unknown:_},cost:{known_sum:Number(c.total_cost_brl??0),unknown:_}},duration:{known_sum:r.get(l)??0,unknown:r.has(l)?0:Number(c.total_run_count??0)}}]}))}firstFoldAggregate(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=this.dailyAggregateRows().filter(l=>{let c=String(l.day);return(n===null||c>=n)&&(i===null||c<=i)}),o=l=>{let c=r.map(d=>d[l]).filter(d=>typeof d=="number");return c.length===0?null:c.reduce((d,u)=>d+u,0)},a=this.executionDurationByDay(t),s=[...a.values()].reduce((l,c)=>l+c,0);return{days:r.length,total_run_count:o("total_run_count")??0,agent_invocation_count:o("invocation_count")??0,llm_call_count:o("llm_call_count"),duration_ms:a.size===0?null:s,total_tokens:o("total_tokens"),cost_brl:o("total_cost_brl"),execution_day_count:a.size}}firstFoldMonthlyQuick(t){if(this.firstFoldMonthlyQuickCache===void 0){let c=this.database.prepare("SELECT payload_json FROM zaip_aios_activities WHERE payload_type='first_fold_monthly_quick_cache' ORDER BY recorded_at DESC LIMIT 1").get();try{let d=typeof c?.payload_json=="string"?JSON.parse(c.payload_json):null;this.firstFoldMonthlyQuickCache=d!==null&&typeof d.from_day=="string"&&typeof d.to_day=="string"&&d.aggregate!==void 0&&d.pages!==void 0&&Array.isArray(d.top_tasks)?d:null}catch{this.firstFoldMonthlyQuickCache=null}}let n=this.firstFoldMonthlyQuickCache;if(n===null)return null;let i=t.from?.slice(0,10)??null,r=t.to?.slice(0,10)??null,o=i===n.from_day&&r===n.to_day,a=i===n.from_day&&r!==null&&r>n.to_day&&r.slice(0,7)===n.from_day.slice(0,7),s=n.source_latest_day===null||n.source_latest_day<=n.to_day;return o||a&&s?n:i!==null&&r!==null&&i.slice(0,7)>(n.source_latest_day===null?n.from_day.slice(0,7):n.source_latest_day.slice(0,7))?{from_day:i,to_day:r,source_latest_day:n.source_latest_day,aggregate:{days:0,total_run_count:0,agent_invocation_count:0,llm_call_count:null,duration_ms:null,total_tokens:null,cost_brl:null,execution_day_count:0},pages:{task:[],spec:[],prd:[]},top_tasks:[]}:null}firstFoldRelevantLatestDay(){let t=this.database.prepare(`SELECT MAX(day) AS day FROM (
1282
+ SELECT occurred_day_sp AS day FROM activities
1283
+ UNION ALL SELECT occurred_day_sp AS day FROM canonical_work_items
1284
+ UNION ALL SELECT occurred_day_sp AS day FROM canonical_artifacts
1285
+ UNION ALL SELECT occurred_day_sp AS day FROM canonical_run_index
1286
+ UNION ALL SELECT occurred_day_sp AS day FROM attributed_token_active_facts
1287
+ )`).get();return typeof t.day=="string"?t.day:null}firstFoldAllTime(){if(this.firstFoldAllTimeCache!==null)return this.firstFoldAllTimeCache;let t=this.database.prepare("SELECT * FROM zaip_vw_first_fold_overview_all_time").get(),n=this.database.prepare("SELECT status, task_count FROM zaip_vw_first_fold_task_status_all_time").all(),i=this.database.prepare("SELECT risk, task_count FROM zaip_vw_first_fold_task_risk_all_time").all(),r=this.database.prepare("SELECT * FROM zaip_vw_first_fold_task_metrics_all_time").get(),o=this.database.prepare("SELECT * FROM zaip_vw_first_fold_top_tasks_all_time ORDER BY rank").all(),a=(c,d=0)=>typeof c=="number"?c:d,s=c=>typeof c=="number"?c:null,l=c=>{let d=this.database.prepare(`SELECT stage, entity_count FROM zaip_vw_first_fold_${c}_status_all_time`).all(),u=this.database.prepare(`SELECT classification, entity_count FROM zaip_vw_first_fold_${c}_classification_all_time`).all(),_=this.database.prepare(`SELECT * FROM zaip_vw_first_fold_${c}_metrics_all_time`).get(),p=this.database.prepare(`SELECT * FROM zaip_vw_first_fold_top_${c}s_all_time ORDER BY rank`).all();return{status_counts:Object.fromEntries(d.map(v=>[v.stage,Number(v.entity_count)])),classification_counts:Object.fromEntries(u.map(v=>[v.classification,Number(v.entity_count)])),entity_count:a(_.entity_count),total_run_count:a(_.total_run_count),total_duration_ms:s(_.total_duration_ms),total_tokens:s(_.total_tokens),total_cost_usd:s(_.total_cost_usd),total_cost_brl:s(_.total_cost_brl),average_duration_ms:s(_.average_duration_ms),average_tokens:s(_.average_tokens),average_cost_usd:s(_.average_cost_usd),average_cost_brl:s(_.average_cost_brl),latest_created_at:typeof _.latest_created_at=="string"?_.latest_created_at:null,top_entities:p}};return this.firstFoldAllTimeCache={aggregate:{days:typeof t.start_day=="string"&&typeof t.end_day=="string"?this.dailyAggregateRows().length:0,start_day:typeof t.start_day=="string"?t.start_day:null,end_day:typeof t.end_day=="string"?t.end_day:null,task_count:a(t.task_count),completed_task_count:a(t.completed_task_count),spec_count:a(t.spec_count),completed_spec_count:a(t.completed_spec_count),prd_count:a(t.prd_count),completed_prd_count:a(t.completed_prd_count),total_run_count:a(t.total_run_count),agent_invocation_count:a(t.agent_invocation_count),llm_call_count:s(t.llm_call_count),duration_ms:s(t.total_duration_ms),total_tokens:s(t.total_tokens),total_cost_usd:s(t.total_cost_usd),cost_brl:s(t.total_cost_brl),execution_day_count:a(t.execution_day_count),latest_task_created_at:typeof t.latest_task_created_at=="string"?t.latest_task_created_at:null},task_status_counts:Object.fromEntries(n.map(c=>[c.status,Number(c.task_count)])),task_risk_counts:Object.fromEntries(i.map(c=>[c.risk,Number(c.task_count)])),task_metrics:{average_duration_ms_per_task:s(r.average_duration_ms_per_task),average_tokens_per_task:s(r.average_tokens_per_task),average_cost_usd_per_task:s(r.average_cost_usd_per_task),average_cost_brl_per_task:s(r.average_cost_brl_per_task),latest_task_created_at:typeof r.latest_task_created_at=="string"?r.latest_task_created_at:null},top_tasks:o,macro_metrics:{specs:l("spec"),prds:l("prd")}},this.firstFoldAllTimeCache}firstFoldTopTasksAllTime(){return this.firstFoldTopTasksAllTimeCache!==null?this.firstFoldTopTasksAllTimeCache:(this.firstFoldTopTasksAllTimeCache=this.database.prepare("SELECT * FROM zaip_vw_first_fold_top_tasks_all_time ORDER BY rank").all(),this.firstFoldTopTasksAllTimeCache)}firstFoldViewportAllTime(){if(this.firstFoldViewportCache!==null)return this.firstFoldViewportCache;let t=this.database.prepare("SELECT payload_json FROM zaip_aios_activities WHERE payload_type='first_fold_viewport_cache' ORDER BY recorded_at DESC LIMIT 1").get();if(typeof t?.payload_json=="string")return this.firstFoldViewportCache=JSON.parse(t.payload_json),this.firstFoldViewportCache;let n=process.env.ZAIP_DASHBOARD_PROFILE_FIRST_FOLD==="1",r=((s,l)=>{let c=performance.now(),d=l();return n&&(this.firstFoldViewportTimings[s]=Math.round((performance.now()-c)*10)/10),n&&console.info(JSON.stringify({event:"dashboard_first_fold_select",select:s,elapsed_ms:Math.round((performance.now()-c)*10)/10})),d})("viewport_overview",()=>this.database.prepare(`WITH totals AS (
1288
+ SELECT SUM(CASE WHEN activity_source_kind='agent_run' THEN 1 ELSE 0 END) AS agent_invocation_count,
1289
+ SUM(llm_call_count) AS llm_call_count,
1290
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd,
1291
+ SUM(cost_brl) AS total_cost_brl FROM activities
1292
+ ), run_totals AS (
1293
+ SELECT COUNT(*) AS total_run_count FROM canonical_run_index
1294
+ ), duration_totals AS (
1295
+ SELECT ROUND(SUM(attributed_token_active_ms)) AS total_duration_ms,
1296
+ COUNT(DISTINCT occurred_day_sp) AS execution_day_count
1297
+ FROM attributed_token_active_facts
1298
+ ), bounds AS (
1299
+ SELECT MIN(day) AS start_day, MAX(day) AS end_day, COUNT(*) AS day_count FROM (
1300
+ SELECT occurred_day_sp AS day FROM activities
1301
+ UNION SELECT occurred_day_sp AS day FROM canonical_work_items
1302
+ UNION SELECT occurred_day_sp AS day FROM canonical_artifacts
1303
+ )
1304
+ ), canonical_items AS MATERIALIZED (
1305
+ SELECT json_extract(payload_json, '$.entity_kind') AS entity_kind,
1306
+ json_extract(payload_json, '$.id') AS id,
1307
+ json_extract(payload_json, '$.status') AS status,
1308
+ json_extract(payload_json, '$.risk') AS risk,
1309
+ json_extract(payload_json, '$.occurred_at') AS occurred_at
1310
+ FROM zaip_aios_activities WHERE payload_type='work_item'
1311
+ ), items AS MATERIALIZED (
1312
+ SELECT entity_kind, id, status, risk, occurred_at FROM canonical_items
1313
+ UNION ALL SELECT 'task', a.task_id, MAX(a.work_item_status), MAX(a.risk), MIN(a.occurred_at)
1314
+ FROM zaip_aios_activities a WHERE a.payload_type IS NULL AND a.task_id IS NOT NULL
1315
+ AND NOT EXISTS (SELECT 1 FROM canonical_items c WHERE c.entity_kind='task' AND c.id=a.task_id)
1316
+ GROUP BY task_id
1317
+ UNION ALL SELECT 'spec', a.spec_id, MAX(a.work_item_status), MAX(a.risk), MIN(a.occurred_at)
1318
+ FROM zaip_aios_activities a WHERE a.payload_type IS NULL AND a.spec_id IS NOT NULL
1319
+ AND NOT EXISTS (SELECT 1 FROM canonical_items c WHERE c.entity_kind='spec' AND c.id=a.spec_id)
1320
+ GROUP BY spec_id
1321
+ UNION ALL SELECT 'prd', a.prd_id, MAX(a.work_item_status), MAX(a.risk), MIN(a.occurred_at)
1322
+ FROM zaip_aios_activities a WHERE a.payload_type IS NULL AND a.prd_id IS NOT NULL
1323
+ AND NOT EXISTS (SELECT 1 FROM canonical_items c WHERE c.entity_kind='prd' AND c.id=a.prd_id)
1324
+ GROUP BY prd_id
1325
+ ), item_totals AS (
1326
+ SELECT
1327
+ SUM(entity_kind='task') AS task_count,
1328
+ SUM(entity_kind='task' AND status='completed') AS completed_task_count,
1329
+ MAX(CASE WHEN entity_kind='task' THEN occurred_at END) AS latest_task_created_at,
1330
+ SUM(entity_kind='spec') AS spec_count,
1331
+ SUM(entity_kind='spec' AND status IN ('completed','delivered')) AS completed_spec_count,
1332
+ SUM(entity_kind='prd') AS prd_count,
1333
+ SUM(entity_kind='prd' AND status IN ('completed','delivered')) AS completed_prd_count
1334
+ FROM items
1335
+ ), task_status AS (
1336
+ SELECT json_group_object(status, task_count) AS task_status_json FROM (
1337
+ SELECT COALESCE(status, 'draft') AS status, COUNT(*) AS task_count
1338
+ FROM items WHERE entity_kind='task' GROUP BY COALESCE(status, 'draft')
1339
+ )
1340
+ ), task_risk AS (
1341
+ SELECT json_group_object(risk, task_count) AS task_risk_json FROM (
1342
+ SELECT COALESCE(risk, 'standard') AS risk, COUNT(*) AS task_count
1343
+ FROM items WHERE entity_kind='task' GROUP BY COALESCE(risk, 'standard')
1344
+ )
1345
+ ) SELECT totals.*, run_totals.*, duration_totals.*, bounds.*, item_totals.*, task_status.*, task_risk.*
1346
+ FROM totals CROSS JOIN run_totals CROSS JOIN duration_totals CROSS JOIN bounds
1347
+ CROSS JOIN item_totals CROSS JOIN task_status CROSS JOIN task_risk`).get()),o=(s,l=0)=>typeof s=="number"?s:l,a=s=>typeof s=="number"?s:null;return this.firstFoldViewportCache={aggregate:{days:o(r.day_count),start_day:typeof r.start_day=="string"?r.start_day:null,end_day:typeof r.end_day=="string"?r.end_day:null,task_count:o(r.task_count),completed_task_count:o(r.completed_task_count),spec_count:o(r.spec_count),completed_spec_count:o(r.completed_spec_count),prd_count:o(r.prd_count),completed_prd_count:o(r.completed_prd_count),total_run_count:o(r.total_run_count),agent_invocation_count:o(r.agent_invocation_count),llm_call_count:a(r.llm_call_count),duration_ms:a(r.total_duration_ms),total_tokens:a(r.total_tokens),total_cost_usd:a(r.total_cost_usd),cost_brl:a(r.total_cost_brl),execution_day_count:o(r.execution_day_count),latest_task_created_at:typeof r.latest_task_created_at=="string"?r.latest_task_created_at:null},task_status_counts:typeof r.task_status_json=="string"?JSON.parse(r.task_status_json):{},task_risk_counts:typeof r.task_risk_json=="string"?JSON.parse(r.task_risk_json):{}},this.firstFoldViewportCache}firstFoldViewportProfile(){return this.firstFoldViewportTimings}topTasks(t,n=5){let i=t.from?.slice(0,10)??null,r=t.to?.slice(0,10)??null,o=this.database.prepare(`SELECT task_id, SUM(total_tokens) AS total_tokens, SUM(cost_brl) AS cost_brl, COUNT(*) AS run_count
1348
+ FROM activities WHERE task_id IS NOT NULL AND phase = 'execution'
1349
+ AND (? IS NULL OR occurred_day_sp >= ?) AND (? IS NULL OR occurred_day_sp <= ?)
1350
+ GROUP BY task_id`).all(i,i,r,r),a=this.database.prepare(`SELECT a.task_id, SUM(f.attributed_token_active_ms) AS duration_ms
1351
+ FROM attributed_token_active_facts f JOIN zaip_aios_activities a USING(activity_row_id)
1352
+ WHERE a.task_id IS NOT NULL AND a.phase = 'execution'
1353
+ AND (? IS NULL OR f.occurred_day_sp >= ?) AND (? IS NULL OR f.occurred_day_sp <= ?)
1354
+ GROUP BY a.task_id`).all(i,i,r,r),s=new Map(a.map(l=>[l.task_id,Number(l.duration_ms)]));return o.map(l=>({...l,duration_ms:s.get(l.task_id)??0})).filter(l=>l.duration_ms>0).sort((l,c)=>c.duration_ms-l.duration_ms||l.task_id.localeCompare(c.task_id)).slice(0,n)}canonicalTraceFiles(t){let n=[...new Set(t.filter(Boolean))];if(n.length===0)return[];let i=n.map(()=>"content LIKE ?").join(" OR ");return this.database.prepare(`SELECT path, content FROM files
1355
+ WHERE path LIKE '.agents/records/%' AND (${i}) ORDER BY path`).all(...n.map(r=>`%${r}%`))}taskTraceUsage(t){let n=this.database.prepare(`SELECT run_id, run_role, phase, duration_ms FROM canonical_run_index
1356
+ WHERE task_id = ?`).all(t),i=this.database.prepare("SELECT run_id, total_tokens, cost_brl FROM activities WHERE task_id = ?").all(t),r=n.filter(d=>d.run_role==="root"&&d.phase==="execution"&&typeof d.duration_ms=="number").length,o=this.executionDurationByDay({from:null,to:null},t),a=o.size===0?null:[...o.values()].reduce((d,u)=>d+u,0),s=i.filter(d=>typeof d.total_tokens=="number"),l=i.filter(d=>typeof d.cost_brl=="number"),c=(d,u)=>({value:d,known_runs:u,unknown_runs:Math.max(0,n.length-u),coverage_ratio:n.length===0?1:u/n.length});return{run_count:n.length,duration_ms:c(a,r),total_tokens:c(s.length===0?null:s.reduce((d,u)=>d+Number(u.total_tokens),0),s.length),cost:{...c(l.length===0?null:l.reduce((d,u)=>d+Number(u.cost_brl),0),l.length),currency:l.length===0?null:"BRL"}}}invocationTotals(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null;return this.database.prepare("SELECT COUNT(*) AS invocation_count, SUM(llm_call_count) AS llm_call_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl FROM invocations WHERE (? IS NULL OR occurred_day_sp >= ?) AND (? IS NULL OR occurred_day_sp <= ?)").get(n,n,i,i)}invocationCostRows(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r="date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')",o=[`(? IS NULL OR ${r} >= ?)`,`(? IS NULL OR ${r} <= ?)`],a=[n,n,i,i],s=(u,_)=>{_!==void 0&&_.length>0&&(o.push(`${u} IN (${_.map(()=>"?").join(",")})`),a.push(..._))};s("i.zaip_agent",t.agents),s("i.phase",t.phases),s("i.status",t.statuses),s("i.task_id",t.tasks),s("i.spec_id",t.specs),s("i.prd_id",t.prds),s("i.execution_id",t.executions),s("i.change_id",t.changes);let l=(t.providers??[]).filter(u=>u!=="unavailable"),c=(t.models??[]).filter(u=>u!=="unavailable");if(t.providers?.includes("unavailable")===!0||t.models?.includes("unavailable")===!0){let u=(_,p)=>{if(p===void 0||p.length===0)return;let v=p.filter(w=>w!=="unavailable"),f=p.includes("unavailable"),h=v.length===0?"0":`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id = i.agent_invocation_id AND f.${_} IN (${v.map(()=>"?").join(",")}))`;v.length>0&&a.push(...v);let k=`NOT EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id = i.agent_invocation_id AND f.${_} IS NOT NULL AND f.${_} <> 'unavailable')`;o.push(f?`(${h} OR ${k})`:h)};u("provider",t.providers),u("model",t.models)}else if(l.length>0||c.length>0){let u=[];l.length>0&&(u.push(`f.provider IN (${l.map(()=>"?").join(",")})`),a.push(...l)),c.length>0&&(u.push(`f.model IN (${c.map(()=>"?").join(",")})`),a.push(...c)),o.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id = i.agent_invocation_id AND ${u.join(" AND ")})`)}return this.database.prepare(`SELECT i.*, CASE COUNT(DISTINCT s.provider) WHEN 0 THEN NULL WHEN 1 THEN MIN(s.provider) ELSE 'mixed' END AS provider, CASE COUNT(DISTINCT s.model) WHEN 0 THEN NULL WHEN 1 THEN MIN(s.model) ELSE 'mixed' END AS model,
1357
+ SUM(s.input_tokens) AS input_tokens, SUM(s.cached_input_tokens) AS cached_input_tokens,
1358
+ SUM(s.output_tokens) AS output_tokens, SUM(s.reasoning_tokens) AS reasoning_tokens,
1359
+ SUM(s.total_tokens) AS total_tokens, SUM(s.cost_usd) AS cost_usd, SUM(s.cost_brl) AS cost_brl
1360
+ FROM invocations i LEFT JOIN invocation_usage s USING(agent_invocation_id)
1361
+ WHERE ${o.join(" AND ")}
1362
+ GROUP BY i.agent_invocation_id ORDER BY i.occurred_at`).all(...a)}costMonitorFactualDurationByDay(t,n=this.costMonitorFinancialActivityRows(t)){let i=n,r=new Set,o=new Map;for(let u of i){let _=typeof u.source_started_at=="string"?u.source_started_at:typeof u.source_occurred_at=="string"?u.source_occurred_at:typeof u.occurred_at=="string"?u.occurred_at:null;if(_===null||!(typeof u.total_tokens=="number"||typeof u.cost_brl=="number"||typeof u.cost_usd=="number"))continue;let v=typeof u.activity_row_id=="string"||typeof u.activity_row_id=="number"?String(u.activity_row_id):String(u.run_id??_);r.add(v)}let a=new Map,s=new Set,l=this.database.prepare("SELECT 1 AS present FROM sqlite_master WHERE name = 'attributed_token_active_facts'").get()!==void 0?"attributed_token_active_facts":"zaip_vw_attributed_token_active_facts",c=Array.from(r);for(let u=0;u<c.length;u+=900){let _=c.slice(u,u+900),p=this.database.prepare(`SELECT activity_row_id, occurred_day_sp, attributed_token_active_ms
1363
+ FROM ${l}
1364
+ WHERE activity_row_id IN (${_.map(()=>"?").join(",")})`).all(..._);for(let v of p){let f=String(v.activity_row_id),h=String(v.occurred_day_sp),k=Number(v.attributed_token_active_ms);if(!Number.isFinite(k)||k<0)continue;let w=a.get(h)??{known_sum:0,activityIds:new Set};w.known_sum+=k,w.activityIds.add(f),a.set(h,w),s.add(f)}}for(let u of i){let _=typeof u.activity_row_id=="string"||typeof u.activity_row_id=="number"?String(u.activity_row_id):null;if(_===null||s.has(_))continue;let p=typeof u.source_started_at=="string"?u.source_started_at:typeof u.source_occurred_at=="string"?u.source_occurred_at:typeof u.occurred_at=="string"?u.occurred_at:null;if(p===null)continue;let v=_n(p),f=o.get(v)??new Set;f.add(_),o.set(v,f)}let d=new Map;for(let u of new Set([...a.keys(),...o.keys()])){let _=a.get(u)??{known_sum:0,activityIds:new Set},p=o.get(u)??new Set;d.set(u,{known_sum:_.known_sum,eligible_runs:new Set([..._.activityIds,...p]).size,known_runs:_.activityIds.size})}return d}activityCostRows(t){let n=t.from?.slice(0,10)??null,i=t.to?.slice(0,10)??null,r=["(? IS NULL OR i.occurred_day_sp >= ?)","(? IS NULL OR i.occurred_day_sp <= ?)"],o=[n,n,i,i],a=(s,l)=>{l!==void 0&&l.length>0&&(r.push(`${s} IN (${l.map(()=>"?").join(",")})`),o.push(...l))};return a("i.zaip_agent",t.agents),a("i.provider",t.providers),a("i.model",t.models),a("i.phase",t.phases),a("i.status",t.statuses),a("i.task_id",t.tasks),a("i.spec_id",t.specs),a("i.prd_id",t.prds),a("i.execution_id",t.executions),a("i.change_id",t.changes),this.database.prepare(`SELECT i.*, i.activity_row_id AS agent_invocation_id,
1365
+ i.parent_run_id AS parent_agent_invocation_id
1366
+ FROM activities i WHERE ${r.join(" AND ")} ORDER BY i.occurred_at`).all(...o)}costMonitorFinancialActivityRows(t){let{from:n,to:i,providers:r=[],models:o=[]}=t,a=Ht(n),s=Ht(i),l="date(COALESCE(a.source_started_at, a.source_occurred_at, a.occurred_at), '-3 hours')",c=["(a.total_tokens IS NOT NULL OR a.cost_brl IS NOT NULL OR a.cost_usd IS NOT NULL)",`(? IS NULL OR ${l} >= ?)`,`(? IS NULL OR ${l} <= ?)`],d=[a,a,s,s],u=(_,p)=>{p!==void 0&&p.length>0&&(c.push(`a.${_} IN (${p.map(()=>"?").join(",")})`),d.push(...p))};if(u("zaip_agent",t.agents),u("phase",t.phases),u("status",t.statuses),u("task_id",t.tasks),u("spec_id",t.specs),u("prd_id",t.prds),u("execution_id",t.executions),u("change_id",t.changes),r.length>0||o.length>0){let _=[];r.length>0&&_.push(`COALESCE(u.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),o.length>0&&_.push(`COALESCE(u.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`);let p=[...r,...o],v=[];r.length>0&&v.push(`COALESCE(a.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),o.length>0&&v.push(`COALESCE(a.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`),c.push(`((a.agent_run_id IS NULL AND ${v.join(" AND ")}) OR (a.agent_run_id IS NOT NULL AND EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id = a.agent_run_id AND ${_.join(" AND ")})))`),d.push(...r,...o,...p)}return this.database.prepare(`SELECT
1367
+ a.activity_row_id, a.agent_run_id, a.parent_run_id,
1368
+ a.source_started_at, a.source_finished_at, a.source_occurred_at,
1369
+ a.occurred_at, a.occurred_day_sp, a.run_id,
1370
+ a.task_id, a.execution_id, a.spec_id, a.prd_id, a.change_id,
1371
+ a.zaip_agent, a.provider, a.model, a.phase, a.status,
1372
+ a.duration_ms, a.source_duration_ms, a.duration_provenance,
1373
+ a.total_tokens, a.input_tokens, a.cached_input_tokens,
1374
+ a.output_tokens, a.reasoning_tokens, a.cost_usd, a.cost_brl,
1375
+ a.source_event_count,
1376
+ a.activity_row_id AS agent_invocation_id,
1377
+ a.parent_run_id AS parent_agent_invocation_id
1378
+ FROM activities a WHERE ${c.join(" AND ")} ORDER BY a.occurred_at`).all(...d)}costMonitorSummaryAggregate(t){let{from:n,to:i,providers:r=[],models:o=[]}=t,a=Ht(n),s=Ht(i),l="date(COALESCE(a.source_started_at, a.source_occurred_at, a.occurred_at), '-3 hours')",c=["(a.total_tokens IS NOT NULL OR a.cost_brl IS NOT NULL OR a.cost_usd IS NOT NULL)",`(? IS NULL OR ${l} >= ?)`,`(? IS NULL OR ${l} <= ?)`],d=[a,a,s,s],u=(Z,oe)=>{oe===void 0||oe.length===0||(c.push(`a.${Z} IN (${oe.map(()=>"?").join(",")})`),d.push(...oe))};if(u("zaip_agent",t.agents),u("phase",t.phases),u("status",t.statuses),u("task_id",t.tasks),u("spec_id",t.specs),u("prd_id",t.prds),u("execution_id",t.executions),u("change_id",t.changes),r.length>0||o.length>0){let Z=[],oe=[],he=[],Re=[];r.length>0&&(Z.push(`COALESCE(u.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),oe.push(`COALESCE(a.provider, 'unavailable') IN (${r.map(()=>"?").join(",")})`),he.push(...r),Re.push(...r)),o.length>0&&(Z.push(`COALESCE(u.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`),oe.push(`COALESCE(a.model, 'unavailable') IN (${o.map(()=>"?").join(",")})`),he.push(...o),Re.push(...o)),c.push(`((a.agent_run_id IS NULL AND ${oe.join(" AND ")}) OR (a.agent_run_id IS NOT NULL AND a.agent_run_id IN (SELECT u.agent_invocation_id FROM invocation_usage u WHERE ${Z.join(" AND ")})))`),d.push(...Re,...he)}let _=`WITH selected AS (
1379
+ SELECT ${l} AS day,
1380
+ CASE WHEN a.phase='conversation' THEN 'conversation'
1381
+ WHEN a.phase='planning' THEN 'planning' ELSE 'execution' END AS phase_key,
1382
+ a.task_id, a.model, a.agent_run_id, a.activity_source_kind,
1383
+ a.source_event_count AS event_count,
1384
+ a.attributed_token_active_ms AS duration_ms,
1385
+ a.input_tokens, a.cached_input_tokens, a.output_tokens, a.reasoning_tokens,
1386
+ a.total_tokens, a.cost_usd, a.cost_brl
1387
+ FROM activities a WHERE ${c.join(" AND ")}
1388
+ )`,v=this.database.prepare(`${_}
1389
+ SELECT day, phase_key, COUNT(*) AS eligible_runs,
1390
+ json_group_array(DISTINCT task_id) AS task_ids_json,
1391
+ COALESCE(SUM(event_count), 0) AS events,
1392
+ SUM(duration_ms) AS duration_ms,
1393
+ SUM(input_tokens) AS input_tokens,
1394
+ SUM(cached_input_tokens) AS cached_input_tokens,
1395
+ SUM(output_tokens) AS output_tokens,
1396
+ SUM(reasoning_tokens) AS reasoning_tokens,
1397
+ SUM(total_tokens) AS total_tokens,
1398
+ SUM(cost_usd) AS cost_usd,
1399
+ SUM(cost_brl) AS cost_brl,
1400
+ COUNT(duration_ms) AS duration_known,
1401
+ COUNT(total_tokens) AS tokens_known,
1402
+ COUNT(cost_usd) AS usd_known,
1403
+ COUNT(cost_brl) AS brl_known
1404
+ FROM selected GROUP BY day, phase_key ORDER BY day, phase_key`).all(...d),f=["duration_ms","input_tokens","cached_input_tokens","output_tokens","reasoning_tokens","total_tokens","cost_usd","cost_brl"],h=["eligible_runs","events","duration_known","tokens_known","usd_known","brl_known"],k=(Z,oe)=>{let he={key:Z};for(let Fe of h)he[Fe]=oe.reduce((bt,St)=>bt+(typeof St[Fe]=="number"?Number(St[Fe]):0),0);for(let Fe of f){let bt=oe.filter(St=>typeof St[Fe]=="number");he[Fe]=bt.length===0?null:bt.reduce((St,Pt)=>St+Number(Pt[Fe]),0)}let Re=new Set;for(let Fe of oe)if(typeof Fe.task_ids_json=="string")for(let bt of JSON.parse(Fe.task_ids_json))typeof bt=="string"&&Re.add(bt);return he.task_count=Re.size,he},O=["conversation","planning","execution"].map(Z=>k(Z,v.filter(oe=>oe.phase_key===Z)));O.push(k("total",v));let g=[...new Set(v.map(Z=>String(Z.day)))].map(Z=>k(Z,v.filter(oe=>String(oe.day)===Z))),b=this.database.prepare(`WITH canonical_ids AS MATERIALIZED (
1405
+ SELECT entity_kind AS kind, id FROM canonical_work_items
1406
+ ), work_item_days AS (
1407
+ SELECT entity_kind AS kind, id, occurred_day_sp AS day FROM canonical_work_items
1408
+ UNION ALL
1409
+ SELECT 'task', a.task_id, MIN(a.occurred_day_sp) FROM activities a
1410
+ LEFT JOIN canonical_ids c ON c.kind='task' AND c.id=a.task_id
1411
+ WHERE a.task_id IS NOT NULL AND c.id IS NULL
1412
+ GROUP BY a.task_id
1413
+ UNION ALL
1414
+ SELECT 'spec', a.spec_id, MIN(a.occurred_day_sp) FROM activities a
1415
+ LEFT JOIN canonical_ids c ON c.kind='spec' AND c.id=a.spec_id
1416
+ WHERE a.spec_id IS NOT NULL AND c.id IS NULL
1417
+ GROUP BY a.spec_id
1418
+ UNION ALL
1419
+ SELECT 'prd', a.prd_id, MIN(a.occurred_day_sp) FROM activities a
1420
+ LEFT JOIN canonical_ids c ON c.kind='prd' AND c.id=a.prd_id
1421
+ WHERE a.prd_id IS NOT NULL AND c.id IS NULL
1422
+ GROUP BY a.prd_id
1423
+ ), structural AS (
1424
+ SELECT day,
1425
+ SUM(CASE WHEN kind='prd' THEN 1 ELSE 0 END) AS prd_count,
1426
+ SUM(CASE WHEN kind='spec' THEN 1 ELSE 0 END) AS spec_count,
1427
+ SUM(CASE WHEN kind='task' THEN 1 ELSE 0 END) AS task_count,
1428
+ 0 AS validation_count, 0 AS evidence_count
1429
+ FROM work_item_days
1430
+ WHERE day IS NOT NULL
1431
+ AND (? IS NULL OR day >= ?)
1432
+ AND (? IS NULL OR day <= ?)
1433
+ GROUP BY day
1434
+ UNION ALL
1435
+ SELECT occurred_day_sp,
1436
+ 0, 0, 0,
1437
+ SUM(CASE WHEN artifact_kind='validation' THEN 1 ELSE 0 END),
1438
+ SUM(CASE WHEN artifact_kind='evidence' THEN 1 ELSE 0 END)
1439
+ FROM canonical_artifacts
1440
+ WHERE occurred_day_sp IS NOT NULL
1441
+ AND (? IS NULL OR occurred_day_sp >= ?)
1442
+ AND (? IS NULL OR occurred_day_sp <= ?)
1443
+ GROUP BY occurred_day_sp
1444
+ )
1445
+ SELECT day,
1446
+ SUM(prd_count) AS prd_count,
1447
+ SUM(spec_count) AS spec_count,
1448
+ SUM(task_count) AS task_count,
1449
+ SUM(validation_count) AS validation_count,
1450
+ SUM(evidence_count) AS evidence_count
1451
+ FROM structural GROUP BY day ORDER BY day`).all(a,a,s,s,a,a,s,s),T=Z=>typeof Z=="number"?Z:0,I=Z=>typeof Z=="number"?Z:null,R=Z=>{let oe=T(Z?.eligible_runs);return{events:T(Z?.events),duration_ms:I(Z?.duration_ms),tokens:{input:I(Z?.input_tokens),cached_input:I(Z?.cached_input_tokens),output:I(Z?.output_tokens),reasoning:I(Z?.reasoning_tokens),total:I(Z?.total_tokens)},cost:{usd:I(Z?.cost_usd),brl:I(Z?.cost_brl)},coverage:{events:T(Z?.events),tokens:T(Z?.tokens_known),usd:T(Z?.usd_known),brl:T(Z?.brl_known)},_duration_population:{eligible_runs:oe,known_runs:T(Z?.duration_known)}}},U=new Map(O.map(Z=>[String(Z.key),Z])),V=U.get("total"),y=Z=>{let{_duration_population:oe,...he}=Z;return he},S=y(R(U.get("conversation"))),x=y(R(U.get("planning"))),W=y(R(U.get("execution"))),ce=y(R(U.get("total"))),ee=y(R()),ge=new Map(g.map(Z=>[String(Z.key),Z])),L=new Map(b.map(Z=>[String(Z.day),Z])),B=[...new Set([...ge.keys(),...L.keys()])].sort().map(Z=>{let oe=ge.get(Z),he=L.get(Z),Re=T(oe?.eligible_runs),Fe=T(oe?.duration_known);return{key:Z,prd_count:T(he?.prd_count),spec_count:T(he?.spec_count),task_count:T(he?.task_count),validation_count:T(he?.validation_count),evidence_count:T(he?.evidence_count),total_run_count:Re,total_duration:I(oe?.duration_ms),duration_known:T(oe?.duration_ms),duration_unknown:Math.max(0,Re-Fe),total_tokens:I(oe?.total_tokens),total_cost_usd:I(oe?.cost_usd),total_cost_brl:I(oe?.cost_brl),source_event_count:T(oe?.events)}}),me=Object.fromEntries(B.map(Z=>{let oe=ge.get(Z.key),he=T(oe?.eligible_runs),Re=T(oe?.tokens_known),Fe=T(oe?.brl_known);return[Z.key,{prds:Z.prd_count,specs:Z.spec_count,tasks:Z.task_count,validations:Z.validation_count,evidences:Z.evidence_count,runs:he,usage:{total_tokens:{known_sum:T(oe?.total_tokens),unknown:he-Re,complete:Re===he,coverage_ratio:he===0?1:Re/he},cost:{known_sum:T(oe?.cost_brl),unknown:he-Fe,complete:Fe===he,coverage_ratio:he===0?1:Fe/he,currency:"BRL"}},events:{known_sum:T(oe?.events),unknown:0,complete:!0,coverage_ratio:1}}]})),Ie=Object.fromEntries(g.map(Z=>{let oe=R(Z);return[String(Z.key),{known_sum:T(Z.duration_ms),eligible_runs:oe._duration_population.eligible_runs,known_runs:oe._duration_population.known_runs}]})),Te=this.database.prepare(`${_},
1452
+ segment_totals AS (
1453
+ SELECT agent_invocation_id, SUM(total_tokens) AS total_tokens,
1454
+ SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1455
+ FROM cost_invocation_dimension_facts
1456
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1457
+ GROUP BY agent_invocation_id
1458
+ ), components AS (
1459
+ -- Agent facts can contain several observed models. Attribute their
1460
+ -- financial components to the model segment, never to a mixed parent.
1461
+ SELECT CASE WHEN f.model IS NULL OR trim(f.model) = '' OR lower(f.model) IN ('unavailable', 'unknown', 'mixed')
1462
+ THEN 'unavailable' ELSE f.model END AS key,
1463
+ SUM(f.total_tokens) AS total_tokens, SUM(f.cost_usd) AS total_cost_usd,
1464
+ SUM(f.cost_brl) AS total_cost_brl
1465
+ FROM selected s JOIN cost_invocation_dimension_facts f
1466
+ ON f.agent_invocation_id=s.agent_run_id
1467
+ WHERE s.agent_run_id IS NOT NULL
1468
+ GROUP BY key
1469
+ UNION ALL
1470
+ -- Non-agent financial facts have no invocation segments, so their
1471
+ -- observed model remains the only factual dimension.
1472
+ SELECT CASE WHEN model IS NULL OR trim(model) = '' OR lower(model) IN ('unavailable', 'unknown', 'mixed')
1473
+ THEN 'unavailable' ELSE model END AS key,
1474
+ SUM(total_tokens), SUM(cost_usd), SUM(cost_brl)
1475
+ FROM selected WHERE agent_run_id IS NULL GROUP BY key
1476
+ UNION ALL
1477
+ -- Preserve any consolidated invocation remainder as Sem dimens\xE3o so
1478
+ -- the model chart reconciles to the same financial population.
1479
+ SELECT 'unavailable' AS key,
1480
+ SUM(s.total_tokens - COALESCE(st.total_tokens, 0)),
1481
+ SUM(s.cost_usd - COALESCE(st.cost_usd, 0)),
1482
+ SUM(s.cost_brl - COALESCE(st.cost_brl, 0))
1483
+ FROM selected s LEFT JOIN segment_totals st ON st.agent_invocation_id=s.agent_run_id
1484
+ WHERE s.agent_run_id IS NOT NULL
1485
+ AND (s.total_tokens <> COALESCE(st.total_tokens, 0)
1486
+ OR s.cost_usd <> COALESCE(st.cost_usd, 0)
1487
+ OR s.cost_brl <> COALESCE(st.cost_brl, 0))
1488
+ )
1489
+ SELECT key, 0 AS invocation_count, NULL AS task_count,
1490
+ NULL AS total_duration, 0 AS duration_unknown, 0 AS duration_known,
1491
+ 0 AS source_event_count, SUM(total_tokens) AS total_tokens,
1492
+ SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
1493
+ FROM components GROUP BY key ORDER BY total_cost_brl DESC, key`).all(...d).map(Z=>{let oe=I(Z.total_duration),he=T(Z.duration_unknown),Re=I(Z.duration_known)??oe??0;return{key:String(Z.key??"unavailable"),label:String(Z.label??Z.key??"unavailable"),latest_started_at:"",run_count:T(Z.invocation_count),task_count:I(Z.task_count),prd_count:0,spec_count:0,evidence_count:0,test_count:0,event_count:T(Z.source_event_count),total_tokens:I(Z.total_tokens),estimated_usd:I(Z.total_cost_usd),estimated_brl:I(Z.total_cost_brl),duration_ms:oe,duration:{known_sum:Re,unknown:he,complete:he===0,coverage_ratio:he===0?1:0},coverage:{events:0,tokens:0,usd:0,brl:0}}});return{periods:{daily:me},aggregate_usage:{conversation:S,planning:x,execution:W,total:ce,new_work:ce,rework:ee},task_count:T(V?.task_count),model_groups:Te,cost_monitor_daily_duration:Ie,daily_rows:B}}summaryPage(t,n,i,r,o=null){let a="operations_work_summary",s=n.from?.slice(0,10)??null,l=n.to?.slice(0,10)??null,c=EK(o),d=["entity_kind = ?","(? IS NULL OR occurred_day_sp >= ?)","(? IS NULL OR occurred_day_sp <= ?)"],u=[t,s,s,l,l];n.status&&(d.push("status = ?"),u.push(n.status)),n.risk&&(d.push("risk = ?"),u.push(n.risk)),n.query&&(d.push("(id LIKE ? OR title LIKE ?)"),u.push(`%${n.query}%`,`%${n.query}%`));let _=d.join(" AND "),p=[...u];c!==null&&(d.push("(occurred_at < ? OR (occurred_at = ? AND id < ?))"),u.push(c[0],c[0],c[1]));let v=d.join(" AND "),f=Number(this.database.prepare(`SELECT COUNT(*) AS count FROM ${a} WHERE ${_}`).get(...p).count),h=c===null?i:0,k=this.database.prepare(`SELECT id, title, status, risk, occurred_at, occurred_day_sp,
1494
+ invocation_count, llm_call_count, total_duration, total_tokens, total_cost_usd, total_cost_brl
1495
+ FROM ${a} WHERE ${v} ORDER BY occurred_at DESC, id DESC LIMIT ? OFFSET ?`).all(...u,r,h),w=k.at(-1);return{data_source:"sqlite_read_model",kind:t,offset:h,limit:r,total:f,has_more:k.length===r&&(c!==null||h+k.length<f),next_cursor:w===void 0||k.length<r?null:wK(String(w.occurred_at),String(w.id)),rows:k}}overviewPage(t,n,i){let r=Number(this.database.prepare("SELECT COUNT(*) AS count FROM overview WHERE period_kind = ?").get(t).count),o=this.database.prepare(`SELECT o.*, op.operations_total_duration, cm.cost_monitor_total_duration, cm.total_tokens, cm.total_cost_usd, cm.total_cost_brl
1496
+ FROM overview o JOIN operations_overview op USING(period_kind, period_key) JOIN cost_monitor_overview cm USING(period_kind, period_key)
1497
+ WHERE o.period_kind = ? ORDER BY o.period_key DESC LIMIT ? OFFSET ?`).all(t,i,n),a=this.executionDurationByDay({from:null,to:null});for(let s of o)s.operations_total_duration=[...a].filter(([l])=>t==="day"?l===s.period_key:l.startsWith(String(s.period_key))).reduce((l,[,c])=>l+c,0);return{data_source:"sqlite_read_model",kind:"overview",period:t,offset:n,limit:i,total:r,has_more:n+o.length<r,rows:o}}viewPage(t,n){let i=`${t}:${JSON.stringify(n)}`,r=this.viewPageResultCache.get(i);if(r!==void 0)return structuredClone(r);let o=this.uncachedViewPage(t,n);if(this.viewPageResultCache.size>=256){let a=this.viewPageResultCache.keys().next().value;a!==void 0&&this.viewPageResultCache.delete(a)}return this.viewPageResultCache.set(i,structuredClone(o)),o}uncachedViewPage(t,n){if(["operations_work_kanban","operations_executions","operations_agent_invocations","operations_conversations"].includes(t)&&!n.from&&!n.to&&!n.query&&!n.status&&!n.risk&&!n.provider&&!n.model&&!n.agent&&!n.phase&&!n.origin&&!n.workType&&!n.priority){let g=this.unfilteredViewRows(t),b=Math.min(200,Math.max(1,n.limit??100)),T=Math.max(0,n.offset??0),I=g.slice(T,T+b);return{data_source:"sqlite_read_model",view:t,offset:T,limit:b,total_count:g.length,has_more:T+I.length<g.length,rows:I}}if(t==="operations_work_list"&&!n.from&&!n.to&&!n.query&&!n.status&&!n.risk){let g=this.operationsWorkListRows(),b=Math.min(200,Math.max(1,n.limit??50)),T=Math.max(0,n.offset??0),I=g.slice(T,T+b);return{data_source:"sqlite_read_model",view:t,offset:T,limit:b,total_count:g.length,has_more:T+I.length<g.length,rows:I}}if(t==="cost_monitor_agent_invocations"){let g="date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')",b=[`(? IS NULL OR ${g} >= ?)`,`(? IS NULL OR ${g} <= ?)`],T=Ht(n.from),I=Ht(n.to),R=[T,T,I,I],U=(ee,ge)=>{ge&&(b.push(`${ee} = ?`),R.push(ge))};U("i.zaip_agent",n.agent),U("i.phase",n.phase),U("i.status",n.status);let V=[];n.provider&&(n.provider==="unavailable"?b.push("((i.agent_invocation_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')) OR (i.agent_invocation_id IS NULL AND (i.provider IS NULL OR i.provider = 'unavailable')))"):(V.push("f.provider=?"),R.push(n.provider))),n.model&&(n.model==="unavailable"?b.push("((i.agent_invocation_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')) OR (i.agent_invocation_id IS NULL AND (i.model IS NULL OR i.model = 'unavailable')))"):(V.push("f.model=?"),R.push(n.model))),V.length>0&&b.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id=i.agent_invocation_id AND ${V.join(" AND ")})`),n.query&&(b.push("(i.agent_invocation_id LIKE ? OR i.task_id LIKE ? OR i.execution_id LIKE ?)"),R.push(`%${n.query}%`,`%${n.query}%`,`%${n.query}%`));let y=b.join(" AND "),S=Math.min(200,Math.max(1,n.limit??100)),x=Math.max(0,n.offset??0),W=Number(this.database.prepare(`SELECT COUNT(*) AS count FROM cost_agent_invocations i WHERE ${y}`).get(...R).count),ce=this.database.prepare(`SELECT i.* FROM cost_agent_invocations i WHERE ${y} ORDER BY i.occurred_at DESC, i.agent_invocation_id DESC LIMIT ? OFFSET ?`).all(...R,S,x);return{data_source:"sqlite_read_model",view:t,offset:x,limit:S,total_count:W,has_more:x+ce.length<W,rows:ce}}let o={cost_monitor_daily:"day",cost_monitor_monthly:"month",cost_monitor_annual:"year",cost_monitor_zaip_agents:"agent",cost_monitor_models:"model",cost_monitor_providers:"provider"}[t];if((o==="model"||o==="provider")&&!n.from&&!n.to&&!n.query&&!n.status&&!n.risk&&!n.provider&&!n.model&&!n.agent&&!n.phase&&!n.origin&&!n.workType&&!n.priority){let g=o,b=this.database.prepare(`SELECT
1498
+ json_extract(payload_json, '$.key') AS key,
1499
+ json_extract(payload_json, '$.label') AS label,
1500
+ json_extract(payload_json, '$.invocation_count') AS invocation_count,
1501
+ json_extract(payload_json, '$.task_count') AS task_count,
1502
+ json_extract(payload_json, '$.total_duration') AS total_duration,
1503
+ json_extract(payload_json, '$.source_event_count') AS source_event_count,
1504
+ json_extract(payload_json, '$.total_tokens') AS total_tokens,
1505
+ json_extract(payload_json, '$.total_cost_usd') AS total_cost_usd,
1506
+ json_extract(payload_json, '$.total_cost_brl') AS total_cost_brl
1507
+ FROM zaip_aios_activities
1508
+ WHERE payload_type='cost_dimension_aggregate_v1'
1509
+ AND json_extract(payload_json, '$.dimension')=?
1510
+ ORDER BY total_cost_brl DESC, key`).all(g),T=Math.min(200,Math.max(1,n.limit??50)),I=Math.max(0,n.offset??0),R=b.slice(I,I+T);return{data_source:"sqlite_read_model",view:t,offset:I,limit:T,total_count:b.length,has_more:I+R.length<b.length,rows:R}}if(o==="agent"){let g=["i.zaip_agent IS NOT NULL"],b=[];if(n.from&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),b.push(n.from.slice(0,10))),n.to&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),b.push(n.to.slice(0,10))),n.agent&&(g.push("i.zaip_agent = ?"),b.push(n.agent)),n.phase&&(g.push("i.phase = ?"),b.push(n.phase)),n.status&&(g.push("i.status = ?"),b.push(n.status)),n.priority&&g.push("0"),n.risk&&(g.push("t.risk = ?"),b.push(n.risk)),n.origin){let B=n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL";g.push(B)}n.workType&&g.push("0");let T=[];if(n.provider&&(n.provider==="unavailable"?g.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(T.push("f.provider = ?"),b.push(n.provider))),n.model&&(n.model==="unavailable"?g.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')"):(T.push("f.model = ?"),b.push(n.model))),T.length>0&&g.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id=i.agent_invocation_id AND ${T.join(" AND ")})`),n.query){let B=`%${n.query}%`;g.push("(i.zaip_agent LIKE ? OR i.zaip_agent_persona LIKE ? OR i.zaip_agent_job LIKE ?)"),b.push(B,B,B)}let I="date(COALESCE(a.source_started_at, a.source_occurred_at, a.occurred_at), '-3 hours')",R=["a.activity_source_kind <> 'agent_run'","a.zaip_agent IS NOT NULL","(a.total_tokens IS NOT NULL OR a.cost_brl IS NOT NULL OR a.cost_usd IS NOT NULL)"],U=[];if(n.from&&(R.push(`${I} >= ?`),U.push(n.from.slice(0,10))),n.to&&(R.push(`${I} <= ?`),U.push(n.to.slice(0,10))),n.agent&&(R.push("a.zaip_agent = ?"),U.push(n.agent)),n.phase&&(R.push("a.phase = ?"),U.push(n.phase)),n.status&&(R.push("a.status = ?"),U.push(n.status)),(n.priority||n.workType)&&R.push("0"),n.risk&&(R.push("activity_task.risk = ?"),U.push(n.risk)),n.origin&&R.push(n.origin==="prd"?"a.prd_id IS NOT NULL":n.origin==="spec"?"a.prd_id IS NULL AND a.spec_id IS NOT NULL":n.origin==="task"?"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NOT NULL":"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NULL"),n.provider||n.model){let B=[],me=[];n.provider&&(B.push("COALESCE(a.provider, 'unavailable') = ?"),me.push("COALESCE(u.provider, 'unavailable') = ?"),U.push(n.provider)),n.model&&(B.push("COALESCE(a.model, 'unavailable') = ?"),me.push("COALESCE(u.model, 'unavailable') = ?"),U.push(n.model)),R.push(`((a.agent_run_id IS NULL AND ${B.join(" AND ")}) OR (a.agent_run_id IS NOT NULL AND EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id = a.agent_run_id AND ${me.join(" AND ")})))`),n.provider&&U.push(n.provider),n.model&&U.push(n.model)}if(n.query){let B=`%${n.query}%`;R.push("(a.zaip_agent LIKE ? OR a.zaip_agent_persona LIKE ? OR a.zaip_agent_job LIKE ?)"),U.push(B,B,B)}let V=g.join(" AND "),y=["i.zaip_agent IS NOT NULL","(i.total_tokens IS NOT NULL OR i.cost_brl IS NOT NULL OR i.cost_usd IS NOT NULL)"],S=[],x="date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')";if(n.from&&(y.push(`${x} >= ?`),S.push(n.from.slice(0,10))),n.to&&(y.push(`${x} <= ?`),S.push(n.to.slice(0,10))),n.agent&&(y.push("i.zaip_agent = ?"),S.push(n.agent)),n.phase&&(y.push("i.phase = ?"),S.push(n.phase)),n.status&&(y.push("i.status = ?"),S.push(n.status)),(n.priority||n.workType)&&y.push("0"),n.risk&&(y.push("invocation_task.risk = ?"),S.push(n.risk)),n.origin&&y.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.provider||n.model){let B=[];n.provider&&(B.push("COALESCE(u.provider, 'unavailable') = ?"),S.push(n.provider)),n.model&&(B.push("COALESCE(u.model, 'unavailable') = ?"),S.push(n.model)),y.push(`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=i.agent_invocation_id AND ${B.join(" AND ")})`)}if(n.query){let B=`%${n.query}%`;y.push("(i.zaip_agent LIKE ? OR i.zaip_agent_persona LIKE ? OR i.zaip_agent_job LIKE ?)"),S.push(B,B,B)}let W=`WITH agent_facts AS (
1511
+ SELECT i.zaip_agent AS key, i.zaip_agent_persona AS persona, i.zaip_agent_job AS job, d.persona AS catalog_persona, d.job AS catalog_job,
1512
+ i.occurred_at, i.task_id, i.duration_ms, i.source_event_count, i.total_tokens, i.cost_usd, i.cost_brl
1513
+ FROM invocations i LEFT JOIN tasks invocation_task ON invocation_task.id=i.task_id LEFT JOIN zaip_dim_zaip_agent d ON d.zaip_agent = i.zaip_agent
1514
+ WHERE ${y.join(" AND ")}
1515
+ UNION ALL
1516
+ SELECT a.zaip_agent AS key, a.zaip_agent_persona AS persona, a.zaip_agent_job AS job, d.persona AS catalog_persona, d.job AS catalog_job,
1517
+ a.occurred_at, a.task_id, a.attributed_token_active_ms AS duration_ms, a.source_event_count, a.total_tokens, a.cost_usd, a.cost_brl
1518
+ FROM activities a LEFT JOIN tasks activity_task ON activity_task.id=a.task_id LEFT JOIN zaip_dim_zaip_agent d ON d.zaip_agent = a.zaip_agent
1519
+ WHERE ${R.join(" AND ")}
1520
+ )`,ce=Math.min(200,Math.max(1,n.limit??50)),ee=Math.max(0,n.offset??0),ge=Number(this.database.prepare(`${W} SELECT COUNT(DISTINCT key) AS count FROM agent_facts`).get(...S,...U).count),L=this.database.prepare(`${W} SELECT COUNT(*) AS invocation_count, COUNT(DISTINCT task_id) AS task_count, SUM(duration_ms) AS total_duration, SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) AS duration_unknown, SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) AS duration_known, SUM(source_event_count) AS source_event_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM agent_facts`).get(...S,...U),le=this.database.prepare(`${W} SELECT key, key AS label, COALESCE(MAX(persona), MAX(catalog_persona)) AS persona, COALESCE(MAX(job), MAX(catalog_job)) AS job, MAX(occurred_at) AS latest_started_at, COUNT(*) AS invocation_count, COUNT(DISTINCT task_id) AS task_count, SUM(duration_ms) AS total_duration, SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) AS duration_unknown, SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) AS duration_known, SUM(source_event_count) AS source_event_count, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM agent_facts GROUP BY key ORDER BY total_cost_brl DESC, key LIMIT ? OFFSET ?`).all(...S,...U,ce,ee);return{data_source:"sqlite_read_model",view:t,offset:ee,limit:ce,total_count:ge,has_more:ee+le.length<ge,totals:L,rows:le}}if(o==="model"){let g=["1=1"],b=[];n.from&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),b.push(n.from.slice(0,10))),n.to&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),b.push(n.to.slice(0,10))),n.agent&&(g.push("i.zaip_agent = ?"),b.push(n.agent)),n.phase&&(g.push("i.phase = ?"),b.push(n.phase)),n.status&&(g.push("i.status = ?"),b.push(n.status)),(n.priority||n.workType)&&g.push("0"),n.risk&&(g.push("t.risk = ?"),b.push(n.risk)),n.origin&&g.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.provider&&(n.provider==="unavailable"?g.push("s.provider IS NULL AND NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(g.push("s.provider = ?"),b.push(n.provider))),n.model&&(n.model==="unavailable"?g.push("s.model_key = 'unavailable'"):(g.push("s.model_key = ?"),b.push(n.model))),n.query&&(g.push("s.model_key LIKE ?"),b.push(`%${n.query}%`));let T=g.join(" AND "),I=["a.activity_source_kind <> 'agent_run'"],R=[];n.from&&(I.push("a.occurred_day_sp >= ?"),R.push(n.from.slice(0,10))),n.to&&(I.push("a.occurred_day_sp <= ?"),R.push(n.to.slice(0,10))),n.agent&&(I.push("a.zaip_agent = ?"),R.push(n.agent)),n.phase&&(I.push("a.phase = ?"),R.push(n.phase)),n.status&&(I.push("a.status = ?"),R.push(n.status)),(n.priority||n.workType)&&I.push("0"),n.risk&&(I.push("activity_task.risk = ?"),R.push(n.risk)),n.origin&&I.push(n.origin==="prd"?"a.prd_id IS NOT NULL":n.origin==="spec"?"a.prd_id IS NULL AND a.spec_id IS NOT NULL":n.origin==="task"?"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NOT NULL":"a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NULL"),n.provider&&(n.provider==="unavailable"?I.push("a.provider IS NULL OR trim(a.provider) = '' OR a.provider = 'unavailable'"):(I.push("a.provider = ?"),R.push(n.provider))),n.model&&(n.model==="unavailable"?I.push("a.model IS NULL OR trim(a.model) = '' OR a.model = 'unavailable'"):(I.push("a.model = ?"),R.push(n.model))),n.query&&(I.push("COALESCE(a.model, 'unavailable') LIKE ?"),R.push(`%${n.query}%`));let U=`WITH segment_totals AS (
1521
+ SELECT agent_invocation_id, SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1522
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1523
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1524
+ FROM cost_invocation_dimension_facts
1525
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1526
+ GROUP BY agent_invocation_id
1527
+ ), segments AS (
1528
+ SELECT agent_invocation_id,
1529
+ CASE WHEN model IS NULL OR trim(model) = '' OR model = 'unavailable' THEN 'unavailable' ELSE model END AS model_key,
1530
+ CASE WHEN provider IS NULL OR trim(provider) = '' OR provider = 'unavailable' THEN NULL ELSE provider END AS provider,
1531
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1532
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1533
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1534
+ FROM cost_invocation_dimension_facts
1535
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1536
+ GROUP BY agent_invocation_id, model_key, provider
1537
+ UNION ALL
1538
+ -- Preserve every factual residual from the consolidated invocation:
1539
+ -- source totals can exceed their attributed usage segments even when
1540
+ -- a provider/model string exists. The residual is Sem dimens\xE3o.
1541
+ SELECT i.agent_invocation_id, 'unavailable' AS model_key, NULL AS provider,
1542
+ i.input_tokens - COALESCE(st.input_tokens, 0), i.cached_input_tokens - COALESCE(st.cached_input_tokens, 0),
1543
+ i.output_tokens - COALESCE(st.output_tokens, 0), i.reasoning_tokens - COALESCE(st.reasoning_tokens, 0),
1544
+ i.total_tokens - COALESCE(st.total_tokens, 0), i.cost_usd - COALESCE(st.cost_usd, 0), i.cost_brl - COALESCE(st.cost_brl, 0)
1545
+ FROM invocations i LEFT JOIN segment_totals st USING(agent_invocation_id)
1546
+ WHERE (i.total_tokens IS NOT NULL OR i.cost_usd IS NOT NULL OR i.cost_brl IS NOT NULL)
1547
+ AND (i.total_tokens <> COALESCE(st.total_tokens, 0) OR i.cost_usd <> COALESCE(st.cost_usd, 0) OR i.cost_brl <> COALESCE(st.cost_brl, 0))
1548
+ ), model_segments AS (
1549
+ SELECT agent_invocation_id, model_key, SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1550
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1551
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1552
+ FROM segments GROUP BY agent_invocation_id, model_key
1553
+ ), known_models AS (
1554
+ SELECT agent_invocation_id, COUNT(DISTINCT model_key) AS model_count
1555
+ FROM model_segments WHERE model_key <> 'unavailable' GROUP BY agent_invocation_id
1556
+ ), filtered_segments AS (
1557
+ SELECT s.*, i.task_id, i.duration_ms, i.source_event_count, km.model_count
1558
+ FROM segments s JOIN invocations i USING(agent_invocation_id)
1559
+ LEFT JOIN tasks t ON t.id=i.task_id LEFT JOIN known_models km USING(agent_invocation_id)
1560
+ WHERE ${T}`,V=`), financial_components AS (
1561
+ SELECT model_key AS key, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl
1562
+ FROM filtered_segments GROUP BY model_key
1563
+ UNION ALL
1564
+ SELECT CASE WHEN a.model IS NULL OR trim(a.model) = '' OR lower(a.model) IN ('unavailable', 'unknown', 'mixed') THEN 'unavailable' ELSE a.model END AS key,
1565
+ SUM(a.total_tokens) AS total_tokens, SUM(a.cost_usd) AS total_cost_usd, SUM(a.cost_brl) AS total_cost_brl
1566
+ FROM activities a LEFT JOIN tasks activity_task ON activity_task.id=a.task_id
1567
+ WHERE ${I.join(" AND ")}
1568
+ AND (a.total_tokens IS NOT NULL OR a.cost_usd IS NOT NULL OR a.cost_brl IS NOT NULL)
1569
+ GROUP BY key
1570
+ ), financial AS (
1571
+ SELECT key, SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
1572
+ FROM financial_components GROUP BY key
1573
+ ), population_models AS (
1574
+ SELECT agent_invocation_id, model_key, MAX(task_id) AS task_id, MAX(duration_ms) AS duration_ms,
1575
+ MAX(source_event_count) AS source_event_count, MAX(model_count) AS model_count
1576
+ FROM filtered_segments GROUP BY agent_invocation_id, model_key
1577
+ ), population_ranked AS (
1578
+ SELECT *, ROW_NUMBER() OVER (PARTITION BY agent_invocation_id ORDER BY model_key) AS model_rank
1579
+ FROM population_models
1580
+ ), population AS (
1581
+ SELECT model_key AS key,
1582
+ COUNT(*) AS invocation_count,
1583
+ SUM(duration_ms) AS total_duration,
1584
+ SUM(source_event_count) AS source_event_count
1585
+ FROM population_ranked WHERE model_rank = 1 AND model_count = 1
1586
+ GROUP BY model_key
1587
+ ), task_models AS (
1588
+ SELECT task_id, model_key
1589
+ FROM population_models WHERE task_id IS NOT NULL
1590
+ GROUP BY task_id, model_key
1591
+ ), task_population AS (
1592
+ SELECT model_key AS key,
1593
+ COUNT(*) AS task_count
1594
+ FROM task_models
1595
+ GROUP BY model_key
1596
+ ), keys AS (
1597
+ SELECT key FROM financial UNION SELECT key FROM population UNION SELECT key FROM task_population
1598
+ )`,y=Math.min(200,Math.max(1,n.limit??50)),S=Math.max(0,n.offset??0),x=Number(this.database.prepare(`${U} ${V} SELECT COUNT(*) AS count FROM keys`).get(...b,...R).count),W=this.database.prepare(`${U} ${V} SELECT
1599
+ (SELECT COUNT(*) FROM population_ranked WHERE model_rank = 1) AS invocation_count,
1600
+ (SELECT COUNT(DISTINCT task_id) FROM population_models) AS task_count,
1601
+ (SELECT SUM(duration_ms) FROM population_ranked WHERE model_rank = 1) AS total_duration,
1602
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) FROM population_ranked WHERE model_rank = 1) AS duration_unknown,
1603
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) FROM population_ranked WHERE model_rank = 1) AS duration_known,
1604
+ (SELECT SUM(source_event_count) FROM population_ranked WHERE model_rank = 1) AS source_event_count,
1605
+ SUM(input_tokens) AS total_input_tokens,
1606
+ SUM(cached_input_tokens) AS total_cached_input_tokens,
1607
+ SUM(output_tokens) AS total_output_tokens,
1608
+ SUM(reasoning_tokens) AS total_reasoning_tokens,
1609
+ SUM(total_tokens) AS total_tokens,
1610
+ SUM(cost_usd) AS total_cost_usd,
1611
+ SUM(cost_brl) AS total_cost_brl
1612
+ FROM filtered_segments`).get(...b,...R),ce=this.database.prepare(`${U} ${V} SELECT keys.key, keys.key AS label, COALESCE(population.invocation_count, 0) AS invocation_count, COALESCE(task_population.task_count, 0) AS task_count, population.total_duration, population.source_event_count, financial.total_tokens, financial.total_cost_usd, financial.total_cost_brl FROM keys LEFT JOIN population USING(key) LEFT JOIN task_population USING(key) LEFT JOIN financial USING(key) ORDER BY financial.total_cost_brl DESC, keys.key LIMIT ? OFFSET ?`).all(...b,...R,y,S);return{data_source:"sqlite_read_model",view:t,offset:S,limit:y,total_count:x,has_more:S+ce.length<x,totals:W,rows:ce}}if(o==="provider"){let g=["1=1"],b=[];n.from&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),b.push(n.from.slice(0,10))),n.to&&(g.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),b.push(n.to.slice(0,10))),n.agent&&(g.push("i.zaip_agent = ?"),b.push(n.agent)),n.phase&&(g.push("i.phase = ?"),b.push(n.phase)),n.status&&(g.push("i.status = ?"),b.push(n.status)),(n.priority||n.workType)&&g.push("0"),n.risk&&(g.push("t.risk = ?"),b.push(n.risk)),n.origin&&g.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.provider&&(n.provider==="unavailable"?g.push("s.provider_key = 'unavailable'"):(g.push("s.provider_key = ?"),b.push(n.provider))),n.model&&(n.model==="unavailable"?g.push("s.model_key = 'unavailable'"):(g.push("s.model_key = ?"),b.push(n.model))),n.query&&(g.push("s.provider_key LIKE ?"),b.push(`%${n.query}%`));let I=`WITH segment_totals AS (
1613
+ SELECT agent_invocation_id, SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1614
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1615
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1616
+ FROM cost_invocation_dimension_facts
1617
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1618
+ GROUP BY agent_invocation_id
1619
+ ), segments AS (
1620
+ SELECT agent_invocation_id,
1621
+ CASE WHEN provider IS NULL OR trim(provider) = '' OR provider = 'unavailable' THEN 'unavailable' ELSE provider END AS provider_key,
1622
+ CASE WHEN model IS NULL OR trim(model) = '' OR model = 'unavailable' THEN 'unavailable' ELSE model END AS model_key,
1623
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1624
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1625
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1626
+ FROM cost_invocation_dimension_facts
1627
+ WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
1628
+ GROUP BY agent_invocation_id, provider_key, model_key
1629
+ UNION ALL
1630
+ -- See the equivalent Models branch: attribute only the segment part;
1631
+ -- retain the consolidated factual remainder as Sem dimens\xE3o.
1632
+ SELECT i.agent_invocation_id, 'unavailable' AS provider_key, 'unavailable' AS model_key,
1633
+ i.input_tokens - COALESCE(st.input_tokens, 0), i.cached_input_tokens - COALESCE(st.cached_input_tokens, 0),
1634
+ i.output_tokens - COALESCE(st.output_tokens, 0), i.reasoning_tokens - COALESCE(st.reasoning_tokens, 0),
1635
+ i.total_tokens - COALESCE(st.total_tokens, 0), i.cost_usd - COALESCE(st.cost_usd, 0), i.cost_brl - COALESCE(st.cost_brl, 0)
1636
+ FROM invocations i LEFT JOIN segment_totals st USING(agent_invocation_id)
1637
+ WHERE (i.total_tokens IS NOT NULL OR i.cost_usd IS NOT NULL OR i.cost_brl IS NOT NULL)
1638
+ AND (i.total_tokens <> COALESCE(st.total_tokens, 0) OR i.cost_usd <> COALESCE(st.cost_usd, 0) OR i.cost_brl <> COALESCE(st.cost_brl, 0))
1639
+ ), provider_segments AS (
1640
+ SELECT agent_invocation_id, provider_key,
1641
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1642
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens,
1643
+ SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
1644
+ FROM segments GROUP BY agent_invocation_id, provider_key
1645
+ ), known_providers AS (
1646
+ SELECT agent_invocation_id, COUNT(DISTINCT provider_key) AS provider_count
1647
+ FROM provider_segments WHERE provider_key <> 'unavailable' GROUP BY agent_invocation_id
1648
+ ), filtered_segments AS (
1649
+ SELECT s.*, i.task_id, i.duration_ms, i.source_event_count, kp.provider_count
1650
+ FROM segments s JOIN invocations i USING(agent_invocation_id)
1651
+ LEFT JOIN tasks t ON t.id=i.task_id LEFT JOIN known_providers kp USING(agent_invocation_id)
1652
+ WHERE ${g.join(" AND ")}`,R=`), financial AS (
1653
+ SELECT provider_key AS key, SUM(total_tokens) AS total_tokens, SUM(cost_usd) AS total_cost_usd, SUM(cost_brl) AS total_cost_brl FROM filtered_segments GROUP BY provider_key
1654
+ ), population_providers AS (
1655
+ SELECT agent_invocation_id, provider_key, MAX(task_id) AS task_id, MAX(duration_ms) AS duration_ms, MAX(source_event_count) AS source_event_count, MAX(provider_count) AS provider_count
1656
+ FROM filtered_segments GROUP BY agent_invocation_id, provider_key
1657
+ ), population_ranked AS (
1658
+ SELECT *, ROW_NUMBER() OVER (PARTITION BY agent_invocation_id ORDER BY provider_key) AS provider_rank FROM population_providers
1659
+ ), population AS (
1660
+ SELECT provider_key AS key, COUNT(*) AS invocation_count, SUM(duration_ms) AS total_duration, SUM(source_event_count) AS source_event_count
1661
+ FROM population_ranked WHERE provider_rank = 1 AND provider_count = 1 GROUP BY provider_key
1662
+ ), task_providers AS (
1663
+ SELECT task_id, provider_key FROM population_providers WHERE task_id IS NOT NULL GROUP BY task_id, provider_key
1664
+ ), task_population AS (
1665
+ SELECT provider_key AS key, COUNT(*) AS task_count
1666
+ FROM task_providers GROUP BY provider_key
1667
+ ), keys AS (SELECT key FROM financial UNION SELECT key FROM population UNION SELECT key FROM task_population)`,U=Math.min(200,Math.max(1,n.limit??50)),V=Math.max(0,n.offset??0),y=Number(this.database.prepare(`${I} ${R} SELECT COUNT(*) AS count FROM keys`).get(...b).count),S=this.database.prepare(`${I} ${R} SELECT
1668
+ (SELECT COUNT(*) FROM population_ranked WHERE provider_rank = 1) AS invocation_count,
1669
+ (SELECT COUNT(DISTINCT task_id) FROM population_providers) AS task_count,
1670
+ (SELECT SUM(duration_ms) FROM population_ranked WHERE provider_rank = 1) AS total_duration,
1671
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 1 ELSE 0 END) FROM population_ranked WHERE provider_rank = 1) AS duration_unknown,
1672
+ (SELECT SUM(CASE WHEN duration_ms IS NULL THEN 0 ELSE duration_ms END) FROM population_ranked WHERE provider_rank = 1) AS duration_known,
1673
+ (SELECT SUM(source_event_count) FROM population_ranked WHERE provider_rank = 1) AS source_event_count,
1674
+ SUM(input_tokens) AS total_input_tokens,
1675
+ SUM(cached_input_tokens) AS total_cached_input_tokens,
1676
+ SUM(output_tokens) AS total_output_tokens,
1677
+ SUM(reasoning_tokens) AS total_reasoning_tokens,
1678
+ SUM(total_tokens) AS total_tokens,
1679
+ SUM(cost_usd) AS total_cost_usd,
1680
+ SUM(cost_brl) AS total_cost_brl
1681
+ FROM filtered_segments`).get(...b),x=this.database.prepare(`${I} ${R} SELECT keys.key, keys.key AS label, COALESCE(population.invocation_count,0) AS invocation_count, COALESCE(task_population.task_count,0) AS task_count, population.total_duration, population.source_event_count, financial.total_tokens, financial.total_cost_usd, financial.total_cost_brl FROM keys LEFT JOIN population USING(key) LEFT JOIN task_population USING(key) LEFT JOIN financial USING(key) ORDER BY financial.total_cost_brl DESC, keys.key LIMIT ? OFFSET ?`).all(...b,U,V);return{data_source:"sqlite_read_model",view:t,offset:V,limit:U,total_count:y,has_more:V+x.length<y,totals:S,rows:x}}let s=o==="day"||o==="month"||o==="year",l=!!(n.provider||n.model||n.agent||n.phase||n.status||n.origin||n.priority||n.risk||n.workType);if(o!==void 0&&s&&!l){let g=Ht(n.from),b=Ht(n.to),I=this.costMonitorSummaryAggregate({from:g,to:b}).daily_rows,R=new Map(I.map(L=>[String(L.key),L])),U=[...R.keys()].sort(),V=new Map,y=["prd_count","spec_count","task_count","validation_count","evidence_count","total_run_count","invocation_count","cost_monitor_invocation_count","llm_call_count","source_event_count","total_tokens","total_cost_usd","total_cost_brl"];for(let L of U){let le=o==="day"?L:o==="month"?L.slice(0,7):L.slice(0,4),B=V.get(le)??{key:le,label:le,period_key:le,start_day:L,end_day:L,total_duration:null,duration_incomplete:!1,duration_provenance:"unavailable",estimation_basis:null};B.start_day=String(B.start_day)<L?B.start_day:L,B.end_day=String(B.end_day)>L?B.end_day:L;let me=R.get(L);for(let Me of y){let Te=me?.[Me];typeof Te=="number"&&(B[Me]=(typeof B[Me]=="number"?Number(B[Me]):0)+Te)}let Ie=me?.total_duration;typeof Ie=="number"&&(B.total_duration=(typeof B.total_duration=="number"?Number(B.total_duration):0)+Ie),typeof me?.duration_unknown=="number"&&me.duration_unknown>0&&(B.duration_incomplete=!0),V.set(le,B)}let S=n.query?.toLocaleLowerCase()??null,x=[...V.values()].map(L=>{let le=typeof L.total_duration=="number"?L.total_duration:null,B=L.duration_incomplete===!0?1:0;return{key:String(L.key),label:String(L.label),prd_count:Number(L.prd_count??0),spec_count:Number(L.spec_count??0),task_count:Number(L.task_count??0),total_run_count:Number(L.total_run_count??0),validation_count:Number(L.validation_count??0),evidence_count:Number(L.evidence_count??0),total_duration:le,duration_known:le??0,duration_unknown:B,total_tokens:typeof L.total_tokens=="number"?L.total_tokens:null,total_cost_usd:typeof L.total_cost_usd=="number"?L.total_cost_usd:null,total_cost_brl:typeof L.total_cost_brl=="number"?L.total_cost_brl:null}}).filter(L=>S===null||String(L.key).toLocaleLowerCase().includes(S)).sort((L,le)=>String(le.key).localeCompare(String(L.key))),W=x.reduce((L,le)=>{for(let B of["prd_count","spec_count","task_count","total_run_count","validation_count","evidence_count","total_duration","duration_known","duration_unknown","total_tokens","total_cost_usd","total_cost_brl"]){let me=le[B];typeof me=="number"?L[B]=(L[B]??0)+me:B in L||(L[B]=null)}return L},{}),ce=Math.min(200,Math.max(1,n.limit??50)),ee=Math.max(0,n.offset??0),ge=x.slice(ee,ee+ce);return{data_source:"sqlite_read_model",view:t,offset:ee,limit:ce,total_count:x.length,has_more:ee+ge.length<x.length,totals:W,rows:ge}}if(o!==void 0&&(!s||l)){if(s&&n.workType)return{data_source:"sqlite_read_model",view:t,offset:Math.max(0,n.offset??0),limit:Math.min(200,Math.max(1,n.limit??50)),total_count:0,has_more:!1,rows:[]};let g=o==="day"?"date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')":o==="month"?"substr(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours'), 1, 7)":o==="year"?"substr(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours'), 1, 4)":"i.provider_group",b=[`${g} IS NOT NULL`,"(i.total_tokens IS NOT NULL OR i.cost_usd IS NOT NULL OR i.cost_brl IS NOT NULL)"],T=[];n.from&&(b.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') >= ?"),T.push(Ht(n.from))),n.to&&(b.push("date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours') <= ?"),T.push(Ht(n.to)));let I=[];if(n.provider&&(n.provider==="unavailable"?b.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(I.push("f.provider=?"),T.push(n.provider))),n.model&&(n.model==="unavailable"?b.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')"):(I.push("f.model=?"),T.push(n.model))),I.length>0&&b.push(`EXISTS (SELECT 1 FROM invocation_usage f WHERE f.agent_invocation_id=i.agent_invocation_id AND ${I.join(" AND ")})`),n.agent&&(b.push("i.zaip_agent = ?"),T.push(n.agent)),n.phase&&(b.push("i.phase = ?"),T.push(n.phase)),n.status&&(b.push("i.status = ?"),T.push(n.status)),n.priority&&b.push("0"),n.risk&&(b.push("i.task_risk = ?"),T.push(n.risk)),n.origin&&b.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),n.workType&&b.push("0"),n.query){let ce=`%${n.query}%`;b.push("(i.agent_invocation_id LIKE ? OR i.execution_id LIKE ? OR i.task_id LIKE ? OR i.spec_id LIKE ? OR i.prd_id LIKE ? OR i.conversation_id LIKE ? OR i.zaip_agent LIKE ? OR i.purpose LIKE ?)"),T.push(ce,ce,ce,ce,ce,ce,ce,ce)}let R=`WITH usage_rollup AS (
1682
+ SELECT agent_invocation_id,
1683
+ CASE COUNT(DISTINCT provider) WHEN 0 THEN NULL WHEN 1 THEN MIN(provider) ELSE 'mixed' END AS provider_group,
1684
+ CASE COUNT(DISTINCT model) WHEN 0 THEN NULL WHEN 1 THEN MIN(model) ELSE 'mixed' END AS model_group,
1685
+ SUM(input_tokens) AS input_tokens, SUM(cached_input_tokens) AS cached_input_tokens,
1686
+ SUM(output_tokens) AS output_tokens, SUM(reasoning_tokens) AS reasoning_tokens
1687
+ FROM invocation_usage GROUP BY agent_invocation_id
1688
+ ), facts AS (
1689
+ -- Temporal Cost Monitor groups intentionally retain historical
1690
+ -- financial activities that have no agent invocation id. For modern
1691
+ -- Agent Runs, usage_rollup remains available for provider/model
1692
+ -- same-segment filtering; historical facts keep their own recorded
1693
+ -- provider/model attributes.
1694
+ SELECT v.*, v.agent_run_id AS agent_invocation_id, t.risk AS task_risk,
1695
+ u.provider_group, u.model_group, u.input_tokens, u.cached_input_tokens,
1696
+ u.output_tokens, u.reasoning_tokens
1697
+ FROM activities v
1698
+ LEFT JOIN tasks t ON t.id=v.task_id
1699
+ LEFT JOIN usage_rollup u ON u.agent_invocation_id=v.agent_run_id
1700
+ )`,U=b.join(" AND "),V=Number(this.database.prepare(`${R} SELECT COUNT(*) AS count FROM (SELECT ${g} FROM facts i WHERE ${U} GROUP BY ${g})`).get(...T).count),y=Math.min(200,Math.max(1,n.limit??50)),S=Math.max(0,n.offset??0),x=o==="day"||o==="month"||o==="year"?"key DESC":"total_cost_brl DESC, key",W=this.database.prepare(`${R} SELECT ${g} AS key, ${g} AS label, ${g} AS period_key, MIN(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')) AS start_day, MAX(date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')) AS end_day, COUNT(*) AS invocation_count, SUM(i.llm_call_count) AS llm_call_count, SUM(i.source_event_count) AS source_event_count, NULL AS total_duration, SUM(i.input_tokens) AS total_input_tokens, SUM(i.cached_input_tokens) AS total_cached_input_tokens, SUM(i.output_tokens) AS total_output_tokens, SUM(i.reasoning_tokens) AS total_reasoning_tokens, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM facts i WHERE ${U} GROUP BY ${g} ORDER BY ${x} LIMIT ? OFFSET ?`).all(...T,y,S);if(s){let ce={from:n.from??null,to:n.to??null,providers:n.provider?[n.provider]:[],models:n.model?[n.model]:[],agents:n.agent?[n.agent]:[],phases:n.phase?[n.phase]:[],statuses:n.status?[n.status]:[]},ee=this.costMonitorFactualDurationByDay(ce),ge=!!(n.origin||n.priority||n.risk||n.workType),L=ge?[]:this.database.prepare(`SELECT day, prd_count, spec_count, task_count, validation_count, evidence_count
1701
+ FROM daily_aggregate_cache WHERE (? IS NULL OR day >= ?) AND (? IS NULL OR day <= ?)`).all(Ht(n.from),Ht(n.from),Ht(n.to),Ht(n.to)),le=new Map;for(let Te of L){let Z=String(Te.day),oe=o==="day"?Z:o==="month"?Z.slice(0,7):Z.slice(0,4),he=le.get(oe)??{prd_count:0,spec_count:0,task_count:0,validation_count:0,evidence_count:0};for(let Re of["prd_count","spec_count","task_count","validation_count","evidence_count"])he[Re]=(he[Re]??0)+Number(Te[Re]??0);le.set(oe,he)}let B=new Map(W.map(Te=>[String(Te.period_key),Te])),me=new Set((n.query?[]:[...new Set([...ee.keys(),...L.map(Te=>String(Te.day))])]).map(Te=>o==="day"?Te:o==="month"?Te.slice(0,7):Te.slice(0,4))),Me=[...new Set([...B.keys(),...me])].sort((Te,Z)=>Z.localeCompare(Te)).map(Te=>{let Z=B.get(Te)??{key:Te,label:Te,period_key:Te,start_day:Te,end_day:Te,invocation_count:0,llm_call_count:null,source_event_count:0,total_tokens:null,total_cost_usd:null,total_cost_brl:null},oe=Re=>o==="day"?Re===Te:Re.startsWith(Te),he=[...ee].filter(([Re])=>oe(Re));return{...Z,...le.get(Te)??(ge?{prd_count:null,spec_count:null,task_count:null,validation_count:null,evidence_count:null}:{prd_count:0,spec_count:0,task_count:0,validation_count:0,evidence_count:0}),total_run_count:Number(Z.invocation_count??0),total_duration:he.length===0||he.some(([,Re])=>Re.eligible_runs!==Re.known_runs)?null:he.reduce((Re,[,Fe])=>Re+Fe.known_sum,0)}});V=Me.length,W=Me.slice(S,S+y);for(let Te of W){let Z=String(Te.period_key),oe=[...ee.keys()].filter(he=>o==="day"?he===Z:he.startsWith(Z));oe.length>0&&(Te.start_day=oe.sort()[0],Te.end_day=oe.sort().at(-1))}}return{data_source:"sqlite_read_model",view:t,offset:S,limit:y,total_count:V,has_more:S+W.length<V,rows:W}}let d={cost_monitor_executions:"execution",cost_monitor_tasks:"task",cost_monitor_specs:"spec",cost_monitor_prds:"prd",cost_monitor_conversations:"conversation"}[t];if(d!==void 0){let g=d==="spec"||d==="prd",b=!!(n.provider||n.model||n.agent||n.phase||n.origin||n.workType||n.priority);if(g&&!b){let L=d==="spec"?"specs":"prds",le=d==="spec"?"spec_id":"prd_id",B=[],me=[],Ie=[],Me=[];n.from&&(B.push("entity.occurred_day_sp >= ?"),me.push(n.from.slice(0,10)),Ie.push("i.occurred_day_sp >= ?"),Me.push(n.from.slice(0,10))),n.to&&(B.push("entity.occurred_day_sp <= ?"),me.push(n.to.slice(0,10)),Ie.push("i.occurred_day_sp <= ?"),Me.push(n.to.slice(0,10))),n.status&&(B.push("entity.status = ?"),me.push(n.status)),n.risk&&(B.push("entity.risk = ?"),me.push(n.risk)),n.query&&(B.push("(entity.id LIKE ? OR COALESCE(entity.title, '') LIKE ?)"),me.push(`%${n.query}%`,`%${n.query}%`));let Te=B.length===0?"1":B.join(" AND "),Z=Ie.length===0?"":` AND ${Ie.join(" AND ")}`,oe=`WITH grouped AS (
1702
+ SELECT entity.id AS group_value, entity.title, entity.status, entity.risk,
1703
+ COALESCE(MIN(i.occurred_day_sp), entity.occurred_day_sp) AS first_day,
1704
+ COALESCE(MAX(i.occurred_day_sp), entity.occurred_day_sp) AS last_day,
1705
+ COALESCE(MAX(i.occurred_at), entity.occurred_at) AS occurred_at,
1706
+ COUNT(i.agent_invocation_id) AS invocation_count,
1707
+ SUM(i.llm_call_count) AS llm_call_count, SUM(i.duration_ms) AS total_duration,
1708
+ SUM(i.input_tokens) AS total_input_tokens,
1709
+ SUM(i.cached_input_tokens) AS total_cached_input_tokens,
1710
+ SUM(i.output_tokens) AS total_output_tokens,
1711
+ SUM(i.reasoning_tokens) AS total_reasoning_tokens,
1712
+ SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd,
1713
+ SUM(i.cost_brl) AS total_cost_brl
1714
+ FROM ${L} entity
1715
+ LEFT JOIN invocations i ON i.${le} = entity.id${Z}
1716
+ WHERE ${Te}
1717
+ GROUP BY entity.id, entity.title, entity.status, entity.risk, entity.occurred_at, entity.occurred_day_sp
1718
+ )`,he=Math.min(200,Math.max(1,n.limit??50)),Re=Math.max(0,n.offset??0),Fe=[...Me,...me],bt=Number(this.database.prepare(`${oe} SELECT COUNT(*) AS count FROM grouped`).get(...Fe).count),St=this.database.prepare(`${oe} SELECT COUNT(*) AS entity_count, COALESCE(SUM(invocation_count), 0) AS invocation_count, ROUND(SUM(total_duration)) AS total_duration, SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl FROM grouped`).get(...Fe),Pt=this.database.prepare(`${oe} SELECT group_value AS id, group_value AS key, title, status, risk, first_day, last_day, occurred_at, invocation_count, llm_call_count, total_duration, total_input_tokens, total_cached_input_tokens, total_output_tokens, total_reasoning_tokens, total_tokens, total_cost_usd, total_cost_brl FROM grouped ORDER BY total_cost_brl DESC, group_value LIMIT ? OFFSET ?`).all(...Fe,he,Re);return{data_source:"sqlite_read_model",view:t,offset:Re,limit:he,total_count:bt,has_more:Re+Pt.length<bt,totals:St,rows:Pt}}if(!!(n.provider||n.model||n.agent||n.phase||n.status||n.origin||n.workType||n.priority||n.risk)){let L={task:"i.task_id",spec:"i.spec_id",prd:"i.prd_id",execution:"i.execution_id",conversation:"i.conversation_id"}[d],le=d==="task"?"tasks":d==="spec"?"specs":d==="prd"?"prds":null,B=[`${L} IS NOT NULL`],me=[];n.from&&(B.push("i.occurred_day_sp >= ?"),me.push(n.from.slice(0,10))),n.to&&(B.push("i.occurred_day_sp <= ?"),me.push(n.to.slice(0,10))),n.agent&&(B.push("i.zaip_agent = ?"),me.push(n.agent)),n.phase&&(B.push("i.phase = ?"),me.push(n.phase)),n.status&&(B.push("i.status = ?"),me.push(n.status)),n.risk&&(B.push("task_entity.risk = ?"),me.push(n.risk)),n.origin&&B.push(n.origin==="prd"?"i.prd_id IS NOT NULL":n.origin==="spec"?"i.prd_id IS NULL AND i.spec_id IS NOT NULL":n.origin==="task"?"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL":"i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL"),(n.workType||n.priority)&&B.push("0");let Ie=[];n.provider&&(n.provider==="unavailable"?B.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_provider WHERE known_provider.agent_invocation_id=i.agent_invocation_id AND known_provider.provider IS NOT NULL AND known_provider.provider <> 'unavailable')"):(Ie.push("u.provider = ?"),me.push(n.provider))),n.model&&(n.model==="unavailable"?B.push("NOT EXISTS (SELECT 1 FROM invocation_usage known_model WHERE known_model.agent_invocation_id=i.agent_invocation_id AND known_model.model IS NOT NULL AND known_model.model <> 'unavailable')"):(Ie.push("u.model = ?"),me.push(n.model))),Ie.length>0&&B.push(`EXISTS (SELECT 1 FROM invocation_usage u WHERE u.agent_invocation_id=i.agent_invocation_id AND ${Ie.join(" AND ")})`),n.query&&(B.push(le===null?`${L} LIKE ?`:`(${L} LIKE ? OR COALESCE(entity.title, '') LIKE ?)`),me.push(`%${n.query}%`,...le===null?[]:[`%${n.query}%`]));let Z=`${le===null?"":`LEFT JOIN ${le} entity ON entity.id=${L}`} LEFT JOIN tasks task_entity ON task_entity.id=i.task_id`,oe=B.join(" AND "),he=le===null?L:`COALESCE(MAX(entity.title), ${L})`,Fe=`WITH grouped AS (SELECT ${L} AS group_value, ${he} AS title, ${le===null?"NULL":"MAX(entity.status)"} AS status, MAX(task_entity.risk) AS risk, MAX(i.occurred_at) AS occurred_at, COUNT(*) AS invocation_count, SUM(i.duration_ms) AS total_duration, SUM(i.total_tokens) AS total_tokens, SUM(i.cost_usd) AS total_cost_usd, SUM(i.cost_brl) AS total_cost_brl FROM invocations i ${Z} WHERE ${oe} GROUP BY ${L})`,bt=Math.min(200,Math.max(1,n.limit??50)),St=Math.max(0,n.offset??0),Pt=Number(this.database.prepare(`${Fe} SELECT COUNT(*) AS count FROM grouped`).get(...me).count),Ii=this.database.prepare(`${Fe} SELECT COUNT(*) AS entity_count, COALESCE(SUM(invocation_count), 0) AS invocation_count, ROUND(SUM(total_duration)) AS total_duration, SUM(total_tokens) AS total_tokens, SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl FROM grouped`).get(...me),yo=this.database.prepare(`${Fe} SELECT group_value AS id, group_value AS key, title, status, risk, occurred_at, invocation_count, total_duration, total_tokens, total_cost_usd, total_cost_brl FROM grouped ORDER BY total_cost_brl DESC, group_value LIMIT ? OFFSET ?`).all(...me,bt,St);return{data_source:"sqlite_read_model",view:t,offset:St,limit:bt,total_count:Pt,has_more:St+yo.length<Pt,totals:Ii,rows:yo}}let R={task:{table:"tasks",title:"entity.title",status:"entity.status",risk:"entity.risk"},spec:{table:"specs",title:"entity.title",status:"entity.status",risk:"entity.risk"},prd:{table:"prds",title:"entity.title",status:"entity.status",risk:"entity.risk"},execution:{table:"executions",title:"grouped.group_value",status:"entity.status",risk:"NULL"},conversation:{table:"conversations",title:"grouped.group_value",status:"entity.status",risk:"NULL"}}[d],U=["group_kind = ?","group_value IS NOT NULL"],V=[d];n.from&&(U.push("day >= ?"),V.push(n.from.slice(0,10))),n.to&&(U.push("day <= ?"),V.push(n.to.slice(0,10))),n.query&&(U.push("group_value LIKE ?"),V.push(`%${n.query}%`));let y=d==="provider"?n.provider:d==="model"?n.model:d==="zaip_agent"?n.agent:void 0;y&&(U.push("group_value = ?"),V.push(y));let S=U.join(" AND "),x=Number(this.database.prepare(`SELECT COUNT(DISTINCT group_value) AS count FROM cost_monitor_group_daily_cache WHERE ${S}`).get(...V).count),W=this.database.prepare(`SELECT COUNT(DISTINCT group_value) AS entity_count,
1719
+ COALESCE(SUM(invocation_count), 0) AS invocation_count,
1720
+ ROUND(SUM(total_duration)) AS total_duration,
1721
+ SUM(total_tokens) AS total_tokens,
1722
+ SUM(total_cost_usd) AS total_cost_usd,
1723
+ SUM(total_cost_brl) AS total_cost_brl
1724
+ FROM cost_monitor_group_daily_cache
1725
+ WHERE ${S}`).get(...V),ce=Math.min(200,Math.max(1,n.limit??50)),ee=Math.max(0,n.offset??0),ge=this.database.prepare(`WITH grouped AS (
1726
+ SELECT group_value, MIN(day) AS first_day, MAX(day) AS last_day,
1727
+ SUM(invocation_count) AS invocation_count,
1728
+ SUM(llm_call_count) AS llm_call_count,
1729
+ SUM(total_duration) AS total_duration,
1730
+ SUM(total_input_tokens) AS total_input_tokens,
1731
+ SUM(total_cached_input_tokens) AS total_cached_input_tokens,
1732
+ SUM(total_output_tokens) AS total_output_tokens,
1733
+ SUM(total_reasoning_tokens) AS total_reasoning_tokens,
1734
+ SUM(total_tokens) AS total_tokens,
1735
+ SUM(total_cost_usd) AS total_cost_usd,
1736
+ SUM(total_cost_brl) AS total_cost_brl
1737
+ FROM cost_monitor_group_daily_cache
1738
+ WHERE ${S}
1739
+ GROUP BY group_value
1740
+ )
1741
+ SELECT grouped.group_value AS id, grouped.group_value AS key,
1742
+ COALESCE(${R.title}, grouped.group_value) AS title,
1743
+ ${R.status} AS status, ${R.risk} AS risk,
1744
+ grouped.first_day, grouped.last_day,
1745
+ grouped.last_day || 'T12:00:00.000Z' AS occurred_at,
1746
+ grouped.invocation_count, grouped.llm_call_count, grouped.total_duration,
1747
+ grouped.total_input_tokens, grouped.total_cached_input_tokens,
1748
+ grouped.total_output_tokens, grouped.total_reasoning_tokens,
1749
+ grouped.total_tokens, grouped.total_cost_usd, grouped.total_cost_brl
1750
+ FROM grouped
1751
+ LEFT JOIN ${R.table} entity ON entity.id = grouped.group_value
1752
+ ORDER BY grouped.total_cost_brl DESC, grouped.group_value
1753
+ LIMIT ? OFFSET ?`).all(...V,ce,ee);return{data_source:"sqlite_read_model",view:t,offset:ee,limit:ce,total_count:x,has_more:ee+ge.length<x,totals:W,rows:ge}}let u=O_[t],_=[],p=[],v=t==="cost_monitor_monthly"||t==="cost_monitor_annual"||t==="operations_monthly"||t==="operations_annual";v&&n.from?(_.push("end_day >= ?"),p.push(n.from.slice(0,10))):u.date!==null&&n.from&&(_.push(`${u.date} >= ?`),p.push(n.from.slice(0,10))),v&&n.to?(_.push("start_day <= ?"),p.push(n.to.slice(0,10))):u.date!==null&&n.to&&(_.push(`${u.date} <= ?`),p.push(n.to.slice(0,10))),n.query&&["cost_monitor_daily","cost_monitor_monthly","cost_monitor_annual","cost_monitor_overview_view","operations_monthly","operations_annual"].includes(t)&&(_.push("period_key LIKE ?"),p.push(`%${n.query}%`)),n.query&&t==="operations_daily"&&(_.push("day LIKE ?"),p.push(`%${n.query}%`)),n.status&&["operations_work_list","operations_work_kanban","operations_executions","operations_conversations","operations_decisions","operations_changes","operations_agent_invocations","first_fold_task","first_fold_spec","first_fold_prd"].includes(t)&&(_.push("status = ?"),p.push(n.status)),n.risk&&["operations_work_list","operations_work_kanban","operations_executions","operations_conversations","operations_decisions","operations_changes","operations_agent_invocations","first_fold_task","first_fold_spec","first_fold_prd"].includes(t)&&(_.push("risk = ?"),p.push(n.risk)),n.query&&["operations_work_list","operations_work_kanban","first_fold_top_tasks","first_fold_task","first_fold_spec","first_fold_prd"].includes(t)&&(_.push("(id LIKE ? OR title LIKE ?)"),p.push(`%${n.query}%`,`%${n.query}%`)),n.query&&t==="operations_executions"&&(_.push("execution_id LIKE ?"),p.push(`%${n.query}%`)),n.query&&t==="operations_conversations"&&(_.push("conversation_id LIKE ?"),p.push(`%${n.query}%`)),n.query&&(t==="operations_decisions"||t==="operations_changes")&&(_.push("id LIKE ?"),p.push(`%${n.query}%`)),t==="operations_agent_invocations"&&(n.query&&(_.push("(agent_invocation_id LIKE ? OR task_id LIKE ? OR execution_id LIKE ?)"),p.push(`%${n.query}%`,`%${n.query}%`,`%${n.query}%`)),n.agent&&(_.push("zaip_agent = ?"),p.push(n.agent)),n.phase&&(_.push("phase = ?"),p.push(n.phase)),n.provider&&(_.push("provider = ?"),p.push(n.provider)),n.model&&(_.push("model = ?"),p.push(n.model)));let f=_.length===0?"":` WHERE ${_.join(" AND ")}`,h=Number(this.database.prepare(`SELECT COUNT(*) AS count FROM ${t}${f}`).get(...p).count),k=Math.min(200,Math.max(1,n.limit??(t.includes("agent_invocations")?100:t==="first_fold_top_tasks"?5:50))),w=Math.max(0,n.offset??0),O=this.database.prepare(`SELECT * FROM ${t}${f} ORDER BY ${u.order} LIMIT ? OFFSET ?`).all(...p,k,w);if(t==="operations_daily"||t==="operations_monthly"||t==="operations_annual"){let g=t!=="operations_daily"&&(n.from||n.to),b=n.from?.slice(0,10)??null,T=n.to?.slice(0,10)??null,I=g?this.database.prepare("SELECT * FROM operations_daily WHERE (? IS NULL OR day >= ?) AND (? IS NULL OR day <= ?)").all(b,b,T,T):[],R=this.executionDurationByDay({from:n.from??null,to:n.to??null});for(let U of O){let V=String(U.day??U.period_key);if(g){let y=I.filter(x=>String(x.day).startsWith(V)),S=y.map(x=>String(x.day)).sort();U.start_day=S[0]??null,U.end_day=S.at(-1)??null;for(let x of["prd_count","spec_count","task_count","validation_count","evidence_count","total_run_count","invocation_count","llm_call_count","total_tokens","total_cost_usd","total_cost_brl"])U[x]=y.reduce((W,ce)=>W+(typeof ce[x]=="number"?Number(ce[x]):0),0)}U.operations_total_duration=[...R].filter(([y])=>t==="operations_daily"?y===V:y.startsWith(V)).reduce((y,[,S])=>y+S,0)}}return{data_source:"sqlite_read_model",view:t,offset:w,limit:k,total_count:h,has_more:w+O.length<h,rows:O}}metadata(){this.metadataValues===null&&(this.metadataValues=new Map(this.database.prepare("SELECT key, value FROM read_model_metadata").all().map(n=>[n.key,n.value])));let t=n=>Number(this.metadataValues?.get(n)??0);return{storage_mode:"sqlite_read_model",db_path:process.env.ZAIP_SQLITE_DB_PATH?"session-specific":b$,source_file_count:t("source_file_count"),excluded_source_count:t("excluded_source_count"),daily_aggregate_count:t("daily_aggregate_count"),activity_count:t("activity_count"),canonical_run_count:t("canonical_run_count"),agent_run_count:t("agent_run_count"),telemetry_summary_count:t("telemetry_summary_count"),unassisted_activity_count:t("unassisted_activity_count")}}};function wK(e,t){return encodeURIComponent(JSON.stringify([e,t]))}function EK(e){if(e===null)return null;try{let t=JSON.parse(decodeURIComponent(e));return Array.isArray(t)&&typeof t[0]=="string"&&typeof t[1]=="string"?[t[0],t[1]]:null}catch{return null}}function T$(e){return e.map(t=>({task_id:t.task_id,duration_ms:t.total_duration_ms,total_tokens:t.total_tokens,total_cost_usd:t.total_cost_usd,cost_brl:t.total_cost_brl,run_count:t.total_run_count}))}var Ae="/api/v2",Hh="127.0.0.1",sc="zaip-dashboard-sqlite-runtime",k$="zaip-dashboard-sqlite-session",AK=".agents/dashboard/work-priority.json",w$=5e3,TK={"agent-orchestrator":"1 - Dave - Product Owner.png","agent-builder":"2 - Rafa - Tech Lead.png","agent-task-executor":"3 - Leo - Software Engineer.png","agent-analyst":"4 - Bia - Product Manager.png","agent-finalizer":"5 - Gui - Quality Assurance Lead.png","agent-reviewer":"6 - Nanda - Principal Engineer.png","agent-integrator":"7 - Dani - Integration Engineer.png","agent-auditor":"8 - Ana - Quality Auditor.png","agent-text-summarizer":"9 - Lia - Technical Writer.png","agent-data-analyst":"10 - Gabi - Data Analyst.png","agent-refactoring-specialist":"11 - Tati - Refactoring Specialist.png","agent-frontend":"12 - Doug - Frontend Developer.png","agent-backend":"13 - Will - Backend Developer.png","agent-website-developer":"14 - Jonny - Website Developer.png","agent-designer":"15 - Manu - Product Designer.png","agent-cloud-engineer":"16 - Dan - Cloud Engineer.png","agent-security-auditor":"17 - Luis - Security Auditor.png","agent-marketing-analyst":"18 - Lucia - Marketing Analyst.png"};function xK(e){let t=new Set(["prd","spec","change","task","execution"]),n=new Set(["active","executing","verifying","running","paused"]);return e.filter(i=>t.has(i.kind)&&(n.has(i.status??"")||i.kind==="task"&&i.status==="planned")).map(i=>i.id).sort()}var en=class extends Error{name="V2WorkspaceRequiredError"};function x$(e){try{let t=new URL(e);return t.protocol==="http:"&&(t.hostname===Hh||t.hostname==="localhost")}catch{return!1}}function OK(e){try{let t=decodeURIComponent(e).replaceAll("\\","/");return!t.includes("\0")&&!t.split("/").some(n=>n==="..")}catch{return!1}}function O$(){return process.env.ZAIP_UI_TOKEN??(0,cc.randomBytes)(24).toString("base64url")}function RK(e){if(e.req.method!=="GET"&&e.req.method!=="HEAD"||e.req.path!=="/"&&e.req.path!=="/index.html")return!1;let t=e.req.header("origin");return t!==void 0&&!x$(t)?!1:e.req.header("sec-fetch-site")!=="cross-site"}async function $_(e){let t=await mA(e);if(t.version===1)throw new en("Dashboard API requires a modern ZAIP-AIOS workspace");return t}function be(e,t,n=200,i=!1){if(i){let r=`"${(0,cc.createHash)("sha256").update(JSON.stringify(t)).digest("base64url")}"`;if(e.header("ETag",r),e.header("Cache-Control","private, no-cache"),e.req.header("if-none-match")===r)return e.body(null,304)}return e.req.method==="HEAD"?e.body(null,n):e.json(t,n)}async function va(e,t,n,i={}){let r=e instanceof Et?$K(e,t,n,i):await Hs(e,t,n,i);if(!(e instanceof Et))return r;let o=e.firstFoldMonthlyQuick(n),a=n.from===null&&n.to===null?e.firstFoldViewportAllTime().aggregate:o?.aggregate??e.firstFoldAggregate(n);return{...r,summary:{...r.summary,run_count:a.total_run_count,overview_metrics:{...r.summary.overview_metrics,duration_ms:a.duration_ms,tokens:a.total_tokens,cost_brl:a.cost_brl,execution_day_count:a.execution_day_count,data_source:"run_records"}}}}function $K(e,t,n,i){let r=e.firstFoldMonthlyQuick(n),o=n.from===null&&n.to===null&&i.includeExtended===!0?e.firstFoldAllTime():null,a=o??(n.from===null&&n.to===null?e.firstFoldViewportAllTime():null),s=y=>r?.pages[y]??e.summaryPage(y,n,0,1e4).rows,l=a===null||i.includeBoardTasks===!0,c=l?s("task"):[],d=l?s("spec"):[],u=l?s("prd"):[],_=a?.aggregate??r?.aggregate??e.firstFoldAggregate(n),p=a?.aggregate.task_count??c.length,v=n.from===null&&n.to===null&&(o!==null||i.includeTopTasks===!0)?o?.top_tasks??e.firstFoldTopTasksAllTime():null,f=v===null?(r?.top_tasks??e.topTasks(n)).map(y=>({task_id:y.task_id,duration_ms:y.duration_ms,total_tokens:y.total_tokens,cost_brl:y.cost_brl,run_count:y.run_count})):T$(v),h=o===null?void 0:Object.fromEntries(["specs","prds"].map(y=>{let S=o.macro_metrics[y];return[y,{status_counts:S.status_counts,classification_counts:S.classification_counts,entity_count:S.entity_count,total_run_count:S.total_run_count,total_duration_ms:S.total_duration_ms,total_tokens:S.total_tokens,total_cost_usd:S.total_cost_usd,total_cost_brl:S.total_cost_brl,average_duration_ms:S.average_duration_ms,average_tokens:S.average_tokens,average_cost_usd:S.average_cost_usd,average_cost_brl:S.average_cost_brl,latest_created_at:S.latest_created_at,top_entities:S.top_entities.map(x=>({entity_id:x.entity_id,title:x.title,duration_ms:x.total_duration_ms,total_tokens:x.total_tokens,total_cost_usd:x.total_cost_usd,cost_brl:x.total_cost_brl,run_count:x.total_run_count,duration_share:x.duration_share}))}]})),k=a?.task_status_counts??{},w=a?.task_risk_counts??{};if(a===null)for(let y of c){let S=typeof y.status=="string"?y.status:"draft",x=typeof y.risk=="string"?y.risk:"standard";k[S]=(k[S]??0)+1,w[x]=(w[x]??0)+1}let O=a?.aggregate.latest_task_created_at??[...c,...d,...u].map(y=>typeof y.occurred_at=="string"?y.occurred_at:null).filter(y=>y!==null).sort().at(-1)??null,g={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}},b={...g,tokens:{...g.tokens,total:_.total_tokens},cost:{...g.cost,brl:_.cost_brl}},T={conversation:g,planning:g,execution:g,total:b,new_work:g,rework:g},I=i.includePeriods===!0?e.dailyPeriods(n):{},R=Object.values(I).some(y=>y.usage.total_tokens.unknown>0||y.usage.cost.unknown>0),U=y=>({schema_version:2,id:String(y.id),revision:1,change_id:"",title:String(y.title??y.id),short_name:String(y.title??y.id),objective:"",status:CK(y.status),attempt_count:null,risk:IK(y.risk),priority:"medium",owner:null,requirement_ids:[],acceptance_ids:[],depends_on:[],write_scopes:[],created_at:String(y.occurred_at),updated_at:String(y.occurred_at),started_at:null,finished_at:null,result:null,artifact_path:".agents/records",progress:0,spec_id:null,execution_started:!1,telemetry:{duration_ms:ho(y.total_duration),tokens:ho(y.total_tokens),cost_brl:ho(y.total_cost_brl)}}),V=(y,S)=>{let x={...g,tokens:{...g.tokens,total:ho(y.total_tokens)},cost:{...g.cost,brl:ho(y.total_cost_brl)}};return{id:String(y.id),title:String(y.title??y.id),created_at:String(y.occurred_at),updated_at:String(y.occurred_at),kind:S,parent_id:null,artifact_path:".agents/records",lifecycle_status:String(y.status??"draft"),work_status:NK(y.status),execution_ids:[],task_ids:[],planned_tasks:[],canonical_run_ids:[],run_ids:[],root_execution_run_ids:[],execution_count:0,task_count:0,run_count:ho(y.invocation_count)??0,duration_ms:ho(y.total_duration),decisions:{human:0,agent:0},rework_run_count:0,quality:{completed_tasks:0,task_completion_rate:0,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},usage:{conversation:g,planning:g,execution:g,total:x,new_work:g,rework:g}}};return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",filters:n,summary:{prd_count:a?.aggregate.prd_count??u.length,spec_count:a?.aggregate.spec_count??d.length,execution_count:0,task_count:p,run_count:_.total_run_count,overview_metrics:{duration_ms:_.duration_ms,execution_day_count:_.execution_day_count,tokens:_.total_tokens,cost_brl:_.cost_brl,prd_count:a?.aggregate.prd_count??u.length,spec_count:a?.aggregate.spec_count??d.length,selected_counts:{prds:a?.aggregate.prd_count??u.length,specs:a?.aggregate.spec_count??d.length},task_count:p,completed_prd_count:a?.aggregate.completed_prd_count??u.filter(y=>y.status==="completed").length,completed_spec_count:a?.aggregate.completed_spec_count??d.filter(y=>y.status==="completed").length,completed_task_count:a?.aggregate.completed_task_count??k.completed??0,task_status_counts:k,task_risk_counts:w,top_tasks:f,...h===void 0?{}:{macro_metrics:h},latest_task_created_at:O,coverage:{duration:1,tokens:R?0:1,cost:R?0:1},data_source:"run_records",partial:!0},decisions:{human:0,agent:0},source_latest_at:O,quality:{completed_tasks:k.completed??0,task_completion_rate:p===0?0:(a?.aggregate.completed_task_count??k.completed??0)/p,terminal_runs:0,successful_runs:0,terminal_success_rate:0,rework_rate:0},reconciliation:{phase_tokens_match_total:!0,phase_usd_match_total:!0,phase_brl_match_total:!0,origin_tokens_match_total:!0},usage:T,periods:{daily:i.includePeriods===!0?I:{}}},origins:{conversation:T,task:T,spec:T,prd:T},prds:u.map(y=>V(y,"prd")),specs:d.map(y=>V(y,"spec")),tasks:i.includeBoardTasks?c.map(U):[],changes:[],executions:[],runs:[],decisions:[],evidences:[],validations:[]}}function ho(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function CK(e){return["draft","planned","executing","verifying","completed","failed","blocked","cancelled"].includes(String(e))?String(e):"draft"}function IK(e){return["lite","standard","critical"].includes(String(e))?String(e):"standard"}function NK(e){let t=String(e);return["executing","verifying","completed","blocked","failed","cancelled"].includes(t)?t:"planning"}async function R$(e,t={from:null,to:null}){if(e instanceof Et)return e.costMonitorSummaryAggregate(t);let n=await new Ut(e).readDailyReadModels("overview");if(n===null)throw new Error("Lifecycle daily overview is not initialized");return{periods:{daily:Object.fromEntries(Object.entries(n.days).map(([i,r])=>[i,r.overview]))}}}function PK(e,t,n){let r=e.canonicalTraceFiles([n]).find(h=>h.path.includes("/.agents/records/tasks/")||h.path.includes(".agents/records/tasks/"));if(r===void 0)throw new Error(`Canonical Task ${n} was not found`);let o=h=>{let k=/^---\r?\n([\s\S]*?)\r?\n---/.exec(r.content)?.[1]??"",w=new RegExp(`^${h}:\\s*(.+?)\\s*$`,"m").exec(k)?.[1]?.trim();return w===void 0||w==="null"?null:w.replace(/^['"]|['"]$/g,"")},a=(h,k)=>o(h)??new RegExp(`\\b${k}[A-Z0-9-]+`).exec(r.content)?.[0]??null,s=a("change_id","CHG-")??n,l=a("spec_id","SPEC-"),c=a("prd_id","PRD-"),d=[n,s,l,c].filter(h=>h!==null),u=e.canonicalTraceFiles(d).filter(h=>/\.(?:md|json|jsonl|txt|log)$/i.test(h.path)&&h.content.length<=25e4).map(h=>{let k=gh(h.path),w=a_(h.content);return{id:(0,cc.createHash)("sha256").update(h.path).digest("hex").slice(0,16),path:h.path,title:h.content.match(/^#\s+(.+)$/m)?.[1]?.trim()??h.path.split("/").at(-1)??h.path,...k,content:h.content,...w}}),_=mh(u),p=new Set(u.map(h=>h.stage)),v=o("risk"),f=o("status");return{schema_version:2,layout_version:t.version,readonly:!0,source:".agents/records",task_id:n,task_title:o("title")??r.content.match(/^#\s+(.+)$/m)?.[1]?.trim()??n,task_risk:v==="lite"||v==="standard"||v==="critical"?v:null,task_created_at:o("created_at"),task_progress:f==="completed"?100:f==="verifying"?80:f==="executing"?50:f==="blocked"||f==="failed"||f==="cancelled"?0:10,spec_id:l,prd_id:c,change_id:s,usage:e.taskTraceUsage(n),documents:u,stages:_,coverage:{stages_with_documents:p.size,stages_with_timestamps:_.filter(h=>h.status==="recorded").length,total_stages:6,evidence_count:u.filter(h=>h.kind==="evidence").length,test_count:u.filter(h=>h.kind==="test").length}}}function Kh(e=process.env.ZAIP_WORKSPACE??process.cwd(),t=O$(),n=(0,Bh.resolve)(process.env.ZAIP_UI_ROOT??"./dist"),i={}){let r=new Oh,o=i.filesystem??new mi(e),a=o instanceof Et,s=a?$_(o):null,l=()=>s??$_(o),c=i.snapshotReadOnly??a,d=i.snapshotState??"current",u=i.canonicalFilesystem??new mi(e),_=i.reconcileOpenWork??h$,p=i.refreshReadModel??(async()=>{a&&await o.rebuildAndRefresh(()=>ac(e,{forceCanonical:!0}))}),v=T_(e),f=i.syncAgentAdapters??(()=>$R(e)),h=Promise.resolve(),k=new Map,w=new Map,O=new Map,g=new Map,b=async(y,S,x=!1)=>{let W=O.get(y);if(!x&&W!==void 0&&(y.startsWith("operations:board:")||Date.now()-W.cachedAt<w$))return W.payload;let ce=g.get(y);if(ce!==void 0)return x?(await ce,b(y,S,!0)):ce;let ee=S().then(ge=>(O.set(y,{payload:ge,cachedAt:Date.now()}),ge)).finally(()=>g.delete(y));return g.set(y,ee),ee},T=y=>{let{from:S,to:x}=Nt(y);return`${Gr(y)}:${S??""}:${x??""}`},I=()=>{w.clear(),O.clear(),g.clear()},R=null,U=async()=>(R!==null||(R=p().then(()=>I()).finally(()=>{R=null})),R),V=y=>{let S=T(y),x=w.get(S);if(x!==void 0&&Date.now()-x.cachedAt<w$)return y.header("X-ZAIP-Snapshot-Cache","hit"),Promise.resolve(x.snapshot);let W=k.get(S);if(W!==void 0)return y.header("X-ZAIP-Snapshot-Cache","inflight"),W;y.header("X-ZAIP-Snapshot-Cache","miss");let ce=l().then(ee=>MK(o,e,y,ee)).then(ee=>(w.set(S,{snapshot:ee,cachedAt:Date.now()}),ee)).finally(()=>{k.delete(S)});return k.set(S,ce),ce};return r.use("*",async(y,S)=>(y.header("Cache-Control","no-store"),y.header("X-Content-Type-Options","nosniff"),y.header("Referrer-Policy","no-referrer"),y.header("Content-Security-Policy","default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; object-src 'none'; frame-ancestors 'none'"),RK(y)&&AR(y,k$,t,{httpOnly:!0,path:"/",sameSite:"Strict"}),S())),r.use(`${Ae}/*`,async(y,S)=>{let x=y.req.method==="PUT"&&(y.req.path===`${Ae}/work-priority`||y.req.path===`${Ae}/project-settings`||!c&&(y.req.path===`${Ae}/pricing`||y.req.path===`${Ae}/fx-rate`||y.req.path===`${Ae}/agent-catalog`)),W=y.req.method==="POST"&&y.req.path===`${Ae}/reconcile-open-work`,ce=y.req.method==="POST"&&y.req.path===`${Ae}/refresh-projection`;if(y.req.method!=="GET"&&y.req.method!=="HEAD"&&!x&&!W&&!ce)return y.header("Allow",y.req.path===`${Ae}/pricing`||y.req.path===`${Ae}/fx-rate`||y.req.path===`${Ae}/agent-catalog`||y.req.path===`${Ae}/project-settings`||y.req.path===`${Ae}/work-priority`?"GET, HEAD, PUT":y.req.path===`${Ae}/reconcile-open-work`||y.req.path===`${Ae}/refresh-projection`?"POST":"GET, HEAD"),y.json({error:"Dashboard API is read-only"},405);if(y.req.path===`${Ae}/health`||y.req.path===`${Ae}/ready`)return S();let ee=y.req.header("origin");if(ee!==void 0&&!x$(ee))return y.json({error:"Origin rejected"},403);let ge=y.req.header("x-zaip-session"),L=ER(y,k$),le=y.req.method==="GET"&&y.req.path.startsWith(`${Ae}/agent-catalog-assets/`)?y.req.query("token"):void 0;return ge!==t&&L!==t&&le!==t?y.json({error:"Invalid local session"},401):S()}),r.on(["GET","HEAD"],`${Ae}/health`,async y=>{try{let S=await l();return be(y,{kind:sc,workspaceKey:v,service:"zaip-aios-dashboard",status:"ok",api_version:2,workspace_layout:S.version,read_only:!0,storage:a?o.metadata():{storage_mode:"filesystem"},snapshot_state:d})}catch(S){return be(y,{kind:sc,workspaceKey:v,service:"zaip-aios-dashboard",status:"unavailable",api_version:2,read_only:!0,error:S instanceof Error?S.message:String(S)},503)}}),r.on(["GET","HEAD"],`${Ae}/ready`,async y=>{try{let S=await l();if(a){let W=o.metadata();return be(y,{kind:sc,workspaceKey:v,status:"ready",workspace_layout:S.version,storage_mode:W.storage_mode,activity_count:W.activity_count,day_count:W.daily_aggregate_count,snapshot_state:d})}let x=await va(o,S,{from:null,to:null});return be(y,{kind:sc,workspaceKey:v,status:"ready",source_latest_at:x.summary.source_latest_at})}catch(S){return be(y,{kind:sc,workspaceKey:v,status:"unavailable",error:S instanceof Error?S.message:String(S)},503)}}),r.on(["GET","HEAD"],`${Ae}/operations`,async y=>{try{let S=performance.now(),x=y.req.query("scope");if(x!=="overview"&&x!=="quick"&&x!=="detail"&&x!=="board"&&x!=="classification")return be(y,(await V(y)).operations);let W=await l(),ce=performance.now()-S,{from:ee,to:ge}=Nt(y);if(x==="board"){let le=FR(y.req.query("stage")),B=Math.max(0,Number.parseInt(y.req.query("offset")??"0",10)||0),me=Math.min(50,Math.max(1,Number.parseInt(y.req.query("limit")??"10",10)||10)),Ie=await b(`operations:board:${ee??""}:${ge??""}`,async()=>{let oe=await va(o,W,{from:ee,to:ge},{includeBoardTasks:!0});return{projection:oe,priority:await w_(u,E_(oe))}}),Me=zR(y),Te=JSON.stringify({from:ee,to:ge,stage:le,offset:B,limit:me,...Me}),Z=await b(`operations:board-page:${Te}`,async()=>qR(Ie.projection,le,B,me,Ie.priority.item_ids,Me));return be(y,Z,200,!0)}if(x==="classification"){let le=y.req.query("kind"),B=y.req.query("classification");if(le!=="task"&&le!=="spec"&&le!=="prd")return be(y,{error:"A valid work kind is required"},400);if(!["lite","standard","critical","empty","structured","rework"].includes(B??""))return be(y,{error:"A valid classification is required"},400);let me=Math.max(0,Number.parseInt(y.req.query("offset")??"0",10)||0),Ie=Math.min(50,Math.max(1,Number.parseInt(y.req.query("limit")??"50",10)||50)),Me=await b(`operations:classification:${ee??""}:${ge??""}`,()=>va(o,W,{from:ee,to:ge},{includeBoardTasks:!0}));return be(y,VR(Me,le,B,me,Ie),200,!0)}if(x==="quick"){let le=performance.now(),B=await b(`operations:quick:${ee??""}:${ge??""}`,()=>va(o,W,{from:ee,to:ge},{includeTopTasks:ee===null&&ge===null}),y.req.query("fresh")==="1");if(process.env.ZAIP_DASHBOARD_PROFILE_FIRST_FOLD==="1"&&o instanceof Et){let me=o.firstFoldViewportProfile();y.header("Server-Timing",[`layout;dur=${Math.round(ce*10)/10}`,`projection;dur=${Math.round((performance.now()-le)*10)/10}`,...Object.entries(me).map(([Ie,Me])=>`${Ie};dur=${Me}`)].join(", "))}return be(y,B,200,!0)}let L=o instanceof Et?await va(o,W,{from:ee,to:ge},{includeBoardTasks:x==="detail",includeExtended:x==="detail"||x==="overview",includePeriods:x==="detail"||x==="overview"}):await k_(o,W,{from:ee,to:ge},x==="overview");return be(y,L,200,x==="overview")}catch(S){if(S instanceof en)throw S;return be(y,{error:S instanceof Error?S.message:String(S)},400)}}),i$(r,o,b,be),r.on(["GET","HEAD"],`${Ae}/sqlite-read-models`,async y=>{if(!(o instanceof Et))return be(y,{error:"SQLite read model is not active"},409);let S=y.req.query("kind"),x=Math.max(0,Number.parseInt(y.req.query("offset")??"0",10)||0),W=Math.min(200,Math.max(1,Number.parseInt(y.req.query("limit")??"20",10)||20));if(S==="overview"){let L=y.req.query("period");return L!=="day"&&L!=="month"&&L!=="year"?be(y,{error:"Unsupported SQLite overview period"},400):be(y,o.overviewPage(L,x,W),200,!0)}if(S!=="task"&&S!=="spec"&&S!=="prd")return be(y,{error:"Unsupported SQLite read model"},400);let{from:ce,to:ee}=Nt(y),ge=mo(y);return be(y,o.summaryPage(S,{from:ce,to:ee,...ge},x,W,y.req.query("cursor")??null),200,!0)}),r.on(["GET","HEAD"],`${Ae}/sqlite-views`,async y=>{if(!(o instanceof Et))return be(y,{error:"SQLite read model is not active"},409);let S=y.req.query("view");if(S===void 0||!(S in O_))return be(y,{error:"Unsupported SQLite view"},400);let x=Number.parseInt(y.req.query("limit")??"",10),W=S.includes("agent_invocations")?100:S==="first_fold_top_tasks"?5:50,ce=Math.min(200,Math.max(1,Number.isFinite(x)?x:W)),{from:ee,to:ge}=Nt(y),L=le=>{let B=y.req.query(le);return B===void 0?{}:{[le]:B}};return be(y,o.viewPage(S,{from:ee,to:ge,...L("query"),...L("status"),...L("risk"),...L("provider"),...L("model"),...L("agent"),...L("phase"),...L("origin"),...L("workType"),...L("priority"),offset:Math.max(0,Number.parseInt(y.req.query("offset")??"0",10)||0),limit:ce}),200,!0)}),r.on(["GET","HEAD"],`${Ae}/work-priority`,async y=>{let S=await $_(u),x=await Ks(u,S,{from:null,to:null});return be(y,await w_(u,E_(x)))}),r.on(["GET","HEAD"],`${Ae}/operations/entities`,async y=>{let S=Math.max(0,Number.parseInt(y.req.query("offset")??"0",10)||0),x=Math.min(500,Math.max(1,Number.parseInt(y.req.query("limit")??"100",10)||100)),W=y.req.query("kind");if(W!=="changes"&&W!=="decisions")return be(y,{error:"Unsupported Operations entity page"},400);let{from:ce,to:ee}=Nt(y),ge=mo(y),L=await b(`operations:entities:${W}:${ce??""}:${ee??""}:${S}:${x}:${ge.query}:${ge.status}:${ge.risk}`,async()=>{let le=await l(),B=await new Ut(o).readEntities(W==="changes"?"change":"decision"),me=W==="changes"?GR(B,le,ce,ee):XR(B,le,ce,ee),Ie=QR(me,ge);return{data_source:"lifecycle_manifest_shards",kind:W,offset:S,limit:x,total:Ie.length,rows:Ie.slice(S,S+x)}});return be(y,L,200,!0)}),r$(r,o,b,be),r.put(`${Ae}/work-priority`,async y=>{let S=jh(await y.req.json());return await u.writeTextAtomic(AK,`${JSON.stringify(S,null,2)}
1754
+ `),I(),y.json(S)}),r.on(["GET","HEAD"],`${Ae}/snapshot`,async y=>{try{return be(y,await V(y))}catch(S){if(S instanceof en)throw S;return be(y,{error:S instanceof Error?S.message:String(S)},400)}}),r.post(`${Ae}/reconcile-open-work`,async y=>{try{await l();let S=await _(u,e);return await U(),y.json({...await V(y),reconciliation:S})}catch(S){if(S instanceof en)throw S;return y.json({error:S instanceof Error?S.message:String(S)},400)}}),r.post(`${Ae}/refresh-projection`,async y=>{try{return await l(),await U(),y.json(await V(y))}catch(S){if(S instanceof en)throw S;return y.json({error:S instanceof Error?S.message:String(S)},400)}}),r.on(["GET","HEAD"],`${Ae}/cost-monitor`,async y=>{try{let S=y.req.query("scope")??"summary";if(S==="summary"){let ge=await l(),{from:L,to:le}=Nt(y),B=Gr(y),me=performance.now(),[Ie,Me]=await Promise.all([R$(o,{from:L,to:le,providers:lt(y,"provider"),models:lt(y,"model"),agents:lt(y,"agent"),phases:lt(y,"phase"),statuses:lt(y,"status"),tasks:lt(y,"task"),specs:lt(y,"spec"),prds:lt(y,"prd"),executions:lt(y,"execution"),changes:lt(y,"change")}),B==="BRL"?Dh(o):Promise.resolve(null)]),Te=performance.now()-me,Z={schema_version:1,layout_version:ge.version,readonly:!0,source:".agents/records",filters:{from:L,to:le},summary:{task_count:Ie.task_count??0},prds:[],specs:[],runs:[]},oe=performance.now(),he=ph(Ie,Z,B,Me?.rate??null);return y.header("Server-Timing",`cost_sql;dur=${Te.toFixed(1)},cost_projection;dur=${(performance.now()-oe).toFixed(1)}`),be(y,he,200,!0)}if(S==="runs"){let ge=await l(),{from:L,to:le}=Nt(y),B=Math.max(0,Number.parseInt(y.req.query("offset")??"0",10)||0),me=Math.min(500,Math.max(1,Number.parseInt(y.req.query("limit")??"100",10)||100));return be(y,await l$(o,ge,y,{from:L,to:le},B,me),200,!0)}if(u$(y))return be(y,(await V(y)).costs);let x=await l(),{from:W,to:ce}=Nt(y),ee=await k_(o,x,{from:W,to:ce});return be(y,await s$(o,ee,y))}catch(S){if(S instanceof en)throw S;return be(y,{error:S instanceof Error?S.message:String(S)},400)}}),r.on(["GET","HEAD"],`${Ae}/pricing`,async y=>be(y,Ki.parse(JSON.parse(await o.readText(".agents/config/pricing/models.json"))))),r.put(`${Ae}/pricing`,async y=>{let S=Ki.parse({...await y.req.json(),updated_at:new Date().toISOString()});return await o.writeTextAtomic(".agents/config/pricing/models.json",`${JSON.stringify(S,null,2)}
1755
+ `),I(),y.json(S)}),r.on(["GET","HEAD"],`${Ae}/fx-rate`,async y=>{let S=await new hi(o).readLatestFxRate();return be(y,S)}),r.put(`${Ae}/fx-rate`,async y=>{let S=Ji.pick({rate:!0}).parse(await y.req.json()),x=await new hi(o).writeCurrentFxRate(S.rate);return I(),y.json(x)}),r.on(["GET","HEAD"],`${Ae}/agent-catalog`,async y=>{try{return be(y,await NR(o))}catch(S){return be(y,{error:S instanceof Error?S.message:String(S)},400)}}),r.get(`${Ae}/agent-catalog-assets/:agentId`,async y=>{let S=TK[y.req.param("agentId")];if(S===void 0)return y.json({error:"Agent portrait not found"},404);try{return y.body(await(0,A$.readFile)((0,Bh.resolve)(e,".agents/config/src",S)),200,{"cache-control":"no-store","content-type":"image/png"})}catch(x){return x.code==="ENOENT"?y.json({error:"Agent portrait not found"},404):y.json({error:"Agent portrait could not be read"},500)}}),r.put(`${Ae}/agent-catalog`,async y=>{let S=async()=>{try{let W=await PR(o,await y.req.json(),f);return I(),y.json(W)}catch(W){return W instanceof Ft?y.json({error:W.message},W.status):y.json({error:"Agent catalog update failed"},500)}},x=h.then(S,S);return h=x.then(()=>{},()=>{}),x}),r.on(["GET","HEAD"],`${Ae}/project-settings`,async y=>{try{return be(y,await jR(u))}catch(S){return be(y,{error:S instanceof Error?S.message:String(S)},400)}}),r.on(["GET","HEAD"],`${Ae}/project-settings/overview`,async y=>be(y,await DR(u))),r.put(`${Ae}/project-settings`,async y=>{try{let S=await UR(u,await y.req.json());return I(),y.json(S)}catch(S){return y.json({error:S instanceof Error?S.message:"Project settings update failed"},400)}}),r.on(["GET","HEAD"],`${Ae}/tasks/:id`,async y=>{try{let S=await l();return be(y,await ih(o,S,y.req.param("id")))}catch(S){if(S instanceof en)throw S;return be(y,{error:"Task not found"},404)}}),r.on(["GET","HEAD"],`${Ae}/prds/:id`,async y=>{try{let S=await l();return be(y,await oh(o,S,y.req.param("id")))}catch(S){if(S instanceof en)throw S;return be(y,{error:"PRD not found"},404)}}),r.on(["GET","HEAD"],`${Ae}/specs/:id`,async y=>{try{let S=await l();return be(y,await ah(o,S,y.req.param("id")))}catch(S){if(S instanceof en)throw S;return be(y,{error:"SPEC not found"},404)}}),r.on(["GET","HEAD"],`${Ae}/tasks/:id/trace`,async y=>{try{let S=await l(),x=y.req.param("id");return be(y,o instanceof Et?PK(o,S,x):await GO(o,S,x))}catch(S){if(S instanceof en)throw S;return be(y,{error:"Task trace not found"},404)}}),r.onError((y,S)=>{let x=y instanceof en?409:500;return be(S,{error:x===409?y.message:"Dashboard projection failed"},x)}),r.all(`${Ae}/*`,y=>be(y,{error:"Not found"},404)),r.on(["GET","HEAD"],"/",Sc({path:`${n}/index.html`})),r.use("/*",async(y,S)=>OK(y.req.path)?S():y.json({error:"Invalid dashboard asset path"},400)),r.use("/*",Sc({root:n})),r.on(["GET","HEAD"],"/*",Sc({path:`${n}/index.html`})),r}async function MK(e,t,n,i){let r=i??await $_(e),{from:o,to:a}=Nt(n),s=Gr(n),l=e instanceof Et?await va(e,r,{from:o,to:a}):await k_(e,r,{from:o,to:a}),c=e instanceof Et?ph(await R$(e,{from:o,to:a}),l,s,s==="BRL"?(await Dh(e))?.rate??null:null):await ha(e,l,s);return{operations:l,costs:c,dashboard:await g$(e,t),projection:{source_latest_at:l.summary.source_latest_at,served_at:new Date().toISOString()}}}var LK=performance.now(),$$=O$(),C_=process.env.ZAIP_WORKSPACE??process.cwd(),E$;function Jh(){return E$??=Kh(C_,$$),E$}var jK=new Proxy({},{get(e,t){let n=Reflect.get(Jh(),t);return typeof n=="function"?n.bind(Jh()):n}});function R_(e){process.stderr.write(`${JSON.stringify({event:"dashboard_sqlite_startup_phase",phase:e,elapsed_ms:Math.round(performance.now()-LK)})}
1756
+ `)}async function DK(){let e=Number.parseInt(process.env.ZAIP_SERVER_PORT??"4317",10);R_("main_entered");let t=performance.now(),n=await ac(C_);process.stderr.write(`${JSON.stringify({event:"dashboard_sqlite_read_model",elapsed_ms:Math.round(performance.now()-t),cache:n.cache,fingerprint_ms:n.fingerprint_ms,materialize_ms:n.materialize_ms,source_files:n.files})}
1757
+ `),R_("read_model_ready");let i=Kh(C_,$$,void 0,{filesystem:new Et(C_),snapshotState:n.cache==="stale_seed"?"updating":"current"});R_("runtime_app_ready"),Ay({fetch:i.fetch,hostname:Hh,port:e},({port:r})=>{R_("listening"),process.stdout.write(`ZAIP-AIOS dashboard API: http://${Hh}:${r}${Ae}/health
1758
+ `)})}(process.argv[1]?.endsWith("server.cjs")||process.argv[1]?.endsWith("server.js")||process.argv[1]?.endsWith("server.mjs"))&&DK();0&&(module.exports={SqliteReadModelFileSystem,app,createDashboardApp,dashboardWorkspaceKey,defaultDashboardApp,githubRepositoryFromRemote,manifestRun,mergeManifestRuns,openWorkIds,projectAllTimeTopTasks,projectionPeriodFilter,rebuildSqliteReadModel,reconciliationResult,validateSqliteReadModelSchema});
1759
+ //# sourceMappingURL=server.cjs.map