@hotmeshio/long-tail 0.19.1 → 0.20.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 (244) hide show
  1. package/build/api/workflows/config.d.ts +3 -0
  2. package/build/api/workflows/config.js +15 -0
  3. package/build/api/workflows/index.d.ts +1 -0
  4. package/build/api/workflows/index.js +3 -1
  5. package/build/api/workflows/input-lookups.d.ts +16 -0
  6. package/build/api/workflows/input-lookups.js +69 -0
  7. package/build/api/workflows/input-validation.d.ts +4 -3
  8. package/build/api/workflows/input-validation.js +7 -4
  9. package/build/api/workflows/invocable.js +1 -0
  10. package/build/api/workflows/invocation.js +1 -1
  11. package/build/lib/db/schemas/035_workflow_input_lookups.sql +9 -0
  12. package/build/routes/workflows/config.js +10 -0
  13. package/build/services/config/cache.js +1 -0
  14. package/build/services/config/read.js +2 -0
  15. package/build/services/config/sql.d.ts +2 -2
  16. package/build/services/config/sql.js +6 -5
  17. package/build/services/config/write.js +10 -1
  18. package/build/services/knowledge/index.d.ts +1 -0
  19. package/build/services/knowledge/index.js +1 -0
  20. package/build/services/knowledge/lookup-refs.d.ts +7 -0
  21. package/build/services/knowledge/lookup-refs.js +26 -0
  22. package/build/services/mcp/db-server/schemas.d.ts +2 -2
  23. package/build/shared/form-validation/field-validator.d.ts +1 -0
  24. package/build/shared/form-validation/field-validator.js +94 -6
  25. package/build/shared/form-validation/invoke-context.d.ts +4 -3
  26. package/build/shared/form-validation/invoke-context.js +5 -4
  27. package/build/shared/form-validation/x-lt-options.d.ts +3 -3
  28. package/build/shared/form-validation/x-lt-options.js +19 -5
  29. package/build/shared/form-validation/x-lt-show-if.d.ts +5 -0
  30. package/build/shared/form-validation/x-lt-show-if.js +10 -0
  31. package/build/start/workers.js +10 -0
  32. package/build/system/mcp-servers/admin/schemas.d.ts +64 -20
  33. package/build/system/mcp-servers/admin/schemas.js +19 -3
  34. package/build/system/mcp-servers/admin/workflow-config.js +54 -9
  35. package/build/system/mcp-servers/admin/workflows.js +9 -7
  36. package/build/system/mcp-servers/db-query/schemas.d.ts +2 -2
  37. package/build/system/seed/tool-manifests-admin.d.ts +517 -54
  38. package/build/system/seed/tool-manifests-admin.js +4 -3
  39. package/build/tsconfig.tsbuildinfo +1 -1
  40. package/build/types/config.d.ts +4 -0
  41. package/build/types/startup.d.ts +6 -0
  42. package/dashboard/dist/assets/{AdminDashboard-Drs-9TRM.js → AdminDashboard-DplvDBti.js} +2 -2
  43. package/dashboard/dist/assets/{AdminDashboard-Drs-9TRM.js.map → AdminDashboard-DplvDBti.js.map} +1 -1
  44. package/dashboard/dist/assets/{AgentConfigPage-BDPDZ7-v.js → AgentConfigPage-D8Bf6YxO.js} +2 -2
  45. package/dashboard/dist/assets/{AgentConfigPage-BDPDZ7-v.js.map → AgentConfigPage-D8Bf6YxO.js.map} +1 -1
  46. package/dashboard/dist/assets/{AgentDetailPage-CGBulM4_.js → AgentDetailPage-BN8g0Y2G.js} +2 -2
  47. package/dashboard/dist/assets/{AgentDetailPage-CGBulM4_.js.map → AgentDetailPage-BN8g0Y2G.js.map} +1 -1
  48. package/dashboard/dist/assets/{AgentsPage-D77JeViQ.js → AgentsPage-7JJBHku8.js} +2 -2
  49. package/dashboard/dist/assets/{AgentsPage-D77JeViQ.js.map → AgentsPage-7JJBHku8.js.map} +1 -1
  50. package/dashboard/dist/assets/{AvailableEscalationsPage-CqM_MOMy.js → AvailableEscalationsPage-lz5qwSjg.js} +2 -2
  51. package/dashboard/dist/assets/{AvailableEscalationsPage-CqM_MOMy.js.map → AvailableEscalationsPage-lz5qwSjg.js.map} +1 -1
  52. package/dashboard/dist/assets/{BotPicker-CC5vI_Sv.js → BotPicker-CGCnIz8I.js} +2 -2
  53. package/dashboard/dist/assets/{BotPicker-CC5vI_Sv.js.map → BotPicker-CGCnIz8I.js.map} +1 -1
  54. package/dashboard/dist/assets/{BulkAssignModal-BXiJnlqt.js → BulkAssignModal-NJBcoj-f.js} +2 -2
  55. package/dashboard/dist/assets/{BulkAssignModal-BXiJnlqt.js.map → BulkAssignModal-NJBcoj-f.js.map} +1 -1
  56. package/dashboard/dist/assets/{CapabilitiesPage-D9TC2iKy.js → CapabilitiesPage-F8dpNn9B.js} +2 -2
  57. package/dashboard/dist/assets/{CapabilitiesPage-D9TC2iKy.js.map → CapabilitiesPage-F8dpNn9B.js.map} +1 -1
  58. package/dashboard/dist/assets/{CollapsibleSection-D10lGw_u.js → CollapsibleSection-BZW6VpCU.js} +2 -2
  59. package/dashboard/dist/assets/{CollapsibleSection-D10lGw_u.js.map → CollapsibleSection-BZW6VpCU.js.map} +1 -1
  60. package/dashboard/dist/assets/{ConfirmDeleteModal-BJdLN6No.js → ConfirmDeleteModal-64adXLdq.js} +2 -2
  61. package/dashboard/dist/assets/{ConfirmDeleteModal-BJdLN6No.js.map → ConfirmDeleteModal-64adXLdq.js.map} +1 -1
  62. package/dashboard/dist/assets/{CountdownTimer-D9B-BjQ7.js → CountdownTimer-BxDub9d2.js} +2 -2
  63. package/dashboard/dist/assets/{CountdownTimer-D9B-BjQ7.js.map → CountdownTimer-BxDub9d2.js.map} +1 -1
  64. package/dashboard/dist/assets/{CredentialsPage-hniUAFBK.js → CredentialsPage-CnLzopLL.js} +2 -2
  65. package/dashboard/dist/assets/{CredentialsPage-hniUAFBK.js.map → CredentialsPage-CnLzopLL.js.map} +1 -1
  66. package/dashboard/dist/assets/{CronLabel-v9DCD2FX.js → CronLabel-CAD5UYDT.js} +2 -2
  67. package/dashboard/dist/assets/{CronLabel-v9DCD2FX.js.map → CronLabel-CAD5UYDT.js.map} +1 -1
  68. package/dashboard/dist/assets/{ElapsedCell-_xvVTK8N.js → ElapsedCell-CwO4ufd0.js} +2 -2
  69. package/dashboard/dist/assets/{ElapsedCell-_xvVTK8N.js.map → ElapsedCell-CwO4ufd0.js.map} +1 -1
  70. package/dashboard/dist/assets/{EntityTimelinePanel-1lT3jkCM.js → EntityTimelinePanel-CkF-oW-m.js} +2 -2
  71. package/dashboard/dist/assets/{EntityTimelinePanel-1lT3jkCM.js.map → EntityTimelinePanel-CkF-oW-m.js.map} +1 -1
  72. package/dashboard/dist/assets/{EscalationListSchemaPage-BeQUTUEO.js → EscalationListSchemaPage-h9JO_q5f.js} +2 -2
  73. package/dashboard/dist/assets/{EscalationListSchemaPage-BeQUTUEO.js.map → EscalationListSchemaPage-h9JO_q5f.js.map} +1 -1
  74. package/dashboard/dist/assets/{EscalationListView-uuZRMSLB.js → EscalationListView-AHW2xtlr.js} +2 -2
  75. package/dashboard/dist/assets/{EscalationListView-uuZRMSLB.js.map → EscalationListView-AHW2xtlr.js.map} +1 -1
  76. package/dashboard/dist/assets/{EscalationSchemaPage-D4VlEwyS.js → EscalationSchemaPage-mJFL5_Se.js} +2 -2
  77. package/dashboard/dist/assets/{EscalationSchemaPage-D4VlEwyS.js.map → EscalationSchemaPage-mJFL5_Se.js.map} +1 -1
  78. package/dashboard/dist/assets/{EscalationsOverview-Bx6Zrzm-.js → EscalationsOverview-DlXUFqWJ.js} +2 -2
  79. package/dashboard/dist/assets/{EscalationsOverview-Bx6Zrzm-.js.map → EscalationsOverview-DlXUFqWJ.js.map} +1 -1
  80. package/dashboard/dist/assets/{EventTable-KEC3YWBf.js → EventTable-Ike2xchn.js} +2 -2
  81. package/dashboard/dist/assets/{EventTable-KEC3YWBf.js.map → EventTable-Ike2xchn.js.map} +1 -1
  82. package/dashboard/dist/assets/{FilterBar-xwN_b5fj.js → FilterBar-DMOR-O1c.js} +2 -2
  83. package/dashboard/dist/assets/{FilterBar-xwN_b5fj.js.map → FilterBar-DMOR-O1c.js.map} +1 -1
  84. package/dashboard/dist/assets/{GraphInvokePage-DV7Y0fe2.js → GraphInvokePage-CKtvWowP.js} +2 -2
  85. package/dashboard/dist/assets/{GraphInvokePage-DV7Y0fe2.js.map → GraphInvokePage-CKtvWowP.js.map} +1 -1
  86. package/dashboard/dist/assets/{HomePage-G785SWcW.js → HomePage-BQ3Q791Q.js} +2 -2
  87. package/dashboard/dist/assets/{HomePage-G785SWcW.js.map → HomePage-BQ3Q791Q.js.map} +1 -1
  88. package/dashboard/dist/assets/{ListToolbar-zPVYPg3W.js → ListToolbar-DdJzj472.js} +2 -2
  89. package/dashboard/dist/assets/{ListToolbar-zPVYPg3W.js.map → ListToolbar-DdJzj472.js.map} +1 -1
  90. package/dashboard/dist/assets/{McpOverview-CMGUq8hx.js → McpOverview-BbtrduWn.js} +2 -2
  91. package/dashboard/dist/assets/{McpOverview-CMGUq8hx.js.map → McpOverview-BbtrduWn.js.map} +1 -1
  92. package/dashboard/dist/assets/{McpQueryDetailPage-CdhLhaKn.js → McpQueryDetailPage-C1L4T-Wt.js} +2 -2
  93. package/dashboard/dist/assets/{McpQueryDetailPage-CdhLhaKn.js.map → McpQueryDetailPage-C1L4T-Wt.js.map} +1 -1
  94. package/dashboard/dist/assets/{McpQueryPage-CNSNMagY.js → McpQueryPage-CfJy7HZ7.js} +2 -2
  95. package/dashboard/dist/assets/{McpQueryPage-CNSNMagY.js.map → McpQueryPage-CfJy7HZ7.js.map} +1 -1
  96. package/dashboard/dist/assets/{McpRunDetailPage-DBm8hUaW.js → McpRunDetailPage-CA9yv7he.js} +2 -2
  97. package/dashboard/dist/assets/{McpRunDetailPage-DBm8hUaW.js.map → McpRunDetailPage-CA9yv7he.js.map} +1 -1
  98. package/dashboard/dist/assets/{McpRunsPage-B6rb5QBf.js → McpRunsPage-D7QXjW9z.js} +2 -2
  99. package/dashboard/dist/assets/{McpRunsPage-B6rb5QBf.js.map → McpRunsPage-D7QXjW9z.js.map} +1 -1
  100. package/dashboard/dist/assets/{OperationsPage-Dxk1fAMg.js → OperationsPage-aLHHAP2X.js} +2 -2
  101. package/dashboard/dist/assets/{OperationsPage-Dxk1fAMg.js.map → OperationsPage-aLHHAP2X.js.map} +1 -1
  102. package/dashboard/dist/assets/{OperatorDashboard-DBOscDnf.js → OperatorDashboard-sXNDh1Ph.js} +2 -2
  103. package/dashboard/dist/assets/{OperatorDashboard-DBOscDnf.js.map → OperatorDashboard-sXNDh1Ph.js.map} +1 -1
  104. package/dashboard/dist/assets/{PersonaDetailPage-BGRdGpeR.js → PersonaDetailPage-NeHD-Gra.js} +2 -2
  105. package/dashboard/dist/assets/{PersonaDetailPage-BGRdGpeR.js.map → PersonaDetailPage-NeHD-Gra.js.map} +1 -1
  106. package/dashboard/dist/assets/{PersonasPage-DRzOZcVa.js → PersonasPage-DavKXRWX.js} +2 -2
  107. package/dashboard/dist/assets/{PersonasPage-DRzOZcVa.js.map → PersonasPage-DavKXRWX.js.map} +1 -1
  108. package/dashboard/dist/assets/{ProcessDetailPage-BLGjZXpM.js → ProcessDetailPage-DkdKJGe6.js} +2 -2
  109. package/dashboard/dist/assets/{ProcessDetailPage-BLGjZXpM.js.map → ProcessDetailPage-DkdKJGe6.js.map} +1 -1
  110. package/dashboard/dist/assets/{ProcessesListPage-5NnysKFC.js → ProcessesListPage-CjwVKe32.js} +2 -2
  111. package/dashboard/dist/assets/{ProcessesListPage-5NnysKFC.js.map → ProcessesListPage-CjwVKe32.js.map} +1 -1
  112. package/dashboard/dist/assets/ResolverForm-Bk-wDkN-.js +3 -0
  113. package/dashboard/dist/assets/ResolverForm-Bk-wDkN-.js.map +1 -0
  114. package/dashboard/dist/assets/{RoleDetailPage-C_LIoe1j.js → RoleDetailPage-WQt0y5l7.js} +3 -3
  115. package/dashboard/dist/assets/{RoleDetailPage-C_LIoe1j.js.map → RoleDetailPage-WQt0y5l7.js.map} +1 -1
  116. package/dashboard/dist/assets/{RolesPage-BmW1LzkU.js → RolesPage-OM9KM8Pg.js} +2 -2
  117. package/dashboard/dist/assets/{RolesPage-BmW1LzkU.js.map → RolesPage-OM9KM8Pg.js.map} +1 -1
  118. package/dashboard/dist/assets/{RunAsSelector-BwZTJ4Yj.js → RunAsSelector-fFMt1bGe.js} +2 -2
  119. package/dashboard/dist/assets/{RunAsSelector-BwZTJ4Yj.js.map → RunAsSelector-fFMt1bGe.js.map} +1 -1
  120. package/dashboard/dist/assets/ScanCodesPage-AujH-pPQ.js +2 -0
  121. package/dashboard/dist/assets/{ScanCodesPage-FiYIYB-m.js.map → ScanCodesPage-AujH-pPQ.js.map} +1 -1
  122. package/dashboard/dist/assets/{ScanSchemeDetailPage-BiAqtD-a.js → ScanSchemeDetailPage-eKQpmsC_.js} +2 -2
  123. package/dashboard/dist/assets/{ScanSchemeDetailPage-BiAqtD-a.js.map → ScanSchemeDetailPage-eKQpmsC_.js.map} +1 -1
  124. package/dashboard/dist/assets/{ScanStationPage-8CdOtbCD.js → ScanStationPage-C1_ppDoZ.js} +2 -2
  125. package/dashboard/dist/assets/{ScanStationPage-8CdOtbCD.js.map → ScanStationPage-C1_ppDoZ.js.map} +1 -1
  126. package/dashboard/dist/assets/{StickyPagination-DRuqKhZt.js → StickyPagination-B91Pk9xh.js} +2 -2
  127. package/dashboard/dist/assets/{StickyPagination-DRuqKhZt.js.map → StickyPagination-B91Pk9xh.js.map} +1 -1
  128. package/dashboard/dist/assets/{StreamMessageDetail-JwlbRiMn.js → StreamMessageDetail-C7SPqaJt.js} +2 -2
  129. package/dashboard/dist/assets/{StreamMessageDetail-JwlbRiMn.js.map → StreamMessageDetail-C7SPqaJt.js.map} +1 -1
  130. package/dashboard/dist/assets/{SwimlaneTimeline-hu3c4bCJ.js → SwimlaneTimeline-BcHR8ylf.js} +2 -2
  131. package/dashboard/dist/assets/{SwimlaneTimeline-hu3c4bCJ.js.map → SwimlaneTimeline-BcHR8ylf.js.map} +1 -1
  132. package/dashboard/dist/assets/{TaskDetailPage-NqVZF3jW.js → TaskDetailPage-Bqj0I_I0.js} +2 -2
  133. package/dashboard/dist/assets/{TaskDetailPage-NqVZF3jW.js.map → TaskDetailPage-Bqj0I_I0.js.map} +1 -1
  134. package/dashboard/dist/assets/{TasksListPage-BQNaSzCn.js → TasksListPage-BB1f79lL.js} +2 -2
  135. package/dashboard/dist/assets/{TasksListPage-BQNaSzCn.js.map → TasksListPage-BB1f79lL.js.map} +1 -1
  136. package/dashboard/dist/assets/{TimeAgo-Cv35DOiI.js → TimeAgo-BFnODmNe.js} +2 -2
  137. package/dashboard/dist/assets/{TimeAgo-Cv35DOiI.js.map → TimeAgo-BFnODmNe.js.map} +1 -1
  138. package/dashboard/dist/assets/{TimestampCell-DHUXey9s.js → TimestampCell-BXgLOBsr.js} +2 -2
  139. package/dashboard/dist/assets/{TimestampCell-DHUXey9s.js.map → TimestampCell-BXgLOBsr.js.map} +1 -1
  140. package/dashboard/dist/assets/{ToolTestPanel-DvuLFWqQ.js → ToolTestPanel-Bwe3J5lj.js} +2 -2
  141. package/dashboard/dist/assets/{ToolTestPanel-DvuLFWqQ.js.map → ToolTestPanel-Bwe3J5lj.js.map} +1 -1
  142. package/dashboard/dist/assets/{TopicDetailPage-TXX3QNSo.js → TopicDetailPage-DAF07vZ9.js} +2 -2
  143. package/dashboard/dist/assets/{TopicDetailPage-TXX3QNSo.js.map → TopicDetailPage-DAF07vZ9.js.map} +1 -1
  144. package/dashboard/dist/assets/{TopicsPage-h-oyTeEJ.js → TopicsPage-C1gxBUap.js} +2 -2
  145. package/dashboard/dist/assets/{TopicsPage-h-oyTeEJ.js.map → TopicsPage-C1gxBUap.js.map} +1 -1
  146. package/dashboard/dist/assets/{UserName-BceRCeDF.js → UserName-BzXJUE6q.js} +2 -2
  147. package/dashboard/dist/assets/{UserName-BceRCeDF.js.map → UserName-BzXJUE6q.js.map} +1 -1
  148. package/dashboard/dist/assets/{WorkflowExecutionPage-CmHGcaN9.js → WorkflowExecutionPage-SkRU5cRX.js} +2 -2
  149. package/dashboard/dist/assets/{WorkflowExecutionPage-CmHGcaN9.js.map → WorkflowExecutionPage-SkRU5cRX.js.map} +1 -1
  150. package/dashboard/dist/assets/{WorkflowsDashboard-B0r2lQXk.js → WorkflowsDashboard-CZAqRk1N.js} +2 -2
  151. package/dashboard/dist/assets/{WorkflowsDashboard-B0r2lQXk.js.map → WorkflowsDashboard-CZAqRk1N.js.map} +1 -1
  152. package/dashboard/dist/assets/{WorkflowsOverview-BTMc2PJ_.js → WorkflowsOverview-BoN44VTE.js} +2 -2
  153. package/dashboard/dist/assets/{WorkflowsOverview-BTMc2PJ_.js.map → WorkflowsOverview-BoN44VTE.js.map} +1 -1
  154. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DUiCVnZp.js → YamlWorkflowDetailPage-CqjhtdJf.js} +2 -2
  155. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DUiCVnZp.js.map → YamlWorkflowDetailPage-CqjhtdJf.js.map} +1 -1
  156. package/dashboard/dist/assets/{YamlWorkflowsPage-BAuXfwi0.js → YamlWorkflowsPage-CwnJkzyb.js} +2 -2
  157. package/dashboard/dist/assets/{YamlWorkflowsPage-BAuXfwi0.js.map → YamlWorkflowsPage-CwnJkzyb.js.map} +1 -1
  158. package/dashboard/dist/assets/{agents-BvmLCk4h.js → agents-gV0Ys-sY.js} +2 -2
  159. package/dashboard/dist/assets/{agents-BvmLCk4h.js.map → agents-gV0Ys-sY.js.map} +1 -1
  160. package/dashboard/dist/assets/{bots-f_tyhl4I.js → bots-B97itB3I.js} +2 -2
  161. package/dashboard/dist/assets/{bots-f_tyhl4I.js.map → bots-B97itB3I.js.map} +1 -1
  162. package/dashboard/dist/assets/{capabilities-DNo5bqLx.js → capabilities-CR9xZgGd.js} +2 -2
  163. package/dashboard/dist/assets/{capabilities-DNo5bqLx.js.map → capabilities-CR9xZgGd.js.map} +1 -1
  164. package/dashboard/dist/assets/{controlplane-Dyyj2Irb.js → controlplane-YxvP1KCa.js} +2 -2
  165. package/dashboard/dist/assets/{controlplane-Dyyj2Irb.js.map → controlplane-YxvP1KCa.js.map} +1 -1
  166. package/dashboard/dist/assets/{escalation-columns-DIigeTOK.js → escalation-columns-uq-IV2aj.js} +2 -2
  167. package/dashboard/dist/assets/{escalation-columns-DIigeTOK.js.map → escalation-columns-uq-IV2aj.js.map} +1 -1
  168. package/dashboard/dist/assets/index-3ezfWLkE.js +6 -0
  169. package/dashboard/dist/assets/index-3ezfWLkE.js.map +1 -0
  170. package/dashboard/dist/assets/{index-CsKiRyhy.js → index-B9BBCqLI.js} +2 -2
  171. package/dashboard/dist/assets/{index-CsKiRyhy.js.map → index-B9BBCqLI.js.map} +1 -1
  172. package/dashboard/dist/assets/{index-DL83W7Gu.js → index-BQpV-DTG.js} +2 -2
  173. package/dashboard/dist/assets/{index-DL83W7Gu.js.map → index-BQpV-DTG.js.map} +1 -1
  174. package/dashboard/dist/assets/index-Bp9KBLT5.js +2 -0
  175. package/dashboard/dist/assets/{index-D7ESqn22.js.map → index-Bp9KBLT5.js.map} +1 -1
  176. package/dashboard/dist/assets/{index-DvxxrFBo.js → index-CFbo9FU9.js} +2 -2
  177. package/dashboard/dist/assets/{index-DvxxrFBo.js.map → index-CFbo9FU9.js.map} +1 -1
  178. package/dashboard/dist/assets/{index-e2X-s0EQ.js → index-CIpHj4di.js} +2 -2
  179. package/dashboard/dist/assets/{index-e2X-s0EQ.js.map → index-CIpHj4di.js.map} +1 -1
  180. package/dashboard/dist/assets/{index-BMlQYOE1.js → index-CIwlVfvV.js} +10 -10
  181. package/dashboard/dist/assets/index-CIwlVfvV.js.map +1 -0
  182. package/dashboard/dist/assets/{index-BNZknxFY.js → index-CUZ6LYye.js} +2 -2
  183. package/dashboard/dist/assets/{index-BNZknxFY.js.map → index-CUZ6LYye.js.map} +1 -1
  184. package/dashboard/dist/assets/index-Cfvkl2J0.js +13 -0
  185. package/dashboard/dist/assets/index-Cfvkl2J0.js.map +1 -0
  186. package/dashboard/dist/assets/{index-DWse7ERF.js → index-DMeaiKgf.js} +2 -2
  187. package/dashboard/dist/assets/{index-DWse7ERF.js.map → index-DMeaiKgf.js.map} +1 -1
  188. package/dashboard/dist/assets/{index-C-Xr2V3F.js → index-DwOnWeu8.js} +2 -2
  189. package/dashboard/dist/assets/{index-C-Xr2V3F.js.map → index-DwOnWeu8.js.map} +1 -1
  190. package/dashboard/dist/assets/index-SGyrXGp8.js +3 -0
  191. package/dashboard/dist/assets/{index-CegPUKpc.js.map → index-SGyrXGp8.js.map} +1 -1
  192. package/dashboard/dist/assets/{index-PcyGjmBm.js → index-ipqwPavs.js} +2 -2
  193. package/dashboard/dist/assets/{index-PcyGjmBm.js.map → index-ipqwPavs.js.map} +1 -1
  194. package/dashboard/dist/assets/invoke-context-DrVyUEfs.js +2 -0
  195. package/dashboard/dist/assets/invoke-context-DrVyUEfs.js.map +1 -0
  196. package/dashboard/dist/assets/{knowledge-Coo6CKzo.js → knowledge-XX6cW4Ob.js} +2 -2
  197. package/dashboard/dist/assets/{knowledge-Coo6CKzo.js.map → knowledge-XX6cW4Ob.js.map} +1 -1
  198. package/dashboard/dist/assets/{mcp-Cz5eFnP_.js → mcp-CH13hNH2.js} +2 -2
  199. package/dashboard/dist/assets/{mcp-Cz5eFnP_.js.map → mcp-CH13hNH2.js.map} +1 -1
  200. package/dashboard/dist/assets/{mcp-query-BtnuO4LF.js → mcp-query-Duydd3JA.js} +2 -2
  201. package/dashboard/dist/assets/{mcp-query-BtnuO4LF.js.map → mcp-query-Duydd3JA.js.map} +1 -1
  202. package/dashboard/dist/assets/{personas-C2-LgpHQ.js → personas-mDk4lLQS.js} +2 -2
  203. package/dashboard/dist/assets/{personas-C2-LgpHQ.js.map → personas-mDk4lLQS.js.map} +1 -1
  204. package/dashboard/dist/assets/{pipelines-TuXQvUA-.js → pipelines-B5GcgCeF.js} +2 -2
  205. package/dashboard/dist/assets/{pipelines-TuXQvUA-.js.map → pipelines-B5GcgCeF.js.map} +1 -1
  206. package/dashboard/dist/assets/{resolver-payload-C1dXB3n6.js → resolver-payload-m9AGKZ3a.js} +2 -2
  207. package/dashboard/dist/assets/{resolver-payload-C1dXB3n6.js.map → resolver-payload-m9AGKZ3a.js.map} +1 -1
  208. package/dashboard/dist/assets/{tasks-OUzpu__z.js → tasks-CItmNsRp.js} +2 -2
  209. package/dashboard/dist/assets/{tasks-OUzpu__z.js.map → tasks-CItmNsRp.js.map} +1 -1
  210. package/dashboard/dist/assets/{topics-B8bdrBaW.js → topics-CJYG7BX5.js} +2 -2
  211. package/dashboard/dist/assets/{topics-B8bdrBaW.js.map → topics-CJYG7BX5.js.map} +1 -1
  212. package/dashboard/dist/assets/{useDebouncedValue-Cp5ZOtVE.js → useDebouncedValue-BrwgXcp8.js} +2 -2
  213. package/dashboard/dist/assets/{useDebouncedValue-Cp5ZOtVE.js.map → useDebouncedValue-BrwgXcp8.js.map} +1 -1
  214. package/dashboard/dist/assets/{useNamespace-DtQe3wZ5.js → useNamespace-CHty0HAS.js} +2 -2
  215. package/dashboard/dist/assets/{useNamespace-DtQe3wZ5.js.map → useNamespace-CHty0HAS.js.map} +1 -1
  216. package/dashboard/dist/assets/{useYamlActivityEvents-CS22c15X.js → useYamlActivityEvents-CoTsia7t.js} +2 -2
  217. package/dashboard/dist/assets/{useYamlActivityEvents-CS22c15X.js.map → useYamlActivityEvents-CoTsia7t.js.map} +1 -1
  218. package/dashboard/dist/assets/{yaml-workflows-HQIki3hI.js → yaml-workflows-CiWwx5rM.js} +2 -2
  219. package/dashboard/dist/assets/{yaml-workflows-HQIki3hI.js.map → yaml-workflows-CiWwx5rM.js.map} +1 -1
  220. package/dashboard/dist/index.html +1 -1
  221. package/docs/api/http/workflows.md +28 -1
  222. package/docs/api/mcp/admin.md +40 -4
  223. package/docs/code-owned-configuration.md +1 -1
  224. package/docs/dashboard.md +1 -1
  225. package/docs/design-principles.md +6 -5
  226. package/docs/hitl/form.md +12 -7
  227. package/docs/hitl/invoke-form.md +6 -3
  228. package/docs/hitl/lookups.md +21 -0
  229. package/docs/hitl/x-lt-validation.md +50 -3
  230. package/docs/hitl/x-lt-widget.md +21 -0
  231. package/docs/hitl-guide.md +5 -2
  232. package/package.json +1 -1
  233. package/dashboard/dist/assets/ResolverForm-Dy0yirtP.js +0 -2
  234. package/dashboard/dist/assets/ResolverForm-Dy0yirtP.js.map +0 -1
  235. package/dashboard/dist/assets/ScanCodesPage-FiYIYB-m.js +0 -2
  236. package/dashboard/dist/assets/index-BMlQYOE1.js.map +0 -1
  237. package/dashboard/dist/assets/index-CegPUKpc.js +0 -3
  238. package/dashboard/dist/assets/index-D7ESqn22.js +0 -2
  239. package/dashboard/dist/assets/index-DPLssnMW.js +0 -6
  240. package/dashboard/dist/assets/index-DPLssnMW.js.map +0 -1
  241. package/dashboard/dist/assets/index-DoETPlJP.js +0 -11
  242. package/dashboard/dist/assets/index-DoETPlJP.js.map +0 -1
  243. package/dashboard/dist/assets/seed-form-json-DvPsISxD.js +0 -2
  244. package/dashboard/dist/assets/seed-form-json-DvPsISxD.js.map +0 -1
