@hotmeshio/long-tail 0.25.2 → 0.25.4

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 (200) hide show
  1. package/build/routes/oauth-server/authorize.js +4 -4
  2. package/build/services/auth/oauth-server/authorization.d.ts +5 -0
  3. package/build/services/auth/oauth-server/authorization.js +8 -0
  4. package/build/services/auth/oauth-server/metadata.d.ts +1 -1
  5. package/build/services/auth/oauth-server/metadata.js +2 -1
  6. package/dashboard/dist/assets/{AdminDashboard-B8MqNLiB.js → AdminDashboard-DlItqxFS.js} +2 -2
  7. package/dashboard/dist/assets/{AdminDashboard-B8MqNLiB.js.map → AdminDashboard-DlItqxFS.js.map} +1 -1
  8. package/dashboard/dist/assets/{AgentConfigPage-Yg81Eiuo.js → AgentConfigPage-BUmT4a7n.js} +2 -2
  9. package/dashboard/dist/assets/{AgentConfigPage-Yg81Eiuo.js.map → AgentConfigPage-BUmT4a7n.js.map} +1 -1
  10. package/dashboard/dist/assets/{AgentDetailPage-ZUGYEONO.js → AgentDetailPage-Cww8rlBi.js} +3 -3
  11. package/dashboard/dist/assets/{AgentDetailPage-ZUGYEONO.js.map → AgentDetailPage-Cww8rlBi.js.map} +1 -1
  12. package/dashboard/dist/assets/AgentsPage-C9UuUKhr.js +2 -0
  13. package/dashboard/dist/assets/{AgentsPage-CZIWMwak.js.map → AgentsPage-C9UuUKhr.js.map} +1 -1
  14. package/dashboard/dist/assets/{AvailableEscalationsPage-BVtpc4xO.js → AvailableEscalationsPage-DrvfXz70.js} +2 -2
  15. package/dashboard/dist/assets/{AvailableEscalationsPage-BVtpc4xO.js.map → AvailableEscalationsPage-DrvfXz70.js.map} +1 -1
  16. package/dashboard/dist/assets/{BotPicker-8bf0yOCT.js → BotPicker-CDq9XRMp.js} +2 -2
  17. package/dashboard/dist/assets/{BotPicker-8bf0yOCT.js.map → BotPicker-CDq9XRMp.js.map} +1 -1
  18. package/dashboard/dist/assets/{BulkAssignModal-B2lr1J6P.js → BulkAssignModal-jsvqtrEA.js} +2 -2
  19. package/dashboard/dist/assets/{BulkAssignModal-B2lr1J6P.js.map → BulkAssignModal-jsvqtrEA.js.map} +1 -1
  20. package/dashboard/dist/assets/{CapabilitiesPage-BQQBR2sj.js → CapabilitiesPage-CSCrI6B1.js} +2 -2
  21. package/dashboard/dist/assets/{CapabilitiesPage-BQQBR2sj.js.map → CapabilitiesPage-CSCrI6B1.js.map} +1 -1
  22. package/dashboard/dist/assets/{CollapsibleSection-DFW8TYyU.js → CollapsibleSection-uD9mn-CQ.js} +2 -2
  23. package/dashboard/dist/assets/{CollapsibleSection-DFW8TYyU.js.map → CollapsibleSection-uD9mn-CQ.js.map} +1 -1
  24. package/dashboard/dist/assets/{ConfirmDeleteModal-DGlOlQAo.js → ConfirmDeleteModal-BRmx2hA4.js} +2 -2
  25. package/dashboard/dist/assets/{ConfirmDeleteModal-DGlOlQAo.js.map → ConfirmDeleteModal-BRmx2hA4.js.map} +1 -1
  26. package/dashboard/dist/assets/{ConnectedAppsPage-CIM9gzHj.js → ConnectedAppsPage-DlMzE5a-.js} +2 -2
  27. package/dashboard/dist/assets/{ConnectedAppsPage-CIM9gzHj.js.map → ConnectedAppsPage-DlMzE5a-.js.map} +1 -1
  28. package/dashboard/dist/assets/{CountdownTimer-BD_iWm6S.js → CountdownTimer-sRuM4eM5.js} +2 -2
  29. package/dashboard/dist/assets/{CountdownTimer-BD_iWm6S.js.map → CountdownTimer-sRuM4eM5.js.map} +1 -1
  30. package/dashboard/dist/assets/{CredentialsPage-CTtUkvoD.js → CredentialsPage-bLYydwqa.js} +2 -2
  31. package/dashboard/dist/assets/{CredentialsPage-CTtUkvoD.js.map → CredentialsPage-bLYydwqa.js.map} +1 -1
  32. package/dashboard/dist/assets/{CronLabel-rZMptkYQ.js → CronLabel-D_ATDL2N.js} +2 -2
  33. package/dashboard/dist/assets/{CronLabel-rZMptkYQ.js.map → CronLabel-D_ATDL2N.js.map} +1 -1
  34. package/dashboard/dist/assets/{ElapsedCell-CmK9gHC5.js → ElapsedCell-groSMfqB.js} +2 -2
  35. package/dashboard/dist/assets/{ElapsedCell-CmK9gHC5.js.map → ElapsedCell-groSMfqB.js.map} +1 -1
  36. package/dashboard/dist/assets/{EntityTimelinePanel-Cfg0EMZs.js → EntityTimelinePanel-D-F3_A9m.js} +2 -2
  37. package/dashboard/dist/assets/{EntityTimelinePanel-Cfg0EMZs.js.map → EntityTimelinePanel-D-F3_A9m.js.map} +1 -1
  38. package/dashboard/dist/assets/{EscalationListSchemaPage-CPcbC1-9.js → EscalationListSchemaPage-Bad6Jrmr.js} +2 -2
  39. package/dashboard/dist/assets/{EscalationListSchemaPage-CPcbC1-9.js.map → EscalationListSchemaPage-Bad6Jrmr.js.map} +1 -1
  40. package/dashboard/dist/assets/{EscalationSchemaPage-BsYdNVN7.js → EscalationSchemaPage-BKi_npI9.js} +2 -2
  41. package/dashboard/dist/assets/{EscalationSchemaPage-BsYdNVN7.js.map → EscalationSchemaPage-BKi_npI9.js.map} +1 -1
  42. package/dashboard/dist/assets/{EscalationTimeline-D1enxZDs.js → EscalationTimeline-DQUUm3b1.js} +2 -2
  43. package/dashboard/dist/assets/{EscalationTimeline-D1enxZDs.js.map → EscalationTimeline-DQUUm3b1.js.map} +1 -1
  44. package/dashboard/dist/assets/{EscalationTitleSelect-DwqhnPKX.js → EscalationTitleSelect-3mhXh77a.js} +2 -2
  45. package/dashboard/dist/assets/{EscalationTitleSelect-DwqhnPKX.js.map → EscalationTitleSelect-3mhXh77a.js.map} +1 -1
  46. package/dashboard/dist/assets/{EscalationsOverview-ChuKh02E.js → EscalationsOverview-Qaov-uML.js} +2 -2
  47. package/dashboard/dist/assets/{EscalationsOverview-ChuKh02E.js.map → EscalationsOverview-Qaov-uML.js.map} +1 -1
  48. package/dashboard/dist/assets/{EventTable-GqZIKPce.js → EventTable-V4RF_n58.js} +2 -2
  49. package/dashboard/dist/assets/{EventTable-GqZIKPce.js.map → EventTable-V4RF_n58.js.map} +1 -1
  50. package/dashboard/dist/assets/{FilterBar-CqPFZkVU.js → FilterBar-BygWrnB1.js} +2 -2
  51. package/dashboard/dist/assets/{FilterBar-CqPFZkVU.js.map → FilterBar-BygWrnB1.js.map} +1 -1
  52. package/dashboard/dist/assets/{GraphInvokePage-_fB7mtBU.js → GraphInvokePage-Djslhf96.js} +2 -2
  53. package/dashboard/dist/assets/{GraphInvokePage-_fB7mtBU.js.map → GraphInvokePage-Djslhf96.js.map} +1 -1
  54. package/dashboard/dist/assets/{HomePage-BXA0Cz0F.js → HomePage-EjcNxlKx.js} +2 -2
  55. package/dashboard/dist/assets/{HomePage-BXA0Cz0F.js.map → HomePage-EjcNxlKx.js.map} +1 -1
  56. package/dashboard/dist/assets/{ListToolbar-Bf4DFITI.js → ListToolbar-RrEAePOX.js} +2 -2
  57. package/dashboard/dist/assets/{ListToolbar-Bf4DFITI.js.map → ListToolbar-RrEAePOX.js.map} +1 -1
  58. package/dashboard/dist/assets/{McpOverview-H61XQRji.js → McpOverview-8gqiL3Vj.js} +2 -2
  59. package/dashboard/dist/assets/{McpOverview-H61XQRji.js.map → McpOverview-8gqiL3Vj.js.map} +1 -1
  60. package/dashboard/dist/assets/{McpQueryDetailPage-wbwK8WWq.js → McpQueryDetailPage-COyn6Ak5.js} +2 -2
  61. package/dashboard/dist/assets/{McpQueryDetailPage-wbwK8WWq.js.map → McpQueryDetailPage-COyn6Ak5.js.map} +1 -1
  62. package/dashboard/dist/assets/{McpQueryPage-CYvVEk3G.js → McpQueryPage-Dj6Qj72w.js} +2 -2
  63. package/dashboard/dist/assets/{McpQueryPage-CYvVEk3G.js.map → McpQueryPage-Dj6Qj72w.js.map} +1 -1
  64. package/dashboard/dist/assets/{McpRunDetailPage-TZBX68i4.js → McpRunDetailPage-80fQn9iX.js} +2 -2
  65. package/dashboard/dist/assets/{McpRunDetailPage-TZBX68i4.js.map → McpRunDetailPage-80fQn9iX.js.map} +1 -1
  66. package/dashboard/dist/assets/{McpRunsPage-Cu91Mh52.js → McpRunsPage-DaSsI-EM.js} +2 -2
  67. package/dashboard/dist/assets/{McpRunsPage-Cu91Mh52.js.map → McpRunsPage-DaSsI-EM.js.map} +1 -1
  68. package/dashboard/dist/assets/{OperationsPage-D-6sKw6y.js → OperationsPage-BSu1o2gB.js} +2 -2
  69. package/dashboard/dist/assets/{OperationsPage-D-6sKw6y.js.map → OperationsPage-BSu1o2gB.js.map} +1 -1
  70. package/dashboard/dist/assets/{OperatorDashboard-DD8JUU3L.js → OperatorDashboard-HFI4WGIV.js} +2 -2
  71. package/dashboard/dist/assets/{OperatorDashboard-DD8JUU3L.js.map → OperatorDashboard-HFI4WGIV.js.map} +1 -1
  72. package/dashboard/dist/assets/{PersonaDetailPage-CGri6okV.js → PersonaDetailPage-D0qlBuGi.js} +2 -2
  73. package/dashboard/dist/assets/{PersonaDetailPage-CGri6okV.js.map → PersonaDetailPage-D0qlBuGi.js.map} +1 -1
  74. package/dashboard/dist/assets/{PersonasPage-DtHW6-Qx.js → PersonasPage-BJClu-5H.js} +2 -2
  75. package/dashboard/dist/assets/{PersonasPage-DtHW6-Qx.js.map → PersonasPage-BJClu-5H.js.map} +1 -1
  76. package/dashboard/dist/assets/{PortalPage-Dgbk_mzr.js → PortalPage-CucNZn_w.js} +2 -2
  77. package/dashboard/dist/assets/{PortalPage-Dgbk_mzr.js.map → PortalPage-CucNZn_w.js.map} +1 -1
  78. package/dashboard/dist/assets/{ProcessDetailPage-BdkacBrD.js → ProcessDetailPage-B9wMw0RV.js} +2 -2
  79. package/dashboard/dist/assets/{ProcessDetailPage-BdkacBrD.js.map → ProcessDetailPage-B9wMw0RV.js.map} +1 -1
  80. package/dashboard/dist/assets/{ProcessesListPage-DO5A-OfZ.js → ProcessesListPage-B6k4RpmR.js} +2 -2
  81. package/dashboard/dist/assets/{ProcessesListPage-DO5A-OfZ.js.map → ProcessesListPage-B6k4RpmR.js.map} +1 -1
  82. package/dashboard/dist/assets/{ResolverForm-CqGE5lf-.js → ResolverForm-ZVufJ4G-.js} +2 -2
  83. package/dashboard/dist/assets/{ResolverForm-CqGE5lf-.js.map → ResolverForm-ZVufJ4G-.js.map} +1 -1
  84. package/dashboard/dist/assets/{RoleDetailPage-DgVp0Hih.js → RoleDetailPage-CTbq0mz4.js} +2 -2
  85. package/dashboard/dist/assets/{RoleDetailPage-DgVp0Hih.js.map → RoleDetailPage-CTbq0mz4.js.map} +1 -1
  86. package/dashboard/dist/assets/{RolesPage-BmsWq83e.js → RolesPage-DBKxeam4.js} +2 -2
  87. package/dashboard/dist/assets/{RolesPage-BmsWq83e.js.map → RolesPage-DBKxeam4.js.map} +1 -1
  88. package/dashboard/dist/assets/RosterWidget-BkLAwEYB.js +2 -0
  89. package/dashboard/dist/assets/RosterWidget-BkLAwEYB.js.map +1 -0
  90. package/dashboard/dist/assets/{RunAsSelector-CyUWGp5P.js → RunAsSelector-D2DC4iDf.js} +2 -2
  91. package/dashboard/dist/assets/{RunAsSelector-CyUWGp5P.js.map → RunAsSelector-D2DC4iDf.js.map} +1 -1
  92. package/dashboard/dist/assets/{ScanCodesPage-Cy05JOt4.js → ScanCodesPage-BlKleaT0.js} +2 -2
  93. package/dashboard/dist/assets/{ScanCodesPage-Cy05JOt4.js.map → ScanCodesPage-BlKleaT0.js.map} +1 -1
  94. package/dashboard/dist/assets/{ScanSchemeDetailPage-BX1afzOg.js → ScanSchemeDetailPage-CTW6gofi.js} +2 -2
  95. package/dashboard/dist/assets/{ScanSchemeDetailPage-BX1afzOg.js.map → ScanSchemeDetailPage-CTW6gofi.js.map} +1 -1
  96. package/dashboard/dist/assets/{ScanStationPage-DLAB41tb.js → ScanStationPage-DPRjSPyT.js} +2 -2
  97. package/dashboard/dist/assets/{ScanStationPage-DLAB41tb.js.map → ScanStationPage-DPRjSPyT.js.map} +1 -1
  98. package/dashboard/dist/assets/{StickyPagination-BzUTnYYE.js → StickyPagination-CkmX3-Gu.js} +2 -2
  99. package/dashboard/dist/assets/{StickyPagination-BzUTnYYE.js.map → StickyPagination-CkmX3-Gu.js.map} +1 -1
  100. package/dashboard/dist/assets/{StreamMessageDetail-D0W1ekgG.js → StreamMessageDetail-Xm_n510s.js} +2 -2
  101. package/dashboard/dist/assets/{StreamMessageDetail-D0W1ekgG.js.map → StreamMessageDetail-Xm_n510s.js.map} +1 -1
  102. package/dashboard/dist/assets/{SwimlaneTimeline-BPBwmwuO.js → SwimlaneTimeline-De48aJan.js} +2 -2
  103. package/dashboard/dist/assets/{SwimlaneTimeline-BPBwmwuO.js.map → SwimlaneTimeline-De48aJan.js.map} +1 -1
  104. package/dashboard/dist/assets/{TaskDetailPage-VuaIXISy.js → TaskDetailPage-HycMx3O9.js} +2 -2
  105. package/dashboard/dist/assets/{TaskDetailPage-VuaIXISy.js.map → TaskDetailPage-HycMx3O9.js.map} +1 -1
  106. package/dashboard/dist/assets/{TasksListPage-KaUSoqos.js → TasksListPage-OIcFFp1C.js} +2 -2
  107. package/dashboard/dist/assets/{TasksListPage-KaUSoqos.js.map → TasksListPage-OIcFFp1C.js.map} +1 -1
  108. package/dashboard/dist/assets/{TimeAgo-C_E6u0fr.js → TimeAgo-OTC_55oZ.js} +2 -2
  109. package/dashboard/dist/assets/{TimeAgo-C_E6u0fr.js.map → TimeAgo-OTC_55oZ.js.map} +1 -1
  110. package/dashboard/dist/assets/{TimestampCell-CUJiAmax.js → TimestampCell-CAwIj_AI.js} +2 -2
  111. package/dashboard/dist/assets/{TimestampCell-CUJiAmax.js.map → TimestampCell-CAwIj_AI.js.map} +1 -1
  112. package/dashboard/dist/assets/{ToolTestPanel-Ch5nQANh.js → ToolTestPanel-8Vf6pfw4.js} +2 -2
  113. package/dashboard/dist/assets/{ToolTestPanel-Ch5nQANh.js.map → ToolTestPanel-8Vf6pfw4.js.map} +1 -1
  114. package/dashboard/dist/assets/{TopicDetailPage-BprToO7w.js → TopicDetailPage-iZW8rK9L.js} +2 -2
  115. package/dashboard/dist/assets/{TopicDetailPage-BprToO7w.js.map → TopicDetailPage-iZW8rK9L.js.map} +1 -1
  116. package/dashboard/dist/assets/{TopicsPage-8SmCnQ-E.js → TopicsPage-CqiEcj-W.js} +2 -2
  117. package/dashboard/dist/assets/{TopicsPage-8SmCnQ-E.js.map → TopicsPage-CqiEcj-W.js.map} +1 -1
  118. package/dashboard/dist/assets/{UserName-BkJryunF.js → UserName-DQFjuoib.js} +2 -2
  119. package/dashboard/dist/assets/{UserName-BkJryunF.js.map → UserName-DQFjuoib.js.map} +1 -1
  120. package/dashboard/dist/assets/{WorkflowExecutionPage-B2S5ODie.js → WorkflowExecutionPage-Di08wCbs.js} +2 -2
  121. package/dashboard/dist/assets/{WorkflowExecutionPage-B2S5ODie.js.map → WorkflowExecutionPage-Di08wCbs.js.map} +1 -1
  122. package/dashboard/dist/assets/{WorkflowsDashboard-CABuRCXp.js → WorkflowsDashboard-Bb8HlrTJ.js} +2 -2
  123. package/dashboard/dist/assets/{WorkflowsDashboard-CABuRCXp.js.map → WorkflowsDashboard-Bb8HlrTJ.js.map} +1 -1
  124. package/dashboard/dist/assets/{WorkflowsOverview-BPUHAj8T.js → WorkflowsOverview-Dta1kurk.js} +2 -2
  125. package/dashboard/dist/assets/{WorkflowsOverview-BPUHAj8T.js.map → WorkflowsOverview-Dta1kurk.js.map} +1 -1
  126. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DZGjT-Tl.js → YamlWorkflowDetailPage-CfAajg68.js} +2 -2
  127. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DZGjT-Tl.js.map → YamlWorkflowDetailPage-CfAajg68.js.map} +1 -1
  128. package/dashboard/dist/assets/{YamlWorkflowsPage-DIxHURlM.js → YamlWorkflowsPage-CQFUzT4t.js} +2 -2
  129. package/dashboard/dist/assets/{YamlWorkflowsPage-DIxHURlM.js.map → YamlWorkflowsPage-CQFUzT4t.js.map} +1 -1
  130. package/dashboard/dist/assets/{agents-BnDp2rcb.js → agents-PuftRTB2.js} +2 -2
  131. package/dashboard/dist/assets/{agents-BnDp2rcb.js.map → agents-PuftRTB2.js.map} +1 -1
  132. package/dashboard/dist/assets/{bots-maURYoyr.js → bots-BmEiPAWY.js} +2 -2
  133. package/dashboard/dist/assets/{bots-maURYoyr.js.map → bots-BmEiPAWY.js.map} +1 -1
  134. package/dashboard/dist/assets/{capabilities-5-TakMUh.js → capabilities-CRii4Soa.js} +2 -2
  135. package/dashboard/dist/assets/{capabilities-5-TakMUh.js.map → capabilities-CRii4Soa.js.map} +1 -1
  136. package/dashboard/dist/assets/{controlplane-BXVVTWoh.js → controlplane-DO_czaYo.js} +2 -2
  137. package/dashboard/dist/assets/{controlplane-BXVVTWoh.js.map → controlplane-DO_czaYo.js.map} +1 -1
  138. package/dashboard/dist/assets/{escalation-columns-v8gx8wFb.js → escalation-columns-CzCquCPh.js} +2 -2
  139. package/dashboard/dist/assets/{escalation-columns-v8gx8wFb.js.map → escalation-columns-CzCquCPh.js.map} +1 -1
  140. package/dashboard/dist/assets/{escalation-items-OWntjDaH.js → escalation-items-Cy0ZgJqV.js} +2 -2
  141. package/dashboard/dist/assets/{escalation-items-OWntjDaH.js.map → escalation-items-Cy0ZgJqV.js.map} +1 -1
  142. package/dashboard/dist/assets/{index-BIfY4mR2.js → index-2SM2_onB.js} +2 -2
  143. package/dashboard/dist/assets/{index-BIfY4mR2.js.map → index-2SM2_onB.js.map} +1 -1
  144. package/dashboard/dist/assets/{index-vgHzaGmW.js → index-4YaDUcKd.js} +2 -2
  145. package/dashboard/dist/assets/{index-vgHzaGmW.js.map → index-4YaDUcKd.js.map} +1 -1
  146. package/dashboard/dist/assets/{index-YGTGxcTF.js → index-CL_1VpGb.js} +2 -2
  147. package/dashboard/dist/assets/{index-YGTGxcTF.js.map → index-CL_1VpGb.js.map} +1 -1
  148. package/dashboard/dist/assets/{index-Dk7nwVpm.js → index-CZ7A3AcD.js} +2 -2
  149. package/dashboard/dist/assets/{index-Dk7nwVpm.js.map → index-CZ7A3AcD.js.map} +1 -1
  150. package/dashboard/dist/assets/{index-CvKegIVe.js → index-CfP2nKRc.js} +2 -2
  151. package/dashboard/dist/assets/{index-CvKegIVe.js.map → index-CfP2nKRc.js.map} +1 -1
  152. package/dashboard/dist/assets/{index-CR9rhAvN.js → index-Cga5IW3D.js} +2 -2
  153. package/dashboard/dist/assets/{index-CR9rhAvN.js.map → index-Cga5IW3D.js.map} +1 -1
  154. package/dashboard/dist/assets/{index-BTm3-qwq.js → index-Cx8xb-oU.js} +2 -2
  155. package/dashboard/dist/assets/{index-BTm3-qwq.js.map → index-Cx8xb-oU.js.map} +1 -1
  156. package/dashboard/dist/assets/{index-Dafrbwk_.js → index-DhSCCpqM.js} +2 -2
  157. package/dashboard/dist/assets/{index-Dafrbwk_.js.map → index-DhSCCpqM.js.map} +1 -1
  158. package/dashboard/dist/assets/{index-WPVpyoD3.js → index-DiaRlFYI.js} +2 -2
  159. package/dashboard/dist/assets/{index-WPVpyoD3.js.map → index-DiaRlFYI.js.map} +1 -1
  160. package/dashboard/dist/assets/{index-D7peGNN0.js → index-Dz6R8-Dw.js} +11 -11
  161. package/dashboard/dist/assets/index-Dz6R8-Dw.js.map +1 -0
  162. package/dashboard/dist/assets/{index-D_ojXTgO.js → index-Rwqrflm-.js} +2 -2
  163. package/dashboard/dist/assets/{index-D_ojXTgO.js.map → index-Rwqrflm-.js.map} +1 -1
  164. package/dashboard/dist/assets/{index-DvkcyTE2.js → index-XntldBd0.js} +2 -2
  165. package/dashboard/dist/assets/{index-DvkcyTE2.js.map → index-XntldBd0.js.map} +1 -1
  166. package/dashboard/dist/assets/{index-CWKs10VQ.js → index-jL2K6us4.js} +2 -2
  167. package/dashboard/dist/assets/{index-CWKs10VQ.js.map → index-jL2K6us4.js.map} +1 -1
  168. package/dashboard/dist/assets/{knowledge-L_zY1zmy.js → knowledge-CeUqGPuo.js} +2 -2
  169. package/dashboard/dist/assets/{knowledge-L_zY1zmy.js.map → knowledge-CeUqGPuo.js.map} +1 -1
  170. package/dashboard/dist/assets/{mcp-wCWFRA0T.js → mcp-Cx96NTeD.js} +2 -2
  171. package/dashboard/dist/assets/{mcp-wCWFRA0T.js.map → mcp-Cx96NTeD.js.map} +1 -1
  172. package/dashboard/dist/assets/{mcp-query-CFbGudkb.js → mcp-query-XAzWl0gm.js} +2 -2
  173. package/dashboard/dist/assets/{mcp-query-CFbGudkb.js.map → mcp-query-XAzWl0gm.js.map} +1 -1
  174. package/dashboard/dist/assets/{personas-B_VIacZJ.js → personas--4kjwyOw.js} +2 -2
  175. package/dashboard/dist/assets/{personas-B_VIacZJ.js.map → personas--4kjwyOw.js.map} +1 -1
  176. package/dashboard/dist/assets/{pipelines-Bv0Z8xQA.js → pipelines-PgkwvG7f.js} +2 -2
  177. package/dashboard/dist/assets/{pipelines-Bv0Z8xQA.js.map → pipelines-PgkwvG7f.js.map} +1 -1
  178. package/dashboard/dist/assets/{tasks-DP6yaNZs.js → tasks-CcYxdBa3.js} +2 -2
  179. package/dashboard/dist/assets/{tasks-DP6yaNZs.js.map → tasks-CcYxdBa3.js.map} +1 -1
  180. package/dashboard/dist/assets/{topics-UBSIcpSR.js → topics-_lik7cNY.js} +2 -2
  181. package/dashboard/dist/assets/{topics-UBSIcpSR.js.map → topics-_lik7cNY.js.map} +1 -1
  182. package/dashboard/dist/assets/{useDebouncedValue-R62q3Xpx.js → useDebouncedValue-Bm_AoxVx.js} +2 -2
  183. package/dashboard/dist/assets/{useDebouncedValue-R62q3Xpx.js.map → useDebouncedValue-Bm_AoxVx.js.map} +1 -1
  184. package/dashboard/dist/assets/{useNamespace-CAaszJDE.js → useNamespace-DgXXKdx5.js} +2 -2
  185. package/dashboard/dist/assets/{useNamespace-CAaszJDE.js.map → useNamespace-DgXXKdx5.js.map} +1 -1
  186. package/dashboard/dist/assets/{useYamlActivityEvents-emCp9U69.js → useYamlActivityEvents-Dj2qtGSd.js} +2 -2
  187. package/dashboard/dist/assets/{useYamlActivityEvents-emCp9U69.js.map → useYamlActivityEvents-Dj2qtGSd.js.map} +1 -1
  188. package/dashboard/dist/assets/{validate-C7yskdEn.js → validate-FlXCBBT6.js} +2 -2
  189. package/dashboard/dist/assets/{validate-C7yskdEn.js.map → validate-FlXCBBT6.js.map} +1 -1
  190. package/dashboard/dist/assets/{yaml-workflows-C2sOwz1p.js → yaml-workflows-B0_JxRYQ.js} +2 -2
  191. package/dashboard/dist/assets/{yaml-workflows-C2sOwz1p.js.map → yaml-workflows-B0_JxRYQ.js.map} +1 -1
  192. package/dashboard/dist/index.html +1 -1
  193. package/docs/hitl/x-lt-roster.md +1 -1
  194. package/docs/mcp.md +6 -1
  195. package/docs/scan-codes.md +5 -0
  196. package/package.json +1 -1
  197. package/dashboard/dist/assets/AgentsPage-CZIWMwak.js +0 -2
  198. package/dashboard/dist/assets/RosterWidget-DR-T4Izu.js +0 -2
  199. package/dashboard/dist/assets/RosterWidget-DR-T4Izu.js.map +0 -1
  200. package/dashboard/dist/assets/index-D7peGNN0.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{j as e,a as y}from"./vendor-query-DvWWuNIB.js";import{ae as h,bv as ee,bw as le,bx as ce,Z as re,bt as q,by as oe,bu as ie,bz as xe}from"./index-D7peGNN0.js";import{C as de}from"./ConfirmDeleteModal-DGlOlQAo.js";import{P as me}from"./PageHeader-BSWIspNB.js";import{G as he}from"./GrantScopeField-BzWGzBfA.js";import{h as H,A as W,bG as ue,bF as be,l as pe,a as te,j as je}from"./vendor-icons-DUYcKTjP.js";import{e as ge,f as Ne,u as fe}from"./vendor-react-_9U4mKFr.js";const ve=[h.SHOW_DETAIL,h.CLAIM,h.CLAIM_SHOW_DETAIL,h.RELEASE,h.RESOLVE,h.ESCALATE,h.CANCEL],ye=()=>({label:"",verb:h.RESOLVE});function ke({choices:t,onChange:s}){const x=(r,d)=>s(t.map((l,b)=>b===r?{...l,...d}:l)),o=r=>s(t.filter((d,l)=>l!==r));return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"block text-xs text-text-secondary",children:["Choices ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary",children:"The buttons the station screen offers under the item's reality. A code makes a choice double-scannable — scan the item, then the printed action card."}),e.jsx("div",{className:"divide-y divide-surface-border border-y border-surface-border",children:t.map((r,d)=>e.jsx(we,{index:d,choice:r,onPatch:l=>x(d,l),onRemove:()=>o(d)},d))}),e.jsxs("button",{type:"button",onClick:()=>s([...t,ye()]),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover pt-2",children:[e.jsx(H,{className:"w-3.5 h-3.5"})," Add a choice"]})]})}function we({index:t,choice:s,onPatch:x,onRemove:o}){var m;const[r,d]=y.useState(s.params?JSON.stringify(s.params,null,2):""),[l,b]=y.useState(null),i=c=>{if(d(c),!c.trim()){b(null),x({params:void 0});return}try{x({params:JSON.parse(c)}),b(null)}catch{b("Fix the JSON to save these params.")}};return e.jsxs("div",{className:"pt-8 pb-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-widest text-text-tertiary",children:["Choice ",t+1]}),e.jsx("button",{type:"button",onClick:o,className:"icon-link ml-auto",title:"Remove choice",children:e.jsx(W,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[12rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Label ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Button text — what the associate reads."}),e.jsx("input",{value:s.label,onChange:c=>x({label:c.target.value}),className:"input w-full",placeholder:"Collected"})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Runs ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The action this choice performs."}),e.jsx("select",{value:s.verb,onChange:c=>x({verb:c.target.value}),className:"select",children:ve.map(c=>e.jsx("option",{value:c,children:c},c))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Code"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Short token for double-scan selection."}),e.jsx("input",{value:s.code??"",onChange:c=>x({code:c.target.value||void 0}),className:"input w-[10rem] font-mono",placeholder:"COLLECT"})]}),e.jsxs("label",{className:"block flex-1 min-w-[14rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Confirmation"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Ask before running — empty runs on tap."}),e.jsx("input",{value:((m=s.confirm)==null?void 0:m.prompt)??"",onChange:c=>x({confirm:c.target.value?{prompt:c.target.value}:void 0}),className:"input w-full",placeholder:"Run without asking"})]}),e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!s.requireActingIdentity,onChange:c=>x({requireActingIdentity:c.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"This choice runs only for a badged (or write-capable) user.",children:"Requires acting identity"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Params (JSON)"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The verb's parameters — resolverPayload, targetRole, metadata, durationMinutes."}),e.jsx("textarea",{value:r,onChange:c=>i(c.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:'{ "resolverPayload": { "outcome": "collected" } }'}),l&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:l})]})]})}function se(t){return t.split(",").map(s=>s.trim()).filter(Boolean)}function Ce({step:t,onPatch:s}){const x=t.params??{},o=x.accumulate??{},r=o.item,d=l=>{var m;const{item:b,...i}=o;s({params:{...x,accumulate:l?{...i,item:l}:i},...!l&&((m=t.refuse)!=null&&m.missing)?{refuse:{...t.refuse,missing:void 0}}:{}})};return e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-2 basis-full cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:!!r,onChange:l=>d(l.target.checked?{}:void 0),className:"w-4 h-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Also record it on the scanned item's own row"})]}),r&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Item queues"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Where the item's row waits, comma-separated. Empty: any I can read."}),e.jsx("input",{value:(r.roles??[]).join(", "),onChange:l=>{const b=se(l.target.value),{roles:i,...m}=r;d(b.length?{...m,roles:b}:m)},className:"input w-[14rem] font-mono",placeholder:"packing","aria-label":"Item queues"})]}),r&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Item row has"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"facet=value pairs, comma-separated."}),e.jsx("input",{value:Object.entries(r.facets??{}).map(([l,b])=>`${l}=${b}`).join(", "),onChange:l=>{const b=Object.fromEntries(se(l.target.value).map(c=>c.split("=").map(g=>g.trim())).filter(([c,g])=>c&&g!==void 0&&g!=="")),{facets:i,...m}=r;d(Object.keys(b).length?{...m,facets:b}:m)},className:"input w-[14rem] font-mono",placeholder:"shape=consolidated","aria-label":"Item row has"})]}),r&&t.refuse&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When the item is not waiting"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"What the station says when the scan is right but the item has no waiting row. Empty: the next step runs."}),e.jsx("input",{value:t.refuse.missing??"",onChange:l=>s({refuse:{...t.refuse,missing:l.target.value||void 0}}),className:"input w-full",placeholder:"That one is not waiting to be packed.","aria-label":"When the item is not waiting"})]})]})}function ae(t){return t.split(/[\s,]+/).map(Number).filter(s=>Number.isInteger(s)&&s>=10&&s<=99)}function $(t){return t.split(",").map(s=>s.trim()).filter(Boolean)}function Se({step:t,onPatch:s}){var c,g,k,w,S,u,A,v;const x=t.params??{},o=a=>s({params:{...x,...a}}),r=x.accumulate??{},d=r.from?"from":r.into?"into":"";if(t.verb===h.HOLD){const a=x.hold??{},j=p=>o({hold:{...a,...p}});return e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Hold for (seconds)"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"How long the station waits for the next scan (5–600, default 45)."}),e.jsx("input",{type:"number",min:5,max:600,value:a.ttlSeconds??"",onChange:p=>j({ttlSeconds:p.target.value?Number(p.target.value):void 0}),className:"input w-[10rem]",placeholder:"45"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Next scan schemes"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The scheme versions expected next, e.g. 14."}),e.jsx("input",{value:(((c=a.expect)==null?void 0:c.schemes)??[]).join(", "),onChange:p=>{const N=ae(p.target.value);j({expect:N.length?{...a.expect,schemes:N}:void 0})},className:"input w-[10rem] font-mono",placeholder:"14","aria-label":"Next scan schemes"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Headline"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["Where it goes, shown largest. ","{item.<facet>}"," reads the held row."]}),e.jsx("input",{value:a.headline??"",onChange:p=>j({headline:p.target.value||void 0}),className:"input w-[14rem] font-mono",placeholder:"{item.containerCode}","aria-label":"Headline"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Under the headline"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"A place name, e.g. the facility."}),e.jsx("input",{value:a.subline??"",onChange:p=>j({subline:p.target.value||void 0}),className:"input w-[14rem] font-mono",placeholder:"{item.locationName}","aria-label":"Under the headline"})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Ask for it"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["Markdown the station shows while holding. ","{item.<facet>}"," reads the held row."]}),e.jsx("input",{value:((g=a.expect)==null?void 0:g.prompt)??"",onChange:p=>a.expect&&j({expect:{...a.expect,prompt:p.target.value||void 0}}),disabled:!a.expect,className:"input w-full",placeholder:"Walk to **{item.containerCode}** and scan it.","aria-label":"Ask for it"})]})]})}const l=t.verb===h.FILL;if(t.verb!==h.ACCUMULATE&&!l)return null;const b=a=>{const{from:j,into:p,item:N,...L}=r;s({params:{...x,accumulate:{...L,...a==="from"?{from:"subject"}:{},...a==="into"?{into:"subject",...N?{item:N}:{}}:{}}},subject:a?t.subject??{schemes:[]}:void 0,match:a?t.match:void 0,refuse:a?t.refuse:void 0})},i=x.fill??{into:"subject"},m=l?i.into==="subject":!!d;return e.jsxs("div",{className:"flex flex-wrap gap-4",children:[l?e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Check off on"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The row whose expected items the scan checks off."}),e.jsxs("select",{value:i.into,onChange:a=>s({params:{...x,fill:{...i,into:a.target.value}},subject:a.target.value==="subject"?t.subject??{schemes:[]}:void 0}),className:"select",children:[e.jsx("option",{value:"subject",children:"The held item"}),e.jsx("option",{value:"scanned",children:"The scanned row"})]})]}):e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Held item"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Pair this scan with the item the station is holding."}),e.jsxs("select",{value:d,onChange:a=>b(a.target.value),className:"select",children:[e.jsx("option",{value:"",children:"Not used"}),e.jsx("option",{value:"from",children:"Goes into the scanned container"}),e.jsx("option",{value:"into",children:"Takes the scanned code"})]})]}),m&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Held from schemes ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The schemes the held item was scanned under, e.g. 11."}),e.jsx("input",{value:(((k=t.subject)==null?void 0:k.schemes)??[]).join(", "),onChange:a=>s({subject:{...t.subject,schemes:ae(a.target.value)}}),className:"input w-[10rem] font-mono",placeholder:"11","aria-label":"Held from schemes"})]}),m&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Only when the held item has"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"facet=value pairs, comma-separated; otherwise the next step runs."}),e.jsx("input",{value:Object.entries(((w=t.subject)==null?void 0:w.facets)??{}).map(([a,j])=>`${a}=${j}`).join(", "),onChange:a=>{const j=Object.fromEntries($(a.target.value).map(L=>L.split("=").map(_=>_.trim())).filter(([L,_])=>L&&_!==void 0&&_!=="")),{facets:p,...N}=t.subject??{schemes:[]};s({subject:Object.keys(j).length?{...N,facets:j}:N})},className:"input w-[14rem] font-mono",placeholder:"placement=unassigned","aria-label":"Only when the held item has"})]}),m&&!l&&e.jsxs("label",{className:"block flex-1 min-w-[14rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Must match"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["The scanned code must equal one of these, comma-separated, e.g. ","{subject.containerCode}","; a list facet such as ","{subject.offeredContainers}"," allows every entry."]}),e.jsx("input",{value:(((S=t.match)==null?void 0:S.target)??[]).join(", "),onChange:a=>{var p;const j=$(a.target.value);s({match:j.length||(p=t.match)!=null&&p.facets?{...t.match,target:j.length?j:void 0}:void 0})},className:"input w-full font-mono",placeholder:"{subject.containerCode}","aria-label":"Must match"})]}),d==="from"&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Shared facets"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The container must carry the held item's value for these."}),e.jsx("input",{value:(((u=t.match)==null?void 0:u.facets)??[]).join(", "),onChange:a=>{var p;const j=$(a.target.value);s({match:j.length||(p=t.match)!=null&&p.target?{...t.match,facets:j.length?j:void 0}:void 0})},className:"input w-[12rem] font-mono",placeholder:"containerKey","aria-label":"Shared facets"})]}),d==="from"&&t.refuse&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When no open container carries it"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"What the station says when the scan is right but nothing is open under that code. Empty: the next step runs."}),e.jsx("input",{value:t.refuse.missing??"",onChange:a=>s({refuse:{...t.refuse,missing:a.target.value||void 0}}),className:"input w-full",placeholder:"That container was just taken. Scan the item again.","aria-label":"When no open container carries it"})]}),d==="into"&&e.jsx(Ce,{step:t,onPatch:s}),m&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When it lands"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"What the station shows, large, once the write lands. Same tokens as the line below."}),e.jsx("input",{value:((A=t.done)==null?void 0:A.markdown)??"",onChange:a=>s({done:a.target.value?{markdown:a.target.value}:void 0}),className:"input w-full",placeholder:l?"{fill.filled} of {fill.total} checked off.":"Place it in **{container.containerCode}**. All good.","aria-label":"When it lands"})]}),m&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When it is the wrong one"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["What the station says. ","{subject.<facet>}"," reads the held item",d==="from"?e.jsxs(e.Fragment,{children:[", ","{container.<facet>}"," the scanned container"]}):null,d==="into"&&r.item?e.jsxs(e.Fragment,{children:[", ","{item.<facet>}"," the scanned item's row"]}):null,l?e.jsxs(e.Fragment,{children:[", ","{fill.pending}"," what is still expected"]}):null,"."]}),e.jsx("input",{value:((v=t.refuse)==null?void 0:v.markdown)??"",onChange:a=>s({refuse:a.target.value?{...t.refuse,markdown:a.target.value}:void 0}),className:"input w-full",placeholder:"This one goes in **{subject.containerCode}**.","aria-label":"When it is the wrong one"})]})]})}const Te={[h.SHOW_DETAIL]:"Show the item",[h.SHOW_LIST]:"Show all matches as a list",[h.CLAIM]:"Claim",[h.CLAIM_SHOW_DETAIL]:"Claim and show the item",[h.RELEASE]:"Release my claim",[h.RESOLVE]:"Resolve with a canned payload",[h.ESCALATE]:"Send to another queue",[h.CANCEL]:"Cancel",[h.ACCUMULATE]:"Add to an accumulator",[h.PRESENT]:"Show reality + choices",[h.HOLD]:"Hold it for the next scan",[h.FILL]:"Check off one expected item"};function Ae({index:t,step:s,roleKeys:x,isLast:o,onPatch:r,onMove:d,onRemove:l}){var L,_,C,M,D,f,T,I,E,R,P,U,B,G,J,K,V,Y,z,Q,Z;const[b,i]=y.useState((L=s.params)!=null&&L.resolverPayload?JSON.stringify(s.params.resolverPayload,null,2):""),[m,c]=y.useState(null),g=n=>r({query:{...s.query,...n}}),k=n=>r({params:{...s.params,...n}}),w=n=>{if(i(n),!n.trim()){c(null),k({resolverPayload:void 0});return}try{k({resolverPayload:JSON.parse(n)}),c(null)}catch{c("Fix the JSON to save this payload.")}},S=s.query.roles??[],u=s.verb===h.PRESENT,A=s.verb===h.ESCALATE,v=s.verb===h.ACCUMULATE,a=v&&!!((C=(_=s.params)==null?void 0:_.accumulate)!=null&&C.containerFacet),j=v&&!!((D=(M=s.params)==null?void 0:M.accumulate)!=null&&D.from||(T=(f=s.params)==null?void 0:f.accumulate)!=null&&T.into),p=n=>{var O;return k({accumulate:{...(O=s.params)==null?void 0:O.accumulate,...n}})},N=s.verb===h.RESOLVE||s.verb===h.ESCALATE&&((I=s.params)==null?void 0:I.closeCurrent)==="resolve"||v;return e.jsxs("div",{className:"py-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-quaternary",children:["Step ",t+1]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>d(-1),disabled:t===0,className:"icon-link disabled:opacity-30",title:"Move up",children:e.jsx(ue,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:()=>d(1),disabled:o,className:"icon-link disabled:opacity-30",title:"Move down",children:e.jsx(be,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:l,className:"icon-link",title:"Remove step",children:e.jsx(W,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Look in"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queues the item is expected in — empty means any."}),e.jsx(ee,{values:S,options:x,onChange:n=>g({roles:n.length?n:void 0}),addLabel:"Add a queue…",emptyText:"Any queue I can see",ariaLabel:"Add a queue"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Held by"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Narrow to claimed, unclaimed, or my items."}),e.jsxs("select",{value:s.query.availability??"any",onChange:n=>g({availability:n.target.value==="any"?void 0:n.target.value}),className:"select",children:[e.jsx("option",{value:"any",children:"Anyone / unheld"}),e.jsx("option",{value:"available",children:"Unclaimed only"}),e.jsx("option",{value:"claimed",children:"Claimed only"}),e.jsx("option",{value:"mine",children:"Mine only"})]})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Then ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The action this step performs on a match."}),e.jsx("select",{value:s.verb,onChange:n=>{const O=n.target.value,X=O===h.FILL;r({verb:O,params:X?{fill:{into:"subject"}}:void 0,confirm:void 0,choices:void 0,autoSelectSingle:void 0,subject:X?{schemes:[]}:void 0,match:void 0,refuse:void 0})},className:"select",children:Object.entries(Te).map(([n,O])=>e.jsx("option",{value:n,children:O},n))})]}),A&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Send to ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queue the item re-homes to."}),e.jsxs("select",{value:((E=s.params)==null?void 0:E.targetRole)??"",onChange:n=>k({targetRole:n.target.value||void 0}),className:"select font-mono",children:[e.jsx("option",{value:"",disabled:!0,children:"Choose…"}),x.map(n=>e.jsx("option",{value:n,children:n},n))]})]}),A&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Current item"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Close out the located item first."}),e.jsxs("select",{value:((R=s.params)==null?void 0:R.closeCurrent)??"",onChange:n=>k({closeCurrent:n.target.value||void 0}),className:"select",children:[e.jsx("option",{value:"",children:"Leave it open"}),e.jsx("option",{value:"resolve",children:"Resolve it"}),e.jsx("option",{value:"cancel",children:"Cancel it"})]})]}),v&&!j&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Container facet"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Item mode: the scanned item's row carries this facet, and the container that shares its value receives the item. Empty means the scan names the container."}),e.jsx("input",{value:((U=(P=s.params)==null?void 0:P.accumulate)==null?void 0:U.containerFacet)??"",onChange:n=>p({containerFacet:n.target.value||void 0}),className:"input w-full min-w-[12rem] font-mono",placeholder:"binKey","aria-label":"Container facet"})]}),v&&!a&&!((G=(B=s.params)==null?void 0:B.accumulate)!=null&&G.into)&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Item key ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["The key the item is held under. ","{scan.target}"," fills from the scan; ","{subject.<facet>}"," reads the held item; ","{claim.<facet>}"," the acting user's live claim."]}),e.jsx("input",{value:((J=s.params)==null?void 0:J.itemKey)??"",onChange:n=>k({itemKey:n.target.value||void 0}),className:"input w-full min-w-[16rem] font-mono",placeholder:"{claim.orderId}","aria-label":"Item key"})]}),a&&e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Container queues"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queues the container is expected in — empty means any I can act on."}),e.jsx(ee,{values:((V=(K=s.params)==null?void 0:K.accumulate)==null?void 0:V.containerRoles)??[],options:x,onChange:n=>p({containerRoles:n.length?n:void 0}),addLabel:"Add a queue…",emptyText:"Any queue I can act on",ariaLabel:"Add a container queue"})]}),a&&e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:((z=(Y=s.params)==null?void 0:Y.accumulate)==null?void 0:z.reciprocal)!==!1,onChange:n=>p({reciprocal:n.target.checked?void 0:!1})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"Write the item's own row in the same statement, so it records which container holds it.",children:"Also record the container on the item"})]}),!u&&!s.subject&&s.verb!==h.HOLD&&s.verb!==h.FILL&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Confirmation"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Ask before acting — the prompt shows on the item."}),e.jsx("input",{value:((Q=s.confirm)==null?void 0:Q.prompt)??"",onChange:n=>r({confirm:n.target.value?{prompt:n.target.value}:void 0}),className:"input w-full min-w-[16rem]",placeholder:"Run without asking"})]}),e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!s.requireActingIdentity,onChange:n=>r({requireActingIdentity:n.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"This step runs only for a badged (or write-capable) user.",children:"Requires acting identity"})]}),u&&((Z=s.choices)==null?void 0:Z.length)===1&&e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!s.autoSelectSingle,onChange:n=>r({autoSelectSingle:n.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"With one choice, the scan runs it directly instead of presenting; a badge is still collected first when required.",children:"Auto-select the single choice"})]})]}),e.jsx(Se,{step:s,onPatch:r}),N&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:[v?"Item payload":"Resolver payload"," ",!v&&e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:[v?"Optional JSON stored on the item.":"JSON submitted as the resolution."," ","{scan.target}",", ","{scan.category}"," and ","{scan.scannedAt}"," fill in from the scan; ","{claim.<facet>}"," reads the acting user's live claim",a?e.jsxs(e.Fragment,{children:[", ","{item.<facet>}"," the scanned item's row"]}):null,"."]}),e.jsx("textarea",{value:b,onChange:n=>w(n.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:'{ "outcome": "collected", "serial": "{scan.target}" }'}),m&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:m})]}),u&&e.jsx(ke,{choices:s.choices??[],onChange:n=>r({choices:n.length?n:void 0,...n.length===1?{}:{autoSelectSingle:void 0}})})]})}const ne=()=>({query:{},verb:h.SHOW_DETAIL});function Ee({schemeVersion:t,schemeKind:s,category:x,rule:o,codePreview:r,onDeleted:d}){var M,D;const l=le(),b=ce(),{data:i}=re(),m=((i==null?void 0:i.roles)??[]).map(f=>f.role),c=s===q.IDENTITY,[g,k]=y.useState((o==null?void 0:o.name)??""),[w,S]=y.useState((o==null?void 0:o.steps)??(c?[]:[ne()])),[u,A]=y.useState(((M=o==null?void 0:o.fallback)==null?void 0:M.markdown)??""),[v,a]=y.useState(((D=o==null?void 0:o.notPrimed)==null?void 0:D.markdown)??""),[j,p]=y.useState((o==null?void 0:o.enabled)??!0),N=(f,T)=>S(I=>I.map((E,R)=>R===f?{...E,...T}:E)),L=(f,T)=>S(I=>{const E=[...I],R=f+T;return R<0||R>=E.length?I:([E[f],E[R]]=[E[R],E[f]],E)}),_=f=>S(T=>T.filter((I,E)=>E!==f)),C=()=>l.mutate({scheme_version:t,category:x,name:g,steps:c?[]:w,fallback:{markdown:u||void 0},notPrimed:{markdown:v||void 0},enabled:j});return e.jsxs("div",{className:"space-y-8 max-w-form",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["1 · Friendly name ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:c?'Name the badge population — "Associate badge".':'Print this beside the code — "Send Printer to Servicing".'}),e.jsx("input",{value:g,onChange:f=>k(f.target.value),className:"input w-full"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Status"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Disabled rules report unconfigured."}),e.jsxs("select",{value:j?"enabled":"disabled",onChange:f=>p(f.target.value==="enabled"),className:"select",children:[e.jsx("option",{value:"enabled",children:"Enabled"}),e.jsx("option",{value:"disabled",children:"Disabled"})]})]})]}),!c&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"block text-xs text-text-secondary",children:["2 · Conditions and actions ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary",children:'Scanning walks the steps in order — the first query that finds the item runs its action. Put the expected state first and a broad "show the item" last so a misplaced item still reports where it is.'})]}),e.jsx("div",{className:"divide-y divide-surface-border border-y border-surface-border",children:w.map((f,T)=>e.jsx(Ae,{index:T,step:f,roleKeys:m,isLast:T===w.length-1,onPatch:I=>N(T,I),onMove:I=>L(T,I),onRemove:()=>_(T)},T))}),e.jsxs("button",{type:"button",onClick:()=>S(f=>[...f,ne()]),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover",children:[e.jsx(H,{className:"w-3.5 h-3.5"})," Add a step"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:c?"2 · When the badge is unknown":"3 · When nothing matches"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:c?"Markdown shown when a scanned badge matches no user.":"Markdown shown to the scanner operator when no step finds the item."}),e.jsx("textarea",{value:u,onChange:f=>A(f.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:c?"**Badge not recognized.** See your lead to get it registered.":"**Nothing here.** The item this code points at is not in any queue."})]}),!c&&e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When a badge is required"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Markdown shown when a step or choice needs an acting identity and none is primed."}),e.jsx("textarea",{value:v,onChange:f=>a(f.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:"**Scan your badge** to run this action."})]})]}),l.error&&e.jsx("p",{className:"text-xs text-status-error",children:l.error.message}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:C,disabled:!g||!c&&w.length===0||l.isPending,className:"btn-primary text-xs",children:o?"Save rule":`Create rule ${t}:${x}`}),e.jsx("span",{className:"text-2xs text-text-quaternary font-mono",children:r}),o&&e.jsxs("button",{type:"button",onClick:()=>b.mutate({scheme_version:t,category:x},{onSuccess:d}),className:"ml-auto flex items-center gap-1 text-xs text-status-error/80 hover:text-status-error",children:[e.jsx(W,{className:"w-3.5 h-3.5"})," Delete rule"]})]})]})}function Le(t){for(let s=0;s<=9;s++)if(!t.has(String(s)))return String(s);return null}function F({icon:t,label:s,annotation:x,aside:o,children:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(t,{className:"w-3 h-3 text-text-tertiary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:s}),x&&e.jsxs("span",{className:"text-2xs text-text-quaternary truncate",children:["— ",x]})]}),o]}),e.jsx("div",{className:"border-l-2 pl-5 border-surface-border/60",children:r})]})}function $e(){const{version:t}=ge(),s=Number(t),[x,o]=Ne(),{data:r,isLoading:d}=oe(Number.isInteger(s)?s:null),l=x.get("category"),b=u=>{o(A=>{const v=new URLSearchParams(A);return u?v.set("category",u):v.delete("category"),v})};if(d)return e.jsx("div",{className:"text-sm text-text-tertiary",children:"Loading…"});if(!r)return e.jsxs("div",{className:"text-sm text-text-tertiary",children:["No scheme for version ",t,"."]});const{scheme:i,rules:m}=r,c=new Map(m.map(u=>[u.category,u])),g=l?c.get(l)??null:null,k=Le(new Set(m.map(u=>u.category))),w=i.encoding==="fixed"?"7".repeat(i.target_length??8):"SN-1234",S=u=>i.encoding==="gtin"?"036000291452":i.encoding==="fixed"?`${i.version}${u}${w}`:`${i.version}${i.delimiter}${u}${i.delimiter}${w}`;return e.jsxs("div",{className:"space-y-10",children:[e.jsx(me,{title:i.name}),e.jsxs("p",{className:"text-sm text-text-secondary max-w-form -mt-4",children:["Codes for this scheme start with ",e.jsx("span",{className:"font-mono text-text-primary",children:i.version}),".",i.kind===q.IDENTITY?" Scanning a badge primes who acts next; each slot names the badge and its unknown-badge message.":" Add an action, name it, and configure what a scan does — each action gets its own slot automatically."]}),e.jsx(Ie,{scheme:i,ruleCount:m.length},i.version),e.jsx(F,{icon:pe,label:"Actions",annotation:i.kind===q.IDENTITY?"named badge slots — each carries its unknown-badge message":"what a scan of this scheme does — named, in the order you add them",children:e.jsxs("div",{className:"divide-y divide-surface-border border-y border-surface-border max-w-form",children:[m.map(u=>{const A=l===u.category;return e.jsxs("button",{type:"button",onClick:()=>b(A?null:u.category),className:`w-full flex items-center gap-4 py-3 px-2 text-left transition-colors ${A?"bg-accent/10":"hover:bg-surface-sunken"}`,children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-xs font-mono text-accent border border-surface-border rounded shrink-0",children:u.category}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text-primary truncate",children:u.name}),e.jsx("div",{className:"text-2xs text-text-tertiary font-mono truncate",children:S(u.category)})]})]},u.category)}),e.jsxs("div",{className:"flex items-center gap-4 py-3 px-2",children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-text-quaternary shrink-0",children:e.jsx(te,{className:"w-4 h-4",strokeWidth:1.5})}),k==null?e.jsx("span",{className:"text-2xs text-text-quaternary",children:"All 10 action slots are in use."}):e.jsxs("button",{type:"button",onClick:()=>b(k),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover",children:[e.jsx(H,{className:"w-3.5 h-3.5"})," Add an action"]})]})]})}),l&&e.jsx(F,{icon:te,label:g?g.name:"New action",annotation:`this label prints beside the code — e.g. ${S(l)}`,children:e.jsx(Ee,{schemeVersion:i.version,schemeKind:i.kind,category:l,rule:g,codePreview:S(l),onDeleted:()=>b(null)},`${i.version}:${l}`)})]})}function Ie({scheme:t,ruleCount:s}){const x=fe(),o=ie(),r=xe(),[d,l]=y.useState(t.name),[b,i]=y.useState(t.kind),[m,c]=y.useState(t.target_facet),[g,k]=y.useState(t.grant_ttl_seconds??3600),[w,S]=y.useState(t.grant_max_uses??0),[u,A]=y.useState(t.grant_scope??"action"),[v,a]=y.useState(t.enabled),[j,p]=y.useState(!1),N=b===q.IDENTITY,L=!N||g>=1&&g<=86400,_=d!==t.name||m!==t.target_facet||v!==t.enabled||b!==t.kind||N&&(g!==t.grant_ttl_seconds||w!==t.grant_max_uses||u!==(t.grant_scope??"action"));return e.jsxs(F,{icon:je,label:"Scheme",annotation:`version digit ${t.version}`,aside:e.jsxs("button",{type:"button",onClick:()=>p(!0),className:"flex items-center gap-1 text-xs text-status-error/80 hover:text-status-error",children:[e.jsx(W,{className:"w-3.5 h-3.5"})," Delete scheme"]}),children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4 max-w-form",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Kind ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"A badge — scanning it primes who acts next.":"An item code — scanning it acts on the item."}),e.jsxs("select",{value:b,onChange:C=>i(C.target.value),className:"select",children:[e.jsx("option",{value:q.ACTION,children:"Action"}),e.jsx("option",{value:q.IDENTITY,children:"Identity"})]})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Name ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"Say who the badge identifies.":"Say what the target identifies."}),e.jsx("input",{value:d,onChange:C=>l(C.target.value),className:"input w-full"})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Target facet ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"The user-metadata key the badge matches (e.g. badge_id).":"The metadata key the scanned value matches."}),e.jsx("input",{value:m,onChange:C=>c(C.target.value),className:"input w-full font-mono"})]}),N&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Grant TTL (seconds) ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"How long a badge scan stays primed (1–86400)."}),e.jsx("input",{type:"number",min:1,max:86400,value:g,onChange:C=>k(Number(C.target.value)),className:"input w-[12rem]"}),!L&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:"Enter 1–86400 seconds."})]}),N&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Grant max uses"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"0 = TTL-bound; n = the grant covers n acts."}),e.jsx("input",{type:"number",min:0,value:w,onChange:C=>S(Number(C.target.value)),className:"input w-[12rem]"})]}),N&&e.jsx(he,{value:u,onChange:A}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Status"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Disable to reject every scan of this version."}),e.jsxs("select",{value:v?"enabled":"disabled",onChange:C=>a(C.target.value==="enabled"),className:"select",children:[e.jsx("option",{value:"enabled",children:"Enabled"}),e.jsx("option",{value:"disabled",children:"Disabled"})]})]}),_&&e.jsx("button",{type:"button",disabled:o.isPending||!d||!m||!L,onClick:()=>o.mutate({version:t.version,name:d,description:t.description,target_facet:m,encoding:t.encoding,delimiter:t.delimiter,target_length:t.target_length,kind:b,grant_ttl_seconds:N?g:null,grant_max_uses:N?w:0,grant_scope:N?u:"action",enabled:v}),className:"btn-primary text-xs",children:"Save"})]}),o.error&&e.jsx("p",{className:"text-xs text-status-error mt-2",children:o.error.message}),e.jsx(de,{open:j,onClose:()=>p(!1),onConfirm:()=>r.mutate(t.version,{onSuccess:()=>x("/admin/scan-codes")}),title:`Delete scheme ${t.version}`,description:s>0?`This deletes "${t.name}" and its ${s} ${s===1?"rule":"rules"}. Codes starting with ${t.version} stop resolving, and labels already printed with them report unconfigured.`:`This deletes "${t.name}". Codes starting with ${t.version} stop resolving.`,isPending:r.isPending,error:r.error})]})}export{$e as ScanSchemeDetailPage};
