@hotmeshio/long-tail 0.17.1 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AdminDashboard-D-YHIR8w.js → AdminDashboard-B_AVB7tk.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-D-YHIR8w.js.map → AdminDashboard-B_AVB7tk.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-CG54Ll2A.js → AgentConfigPage-JoZko3JB.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-CG54Ll2A.js.map → AgentConfigPage-JoZko3JB.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-rTcofeW4.js → AgentDetailPage-DfpR2Fgg.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-rTcofeW4.js.map → AgentDetailPage-DfpR2Fgg.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-B7PNjrkn.js → AgentsPage-F2ixDk1Q.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-B7PNjrkn.js.map → AgentsPage-F2ixDk1Q.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-D-W4OP55.js +2 -0
- package/dashboard/dist/assets/{AvailableEscalationsPage-CEDwyzlx.js.map → AvailableEscalationsPage-D-W4OP55.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-cg1qXRF3.js → BotPicker-B8Yal8Mm.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-cg1qXRF3.js.map → BotPicker-B8Yal8Mm.js.map} +1 -1
- package/dashboard/dist/assets/BulkAssignModal-ySfoaF7f.js +2 -0
- package/dashboard/dist/assets/{BulkAssignModal-BDzaHGAb.js.map → BulkAssignModal-ySfoaF7f.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-CswExj9-.js → CapabilitiesPage-BSJ2oFj6.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-CswExj9-.js.map → CapabilitiesPage-BSJ2oFj6.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-CpVKfkkq.js → CollapsibleSection-CcV88IUy.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-CpVKfkkq.js.map → CollapsibleSection-CcV88IUy.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-ClJhYGg1.js → CountdownTimer-C-E9MXMk.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-ClJhYGg1.js.map → CountdownTimer-C-E9MXMk.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-DYBp7v8W.js → CredentialsPage-DrydlZ65.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-DYBp7v8W.js.map → CredentialsPage-DrydlZ65.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-Bd_fipHy.js → CronLabel-BxQmJXos.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-Bd_fipHy.js.map → CronLabel-BxQmJXos.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-B-Wn6Y8B.js → ElapsedCell-lszUXiyP.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-B-Wn6Y8B.js.map → ElapsedCell-lszUXiyP.js.map} +1 -1
- package/dashboard/dist/assets/{EntityTimelinePanel-DcgFUbk4.js → EntityTimelinePanel-CwzIV87U.js} +2 -2
- package/dashboard/dist/assets/{EntityTimelinePanel-DcgFUbk4.js.map → EntityTimelinePanel-CwzIV87U.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-DpnorXeU.js → EscalationListSchemaPage-D16uUVcG.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-DpnorXeU.js.map → EscalationListSchemaPage-D16uUVcG.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-LPTJJDfP.js → EscalationSchemaPage-BLM3dUEw.js} +2 -2
- package/dashboard/dist/assets/{EscalationSchemaPage-LPTJJDfP.js.map → EscalationSchemaPage-BLM3dUEw.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-Bq5_ICUt.js → EscalationsOverview-BlFjoKlR.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-Bq5_ICUt.js.map → EscalationsOverview-BlFjoKlR.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-Cinbdm1u.js → EventTable-rTkMR8Zf.js} +2 -2
- package/dashboard/dist/assets/{EventTable-Cinbdm1u.js.map → EventTable-rTkMR8Zf.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-DyojX5m4.js → FilterBar-BeVBUdfJ.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-DyojX5m4.js.map → FilterBar-BeVBUdfJ.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-Ba5fNcgv.js → GraphInvokePage-BV60xkVy.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-Ba5fNcgv.js.map → GraphInvokePage-BV60xkVy.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-DuFXqfz3.js → HomePage-BA0RYzFc.js} +2 -2
- package/dashboard/dist/assets/{HomePage-DuFXqfz3.js.map → HomePage-BA0RYzFc.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-GpwHcjkZ.js → ListToolbar-4IfsUXfV.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-GpwHcjkZ.js.map → ListToolbar-4IfsUXfV.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-Bi23-hih.js → McpOverview-gDegMXvF.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-Bi23-hih.js.map → McpOverview-gDegMXvF.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-FhHSfX9W.js → McpQueryDetailPage-CnCffPks.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-FhHSfX9W.js.map → McpQueryDetailPage-CnCffPks.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-czMlM7vR.js → McpQueryPage-CLEMtLOG.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-czMlM7vR.js.map → McpQueryPage-CLEMtLOG.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-BOh2M0Ca.js → McpRunDetailPage-tr-lrWVv.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-BOh2M0Ca.js.map → McpRunDetailPage-tr-lrWVv.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-DfJzbGYM.js → McpRunsPage-nE0d_1Px.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-DfJzbGYM.js.map → McpRunsPage-nE0d_1Px.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-BS8blKLj.js → OperationsPage-C8h1DN5Q.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-BS8blKLj.js.map → OperationsPage-C8h1DN5Q.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-BWtTKrcJ.js → OperatorDashboard-DCG8BFKE.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-BWtTKrcJ.js.map → OperatorDashboard-DCG8BFKE.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-VkhuauBf.js → PersonaDetailPage-BEVeJr1q.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-VkhuauBf.js.map → PersonaDetailPage-BEVeJr1q.js.map} +1 -1
- package/dashboard/dist/assets/PersonasPage-B5fj2AK6.js +2 -0
- package/dashboard/dist/assets/{PersonasPage-DRoneLfx.js.map → PersonasPage-B5fj2AK6.js.map} +1 -1
- package/dashboard/dist/assets/ProcessDetailPage-CWGby6KD.js +2 -0
- package/dashboard/dist/assets/{ProcessDetailPage-B5mmkHS0.js.map → ProcessDetailPage-CWGby6KD.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-BV0e2OfH.js → ProcessesListPage-nFdLMlfb.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-BV0e2OfH.js.map → ProcessesListPage-nFdLMlfb.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-OmOdRm1F.js +8 -0
- package/dashboard/dist/assets/{RoleDetailPage-eenl_a5Z.js.map → RoleDetailPage-OmOdRm1F.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-BLfJcFf7.js → RolesPage-DwprdPCA.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-BLfJcFf7.js.map → RolesPage-DwprdPCA.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-BnLKKs51.js → RunAsSelector-DGw9EKSR.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-BnLKKs51.js.map → RunAsSelector-DGw9EKSR.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-BWIcjnr4.js → ScanCodesPage-RPi4qZ_l.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-BWIcjnr4.js.map → ScanCodesPage-RPi4qZ_l.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-sAuU8cZj.js → ScanSchemeDetailPage-BKc4lUjc.js} +2 -2
- package/dashboard/dist/assets/{ScanSchemeDetailPage-sAuU8cZj.js.map → ScanSchemeDetailPage-BKc4lUjc.js.map} +1 -1
- package/dashboard/dist/assets/{ScanStationPage-CA_q1uaI.js → ScanStationPage-DUfxcntB.js} +2 -2
- package/dashboard/dist/assets/{ScanStationPage-CA_q1uaI.js.map → ScanStationPage-DUfxcntB.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-sVI21e82.js → StickyPagination-DXOk5z5X.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-sVI21e82.js.map → StickyPagination-DXOk5z5X.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-Djm_zQAv.js → StreamMessageDetail-BB1h2zZN.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-Djm_zQAv.js.map → StreamMessageDetail-BB1h2zZN.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-CwxXRmRQ.js → SwimlaneTimeline-CapKokLg.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-CwxXRmRQ.js.map → SwimlaneTimeline-CapKokLg.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-SiBSTsfp.js → TaskDetailPage-Dfzdp97x.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-SiBSTsfp.js.map → TaskDetailPage-Dfzdp97x.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-CBTFz3Bp.js → TasksListPage-DxlS7PTD.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-CBTFz3Bp.js.map → TasksListPage-DxlS7PTD.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-Ctwwdamz.js → TimeAgo-Bv5viQ1m.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-Ctwwdamz.js.map → TimeAgo-Bv5viQ1m.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-CI8UrDuQ.js → TimestampCell-DXNBf_eb.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-CI8UrDuQ.js.map → TimestampCell-DXNBf_eb.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-Cf9ZEBF7.js → ToolTestPanel-f32mir7Q.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-Cf9ZEBF7.js.map → ToolTestPanel-f32mir7Q.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-BYIOSVNy.js → TopicDetailPage-D-N8Vsd4.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-BYIOSVNy.js.map → TopicDetailPage-D-N8Vsd4.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-C9x4tIEi.js → TopicsPage-hqlu32wg.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-C9x4tIEi.js.map → TopicsPage-hqlu32wg.js.map} +1 -1
- package/dashboard/dist/assets/UserName-BhA_ItNN.js +2 -0
- package/dashboard/dist/assets/{UserName-Ck-eLb-1.js.map → UserName-BhA_ItNN.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-BPxoPK8g.js → WorkflowExecutionPage-BAgMKnhe.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-BPxoPK8g.js.map → WorkflowExecutionPage-BAgMKnhe.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-CDHQUYEr.js → WorkflowsDashboard-B2wYT_hj.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-CDHQUYEr.js.map → WorkflowsDashboard-B2wYT_hj.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-DGp8J0G2.js → WorkflowsOverview--jC5F9lz.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-DGp8J0G2.js.map → WorkflowsOverview--jC5F9lz.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-B112bGAY.js → YamlWorkflowDetailPage-BdB5eX8s.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-B112bGAY.js.map → YamlWorkflowDetailPage-BdB5eX8s.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-Cw5wddH7.js → YamlWorkflowsPage-BUQQU9II.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-Cw5wddH7.js.map → YamlWorkflowsPage-BUQQU9II.js.map} +1 -1
- package/dashboard/dist/assets/{agents-CZ8WIdWH.js → agents-BF_S1J_z.js} +2 -2
- package/dashboard/dist/assets/{agents-CZ8WIdWH.js.map → agents-BF_S1J_z.js.map} +1 -1
- package/dashboard/dist/assets/{bots-Xu3MUuXN.js → bots-CGlEoWAu.js} +2 -2
- package/dashboard/dist/assets/{bots-Xu3MUuXN.js.map → bots-CGlEoWAu.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-XJukFiLn.js → capabilities-Pq8pG0kX.js} +2 -2
- package/dashboard/dist/assets/{capabilities-XJukFiLn.js.map → capabilities-Pq8pG0kX.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-D8ZQQUAV.js → controlplane-dY6a4iYT.js} +2 -2
- package/dashboard/dist/assets/{controlplane-D8ZQQUAV.js.map → controlplane-dY6a4iYT.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-C1GyAMeK.js → escalation-columns-CBUTda5U.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-C1GyAMeK.js.map → escalation-columns-CBUTda5U.js.map} +1 -1
- package/dashboard/dist/assets/{index-CRxbF5vt.js → index-BHfISWyn.js} +2 -2
- package/dashboard/dist/assets/{index-CRxbF5vt.js.map → index-BHfISWyn.js.map} +1 -1
- package/dashboard/dist/assets/{index-DCaGxwKU.js → index-BTksPQZe.js} +2 -2
- package/dashboard/dist/assets/{index-DCaGxwKU.js.map → index-BTksPQZe.js.map} +1 -1
- package/dashboard/dist/assets/{index-Dc43wixL.js → index-BWtW5puE.js} +2 -2
- package/dashboard/dist/assets/{index-Dc43wixL.js.map → index-BWtW5puE.js.map} +1 -1
- package/dashboard/dist/assets/{index-D_5_1D7U.js → index-Bn-6MP9-.js} +2 -2
- package/dashboard/dist/assets/{index-D_5_1D7U.js.map → index-Bn-6MP9-.js.map} +1 -1
- package/dashboard/dist/assets/{index-CHAmwNDI.js → index-BrFGgfjR.js} +2 -2
- package/dashboard/dist/assets/{index-CHAmwNDI.js.map → index-BrFGgfjR.js.map} +1 -1
- package/dashboard/dist/assets/{index-DFmV19fc.js → index-ByYeo8P7.js} +2 -2
- package/dashboard/dist/assets/{index-DFmV19fc.js.map → index-ByYeo8P7.js.map} +1 -1
- package/dashboard/dist/assets/{index-CgGR0kM6.js → index-CivQGQpu.js} +3 -3
- package/dashboard/dist/assets/{index-CgGR0kM6.js.map → index-CivQGQpu.js.map} +1 -1
- package/dashboard/dist/assets/{index-DeRM0-Xz.js → index-CwQn-nhR.js} +2 -2
- package/dashboard/dist/assets/{index-DeRM0-Xz.js.map → index-CwQn-nhR.js.map} +1 -1
- package/dashboard/dist/assets/{index-COtlcGK_.js → index-D0bjzVum.js} +2 -2
- package/dashboard/dist/assets/{index-COtlcGK_.js.map → index-D0bjzVum.js.map} +1 -1
- package/dashboard/dist/assets/{index-DWhyH1kV.js → index-D1KCPoRr.js} +2 -2
- package/dashboard/dist/assets/{index-DWhyH1kV.js.map → index-D1KCPoRr.js.map} +1 -1
- package/dashboard/dist/assets/index-D9rtK9QF.js +67 -0
- package/dashboard/dist/assets/index-D9rtK9QF.js.map +1 -0
- package/dashboard/dist/assets/{index-DYIy3uT5.js → index-DrlZc3C0.js} +2 -2
- package/dashboard/dist/assets/{index-DYIy3uT5.js.map → index-DrlZc3C0.js.map} +1 -1
- package/dashboard/dist/assets/index-U7HShN30.js +2 -0
- package/dashboard/dist/assets/{index-CR96SICL.js.map → index-U7HShN30.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-sjJNIdJY.js → knowledge-8_TilyaY.js} +2 -2
- package/dashboard/dist/assets/{knowledge-sjJNIdJY.js.map → knowledge-8_TilyaY.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CQeu19Jf.js → mcp-hY3O2HJa.js} +2 -2
- package/dashboard/dist/assets/{mcp-CQeu19Jf.js.map → mcp-hY3O2HJa.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-B9GuC88j.js → mcp-query-CA8NEf2e.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-B9GuC88j.js.map → mcp-query-CA8NEf2e.js.map} +1 -1
- package/dashboard/dist/assets/{personas-CQr9sXg3.js → personas-DrWgQ94s.js} +2 -2
- package/dashboard/dist/assets/{personas-CQr9sXg3.js.map → personas-DrWgQ94s.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-DzMf-VE7.js → pipelines-DdgSlafC.js} +2 -2
- package/dashboard/dist/assets/{pipelines-DzMf-VE7.js.map → pipelines-DdgSlafC.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-QKuXlyLe.js → tasks-UyjER1TA.js} +2 -2
- package/dashboard/dist/assets/{tasks-QKuXlyLe.js.map → tasks-UyjER1TA.js.map} +1 -1
- package/dashboard/dist/assets/{topics-DQAQnGV7.js → topics-CIc5SpT_.js} +2 -2
- package/dashboard/dist/assets/{topics-DQAQnGV7.js.map → topics-CIc5SpT_.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-DuE9Mj3I.js → useDebouncedValue-CmUqBRK4.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-DuE9Mj3I.js.map → useDebouncedValue-CmUqBRK4.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-BTCrNkwo.js → useNamespace-BOZOwXTE.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-BTCrNkwo.js.map → useNamespace-BOZOwXTE.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-_aa1_rNu.js → useYamlActivityEvents-BsTpIsba.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-_aa1_rNu.js.map → useYamlActivityEvents-BsTpIsba.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-CEWX3imM.js → workflows-BkFI3IwE.js} +2 -2
- package/dashboard/dist/assets/{workflows-CEWX3imM.js.map → workflows-BkFI3IwE.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-Bek1Mg86.js → yaml-workflows-CeeqNi9k.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-Bek1Mg86.js.map → yaml-workflows-CeeqNi9k.js.map} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/package.json +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CEDwyzlx.js +0 -2
- package/dashboard/dist/assets/BulkAssignModal-BDzaHGAb.js +0 -2
- package/dashboard/dist/assets/PersonasPage-DRoneLfx.js +0 -2
- package/dashboard/dist/assets/ProcessDetailPage-B5mmkHS0.js +0 -2
- package/dashboard/dist/assets/RoleDetailPage-eenl_a5Z.js +0 -8
- package/dashboard/dist/assets/UserName-Ck-eLb-1.js +0 -2
- package/dashboard/dist/assets/index-BEeGFfuP.js +0 -67
- package/dashboard/dist/assets/index-BEeGFfuP.js.map +0 -1
- package/dashboard/dist/assets/index-CR96SICL.js +0 -2
- package/dashboard/dist/assets/users-D-DhFQBy.js +0 -2
- package/dashboard/dist/assets/users-D-DhFQBy.js.map +0 -1
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-BV0e2OfH.js","./vendor-query-RUZdMvN6.js","./tasks-QKuXlyLe.js","./workflows-CEWX3imM.js","./useFilterParams-crmlBw_l.js","./vendor-react-CdqEC2zv.js","./useDebouncedValue-DuE9Mj3I.js","./api-path-u2Jf9QXS.js","./DataTable-DFPMeqyQ.js","./EmptyState-lpUFYfun.js","./TimestampCell-CI8UrDuQ.js","./StickyPagination-sVI21e82.js","./FilterBar-DyojX5m4.js","./vendor-icons-h-jlRSb9.js","./PageHeader-CFVw67M6.js","./ListToolbar-GpwHcjkZ.js","./WorkflowPill-CN-952iI.js","./ProcessDetailPage-B5mmkHS0.js","./PageHeaderWithStats-D9tQxILm.js","./StatusBadge-BDeUwPtb.js","./RolePill-Di_5hfvw.js","./UserName-Ck-eLb-1.js","./users-D-DhFQBy.js","./McpOverview-Bi23-hih.js","./mcp-CQeu19Jf.js","./pipelines-DzMf-VE7.js","./yaml-workflows-Bek1Mg86.js","./controlplane-D8ZQQUAV.js","./StatCard-BXQ8dD9Y.js","./McpRunsPage-DfJzbGYM.js","./useNamespace-BTCrNkwo.js","./ElapsedCell-B-Wn6Y8B.js","./RowActions-eYrzgQSj.js","./McpRunDetailPage-BOh2M0Ca.js","./SegmentedTabs-DXNzY05q.js","./EventTable-Cinbdm1u.js","./SwimlaneTimeline-CwxXRmRQ.js","./StreamMessageDetail-Djm_zQAv.js","./CopyableId-4Lqlc5cU.js","./McpQueryPage-czMlM7vR.js","./mcp-query-B9GuC88j.js","./McpQueryDetailPage-FhHSfX9W.js","./TagInput-BLwxTNsI.js","./CollapsibleSection-CpVKfkkq.js","./useYamlActivityEvents-_aa1_rNu.js","./helpers-DzO-OGPe.js","./RunAsSelector-BnLKKs51.js","./BotPicker-cg1qXRF3.js","./bots-Xu3MUuXN.js","./ToolPill-C6hkOqPx.js","./TimeAgo-Ctwwdamz.js","./EscalationsOverview-Bq5_ICUt.js","./AvailableEscalationsPage-CEDwyzlx.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-BDzaHGAb.js","./Modal-BU7No9NH.js","./constants-BHkpVaqx.js","./escalation-columns-C1GyAMeK.js","./EntityTimelinePanel-DcgFUbk4.js","./PriorityBadge-BETdj4M-.js","./CountdownTimer-ClJhYGg1.js","./OperatorDashboard-BWtTKrcJ.js","./index-CgGR0kM6.js","./metadata-display-DHjqWkLG.js","./WorkflowsOverview-DGp8J0G2.js","./index-DFmV19fc.js","./NamespacePill-DONj6eUU.js","./WorkflowsDashboard-CDHQUYEr.js","./YamlWorkflowsPage-Cw5wddH7.js","./GraphInvokePage-Ba5fNcgv.js","./YamlWorkflowDetailPage-B112bGAY.js","./TasksListPage-CBTFz3Bp.js","./TaskDetailPage-SiBSTsfp.js","./WorkflowExecutionPage-BPxoPK8g.js","./AdminDashboard-D-YHIR8w.js","./index-CHAmwNDI.js","./TaskQueuePill-DVgcqd-h.js","./index-DCaGxwKU.js","./ConfirmDeleteModal-CQsJUzEa.js","./index-Dc43wixL.js","./ToolTestPanel-Cf9ZEBF7.js","./index-DYIy3uT5.js","./index-CR96SICL.js","./personas-CQr9sXg3.js","./ScopeBadge-CqIIeWjK.js","./RolesPage-BLfJcFf7.js","./RoleDetailPage-eenl_a5Z.js","./AutoGrowTextarea-DgEQeRQw.js","./PersonasPage-DRoneLfx.js","./PersonaDetailPage-VkhuauBf.js","./EscalationSchemaPage-LPTJJDfP.js","./EscalationListSchemaPage-DpnorXeU.js","./ScanCodesPage-BWIcjnr4.js","./ScanSchemeDetailPage-sAuU8cZj.js","./ScanStationPage-CA_q1uaI.js","./index-DeRM0-Xz.js","./OperationsPage-BS8blKLj.js","./index-DWhyH1kV.js","./index-CRxbF5vt.js","./CredentialsPage-DYBp7v8W.js","./index-D_5_1D7U.js","./DropZone-Pv-v5RAs.js","./index-COtlcGK_.js","./knowledge-sjJNIdJY.js","./HomePage-DuFXqfz3.js","./AgentsPage-B7PNjrkn.js","./agents-CZ8WIdWH.js","./AgentDetailPage-rTcofeW4.js","./CronLabel-Bd_fipHy.js","./AgentConfigPage-CG54Ll2A.js","./capabilities-XJukFiLn.js","./topics-DQAQnGV7.js","./CapabilitiesPage-CswExj9-.js","./TopicsPage-C9x4tIEi.js","./TopicDetailPage-BYIOSVNy.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var lw=Object.defineProperty;var cw=(r,t,s)=>t in r?lw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var A=(r,t,s)=>cw(r,typeof t!="symbol"?t+"":t,s);import{r as uw,u as lt,a as j,j as p,b as ot,c as mt,g as fw,Q as hw,d as dw}from"./vendor-query-RUZdMvN6.js";import{r as mw,u as _o,a as vn,b as fb,L as Fs,N as Ki,c as Gn,O as $i,d as pw,R as yw}from"./vendor-react-CdqEC2zv.js";import{X as Ft,E as gw,S as bw,M as vw,a as hu,b as xw,C as hb,c as ed,I as td,R as db,B as mb,U as _w,d as ww,L as Sw,e as Ew,Z as Ow,P as Gy,f as pb,g as Aw,h as Fy,i as Vy,j as Yy,k as jw,W as kd,l as Tw,m as kw,F as Nw,n as yb,o as Cw,D as Mw,N as Rw,p as Dw,q as gb,r as bb,s as vb,t as xb,u as qw,v as Lw,w as Bw,G as Pw,T as Uw,x as zw,y as Iw,z as $w}from"./vendor-icons-h-jlRSb9.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const m of c.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();var qh={exports:{}},Xa={},Lh={exports:{}},Bh={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* scheduler.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Ky;function Hw(){return Ky||(Ky=1,(function(r){function t(Y,ae){var de=Y.length;Y.push(ae);e:for(;0<de;){var Oe=de-1>>>1,oe=Y[Oe];if(0<l(oe,ae))Y[Oe]=ae,Y[de]=oe,de=Oe;else break e}}function s(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var ae=Y[0],de=Y.pop();if(de!==ae){Y[0]=de;e:for(var Oe=0,oe=Y.length,je=oe>>>1;Oe<je;){var Se=2*(Oe+1)-1,ke=Y[Se],We=Se+1,Ae=Y[We];if(0>l(ke,de))We<oe&&0>l(Ae,ke)?(Y[Oe]=Ae,Y[We]=de,Oe=We):(Y[Oe]=ke,Y[Se]=de,Oe=Se);else if(We<oe&&0>l(Ae,de))Y[Oe]=Ae,Y[We]=de,Oe=We;else break e}}return ae}function l(Y,ae){var de=Y.sortIndex-ae.sortIndex;return de!==0?de:Y.id-ae.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;r.unstable_now=function(){return c.now()}}else{var m=Date,y=m.now();r.unstable_now=function(){return m.now()-y}}var g=[],f=[],d=1,b=null,v=3,x=!1,w=!1,S=!1,M=!1,L=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,re=typeof setImmediate<"u"?setImmediate:null;function ce(Y){for(var ae=s(f);ae!==null;){if(ae.callback===null)i(f);else if(ae.startTime<=Y)i(f),ae.sortIndex=ae.expirationTime,t(g,ae);else break;ae=s(f)}}function C(Y){if(S=!1,ce(Y),!w)if(s(g)!==null)w=!0,P||(P=!0,J());else{var ae=s(f);ae!==null&&Te(C,ae.startTime-Y)}}var P=!1,se=-1,X=5,B=-1;function G(){return M?!0:!(r.unstable_now()-B<X)}function W(){if(M=!1,P){var Y=r.unstable_now();B=Y;var ae=!0;try{e:{w=!1,S&&(S=!1,U(se),se=-1),x=!0;var de=v;try{t:{for(ce(Y),b=s(g);b!==null&&!(b.expirationTime>Y&&G());){var Oe=b.callback;if(typeof Oe=="function"){b.callback=null,v=b.priorityLevel;var oe=Oe(b.expirationTime<=Y);if(Y=r.unstable_now(),typeof oe=="function"){b.callback=oe,ce(Y),ae=!0;break t}b===s(g)&&i(g),ce(Y)}else i(g);b=s(g)}if(b!==null)ae=!0;else{var je=s(f);je!==null&&Te(C,je.startTime-Y),ae=!1}}break e}finally{b=null,v=de,x=!1}ae=void 0}}finally{ae?J():P=!1}}}var J;if(typeof re=="function")J=function(){re(W)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,xe=he.port2;he.port1.onmessage=W,J=function(){xe.postMessage(null)}}else J=function(){L(W,0)};function Te(Y,ae){se=L(function(){Y(r.unstable_now())},ae)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(Y){Y.callback=null},r.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<Y?Math.floor(1e3/Y):5},r.unstable_getCurrentPriorityLevel=function(){return v},r.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var ae=3;break;default:ae=v}var de=v;v=ae;try{return Y()}finally{v=de}},r.unstable_requestPaint=function(){M=!0},r.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var de=v;v=Y;try{return ae()}finally{v=de}},r.unstable_scheduleCallback=function(Y,ae,de){var Oe=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Oe+de:Oe):de=Oe,Y){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=de+oe,Y={id:d++,callback:ae,priorityLevel:Y,startTime:de,expirationTime:oe,sortIndex:-1},de>Oe?(Y.sortIndex=de,t(f,Y),s(g)===null&&Y===s(f)&&(S?(U(se),se=-1):S=!0,Te(C,de-Oe))):(Y.sortIndex=oe,t(g,Y),w||x||(w=!0,P||(P=!0,J()))),Y},r.unstable_shouldYield=G,r.unstable_wrapCallback=function(Y){var ae=v;return function(){var de=v;v=ae;try{return Y.apply(this,arguments)}finally{v=de}}}})(Bh)),Bh}var Xy;function Gw(){return Xy||(Xy=1,Lh.exports=Hw()),Lh.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-dom-client.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var Jy;function Fw(){if(Jy)return Xa;Jy=1;var r=Gw(),t=uw(),s=mw();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function m(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function y(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(i(188))}function f(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,o=n;;){var u=a.return;if(u===null)break;var h=u.alternate;if(h===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===a)return g(u),e;if(h===o)return g(u),n;h=h.sibling}throw Error(i(188))}if(a.return!==o.return)a=u,o=h;else{for(var _=!1,E=u.child;E;){if(E===a){_=!0,a=u,o=h;break}if(E===o){_=!0,o=u,a=h;break}E=E.sibling}if(!_){for(E=h.child;E;){if(E===a){_=!0,a=h,o=u;break}if(E===o){_=!0,o=h,a=u;break}E=E.sibling}if(!_)throw Error(i(189))}}if(a.alternate!==o)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:n}function d(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=d(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),re=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function xe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case M:return"StrictMode";case C:return"Suspense";case P:return"SuspenseList";case B:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case re:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return n=e.displayName||null,n!==null?n:xe(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return xe(e(n))}catch{}}return null}var Te=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Oe=[],oe=-1;function je(e){return{current:e}}function Se(e){0>oe||(e.current=Oe[oe],Oe[oe]=null,oe--)}function ke(e,n){oe++,Oe[oe]=e.current,e.current=n}var We=je(null),Ae=je(null),ct=je(null),At=je(null);function qt(e,n){switch(ke(ct,n),ke(Ae,e),ke(We,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?dy(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=dy(n),e=my(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Se(We),ke(We,e)}function Ne(){Se(We),Se(Ae),Se(ct)}function Lt(e){e.memoizedState!==null&&ke(At,e);var n=We.current,a=my(n,e.type);n!==a&&(ke(Ae,e),ke(We,a))}function gs(e){Ae.current===e&&(Se(We),Se(Ae)),At.current===e&&(Se(At),Fa._currentValue=de)}var Xs,bs;function _n(e){if(Xs===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Xs=n&&n[1]||"",bs=-1<a.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+Xs+e+bs}var Js=!1;function Nr(e,n){if(!e||Js)return"";Js=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(K){var F=K}Reflect.construct(e,[],ne)}else{try{ne.call()}catch(K){F=K}e.call(ne.prototype)}}else{try{throw Error()}catch(K){F=K}(ne=e())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(K){if(K&&F&&typeof K.stack=="string")return[K.stack,F.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=o.DetermineComponentFrameRoot(),_=h[0],E=h[1];if(_&&E){var R=_.split(`
|
|
21
|
-
`),H=E.split(`
|
|
22
|
-
`);for(u=o=0;o<R.length&&!R[o].includes("DetermineComponentFrameRoot");)o++;for(;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;if(o===R.length||u===H.length)for(o=R.length-1,u=H.length-1;1<=o&&0<=u&&R[o]!==H[u];)u--;for(;1<=o&&0<=u;o--,u--)if(R[o]!==H[u]){if(o!==1||u!==1)do if(o--,u--,0>u||R[o]!==H[u]){var Q=`
|
|
23
|
-
`+R[o].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=o&&0<=u);break}}}finally{Js=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?_n(a):""}function ko(e,n){switch(e.tag){case 26:case 27:case 5:return _n(e.type);case 16:return _n("Lazy");case 13:return e.child!==n&&n!==null?_n("Suspense Fallback"):_n("Suspense");case 19:return _n("SuspenseList");case 0:case 15:return Nr(e.type,!1);case 11:return Nr(e.type.render,!1);case 1:return Nr(e.type,!0);case 31:return _n("Activity");default:return""}}function No(e){try{var n="",a=null;do n+=ko(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
|
|
24
|
-
Error generating stack: `+o.message+`
|
|
25
|
-
`+o.stack}}var ta=Object.prototype.hasOwnProperty,na=r.unstable_scheduleCallback,rr=r.unstable_cancelCallback,Co=r.unstable_shouldYield,Qs=r.unstable_requestPaint,rt=r.unstable_now,Eu=r.unstable_getCurrentPriorityLevel,Mo=r.unstable_ImmediatePriority,Ro=r.unstable_UserBlockingPriority,Zs=r.unstable_NormalPriority,Ou=r.unstable_LowPriority,Do=r.unstable_IdlePriority,Au=r.log,qo=r.unstable_setDisableYieldValue,vs=null,pt=null;function en(e){if(typeof Au=="function"&&qo(e),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(vs,e)}catch{}}var Bt=Math.clz32?Math.clz32:Ws,ra=Math.log,sa=Math.LN2;function Ws(e){return e>>>=0,e===0?32:31-(ra(e)/sa|0)|0}var Cr=256,sr=262144,Mr=4194304;function qn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function xs(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var E=o&134217727;return E!==0?(o=E&~h,o!==0?u=qn(o):(_&=E,_!==0?u=qn(_):a||(a=E&~e,a!==0&&(u=qn(a))))):(E=o&~h,E!==0?u=qn(E):_!==0?u=qn(_):a||(a=o&~e,a!==0&&(u=qn(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function _s(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ia(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ei(){var e=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),e}function Rr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Ln(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dr(e,n,a,o,u,h){var _=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,R=e.expirationTimes,H=e.hiddenUpdates;for(a=_&~a;0<a;){var Q=31-Bt(a),ne=1<<Q;E[Q]=0,R[Q]=-1;var F=H[Q];if(F!==null)for(H[Q]=null,Q=0;Q<F.length;Q++){var K=F[Q];K!==null&&(K.lane&=-536870913)}a&=~ne}o!==0&&qr(e,o,0),h!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=h&~(_&~n))}function qr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Bt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function ws(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Bt(a),u=1<<o;u&n|e[o]&n&&(e[o]|=n),a&=~u}}function Lr(e,n){var a=n&-n;return a=(a&42)!==0?1:ir(a),(a&(e.suspendedLanes|n))!==0?0:a}function ir(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ss(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function aa(){var e=ae.p;return e!==0?e:(e=window.event,e===void 0?32:By(e.type))}function Lo(e,n){var a=ae.p;try{return ae.p=e,n()}finally{ae.p=a}}var Yn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Yn,ut="__reactProps$"+Yn,tn="__reactContainer$"+Yn,Es="__reactEvents$"+Yn,oa="__reactListeners$"+Yn,Bo="__reactHandles$"+Yn,Po="__reactResources$"+Yn,Et="__reactMarker$"+Yn;function ti(e){delete e[Qe],delete e[ut],delete e[Es],delete e[oa],delete e[Bo]}function O(e){var n=e[Qe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[tn]||a[Qe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=_y(e);e!==null;){if(a=e[Qe])return a;e=_y(e)}return n}e=a,a=e.parentNode}return null}function k(e){if(e=e[Qe]||e[tn]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function T(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function N(e){var n=e[Po];return n||(n=e[Po]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function D(e){e[Et]=!0}var I=new Set,te={};function ie(e,n){V(e,n),V(e+"Capture",n)}function V(e,n){for(te[e]=n,e=0;e<n.length;e++)I.add(n[e])}var ee=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pe={},Re={};function et(e){return ta.call(Re,e)?!0:ta.call(pe,e)?!1:ee.test(e)?Re[e]=!0:(pe[e]=!0,!1)}function Pt(e,n,a){if(et(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Bn(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function ar(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function wn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function im(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function tx(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(_){a=""+_,h.call(this,_)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ju(e){if(!e._valueTracker){var n=im(e)?"checked":"value";e._valueTracker=tx(e,n,""+e[n])}}function am(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=im(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Uo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var nx=/[\n"\\]/g;function Sn(e){return e.replace(nx,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Tu(e,n,a,o,u,h,_,E){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+wn(n)):e.value!==""+wn(n)&&(e.value=""+wn(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?ku(e,_,wn(n)):a!=null?ku(e,_,wn(a)):o!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+wn(E):e.removeAttribute("name")}function om(e,n,a,o,u,h,_,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){ju(e);return}a=a!=null?""+wn(a):"",n=n!=null?""+wn(n):a,E||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=E?e.checked:!!o,e.defaultChecked=!!o,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),ju(e)}function ku(e,n,a){n==="number"&&Uo(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ni(e,n,a,o){if(e=e.options,n){n={};for(var u=0;u<a.length;u++)n["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=n.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&o&&(e[a].defaultSelected=!0)}else{for(a=""+wn(a),n=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function lm(e,n,a){if(n!=null&&(n=""+wn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+wn(a):""}function cm(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(Te(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=wn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),ju(e)}function ri(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var rx=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function um(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||rx.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function fm(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&a[u]!==o&&um(e,u,o)}else for(var h in n)n.hasOwnProperty(h)&&um(e,h,n[h])}function Nu(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sx=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ix=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function zo(e){return ix.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function or(){}var Cu=null;function Mu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var si=null,ii=null;function hm(e){var n=k(e);if(n&&(e=n.stateNode)){var a=e[ut]||null;e:switch(e=n.stateNode,n.type){case"input":if(Tu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Sn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var u=o[ut]||null;if(!u)throw Error(i(90));Tu(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&am(o)}break e;case"textarea":lm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ni(e,!!a.multiple,n,!1)}}}var Ru=!1;function dm(e,n,a){if(Ru)return e(n,a);Ru=!0;try{var o=e(n);return o}finally{if(Ru=!1,(si!==null||ii!==null)&&(jl(),si&&(n=si,e=ii,ii=si=null,hm(n),e)))for(n=0;n<e.length;n++)hm(e[n])}}function la(e,n){var a=e.stateNode;if(a===null)return null;var o=a[ut]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Du=!1;if(lr)try{var ca={};Object.defineProperty(ca,"passive",{get:function(){Du=!0}}),window.addEventListener("test",ca,ca),window.removeEventListener("test",ca,ca)}catch{Du=!1}var Br=null,qu=null,Io=null;function mm(){if(Io)return Io;var e,n=qu,a=n.length,o,u="value"in Br?Br.value:Br.textContent,h=u.length;for(e=0;e<a&&n[e]===u[e];e++);var _=a-e;for(o=1;o<=_&&n[a-o]===u[h-o];o++);return Io=u.slice(e,1<o?1-o:void 0)}function $o(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ho(){return!0}function pm(){return!1}function Yt(e){function n(a,o,u,h,_){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=h,this.target=_,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Ho:pm,this.isPropagationStopped=pm,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ho)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ho)},persist:function(){},isPersistent:Ho}),n}var Os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Go=Yt(Os),ua=b({},Os,{view:0,detail:0}),ax=Yt(ua),Lu,Bu,fa,Fo=b({},ua,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==fa&&(fa&&e.type==="mousemove"?(Lu=e.screenX-fa.screenX,Bu=e.screenY-fa.screenY):Bu=Lu=0,fa=e),Lu)},movementY:function(e){return"movementY"in e?e.movementY:Bu}}),ym=Yt(Fo),ox=b({},Fo,{dataTransfer:0}),lx=Yt(ox),cx=b({},ua,{relatedTarget:0}),Pu=Yt(cx),ux=b({},Os,{animationName:0,elapsedTime:0,pseudoElement:0}),fx=Yt(ux),hx=b({},Os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dx=Yt(hx),mx=b({},Os,{data:0}),gm=Yt(mx),px={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yx={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},gx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=gx[e])?!!n[e]:!1}function Uu(){return bx}var vx=b({},ua,{key:function(e){if(e.key){var n=px[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=$o(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?yx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uu,charCode:function(e){return e.type==="keypress"?$o(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$o(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xx=Yt(vx),_x=b({},Fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bm=Yt(_x),wx=b({},ua,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uu}),Sx=Yt(wx),Ex=b({},Os,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ox=Yt(Ex),Ax=b({},Fo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),jx=Yt(Ax),Tx=b({},Os,{newState:0,oldState:0}),kx=Yt(Tx),Nx=[9,13,27,32],zu=lr&&"CompositionEvent"in window,ha=null;lr&&"documentMode"in document&&(ha=document.documentMode);var Cx=lr&&"TextEvent"in window&&!ha,vm=lr&&(!zu||ha&&8<ha&&11>=ha),xm=" ",_m=!1;function wm(e,n){switch(e){case"keyup":return Nx.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ai=!1;function Mx(e,n){switch(e){case"compositionend":return Sm(n);case"keypress":return n.which!==32?null:(_m=!0,xm);case"textInput":return e=n.data,e===xm&&_m?null:e;default:return null}}function Rx(e,n){if(ai)return e==="compositionend"||!zu&&wm(e,n)?(e=mm(),Io=qu=Br=null,ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return vm&&n.locale!=="ko"?null:n.data;default:return null}}var Dx={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Em(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Dx[e.type]:n==="textarea"}function Om(e,n,a,o){si?ii?ii.push(o):ii=[o]:si=o,n=Dl(n,"onChange"),0<n.length&&(a=new Go("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var da=null,ma=null;function qx(e){oy(e,0)}function Vo(e){var n=T(e);if(am(n))return e}function Am(e,n){if(e==="change")return n}var jm=!1;if(lr){var Iu;if(lr){var $u="oninput"in document;if(!$u){var Tm=document.createElement("div");Tm.setAttribute("oninput","return;"),$u=typeof Tm.oninput=="function"}Iu=$u}else Iu=!1;jm=Iu&&(!document.documentMode||9<document.documentMode)}function km(){da&&(da.detachEvent("onpropertychange",Nm),ma=da=null)}function Nm(e){if(e.propertyName==="value"&&Vo(ma)){var n=[];Om(n,ma,e,Mu(e)),dm(qx,n)}}function Lx(e,n,a){e==="focusin"?(km(),da=n,ma=a,da.attachEvent("onpropertychange",Nm)):e==="focusout"&&km()}function Bx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vo(ma)}function Px(e,n){if(e==="click")return Vo(n)}function Ux(e,n){if(e==="input"||e==="change")return Vo(n)}function zx(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var nn=typeof Object.is=="function"?Object.is:zx;function pa(e,n){if(nn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!ta.call(n,u)||!nn(e[u],n[u]))return!1}return!0}function Cm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Mm(e,n){var a=Cm(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Cm(a)}}function Rm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Rm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Dm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Uo(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Uo(e.document)}return n}function Hu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Ix=lr&&"documentMode"in document&&11>=document.documentMode,oi=null,Gu=null,ya=null,Fu=!1;function qm(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Fu||oi==null||oi!==Uo(o)||(o=oi,"selectionStart"in o&&Hu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),ya&&pa(ya,o)||(ya=o,o=Dl(Gu,"onSelect"),0<o.length&&(n=new Go("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=oi)))}function As(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var li={animationend:As("Animation","AnimationEnd"),animationiteration:As("Animation","AnimationIteration"),animationstart:As("Animation","AnimationStart"),transitionrun:As("Transition","TransitionRun"),transitionstart:As("Transition","TransitionStart"),transitioncancel:As("Transition","TransitionCancel"),transitionend:As("Transition","TransitionEnd")},Vu={},Lm={};lr&&(Lm=document.createElement("div").style,"AnimationEvent"in window||(delete li.animationend.animation,delete li.animationiteration.animation,delete li.animationstart.animation),"TransitionEvent"in window||delete li.transitionend.transition);function js(e){if(Vu[e])return Vu[e];if(!li[e])return e;var n=li[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Lm)return Vu[e]=n[a];return e}var Bm=js("animationend"),Pm=js("animationiteration"),Um=js("animationstart"),$x=js("transitionrun"),Hx=js("transitionstart"),Gx=js("transitioncancel"),zm=js("transitionend"),Im=new Map,Yu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Yu.push("scrollEnd");function Pn(e,n){Im.set(e,n),ie(n,[e])}var Yo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],ci=0,Ku=0;function Ko(){for(var e=ci,n=Ku=ci=0;n<e;){var a=En[n];En[n++]=null;var o=En[n];En[n++]=null;var u=En[n];En[n++]=null;var h=En[n];if(En[n++]=null,o!==null&&u!==null){var _=o.pending;_===null?u.next=u:(u.next=_.next,_.next=u),o.pending=u}h!==0&&$m(a,u,h)}}function Xo(e,n,a,o){En[ci++]=e,En[ci++]=n,En[ci++]=a,En[ci++]=o,Ku|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Xu(e,n,a,o){return Xo(e,n,a,o),Jo(e)}function Ts(e,n){return Xo(e,null,null,n),Jo(e)}function $m(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var u=!1,h=e.return;h!==null;)h.childLanes|=a,o=h.alternate,o!==null&&(o.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(u=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,u&&n!==null&&(u=31-Bt(a),e=h.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=a|536870912),h):null}function Jo(e){if(50<Pa)throw Pa=0,ih=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ui={};function Fx(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(e,n,a,o){return new Fx(e,n,a,o)}function Ju(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cr(e,n){var a=e.alternate;return a===null?(a=rn(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Hm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Qo(e,n,a,o,u,h){var _=0;if(o=e,typeof e=="function")Ju(e)&&(_=1);else if(typeof e=="string")_=J_(e,a,We.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case B:return e=rn(31,a,n,u),e.elementType=B,e.lanes=h,e;case S:return ks(a.children,u,h,n);case M:_=8,u|=24;break;case L:return e=rn(12,a,n,u|2),e.elementType=L,e.lanes=h,e;case C:return e=rn(13,a,n,u),e.elementType=C,e.lanes=h,e;case P:return e=rn(19,a,n,u),e.elementType=P,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case re:_=10;break e;case U:_=9;break e;case ce:_=11;break e;case se:_=14;break e;case X:_=16,o=null;break e}_=29,a=Error(i(130,e===null?"null":typeof e,"")),o=null}return n=rn(_,a,n,u),n.elementType=e,n.type=o,n.lanes=h,n}function ks(e,n,a,o){return e=rn(7,e,o,n),e.lanes=a,e}function Qu(e,n,a){return e=rn(6,e,null,n),e.lanes=a,e}function Gm(e){var n=rn(18,null,null,0);return n.stateNode=e,n}function Zu(e,n,a){return n=rn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Fm=new WeakMap;function On(e,n){if(typeof e=="object"&&e!==null){var a=Fm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:No(n)},Fm.set(e,n),n)}return{value:e,source:n,stack:No(n)}}var fi=[],hi=0,Zo=null,ga=0,An=[],jn=0,Pr=null,Kn=1,Xn="";function ur(e,n){fi[hi++]=ga,fi[hi++]=Zo,Zo=e,ga=n}function Vm(e,n,a){An[jn++]=Kn,An[jn++]=Xn,An[jn++]=Pr,Pr=e;var o=Kn;e=Xn;var u=32-Bt(o)-1;o&=~(1<<u),a+=1;var h=32-Bt(n)+u;if(30<h){var _=u-u%5;h=(o&(1<<_)-1).toString(32),o>>=_,u-=_,Kn=1<<32-Bt(n)+u|a<<u|o,Xn=h+e}else Kn=1<<h|a<<u|o,Xn=e}function Wu(e){e.return!==null&&(ur(e,1),Vm(e,1,0))}function ef(e){for(;e===Zo;)Zo=fi[--hi],fi[hi]=null,ga=fi[--hi],fi[hi]=null;for(;e===Pr;)Pr=An[--jn],An[jn]=null,Xn=An[--jn],An[jn]=null,Kn=An[--jn],An[jn]=null}function Ym(e,n){An[jn++]=Kn,An[jn++]=Xn,An[jn++]=Pr,Kn=n.id,Xn=n.overflow,Pr=e}var Ct=null,tt=null,Pe=!1,Ur=null,Tn=!1,tf=Error(i(519));function zr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ba(On(n,e)),tf}function Km(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Qe]=e,n[ut]=o,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<za.length;a++)qe(za[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),om(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),cm(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||fy(n.textContent,a)?(o.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),o.onScroll!=null&&qe("scroll",n),o.onScrollEnd!=null&&qe("scrollend",n),o.onClick!=null&&(n.onclick=or),n=!0):n=!1,n||zr(e,!0)}function Xm(e){for(Ct=e.return;Ct;)switch(Ct.tag){case 5:case 31:case 13:Tn=!1;return;case 27:case 3:Tn=!0;return;default:Ct=Ct.return}}function di(e){if(e!==Ct)return!1;if(!Pe)return Xm(e),Pe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||xh(e.type,e.memoizedProps)),a=!a),a&&tt&&zr(e),Xm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));tt=xy(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));tt=xy(e)}else n===27?(n=tt,es(e.type)?(e=Oh,Oh=null,tt=e):tt=n):tt=Ct?Nn(e.stateNode.nextSibling):null;return!0}function Ns(){tt=Ct=null,Pe=!1}function nf(){var e=Ur;return e!==null&&(Qt===null?Qt=e:Qt.push.apply(Qt,e),Ur=null),e}function ba(e){Ur===null?Ur=[e]:Ur.push(e)}var rf=je(null),Cs=null,fr=null;function Ir(e,n,a){ke(rf,n._currentValue),n._currentValue=a}function hr(e){e._currentValue=rf.current,Se(rf)}function sf(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function af(e,n,a,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var h=u.dependencies;if(h!==null){var _=u.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=u;for(var R=0;R<n.length;R++)if(E.context===n[R]){h.lanes|=a,E=h.alternate,E!==null&&(E.lanes|=a),sf(h.return,a,e),o||(_=null);break e}h=E.next}}else if(u.tag===18){if(_=u.return,_===null)throw Error(i(341));_.lanes|=a,h=_.alternate,h!==null&&(h.lanes|=a),sf(_,a,e),_=null}else _=u.child;if(_!==null)_.return=u;else for(_=u;_!==null;){if(_===e){_=null;break}if(u=_.sibling,u!==null){u.return=_.return,_=u;break}_=_.return}u=_}}function mi(e,n,a,o){e=null;for(var u=n,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var _=u.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var E=u.type;nn(u.pendingProps.value,_.value)||(e!==null?e.push(E):e=[E])}}else if(u===At.current){if(_=u.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Fa):e=[Fa])}u=u.return}e!==null&&af(n,e,a,o),n.flags|=262144}function Wo(e){for(e=e.firstContext;e!==null;){if(!nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ms(e){Cs=e,fr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Mt(e){return Jm(Cs,e)}function el(e,n){return Cs===null&&Ms(e),Jm(e,n)}function Jm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},fr===null){if(e===null)throw Error(i(308));fr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else fr=fr.next=n;return a}var Vx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},Yx=r.unstable_scheduleCallback,Kx=r.unstable_NormalPriority,vt={$$typeof:re,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function of(){return{controller:new Vx,data:new Map,refCount:0}}function va(e){e.refCount--,e.refCount===0&&Yx(Kx,function(){e.controller.abort()})}var xa=null,lf=0,pi=0,yi=null;function Xx(e,n){if(xa===null){var a=xa=[];lf=0,pi=fh(),yi={status:"pending",value:void 0,then:function(o){a.push(o)}}}return lf++,n.then(Qm,Qm),n}function Qm(){if(--lf===0&&xa!==null){yi!==null&&(yi.status="fulfilled");var e=xa;xa=null,pi=0,yi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Jx(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<a.length;u++)(0,a[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var Zm=Y.S;Y.S=function(e,n){qp=rt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Xx(e,n),Zm!==null&&Zm(e,n)};var Rs=je(null);function cf(){var e=Rs.current;return e!==null?e:Ze.pooledCache}function tl(e,n){n===null?ke(Rs,Rs.current):ke(Rs,n.pool)}function Wm(){var e=cf();return e===null?null:{parent:vt._currentValue,pool:e}}var gi=Error(i(460)),uf=Error(i(474)),nl=Error(i(542)),rl={then:function(){}};function e0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function t0(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(or,or),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,r0(e),e;default:if(typeof n.status=="string")n.then(or,or);else{if(e=Ze,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,r0(e),e}throw qs=n,gi}}function Ds(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(qs=a,gi):a}}var qs=null;function n0(){if(qs===null)throw Error(i(459));var e=qs;return qs=null,e}function r0(e){if(e===gi||e===nl)throw Error(i(483))}var bi=null,_a=0;function sl(e){var n=_a;return _a+=1,bi===null&&(bi=[]),t0(bi,e,n)}function wa(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function il(e,n){throw n.$$typeof===v?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function s0(e){function n(z,q){if(e){var $=z.deletions;$===null?(z.deletions=[q],z.flags|=16):$.push(q)}}function a(z,q){if(!e)return null;for(;q!==null;)n(z,q),q=q.sibling;return null}function o(z){for(var q=new Map;z!==null;)z.key!==null?q.set(z.key,z):q.set(z.index,z),z=z.sibling;return q}function u(z,q){return z=cr(z,q),z.index=0,z.sibling=null,z}function h(z,q,$){return z.index=$,e?($=z.alternate,$!==null?($=$.index,$<q?(z.flags|=67108866,q):$):(z.flags|=67108866,q)):(z.flags|=1048576,q)}function _(z){return e&&z.alternate===null&&(z.flags|=67108866),z}function E(z,q,$,Z){return q===null||q.tag!==6?(q=Qu($,z.mode,Z),q.return=z,q):(q=u(q,$),q.return=z,q)}function R(z,q,$,Z){var ve=$.type;return ve===S?Q(z,q,$.props.children,Z,$.key):q!==null&&(q.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===X&&Ds(ve)===q.type)?(q=u(q,$.props),wa(q,$),q.return=z,q):(q=Qo($.type,$.key,$.props,null,z.mode,Z),wa(q,$),q.return=z,q)}function H(z,q,$,Z){return q===null||q.tag!==4||q.stateNode.containerInfo!==$.containerInfo||q.stateNode.implementation!==$.implementation?(q=Zu($,z.mode,Z),q.return=z,q):(q=u(q,$.children||[]),q.return=z,q)}function Q(z,q,$,Z,ve){return q===null||q.tag!==7?(q=ks($,z.mode,Z,ve),q.return=z,q):(q=u(q,$),q.return=z,q)}function ne(z,q,$){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Qu(""+q,z.mode,$),q.return=z,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return $=Qo(q.type,q.key,q.props,null,z.mode,$),wa($,q),$.return=z,$;case w:return q=Zu(q,z.mode,$),q.return=z,q;case X:return q=Ds(q),ne(z,q,$)}if(Te(q)||J(q))return q=ks(q,z.mode,$,null),q.return=z,q;if(typeof q.then=="function")return ne(z,sl(q),$);if(q.$$typeof===re)return ne(z,el(z,q),$);il(z,q)}return null}function F(z,q,$,Z){var ve=q!==null?q.key:null;if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return ve!==null?null:E(z,q,""+$,Z);if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return $.key===ve?R(z,q,$,Z):null;case w:return $.key===ve?H(z,q,$,Z):null;case X:return $=Ds($),F(z,q,$,Z)}if(Te($)||J($))return ve!==null?null:Q(z,q,$,Z,null);if(typeof $.then=="function")return F(z,q,sl($),Z);if($.$$typeof===re)return F(z,q,el(z,$),Z);il(z,$)}return null}function K(z,q,$,Z,ve){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return z=z.get($)||null,E(q,z,""+Z,ve);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:return z=z.get(Z.key===null?$:Z.key)||null,R(q,z,Z,ve);case w:return z=z.get(Z.key===null?$:Z.key)||null,H(q,z,Z,ve);case X:return Z=Ds(Z),K(z,q,$,Z,ve)}if(Te(Z)||J(Z))return z=z.get($)||null,Q(q,z,Z,ve,null);if(typeof Z.then=="function")return K(z,q,$,sl(Z),ve);if(Z.$$typeof===re)return K(z,q,$,el(q,Z),ve);il(q,Z)}return null}function ye(z,q,$,Z){for(var ve=null,$e=null,ge=q,Me=q=0,Be=null;ge!==null&&Me<$.length;Me++){ge.index>Me?(Be=ge,ge=null):Be=ge.sibling;var He=F(z,ge,$[Me],Z);if(He===null){ge===null&&(ge=Be);break}e&&ge&&He.alternate===null&&n(z,ge),q=h(He,q,Me),$e===null?ve=He:$e.sibling=He,$e=He,ge=Be}if(Me===$.length)return a(z,ge),Pe&&ur(z,Me),ve;if(ge===null){for(;Me<$.length;Me++)ge=ne(z,$[Me],Z),ge!==null&&(q=h(ge,q,Me),$e===null?ve=ge:$e.sibling=ge,$e=ge);return Pe&&ur(z,Me),ve}for(ge=o(ge);Me<$.length;Me++)Be=K(ge,z,Me,$[Me],Z),Be!==null&&(e&&Be.alternate!==null&&ge.delete(Be.key===null?Me:Be.key),q=h(Be,q,Me),$e===null?ve=Be:$e.sibling=Be,$e=Be);return e&&ge.forEach(function(is){return n(z,is)}),Pe&&ur(z,Me),ve}function Ee(z,q,$,Z){if($==null)throw Error(i(151));for(var ve=null,$e=null,ge=q,Me=q=0,Be=null,He=$.next();ge!==null&&!He.done;Me++,He=$.next()){ge.index>Me?(Be=ge,ge=null):Be=ge.sibling;var is=F(z,ge,He.value,Z);if(is===null){ge===null&&(ge=Be);break}e&&ge&&is.alternate===null&&n(z,ge),q=h(is,q,Me),$e===null?ve=is:$e.sibling=is,$e=is,ge=Be}if(He.done)return a(z,ge),Pe&&ur(z,Me),ve;if(ge===null){for(;!He.done;Me++,He=$.next())He=ne(z,He.value,Z),He!==null&&(q=h(He,q,Me),$e===null?ve=He:$e.sibling=He,$e=He);return Pe&&ur(z,Me),ve}for(ge=o(ge);!He.done;Me++,He=$.next())He=K(ge,z,Me,He.value,Z),He!==null&&(e&&He.alternate!==null&&ge.delete(He.key===null?Me:He.key),q=h(He,q,Me),$e===null?ve=He:$e.sibling=He,$e=He);return e&&ge.forEach(function(ow){return n(z,ow)}),Pe&&ur(z,Me),ve}function Je(z,q,$,Z){if(typeof $=="object"&&$!==null&&$.type===S&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case x:e:{for(var ve=$.key;q!==null;){if(q.key===ve){if(ve=$.type,ve===S){if(q.tag===7){a(z,q.sibling),Z=u(q,$.props.children),Z.return=z,z=Z;break e}}else if(q.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===X&&Ds(ve)===q.type){a(z,q.sibling),Z=u(q,$.props),wa(Z,$),Z.return=z,z=Z;break e}a(z,q);break}else n(z,q);q=q.sibling}$.type===S?(Z=ks($.props.children,z.mode,Z,$.key),Z.return=z,z=Z):(Z=Qo($.type,$.key,$.props,null,z.mode,Z),wa(Z,$),Z.return=z,z=Z)}return _(z);case w:e:{for(ve=$.key;q!==null;){if(q.key===ve)if(q.tag===4&&q.stateNode.containerInfo===$.containerInfo&&q.stateNode.implementation===$.implementation){a(z,q.sibling),Z=u(q,$.children||[]),Z.return=z,z=Z;break e}else{a(z,q);break}else n(z,q);q=q.sibling}Z=Zu($,z.mode,Z),Z.return=z,z=Z}return _(z);case X:return $=Ds($),Je(z,q,$,Z)}if(Te($))return ye(z,q,$,Z);if(J($)){if(ve=J($),typeof ve!="function")throw Error(i(150));return $=ve.call($),Ee(z,q,$,Z)}if(typeof $.then=="function")return Je(z,q,sl($),Z);if($.$$typeof===re)return Je(z,q,el(z,$),Z);il(z,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,q!==null&&q.tag===6?(a(z,q.sibling),Z=u(q,$),Z.return=z,z=Z):(a(z,q),Z=Qu($,z.mode,Z),Z.return=z,z=Z),_(z)):a(z,q)}return function(z,q,$,Z){try{_a=0;var ve=Je(z,q,$,Z);return bi=null,ve}catch(ge){if(ge===gi||ge===nl)throw ge;var $e=rn(29,ge,null,z.mode);return $e.lanes=Z,$e.return=z,$e}finally{}}}var Ls=s0(!0),i0=s0(!1),$r=!1;function ff(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Hr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ge&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=Jo(e),$m(e,null,a),n}return Xo(e,o,n,a),Jo(e)}function Sa(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,ws(e,a)}}function df(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=_:h=h.next=_,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var mf=!1;function Ea(){if(mf){var e=yi;if(e!==null)throw e}}function Oa(e,n,a,o){mf=!1;var u=e.updateQueue;$r=!1;var h=u.firstBaseUpdate,_=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var R=E,H=R.next;R.next=null,_===null?h=H:_.next=H,_=R;var Q=e.alternate;Q!==null&&(Q=Q.updateQueue,E=Q.lastBaseUpdate,E!==_&&(E===null?Q.firstBaseUpdate=H:E.next=H,Q.lastBaseUpdate=R))}if(h!==null){var ne=u.baseState;_=0,Q=H=R=null,E=h;do{var F=E.lane&-536870913,K=F!==E.lane;if(K?(Le&F)===F:(o&F)===F){F!==0&&F===pi&&(mf=!0),Q!==null&&(Q=Q.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ye=e,Ee=E;F=n;var Je=a;switch(Ee.tag){case 1:if(ye=Ee.payload,typeof ye=="function"){ne=ye.call(Je,ne,F);break e}ne=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Ee.payload,F=typeof ye=="function"?ye.call(Je,ne,F):ye,F==null)break e;ne=b({},ne,F);break e;case 2:$r=!0}}F=E.callback,F!==null&&(e.flags|=64,K&&(e.flags|=8192),K=u.callbacks,K===null?u.callbacks=[F]:K.push(F))}else K={lane:F,tag:E.tag,payload:E.payload,callback:E.callback,next:null},Q===null?(H=Q=K,R=ne):Q=Q.next=K,_|=F;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;K=E,E=K.next,K.next=null,u.lastBaseUpdate=K,u.shared.pending=null}}while(!0);Q===null&&(R=ne),u.baseState=R,u.firstBaseUpdate=H,u.lastBaseUpdate=Q,h===null&&(u.shared.lanes=0),Xr|=_,e.lanes=_,e.memoizedState=ne}}function a0(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function o0(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)a0(a[e],n)}var vi=je(null),al=je(0);function l0(e,n){e=_r,ke(al,e),ke(vi,n),_r=e|n.baseLanes}function pf(){ke(al,_r),ke(vi,vi.current)}function yf(){_r=al.current,Se(vi),Se(al)}var sn=je(null),kn=null;function Fr(e){var n=e.alternate;ke(yt,yt.current&1),ke(sn,e),kn===null&&(n===null||vi.current!==null||n.memoizedState!==null)&&(kn=e)}function gf(e){ke(yt,yt.current),ke(sn,e),kn===null&&(kn=e)}function c0(e){e.tag===22?(ke(yt,yt.current),ke(sn,e),kn===null&&(kn=e)):Vr()}function Vr(){ke(yt,yt.current),ke(sn,sn.current)}function an(e){Se(sn),kn===e&&(kn=null),Se(yt)}var yt=je(0);function ol(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Sh(a)||Eh(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var dr=0,Ce=null,Ke=null,xt=null,ll=!1,xi=!1,Bs=!1,cl=0,Aa=0,_i=null,Qx=0;function ft(){throw Error(i(321))}function bf(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!nn(e[a],n[a]))return!1;return!0}function vf(e,n,a,o,u,h){return dr=h,Ce=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?V0:Df,Bs=!1,h=a(o,u),Bs=!1,xi&&(h=f0(n,a,o,u)),u0(e),h}function u0(e){Y.H=ka;var n=Ke!==null&&Ke.next!==null;if(dr=0,xt=Ke=Ce=null,ll=!1,Aa=0,_i=null,n)throw Error(i(300));e===null||_t||(e=e.dependencies,e!==null&&Wo(e)&&(_t=!0))}function f0(e,n,a,o){Ce=e;var u=0;do{if(xi&&(_i=null),Aa=0,xi=!1,25<=u)throw Error(i(301));if(u+=1,xt=Ke=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}Y.H=Y0,h=n(a,o)}while(xi);return h}function Zx(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?ja(n):n,e=e.useState()[0],(Ke!==null?Ke.memoizedState:null)!==e&&(Ce.flags|=1024),n}function xf(){var e=cl!==0;return cl=0,e}function _f(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function wf(e){if(ll){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}ll=!1}dr=0,xt=Ke=Ce=null,xi=!1,Aa=cl=0,_i=null}function Ut(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xt===null?Ce.memoizedState=xt=e:xt=xt.next=e,xt}function gt(){if(Ke===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var n=xt===null?Ce.memoizedState:xt.next;if(n!==null)xt=n,Ke=e;else{if(e===null)throw Ce.alternate===null?Error(i(467)):Error(i(310));Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},xt===null?Ce.memoizedState=xt=e:xt=xt.next=e}return xt}function ul(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ja(e){var n=Aa;return Aa+=1,_i===null&&(_i=[]),e=t0(_i,e,n),n=Ce,(xt===null?n.memoizedState:xt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?V0:Df),e}function fl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ja(e);if(e.$$typeof===re)return Mt(e)}throw Error(i(438,String(e)))}function Sf(e){var n=null,a=Ce.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=Ce.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=ul(),Ce.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=G;return n.index++,a}function mr(e,n){return typeof n=="function"?n(e):n}function hl(e){var n=gt();return Ef(n,Ke,e)}function Ef(e,n,a){var o=e.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=a;var u=e.baseQueue,h=o.pending;if(h!==null){if(u!==null){var _=u.next;u.next=h.next,h.next=_}n.baseQueue=u=h,o.pending=null}if(h=e.baseState,u===null)e.memoizedState=h;else{n=u.next;var E=_=null,R=null,H=n,Q=!1;do{var ne=H.lane&-536870913;if(ne!==H.lane?(Le&ne)===ne:(dr&ne)===ne){var F=H.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ne===pi&&(Q=!0);else if((dr&F)===F){H=H.next,F===pi&&(Q=!0);continue}else ne={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=ne,_=h):R=R.next=ne,Ce.lanes|=F,Xr|=F;ne=H.action,Bs&&a(h,ne),h=H.hasEagerState?H.eagerState:a(h,ne)}else F={lane:ne,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=F,_=h):R=R.next=F,Ce.lanes|=ne,Xr|=ne;H=H.next}while(H!==null&&H!==n);if(R===null?_=h:R.next=E,!nn(h,e.memoizedState)&&(_t=!0,Q&&(a=yi,a!==null)))throw a;e.memoizedState=h,e.baseState=_,e.baseQueue=R,o.lastRenderedState=h}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Of(e){var n=gt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var o=a.dispatch,u=a.pending,h=n.memoizedState;if(u!==null){a.pending=null;var _=u=u.next;do h=e(h,_.action),_=_.next;while(_!==u);nn(h,n.memoizedState)||(_t=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,o]}function h0(e,n,a){var o=Ce,u=gt(),h=Pe;if(h){if(a===void 0)throw Error(i(407));a=a()}else a=n();var _=!nn((Ke||u).memoizedState,a);if(_&&(u.memoizedState=a,_t=!0),u=u.queue,Tf(p0.bind(null,o,u,e),[e]),u.getSnapshot!==n||_||xt!==null&&xt.memoizedState.tag&1){if(o.flags|=2048,wi(9,{destroy:void 0},m0.bind(null,o,u,a,n),null),Ze===null)throw Error(i(349));h||(dr&127)!==0||d0(o,n,a)}return a}function d0(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ce.updateQueue,n===null?(n=ul(),Ce.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function m0(e,n,a,o){n.value=a,n.getSnapshot=o,y0(n)&&g0(e)}function p0(e,n,a){return a(function(){y0(n)&&g0(e)})}function y0(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!nn(e,a)}catch{return!0}}function g0(e){var n=Ts(e,2);n!==null&&Zt(n,e,2)}function Af(e){var n=Ut();if(typeof e=="function"){var a=e;if(e=a(),Bs){en(!0);try{a()}finally{en(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:e},n}function b0(e,n,a,o){return e.baseState=a,Ef(e,Ke,typeof o=="function"?o:mr)}function Wx(e,n,a,o,u){if(pl(e))throw Error(i(485));if(e=n.action,e!==null){var h={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){h.listeners.push(_)}};Y.T!==null?a(!0):h.isTransition=!1,o(h),a=n.pending,a===null?(h.next=n.pending=h,v0(n,h)):(h.next=a.next,n.pending=a.next=h)}}function v0(e,n){var a=n.action,o=n.payload,u=e.state;if(n.isTransition){var h=Y.T,_={};Y.T=_;try{var E=a(u,o),R=Y.S;R!==null&&R(_,E),x0(e,n,E)}catch(H){jf(e,n,H)}finally{h!==null&&_.types!==null&&(h.types=_.types),Y.T=h}}else try{h=a(u,o),x0(e,n,h)}catch(H){jf(e,n,H)}}function x0(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){_0(e,n,o)},function(o){return jf(e,n,o)}):_0(e,n,a)}function _0(e,n,a){n.status="fulfilled",n.value=a,w0(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,v0(e,a)))}function jf(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,w0(n),n=n.next;while(n!==o)}e.action=null}function w0(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function S0(e,n){return n}function E0(e,n){if(Pe){var a=Ze.formState;if(a!==null){e:{var o=Ce;if(Pe){if(tt){t:{for(var u=tt,h=Tn;u.nodeType!==8;){if(!h){u=null;break t}if(u=Nn(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){tt=Nn(u.nextSibling),o=u.data==="F!";break e}}zr(o)}o=!1}o&&(n=a[0])}}return a=Ut(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:S0,lastRenderedState:n},a.queue=o,a=H0.bind(null,Ce,o),o.dispatch=a,o=Af(!1),h=Rf.bind(null,Ce,!1,o.queue),o=Ut(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,a=Wx.bind(null,Ce,u,h,a),u.dispatch=a,o.memoizedState=e,[n,a,!1]}function O0(e){var n=gt();return A0(n,Ke,e)}function A0(e,n,a){if(n=Ef(e,n,S0)[0],e=hl(mr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=ja(n)}catch(_){throw _===gi?nl:_}else o=n;n=gt();var u=n.queue,h=u.dispatch;return a!==n.memoizedState&&(Ce.flags|=2048,wi(9,{destroy:void 0},e_.bind(null,u,a),null)),[o,h,e]}function e_(e,n){e.action=n}function j0(e){var n=gt(),a=Ke;if(a!==null)return A0(n,a,e);gt(),n=n.memoizedState,a=gt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function wi(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=Ce.updateQueue,n===null&&(n=ul(),Ce.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function T0(){return gt().memoizedState}function dl(e,n,a,o){var u=Ut();Ce.flags|=e,u.memoizedState=wi(1|n,{destroy:void 0},a,o===void 0?null:o)}function ml(e,n,a,o){var u=gt();o=o===void 0?null:o;var h=u.memoizedState.inst;Ke!==null&&o!==null&&bf(o,Ke.memoizedState.deps)?u.memoizedState=wi(n,h,a,o):(Ce.flags|=e,u.memoizedState=wi(1|n,h,a,o))}function k0(e,n){dl(8390656,8,e,n)}function Tf(e,n){ml(2048,8,e,n)}function t_(e){Ce.flags|=4;var n=Ce.updateQueue;if(n===null)n=ul(),Ce.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function N0(e){var n=gt().memoizedState;return t_({ref:n,nextImpl:e}),function(){if((Ge&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function C0(e,n){return ml(4,2,e,n)}function M0(e,n){return ml(4,4,e,n)}function R0(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function D0(e,n,a){a=a!=null?a.concat([e]):null,ml(4,4,R0.bind(null,n,e),a)}function kf(){}function q0(e,n){var a=gt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&bf(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function L0(e,n){var a=gt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&bf(n,o[1]))return o[0];if(o=e(),Bs){en(!0);try{e()}finally{en(!1)}}return a.memoizedState=[o,n],o}function Nf(e,n,a){return a===void 0||(dr&1073741824)!==0&&(Le&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Bp(),Ce.lanes|=e,Xr|=e,a)}function B0(e,n,a,o){return nn(a,n)?a:vi.current!==null?(e=Nf(e,a,o),nn(e,n)||(_t=!0),e):(dr&42)===0||(dr&1073741824)!==0&&(Le&261930)===0?(_t=!0,e.memoizedState=a):(e=Bp(),Ce.lanes|=e,Xr|=e,n)}function P0(e,n,a,o,u){var h=ae.p;ae.p=h!==0&&8>h?h:8;var _=Y.T,E={};Y.T=E,Rf(e,!1,n,a);try{var R=u(),H=Y.S;if(H!==null&&H(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Q=Jx(R,o);Ta(e,n,Q,cn(e))}else Ta(e,n,o,cn(e))}catch(ne){Ta(e,n,{then:function(){},status:"rejected",reason:ne},cn())}finally{ae.p=h,_!==null&&E.types!==null&&(_.types=E.types),Y.T=_}}function n_(){}function Cf(e,n,a,o){if(e.tag!==5)throw Error(i(476));var u=U0(e).queue;P0(e,u,n,de,a===null?n_:function(){return z0(e),a(o)})}function U0(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function z0(e){var n=U0(e);n.next===null&&(n=e.alternate.memoizedState),Ta(e,n.next.queue,{},cn())}function Mf(){return Mt(Fa)}function I0(){return gt().memoizedState}function $0(){return gt().memoizedState}function r_(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=cn();e=Hr(a);var o=Gr(n,e,a);o!==null&&(Zt(o,n,a),Sa(o,n,a)),n={cache:of()},e.payload=n;return}n=n.return}}function s_(e,n,a){var o=cn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},pl(e)?G0(n,a):(a=Xu(e,n,a,o),a!==null&&(Zt(a,e,o),F0(a,n,o)))}function H0(e,n,a){var o=cn();Ta(e,n,a,o)}function Ta(e,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(pl(e))G0(n,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var _=n.lastRenderedState,E=h(_,a);if(u.hasEagerState=!0,u.eagerState=E,nn(E,_))return Xo(e,n,u,0),Ze===null&&Ko(),!1}catch{}finally{}if(a=Xu(e,n,u,o),a!==null)return Zt(a,e,o),F0(a,n,o),!0}return!1}function Rf(e,n,a,o){if(o={lane:2,revertLane:fh(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},pl(e)){if(n)throw Error(i(479))}else n=Xu(e,a,o,2),n!==null&&Zt(n,e,2)}function pl(e){var n=e.alternate;return e===Ce||n!==null&&n===Ce}function G0(e,n){xi=ll=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function F0(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,ws(e,a)}}var ka={readContext:Mt,use:fl,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useLayoutEffect:ft,useInsertionEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useSyncExternalStore:ft,useId:ft,useHostTransitionStatus:ft,useFormState:ft,useActionState:ft,useOptimistic:ft,useMemoCache:ft,useCacheRefresh:ft};ka.useEffectEvent=ft;var V0={readContext:Mt,use:fl,useCallback:function(e,n){return Ut().memoizedState=[e,n===void 0?null:n],e},useContext:Mt,useEffect:k0,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,dl(4194308,4,R0.bind(null,n,e),a)},useLayoutEffect:function(e,n){return dl(4194308,4,e,n)},useInsertionEffect:function(e,n){dl(4,2,e,n)},useMemo:function(e,n){var a=Ut();n=n===void 0?null:n;var o=e();if(Bs){en(!0);try{e()}finally{en(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Ut();if(a!==void 0){var u=a(n);if(Bs){en(!0);try{a(n)}finally{en(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=s_.bind(null,Ce,e),[o.memoizedState,e]},useRef:function(e){var n=Ut();return e={current:e},n.memoizedState=e},useState:function(e){e=Af(e);var n=e.queue,a=H0.bind(null,Ce,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:kf,useDeferredValue:function(e,n){var a=Ut();return Nf(a,e,n)},useTransition:function(){var e=Af(!1);return e=P0.bind(null,Ce,e.queue,!0,!1),Ut().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ce,u=Ut();if(Pe){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Ze===null)throw Error(i(349));(Le&127)!==0||d0(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,k0(p0.bind(null,o,h,e),[e]),o.flags|=2048,wi(9,{destroy:void 0},m0.bind(null,o,h,a,n),null),a},useId:function(){var e=Ut(),n=Ze.identifierPrefix;if(Pe){var a=Xn,o=Kn;a=(o&~(1<<32-Bt(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=cl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Qx++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Mf,useFormState:E0,useActionState:E0,useOptimistic:function(e){var n=Ut();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Rf.bind(null,Ce,!0,a),a.dispatch=n,[e,n]},useMemoCache:Sf,useCacheRefresh:function(){return Ut().memoizedState=r_.bind(null,Ce)},useEffectEvent:function(e){var n=Ut(),a={impl:e};return n.memoizedState=a,function(){if((Ge&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Df={readContext:Mt,use:fl,useCallback:q0,useContext:Mt,useEffect:Tf,useImperativeHandle:D0,useInsertionEffect:C0,useLayoutEffect:M0,useMemo:L0,useReducer:hl,useRef:T0,useState:function(){return hl(mr)},useDebugValue:kf,useDeferredValue:function(e,n){var a=gt();return B0(a,Ke.memoizedState,e,n)},useTransition:function(){var e=hl(mr)[0],n=gt().memoizedState;return[typeof e=="boolean"?e:ja(e),n]},useSyncExternalStore:h0,useId:I0,useHostTransitionStatus:Mf,useFormState:O0,useActionState:O0,useOptimistic:function(e,n){var a=gt();return b0(a,Ke,e,n)},useMemoCache:Sf,useCacheRefresh:$0};Df.useEffectEvent=N0;var Y0={readContext:Mt,use:fl,useCallback:q0,useContext:Mt,useEffect:Tf,useImperativeHandle:D0,useInsertionEffect:C0,useLayoutEffect:M0,useMemo:L0,useReducer:Of,useRef:T0,useState:function(){return Of(mr)},useDebugValue:kf,useDeferredValue:function(e,n){var a=gt();return Ke===null?Nf(a,e,n):B0(a,Ke.memoizedState,e,n)},useTransition:function(){var e=Of(mr)[0],n=gt().memoizedState;return[typeof e=="boolean"?e:ja(e),n]},useSyncExternalStore:h0,useId:I0,useHostTransitionStatus:Mf,useFormState:j0,useActionState:j0,useOptimistic:function(e,n){var a=gt();return Ke!==null?b0(a,Ke,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Sf,useCacheRefresh:$0};Y0.useEffectEvent=N0;function qf(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Lf={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=cn(),u=Hr(o);u.payload=n,a!=null&&(u.callback=a),n=Gr(e,u,o),n!==null&&(Zt(n,e,o),Sa(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=cn(),u=Hr(o);u.tag=1,u.payload=n,a!=null&&(u.callback=a),n=Gr(e,u,o),n!==null&&(Zt(n,e,o),Sa(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=cn(),o=Hr(a);o.tag=2,n!=null&&(o.callback=n),n=Gr(e,o,a),n!==null&&(Zt(n,e,a),Sa(n,e,a))}};function K0(e,n,a,o,u,h,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,_):n.prototype&&n.prototype.isPureReactComponent?!pa(a,o)||!pa(u,h):!0}function X0(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&Lf.enqueueReplaceState(n,n.state,null)}function Ps(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function J0(e){Yo(e)}function Q0(e){console.error(e)}function Z0(e){Yo(e)}function yl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function W0(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Bf(e,n,a){return a=Hr(a),a.tag=3,a.payload={element:null},a.callback=function(){yl(e,n)},a}function ep(e){return e=Hr(e),e.tag=3,e}function tp(e,n,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var h=o.value;e.payload=function(){return u(h)},e.callback=function(){W0(n,a,o)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){W0(n,a,o),typeof u!="function"&&(Jr===null?Jr=new Set([this]):Jr.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function i_(e,n,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&mi(n,a,u,!0),a=sn.current,a!==null){switch(a.tag){case 31:case 13:return kn===null?Tl():a.alternate===null&&ht===0&&(ht=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===rl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),lh(e,o,u)),!1;case 22:return a.flags|=65536,o===rl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),lh(e,o,u)),!1}throw Error(i(435,a.tag))}return lh(e,o,u),Tl(),!1}if(Pe)return n=sn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==tf&&(e=Error(i(422),{cause:o}),ba(On(e,a)))):(o!==tf&&(n=Error(i(423),{cause:o}),ba(On(n,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=On(o,a),u=Bf(e.stateNode,o,u),df(e,u),ht!==4&&(ht=2)),!1;var h=Error(i(520),{cause:o});if(h=On(h,a),Ba===null?Ba=[h]:Ba.push(h),ht!==4&&(ht=2),n===null)return!0;o=On(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Bf(a.stateNode,o,e),df(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Jr===null||!Jr.has(h))))return a.flags|=65536,u&=-u,a.lanes|=u,u=ep(u),tp(u,e,a,o),df(a,u),!1}a=a.return}while(a!==null);return!1}var Pf=Error(i(461)),_t=!1;function Rt(e,n,a,o){n.child=e===null?i0(n,null,a,o):Ls(n,e.child,a,o)}function np(e,n,a,o,u){a=a.render;var h=n.ref;if("ref"in o){var _={};for(var E in o)E!=="ref"&&(_[E]=o[E])}else _=o;return Ms(n),o=vf(e,n,a,_,h,u),E=xf(),e!==null&&!_t?(_f(e,n,u),pr(e,n,u)):(Pe&&E&&Wu(n),n.flags|=1,Rt(e,n,o,u),n.child)}function rp(e,n,a,o,u){if(e===null){var h=a.type;return typeof h=="function"&&!Ju(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,sp(e,n,h,o,u)):(e=Qo(a.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Vf(e,u)){var _=h.memoizedProps;if(a=a.compare,a=a!==null?a:pa,a(_,o)&&e.ref===n.ref)return pr(e,n,u)}return n.flags|=1,e=cr(h,o),e.ref=n.ref,e.return=n,n.child=e}function sp(e,n,a,o,u){if(e!==null){var h=e.memoizedProps;if(pa(h,o)&&e.ref===n.ref)if(_t=!1,n.pendingProps=o=h,Vf(e,u))(e.flags&131072)!==0&&(_t=!0);else return n.lanes=e.lanes,pr(e,n,u)}return Uf(e,n,a,o,u)}function ip(e,n,a,o){var u=o.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~h}else o=0,n.child=null;return ap(e,n,h,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&tl(n,h!==null?h.cachePool:null),h!==null?l0(n,h):pf(),c0(n);else return o=n.lanes=536870912,ap(e,n,h!==null?h.baseLanes|a:a,a,o)}else h!==null?(tl(n,h.cachePool),l0(n,h),Vr(),n.memoizedState=null):(e!==null&&tl(n,null),pf(),Vr());return Rt(e,n,u,a),n.child}function Na(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function ap(e,n,a,o,u){var h=cf();return h=h===null?null:{parent:vt._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&tl(n,null),pf(),c0(n),e!==null&&mi(e,n,o,!0),n.childLanes=u,null}function gl(e,n){return n=vl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function op(e,n,a){return Ls(n,e.child,null,a),e=gl(n,n.pendingProps),e.flags|=2,an(n),n.memoizedState=null,e}function a_(e,n,a){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Pe){if(o.mode==="hidden")return e=gl(n,o),n.lanes=536870912,Na(null,e);if(gf(n),(e=tt)?(e=vy(e,Tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Pr!==null?{id:Kn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Gm(e),a.return=n,n.child=a,Ct=n,tt=null)):e=null,e===null)throw zr(n);return n.lanes=536870912,null}return gl(n,o)}var h=e.memoizedState;if(h!==null){var _=h.dehydrated;if(gf(n),u)if(n.flags&256)n.flags&=-257,n=op(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(_t||mi(e,n,a,!1),u=(a&e.childLanes)!==0,_t||u){if(o=Ze,o!==null&&(_=Lr(o,a),_!==0&&_!==h.retryLane))throw h.retryLane=_,Ts(e,_),Zt(o,e,_),Pf;Tl(),n=op(e,n,a)}else e=h.treeContext,tt=Nn(_.nextSibling),Ct=n,Pe=!0,Ur=null,Tn=!1,e!==null&&Ym(n,e),n=gl(n,o),n.flags|=4096;return n}return e=cr(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function bl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Uf(e,n,a,o,u){return Ms(n),a=vf(e,n,a,o,void 0,u),o=xf(),e!==null&&!_t?(_f(e,n,u),pr(e,n,u)):(Pe&&o&&Wu(n),n.flags|=1,Rt(e,n,a,u),n.child)}function lp(e,n,a,o,u,h){return Ms(n),n.updateQueue=null,a=f0(n,o,a,u),u0(e),o=xf(),e!==null&&!_t?(_f(e,n,h),pr(e,n,h)):(Pe&&o&&Wu(n),n.flags|=1,Rt(e,n,a,h),n.child)}function cp(e,n,a,o,u){if(Ms(n),n.stateNode===null){var h=ui,_=a.contextType;typeof _=="object"&&_!==null&&(h=Mt(_)),h=new a(o,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Lf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=o,h.state=n.memoizedState,h.refs={},ff(n),_=a.contextType,h.context=typeof _=="object"&&_!==null?Mt(_):ui,h.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(qf(n,a,_,o),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(_=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),_!==h.state&&Lf.enqueueReplaceState(h,h.state,null),Oa(n,o,h,u),Ea(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){h=n.stateNode;var E=n.memoizedProps,R=Ps(a,E);h.props=R;var H=h.context,Q=a.contextType;_=ui,typeof Q=="object"&&Q!==null&&(_=Mt(Q));var ne=a.getDerivedStateFromProps;Q=typeof ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,Q||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||H!==_)&&X0(n,h,o,_),$r=!1;var F=n.memoizedState;h.state=F,Oa(n,o,h,u),Ea(),H=n.memoizedState,E||F!==H||$r?(typeof ne=="function"&&(qf(n,a,ne,o),H=n.memoizedState),(R=$r||K0(n,a,R,o,F,H,_))?(Q||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=H),h.props=o,h.state=H,h.context=_,o=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{h=n.stateNode,hf(e,n),_=n.memoizedProps,Q=Ps(a,_),h.props=Q,ne=n.pendingProps,F=h.context,H=a.contextType,R=ui,typeof H=="object"&&H!==null&&(R=Mt(H)),E=a.getDerivedStateFromProps,(H=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(_!==ne||F!==R)&&X0(n,h,o,R),$r=!1,F=n.memoizedState,h.state=F,Oa(n,o,h,u),Ea();var K=n.memoizedState;_!==ne||F!==K||$r||e!==null&&e.dependencies!==null&&Wo(e.dependencies)?(typeof E=="function"&&(qf(n,a,E,o),K=n.memoizedState),(Q=$r||K0(n,a,Q,o,F,K,R)||e!==null&&e.dependencies!==null&&Wo(e.dependencies))?(H||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,K,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,K,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=K),h.props=o,h.state=K,h.context=R,o=Q):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),o=!1)}return h=o,bl(e,n),o=(n.flags&128)!==0,h||o?(h=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&o?(n.child=Ls(n,e.child,null,u),n.child=Ls(n,null,a,u)):Rt(e,n,a,u),n.memoizedState=h.state,e=n.child):e=pr(e,n,u),e}function up(e,n,a,o){return Ns(),n.flags|=256,Rt(e,n,a,o),n.child}var zf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function If(e){return{baseLanes:e,cachePool:Wm()}}function $f(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=ln),e}function fp(e,n,a){var o=n.pendingProps,u=!1,h=(n.flags&128)!==0,_;if((_=h)||(_=e!==null&&e.memoizedState===null?!1:(yt.current&2)!==0),_&&(u=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(Pe){if(u?Fr(n):Vr(),(e=tt)?(e=vy(e,Tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Pr!==null?{id:Kn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Gm(e),a.return=n,n.child=a,Ct=n,tt=null)):e=null,e===null)throw zr(n);return Eh(e)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,u?(Vr(),u=n.mode,E=vl({mode:"hidden",children:E},u),o=ks(o,u,a,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=If(a),o.childLanes=$f(e,_,a),n.memoizedState=zf,Na(null,o)):(Fr(n),Hf(n,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(h)n.flags&256?(Fr(n),n.flags&=-257,n=Gf(e,n,a)):n.memoizedState!==null?(Vr(),n.child=e.child,n.flags|=128,n=null):(Vr(),E=o.fallback,u=n.mode,o=vl({mode:"visible",children:o.children},u),E=ks(E,u,a,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,Ls(n,e.child,null,a),o=n.child,o.memoizedState=If(a),o.childLanes=$f(e,_,a),n.memoizedState=zf,n=Na(null,o));else if(Fr(n),Eh(E)){if(_=E.nextSibling&&E.nextSibling.dataset,_)var H=_.dgst;_=H,o=Error(i(419)),o.stack="",o.digest=_,ba({value:o,source:null,stack:null}),n=Gf(e,n,a)}else if(_t||mi(e,n,a,!1),_=(a&e.childLanes)!==0,_t||_){if(_=Ze,_!==null&&(o=Lr(_,a),o!==0&&o!==R.retryLane))throw R.retryLane=o,Ts(e,o),Zt(_,e,o),Pf;Sh(E)||Tl(),n=Gf(e,n,a)}else Sh(E)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,tt=Nn(E.nextSibling),Ct=n,Pe=!0,Ur=null,Tn=!1,e!==null&&Ym(n,e),n=Hf(n,o.children),n.flags|=4096);return n}return u?(Vr(),E=o.fallback,u=n.mode,R=e.child,H=R.sibling,o=cr(R,{mode:"hidden",children:o.children}),o.subtreeFlags=R.subtreeFlags&65011712,H!==null?E=cr(H,E):(E=ks(E,u,a,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Na(null,o),o=n.child,E=e.child.memoizedState,E===null?E=If(a):(u=E.cachePool,u!==null?(R=vt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Wm(),E={baseLanes:E.baseLanes|a,cachePool:u}),o.memoizedState=E,o.childLanes=$f(e,_,a),n.memoizedState=zf,Na(e.child,o)):(Fr(n),a=e.child,e=a.sibling,a=cr(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=a,n.memoizedState=null,a)}function Hf(e,n){return n=vl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function vl(e,n){return e=rn(22,e,null,n),e.lanes=0,e}function Gf(e,n,a){return Ls(n,e.child,null,a),e=Hf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function hp(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),sf(e.return,n,a)}function Ff(e,n,a,o,u,h){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:h}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=o,_.tail=a,_.tailMode=u,_.treeForkCount=h)}function dp(e,n,a){var o=n.pendingProps,u=o.revealOrder,h=o.tail;o=o.children;var _=yt.current,E=(_&2)!==0;if(E?(_=_&1|2,n.flags|=128):_&=1,ke(yt,_),Rt(e,n,o,a),o=Pe?ga:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hp(e,a,n);else if(e.tag===19)hp(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=n.child,u=null;a!==null;)e=a.alternate,e!==null&&ol(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=n.child,n.child=null):(u=a.sibling,a.sibling=null),Ff(n,!1,u,a,h,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&ol(e)===null){n.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}Ff(n,!0,a,null,h,o);break;case"together":Ff(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function pr(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Xr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(mi(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,a=cr(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=cr(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Vf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Wo(e)))}function o_(e,n,a){switch(n.tag){case 3:qt(n,n.stateNode.containerInfo),Ir(n,vt,e.memoizedState.cache),Ns();break;case 27:case 5:Lt(n);break;case 4:qt(n,n.stateNode.containerInfo);break;case 10:Ir(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,gf(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Fr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?fp(e,n,a):(Fr(n),e=pr(e,n,a),e!==null?e.sibling:null);Fr(n);break;case 19:var u=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(mi(e,n,a,!1),o=(a&n.childLanes)!==0),u){if(o)return dp(e,n,a);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ke(yt,yt.current),o)break;return null;case 22:return n.lanes=0,ip(e,n,a,n.pendingProps);case 24:Ir(n,vt,e.memoizedState.cache)}return pr(e,n,a)}function mp(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)_t=!0;else{if(!Vf(e,a)&&(n.flags&128)===0)return _t=!1,o_(e,n,a);_t=(e.flags&131072)!==0}else _t=!1,Pe&&(n.flags&1048576)!==0&&Vm(n,ga,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=Ds(n.elementType),n.type=e,typeof e=="function")Ju(e)?(o=Ps(e,o),n.tag=1,n=cp(null,n,e,o,a)):(n.tag=0,n=Uf(null,n,e,o,a));else{if(e!=null){var u=e.$$typeof;if(u===ce){n.tag=11,n=np(null,n,e,o,a);break e}else if(u===se){n.tag=14,n=rp(null,n,e,o,a);break e}}throw n=xe(e)||e,Error(i(306,n,""))}}return n;case 0:return Uf(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,u=Ps(o,n.pendingProps),cp(e,n,o,u,a);case 3:e:{if(qt(n,n.stateNode.containerInfo),e===null)throw Error(i(387));o=n.pendingProps;var h=n.memoizedState;u=h.element,hf(e,n),Oa(n,o,null,a);var _=n.memoizedState;if(o=_.cache,Ir(n,vt,o),o!==h.cache&&af(n,[vt],a,!0),Ea(),o=_.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=up(e,n,o,a);break e}else if(o!==u){u=On(Error(i(424)),n),ba(u),n=up(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(tt=Nn(e.firstChild),Ct=n,Pe=!0,Ur=null,Tn=!0,a=i0(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ns(),o===u){n=pr(e,n,a);break e}Rt(e,n,o,a)}n=n.child}return n;case 26:return bl(e,n),e===null?(a=Oy(n.type,null,n.pendingProps,null))?n.memoizedState=a:Pe||(a=n.type,e=n.pendingProps,o=ql(ct.current).createElement(a),o[Qe]=n,o[ut]=e,Dt(o,a,e),D(o),n.stateNode=o):n.memoizedState=Oy(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Lt(n),e===null&&Pe&&(o=n.stateNode=wy(n.type,n.pendingProps,ct.current),Ct=n,Tn=!0,u=tt,es(n.type)?(Oh=u,tt=Nn(o.firstChild)):tt=u),Rt(e,n,n.pendingProps.children,a),bl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Pe&&((u=o=tt)&&(o=B_(o,n.type,n.pendingProps,Tn),o!==null?(n.stateNode=o,Ct=n,tt=Nn(o.firstChild),Tn=!1,u=!0):u=!1),u||zr(n)),Lt(n),u=n.type,h=n.pendingProps,_=e!==null?e.memoizedProps:null,o=h.children,xh(u,h)?o=null:_!==null&&xh(u,_)&&(n.flags|=32),n.memoizedState!==null&&(u=vf(e,n,Zx,null,null,a),Fa._currentValue=u),bl(e,n),Rt(e,n,o,a),n.child;case 6:return e===null&&Pe&&((e=a=tt)&&(a=P_(a,n.pendingProps,Tn),a!==null?(n.stateNode=a,Ct=n,tt=null,e=!0):e=!1),e||zr(n)),null;case 13:return fp(e,n,a);case 4:return qt(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Ls(n,null,o,a):Rt(e,n,o,a),n.child;case 11:return np(e,n,n.type,n.pendingProps,a);case 7:return Rt(e,n,n.pendingProps,a),n.child;case 8:return Rt(e,n,n.pendingProps.children,a),n.child;case 12:return Rt(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Ir(n,n.type,o.value),Rt(e,n,o.children,a),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ms(n),u=Mt(u),o=o(u),n.flags|=1,Rt(e,n,o,a),n.child;case 14:return rp(e,n,n.type,n.pendingProps,a);case 15:return sp(e,n,n.type,n.pendingProps,a);case 19:return dp(e,n,a);case 31:return a_(e,n,a);case 22:return ip(e,n,a,n.pendingProps);case 24:return Ms(n),o=Mt(vt),e===null?(u=cf(),u===null&&(u=Ze,h=of(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=a),u=h),n.memoizedState={parent:o,cache:u},ff(n),Ir(n,vt,u)):((e.lanes&a)!==0&&(hf(e,n),Oa(n,null,null,a),Ea()),u=e.memoizedState,h=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Ir(n,vt,o)):(o=h.cache,Ir(n,vt,o),o!==u.cache&&af(n,[vt],a,!0))),Rt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function yr(e){e.flags|=4}function Yf(e,n,a,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Ip())e.flags|=8192;else throw qs=rl,uf}else e.flags&=-16777217}function pp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ny(n))if(Ip())e.flags|=8192;else throw qs=rl,uf}function xl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ei():536870912,e.lanes|=n,Ai|=n)}function Ca(e,n){if(!Pe)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function nt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function l_(e,n,a){var o=n.pendingProps;switch(ef(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(n),null;case 1:return nt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),hr(vt),Ne(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(di(n)?yr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,nf())),nt(n),null;case 26:var u=n.type,h=n.memoizedState;return e===null?(yr(n),h!==null?(nt(n),pp(n,h)):(nt(n),Yf(n,u,null,o,a))):h?h!==e.memoizedState?(yr(n),nt(n),pp(n,h)):(nt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&yr(n),nt(n),Yf(n,u,e,o,a)),null;case 27:if(gs(n),a=ct.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&yr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return nt(n),null}e=We.current,di(n)?Km(n):(e=wy(u,o,a),n.stateNode=e,yr(n))}return nt(n),null;case 5:if(gs(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&yr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return nt(n),null}if(h=We.current,di(n))Km(n);else{var _=ql(ct.current);switch(h){case 1:h=_.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=_.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=_.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?_.createElement("select",{is:o.is}):_.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?_.createElement(u,{is:o.is}):_.createElement(u)}}h[Qe]=n,h[ut]=o;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)h.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=h;e:switch(Dt(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&yr(n)}}return nt(n),Yf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&yr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=ct.current,di(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,u=Ct,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[Qe]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||fy(e.nodeValue,a)),e||zr(n,!0)}else e=ql(e).createTextNode(o),e[Qe]=n,n.stateNode=e}return nt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=di(n),a!==null){if(e===null){if(!o)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Qe]=n}else Ns(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;nt(n),e=!1}else a=nf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(an(n),n):(an(n),null);if((n.flags&128)!==0)throw Error(i(558))}return nt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=di(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(i(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));u[Qe]=n}else Ns(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;nt(n),u=!1}else u=nf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(an(n),n):(an(n),null)}return an(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),xl(n,n.updateQueue),nt(n),null);case 4:return Ne(),e===null&&ph(n.stateNode.containerInfo),nt(n),null;case 10:return hr(n.type),nt(n),null;case 19:if(Se(yt),o=n.memoizedState,o===null)return nt(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Ca(o,!1);else{if(ht!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=ol(e),h!==null){for(n.flags|=128,Ca(o,!1),e=h.updateQueue,n.updateQueue=e,xl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Hm(a,e),a=a.sibling;return ke(yt,yt.current&1|2),Pe&&ur(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&rt()>Ol&&(n.flags|=128,u=!0,Ca(o,!1),n.lanes=4194304)}else{if(!u)if(e=ol(h),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,xl(n,e),Ca(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!Pe)return nt(n),null}else 2*rt()-o.renderingStartTime>Ol&&a!==536870912&&(n.flags|=128,u=!0,Ca(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(e=o.last,e!==null?e.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=rt(),e.sibling=null,a=yt.current,ke(yt,u?a&1|2:a&1),Pe&&ur(n,o.treeForkCount),e):(nt(n),null);case 22:case 23:return an(n),yf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(nt(n),n.subtreeFlags&6&&(n.flags|=8192)):nt(n),a=n.updateQueue,a!==null&&xl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&Se(Rs),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),hr(vt),nt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function c_(e,n){switch(ef(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return hr(vt),Ne(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return gs(n),null;case 31:if(n.memoizedState!==null){if(an(n),n.alternate===null)throw Error(i(340));Ns()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(an(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Ns()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Se(yt),null;case 4:return Ne(),null;case 10:return hr(n.type),null;case 22:case 23:return an(n),yf(),e!==null&&Se(Rs),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return hr(vt),null;case 25:return null;default:return null}}function yp(e,n){switch(ef(n),n.tag){case 3:hr(vt),Ne();break;case 26:case 27:case 5:gs(n);break;case 4:Ne();break;case 31:n.memoizedState!==null&&an(n);break;case 13:an(n);break;case 19:Se(yt);break;case 10:hr(n.type);break;case 22:case 23:an(n),yf(),e!==null&&Se(Rs);break;case 24:hr(vt)}}function Ma(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&e)===e){o=void 0;var h=a.create,_=a.inst;o=h(),_.destroy=o}a=a.next}while(a!==u)}}catch(E){Ve(n,n.return,E)}}function Yr(e,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&e)===e){var _=o.inst,E=_.destroy;if(E!==void 0){_.destroy=void 0,u=n;var R=a,H=E;try{H()}catch(Q){Ve(u,R,Q)}}}o=o.next}while(o!==h)}}catch(Q){Ve(n,n.return,Q)}}function gp(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{o0(n,a)}catch(o){Ve(e,e.return,o)}}}function bp(e,n,a){a.props=Ps(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ve(e,n,o)}}function Ra(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(u){Ve(e,n,u)}}function Jn(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Ve(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Ve(e,n,u)}else a.current=null}function vp(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Ve(e,e.return,u)}}function Kf(e,n,a){try{var o=e.stateNode;C_(o,e.type,a,n),o[ut]=n}catch(u){Ve(e,e.return,u)}}function xp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&es(e.type)||e.tag===4}function Xf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&es(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jf(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=or));else if(o!==4&&(o===27&&es(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Jf(e,n,a),e=e.sibling;e!==null;)Jf(e,n,a),e=e.sibling}function _l(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&es(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(_l(e,n,a),e=e.sibling;e!==null;)_l(e,n,a),e=e.sibling}function _p(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);Dt(n,o,a),n[Qe]=e,n[ut]=a}catch(h){Ve(e,e.return,h)}}var gr=!1,wt=!1,Qf=!1,wp=typeof WeakSet=="function"?WeakSet:Set,jt=null;function u_(e,n){if(e=e.containerInfo,bh=$l,e=Dm(e),Hu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var u=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var _=0,E=-1,R=-1,H=0,Q=0,ne=e,F=null;t:for(;;){for(var K;ne!==a||u!==0&&ne.nodeType!==3||(E=_+u),ne!==h||o!==0&&ne.nodeType!==3||(R=_+o),ne.nodeType===3&&(_+=ne.nodeValue.length),(K=ne.firstChild)!==null;)F=ne,ne=K;for(;;){if(ne===e)break t;if(F===a&&++H===u&&(E=_),F===h&&++Q===o&&(R=_),(K=ne.nextSibling)!==null)break;ne=F,F=ne.parentNode}ne=K}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(vh={focusedElem:e,selectionRange:a},$l=!1,jt=n;jt!==null;)if(n=jt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,jt=e;else for(;jt!==null;){switch(n=jt,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,u=h.memoizedProps,h=h.memoizedState,o=a.stateNode;try{var ye=Ps(a.type,u);e=o.getSnapshotBeforeUpdate(ye,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Ve(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)wh(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":wh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,jt=e;break}jt=n.return}}function Sp(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:vr(e,a),o&4&&Ma(5,a);break;case 1:if(vr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){Ve(a,a.return,_)}else{var u=Ps(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){Ve(a,a.return,_)}}o&64&&gp(a),o&512&&Ra(a,a.return);break;case 3:if(vr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{o0(e,n)}catch(_){Ve(a,a.return,_)}}break;case 27:n===null&&o&4&&_p(a);case 26:case 5:vr(e,a),n===null&&o&4&&vp(a),o&512&&Ra(a,a.return);break;case 12:vr(e,a);break;case 31:vr(e,a),o&4&&Ap(e,a);break;case 13:vr(e,a),o&4&&jp(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=v_.bind(null,a),U_(e,a))));break;case 22:if(o=a.memoizedState!==null||gr,!o){n=n!==null&&n.memoizedState!==null||wt,u=gr;var h=wt;gr=o,(wt=n)&&!h?xr(e,a,(a.subtreeFlags&8772)!==0):vr(e,a),gr=u,wt=h}break;case 30:break;default:vr(e,a)}}function Ep(e){var n=e.alternate;n!==null&&(e.alternate=null,Ep(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&ti(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var st=null,Kt=!1;function br(e,n,a){for(a=a.child;a!==null;)Op(e,n,a),a=a.sibling}function Op(e,n,a){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(vs,a)}catch{}switch(a.tag){case 26:wt||Jn(a,n),br(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:wt||Jn(a,n);var o=st,u=Kt;es(a.type)&&(st=a.stateNode,Kt=!1),br(e,n,a),$a(a.stateNode),st=o,Kt=u;break;case 5:wt||Jn(a,n);case 6:if(o=st,u=Kt,st=null,br(e,n,a),st=o,Kt=u,st!==null)if(Kt)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(a.stateNode)}catch(h){Ve(a,n,h)}else try{st.removeChild(a.stateNode)}catch(h){Ve(a,n,h)}break;case 18:st!==null&&(Kt?(e=st,gy(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Di(e)):gy(st,a.stateNode));break;case 4:o=st,u=Kt,st=a.stateNode.containerInfo,Kt=!0,br(e,n,a),st=o,Kt=u;break;case 0:case 11:case 14:case 15:Yr(2,a,n),wt||Yr(4,a,n),br(e,n,a);break;case 1:wt||(Jn(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&bp(a,n,o)),br(e,n,a);break;case 21:br(e,n,a);break;case 22:wt=(o=wt)||a.memoizedState!==null,br(e,n,a),wt=o;break;default:br(e,n,a)}}function Ap(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Di(e)}catch(a){Ve(n,n.return,a)}}}function jp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Di(e)}catch(a){Ve(n,n.return,a)}}function f_(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new wp),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new wp),n;default:throw Error(i(435,e.tag))}}function wl(e,n){var a=f_(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var u=x_.bind(null,e,o);o.then(u,u)}})}function Xt(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o],h=e,_=n,E=_;e:for(;E!==null;){switch(E.tag){case 27:if(es(E.type)){st=E.stateNode,Kt=!1;break e}break;case 5:st=E.stateNode,Kt=!1;break e;case 3:case 4:st=E.stateNode.containerInfo,Kt=!0;break e}E=E.return}if(st===null)throw Error(i(160));Op(h,_,u),st=null,Kt=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Tp(n,e),n=n.sibling}var Un=null;function Tp(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Xt(n,e),Jt(e),o&4&&(Yr(3,e,e.return),Ma(3,e),Yr(5,e,e.return));break;case 1:Xt(n,e),Jt(e),o&512&&(wt||a===null||Jn(a,a.return)),o&64&&gr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var u=Un;if(Xt(n,e),Jt(e),o&512&&(wt||a===null||Jn(a,a.return)),o&4){var h=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":h=u.getElementsByTagName("title")[0],(!h||h[Et]||h[Qe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(o),u.head.insertBefore(h,u.querySelector("head > title"))),Dt(h,o,a),h[Qe]=e,D(h),o=h;break e;case"link":var _=Ty("link","href",u).get(o+(a.href||""));if(_){for(var E=0;E<_.length;E++)if(h=_[E],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(E,1);break t}}h=u.createElement(o),Dt(h,o,a),u.head.appendChild(h);break;case"meta":if(_=Ty("meta","content",u).get(o+(a.content||""))){for(E=0;E<_.length;E++)if(h=_[E],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(E,1);break t}}h=u.createElement(o),Dt(h,o,a),u.head.appendChild(h);break;default:throw Error(i(468,o))}h[Qe]=e,D(h),o=h}e.stateNode=o}else ky(u,e.type,e.stateNode);else e.stateNode=jy(u,o,e.memoizedProps);else h!==o?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,o===null?ky(u,e.type,e.stateNode):jy(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Kf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Xt(n,e),Jt(e),o&512&&(wt||a===null||Jn(a,a.return)),a!==null&&o&4&&Kf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Xt(n,e),Jt(e),o&512&&(wt||a===null||Jn(a,a.return)),e.flags&32){u=e.stateNode;try{ri(u,"")}catch(ye){Ve(e,e.return,ye)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Kf(e,u,a!==null?a.memoizedProps:u)),o&1024&&(Qf=!0);break;case 6:if(Xt(n,e),Jt(e),o&4){if(e.stateNode===null)throw Error(i(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(ye){Ve(e,e.return,ye)}}break;case 3:if(Pl=null,u=Un,Un=Ll(n.containerInfo),Xt(n,e),Un=u,Jt(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Di(n.containerInfo)}catch(ye){Ve(e,e.return,ye)}Qf&&(Qf=!1,kp(e));break;case 4:o=Un,Un=Ll(e.stateNode.containerInfo),Xt(n,e),Jt(e),Un=o;break;case 12:Xt(n,e),Jt(e);break;case 31:Xt(n,e),Jt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 13:Xt(n,e),Jt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(El=rt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 22:u=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,H=gr,Q=wt;if(gr=H||u,wt=Q||R,Xt(n,e),wt=Q,gr=H,Jt(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(a===null||R||gr||wt||Us(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,u)_=h.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{E=R.stateNode;var ne=R.memoizedProps.style,F=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;E.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(ye){Ve(R,R.return,ye)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(ye){Ve(R,R.return,ye)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;u?by(K,!0):by(R.stateNode,!1)}catch(ye){Ve(R,R.return,ye)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,wl(e,a))));break;case 19:Xt(n,e),Jt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 30:break;case 21:break;default:Xt(n,e),Jt(e)}}function Jt(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(xp(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var u=a.stateNode,h=Xf(e);_l(e,h,u);break;case 5:var _=a.stateNode;a.flags&32&&(ri(_,""),a.flags&=-33);var E=Xf(e);_l(e,E,_);break;case 3:case 4:var R=a.stateNode.containerInfo,H=Xf(e);Jf(e,H,R);break;default:throw Error(i(161))}}catch(Q){Ve(e,e.return,Q)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function kp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;kp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function vr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Sp(e,n.alternate,n),n=n.sibling}function Us(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Yr(4,n,n.return),Us(n);break;case 1:Jn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&bp(n,n.return,a),Us(n);break;case 27:$a(n.stateNode);case 26:case 5:Jn(n,n.return),Us(n);break;case 22:n.memoizedState===null&&Us(n);break;case 30:Us(n);break;default:Us(n)}e=e.sibling}}function xr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,h=n,_=h.flags;switch(h.tag){case 0:case 11:case 15:xr(u,h,a),Ma(4,h);break;case 1:if(xr(u,h,a),o=h,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(H){Ve(o,o.return,H)}if(o=h,u=o.updateQueue,u!==null){var E=o.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)a0(R[u],E)}catch(H){Ve(o,o.return,H)}}a&&_&64&&gp(h),Ra(h,h.return);break;case 27:_p(h);case 26:case 5:xr(u,h,a),a&&o===null&&_&4&&vp(h),Ra(h,h.return);break;case 12:xr(u,h,a);break;case 31:xr(u,h,a),a&&_&4&&Ap(u,h);break;case 13:xr(u,h,a),a&&_&4&&jp(u,h);break;case 22:h.memoizedState===null&&xr(u,h,a),Ra(h,h.return);break;case 30:break;default:xr(u,h,a)}n=n.sibling}}function Zf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&va(a))}function Wf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e))}function zn(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Np(e,n,a,o),n=n.sibling}function Np(e,n,a,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:zn(e,n,a,o),u&2048&&Ma(9,n);break;case 1:zn(e,n,a,o);break;case 3:zn(e,n,a,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e)));break;case 12:if(u&2048){zn(e,n,a,o),e=n.stateNode;try{var h=n.memoizedProps,_=h.id,E=h.onPostCommit;typeof E=="function"&&E(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Ve(n,n.return,R)}}else zn(e,n,a,o);break;case 31:zn(e,n,a,o);break;case 13:zn(e,n,a,o);break;case 23:break;case 22:h=n.stateNode,_=n.alternate,n.memoizedState!==null?h._visibility&2?zn(e,n,a,o):Da(e,n):h._visibility&2?zn(e,n,a,o):(h._visibility|=2,Si(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Zf(_,n);break;case 24:zn(e,n,a,o),u&2048&&Wf(n.alternate,n);break;default:zn(e,n,a,o)}}function Si(e,n,a,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,_=n,E=a,R=o,H=_.flags;switch(_.tag){case 0:case 11:case 15:Si(h,_,E,R,u),Ma(8,_);break;case 23:break;case 22:var Q=_.stateNode;_.memoizedState!==null?Q._visibility&2?Si(h,_,E,R,u):Da(h,_):(Q._visibility|=2,Si(h,_,E,R,u)),u&&H&2048&&Zf(_.alternate,_);break;case 24:Si(h,_,E,R,u),u&&H&2048&&Wf(_.alternate,_);break;default:Si(h,_,E,R,u)}n=n.sibling}}function Da(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,u=o.flags;switch(o.tag){case 22:Da(a,o),u&2048&&Zf(o.alternate,o);break;case 24:Da(a,o),u&2048&&Wf(o.alternate,o);break;default:Da(a,o)}n=n.sibling}}var qa=8192;function Ei(e,n,a){if(e.subtreeFlags&qa)for(e=e.child;e!==null;)Cp(e,n,a),e=e.sibling}function Cp(e,n,a){switch(e.tag){case 26:Ei(e,n,a),e.flags&qa&&e.memoizedState!==null&&Q_(a,Un,e.memoizedState,e.memoizedProps);break;case 5:Ei(e,n,a);break;case 3:case 4:var o=Un;Un=Ll(e.stateNode.containerInfo),Ei(e,n,a),Un=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=qa,qa=16777216,Ei(e,n,a),qa=o):Ei(e,n,a));break;default:Ei(e,n,a)}}function Mp(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function La(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];jt=o,Dp(o,e)}Mp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rp(e),e=e.sibling}function Rp(e){switch(e.tag){case 0:case 11:case 15:La(e),e.flags&2048&&Yr(9,e,e.return);break;case 3:La(e);break;case 12:La(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Sl(e)):La(e);break;default:La(e)}}function Sl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];jt=o,Dp(o,e)}Mp(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Yr(8,n,n.return),Sl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Sl(n));break;default:Sl(n)}e=e.sibling}}function Dp(e,n){for(;jt!==null;){var a=jt;switch(a.tag){case 0:case 11:case 15:Yr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:va(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,jt=o;else e:for(a=e;jt!==null;){o=jt;var u=o.sibling,h=o.return;if(Ep(o),o===a){jt=null;break e}if(u!==null){u.return=h,jt=u;break e}jt=h}}}var h_={getCacheForType:function(e){var n=Mt(vt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Mt(vt).controller.signal}},d_=typeof WeakMap=="function"?WeakMap:Map,Ge=0,Ze=null,De=null,Le=0,Fe=0,on=null,Kr=!1,Oi=!1,eh=!1,_r=0,ht=0,Xr=0,zs=0,th=0,ln=0,Ai=0,Ba=null,Qt=null,nh=!1,El=0,qp=0,Ol=1/0,Al=null,Jr=null,Ot=0,Qr=null,ji=null,wr=0,rh=0,sh=null,Lp=null,Pa=0,ih=null;function cn(){return(Ge&2)!==0&&Le!==0?Le&-Le:Y.T!==null?fh():aa()}function Bp(){if(ln===0)if((Le&536870912)===0||Pe){var e=sr;sr<<=1,(sr&3932160)===0&&(sr=262144),ln=e}else ln=536870912;return e=sn.current,e!==null&&(e.flags|=32),ln}function Zt(e,n,a){(e===Ze&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Ti(e,0),Zr(e,Le,ln,!1)),Ln(e,a),((Ge&2)===0||e!==Ze)&&(e===Ze&&((Ge&2)===0&&(zs|=a),ht===4&&Zr(e,Le,ln,!1)),Qn(e))}function Pp(e,n,a){if((Ge&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||_s(e,n),u=o?y_(e,n):oh(e,n,!0),h=o;do{if(u===0){Oi&&!o&&Zr(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!m_(a)){u=oh(e,n,!1),h=!1;continue}if(u===2){if(h=n,e.errorRecoveryDisabledLanes&h)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var E=e;u=Ba;var R=E.current.memoizedState.isDehydrated;if(R&&(Ti(E,_).flags|=256),_=oh(E,_,!1),_!==2){if(eh&&!R){E.errorRecoveryDisabledLanes|=h,zs|=h,u=4;break e}h=Qt,Qt=u,h!==null&&(Qt===null?Qt=h:Qt.push.apply(Qt,h))}u=_}if(h=!1,u!==2)continue}}if(u===1){Ti(e,0),Zr(e,n,0,!0);break}e:{switch(o=e,h=u,h){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Zr(o,n,ln,!Kr);break e;case 2:Qt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(u=El+300-rt(),10<u)){if(Zr(o,n,ln,!Kr),xs(o,0,!0)!==0)break e;wr=n,o.timeoutHandle=py(Up.bind(null,o,a,Qt,Al,nh,n,ln,zs,Ai,Kr,h,"Throttled",-0,0),u);break e}Up(o,a,Qt,Al,nh,n,ln,zs,Ai,Kr,h,null,-0,0)}}break}while(!0);Qn(e)}function Up(e,n,a,o,u,h,_,E,R,H,Q,ne,F,K){if(e.timeoutHandle=-1,ne=n.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:or},Cp(n,h,ne);var ye=(h&62914560)===h?El-rt():(h&4194048)===h?qp-rt():0;if(ye=Z_(ne,ye),ye!==null){wr=h,e.cancelPendingCommit=ye(Yp.bind(null,e,n,h,a,o,u,_,E,R,Q,ne,null,F,K)),Zr(e,h,_,!H);return}}Yp(e,n,h,a,o,u,_,E,R)}function m_(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],h=u.getSnapshot;u=u.value;try{if(!nn(h(),u))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Zr(e,n,a,o){n&=~th,n&=~zs,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var h=31-Bt(u),_=1<<h;o[h]=-1,u&=~_}a!==0&&qr(e,a,n)}function jl(){return(Ge&6)===0?(Ua(0),!1):!0}function ah(){if(De!==null){if(Fe===0)var e=De.return;else e=De,fr=Cs=null,wf(e),bi=null,_a=0,e=De;for(;e!==null;)yp(e.alternate,e),e=e.return;De=null}}function Ti(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,D_(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),wr=0,ah(),Ze=e,De=a=cr(e.current,null),Le=n,Fe=0,on=null,Kr=!1,Oi=_s(e,n),eh=!1,Ai=ln=th=zs=Xr=ht=0,Qt=Ba=null,nh=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Bt(o),h=1<<u;n|=e[u],o&=~h}return _r=n,Ko(),a}function zp(e,n){Ce=null,Y.H=ka,n===gi||n===nl?(n=n0(),Fe=3):n===uf?(n=n0(),Fe=4):Fe=n===Pf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,on=n,De===null&&(ht=1,yl(e,On(n,e.current)))}function Ip(){var e=sn.current;return e===null?!0:(Le&4194048)===Le?kn===null:(Le&62914560)===Le||(Le&536870912)!==0?e===kn:!1}function $p(){var e=Y.H;return Y.H=ka,e===null?ka:e}function Hp(){var e=Y.A;return Y.A=h_,e}function Tl(){ht=4,Kr||(Le&4194048)!==Le&&sn.current!==null||(Oi=!0),(Xr&134217727)===0&&(zs&134217727)===0||Ze===null||Zr(Ze,Le,ln,!1)}function oh(e,n,a){var o=Ge;Ge|=2;var u=$p(),h=Hp();(Ze!==e||Le!==n)&&(Al=null,Ti(e,n)),n=!1;var _=ht;e:do try{if(Fe!==0&&De!==null){var E=De,R=on;switch(Fe){case 8:ah(),_=6;break e;case 3:case 2:case 9:case 6:sn.current===null&&(n=!0);var H=Fe;if(Fe=0,on=null,ki(e,E,R,H),a&&Oi){_=0;break e}break;default:H=Fe,Fe=0,on=null,ki(e,E,R,H)}}p_(),_=ht;break}catch(Q){zp(e,Q)}while(!0);return n&&e.shellSuspendCounter++,fr=Cs=null,Ge=o,Y.H=u,Y.A=h,De===null&&(Ze=null,Le=0,Ko()),_}function p_(){for(;De!==null;)Gp(De)}function y_(e,n){var a=Ge;Ge|=2;var o=$p(),u=Hp();Ze!==e||Le!==n?(Al=null,Ol=rt()+500,Ti(e,n)):Oi=_s(e,n);e:do try{if(Fe!==0&&De!==null){n=De;var h=on;t:switch(Fe){case 1:Fe=0,on=null,ki(e,n,h,1);break;case 2:case 9:if(e0(h)){Fe=0,on=null,Fp(n);break}n=function(){Fe!==2&&Fe!==9||Ze!==e||(Fe=7),Qn(e)},h.then(n,n);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:e0(h)?(Fe=0,on=null,Fp(n)):(Fe=0,on=null,ki(e,n,h,7));break;case 5:var _=null;switch(De.tag){case 26:_=De.memoizedState;case 5:case 27:var E=De;if(_?Ny(_):E.stateNode.complete){Fe=0,on=null;var R=E.sibling;if(R!==null)De=R;else{var H=E.return;H!==null?(De=H,kl(H)):De=null}break t}}Fe=0,on=null,ki(e,n,h,5);break;case 6:Fe=0,on=null,ki(e,n,h,6);break;case 8:ah(),ht=6;break e;default:throw Error(i(462))}}g_();break}catch(Q){zp(e,Q)}while(!0);return fr=Cs=null,Y.H=o,Y.A=u,Ge=a,De!==null?0:(Ze=null,Le=0,Ko(),ht)}function g_(){for(;De!==null&&!Co();)Gp(De)}function Gp(e){var n=mp(e.alternate,e,_r);e.memoizedProps=e.pendingProps,n===null?kl(e):De=n}function Fp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=lp(a,n,n.pendingProps,n.type,void 0,Le);break;case 11:n=lp(a,n,n.pendingProps,n.type.render,n.ref,Le);break;case 5:wf(n);default:yp(a,n),n=De=Hm(n,_r),n=mp(a,n,_r)}e.memoizedProps=e.pendingProps,n===null?kl(e):De=n}function ki(e,n,a,o){fr=Cs=null,wf(n),bi=null,_a=0;var u=n.return;try{if(i_(e,u,n,a,Le)){ht=1,yl(e,On(a,e.current)),De=null;return}}catch(h){if(u!==null)throw De=u,h;ht=1,yl(e,On(a,e.current)),De=null;return}n.flags&32768?(Pe||o===1?e=!0:Oi||(Le&536870912)!==0?e=!1:(Kr=e=!0,(o===2||o===9||o===3||o===6)&&(o=sn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Vp(n,e)):kl(n)}function kl(e){var n=e;do{if((n.flags&32768)!==0){Vp(n,Kr);return}e=n.return;var a=l_(n.alternate,n,_r);if(a!==null){De=a;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);ht===0&&(ht=5)}function Vp(e,n){do{var a=c_(e.alternate,e);if(a!==null){a.flags&=32767,De=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);ht=6,De=null}function Yp(e,n,a,o,u,h,_,E,R){e.cancelPendingCommit=null;do Nl();while(Ot!==0);if((Ge&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(h=n.lanes|n.childLanes,h|=Ku,Dr(e,a,h,_,E,R),e===Ze&&(De=Ze=null,Le=0),ji=n,Qr=e,wr=a,rh=h,sh=u,Lp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,__(Zs,function(){return Zp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,u=ae.p,ae.p=2,_=Ge,Ge|=4;try{u_(e,n,a)}finally{Ge=_,ae.p=u,Y.T=o}}Ot=1,Kp(),Xp(),Jp()}}function Kp(){if(Ot===1){Ot=0;var e=Qr,n=ji,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Ge;Ge|=4;try{Tp(n,e);var h=vh,_=Dm(e.containerInfo),E=h.focusedElem,R=h.selectionRange;if(_!==E&&E&&E.ownerDocument&&Rm(E.ownerDocument.documentElement,E)){if(R!==null&&Hu(E)){var H=R.start,Q=R.end;if(Q===void 0&&(Q=H),"selectionStart"in E)E.selectionStart=H,E.selectionEnd=Math.min(Q,E.value.length);else{var ne=E.ownerDocument||document,F=ne&&ne.defaultView||window;if(F.getSelection){var K=F.getSelection(),ye=E.textContent.length,Ee=Math.min(R.start,ye),Je=R.end===void 0?Ee:Math.min(R.end,ye);!K.extend&&Ee>Je&&(_=Je,Je=Ee,Ee=_);var z=Mm(E,Ee),q=Mm(E,Je);if(z&&q&&(K.rangeCount!==1||K.anchorNode!==z.node||K.anchorOffset!==z.offset||K.focusNode!==q.node||K.focusOffset!==q.offset)){var $=ne.createRange();$.setStart(z.node,z.offset),K.removeAllRanges(),Ee>Je?(K.addRange($),K.extend(q.node,q.offset)):($.setEnd(q.node,q.offset),K.addRange($))}}}}for(ne=[],K=E;K=K.parentNode;)K.nodeType===1&&ne.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ne.length;E++){var Z=ne[E];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}$l=!!bh,vh=bh=null}finally{Ge=u,ae.p=o,Y.T=a}}e.current=n,Ot=2}}function Xp(){if(Ot===2){Ot=0;var e=Qr,n=ji,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Ge;Ge|=4;try{Sp(e,n.alternate,n)}finally{Ge=u,ae.p=o,Y.T=a}}Ot=3}}function Jp(){if(Ot===4||Ot===3){Ot=0,Qs();var e=Qr,n=ji,a=wr,o=Lp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ot=5:(Ot=0,ji=Qr=null,Qp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Jr=null),Ss(a),n=n.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(vs,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Y.T,u=ae.p,ae.p=2,Y.T=null;try{for(var h=e.onRecoverableError,_=0;_<o.length;_++){var E=o[_];h(E.value,{componentStack:E.stack})}}finally{Y.T=n,ae.p=u}}(wr&3)!==0&&Nl(),Qn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===ih?Pa++:(Pa=0,ih=e):Pa=0,Ua(0)}}function Qp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,va(n)))}function Nl(){return Kp(),Xp(),Jp(),Zp()}function Zp(){if(Ot!==5)return!1;var e=Qr,n=rh;rh=0;var a=Ss(wr),o=Y.T,u=ae.p;try{ae.p=32>a?32:a,Y.T=null,a=sh,sh=null;var h=Qr,_=wr;if(Ot=0,ji=Qr=null,wr=0,(Ge&6)!==0)throw Error(i(331));var E=Ge;if(Ge|=4,Rp(h.current),Np(h,h.current,_,a),Ge=E,Ua(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(vs,h)}catch{}return!0}finally{ae.p=u,Y.T=o,Qp(e,n)}}function Wp(e,n,a){n=On(a,n),n=Bf(e.stateNode,n,2),e=Gr(e,n,2),e!==null&&(Ln(e,2),Qn(e))}function Ve(e,n,a){if(e.tag===3)Wp(e,e,a);else for(;n!==null;){if(n.tag===3){Wp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Jr===null||!Jr.has(o))){e=On(a,e),a=ep(2),o=Gr(n,a,2),o!==null&&(tp(a,o,n,e),Ln(o,2),Qn(o));break}}n=n.return}}function lh(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new d_;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(eh=!0,u.add(a),e=b_.bind(null,e,n,a),n.then(e,e))}function b_(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ze===e&&(Le&a)===a&&(ht===4||ht===3&&(Le&62914560)===Le&&300>rt()-El?(Ge&2)===0&&Ti(e,0):th|=a,Ai===Le&&(Ai=0)),Qn(e)}function ey(e,n){n===0&&(n=ei()),e=Ts(e,n),e!==null&&(Ln(e,n),Qn(e))}function v_(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),ey(e,a)}function x_(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),ey(e,a)}function __(e,n){return na(e,n)}var Cl=null,Ni=null,ch=!1,Ml=!1,uh=!1,Wr=0;function Qn(e){e!==Ni&&e.next===null&&(Ni===null?Cl=Ni=e:Ni=Ni.next=e),Ml=!0,ch||(ch=!0,S_())}function Ua(e,n){if(!uh&&Ml){uh=!0;do for(var a=!1,o=Cl;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var _=o.suspendedLanes,E=o.pingedLanes;h=(1<<31-Bt(42|e)+1)-1,h&=u&~(_&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,sy(o,h))}else h=Le,h=xs(o,o===Ze?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||_s(o,h)||(a=!0,sy(o,h));o=o.next}while(a);uh=!1}}function w_(){ty()}function ty(){Ml=ch=!1;var e=0;Wr!==0&&R_()&&(e=Wr);for(var n=rt(),a=null,o=Cl;o!==null;){var u=o.next,h=ny(o,n);h===0?(o.next=null,a===null?Cl=u:a.next=u,u===null&&(Ni=a)):(a=o,(e!==0||(h&3)!==0)&&(Ml=!0)),o=u}Ot!==0&&Ot!==5||Ua(e),Wr!==0&&(Wr=0)}function ny(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var _=31-Bt(h),E=1<<_,R=u[_];R===-1?((E&a)===0||(E&o)!==0)&&(u[_]=ia(E,n)):R<=n&&(e.expiredLanes|=E),h&=~E}if(n=Ze,a=Le,a=xs(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&rr(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||_s(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&rr(o),Ss(a)){case 2:case 8:a=Ro;break;case 32:a=Zs;break;case 268435456:a=Do;break;default:a=Zs}return o=ry.bind(null,e),a=na(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&rr(o),e.callbackPriority=2,e.callbackNode=null,2}function ry(e,n){if(Ot!==0&&Ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Nl()&&e.callbackNode!==a)return null;var o=Le;return o=xs(e,e===Ze?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Pp(e,o,n),ny(e,rt()),e.callbackNode!=null&&e.callbackNode===a?ry.bind(null,e):null)}function sy(e,n){if(Nl())return null;Pp(e,n,!0)}function S_(){q_(function(){(Ge&6)!==0?na(Mo,w_):ty()})}function fh(){if(Wr===0){var e=pi;e===0&&(e=Cr,Cr<<=1,(Cr&261888)===0&&(Cr=256)),Wr=e}return Wr}function iy(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:zo(""+e)}function ay(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function E_(e,n,a,o,u){if(n==="submit"&&a&&a.stateNode===u){var h=iy((u[ut]||null).action),_=o.submitter;_&&(n=(n=_[ut]||null)?iy(n.formAction):_.getAttribute("formAction"),n!==null&&(h=n,_=null));var E=new Go("action","action",null,o,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Wr!==0){var R=_?ay(u,_):new FormData(u);Cf(a,{pending:!0,data:R,method:u.method,action:h},null,R)}}else typeof h=="function"&&(E.preventDefault(),R=_?ay(u,_):new FormData(u),Cf(a,{pending:!0,data:R,method:u.method,action:h},h,R))},currentTarget:u}]})}}for(var hh=0;hh<Yu.length;hh++){var dh=Yu[hh],O_=dh.toLowerCase(),A_=dh[0].toUpperCase()+dh.slice(1);Pn(O_,"on"+A_)}Pn(Bm,"onAnimationEnd"),Pn(Pm,"onAnimationIteration"),Pn(Um,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn($x,"onTransitionRun"),Pn(Hx,"onTransitionStart"),Pn(Gx,"onTransitionCancel"),Pn(zm,"onTransitionEnd"),V("onMouseEnter",["mouseout","mouseover"]),V("onMouseLeave",["mouseout","mouseover"]),V("onPointerEnter",["pointerout","pointerover"]),V("onPointerLeave",["pointerout","pointerover"]),ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var za="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),j_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(za));function oy(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],u=o.event;o=o.listeners;e:{var h=void 0;if(n)for(var _=o.length-1;0<=_;_--){var E=o[_],R=E.instance,H=E.currentTarget;if(E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(Q){Yo(Q)}u.currentTarget=null,h=R}else for(_=0;_<o.length;_++){if(E=o[_],R=E.instance,H=E.currentTarget,E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(Q){Yo(Q)}u.currentTarget=null,h=R}}}}function qe(e,n){var a=n[Es];a===void 0&&(a=n[Es]=new Set);var o=e+"__bubble";a.has(o)||(ly(n,e,2,!1),a.add(o))}function mh(e,n,a){var o=0;n&&(o|=4),ly(a,e,o,n)}var Rl="_reactListening"+Math.random().toString(36).slice(2);function ph(e){if(!e[Rl]){e[Rl]=!0,I.forEach(function(a){a!=="selectionchange"&&(j_.has(a)||mh(a,!1,e),mh(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Rl]||(n[Rl]=!0,mh("selectionchange",!1,n))}}function ly(e,n,a,o){switch(By(n)){case 2:var u=tw;break;case 8:u=nw;break;default:u=Nh}a=u.bind(null,n,a,e),u=void 0,!Du||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,a,{capture:!0,passive:u}):e.addEventListener(n,a,!0):u!==void 0?e.addEventListener(n,a,{passive:u}):e.addEventListener(n,a,!1)}function yh(e,n,a,o,u){var h=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var _=o.tag;if(_===3||_===4){var E=o.stateNode.containerInfo;if(E===u)break;if(_===4)for(_=o.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===u)return;_=_.return}for(;E!==null;){if(_=O(E),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){o=h=_;continue e}E=E.parentNode}}o=o.return}dm(function(){var H=h,Q=Mu(a),ne=[];e:{var F=Im.get(e);if(F!==void 0){var K=Go,ye=e;switch(e){case"keypress":if($o(a)===0)break e;case"keydown":case"keyup":K=xx;break;case"focusin":ye="focus",K=Pu;break;case"focusout":ye="blur",K=Pu;break;case"beforeblur":case"afterblur":K=Pu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=ym;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=lx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Sx;break;case Bm:case Pm:case Um:K=fx;break;case zm:K=Ox;break;case"scroll":case"scrollend":K=ax;break;case"wheel":K=jx;break;case"copy":case"cut":case"paste":K=dx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=bm;break;case"toggle":case"beforetoggle":K=kx}var Ee=(n&4)!==0,Je=!Ee&&(e==="scroll"||e==="scrollend"),z=Ee?F!==null?F+"Capture":null:F;Ee=[];for(var q=H,$;q!==null;){var Z=q;if($=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||$===null||z===null||(Z=la(q,z),Z!=null&&Ee.push(Ia(q,Z,$))),Je)break;q=q.return}0<Ee.length&&(F=new K(F,ye,null,a,Q),ne.push({event:F,listeners:Ee}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==Cu&&(ye=a.relatedTarget||a.fromElement)&&(O(ye)||ye[tn]))break e;if((K||F)&&(F=Q.window===Q?Q:(F=Q.ownerDocument)?F.defaultView||F.parentWindow:window,K?(ye=a.relatedTarget||a.toElement,K=H,ye=ye?O(ye):null,ye!==null&&(Je=c(ye),Ee=ye.tag,ye!==Je||Ee!==5&&Ee!==27&&Ee!==6)&&(ye=null)):(K=null,ye=H),K!==ye)){if(Ee=ym,Z="onMouseLeave",z="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=bm,Z="onPointerLeave",z="onPointerEnter",q="pointer"),Je=K==null?F:T(K),$=ye==null?F:T(ye),F=new Ee(Z,q+"leave",K,a,Q),F.target=Je,F.relatedTarget=$,Z=null,O(Q)===H&&(Ee=new Ee(z,q+"enter",ye,a,Q),Ee.target=$,Ee.relatedTarget=Je,Z=Ee),Je=Z,K&&ye)t:{for(Ee=T_,z=K,q=ye,$=0,Z=z;Z;Z=Ee(Z))$++;Z=0;for(var ve=q;ve;ve=Ee(ve))Z++;for(;0<$-Z;)z=Ee(z),$--;for(;0<Z-$;)q=Ee(q),Z--;for(;$--;){if(z===q||q!==null&&z===q.alternate){Ee=z;break t}z=Ee(z),q=Ee(q)}Ee=null}else Ee=null;K!==null&&cy(ne,F,K,Ee,!1),ye!==null&&Je!==null&&cy(ne,Je,ye,Ee,!0)}}e:{if(F=H?T(H):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var $e=Am;else if(Em(F))if(jm)$e=Ux;else{$e=Bx;var ge=Lx}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?H&&Nu(H.elementType)&&($e=Am):$e=Px;if($e&&($e=$e(e,H))){Om(ne,$e,a,Q);break e}ge&&ge(e,F,H),e==="focusout"&&H&&F.type==="number"&&H.memoizedProps.value!=null&&ku(F,"number",F.value)}switch(ge=H?T(H):window,e){case"focusin":(Em(ge)||ge.contentEditable==="true")&&(oi=ge,Gu=H,ya=null);break;case"focusout":ya=Gu=oi=null;break;case"mousedown":Fu=!0;break;case"contextmenu":case"mouseup":case"dragend":Fu=!1,qm(ne,a,Q);break;case"selectionchange":if(Ix)break;case"keydown":case"keyup":qm(ne,a,Q)}var Me;if(zu)e:{switch(e){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else ai?wm(e,a)&&(Be="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Be="onCompositionStart");Be&&(vm&&a.locale!=="ko"&&(ai||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&ai&&(Me=mm()):(Br=Q,qu="value"in Br?Br.value:Br.textContent,ai=!0)),ge=Dl(H,Be),0<ge.length&&(Be=new gm(Be,e,null,a,Q),ne.push({event:Be,listeners:ge}),Me?Be.data=Me:(Me=Sm(a),Me!==null&&(Be.data=Me)))),(Me=Cx?Mx(e,a):Rx(e,a))&&(Be=Dl(H,"onBeforeInput"),0<Be.length&&(ge=new gm("onBeforeInput","beforeinput",null,a,Q),ne.push({event:ge,listeners:Be}),ge.data=Me)),E_(ne,e,H,a,Q)}oy(ne,n)})}function Ia(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Dl(e,n){for(var a=n+"Capture",o=[];e!==null;){var u=e,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=la(e,a),u!=null&&o.unshift(Ia(e,u,h)),u=la(e,n),u!=null&&o.push(Ia(e,u,h))),e.tag===3)return o;e=e.return}return[]}function T_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function cy(e,n,a,o,u){for(var h=n._reactName,_=[];a!==null&&a!==o;){var E=a,R=E.alternate,H=E.stateNode;if(E=E.tag,R!==null&&R===o)break;E!==5&&E!==26&&E!==27||H===null||(R=H,u?(H=la(a,h),H!=null&&_.unshift(Ia(a,H,R))):u||(H=la(a,h),H!=null&&_.push(Ia(a,H,R)))),a=a.return}_.length!==0&&e.push({event:n,listeners:_})}var k_=/\r\n?/g,N_=/\u0000|\uFFFD/g;function uy(e){return(typeof e=="string"?e:""+e).replace(k_,`
|
|
26
|
-
`).replace(N_,"")}function fy(e,n){return n=uy(n),uy(e)===n}function Xe(e,n,a,o,u,h){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||ri(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&ri(e,""+o);break;case"className":Bn(e,"class",o);break;case"tabIndex":Bn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Bn(e,a,o);break;case"style":fm(e,o,h);break;case"data":if(n!=="object"){Bn(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=zo(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&Xe(e,n,"name",u.name,u,null),Xe(e,n,"formEncType",u.formEncType,u,null),Xe(e,n,"formMethod",u.formMethod,u,null),Xe(e,n,"formTarget",u.formTarget,u,null)):(Xe(e,n,"encType",u.encType,u,null),Xe(e,n,"method",u.method,u,null),Xe(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=zo(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=or);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=zo(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Pt(e,"popover",o);break;case"xlinkActuate":ar(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":ar(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":ar(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":ar(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":ar(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":ar(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":ar(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":ar(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":ar(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Pt(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=sx.get(a)||a,Pt(e,a,o))}}function gh(e,n,a,o,u,h){switch(a){case"style":fm(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof o=="string"?ri(e,o):(typeof o=="number"||typeof o=="bigint")&&ri(e,""+o);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=or);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!te.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),n=a.slice(2,u?a.length-7:void 0),h=e[ut]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,u),typeof o=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,u);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Pt(e,a,o)}}}function Dt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var o=!1,u=!1,h;for(h in a)if(a.hasOwnProperty(h)){var _=a[h];if(_!=null)switch(h){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Xe(e,n,h,_,a,null)}}u&&Xe(e,n,"srcSet",a.srcSet,a,null),o&&Xe(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=h=_=u=null,R=null,H=null;for(o in a)if(a.hasOwnProperty(o)){var Q=a[o];if(Q!=null)switch(o){case"name":u=Q;break;case"type":_=Q;break;case"checked":R=Q;break;case"defaultChecked":H=Q;break;case"value":h=Q;break;case"defaultValue":E=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,n));break;default:Xe(e,n,o,Q,a,null)}}om(e,h,E,R,H,_,u,!1);return;case"select":qe("invalid",e),o=_=h=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":h=E;break;case"defaultValue":_=E;break;case"multiple":o=E;default:Xe(e,n,u,E,a,null)}n=h,a=_,e.multiple=!!o,n!=null?ni(e,!!o,n,!1):a!=null&&ni(e,!!o,a,!0);return;case"textarea":qe("invalid",e),h=u=o=null;for(_ in a)if(a.hasOwnProperty(_)&&(E=a[_],E!=null))switch(_){case"value":o=E;break;case"defaultValue":u=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:Xe(e,n,_,E,a,null)}cm(e,o,u,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(o=a[R],o!=null))switch(R){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Xe(e,n,R,o,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(o=0;o<za.length;o++)qe(za[o],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Xe(e,n,H,o,a,null)}return;default:if(Nu(n)){for(Q in a)a.hasOwnProperty(Q)&&(o=a[Q],o!==void 0&&gh(e,n,Q,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&Xe(e,n,E,o,a,null))}function C_(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,_=null,E=null,R=null,H=null,Q=null;for(K in a){var ne=a[K];if(a.hasOwnProperty(K)&&ne!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=ne;default:o.hasOwnProperty(K)||Xe(e,n,K,null,o,ne)}}for(var F in o){var K=o[F];if(ne=a[F],o.hasOwnProperty(F)&&(K!=null||ne!=null))switch(F){case"type":h=K;break;case"name":u=K;break;case"checked":H=K;break;case"defaultChecked":Q=K;break;case"value":_=K;break;case"defaultValue":E=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(i(137,n));break;default:K!==ne&&Xe(e,n,F,K,o,ne)}}Tu(e,_,E,R,H,Q,h,u);return;case"select":K=_=E=F=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":K=R;default:o.hasOwnProperty(h)||Xe(e,n,h,null,o,R)}for(u in o)if(h=o[u],R=a[u],o.hasOwnProperty(u)&&(h!=null||R!=null))switch(u){case"value":F=h;break;case"defaultValue":E=h;break;case"multiple":_=h;default:h!==R&&Xe(e,n,u,h,o,R)}n=E,a=_,o=K,F!=null?ni(e,!!a,F,!1):!!o!=!!a&&(n!=null?ni(e,!!a,n,!0):ni(e,!!a,a?[]:"",!1));return;case"textarea":K=F=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Xe(e,n,E,null,o,u)}for(_ in o)if(u=o[_],h=a[_],o.hasOwnProperty(_)&&(u!=null||h!=null))switch(_){case"value":F=u;break;case"defaultValue":K=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(i(91));break;default:u!==h&&Xe(e,n,_,u,o,h)}lm(e,F,K);return;case"option":for(var ye in a)if(F=a[ye],a.hasOwnProperty(ye)&&F!=null&&!o.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:Xe(e,n,ye,null,o,F)}for(R in o)if(F=o[R],K=a[R],o.hasOwnProperty(R)&&F!==K&&(F!=null||K!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:Xe(e,n,R,F,o,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in a)F=a[Ee],a.hasOwnProperty(Ee)&&F!=null&&!o.hasOwnProperty(Ee)&&Xe(e,n,Ee,null,o,F);for(H in o)if(F=o[H],K=a[H],o.hasOwnProperty(H)&&F!==K&&(F!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(i(137,n));break;default:Xe(e,n,H,F,o,K)}return;default:if(Nu(n)){for(var Je in a)F=a[Je],a.hasOwnProperty(Je)&&F!==void 0&&!o.hasOwnProperty(Je)&&gh(e,n,Je,void 0,o,F);for(Q in o)F=o[Q],K=a[Q],!o.hasOwnProperty(Q)||F===K||F===void 0&&K===void 0||gh(e,n,Q,F,o,K);return}}for(var z in a)F=a[z],a.hasOwnProperty(z)&&F!=null&&!o.hasOwnProperty(z)&&Xe(e,n,z,null,o,F);for(ne in o)F=o[ne],K=a[ne],!o.hasOwnProperty(ne)||F===K||F==null&&K==null||Xe(e,n,ne,F,o,K)}function hy(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function M_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],h=u.transferSize,_=u.initiatorType,E=u.duration;if(h&&E&&hy(_)){for(_=0,E=u.responseEnd,o+=1;o<a.length;o++){var R=a[o],H=R.startTime;if(H>E)break;var Q=R.transferSize,ne=R.initiatorType;Q&&hy(ne)&&(R=R.responseEnd,_+=Q*(R<E?1:(E-H)/(R-H)))}if(--o,n+=8*(h+_)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var bh=null,vh=null;function ql(e){return e.nodeType===9?e:e.ownerDocument}function dy(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function my(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function xh(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var _h=null;function R_(){var e=window.event;return e&&e.type==="popstate"?e===_h?!1:(_h=e,!0):(_h=null,!1)}var py=typeof setTimeout=="function"?setTimeout:void 0,D_=typeof clearTimeout=="function"?clearTimeout:void 0,yy=typeof Promise=="function"?Promise:void 0,q_=typeof queueMicrotask=="function"?queueMicrotask:typeof yy<"u"?function(e){return yy.resolve(null).then(e).catch(L_)}:py;function L_(e){setTimeout(function(){throw e})}function es(e){return e==="head"}function gy(e,n){var a=n,o=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(u),Di(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")$a(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,$a(a);for(var h=a.firstChild;h;){var _=h.nextSibling,E=h.nodeName;h[Et]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=_}}else a==="body"&&$a(e.ownerDocument.body);a=u}while(a);Di(n)}function by(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function wh(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":wh(a),ti(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function B_(e,n,a,o){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[Et])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Nn(e.nextSibling),e===null)break}return null}function P_(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Nn(e.nextSibling),e===null))return null;return e}function vy(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Nn(e.nextSibling),e===null))return null;return e}function Sh(e){return e.data==="$?"||e.data==="$~"}function Eh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function U_(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Nn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Oh=null;function xy(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Nn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function _y(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function wy(e,n,a){switch(n=ql(a),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function $a(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ti(e)}var Cn=new Map,Sy=new Set;function Ll(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Sr=ae.d;ae.d={f:z_,r:I_,D:$_,C:H_,L:G_,m:F_,X:Y_,S:V_,M:K_};function z_(){var e=Sr.f(),n=jl();return e||n}function I_(e){var n=k(e);n!==null&&n.tag===5&&n.type==="form"?z0(n):Sr.r(e)}var Ci=typeof document>"u"?null:document;function Ey(e,n,a){var o=Ci;if(o&&typeof n=="string"&&n){var u=Sn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),Sy.has(u)||(Sy.add(u),e={rel:e,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),Dt(n,"link",e),D(n),o.head.appendChild(n)))}}function $_(e){Sr.D(e),Ey("dns-prefetch",e,null)}function H_(e,n){Sr.C(e,n),Ey("preconnect",e,n)}function G_(e,n,a){Sr.L(e,n,a);var o=Ci;if(o&&e&&n){var u='link[rel="preload"][as="'+Sn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Sn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Sn(a.imageSizes)+'"]')):u+='[href="'+Sn(e)+'"]';var h=u;switch(n){case"style":h=Mi(e);break;case"script":h=Ri(e)}Cn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Cn.set(h,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(Ha(h))||n==="script"&&o.querySelector(Ga(h))||(n=o.createElement("link"),Dt(n,"link",e),D(n),o.head.appendChild(n)))}}function F_(e,n){Sr.m(e,n);var a=Ci;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+Sn(o)+'"][href="'+Sn(e)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ri(e)}if(!Cn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Cn.set(h,e),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ga(h)))return}o=a.createElement("link"),Dt(o,"link",e),D(o),a.head.appendChild(o)}}}function V_(e,n,a){Sr.S(e,n,a);var o=Ci;if(o&&e){var u=N(o).hoistableStyles,h=Mi(e);n=n||"default";var _=u.get(h);if(!_){var E={loading:0,preload:null};if(_=o.querySelector(Ha(h)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Cn.get(h))&&Ah(e,a);var R=_=o.createElement("link");D(R),Dt(R,"link",e),R._p=new Promise(function(H,Q){R.onload=H,R.onerror=Q}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Bl(_,n,o)}_={type:"stylesheet",instance:_,count:1,state:E},u.set(h,_)}}}function Y_(e,n){Sr.X(e,n);var a=Ci;if(a&&e){var o=N(a).hoistableScripts,u=Ri(e),h=o.get(u);h||(h=a.querySelector(Ga(u)),h||(e=b({src:e,async:!0},n),(n=Cn.get(u))&&jh(e,n),h=a.createElement("script"),D(h),Dt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function K_(e,n){Sr.M(e,n);var a=Ci;if(a&&e){var o=N(a).hoistableScripts,u=Ri(e),h=o.get(u);h||(h=a.querySelector(Ga(u)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Cn.get(u))&&jh(e,n),h=a.createElement("script"),D(h),Dt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function Oy(e,n,a,o){var u=(u=ct.current)?Ll(u):null;if(!u)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=Mi(a.href),a=N(u).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Mi(a.href);var h=N(u).hoistableStyles,_=h.get(e);if(_||(u=u.ownerDocument||u,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,_),(h=u.querySelector(Ha(e)))&&!h._p&&(_.instance=h,_.state.loading=5),Cn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Cn.set(e,a),h||X_(u,e,a,_.state))),n&&o===null)throw Error(i(528,""));return _}if(n&&o!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ri(a),a=N(u).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mi(e){return'href="'+Sn(e)+'"'}function Ha(e){return'link[rel="stylesheet"]['+e+"]"}function Ay(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function X_(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Dt(n,"link",a),D(n),e.head.appendChild(n))}function Ri(e){return'[src="'+Sn(e)+'"]'}function Ga(e){return"script[async]"+e}function jy(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Sn(a.href)+'"]');if(o)return n.instance=o,D(o),o;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),D(o),Dt(o,"style",u),Bl(o,a.precedence,e),n.instance=o;case"stylesheet":u=Mi(a.href);var h=e.querySelector(Ha(u));if(h)return n.state.loading|=4,n.instance=h,D(h),h;o=Ay(a),(u=Cn.get(u))&&Ah(o,u),h=(e.ownerDocument||e).createElement("link"),D(h);var _=h;return _._p=new Promise(function(E,R){_.onload=E,_.onerror=R}),Dt(h,"link",o),n.state.loading|=4,Bl(h,a.precedence,e),n.instance=h;case"script":return h=Ri(a.src),(u=e.querySelector(Ga(h)))?(n.instance=u,D(u),u):(o=a,(u=Cn.get(h))&&(o=b({},a),jh(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),D(u),Dt(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Bl(o,a.precedence,e));return n.instance}function Bl(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,_=0;_<o.length;_++){var E=o[_];if(E.dataset.precedence===n)h=E;else if(h!==u)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Ah(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function jh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Pl=null;function Ty(e,n,a){if(Pl===null){var o=new Map,u=Pl=new Map;u.set(a,o)}else u=Pl,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var h=a[u];if(!(h[Et]||h[Qe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var _=h.getAttribute(n)||"";_=e+_;var E=o.get(_);E?E.push(h):o.set(_,[h])}}return o}function ky(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function J_(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Ny(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Q_(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Mi(o.href),h=n.querySelector(Ha(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Ul.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,D(h);return}h=n.ownerDocument||n,o=Ay(o),(u=Cn.get(u))&&Ah(o,u),h=h.createElement("link"),D(h);var _=h;_._p=new Promise(function(E,R){_.onload=E,_.onerror=R}),Dt(h,"link",o),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Ul.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Th=0;function Z_(e,n){return e.stylesheets&&e.count===0&&Il(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Th===0&&(Th=62500*M_());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Th?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Ul(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Il(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zl=null;function Il(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zl=new Map,n.forEach(W_,e),zl=null,Ul.call(e))}function W_(e,n){if(!(n.state.loading&4)){var a=zl.get(e);if(a)var o=a.get(null);else{a=new Map,zl.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var _=u[h];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),o=_)}o&&a.set(null,o)}u=n.instance,_=u.getAttribute("data-precedence"),h=a.get(_)||o,h===o&&a.set(null,u),a.set(_,u),this.count++,o=Ul.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),h?h.parentNode.insertBefore(u,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var Fa={$$typeof:re,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function ew(e,n,a,o,u,h,_,E,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Rr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rr(0),this.hiddenUpdates=Rr(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Cy(e,n,a,o,u,h,_,E,R,H,Q,ne){return e=new ew(e,n,a,_,R,H,Q,ne,E),n=1,h===!0&&(n|=24),h=rn(3,null,null,n),e.current=h,h.stateNode=e,n=of(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:o,isDehydrated:a,cache:n},ff(h),e}function My(e){return e?(e=ui,e):ui}function Ry(e,n,a,o,u,h){u=My(u),o.context===null?o.context=u:o.pendingContext=u,o=Hr(n),o.payload={element:a},h=h===void 0?null:h,h!==null&&(o.callback=h),a=Gr(e,o,n),a!==null&&(Zt(a,e,n),Sa(a,e,n))}function Dy(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function kh(e,n){Dy(e,n),(e=e.alternate)&&Dy(e,n)}function qy(e){if(e.tag===13||e.tag===31){var n=Ts(e,67108864);n!==null&&Zt(n,e,67108864),kh(e,67108864)}}function Ly(e){if(e.tag===13||e.tag===31){var n=cn();n=ir(n);var a=Ts(e,n);a!==null&&Zt(a,e,n),kh(e,n)}}var $l=!0;function tw(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=2,Nh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function nw(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=8,Nh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function Nh(e,n,a,o){if($l){var u=Ch(o);if(u===null)yh(e,n,o,Hl,a),Py(e,o);else if(sw(u,e,n,a,o))o.stopPropagation();else if(Py(e,o),n&4&&-1<rw.indexOf(e)){for(;u!==null;){var h=k(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var _=qn(h.pendingLanes);if(_!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;_;){var R=1<<31-Bt(_);E.entanglements[1]|=R,_&=~R}Qn(h),(Ge&6)===0&&(Ol=rt()+500,Ua(0))}}break;case 31:case 13:E=Ts(h,2),E!==null&&Zt(E,h,2),jl(),kh(h,2)}if(h=Ch(o),h===null&&yh(e,n,o,Hl,a),h===u)break;u=h}u!==null&&o.stopPropagation()}else yh(e,n,o,null,a)}}function Ch(e){return e=Mu(e),Mh(e)}var Hl=null;function Mh(e){if(Hl=null,e=O(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=m(n),e!==null)return e;e=null}else if(a===31){if(e=y(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Hl=e,null}function By(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Eu()){case Mo:return 2;case Ro:return 8;case Zs:case Ou:return 32;case Do:return 268435456;default:return 32}default:return 32}}var Rh=!1,ts=null,ns=null,rs=null,Va=new Map,Ya=new Map,ss=[],rw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Py(e,n){switch(e){case"focusin":case"focusout":ts=null;break;case"dragenter":case"dragleave":ns=null;break;case"mouseover":case"mouseout":rs=null;break;case"pointerover":case"pointerout":Va.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ya.delete(n.pointerId)}}function Ka(e,n,a,o,u,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:h,targetContainers:[u]},n!==null&&(n=k(n),n!==null&&qy(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function sw(e,n,a,o,u){switch(n){case"focusin":return ts=Ka(ts,e,n,a,o,u),!0;case"dragenter":return ns=Ka(ns,e,n,a,o,u),!0;case"mouseover":return rs=Ka(rs,e,n,a,o,u),!0;case"pointerover":var h=u.pointerId;return Va.set(h,Ka(Va.get(h)||null,e,n,a,o,u)),!0;case"gotpointercapture":return h=u.pointerId,Ya.set(h,Ka(Ya.get(h)||null,e,n,a,o,u)),!0}return!1}function Uy(e){var n=O(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=m(a),n!==null){e.blockedOn=n,Lo(e.priority,function(){Ly(a)});return}}else if(n===31){if(n=y(a),n!==null){e.blockedOn=n,Lo(e.priority,function(){Ly(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gl(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Ch(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Cu=o,a.target.dispatchEvent(o),Cu=null}else return n=k(a),n!==null&&qy(n),e.blockedOn=a,!1;n.shift()}return!0}function zy(e,n,a){Gl(e)&&a.delete(n)}function iw(){Rh=!1,ts!==null&&Gl(ts)&&(ts=null),ns!==null&&Gl(ns)&&(ns=null),rs!==null&&Gl(rs)&&(rs=null),Va.forEach(zy),Ya.forEach(zy)}function Fl(e,n){e.blockedOn===n&&(e.blockedOn=null,Rh||(Rh=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,iw)))}var Vl=null;function Iy(e){Vl!==e&&(Vl=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Vl===e&&(Vl=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Mh(o||a)===null)continue;break}var h=k(a);h!==null&&(e.splice(n,3),n-=3,Cf(h,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Di(e){function n(R){return Fl(R,e)}ts!==null&&Fl(ts,e),ns!==null&&Fl(ns,e),rs!==null&&Fl(rs,e),Va.forEach(n),Ya.forEach(n);for(var a=0;a<ss.length;a++){var o=ss[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ss.length&&(a=ss[0],a.blockedOn===null);)Uy(a),a.blockedOn===null&&ss.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],h=a[o+1],_=u[ut]||null;if(typeof h=="function")_||Iy(a);else if(_){var E=null;if(h&&h.hasAttribute("formAction")){if(u=h,_=h[ut]||null)E=_.formAction;else if(Mh(u)!==null)continue}else E=_.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),Iy(a)}}}function $y(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(_){return u=_})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function Dh(e){this._internalRoot=e}Yl.prototype.render=Dh.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=cn();Ry(a,o,e,n,null,null)},Yl.prototype.unmount=Dh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Ry(e.current,2,null,e,null,null),jl(),n[tn]=null}};function Yl(e){this._internalRoot=e}Yl.prototype.unstable_scheduleHydration=function(e){if(e){var n=aa();e={blockedOn:null,target:e,priority:n};for(var a=0;a<ss.length&&n!==0&&n<ss[a].priority;a++);ss.splice(a,0,e),a===0&&Uy(e)}};var Hy=t.version;if(Hy!=="19.2.4")throw Error(i(527,Hy,"19.2.4"));ae.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=f(n),e=e!==null?d(e):null,e=e===null?null:e.stateNode,e};var aw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{vs=Kl.inject(aw),pt=Kl}catch{}}return Xa.createRoot=function(e,n){if(!l(e))throw Error(i(299));var a=!1,o="",u=J0,h=Q0,_=Z0;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=Cy(e,1,!1,null,null,a,o,null,u,h,_,$y),e[tn]=n.current,ph(e),new Dh(n)},Xa.hydrateRoot=function(e,n,a){if(!l(e))throw Error(i(299));var o=!1,u="",h=J0,_=Q0,E=Z0,R=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Cy(e,1,!0,n,a??null,o,u,R,h,_,E,$y),n.context=My(null),a=n.current,o=cn(),o=ir(o),u=Hr(o),u.callback=null,Gr(a,u,o),a=o,n.current.lanes=a,Ln(n,a),Qn(n),e[tn]=n.current,ph(e),new Yl(n)},Xa.version="19.2.4",Xa}var Qy;function Vw(){if(Qy)return qh.exports;Qy=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(t){console.error(t)}}return r(),qh.exports=Fw(),qh.exports}var Yw=Vw();const Kw="modulepreload",Xw=function(r,t){return new URL(r,t).href},Zy={},we=function(t,s,i){let l=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const y=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),f=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));l=m(s.map(d=>{if(d=Xw(d,i),d in Zy)return;Zy[d]=!0;const b=d.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(!!i)for(let S=y.length-1;S>=0;S--){const M=y[S];if(M.href===d&&(!b||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${v}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":Kw,b||(w.as="script"),w.crossOrigin="",w.href=d,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((S,M)=>{w.addEventListener("load",S),w.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${d}`)))})}))}function c(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return l.then(m=>{for(const y of m||[])y.status==="rejected"&&c(y.reason);return t().catch(c)})};function du(r){try{const t=r.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function _b(r){const t=du(r);return!t||typeof t.exp!="number"?null:t.exp}function Nd(r,t=0){const s=_b(r);return s===null?!0:Date.now()/1e3>=s-t}const kt=window.__LT_BASE__??"",nd=`${kt}/api`;class Wy extends Error{constructor(t,s,i){super(t),this.status=s,this.body=i,this.name="ApiError"}}let cs=null;function Xl(r){cs=r}function wb(){return cs}const Jw="X-LT-Acting-Token";let Gc=null,Fc=null;function eg(r){Gc=r}function tg(r){Fc=r}function Qw(r){const t=r==null?void 0:r.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function ng(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:t,password:s}=JSON.parse(r),i=await fetch(`${nd}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:s})});if(!i.ok)return null;const l=await i.json();return l.token&&l.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:l.user.display_name,username:l.user.external_id})),l.token??null}catch{return null}}let as=null;async function _e(r,t={}){const s={"Content-Type":"application/json",...t.headers};if(cs){if(Nd(cs)){as||(as=ng().finally(()=>{as=null}));const c=await as;if(c)cs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${cs}`}const i=(Gc==null?void 0:Gc())??null;i&&(s[Jw]=i);let l=await fetch(`${nd}${r}`,{...t,headers:s});if(l.status===401&&i){const c=await l.clone().json().catch(()=>null);if(Qw(c))throw Fc==null||Fc(),new Wy(c.error,401,c)}if(l.status===401&&cs){as||(as=ng().finally(()=>{as=null}));const c=await as;if(c&&(cs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,l=await fetch(`${nd}${r}`,{...t,headers:s})),l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const c=await l.json().catch(()=>({error:l.statusText}));throw new Wy(c.message||c.error||l.statusText,l.status,c)}return l.json()}const Zw="lt_ai_override";function Ww(){return _e("/settings")}function eS(){try{if(localStorage.getItem(Zw)==="off")return!1}catch{}return null}function nr(){var s;const r=lt({queryKey:["settings"],queryFn:Ww,staleTime:1/0}),t=eS();return r.data&&t===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function tS(r){var f,d,b;const{data:t}=nr(),s=((f=t==null?void 0:t.auth)==null?void 0:f.ssoKeepaliveSeconds)??0,i=((d=t==null?void 0:t.auth)==null?void 0:d.ssoKeepaliveIdleTimeoutSeconds)??0,l=j.useRef(Date.now()),c=j.useRef(Date.now()),m=j.useRef(!1),g=!!r&&((b=du(r))==null?void 0:b.sso)===!0&&s>0;j.useEffect(()=>{if(!g)return;const v=()=>{l.current=Date.now()};window.addEventListener("pointerdown",v,{passive:!0}),window.addEventListener("keydown",v,{passive:!0}),window.addEventListener("wheel",v,{passive:!0});const x=async()=>{if(!m.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-l.current>i*1e3)){m.current=!0;try{const M=await fetch(`${kt}/api/auth/sso`,{method:"POST"});if(M.status===401||M.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!M.ok)return;const L=await M.json().catch(()=>null);L!=null&&L.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:L.token}})))}catch{}finally{m.current=!1}}},w=setInterval(x,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&x()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v),window.removeEventListener("wheel",v)}},[g,s,i])}const Sb=j.createContext(null),nS=300;function Ph(r,t){if(Nd(r))return null;const s=du(r);if(!s)return null;const i=t??(()=>{try{const l=sessionStorage.getItem("lt_user_info");return l?JSON.parse(l):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function rS({children:r}){const[t,s]=j.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Nd(b)?(sessionStorage.removeItem("lt_token"),null):(Xl(b),Ph(b)):null}),i=j.useRef(void 0),l=j.useCallback(b=>{clearTimeout(i.current);const v=_b(b);if(!v)return;const x=(v-nS)*1e3-Date.now();x<=0||(i.current=setTimeout(async()=>{try{const w=du(b);if(w!=null&&w.sso){const ce=await fetch(`${kt}/api/auth/sso`,{method:"POST"});if(!ce.ok)return;const C=await ce.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:M,password:L}=JSON.parse(S),U=await fetch(`${kt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:M,password:L})});if(!U.ok)return;const re=await U.json();re.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:re.token}}))}catch{}},x))},[]),c=j.useCallback((b,v,x)=>{const w={displayName:(x==null?void 0:x.displayName)??null,username:(x==null?void 0:x.username)??(v==null?void 0:v.username)??null},S=Ph(b,w);S&&(Xl(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),v&&sessionStorage.setItem("lt_credentials",JSON.stringify(v)),s(S),l(b))},[l]),m=j.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");Xl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);j.useEffect(()=>{const b=()=>m(),v=x=>{var M;const w=(M=x.detail)==null?void 0:M.token;if(!w)return;const S=Ph(w);S&&(Xl(w),sessionStorage.setItem("lt_token",w),s(S),l(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",v),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",v)}},[m,l]),j.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&l(b),()=>clearTimeout(i.current)},[]);const y=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.role===b))??!1,[t]),f=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.type===b))??!1,[t]),d=(t==null?void 0:t.roles.map(b=>b.role))??[];return p.jsxs(Sb.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:y,login:c,logout:m,hasRole:g,hasRoleType:f,userRoleNames:d},children:[p.jsx(sS,{authenticated:t!==null}),r]})}function sS({authenticated:r}){return tS(r?sessionStorage.getItem("lt_token"):null),null}function Vt(){const r=j.useContext(Sb);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const gn=new Uint8Array(0),Ys=new TextEncoder,mn=new TextDecoder;function iS(...r){let t=0;for(let l=0;l<r.length;l++)t+=r[l].length;const s=new Uint8Array(t);let i=0;for(let l=0;l<r.length;l++)s.set(r[l],i),i+=r[l].length;return s}function uo(...r){const t=[];for(let s=0;s<r.length;s++)t.push(Ys.encode(r[s]));return t.length===0?gn:t.length===1?t[0]:iS(...t)}function rg(r){return!r||r.length===0?"":mn.decode(r)}const sg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",ig=36,aS=0xcfd41b9100000,ag=33,oS=333,og=22;function lS(r){for(let t=0;t<r.length;t++)r[t]=Math.floor(Math.random()*255)}function cS(r){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(r):lS(r)}class uS{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(og),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*aS),this.inc=Math.floor(Math.random()*(oS-ag)+ag)}setPre(){const t=new Uint8Array(12);cS(t);for(let s=0;s<12;s++){const i=t[s]%36;this.buf[s]=sg.charCodeAt(i)}}fillSeq(){let t=this.seq;for(let s=og-1;s>=12;s--)this.buf[s]=sg.charCodeAt(t%ig),t=Math.floor(t/ig)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const ps=new uS;var Or;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Or||(Or={}));var Hi;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(Hi||(Hi={}));var le;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(le||(le={}));function fS(r){return typeof r.code=="string"}class Eb{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(le.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(le.BadJson,"Bad JSON"),this.messages.set(le.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return hS.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const hS=new Eb;class me extends Error{constructor(s,i,l){super(s);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=l}static errorForCode(s,i){const l=Eb.getMessage(s);return new me(l,s,i)}isAuthError(){return this.code===le.AuthenticationExpired||this.code===le.AuthorizationViolation||this.code===le.AccountExpired}isAuthTimeout(){return this.code===le.AuthenticationTimeout}isPermissionError(){return this.code===le.PermissionsViolation}isProtocolError(){return this.code===le.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var hn;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(hn||(hn={}));var Fn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Fn||(Fn={}));var fo;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(fo||(fo={}));const Wc="Nats-Service-Error",eu="Nats-Service-Error-Code";class tu extends Error{constructor(s,i){super(i);A(this,"code");this.code=s}static isServiceError(s){return tu.toServiceError(s)!==null}static toServiceError(s){var l,c;const i=((l=s==null?void 0:s.headers)==null?void 0:l.get(eu))||"";if(i!==""){const m=parseInt(i)||400,y=((c=s==null?void 0:s.headers)==null?void 0:c.get(Wc))||"";return new tu(m,y.length?y:i)}return null}}function Ar(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${ps.next()}`}const rd="127.0.0.1";var us;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(us||(us={}));function mu(r,...t){for(let s=0;s<t.length;s++){const i=t[s];Object.keys(i).forEach(function(l){r[l]=i[l]})}return r}function Jl(r){return mn.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Xi(r,t=!0){const s=t?me.errorForCode(le.Timeout):null;let i,l;const c=new Promise((m,y)=>{i={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{y(s===null?me.errorForCode(le.Timeout):s)},r)});return Object.assign(c,i)}function Zi(r=0){let t;const s=new Promise(i=>{const l=setTimeout(()=>{i()},r);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(s,t)}function at(){let r={};const t=new Promise((s,i)=>{r={resolve:s,reject:i}});return Object.assign(t,r)}function Ob(r){for(let t=r.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[r[t],r[s]]=[r[s],r[t]]}return r}function dS(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Cd(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const t=r.length-1;return{backoff(s){return dS(s>t?r[t]:r[s])}}}function it(r){return r*1e6}function Md(r){return Math.floor(r/1e6)}function lg(r){let i=!0;const l=new Array(r.length);for(let c=0;c<r.length;c++){let m=r.charCodeAt(c);if(m===58||m<33||m>126)throw new me(`'${r[c]}' is not a valid character for a header key`,le.BadHeader);i&&97<=m&&m<=122?m-=32:!i&&65<=m&&m<=90&&(m+=32),l[c]=m,i=m==45}return String.fromCharCode(...l)}function jr(r=0,t=""){if(r===0&&t!==""||r>0&&t==="")throw new Error("setting status requires both code and description");return new fs(r,t)}const Uh="NATS/1.0";class fs{constructor(t=0,s=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,i]of this.headers){const l=t.values(s);if(i.length!==l.length)return!1;const c=[...i].sort(),m=[...l].sort();for(let y=0;y<c.length;y++)if(c[y]!==m[y])return!1}return!0}return!1}static decode(t){const s=new fs,l=mn.decode(t).split(`\r
|
|
27
|
-
`),c=l[0];if(c!==Uh){let m=c.replace(Uh,"").trim();if(m.length>0){s._code=parseInt(m,10),isNaN(s._code)&&(s._code=0);const y=s._code.toString();m=m.replace(y,""),s._description=m.trim()}}return l.length>=1&&l.slice(1).map(m=>{if(m){const y=m.indexOf(":");if(y>-1){const g=m.slice(0,y),f=m.slice(y+1).trim();s.append(g,f)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Uh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let l=0;l<i.length;l++)t=`${t}\r
|
|
28
|
-
${s}: ${i[l]}`;return`${t}\r
|
|
29
|
-
\r
|
|
30
|
-
`}encode(){return Ys.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new me("invalid header value - \\r and \\n are not allowed.",le.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=hn.Exact){const i=this.keys();switch(s){case hn.Exact:return i.filter(l=>l===t);case hn.CanonicalMIME:return t=lg(t),i.filter(l=>l===t);default:{const l=t.toLowerCase();return i.filter(c=>l===c.toLowerCase())}}}get(t,s=hn.Exact){const i=this.findKeys(t,s);if(i.length){const l=this.headers.get(i[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,s=hn.Exact){const i=this.findKeys(t,s);if(i.length){const l=this.headers.get(i[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,s=hn.Exact){return this.findKeys(t,s).length>0}set(t,s,i=hn.Exact){this.delete(t,i),this.append(t,s,i)}append(t,s,i=hn.Exact){const l=lg(t);i===hn.CanonicalMIME&&(t=l);const c=this.findKeys(t,i);t=c.length>0?c[0]:t;const m=fs.validHeaderValue(s);let y=this.headers.get(t);y||(y=[],this.headers.set(t,y)),y.push(m)}values(t,s=hn.Exact){const i=[];return this.findKeys(t,s).forEach(c=>{const m=this.headers.get(c);m&&i.push(...m)}),i}delete(t,s=hn.Exact){this.findKeys(t,s).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new fs;for(const i in t)s.headers.set(i,t[i]);return s}}function sd(){return{encode(r){return Ys.encode(r)},decode(r){return mn.decode(r)}}}function Vn(r){return{encode(t){try{return t===void 0&&(t=null),Ys.encode(JSON.stringify(t))}catch(s){throw me.errorForCode(le.BadJson,s)}},decode(t){try{return JSON.parse(mn.decode(t),r)}catch(s){throw me.errorForCode(le.BadJson,s)}}}}function Ab(r){var t;return r&&r.data.length===0&&((t=r.headers)==null?void 0:t.code)===503?me.errorForCode(le.NoResponders):null}class Rd{constructor(t,s,i){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=t,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=mn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=mn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=fs.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=gn,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var l;const t=this._msg.subject.length,s=((l=this._msg.reply)==null?void 0:l.length)||0,i=this._msg.size===-1?0:this._msg.size;return t+s+i}json(t){return Vn(t).decode(this.data)}string(){return mn.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(i,l){return(i==="start"||i==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(Rd,"jc");function Gi(r){return pu("durable",r)}function It(r){return pu("stream",r)}function pu(r,t=""){if(t==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
|
-
`,"\r"].forEach(i=>{if(t.indexOf(i)!==-1){switch(i){case`
|
|
32
|
-
`:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${i}'`)}}),""}function oo(r,t=""){if(t==="")throw Error(`${r} name required`);const s=mS(t);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function mS(r=""){if(r==="")throw Error("name required");const t=/^[-\w]+$/g;if(r.match(t)===null){for(const i of r.split(""))if(i.match(t)===null)return`cannot contain '${i}'`}return""}function id(r){if(r.data.length>0)return!1;const t=r.headers;return t?t.code>=100&&t.code<200:!1}function ad(r){var t;return id(r)&&((t=r.headers)==null?void 0:t.description)==="Idle Heartbeat"}function pS(r,t,s){const i=jr(r,t),l={hdr:1,sid:0,size:0},c=new Rd(l,gn,{});return c._headers=i,c._subject=s,c}function Fi(r){if(r.data.length!==0)return null;const t=r.headers;return t?jb(t.code,t.description):null}var Rn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(Rn||(Rn={}));function yS(r){return r.code!==le.JetStream409?!1:[Rn.MaxBatchExceeded,Rn.MaxExpiresExceeded,Rn.MaxBytesExceeded,Rn.MaxMessageSizeExceeded,Rn.PushConsumer,Rn.IdleHeartbeatMissed,Rn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function jb(r,t=""){if(r<300)return null;switch(t=t.toLowerCase(),r){case 404:return new me(t,le.JetStream404NoMessages);case 408:return new me(t,le.JetStream408RequestTimeout);case 409:{const s=t.startsWith(Rn.IdleHeartbeatMissed)?le.JetStreamIdleHeartBeat:le.JetStream409;return new me(t,s)}case 503:return me.errorForCode(le.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=le.Unknown),new me(t,`${r}`)}}class Nt{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=at(),this.yields=[],this.iterClosed=at(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",le.ApiError);if(this.yielding)throw new me("already yielding",le.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const l=t[s];try{l()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const l=Date.now();yield t[s],this.time=Date.now()-l,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=at())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Dd{constructor(t,s,i={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=t,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,s=0,i=2){this.interval=t,this.maxOut=i,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var od;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(od||(od={}));var yo;(function(r){r.Old="old",r.New="new"})(yo||(yo={}));var ld;(function(r){r.File="file",r.Memory="memory"})(ld||(ld={}));var bt;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(bt||(bt={}));var Tt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(Tt||(Tt={}));var Ji;(function(r){r.Instant="instant",r.Original="original"})(Ji||(Ji={}));var ys;(function(r){r.None="none",r.S2="s2"})(ys||(ys={}));var nu;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(nu||(nu={}));function gS(r,t={}){return Object.assign({name:r,deliver_policy:bt.All,ack_policy:Tt.Explicit,ack_wait:it(30*1e3),replay_policy:Ji.Instant},t)}var cg;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(cg||(cg={}));var Gt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Gt||(Gt={}));var $n;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})($n||($n={}));var Ii;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(Ii||(Ii={}));var ug;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(ug||(ug={}));const dn="KV_";class bS{constructor(t){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=gS("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?Tt.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Gi(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=bt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=bt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=bt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=bt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=bt.Last,this}deliverNew(){return this.config.deliver_policy=bt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Tt.None,this}ackAll(){return this.config.ack_policy=Tt.All,this}ackExplicit(){return this.config.ack_policy=Tt.Explicit,this}ackWait(t){return this.config.ack_wait=it(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=Ji.Instant,this}replayOriginal(){return this.config.replay_policy=Ji.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=it(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=it(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=it(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function hs(r){return new bS(r)}function fg(r){return typeof r.getOpts=="function"}class vS{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const i=atob(t);return s?Uint8Array.from(i,l=>l.charCodeAt(0)):i}}class Vi{static encode(t){return Vi.toB64URLEncoding(vS.encode(t))}static decode(t,s=!1){return Vi.decode(Vi.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Qi{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let c=0;c<t.length;c++)s+=t[c].length;const i=new Uint8Array(s);let l=0;for(let c=0;c<t.length;c++)i.set(t[c],l),l+=t[c].length;return i}static fromAscii(t){return t||(t=""),Ys.encode(t)}static toAscii(t){return mn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)t.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(t===void 0||t>i)&&(t=i);const l=s.subarray(0,t);return i>t&&this.buffers.push(s.subarray(t)),this.byteLength=i-t,l}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function xS(r,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in r)){var l=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(r,i,l.get?l:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(r)}var _S=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Ja=_S.performance||{};Ja.now||Ja.mozNow||Ja.msNow||Ja.oNow||Ja.webkitNow;var hg={versions:{}},wS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function SS(r){if(r.__esModule)return r;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),t}var zh,yu={exports:{}},dg={},mg=SS(xS({__proto__:null,default:dg},[dg]));zh=yu,(function(){var r="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",l=!s.JS_SHA256_NO_NODE_JS&&hg.versions&&hg.versions.node;l?s=wS:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&zh.exports,m=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",y="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],f=[24,16,8,0],d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],v=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!m||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var x=function(C,P){return function(se){return new U(P,!0).update(se)[C]()}},w=function(C){var P=x("hex",C);l&&(P=S(P,C)),P.create=function(){return new U(C)},P.update=function(B){return P.create().update(B)};for(var se=0;se<b.length;++se){var X=b[se];P[X]=x(X,C)}return P},S=function(C,P){var se,X=mg,B=mg.Buffer,G=P?"sha224":"sha256";return se=B.from&&!s.JS_SHA256_NO_BUFFER_FROM?B.from:function(W){return new B(W)},function(W){if(typeof W=="string")return X.createHash(G).update(W,"utf8").digest("hex");if(W==null)throw new Error(r);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===B?X.createHash(G).update(se(W)).digest("hex"):C(W)}},M=function(C,P){return function(se,X){return new re(se,P,!0).update(X)[C]()}},L=function(C){var P=M("hex",C);P.create=function(B){return new re(B,C)},P.update=function(B,G){return P.create(B).update(G)};for(var se=0;se<b.length;++se){var X=b[se];P[X]=M(X,C)}return P};function U(C,P){P?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function re(C,P,se){var X,B=typeof C;if(B==="string"){var G,W=[],J=C.length,he=0;for(X=0;X<J;++X)(G=C.charCodeAt(X))<128?W[he++]=G:G<2048?(W[he++]=192|G>>>6,W[he++]=128|63&G):G<55296||G>=57344?(W[he++]=224|G>>>12,W[he++]=128|G>>>6&63,W[he++]=128|63&G):(G=65536+((1023&G)<<10|1023&C.charCodeAt(++X)),W[he++]=240|G>>>18,W[he++]=128|G>>>12&63,W[he++]=128|G>>>6&63,W[he++]=128|63&G);C=W}else{if(B!=="object")throw new Error(r);if(C===null)throw new Error(r);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new U(P,!0).update(C).array());var xe=[],Te=[];for(X=0;X<64;++X){var Y=C[X]||0;xe[X]=92^Y,Te[X]=54^Y}U.call(this,P,se),this.update(Te),this.oKeyPad=xe,this.inner=!0,this.sharedMemory=se}U.prototype.update=function(C){if(!this.finalized){var P,se=typeof C;if(se!=="string"){if(se!=="object")throw new Error(r);if(C===null)throw new Error(r);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(r);P=!0}for(var X,B,G=0,W=C.length,J=this.blocks;G<W;){if(this.hashed&&(this.hashed=!1,J[0]=this.block,this.block=J[16]=J[1]=J[2]=J[3]=J[4]=J[5]=J[6]=J[7]=J[8]=J[9]=J[10]=J[11]=J[12]=J[13]=J[14]=J[15]=0),P)for(B=this.start;G<W&&B<64;++G)J[B>>>2]|=C[G]<<f[3&B++];else for(B=this.start;G<W&&B<64;++G)(X=C.charCodeAt(G))<128?J[B>>>2]|=X<<f[3&B++]:X<2048?(J[B>>>2]|=(192|X>>>6)<<f[3&B++],J[B>>>2]|=(128|63&X)<<f[3&B++]):X<55296||X>=57344?(J[B>>>2]|=(224|X>>>12)<<f[3&B++],J[B>>>2]|=(128|X>>>6&63)<<f[3&B++],J[B>>>2]|=(128|63&X)<<f[3&B++]):(X=65536+((1023&X)<<10|1023&C.charCodeAt(++G)),J[B>>>2]|=(240|X>>>18)<<f[3&B++],J[B>>>2]|=(128|X>>>12&63)<<f[3&B++],J[B>>>2]|=(128|X>>>6&63)<<f[3&B++],J[B>>>2]|=(128|63&X)<<f[3&B++]);this.lastByteIndex=B,this.bytes+=B-this.start,B>=64?(this.block=J[16],this.start=B-64,this.hash(),this.hashed=!0):this.start=B}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,P=this.lastByteIndex;C[16]=this.block,C[P>>>2]|=g[3&P],this.block=C[16],P>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},U.prototype.hash=function(){var C,P,se,X,B,G,W,J,he,xe=this.h0,Te=this.h1,Y=this.h2,ae=this.h3,de=this.h4,Oe=this.h5,oe=this.h6,je=this.h7,Se=this.blocks;for(C=16;C<64;++C)P=((B=Se[C-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,se=((B=Se[C-2])>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,Se[C]=Se[C-16]+P+Se[C-7]+se|0;for(he=Te&Y,C=0;C<64;C+=4)this.first?(this.is224?(G=300032,je=(B=Se[0]-1413257819)-150054599|0,ae=B+24177077|0):(G=704751109,je=(B=Se[0]-210244248)-1521486534|0,ae=B+143694565|0),this.first=!1):(P=(xe>>>2|xe<<30)^(xe>>>13|xe<<19)^(xe>>>22|xe<<10),X=(G=xe&Te)^xe&Y^he,je=ae+(B=je+(se=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&Oe^~de&oe)+d[C]+Se[C])|0,ae=B+(P+X)|0),P=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),X=(W=ae&xe)^ae&Te^G,oe=Y+(B=oe+(se=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&Oe)+d[C+1]+Se[C+1])|0,P=((Y=B+(P+X)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),X=(J=Y&ae)^Y&xe^W,Oe=Te+(B=Oe+(se=(oe>>>6|oe<<26)^(oe>>>11|oe<<21)^(oe>>>25|oe<<7))+(oe&je^~oe&de)+d[C+2]+Se[C+2])|0,P=((Te=B+(P+X)|0)>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),X=(he=Te&Y)^Te&ae^J,de=xe+(B=de+(se=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&oe^~Oe&je)+d[C+3]+Se[C+3])|0,xe=B+(P+X)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+xe|0,this.h1=this.h1+Te|0,this.h2=this.h2+Y|0,this.h3=this.h3+ae|0,this.h4=this.h4+de|0,this.h5=this.h5+Oe|0,this.h6=this.h6+oe|0,this.h7=this.h7+je|0},U.prototype.hex=function(){this.finalize();var C=this.h0,P=this.h1,se=this.h2,X=this.h3,B=this.h4,G=this.h5,W=this.h6,J=this.h7,he=y[C>>>28&15]+y[C>>>24&15]+y[C>>>20&15]+y[C>>>16&15]+y[C>>>12&15]+y[C>>>8&15]+y[C>>>4&15]+y[15&C]+y[P>>>28&15]+y[P>>>24&15]+y[P>>>20&15]+y[P>>>16&15]+y[P>>>12&15]+y[P>>>8&15]+y[P>>>4&15]+y[15&P]+y[se>>>28&15]+y[se>>>24&15]+y[se>>>20&15]+y[se>>>16&15]+y[se>>>12&15]+y[se>>>8&15]+y[se>>>4&15]+y[15&se]+y[X>>>28&15]+y[X>>>24&15]+y[X>>>20&15]+y[X>>>16&15]+y[X>>>12&15]+y[X>>>8&15]+y[X>>>4&15]+y[15&X]+y[B>>>28&15]+y[B>>>24&15]+y[B>>>20&15]+y[B>>>16&15]+y[B>>>12&15]+y[B>>>8&15]+y[B>>>4&15]+y[15&B]+y[G>>>28&15]+y[G>>>24&15]+y[G>>>20&15]+y[G>>>16&15]+y[G>>>12&15]+y[G>>>8&15]+y[G>>>4&15]+y[15&G]+y[W>>>28&15]+y[W>>>24&15]+y[W>>>20&15]+y[W>>>16&15]+y[W>>>12&15]+y[W>>>8&15]+y[W>>>4&15]+y[15&W];return this.is224||(he+=y[J>>>28&15]+y[J>>>24&15]+y[J>>>20&15]+y[J>>>16&15]+y[J>>>12&15]+y[J>>>8&15]+y[J>>>4&15]+y[15&J]),he},U.prototype.toString=U.prototype.hex,U.prototype.digest=function(){this.finalize();var C=this.h0,P=this.h1,se=this.h2,X=this.h3,B=this.h4,G=this.h5,W=this.h6,J=this.h7,he=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,P>>>24&255,P>>>16&255,P>>>8&255,255&P,se>>>24&255,se>>>16&255,se>>>8&255,255&se,X>>>24&255,X>>>16&255,X>>>8&255,255&X,B>>>24&255,B>>>16&255,B>>>8&255,255&B,G>>>24&255,G>>>16&255,G>>>8&255,255&G,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||he.push(J>>>24&255,J>>>16&255,J>>>8&255,255&J),he},U.prototype.array=U.prototype.digest,U.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),P=new DataView(C);return P.setUint32(0,this.h0),P.setUint32(4,this.h1),P.setUint32(8,this.h2),P.setUint32(12,this.h3),P.setUint32(16,this.h4),P.setUint32(20,this.h5),P.setUint32(24,this.h6),this.is224||P.setUint32(28,this.h7),C},re.prototype=new U,re.prototype.finalize=function(){if(U.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();U.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),U.prototype.finalize.call(this)}};var ce=w();ce.sha256=ce,ce.sha224=w(!0),ce.sha256.hmac=L(),ce.sha224.hmac=L(!0),c?zh.exports=ce:(s.sha256=ce.sha256,s.sha224=ce.sha224)})();yu.exports;yu.exports.sha224;var pg=yu.exports.sha256;function cd(r){return kS(r)}function ES(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),i=/^[0-9a-f]+$/.test(r);return s||i?r.length%2===0:!1}function OS(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function AS(r){return ES(r)?"hex":OS(r)?"b64":""}function jS(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)t[s/2]=parseInt(r.substring(s,s+2),16);return t}function TS(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const t=atob(r);return Uint8Array.from(t,s=>s.charCodeAt(0))}function kS(r){switch(AS(r)){case"hex":return jS(r);case"b64":return TS(r)}return null}function NS(r,t){const s=typeof r=="string"?cd(r):r,i=typeof t=="string"?cd(t):t;if(s===null||i===null||s.length!==i.length)return!1;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return!1;return!0}class Tb{constructor(t,s,i=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=ps.next(),i&&(this.ctx=new Error)}}class CS extends Tb{constructor(s,i,l={maxWait:1e3}){super(s,i);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=at(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
|
|
33
|
-
|
|
34
|
-
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Fn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Fn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Fn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class kb extends Tb{constructor(s,i,l={timeout:1e3},c=!0){super(s,i,c);A(this,"deferred");A(this,"timer");this.deferred=at(),this.timer=Xi(l.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
|
-
|
|
36
|
-
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||me.errorForCode(le.Cancelled))}}const MS="$JS.API";function RS(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),mu({apiPrefix:MS,timeout:5e3},r)}class wo{constructor(t,s){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=t,this.opts=RS(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Vn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,i){i=i||{},i.timeout=this.timeout;let l=gn;s&&(l=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=Cd();for(let y=0;y<c;y++)try{const g=await this.nc.request(t,l,i);return this.parseJsResponse(g)}catch(g){const f=g;if((f.code==="503"||f.code===le.Timeout)&&y+1<c)await Zi(m.backoff(y));else throw g}}async findStream(t){const s={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const s=this.jc.decode(t.data),i=s;if(i.error){const l=jb(i.error.code,i.error.description);if(l!==null)throw l.api_error=i.error,l}return s}}class lo{constructor(t,s,i,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(t){var s,i,l;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=t.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function Vs(r=""){const t=r.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${r}' is not a semver value`)}function ud(r,t){return r.major<t.major?-1:r.major>t.major?1:r.minor<t.minor?-1:r.minor>t.minor?1:r.micro<t.micro?-1:r.micro>t.micro?1:0}var Ie;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ie||(Ie={}));class DS{constructor(t){A(this,"server");A(this,"features");A(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=Vs(t)),this.server=t,this.set(Ie.JS_KV,"2.6.2"),this.set(Ie.JS_OBJECTSTORE,"2.6.3"),this.set(Ie.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ie.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ie.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ie.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ie.JS_SIMPLIFICATION,"2.9.4"),this.set(Ie.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ie.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ie.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ie.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ie.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ie.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:ud(this.server,Vs(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=Vs(t)),ud(this.server,t)>=0}}class ru extends wo{constructor(t,s){super(t,s)}async add(t,s,i=nu.Create){if(It(t),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=s,l.stream_name=t,l.action=i,l.config.durable_name&&Gi(l.config.durable_name);const c=this.nc;let{min:m,ok:y}=c.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!y)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{pu("name",g)}catch(v){const x=v.message,w=x.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${x.substring(w)}`):v}let f,d="";if(Array.isArray(s.filter_subjects)){const{min:v,ok:x}=c.features.get(Ie.JS_MULTIPLE_CONSUMER_FILTER);if(!x)throw new Error(`consumer 'filter_subjects' requires server ${v}`);y=!1}if(s.metadata){const{min:v,ok:x}=c.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!x)throw new Error(`consumer 'metadata' requires server ${v}`)}if(y&&(d=s.name??s.durable_name??""),d!==""){let v=s.filter_subject??void 0;v===">"&&(v=void 0),f=v!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${d}.${v}`:`${this.prefix}.CONSUMER.CREATE.${t}.${d}`}else f=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,l)}async update(t,s,i){const l=await this.info(t,s),c=i;return this.add(t,Object.assign(l.config,c),nu.Update)}async info(t,s){return It(t),Gi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return It(t),Gi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){It(t);const s=l=>l.consumers,i=`${this.prefix}.CONSUMER.LIST.${t}`;return new lo(i,s,this)}pause(t,s,i){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,c={pause_until:i.toISOString()};return this._request(l,c)}resume(t,s){return this.pause(t,s,new Date(0))}}function qi(r,t,s=!1){if(s===!0&&!r)throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`));if(r&&typeof r!="function")throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`))}class qS extends Nt{constructor(s,i,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");qi(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&qi(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(qi(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(qi(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(qi(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&qi(l.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(l.callback){const d=l.callback;c=(b,v)=>{const[x,w]=this.adapter(b,v);if(x){d(x,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(d(x,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:m,queue:y,timeout:g}=l,f={queue:y,timeout:g,callback:c};m&&m>0&&(f.max=m),this.sub=s.subscribe(i,f),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=at(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,i){this.sub.cancelTimeout();const[l,c]=this.adapter(s,i);l&&this.stop(l),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let pn;function LS(r){pn=r}function Nb(){return pn!==void 0&&pn.defaultPort!==void 0?pn.defaultPort:4222}function Ih(){return pn!==void 0&&pn.urlParseFn?pn.urlParseFn:void 0}function BS(){if(!pn||typeof pn.factory!="function")throw new Error("transport fn is not set");return pn.factory()}function fd(){return pn!==void 0&&pn.dnsResolveFn?pn.dnsResolveFn:void 0}const Vc=`\r
|
|
37
|
-
`,su=Qi.fromAscii(Vc),PS=new Uint8Array(su)[0],US=new Uint8Array(su)[1];function zS(r){for(let t=0;t<r.length;t++){const s=t+1;if(r.byteLength>s&&r[t]===PS&&r[s]===US)return s+1}return 0}function IS(r){const t=zS(r);if(t>0){const i=new Uint8Array(r).slice(0,t);return mn.decode(i)}return""}const $S=4,Cb=48,HS=65,GS=97;function FS(r,t,s,i){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,y)=>{l[y]=m}),l[12]=r,l[13]=t,l[14]=s,l[15]=i,l}function hd(r){return VS(r)!==void 0}function VS(r){for(let t=0;t<r.length;t++)switch(r[t]){case".":return Mb(r);case":":return YS(r)}}function Mb(r){const t=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:i,c:l,ok:c}=KS(r);if(!c||i>255)return;r=r.substring(l),t[s]=i}return FS(t[0],t[1],t[2],t[3])}function YS(r){const t=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return t;let i=0;for(;i<16;){const{n:l,c,ok:m}=XS(r);if(!m||l>65535)return;if(c<r.length&&r[c]==="."){if(s<0&&i!=12||i+4>16)return;const y=Mb(r);if(y===void 0)return;t[i]=y[12],t[i+1]=y[13],t[i+2]=y[14],t[i+3]=y[15],r="",i+=$S;break}if(t[i]=l>>8,t[i+1]=l,i+=2,r=r.substring(c),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=i,r=r.substring(1),r.length===0)break}}if(r.length===0){if(i<16){if(s<0)return;const l=16-i;for(let c=i-1;c>=s;c--)t[c+l]=t[c];for(let c=s+l-1;c>=s;c--)t[c]=0}else if(s>=0)return;return t}}function KS(r){let t=0,s=0;for(t=0;t<r.length&&48<=r.charCodeAt(t)&&r.charCodeAt(t)<=57;t++)if(s=s*10+(r.charCodeAt(t)-Cb),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function XS(r){let t=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)t*=16,t+=r.charCodeAt(s)-Cb;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)t*=16,t+=r.charCodeAt(s)-GS+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)t*=16,t+=r.charCodeAt(s)-HS+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function JS(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function dd(r){return!JS(r)}function QS(r){const t="::FFFF:",s=r.toUpperCase().indexOf(t);if(s!==-1&&r.indexOf(".")!==-1){let i=r.substring(s+t.length);return i=i.replace("[",""),i.replace("]","")}return r}function ZS(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=QS(r),dd(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const t=dd(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,i=s===80?"https":"http",l=new URL(`${i}://${r}`);l.port=`${s}`;let c=l.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:l.host,hostname:c,port:s}}class ho{constructor(t,s=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const i=ZS(t);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(hd(this.hostname))return[this];{const i=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const l of i){const c=this.port===80?"https":"http",m=new URL(`${c}://${dd(l)?"["+l+"]":l}`);m.port=`${this.port}`;const y=new ho(m.host,!1);y.tlsName=this.hostname,s.push(y)}}return t.randomize&&Ob(s),this.resolves=s,s}}class WS{constructor(t=[],s={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=Ih();t&&(t.forEach(l=>{l=i?i(l):l,this.servers.push(new ho(l))}),this.randomize&&(this.servers=Ob(this.servers))),this.servers.length===0&&this.addServer(`${rd}:${Nb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();hd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const i=Ih();t=i?i(t):t;const l=new ho(t,s);hd(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,s){const i=[];let l=[];const c=Ih(),m=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,s):g;const f=new ho(g,!0);m.set(g,f)});const y=[];return this.servers.forEach((g,f)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&y.push(f),m.delete(d)}),y.reverse(),y.forEach(g=>{const f=this.servers.splice(g,1);l=l.concat(f[0].listen)}),m.forEach((g,f)=>{this.servers.push(g),i.push(f)}),{added:i,deleted:l}}}class eE{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Ar(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const l=this.all().find(c=>c.requestSubject===i.subject);if(l)return l.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const i=this.getToken(s);if(i){const l=this.get(i);l&&(t===null&&s.headers&&(t=Ab(s)),l.resolver(t,s))}}}close(){const t=me.errorForCode(le.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class tE{constructor(t,s,i){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(this,"pendings");this.ph=t,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Hi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=at();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class nE extends Error{constructor(t){super(t),this.name="AssertionError"}}function rE(r,t="Assertion failed."){if(!r)throw new nE(t)}const yg=32*1024,$h=2**32-2;function Ql(r,t,s=0){const i=t.byteLength-s;return r.byteLength>i&&(r=r.subarray(0,i)),t.set(r,s),r.byteLength}class Hh{constructor(t){A(this,"_buf");A(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){rE(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=Ql(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Ys.encode(t))}write(t){const s=this._grow(t.byteLength);return Ql(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(t);if(i>=0)return i;const l=this.capacity;if(t<=Math.floor(l/2)-s)Ql(this._buf.subarray(this._off),this._buf);else{if(l+t>$h)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*l+t,$h));Ql(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+t,$h)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const i=new Uint8Array(yg);for(;;){const l=this.capacity-this.length<yg,c=l?i:new Uint8Array(this._buf.buffer,this.length),m=t.read(c);if(m===null)return s;l?this.write(c.subarray(0,m)):this._reslice(this.length+m),s+=m}}}var $t;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})($t||($t={}));function gg(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const sE=48;class bg{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=t,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const i=t[s];switch(this.state){case ue.OP_START:switch(i){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=gg();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=gg();break;case fe.P:case fe.p:this.state=ue.OP_P;break;case fe.PLUS:this.state=ue.OP_PLUS;break;case fe.MINUS:this.state=ue.OP_MINUS;break;case fe.I:case fe.i:this.state=ue.OP_I;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_H:switch(i){case fe.M:case fe.m:this.state=ue.OP_M;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_M:switch(i){case fe.S:case fe.s:this.state=ue.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MS:switch(i){case fe.G:case fe.g:this.state=ue.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MSG:switch(i){case fe.SPACE:case fe.TAB:this.state=ue.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MSG_SPC:switch(i){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MSG_ARG,this.as=s}break;case ue.MSG_ARG:switch(i){case fe.CR:this.drop=1;break;case fe.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(l),this.drop=0,this.as=s+1,this.state=ue.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case ue.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:$t.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const c=t.length-s;c<l&&(l=c),l>0?(this.msgBuf.write(t.subarray(s,s+l)),s=s+l-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:$t.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END);break;case ue.MSG_END:switch(i){case fe.NL:this.drop=0,this.as=s+1,this.state=ue.OP_START;break;default:continue}break;case ue.OP_PLUS:switch(i){case fe.O:case fe.o:this.state=ue.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PLUS_O:switch(i){case fe.K:case fe.k:this.state=ue.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PLUS_OK:switch(i){case fe.NL:this.dispatcher.push({kind:$t.OK}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_MINUS:switch(i){case fe.E:case fe.e:this.state=ue.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_E:switch(i){case fe.R:case fe.r:this.state=ue.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ER:switch(i){case fe.R:case fe.r:this.state=ue.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ERR:switch(i){case fe.SPACE:case fe.TAB:this.state=ue.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ERR_SPC:switch(i){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MINUS_ERR_ARG,this.as=s}break;case ue.MINUS_ERR_ARG:switch(i){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:$t.ERR,data:l}),this.drop=0,this.as=s+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case ue.OP_P:switch(i){case fe.I:case fe.i:this.state=ue.OP_PI;break;case fe.O:case fe.o:this.state=ue.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PO:switch(i){case fe.N:case fe.n:this.state=ue.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PON:switch(i){case fe.G:case fe.g:this.state=ue.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PONG:switch(i){case fe.NL:this.dispatcher.push({kind:$t.PONG}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_PI:switch(i){case fe.N:case fe.n:this.state=ue.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PIN:switch(i){case fe.G:case fe.g:this.state=ue.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PING:switch(i){case fe.NL:this.dispatcher.push({kind:$t.PING}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_I:switch(i){case fe.N:case fe.n:this.state=ue.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_IN:switch(i){case fe.F:case fe.f:this.state=ue.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INF:switch(i){case fe.O:case fe.o:this.state=ue.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INFO:switch(i){case fe.SPACE:case fe.TAB:this.state=ue.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INFO_SPC:switch(i){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.INFO_ARG,this.as=s}break;case ue.INFO_ARG:switch(i){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:$t.INFO,data:l}),this.drop=0,this.as=s+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(t.subarray(s))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Hh(t.subarray(this.as,s-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Hh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(t+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,t),this.argBuf=new Hh(i),this.ma.subject=i.subarray(0,t),this.ma.reply&&(this.ma.reply=i.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let i=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:i>=0&&(s.push(t.subarray(i,l)),i=-1);break;default:i<0&&(i=l)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${mn.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let i=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:i>=0&&(s.push(t.subarray(i,l)),i=-1);break;default:i<0&&(i=l)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let i=0;i<t.length;i++){if(t[i]<48||t[i]>57)return-1;s=s*10+(t[i]-sE)}return s}}var ue;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(ue||(ue={}));var fe;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(fe||(fe={}));(function(r){var t=function(O,k){this.hi=O|0,this.lo=k|0},s=function(O){var k,T=new Float64Array(16);if(O)for(k=0;k<O.length;k++)T[k]=O[k];return T},i=function(){throw new Error("no PRNG")},l=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=s(),y=s([1]),g=s([56129,1]),f=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),x=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(O,k){return O<<k|O>>>32-k}function S(O,k){var T=O[k+3]&255;return T=T<<8|O[k+2]&255,T=T<<8|O[k+1]&255,T<<8|O[k+0]&255}function M(O,k){var T=O[k]<<24|O[k+1]<<16|O[k+2]<<8|O[k+3],N=O[k+4]<<24|O[k+5]<<16|O[k+6]<<8|O[k+7];return new t(T,N)}function L(O,k,T){var N;for(N=0;N<4;N++)O[k+N]=T&255,T>>>=8}function U(O,k,T){O[k]=T.hi>>24&255,O[k+1]=T.hi>>16&255,O[k+2]=T.hi>>8&255,O[k+3]=T.hi&255,O[k+4]=T.lo>>24&255,O[k+5]=T.lo>>16&255,O[k+6]=T.lo>>8&255,O[k+7]=T.lo&255}function re(O,k,T,N,D){var I,te=0;for(I=0;I<D;I++)te|=O[k+I]^T[N+I];return(1&te-1>>>8)-1}function ce(O,k,T,N){return re(O,k,T,N,16)}function C(O,k,T,N){return re(O,k,T,N,32)}function P(O,k,T,N,D){var I=new Uint32Array(16),te=new Uint32Array(16),ie=new Uint32Array(16),V=new Uint32Array(4),ee,pe,Re;for(ee=0;ee<4;ee++)te[5*ee]=S(N,4*ee),te[1+ee]=S(T,4*ee),te[6+ee]=S(k,4*ee),te[11+ee]=S(T,16+4*ee);for(ee=0;ee<16;ee++)ie[ee]=te[ee];for(ee=0;ee<20;ee++){for(pe=0;pe<4;pe++){for(Re=0;Re<4;Re++)V[Re]=te[(5*pe+4*Re)%16];for(V[1]^=w(V[0]+V[3]|0,7),V[2]^=w(V[1]+V[0]|0,9),V[3]^=w(V[2]+V[1]|0,13),V[0]^=w(V[3]+V[2]|0,18),Re=0;Re<4;Re++)I[4*pe+(pe+Re)%4]=V[Re]}for(Re=0;Re<16;Re++)te[Re]=I[Re]}if(D){for(ee=0;ee<16;ee++)te[ee]=te[ee]+ie[ee]|0;for(ee=0;ee<4;ee++)te[5*ee]=te[5*ee]-S(N,4*ee)|0,te[6+ee]=te[6+ee]-S(k,4*ee)|0;for(ee=0;ee<4;ee++)L(O,4*ee,te[5*ee]),L(O,16+4*ee,te[6+ee])}else for(ee=0;ee<16;ee++)L(O,4*ee,te[ee]+ie[ee]|0)}function se(O,k,T,N){return P(O,k,T,N,!1),0}function X(O,k,T,N){return P(O,k,T,N,!0),0}var B=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function G(O,k,T,N,D,I,te){var ie=new Uint8Array(16),V=new Uint8Array(64),ee,pe;if(!D)return 0;for(pe=0;pe<16;pe++)ie[pe]=0;for(pe=0;pe<8;pe++)ie[pe]=I[pe];for(;D>=64;){for(se(V,ie,te,B),pe=0;pe<64;pe++)O[k+pe]=(T?T[N+pe]:0)^V[pe];for(ee=1,pe=8;pe<16;pe++)ee=ee+(ie[pe]&255)|0,ie[pe]=ee&255,ee>>>=8;D-=64,k+=64,T&&(N+=64)}if(D>0)for(se(V,ie,te,B),pe=0;pe<D;pe++)O[k+pe]=(T?T[N+pe]:0)^V[pe];return 0}function W(O,k,T,N,D){return G(O,k,null,0,T,N,D)}function J(O,k,T,N,D){var I=new Uint8Array(32);return X(I,N,D,B),W(O,k,T,N.subarray(16),I)}function he(O,k,T,N,D,I,te){var ie=new Uint8Array(32);return X(ie,I,te,B),G(O,k,T,N,D,I.subarray(16),ie)}function xe(O,k){var T,N=0;for(T=0;T<17;T++)N=N+(O[T]+k[T]|0)|0,O[T]=N&255,N>>>=8}var Te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(O,k,T,N,D,I){var te,ie,V,ee,pe=new Uint32Array(17),Re=new Uint32Array(17),et=new Uint32Array(17),Pt=new Uint32Array(17),Bn=new Uint32Array(17);for(V=0;V<17;V++)Re[V]=et[V]=0;for(V=0;V<16;V++)Re[V]=I[V];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;D>0;){for(V=0;V<17;V++)Pt[V]=0;for(V=0;V<16&&V<D;++V)Pt[V]=T[N+V];for(Pt[V]=1,N+=V,D-=V,xe(et,Pt),ie=0;ie<17;ie++)for(pe[ie]=0,V=0;V<17;V++)pe[ie]=pe[ie]+et[V]*(V<=ie?Re[ie-V]:320*Re[ie+17-V]|0)|0|0;for(ie=0;ie<17;ie++)et[ie]=pe[ie];for(ee=0,V=0;V<16;V++)ee=ee+et[V]|0,et[V]=ee&255,ee>>>=8;for(ee=ee+et[16]|0,et[16]=ee&3,ee=5*(ee>>>2)|0,V=0;V<16;V++)ee=ee+et[V]|0,et[V]=ee&255,ee>>>=8;ee=ee+et[16]|0,et[16]=ee}for(V=0;V<17;V++)Bn[V]=et[V];for(xe(et,Te),te=-(et[16]>>>7)|0,V=0;V<17;V++)et[V]^=te&(Bn[V]^et[V]);for(V=0;V<16;V++)Pt[V]=I[V+16];for(Pt[16]=0,xe(et,Pt),V=0;V<16;V++)O[k+V]=et[V];return 0}function ae(O,k,T,N,D,I){var te=new Uint8Array(16);return Y(te,0,T,N,D,I),ce(O,k,te,0)}function de(O,k,T,N,D){var I;if(T<32)return-1;for(he(O,0,k,0,T,N,D),Y(O,16,O,32,T-32,O),I=0;I<16;I++)O[I]=0;return 0}function Oe(O,k,T,N,D){var I,te=new Uint8Array(32);if(T<32||(J(te,0,32,N,D),ae(k,16,k,32,T-32,te)!==0))return-1;for(he(O,0,k,0,T,N,D),I=0;I<32;I++)O[I]=0;return 0}function oe(O,k){var T;for(T=0;T<16;T++)O[T]=k[T]|0}function je(O){var k,T;for(T=0;T<16;T++)O[T]+=65536,k=Math.floor(O[T]/65536),O[(T+1)*(T<15?1:0)]+=k-1+37*(k-1)*(T===15?1:0),O[T]-=k*65536}function Se(O,k,T){for(var N,D=~(T-1),I=0;I<16;I++)N=D&(O[I]^k[I]),O[I]^=N,k[I]^=N}function ke(O,k){var T,N,D,I=s(),te=s();for(T=0;T<16;T++)te[T]=k[T];for(je(te),je(te),je(te),N=0;N<2;N++){for(I[0]=te[0]-65517,T=1;T<15;T++)I[T]=te[T]-65535-(I[T-1]>>16&1),I[T-1]&=65535;I[15]=te[15]-32767-(I[14]>>16&1),D=I[15]>>16&1,I[14]&=65535,Se(te,I,1-D)}for(T=0;T<16;T++)O[2*T]=te[T]&255,O[2*T+1]=te[T]>>8}function We(O,k){var T=new Uint8Array(32),N=new Uint8Array(32);return ke(T,O),ke(N,k),C(T,0,N,0)}function Ae(O){var k=new Uint8Array(32);return ke(k,O),k[0]&1}function ct(O,k){var T;for(T=0;T<16;T++)O[T]=k[2*T]+(k[2*T+1]<<8);O[15]&=32767}function At(O,k,T){var N;for(N=0;N<16;N++)O[N]=k[N]+T[N]|0}function qt(O,k,T){var N;for(N=0;N<16;N++)O[N]=k[N]-T[N]|0}function Ne(O,k,T){var N,D,I=new Float64Array(31);for(N=0;N<31;N++)I[N]=0;for(N=0;N<16;N++)for(D=0;D<16;D++)I[N+D]+=k[N]*T[D];for(N=0;N<15;N++)I[N]+=38*I[N+16];for(N=0;N<16;N++)O[N]=I[N];je(O),je(O)}function Lt(O,k){Ne(O,k,k)}function gs(O,k){var T=s(),N;for(N=0;N<16;N++)T[N]=k[N];for(N=253;N>=0;N--)Lt(T,T),N!==2&&N!==4&&Ne(T,T,k);for(N=0;N<16;N++)O[N]=T[N]}function Xs(O,k){var T=s(),N;for(N=0;N<16;N++)T[N]=k[N];for(N=250;N>=0;N--)Lt(T,T),N!==1&&Ne(T,T,k);for(N=0;N<16;N++)O[N]=T[N]}function bs(O,k,T){var N=new Uint8Array(32),D=new Float64Array(80),I,te,ie=s(),V=s(),ee=s(),pe=s(),Re=s(),et=s();for(te=0;te<31;te++)N[te]=k[te];for(N[31]=k[31]&127|64,N[0]&=248,ct(D,T),te=0;te<16;te++)V[te]=D[te],pe[te]=ie[te]=ee[te]=0;for(ie[0]=pe[0]=1,te=254;te>=0;--te)I=N[te>>>3]>>>(te&7)&1,Se(ie,V,I),Se(ee,pe,I),At(Re,ie,ee),qt(ie,ie,ee),At(ee,V,pe),qt(V,V,pe),Lt(pe,Re),Lt(et,ie),Ne(ie,ee,ie),Ne(ee,V,Re),At(Re,ie,ee),qt(ie,ie,ee),Lt(V,ie),qt(ee,pe,et),Ne(ie,ee,g),At(ie,ie,pe),Ne(ee,ee,ie),Ne(ie,pe,et),Ne(pe,V,D),Lt(V,Re),Se(ie,V,I),Se(ee,pe,I);for(te=0;te<16;te++)D[te+16]=ie[te],D[te+32]=ee[te],D[te+48]=V[te],D[te+64]=pe[te];var Pt=D.subarray(32),Bn=D.subarray(16);return gs(Pt,Pt),Ne(Bn,Bn,Pt),ke(O,Bn),0}function _n(O,k){return bs(O,k,c)}function Js(O,k){return i(k,32),_n(O,k)}function Nr(O,k,T){var N=new Uint8Array(32);return bs(N,T,k),X(O,l,N,B)}var ko=de,No=Oe;function ta(O,k,T,N,D,I){var te=new Uint8Array(32);return Nr(te,D,I),ko(O,k,T,N,te)}function na(O,k,T,N,D,I){var te=new Uint8Array(32);return Nr(te,D,I),No(O,k,T,N,te)}function rr(){var O=0,k=0,T=0,N=0,D=65535,I,te,ie;for(ie=0;ie<arguments.length;ie++)I=arguments[ie].lo,te=arguments[ie].hi,O+=I&D,k+=I>>>16,T+=te&D,N+=te>>>16;return k+=O>>>16,T+=k>>>16,N+=T>>>16,new t(T&D|N<<16,O&D|k<<16)}function Co(O,k){return new t(O.hi>>>k,O.lo>>>k|O.hi<<32-k)}function Qs(){var O=0,k=0,T;for(T=0;T<arguments.length;T++)O^=arguments[T].lo,k^=arguments[T].hi;return new t(k,O)}function rt(O,k){var T,N,D=32-k;return k<32?(T=O.hi>>>k|O.lo<<D,N=O.lo>>>k|O.hi<<D):k<64&&(T=O.lo>>>k|O.hi<<D,N=O.hi>>>k|O.lo<<D),new t(T,N)}function Eu(O,k,T){var N=O.hi&k.hi^~O.hi&T.hi,D=O.lo&k.lo^~O.lo&T.lo;return new t(N,D)}function Mo(O,k,T){var N=O.hi&k.hi^O.hi&T.hi^k.hi&T.hi,D=O.lo&k.lo^O.lo&T.lo^k.lo&T.lo;return new t(N,D)}function Ro(O){return Qs(rt(O,28),rt(O,34),rt(O,39))}function Zs(O){return Qs(rt(O,14),rt(O,18),rt(O,41))}function Ou(O){return Qs(rt(O,1),rt(O,8),Co(O,7))}function Do(O){return Qs(rt(O,19),rt(O,61),Co(O,6))}var Au=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function qo(O,k,T){var N=[],D=[],I=[],te=[],ie,V,ee;for(V=0;V<8;V++)N[V]=I[V]=M(O,8*V);for(var pe=0;T>=128;){for(V=0;V<16;V++)te[V]=M(k,8*V+pe);for(V=0;V<80;V++){for(ee=0;ee<8;ee++)D[ee]=I[ee];for(ie=rr(I[7],Zs(I[4]),Eu(I[4],I[5],I[6]),Au[V],te[V%16]),D[7]=rr(ie,Ro(I[0]),Mo(I[0],I[1],I[2])),D[3]=rr(D[3],ie),ee=0;ee<8;ee++)I[(ee+1)%8]=D[ee];if(V%16===15)for(ee=0;ee<16;ee++)te[ee]=rr(te[ee],te[(ee+9)%16],Ou(te[(ee+1)%16]),Do(te[(ee+14)%16]))}for(V=0;V<8;V++)I[V]=rr(I[V],N[V]),N[V]=I[V];pe+=128,T-=128}for(V=0;V<8;V++)U(O,8*V,N[V]);return T}var vs=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function pt(O,k,T){var N=new Uint8Array(64),D=new Uint8Array(256),I,te=T;for(I=0;I<64;I++)N[I]=vs[I];for(qo(N,k,T),T%=128,I=0;I<256;I++)D[I]=0;for(I=0;I<T;I++)D[I]=k[te-T+I];for(D[T]=128,T=256-128*(T<112?1:0),D[T-9]=0,U(D,T-8,new t(te/536870912|0,te<<3)),qo(N,D,T),I=0;I<64;I++)O[I]=N[I];return 0}function en(O,k){var T=s(),N=s(),D=s(),I=s(),te=s(),ie=s(),V=s(),ee=s(),pe=s();qt(T,O[1],O[0]),qt(pe,k[1],k[0]),Ne(T,T,pe),At(N,O[0],O[1]),At(pe,k[0],k[1]),Ne(N,N,pe),Ne(D,O[3],k[3]),Ne(D,D,d),Ne(I,O[2],k[2]),At(I,I,I),qt(te,N,T),qt(ie,I,D),At(V,I,D),At(ee,N,T),Ne(O[0],te,ie),Ne(O[1],ee,V),Ne(O[2],V,ie),Ne(O[3],te,ee)}function Bt(O,k,T){var N;for(N=0;N<4;N++)Se(O[N],k[N],T)}function ra(O,k){var T=s(),N=s(),D=s();gs(D,k[2]),Ne(T,k[0],D),Ne(N,k[1],D),ke(O,N),O[31]^=Ae(T)<<7}function sa(O,k,T){var N,D;for(oe(O[0],m),oe(O[1],y),oe(O[2],y),oe(O[3],m),D=255;D>=0;--D)N=T[D/8|0]>>(D&7)&1,Bt(O,k,N),en(k,O),en(O,O),Bt(O,k,N)}function Ws(O,k){var T=[s(),s(),s(),s()];oe(T[0],b),oe(T[1],v),oe(T[2],y),Ne(T[3],b,v),sa(O,T,k)}function Cr(O,k,T){var N=new Uint8Array(64),D=[s(),s(),s(),s()],I;for(T||i(k,32),pt(N,k,32),N[0]&=248,N[31]&=127,N[31]|=64,Ws(D,N),ra(O,D),I=0;I<32;I++)k[I+32]=O[I];return 0}var sr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Mr(O,k){var T,N,D,I;for(N=63;N>=32;--N){for(T=0,D=N-32,I=N-12;D<I;++D)k[D]+=T-16*k[N]*sr[D-(N-32)],T=Math.floor((k[D]+128)/256),k[D]-=T*256;k[D]+=T,k[N]=0}for(T=0,D=0;D<32;D++)k[D]+=T-(k[31]>>4)*sr[D],T=k[D]>>8,k[D]&=255;for(D=0;D<32;D++)k[D]-=T*sr[D];for(N=0;N<32;N++)k[N+1]+=k[N]>>8,O[N]=k[N]&255}function qn(O){var k=new Float64Array(64),T;for(T=0;T<64;T++)k[T]=O[T];for(T=0;T<64;T++)O[T]=0;Mr(O,k)}function xs(O,k,T,N){var D=new Uint8Array(64),I=new Uint8Array(64),te=new Uint8Array(64),ie,V,ee=new Float64Array(64),pe=[s(),s(),s(),s()];pt(D,N,32),D[0]&=248,D[31]&=127,D[31]|=64;var Re=T+64;for(ie=0;ie<T;ie++)O[64+ie]=k[ie];for(ie=0;ie<32;ie++)O[32+ie]=D[32+ie];for(pt(te,O.subarray(32),T+32),qn(te),Ws(pe,te),ra(O,pe),ie=32;ie<64;ie++)O[ie]=N[ie];for(pt(I,O,T+64),qn(I),ie=0;ie<64;ie++)ee[ie]=0;for(ie=0;ie<32;ie++)ee[ie]=te[ie];for(ie=0;ie<32;ie++)for(V=0;V<32;V++)ee[ie+V]+=I[ie]*D[V];return Mr(O.subarray(32),ee),Re}function _s(O,k){var T=s(),N=s(),D=s(),I=s(),te=s(),ie=s(),V=s();return oe(O[2],y),ct(O[1],k),Lt(D,O[1]),Ne(I,D,f),qt(D,D,O[2]),At(I,O[2],I),Lt(te,I),Lt(ie,te),Ne(V,ie,te),Ne(T,V,D),Ne(T,T,I),Xs(T,T),Ne(T,T,D),Ne(T,T,I),Ne(T,T,I),Ne(O[0],T,I),Lt(N,O[0]),Ne(N,N,I),We(N,D)&&Ne(O[0],O[0],x),Lt(N,O[0]),Ne(N,N,I),We(N,D)?-1:(Ae(O[0])===k[31]>>7&&qt(O[0],m,O[0]),Ne(O[3],O[0],O[1]),0)}function ia(O,k,T,N){var D,I=new Uint8Array(32),te=new Uint8Array(64),ie=[s(),s(),s(),s()],V=[s(),s(),s(),s()];if(T<64||_s(V,N))return-1;for(D=0;D<T;D++)O[D]=k[D];for(D=0;D<32;D++)O[D+32]=N[D];if(pt(te,O,T),qn(te),sa(ie,V,te),Ws(V,k.subarray(32)),en(ie,V),ra(I,ie),T-=64,C(k,0,I,0)){for(D=0;D<T;D++)O[D]=0;return-1}for(D=0;D<T;D++)O[D]=k[D+64];return T}var ei=32,Rr=24,Ln=32,Dr=16,qr=32,ws=32,Lr=32,ir=32,Ss=32,aa=Rr,Lo=Ln,Yn=Dr,Qe=64,ut=32,tn=64,Es=32,oa=64;r.lowlevel={crypto_core_hsalsa20:X,crypto_stream_xor:he,crypto_stream:J,crypto_stream_salsa20_xor:G,crypto_stream_salsa20:W,crypto_onetimeauth:Y,crypto_onetimeauth_verify:ae,crypto_verify_16:ce,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:Oe,crypto_scalarmult:bs,crypto_scalarmult_base:_n,crypto_box_beforenm:Nr,crypto_box_afternm:ko,crypto_box:ta,crypto_box_open:na,crypto_box_keypair:Js,crypto_hash:pt,crypto_sign:xs,crypto_sign_keypair:Cr,crypto_sign_open:ia,crypto_secretbox_KEYBYTES:ei,crypto_secretbox_NONCEBYTES:Rr,crypto_secretbox_ZEROBYTES:Ln,crypto_secretbox_BOXZEROBYTES:Dr,crypto_scalarmult_BYTES:qr,crypto_scalarmult_SCALARBYTES:ws,crypto_box_PUBLICKEYBYTES:Lr,crypto_box_SECRETKEYBYTES:ir,crypto_box_BEFORENMBYTES:Ss,crypto_box_NONCEBYTES:aa,crypto_box_ZEROBYTES:Lo,crypto_box_BOXZEROBYTES:Yn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:ut,crypto_sign_SECRETKEYBYTES:tn,crypto_sign_SEEDBYTES:Es,crypto_hash_BYTES:oa,gf:s,D:f,L:sr,pack25519:ke,unpack25519:ct,M:Ne,A:At,S:Lt,Z:qt,pow2523:Xs,add:en,set25519:oe,modL:Mr,scalarmult:sa,scalarbase:Ws};function Bo(O,k){if(O.length!==ei)throw new Error("bad key size");if(k.length!==Rr)throw new Error("bad nonce size")}function Po(O,k){if(O.length!==Lr)throw new Error("bad public key size");if(k.length!==ir)throw new Error("bad secret key size")}function Et(){for(var O=0;O<arguments.length;O++)if(!(arguments[O]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ti(O){for(var k=0;k<O.length;k++)O[k]=0}r.randomBytes=function(O){var k=new Uint8Array(O);return i(k,O),k},r.secretbox=function(O,k,T){Et(O,k,T),Bo(T,k);for(var N=new Uint8Array(Ln+O.length),D=new Uint8Array(N.length),I=0;I<O.length;I++)N[I+Ln]=O[I];return de(D,N,N.length,k,T),D.subarray(Dr)},r.secretbox.open=function(O,k,T){Et(O,k,T),Bo(T,k);for(var N=new Uint8Array(Dr+O.length),D=new Uint8Array(N.length),I=0;I<O.length;I++)N[I+Dr]=O[I];return N.length<32||Oe(D,N,N.length,k,T)!==0?null:D.subarray(Ln)},r.secretbox.keyLength=ei,r.secretbox.nonceLength=Rr,r.secretbox.overheadLength=Dr,r.scalarMult=function(O,k){if(Et(O,k),O.length!==ws)throw new Error("bad n size");if(k.length!==qr)throw new Error("bad p size");var T=new Uint8Array(qr);return bs(T,O,k),T},r.scalarMult.base=function(O){if(Et(O),O.length!==ws)throw new Error("bad n size");var k=new Uint8Array(qr);return _n(k,O),k},r.scalarMult.scalarLength=ws,r.scalarMult.groupElementLength=qr,r.box=function(O,k,T,N){var D=r.box.before(T,N);return r.secretbox(O,k,D)},r.box.before=function(O,k){Et(O,k),Po(O,k);var T=new Uint8Array(Ss);return Nr(T,O,k),T},r.box.after=r.secretbox,r.box.open=function(O,k,T,N){var D=r.box.before(T,N);return r.secretbox.open(O,k,D)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var O=new Uint8Array(Lr),k=new Uint8Array(ir);return Js(O,k),{publicKey:O,secretKey:k}},r.box.keyPair.fromSecretKey=function(O){if(Et(O),O.length!==ir)throw new Error("bad secret key size");var k=new Uint8Array(Lr);return _n(k,O),{publicKey:k,secretKey:new Uint8Array(O)}},r.box.publicKeyLength=Lr,r.box.secretKeyLength=ir,r.box.sharedKeyLength=Ss,r.box.nonceLength=aa,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(O,k){if(Et(O,k),k.length!==tn)throw new Error("bad secret key size");var T=new Uint8Array(Qe+O.length);return xs(T,O,O.length,k),T},r.sign.open=function(O,k){if(Et(O,k),k.length!==ut)throw new Error("bad public key size");var T=new Uint8Array(O.length),N=ia(T,O,O.length,k);if(N<0)return null;for(var D=new Uint8Array(N),I=0;I<D.length;I++)D[I]=T[I];return D},r.sign.detached=function(O,k){for(var T=r.sign(O,k),N=new Uint8Array(Qe),D=0;D<N.length;D++)N[D]=T[D];return N},r.sign.detached.verify=function(O,k,T){if(Et(O,k,T),k.length!==Qe)throw new Error("bad signature size");if(T.length!==ut)throw new Error("bad public key size");var N=new Uint8Array(Qe+O.length),D=new Uint8Array(Qe+O.length),I;for(I=0;I<Qe;I++)N[I]=k[I];for(I=0;I<O.length;I++)N[I+Qe]=O[I];return ia(D,N,N.length,T)>=0},r.sign.keyPair=function(){var O=new Uint8Array(ut),k=new Uint8Array(tn);return Cr(O,k),{publicKey:O,secretKey:k}},r.sign.keyPair.fromSecretKey=function(O){if(Et(O),O.length!==tn)throw new Error("bad secret key size");for(var k=new Uint8Array(ut),T=0;T<k.length;T++)k[T]=O[32+T];return{publicKey:k,secretKey:new Uint8Array(O)}},r.sign.keyPair.fromSeed=function(O){if(Et(O),O.length!==Es)throw new Error("bad seed size");for(var k=new Uint8Array(ut),T=new Uint8Array(tn),N=0;N<32;N++)T[N]=O[N];return Cr(k,T,!0),{publicKey:k,secretKey:T}},r.sign.publicKeyLength=ut,r.sign.secretKeyLength=tn,r.sign.seedLength=Es,r.sign.signatureLength=Qe,r.hash=function(O){Et(O);var k=new Uint8Array(oa);return pt(k,O,O.length),k},r.hash.hashLength=oa,r.verify=function(O,k){return Et(O,k),O.length===0||k.length===0||O.length!==k.length?!1:re(O,0,k,0,O.length)===0},r.setPRNG=function(O){i=O},(function(){var O=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(O&&O.getRandomValues){var k=65536;r.setPRNG(function(T,N){var D,I=new Uint8Array(N);for(D=0;D<N;D+=k)O.getRandomValues(I.subarray(D,D+Math.min(N-D,k)));for(D=0;D<N;D++)T[D]=I[D];ti(I)})}else typeof require<"u"&&(O=require("crypto"),O&&O.randomBytes&&r.setPRNG(function(T,N){var D,I=O.randomBytes(N);for(D=0;D<N;D++)T[D]=I[D];ti(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Zl=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Zl.sign.keyPair.fromSeed,Zl.sign.detached,Zl.sign.detached.verify,Zl.randomBytes;var vg;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(vg||(vg={}));var xg;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(xg||(xg={}));function iE(r){return t=>{let s={};return r.forEach(i=>{const l=i(t)||{};s=Object.assign(s,l)}),s}}function aE(){return()=>{}}function oE(r,t){return()=>{const s=typeof r=="function"?r():r,i=typeof t=="function"?t():t;return{user:s,pass:i}}}function lE(r){return()=>({auth_token:typeof r=="function"?r():r})}const Rb=120*1e3,cE=2,Db=2*1e3;function uE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Rb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Db,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function fE(r){const t=[];return typeof r.authenticator=="function"&&t.push(r.authenticator),Array.isArray(r.authenticator)&&t.push(...r.authenticator),r.token&&t.push(lE(r.token)),r.user&&t.push(oE(r.user,r.pass)),t.length===0?aE():iE(t)}function hE(r){const t=`${rd}:${Nb()}`;if(r=r||{servers:[t]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new me("port and servers options are mutually exclusive",le.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${rd}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[t]);const s=mu(uE(),r);if(s.authenticator=fE(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new me(`${i} option should be a function`,le.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Ar(s.inboxPrefix)}catch(i){throw new me(i.message,le.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof fd()=="function"),s.resolve&&typeof fd()!="function")throw new me("'resolve' is not supported on this client",le.InvalidOption);return s}function dE(r,t){const{proto:s,tls_required:i,tls_available:l}=r;if((s===void 0||s<1)&&t.noEcho)throw new me("noEcho",le.ServerOptionNotAvailable);const c=i||l||!1;if(t.tls&&!c)throw new me("tls",le.ServerOptionNotAvailable)}const mE=1024*32,pE=/^INFO\s+([^\r\n]+)\r\n/i,yE=uo(`PONG\r
|
|
38
|
-
`),_g=uo(`PING\r
|
|
39
|
-
`);class gE{constructor(t,s,i){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const l=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};mu(this,l)}}class qb extends Nt{constructor(s,i,l={}){var m;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");mu(this,l),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=at();const c=!((m=s.options)!=null&&m.noAsyncTraces);l.timeout&&(this.timer=Xi(l.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(y=>{this.stop(y),this.noIterator&&this.callback(y,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,l=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,m=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(y,g)=>{const{ingest:f}=l(g);f&&c(g)&&(i(y,g),m(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(le.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(at()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class bE{constructor(){A(this,"mux");A(this,"subs");A(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,i=this.all();let l;if(s.operation==="subscription"&&(l=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(l=i.find(c=>c.requestSubject===s.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class iu{constructor(t,s){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=mE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new bE,this.muxSubscriptions=new eE,this.outbound=new Qi,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new DS({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new WS(i,{randomize:!t.noRandomize}),this.closed=at(),this.parser=new bg(this),this.heartbeats=new tE(this,this.options.pingInterval||Rb,this.options.maxPingOut||cE)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=me.errorForCode(le.Disconnect);s.stack="",t.forEach(i=>{i.reject(s)}),this.parser=new bg(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new Nt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=at();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=BS(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:Hi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Hi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Or.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Or.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===le.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let i;try{i=Xi(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(l){s.reject(l)}try{await Promise.race([i,s]),i&&i.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw i&&i.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:s}=this.options,i=await t.resolve({fn:fd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let l=null;for(const c of i)try{l=null,this.dispatchStatus({type:Hi.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){l=m}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Db;let i=s;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:me.errorForCode(le.ConnectionRefused));const c=Date.now();if(l.lastConnect===0||l.lastConnect+s<=c){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(m){if(t=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const y=this.options.maxReconnectAttempts||0;y!==-1&&l.reconnects>=y&&this.servers.removeCurrentServer()}}else i=Math.min(i,l.lastConnect+s-c),await Zi(i)}}static async connect(t,s){const i=new iu(t,s);return await i.dialLoop(),i}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new me(t,le.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){i.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new me(t,le.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new me(t,le.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new me(t,le.AccountExpired):s.indexOf("authentication timeout")!==-1?new me(t,le.AuthenticationTimeout):new me(t,le.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(t.sid);i&&(i.received+=1,i.callback&&i.callback(null,new Rd(t,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(t){const s=rg(t),i=iu.toError(s),l={type:Or.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){l.permissionContext=i.permissionContext;const m=this.subscriptions.getMux();c=(m==null?void 0:m.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(i)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(yE)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(rg(t));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Vs(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const y=new gE({version:c,lang:m},this.options,s.nonce);s.headers&&(y.headers=!0,y.no_responders=!0);const g=JSON.stringify(y);this.transport.send(uo(`CONNECT ${g}${Vc}`)),this.transport.send(_g)}catch(y){this._close(y)}}i&&this.dispatchStatus({type:Or.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Or.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case $t.MSG:{const{msg:s,data:i}=t;this.processMsg(s,i);break}case $t.OK:break;case $t.ERR:this.processError(t.data);break;case $t.PING:this.processPing();break;case $t.PONG:this.processPong();break;case $t.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const i=this.outbound.length();let l;typeof t=="string"?l=uo(t):l=t,this.outbound.fill(l,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=gn,i){let l;if(s instanceof Uint8Array)l=s;else if(typeof s=="string")l=Ys.encode(s);else throw me.errorForCode(le.BadPayload);let c=l.length;i=i||{},i.reply=i.reply||"";let m=gn,y=0;if(i.headers){if(this.info&&!this.info.headers)throw new me("headers",le.ServerOptionNotAvailable);m=i.headers.encode(),y=m.length,c=l.length+y}if(this.info&&c>this.info.max_payload)throw me.errorForCode(le.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${t} ${i.reply} ${y} ${c}\r
|
|
40
|
-
`:g=`HPUB ${t} ${y} ${c}\r
|
|
41
|
-
`,this.sendCommand(g,m,l,su)):(i.reply?g=`PUB ${t} ${i.reply} ${c}\r
|
|
42
|
-
`:g=`PUB ${t} ${c}\r
|
|
43
|
-
`,this.sendCommand(g,l,su))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
|
|
44
|
-
`):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
|
|
45
|
-
`)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
|
|
46
|
-
`):this.sendCommand(`UNSUB ${t.sid}\r
|
|
47
|
-
`),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=at()),this.pongs.push(t),this.outbound.fill(_g),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?t.push(`SUB ${i.subject} ${i.queue} ${i.sid}${Vc}`):t.push(`SUB ${i.subject} ${i.sid}${Vc}`)}),t.length&&this.transport.send(uo(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.forEach(i=>{s.push(i.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new qb(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const vE="$SRV";class wg{constructor(t){A(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,s){return this.msg.respond(t,s)}respondError(t,s,i,l){var c,m;return l=l||{},l.headers=l.headers||jr(),(c=l.headers)==null||c.set(eu,`${t}`),(m=l.headers)==null||m.set(Wc,s),this.msg.respond(i,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class go{constructor(t,s="",i=""){A(this,"subject");A(this,"queue");A(this,"srv");s!==""&&_E("service group",s);let l="";if(t instanceof So)this.srv=t,l="";else if(t instanceof go){const c=t;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),l=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,s),this.queue=i}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const i=typeof s=="function"?{handler:s,subject:t}:s;oo("endpoint",t);let{subject:l,handler:c,metadata:m,queue:y}=i;l=l||t,y=y||this.queue,xE("endpoint subject",l),l=this.calcSubject(this.subject,l);const g={name:t,subject:l,queue:y,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(t="",s=""){return new go(this,t,s)}}function xE(r,t){if(t==="")throw new Error(`${r} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((i,l)=>{if(i===">"&&l!==s.length-1)throw new Error(`${r} cannot have internal '>': '${t}'`)})}function _E(r,t){if(t.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${t}'`);t.split(".").forEach(i=>{if(i===">")throw new Error(`${r} name cannot contain internal '>': '${t}'`)})}class So{constructor(t,s={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),oo("name",this.config.name),oo("queue",this.config.queue),Vs(this.config.version),this._id=ps.next(),this.internal=[],this._done=at(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(t,s="",i="",l){const c=l??vE;return s===""&&i===""?`${c}.${t}`:(oo("control subject name",s),i!==""?(oo("control subject id",i),`${c}.${t}.${s}.${i}`):`${c}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const s=jr();if(t instanceof tu){const i=t;s.set(Wc,i.message),s.set(eu,`${i.code}`)}else s.set(Wc,t.message),s.set(eu,"500");return s}setupHandler(t,s=!1){const i=s?"":t.queue?t.queue:this.config.queue,{name:l,subject:c,handler:m}=t,y=t;y.internal=s,s&&this.internal.push(y),y.stats=new wE(l,c,i),y.queue=i;const g=m?(f,d)=>{if(f){this.close(f);return}const b=Date.now();try{m(f,new wg(d))}catch(v){y.stats.countError(v),d==null||d.respond(gn,{headers:this.errorToHeader(v)})}finally{y.stats.countLatency(b)}}:void 0;return y.sub=this.nc.subscribe(c,{callback:g,queue:i}),y.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const d=new Error(`required subscription ${t.subject} errored: ${f.message}`);d.stack=f.stack,this.close(d).catch()}}),y}info(){return{type:fo.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:i,name:l,queue:c}=t;return{subject:s,metadata:i,name:l,queue_group:c}})}async stats(){const t=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}t.push(s.stats.stats(s.qi))}return{type:fo.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const i=`${t}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,t,s),this._doAddInternalHandler(`${i}-kind`,t,s,this.name),this._doAddInternalHandler(`${i}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,i,l="",c=""){const m={};m.name=t,m.subject=So.controlSubject(s,l,c),m.handler=i,this.setupHandler(m,!0)}start(){const t=Vn(),s=(m,y)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(y==null||y.respond(t.encode(g)),Promise.resolve())),i=(m,y)=>m?(this.close(m),Promise.reject(m)):(y==null||y.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),c=(m,y)=>m?(this.close(m).then().catch(),Promise.reject(m)):(y.respond(l),Promise.resolve());return this.addInternalHandler(us.PING,c),this.addInternalHandler(us.STATS,s),this.addInternalHandler(us.INFO,i),this.handlers.forEach(m=>{const{subject:y}=m;typeof y=="string"&&m.handler!==null&&this.setupHandler(m)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:fo.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new go(this,t,s)}addEndpoint(t,s){return new go(this).addEndpoint(t,s)}_addEndpoint(t){const s=new Nt;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(l,c)=>{l?this.stop(l).catch():s.push(new wg(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(t,!1);return i.qi=s,this.handlers.push(i),s}}class wE{constructor(t,s,i=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=it(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:i,num_errors:l,num_requests:c,processing_time:m,last_error:y,data:g,queue:f}=this;return{name:t,subject:s,average_processing_time:i,num_errors:l,num_requests:c,processing_time:m,last_error:y,data:g,queue_group:f}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=it(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class SE{constructor(t,s={strategy:Fn.JitterTimer,maxWait:2e3},i){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=i,this.opts=s}ping(t="",s=""){return this.q(us.PING,t,s)}stats(t="",s=""){return this.q(us.STATS,t,s)}info(t="",s=""){return this.q(us.INFO,t,s)}async q(t,s="",i=""){const l=new Nt,c=Vn(),m=So.controlSubject(t,s,i,this.prefix),y=await this.nc.requestMany(m,gn,this.opts);return(async()=>{for await(const g of y)try{const f=c.decode(g.data);l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(g=>{l.stop(g)}),l}}function Lb(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function EE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Lb(),storage:ld.File}}const au="KV-Operation",Sg="$KV",OE=/^[-/=.\w]+$/,AE=/^[-/=.>*\w]+$/,jE=/^[-\w]+$/;function TE(r){if(r.startsWith(".")||r.endsWith(".")||!OE.test(r))throw new Error(`invalid key: ${r}`)}function kE(r){if(r.startsWith(".")||r.endsWith(".")||!AE.test(r))throw new Error(`invalid key: ${r}`)}function NE(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const t=r.split(".");let s=!1;for(let i=0;i<t.length;i++)switch(t[i]){case"*":s=!0;break;case">":if(i!==t.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Yc(r){if(!jE.test(r))throw new Error(`invalid bucket name: ${r}`)}var Zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Zn||(Zn={}));class bo{constructor(t,s,i){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",TE);A(this,"validateSearchKey",kE);A(this,"hasWildcards",NE);Yc(t),this.js=s,this.jsm=i,this.bucket=t,this.prefix=Sg,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,i={}){Yc(s);const l=await t.jetstreamManager(),c=new bo(s,t,l);return await c.init(i),c}static async bind(t,s,i={}){const l=await t.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};Yc(s);const m=new bo(s,t,l);return c.config.name=i.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=i.codec||Lb(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(t={}){const s=Object.assign(EE(),t);this.codec=s.codec;const i={};this.stream=i.name=t.streamName??this.bucketName(),i.retention=od.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(i.placement=t.placement),t.republish&&(i.republish=t.republish),t.description&&(i.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(dn)||(b.name=`${dn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(t.sources){const b=t.sources.map(v=>{const x=Object.assign({},v),w=x.name.startsWith(dn)?x.name.substring(dn.length):x.name;return x.name.startsWith(dn)||(x.name=`${dn}${x.name}`),!v.external&&w!==this.bucket&&(x.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),x});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?ys.S2:ys.None);const c=this.js.nc,m=c.getServerVersion(),y=m?ud(m,Vs("2.7.2"))>=0:!1;i.discard=y?yo.New:yo.Old;const{ok:g,min:f}=c.features.get(Ie.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=m?`${m.major}.${m.minor}.${m.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,i.allow_direct=t.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=it(s.ttl)),i.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(i.name),!d.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")d=await this.jsm.streams.add(i);else throw b}this.initializePrefixes(d)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=t.config;if(s){let i=s.name;if(i.startsWith(dn)&&(i=i.substring(dn.length)),s.external&&s.external.api!==""){const l=s.name.substring(dn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${dn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(t),i.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${Sg}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(t,s){const i=s&&s.get(Gt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):t.length}smToEntry(t){return new FE(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new VE(this.bucket,s,t)}async create(t,s){var c;let i;try{const m=await this.put(t,s,{previousSeq:0});return Promise.resolve(m)}catch(m){if(i=m,((c=m==null?void 0:m.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(m)}let l=0;try{const m=await this.get(t);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(l=m!==null?m.revision:0,this.update(t,s,l)):Promise.reject(i)}catch(m){return Promise.reject(m)}}update(t,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:i})}async put(t,s,i={}){var m,y;const l=this.encodeKey(t);this.validateKey(l);const c={};if(i.previousSeq!==void 0){const g=jr();c.headers=g,g.set(Zn.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),s,c)).seq}catch(g){const f=g;return f.isJetStreamError()?(f.message=(m=f.api_error)==null?void 0:m.description,f.code=`${(y=f.api_error)==null?void 0:y.code}`,Promise.reject(f)):Promise.reject(g)}}async get(t,s){const i=this.encodeKey(t);this.validateKey(i);let l={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(l={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),l):c=await this.jsm.streams.getMessage(this.bucketName(),l);const m=this.smToEntry(c);return m.key!==i?null:m}catch(m){if(m.code===le.JetStream404NoMessages)return null;throw m}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=at(),i=[],l=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of l)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,l.stop();const c=Date.now()-t,m=i.map(g=>{const f=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),y=await Promise.all(m);return y.unshift({success:!0,purged:0}),y.reduce((g,f)=>(g.purged+=f.purged,g))}async _deleteOrPurge(t,s,i){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,i);const l=await this.keys(t),c=[];for await(const m of l)c.push(this._doDeleteOrPurge(m,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,s,i){const l=this.encodeKey(t);this.validateKey(l);const c=jr();c.set(au,s),s==="PURGE"&&c.set(Gt.RollupHdr,Gt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(Zn.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),gn,{headers:c})}_buildCC(t,s,i={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const f=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(f)}),m=bt.LastPerSubject;s===$n.AllHistory&&(m=bt.All),s===$n.UpdatesOnly&&(m=bt.New);let y;return c.length===1&&(y=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:Tt.None,filter_subjects:c,filter_subject:y,flow_control:!0,idle_heartbeat:it(5*1e3)},i)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",i=new Nt,l={};l.headers_only=t.headers_only||!1;let c;c=()=>{i.stop()};let m=0;const y=this._buildCC(s,$n.AllHistory,l),g=y.filter_subject,f=hs(y);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,v)=>{if(b){i.stop(b);return}if(v){const x=this.jmToEntry(v);i.push(x),i.received++,(c&&m>0&&i.received>=m||v.info.pending===0)&&(i.push(c),c=void 0)}});const d=await this.js.subscribe(g,f);if(c){const{info:{last:b}}=d,v=b.num_pending+b.delivered.consumer_seq;if(v===0||i.received>=v)try{c()}catch(x){i.stop(x)}finally{c=void 0}else m=v}return i._data=d,i.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);return i}async watch(t={}){const s=t.key??">",i=new Nt,l={};l.headers_only=t.headers_only||!1;let c=$n.LastValue;t.include===$n.AllHistory?c=$n.AllHistory:t.include===$n.UpdatesOnly&&(c=$n.UpdatesOnly);const m=t.ignoreDeletes===!0;let y=t.initializedFn,g=0;const f=this._buildCC(s,c,l),d=f.filter_subject,b=hs(f);this.canSetWatcherName()&&b.consumerName(ps.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((x,w)=>{if(x){i.stop(x);return}if(w){const S=this.jmToEntry(w);if(m&&S.operation==="DEL")return;i.push(S),i.received++,y&&(g>0&&i.received>=g||w.info.pending===0)&&(i.push(y),y=void 0)}});const v=await this.js.subscribe(d,b);if(y){const{info:{last:x}}=v,w=x.num_pending+x.delivered.consumer_seq;if(w===0||i.received>=w)try{y()}catch(S){i.stop(S)}finally{y=void 0}else g=w}return i._data=v,i.iterClosed.then(()=>{v.unsubscribe()}),v.closed.then(()=>{i.stop()}).catch(x=>{i.stop(x)}),i}async keys(t=">"){const s=new Nt,i=this._buildCC(t,$n.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":i.filter_subject,c=hs(i);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(l,c);return(async()=>{var g;for await(const f of m){const d=(g=f.headers)==null?void 0:g.get(au);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));s.push(b)}f.info.pending===0&&m.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),l=await this.jsm.streams.info(i);return new Bb(l,s)}}class Bb{constructor(t,s=""){A(this,"si");A(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(dn)?this.si.config.name.substring(dn.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Md(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==ys.None:!1}}const qd="OBJ_",Eg="SHA-256=";function CE(r){return Yc(r),`${qd}${r}`}function ME(r){return r.startsWith(qd)?r.substring(4):r}class md{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return ME(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==ys.None:!1}}function Wl(r){if(r===void 0)return;const{domain:t}=r;if(t===void 0)return r;const s=Object.assign({},r);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var Mn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(Mn||(Mn={}));var Wn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(Wn||(Wn={}));var Yi;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Yi||(Yi={}));const Og=Uint8Array.of(43,65,67,75),RE=Uint8Array.of(45,78,65,75),Qa=Uint8Array.of(43,87,80,73),DE=Uint8Array.of(43,78,88,84),qE=Uint8Array.of(43,84,69,82,77),LE=Uint8Array.of(32);function vo(r,t=5e3){return new WE(r,t)}class Gh extends Nt{constructor(s,i,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,l),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Ar(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:l,threshold_bytes:c,threshold_messages:m}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:y}=this;y&&y.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,f)=>{var b,v,x,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(ad(f))return;const S=(v=f.headers)==null?void 0:v.code,M=((w=(x=f.headers)==null?void 0:x.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:L,bytesLeft:U}=this.parseDiscard(f.headers);if(L>0||U>0)this.pending.msgs-=L,this.pending.bytes-=U,this.pending.requests--,this.notify(Yi.Discard,{msgsLeft:L,bytesLeft:U});else if(S===400){this.stop(new me(M,`${S}`));return}else if(S===409&&M==="consumer deleted"){if(this.notify(Wn.ConsumerDeleted,`${S} ${M}`),!this.refilling||this.abortOnMissingResource){const re=new me(M,`${S}`);this.stop(re);return}}else if(S===503){if(this.notify(Wn.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const re=new me("no responders",`${S}`);this.stop(re);return}}else this.notify(Yi.DebugEvent,`${S} ${M}`)}else this._push(vo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=m||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Dd(l,g=>(this.notify(Wn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case Or.Disconnect:(f=this.monitor)==null||f.cancel();break;case Or.Reconnect:this.resetPending().then(b=>{var v;b&&((v=this.monitor)==null||v.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(l){this.stop(l)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:s,data:i})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,i=0;const l=Cd([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(m){if(m.message==="stream not found"){if(i++,this.notify(Wn.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(s++,this.notify(Wn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(m),!1;if(this.forOrderedConsumer)return!1}else s=0,i=0;this.inBackOff=!0;const y=l.backoff(c),g=Zi(y);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Yi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,l=it(this.opts.idle_heartbeat),c=it(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:l,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},l=s==null?void 0:s.get(Gt.PendingMessagesHdr);l&&(i.msgsLeft=parseInt(l));const c=s==null?void 0:s.get(Gt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,l;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const l=s||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,i){const c=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||c;const m=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||m}return l}status(){const s=new Nt;return this.listeners.push(s),Promise.resolve(s)}}class BE extends Nt{constructor(){super();A(this,"src");A(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const l of i)this.notify(l.type,l.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Nt;return this.listeners.push(s),Promise.resolve(s)}}class pd{constructor(t,s){A(this,"api");A(this,"_info");A(this,"stream");A(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Gh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new Gh(this,t,!1),i=Math.round(s.opts.expires*1.05),l=Xi(i);return s.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{s.close().catch()}),s.trackTimeout(l),Promise.resolve(s)}next(t={expires:3e4}){const s=at(),i=t;i.max_messages=1;const l=new Gh(this,i,!1),c=Math.round(l.opts.expires*1.05);c>=6e4&&(async()=>{for await(const y of await l.status())if(y.type===Wn.HeartbeatsMissed&&y.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const y of l){s.resolve(y);break}})().catch(()=>{});const m=Xi(c);return l.closed().then(y=>{y?s.reject(y):s.resolve(null)}).catch(y=>{s.reject(y)}).finally(()=>{m.cancel()}),m.catch(y=>{s.resolve(null),l.close().catch()}),l.trackTimeout(m),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(l=>(this._info=l,this._info))}}class PE{constructor(t,s,i={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=ps.next(),typeof i.name_prefix=="string"&&(pu("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Mn.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const i={name:s,deliver_policy:bt.StartSequence,opt_start_seq:t,ack_policy:Tt.None,inactive_threshold:it(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||bt.StartSequence,(this.consumerOpts.deliver_policy===bt.LastPerSubject||this.consumerOpts.deliver_policy===bt.New||this.consumerOpts.deliver_policy===bt.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===bt.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=bt.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=it(this.consumerOpts.inactive_threshold))),i}async resetConsumer(t=0){var m,y,g,f,d;ps.next();const s=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(t);i.max_deliver=1,i.mem_storage=!0;const l=Cd([((y=this.opts)==null?void 0:y.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(Wn.OrderedConsumerRecreated,c.name);break}catch(v){if(v.message==="stream not found"&&((f=this.iter)==null||f.notify(Wn.StreamNotFound,b),this.type===Mn.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(v),Promise.reject(v);if(s&&b>=this.maxInitialReset)throw v;await Zi(l.backoff(b+1))}return c}internalHandler(t){return s=>{var l;if(this.serial!==t)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(l=this.iter)==null||l.push(s)}}async reset(t={max_messages:100,expires:3e4},s){var g,f;s=s||{};const i=s.fromFetch||!1,l=s.orderedReset||!1;if(this.type===Mn.Fetch&&l){(g=this.iter)==null||g.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new BE),this.consumer=new pd(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let m=null;this.type===Mn.Fetch&&i?m=await this.consumer.fetch(t):this.type===Mn.Consume&&(m=await this.consumer.consume(t));const y=m;y.forOrderedConsumer=!0,y.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(y)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(Yi.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Mn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Mn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Mn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Mn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Mn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=at();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class yd{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ie.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new pd(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new pd(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(t,s){await this.checkVersion();const i=this.api;return new Ld(i.nc,i.opts).info(t).then(c=>Promise.resolve(new PE(this.api,t,s))).catch(c=>Promise.reject(c))}}class gu{constructor(t,s){A(this,"api");A(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new gu(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(t){return new yd(new ru(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new yd(new ru(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class Ld extends wo{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:l,ok:c}=s.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:c}=s.features.get(Ie.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:c}=s.features.get(Ie.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:c}=s.features.get(Ie.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:c}=s.features.get(Ie.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function i(l,c){var y;if((((y=c==null?void 0:c.subject_transforms)==null?void 0:y.length)||0)>0){const{min:g,ok:f}=s.features.get(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${l} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(l=>{i("stream sources",l)}),t.mirror&&i("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),It(t.name),t.mirror=Wl(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(Wl);const i=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(i),i}async delete(t){return It(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var y;if(typeof t=="object"){const g=t;t=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),It(t);const i=await this.info(t),l=Object.assign(i.config,s);l.mirror=Wl(l.mirror),l.sources=(y=l.sources)==null?void 0:y.map(Wl);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(m),m}async info(t,s){It(t);const i=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(i,s),{total:m,limit:y}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const f=[c],d=s||{};let b=0;for(;m>g;){b++,d.offset=y*b;const x=await this._request(i,d);m=x.total,f.push(x);const w=Object.getOwnPropertyNames(x.state.subjects).length;if(g+=w,w<y)break}let v={};for(let x=0;x<f.length;x++)c=f[x],c.state.subjects&&(v=Object.assign(v,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=v}return this._fixInfo(c),c}list(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>{const m=c;return m.streams.forEach(y=>{this._fixInfo(y)}),m.streams},l=`${this.prefix}.STREAM.LIST`;return new lo(l,i,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:l,seq:c}=s;if(typeof l=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return It(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,i=!0){It(t);const l={seq:s};return i||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,s){It(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new Pb(l)}find(t){return this.findStream(t)}listKvs(){const t=i=>{var g;const c=i.streams.filter(f=>f.config.name.startsWith(dn));c.forEach(f=>{this._fixInfo(f)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(f=>new Bb(f,m))},s=`${this.prefix}.STREAM.LIST`;return new lo(s,t,this)}listObjectStores(){const t=i=>{const c=i.streams.filter(y=>y.config.name.startsWith(qd));return c.forEach(y=>{this._fixInfo(y)}),c.map(y=>new md(y))},s=`${this.prefix}.STREAM.LIST`;return new lo(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>c.streams,l=`${this.prefix}.STREAM.NAMES`;return new lo(l,i,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new gu(this,s))}}class UE extends wo{constructor(t,s){super(t,s)}async getMessage(t,s){It(t);let i=s;const{last_by_subj:l}=i;l&&(i=null);const c=i?this.jc.encode(i):gn,m=this.opts.apiPrefix||"$JS.API",y=l?`${m}.DIRECT.GET.${t}.${l}`:`${m}.DIRECT.GET.${t}`,g=await this.nc.request(y,c,{timeout:this.timeout}),f=Fi(g);if(f)return Promise.reject(f);const d=new gd(g);return Promise.resolve(d)}async getBatch(t,s){It(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,f)=>g==="up_to_time"&&f instanceof Date?f.toISOString():f),m=new Nt,y=await this.nc.requestMany(l,c,{strategy:Fn.SentinelMsg});return(async()=>{var b,v,x;let g=!1,f=!1,d;for await(const w of y){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){d=(v=w.headers)==null?void 0:v.description.toLowerCase();break}if(((x=w.headers)==null?void 0:x.get("Nats-Num-Pending"))===""){f=!0;break}}if(w.data.length===0)break;m.push(new gd(w))}m.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(d)throw new Error(`bad request: ${d}`);m.stop()})})(),Promise.resolve(m)}}class gd{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Ii.Subject)}get seq(){const t=this.header.last(Ii.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ii.TimeStamp)}get stream(){return this.header.last(Ii.Stream)}json(t){return Vn(t).decode(this.data)}string(){return mn.decode(this.data)}}A(gd,"jc");class zE extends wo{constructor(s,i){super(s,i);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new Ld(s,i),this.consumers=new ru(s,i),this.direct=new UE(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Nt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,l)=>{if(i)throw i;try{const c=this.parseJsResponse(l),m=c.type.split("."),y=m[m.length-1];s.push({kind:y,data:c})}catch(c){s.stop(c)}}}),s}}class Pb{constructor(t){A(this,"_header");A(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):gn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=fs.decode(t)}else this._header=jr();return this._header}_parse(t){const s=atob(t),i=s.length,l=new Uint8Array(i);for(let c=0;c<i;c++)l[c]=s.charCodeAt(c);return l}json(t){return Vn(t).decode(this.data)}string(){return mn.decode(this.data)}}A(Pb,"jc");class IE{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new gu(this.api,s))}}class Fh{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=fs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function Ag(r){const t={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;t.headers=s.toRecord()}return t}function $E(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class mo{constructor(t,s,i){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=t,this.jsm=s,this.js=i}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new Fh(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;t.push(i)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:i}=this._checkNotEmpty(t);if(i)return Promise.reject(i);const l=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),y=Vn().decode(c.data);return y.revision=c.seq,y}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new md(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new md(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,s,i){var ce;const l=this.js.getOptions();i=i||{timeout:l.timeout},i.timeout=i.timeout||l.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:m}=i,y=this.js.nc.info,g=(y==null?void 0:y.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((ce=t.options)==null?void 0:ce.max_chunk_size)||128*1024;f=f>g?g:f,t.options.max_chunk_size=f;const d=await this.info(t.name),{name:b,error:v}=this._checkNotEmpty(t.name);if(v)return Promise.reject(v);const x=ps.next(),w=this._chunkSubject(x),S=this._metaSubject(b),M=Object.assign({bucket:this.name,nuid:x,size:0,chunks:0},Ag(t)),L=at(),U=[],re=new Qi;try{const C=s?s.getReader():null,P=pg.create();for(;;){const{done:se,value:X}=C?await C.read():{done:!0,value:void 0};if(se){if(re.size()>0){const J=re.drain();P.update(J),M.chunks++,M.size+=J.length,U.push(this.js.publish(w,J,{timeout:c}))}await Promise.all(U),U.length=0,M.mtime=new Date().toISOString();const B=Vi.encode(P.digest());M.digest=`${Eg}${B}`,M.deleted=!1;const G=jr();typeof m=="number"&&G.set(Zn.ExpectedLastSubjectSequenceHdr,`${m}`),G.set(Gt.RollupHdr,Gt.RollupValueSubject);const W=await this.js.publish(S,Vn().encode(M),{headers:G,timeout:c});if(M.revision=W.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}L.resolve(new Fh(M));break}if(X)for(re.fill(X);re.size()>f;){M.chunks++,M.size+=f;const B=re.drain(t.options.max_chunk_size);P.update(B),U.push(this.js.publish(w,B,{timeout:c}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:w}),L.reject(C)}return L}putBlob(t,s,i){function l(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,l(s),i)}put(t,s,i){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,i)}async getBlob(t){async function s(c){const m=new Qi,y=c.getReader();for(;;){const{done:g,value:f}=await y.read();if(g)return m.drain();f&&f.length&&m.fill(f)}}const i=await this.get(t);if(i===null)return Promise.resolve(null);const l=await Promise.all([i.error,s(i.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await mo.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(Eg))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=cd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const l=at(),c={info:new Fh(s),error:l};if(s.size===0)return c.data=$E(),l.resolve(null),Promise.resolve(c);let m;const y=hs();y.orderedConsumer();const g=pg.create(),f=`$O.${this.name}.C.${s.nuid}`,d=await this.js.subscribe(f,y);return(async()=>{for await(const b of d)b.data.length>0&&(g.update(b.data),m.enqueue(b.data)),b.info.pending===0&&(NS(i,g.digest())?m.close():m.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),d.unsubscribe())})().then(()=>{l.resolve()}).catch(b=>{m.error(b),l.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(t,s){if(!(s instanceof mo))return Promise.reject("bucket required");const i=s,{name:l,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const m={name:l,options:{link:{bucket:i.name}}};return this._put(m,null)}async link(t,s){const{name:i,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const m={bucket:s.bucket,name:s.name},y={name:i,bucket:s.bucket,options:{link:m}};await this.js.publish(this._metaSubject(t),JSON.stringify(y));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Vn(),l=jr();return l.set(Gt.RollupHdr,Gt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(t,s={}){const i=await this.rawInfo(t);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:l,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(t!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=l;const m=Object.assign({},i,Ag(s)),y=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return t!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(y)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let s=!1;const i=new Nt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Vn(),m=hs();m.orderedConsumer(),t.includeHistory?m.deliverLastPerSubject():(s=!0,m.deliverNew()),m.callback((g,f)=>{var d;if(g){i.stop(g);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||i.push(b),((d=f.info)==null?void 0:d.pending)===0&&!s&&(s=!0,i.push(null))}});const y=await this.js.subscribe(l,m);return i._data=y,i.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Vi.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=CE(this.name)}catch(l){return Promise.reject(l)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const i=Object.assign({max_age:s},t);i.name=this.stream,i.num_replicas=t.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=yo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(i.placement=t.placement),t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?ys.S2:ys.None);try{await this.jsm.streams.info(i.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(t,s,i={}){const l=await t.jetstreamManager(),c=new mo(s,l,t);return await c.init(i),Promise.resolve(c)}}class HE{constructor(t){A(this,"js");this.js=t}kv(t,s={}){const i=this.js,{ok:l,min:c}=i.nc.features.get(Ie.JS_KV);return l?s.bindOnly?bo.bind(this.js,t,s):bo.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,s={}){var m;if(typeof((m=crypto==null?void 0:crypto.subtle)==null?void 0:m.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const i=this.js,{ok:l,min:c}=i.nc.features.get(Ie.JS_OBJECTSTORE);return l?mo.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class Bd extends wo{constructor(s,i){super(s,i);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new ru(s,i),this.streamAPI=new Ld(s,i),this.consumers=new yd(this.consumerAPI),this.streams=new IE(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new HE(this)}async publish(s,i=gn,l){l=l||{},l.expect=l.expect||{};const c=(l==null?void 0:l.headers)||jr();l&&(l.msgID&&c.set(Zn.MsgIdHdr,l.msgID),l.expect.lastMsgID&&c.set(Zn.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&c.set(Zn.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&c.set(Zn.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&c.set(Zn.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const m=l.timeout||this.timeout,y={};m&&(y.timeout=m),l&&(y.headers=c);let{retries:g,retry_delay:f}=l;g=g||1,f=f||250;let d;for(let v=0;v<g;v++)try{d=await this.nc.request(s,i,y);break}catch(x){if(x.code==="503"&&v+1<g)await Zi(f);else throw x}const b=this.parseJsResponse(d);if(b.stream==="")throw me.errorForCode(le.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,l=0){It(s),Gi(i);let c=this.timeout;l>c&&(c=l),l=l<0?0:it(l);const m={batch:1,no_wait:l===0,expires:l},y=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Fi(y);if(g)throw g;return vo(y,this.timeout)}fetch(s,i,l={}){It(s),Gi(i);let c=null;const m=(l.max_bytes??0)>0;let y=0;const g=m?l.max_bytes:0;let f=null;const d={};if(d.batch=l.batch||1,g){const U=this.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!U.ok)throw new Error(`max_bytes is only supported on servers ${U.min} or better`);d.max_bytes=g}d.no_wait=l.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=l.expires||0;if(b&&(d.expires=it(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const v=l.idle_heartbeat||0;v&&(d.idle_heartbeat=it(v),l.delay_heartbeat===!0&&(d.idle_heartbeat=it(v*4)));const x=new Nt,w=d.batch;let S=0;x.protocolFilterFn=(U,re=!1)=>ad(U.msg)?(f==null||f.work(),!1):!0,x.dispatchedFn=U=>{if(U){if(m&&(y+=U.data.length),S++,c&&U.info.pending===0)return;(x.getPending()===1&&U.info.pending===0||w===S||g>0&&y>=g)&&x.stop()}};const M=Ar(this.nc.options.inboxPrefix),L=this.nc.subscribe(M,{max:l.batch,callback:(U,re)=>{U===null&&(U=Fi(re)),U!==null?(c&&(c.cancel(),c=null),fS(U)?x.stop(zb(U)===null?void 0:U):x.stop(U)):(f==null||f.work(),x.received++,x.push(vo(re,this.timeout)))}});return b&&(c=Xi(b),c.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{v&&(f=new Dd(v,U=>(x.push(()=>{x.err=new me(`${Rn.IdleHeartbeatMissed}: ${U}`,le.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),x.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{reply:M}),x}async pullSubscribe(s,i=hs()){const l=await this._processOptions(s,i);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=l.config.ack_policy;if(c===Tt.None||c===Tt.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(l),y=new YE(this,l.deliver,m);y.info=l;try{await this._maybeCreateConsumer(l)}catch(g){throw y.unsubscribe(),g}return y}async subscribe(s,i=hs()){const l=await this._processOptions(s,i);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(l),m=new Ub(this,l.deliver,c);m.info=l;try{await this._maybeCreateConsumer(l)}catch(y){throw m.unsubscribe(),y}return m._maybeSetupHbMonitoring(),m}async _processOptions(s,i=hs()){const l=fg(i)?i.getOpts():i;if(l.isBind=fg(i)?i.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==Tt.NotSet&&l.config.ack_policy!==Tt.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",le.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",le.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",le.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",le.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",le.ApiError);l.config.deliver_subject=Ar(this.nc.options.inboxPrefix),l.config.ack_policy=Tt.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||it(5e3),l.config.ack_wait=it(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===Tt.NotSet&&(l.config.ack_policy=Tt.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(s),l.attached=!1,l.config.durable_name)try{const c=await this.consumerAPI.info(l.stream,l.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const m=l.config.deliver_group??"";if(m===""&&c.push_bound===!0)throw new Error("duplicate subscription");const y=c.config.deliver_group??"";if(m!==y)throw y===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${y}'`);l.last=c,l.config=c.config,l.attached=!0,l.config.durable_name||(l.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=s),l.deliver=l.config.deliver_subject||Ar(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=KE(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=Bd.ingestionFn(s.ordered),i.protocolFilterFn=(l,c=!1)=>{const m=l;return id(m.msg)?(c||m.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Tt.None&&(i.dispatchedFn=QE),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:bt.All,ack_policy:Tt.Explicit,ack_wait:it(30*1e3),replay_policy:Ji.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,l)=>{var g;const c=l;if(!i)return{ingest:!1,protocol:!1};const m=i;if(Fi(m.msg)||(g=c.monitor)==null||g.work(),ad(m.msg)){const f=s?c._checkHbOrderConsumer(m.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(id(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class Pd{constructor(t){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=hE(t),this.listeners=[]}static connect(t={}){return new Promise((s,i)=>{const l=new Pd(t);iu.connect(l.options,l).then(c=>{l.protocol=c,(async function(){for await(const m of c.status())l.listeners.forEach(y=>{y.push(m)})})(),s(l)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,i){if(this.isClosed())throw me.errorForCode(le.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw me.errorForCode(le.ConnectionDraining);if(t=t||"",t.length===0)throw me.errorForCode(le.BadSubject)}publish(t,s,i){this._check(t,!1,!0),this.protocol.publish(t,s,i)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const i=new qb(this.protocol,t,s);return this.protocol.subscribe(i),i}_resub(t,s,i){this._check(s,!0,!1);const l=t;l.max=i,i&&(l.max=i+l.received),this.protocol.resub(l,s)}requestMany(t,s=gn,i={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Fn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new me("timeout",le.InvalidOption));const c=new Nt;function m(g){c.push(()=>{c.stop(g)})}function y(g,f){g||f===null?m(g===null?void 0:g):c.push(f)}if(i.noMux){const g=l?new Error().stack:null;let f=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const d=this.subscribe(Ar(this.options.inboxPrefix),{callback:(w,S)=>{var M,L;if(((M=S==null?void 0:S.data)==null?void 0:M.length)===0&&((L=S==null?void 0:S.headers)==null?void 0:L.status)===le.NoResponders&&(w=me.errorForCode(le.NoResponders)),w){g&&(w.stack+=`
|
|
48
|
-
|
|
49
|
-
${g}`),b(w);return}y(null,S),i.strategy===Fn.Count&&(f--,f===0&&b()),i.strategy===Fn.JitterTimer&&(x(),v=setTimeout(()=>{b()},300)),i.strategy===Fn.SentinelMsg&&S&&S.data.length===0&&b()}});d.requestSubject=t,d.closed.then(()=>{m()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),x(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{x(),d==null||d.unsubscribe()}).catch(w=>{x(),d==null||d.unsubscribe()});try{this.publish(t,s,{reply:d.getSubject()})}catch(w){b(w)}let v=setTimeout(()=>{b()},i.maxWait);const x=()=>{v&&clearTimeout(v)}}else{const g=i;g.callback=y,c.iterClosed.then(()=>{f.cancel()}).catch(d=>{f.cancel(d)});const f=new CS(this.protocol.muxSubscriptions,t,g);this.protocol.request(f);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:i.headers})}catch(d){f.cancel(d)}}return Promise.resolve(c)}request(t,s,i={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const l=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new me("timeout",le.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new me("reply can only be used with noMux",le.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Ar(this.options.inboxPrefix),m=at(),y=l?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(f,d)=>{f?(y&&f.code!==le.Timeout&&(f.stack+=`
|
|
50
|
-
|
|
51
|
-
${y.stack}`),g.unsubscribe(),m.reject(f)):(f=Ab(d),f?(y&&(f.stack+=`
|
|
52
|
-
|
|
53
|
-
${y.stack}`),m.reject(f)):m.resolve(d))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:c,headers:i.headers}),m}else{const c=new kb(this.protocol.muxSubscriptions,t,i,l);this.protocol.request(c);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(y){c.cancel(y)}const m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Nt;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new zE(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const l=i;throw l.code===le.NoResponders&&(l.code=le.JetStreamNotEnabled),l}return s}jetstream(t={}){return new Bd(this,t)}getServerVersion(){const t=this.info;return t?Vs(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(le.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new GE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):this.protocol.reconnect()}}class GE{constructor(t){A(this,"nc");this.nc=t}add(t){try{return new So(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new SE(this.nc,t,s)}}class FE{constructor(t,s,i){A(this,"bucket");A(this,"sm");A(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=i}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(au)||"PUT"}get length(){const t=this.sm.header.get(Gt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class VE{constructor(t,s,i){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=t,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(Md(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(au))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Gt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ub extends qS{constructor(s,i,l){super(s.nc,i,l);A(this,"js");A(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const i=Ar(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=ps.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=bt.StartSequence,c.config.opt_start_seq=s;const m={};m.stream_name=this.info.stream,m.config=c.config;const y=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(y,m,{retries:-1}).then(g=>{const f=g,d=this.sub.info;d.last=f,this.info.config=f.config,this.info.name=f.name}).catch(g=>{const f=new me(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,le.RequestError,g);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var i,l;const s=((l=(i=this.info)==null?void 0:i.config)==null?void 0:l.idle_heartbeat)||0;s&&this._setupHbMonitoring(Md(s))}_setupHbMonitoring(s,i=0){const l={cancelAfter:0,maxOut:2};i&&(l.cancelAfter=i);const c=this.sub,m=y=>{var d,b,v,x;const g=pS(409,`${Rn.IdleHeartbeatMissed}: ${y}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const w=((v=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:v.stream_seq)||0;return this._resetOrderedConsumer(w+1),(x=this.monitor)==null||x.restart(),!1}return!c.noIterator};this.monitor=new Dd(s,m,l)}_checkHbOrderConsumer(s){const i=s.headers.get(Gt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const l=parseInt(s.headers.get(Gt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,l=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,l=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(l)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,l=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(l);return s.last=c,c}}class YE extends Ub{constructor(t,s,i){super(t,s,i)}pull(t={batch:1}){const{stream:s,config:i,name:l}=this.sub.info,c=i.durable_name??l,m={};if(m.batch=t.batch||1,m.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);m.max_bytes=t.max_bytes}let y=0;t.expires&&t.expires>0&&(y=t.expires,m.expires=it(y));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,m.idle_heartbeat=it(g)),g&&y===0)throw new Error("idle_heartbeat requires expires");if(g>y)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),y&&g&&(this.monitor?this.monitor._change(g,y):this._setupHbMonitoring(g,y));const f=this.info.api,d=`${f.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;f.nc.publish(d,f.jc.encode(m),{reply:b})}}}function KE(r,t){return r?JE(t):XE(t)}function XE(r){return(t,s)=>t?[t,null]:(t=Fi(s),t?[t,null]:[null,vo(s,r)])}function JE(r){return(t,s)=>{if(t)return[t,null];const i=Fi(s);return i!==null?[zb(i),null]:[null,vo(s,r)]}}function zb(r){if(r!==null)switch(r.code){case le.JetStream404NoMessages:case le.JetStream408RequestTimeout:return null;case le.JetStream409:return yS(r)?r:null;default:return r}return null}function QE(r){r&&r.ack()}function ZE(r){const t=r.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class WE{constructor(t,s){A(this,"msg");A(this,"di");A(this,"didAck");A(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=ZE(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Qa[0]&&t[1]===Qa[1]&&t[2]===Qa[2]&&t[3]===Qa[3]}async ackAck(t){var i;t=t||{},t.timeout=t.timeout||this.timeout;const s=at();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,m=!((i=c.options)!=null&&i.noAsyncTraces),y=new kb(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},m);c.request(y);try{c.publish(this.msg.reply,Og,{reply:`${c.muxSubscriptions.baseInbox}${y.token}`})}catch(g){y.cancel(g)}try{await Promise.race([y.timer,y.deferred]),s.resolve(!0)}catch(g){y.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(Og)}nak(t){let s=RE;t&&(s=sd().encode(`-NAK ${JSON.stringify({delay:it(t)})}`)),this.doAck(s)}working(){this.doAck(Qa)}next(t,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=it(s.expires));const l=Vn().encode(i),c=Qi.concat(DE,LE,l),m=t?{reply:t}:void 0;this.msg.respond(c,m)}term(t=""){let s=qE;(t==null?void 0:t.length)>0&&(s=sd().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const e2="1.30.3",t2="nats.ws";class n2{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=e2,this.lang=t2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=at(),this.closedNotification=at()}async connect(t,s){const i=at();if(s.tls)return i.reject(new me("tls",le.InvalidOption)),i;this.options=s;const l=t.src;if(s.wsFactory){const{socket:c,encrypted:m}=await s.wsFactory(t.src,s);this.socket=c,this.encrypted=m}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const m=Qi.concat(...this.yields),y=IS(m);if(y!==""){const g=pE.exec(y);if(!g){s.debug&&console.error("!!!",Jl(m)),i.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(g[1]);dE(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(f){i.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let m;this.done||(c.wasClean||(m=new Error(c.reason)),this._closed(m))},this.socket.onerror=c=>{if(this.isDiscarded())return;const m=c,y=new me(m.message,le.Unknown,new Error(m.error));i.reject(y)},i}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Zi(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${Jl(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=at())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${Jl(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${Jl(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function r2(r,t){/^(.*:\/\/)(.*)/.test(r)||(typeof t=="boolean"?r=`${t===!0?"https":"http"}://${r}`:r=`https://${r}`);let i=new URL(r);const l=i.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${r}`));let c,m;const y=i.hostname,g=i.pathname,f=i.search||"";switch(l){case"http:":case"ws:":case"nats:":m=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":m=i.port||"443",c="wss:";break;default:m=i.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${y}:${m}${g}${f}`}function s2(r={}){return LS({defaultPort:443,urlParseFn:r2,factory:()=>new n2}),Pd.connect(r)}const i2=null,a2=null,Ht="lt.events";function Ib(r,t){const s=r.split("."),i=t.split(".");for(let l=0;l<i.length;l++){const c=i[l];if(c===">")return!0;if(l>=s.length||c!=="*"&&c!==s[l])return!1}return s.length===i.length}const Wi=j.createContext({connected:!1,subscribe:()=>()=>{}});function o2(){const{connected:r}=j.useContext(Wi);return{connected:r}}function yn(r,t){const{subscribe:s}=j.useContext(Wi),i=j.useRef(t);i.current=t,j.useEffect(()=>s(r,c=>i.current(c)),[s,r])}function Ks(r,t){const{subscribe:s}=j.useContext(Wi),i=j.useRef(t);i.current=t;const l=r.join(","),c=j.useMemo(()=>l.split(",").filter(Boolean),[l]);j.useEffect(()=>{const m=g=>i.current(g),y=c.map(g=>s(g,m));return()=>y.forEach(g=>g())},[s,c])}const l2=j.createContext({connected:!1,subscribe:()=>()=>{}}),c2=sd();function u2({children:r,url:t,token:s}){const i=j.useRef(null),[l,c]=j.useState(!1),m=j.useRef(null),y=j.useRef(new Map),g=j.useRef(new Map),f=j.useCallback((x,w)=>{(async()=>{for await(const S of w)try{if(!Ib(S.subject,x))continue;const M=JSON.parse(c2.decode(S.data)),L=y.current.get(x);if(!L)continue;for(const U of L)try{U(M)}catch{}}catch{}})()},[]),d=j.useCallback(x=>{var S;const w=i.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||g.current.has(x)))try{const M=w.subscribe(x);g.current.set(x,M),f(x,M)}catch{}},[f]),b=j.useCallback((x,w)=>{const S=y.current;return S.has(x)||S.set(x,new Set),S.get(x).add(w),d(x),()=>{const M=S.get(x);if(M&&(M.delete(w),M.size===0)){S.delete(x);const L=g.current.get(x);if(L){g.current.delete(x);try{L.unsubscribe()}catch{}}}}},[d]),v=j.useCallback(async()=>{try{if(i.current)return;const x=t||i2;if(!x){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await s2({servers:x,token:s||a2||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});i.current=w,c(!0);for(const S of y.current.keys())d(S);(async()=>{for await(const S of w.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),m.current=setTimeout(v,3e3)}},[d]);return j.useEffect(()=>(v(),()=>{m.current&&clearTimeout(m.current);for(const x of g.current.values())try{x.unsubscribe()}catch{}g.current.clear(),i.current&&(i.current.close().catch(()=>{}),i.current=null),c(!1)}),[v]),p.jsx(l2.Provider,{value:{connected:l,subscribe:b},children:p.jsx(Wi.Provider,{value:{connected:l,subscribe:b},children:r})})}const tr=Object.create(null);tr.open="0";tr.close="1";tr.ping="2";tr.pong="3";tr.message="4";tr.upgrade="5";tr.noop="6";const Kc=Object.create(null);Object.keys(tr).forEach(r=>{Kc[tr[r]]=r});const bd={type:"error",data:"parser error"},$b=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Hb=typeof ArrayBuffer=="function",Gb=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,Ud=({type:r,data:t},s,i)=>$b&&t instanceof Blob?s?i(t):jg(t,i):Hb&&(t instanceof ArrayBuffer||Gb(t))?s?i(t):jg(new Blob([t]),i):i(tr[r]+(t||"")),jg=(r,t)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];t("b"+(i||""))},s.readAsDataURL(r)};function Tg(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let Vh;function f2(r,t){if($b&&r.data instanceof Blob)return r.data.arrayBuffer().then(Tg).then(t);if(Hb&&(r.data instanceof ArrayBuffer||Gb(r.data)))return t(Tg(r.data));Ud(r,!1,s=>{Vh||(Vh=new TextEncoder),t(Vh.encode(s))})}const kg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",co=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<kg.length;r++)co[kg.charCodeAt(r)]=r;const h2=r=>{let t=r.length*.75,s=r.length,i,l=0,c,m,y,g;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);const f=new ArrayBuffer(t),d=new Uint8Array(f);for(i=0;i<s;i+=4)c=co[r.charCodeAt(i)],m=co[r.charCodeAt(i+1)],y=co[r.charCodeAt(i+2)],g=co[r.charCodeAt(i+3)],d[l++]=c<<2|m>>4,d[l++]=(m&15)<<4|y>>2,d[l++]=(y&3)<<6|g&63;return f},d2=typeof ArrayBuffer=="function",zd=(r,t)=>{if(typeof r!="string")return{type:"message",data:Fb(r,t)};const s=r.charAt(0);return s==="b"?{type:"message",data:m2(r.substring(1),t)}:Kc[s]?r.length>1?{type:Kc[s],data:r.substring(1)}:{type:Kc[s]}:bd},m2=(r,t)=>{if(d2){const s=h2(r);return Fb(s,t)}else return{base64:!0,data:r}},Fb=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Vb="",p2=(r,t)=>{const s=r.length,i=new Array(s);let l=0;r.forEach((c,m)=>{Ud(c,!1,y=>{i[m]=y,++l===s&&t(i.join(Vb))})})},y2=(r,t)=>{const s=r.split(Vb),i=[];for(let l=0;l<s.length;l++){const c=zd(s[l],t);if(i.push(c),c.type==="error")break}return i};function g2(){return new TransformStream({transform(r,t){f2(r,s=>{const i=s.length;let l;if(i<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,i);else if(i<65536){l=new Uint8Array(3);const c=new DataView(l.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{l=new Uint8Array(9);const c=new DataView(l.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(s)})}})}let Yh;function ec(r){return r.reduce((t,s)=>t+s.length,0)}function tc(r,t){if(r[0].length===t)return r.shift();const s=new Uint8Array(t);let i=0;for(let l=0;l<t;l++)s[l]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),s}function b2(r,t){Yh||(Yh=new TextDecoder);const s=[];let i=0,l=-1,c=!1;return new TransformStream({transform(m,y){for(s.push(m);;){if(i===0){if(ec(s)<1)break;const g=tc(s,1);c=(g[0]&128)===128,l=g[0]&127,l<126?i=3:l===126?i=1:i=2}else if(i===1){if(ec(s)<2)break;const g=tc(s,2);l=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(ec(s)<8)break;const g=tc(s,8),f=new DataView(g.buffer,g.byteOffset,g.length),d=f.getUint32(0);if(d>Math.pow(2,21)-1){y.enqueue(bd);break}l=d*Math.pow(2,32)+f.getUint32(4),i=3}else{if(ec(s)<l)break;const g=tc(s,l);y.enqueue(zd(c?g:Yh.decode(g),t)),i=0}if(l===0||l>r){y.enqueue(bd);break}}}})}const Yb=4;function St(r){if(r)return v2(r)}function v2(r){for(var t in St.prototype)r[t]=St.prototype[t];return r}St.prototype.on=St.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};St.prototype.once=function(r,t){function s(){this.off(r,s),t.apply(this,arguments)}return s.fn=t,this.on(r,s),this};St.prototype.off=St.prototype.removeListener=St.prototype.removeAllListeners=St.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,l=0;l<s.length;l++)if(i=s[l],i===t||i.fn===t){s.splice(l,1);break}return s.length===0&&delete this._callbacks["$"+r],this};St.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,l=s.length;i<l;++i)s[i].apply(this,t)}return this};St.prototype.emitReserved=St.prototype.emit;St.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};St.prototype.hasListeners=function(r){return!!this.listeners(r).length};const bu=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),Dn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),x2="arraybuffer";function Kb(r,...t){return t.reduce((s,i)=>(r.hasOwnProperty(i)&&(s[i]=r[i]),s),{})}const _2=Dn.setTimeout,w2=Dn.clearTimeout;function vu(r,t){t.useNativeTimers?(r.setTimeoutFn=_2.bind(Dn),r.clearTimeoutFn=w2.bind(Dn)):(r.setTimeoutFn=Dn.setTimeout.bind(Dn),r.clearTimeoutFn=Dn.clearTimeout.bind(Dn))}const S2=1.33;function E2(r){return typeof r=="string"?O2(r):Math.ceil((r.byteLength||r.size)*S2)}function O2(r){let t=0,s=0;for(let i=0,l=r.length;i<l;i++)t=r.charCodeAt(i),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(i++,s+=4);return s}function Xb(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function A2(r){let t="";for(let s in r)r.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return t}function j2(r){let t={},s=r.split("&");for(let i=0,l=s.length;i<l;i++){let c=s[i].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class T2 extends Error{constructor(t,s,i){super(t),this.description=s,this.context=i,this.type="TransportError"}}class Id extends St{constructor(t){super(),this.writable=!1,vu(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,i){return super.emitReserved("error",new T2(t,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=zd(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=A2(t);return s.length?"?"+s:""}}class k2 extends Id{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};y2(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,p2(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Xb()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let Jb=!1;try{Jb=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const N2=Jb;function C2(){}class M2 extends k2{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,s){const i=this.request({method:"POST",data:t});i.on("success",s),i.on("error",(l,c)=>{this.onError("xhr post error",l,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=t}}class er extends St{constructor(t,s,i){super(),this.createRequest=t,vu(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const s=Kb(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&i.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var l;i.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=er.requestsCount++,er.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=C2,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete er.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}er.requestsCount=0;er.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ng);else if(typeof addEventListener=="function"){const r="onpagehide"in Dn?"pagehide":"unload";addEventListener(r,Ng,!1)}}function Ng(){for(let r in er.requests)er.requests.hasOwnProperty(r)&&er.requests[r].abort()}const R2=(function(){const r=Qb({xdomain:!1});return r&&r.responseType!==null})();class D2 extends M2{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=R2&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new er(Qb,this.uri(),t)}}function Qb(r){const t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||N2))return new XMLHttpRequest}catch{}if(!t)try{return new Dn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Zb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class q2 extends Id{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,i=Zb?{}:Kb(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,i)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],l=s===t.length-1;Ud(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}l&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Xb()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Kh=Dn.WebSocket||Dn.MozWebSocket;class L2 extends q2{createSocket(t,s,i){return Zb?new Kh(t,s,i):s?new Kh(t,s):new Kh(t)}doWrite(t,s){this.ws.send(s)}}class B2 extends Id{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=b2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(s).getReader(),l=g2();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const c=()=>{i.read().then(({done:y,value:g})=>{y||(this.onPacket(g),c())}).catch(y=>{})};c();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],l=s===t.length-1;this._writer.write(i).then(()=>{l&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const P2={websocket:L2,webtransport:B2,polling:D2},U2=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,z2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function vd(r){if(r.length>8e3)throw"URI too long";const t=r,s=r.indexOf("["),i=r.indexOf("]");s!=-1&&i!=-1&&(r=r.substring(0,s)+r.substring(s,i).replace(/:/g,";")+r.substring(i,r.length));let l=U2.exec(r||""),c={},m=14;for(;m--;)c[z2[m]]=l[m]||"";return s!=-1&&i!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=I2(c,c.path),c.queryKey=$2(c,c.query),c}function I2(r,t){const s=/\/{2,9}/g,i=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function $2(r,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,l,c){l&&(s[l]=c)}),s}const xd=typeof addEventListener=="function"&&typeof removeEventListener=="function",Xc=[];xd&&addEventListener("offline",()=>{Xc.forEach(r=>r())},!1);class ds extends St{constructor(t,s){if(super(),this.binaryType=x2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const i=vd(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=vd(s.host).host);vu(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{const l=i.prototype.name;this.transports.push(l),this._transportsByName[l]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=j2(this.opts.query)),xd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Xc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=Yb,s.transport=t,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ds.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",ds.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const l=this.writeBuffer[i].data;if(l&&(s+=E2(l)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,bu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,l){if(typeof s=="function"&&(l=s,s=void 0),typeof i=="function"&&(l=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:t,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(ds.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),xd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=Xc.indexOf(this._offlineEventListener);i!==-1&&Xc.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}ds.protocol=Yb;class H2 extends ds{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),i=!1;ds.priorWebsocketSuccess=!1;const l=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;ds.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=s.name,this.emitReserved("upgradeError",v)}}))};function c(){i||(i=!0,d(),s.close(),s=null)}const m=b=>{const v=new Error("probe error: "+b);v.transport=s.name,c(),this.emitReserved("upgradeError",v)};function y(){m("transport closed")}function g(){m("socket closed")}function f(b){s&&b.name!==s.name&&c()}const d=()=>{s.removeListener("open",l),s.removeListener("error",m),s.removeListener("close",y),this.off("close",g),this.off("upgrading",f)};s.once("open",l),s.once("error",m),s.once("close",y),this.once("close",g),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&s.push(t[i]);return s}}let G2=class extends H2{constructor(t,s={}){const i=typeof t=="object"?t:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(l=>P2[l]).filter(l=>!!l)),super(t,i)}};function F2(r,t="",s){let i=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),i=vd(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+t,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const V2=typeof ArrayBuffer=="function",Y2=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Wb=Object.prototype.toString,K2=typeof Blob=="function"||typeof Blob<"u"&&Wb.call(Blob)==="[object BlobConstructor]",X2=typeof File=="function"||typeof File<"u"&&Wb.call(File)==="[object FileConstructor]";function $d(r){return V2&&(r instanceof ArrayBuffer||Y2(r))||K2&&r instanceof Blob||X2&&r instanceof File}function Jc(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,i=r.length;s<i;s++)if(Jc(r[s]))return!0;return!1}if($d(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Jc(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&Jc(r[s]))return!0;return!1}function J2(r){const t=[],s=r.data,i=r;return i.data=_d(s,t),i.attachments=t.length,{packet:i,buffers:t}}function _d(r,t){if(!r)return r;if($d(r)){const s={_placeholder:!0,num:t.length};return t.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let i=0;i<r.length;i++)s[i]=_d(r[i],t);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(s[i]=_d(r[i],t));return s}return r}function Q2(r,t){return r.data=wd(r.data,t),delete r.attachments,r}function wd(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=wd(r[s],t);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=wd(r[s],t));return r}const Z2=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ue;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(Ue||(Ue={}));class W2{constructor(t){this.replacer=t}encode(t){return(t.type===Ue.EVENT||t.type===Ue.ACK)&&Jc(t)?this.encodeAsBinary({type:t.type===Ue.EVENT?Ue.BINARY_EVENT:Ue.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Ue.BINARY_EVENT||t.type===Ue.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=J2(t),i=this.encodeAsString(s.packet),l=s.buffers;return l.unshift(i),l}}class Hd extends St{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const i=s.type===Ue.BINARY_EVENT;i||s.type===Ue.BINARY_ACK?(s.type=i?Ue.EVENT:Ue.ACK,this.reconstructor=new eO(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if($d(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const i={type:Number(t.charAt(0))};if(Ue[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ue.BINARY_EVENT||i.type===Ue.BINARY_ACK){const c=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const m=t.substring(c,s);if(m!=Number(m)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const y=Number(m);if(!tO(y)||y<0)throw new Error("Illegal attachments");if(y>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=y}if(t.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););i.nsp=t.substring(c,s)}else i.nsp="/";const l=t.charAt(s+1);if(l!==""&&Number(l)==l){const c=s+1;for(;++s;){const m=t.charAt(s);if(m==null||Number(m)!=m){--s;break}if(s===t.length)break}i.id=Number(t.substring(c,s+1))}if(t.charAt(++s)){const c=this.tryParse(t.substr(s));if(Hd.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Ue.CONNECT:return Cg(s);case Ue.DISCONNECT:return s===void 0;case Ue.CONNECT_ERROR:return typeof s=="string"||Cg(s);case Ue.EVENT:case Ue.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Z2.indexOf(s[0])===-1);case Ue.ACK:case Ue.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class eO{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=Q2(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const tO=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function Cg(r){return Object.prototype.toString.call(r)==="[object Object]"}const nO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Hd,Encoder:W2,get PacketType(){return Ue}},Symbol.toStringTag,{value:"Module"}));function Hn(r,t,s){return r.on(t,s),function(){r.off(t,s)}}const rO=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ev extends St{constructor(t,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Hn(t,"open",this.onopen.bind(this)),Hn(t,"packet",this.onpacket.bind(this)),Hn(t,"error",this.onerror.bind(this)),Hn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var i,l,c;if(rO.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const m={type:Ue.EVENT,data:s};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const d=this.ids++,b=s.pop();this._registerAckCallback(d,b),m.id=d}const y=(l=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||l===void 0?void 0:l.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!y||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(t,s){var i;const l=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(l===void 0){this.acks[t]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===t&&this.sendBuffer.splice(y,1);s.call(this,new Error("operation has timed out"))},l),m=(...y)=>{this.io.clearTimeoutFn(c),s.apply(this,y)};m.withError=!0,this.acks[t]=m}emitWithAck(t,...s){return new Promise((i,l)=>{const c=(m,y)=>m?l(m):i(y);c.withError=!0,s.push(c),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...c)=>(this._queue[0],l!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(l)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ue.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ue.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ue.EVENT:case Ue.BINARY_EVENT:this.onevent(t);break;case Ue.ACK:case Ue.BINARY_ACK:this.onack(t);break;case Ue.DISCONNECT:this.ondisconnect();break;case Ue.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let i=!1;return function(...l){i||(i=!0,s.packet({type:Ue.ACK,id:t,data:l}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ue.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,t.data)}}}function ea(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}ea.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};ea.prototype.reset=function(){this.attempts=0};ea.prototype.setMin=function(r){this.ms=r};ea.prototype.setMax=function(r){this.max=r};ea.prototype.setJitter=function(r){this.jitter=r};class Sd extends St{constructor(t,s){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,vu(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ea({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const l=s.parser||nO;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new G2(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const l=Hn(s,"open",function(){i.onopen(),t&&t()}),c=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),t?t(y):this.maybeReconnectOnOpen()},m=Hn(s,"error",c);if(this._timeout!==!1){const y=this._timeout,g=this.setTimeoutFn(()=>{l(),c(new Error("timeout")),s.close()},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(l),this.subs.push(m),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Hn(t,"ping",this.onping.bind(this)),Hn(t,"data",this.ondata.bind(this)),Hn(t,"error",this.onerror.bind(this)),Hn(t,"close",this.onclose.bind(this)),Hn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){bu(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new ev(this,t,s),this.nsps[t]=i),i}_destroy(t){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let i=0;i<s.length;i++)this.engine.write(s[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Za={};function Qc(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};const s=F2(r,t.path||"/socket.io"),i=s.source,l=s.id,c=s.path,m=Za[l]&&c in Za[l].nsps,y=t.forceNew||t["force new connection"]||t.multiplex===!1||m;let g;return y?g=new Sd(i,t):(Za[l]||(Za[l]=new Sd(i,t)),g=Za[l]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(Qc,{Manager:Sd,Socket:ev,io:Qc,connect:Qc});const sO=j.createContext({connected:!1,subscribe:()=>()=>{}});function iO({children:r}){const t=j.useRef(null),[s,i]=j.useState(!1),l=j.useRef(new Map),c=j.useCallback((y,g)=>{var d;const f=l.current;return f.has(y)||(f.set(y,new Set),(d=t.current)==null||d.emit("lt.subscribe",y)),f.get(y).add(g),()=>{var v;const b=f.get(y);b&&(b.delete(g),b.size===0&&(f.delete(y),(v=t.current)==null||v.emit("lt.unsubscribe",y)))}},[]),m=j.useCallback((y,g)=>{for(const[f,d]of l.current)if(Ib(y,f))for(const b of d)try{b(g)}catch{}},[]);return j.useEffect(()=>{const y=wb(),g=Qc({path:`${kt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...y?{auth:{token:y}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),i(!0);for(const f of l.current.keys())g.emit("lt.subscribe",f)}),g.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),i(!1)}),g.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),i(!1)}),g.onAny((f,d)=>{if(f.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;m(f,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,i(!1)}},[m]),p.jsx(sO.Provider,{value:{connected:s,subscribe:c},children:p.jsx(Wi.Provider,{value:{connected:s,subscribe:c},children:r})})}function aO({children:r}){const[t,s]=j.useState(null),[i,l]=j.useState({url:null,token:null});return j.useEffect(()=>{let c=!1;async function m(){var y;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${kt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),c||s("socketio");return}const f=await g.json(),d=(y=f==null?void 0:f.events)==null?void 0:y.transport;if(console.log("[lt-transport] server reports:",d),!c){if(d==="nats"){let b=f.events.natsWsUrl??null,v=null;const x=wb();if(x)try{const w=await fetch(`${kt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${x}`}});if(w.ok){const S=await w.json();b=S.natsWsUrl??b,v=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}l({url:b,token:v})}s(d==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),c||s("socketio")}}return m(),()=>{c=!0}},[]),t==="nats"?p.jsx(u2,{url:i.url,token:i.token,children:r}):t==="socketio"?p.jsx(iO,{children:r}):p.jsx(p.Fragment,{children:r})}const Gd="lt_view_as",Fd="lt_ai_override",Ed="lt_graph_enabled",Vd="lt_scan_override";function tv(){try{const r=localStorage.getItem(Fd);if(r==="true")return!0;if(r==="false")return!1}catch{}return null}function oO(r){try{localStorage.setItem(Fd,String(r))}catch{}}function lO(){try{localStorage.removeItem(Fd)}catch{}}function Yd(){try{const r=localStorage.getItem(Gd);if(r==="admin"||r==="engineer"||r==="operator")return r}catch{}return null}function cO(r){try{localStorage.setItem(Gd,r)}catch{}window.location.reload()}function Od(){try{localStorage.removeItem(Gd)}catch{}window.location.reload()}function nv(){try{return localStorage.getItem(Ed)==="true"}catch{return!1}}function uO(r){try{r?localStorage.setItem(Ed,"true"):localStorage.removeItem(Ed)}catch{}}function rv(){try{const r=localStorage.getItem(Vd);if(r==="true")return!0;if(r==="false")return!1}catch{}return null}function fO(r){try{localStorage.setItem(Vd,String(r))}catch{}}function hO(){try{localStorage.removeItem(Vd)}catch{}}function sv(){const{isSuperAdmin:r,hasRoleType:t,hasRole:s}=Vt(),i=Yd(),l=r||s("engineer"),c=t("admin"),m=r||t("admin");return{isBuilder:i?!1:l,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":m,viewAs:i,realIsBuilder:l}}function iv(){var f;const{isSuperAdmin:r,hasRoleType:t,hasRole:s}=Vt(),{data:i}=nr(),l=((f=i==null?void 0:i.features)==null?void 0:f.publicPaceBoard)!==!1,c=r?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",m=Yd(),y=m==="admin"||m==="engineer"||m==="operator"?m:null,g=y??c;return{tier:g,realTier:c,viewAs:y,canSeePaceBoard:l||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!l}}function av(r){return(r??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function Tr(r={}){const t=r.role?av(r.role):"*",s=r.id??"*",i=r.verb??">";return`${Ht}.system.escalation.${t}.${s}.${i}`}function Ad(r){return r.verbs.map(t=>Tr({role:r.role,verb:t}))}function Kd(r){const{user:t,isSuperAdmin:s,hasRoleType:i}=Vt(),l=s||i("admin"),c=((t==null?void 0:t.roles)??[]).map(y=>y.role).sort().join(","),m=(r??[]).join(",");return j.useMemo(()=>{const y=m?m.split(","):null;return l||!c?y?Ad({verbs:y}):[Tr({})]:c.split(",").flatMap(g=>y?Ad({role:g,verbs:y}):[Tr({role:g})])},[l,c,m])}const jd="/escalations/detail/";function dO(r){return r.startsWith(jd)&&r.slice(jd.length).split("/")[0]||void 0}function mO(){const{user:r}=Vt(),t=_o(),s=vn(),i=j.useRef(s.pathname);i.current=s.pathname;const l=j.useRef(r==null?void 0:r.userId);l.current=r==null?void 0:r.userId;const c=j.useCallback(m=>{var b,v,x;if((m==null?void 0:m.assignedAtCreation)!==!0)return;const y=(m==null?void 0:m.escalationId)??((b=m==null?void 0:m.data)==null?void 0:b.id),g=(v=m==null?void 0:m.data)==null?void 0:v.assigned_to,f=(x=m==null?void 0:m.data)==null?void 0:x.parent_id;if(!y||g!==l.current||!f||f!==dO(i.current))return;const d=`${jd}${y}`;i.current!==d&&t(d)},[t]);Ks(Kd(["claimed"]),c)}function pO(){return lt({queryKey:["roles"],queryFn:()=>_e("/roles")})}function ov(r){return lt({queryKey:["roles","details"],queryFn:()=>_e("/roles/details"),enabled:(r==null?void 0:r.enabled)??!0})}function RN(r,t,s=!0){return lt({queryKey:["roles",r,"schema",t??"latest"],queryFn:()=>_e(`/roles/${encodeURIComponent(r)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!r})}function DN(r){return lt({queryKey:["roles",r,"schema-versions"],queryFn:()=>_e(`/roles/${encodeURIComponent(r)}/schema/versions`),enabled:!!r})}function qN(r,t,s=!0){return lt({queryKey:["roles",r,"list-schema",t??"latest"],queryFn:()=>_e(`/roles/${encodeURIComponent(r)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!r})}function LN(r){return lt({queryKey:["roles",r,"list-schema-versions"],queryFn:()=>_e(`/roles/${encodeURIComponent(r)}/list-schema/versions`),enabled:!!r})}function BN(){const r=ot();return mt({mutationFn:t=>_e("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}function PN(){const r=ot();return mt({mutationFn:({role:t,...s})=>_e(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await r.cancelQueries({queryKey:["roles","details"]});const i=r.getQueryData(["roles","details"]);return i&&r.setQueryData(["roles","details"],{roles:i.roles.map(l=>l.role===t?{...l,...s}:l)}),{previous:i}},onError:(t,s,i)=>{i!=null&&i.previous&&r.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}function UN(){const r=ot();return mt({mutationFn:t=>_e(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}function yO(){const{user:r}=Vt(),{data:t}=ov();return j.useMemo(()=>{var c,m;const s=(r==null?void 0:r.roles)??[],i=s.length===1?s[0]:null;if(!i||i.type!=="member")return{kiosk:!1,role:null,homePath:null};const l=(c=t==null?void 0:t.roles)==null?void 0:c.find(y=>y.role===i.role);return((m=l==null?void 0:l.properties)==null?void 0:m.kiosk)!==!0?{kiosk:!1,role:null,homePath:null}:{kiosk:!0,role:i.role,homePath:`/escalations/available?role=${encodeURIComponent(i.role)}&status=available`}},[r,t])}const gO=["/escalations","/scan","/login"];function bO(r){return gO.some(t=>r===t||r.startsWith(`${t}/`)||r.startsWith(`${t}?`))}const Xd=j.createContext(null),Xh="lt_sidebar_collapsed",lv="(max-width: 1023px)";function vO(){try{return window.matchMedia(lv).matches}catch{return!1}}function xO({children:r}){const[t,s]=j.useState(()=>{if(vO())return!0;try{return localStorage.getItem(Xh)==="true"}catch{return!1}});j.useEffect(()=>{let l;try{l=window.matchMedia(lv)}catch{return}const c=m=>{if(m.matches)s(!0);else try{s(localStorage.getItem(Xh)==="true")}catch{s(!1)}};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]);const i=j.useCallback(()=>{s(l=>{const c=!l;try{localStorage.setItem(Xh,String(c))}catch{}return c})},[]);return p.jsx(Xd.Provider,{value:{collapsed:t,toggle:i},children:r})}function _O({children:r}){return p.jsx(Xd.Provider,{value:{collapsed:!1,toggle:()=>{}},children:r})}function Jd(){const r=j.useContext(Xd);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}const Mg=380,Qd=j.createContext(null);function wO({children:r}){const[t,s]=j.useState({node:null,width:Mg,open:!1,ownerKey:null}),i=vn(),l=j.useRef(i.pathname),c=j.useCallback((y,g)=>{s({node:y,width:(g==null?void 0:g.width)??Mg,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=j.useCallback(y=>{s(g=>typeof y=="string"&&g.ownerKey!==y?g:{...g,open:!1})},[]);return j.useEffect(()=>{i.pathname!==l.current&&(l.current=i.pathname,s(y=>y.open||y.node?{...y,node:null,open:!1,ownerKey:null}:y))},[i.pathname]),p.jsx(Qd.Provider,{value:{...t,setPanel:c,closePanel:m},children:r})}function Zd(){const r=j.useContext(Qd);if(!r)throw new Error("useShellPanel must be used within ShellPanelProvider");return r}function zN(){return j.useContext(Qd)}function SO({open:r,width:t=380,children:s,className:i=""}){const[l,c]=j.useState(r);return j.useEffect(()=>{r&&c(!0)},[r]),p.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:r?t:0,maxWidth:"50%"},onTransitionEnd:m=>{!r&&m.propertyName==="width"&&c(!1)},children:p.jsx("div",{style:{width:t},className:"h-full",children:l?s:null})})}function IN({label:r,children:t}){return p.jsxs("div",{children:[p.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:r}),p.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function $N({views:r,activeId:t,onViewChange:s,onClose:i,headerActions:l,stickyClassName:c,labelInline:m}){const y=r.find(g=>g.id===t)??r[0];return y?p.jsx("div",{className:"h-full bg-surface-hover",children:p.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[p.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:r.map(g=>{const f=g.icon,d=g.id===y.id;return p.jsx("button",{role:"radio","aria-checked":d,onClick:()=>s(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${d?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:p.jsx(f,{className:"w-3.5 h-3.5"})},g.id)})}),m&&p.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:y.label})]}),p.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l,i&&p.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:p.jsx(Ft,{className:"w-3.5 h-3.5"})})]})]}),!m&&p.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:y.label}),p.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:y.content})]})}):null}function cv(r,t){var s,i,l,c,m;t.facets&&Object.keys(t.facets).length&&r.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&r.set("block",JSON.stringify(t.block)),(i=t.range)!=null&&i.length&&r.set("range",JSON.stringify(t.range)),(l=t.exists)!=null&&l.length&&r.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&r.set("roles",JSON.stringify(t.roles)),(m=t.orderBy)!=null&&m.length&&r.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&r.set("available",String(t.available)),t.jeopardy===!0&&r.set("jeopardy","1"),t.include&&r.set("include",t.include)}function HN(r,t){const s=r??"24h";return lt({queryKey:["stationMetrics",s],queryFn:()=>_e(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function GN(r){const t=r?`?period=${r}`:"";return lt({queryKey:["escalationStats",r],queryFn:()=>_e(`/escalations/stats${t}`)})}function FN(){return lt({queryKey:["escalationTypes"],queryFn:()=>_e("/escalations/types")})}function VN(r=!0){return lt({queryKey:["escalationFacetKeys"],queryFn:()=>_e("/escalations/facet-keys"),enabled:r,staleTime:6e4})}function uv(r){const{enabled:t=!0,staleTime:s,...i}=r,l=new URLSearchParams;return i.status&&l.set("status",i.status),i.role&&l.set("role",i.role),i.type&&l.set("type",i.type),i.subtype&&l.set("subtype",i.subtype),i.assigned_to&&l.set("assigned_to",i.assigned_to),i.parent_id&&l.set("parent_id",i.parent_id),i.claimed&&l.set("claimed","true"),i.priority&&l.set("priority",String(i.priority)),i.limit&&l.set("limit",String(i.limit)),i.offset!==void 0&&l.set("offset",String(i.offset)),i.sort_by&&l.set("sort_by",i.sort_by),i.order&&l.set("order",i.order),i.search&&l.set("search",i.search),cv(l,i),lt({queryKey:["escalations",i],queryFn:()=>_e(`/escalations?${l}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function fv(r){const{enabled:t=!0,staleTime:s,...i}=r,l=new URLSearchParams;return i.role&&l.set("role",i.role),i.type&&l.set("type",i.type),i.subtype&&l.set("subtype",i.subtype),i.priority&&l.set("priority",String(i.priority)),i.limit&&l.set("limit",String(i.limit)),i.offset!==void 0&&l.set("offset",String(i.offset)),i.sort_by&&l.set("sort_by",i.sort_by),i.order&&l.set("order",i.order),i.search&&l.set("search",i.search),cv(l,i),lt({queryKey:["escalations","available",i],queryFn:()=>_e(`/escalations/available?${l}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function YN(r){return lt({queryKey:["escalations","by-workflow",r],queryFn:()=>_e(`/escalations/by-workflow/${r}`),enabled:!!r})}function KN(r){return lt({queryKey:["escalations",r],queryFn:()=>_e(`/escalations/${r}`),enabled:!!r})}function XN(r,t){return lt({queryKey:["escalations",r,"lookups"],queryFn:()=>_e(`/escalations/${r}/lookups`),enabled:!!r&&t,staleTime:1/0})}function JN(){const r=ot();return mt({mutationFn:({id:t,durationMinutes:s})=>_e(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function QN(){const r=ot();return mt({mutationFn:t=>_e(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function ZN(){const r=ot();return mt({mutationFn:({id:t,resolverPayload:s})=>_e(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function WN(){const r=ot();return mt({mutationFn:({id:t,targetRole:s})=>_e(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function e3(){const r=ot();return mt({mutationFn:({ids:t,priority:s})=>_e("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function t3(){const r=ot();return mt({mutationFn:({ids:t,durationMinutes:s})=>_e("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function n3(){const r=ot();return mt({mutationFn:({ids:t,targetUserId:s,durationMinutes:i,reassign:l})=>_e("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:i,...l?{reassign:!0}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function r3(){const r=ot();return mt({mutationFn:({ids:t})=>_e("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function s3(){const r=ot();return mt({mutationFn:({ids:t,hint:s})=>_e("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function i3(){const r=ot();return mt({mutationFn:t=>_e(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function a3(){const r=ot();return mt({mutationFn:({ids:t})=>_e("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Wd(r){const t=[],s=r.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":t.push(["tasks"]),t.push(["jobs"]),t.push(["processes"]),r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["workflowState",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId])),r.originId&&t.push(["processes",r.originId]);break;case"escalation":t.push(["escalations"]),t.push(["escalationStats"]),t.push(["stationMetrics"]),r.workflowId&&t.push(["workflowExecution",r.workflowId]);break;case"workflow":t.push(["jobs"]),t.push(["tasks"]),t.push(["processes"]),r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["workflowState",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId]),t.push(["mcpQueryResult",r.workflowId]),t.push(["builderResult",r.workflowId]));break;case"activity":r.workflowId&&t.push(["mcpRunExecution",r.workflowId]),t.push(["mcpRuns"]);break;case"milestone":r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId])),t.push(["tasks"]);break;case"knowledge":t.push(["knowledge"]);break;case"file":t.push(["files"]);break;case"agent":t.push(["agents"]);break;default:t.push(["jobs"]),t.push(["tasks"]);break}return t}const EO={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},o3=300,Rg={DETAIL:0,LIST:1,SUMMARY:2};function OO(r){const t=new Map,s={},i={};let l=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function m(d){delete s[d],i[d]=Date.now();const b=[];for(const[x,w]of t)w===d&&b.push(x);for(const x of b)t.delete(x);if(b.length===0)return;const v=c();v&&(l=!0);for(const x of b)r.invalidateQueries({queryKey:JSON.parse(x),...v?{refetchType:"none"}:{}})}function y(d){if(s[d])return;const{coalesceMs:b,minIntervalMs:v}=EO[d],x=i[d],w=x===void 0?0:x+v-Date.now(),S=Math.max(b,w);s[d]=setTimeout(()=>m(d),S)}function g(d,b){for(const v of b){const x=JSON.stringify(v),w=t.get(x);(w===void 0||Rg[d]<Rg[w])&&t.set(x,d)}y(d)}const f=()=>{typeof document>"u"||document.visibilityState==="visible"&&l&&(l=!1,r.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",f),{request:g,dispose(){for(const d of Object.keys(s)){const b=s[d];b&&clearTimeout(b),delete s[d]}t.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",f)}}}const Dg=new WeakMap;function AO(r){let t=Dg.get(r);return t||(t=OO(r),Dg.set(r,t)),t}function Wt(r){const t=ot();return j.useCallback(s=>{AO(t).request(r,s)},[t,r])}function em(r){return r?[`${Ht}.system.workflow.>`,`${Ht}.system.activity.>`,`${Ht}.system.milestone.>`,`${Ht}.system.task.>`,`${Ht}.system.escalation.>`]:[]}function l3(){const r=Wt("LIST");yn(`${Ht}.system.task.>`,()=>{r([["jobs"]])}),yn(`${Ht}.system.workflow.>`,()=>{r([["jobs"]])})}function c3(r){const t=Wt("DETAIL");Ks(em(r),s=>{var y;if(!r||!(s.workflowId===r||((y=s.workflowId)==null?void 0:y.includes(r))))return;const l=s.type.split("."),c=l[0]==="system"?l[1]:l[0],m=Wd(s);c==="escalation"&&m.push(["escalations","by-workflow",r]),t(m)})}function u3(r){const t=Wt("DETAIL");Ks(em(r),s=>{var y;if(!r||!(s.workflowId===r||((y=s.workflowId)==null?void 0:y.includes(r))))return;const l=s.type.split("."),c=l[0]==="system"?l[1]:l[0],m=Wd(s);c==="escalation"&&m.push(["escalations","by-workflow",r]),t(m)})}function f3(r){const t=Wt("DETAIL");Ks(em(r),s=>{var c;if(!r||!(s.workflowId===r||((c=s.workflowId)==null?void 0:c.includes(r))))return;const l=Wd(s);l.push(["workflowSets"]),l.push(["yamlWorkflows"]),t(l)})}function h3(r){const t=Wt("DETAIL"),s=j.useCallback(i=>{r&&(i.originId!==r&&i.workflowId!==r||t([["processes",r]]))},[r,t]);yn(`${Ht}.system.task.>`,s),yn(`${Ht}.system.workflow.>`,s),yn(`${Ht}.system.escalation.>`,s)}function d3(){const r=Wt("SUMMARY");yn(Tr({}),()=>{r([["escalationStats"]])})}function m3(){const r=Wt("SUMMARY");yn(Tr({}),()=>{r([["stationMetrics"]])})}function p3(){const r=Wt("SUMMARY");yn(Tr({}),()=>{r([["escAggregate"],["escTimeline"]])})}function y3(r){const t=Wt("LIST"),s=(r==null?void 0:r.role)??null,i=((r==null?void 0:r.verbs)??[]).join(","),l=j.useMemo(()=>{const c=i?i.split(","):null;return c?Ad({role:s,verbs:c}):[Tr({role:s})]},[s,i]);Ks(l,()=>{t([["escalations"]])})}function g3(r){const t=Wt("DETAIL");yn(Tr(r?{id:r}:{id:"__none__"}),s=>{!r||s.escalationId!==r||t([["escalations",r]])})}function b3(){const r=Wt("LIST");yn(`${Ht}.system.agent.>`,()=>{r([["agents"]])})}function v3(){const r=Wt("LIST");yn(`${Ht}.system.task.>`,()=>{r([["processes"]])}),yn(`${Ht}.system.workflow.>`,()=>{r([["processes"]])})}function jO(){const{user:r}=Vt(),t=r==null?void 0:r.userId,s=Wt("SUMMARY");Ks(Kd(),()=>{s([["escalations"]])});const{data:i}=fv({limit:1}),{data:l}=uv({assigned_to:t,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(l==null?void 0:l.total)??0}}function ou({size:r="sm",hideLabel:t=!1,className:s="",appName:i="LongTail",variant:l="full"}){const c=r==="lg";if(l==="comet")return p.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:p.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${kt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(l==="mark")return p.jsx("div",{className:`flex items-center ${s}`,children:p.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${kt}/logo512.png)`}})});const m=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",y=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return p.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[p.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${kt}/logo512.png)`}}),p.jsx("span",{className:`z-[1] transition-opacity duration-300 ${y} ${t?"opacity-0":""}`,children:i})]})}const TO="system.surfaces.dashboard",kO=`${Ht}.${TO}`;function hv(r=!0){return lt({queryKey:["announcements"],queryFn:()=>_e("/announcements"),enabled:r,staleTime:3e4})}function NO(){const r=ot();return mt({mutationFn:t=>_e("/announcements",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{r.invalidateQueries({queryKey:["announcements"]})}})}function CO(){const r=ot();return mt({mutationFn:t=>_e(`/announcements/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["announcements"]})}})}const dv=6048e5,MO=864e5,qg=6e4,Lg=525600,Bg=43200,Pg=1440,Ug=Symbol.for("constructDateFrom");function kr(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&Ug in r?r[Ug](t):r instanceof Date?new r.constructor(t):new Date(t)}function bn(r,t){return kr(t||r,r)}let RO={};function Eo(){return RO}function xo(r,t){var y,g,f,d;const s=Eo(),i=(t==null?void 0:t.weekStartsOn)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((d=(f=s.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,l=bn(r,t==null?void 0:t.in),c=l.getDay(),m=(c<i?7:0)+c-i;return l.setDate(l.getDate()-m),l.setHours(0,0,0,0),l}function lu(r,t){return xo(r,{...t,weekStartsOn:1})}function mv(r,t){const s=bn(r,t==null?void 0:t.in),i=s.getFullYear(),l=kr(s,0);l.setFullYear(i+1,0,4),l.setHours(0,0,0,0);const c=lu(l),m=kr(s,0);m.setFullYear(i,0,4),m.setHours(0,0,0,0);const y=lu(m);return s.getTime()>=c.getTime()?i+1:s.getTime()>=y.getTime()?i:i-1}function cu(r){const t=bn(r),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+r-+s}function pv(r,...t){const s=kr.bind(null,r||t.find(i=>typeof i=="object"));return t.map(s)}function zg(r,t){const s=bn(r,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function DO(r,t,s){const[i,l]=pv(s==null?void 0:s.in,r,t),c=zg(i),m=zg(l),y=+c-cu(c),g=+m-cu(m);return Math.round((y-g)/MO)}function qO(r,t){const s=mv(r,t),i=kr(r,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),lu(i)}function LO(r,t){const s=+bn(r)-+bn(t);return s<0?-1:s>0?1:s}function BO(r){return kr(r,Date.now())}function PO(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function UO(r){return!(!PO(r)&&typeof r!="number"||isNaN(+bn(r)))}function zO(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function IO(r,t){const s=bn(r,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const $O={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},HO=(r,t,s)=>{let i;const l=$O[r];return typeof l=="string"?i=l:t===1?i=l.one:i=l.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function Jh(r){return(t={})=>{const s=t.width?String(t.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const GO={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},FO={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},VO={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},YO={date:Jh({formats:GO,defaultWidth:"full"}),time:Jh({formats:FO,defaultWidth:"full"}),dateTime:Jh({formats:VO,defaultWidth:"full"})},KO={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},XO=(r,t,s,i)=>KO[r];function Wa(r){return(t,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let l;if(i==="formatting"&&r.formattingValues){const m=r.defaultFormattingWidth||r.defaultWidth,y=s!=null&&s.width?String(s.width):m;l=r.formattingValues[y]||r.formattingValues[m]}else{const m=r.defaultWidth,y=s!=null&&s.width?String(s.width):r.defaultWidth;l=r.values[y]||r.values[m]}const c=r.argumentCallback?r.argumentCallback(t):t;return l[c]}}const JO={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},QO={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ZO={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},WO={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},tA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},nA=(r,t)=>{const s=Number(r),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},rA={ordinalNumber:nA,era:Wa({values:JO,defaultWidth:"wide"}),quarter:Wa({values:QO,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Wa({values:ZO,defaultWidth:"wide"}),day:Wa({values:WO,defaultWidth:"wide"}),dayPeriod:Wa({values:eA,defaultWidth:"wide",formattingValues:tA,defaultFormattingWidth:"wide"})};function eo(r){return(t,s={})=>{const i=s.width,l=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],c=t.match(l);if(!c)return null;const m=c[0],y=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(y)?iA(y,b=>b.test(m)):sA(y,b=>b.test(m));let f;f=r.valueCallback?r.valueCallback(g):g,f=s.valueCallback?s.valueCallback(f):f;const d=t.slice(m.length);return{value:f,rest:d}}}function sA(r,t){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&t(r[s]))return s}function iA(r,t){for(let s=0;s<r.length;s++)if(t(r[s]))return s}function aA(r){return(t,s={})=>{const i=t.match(r.matchPattern);if(!i)return null;const l=i[0],c=t.match(r.parsePattern);if(!c)return null;let m=r.valueCallback?r.valueCallback(c[0]):c[0];m=s.valueCallback?s.valueCallback(m):m;const y=t.slice(l.length);return{value:m,rest:y}}}const oA=/^(\d+)(th|st|nd|rd)?/i,lA=/\d+/i,cA={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},uA={any:[/^b/i,/^(a|c)/i]},fA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hA={any:[/1/i,/2/i,/3/i,/4/i]},dA={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},mA={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},pA={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},yA={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},gA={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},bA={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},vA={ordinalNumber:aA({matchPattern:oA,parsePattern:lA,valueCallback:r=>parseInt(r,10)}),era:eo({matchPatterns:cA,defaultMatchWidth:"wide",parsePatterns:uA,defaultParseWidth:"any"}),quarter:eo({matchPatterns:fA,defaultMatchWidth:"wide",parsePatterns:hA,defaultParseWidth:"any",valueCallback:r=>r+1}),month:eo({matchPatterns:dA,defaultMatchWidth:"wide",parsePatterns:mA,defaultParseWidth:"any"}),day:eo({matchPatterns:pA,defaultMatchWidth:"wide",parsePatterns:yA,defaultParseWidth:"any"}),dayPeriod:eo({matchPatterns:gA,defaultMatchWidth:"any",parsePatterns:bA,defaultParseWidth:"any"})},yv={code:"en-US",formatDistance:HO,formatLong:YO,formatRelative:XO,localize:rA,match:vA,options:{weekStartsOn:0,firstWeekContainsDate:1}};function xA(r,t){const s=bn(r,t==null?void 0:t.in);return DO(s,IO(s))+1}function _A(r,t){const s=bn(r,t==null?void 0:t.in),i=+lu(s)-+qO(s);return Math.round(i/dv)+1}function gv(r,t){var d,b,v,x;const s=bn(r,t==null?void 0:t.in),i=s.getFullYear(),l=Eo(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??l.firstWeekContainsDate??((x=(v=l.locale)==null?void 0:v.options)==null?void 0:x.firstWeekContainsDate)??1,m=kr((t==null?void 0:t.in)||r,0);m.setFullYear(i+1,0,c),m.setHours(0,0,0,0);const y=xo(m,t),g=kr((t==null?void 0:t.in)||r,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const f=xo(g,t);return+s>=+y?i+1:+s>=+f?i:i-1}function wA(r,t){var y,g,f,d;const s=Eo(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((d=(f=s.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,l=gv(r,t),c=kr((t==null?void 0:t.in)||r,0);return c.setFullYear(l,0,i),c.setHours(0,0,0,0),xo(c,t)}function SA(r,t){const s=bn(r,t==null?void 0:t.in),i=+xo(s,t)-+wA(s,t);return Math.round(i/dv)+1}function Ye(r,t){const s=r<0?"-":"",i=Math.abs(r).toString().padStart(t,"0");return s+i}const os={y(r,t){const s=r.getFullYear(),i=s>0?s:1-s;return Ye(t==="yy"?i%100:i,t.length)},M(r,t){const s=r.getMonth();return t==="M"?String(s+1):Ye(s+1,2)},d(r,t){return Ye(r.getDate(),t.length)},a(r,t){const s=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,t){return Ye(r.getHours()%12||12,t.length)},H(r,t){return Ye(r.getHours(),t.length)},m(r,t){return Ye(r.getMinutes(),t.length)},s(r,t){return Ye(r.getSeconds(),t.length)},S(r,t){const s=t.length,i=r.getMilliseconds(),l=Math.trunc(i*Math.pow(10,s-3));return Ye(l,t.length)}},Li={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ig={G:function(r,t,s){const i=r.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(r,t,s){if(t==="yo"){const i=r.getFullYear(),l=i>0?i:1-i;return s.ordinalNumber(l,{unit:"year"})}return os.y(r,t)},Y:function(r,t,s,i){const l=gv(r,i),c=l>0?l:1-l;if(t==="YY"){const m=c%100;return Ye(m,2)}return t==="Yo"?s.ordinalNumber(c,{unit:"year"}):Ye(c,t.length)},R:function(r,t){const s=mv(r);return Ye(s,t.length)},u:function(r,t){const s=r.getFullYear();return Ye(s,t.length)},Q:function(r,t,s){const i=Math.ceil((r.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return Ye(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(r,t,s){const i=Math.ceil((r.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return Ye(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(r,t,s){const i=r.getMonth();switch(t){case"M":case"MM":return os.M(r,t);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(r,t,s){const i=r.getMonth();switch(t){case"L":return String(i+1);case"LL":return Ye(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(r,t,s,i){const l=SA(r,i);return t==="wo"?s.ordinalNumber(l,{unit:"week"}):Ye(l,t.length)},I:function(r,t,s){const i=_A(r);return t==="Io"?s.ordinalNumber(i,{unit:"week"}):Ye(i,t.length)},d:function(r,t,s){return t==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):os.d(r,t)},D:function(r,t,s){const i=xA(r);return t==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):Ye(i,t.length)},E:function(r,t,s){const i=r.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(r,t,s,i){const l=r.getDay(),c=(l-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return Ye(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(l,{width:"short",context:"formatting"});case"eeee":default:return s.day(l,{width:"wide",context:"formatting"})}},c:function(r,t,s,i){const l=r.getDay(),c=(l-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return Ye(c,t.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(l,{width:"narrow",context:"standalone"});case"cccccc":return s.day(l,{width:"short",context:"standalone"});case"cccc":default:return s.day(l,{width:"wide",context:"standalone"})}},i:function(r,t,s){const i=r.getDay(),l=i===0?7:i;switch(t){case"i":return String(l);case"ii":return Ye(l,t.length);case"io":return s.ordinalNumber(l,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(r,t,s){const l=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(r,t,s){const i=r.getHours();let l;switch(i===12?l=Li.noon:i===0?l=Li.midnight:l=i/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(r,t,s){const i=r.getHours();let l;switch(i>=17?l=Li.evening:i>=12?l=Li.afternoon:i>=4?l=Li.morning:l=Li.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(r,t,s){if(t==="ho"){let i=r.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return os.h(r,t)},H:function(r,t,s){return t==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):os.H(r,t)},K:function(r,t,s){const i=r.getHours()%12;return t==="Ko"?s.ordinalNumber(i,{unit:"hour"}):Ye(i,t.length)},k:function(r,t,s){let i=r.getHours();return i===0&&(i=24),t==="ko"?s.ordinalNumber(i,{unit:"hour"}):Ye(i,t.length)},m:function(r,t,s){return t==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):os.m(r,t)},s:function(r,t,s){return t==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):os.s(r,t)},S:function(r,t){return os.S(r,t)},X:function(r,t,s){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Hg(i);case"XXXX":case"XX":return Hs(i);case"XXXXX":case"XXX":default:return Hs(i,":")}},x:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"x":return Hg(i);case"xxxx":case"xx":return Hs(i);case"xxxxx":case"xxx":default:return Hs(i,":")}},O:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+$g(i,":");case"OOOO":default:return"GMT"+Hs(i,":")}},z:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+$g(i,":");case"zzzz":default:return"GMT"+Hs(i,":")}},t:function(r,t,s){const i=Math.trunc(+r/1e3);return Ye(i,t.length)},T:function(r,t,s){return Ye(+r,t.length)}};function $g(r,t=""){const s=r>0?"-":"+",i=Math.abs(r),l=Math.trunc(i/60),c=i%60;return c===0?s+String(l):s+String(l)+t+Ye(c,2)}function Hg(r,t){return r%60===0?(r>0?"-":"+")+Ye(Math.abs(r)/60,2):Hs(r,t)}function Hs(r,t=""){const s=r>0?"-":"+",i=Math.abs(r),l=Ye(Math.trunc(i/60),2),c=Ye(i%60,2);return s+l+t+c}const Gg=(r,t)=>{switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},bv=(r,t)=>{switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},EA=(r,t)=>{const s=r.match(/(P+)(p+)?/)||[],i=s[1],l=s[2];if(!l)return Gg(r,t);let c;switch(i){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",Gg(i,t)).replace("{{time}}",bv(l,t))},OA={p:bv,P:EA},AA=/^D+$/,jA=/^Y+$/,TA=["D","DD","YY","YYYY"];function kA(r){return AA.test(r)}function NA(r){return jA.test(r)}function CA(r,t,s){const i=MA(r,t,s);if(console.warn(i),TA.includes(r))throw new RangeError(i)}function MA(r,t,s){const i=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${t}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const RA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,DA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,qA=/^'([^]*?)'?$/,LA=/''/g,BA=/[a-zA-Z]/;function tm(r,t,s){var d,b,v,x;const i=Eo(),l=i.locale??yv,c=i.firstWeekContainsDate??((b=(d=i.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=i.weekStartsOn??((x=(v=i.locale)==null?void 0:v.options)==null?void 0:x.weekStartsOn)??0,y=bn(r,s==null?void 0:s.in);if(!UO(y))throw new RangeError("Invalid time value");let g=t.match(DA).map(w=>{const S=w[0];if(S==="p"||S==="P"){const M=OA[S];return M(w,l.formatLong)}return w}).join("").match(RA).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:PA(w)};if(Ig[S])return{isToken:!0,value:w};if(S.match(BA))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});l.localize.preprocessor&&(g=l.localize.preprocessor(y,g));const f={firstWeekContainsDate:c,weekStartsOn:m,locale:l};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(NA(S)||kA(S))&&CA(S,t,String(r));const M=Ig[S[0]];return M(y,S,l.localize,f)}).join("")}function PA(r){const t=r.match(qA);return t?t[1].replace(LA,"'"):r}function UA(r,t,s){const i=Eo(),l=(s==null?void 0:s.locale)??i.locale??yv,c=LO(r,t);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[y,g]=pv(s==null?void 0:s.in,...c>0?[t,r]:[r,t]),f=zO((s==null?void 0:s.roundingMethod)??"round"),d=g.getTime()-y.getTime(),b=d/qg,v=cu(g)-cu(y),x=(d-v)/qg,w=s==null?void 0:s.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<Pg?S="hour":x<Bg?S="day":x<Lg?S="month":S="year",S==="second"){const M=f(d/1e3);return l.formatDistance("xSeconds",M,m)}else if(S==="minute"){const M=f(b);return l.formatDistance("xMinutes",M,m)}else if(S==="hour"){const M=f(b/60);return l.formatDistance("xHours",M,m)}else if(S==="day"){const M=f(x/Pg);return l.formatDistance("xDays",M,m)}else if(S==="month"){const M=f(x/Bg);return M===12&&w!=="month"?l.formatDistance("xYears",1,m):l.formatDistance("xMonths",M,m)}else{const M=f(x/Lg);return l.formatDistance("xYears",M,m)}}function zA(r,t){return UA(r,BO(r),t)}function x3(r){return r.toLocaleString()}function _3(r){return r>=1e9?`${(r/1e9).toFixed(1).replace(/\.0$/,"")}B`:r>=1e6?`${(r/1e6).toFixed(1).replace(/\.0$/,"")}M`:r>=1e4?`${(r/1e3).toFixed(1).replace(/\.0$/,"")}K`:r.toLocaleString()}function IA(r){const t=new Date(r);return t.getTime()>Date.now()?"just now":zA(t,{addSuffix:!0})}function w3(r){const t=Date.now()-new Date(r).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const l=Math.floor(i/60);if(l<24)return`${l}h`;const c=Math.floor(l/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function S3(r){return r<=0?"Expired":nm(r)}function $A(r){return r==null?"--":nm(r)}function E3(r){return r?tm(new Date(r),"MMM d, yyyy h:mm a"):"--"}function nm(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const m=r/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const t=Math.floor(r/1e3),s=Math.floor(t/86400),i=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),c=t%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?l>0?`${i}h ${l}m`:`${i}h`:c>0?`${l}m ${c}s`:`${l}m`}function O3(r,t){const s=new Date(r).getTime(),i=t?new Date(t).getTime():Date.now();return nm(i-s)}function vv({options:r,children:t,className:s=""}){const[i,l]=j.useState(!1),[c,m]=j.useState(null),[y,g]=j.useState(null),f=j.useRef(null),d=j.useRef(void 0),b=j.useRef(void 0),v=220,x=j.useCallback(()=>{if(!f.current)return;const L=f.current.getBoundingClientRect(),U=window.innerWidth-v-8,re=Math.max(8,Math.min(L.left,U));g({top:L.bottom+4,left:re})},[]),w=j.useCallback(async(L,U)=>{try{await navigator.clipboard.writeText(L),m(U),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=j.useCallback(()=>{clearTimeout(b.current),x(),l(!0)},[x]),M=j.useCallback(()=>{b.current=setTimeout(()=>l(!1),150)},[]);return j.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),p.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:M,children:[t,i&&y&&fb.createPortal(p.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:y.top,left:y.left},onMouseEnter:S,onMouseLeave:M,children:r.map(L=>p.jsxs("button",{onClick:U=>{U.stopPropagation(),w(L.value,L.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[p.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:L.label}),p.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===L.label?"✓":L.value})]},L.label))}),document.body)]})}function HA(r,t){const s=new Date(r);switch(t){case"relative":return IA(r);case"datetime":return tm(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function GA(r){const t=new Date(r);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:tm(t,"MMM d, yyyy h:mm:ss a")}]}function xv({date:r,format:t="relative",className:s=""}){const[,i]=j.useState(0);j.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>i(m=>m+1),3e4);return()=>clearInterval(c)},[t]);const l=j.useMemo(()=>GA(r),[r]);return p.jsx(vv,{options:l,children:p.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:HA(r,t)})})}function FA({values:r,options:t,onChange:s,addLabel:i,emptyText:l,ariaLabel:c}){const m=t.filter(y=>!r.includes(y));return p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.map(y=>p.jsxs("button",{type:"button",onClick:()=>s(r.filter(g=>g!==y)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${y}`,children:[y,p.jsx(Ft,{className:"w-3 h-3",strokeWidth:1.5})]},y)),r.length===0&&l&&p.jsx("span",{className:"text-2xs text-text-tertiary italic",children:l}),m.length>0&&p.jsxs("select",{value:"",onChange:y=>y.target.value&&s([...r,y.target.value]),className:"select font-mono","aria-label":c??i,children:[p.jsx("option",{value:"",children:i}),m.map(y=>p.jsx("option",{value:y,children:y},y))]})]})}const VA=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function YA(){const{data:r}=hv(),{data:t}=pO(),s=NO(),i=CO(),[l,c]=j.useState(""),[m,y]=j.useState(""),[g,f]=j.useState(1440),[d,b]=j.useState([]),v=(r==null?void 0:r.announcements)??[],x=()=>{m.trim()&&s.mutate({body:m.trim(),...l.trim()?{title:l.trim()}:{},...d.length?{roles:d}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),y(""),b([])}})};return p.jsxs("div",{children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),p.jsx("input",{type:"text",value:l,onChange:w=>c(w.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),p.jsxs("label",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),p.jsx("textarea",{value:m,onChange:w=>y(w.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),p.jsxs("label",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),p.jsx("select",{value:g,onChange:w=>f(Number(w.target.value)),className:"select text-xs w-full",children:VA.map(w=>p.jsx("option",{value:w.minutes,children:w.label},w.minutes))})]}),p.jsxs("div",{className:"block",children:[p.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),p.jsx(FA,{values:d,options:(t==null?void 0:t.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&p.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),p.jsx("button",{onClick:x,disabled:!m.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),v.length>0&&p.jsxs("div",{className:"mt-6",children:[p.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),p.jsx("div",{className:"space-y-1",children:v.map(w=>p.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[p.jsxs("span",{className:"min-w-0 flex-1",children:[p.jsx("span",{className:"block text-xs text-text-primary truncate",children:w.title??w.body.split(`
|
|
54
|
-
`)[0]}),p.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",p.jsx(xv,{date:w.expires_at,format:"relative"})]})]}),p.jsx("button",{onClick:()=>i.mutate(w.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${w.title??"announcement"}`,children:p.jsx(Ft,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},w.id))})]})]})}const KA=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],XA=["operator","engineer","admin","superadmin"];function Fg(r){return XA.indexOf(r)}function JA(r,t){return Fg(r)>=Fg(t)}function QA({onClose:r}){var de,Oe,oe,je,Se,ke,We;const{isSuperAdmin:t,hasRoleType:s,hasRole:i}=Vt(),{data:l}=nr(),c=Yd(),m=!!((de=l==null?void 0:l.ai)!=null&&de.enabled),y=tv(),g=y!==null?y:m,[f,d]=j.useState(g),b=(Oe=l==null?void 0:l.features)==null?void 0:Oe.graphWorkflows,v=b==null,[x,w]=j.useState(b===!0||v&&nv()),S=!!((oe=l==null?void 0:l.features)!=null&&oe.scanCodes),M=rv(),[L,U]=j.useState(M!==null?M:S),re=t?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ce=((je=l==null?void 0:l.branding)==null?void 0:je.appName)??"LongTail",C=(Se=l==null?void 0:l.environment)==null?void 0:Se.longTailVersion,P=(ke=l==null?void 0:l.environment)==null?void 0:ke.hotmeshVersion,se=(We=l==null?void 0:l.environment)==null?void 0:We.nodeEnv;j.useEffect(()=>{const Ae=ct=>{ct.key==="Escape"&&r()};return document.addEventListener("keydown",Ae),()=>document.removeEventListener("keydown",Ae)},[r]);const X=KA.filter(Ae=>JA(re,Ae.minTier)),B=X.length>1,G=re!=="operator",W=[...B?[{id:"viewas",label:"View As",icon:gw}]:[],{id:"features",label:"Features",icon:bw},...G?[{id:"alerts",label:"Alerts",icon:vw}]:[]],[J,he]=j.useState(W[0].id),xe=Ae=>{Ae===null?Od():cO(Ae)},Te=()=>{const Ae=!f;d(Ae),Ae===m?lO():oO(Ae),window.location.reload()},Y=()=>{const Ae=!x;w(Ae),uO(Ae),window.location.reload()},ae=()=>{const Ae=!L;U(Ae),Ae===S?hO():fO(Ae),window.location.reload()};return p.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:r,children:p.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:Ae=>Ae.stopPropagation(),children:[p.jsx("button",{onClick:r,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:p.jsx(Ft,{className:"w-4 h-4",strokeWidth:1.5})}),p.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[p.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${kt}/logo512.png)`}}),p.jsxs("div",{className:"text-center",children:[p.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ce}),C&&p.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",C,P&&p.jsxs(p.Fragment,{children:[" · HotMesh v",P]}),se&&se!=="production"&&p.jsx("span",{className:"ml-1 text-status-warning",children:se})]})]})]}),p.jsx("hr",{className:"border-surface-border/50 mb-6"}),W.length>1&&p.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:W.map(Ae=>{const ct=J===Ae.id;return p.jsxs("button",{role:"tab","aria-selected":ct,onClick:()=>he(Ae.id),title:Ae.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${ct?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[p.jsx(Ae.icon,{className:"w-5 h-5",strokeWidth:1.5,...ct?{fill:"currentColor",fillOpacity:.15}:{}}),p.jsx("span",{className:"text-2xs font-medium",children:Ae.label})]},Ae.id)})}),J==="viewas"&&B&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(Ae=>{const ct=c===Ae.id,At=Ae.id===null?`Your view · ${re}`:Ae.label;return p.jsxs("button",{onClick:()=>xe(Ae.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[p.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${ct?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:ct&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),p.jsxs("span",{children:[p.jsx("span",{className:`block text-sm font-medium transition-colors ${ct?"text-accent":"text-text-primary group-hover:text-accent"}`,children:At}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:Ae.description})]})]},String(Ae.id))})]}),J==="features"&&p.jsxs("div",{children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),p.jsxs("button",{onClick:Te,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[p.jsxs("span",{children:[p.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:f?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),p.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${f?"bg-accent":"bg-surface-border"}`,children:p.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),v&&p.jsxs("button",{onClick:Y,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[p.jsxs("span",{children:[p.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:x?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),p.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${x?"bg-accent":"bg-surface-border"}`,children:p.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${x?"translate-x-4":"translate-x-0"}`})})]}),p.jsxs("button",{onClick:ae,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[p.jsxs("span",{children:[p.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),p.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:L?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),p.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${L?"bg-accent":"bg-surface-border"}`,children:p.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${L?"translate-x-4":"translate-x-0"}`})})]})]}),J==="alerts"&&G&&p.jsx(YA,{}),p.jsx("hr",{className:"border-surface-border/50 mt-8"}),p.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const _v=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],Vg="blue",wv="lt.theme";let Sv=[];function ZA(r){const t=new Set(_v.map(i=>i.id)),s=new Set;Sv=r.filter(i=>!(i!=null&&i.id)||t.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function WA(){return[..._v,...Sv]}function Ev(){try{return localStorage.getItem(wv)||Vg}catch{return Vg}}function Ov(r){document.documentElement.dataset.theme=r}function ej(r){try{localStorage.setItem(wv,r)}catch{}Ov(r)}const Av=j.createContext(null);function tj(){const r=j.useContext(Av);if(!r)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return r}function nj({children:r}){const[t,s]=j.useState(null),i=j.useRef(t);i.current=t,j.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){s(null);return}const f=setTimeout(()=>s(null),g);return()=>clearTimeout(f)},[t]);const l=j.useCallback(g=>{var d;if(!g.actingToken||!g.actor)return null;const f=((d=i.current)==null?void 0:d.actingToken)??null;return s({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),f},[]),c=j.useCallback(()=>s(null),[]);j.useEffect(()=>(eg(()=>{var g;return((g=i.current)==null?void 0:g.actingToken)??null}),tg(c),()=>{eg(null),tg(null)}),[c]);const m=j.useCallback(()=>{var f;const g=(f=i.current)==null?void 0:f.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),y=j.useMemo(()=>({identity:t,prime:l,clear:c,remainingSeconds:m}),[t,l,c,m]);return p.jsx(Av.Provider,{value:y,children:r})}const Zc={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},jv="lt_scan_wedge_config";function Tv(){try{const r=localStorage.getItem(jv);return r?{...Zc,...JSON.parse(r)}:Zc}catch{return Zc}}function rj(r){const t={...Tv(),...r};return localStorage.setItem(jv,JSON.stringify(t)),t}const sj=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function Yg(r){let t=null;for(const s of sj){const i=r.match(s);i&&(!t||i[0].length>t.length)&&(t=i[0])}return t}const ij=new Set(["Shift","CapsLock"]),nc={suppress:!1,emit:null};function aj(r=Zc){let t={buffer:"",times:[],lastKeyMs:0};function s(){t={buffer:"",times:[],lastKeyMs:0}}function i(m){const{key:y,timeMs:g,hasModifier:f,isRepeat:d}=m;if(ij.has(y))return nc;if(r.terminators.includes(y)){const S=Yg(t.buffer);return s(),S&&S.length>=r.minLength?{suppress:!0,emit:S,consumedLength:S.length}:nc}if(f||d||y.length!==1)return s(),nc;const b=g-t.lastKeyMs,v=t.lastKeyMs>0&&b<=r.maxKeyGapMs,x=(v?t.buffer+y:y).slice(-128),w=(v?[...t.times,g]:[g]).slice(-128);return t={buffer:x,times:w,lastKeyMs:g},nc}function l(){return{buffer:t.buffer}}function c(){const m=Yg(t.buffer);if(!m||m.length<r.minLength)return null;const y=t.times.slice(-m.length);return y.length<2||(y[y.length-1]-y[0])/(y.length-1)>r.autoFireMaxAvgKeyMs?null:{code:m,consumedLength:m.length}}return{step:i,reset:s,snapshot:l,pendingAutoFire:c}}function oj(){const r=document.activeElement;return r instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(r.type)?r:null:r instanceof HTMLTextAreaElement?r:null}function lj(r,t,s){var c;const i=r instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,l=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;l?l.call(r,t):r.value=t;try{r.setSelectionRange(s,s)}catch{}r.dispatchEvent(new Event("input",{bubbles:!0}))}function Kg(r){if(r<=0)return;const t=oj();if(!t)return;const s=t.selectionStart??t.value.length,i=Math.max(0,s-r);lj(t,t.value.slice(0,i)+t.value.slice(s),i)}function cj({active:r,wedgeConfig:t,diagnosticsOn:s,onScan:i,onDiag:l}){const c=j.useRef({diagnosticsOn:s,onScan:i,onDiag:l});c.current={diagnosticsOn:s,onScan:i,onDiag:l};const m=j.useRef(0),y=j.useRef(0);j.useEffect(()=>{if(!r)return;const g=aj(t);let f=null;const d=()=>{f&&(clearTimeout(f),f=null)},b=(w,S,M)=>{S&&Kg(S),c.current.diagnosticsOn&&(console.debug("[scan]",M),c.current.onDiag({seq:++m.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:M})),c.current.onScan(w)},v=()=>{d(),g.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const w=g.pendingAutoFire();w&&(g.reset(),b(w.code,w.consumedLength,`capture → ${w.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},x=w=>{const S=g.snapshot().buffer,{suppress:M,emit:L,consumedLength:U}=g.step({key:w.key,timeMs:w.timeStamp,hasModifier:w.ctrlKey||w.metaKey||w.altKey,isRepeat:w.repeat});if(M&&(w.preventDefault(),w.stopPropagation()),c.current.diagnosticsOn){const re=g.snapshot().buffer,ce=t.terminators.includes(w.key),C=L?`capture → ${L}`:ce?`terminator — no code tail in "${S.slice(-24)}"`:re===S?S?"neutral (chord key)":"ignored":re===""?"reset (edit/chord/non-printable)":re.length<=1&&S.length>1?"gap — new episode":"accumulate",P=y.current?Math.round(w.timeStamp-y.current):0,se={seq:++m.current,key:w.key,code:w.code!==w.key?w.code:"",deltaMs:P,buffer:re.slice(-24),note:C};console.debug("[scan]",se.key,se.code,`${se.deltaMs}ms`,se.note),c.current.onDiag(se)}y.current=w.timeStamp,L?(d(),U&&Kg(U),c.current.onScan(L)):v()};return window.addEventListener("keydown",x,{capture:!0}),()=>{d(),window.removeEventListener("keydown",x,{capture:!0})}},[r,t])}const ze={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},rc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},A3={ACTION:"action",IDENTITY:"identity"};function uj(r,t){return _e("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:r,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function j3(r){return _e("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(r)})}function T3(){return lt({queryKey:["scan-schemes"],queryFn:()=>_e("/scan-codes/schemes")})}function k3(r){return lt({queryKey:["scan-schemes",r],queryFn:()=>_e(`/scan-codes/schemes/${r}`),enabled:r!=null})}function N3(){const r=ot();return mt({mutationFn:t=>_e(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>r.invalidateQueries({queryKey:["scan-schemes"]})})}function C3(){const r=ot();return mt({mutationFn:t=>_e(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>r.invalidateQueries({queryKey:["scan-schemes"]})})}function M3(){const r=ot();return mt({mutationFn:t=>_e(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,s)=>r.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function R3(){const r=ot();return mt({mutationFn:t=>_e(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,s)=>r.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const Xg={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual"},Bi=r=>{if(r)try{return JSON.parse(r)}catch{return}},Gs=r=>r==null||Array.isArray(r)&&r.length===0||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0;function fj(r){const t={},s=Bi(r.get("facets"));Gs(s)||(t.facets=s);const i=Bi(r.get("block"));Gs(i)||(t.block=i);const l=Bi(r.get("range"));Gs(l)||(t.range=l);const c=Bi(r.get("exists"));Gs(c)||(t.exists=c);const m=Bi(r.get("roles"));Gs(m)||(t.roles=m);const y=Bi(r.get("orderBy"));Gs(y)||(t.orderBy=y),r.get("available")!=null&&(t.available=r.get("available")==="true");const g=r.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function D3(r,t){const s=(i,l)=>Gs(l)?r.delete(i):r.set(i,JSON.stringify(l));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?r.delete("available"):r.set("available",String(t.available)),t.jeopardy===!0?r.set("jeopardy","1"):r.delete("jeopardy")}const Jg=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function kv(r,t){const s={};for(const[l,c]of Object.entries(r))s[l]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${i}${Jg}`:`/escalations/available?facets=${i}${Jg}`}function q3(r,t,s){return kv({[r]:t},s)}function L3(r){var t,s,i;return Object.keys(r.facets??{}).length+(((t=r.block)==null?void 0:t.length)??0)+(((s=r.range)==null?void 0:s.length)??0)+(((i=r.exists)==null?void 0:i.length)??0)+(r.available!=null?1:0)+(r.jeopardy===!0?1:0)}function Nv(){var s;const{data:r}=nr(),t=rv();return t!==null?t:!!((s=r==null?void 0:r.features)!=null&&s.scanCodes)}const Cv=j.createContext(null);function Mv(){const r=j.useContext(Cv);if(!r)throw new Error("useScanInput must be used within ScanInputProvider");return r}const hj="scanPendingAction",dj="scanChoices",mj="/scan/station";function pj({children:r}){const{user:t}=Vt(),s=Nv(),i=_o(),{identity:l,prime:c}=tj(),[m,y]=j.useState(null),[g,f]=j.useState(!1),[d,b]=j.useState(()=>Tv()),[v,x]=j.useState([]),[w,S]=j.useState(!1),M=j.useCallback(B=>{var W;const{outcome:G}=B;if(G===ze.CONFIRM_REQUIRED&&B.pendingAction)return i(`/escalations/detail/${B.pendingAction.escalationId}`,{state:{[hj]:B.pendingAction}}),!0;if(G===ze.EXECUTED&&B.escalation){const J=[rc.SHOW_DETAIL,rc.CLAIM_SHOW_DETAIL,rc.CLAIM,rc.ESCALATE];return B.verb&&J.includes(B.verb)?(i(`/escalations/detail/${B.escalation.id}`),!0):!1}if(G===ze.MATCHED_LIST&&B.listQuery){const{targetFacet:J,target:he,roles:xe}=B.listQuery;return i(kv({[J]:he},(xe==null?void 0:xe[0])??null)),!0}return G===ze.CHOICES&&B.choices?(i(mj,{state:{[dj]:B}}),!0):G===ze.NO_MATCH_FALLBACK&&((W=B.fallback)!=null&&W.route)?(i(B.fallback.route),!0):!1},[i]),L=j.useRef(null);L.current=(l==null?void 0:l.actingToken)??null;const U=j.useRef(null),re=j.useRef(null),ce=j.useCallback(B=>{re.current=B},[]),C=j.useCallback(async(B,G=Xg.MANUAL)=>{var J;if((J=re.current)!=null&&J.call(re,B))return;f(!0);const W=Date.now();try{const he=await uj(B,{actingToken:L.current??void 0,previousActingToken:U.current??void 0});he.outcome===ze.IDENTITY_PRIMED&&(U.current=c(he));const xe=M(he);y({code:B,source:G,at:W,response:he,error:null,navigated:xe})}catch(he){y({code:B,source:G,at:W,response:null,error:he.message,navigated:!1})}finally{f(!1)}},[M,c]),P=j.useRef(C);P.current=C,cj({active:!!t&&s,wedgeConfig:d,diagnosticsOn:w,onScan:B=>void P.current(B,Xg.KEYBOARD_WEDGE),onDiag:B=>x(G=>[...G.slice(-29),B])});const se=j.useCallback(B=>{b(rj(B))},[]),X=j.useMemo(()=>({submitCode:C,setCodeInterceptor:ce,lastResult:m,busy:g,wedgeConfig:d,updateWedgeConfig:se,diagnostics:v,diagnosticsOn:w,setDiagnosticsOn:S}),[C,ce,m,g,d,se,v,w]);return p.jsx(Cv.Provider,{value:X,children:r})}var sc={},to={},ic={},Qg;function xn(){if(Qg)return ic;Qg=1,Object.defineProperty(ic,"__esModule",{value:!0});function r(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var t=function s(i,l){r(this,s),this.data=i,this.text=l.text||i,this.options=l};return ic.default=t,ic}var Zg;function yj(){if(Zg)return to;Zg=1,Object.defineProperty(to,"__esModule",{value:!0}),to.CODE39=void 0;var r=(function(){function S(M,L){for(var U=0;U<L.length;U++){var re=L[U];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(M,re.key,re)}}return function(M,L,U){return L&&S(M.prototype,L),U&&S(M,U),M}})(),t=xn(),s=i(t);function i(S){return S&&S.__esModule?S:{default:S}}function l(S,M){if(!(S instanceof M))throw new TypeError("Cannot call a class as a function")}function c(S,M){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:S}function m(S,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);S.prototype=Object.create(M&&M.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(S,M):S.__proto__=M)}var y=(function(S){m(M,S);function M(L,U){return l(this,M),L=L.toUpperCase(),U.mod43&&(L+=v(w(L))),c(this,(M.__proto__||Object.getPrototypeOf(M)).call(this,L,U))}return r(M,[{key:"encode",value:function(){for(var U=d("*"),re=0;re<this.data.length;re++)U+=d(this.data[re])+"0";return U+=d("*"),{data:U,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),M})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],f=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function d(S){return b(x(S))}function b(S){return f[S].toString(2)}function v(S){return g[S]}function x(S){return g.indexOf(S)}function w(S){for(var M=0,L=0;L<S.length;L++)M+=x(S[L]);return M=M%43,M}return to.CODE39=y,to}var In={},ac={},oc={},dt={},Wg;function Oo(){if(Wg)return dt;Wg=1,Object.defineProperty(dt,"__esModule",{value:!0});var r;function t(g,f,d){return f in g?Object.defineProperty(g,f,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[f]=d,g}var s=dt.SET_A=0,i=dt.SET_B=1,l=dt.SET_C=2;dt.SHIFT=98;var c=dt.START_A=103,m=dt.START_B=104,y=dt.START_C=105;return dt.MODULO=103,dt.STOP=106,dt.FNC1=207,dt.SET_BY_CODE=(r={},t(r,c,s),t(r,m,i),t(r,y,l),r),dt.SWAP={101:s,100:i,99:l},dt.A_START_CHAR="Ð",dt.B_START_CHAR="Ñ",dt.C_START_CHAR="Ò",dt.A_CHARS="[\0-_È-Ï]",dt.B_CHARS="[ -È-Ï]",dt.C_CHARS="(Ï*[0-9]{2}Ï*)",dt.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],dt}var e1;function xu(){if(e1)return oc;e1=1,Object.defineProperty(oc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xn(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){c(this,d);var x=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),v));return x.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),x}return r(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.bytes,x=v.shift()-105,w=i.SET_BY_CODE[x];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&v.unshift(i.FNC1);var S=d.next(v,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(x)+S.result+d.getBar((S.checksum+x)%i.MODULO)+d.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var v=this.options.ean128||!1;return typeof v=="string"&&(v=v.toLowerCase()==="true"),v}}],[{key:"getBar",value:function(v){return i.BARS[v]?i.BARS[v].toString():""}},{key:"correctIndex",value:function(v,x){if(x===i.SET_A){var w=v.shift();return w<32?w+64:w-32}else return x===i.SET_B?v.shift()-32:(v.shift()-48)*10+v.shift()-48}},{key:"next",value:function(v,x,w){if(!v.length)return{result:"",checksum:0};var S=void 0,M=void 0;if(v[0]>=200){M=v.shift()-105;var L=i.SWAP[M];L!==void 0?S=d.next(v,x+1,L):((w===i.SET_A||w===i.SET_B)&&M===i.SHIFT&&(v[0]=w===i.SET_A?v[0]>95?v[0]-96:v[0]:v[0]<32?v[0]+96:v[0]),S=d.next(v,x+1,w))}else M=d.correctIndex(v,w),S=d.next(v,x+1,w);var U=d.getBar(M),re=M*x;return{result:U+S.result,checksum:re+S.checksum}}}]),d})(s.default);return oc.default=g,oc}var lc={},t1;function gj(){if(t1)return lc;t1=1,Object.defineProperty(lc,"__esModule",{value:!0});var r=Oo(),t=function(y){return y.match(new RegExp("^"+r.A_CHARS+"*"))[0].length},s=function(y){return y.match(new RegExp("^"+r.B_CHARS+"*"))[0].length},i=function(y){return y.match(new RegExp("^"+r.C_CHARS+"*"))[0]};function l(m,y){var g=y?r.A_CHARS:r.B_CHARS,f=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(m.substring(f[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(y?205:206)+l(m.substring(d.length),!y)}function c(m){var y=i(m),g=y.length;if(g===m.length)return m;m=m.substring(g);var f=t(m)>=s(m);return y+String.fromCharCode(f?206:205)+l(m,f)}return lc.default=function(m){var y=void 0,g=i(m).length;if(g>=2)y=r.C_START_CHAR+c(m);else{var f=t(m)>s(m);y=(f?r.A_START_CHAR:r.B_START_CHAR)+l(m,f)}return y.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},lc}var n1;function bj(){if(n1)return ac;n1=1,Object.defineProperty(ac,"__esModule",{value:!0});var r=xu(),t=l(r),s=gj(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var x=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,i.default)(b),v));else var x=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v));return m(x)}return d})(t.default);return ac.default=g,ac}var cc={},r1;function vj(){if(r1)return cc;r1=1,Object.defineProperty(cc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.A_START_CHAR+b,v))}return r(d,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),d})(s.default);return cc.default=g,cc}var uc={},s1;function xj(){if(s1)return uc;s1=1,Object.defineProperty(uc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.B_START_CHAR+b,v))}return r(d,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),d})(s.default);return uc.default=g,uc}var fc={},i1;function _j(){if(i1)return fc;i1=1,Object.defineProperty(fc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.C_START_CHAR+b,v))}return r(d,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),d})(s.default);return fc.default=g,fc}var a1;function wj(){if(a1)return In;a1=1,Object.defineProperty(In,"__esModule",{value:!0}),In.CODE128C=In.CODE128B=In.CODE128A=In.CODE128=void 0;var r=bj(),t=g(r),s=vj(),i=g(s),l=xj(),c=g(l),m=_j(),y=g(m);function g(f){return f&&f.__esModule?f:{default:f}}return In.CODE128=t.default,In.CODE128A=i.default,In.CODE128B=c.default,In.CODE128C=y.default,In}var zt={},hc={},Er={},o1;function Ao(){return o1||(o1=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.SIDE_BIN="101",Er.MIDDLE_BIN="01010",Er.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},Er.EAN2_STRUCTURE=["LL","LG","GL","GG"],Er.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Er.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Er}var dc={},mc={},l1;function jo(){if(l1)return mc;l1=1,Object.defineProperty(mc,"__esModule",{value:!0});var r=Ao(),t=function(i,l,c){var m=i.split("").map(function(g,f){return r.BINARIES[l[f]]}).map(function(g,f){return g?g[i[f]]:""});if(c){var y=i.length-1;m=m.map(function(g,f){return f<y?g+c:g})}return m.join("")};return mc.default=t,mc}var c1;function Rv(){if(c1)return dc;c1=1,Object.defineProperty(dc,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})(),t=Ao(),s=jo(),i=m(s),l=xn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function y(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(x,w){y(this,v);var S=g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return r(v,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),v})(c.default);return dc.default=d,dc}var u1;function Sj(){if(u1)return hc;u1=1,Object.defineProperty(hc,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})(),t=function b(v,x,w){v===null&&(v=Function.prototype);var S=Object.getOwnPropertyDescriptor(v,x);if(S===void 0){var M=Object.getPrototypeOf(v);return M===null?void 0:b(M,x,w)}else{if("value"in S)return S.value;var L=S.get;return L===void 0?void 0:L.call(w)}},s=Ao(),i=Rv(),l=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function y(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=function(v){var x=v.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,M){return M%2?w+S*3:w+S},0);return(10-x%10)%10},d=(function(b){g(v,b);function v(x,w){m(this,v),x.search(/^[0-9]{12}$/)!==-1&&(x+=f(x));var S=y(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w));return S.lastChar=w.lastChar,S}return r(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),v})(l.default);return hc.default=d,hc}var pc={},f1;function Ej(){if(f1)return pc;f1=1,Object.defineProperty(pc,"__esModule",{value:!0});var r=(function(){function d(b,v){for(var x=0;x<v.length;x++){var w=v[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,v,x){return v&&d(b.prototype,v),x&&d(b,x),b}})(),t=function d(b,v,x){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,v);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,v,x)}else{if("value"in w)return w.value;var M=w.get;return M===void 0?void 0:M.call(x)}},s=Rv(),i=l(s);function l(d){return d&&d.__esModule?d:{default:d}}function c(d,b){if(!(d instanceof b))throw new TypeError("Cannot call a class as a function")}function m(d,b){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:d}function y(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);d.prototype=Object.create(b&&b.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(d,b):d.__proto__=b)}var g=function(b){var v=b.substr(0,7).split("").map(function(x){return+x}).reduce(function(x,w,S){return S%2?x+w:x+w*3},0);return(10-v%10)%10},f=(function(d){y(b,d);function b(v,x){return c(this,b),v.search(/^[0-9]{7}$/)!==-1&&(v+=g(v)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,x))}return r(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var x=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,x,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var x=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,x,"RRRR")}}]),b})(i.default);return pc.default=f,pc}var yc={},h1;function Oj(){if(h1)return yc;h1=1,Object.defineProperty(yc,"__esModule",{value:!0});var r=(function(){function v(x,w){for(var S=0;S<w.length;S++){var M=w[S];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(x,M.key,M)}}return function(x,w,S){return w&&v(x.prototype,w),S&&v(x,S),x}})(),t=Ao(),s=jo(),i=m(s),l=xn(),c=m(l);function m(v){return v&&v.__esModule?v:{default:v}}function y(v,x){if(!(v instanceof x))throw new TypeError("Cannot call a class as a function")}function g(v,x){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:v}function f(v,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);v.prototype=Object.create(x&&x.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(v,x):v.__proto__=x)}var d=function(x){var w=x.split("").map(function(S){return+S}).reduce(function(S,M,L){return L%2?S+M*9:S+M*3},0);return w%10},b=(function(v){f(x,v);function x(w,S){return y(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,w,S))}return r(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),x})(c.default);return yc.default=b,yc}var gc={},d1;function Aj(){if(d1)return gc;d1=1,Object.defineProperty(gc,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})(),t=Ao(),s=jo(),i=m(s),l=xn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function y(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(x,w){return y(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w))}return r(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,w,"01"),text:this.text}}}]),v})(c.default);return gc.default=d,gc}var no={},m1;function Dv(){if(m1)return no;m1=1,Object.defineProperty(no,"__esModule",{value:!0});var r=(function(){function b(v,x){for(var w=0;w<x.length;w++){var S=x[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,x,w){return x&&b(v.prototype,x),w&&b(v,w),v}})();no.checksum=d;var t=jo(),s=c(t),i=xn(),l=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function y(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=(function(b){g(v,b);function v(x,w){m(this,v),x.search(/^[0-9]{11}$/)!==-1&&(x+=d(x));var S=y(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,x,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return r(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==d(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),v})(l.default);function d(b){var v=0,x;for(x=1;x<11;x+=2)v+=parseInt(b[x]);for(x=0;x<11;x+=2)v+=parseInt(b[x])*3;return(10-v%10)%10}return no.default=f,no}var bc={},p1;function jj(){if(p1)return bc;p1=1,Object.defineProperty(bc,"__esModule",{value:!0});var r=(function(){function w(S,M){for(var L=0;L<M.length;L++){var U=M[L];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(S,U.key,U)}}return function(S,M,L){return M&&w(S.prototype,M),L&&w(S,L),S}})(),t=jo(),s=m(t),i=xn(),l=m(i),c=Dv();function m(w){return w&&w.__esModule?w:{default:w}}function y(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function g(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function f(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var d=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],v=(function(w){f(S,w);function S(M,L){y(this,S);var U=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,M,L));if(U.isValid=!1,M.search(/^[0-9]{6}$/)!==-1)U.middleDigits=M,U.upcA=x(M,"0"),U.text=L.text||""+U.upcA[0]+M+U.upcA[U.upcA.length-1],U.isValid=!0;else if(M.search(/^[01][0-9]{7}$/)!==-1)if(U.middleDigits=M.substring(1,M.length-1),U.upcA=x(U.middleDigits,M[0]),U.upcA[U.upcA.length-1]===M[M.length-1])U.isValid=!0;else return g(U);else return g(U);return U.displayValue=L.displayValue,L.fontSize>L.width*10?U.fontSize=L.width*10:U.fontSize=L.fontSize,U.guardHeight=L.height+U.fontSize/2+L.textMargin,U}return r(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var L="";return L+="101",L+=this.encodeMiddleDigits(),L+="010101",{data:L,text:this.text}}},{key:"guardedEncoding",value:function(){var L=[];return this.displayValue&&L.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),L.push({data:"101",options:{height:this.guardHeight}}),L.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),L.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&L.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),L}},{key:"encodeMiddleDigits",value:function(){var L=this.upcA[0],U=this.upcA[this.upcA.length-1],re=b[parseInt(U)][parseInt(L)];return(0,s.default)(this.middleDigits,re)}}]),S})(l.default);function x(w,S){for(var M=parseInt(w[w.length-1]),L=d[M],U="",re=0,ce=0;ce<L.length;ce++){var C=L[ce];C==="X"?U+=w[re++]:U+=C}return U=""+S+U,""+U+(0,c.checksum)(U)}return bc.default=v,bc}var y1;function Tj(){if(y1)return zt;y1=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.UPCE=zt.UPC=zt.EAN2=zt.EAN5=zt.EAN8=zt.EAN13=void 0;var r=Sj(),t=v(r),s=Ej(),i=v(s),l=Oj(),c=v(l),m=Aj(),y=v(m),g=Dv(),f=v(g),d=jj(),b=v(d);function v(x){return x&&x.__esModule?x:{default:x}}return zt.EAN13=t.default,zt.EAN8=i.default,zt.EAN5=c.default,zt.EAN2=y.default,zt.UPC=f.default,zt.UPCE=b.default,zt}var Is={},vc={},Pi={},g1;function kj(){return g1||(g1=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.START_BIN="1010",Pi.END_BIN="11101",Pi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Pi}var b1;function qv(){if(b1)return vc;b1=1,Object.defineProperty(vc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=kj(),s=xn(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return r(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var v=this,x=this.data.match(/.{2}/g).map(function(w){return v.encodePair(w)}).join("");return{data:t.START_BIN+x+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(v){var x=t.BINARIES[v[1]];return t.BINARIES[v[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(x[S]==="1"?"000":"0")}).join("")}}]),d})(i.default);return vc.default=g,vc}var xc={},v1;function Nj(){if(v1)return xc;v1=1,Object.defineProperty(xc,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=qv(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var y=function(d){var b=d.substr(0,13).split("").map(function(v){return parseInt(v,10)}).reduce(function(v,x,w){return v+x*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(f){m(d,f);function d(b,v){return l(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=y(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return r(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===y(this.data)}}]),d})(s.default);return xc.default=g,xc}var x1;function Cj(){if(x1)return Is;x1=1,Object.defineProperty(Is,"__esModule",{value:!0}),Is.ITF14=Is.ITF=void 0;var r=qv(),t=l(r),s=Nj(),i=l(s);function l(c){return c&&c.__esModule?c:{default:c}}return Is.ITF=t.default,Is.ITF14=i.default,Is}var un={},_c={},_1;function To(){if(_1)return _c;_1=1,Object.defineProperty(_c,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=xn(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var y=(function(f){m(d,f);function d(b,v){return l(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return r(d,[{key:"encode",value:function(){for(var v="110",x=0;x<this.data.length;x++){var w=parseInt(this.data[x]),S=w.toString(2);S=g(S,4-S.length);for(var M=0;M<S.length;M++)v+=S[M]=="0"?"100":"110"}return v+="1001",{data:v,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(s.default);function g(f,d){for(var b=0;b<d;b++)f="0"+f;return f}return _c.default=y,_c}var wc={},ro={},w1;function _u(){if(w1)return ro;w1=1,Object.defineProperty(ro,"__esModule",{value:!0}),ro.mod10=r,ro.mod11=t;function r(s){for(var i=0,l=0;l<s.length;l++){var c=parseInt(s[l]);(l+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function t(s){for(var i=0,l=[2,3,4,5,6,7],c=0;c<s.length;c++){var m=parseInt(s[s.length-1-c]);i+=l[c%l.length]*m}return(11-i%11)%11}return ro}var S1;function Mj(){if(S1)return wc;S1=1,Object.defineProperty(wc,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,s.mod10)(d),b))}return f})(t.default);return wc.default=y,wc}var Sc={},E1;function Rj(){if(E1)return Sc;E1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,s.mod11)(d),b))}return f})(t.default);return Sc.default=y,Sc}var Ec={},O1;function Dj(){if(O1)return Ec;O1=1,Object.defineProperty(Ec,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,s.mod10)(d),d+=(0,s.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return Ec.default=y,Ec}var Oc={},A1;function qj(){if(A1)return Oc;A1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var r=To(),t=i(r),s=_u();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,s.mod11)(d),d+=(0,s.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return Oc.default=y,Oc}var j1;function Lj(){if(j1)return un;j1=1,Object.defineProperty(un,"__esModule",{value:!0}),un.MSI1110=un.MSI1010=un.MSI11=un.MSI10=un.MSI=void 0;var r=To(),t=d(r),s=Mj(),i=d(s),l=Rj(),c=d(l),m=Dj(),y=d(m),g=qj(),f=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return un.MSI=t.default,un.MSI10=i.default,un.MSI11=c.default,un.MSI1010=y.default,un.MSI1110=f.default,un}var so={},T1;function Bj(){if(T1)return so;T1=1,Object.defineProperty(so,"__esModule",{value:!0}),so.pharmacode=void 0;var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=xn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){l(this,f);var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b));return v.number=parseInt(d,10),v}return r(f,[{key:"encode",value:function(){for(var b=this.number,v="";!isNaN(b)&&b!=0;)b%2===0?(v="11100"+v,b=(b-2)/2):(v="100"+v,b=(b-1)/2);return v=v.slice(0,-2),{data:v,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(s.default);return so.pharmacode=y,so}var io={},k1;function Pj(){if(k1)return io;k1=1,Object.defineProperty(io,"__esModule",{value:!0}),io.codabar=void 0;var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=xn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){l(this,f),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d.toUpperCase(),b));return v.text=v.options.text||v.text.replace(/[A-D]/g,""),v}return r(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],v=this.getEncodings(),x=0;x<this.data.length;x++)b.push(v[this.data.charAt(x)]),x!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),f})(s.default);return io.codabar=y,io}var $s={},Ac={},Ui={},N1;function Uj(){return N1||(N1=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Ui.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Ui.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Ui}var C1;function Lv(){if(C1)return Ac;C1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var r=(function(){function f(d,b){for(var v=0;v<b.length;v++){var x=b[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(d,x.key,x)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=Uj(),s=xn(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function y(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){y(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return r(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.data.split("").flatMap(function(M){return t.MULTI_SYMBOLS[M]||M}),x=v.map(function(M){return d.getEncoding(M)}).join(""),w=d.checksum(v,20),S=d.checksum(v.concat(w),15);return{text:this.text,data:d.getEncoding("ÿ")+x+d.getEncoding(w)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(v){return t.BINARIES[d.symbolValue(v)]}},{key:"getSymbol",value:function(v){return t.SYMBOLS[v]}},{key:"symbolValue",value:function(v){return t.SYMBOLS.indexOf(v)}},{key:"checksum",value:function(v,x){var w=v.slice().reverse().reduce(function(S,M,L){var U=L%x+1;return S+d.symbolValue(M)*U},0);return d.getSymbol(w%47)}}]),d})(i.default);return Ac.default=g,Ac}var jc={},M1;function zj(){if(M1)return jc;M1=1,Object.defineProperty(jc,"__esModule",{value:!0});var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=Lv(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return r(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(s.default);return jc.default=y,jc}var R1;function Ij(){if(R1)return $s;R1=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.CODE93FullASCII=$s.CODE93=void 0;var r=Lv(),t=l(r),s=zj(),i=l(s);function l(c){return c&&c.__esModule?c:{default:c}}return $s.CODE93=t.default,$s.CODE93FullASCII=i.default,$s}var ao={},D1;function $j(){if(D1)return ao;D1=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.GenericBarcode=void 0;var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=xn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return r(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(s.default);return ao.GenericBarcode=y,ao}var q1;function Hj(){if(q1)return sc;q1=1,Object.defineProperty(sc,"__esModule",{value:!0});var r=yj(),t=wj(),s=Tj(),i=Cj(),l=Lj(),c=Bj(),m=Pj(),y=Ij(),g=$j();return sc.default={CODE39:r.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:l.MSI,MSI10:l.MSI10,MSI11:l.MSI11,MSI1010:l.MSI1010,MSI1110:l.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:y.CODE93,CODE93FullASCII:y.CODE93FullASCII,GenericBarcode:g.GenericBarcode},sc}var Tc={},L1;function wu(){if(L1)return Tc;L1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var r=Object.assign||function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(t[l]=i[l])}return t};return Tc.default=function(t,s){return r({},t,s)},Tc}var kc={},B1;function Gj(){if(B1)return kc;B1=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.default=r;function r(t){var s=[];function i(l){if(Array.isArray(l))for(var c=0;c<l.length;c++)i(l[c]);else l.text=l.text||"",l.data=l.data||"",s.push(l)}return i(t),s}return kc}var Nc={},P1;function Fj(){if(P1)return Nc;P1=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.default=r;function r(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return Nc}var Cc={},Mc={},Rc={},U1;function Bv(){if(U1)return Rc;U1=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.default=r;function r(t){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof t[i]=="string"&&(t[i]=parseInt(t[i],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Rc}var Dc={},z1;function Pv(){if(z1)return Dc;z1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var r={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return Dc.default=r,Dc}var I1;function Vj(){if(I1)return Mc;I1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var r=Bv(),t=l(r),s=Pv(),i=l(s);function l(m){return m&&m.__esModule?m:{default:m}}function c(m){var y={};for(var g in i.default)i.default.hasOwnProperty(g)&&(m.hasAttribute("jsbarcode-"+g.toLowerCase())&&(y[g]=m.getAttribute("jsbarcode-"+g.toLowerCase())),m.hasAttribute("data-"+g.toLowerCase())&&(y[g]=m.getAttribute("data-"+g.toLowerCase())));return y.value=m.getAttribute("jsbarcode-value")||m.getAttribute("data-value"),y=(0,t.default)(y),y}return Mc.default=c,Mc}var qc={},Lc={},fn={},$1;function Uv(){if($1)return fn;$1=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.getTotalWidthOfEncodings=fn.calculateEncodingAttributes=fn.getBarcodePadding=fn.getEncodingHeight=fn.getMaximumHeightOfEncodings=void 0;var r=wu(),t=s(r);function s(f){return f&&f.__esModule?f:{default:f}}function i(f,d){return d.height+(d.displayValue&&f.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function l(f,d,b){if(b.displayValue&&d<f){if(b.textAlign=="center")return Math.floor((f-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-d)}return 0}function c(f,d,b){for(var v=0;v<f.length;v++){var x=f[v],w=(0,t.default)(d,x.options),S;w.displayValue?S=g(x.text,w,b):S=0;var M=x.data.length*w.width;x.width=Math.ceil(Math.max(S,M)),x.height=i(x,w),x.barcodePadding=l(S,M,w)}}function m(f){for(var d=0,b=0;b<f.length;b++)d+=f[b].width;return d}function y(f){for(var d=0,b=0;b<f.length;b++)f[b].height>d&&(d=f[b].height);return d}function g(f,d,b){var v;if(b)v=b;else if(typeof document<"u")v=document.createElement("canvas").getContext("2d");else return 0;v.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var x=v.measureText(f);if(!x)return 0;var w=x.width;return w}return fn.getMaximumHeightOfEncodings=y,fn.getEncodingHeight=i,fn.getBarcodePadding=l,fn.calculateEncodingAttributes=c,fn.getTotalWidthOfEncodings=m,fn}var H1;function Yj(){if(H1)return Lc;H1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var r=(function(){function y(g,f){for(var d=0;d<f.length;d++){var b=f[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,f,d){return f&&y(g.prototype,f),d&&y(g,d),g}})(),t=wu(),s=l(t),i=Uv();function l(y){return y&&y.__esModule?y:{default:y}}function c(y,g){if(!(y instanceof g))throw new TypeError("Cannot call a class as a function")}var m=(function(){function y(g,f,d){c(this,y),this.canvas=g,this.encodings=f,this.options=d}return r(y,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var d=(0,s.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(d,this.encodings[f]),this.drawCanvasText(d,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,f);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,d){var b=this.canvas.getContext("2d"),v=d.data,x;f.textPosition=="top"?x=f.marginTop+f.fontSize+f.textMargin:x=f.marginTop,b.fillStyle=f.lineColor;for(var w=0;w<v.length;w++){var S=w*f.width+d.barcodePadding;v[w]==="1"?b.fillRect(S,x,f.width,f.height):v[w]&&b.fillRect(S,x,f.width,f.height*v[w])}}},{key:"drawCanvasText",value:function(f,d){var b=this.canvas.getContext("2d"),v=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var x,w;f.textPosition=="top"?w=f.marginTop+f.fontSize-f.textMargin:w=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=v,f.textAlign=="left"||d.barcodePadding>0?(x=0,b.textAlign="left"):f.textAlign=="right"?(x=d.width-1,b.textAlign="right"):(x=d.width/2,b.textAlign="center"),b.fillText(d.text,x,w)}}},{key:"moveCanvasDrawing",value:function(f){var d=this.canvas.getContext("2d");d.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),y})();return Lc.default=m,Lc}var Bc={},G1;function Kj(){if(G1)return Bc;G1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var r=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=wu(),s=l(t),i=Uv();function l(g){return g&&g.__esModule?g:{default:g}}function c(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",y=(function(){function g(f,d,b){c(this,g),this.svg=f,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return r(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var v=this.encodings[b],x=(0,s.default)(this.options,v.options),w=this.createGroup(d,x.marginTop,this.svg);this.setGroupOptions(w,x),this.drawSvgBarcode(w,x,v),this.drawSVGText(w,x,v),d+=v.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),v=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(v,b),this.options.background&&this.drawRect(0,0,v,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,v){var x=v.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,M=0,L=0;L<x.length;L++)M=L*b.width+v.barcodePadding,x[L]==="1"?S++:S>0&&(this.drawRect(M-b.width*S,w,b.width*S,b.height,d),S=0);S>0&&this.drawRect(M-b.width*(S-1),w,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,v){var x=this.document.createElementNS(m,"text");if(b.displayValue){var w,S;x.setAttribute("font-family",b.font),x.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&x.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&x.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||v.barcodePadding>0?(w=0,x.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=v.width-1,x.setAttribute("text-anchor","end")):(w=v.width/2,x.setAttribute("text-anchor","middle")),x.setAttribute("x",w),x.setAttribute("y",S),x.appendChild(this.document.createTextNode(v.text)),d.appendChild(x)}}},{key:"setSvgAttributes",value:function(d,b){var v=this.svg;v.setAttribute("width",d+"px"),v.setAttribute("height",b+"px"),v.setAttribute("x","0px"),v.setAttribute("y","0px"),v.setAttribute("viewBox","0 0 "+d+" "+b),v.setAttribute("xmlns",m),v.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,v){var x=this.document.createElementNS(m,"g");return x.setAttribute("transform","translate("+d+", "+b+")"),v.appendChild(x),x}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,v,x,w){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",v),S.setAttribute("height",x),w.appendChild(S),S}}]),g})();return Bc.default=y,Bc}var Pc={},F1;function Xj(){if(F1)return Pc;F1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var r=(function(){function i(l,c){for(var m=0;m<c.length;m++){var y=c[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}return function(l,c,m){return c&&i(l.prototype,c),m&&i(l,m),l}})();function t(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(l,c,m){t(this,i),this.object=l,this.encodings=c,this.options=m}return r(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Pc.default=s,Pc}var V1;function Jj(){if(V1)return qc;V1=1,Object.defineProperty(qc,"__esModule",{value:!0});var r=Yj(),t=m(r),s=Kj(),i=m(s),l=Xj(),c=m(l);function m(y){return y&&y.__esModule?y:{default:y}}return qc.default={CanvasRenderer:t.default,SVGRenderer:i.default,ObjectRenderer:c.default},qc}var zi={},Y1;function zv(){if(Y1)return zi;Y1=1,Object.defineProperty(zi,"__esModule",{value:!0});function r(m,y){if(!(m instanceof y))throw new TypeError("Cannot call a class as a function")}function t(m,y){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:m}function s(m,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);m.prototype=Object.create(y&&y.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(m,y):m.__proto__=y)}var i=(function(m){s(y,m);function y(g,f){r(this,y);var d=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=f,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return y})(Error),l=(function(m){s(y,m);function y(){r(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return y})(Error),c=(function(m){s(y,m);function y(){r(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return y})(Error);return zi.InvalidInputException=i,zi.InvalidElementException=l,zi.NoElementException=c,zi}var K1;function Qj(){if(K1)return Cc;K1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},t=Vj(),s=m(t),i=Jj(),l=m(i),c=zv();function m(d){return d&&d.__esModule?d:{default:d}}function y(d){if(typeof d=="string")return g(d);if(Array.isArray(d)){for(var b=[],v=0;v<d.length;v++)b.push(y(d[v]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return f(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,s.default)(d),renderer:l.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,s.default)(d),renderer:l.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:l.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":r(d))==="object"&&!d.nodeName)return{element:d,renderer:l.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var v=[],x=0;x<b.length;x++)v.push(y(b[x]));return v}}function f(d){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(d),renderer:l.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Cc.default=y,Cc}var Uc={},X1;function Zj(){if(X1)return Uc;X1=1,Object.defineProperty(Uc,"__esModule",{value:!0});var r=(function(){function i(l,c){for(var m=0;m<c.length;m++){var y=c[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}return function(l,c,m){return c&&i(l.prototype,c),m&&i(l,m),l}})();function t(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(l){t(this,i),this.api=l}return r(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var m=c.apply(void 0,arguments);return this.api._options.valid(!0),m}catch(y){return this.handleCatch(y),this.api}}}]),i})();return Uc.default=s,Uc}var Qh,J1;function Wj(){if(J1)return Qh;J1=1;var r=Hj(),t=L(r),s=wu(),i=L(s),l=Gj(),c=L(l),m=Fj(),y=L(m),g=Qj(),f=L(g),d=Bv(),b=L(d),v=Zj(),x=L(v),w=zv(),S=Pv(),M=L(S);function L(B){return B&&B.__esModule?B:{default:B}}var U=function(){},re=function(G,W,J){var he=new U;if(typeof G>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,f.default)(G),he._encodings=[],he._options=M.default,he._errorHandler=new x.default(he),typeof W<"u"&&(J=J||{},J.format||(J.format=se()),he.options(J)[J.format](W,J).render()),he};re.getModule=function(B){return t.default[B]};for(var ce in t.default)t.default.hasOwnProperty(ce)&&C(t.default,ce);function C(B,G){U.prototype[G]=U.prototype[G.toUpperCase()]=U.prototype[G.toLowerCase()]=function(W,J){var he=this;return he._errorHandler.wrapBarcodeCall(function(){J.text=typeof J.text>"u"?void 0:""+J.text;var xe=(0,i.default)(he._options,J);xe=(0,b.default)(xe);var Te=B[G],Y=P(W,Te,xe);return he._encodings.push(Y),he})}}function P(B,G,W){B=""+B;var J=new G(B,W);if(!J.valid())throw new w.InvalidInputException(J.constructor.name,B);var he=J.encode();he=(0,c.default)(he);for(var xe=0;xe<he.length;xe++)he[xe].options=(0,i.default)(W,he[xe].options);return he}function se(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}U.prototype.options=function(B){return this._options=(0,i.default)(this._options,B),this},U.prototype.blank=function(B){var G=new Array(B+1).join("0");return this._encodings.push({data:G}),this},U.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var B;for(var G in this._renderProperties){B=this._renderProperties[G];var W=(0,i.default)(this._options,B.options);W.format=="auto"&&(W.format=se()),this._errorHandler.wrapBarcodeCall(function(){var J=W.value,he=t.default[W.format.toUpperCase()],xe=P(J,he,W);X(B,xe,W)})}}},U.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var B=0;B<this._renderProperties.length;B++)X(this._renderProperties[B],this._encodings,this._options);else X(this._renderProperties,this._encodings,this._options);return this},U.prototype._defaults=M.default;function X(B,G,W){G=(0,c.default)(G);for(var J=0;J<G.length;J++)G[J].options=(0,i.default)(W,G[J].options),(0,y.default)(G[J].options);(0,y.default)(W);var he=B.renderer,xe=new he(B.element,G,W);xe.render(),B.afterRender&&B.afterRender()}return typeof window<"u"&&(window.JsBarcode=re),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(B,G){var W=[];return jQuery(this).each(function(){W.push(this)}),re(W,B,G)}),Qh=re,Qh}var eT=Wj();const tT=fw(eT),nT={[ze.EXECUTED]:"Executed",[ze.MATCHED_LIST]:"Matched list",[ze.CONFIRM_REQUIRED]:"Awaiting confirmation",[ze.NO_MATCH_FALLBACK]:"No match",[ze.UNCONFIGURED]:"Not configured",[ze.INVALID_CODE]:"Invalid code",[ze.FORBIDDEN]:"Not permitted",[ze.CONFLICT]:"Conflict",[ze.IDENTITY_PRIMED]:"Identity primed",[ze.IDENTITY_UNKNOWN]:"Badge not recognized",[ze.NOT_PRIMED]:"Badge required",[ze.CHOICES]:"Choices presented"},Iv={[ze.EXECUTED]:"text-status-success",[ze.MATCHED_LIST]:"text-status-success",[ze.CONFIRM_REQUIRED]:"text-status-warning",[ze.NO_MATCH_FALLBACK]:"text-text-secondary",[ze.UNCONFIGURED]:"text-status-warning",[ze.INVALID_CODE]:"text-status-error",[ze.FORBIDDEN]:"text-status-error",[ze.CONFLICT]:"text-status-warning",[ze.IDENTITY_PRIMED]:"text-status-success",[ze.IDENTITY_UNKNOWN]:"text-status-warning",[ze.NOT_PRIMED]:"text-status-warning",[ze.CHOICES]:"text-status-success"};function $v(r){return r.outcome===ze.IDENTITY_PRIMED&&r.actor?`Hi ${r.actor.displayName}`:`${nT[r.outcome]}${r.rule?` — ${r.rule.name}`:""}`}function uu(r){var t,s,i;return r.outcome===ze.NO_MATCH_FALLBACK?((t=r.fallback)==null?void 0:t.markdown)??null:r.outcome===ze.IDENTITY_UNKNOWN?((s=r.fallback)==null?void 0:s.markdown)??null:r.outcome===ze.NOT_PRIMED?((i=r.notPrimed)==null?void 0:i.markdown)??null:null}function ls(r){return r.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function Hv({content:r,compact:t}){const s=[],i=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,c;for(;(c=i.exec(r))!==null;)c.index>l&&s.push({type:"text",text:r.slice(l,c.index)}),s.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),l=c.index+c[0].length;l<r.length&&s.push({type:"text",text:r.slice(l)});const m=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},y=[];for(const g of s){if(g.type==="code"){const f=g.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");y.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${m.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}y.push(...rT(g.text,m))}return p.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:y.join(`
|
|
55
|
-
`)}})}function rT(r,t){const s=r.split(`
|
|
56
|
-
`),i=[];let l=!1,c=!1,m=[];for(const y of s){const g=y.trim();if(g.startsWith("|")&&g.endsWith("|")){const f=g.slice(1,-1).split("|").map(d=>d.trim());if(f.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(f);continue}if(c){c=!1;const[f,...d]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ls(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of d){i.push("<tr>");for(const v of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${ls(v)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),m=[]}if(!g){l&&(i.push("</ul>"),l=!1);continue}if(g.startsWith("### ")){l&&(i.push("</ul>"),l=!1),i.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ls(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){l&&(i.push("</ul>"),l=!1),i.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ls(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){l&&(i.push("</ul>"),l=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){l||(i.push('<ul class="space-y-1 my-1">'),l=!0),i.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ls(g.slice(2))}</span></li>`);continue}l&&(i.push("</ul>"),l=!1),i.push(`<p class="${t.text} text-text-secondary my-1">${ls(g)}</p>`)}if(c&&m.length){const[y,...g]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of y)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ls(f)}</th>`);i.push("</tr></thead><tbody>");for(const f of g){i.push("<tr>");for(const d of f)i.push(`<td class="py-1 px-2 border-b border-border/50">${ls(d)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return l&&i.push("</ul>"),i}function sT(r){return r.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function iT(r){const t=new Set;for(const s of r){const i=s.codePointAt(0);(i>127||i<32)&&t.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function aT({value:r}){const t=j.useRef(null),[s,i]=j.useState(!1);return j.useEffect(()=>{if(!(!t.current||!r))try{tT(t.current,r,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[r]),r?p.jsxs("div",{children:[p.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?p.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",p.jsx("span",{className:"font-mono",children:iT(r).join(", ")||"unknown"})]}):p.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:p.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function oT({onClose:r}){const{submitCode:t,lastResult:s,busy:i,wedgeConfig:l,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:y,setDiagnosticsOn:g}=Mv(),[f,d]=j.useState(""),[b,v]=j.useState(!1),x=S=>{S.preventDefault();const M=f.trim();M&&(d(""),t(M))},w=(s==null?void 0:s.response)??null;return p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[p.jsx(hu,{className:"w-4 h-4"}),"Scan"]}),p.jsx("button",{type:"button",onClick:r,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:p.jsx(Ft,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[p.jsxs("form",{onSubmit:x,className:"space-y-2",children:[p.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{value:f,onChange:S=>d(sT(S.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),p.jsx("button",{type:"submit",disabled:i||!f.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),p.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),p.jsx(aT,{value:f.trim()}),s&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),p.jsx("div",{className:"text-sm font-mono text-text-primary",children:s.code}),w?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`text-sm font-medium ${Iv[w.outcome]}`,children:$v(w)}),w.error&&p.jsx("div",{className:"text-xs text-text-tertiary",children:w.error}),uu(w)&&p.jsx("div",{className:"text-sm border-t border-surface-border pt-2",children:p.jsx(Hv,{content:uu(w),compact:!0})})]}):p.jsx("div",{className:"text-sm text-status-error",children:s.error})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("button",{type:"button",onClick:()=>v(S=>!S),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"block text-sm text-text-primary",children:[p.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),p.jsx("input",{type:"number",min:100,max:2e3,step:50,value:l.maxKeyGapMs,onChange:S=>c({maxKeyGapMs:Number(S.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),p.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[p.jsx("input",{type:"checkbox",checked:y,onChange:S=>g(S.target.checked)}),p.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),y&&p.jsxs("div",{className:"border border-surface-border rounded",children:[p.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),p.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&p.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(S=>p.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${S.buffer}`,children:[p.jsxs("span",{className:"text-text-tertiary",children:[String(S.deltaMs).padStart(4),"ms "]}),p.jsx("span",{className:"text",children:JSON.stringify(S.key)}),S.code&&p.jsxs("span",{className:"text-text-tertiary",children:[" (",S.code,")"]}),p.jsxs("span",{className:"text-text-tertiary",children:[" — ",S.note]})]},S.seq))]}),p.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",p.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",p.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",p.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Gv="lt:bookmarks",zc="scan";function lT(){try{const r=localStorage.getItem(Gv);if(!r)return[];const t=JSON.parse(r);return Array.isArray(t)?t:[]}catch{return[]}}function Q1(r){try{localStorage.setItem(Gv,JSON.stringify(r))}catch{}}function cT({onToggleEventFeed:r,onToggleDocs:t,onToggleNav:s}){var de,Oe;const i=_o(),{user:l,logout:c}=Vt(),{viewAs:m,realIsBuilder:y}=sv(),{available:g,mine:f}=jO();iv();const{connected:d}=o2(),{data:b}=nr(),{setPanel:v,closePanel:x,open:w,ownerKey:S}=Zd(),M=Nv(),L=vn(),U=()=>{w&&S===zc?x(zc):v(p.jsx(oT,{onClose:()=>x(zc)}),{width:360,key:zc})},[re,ce]=j.useState(!1),[C,P]=j.useState(!1),[se,X]=j.useState(Ev),[B,G]=j.useState(lT),W=j.useRef(null),J=(de=b==null?void 0:b.branding)==null?void 0:de.appName,he=(Oe=b==null?void 0:b.branding)==null?void 0:Oe.themes,xe=j.useMemo(()=>(ZA(he??[]),WA()),[he]),Te=oe=>{ej(oe),X(oe)},Y=()=>{const oe=window.prompt("Bookmark label:");if(!(oe!=null&&oe.trim()))return;const je=L.pathname+L.search,Se=[...B,{label:oe.trim(),url:je}].sort((ke,We)=>ke.label.localeCompare(We.label));G(Se),Q1(Se),ce(!1)},ae=oe=>{const je=B.filter(Se=>!(Se.label===oe.label&&Se.url===oe.url));G(je),Q1(je)};return j.useEffect(()=>{if(!re)return;const oe=je=>{W.current&&!W.current.contains(je.target)&&ce(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[re]),p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${re?"z-[100]":"z-30"}`,children:[p.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[s&&p.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:p.jsx(xw,{className:"w-5 h-5",strokeWidth:1.5})}),p.jsxs(Fs,{to:"/","aria-label":"Home",className:"shrink-0",onClick:oe=>{(oe.ctrlKey||oe.metaKey)&&(oe.preventDefault(),P(!0))},children:[p.jsx(ou,{appName:J,className:"hidden lg:flex"}),p.jsx(ou,{appName:J,variant:"comet",className:"flex lg:hidden"})]}),p.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),p.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:p.jsx(hb,{className:"w-5 h-5",strokeWidth:2})}),p.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:p.jsx(ed,{className:"w-5 h-5",strokeWidth:2})})]}),p.jsxs("div",{className:"flex items-center gap-5",children:[p.jsxs(Fs,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${g>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[p.jsx(td,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx("span",{className:"hidden lg:inline",children:"all"}),g>0&&p.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),p.jsxs(Fs,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${f>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[p.jsx(td,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx("span",{className:"hidden lg:inline",children:"mine"}),f>0&&p.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),p.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),M&&p.jsxs("button",{type:"button",onClick:U,className:"flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Scan a code",children:[p.jsx(hu,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx("span",{className:"hidden lg:inline",children:"scan"})]}),p.jsxs("button",{type:"button",onClick:()=>{d?r==null||r():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${d?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[p.jsx(db,{className:"w-4 h-4",strokeWidth:1.5}),"events"]}),y&&p.jsx(p.Fragment,{children:p.jsxs("button",{onClick:t,className:"hidden lg:flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[p.jsx(mb,{className:"w-4 h-4",strokeWidth:1.5}),"docs"]})}),m&&p.jsx(p.Fragment,{children:p.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[p.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[m," View"]}),p.jsx("button",{onClick:Od,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:p.jsx(Ft,{className:"w-2.5 h-2.5"})})]})}),p.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),l&&p.jsxs("div",{className:"relative",ref:W,children:[p.jsxs("button",{onClick:()=>ce(oe=>!oe),className:"btn-ghost flex items-center gap-1",children:[p.jsxs("span",{className:"relative",children:[p.jsx(_w,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),m&&p.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),p.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:l.displayName||l.username||l.userId}),p.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),re&&p.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[p.jsx(Fs,{to:"/credentials",onClick:()=>ce(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),p.jsx("button",{onClick:()=>{ce(!1),d?r==null||r():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:d?"Events":"Reconnect events"}),y&&p.jsx("button",{onClick:()=>{ce(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),m&&p.jsxs("button",{onClick:()=>{ce(!1),Od()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",m," view"]}),p.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[p.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),p.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:xe.map(oe=>p.jsx("button",{type:"button",onClick:()=>Te(oe.id),title:oe.label,"aria-label":`${oe.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${se===oe.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:oe.swatch}},oe.id))})]}),p.jsx("button",{onClick:()=>{ce(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),p.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[B.map(oe=>p.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[p.jsx(Fs,{to:oe.url,onClick:()=>ce(!1),title:oe.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:oe.label}),p.jsx("button",{type:"button",onClick:()=>ae(oe),title:`Remove "${oe.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:p.jsx(Ft,{className:"w-3 h-3"})})]},`${oe.label}::${oe.url}`)),p.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),p.jsxs("button",{type:"button",onClick:Y,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[p.jsx(ww,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),C&&p.jsx(QA,{onClose:()=>P(!1)})]})}function rm({open:r,children:t}){const[s,i]=j.useState(r);return j.useEffect(()=>{r&&i(!0)},[r]),p.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||i(!1)},children:p.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function Td(r){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",l="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${t?i:l}`:`${s} gap-3 px-4 py-2 text-sm ${t?i:l}`}}function uT(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function fT({group:r,collapsed:t}){const{pathname:s}=vn(),i=r.matchPaths.some(y=>s.startsWith(y)),[l,c]=j.useState(i),m=l||i;return t?p.jsx(p.Fragment,{children:r.items.map(y=>p.jsx(Ki,{to:y.to,className:Td(!0),title:y.label,children:y.icon&&p.jsx(y.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},y.to))}):p.jsxs("div",{children:[p.jsxs("button",{onClick:()=>c(y=>!y),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[p.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:r.label})]}),p.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${m?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),p.jsx(rm,{open:m,children:r.items.map(y=>p.jsxs(Ki,{to:y.to,end:y.end,className:uT(),children:[y.icon&&p.jsx(y.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:y.label})]},y.to))})]})}function hT(r){return r.kind==="group"}function dT({entry:r,collapsed:t}){const{pathname:s,search:i}=vn(),l=r.to.includes("?"),c=r.icon&&p.jsx(r.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${r.iconClassName??""}`,strokeWidth:1.5,...r.solid?{fill:"currentColor"}:{}});if(l){const[m,y]=r.to.split("?"),g=s===m&&i===`?${y}`,f=Td(t)({isActive:g});return p.jsxs(Ki,{to:r.to,className:f,title:t?r.label:void 0,children:[c,!t&&p.jsx("span",{children:r.label})]})}return p.jsxs(Ki,{to:r.to,end:r.end,className:Td(t),title:t?r.label:void 0,children:[c,!t&&p.jsx("span",{children:r.label})]})}function ms({heading:r,entries:t}){const{collapsed:s}=Jd();return p.jsxs("div",{className:"space-y-1",children:[s?p.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):p.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:r}),t.map(i=>hT(i)?p.jsx(fT,{group:i,collapsed:s},i.label):p.jsx(dT,{entry:i,collapsed:s},i.to))]})}function mT({aiEnabled:r=!1,isBuilder:t=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:l=!1}){const c={to:"/operations",label:"Pace Board",icon:Sw};if(!t&&(!s||i==="engineer"||i==="operator"))return l?p.jsx(ms,{heading:"Monitor",entries:[c]}):null;if(!t)return p.jsx(ms,{heading:"Monitor",entries:l?[c]:[]});const m=[...l?[c]:[],{to:"/topics",label:"Event Topics",icon:db},{to:"/agents",label:r?"Agents":"Automations",icon:Ew},{to:"/capabilities",label:"Capabilities",icon:Ow}];return p.jsx(ms,{heading:"Monitor",entries:m})}function pT(){return lt({queryKey:["me","preferences"],queryFn:()=>_e("/me/preferences"),staleTime:6e4})}function yT(){const r=ot();return mt({mutationFn:t=>_e("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{r.setQueryData(["me","preferences"],t)}})}function gT(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function bT(r){var t;return((t=r.title)==null?void 0:t.trim())||gT(r.role)}function vT(r,t){const s=(r==null?void 0:r.pinnedViews)??[],i=new Set((r==null?void 0:r.hiddenRolePins)??[]),l=new Set(s.map(y=>y.label)),c=[...s],m=new Set;for(const{role:y,pins:g}of t)for(const f of g)l.has(f.label)||i.has(f.label)||m.has(f.label)||(m.add(f.label),c.push({...f,id:`role:${y}:${f.label}`,fromRole:y}));return c}function xT(r){let t;try{t=new URL(r,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const s=t.searchParams,i=fj(s),l=s.get("status")||void 0,c=t.pathname==="/escalations/available"&&(l===void 0||l==="available");return{available:c,params:{...i,role:s.get("role")||void 0,type:s.get("type")||void 0,priority:s.get("priority")?parseInt(s.get("priority"),10):void 0,status:c||l==="all"?void 0:l,search:s.get("search")||void 0}}}function _T(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function wT(){var C;const{collapsed:r}=Jd(),{user:t}=Vt(),s=pT(),i=yT(),l=j.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(P=>P.role)),[t]),{data:c}=ov({enabled:l.size>0}),m=Wt("SUMMARY");Ks(Kd(),()=>{m([["escalations"]])});const y=(C=s.data)==null?void 0:C.preferences,g=j.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(P=>l.has(P.role)&&Array.isArray(P.default_pins)&&P.default_pins.length>0).map(P=>({role:P.role,pins:P.default_pins})),[c,l]),f=j.useMemo(()=>vT(y,g),[y,g]),d=j.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(P=>[P.role,bT(P)])),[c]),b=j.useMemo(()=>f.filter(P=>!P.fromRole),[f]),v=j.useMemo(()=>g.map(({role:P})=>({role:P,title:d.get(P)??P,pins:f.filter(se=>se.fromRole===P)})).filter(P=>P.pins.length>0),[g,d,f]),x=(y==null?void 0:y.pinnedViews)??[],w=j.useRef(null),S=P=>i.mutate({pinnedViews:P}),M=P=>S(x.filter(se=>se.id!==P)),L=P=>S([...x,{id:_T(),label:P.label,url:P.url,badge:P.badge}]),U=P=>i.mutate({hiddenRolePins:[...(y==null?void 0:y.hiddenRolePins)??[],P]}),re=(P,se)=>{if(P===se)return;const X=[...x],[B]=X.splice(P,1);X.splice(se,0,B),S(X)};if(f.length===0)return null;const ce="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return p.jsxs("div",{className:"space-y-1",children:[r&&p.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!r&&b.length>0&&p.jsx("p",{className:ce,children:"Pinned"}),b.map(P=>{const se=x.findIndex(X=>X.id===P.id);return p.jsx(Z1,{pin:P,collapsed:r,draggable:se!==-1,onDragStart:()=>{w.current=se},onDropOn:()=>{w.current!==null&&se!==-1&&re(w.current,se),w.current=null},onRemove:()=>M(P.id)},P.id)}),v.map(P=>p.jsxs("div",{children:[!r&&p.jsx("p",{className:ce,title:`${P.title} — pins from the ${P.role} role`,"data-testid":"pin-group-label",children:P.title}),P.pins.map(se=>p.jsx(Z1,{pin:se,collapsed:r,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>L(se),onHide:()=>U(se.label)},se.id))]},P.role))]})}function Z1({pin:r,collapsed:t,draggable:s,onDragStart:i,onDropOn:l,onRemove:c,onPromote:m,onHide:y}){const{pathname:g,search:f}=vn(),[d,b=""]=r.url.split("?"),v=g===d&&f===(b?`?${b}`:""),x="group flex items-center rounded-md transition-colors duration-150",w=v?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?p.jsx(Ki,{to:r.url,className:`${x} ${w} justify-center w-10 h-10 mx-auto`,title:r.label,children:p.jsx(Gy,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):p.jsxs("div",{className:`${x} ${w} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:l,children:[p.jsxs(Ki,{to:r.url,title:r.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[p.jsx(Gy,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...r.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),p.jsx("span",{className:"truncate flex-1 min-w-0",children:r.label}),r.badge&&p.jsx(ST,{url:r.url})]}),p.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[m&&p.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:p.jsx(pb,{className:"w-3 h-3"})}),y&&p.jsx("button",{onClick:y,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:p.jsx(Aw,{className:"w-3 h-3"})}),c&&p.jsx("button",{onClick:c,title:`Remove "${r.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:p.jsx(Ft,{className:"w-3 h-3"})})]})]})}function ST({url:r}){var m;const t=j.useMemo(()=>xT(r),[r]),s={limit:1,staleTime:15e3},i=fv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),l=uv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?i:l;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:p.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function ET(){var c;const{data:r}=nr(),t=(c=r==null?void 0:r.features)==null?void 0:c.graphWorkflows,s=t===!0||t!==!1&&nv(),i=[{to:"/workflows/registry",label:"Registry",icon:Fy},{to:"/workflows/durable/invoke",label:"Invoke",icon:Vy},{to:"/workflows/executions",label:"Executions",icon:Yy}],l=s?[{kind:"group",label:"Procedural",icon:jw,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:kd,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Fy,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:Vy},{to:"/mcp/executions",label:"Executions",icon:Yy}]}]:i;return p.jsx(ms,{heading:"Orchestrate",entries:l})}const OT=[{to:"/mcp/queries",label:"Designer",icon:Tw},{to:"/mcp/servers",label:"Servers & Tools",icon:kw}];function AT(){return p.jsx(ms,{heading:"Design",entries:OT})}const jT=[{to:"/files",label:"Files",icon:Nw},{to:"/knowledge",label:"Knowledge Base",icon:yb}];function TT(){return p.jsx(ms,{heading:"Storage",entries:jT})}function kT({isBuilder:r=!1,isOps:t=!1}){var m;const{data:s}=nr(),i=((m=s==null?void 0:s.features)==null?void 0:m.dbMaintenance)!==!1,l=[{to:"/admin/users",label:"Accounts",icon:Cw},...r||t?[{to:"/admin/roles",label:"Roles",icon:td},{to:"/admin/personas",label:"Personas",icon:Mw},{to:"/admin/scan-codes",label:"Scan Codes",icon:hu}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:Rw},{to:"/admin/streams",label:"Messages",icon:yb},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:Dw}]:[]];return p.jsxs(p.Fragment,{children:[p.jsx(ms,{heading:"Identity & Access",entries:l}),r&&p.jsx(ms,{heading:"Infrastructure",entries:c})]})}function Fv({aiEnabled:r,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:l}){return p.jsxs(p.Fragment,{children:[p.jsx(mT,{aiEnabled:r,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:l}),p.jsx(wT,{}),t&&p.jsx(ET,{}),t&&r&&p.jsx(AT,{}),t&&p.jsx(TT,{}),(t||s)&&p.jsx(kT,{isBuilder:t,isOps:s})]})}function NT({open:r,onClose:t,...s}){const i=vn();return j.useEffect(()=>{t()},[i.pathname]),p.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${r?"":"pointer-events-none"}`,children:[p.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${r?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),p.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${r?"translate-x-0":"-translate-x-full"}`,children:[p.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:p.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:p.jsx(Ft,{className:"w-4 h-4"})})}),p.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:p.jsx(_O,{children:p.jsx(Fv,{...s})})})]})]})}const Vv="lt_event_feed_patterns";function CT(r,t){if(r.startsWith("/topics/")){const m=decodeURIComponent(r.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const s=r.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(r.startsWith("/escalations")){const m=new URLSearchParams(t).get("role");return m?`lt.events.system.escalation.${av(m)}.>`:"lt.events.system.escalation.>"}const i=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const l=r.match(/^\/agents\/([^/]+)$/);if(l&&l[1]!=="new")return`lt.events.system.agent.${l[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const c=r.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function MT(){try{const r=localStorage.getItem(Vv);return r?JSON.parse(r):[]}catch{return[]}}function Zh(r){try{localStorage.setItem(Vv,JSON.stringify(r))}catch{}}function RT(){const{pathname:r,search:t}=vn(),[s,i]=j.useState(MT),l=j.useMemo(()=>CT(r,t),[r,t]),c=j.useMemo(()=>{const f=new Set([l,...s]);return Array.from(f)},[l,s]),m=j.useCallback(f=>{const d=f.startsWith("lt.events.")?f:`lt.events.${f}`;i(b=>{if(b.includes(d))return b;const v=[...b,d];return Zh(v),v})},[]),y=j.useCallback(f=>{i(d=>{const b=d.filter(v=>v!==f);return Zh(b),b})},[]),g=j.useCallback(()=>{i([]),Zh([])},[]);return{patterns:c,pagePattern:l,userPatterns:s,addPattern:m,removePattern:y,clearUserPatterns:g}}function DT({children:r,className:t=""}){return p.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:r})}const Wh=280,W1="cubic-bezier(0.4, 0, 0.2, 1)",Ic=40;function qT(r){if(!r)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,i=t-Ic*2,l=s-Ic*2,c=r.width/i,m=r.height/l,y=r.left+r.width/2-(Ic+i/2),g=r.top+r.height/2-(Ic+l/2);return`translate(${y}px, ${g}px) scale(${c}, ${m})`}function Yv({open:r,onClose:t,sourceRef:s,children:i}){const[l,c]=j.useState(null),m=j.useRef(null),y=j.useRef(!1);j.useEffect(()=>{var v,x;r&&!y.current?(m.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("entering")):!r&&y.current&&l==="open"&&(m.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("exiting")),y.current=r},[r,s,l]),j.useEffect(()=>{if(l!=="entering")return;const v=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(v)},[l]),j.useEffect(()=>{if(l)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[l]),j.useEffect(()=>{if(!l)return;const v=x=>{x.key==="Escape"&&t()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l,t]);const g=j.useCallback(v=>{v.propertyName==="transform"&&l==="exiting"&&c(null)},[l]);if(j.useEffect(()=>{if(l!=="exiting")return;const v=setTimeout(()=>c(null),Wh+50);return()=>clearTimeout(v)},[l]),!l)return null;const f=l==="entering"||l==="exiting",d=f?qT(m.current):"none",b=f?0:1;return fb.createPortal(p.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Wh}ms ${W1}, opacity ${Wh}ms ${W1}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function LT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function BT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function PT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function UT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function zT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function IT({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function $T(r){const t=r.trim().split(`
|
|
57
|
-
`);if(t.length<2)return r;const s=y=>y.split("|").map(g=>g.trim()).filter(Boolean),i=s(t[0]),l=t.slice(2),c=i.map(y=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${y}</th>`).join(""),m=l.map(y=>`<tr class="border-t border-surface-border">${s(y).map(d=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${d}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${m}</tbody></table>`}function $c(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function HT(r){const t=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,f,d)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${d}</code></pre>`),`\0CODE${b}\0`});const i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,f,d,b)=>$T(`${f}
|
|
58
|
-
${d}
|
|
59
|
-
${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,f)=>`<h4 id="${$c(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(g,f)=>`<h3 id="${$c(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(g,f)=>`<h2 id="${$c(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(g,f)=>`<h1 id="${$c(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const f=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${d?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${d?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const l=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${l(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,f)=>t[parseInt(f,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",y=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const f=g.trim();if(!f)return"";const d=[];let b=f,v;for(;(v=y.exec(b))!==null;){const x=v.index+v[0].length;d.push(b.slice(0,x)),b=b.slice(x).replace(/^<br\/>/,"").trim(),y.lastIndex=0}return b&&d.push(b),d.map(x=>{const w=x.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${m}">${w}</p>`:""}).join("")}).join(""),s}const GT=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function FT(r){return GT.test(r)}function Su({content:r,className:t,onClick:s}){const i=j.useMemo(()=>HT(r),[r]);return p.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function fu({data:r,depth:t=0,generation:s}){const l=s!==void 0&&s>0&&s%2===1?!1:t>0,[c,m]=j.useState(l),[y,g]=j.useState(s);if(s!==void 0&&s!==y&&(g(s),m(s%2===0&&t>0)),r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return p.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?p.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((f,d)=>p.jsxs("div",{children:[p.jsx(fu,{data:f,depth:t+1,generation:s}),d<r.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),p.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const f=Object.entries(r);return f.length===0?p.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?p.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:f.map(([d,b],v)=>p.jsxs("div",{children:[p.jsx("span",{className:"text-text-secondary",children:d}),p.jsx("span",{className:"text-text-tertiary",children:": "}),p.jsx(fu,{data:b,depth:t+1,generation:s}),v<f.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),p.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return p.jsx("span",{children:String(r)})}function po({data:r,depth:t=0}){if(r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&FT(r)?p.jsx(Su,{content:r}):p.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):p.jsx("div",{className:"space-y-2",children:r.map((s,i)=>p.jsxs("div",{className:"flex items-baseline gap-2",children:[p.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),p.jsx("div",{className:"flex-1",children:p.jsx(po,{data:s,depth:t+1})})]},i))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):p.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,l])=>{const c=l===null||typeof l!="object";return p.jsxs("div",{children:[p.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?p.jsx("p",{className:"text-sm text-text-primary",children:p.jsx(po,{data:l,depth:t+1})}):p.jsx(po,{data:l,depth:t+1})]},i)})})}return p.jsx("span",{children:String(r)})}function eb({mode:r,setMode:t,isCollapsed:s,onToggleCollapse:i,onCopy:l,copied:c,onFullscreen:m,onClose:y,large:g}){const f=g?"w-5 h-5":"w-3.5 h-3.5",d=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return p.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&p.jsx("button",{onClick:i,className:d,title:s?"Expand all":"Collapse all",children:s?p.jsx(IT,{className:f}):p.jsx(zT,{className:f})}),p.jsx("button",{onClick:()=>t(r==="json"?"tree":"json"),className:d,title:r==="json"?"Outline view":"JSON view",children:r==="json"?p.jsx(LT,{className:f}):p.jsx(BT,{className:f})}),p.jsx("button",{onClick:l,className:d,title:"Copy to clipboard",children:c?p.jsx(UT,{className:`${f} text-status-success`}):p.jsx(PT,{className:f})}),m&&p.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:p.jsx(gb,{className:f})}),y&&p.jsx("button",{onClick:y,className:d,title:"Close (Esc)",children:p.jsx(bb,{className:f})})]})}function VT({data:r,label:t,variant:s,defaultCollapsed:i=!1,defaultMode:l}){const c=j.useRef(null),[m,y]=j.useState(l??"json"),[g,f]=j.useState(!1),[d,b]=j.useState(!1),[v,x]=j.useState(i?0:1),[w,S]=j.useState(1),M=v%2===0,L=w%2===0,U=j.useCallback(()=>x(G=>G+1),[]),re=j.useCallback(()=>S(G=>G+1),[]);let ce=r;if(typeof r=="string")try{ce=JSON.parse(r)}catch{}const C=async()=>{const G=typeof r=="string"?r:JSON.stringify(ce,null,2);await navigator.clipboard.writeText(G),f(!0),setTimeout(()=>f(!1),2e3)},P=j.useCallback(()=>{S(1),b(!0)},[]),se=s==="panel",X=se?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",B=se?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return p.jsxs("div",{className:X,children:[t&&p.jsx(DT,{children:t}),p.jsxs("div",{ref:c,className:"relative",children:[p.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:p.jsx(eb,{mode:m,setMode:y,isCollapsed:M,onToggleCollapse:U,onCopy:C,copied:g,onFullscreen:P})}),p.jsx("div",{className:B,children:m==="json"?p.jsx(fu,{data:ce,generation:v}):p.jsx(po,{data:ce})})]}),p.jsxs(Yv,{open:d,onClose:()=>b(!1),sourceRef:c,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx(eb,{mode:m,setMode:y,isCollapsed:L,onToggleCollapse:re,onCopy:C,copied:g,onClose:()=>b(!1),large:!0})}),p.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?p.jsx(fu,{data:ce,generation:w}):p.jsx(po,{data:ce})})]})]})}const YT=100,tb=500;let KT=0;const Kv={"escalation.created":"text-status-active","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function Xv(r){const t=r.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:r}function nb({event:r,forceExpanded:t=!1}){var v,x;const[s,i]=j.useState(t),l=Kv[Xv(r.type)]||"text-text-tertiary";j.useEffect(()=>{i(t)},[t]);const c=t,m=c?"text-xs":"text-2xs",y=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",d=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return p.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[p.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[p.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),p.jsx("span",{className:`${y} font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),p.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(v=r.data)!=null&&v.workflowId?String(r.data.workflowId):"",(x=r.data)!=null&&x.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),p.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),p.jsx(rm,{open:s,children:p.jsx("div",{className:b,children:p.jsx(VT,{data:r.data})})})]})}function XT({open:r,onToggle:t,configOpen:s,onToggleConfig:i}){const[l,c]=j.useState([]),[m,y]=j.useState(!1),[g,f]=j.useState(""),d=j.useRef(null),b=j.useRef(new Map),{subscribe:v}=j.useContext(Wi),{patterns:x,pagePattern:w,userPatterns:S,addPattern:M,removePattern:L}=RT(),U=j.useCallback(C=>{const P=String(C.type||"unknown");if(P.startsWith("mesh."))return;const se=`${P}:${C.timestamp||""}:${C.escalationId||C.workflowId||C.taskId||""}`,X=Date.now(),B=b.current.get(se);if(!(B&&X-B<tb)){if(b.current.set(se,X),b.current.size>200)for(const[G,W]of b.current)X-W>tb*2&&b.current.delete(G);c(G=>[{id:++KT,type:P,timestamp:C.timestamp||new Date().toISOString(),data:C},...G].slice(0,YT))}},[]),re=j.useRef(U);re.current=U;const ce=r||m||s;return j.useEffect(()=>{if(!ce)return;const C=x.map(P=>v(P,se=>re.current(se)));return()=>C.forEach(P=>P())},[v,x.join(","),ce]),j.useEffect(()=>{r&&d.current&&(d.current.scrollTop=0)},[l.length,r]),p.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[p.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?p.jsx(vb,{className:"w-3 h-3 text-text-tertiary"}):p.jsx(xb,{className:"w-3 h-3 text-text-tertiary"}),p.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),l.length>0&&p.jsxs("span",{className:"text-2xs text-text-tertiary",children:[l.length," events"]}),l.length>0&&!r&&p.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Kv[Xv(l[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:l[0].type}),p.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[p.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:C=>{C.stopPropagation(),i()},children:p.jsx(qw,{className:"w-3 h-3"})}),l.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:C=>{C.stopPropagation(),y(!0)},children:p.jsx(gb,{className:"w-3 h-3"})}),p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:C=>{C.stopPropagation(),c([])},children:p.jsx(Lw,{className:"w-3 h-3"})})]})]})]}),s&&p.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[p.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),p.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:w.replace("lt.events.","")}),S.map(C=>p.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[C.replace("lt.events.",""),p.jsx("button",{onClick:()=>L(C),className:"text-text-quaternary hover:text-status-error",children:p.jsx(Ft,{className:"w-2 h-2"})})]},C))]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:g,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&g.trim()&&(M(g.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),p.jsxs("button",{onClick:()=>{g.trim()&&(M(g.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[p.jsx(pb,{className:"w-2.5 h-2.5"})," Add"]})]})]}),p.jsx(rm,{open:r,children:p.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:l.length===0?p.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):l.map(C=>p.jsx(nb,{event:C},C.id))})}),p.jsxs(Yv,{open:m,onClose:()=>y(!1),sourceRef:d,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx("button",{onClick:()=>y(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:p.jsx(bb,{className:"w-5 h-5"})})}),l.length===0?p.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):l.map(C=>p.jsx(nb,{event:C,forceExpanded:!0},C.id))]})]})}function JT(){return lt({queryKey:["docs"],queryFn:()=>_e("/docs"),staleTime:5*6e4})}function QT(r){return lt({queryKey:["docs",r],queryFn:()=>_e(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function ZT(){const[r,t]=j.useState([]),[s,i]=j.useState([]),[l,c]=j.useState(null),m=j.useRef(l),y=j.useRef(r),g=j.useRef(s);m.current=l,y.current=r,g.current=s;const f=j.useCallback((w,S)=>{var L;const M=m.current;if(M){const U=((L=S==null?void 0:S.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...M,scrollTop:U}])}i([]),c({path:w,scrollTop:0})},[]),d=j.useCallback(w=>{var U;const S=y.current;if(S.length===0)return;const M=S[S.length-1],L=m.current;if(L){const re=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;i([...g.current,{...L,scrollTop:re}])}t(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),b=j.useCallback(w=>{var U;const S=g.current;if(S.length===0)return;const M=S[S.length-1],L=m.current;if(L){const re=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;t([...y.current,{...L,scrollTop:re}])}i(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),v=j.useCallback(w=>{var L,U;const S=m.current;if(!S)return;const M=((L=w==null?void 0:w.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...S,scrollTop:M}]),i([]),c({...S,scrollTop:((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0})},[]),x=j.useCallback(()=>{t([]),i([]),c(null)},[]);return{current:l,backStack:r,forwardStack:s,navigate:f,goBack:d,goForward:b,pushScrollPosition:v,reset:x}}function WT(r,t){const[s,i]=r.split("#");let l=s;if(l.startsWith("./")||l.startsWith("../")){const m=((t?t.replace(/[^/]+$/,""):"")+l).split("/"),y=[];for(const g of m)g===".."?y.pop():g&&g!=="."&&y.push(g);l=y.join("/")}return{path:l,anchor:i}}function ek(r){if(!r.startsWith("#docs"))return null;const t=r.slice(1).split(":"),s=t[1]||"README.md",i=t[2]||void 0;return{path:s,anchor:i}}function tk(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function nk({content:r,currentPath:t,onNavigate:s,onAnchorClick:i}){const l=c=>{var f;const m=c.target,y=m.closest("[data-anchor]");if(y){c.preventDefault(),i();const d=y.dataset.anchor,b=(f=y.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(d)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=m.closest("[data-doc-link]");if(g){c.preventDefault();const{path:d,anchor:b}=WT(g.dataset.docLink,t);s(d,b);return}};return p.jsx(Su,{content:r,className:"docs-content",onClick:l})}function rk(r){const t=[],s=new Map;for(const i of r){const l=i.path.split("/");if(l.length===1){t.push(i);continue}let c=s;for(let m=0;m<l.length-1;m++){const y=l[m];c.has(y)||c.set(y,{label:y,children:[],subdirs:new Map});const g=c.get(y);m===l.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:t,dirs:s}}function sk({docs:r,selected:t,onSelect:s}){const{topLevel:i,dirs:l}=rk(r),c=y=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===y?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function m(y,g){return p.jsxs("details",{open:!0,children:[p.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[p.jsx(Bw,{className:"w-3 h-3",strokeWidth:1.5}),y.label]}),p.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...y.subdirs.values()].map(f=>m(f)),y.children.map(f=>p.jsx("button",{className:c(f.path),onClick:()=>s(f.path),children:f.title},f.path))]})]},y.label)}return p.jsxs("div",{className:"space-y-0.5",children:[i.map(y=>p.jsx("button",{className:c(y.path),onClick:()=>s(y.path),children:y.title},y.path)),[...l.values()].map(y=>m(y))]})}function ik({open:r,onClose:t}){var se,X,B;const[s,i]=j.useState(!1),{data:l}=JT(),c=ZT(),{data:m,isLoading:y}=QT(((se=c.current)==null?void 0:se.path)??null),g=j.useRef(null),[f,d]=j.useState(null);j.useEffect(()=>{f&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var W;const G=(W=g.current)==null?void 0:W.querySelector(`#${CSS.escape(f)}`);G==null||G.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[f,m]);const b=j.useCallback(()=>{var J;const G=ek(window.location.hash),W=(G==null?void 0:G.path)??"README.md";((J=c.current)==null?void 0:J.path)!==W&&c.navigate(W,g),G!=null&&G.anchor&&d(G.anchor)},[c]),v=j.useRef(!0);j.useEffect(()=>{if(!r||!c.current)return;if(v.current){v.current=!1;return}const G=tk(c.current.path);window.location.hash!==G&&window.history.replaceState(null,"",window.location.pathname+window.location.search+G)},[r,(X=c.current)==null?void 0:X.path]),j.useEffect(()=>{if(!r)return;const G=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)},[r,b]);const x=j.useCallback((G,W)=>{W&&d(W),c.navigate(G,g)},[c]),w=j.useCallback(G=>{c.navigate(G,g)},[c]),S=j.useCallback(()=>{c.goBack(g)},[c]),M=j.useCallback(()=>{c.goForward(g)},[c]),L=j.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(j.useEffect(()=>{if(r){v.current=!0,b();const G=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(G)}},[r]),!(r||s))return null;const re=()=>{i(!1),setTimeout(()=>{t(),c.reset()},200)},ce=((B=c.current)==null?void 0:B.path)??null,C=c.backStack.length>0,P=c.forwardStack.length>0;return p.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[p.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:re}),p.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:S,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:p.jsx(hb,{className:"w-4 h-4"})}),p.jsx("button",{onClick:M,disabled:!P,className:`p-0.5 transition-colors ${P?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:p.jsx(ed,{className:"w-4 h-4"})}),p.jsx(mb,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),p.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),p.jsx("button",{onClick:re,className:"p-1 text-text-tertiary hover:text-text-primary",children:p.jsx(Ft,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:l!=null&&l.docs?p.jsx(sk,{docs:l.docs,selected:ce,onSelect:w}):p.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),p.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ce?y?p.jsxs("div",{className:"animate-pulse space-y-2",children:[p.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?p.jsx(nk,{content:m.content,currentPath:ce,onNavigate:x,onAnchorClick:L}):p.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[p.jsx(ed,{className:"w-5 h-5 mb-2"}),p.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function ak(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const rb=2e3;function ok(r){const s=r.filter(l=>!l.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
60
|
-
${s.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.content}`).join(`
|
|
61
|
-
`)}
|
|
62
|
-
[End prior conversation]
|
|
63
|
-
|
|
64
|
-
`}function lk(r){const t=r.summary,s=r.title;if(t){const i=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?t.slice(0,i).trim():t}return s||(typeof r=="string"?r:"Query completed.")}const Jv=j.createContext(null);function ck({children:r}){const t=vn(),[s,i]=j.useState(!1),[l,c]=j.useState([]),[m,y]=j.useState(null),[g,f]=j.useState({}),d=j.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??ak(t.pathname)};j.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const v=j.useCallback(()=>i(L=>!L),[]),x=j.useCallback(L=>{f(L)},[]),w=j.useCallback(()=>{c([]),y(null)},[]),S=j.useCallback(async L=>{var X;const U=new Date().toISOString(),re={id:`user-${Date.now()}`,role:"user",content:L,timestamp:U},ce={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:U,pending:!0};c(B=>[...B,re,ce]);const C={...b};(X=C.entities)!=null&&X.yamlContent&&C.entities.yamlContent.length>rb&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,rb)+`
|
|
65
|
-
... (truncated)`});const se=`${ok(l.concat(re))}${L}`;try{const G=(await _e("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:se,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;y(G),c(W=>W.map(J=>J.id===ce.id?{...J,workflowId:G}:J)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var W;try{const J=await _e(`/workflows/${G}/result`),he=(W=J==null?void 0:J.result)==null?void 0:W.data;if(he){d.current&&clearInterval(d.current),d.current=null,y(null);const xe=lk(he);let Te;try{Te=(await _e(`/workflow-states/${G}/execution`)).duration_ms}catch{}c(Y=>Y.map(ae=>ae.id===ce.id?{...ae,content:xe,timestamp:new Date().toISOString(),pending:!1,durationMs:Te}:ae))}}catch{}},3e3)}catch{c(B=>B.map(G=>G.id===ce.id?{...G,content:"Failed to submit query. Please try again.",pending:!1}:G))}},[l,b]),M=j.useCallback(async L=>{const U=l.find(C=>C.id===L);if(!(U!=null&&U.workflowId)||U.compilationStatus==="compiling"||U.compilationStatus==="done")return;const re=l.indexOf(U),ce=l.slice(0,re).reverse().find(C=>C.role==="user");if(ce){c(C=>C.map(P=>P.id===L?{...P,compilationStatus:"compiling"}:P));try{const C=await _e("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ce.content,summary:U.content})}),P=await _e("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:U.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await _e(`/yaml-workflows/${P.id}/deploy`,{method:"POST"}),c(se=>se.map(X=>X.id===L?{...X,compilationStatus:"done"}:X))}catch(C){const P=C instanceof Error?C.message:"Compilation failed";c(se=>se.map(X=>X.id===L?{...X,compilationStatus:"error",compilationError:P}:X))}}},[l]);return p.jsx(Jv.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:v,messages:l,sendMessage:S,pageContext:b,setPageContext:x,activeWorkflowId:m,clearMessages:w,compileMessage:M},children:r})}function Qv(){const r=j.useContext(Jv);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function uk(){const{helpOpen:r,toggleHelp:t}=Qv();return p.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?p.jsx(Ft,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):p.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${kt}/logo512.png)`}})})}function fk({ms:r,className:t=""}){const s=$A(r),i=j.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?p.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):p.jsx(vv,{options:i,children:p.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const hk=["sm","md","lg","full"],sb={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},ib={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function dk({which:r}){const t="stroke-current";switch(r){case"sm":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function mk({msg:r}){const[t,s]=j.useState(0);j.useEffect(()=>{const m=new Date(r.timestamp).getTime(),y=()=>s(Math.floor((Date.now()-m)/1e3));y();const g=setInterval(y,1e3);return()=>clearInterval(g)},[r.timestamp]);const i=Math.floor(t/60),l=t%60,c=i>0?`${i}m ${l}s`:`${l}s`;return p.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),p.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),r.workflowId&&p.jsxs(Fs,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[p.jsx(kd,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function pk({msg:r,compileMessage:t}){const s=r.role==="assistant";return p.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[p.jsx(xv,{date:r.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),r.durationMs!=null&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),p.jsx(fk,{ms:r.durationMs,className:"!text-2xs text-text-muted/50"})]}),r.workflowId&&p.jsx(Fs,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:p.jsx(kd,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&p.jsx("button",{onClick:()=>t(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:p.jsx(Pw,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function yk(){const{helpOpen:r,setHelpOpen:t,messages:s,sendMessage:i,pageContext:l,activeWorkflowId:c,clearMessages:m,compileMessage:y}=Qv(),[g,f]=j.useState(""),[d,b]=j.useState("md"),[v,x]=j.useState(!0),w=j.useRef(null),S=j.useRef(null);if(j.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[s]),j.useEffect(()=>{r&&S.current&&S.current.focus()},[r]),j.useEffect(()=>{if(!r)return;const C=P=>{P.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,d,t]),!r)return null;const M=()=>{const C=g.trim();!C||c||(i(C),f(""),S.current&&(S.current.style.height="auto"))},L=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),M())},U=d==="full",re=l.page.replace(/-/g," "),ce=U?{}:{bottom:"108px"};return p.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${U?sb.full:`right-6 ${sb[d]}`} ${v?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ce,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:[p.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),p.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:re})]}),p.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[p.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:hk.map(C=>p.jsx("button",{onClick:()=>b(C),className:`p-1 rounded transition-colors ${C===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===d,"aria-label":ib[C],title:ib[C],children:p.jsx(dk,{which:C})},C))}),s.length>0&&p.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:p.jsx(Uw,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),p.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:p.jsx(Ft,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),p.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&p.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>p.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[p.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?p.jsx(mk,{msg:C}):C.role==="assistant"?p.jsx(Su,{content:C.content}):C.content}),!C.pending&&p.jsx("div",{className:"mt-0.5",children:p.jsx(pk,{msg:C,compileMessage:y})})]},C.id))]}),p.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsx("textarea",{ref:S,value:g,onChange:C=>{f(C.target.value);const P=C.target;P.style.height="auto",P.style.height=`${Math.min(P.scrollHeight,120)}px`},onKeyDown:L,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),p.jsx("button",{onClick:M,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:p.jsx(zw,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const gk=6e3,bk="scan";function vk(){const{lastResult:r}=Mv(),{open:t,ownerKey:s}=Zd(),[i,l]=j.useState(null);if(j.useEffect(()=>{if(!r)return;const m=setTimeout(()=>l(r.at),gk);return()=>clearTimeout(m)},[r]),!r||r.navigated||i===r.at||t&&s===bk)return null;const{response:c}=r;return p.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:p.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[p.jsx(hu,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-sm font-mono text-text-secondary truncate",children:r.code}),c?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`text-sm font-medium ${Iv[c.outcome]}`,children:$v(c)}),c.error&&p.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c.error}),uu(c)&&p.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:p.jsx(Hv,{content:uu(c),compact:!0})})]}):p.jsx("div",{className:"text-sm text-status-error",children:r.error})]}),p.jsx("button",{type:"button",onClick:()=>l(r.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:p.jsx(Ft,{className:"w-3.5 h-3.5"})})]})})}const Zv="lt-announcement-dismissed:";function xk(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function _k(r){try{return localStorage.getItem(`${Zv}${r}`)==="1"}catch{return!1}}function wk(){const{isAuthenticated:r,userRoleNames:t}=Vt(),{data:s}=hv(r),i=ot(),[l,c]=j.useState(null),[m,y]=j.useState(0);yn(kO,()=>{i.invalidateQueries({queryKey:["announcements"]})});const g=Date.now(),f=((s==null?void 0:s.announcements)??[]).filter(b=>!_k(b.id)&&new Date(b.expires_at).getTime()>g&&(b.roles.length===0||b.roles.some(v=>t.includes(v))));if(j.useEffect(()=>{const b=((s==null?void 0:s.announcements)??[]).map(x=>new Date(x.expires_at).getTime()-Date.now()).filter(x=>x>0);if(b.length===0)return;const v=setTimeout(()=>y(x=>x+1),Math.min(...b)+250);return()=>clearTimeout(v)},[s,m]),f.length===0)return null;const d=b=>{try{localStorage.setItem(`${Zv}${b}`,"1")}catch{}y(v=>v+1)};return p.jsx("div",{"data-testid":"announcement-banner",className:"relative z-40",children:f.map(b=>{const v=l===b.id,x=b.title??b.body.split(`
|
|
66
|
-
`)[0];return p.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[p.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[p.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),p.jsxs("button",{type:"button",onClick:()=>c(v?null:b.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[p.jsx("span",{className:"truncate",children:x}),v?p.jsx(xb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):p.jsx(vb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{type:"button",onClick:()=>d(b.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${x}`,children:p.jsx(Ft,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&p.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:p.jsx(Su,{content:xk(b.body)})})]},b.id)})})}function Sk(){var C;const{isBuilder:r,isOps:t,viewAs:s}=sv(),{canSeePaceBoard:i}=iv();mO();const{data:l}=nr(),c=tv(),m=c!==null?c:!!((C=l==null?void 0:l.ai)!=null&&C.enabled),{collapsed:y,toggle:g}=Jd(),[f,d]=j.useState(!1),[b,v]=j.useState(!1),[x,w]=j.useState(!1),[S,M]=j.useState(()=>window.location.hash.startsWith("#docs")),L=vn(),U=j.useRef(null),{kiosk:re,homePath:ce}=yO();return j.useEffect(()=>{const P=U.current;P&&(P.classList.remove("animate-page-in"),P.offsetWidth,P.classList.add("animate-page-in"))},[L.pathname]),j.useEffect(()=>{const P=()=>{window.location.hash.startsWith("#docs")&&M(!0)};return window.addEventListener("hashchange",P),()=>window.removeEventListener("hashchange",P)},[]),re&&ce&&!bO(L.pathname)?p.jsx(Gn,{to:ce,replace:!0}):p.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[p.jsx(cT,{onToggleEventFeed:()=>d(P=>!P),onToggleDocs:()=>M(P=>!P),onToggleNav:re?void 0:()=>v(P=>!P)}),p.jsx(wk,{}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!re&&p.jsxs("aside",{className:`${y?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[p.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:p.jsx(Fv,{aiEnabled:m,isBuilder:r,isOps:t,viewAs:s,canSeePaceBoard:i})}),p.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${y?"flex justify-center":"flex items-center px-7"}`,"aria-label":y?"Expand sidebar":"Collapse sidebar",children:y?p.jsx(Iw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):p.jsx($w,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!y&&(l==null?void 0:l.environment)&&p.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${l.environment.longTailVersion} · HotMesh v${l.environment.hotmeshVersion} · Node ${l.environment.nodeVersion} · ${l.environment.nodeEnv}`,children:["long-tail v",l.environment.longTailVersion,p.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",l.environment.hotmeshVersion]})]}),p.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:p.jsx("div",{ref:U,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:p.jsx($i,{})})}),p.jsx(Ek,{})]}),!re&&p.jsx(NT,{open:b,onClose:()=>v(!1),aiEnabled:m,isBuilder:r,isOps:t,viewAs:s,canSeePaceBoard:i}),p.jsx(XT,{open:f,onToggle:()=>d(P=>!P),configOpen:x,onToggleConfig:()=>w(P=>!P)}),p.jsx(ik,{open:S,onClose:()=>{M(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&p.jsx(uk,{}),m&&p.jsx(yk,{}),p.jsx(vk,{})]})}function Ek(){const{node:r,width:t,open:s}=Zd();return p.jsx(SO,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:r})}function Ok(){const{isAuthenticated:r}=Vt(),t=vn();return r?p.jsx(xO,{children:p.jsx(wO,{children:p.jsx(ck,{children:p.jsx(nj,{children:p.jsx(pj,{children:p.jsx(Sk,{})})})})})}):p.jsx(Gn,{to:"/login",state:{from:t.pathname},replace:!0})}function Wv({provider:r,className:t="w-5 h-5"}){switch(r){case"google":return p.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),p.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),p.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),p.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return p.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return p.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),p.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),p.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),p.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return p.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return p.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("path",{d:"M12 8v4l3 3"})]})}}async function Ak(){return _e("/auth/oauth/providers")}async function jk(r,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return _e(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function B3(){return lt({queryKey:["oauth-connections"],queryFn:()=>_e("/auth/oauth/connections")})}function P3(){const r=ot();return mt({mutationFn:({provider:t,label:s})=>jk(t,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function Tk(){var se;const{login:r,isAuthenticated:t}=Vt(),s=_o(),i=vn(),l=new URLSearchParams(i.search),c=l.get("token"),m=l.get("error"),y=((se=i.state)==null?void 0:se.from)??l.get("returnTo")??"/",g=j.useRef(!1);c&&!g.current&&(g.current=!0,r(c,void 0,{displayName:l.get("displayName"),username:l.get("username")}));const[f,d]=j.useState(""),[b,v]=j.useState(""),[x,w]=j.useState(m||""),[S,M]=j.useState(!1),[L,U]=j.useState(!!c),[re,ce]=j.useState([]),C=j.useRef(!1);if(j.useEffect(()=>{c||C.current||(C.current=!0,(async()=>{var X,B,G,W;try{const J=await fetch(`${kt}/api/settings`);if(!J.ok)return;const he=await J.json();if(!((X=he.auth)!=null&&X.sso))return;const xe=await fetch(`${kt}/api/auth/sso`,{method:"POST"});if(!xe.ok){w("Host authentication required — please log in to your organization first");return}const Te=await xe.json();Te.token&&((B=he.auth)!=null&&B.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),U(!0),r(Te.token,void 0,{displayName:(G=Te.user)==null?void 0:G.display_name,username:(W=Te.user)==null?void 0:W.external_id}))}catch{}})())},[]),j.useEffect(()=>{c||Ak().then(ce).catch(()=>{})},[]),j.useEffect(()=>{if(!L)return;const X=setTimeout(()=>s(y,{replace:!0}),1500);return()=>clearTimeout(X)},[L]),t&&!L)return p.jsx(Gn,{to:y,replace:!0});const P=async X=>{var B,G;if(X.preventDefault(),w(""),!f.trim()||!b){w("Username and password are required");return}M(!0);try{const W=await fetch(`${kt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),J=await W.json();if(!W.ok){w(J.error||"Login failed");return}U(!0),r(J.token,{username:f.trim(),password:b},{displayName:(B=J.user)==null?void 0:B.display_name,username:(G=J.user)==null?void 0:G.external_id})}catch{w("Unable to connect to server")}finally{M(!1)}};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${L?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:p.jsx(ou,{size:"lg",hideLabel:L})}),p.jsxs("form",{onSubmit:P,className:`space-y-5 transition-opacity duration-300 ${L?"opacity-0":""}`,children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),p.jsx("input",{id:"username",type:"text",value:f,onChange:X=>d(X.target.value),className:"input",placeholder:"Enter your username",autoFocus:!L,autoComplete:"username"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),p.jsx("input",{id:"password",type:"password",value:b,onChange:X=>v(X.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),x&&p.jsx("p",{className:"text-sm text-status-error",children:x}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||L,children:S?"Signing in...":"Sign In"}),re.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[p.jsx("div",{className:"flex-1 h-px bg-border"}),p.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),p.jsx("div",{className:"flex-1 h-px bg-border"})]}),p.jsx("div",{className:"space-y-2",children:re.filter(X=>X.provider!=="anthropic").map(X=>p.jsxs("a",{href:`${kt}/api/auth/oauth/${X.provider}?returnTo=${encodeURIComponent(y)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[p.jsx(Wv,{provider:X.provider}),"Sign in with ",X.name]},X.provider))})]})]})]})})}function ab(){const{isAuthenticated:r}=Vt(),t=_o(),s=vn(),i=new URLSearchParams(s.search),l=i.get("state")||"";j.useEffect(()=>{r||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[c,m]=j.useState(""),[y,g]=j.useState(i.get("label")||"default"),[f,d]=j.useState(""),[b,v]=j.useState(!1),x=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=M=>{M.preventDefault();const L=c.trim();if(!L){d("A token or API key is required");return}if(!L.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}v(!0),d("");const U=`${kt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(L)}&state=${encodeURIComponent(l)}`;window.location.href=U};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:"mb-10",children:p.jsx(ou,{size:"lg"})}),p.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[p.jsx(Wv,{provider:"anthropic",className:"w-6 h-6"}),p.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),p.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),p.jsxs("form",{onSubmit:S,className:"space-y-5",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),p.jsx("input",{id:"token",type:"password",value:c,onChange:M=>m(M.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),x&&p.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&p.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),p.jsx("input",{id:"label",type:"text",value:y,onChange:M=>g(M.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),p.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),f&&p.jsx("p",{className:"text-sm text-status-error",children:f}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),p.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),p.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",p.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",p.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function Hc({roleTypes:r,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:l,hasRoleType:c}=Vt();return i?p.jsx($i,{}):r&&r.some(m=>c(m))?p.jsx($i,{}):t&&t.some(m=>l(m))?p.jsx($i,{}):p.jsx(Gn,{to:s,replace:!0})}function kk({redirectTo:r="/"}){var i;const{data:t,isLoading:s}=nr();return s||!t?null:(i=t.ai)!=null&&i.enabled?p.jsx($i,{}):p.jsx(Gn,{to:r,replace:!0})}function Nk({flag:r,redirectTo:t="/"}){var l;const{data:s,isLoading:i}=nr();return i||!s?null:((l=s.features)==null?void 0:l[r])===!1?p.jsx(Gn,{to:t,replace:!0}):p.jsx($i,{})}const Ck=j.lazy(()=>we(()=>import("./ProcessesListPage-BV0e2OfH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),Mk=j.lazy(()=>we(()=>import("./ProcessDetailPage-B5mmkHS0.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,5,20,21,22]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),Rk=j.lazy(()=>we(()=>import("./McpOverview-Bi23-hih.js"),__vite__mapDeps([23,1,24,25,26,27,14,13,28,5]),import.meta.url).then(r=>({default:r.McpOverview}))),Dk=j.lazy(()=>we(()=>import("./McpRunsPage-DfJzbGYM.js"),__vite__mapDeps([29,1,25,26,4,5,30,27,7,8,9,16,13,31,14,12,11,15,32]),import.meta.url).then(r=>({default:r.McpRunsPage}))),qk=j.lazy(()=>we(()=>import("./McpRunDetailPage-BOh2M0Ca.js"),__vite__mapDeps([33,1,25,14,13,34,35,12,36,19,5,37,15,38]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),Lk=j.lazy(()=>we(()=>import("./McpQueryPage-czMlM7vR.js"),__vite__mapDeps([39,1,14,13,8,9,12,11,15,7,10,31,16,32,4,5,40]),import.meta.url).then(r=>({default:r.McpQueryPage}))),Bk=j.lazy(()=>we(()=>import("./McpQueryDetailPage-FhHSfX9W.js"),__vite__mapDeps([41,1,14,13,19,40,5,26,42,43,25,3,2,44,45,46,47,48,49,38,50,36,37]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),Pk=j.lazy(()=>we(()=>import("./EscalationsOverview-Bq5_ICUt.js"),__vite__mapDeps([51,1,14,13,28,5]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),Uk=j.lazy(()=>we(()=>import("./AvailableEscalationsPage-CEDwyzlx.js"),__vite__mapDeps([52,1,53,13,54,55,5,22,56,6,57,58,12,59,20,16,60,8,9,19,11,4,32]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),zk=j.lazy(()=>we(()=>import("./OperatorDashboard-BWtTKrcJ.js"),__vite__mapDeps([61,1,4,5,6,7,53,8,9,11,32,57,13,58,12,59,20,16,60,19,55,15]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),Ik=j.lazy(()=>we(()=>import("./index-CgGR0kM6.js"),__vite__mapDeps([62,1,54,55,5,22,56,6,14,13,15,60,8,9,19,11,3,20,38,21,63]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),$k=j.lazy(()=>we(()=>import("./WorkflowsOverview-DGp8J0G2.js"),__vite__mapDeps([64,1,3,14,13,28,5]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),Hk=j.lazy(()=>we(()=>import("./index-DFmV19fc.js"),__vite__mapDeps([65,1,3,14,13,12,16,66,47,48,5]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),Gk=j.lazy(()=>we(()=>import("./index-DFmV19fc.js"),__vite__mapDeps([65,1,3,14,13,12,16,66,47,48,5]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),Fk=j.lazy(()=>we(()=>import("./WorkflowsDashboard-CDHQUYEr.js"),__vite__mapDeps([67,1,31,3,30,27,5,4,7,8,9,16,13,14,12,11,15,32]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),Vk=j.lazy(()=>we(()=>import("./WorkflowsDashboard-CDHQUYEr.js"),__vite__mapDeps([67,1,31,3,30,27,5,4,7,8,9,16,13,14,12,11,15,32]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),Yk=j.lazy(()=>we(()=>import("./YamlWorkflowsPage-Cw5wddH7.js"),__vite__mapDeps([68,1,26,4,5,14,13,12,9,49,66,19]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),Kk=j.lazy(()=>we(()=>import("./GraphInvokePage-Ba5fNcgv.js"),__vite__mapDeps([69,1,26,14,13,44,46,47,48,45,5,49,66]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),Xk=j.lazy(()=>we(()=>import("./YamlWorkflowDetailPage-B112bGAY.js"),__vite__mapDeps([70,1,26,19,66,13,5]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),Jk=j.lazy(()=>we(()=>import("./TasksListPage-CBTFz3Bp.js"),__vite__mapDeps([71,1,2,3,4,5,8,9,19,59,50,11,12,13,14,16]),import.meta.url).then(r=>({default:r.TasksListPage}))),Qk=j.lazy(()=>we(()=>import("./TaskDetailPage-SiBSTsfp.js"),__vite__mapDeps([72,1,2,19,59,14,13,5]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),ob=j.lazy(()=>we(()=>import("./WorkflowExecutionPage-BPxoPK8g.js"),__vite__mapDeps([73,1,3,35,12,13,36,19,5,37,2,14,34,15,38]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),Zk=j.lazy(()=>we(()=>import("./AdminDashboard-D-YHIR8w.js"),__vite__mapDeps([74,1,2,24,18,13,5]),import.meta.url).then(r=>({default:r.AdminDashboard}))),Wk=j.lazy(()=>we(()=>import("./index-CHAmwNDI.js"),__vite__mapDeps([75,1,3,8,9,12,13,32,4,5,14,76,16]),import.meta.url).then(r=>({default:r.WorkersPage}))),eN=j.lazy(()=>we(()=>import("./index-DCaGxwKU.js"),__vite__mapDeps([77,1,3,12,13,78,55,5,20,16,14,47,48,66]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),lb=j.lazy(()=>we(()=>import("./index-DCaGxwKU.js"),__vite__mapDeps([77,1,3,12,13,78,55,5,20,16,14,47,48,66]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),tN=j.lazy(()=>we(()=>import("./index-Dc43wixL.js"),__vite__mapDeps([79,1,24,9,78,55,5,14,13,12,11,4,80,46,47,48,49,45,32,19]),import.meta.url).then(r=>({default:r.McpServersPage}))),cb=j.lazy(()=>we(()=>import("./index-DYIy3uT5.js"),__vite__mapDeps([81,1,24,14,13,42,5]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),nN=j.lazy(()=>we(()=>import("./index-CR96SICL.js"),__vite__mapDeps([82,1,22,4,5,8,9,11,12,13,78,55,32,14,20,48,50,83,84,34]),import.meta.url).then(r=>({default:r.UsersPage}))),rN=j.lazy(()=>we(()=>import("./RolesPage-BLfJcFf7.js"),__vite__mapDeps([85,1,12,13,14,20,55,5]),import.meta.url).then(r=>({default:r.RolesPage}))),sN=j.lazy(()=>we(()=>import("./RoleDetailPage-eenl_a5Z.js"),__vite__mapDeps([86,1,22,87,78,55,5,13]),import.meta.url).then(r=>({default:r.RoleDetailPage}))),iN=j.lazy(()=>we(()=>import("./PersonasPage-DRoneLfx.js"),__vite__mapDeps([88,1,83,12,13,14,20,55,5,22,6]),import.meta.url).then(r=>({default:r.PersonasPage}))),aN=j.lazy(()=>we(()=>import("./PersonaDetailPage-VkhuauBf.js"),__vite__mapDeps([89,1,83,20,13,84,87,78,55,5]),import.meta.url).then(r=>({default:r.PersonaDetailPage}))),oN=j.lazy(()=>we(()=>import("./EscalationSchemaPage-LPTJJDfP.js"),__vite__mapDeps([90,1,13,5]),import.meta.url).then(r=>({default:r.EscalationSchemaPage}))),lN=j.lazy(()=>we(()=>import("./EscalationListSchemaPage-DpnorXeU.js"),__vite__mapDeps([91,1,13,5]),import.meta.url).then(r=>({default:r.EscalationListSchemaPage}))),cN=j.lazy(()=>we(()=>import("./ScanCodesPage-BWIcjnr4.js"),__vite__mapDeps([92,1,14,13,5]),import.meta.url).then(r=>({default:r.ScanCodesPage}))),uN=j.lazy(()=>we(()=>import("./ScanSchemeDetailPage-sAuU8cZj.js"),__vite__mapDeps([93,1,78,55,5,14,13]),import.meta.url).then(r=>({default:r.ScanSchemeDetailPage}))),fN=j.lazy(()=>we(()=>import("./ScanStationPage-CA_q1uaI.js"),__vite__mapDeps([94,1,13,55,5,63]),import.meta.url).then(r=>({default:r.ScanStationPage}))),hN=j.lazy(()=>we(()=>import("./index-DeRM0-Xz.js"),__vite__mapDeps([95,1,14,13,55,5,56]),import.meta.url).then(r=>({default:r.MaintenancePage}))),dN=j.lazy(()=>we(()=>import("./OperationsPage-BS8blKLj.js").then(r=>r.O),__vite__mapDeps([96,1,58,13,5,14]),import.meta.url).then(r=>({default:r.OperationsPage}))),mN=j.lazy(()=>we(()=>import("./index-DWhyH1kV.js"),__vite__mapDeps([97,1,18,13,12,4,5,30,27,55,43,76,8,9,32]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),pN=j.lazy(()=>we(()=>import("./index-CRxbF5vt.js"),__vite__mapDeps([98,1,37,13,4,5,30,27,7,8,9,11,12,14,15]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),yN=j.lazy(()=>we(()=>import("./CredentialsPage-DYBp7v8W.js"),__vite__mapDeps([99,1,14,13,50,78,55,5]),import.meta.url).then(r=>({default:r.CredentialsPage}))),gN=j.lazy(()=>we(()=>import("./index-D_5_1D7U.js"),__vite__mapDeps([100,1,5,14,13,12,15,7,9,101,50]),import.meta.url).then(r=>({default:r.FilesPage}))),bN=j.lazy(()=>we(()=>import("./index-COtlcGK_.js"),__vite__mapDeps([102,1,14,13,12,15,11,9,101,50,103,42,5]),import.meta.url).then(r=>({default:r.KnowledgePage}))),vN=j.lazy(()=>we(()=>import("./HomePage-DuFXqfz3.js"),__vite__mapDeps([104,1,3,25,27,20,13,16,15,96,58,5,14,53]),import.meta.url).then(r=>({default:r.HomePage}))),xN=j.lazy(()=>we(()=>import("./AgentsPage-B7PNjrkn.js"),__vite__mapDeps([105,1,106,4,5,7,8,9,11,12,13,14,15]),import.meta.url).then(r=>({default:r.AgentsPage}))),_N=j.lazy(()=>we(()=>import("./AgentDetailPage-rTcofeW4.js"),__vite__mapDeps([107,1,106,108,13,16,5]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),ub=j.lazy(()=>we(()=>import("./AgentConfigPage-CG54Ll2A.js"),__vite__mapDeps([109,1,106,108,13,14,103,46,47,48,3,26,110,111,16,5]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),wN=j.lazy(()=>we(()=>import("./CapabilitiesPage-CswExj9-.js"),__vite__mapDeps([112,1,110,80,24,46,47,48,13,49,5,45,14,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),SN=j.lazy(()=>we(()=>import("./TopicsPage-C9x4tIEi.js"),__vite__mapDeps([113,1,111,14,13,12,5]),import.meta.url).then(r=>({default:r.TopicsPage}))),EN=j.lazy(()=>we(()=>import("./TopicDetailPage-BYIOSVNy.js"),__vite__mapDeps([114,1,111,15,13,5]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function ON(){return p.jsxs("div",{className:"animate-pulse space-y-4",children:[p.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function be({children:r}){return p.jsx(j.Suspense,{fallback:p.jsx(ON,{}),children:p.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:r})})}const ex=new hw({defaultOptions:{queries:{staleTime:1e4,retry:(r,t)=>t instanceof Error&&t.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{ex.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const r=window.__LT_BASE__||"",t=`${r}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,i=r&&s.startsWith(r)?s.slice(r.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(i)}`}});const AN=pw([{path:"/login",element:p.jsx(Tk,{})},{path:"/connect/anthropic",element:p.jsx(ab,{})},{path:"/connect/:provider",element:p.jsx(ab,{})},{path:"/",element:p.jsx(Ok,{}),children:[{index:!0,element:p.jsx(be,{children:p.jsx(vN,{})})},{path:"processes/all",element:p.jsx(be,{children:p.jsx(Ck,{})})},{path:"processes/detail/:originId",element:p.jsx(be,{children:p.jsx(Mk,{})})},{path:"credentials",element:p.jsx(be,{children:p.jsx(yN,{})})},{path:"connections",element:p.jsx(Gn,{to:"/credentials",replace:!0})},{path:"escalations",element:p.jsx(be,{children:p.jsx(Pk,{})})},{path:"escalations/available",element:p.jsx(be,{children:p.jsx(Uk,{})})},{path:"escalations/queue",element:p.jsx(be,{children:p.jsx(zk,{})})},{path:"escalations/detail/:id",element:p.jsx(be,{children:p.jsx(Ik,{})})},{path:"scan/station",element:p.jsx(be,{children:p.jsx(fN,{})})},{path:"capabilities",element:p.jsx(be,{children:p.jsx(wN,{})})},{path:"agents",element:p.jsx(be,{children:p.jsx(xN,{})})},{path:"agents/new",element:p.jsx(be,{children:p.jsx(ub,{})})},{path:"agents/:id",element:p.jsx(be,{children:p.jsx(_N,{})})},{path:"agents/:id/edit",element:p.jsx(be,{children:p.jsx(ub,{})})},{path:"topics",element:p.jsx(be,{children:p.jsx(SN,{})})},{path:"topics/:topic",element:p.jsx(be,{children:p.jsx(EN,{})})},{element:p.jsx(Hc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:p.jsx(be,{children:p.jsx($k,{})})},{path:"workflows/executions",element:p.jsx(be,{children:p.jsx(Vk,{})})},{path:"workflows/durable/executions",element:p.jsx(be,{children:p.jsx(Fk,{})})},{path:"workflows/durable/executions/:workflowId",element:p.jsx(be,{children:p.jsx(ob,{})})},{path:"workflows/tasks",element:p.jsx(be,{children:p.jsx(Jk,{})})},{path:"workflows/tasks/detail/:id",element:p.jsx(be,{children:p.jsx(Qk,{})})},{path:"workflows/executions/:workflowId",element:p.jsx(be,{children:p.jsx(ob,{})})},{path:"workflows/start",element:p.jsx(be,{children:p.jsx(Hk,{})})},{path:"workflows/durable/invoke",element:p.jsx(be,{children:p.jsx(Gk,{})})},{path:"workflows/cron",element:p.jsx(Gn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:p.jsx(be,{children:p.jsx(Wk,{})})},{path:"workflows/registry",element:p.jsx(be,{children:p.jsx(eN,{})})},{path:"workflows/registry/new",element:p.jsx(be,{children:p.jsx(lb,{})})},{path:"workflows/registry/:workflowType",element:p.jsx(be,{children:p.jsx(lb,{})})}]},{element:p.jsx(Hc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:p.jsx(be,{children:p.jsx(Yk,{})})},{path:"mcp/workflows/invoke",element:p.jsx(be,{children:p.jsx(Kk,{})})},{path:"mcp/workflows/:id",element:p.jsx(be,{children:p.jsx(Xk,{})})},{path:"mcp/executions",element:p.jsx(be,{children:p.jsx(Dk,{})})},{path:"mcp/executions/:jobId",element:p.jsx(be,{children:p.jsx(qk,{})})},{path:"files",element:p.jsx(be,{children:p.jsx(gN,{})})},{path:"knowledge",element:p.jsx(be,{children:p.jsx(bN,{})})},{element:p.jsx(kk,{}),children:[{path:"mcp",element:p.jsx(be,{children:p.jsx(Rk,{})})},{path:"mcp/queries",element:p.jsx(be,{children:p.jsx(Lk,{})})},{path:"mcp/queries/:workflowId",element:p.jsx(be,{children:p.jsx(Bk,{})})},{path:"mcp/tools",element:p.jsx(Gn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:p.jsx(be,{children:p.jsx(tN,{})})},{path:"mcp/servers/new",element:p.jsx(be,{children:p.jsx(cb,{})})},{path:"mcp/servers/:serverId",element:p.jsx(be,{children:p.jsx(cb,{})})}]}]},{path:"operations",element:p.jsx(be,{children:p.jsx(dN,{})})},{element:p.jsx(Hc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:p.jsx(be,{children:p.jsx(Zk,{})})},{path:"admin/users",element:p.jsx(be,{children:p.jsx(nN,{})})},{path:"admin/escalation-chains",element:p.jsx(Gn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:p.jsx(be,{children:p.jsx(rN,{})})},{path:"admin/roles/:role",element:p.jsx(be,{children:p.jsx(sN,{})})},{path:"admin/roles/:role/schema",element:p.jsx(be,{children:p.jsx(oN,{})})},{path:"admin/roles/:role/list-schema",element:p.jsx(be,{children:p.jsx(lN,{})})},{path:"admin/scan-codes",element:p.jsx(be,{children:p.jsx(cN,{})})},{path:"admin/scan-codes/:version",element:p.jsx(be,{children:p.jsx(uN,{})})},{path:"admin/personas",element:p.jsx(be,{children:p.jsx(iN,{})})},{path:"admin/personas/:key",element:p.jsx(be,{children:p.jsx(aN,{})})}]},{element:p.jsx(Hc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:p.jsx(Gn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:p.jsx(Nk,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:p.jsx(be,{children:p.jsx(hN,{})})}]},{path:"admin/controlplane",element:p.jsx(be,{children:p.jsx(mN,{})})},{path:"admin/streams",element:p.jsx(be,{children:p.jsx(pN,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function jN(){return p.jsx(dw,{client:ex,children:p.jsx(rS,{children:p.jsx(aO,{children:p.jsx(yw,{router:AN})})})})}Ov(Ev());const sm=document.createElement("link");sm.rel="stylesheet";sm.href=`${kt}/api/settings/custom.css`;document.head.appendChild(sm);Yw.createRoot(document.getElementById("root")).render(p.jsx(j.StrictMode,{children:p.jsx(jN,{})}));export{fv as $,L3 as A,Zd as B,rm as C,fk as D,pT as E,Yv as F,yT as G,_T as H,sv as I,VT as J,yO as K,e3 as L,t3 as M,Ht as N,n3 as O,IN as P,r3 as Q,s3 as R,DT as S,a3 as T,pO as U,ov as V,FN as W,Vt as X,bT as Y,qN as Z,RN as _,h3 as a,uv as a0,nm as a1,QN as a2,gT as a3,w3 as a4,zN as a5,hj as a6,rc as a7,Su as a8,Hv as a9,FA as aA,M3 as aB,R3 as aC,k3 as aD,C3 as aE,Mv as aF,IA as aG,dj as aH,j3 as aI,ze as aJ,HN as aK,m3 as aL,B3 as aM,P3 as aN,Wv as aO,Ks as aP,Kd as aQ,iv as aR,_3 as aS,b3 as aT,KN as aa,tj as ab,Nv as ac,g3 as ad,XN as ae,WN as af,i3 as ag,Wy as ah,kv as ai,tm as aj,vv as ak,S3 as al,c3 as am,BN as an,UN as ao,PN as ap,DN as aq,x3 as ar,kt as as,wb as at,p3 as au,E3 as av,LN as aw,T3 as ax,A3 as ay,N3 as az,nr as b,O3 as c,o3 as d,xv as e,$A as f,SO as g,$N as h,Wt as i,yn as j,l3 as k,_e as l,u3 as m,f3 as n,YN as o,JN as p,ZN as q,d3 as r,GN as s,tv as t,v3 as u,q3 as v,y3 as w,fj as x,D3 as y,VN as z};
|
|
67
|
-
//# sourceMappingURL=index-BEeGFfuP.js.map
|