@@ -1,3 +1,3 @@
1
- import{a as g,j as e}from"./vendor-query-DvWWuNIB.js";import{a6 as de,z as Rt,aa as rt,a1 as we,G as Pt,e as Lt,ba as ot,bb as Et,aW as Ot,_ as Bt,w as Ft,bc as At,aQ as It,Q as Tt}from"./index-BMlQYOE1.js";import{s as Le,a as ie,u as F,b as Ve,E as ze,c as lt,i as Ee,d as ct}from"./EntityTimelinePanel-1lT3jkCM.js";import{ar as Wt,bK as Dt,au as it,d as Ut,C as dt,ap as xt,bw as zt,e as Gt,X as Ht,aE as Vt,E as ut,ao as Yt,bL as Qt,a2 as Xt}from"./vendor-icons-DeBdvyKJ.js";import{u as mt,f as pt,L as ne,a as Zt}from"./vendor-react-_9U4mKFr.js";import{P as Jt}from"./PageHeader-Di5Sz3an.js";function Kt({groups:t,colors:s}){const l=g.useMemo(()=>{const r=(t??[]).filter(n=>(n.dwellSeconds??0)>0),d=r.reduce((n,o)=>n+(o.dwellSeconds??0),0);return d?r.map(n=>({key:ie(n.subtype),label:Le(n.subtype),seconds:n.dwellSeconds??0,pct:(n.dwellSeconds??0)/d})).sort((n,o)=>o.seconds-n.seconds):null},[t]);if(!l)return e.jsx("span",{className:"text-2xs text-text-quaternary",children:"—"});const i=l.map(r=>`${r.label} ${de(r.seconds*1e3)} · ${Math.round(r.pct*100)}%`).join(`
1
+ import{a as g,j as e}from"./vendor-query-DvWWuNIB.js";import{a6 as de,z as Rt,aa as rt,a1 as we,G as Pt,e as Lt,bc as ot,bd as Et,aY as Ot,_ as Bt,w as Ft,be as At,aS as It,Q as Tt}from"./index-CIwlVfvV.js";import{s as Le,a as ie,u as F,b as Ve,E as ze,c as lt,i as Ee,d as ct}from"./EntityTimelinePanel-CkF-oW-m.js";import{ar as Wt,bK as Dt,au as it,d as Ut,C as dt,ap as xt,bw as zt,e as Gt,X as Ht,aE as Vt,E as ut,ao as Yt,bL as Qt,a2 as Xt}from"./vendor-icons-DeBdvyKJ.js";import{u as mt,f as pt,L as ne,a as Zt}from"./vendor-react-_9U4mKFr.js";import{P as Jt}from"./PageHeader-Di5Sz3an.js";function Kt({groups:t,colors:s}){const l=g.useMemo(()=>{const r=(t??[]).filter(n=>(n.dwellSeconds??0)>0),d=r.reduce((n,o)=>n+(o.dwellSeconds??0),0);return d?r.map(n=>({key:ie(n.subtype),label:Le(n.subtype),seconds:n.dwellSeconds??0,pct:(n.dwellSeconds??0)/d})).sort((n,o)=>o.seconds-n.seconds):null},[t]);if(!l)return e.jsx("span",{className:"text-2xs text-text-quaternary",children:"—"});const i=l.map(r=>`${r.label} ${de(r.seconds*1e3)} · ${Math.round(r.pct*100)}%`).join(`
2
2
  `);return e.jsxs("div",{className:"flex items-center gap-1.5",title:i,children:[e.jsx("div",{className:"w-16 h-1.5 bg-surface-sunken rounded-full overflow-hidden flex shrink-0",children:l.map(r=>e.jsx("div",{style:{width:`${r.pct*100}%`,backgroundColor:s.get(r.key)}},r.key))}),e.jsxs("span",{className:"text-2xs font-mono text-text-quaternary tabular-nums",children:[Math.round(l[0].pct*100),"%"]})]})}function Be(t){return t.reduce((s,l)=>s+(l.dwellSeconds??0),0)||1}function ht(t,s){const l=[];for(const i of t){const r=i.facets[s];r==null||(i.dwellSeconds??0)<=0||l.push(r)}return l}function ft(t,s,l,i){const r=new Map;for(const o of s){const h=o.facets[i];if(h==null||(o.dwellSeconds??0)<=0)continue;const u=r.get(h)??[];u.push(o),r.set(h,u)}const d=new Map;for(const o of l){const h=o.facets[i];h==null||(o.count??0)<=0||o.state==null||d.has(h)||d.set(h,o.state)}const n=[];for(const o of t){const h=o.facets[i];if(h==null||(o.dwellSeconds??0)<=0)continue;const u=[...r.get(h)??[]].sort((m,f)=>(f.dwellSeconds??0)-(m.dwellSeconds??0));n.push({value:h,groups:u,total:o.dwellSeconds??0,nowState:d.get(h)??null})}return n}function es(t,s,l=12){const i=new Map;for(const r of t){if((r.dwellSeconds??0)<=0)continue;const d=r.facets[s]??"no value",n=i.get(d)??[];n.push(r),i.set(d,n)}return[...i.entries()].map(([r,d])=>({value:r,groups:[...d].sort((n,o)=>(o.dwellSeconds??0)-(n.dwellSeconds??0)),total:Be(d)})).sort((r,d)=>d.total-r.total).slice(0,l)}function Ye({groups:t,colors:s,height:l,rounded:i="rounded-sm",className:r=""}){const d=Be(t),n=new Map([...s.keys()].map((h,u)=>[h,u])),o=[...t].sort((h,u)=>(n.get(h.state??"—")??1/0)-(n.get(u.state??"—")??1/0));return e.jsx("div",{className:`${l} flex ${i} overflow-hidden bg-surface-sunken ${r}`,children:o.map(h=>{const u=d>0?Math.round((h.dwellSeconds??0)/d*100):0;return e.jsx("div",{title:`${h.state??"—"} · ${u}%`,style:{width:`${(h.dwellSeconds??0)/d*100}%`,backgroundColor:s.get(h.state??"—")}},h.state??"—")})})}const ts=10;function ss(t){return t<1?`${Math.round(t*60)}m`:t<=24?`${Math.round(t)}h`:`${Math.round(t/24)}d`}function ns({groups:t,colors:s,stateLabel:l,nowByState:i,periodHours:r,tracked:d,entityKey:n}){var b;const o=Be(t),h=[...t].filter(y=>(y.dwellSeconds??0)>0).sort((y,w)=>(w.dwellSeconds??0)-(y.dwellSeconds??0)).map(y=>({state:y.state??"—",label:l(y.state),pct:o>0?Math.round((y.dwellSeconds??0)/o*100):0,color:s.get(y.state??"—"),now:i.get(y.state??"—")??0})),u=((b=h[0])==null?void 0:b.pct)||1,m=h.slice(0,ts),f=h.length-m.length,j=h[0];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:["Where the time went · ",e.jsx("span",{className:"normal-case font-mono",children:n})," system"]}),e.jsxs("div",{className:"space-y-px max-h-40 overflow-hidden",children:[m.map(y=>e.jsx("div",{className:"relative h-3 rounded-sm bg-surface-sunken overflow-hidden",title:`${y.label} · ${y.pct}%${y.now>0?` · ${y.now} now`:""}`,children:e.jsxs("div",{className:"absolute inset-y-0 left-0 flex items-center justify-end gap-1 pr-1.5 rounded-sm",style:{width:`${Math.max(y.pct/u*100,0)}%`,minWidth:"4.25rem",backgroundColor:y.color},children:[e.jsx("span",{className:"text-[10px] leading-none font-mono font-medium text-white/95 truncate",children:y.label}),e.jsxs("span",{className:"text-[10px] leading-none font-mono tabular-nums text-white/75 shrink-0",children:[y.pct,"%"]})]})},y.state)),f>0&&e.jsxs("p",{className:"text-[10px] text-text-quaternary pl-1 pt-0.5",children:["+",f," more stages"]})]})]}),e.jsxs("div",{className:"shrink-0 w-52 pl-6 border-l border-surface-border/40 flex flex-col justify-center",children:[e.jsxs("p",{className:"text-2xs uppercase tracking-widest text-text-tertiary",children:["Last ",ss(r)]}),e.jsxs("p",{className:"mt-1 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-xl font-light text-text-primary tabular-nums leading-none",children:[(j==null?void 0:j.pct)??0,"%"]}),e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:j==null?void 0:j.color}})]}),e.jsxs("p",{className:"text-xs text-text-secondary mt-1",children:[e.jsx("span",{className:"font-mono font-medium text-text-primary",children:j==null?void 0:j.label})," is the biggest time sink"]}),e.jsxs("p",{className:"text-2xs text-text-tertiary mt-1",children:["across ",h.length," stages",d!=null&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"font-mono font-semibold text-text-primary tabular-nums",children:d})," ",e.jsx("span",{className:"font-mono",children:n})," in queue now"]})]})]})]})}function gt({text:t,tail:s=6,className:l=""}){if(t.length<=s+1)return e.jsx("span",{className:`truncate ${l}`,title:t,children:t});const i=t.slice(0,t.length-s),r=t.slice(t.length-s);return e.jsxs("span",{className:`flex items-baseline min-w-0 ${l}`,title:t,children:[e.jsx("span",{className:"truncate min-w-0",children:i}),e.jsx("span",{className:"shrink-0",children:r})]})}const Xe=15,yt="grid grid-cols-[0.6rem_7rem_minmax(2rem,1fr)_1rem] items-center gap-2.5",as=[25,50,100],rs=50;function os({facetKey:t,row:s,colors:l,stateLabel:i,onOpen:r}){const d=mt(),n=o=>{if(o.metaKey||o.ctrlKey){d(Rt(t,s.value));return}r(s.value)};return e.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:o=>{o.key==="Enter"&&n(o)},className:`${yt} text-2xs cursor-pointer group`,children:[e.jsx("span",{className:"w-2 h-2 rounded-full justify-self-center",style:{backgroundColor:s.nowState?l.get(s.nowState):"transparent"},title:s.nowState?i(s.nowState):"no current state"}),e.jsx(gt,{text:s.value,className:"font-mono text-text-secondary group-hover:text-accent transition-colors"}),e.jsx(Ye,{groups:s.groups,colors:l,height:"h-4",className:"min-w-[2rem]"}),e.jsx("button",{className:"icon-link justify-self-center",title:`${de(s.total*1e3)} tracked · open timeline · ⌘-click row searches every queue`,onClick:o=>{o.stopPropagation(),r(s.value)},children:e.jsx(it,{className:"w-3 h-3"})})]})}function bt({facetKey:t,sliced:s,header:l,rows:i,colors:r,stateLabel:d,onOpen:n,onTarget:o,hasMore:h,emptyText:u}){return e.jsxs("div",{className:s?"w-72 shrink-0":"flex-1",children:[l&&e.jsxs("button",{type:"button",onClick:()=>o==null?void 0:o(l.value),className:`${yt} w-full text-left mb-2 group`,children:[e.jsx("span",{"aria-hidden":!0}),e.jsx(gt,{text:l.value,className:"font-mono text-xs font-medium text-text-primary group-hover:text-accent transition-colors"}),e.jsx(Ye,{groups:l.groups,colors:r,height:"h-2.5",className:"min-w-[2rem]"}),e.jsx("span",{className:"icon-link justify-self-center",title:`${de(l.total*1e3)} total in ${l.value} — the band shows the state split`,children:e.jsx(Wt,{className:"w-3 h-3"})})]}),i.length===0?e.jsx("p",{className:"text-2xs text-text-quaternary",children:u??"No entities on this page."}):e.jsx("div",{className:"space-y-px",children:i.map(m=>e.jsx(os,{facetKey:t,row:m,colors:r,stateLabel:d,onOpen:n},m.value))}),h&&l&&o&&e.jsxs("button",{type:"button",onClick:()=>o(l.value),className:"mt-2 inline-flex items-center gap-1 text-2xs text-accent hover:text-accent-hover transition-colors",children:["More ",e.jsx(Dt,{className:"w-3 h-3"})]})]})}function ls({entityKey:t,sliceKey:s,value:l,headerGroups:i,headerTotal:r,window:d,find:n,colors:o,stateLabel:h,onOpen:u,onTarget:m}){var L;const f={entity:t,equals:{[s]:l}},j=F({query:{...f,...n?{prefix:{[t]:n}}:{}},groupBy:{facets:[t]},measure:{kind:"dwell",window:d},orderBy:[{field:"dwellSeconds",direction:"desc"}],limit:Xe}),b=g.useMemo(()=>{var k;return ht(((k=j.data)==null?void 0:k.groups)??[],t)},[j.data,t]),y=b.map(k=>({[t]:k})),w=F(b.length?{query:{entity:t,anyOf:y},groupBy:{state:!0,facets:[t]},measure:{kind:"dwell",window:d},limit:Xe*4}:null),C=F(b.length?{query:{entity:t,anyOf:y},groupBy:{state:!0,facets:[t]},measure:{kind:"membership"}}:null),M=g.useMemo(()=>{var k,$,R;return ft(((k=j.data)==null?void 0:k.groups)??[],(($=w.data)==null?void 0:$.groups)??[],((R=C.data)==null?void 0:R.groups)??[],t)},[j.data,w.data,C.data,t]);return e.jsx(bt,{facetKey:t,sliced:!0,header:{value:l,groups:i,total:r},rows:M,colors:o,stateLabel:h,onOpen:u,onTarget:m,hasMore:((L=j.data)==null?void 0:L.overflow)??!1})}function cs({facetKey:t,rows:s,colors:l,stateLabel:i,onOpen:r,emptyText:d}){return e.jsx(bt,{facetKey:t,sliced:!1,rows:s,colors:l,stateLabel:i,onOpen:r,emptyText:d})}const Me="entity-timeline",is=Lt,De=12;function ds({entityKey:t,periodHours:s,roles:l,scopeFacets:i,find:r,onFindChange:d,entityValue:n,onEntityChange:o,sliceKey:h=null,onSliceKeyChange:u,sliceValue:m=null,onSliceValueChange:f}){var ye,$e,Se,be,x;const j=Ve(s),b=rt(),y=a=>i?{...a,facets:{...a.facets??{},...i}}:a,w=h??"",C=!!w,M=C&&!!m,L=C&&!m,[k,$]=g.useState(0),[R,v]=g.useState(rs);g.useEffect(()=>{$(0)},[r,j.from,j.to,t,w,m,R]);const[H,Q]=g.useState(r??""),N=g.useRef(void 0);g.useEffect(()=>()=>clearTimeout(N.current),[]),g.useEffect(()=>{Q(r??"")},[r]);const q=a=>{Q(a),clearTimeout(N.current),N.current=setTimeout(()=>{const p=a.trim();d(p||null)},is)},le=g.useMemo(()=>{const a=new Map;for(const p of l)a.set(p.role,we(p));return a},[l]),E=a=>a==null?"—":le.get(a)??a,xe=F({query:y({entity:t}),groupBy:{state:!0},measure:{kind:"dwell",window:j},orderBy:[{field:"dwellSeconds",direction:"desc"}]}),A=F({query:y({entity:t}),groupBy:{state:!0},measure:{kind:"membership"}}),K=F({query:y({entity:t}),groupBy:{},measure:{kind:"membership"},distinctBy:t}),P=F(C?{query:y({entity:t}),groupBy:{state:!0,facets:[w]},measure:{kind:"dwell",window:j},limit:200}:null),_=F(!L?{query:y({entity:t,...M?{equals:{[w]:m}}:{},...r?{prefix:{[t]:r}}:{}}),groupBy:{facets:[t]},measure:{kind:"dwell",window:j},orderBy:[{field:"dwellSeconds",direction:"desc"}],limit:R,offset:k*R}:null),ee=g.useMemo(()=>{var a;return ht(((a=_==null?void 0:_.data)==null?void 0:a.groups)??[],t)},[_==null?void 0:_.data,t]),T=ee.length?{entity:t,anyOf:ee.map(a=>({[t]:a}))}:null,te=F(T?{query:y(T),groupBy:{state:!0,facets:[t]},measure:{kind:"dwell",window:j},limit:R*10}:null),ue=F(T?{query:y(T),groupBy:{state:!0,facets:[t]},measure:{kind:"membership"}}:null),c=g.useMemo(()=>{var a,p,G;return ft(((a=_==null?void 0:_.data)==null?void 0:a.groups)??[],((p=te.data)==null?void 0:p.groups)??[],((G=ue.data)==null?void 0:G.groups)??[],t)},[_==null?void 0:_.data,te.data,ue.data,t]),S=g.useRef(()=>{}),O=g.useRef(a=>S.current(a)).current,W=g.useRef(null),B=g.useRef(!1);g.useEffect(()=>{b&&n!==W.current&&(W.current=n,n?b.setPanel(e.jsx(ze,{facetKey:t,value:n,entity:t,intervalColor:O}),{key:Me,width:420}):(B.current=!1,b.closePanel(Me)))},[n,t,b]),g.useEffect(()=>{if(!(!b||!n)){if(b.open&&b.ownerKey===Me){B.current=!0;return}B.current&&(B.current=!1,o(null))}},[b,n,o]);const U=g.useRef(b);U.current=b,g.useEffect(()=>()=>{var a;W.current&&((a=U.current)==null||a.closePanel(Me))},[]);const{data:D}=Pt(),z=g.useMemo(()=>((D==null?void 0:D.keys)??[]).filter(a=>a!==t),[D,t]),V=(((ye=xe.data)==null?void 0:ye.groups)??[]).filter(a=>(a.dwellSeconds??0)>0),X=g.useMemo(()=>{var a;return lt([...V,...((a=A.data)==null?void 0:a.groups)??[]].map(p=>({label:p.state??"—",weight:p.dwellSeconds??p.count??0})))},[V,A.data]),me=new Map(((($e=A.data)==null?void 0:$e.groups)??[]).map(a=>[a.state??"—",a.count??0])),pe=((be=(Se=K.data)==null?void 0:Se.groups[0])==null?void 0:be.count)??null,Z=g.useMemo(()=>new Set(l.filter(a=>a.entity_state_source==="subtype").map(a=>a.role)),[l]);S.current=a=>{const p=Z.has(a.role)?a.subtype??a.role:a.role;return X.get(p)};const Ne=g.useMemo(()=>{var a;return C?es(((a=P.data)==null?void 0:a.groups)??[],w,De):[]},[C,P.data,w]),ve=g.useMemo(()=>{var p;const a=new Set;for(const G of((p=P.data)==null?void 0:p.groups)??[])(G.dwellSeconds??0)>0&&G.facets[w]!=null&&a.add(G.facets[w]);return a.size},[P.data,w]),ke=g.useMemo(()=>{var p;if(!M)return{groups:[],total:0};const a=(((p=P.data)==null?void 0:p.groups)??[]).filter(G=>G.facets[w]===m);return{groups:a,total:Be(a)}},[M,P.data,w,m]),Ie=((x=_==null?void 0:_.data)==null?void 0:x.overflow)??!1,Te=Ee(_==null?void 0:_.error),We=C&&Ee(P.error);return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-2 pt-4 pb-4 flex items-stretch gap-6 border-b border-surface-border/40",children:[V.length>0?e.jsx(ns,{groups:V,colors:X,stateLabel:E,nowByState:me,periodHours:s,tracked:pe,entityKey:t}):e.jsx("p",{className:"flex-1 text-2xs text-text-quaternary self-center",children:"No tracked time in this window."}),e.jsxs("div",{className:"shrink-0 w-56 space-y-2.5 self-center",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Slice by"}),e.jsxs("select",{value:w,onChange:a=>u==null?void 0:u(a.target.value||null),className:"select text-xs font-mono w-full",children:[e.jsx("option",{value:"",children:"— none —"}),z.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsx("input",{type:"text",value:H,onChange:a=>q(a.target.value),placeholder:`Find by ${t}…`,"aria-label":`Find by ${t}`,className:"w-full bg-transparent border-b border-surface-border/60 focus:border-accent focus:outline-none text-xs font-mono text-text-primary placeholder:text-text-quaternary pb-0.5 transition-colors"})]})]}),M&&e.jsxs("div",{className:"shrink-0 px-2 pt-3 flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>f==null?void 0:f(null),className:"inline-flex items-center gap-1 text-2xs text-accent hover:text-accent-hover transition-colors shrink-0",children:[e.jsx(Ut,{className:"w-3 h-3"})," all ",w]}),e.jsx("span",{className:"font-mono text-xs text-text-primary shrink-0",children:m}),e.jsx(Ye,{groups:ke.groups,colors:X,height:"h-2",className:"flex-1 max-w-md"}),e.jsx("span",{className:"font-mono tabular-nums text-2xs text-text-tertiary shrink-0",children:de(ke.total*1e3)})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-2 py-4",children:L?We?e.jsx("p",{className:"text-2xs text-text-quaternary",children:"Slicing requires full read access to the system's queues."}):Ne.length===0?e.jsx("p",{className:"text-2xs text-text-quaternary",children:"No tracked time for this slice in the window."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex gap-6 min-w-max",children:Ne.map(a=>e.jsx(ls,{entityKey:t,sliceKey:w,value:a.value,headerGroups:a.groups,headerTotal:a.total,window:j,find:r,colors:X,stateLabel:E,onOpen:o,onTarget:p=>f==null?void 0:f(p)},a.value))}),ve>De&&e.jsxs("p",{className:"text-2xs text-text-quaternary pt-4",children:["Showing the top ",De," of ",ve," ",e.jsx("span",{className:"font-mono",children:w})," values — a facet this wide isn't a good slice dimension."]})]}):Te?e.jsx("p",{className:"text-2xs text-text-quaternary",children:"The per-entity view requires full read access to the system's queues."}):e.jsx(cs,{facetKey:t,rows:c,colors:X,stateLabel:E,onOpen:o,emptyText:r?`No ${t} starts with “${r}” in this window.`:"No entities tracked in this window."})}),!L&&e.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface/95 px-2 pt-2 pb-3 flex items-center gap-3 text-2xs",children:[e.jsx("button",{disabled:k===0,onClick:()=>$(k-1),className:"text-text-tertiary hover:text-accent transition-colors disabled:opacity-40 disabled:hover:text-text-tertiary",children:"Prev"}),e.jsxs("span",{className:"font-mono tabular-nums text-text-quaternary",children:["page ",k+1]}),e.jsx("button",{disabled:!Ie,onClick:()=>$(k+1),className:"text-text-tertiary hover:text-accent transition-colors disabled:opacity-40 disabled:hover:text-text-tertiary",children:"Next"}),e.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-text-quaternary",children:[e.jsx("span",{children:"per page"}),e.jsx("select",{value:R,onChange:a=>v(Number(a.target.value)),"aria-label":"Results per page",className:"select text-2xs font-mono py-0.5",children:as.map(a=>e.jsx("option",{value:a,children:a},a))})]})]})]})}function xs({fragments:t,activeFragment:s,lenses:l,activeLens:i,onSelectFragment:r,onSelectLens:d}){const[n,o]=g.useState(!1),h=g.useRef(null);g.useEffect(()=>{if(!n)return;const f=b=>{h.current&&!h.current.contains(b.target)&&o(!1)},j=b=>{b.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",j)}},[n]);const u=t.find(f=>f.origin===s)??t[0],m=i?null:(u==null?void 0:u.origin)??null;return e.jsxs("div",{ref:h,className:"relative",title:"Board: pace a segment of roles, or read a metadata facet's trend",children:[e.jsxs("button",{type:"button",onClick:()=>o(f=>!f),className:"group flex items-baseline gap-1.5","aria-expanded":n,"aria-haspopup":"listbox","aria-label":"Board view",children:[e.jsx("span",{className:"text-2xs uppercase tracking-widest text-text-quaternary",children:"View"}),e.jsx("span",{className:"text-xs font-medium text-accent",children:i?e.jsxs(e.Fragment,{children:["by ",e.jsx("span",{className:"font-mono",children:i})]}):(u==null?void 0:u.title)??"Pace Board"}),e.jsx(dt,{className:`w-3 h-3 self-center shrink-0 text-text-tertiary group-hover:text-accent transition-transform ${n?"rotate-180":""}`,strokeWidth:1.5})]}),n&&e.jsxs("div",{role:"listbox",className:"absolute z-[100] top-full right-0 mt-1.5 min-w-[19rem] max-h-96 overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[e.jsx(Ze,{children:"Pace Board"}),t.map(f=>e.jsx(jt,{label:f.title,note:`${f.roleCount} role${f.roleCount===1?"":"s"} · ${f.pending} pending`,jeopardy:f.jeopardy,active:f.origin===m,onClick:()=>{r(f.origin),o(!1)}},f.origin)),l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ze,{children:"Trend Board"}),l.map(f=>e.jsx(us,{lens:f,active:i===f,fetchCount:n,onClick:()=>{d(f),o(!1)}},f))]})]})]})}function Ze({children:t}){return e.jsx("p",{className:"px-3 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:t})}function jt({label:t,note:s,jeopardy:l=0,active:i,mono:r,onClick:d}){return e.jsxs("button",{type:"button",role:"option","aria-selected":i,onClick:d,className:`w-full text-left pl-3 pr-2.5 py-1.5 flex items-baseline gap-2.5 border-l-2 transition-colors ${i?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[e.jsx("span",{className:`text-xs font-medium truncate ${r?"font-mono":""}`,children:t}),s&&e.jsx("span",{className:`ml-auto text-2xs font-mono tabular-nums shrink-0 ${i?"text-accent/70":"text-text-quaternary"}`,children:s}),e.jsx("span",{className:"w-9 shrink-0 flex items-center justify-end gap-0.5 text-2xs font-mono tabular-nums text-status-warning",title:l>0?`${l} in jeopardy`:void 0,children:l>0&&e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"w-3 h-3 shrink-0",strokeWidth:2}),l]})})]})}function us({lens:t,active:s,fetchCount:l,onClick:i}){var n,o;const d=(o=(n=F({query:{entity:t},groupBy:{},measure:{kind:"membership"},distinctBy:t},{enabled:l}).data)==null?void 0:n.groups[0])==null?void 0:o.count;return e.jsx(jt,{label:`by ${t}`,mono:!0,note:d!=null?`${d} in queue`:null,active:s,onClick:i})}const wt=800,Nt=270,ae=28,ms=60,Oe=24,ps=72,Pe=wt-ae-ms,Ge=Nt-Oe-ps,Y=Oe+Ge,Ue=ae+Pe,I="0.5s cubic-bezier(0.4, 0, 0.2, 1)",Je=9;function hs(t){return`M ${(t.x-Je).toFixed(1)} ${t.y.toFixed(1)} L ${(t.x+Je).toFixed(1)} ${t.y.toFixed(1)}`}function fe(t){if(t.length===0)return"";if(t.length===1)return hs(t[0]);const s=[];for(let l=0;l<t.length-1;l++){const i=t[Math.max(0,l-1)],r=t[l],d=t[l+1],n=t[Math.min(t.length-1,l+2)],o=(r.x+(d.x-i.x)/6).toFixed(1),h=(r.y+(d.y-i.y)/6).toFixed(1),u=(d.x-(n.x-r.x)/6).toFixed(1),m=(d.y-(n.y-r.y)/6).toFixed(1);l===0&&s.push(`M ${r.x.toFixed(1)} ${r.y.toFixed(1)}`),s.push(`C ${o} ${h}, ${u} ${m}, ${d.x.toFixed(1)} ${d.y.toFixed(1)}`)}return s.join(" ")}function fs(t,s){if(t.length<2||s.length<2)return"";const l=fe(t),i=[...s].reverse(),r=fe(i),d=r.slice(r.indexOf("C"));return`${l} L ${i[0].x.toFixed(1)} ${i[0].y.toFixed(1)} ${d} Z`}function Ke(t){return t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function qe(t){return t.length>0?t[t.length-1]:void 0}function gs(t){return[1,2,5,10,20,50,100,200,500,1e3,2e3,5e3,1e4,2e4,5e4].filter(l=>l>0&&l<t*.98)}function ys(t){return[.25,.5,.75].map(l=>Math.round(l*t)).filter(l=>l>0)}const re="rgb(var(--lt-status-claimed-graphic))",ge="rgb(var(--lt-status-queued-graphic))",J="rgb(var(--lt-status-success-graphic))",oe="rgb(var(--lt-text-quaternary))",je="rgb(var(--lt-status-error))";function Fe(t,s){return t.replace(/\)$/,` / ${s})`)}const bs=13;function js(t,s){const l=[...t].sort((n,o)=>n.y-o.y);let i=-1/0;const r=l.map(n=>{const o=Math.max(n.y+3,i+bs);return i=o,{...n,labelY:o}}),d=r.length>0?r[r.length-1].labelY-s:0;if(d>0)for(const n of r)n.labelY-=d;return r}function ws({stations:t,selectedRole:s,onSelect:l,onUpstreamSelect:i,onCmdClick:r,periodHours:d,logScale:n=!1,fill:o=!1}){const[h,u]=g.useState(null),m=t.length;if(m===0)return null;const f=c=>m===1?ae+Pe/2:ae+c/(m-1)*Pe,j=new Map(t.map((c,S)=>[c.role,f(S)])),b=t.map((c,S)=>{var B,U,D,z;const O=c.target_per_hour??null,W=O!=null?O*d:null;return{idx:S,x:f(S),expected:W,actual:((B=c.metric)==null?void 0:B.resolved)??0,active:((U=c.metric)==null?void 0:U.claimed)??0,pending:((D=c.metric)==null?void 0:D.pending)??0,priorityCount:((z=c.metric)==null?void 0:z.priority_count)??0}}),y=b.some(c=>c.expected!=null),C=Math.max(1,...b.map(c=>c.expected??0),...b.map(c=>c.actual),...b.map(c=>c.expected!=null?c.pending:0))*1.15,M=n?c=>{const S=Math.log(1+C);return Oe+Ge*(1-Math.log(1+Math.max(0,c))/S)}:c=>Oe+Ge*(1-Math.max(0,Math.min(c,C))/C),L=n?gs(C):ys(C),k=b.filter(c=>c.expected!=null),$=k.map(c=>({...c,y:M(c.expected)})),R=k.map(c=>({...c,y:M(c.actual)})),v=k.map(c=>({...c,y:M(c.active)})),H=k.map(c=>({...c,y:M(c.pending)})),Q=fe($),N=fe(R),q=fe(v),le=fe(H),E=qe(R),xe=qe($),A=qe(v),K=qe(H),P=R.length>=2&&E?`${N} L ${E.x.toFixed(1)} ${Y} L ${R[0].x.toFixed(1)} ${Y} Z`:"",ce=k.some(c=>c.pending>0||c.active>0),_=ce&&v.length>=2&&A?`${q} L ${A.x.toFixed(1)} ${Y} L ${v[0].x.toFixed(1)} ${Y} Z`:"",ee=ce?fs(H,v):"",T=k.some(c=>c.active>0),te=k.some(c=>c.pending>c.active),ue=js([xe?{key:"target",text:"Target",color:oe,y:xe.y}:null,E?{key:"actual",text:"Resolved",color:J,y:E.y}:null,T&&A?{key:"active",text:"Claimed",color:re,y:A.y}:null,te&&K?{key:"queued",text:"Pending",color:ge,y:K.y}:null].filter(Boolean),Y+4);return e.jsxs("svg",{viewBox:`0 0 ${wt} ${Nt}`,className:o?"w-full h-full":"w-full",preserveAspectRatio:"xMidYMid meet",style:{display:"block",...o?{}:{height:"auto"}},children:[L.map(c=>{const S=M(c);return e.jsxs("g",{children:[e.jsx("line",{x1:ae,y1:S,x2:Ue,y2:S,className:"stroke-surface-border",strokeWidth:.5,opacity:n?.45:.3,strokeDasharray:n?"2 5":void 0,style:{transition:`y1 ${I}, y2 ${I}`}}),e.jsx("text",{x:ae-4,y:S+2.5,textAnchor:"end",fontSize:6,fontFamily:"ui-monospace, monospace",opacity:.35,className:"fill-text-quaternary",children:Ke(c)})]},`grid-${c}`)}),t.map(c=>{if(!c.parent_role)return null;const S=j.get(c.parent_role);if(S==null)return null;const O=f(t.findIndex(W=>W.role===c.role));return e.jsx("line",{x1:S,y1:Y,x2:O,y2:Y,className:"stroke-surface-border",strokeWidth:.75},`dep-${c.role}`)}),P&&e.jsx("path",{d:P,opacity:.05,style:{fill:J,transition:`d ${I}`}}),_&&e.jsx("path",{d:_,opacity:.12,style:{fill:re,transition:`d ${I}`}}),ee&&e.jsx("path",{d:ee,opacity:.12,style:{fill:ge,transition:`d ${I}`}}),Q&&e.jsx("path",{d:Q,fill:"none",strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.7,style:{stroke:oe,transition:`d ${I}`}}),$.map(c=>e.jsxs("g",{transform:`translate(${c.x} ${c.y})`,style:{transition:`transform ${I}`},children:[e.jsx("circle",{r:2,opacity:.8,style:{fill:oe}}),e.jsx("text",{y:-5,textAnchor:"middle",fontSize:6.5,fontFamily:"ui-monospace, monospace",fontWeight:"500",opacity:.7,style:{fill:oe},children:Math.round(c.expected)})]},`tval-${c.idx}`)),ce&&le&&e.jsx("path",{d:le,fill:"none",strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.55,style:{stroke:ge,transition:`d ${I}`}}),q&&e.jsx("path",{d:q,fill:"none",strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.5,style:{stroke:re,transition:`d ${I}`}}),N&&e.jsx("path",{d:N,fill:"none",strokeWidth:.6,strokeLinejoin:"round",strokeLinecap:"round",opacity:.65,style:{stroke:J,transition:`d ${I}`}}),v.map((c,S)=>{if(c.pending<=0&&c.active<=0)return null;const O=Math.max(2.5,Math.min(5,2.5+c.active/10)),W=c.pending>c.active,B=Math.min(H[S].y-4,c.y-O-4);return e.jsxs("g",{children:[c.pending>0&&e.jsx("text",{x:c.x,y:B,textAnchor:"middle",fontSize:7.5,fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{fill:W?ge:"rgb(var(--lt-text-tertiary))",transition:`y ${I}`},children:c.pending}),e.jsxs("g",{transform:`translate(${c.x} ${c.y})`,style:{transition:`transform ${I}`},children:[e.jsx("circle",{r:O,opacity:.85,style:{fill:re}}),c.active>0&&e.jsx("text",{y:O+9,textAnchor:"middle",fontSize:7.5,fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{fill:re},children:c.active})]})]},`active-${c.idx}`)}),b.map(c=>{var pe;const S=t[c.idx],O=c.x,W=c.expected!=null?M(c.actual):Y,B=Math.max(2.25,Math.min(4,2.25+c.actual/160)),U=S.role===s,D=h===c.idx,z=c.expected==null?"idle · set a target rate to plot pace":`${c.actual} resolved · target ${Math.round(c.expected)}`+(c.pending>c.active?` · ${c.pending-c.active} pending`:"")+(c.active>0?` · ${c.active} claimed`:"")+(c.priorityCount>0?` · ${c.priorityCount} in jeopardy`:""),V=z.length*5.5+20,X=Math.max(ae+V/2+4,Math.min(Ue-V/2-4,O)),me=W-B-10;return e.jsxs("g",{onClick:Z=>{Z.metaKey||Z.ctrlKey?(Z.stopPropagation(),r==null||r(S.role)):l(S.role)},onMouseEnter:()=>u(c.idx),onMouseLeave:()=>u(null),style:{cursor:"pointer"},children:[e.jsxs("g",{transform:`translate(${O} ${W})`,style:{transition:`transform ${I}`},children:[e.jsx("circle",{r:22,fill:"transparent"}),e.jsx("circle",{r:B,opacity:.9,style:{fill:J,transition:`r ${I}`}}),c.expected!=null&&e.jsx("text",{y:-B-5,textAnchor:"middle",fontSize:9.5,fontFamily:"ui-monospace, monospace",fontWeight:"500",style:{fill:J},children:Ke(c.actual)}),D&&!U&&e.jsx("circle",{r:B+3,fill:"none",strokeWidth:1,opacity:.4,style:{stroke:J}}),U&&e.jsx("circle",{r:B+4,fill:"none",className:"stroke-accent",strokeWidth:2})]}),(((pe=S.upstream_roles)==null?void 0:pe.length)??0)>0&&e.jsxs("g",{transform:`translate(${O-20} ${Y})`,onClick:Z=>{Z.stopPropagation(),i==null||i(S.upstream_roles[0])},style:{cursor:"pointer"},children:[e.jsx("title",{children:`Fed by ${S.upstream_roles.join(", ")} — click to view that sequence`}),e.jsx("circle",{r:9,cy:-6,fill:"transparent"}),e.jsx("path",{d:"M -7 -14 C -3 -14 -1 -9 0 -2",fill:"none",className:"stroke-text-quaternary",strokeWidth:1,strokeDasharray:"2 2",strokeLinecap:"round"}),e.jsx("path",{d:"M 0 -2 L 8 -2",className:"stroke-text-quaternary",strokeWidth:1,strokeLinecap:"round"}),e.jsx("path",{d:"M 8 -2 l -3.5 -2 v 4 z",className:"fill-text-quaternary"})]}),e.jsx("text",{x:O,y:Y+(c.idx%2===0?14:27),textAnchor:"middle",fontSize:9.5,className:"fill-text-tertiary",fontFamily:"ui-sans-serif, sans-serif",fontWeight:"500",children:we(S)}),D&&e.jsxs("g",{children:[e.jsx("rect",{x:X-V/2,y:me-16,width:V,height:19,rx:3,className:"fill-text-primary",opacity:.88}),e.jsx("text",{x:X,y:me-3,textAnchor:"middle",fontSize:8.5,className:"fill-surface",fontFamily:"ui-monospace, monospace",children:z})]})]},S.role)}),!y&&e.jsx("text",{x:ae+Pe/2,y:Y+48,textAnchor:"middle",fontSize:8.5,className:"fill-text-quaternary",fontFamily:"ui-sans-serif, sans-serif",children:"Set target_per_hour on each role in Admin → Roles to enable the pace chart"}),ue.map(c=>e.jsx("text",{x:Ue+6,y:c.labelY,fontSize:8,fontFamily:"ui-sans-serif, sans-serif",fontWeight:c.key==="actual"?700:500,opacity:c.key==="active"?.85:1,style:{fill:c.color,transition:`y ${I}`},children:c.text},c.key))]})}function vt(t){const s=t.priority_facet?`metadata.${t.priority_facet}`:"created_at",l=JSON.stringify([{field:s,direction:"asc"}]);return`/escalations/available?role=${encodeURIComponent(t.role)}&jeopardy=1&view=table&orderBy=${encodeURIComponent(l)}`}function Ns({role:t,periodHours:s,onOpenEntity:l}){var L,k,$,R,v,H,Q;const i=Ve(s),r=t.entity_facet,[d,n]=g.useState(!1),[,o]=pt(),h=()=>{r&&o(N=>{const q=new URLSearchParams(N);return q.set("lens",r),q})},u=F({query:{roles:[t.role]},groupBy:{columns:["subtype"]},measure:{kind:"dwell",window:i},orderBy:[{field:"dwellSeconds",direction:"desc"}]}),m=F({query:{roles:[t.role]},groupBy:{columns:["subtype"]},measure:{kind:"membership"},orderBy:[{field:"count",direction:"desc"}]}),f=F(r?{query:{roles:[t.role]},groupBy:{},measure:{kind:"membership"},distinctBy:r}:null),j=F(r&&d?{query:{roles:[t.role],exists:[r]},groupBy:{facets:[r]},measure:{kind:"dwell",window:i},orderBy:[{field:"dwellSeconds",direction:"desc"}],limit:8}:null),b=g.useMemo(()=>{var N,q;return ct([...((N=u.data)==null?void 0:N.groups)??[],...((q=m.data)==null?void 0:q.groups)??[]])},[u.data,m.data]);if(Ee(u.error))return e.jsx("div",{className:"border-t border-surface-border/40 pt-4 mt-5",children:e.jsx("p",{className:"text-2xs text-text-quaternary",children:"Analytics require full read access to this station's queue."})});const y=(((L=u.data)==null?void 0:L.groups)??[]).filter(N=>(N.dwellSeconds??0)>0),w=y.reduce((N,q)=>N+(q.dwellSeconds??0),0),C=(((k=m.data)==null?void 0:k.groups)??[]).filter(N=>(N.count??0)>0),M=((R=($=f.data)==null?void 0:$.groups[0])==null?void 0:R.count)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-surface-border/40 pt-4 mt-5",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2.5",children:"Where the time went"}),w>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 flex rounded-full overflow-hidden bg-surface-sunken mb-2.5",children:y.map(N=>e.jsx("div",{style:{width:`${(N.dwellSeconds??0)/w*100}%`,backgroundColor:b.get(ie(N.subtype))}},ie(N.subtype)))}),e.jsx("div",{className:"space-y-1",children:y.map(N=>e.jsxs("div",{className:"flex items-center gap-2 text-2xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:b.get(ie(N.subtype))}}),e.jsx("span",{className:`font-mono truncate flex-1 ${N.subtype?"text-text-secondary":"text-text-tertiary"}`,children:Le(N.subtype)}),e.jsx("span",{className:"font-mono tabular-nums text-text-secondary shrink-0",children:de((N.dwellSeconds??0)*1e3)}),e.jsxs("span",{className:"font-mono tabular-nums text-text-quaternary w-8 text-right shrink-0",children:[Math.round((N.dwellSeconds??0)/w*100),"%"]})]},ie(N.subtype)))}),((v=u.data)==null?void 0:v.overflow)&&e.jsx("p",{className:"text-2xs text-text-quaternary mt-1.5",children:"more groups exist — narrow the window"})]}):e.jsx("p",{className:"text-2xs text-text-quaternary",children:"No tracked time in this window."})]}),e.jsxs("div",{className:"border-t border-surface-border/40 pt-4 mt-5",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2.5",children:"In queue now"}),r&&M!=null&&e.jsxs("button",{onClick:h,className:"group flex items-center gap-1 text-2xs mb-2 text-left",title:`Open the ${r} lens — the whole system, entity-first`,children:[e.jsx("span",{className:"text-xs font-mono font-semibold text-text-primary tabular-nums",children:M})," ",e.jsx("span",{className:"font-mono text-text-tertiary group-hover:text-accent transition-colors",children:r}),e.jsx("span",{className:"text-text-quaternary",children:" in queue"}),e.jsx(zt,{className:"w-3 h-3 text-text-quaternary group-hover:text-accent transition-colors"})]}),C.length>0?e.jsx("div",{className:"space-y-1",children:C.map(N=>e.jsxs("div",{className:"flex items-center gap-2 text-2xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:b.get(ie(N.subtype))}}),e.jsx("span",{className:`font-mono truncate flex-1 ${N.subtype?"text-text-secondary":"text-text-tertiary"}`,children:Le(N.subtype)}),e.jsx("span",{className:"font-mono tabular-nums text-text-primary shrink-0",children:N.count})]},ie(N.subtype)))}):e.jsx("p",{className:"text-2xs text-text-quaternary",children:"Queue clear."}),r&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{onClick:()=>n(N=>!N),className:"flex items-center gap-1 text-2xs text-text-tertiary hover:text-accent transition-colors",children:[d?e.jsx(dt,{className:"w-3 h-3"}):e.jsx(Gt,{className:"w-3 h-3"}),"By entity"]}),d&&(Ee(j.error)?e.jsx("p",{className:"text-2xs text-text-quaternary mt-1.5",children:"Requires full read access to this station's queue."}):e.jsxs("div",{className:"space-y-1 mt-1.5",children:[(((H=j.data)==null?void 0:H.groups)??[]).map(N=>{const q=N.facets[r];return q==null?null:e.jsxs("div",{className:"flex items-center gap-2 text-2xs",children:[e.jsx("span",{className:"font-mono truncate flex-1 text-text-secondary",title:q,children:q}),e.jsx("span",{className:"font-mono tabular-nums text-text-secondary shrink-0",children:de((N.dwellSeconds??0)*1e3)}),e.jsx("button",{className:"icon-link shrink-0",title:"Open timeline",onClick:()=>l(r,q),children:e.jsx(it,{className:"w-3 h-3"})})]},q)}),j.data&&j.data.groups.length===0&&e.jsx("p",{className:"text-2xs text-text-quaternary",children:"No entities in this window."}),((Q=j.data)==null?void 0:Q.overflow)&&e.jsx("p",{className:"text-2xs text-text-quaternary",children:"top 8 by dwell"})]}))]})]})]})}const kt=["15m","1h","24h","7d","30d"],vs=t=>kt.includes(t),ks={"15m":.25,"1h":1,"24h":24,"7d":168,"30d":720};function Ce(t){if(t==null)return"—";if(t<1){const s=Math.round(t*60);return s<=0?"< 1s":`${s}s`}return t<60?`${t.toFixed(0)}m`:`${(t/60).toFixed(1)}h`}function _e({label:t,value:s}){return e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsx("span",{className:"text-2xs text-text-tertiary uppercase tracking-wider",children:t}),e.jsx("span",{className:"text-xs font-mono font-medium text-text-primary tabular-nums",children:s})]})}function $s({period:t,onChange:s}){return e.jsx("div",{className:"flex items-center gap-1 mb-4",children:kt.map(l=>e.jsx("button",{onClick:()=>s(l),className:`px-2 py-0.5 text-2xs font-mono rounded transition-colors ${t===l?"bg-accent/10 text-accent font-semibold":"icon-link"}`,children:l},l))})}function Ss({role:t,globalPeriod:s,scopeFacets:l,onClose:i}){const[r,d]=g.useState(vs(s)?s:"24h"),{data:n}=ot(r,l),o=n==null?void 0:n.stations.find(b=>b.role===t.role),h=t.sla_minutes??void 0,u=t.target_per_hour??void 0,m=t.worker_count??void 0,f=rt(),j=g.useCallback((b,y)=>{f==null||f.setPanel(t.entity_facet?e.jsx(ze,{facetKey:b,value:y,entity:t.entity_facet}):e.jsx(ze,{facetKey:b,value:y,role:t.role}),{key:"entity-timeline",width:420})},[f,t.role,t.entity_facet]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-sm font-bold text-text-primary",children:we(t)}),e.jsx("span",{className:"text-2xs font-mono text-text-secondary",children:t.role})]}),t.description&&e.jsx("p",{className:"text-2xs text-text-tertiary mt-1 line-clamp-2 leading-relaxed",children:t.description})]}),e.jsx("button",{onClick:i,className:"icon-link mt-0.5 shrink-0 ml-2",children:e.jsx(Ht,{className:"w-4 h-4"})})]}),o&&o.priority_count>0&&e.jsxs(ne,{to:vt(t),className:"flex items-center justify-between group mb-4",children:[e.jsxs("span",{className:"text-2xs",style:{color:je},children:[o.priority_count," in jeopardy — pull oldest first"]}),e.jsx(Vt,{className:"w-3 h-3 transition-colors",style:{color:je}})]}),e.jsx($s,{period:r,onChange:d}),(u||h||m)&&e.jsxs("div",{className:"flex items-center gap-6 mb-6 text-2xs border-b border-surface-border/30 pb-5",children:[u&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-mono font-semibold text-text-primary text-sm",children:[u,"/h"]}),e.jsx("div",{className:"text-text-quaternary uppercase tracking-wider text-[8.5px] mt-0.5",children:"target"})]}),h&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-mono font-semibold text-text-primary text-sm",children:[h,"m"]}),e.jsx("div",{className:"text-text-quaternary uppercase tracking-wider text-[8.5px] mt-0.5",children:"SLA"})]}),m&&e.jsxs("div",{children:[e.jsx("div",{className:"font-mono font-semibold text-text-primary text-sm",children:m}),e.jsx("div",{className:"text-text-quaternary uppercase tracking-wider text-[8.5px] mt-0.5",children:"workers"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs text-text-quaternary uppercase tracking-wider mb-2",children:"Wait (queue)"}),e.jsx(_e,{label:"P99",value:Ce((o==null?void 0:o.wait.p99)??null)}),e.jsx(_e,{label:"avg",value:Ce((o==null?void 0:o.wait.avg)??null)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs text-text-quaternary uppercase tracking-wider mb-2",children:"Work (proc.)"}),e.jsx(_e,{label:"P99",value:Ce((o==null?void 0:o.work.p99)??null)}),e.jsx(_e,{label:"avg",value:Ce((o==null?void 0:o.work.avg)??null)})]})]}),h&&e.jsx("div",{className:"border-t border-surface-border/40 pt-4 mt-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-2xs text-text-tertiary",children:"SLA target"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[h,"m"]})]})}),e.jsx(Ns,{role:t,periodHours:ks[r],onOpenEntity:j})]})}function Ms({allMetrics:t,orderedRoles:s,period:l}){const i=t.reduce((u,m)=>u+m.pending,0),r=t.reduce((u,m)=>u+m.resolved,0),d=t.reduce((u,m)=>u+m.priority_count,0),n=new Map(t.map(u=>[u.role,u])),o=t.filter(u=>u.priority_count>0).length,h=t.filter(u=>u.pending>0).length;return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-2xs text-text-quaternary uppercase tracking-wider mb-3",children:["Pipeline · ",l]}),e.jsx("div",{className:"mb-4",children:o>0?e.jsxs("p",{className:"text-2xs",style:{color:je},children:[o," role",o>1?"s":""," with items in jeopardy"]}):h>0?e.jsxs("p",{className:"text-2xs text-status-warning",children:[h," role",h>1?"s":""," with backlog"]}):r>0?e.jsx("p",{className:"text-2xs text-status-success",children:"Flowing — queue clear"}):e.jsx("p",{className:"text-2xs text-text-quaternary",children:"Quiet — awaiting work"})}),e.jsxs("div",{className:"space-y-1.5 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider",children:"Pending"}),e.jsx("span",{className:`text-xs font-mono tabular-nums ${i>0?"text-text-primary font-semibold":"text-text-quaternary"}`,children:i})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider",children:["Resolved · ",l]}),e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-secondary",children:r})]}),d>0&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider",children:"Priority"}),e.jsx("span",{className:"text-xs font-mono tabular-nums font-semibold",style:{color:je},children:d})]})]}),e.jsx("div",{className:"border-t border-surface-border/40 pt-2 mb-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider flex-1",children:"Role"}),e.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider w-8 text-right shrink-0",children:"pend"}),e.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider w-8 text-right shrink-0",children:"clmd"}),e.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider w-8 text-right shrink-0",children:"res"})]})}),e.jsx("div",{className:"space-y-0.5",children:s.map(u=>{const m=n.get(u.role),f=(m==null?void 0:m.pending)??0,j=(m==null?void 0:m.claimed)??0,b=(m==null?void 0:m.resolved)??0,y=(m==null?void 0:m.priority_count)??0,w=u.title||u.role,C=y>0,M=f>0;return e.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[e.jsx("span",{className:`text-2xs font-mono flex-1 truncate ${M?"text-text-primary":"text-text-quaternary"}`,title:w,children:w}),e.jsx("span",{className:"text-[0.625rem] leading-none font-semibold tabular-nums w-4 text-right shrink-0",style:{color:je},title:C?`${y} priority — pull oldest first`:void 0,children:C?y:""}),e.jsx("span",{className:`text-2xs font-mono tabular-nums w-8 text-right shrink-0 ${M?"text-text-primary font-semibold":"text-text-quaternary"}`,children:f>0?f:"—"}),e.jsx("span",{className:`text-2xs font-mono tabular-nums w-8 text-right shrink-0 ${j>0?"text-accent font-semibold":"text-text-quaternary"}`,children:j>0?j:"—"}),e.jsx("span",{className:`text-2xs font-mono tabular-nums w-8 text-right shrink-0 ${b>0?"text-text-secondary":"text-text-quaternary"}`,children:b>0?b:"—"})]},u.role)})}),e.jsx("p",{className:"text-2xs text-text-quaternary mt-5",children:"Select a station for queue detail."})]})}function qs({role:t,allMetrics:s,orderedRoles:l,globalPeriod:i,scopeFacets:r,mixGroups:d,onClose:n}){return e.jsx("div",{className:"w-[280px] shrink-0 px-7 py-10 flex flex-col overflow-y-auto min-h-0",children:t?e.jsx(Ss,{role:t,globalPeriod:i,scopeFacets:r,onClose:n}):e.jsxs(e.Fragment,{children:[e.jsx(Ms,{allMetrics:s,orderedRoles:l,period:i}),e.jsx(Cs,{mixGroups:d,orderedRoles:l})]})})}function Cs({mixGroups:t,orderedRoles:s}){const l=new Set(s.map(o=>o.role)),i=(t??[]).filter(o=>o.role&&l.has(o.role)&&(o.dwellSeconds??0)>0);if(i.length===0)return null;const r=new Map(s.map(o=>[o.role,o.title||o.role])),d=et(i,o=>o.role),n=et(i,o=>Le(o.subtype));return e.jsxs(e.Fragment,{children:[e.jsx(tt,{label:"Time by station",entries:d,display:o=>r.get(o)??o}),e.jsx(tt,{label:"Time by subtype",entries:n,display:o=>o})]})}function et(t,s){const l=new Map;for(const i of t){const r=s(i);l.set(r,(l.get(r)??0)+(i.dwellSeconds??0))}return[...l.entries()].sort(([,i],[,r])=>r-i)}function tt({label:t,entries:s,display:l}){const i=lt(s.map(([d,n])=>({label:d,weight:n}))),r=s.reduce((d,[,n])=>d+n,0)||1;return e.jsxs("div",{className:"border-t border-surface-border/40 pt-4 mt-5",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2.5",children:t}),e.jsx("div",{className:"h-2 flex rounded-full overflow-hidden bg-surface-sunken mb-2",children:s.map(([d,n])=>e.jsx("div",{style:{width:`${n/r*100}%`,backgroundColor:i.get(d)}},d))}),e.jsxs("div",{className:"space-y-0.5",children:[s.slice(0,6).map(([d,n])=>e.jsxs("div",{className:"flex items-center gap-2 text-2xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:i.get(d)}}),e.jsx("span",{className:"font-mono text-text-secondary truncate flex-1",children:l(d)}),e.jsx("span",{className:"font-mono tabular-nums text-text-tertiary shrink-0",children:de(n*1e3)}),e.jsxs("span",{className:"font-mono tabular-nums text-text-quaternary w-8 text-right shrink-0",children:[Math.round(n/r*100),"%"]})]},d)),s.length>6&&e.jsxs("p",{className:"text-2xs text-text-quaternary",children:["+",s.length-6," more"]})]})]})}const _s=oe,Ae=Fe(oe,.12),$t=Ae,St=Ae,Mt=Fe(ge,.24),qt=Fe(re,.24),Ct=Fe(J,.24),st=["15m","1h","24h","7d","30d"],Re={"15m":.25,"1h":1,"24h":24,"7d":168,"30d":720};function He(t){const s=t.filter(n=>n.ops_visible),l=new Map(s.map(n=>[n.role,n])),i=new Set,d=s.filter(n=>!n.parent_role||!l.has(n.parent_role)).map(n=>{const o=[],h=[{role:n,depth:0}];for(;h.length>0;){const u=h.shift();i.has(u.role.role)||(i.add(u.role.role),o.push(u),s.filter(m=>m.parent_role===u.role.role&&!i.has(m.role)).forEach(m=>h.push({role:m,depth:u.depth+1})))}return{origin:n,stations:o}});return s.filter(n=>!i.has(n.role)).forEach(n=>d.push({origin:n,stations:[{role:n,depth:0}]})),d.sort((n,o)=>o.stations.length-n.stations.length||n.origin.role.localeCompare(o.origin.role))}function nt(t){if(t==null)return"—";if(t<1){const s=Math.round(t*60);return s<=0?"< 1s":`${s}s`}return t<60?`${t.toFixed(0)}m`:`${(t/60).toFixed(1)}h`}function Rs(t,s){if(!s||t===0)return{pct:null,color:"bg-surface-border"};const l=t/s,i=Math.round(l*100),r=l>1?"bg-status-warning":l<.2?"bg-status-draft":"bg-status-success";return{pct:i,color:r}}function at({value:t,onSave:s}){const[l,i]=g.useState(t!=null?String(t):""),r=g.useRef(void 0),d=n=>{const o=parseInt(n,10);s(!n.trim()||isNaN(o)||o<0?null:o)};return e.jsx("input",{type:"number",min:0,step:1,value:l,onChange:n=>{const o=n.target.value;i(o),clearTimeout(r.current),r.current=setTimeout(()=>d(o),400)},onBlur:n=>{clearTimeout(r.current),d(n.target.value)},onClick:n=>n.stopPropagation(),onKeyDown:n=>n.stopPropagation(),className:"w-full bg-transparent text-xs font-mono tabular-nums text-right focus:outline-none"})}function Ps({role:t,metric:s,mixGroups:l,mixColors:i,selected:r,periodHours:d,onClick:n}){var R;const o=It(),{isBuilder:h,isOps:u}=Tt(),m=(s==null?void 0:s.pending)??0,f=(s==null?void 0:s.claimed)??0,j=(s==null?void 0:s.resolved)??0,b=(s==null?void 0:s.priority_count)??0,y=t.target_per_hour??null,{pct:w,color:C}=Rs(m,y),M=w!=null?Math.min(100,w):0,L=Es(t.target_per_hour??null,t.sla_minutes??null,m,d),k=v=>o.mutate({role:t.role,target_per_hour:v}),$=v=>o.mutate({role:t.role,sla_minutes:v});return e.jsxs("tr",{tabIndex:0,onClick:n,onKeyDown:v=>{v.key==="Enter"&&n()},className:`cursor-pointer border-b border-surface-border/30 last:border-b-0 transition-colors ${r?"border-l-2 !border-l-accent":""}`,children:[e.jsx("td",{className:"pl-3 pr-2 py-1.5 overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"font-bold text-text-primary truncate text-xs",children:we(t)}),(((R=t.upstream_roles)==null?void 0:R.length)??0)>0&&e.jsx("span",{title:`Fed by ${t.upstream_roles.join(", ")}`,className:"shrink-0 leading-none",children:e.jsx(Qt,{className:"w-3 h-3 text-text-quaternary"})})]})}),e.jsx("td",{className:"hidden xl:table-cell pr-2 py-1.5 overflow-hidden",children:e.jsx("span",{className:"block font-mono text-2xs text-text-tertiary truncate",children:t.role})}),e.jsx("td",{className:"px-2 py-1.5",style:{backgroundColor:Ae},children:e.jsx(at,{value:t.target_per_hour??null,onSave:k})}),e.jsx("td",{className:"px-2 py-1.5",style:{backgroundColor:$t},children:e.jsx(at,{value:t.sla_minutes??null,onSave:$})}),e.jsx("td",{className:"px-2 py-1.5 text-right",style:{backgroundColor:St},title:L!=null?`~${L} concurrent worker${L===1?"":"s"} to sustain ${t.target_per_hour}/h within ${t.sla_minutes}m SLA`:void 0,children:e.jsx("span",{className:`text-xs font-mono tabular-nums ${L!=null?"":"text-text-quaternary"}`,children:L??"—"})}),e.jsx("td",{className:"px-2 py-1.5 text-right",style:{backgroundColor:Mt},children:e.jsx(ne,{to:`/escalations/available?role=${encodeURIComponent(t.role)}&status=available`,className:`text-xs font-mono tabular-nums hover:underline ${m>0?"text-text-primary font-semibold":"text-text-quaternary"}`,onClick:v=>v.stopPropagation(),children:m})}),e.jsx("td",{className:"px-2 py-1.5 text-right",style:{backgroundColor:qt},children:e.jsx(ne,{to:`/escalations/available?role=${encodeURIComponent(t.role)}&status=claimed`,className:`text-xs font-mono tabular-nums hover:underline ${f>0?"font-semibold":"text-text-quaternary"}`,style:f>0?{color:re}:void 0,onClick:v=>v.stopPropagation(),children:f})}),e.jsx("td",{className:"px-2 py-1.5 text-right",style:{backgroundColor:Ct},children:e.jsx(ne,{to:`/escalations/available?role=${encodeURIComponent(t.role)}&status=resolved`,className:`text-xs font-mono tabular-nums hover:underline ${j>0?"text-text-secondary":"text-text-quaternary"}`,style:j>0?{color:J}:void 0,onClick:v=>v.stopPropagation(),children:j})}),e.jsx("td",{className:"hidden xl:table-cell px-2 py-1.5 text-right",children:e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-secondary",children:nt((s==null?void 0:s.wait.p99)??null)})}),e.jsx("td",{className:"hidden xl:table-cell px-2 py-1.5 text-right",children:e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-secondary",children:nt((s==null?void 0:s.work.p99)??null)})}),e.jsx("td",{className:"hidden lg:table-cell px-2 py-1.5",children:e.jsx(Kt,{groups:l,colors:i})}),e.jsx("td",{className:"hidden lg:table-cell px-2 py-1.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-12 h-1.5 bg-surface-sunken rounded-full overflow-hidden shrink-0",children:e.jsx("div",{className:`h-full rounded-full ${C}`,style:{width:`${M}%`}})}),e.jsx("span",{className:`text-2xs font-mono tabular-nums ${w!=null&&w>100?"text-status-warning font-semibold":"text-text-quaternary"}`,children:w!=null?`${w}%`:"—"})]})}),e.jsx("td",{className:"py-1.5",children:e.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[e.jsx(ne,{to:`/escalations/available?role=${encodeURIComponent(t.role)}&status=all`,className:"icon-link",title:"View all items in queue",onClick:v=>v.stopPropagation(),children:e.jsx(ut,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"w-3.5 flex items-center justify-center",children:(h||u)&&e.jsx(ne,{to:`/admin/roles/${encodeURIComponent(t.role)}?section=pace-board`,className:"icon-link",title:"Configure this role",onClick:v=>v.stopPropagation(),children:e.jsx(Xt,{className:"w-3.5 h-3.5"})})}),e.jsx("span",{className:"w-3.5 flex items-center justify-center",children:b>0&&e.jsx(ne,{to:vt(t),className:"text-status-error hover:opacity-70 transition-opacity",title:`${b} item${b===1?"":"s"} in jeopardy — pull oldest first`,onClick:v=>v.stopPropagation(),children:e.jsx(xt,{className:"w-3.5 h-3.5",strokeWidth:2})})})]})})]})}const Ls=[{label:"TARGET/H",band:Ae,hue:oe,w:"w-[8%]"},{label:"SLA/M",band:$t,hue:_s,w:"w-[7%]"},{label:"WORKERS",band:St,hue:oe,w:"w-[8%]"},{label:"PENDING",band:Mt,hue:ge,w:"w-[8%]"},{label:"CLAIMED",band:qt,hue:re,w:"w-[8%]"},{label:"RESOLVED",band:Ct,hue:J,w:"w-[8%]"}];function Es(t,s,l,i){if(!t||!s)return null;const r=t*s/60,d=l>0?l*s/(60*i):0;return Math.ceil(r+d)}const se="sticky top-0 z-10 bg-surface border-b border-surface-border py-1.5 text-2xs font-semibold uppercase tracking-wider whitespace-nowrap";function Os(){return e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:`${se} pl-3 pr-2 text-left text-text-quaternary`,children:"NAME"}),e.jsx("th",{className:`${se} hidden xl:table-cell w-[12%] pr-2 text-left text-text-quaternary`,children:"ROLE"}),Ls.map(t=>e.jsx("th",{className:`${se} ${t.w} px-2 text-right`,style:{color:t.hue,backgroundImage:`linear-gradient(${t.band}, ${t.band})`},children:t.label},t.label)),e.jsx("th",{className:`${se} hidden xl:table-cell w-[8%] px-2 text-right text-text-quaternary`,children:"P99 WAIT"}),e.jsx("th",{className:`${se} hidden xl:table-cell w-[8%] px-2 text-right text-text-quaternary`,children:"P99 WORK"}),e.jsx("th",{className:`${se} hidden lg:table-cell w-[10%] px-2 text-left text-text-quaternary`,children:"MIX"}),e.jsx("th",{className:`${se} hidden lg:table-cell w-[11%] px-2 text-left text-text-quaternary`,children:"TREND"}),e.jsx("th",{className:`${se} w-20 px-1 text-center text-text-quaternary`,children:"ACTIONS"})]})})}function Bs(){var be;const[t,s]=g.useState(null),[l,i]=g.useState(!1),[r,d]=g.useState(!0);Et(),Ot();const{data:n,isLoading:o,refetch:h}=Bt(),{declarations:u,values:m}=Ft(),f=g.useMemo(()=>Object.keys(m).length?m:void 0,[m]),[j,b]=g.useState(!1),[y,w]=pt(),C=Zt(),M=mt(),L=C.pathname==="/trends",k=y.get("period"),$=st.includes(k)?k:"1h",R=g.useCallback(x=>{w(a=>{const p=new URLSearchParams(a);return x==="1h"?p.delete("period"):p.set("period",x),p})},[w]),{data:v,isLoading:H,refetch:Q}=ot($,f),N=(n==null?void 0:n.roles)??[],q=(v==null?void 0:v.stations)??[],le=g.useMemo(()=>{const x=new Map(q.map(p=>[p.role,p])),a=new Map;for(const p of He((n==null?void 0:n.roles)??[])){let G=0,Qe=0;for(const _t of p.stations){const he=x.get(_t.role.role);G+=(he==null?void 0:he.pending)??0,Qe+=(he==null?void 0:he.priority_count)??0}a.set(p.origin.role,{stations:p.stations.length,pending:G,jeopardy:Qe})}return a},[q,n]),E=g.useMemo(()=>He(N),[N]),xe=y.get("fragment"),A=E.find(x=>x.origin.role===xe)??E[0]??null,K=g.useCallback(x=>{s(null);const a=new URLSearchParams;x&&a.set("fragment",x),$!=="1h"&&a.set("period",$);const p=a.toString();M(p?`/pace?${p}`:"/pace")},[M,$]),P=(A==null?void 0:A.stations)??[],ce=g.useMemo(()=>new Set(P.map(({role:x})=>x.role)),[P]),_=Ve(Re[$]),ee=g.useMemo(()=>P.map(({role:x})=>x.role),[P]),{data:T}=F(ee.length?{query:{roles:ee,...f?{facets:f}:{}},groupBy:{columns:["role","subtype"]},measure:{kind:"dwell",window:_}}:null),te=g.useMemo(()=>{const x=new Map;for(const a of(T==null?void 0:T.groups)??[]){if(!a.role)continue;const p=x.get(a.role)??[];p.push(a),x.set(a.role,p)}return x},[T]),ue=g.useMemo(()=>{const x=new Map;for(const[a,p]of te)x.set(a,ct(p));return x},[te]),c=g.useMemo(()=>new Map,[]),S=g.useMemo(()=>q.filter(x=>ce.has(x.role)),[q,ce]),O=g.useMemo(()=>P.map(({role:x})=>({role:x.role,title:x.title,parent_role:x.parent_role,target_per_hour:x.target_per_hour??null,upstream_roles:x.upstream_roles??[],metric:q.find(a=>a.role===x.role)})),[P,q]),W=g.useCallback(x=>{const a=E.find(p=>p.stations.some(({role:G})=>G.role===x));a&&K(a.origin.role)},[E,K]),B=((be=P.find(({role:x})=>x.role===t))==null?void 0:be.role)??null,U=g.useMemo(()=>{const x=new Set;for(const a of N)a.ops_visible&&a.entity_facet&&x.add(a.entity_facet);return[...x].sort()},[N]),D=y.get("lens"),z=L?D&&U.includes(D)?D:U[0]??null:null,V=g.useCallback(x=>{s(null);const a=new URLSearchParams;x&&a.set("lens",x),$!=="1h"&&a.set("period",$);const p=a.toString();M(p?`/trends?${p}`:"/trends")},[M,$]),X=y.get("entity"),me=y.get("find"),pe=g.useCallback(x=>{w(a=>{const p=new URLSearchParams(a);return x?p.set("entity",x):p.delete("entity"),p})},[w]),Z=g.useCallback(x=>{w(a=>{const p=new URLSearchParams(a);return x?p.set("find",x):p.delete("find"),p},{replace:!0})},[w]),Ne=y.get("slice"),ve=y.get("sliceValue"),ke=g.useCallback(x=>{w(a=>{const p=new URLSearchParams(a);return x?p.set("slice",x):p.delete("slice"),p.delete("sliceValue"),p})},[w]),Ie=g.useCallback(x=>{w(a=>{const p=new URLSearchParams(a);return x?p.set("sliceValue",x):p.delete("sliceValue"),p})},[w]),Te=o||H,We=async()=>{i(!0),await Promise.all([h(),Q()]),i(!1)},ye=x=>s(a=>a===x?null:x),$e=g.useMemo(()=>E.map(x=>{const a=le.get(x.origin.role);return{origin:x.origin.role,title:we(x.origin),roleCount:(a==null?void 0:a.stations)??x.stations.length,pending:(a==null?void 0:a.pending)??0,jeopardy:(a==null?void 0:a.jeopardy)??0}}),[E,le]),Se=e.jsx("div",{className:"flex items-center gap-0.5",children:st.map(x=>e.jsx("button",{onClick:()=>R(x),className:`px-2.5 py-1 text-2xs font-mono rounded transition-colors ${$===x?"bg-accent/10 text-accent font-semibold":"icon-link"}`,children:x},x))});return e.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[e.jsx(Jt,{title:z?"Trend Board":"Pace Board",docsHash:"#docs:dashboard.md:pace-board",center:Se,actions:e.jsxs("div",{className:"flex items-center gap-3",children:[u.length>0&&e.jsxs("button",{onClick:()=>b(!0),title:"Scope this board — bind facets for this device","data-testid":"board-scope-pill",className:`flex items-center gap-1.5 px-2 py-0.5 text-2xs rounded-full border transition-colors ${f?"border-accent/40 bg-accent/10 text-accent hover:bg-accent/15":"border-surface-border bg-surface-sunken text-text-tertiary hover:text-text-secondary"}`,children:[e.jsx(ut,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"truncate max-w-48 font-mono",children:f?Object.entries(m).map(([x,a])=>`${x} = ${a}`).join(", "):"All"})]}),e.jsx("button",{onClick:We,disabled:l,className:"icon-link disabled:opacity-40",children:e.jsx(Yt,{className:`w-3.5 h-3.5 ${l?"animate-spin":""}`})})]})}),Te?e.jsxs("div",{className:"animate-pulse space-y-6 mt-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-64 bg-surface-sunken rounded w-full"}),e.jsx("div",{className:"space-y-3",children:[1,2,3].map(x=>e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-full"},x))})]}):E.length===0?e.jsxs("div",{className:"mt-8",children:[e.jsx("p",{className:"text-sm text-text-secondary mb-2",children:"Roles appear here once they are marked visible in Operations."}),e.jsxs("p",{className:"text-xs text-text-tertiary",children:["Go to"," ",e.jsx(ne,{to:"/admin/roles",className:"text-accent hover:underline",children:"Roles"})," ","and enable ",e.jsx("strong",{children:"Visible in Operations"})," on the roles that belong to a pace segment."]})]}):e.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[(E.length>1||U.length>0)&&e.jsx("div",{className:"flex items-end justify-end",children:e.jsx("div",{className:"px-4 pt-2 pb-0.5",children:e.jsx(xs,{fragments:$e,activeFragment:(A==null?void 0:A.origin.role)??null,lenses:U,activeLens:z,onSelectFragment:K,onSelectLens:V})})}),z?e.jsx(ds,{entityKey:z,periodHours:Re[$],roles:N,scopeFacets:f,find:me,onFindChange:Z,entityValue:X,onEntityChange:pe,sliceKey:Ne,onSliceKeyChange:ke,sliceValue:ve,onSliceValueChange:Ie},z):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 min-h-[40vh] flex items-stretch overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden px-2 py-4",children:[e.jsx("div",{className:"flex items-center justify-center gap-0.5 pb-2 shrink-0",children:["lin","log"].map(x=>e.jsx("button",{onClick:()=>d(x==="log"),className:`px-2 py-0.5 text-2xs font-mono rounded transition-colors ${(r?"log":"lin")===x?"text-accent font-semibold":"icon-link"}`,title:x==="lin"?"Linear Y axis":"Logarithmic Y axis — reveals shape across wide value ranges",children:x},x))}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col justify-center overflow-hidden",children:e.jsx(ws,{stations:O,selectedRole:t,onSelect:ye,onUpstreamSelect:W,onCmdClick:x=>M(`/escalations/available?role=${encodeURIComponent(x)}`),periodHours:Re[$],logScale:r})})]}),e.jsx("div",{className:"w-px bg-surface-border shrink-0 self-stretch"}),e.jsx(qs,{role:B,allMetrics:S,orderedRoles:P.map(x=>x.role),globalPeriod:$,scopeFacets:f,mixGroups:T==null?void 0:T.groups,onClose:()=>s(null)})]}),e.jsx("div",{className:"max-h-[30vh] flex-none overflow-y-auto border-t border-surface-border",children:e.jsxs("table",{className:"w-full table-fixed",children:[e.jsx(Os,{}),e.jsx("tbody",{children:P.map(({role:x})=>e.jsx(Ps,{role:x,metric:q.find(a=>a.role===x.role),mixGroups:te.get(x.role),mixColors:ue.get(x.role)??c,selected:t===x.role,periodHours:Re[$],onClick:()=>ye(x.role)},x.role))})]})})]})]}),e.jsx(At,{open:j,onClose:()=>b(!1)})]})}const Us=Object.freeze(Object.defineProperty({__proto__:null,OperationsPage:Bs,buildFragments:He},Symbol.toStringTag,{value:"Module"}));export{Us as O,ws as P,He as b,vt as j};
3
- //# sourceMappingURL=OperationsPage-Dxk1fAMg.js.map
3
+ //# sourceMappingURL=OperationsPage-aLHHAP2X.js.map