2
- //# sourceMappingURL=ScanSchemeDetailPage-BX1afzOg.js.map
1
+ import{j as e,a as y}from"./vendor-query-DvWWuNIB.js";import{ae as h,bx as ee,by as le,bz as ce,Z as re,bv as q,bA as oe,bw as ie,bB as xe}from"./index-Dz6R8-Dw.js";import{C as de}from"./ConfirmDeleteModal-BRmx2hA4.js";import{P as me}from"./PageHeader-BSWIspNB.js";import{G as he}from"./GrantScopeField-BzWGzBfA.js";import{h as H,A as W,bG as ue,bF as be,l as pe,a as te,j as je}from"./vendor-icons-DUYcKTjP.js";import{e as ge,f as Ne,u as fe}from"./vendor-react-_9U4mKFr.js";const ve=[h.SHOW_DETAIL,h.CLAIM,h.CLAIM_SHOW_DETAIL,h.RELEASE,h.RESOLVE,h.ESCALATE,h.CANCEL],ye=()=>({label:"",verb:h.RESOLVE});function ke({choices:t,onChange:s}){const x=(r,d)=>s(t.map((l,b)=>b===r?{...l,...d}:l)),o=r=>s(t.filter((d,l)=>l!==r));return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"block text-xs text-text-secondary",children:["Choices ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary",children:"The buttons the station screen offers under the item's reality. A code makes a choice double-scannable — scan the item, then the printed action card."}),e.jsx("div",{className:"divide-y divide-surface-border border-y border-surface-border",children:t.map((r,d)=>e.jsx(we,{index:d,choice:r,onPatch:l=>x(d,l),onRemove:()=>o(d)},d))}),e.jsxs("button",{type:"button",onClick:()=>s([...t,ye()]),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover pt-2",children:[e.jsx(H,{className:"w-3.5 h-3.5"})," Add a choice"]})]})}function we({index:t,choice:s,onPatch:x,onRemove:o}){var m;const[r,d]=y.useState(s.params?JSON.stringify(s.params,null,2):""),[l,b]=y.useState(null),i=c=>{if(d(c),!c.trim()){b(null),x({params:void 0});return}try{x({params:JSON.parse(c)}),b(null)}catch{b("Fix the JSON to save these params.")}};return e.jsxs("div",{className:"pt-8 pb-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-widest text-text-tertiary",children:["Choice ",t+1]}),e.jsx("button",{type:"button",onClick:o,className:"icon-link ml-auto",title:"Remove choice",children:e.jsx(W,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[12rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Label ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Button text — what the associate reads."}),e.jsx("input",{value:s.label,onChange:c=>x({label:c.target.value}),className:"input w-full",placeholder:"Collected"})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Runs ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The action this choice performs."}),e.jsx("select",{value:s.verb,onChange:c=>x({verb:c.target.value}),className:"select",children:ve.map(c=>e.jsx("option",{value:c,children:c},c))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Code"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Short token for double-scan selection."}),e.jsx("input",{value:s.code??"",onChange:c=>x({code:c.target.value||void 0}),className:"input w-[10rem] font-mono",placeholder:"COLLECT"})]}),e.jsxs("label",{className:"block flex-1 min-w-[14rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Confirmation"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Ask before running — empty runs on tap."}),e.jsx("input",{value:((m=s.confirm)==null?void 0:m.prompt)??"",onChange:c=>x({confirm:c.target.value?{prompt:c.target.value}:void 0}),className:"input w-full",placeholder:"Run without asking"})]}),e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!s.requireActingIdentity,onChange:c=>x({requireActingIdentity:c.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"This choice runs only for a badged (or write-capable) user.",children:"Requires acting identity"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Params (JSON)"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The verb's parameters — resolverPayload, targetRole, metadata, durationMinutes."}),e.jsx("textarea",{value:r,onChange:c=>i(c.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:'{ "resolverPayload": { "outcome": "collected" } }'}),l&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:l})]})]})}function se(t){return t.split(",").map(s=>s.trim()).filter(Boolean)}function Ce({step:t,onPatch:s}){const x=t.params??{},o=x.accumulate??{},r=o.item,d=l=>{var m;const{item:b,...i}=o;s({params:{...x,accumulate:l?{...i,item:l}:i},...!l&&((m=t.refuse)!=null&&m.missing)?{refuse:{...t.refuse,missing:void 0}}:{}})};return e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-2 basis-full cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:!!r,onChange:l=>d(l.target.checked?{}:void 0),className:"w-4 h-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Also record it on the scanned item's own row"})]}),r&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Item queues"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Where the item's row waits, comma-separated. Empty: any I can read."}),e.jsx("input",{value:(r.roles??[]).join(", "),onChange:l=>{const b=se(l.target.value),{roles:i,...m}=r;d(b.length?{...m,roles:b}:m)},className:"input w-[14rem] font-mono",placeholder:"packing","aria-label":"Item queues"})]}),r&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Item row has"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"facet=value pairs, comma-separated."}),e.jsx("input",{value:Object.entries(r.facets??{}).map(([l,b])=>`${l}=${b}`).join(", "),onChange:l=>{const b=Object.fromEntries(se(l.target.value).map(c=>c.split("=").map(g=>g.trim())).filter(([c,g])=>c&&g!==void 0&&g!=="")),{facets:i,...m}=r;d(Object.keys(b).length?{...m,facets:b}:m)},className:"input w-[14rem] font-mono",placeholder:"shape=consolidated","aria-label":"Item row has"})]}),r&&t.refuse&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When the item is not waiting"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"What the station says when the scan is right but the item has no waiting row. Empty: the next step runs."}),e.jsx("input",{value:t.refuse.missing??"",onChange:l=>s({refuse:{...t.refuse,missing:l.target.value||void 0}}),className:"input w-full",placeholder:"That one is not waiting to be packed.","aria-label":"When the item is not waiting"})]})]})}function ae(t){return t.split(/[\s,]+/).map(Number).filter(s=>Number.isInteger(s)&&s>=10&&s<=99)}function $(t){return t.split(",").map(s=>s.trim()).filter(Boolean)}function Se({step:t,onPatch:s}){var c,g,k,w,S,u,A,v;const x=t.params??{},o=a=>s({params:{...x,...a}}),r=x.accumulate??{},d=r.from?"from":r.into?"into":"";if(t.verb===h.HOLD){const a=x.hold??{},j=p=>o({hold:{...a,...p}});return e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Hold for (seconds)"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"How long the station waits for the next scan (5–600, default 45)."}),e.jsx("input",{type:"number",min:5,max:600,value:a.ttlSeconds??"",onChange:p=>j({ttlSeconds:p.target.value?Number(p.target.value):void 0}),className:"input w-[10rem]",placeholder:"45"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Next scan schemes"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The scheme versions expected next, e.g. 14."}),e.jsx("input",{value:(((c=a.expect)==null?void 0:c.schemes)??[]).join(", "),onChange:p=>{const N=ae(p.target.value);j({expect:N.length?{...a.expect,schemes:N}:void 0})},className:"input w-[10rem] font-mono",placeholder:"14","aria-label":"Next scan schemes"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Headline"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["Where it goes, shown largest. ","{item.<facet>}"," reads the held row."]}),e.jsx("input",{value:a.headline??"",onChange:p=>j({headline:p.target.value||void 0}),className:"input w-[14rem] font-mono",placeholder:"{item.containerCode}","aria-label":"Headline"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Under the headline"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"A place name, e.g. the facility."}),e.jsx("input",{value:a.subline??"",onChange:p=>j({subline:p.target.value||void 0}),className:"input w-[14rem] font-mono",placeholder:"{item.locationName}","aria-label":"Under the headline"})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Ask for it"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["Markdown the station shows while holding. ","{item.<facet>}"," reads the held row."]}),e.jsx("input",{value:((g=a.expect)==null?void 0:g.prompt)??"",onChange:p=>a.expect&&j({expect:{...a.expect,prompt:p.target.value||void 0}}),disabled:!a.expect,className:"input w-full",placeholder:"Walk to **{item.containerCode}** and scan it.","aria-label":"Ask for it"})]})]})}const l=t.verb===h.FILL;if(t.verb!==h.ACCUMULATE&&!l)return null;const b=a=>{const{from:j,into:p,item:N,...L}=r;s({params:{...x,accumulate:{...L,...a==="from"?{from:"subject"}:{},...a==="into"?{into:"subject",...N?{item:N}:{}}:{}}},subject:a?t.subject??{schemes:[]}:void 0,match:a?t.match:void 0,refuse:a?t.refuse:void 0})},i=x.fill??{into:"subject"},m=l?i.into==="subject":!!d;return e.jsxs("div",{className:"flex flex-wrap gap-4",children:[l?e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Check off on"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The row whose expected items the scan checks off."}),e.jsxs("select",{value:i.into,onChange:a=>s({params:{...x,fill:{...i,into:a.target.value}},subject:a.target.value==="subject"?t.subject??{schemes:[]}:void 0}),className:"select",children:[e.jsx("option",{value:"subject",children:"The held item"}),e.jsx("option",{value:"scanned",children:"The scanned row"})]})]}):e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Held item"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Pair this scan with the item the station is holding."}),e.jsxs("select",{value:d,onChange:a=>b(a.target.value),className:"select",children:[e.jsx("option",{value:"",children:"Not used"}),e.jsx("option",{value:"from",children:"Goes into the scanned container"}),e.jsx("option",{value:"into",children:"Takes the scanned code"})]})]}),m&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Held from schemes ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The schemes the held item was scanned under, e.g. 11."}),e.jsx("input",{value:(((k=t.subject)==null?void 0:k.schemes)??[]).join(", "),onChange:a=>s({subject:{...t.subject,schemes:ae(a.target.value)}}),className:"input w-[10rem] font-mono",placeholder:"11","aria-label":"Held from schemes"})]}),m&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Only when the held item has"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"facet=value pairs, comma-separated; otherwise the next step runs."}),e.jsx("input",{value:Object.entries(((w=t.subject)==null?void 0:w.facets)??{}).map(([a,j])=>`${a}=${j}`).join(", "),onChange:a=>{const j=Object.fromEntries($(a.target.value).map(L=>L.split("=").map(_=>_.trim())).filter(([L,_])=>L&&_!==void 0&&_!=="")),{facets:p,...N}=t.subject??{schemes:[]};s({subject:Object.keys(j).length?{...N,facets:j}:N})},className:"input w-[14rem] font-mono",placeholder:"placement=unassigned","aria-label":"Only when the held item has"})]}),m&&!l&&e.jsxs("label",{className:"block flex-1 min-w-[14rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Must match"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["The scanned code must equal one of these, comma-separated, e.g. ","{subject.containerCode}","; a list facet such as ","{subject.offeredContainers}"," allows every entry."]}),e.jsx("input",{value:(((S=t.match)==null?void 0:S.target)??[]).join(", "),onChange:a=>{var p;const j=$(a.target.value);s({match:j.length||(p=t.match)!=null&&p.facets?{...t.match,target:j.length?j:void 0}:void 0})},className:"input w-full font-mono",placeholder:"{subject.containerCode}","aria-label":"Must match"})]}),d==="from"&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Shared facets"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The container must carry the held item's value for these."}),e.jsx("input",{value:(((u=t.match)==null?void 0:u.facets)??[]).join(", "),onChange:a=>{var p;const j=$(a.target.value);s({match:j.length||(p=t.match)!=null&&p.target?{...t.match,facets:j.length?j:void 0}:void 0})},className:"input w-[12rem] font-mono",placeholder:"containerKey","aria-label":"Shared facets"})]}),d==="from"&&t.refuse&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When no open container carries it"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"What the station says when the scan is right but nothing is open under that code. Empty: the next step runs."}),e.jsx("input",{value:t.refuse.missing??"",onChange:a=>s({refuse:{...t.refuse,missing:a.target.value||void 0}}),className:"input w-full",placeholder:"That container was just taken. Scan the item again.","aria-label":"When no open container carries it"})]}),d==="into"&&e.jsx(Ce,{step:t,onPatch:s}),m&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When it lands"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"What the station shows, large, once the write lands. Same tokens as the line below."}),e.jsx("input",{value:((A=t.done)==null?void 0:A.markdown)??"",onChange:a=>s({done:a.target.value?{markdown:a.target.value}:void 0}),className:"input w-full",placeholder:l?"{fill.filled} of {fill.total} checked off.":"Place it in **{container.containerCode}**. All good.","aria-label":"When it lands"})]}),m&&e.jsxs("label",{className:"block basis-full",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When it is the wrong one"}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["What the station says. ","{subject.<facet>}"," reads the held item",d==="from"?e.jsxs(e.Fragment,{children:[", ","{container.<facet>}"," the scanned container"]}):null,d==="into"&&r.item?e.jsxs(e.Fragment,{children:[", ","{item.<facet>}"," the scanned item's row"]}):null,l?e.jsxs(e.Fragment,{children:[", ","{fill.pending}"," what is still expected"]}):null,"."]}),e.jsx("input",{value:((v=t.refuse)==null?void 0:v.markdown)??"",onChange:a=>s({refuse:a.target.value?{...t.refuse,markdown:a.target.value}:void 0}),className:"input w-full",placeholder:"This one goes in **{subject.containerCode}**.","aria-label":"When it is the wrong one"})]})]})}const Te={[h.SHOW_DETAIL]:"Show the item",[h.SHOW_LIST]:"Show all matches as a list",[h.CLAIM]:"Claim",[h.CLAIM_SHOW_DETAIL]:"Claim and show the item",[h.RELEASE]:"Release my claim",[h.RESOLVE]:"Resolve with a canned payload",[h.ESCALATE]:"Send to another queue",[h.CANCEL]:"Cancel",[h.ACCUMULATE]:"Add to an accumulator",[h.PRESENT]:"Show reality + choices",[h.HOLD]:"Hold it for the next scan",[h.FILL]:"Check off one expected item"};function Ae({index:t,step:s,roleKeys:x,isLast:o,onPatch:r,onMove:d,onRemove:l}){var L,_,C,M,D,f,T,I,E,R,P,U,B,G,J,K,V,Y,z,Q,Z;const[b,i]=y.useState((L=s.params)!=null&&L.resolverPayload?JSON.stringify(s.params.resolverPayload,null,2):""),[m,c]=y.useState(null),g=n=>r({query:{...s.query,...n}}),k=n=>r({params:{...s.params,...n}}),w=n=>{if(i(n),!n.trim()){c(null),k({resolverPayload:void 0});return}try{k({resolverPayload:JSON.parse(n)}),c(null)}catch{c("Fix the JSON to save this payload.")}},S=s.query.roles??[],u=s.verb===h.PRESENT,A=s.verb===h.ESCALATE,v=s.verb===h.ACCUMULATE,a=v&&!!((C=(_=s.params)==null?void 0:_.accumulate)!=null&&C.containerFacet),j=v&&!!((D=(M=s.params)==null?void 0:M.accumulate)!=null&&D.from||(T=(f=s.params)==null?void 0:f.accumulate)!=null&&T.into),p=n=>{var O;return k({accumulate:{...(O=s.params)==null?void 0:O.accumulate,...n}})},N=s.verb===h.RESOLVE||s.verb===h.ESCALATE&&((I=s.params)==null?void 0:I.closeCurrent)==="resolve"||v;return e.jsxs("div",{className:"py-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-quaternary",children:["Step ",t+1]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>d(-1),disabled:t===0,className:"icon-link disabled:opacity-30",title:"Move up",children:e.jsx(ue,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:()=>d(1),disabled:o,className:"icon-link disabled:opacity-30",title:"Move down",children:e.jsx(be,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:l,className:"icon-link",title:"Remove step",children:e.jsx(W,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Look in"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queues the item is expected in — empty means any."}),e.jsx(ee,{values:S,options:x,onChange:n=>g({roles:n.length?n:void 0}),addLabel:"Add a queue…",emptyText:"Any queue I can see",ariaLabel:"Add a queue"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Held by"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Narrow to claimed, unclaimed, or my items."}),e.jsxs("select",{value:s.query.availability??"any",onChange:n=>g({availability:n.target.value==="any"?void 0:n.target.value}),className:"select",children:[e.jsx("option",{value:"any",children:"Anyone / unheld"}),e.jsx("option",{value:"available",children:"Unclaimed only"}),e.jsx("option",{value:"claimed",children:"Claimed only"}),e.jsx("option",{value:"mine",children:"Mine only"})]})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Then ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The action this step performs on a match."}),e.jsx("select",{value:s.verb,onChange:n=>{const O=n.target.value,X=O===h.FILL;r({verb:O,params:X?{fill:{into:"subject"}}:void 0,confirm:void 0,choices:void 0,autoSelectSingle:void 0,subject:X?{schemes:[]}:void 0,match:void 0,refuse:void 0})},className:"select",children:Object.entries(Te).map(([n,O])=>e.jsx("option",{value:n,children:O},n))})]}),A&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Send to ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queue the item re-homes to."}),e.jsxs("select",{value:((E=s.params)==null?void 0:E.targetRole)??"",onChange:n=>k({targetRole:n.target.value||void 0}),className:"select font-mono",children:[e.jsx("option",{value:"",disabled:!0,children:"Choose…"}),x.map(n=>e.jsx("option",{value:n,children:n},n))]})]}),A&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Current item"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Close out the located item first."}),e.jsxs("select",{value:((R=s.params)==null?void 0:R.closeCurrent)??"",onChange:n=>k({closeCurrent:n.target.value||void 0}),className:"select",children:[e.jsx("option",{value:"",children:"Leave it open"}),e.jsx("option",{value:"resolve",children:"Resolve it"}),e.jsx("option",{value:"cancel",children:"Cancel it"})]})]}),v&&!j&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Container facet"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Item mode: the scanned item's row carries this facet, and the container that shares its value receives the item. Empty means the scan names the container."}),e.jsx("input",{value:((U=(P=s.params)==null?void 0:P.accumulate)==null?void 0:U.containerFacet)??"",onChange:n=>p({containerFacet:n.target.value||void 0}),className:"input w-full min-w-[12rem] font-mono",placeholder:"binKey","aria-label":"Container facet"})]}),v&&!a&&!((G=(B=s.params)==null?void 0:B.accumulate)!=null&&G.into)&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Item key ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["The key the item is held under. ","{scan.target}"," fills from the scan; ","{subject.<facet>}"," reads the held item; ","{claim.<facet>}"," the acting user's live claim."]}),e.jsx("input",{value:((J=s.params)==null?void 0:J.itemKey)??"",onChange:n=>k({itemKey:n.target.value||void 0}),className:"input w-full min-w-[16rem] font-mono",placeholder:"{claim.orderId}","aria-label":"Item key"})]}),a&&e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Container queues"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queues the container is expected in — empty means any I can act on."}),e.jsx(ee,{values:((V=(K=s.params)==null?void 0:K.accumulate)==null?void 0:V.containerRoles)??[],options:x,onChange:n=>p({containerRoles:n.length?n:void 0}),addLabel:"Add a queue…",emptyText:"Any queue I can act on",ariaLabel:"Add a container queue"})]}),a&&e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:((z=(Y=s.params)==null?void 0:Y.accumulate)==null?void 0:z.reciprocal)!==!1,onChange:n=>p({reciprocal:n.target.checked?void 0:!1})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"Write the item's own row in the same statement, so it records which container holds it.",children:"Also record the container on the item"})]}),!u&&!s.subject&&s.verb!==h.HOLD&&s.verb!==h.FILL&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Confirmation"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Ask before acting — the prompt shows on the item."}),e.jsx("input",{value:((Q=s.confirm)==null?void 0:Q.prompt)??"",onChange:n=>r({confirm:n.target.value?{prompt:n.target.value}:void 0}),className:"input w-full min-w-[16rem]",placeholder:"Run without asking"})]}),e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!s.requireActingIdentity,onChange:n=>r({requireActingIdentity:n.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"This step runs only for a badged (or write-capable) user.",children:"Requires acting identity"})]}),u&&((Z=s.choices)==null?void 0:Z.length)===1&&e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!s.autoSelectSingle,onChange:n=>r({autoSelectSingle:n.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"With one choice, the scan runs it directly instead of presenting; a badge is still collected first when required.",children:"Auto-select the single choice"})]})]}),e.jsx(Se,{step:s,onPatch:r}),N&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:[v?"Item payload":"Resolver payload"," ",!v&&e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:[v?"Optional JSON stored on the item.":"JSON submitted as the resolution."," ","{scan.target}",", ","{scan.category}"," and ","{scan.scannedAt}"," fill in from the scan; ","{claim.<facet>}"," reads the acting user's live claim",a?e.jsxs(e.Fragment,{children:[", ","{item.<facet>}"," the scanned item's row"]}):null,"."]}),e.jsx("textarea",{value:b,onChange:n=>w(n.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:'{ "outcome": "collected", "serial": "{scan.target}" }'}),m&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:m})]}),u&&e.jsx(ke,{choices:s.choices??[],onChange:n=>r({choices:n.length?n:void 0,...n.length===1?{}:{autoSelectSingle:void 0}})})]})}const ne=()=>({query:{},verb:h.SHOW_DETAIL});function Ee({schemeVersion:t,schemeKind:s,category:x,rule:o,codePreview:r,onDeleted:d}){var M,D;const l=le(),b=ce(),{data:i}=re(),m=((i==null?void 0:i.roles)??[]).map(f=>f.role),c=s===q.IDENTITY,[g,k]=y.useState((o==null?void 0:o.name)??""),[w,S]=y.useState((o==null?void 0:o.steps)??(c?[]:[ne()])),[u,A]=y.useState(((M=o==null?void 0:o.fallback)==null?void 0:M.markdown)??""),[v,a]=y.useState(((D=o==null?void 0:o.notPrimed)==null?void 0:D.markdown)??""),[j,p]=y.useState((o==null?void 0:o.enabled)??!0),N=(f,T)=>S(I=>I.map((E,R)=>R===f?{...E,...T}:E)),L=(f,T)=>S(I=>{const E=[...I],R=f+T;return R<0||R>=E.length?I:([E[f],E[R]]=[E[R],E[f]],E)}),_=f=>S(T=>T.filter((I,E)=>E!==f)),C=()=>l.mutate({scheme_version:t,category:x,name:g,steps:c?[]:w,fallback:{markdown:u||void 0},notPrimed:{markdown:v||void 0},enabled:j});return e.jsxs("div",{className:"space-y-8 max-w-form",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["1 · Friendly name ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:c?'Name the badge population — "Associate badge".':'Print this beside the code — "Send Printer to Servicing".'}),e.jsx("input",{value:g,onChange:f=>k(f.target.value),className:"input w-full"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Status"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Disabled rules report unconfigured."}),e.jsxs("select",{value:j?"enabled":"disabled",onChange:f=>p(f.target.value==="enabled"),className:"select",children:[e.jsx("option",{value:"enabled",children:"Enabled"}),e.jsx("option",{value:"disabled",children:"Disabled"})]})]})]}),!c&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"block text-xs text-text-secondary",children:["2 · Conditions and actions ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary",children:'Scanning walks the steps in order — the first query that finds the item runs its action. Put the expected state first and a broad "show the item" last so a misplaced item still reports where it is.'})]}),e.jsx("div",{className:"divide-y divide-surface-border border-y border-surface-border",children:w.map((f,T)=>e.jsx(Ae,{index:T,step:f,roleKeys:m,isLast:T===w.length-1,onPatch:I=>N(T,I),onMove:I=>L(T,I),onRemove:()=>_(T)},T))}),e.jsxs("button",{type:"button",onClick:()=>S(f=>[...f,ne()]),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover",children:[e.jsx(H,{className:"w-3.5 h-3.5"})," Add a step"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:c?"2 · When the badge is unknown":"3 · When nothing matches"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:c?"Markdown shown when a scanned badge matches no user.":"Markdown shown to the scanner operator when no step finds the item."}),e.jsx("textarea",{value:u,onChange:f=>A(f.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:c?"**Badge not recognized.** See your lead to get it registered.":"**Nothing here.** The item this code points at is not in any queue."})]}),!c&&e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When a badge is required"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Markdown shown when a step or choice needs an acting identity and none is primed."}),e.jsx("textarea",{value:v,onChange:f=>a(f.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:"**Scan your badge** to run this action."})]})]}),l.error&&e.jsx("p",{className:"text-xs text-status-error",children:l.error.message}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:C,disabled:!g||!c&&w.length===0||l.isPending,className:"btn-primary text-xs",children:o?"Save rule":`Create rule ${t}:${x}`}),e.jsx("span",{className:"text-2xs text-text-quaternary font-mono",children:r}),o&&e.jsxs("button",{type:"button",onClick:()=>b.mutate({scheme_version:t,category:x},{onSuccess:d}),className:"ml-auto flex items-center gap-1 text-xs text-status-error/80 hover:text-status-error",children:[e.jsx(W,{className:"w-3.5 h-3.5"})," Delete rule"]})]})]})}function Le(t){for(let s=0;s<=9;s++)if(!t.has(String(s)))return String(s);return null}function F({icon:t,label:s,annotation:x,aside:o,children:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(t,{className:"w-3 h-3 text-text-tertiary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:s}),x&&e.jsxs("span",{className:"text-2xs text-text-quaternary truncate",children:["— ",x]})]}),o]}),e.jsx("div",{className:"border-l-2 pl-5 border-surface-border/60",children:r})]})}function $e(){const{version:t}=ge(),s=Number(t),[x,o]=Ne(),{data:r,isLoading:d}=oe(Number.isInteger(s)?s:null),l=x.get("category"),b=u=>{o(A=>{const v=new URLSearchParams(A);return u?v.set("category",u):v.delete("category"),v})};if(d)return e.jsx("div",{className:"text-sm text-text-tertiary",children:"Loading…"});if(!r)return e.jsxs("div",{className:"text-sm text-text-tertiary",children:["No scheme for version ",t,"."]});const{scheme:i,rules:m}=r,c=new Map(m.map(u=>[u.category,u])),g=l?c.get(l)??null:null,k=Le(new Set(m.map(u=>u.category))),w=i.encoding==="fixed"?"7".repeat(i.target_length??8):"SN-1234",S=u=>i.encoding==="gtin"?"036000291452":i.encoding==="fixed"?`${i.version}${u}${w}`:`${i.version}${i.delimiter}${u}${i.delimiter}${w}`;return e.jsxs("div",{className:"space-y-10",children:[e.jsx(me,{title:i.name}),e.jsxs("p",{className:"text-sm text-text-secondary max-w-form -mt-4",children:["Codes for this scheme start with ",e.jsx("span",{className:"font-mono text-text-primary",children:i.version}),".",i.kind===q.IDENTITY?" Scanning a badge primes who acts next; each slot names the badge and its unknown-badge message.":" Add an action, name it, and configure what a scan does — each action gets its own slot automatically."]}),e.jsx(Ie,{scheme:i,ruleCount:m.length},i.version),e.jsx(F,{icon:pe,label:"Actions",annotation:i.kind===q.IDENTITY?"named badge slots — each carries its unknown-badge message":"what a scan of this scheme does — named, in the order you add them",children:e.jsxs("div",{className:"divide-y divide-surface-border border-y border-surface-border max-w-form",children:[m.map(u=>{const A=l===u.category;return e.jsxs("button",{type:"button",onClick:()=>b(A?null:u.category),className:`w-full flex items-center gap-4 py-3 px-2 text-left transition-colors ${A?"bg-accent/10":"hover:bg-surface-sunken"}`,children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-xs font-mono text-accent border border-surface-border rounded shrink-0",children:u.category}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text-primary truncate",children:u.name}),e.jsx("div",{className:"text-2xs text-text-tertiary font-mono truncate",children:S(u.category)})]})]},u.category)}),e.jsxs("div",{className:"flex items-center gap-4 py-3 px-2",children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-text-quaternary shrink-0",children:e.jsx(te,{className:"w-4 h-4",strokeWidth:1.5})}),k==null?e.jsx("span",{className:"text-2xs text-text-quaternary",children:"All 10 action slots are in use."}):e.jsxs("button",{type:"button",onClick:()=>b(k),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover",children:[e.jsx(H,{className:"w-3.5 h-3.5"})," Add an action"]})]})]})}),l&&e.jsx(F,{icon:te,label:g?g.name:"New action",annotation:`this label prints beside the code — e.g. ${S(l)}`,children:e.jsx(Ee,{schemeVersion:i.version,schemeKind:i.kind,category:l,rule:g,codePreview:S(l),onDeleted:()=>b(null)},`${i.version}:${l}`)})]})}function Ie({scheme:t,ruleCount:s}){const x=fe(),o=ie(),r=xe(),[d,l]=y.useState(t.name),[b,i]=y.useState(t.kind),[m,c]=y.useState(t.target_facet),[g,k]=y.useState(t.grant_ttl_seconds??3600),[w,S]=y.useState(t.grant_max_uses??0),[u,A]=y.useState(t.grant_scope??"action"),[v,a]=y.useState(t.enabled),[j,p]=y.useState(!1),N=b===q.IDENTITY,L=!N||g>=1&&g<=86400,_=d!==t.name||m!==t.target_facet||v!==t.enabled||b!==t.kind||N&&(g!==t.grant_ttl_seconds||w!==t.grant_max_uses||u!==(t.grant_scope??"action"));return e.jsxs(F,{icon:je,label:"Scheme",annotation:`version digit ${t.version}`,aside:e.jsxs("button",{type:"button",onClick:()=>p(!0),className:"flex items-center gap-1 text-xs text-status-error/80 hover:text-status-error",children:[e.jsx(W,{className:"w-3.5 h-3.5"})," Delete scheme"]}),children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4 max-w-form",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Kind ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"A badge — scanning it primes who acts next.":"An item code — scanning it acts on the item."}),e.jsxs("select",{value:b,onChange:C=>i(C.target.value),className:"select",children:[e.jsx("option",{value:q.ACTION,children:"Action"}),e.jsx("option",{value:q.IDENTITY,children:"Identity"})]})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Name ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"Say who the badge identifies.":"Say what the target identifies."}),e.jsx("input",{value:d,onChange:C=>l(C.target.value),className:"input w-full"})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Target facet ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"The user-metadata key the badge matches (e.g. badge_id).":"The metadata key the scanned value matches."}),e.jsx("input",{value:m,onChange:C=>c(C.target.value),className:"input w-full font-mono"})]}),N&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Grant TTL (seconds) ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"How long a badge scan stays primed (1–86400)."}),e.jsx("input",{type:"number",min:1,max:86400,value:g,onChange:C=>k(Number(C.target.value)),className:"input w-[12rem]"}),!L&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:"Enter 1–86400 seconds."})]}),N&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Grant max uses"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"0 = TTL-bound; n = the grant covers n acts."}),e.jsx("input",{type:"number",min:0,value:w,onChange:C=>S(Number(C.target.value)),className:"input w-[12rem]"})]}),N&&e.jsx(he,{value:u,onChange:A}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Status"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Disable to reject every scan of this version."}),e.jsxs("select",{value:v?"enabled":"disabled",onChange:C=>a(C.target.value==="enabled"),className:"select",children:[e.jsx("option",{value:"enabled",children:"Enabled"}),e.jsx("option",{value:"disabled",children:"Disabled"})]})]}),_&&e.jsx("button",{type:"button",disabled:o.isPending||!d||!m||!L,onClick:()=>o.mutate({version:t.version,name:d,description:t.description,target_facet:m,encoding:t.encoding,delimiter:t.delimiter,target_length:t.target_length,kind:b,grant_ttl_seconds:N?g:null,grant_max_uses:N?w:0,grant_scope:N?u:"action",enabled:v}),className:"btn-primary text-xs",children:"Save"})]}),o.error&&e.jsx("p",{className:"text-xs text-status-error mt-2",children:o.error.message}),e.jsx(de,{open:j,onClose:()=>p(!1),onConfirm:()=>r.mutate(t.version,{onSuccess:()=>x("/admin/scan-codes")}),title:`Delete scheme ${t.version}`,description:s>0?`This deletes "${t.name}" and its ${s} ${s===1?"rule":"rules"}. Codes starting with ${t.version} stop resolving, and labels already printed with them report unconfigured.`:`This deletes "${t.name}". Codes starting with ${t.version} stop resolving.`,isPending:r.isPending,error:r.error})]})}export{$e as ScanSchemeDetailPage};
2
+ //# sourceMappingURL=ScanSchemeDetailPage-CTW6gofi.js.map