@hotmeshio/long-tail 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AdminDashboard-JobmypiO.js → AdminDashboard-DmQG0fUK.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-JobmypiO.js.map → AdminDashboard-DmQG0fUK.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-D_HuaRN9.js → AgentConfigPage-BZ8g7Ml8.js} +5 -5
- package/dashboard/dist/assets/{AgentConfigPage-D_HuaRN9.js.map → AgentConfigPage-BZ8g7Ml8.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-Cj22NZLI.js → AgentDetailPage-Cdinl7bx.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-Cj22NZLI.js.map → AgentDetailPage-Cdinl7bx.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DTKto-gL.js → AgentsPage-GEYMgmez.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DTKto-gL.js.map → AgentsPage-GEYMgmez.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-qRf3tBYi.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-qRf3tBYi.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-AwKouk26.js → BotPicker-Bpglj7RE.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-AwKouk26.js.map → BotPicker-Bpglj7RE.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-1ZMO_0UU.js → CapabilitiesPage-ARIQzRiq.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-1ZMO_0UU.js.map → CapabilitiesPage-ARIQzRiq.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-D6kUTrq4.js → CollapsibleSection-BuZl37uS.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-D6kUTrq4.js.map → CollapsibleSection-BuZl37uS.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-Bj9YbInO.js → CountdownTimer-CRK-E2UF.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-Bj9YbInO.js.map → CountdownTimer-CRK-E2UF.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-D5H_kyRL.js → CredentialsPage-CjBiPahB.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-D5H_kyRL.js.map → CredentialsPage-CjBiPahB.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DvmJ0EFz.js → CronLabel-DTXl2Rgj.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DvmJ0EFz.js.map → CronLabel-DTXl2Rgj.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-DT_g8Hr4.js → CustomDurationPicker-qhb23E3p.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-DT_g8Hr4.js.map → CustomDurationPicker-qhb23E3p.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-wJqP4zA4.js → DropZone-C1TpkVQG.js} +2 -2
- package/dashboard/dist/assets/{DropZone-wJqP4zA4.js.map → DropZone-C1TpkVQG.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-7_8YpC3D.js → ElapsedCell-BMhamzj3.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-7_8YpC3D.js.map → ElapsedCell-BMhamzj3.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-ClFRLeKV.js → EscalationListSchemaPage-BEi89A7y.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-ClFRLeKV.js.map → EscalationListSchemaPage-BEi89A7y.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-BcYcj-b8.js → EscalationSchemaPage-9NY4Q4ku.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-BcYcj-b8.js.map → EscalationSchemaPage-9NY4Q4ku.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-uHb8ni_5.js → EscalationsOverview-2VRjFxPV.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-uHb8ni_5.js.map → EscalationsOverview-2VRjFxPV.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-CkdWqmEL.js → EventTable-hHPNI3Yq.js} +2 -2
- package/dashboard/dist/assets/{EventTable-CkdWqmEL.js.map → EventTable-hHPNI3Yq.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-C6sfPjSc.js → GraphInvokePage-B6qAC8zt.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-C6sfPjSc.js.map → GraphInvokePage-B6qAC8zt.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-CUHZxihq.js → HomePage-DDyQOu57.js} +2 -2
- package/dashboard/dist/assets/{HomePage-CUHZxihq.js.map → HomePage-DDyQOu57.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-nWxpujpH.js → ListToolbar-BUgEY8Oc.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-nWxpujpH.js.map → ListToolbar-BUgEY8Oc.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-DXrkDkU-.js → McpOverview-DIenRt0e.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-DXrkDkU-.js.map → McpOverview-DIenRt0e.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-CnLYE26v.js → McpQueryDetailPage-CxAR4Bpw.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-CnLYE26v.js.map → McpQueryDetailPage-CxAR4Bpw.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-oE9eWAus.js → McpQueryPage-CkT4A2c5.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-oE9eWAus.js.map → McpQueryPage-CkT4A2c5.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-B7e6AVl1.js → McpRunDetailPage-DDiOtG5r.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-B7e6AVl1.js.map → McpRunDetailPage-DDiOtG5r.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-Bx5DiGk7.js → McpRunsPage-BWe6WVzw.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-Bx5DiGk7.js.map → McpRunsPage-BWe6WVzw.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-BlhSWa5S.js → NamespacePill--ikKtMvx.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-BlhSWa5S.js.map → NamespacePill--ikKtMvx.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-BmG3qzdR.js → OperationsPage-CzJx-zxj.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-BmG3qzdR.js.map → OperationsPage-CzJx-zxj.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-r6hQ57eO.js → OperatorDashboard-CVq7V7hE.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-r6hQ57eO.js.map → OperatorDashboard-CVq7V7hE.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-Ji1AtA4f.js → PageHeader-CiFhzGc0.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Ji1AtA4f.js.map → PageHeader-CiFhzGc0.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-B2qrFAaG.js → PageHeaderWithStats-_zOnWAhq.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-B2qrFAaG.js.map → PageHeaderWithStats-_zOnWAhq.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-C3gE4OHq.js → ProcessDetailPage-BWVFB-nL.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-C3gE4OHq.js.map → ProcessDetailPage-BWVFB-nL.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-DSsIGmBB.js → ProcessesListPage-kyRO3E9d.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-DSsIGmBB.js.map → ProcessesListPage-kyRO3E9d.js.map} +1 -1
- package/dashboard/dist/assets/{RoleDetailPage-DiFISbnq.js → RoleDetailPage-DrSlAQUQ.js} +3 -3
- package/dashboard/dist/assets/{RoleDetailPage-DiFISbnq.js.map → RoleDetailPage-DrSlAQUQ.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-ColM_ynA.js → RolePill-CUIJSgRq.js} +2 -2
- package/dashboard/dist/assets/{RolePill-ColM_ynA.js.map → RolePill-CUIJSgRq.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-CE5fui18.js → RolesPage-tT21PIEb.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-CE5fui18.js.map → RolesPage-tT21PIEb.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-Ct8NNadu.js → RunAsSelector-BqhOzi2p.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-Ct8NNadu.js.map → RunAsSelector-BqhOzi2p.js.map} +1 -1
- package/dashboard/dist/assets/{SlidePanel-BzeKveus.js → SlidePanel-BcWKelpn.js} +2 -2
- package/dashboard/dist/assets/{SlidePanel-BzeKveus.js.map → SlidePanel-BcWKelpn.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-BfgBtP_B.js → StickyPagination-BTDj99Vb.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-BfgBtP_B.js.map → StickyPagination-BTDj99Vb.js.map} +1 -1
- package/dashboard/dist/assets/StreamMessageDetail-DjjnJ31Q.js +2 -0
- package/dashboard/dist/assets/{StreamMessageDetail-2rwp7Ynx.js.map → StreamMessageDetail-DjjnJ31Q.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BwWyYBCo.js → SwimlaneTimeline-Db7ATobq.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BwWyYBCo.js.map → SwimlaneTimeline-Db7ATobq.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-By0E_Jym.js → TagInput-BaFJCq9A.js} +2 -2
- package/dashboard/dist/assets/{TagInput-By0E_Jym.js.map → TagInput-BaFJCq9A.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-BUKHu2oD.js → TaskDetailPage-BVlCa-PR.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-BUKHu2oD.js.map → TaskDetailPage-BVlCa-PR.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-CY1ZSwWu.js → TaskQueuePill-D9e16qkU.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-CY1ZSwWu.js.map → TaskQueuePill-D9e16qkU.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-C_PwExQC.js → TasksListPage-PKscNTJs.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-C_PwExQC.js.map → TasksListPage-PKscNTJs.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-Bagm-L2o.js → TimeAgo-CGx_Ffwq.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-Bagm-L2o.js.map → TimeAgo-CGx_Ffwq.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BwDo7knq.js → TimestampCell-CdD5hp9o.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BwDo7knq.js.map → TimestampCell-CdD5hp9o.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-D0IzqLEe.js → ToolPill-Enc3nyic.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-D0IzqLEe.js.map → ToolPill-Enc3nyic.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-CVZ2M1yv.js → ToolTestPanel-DWs0DNGB.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-CVZ2M1yv.js.map → ToolTestPanel-DWs0DNGB.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-DKAvbkxD.js → TopicDetailPage-BaL3m3yb.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-DKAvbkxD.js.map → TopicDetailPage-BaL3m3yb.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-BZknsApe.js → TopicsPage-bFjJUYmO.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-BZknsApe.js.map → TopicsPage-bFjJUYmO.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-ByDxLHPZ.js → UserName-IdFyeFle.js} +2 -2
- package/dashboard/dist/assets/{UserName-ByDxLHPZ.js.map → UserName-IdFyeFle.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-DrwKB2x8.js → WorkflowExecutionPage-DtC-71vO.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-DrwKB2x8.js.map → WorkflowExecutionPage-DtC-71vO.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-BXmmLR0t.js → WorkflowPill-S6VV2Eax.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-BXmmLR0t.js.map → WorkflowPill-S6VV2Eax.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-DEq9fkhl.js → WorkflowsDashboard-DGtMG5vL.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-DEq9fkhl.js.map → WorkflowsDashboard-DGtMG5vL.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-l-0KYP7Y.js → WorkflowsOverview-BFs-ZSTn.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-l-0KYP7Y.js.map → WorkflowsOverview-BFs-ZSTn.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-BgimL3VT.js → YamlWorkflowDetailPage-6FTLoVfO.js} +25 -25
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-BgimL3VT.js.map → YamlWorkflowDetailPage-6FTLoVfO.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-CabXXA9r.js → YamlWorkflowsPage-0Moxrj_c.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-CabXXA9r.js.map → YamlWorkflowsPage-0Moxrj_c.js.map} +1 -1
- package/dashboard/dist/assets/{agents-D_L6lV0f.js → agents-Dpg829fG.js} +2 -2
- package/dashboard/dist/assets/{agents-D_L6lV0f.js.map → agents-Dpg829fG.js.map} +1 -1
- package/dashboard/dist/assets/{bots-wdZz1nJw.js → bots-BiS_mYcH.js} +2 -2
- package/dashboard/dist/assets/{bots-wdZz1nJw.js.map → bots-BiS_mYcH.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-C35_V8eu.js → capabilities-Cpe3amV5.js} +2 -2
- package/dashboard/dist/assets/{capabilities-C35_V8eu.js.map → capabilities-Cpe3amV5.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-kR2P6zYv.js → controlplane-CjK2cXaD.js} +2 -2
- package/dashboard/dist/assets/{controlplane-kR2P6zYv.js.map → controlplane-CjK2cXaD.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-_KrFogWG.js +2 -0
- package/dashboard/dist/assets/escalation-columns-_KrFogWG.js.map +1 -0
- package/dashboard/dist/assets/{index-xBNf5aFb.js → index-3ewF-RsR.js} +2 -2
- package/dashboard/dist/assets/{index-xBNf5aFb.js.map → index-3ewF-RsR.js.map} +1 -1
- package/dashboard/dist/assets/{index-BMQopgAx.js → index-BFh7zbQF.js} +2 -2
- package/dashboard/dist/assets/{index-BMQopgAx.js.map → index-BFh7zbQF.js.map} +1 -1
- package/dashboard/dist/assets/{index-BmbO85oT.js → index-BYpOpKoM.js} +2 -2
- package/dashboard/dist/assets/{index-BmbO85oT.js.map → index-BYpOpKoM.js.map} +1 -1
- package/dashboard/dist/assets/{index-wZzl3bcK.js → index-Be9bw5cd.js} +2 -2
- package/dashboard/dist/assets/{index-wZzl3bcK.js.map → index-Be9bw5cd.js.map} +1 -1
- package/dashboard/dist/assets/{index-QOTnrFd1.js → index-C42kzl9D.js} +2 -2
- package/dashboard/dist/assets/{index-QOTnrFd1.js.map → index-C42kzl9D.js.map} +1 -1
- package/dashboard/dist/assets/{index-BfDn7j4K.js → index-CTTxpoEl.js} +2 -2
- package/dashboard/dist/assets/{index-BfDn7j4K.js.map → index-CTTxpoEl.js.map} +1 -1
- package/dashboard/dist/assets/index-DWXhbO4b.js +5 -0
- package/dashboard/dist/assets/index-DWXhbO4b.js.map +1 -0
- package/dashboard/dist/assets/index-DYcP4jyl.js +63 -0
- package/dashboard/dist/assets/index-DYcP4jyl.js.map +1 -0
- package/dashboard/dist/assets/{index-C75E0-Wd.js → index-Dq5RU7sm.js} +2 -2
- package/dashboard/dist/assets/{index-C75E0-Wd.js.map → index-Dq5RU7sm.js.map} +1 -1
- package/dashboard/dist/assets/{index-BZfX_ziz.js → index-Fc1qNrqI.js} +2 -2
- package/dashboard/dist/assets/{index-BZfX_ziz.js.map → index-Fc1qNrqI.js.map} +1 -1
- package/dashboard/dist/assets/{index-B4zWCfQr.js → index-IHOuIqlt.js} +2 -2
- package/dashboard/dist/assets/{index-B4zWCfQr.js.map → index-IHOuIqlt.js.map} +1 -1
- package/dashboard/dist/assets/{index-1WCiN-pF.js → index-JQCy1mnu.js} +2 -2
- package/dashboard/dist/assets/{index-1WCiN-pF.js.map → index-JQCy1mnu.js.map} +1 -1
- package/dashboard/dist/assets/{index-CJFA7aLp.js → index-p85Oqfqc.js} +2 -2
- package/dashboard/dist/assets/{index-CJFA7aLp.js.map → index-p85Oqfqc.js.map} +1 -1
- package/dashboard/dist/assets/index-waKF7bKZ.css +1 -0
- package/dashboard/dist/assets/{knowledge-DDt599ea.js → knowledge-Bed_1toa.js} +2 -2
- package/dashboard/dist/assets/{knowledge-DDt599ea.js.map → knowledge-Bed_1toa.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-BPXRXEje.js → mcp-LRVvEX8W.js} +2 -2
- package/dashboard/dist/assets/{mcp-BPXRXEje.js.map → mcp-LRVvEX8W.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-HUZuboi-.js → mcp-query-k2J65UbP.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-HUZuboi-.js.map → mcp-query-k2J65UbP.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-CH8q3ok_.js → pipelines-C9fpHxJR.js} +2 -2
- package/dashboard/dist/assets/{pipelines-CH8q3ok_.js.map → pipelines-C9fpHxJR.js.map} +1 -1
- package/dashboard/dist/assets/{roles-B7rzw8wD.js → roles-BO-4Ieun.js} +2 -2
- package/dashboard/dist/assets/{roles-B7rzw8wD.js.map → roles-BO-4Ieun.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-j-mVt2EA.js → tasks-BiyBXdk7.js} +2 -2
- package/dashboard/dist/assets/{tasks-j-mVt2EA.js.map → tasks-BiyBXdk7.js.map} +1 -1
- package/dashboard/dist/assets/{topics-DATyaYWW.js → topics-m_BXjCFf.js} +2 -2
- package/dashboard/dist/assets/{topics-DATyaYWW.js.map → topics-m_BXjCFf.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-CwIAhqJk.js → useEventHooks-CtkD_tnd.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-CwIAhqJk.js.map → useEventHooks-CtkD_tnd.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-hV7rcAfa.js → useNamespace-Dt2COnsG.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-hV7rcAfa.js.map → useNamespace-Dt2COnsG.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-Dwuuu3F0.js → useYamlActivityEvents--i7p1Ta9.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-Dwuuu3F0.js.map → useYamlActivityEvents--i7p1Ta9.js.map} +1 -1
- package/dashboard/dist/assets/{users-DS9yeHe4.js → users-BsRZkm9v.js} +2 -2
- package/dashboard/dist/assets/{users-DS9yeHe4.js.map → users-BsRZkm9v.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-BX2Vih4L.js → vendor-icons-DPmIjhZB.js} +129 -124
- package/dashboard/dist/assets/vendor-icons-DPmIjhZB.js.map +1 -0
- package/dashboard/dist/assets/{workflows-FF8WUHaC.js → workflows-B0djSSvg.js} +2 -2
- package/dashboard/dist/assets/{workflows-FF8WUHaC.js.map → workflows-B0djSSvg.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-y-eo6Rwj.js → yaml-workflows-CupO7vvi.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-y-eo6Rwj.js.map → yaml-workflows-CupO7vvi.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/hitl-guide.md +125 -1
- package/package.json +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CUvrKkgS.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-CUvrKkgS.js.map +0 -1
- package/dashboard/dist/assets/StreamMessageDetail-2rwp7Ynx.js +0 -2
- package/dashboard/dist/assets/escalation-columns-BVj16HuR.js +0 -2
- package/dashboard/dist/assets/escalation-columns-BVj16HuR.js.map +0 -1
- package/dashboard/dist/assets/index-CsMAT5cs.css +0 -1
- package/dashboard/dist/assets/index-DIrYjyRG.js +0 -5
- package/dashboard/dist/assets/index-DIrYjyRG.js.map +0 -1
- package/dashboard/dist/assets/index-so192yXP.js +0 -63
- package/dashboard/dist/assets/index-so192yXP.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-BX2Vih4L.js.map +0 -1
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-DSsIGmBB.js","./vendor-query-B2UbickB.js","./tasks-j-mVt2EA.js","./workflows-FF8WUHaC.js","./useEventHooks-CwIAhqJk.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./useDebouncedValue-BA5S7V54.js","./api-path-u2Jf9QXS.js","./DataTable-Byn3oyT9.js","./EmptyState-BcsfPq9T.js","./TimestampCell-BwDo7knq.js","./StickyPagination-BfgBtP_B.js","./FilterBar-DDIn8TOs.js","./PageHeader-Ji1AtA4f.js","./vendor-icons-BX2Vih4L.js","./ListToolbar-nWxpujpH.js","./WorkflowPill-BXmmLR0t.js","./ProcessDetailPage-C3gE4OHq.js","./PageHeaderWithStats-B2qrFAaG.js","./StatusBadge-CEQMRmSQ.js","./RolePill-ColM_ynA.js","./UserName-ByDxLHPZ.js","./users-DS9yeHe4.js","./McpOverview-DXrkDkU-.js","./mcp-BPXRXEje.js","./pipelines-CH8q3ok_.js","./yaml-workflows-y-eo6Rwj.js","./controlplane-kR2P6zYv.js","./StatCard-DrdlUeQz.js","./McpRunsPage-Bx5DiGk7.js","./useNamespace-hV7rcAfa.js","./ElapsedCell-7_8YpC3D.js","./RowActions-BA9L9djf.js","./McpRunDetailPage-B7e6AVl1.js","./CopyableId-uot2mE_g.js","./CollapsibleSection-D6kUTrq4.js","./EventTable-CkdWqmEL.js","./SwimlaneTimeline-BwWyYBCo.js","./StreamMessageDetail-2rwp7Ynx.js","./McpQueryPage-oE9eWAus.js","./mcp-query-HUZuboi-.js","./McpQueryDetailPage-CnLYE26v.js","./TagInput-By0E_Jym.js","./useYamlActivityEvents-Dwuuu3F0.js","./helpers-DzO-OGPe.js","./RunAsSelector-Ct8NNadu.js","./BotPicker-AwKouk26.js","./bots-wdZz1nJw.js","./ToolPill-D0IzqLEe.js","./TimeAgo-Bagm-L2o.js","./EscalationsOverview-uHb8ni_5.js","./AvailableEscalationsPage-CUvrKkgS.js","./CustomDurationPicker-DT_g8Hr4.js","./Modal-CSrxpXeM.js","./constants-BHkpVaqx.js","./roles-B7rzw8wD.js","./CountdownTimer-Bj9YbInO.js","./escalation-columns-BVj16HuR.js","./PriorityBadge-B4ykBH7f.js","./OperatorDashboard-r6hQ57eO.js","./index-DIrYjyRG.js","./SlidePanel-BzeKveus.js","./WorkflowsOverview-l-0KYP7Y.js","./index-BMQopgAx.js","./NamespacePill-BlhSWa5S.js","./WorkflowsDashboard-DEq9fkhl.js","./YamlWorkflowsPage-CabXXA9r.js","./GraphInvokePage-C6sfPjSc.js","./YamlWorkflowDetailPage-BgimL3VT.js","./TasksListPage-C_PwExQC.js","./TaskDetailPage-BUKHu2oD.js","./WorkflowExecutionPage-DrwKB2x8.js","./AdminDashboard-JobmypiO.js","./index-BfDn7j4K.js","./TaskQueuePill-CY1ZSwWu.js","./index-xBNf5aFb.js","./ConfirmDeleteModal-D9_1b4MW.js","./index-BmbO85oT.js","./ToolTestPanel-CVZ2M1yv.js","./index-BZfX_ziz.js","./index-1WCiN-pF.js","./RolesPage-CE5fui18.js","./RoleDetailPage-DiFISbnq.js","./EscalationSchemaPage-BcYcj-b8.js","./EscalationListSchemaPage-ClFRLeKV.js","./index-CJFA7aLp.js","./OperationsPage-BmG3qzdR.js","./index-C75E0-Wd.js","./index-wZzl3bcK.js","./CredentialsPage-D5H_kyRL.js","./index-B4zWCfQr.js","./DropZone-wJqP4zA4.js","./index-QOTnrFd1.js","./knowledge-DDt599ea.js","./HomePage-CUHZxihq.js","./AgentsPage-DTKto-gL.js","./agents-D_L6lV0f.js","./AgentDetailPage-Cj22NZLI.js","./CronLabel-DvmJ0EFz.js","./AgentConfigPage-D_HuaRN9.js","./capabilities-C35_V8eu.js","./topics-DATyaYWW.js","./CapabilitiesPage-1ZMO_0UU.js","./TopicsPage-BZknsApe.js","./TopicDetailPage-DKAvbkxD.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Qx=Object.defineProperty;var Xx=(i,n,s)=>n in i?Qx(i,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[n]=s;var v=(i,n,s)=>Xx(i,typeof n!="symbol"?n+"":n,s);import{r as Kx,a as O,j as h,u as Sn,b as on,c as En,Q as Zx,d as Wx}from"./vendor-query-B2UbickB.js";import{r as ev,L as _r,u as ri,N as $o,a as Og,b as $n,O as Ar,c as Tg,d as tv,R as nv}from"./vendor-react-CXumBFUA.js";import{X as Dr,I as Df,R as Ng,B as kg,U as sv,L as zf,a as m0,b as iv,Z as rv,S as p0,P as g0,C as av,W as rh,c as lv,d as ov,F as cv,e as uv,f as fv,T as hv,N as dv,g as mv,D as pv,M as Cg,h as Mg,i as gv,j as yv,k as bv,E as xv,l as vv,m as _v,n as wv,o as y0,G as Sv,p as Ev,q as Av,r as jv,s as Ov}from"./vendor-icons-BX2Vih4L.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var yf={exports:{}},Ma={},bf={exports:{}},xf={};/**
|
|
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 b0;function Tv(){return b0||(b0=1,(function(i){function n($,se){var he=$.length;$.push(se);e:for(;0<he;){var Ae=he-1>>>1,ve=$[Ae];if(0<o(ve,se))$[Ae]=se,$[he]=ve,he=Ae;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var se=$[0],he=$.pop();if(he!==se){$[0]=he;e:for(var Ae=0,ve=$.length,G=ve>>>1;Ae<G;){var ge=2*(Ae+1)-1,xe=$[ge],Pe=ge+1,tt=$[Pe];if(0>o(xe,he))Pe<ve&&0>o(tt,xe)?($[Ae]=tt,$[Pe]=he,Ae=Pe):($[Ae]=xe,$[ge]=he,Ae=ge);else if(Pe<ve&&0>o(tt,he))$[Ae]=tt,$[Pe]=he,Ae=Pe;else break e}}return se}function o($,se){var he=$.sortIndex-se.sortIndex;return he!==0?he:$.id-se.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();i.unstable_now=function(){return d.now()-m}}var g=[],y=[],E=1,w=null,T=3,z=!1,M=!1,q=!1,Q=!1,W=typeof setTimeout=="function"?setTimeout:null,te=typeof clearTimeout=="function"?clearTimeout:null,fe=typeof setImmediate<"u"?setImmediate:null;function re($){for(var se=s(y);se!==null;){if(se.callback===null)a(y);else if(se.startTime<=$)a(y),se.sortIndex=se.expirationTime,n(g,se);else break;se=s(y)}}function N($){if(q=!1,re($),!M)if(s(g)!==null)M=!0,V||(V=!0,ie());else{var se=s(y);se!==null&&Te(N,se.startTime-$)}}var V=!1,ae=-1,P=5,F=-1;function X(){return Q?!0:!(i.unstable_now()-F<P)}function oe(){if(Q=!1,V){var $=i.unstable_now();F=$;var se=!0;try{e:{M=!1,q&&(q=!1,te(ae),ae=-1),z=!0;var he=T;try{t:{for(re($),w=s(g);w!==null&&!(w.expirationTime>$&&X());){var Ae=w.callback;if(typeof Ae=="function"){w.callback=null,T=w.priorityLevel;var ve=Ae(w.expirationTime<=$);if($=i.unstable_now(),typeof ve=="function"){w.callback=ve,re($),se=!0;break t}w===s(g)&&a(g),re($)}else a(g);w=s(g)}if(w!==null)se=!0;else{var G=s(y);G!==null&&Te(N,G.startTime-$),se=!1}}break e}finally{w=null,T=he,z=!1}se=void 0}}finally{se?ie():V=!1}}}var ie;if(typeof fe=="function")ie=function(){fe(oe)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,Ue=Ne.port2;Ne.port1.onmessage=oe,ie=function(){Ue.postMessage(null)}}else ie=function(){W(oe,0)};function Te($,se){ae=W(function(){$(i.unstable_now())},se)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function($){$.callback=null},i.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<$?Math.floor(1e3/$):5},i.unstable_getCurrentPriorityLevel=function(){return T},i.unstable_next=function($){switch(T){case 1:case 2:case 3:var se=3;break;default:se=T}var he=T;T=se;try{return $()}finally{T=he}},i.unstable_requestPaint=function(){Q=!0},i.unstable_runWithPriority=function($,se){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var he=T;T=$;try{return se()}finally{T=he}},i.unstable_scheduleCallback=function($,se,he){var Ae=i.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?Ae+he:Ae):he=Ae,$){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=he+ve,$={id:E++,callback:se,priorityLevel:$,startTime:he,expirationTime:ve,sortIndex:-1},he>Ae?($.sortIndex=he,n(y,$),s(g)===null&&$===s(y)&&(q?(te(ae),ae=-1):q=!0,Te(N,he-Ae))):($.sortIndex=ve,n(g,$),M||z||(M=!0,V||(V=!0,ie()))),$},i.unstable_shouldYield=X,i.unstable_wrapCallback=function($){var se=T;return function(){var he=T;T=se;try{return $.apply(this,arguments)}finally{T=he}}}})(xf)),xf}var x0;function Nv(){return x0||(x0=1,bf.exports=Tv()),bf.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 v0;function kv(){if(v0)return Ma;v0=1;var i=Nv(),n=Kx(),s=ev();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var r=e,l=t;;){var c=r.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){r=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===r)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(r.return!==l.return)r=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===r){p=!0,r=c,l=u;break}if(b===l){p=!0,l=c,r=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===r){p=!0,r=u,l=c;break}if(b===l){p=!0,l=u,r=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(r.alternate!==l)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,T=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),te=Symbol.for("react.consumer"),fe=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),X=Symbol.for("react.memo_cache_sentinel"),oe=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=oe&&e[oe]||e["@@iterator"],typeof e=="function"?e:null)}var Ne=Symbol.for("react.client.reference");function Ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ne?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case W:return"Profiler";case Q:return"StrictMode";case N:return"Suspense";case V:return"SuspenseList";case F:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case fe:return e.displayName||"Context";case te:return(e._context.displayName||"Context")+".Consumer";case re:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return t=e.displayName||null,t!==null?t:Ue(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return Ue(e(t))}catch{}}return null}var Te=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},Ae=[],ve=-1;function G(e){return{current:e}}function ge(e){0>ve||(e.current=Ae[ve],Ae[ve]=null,ve--)}function xe(e,t){ve++,Ae[ve]=e.current,e.current=t}var Pe=G(null),tt=G(null),St=G(null),at=G(null);function lt(e,t){switch(xe(St,t),xe(tt,e),xe(Pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Up(t),e=Bp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ge(Pe),xe(Pe,e)}function Se(){ge(Pe),ge(tt),ge(St)}function vt(e){e.memoizedState!==null&&xe(at,e);var t=Pe.current,r=Bp(t,e.type);t!==r&&(xe(tt,e),xe(Pe,r))}function qn(e){tt.current===e&&(ge(Pe),ge(tt)),at.current===e&&(ge(at),Ta._currentValue=he)}var In,Rt;function cn(e){if(In===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);In=t&&t[1]||"",Rt=-1<r.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+In+e+Rt}var Mi=!1;function xs(e,t){if(!e||Mi)return"";Mi=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(Y){var L=Y}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(Y){L=Y}e.call(ee.prototype)}}else{try{throw Error()}catch(Y){L=Y}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(Y){if(Y&&L&&typeof Y.stack=="string")return[Y.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var j=p.split(`
|
|
21
|
-
`),B=b.split(`
|
|
22
|
-
`);for(c=l=0;l<j.length&&!j[l].includes("DetermineComponentFrameRoot");)l++;for(;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;if(l===j.length||c===B.length)for(l=j.length-1,c=B.length-1;1<=l&&0<=c&&j[l]!==B[c];)c--;for(;1<=l&&0<=c;l--,c--)if(j[l]!==B[c]){if(l!==1||c!==1)do if(l--,c--,0>c||j[l]!==B[c]){var I=`
|
|
23
|
-
`+j[l].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),I}while(1<=l&&0<=c);break}}}finally{Mi=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?cn(r):""}function sl(e,t){switch(e.tag){case 26:case 27:case 5:return cn(e.type);case 16:return cn("Lazy");case 13:return e.child!==t&&t!==null?cn("Suspense Fallback"):cn("Suspense");case 19:return cn("SuspenseList");case 0:case 15:return xs(e.type,!1);case 11:return xs(e.type.render,!1);case 1:return xs(e.type,!0);case 31:return cn("Activity");default:return""}}function il(e){try{var t="",r=null;do t+=sl(e,r),r=e,e=e.return;while(e);return t}catch(l){return`
|
|
24
|
-
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var Br=Object.prototype.hasOwnProperty,Lr=i.unstable_scheduleCallback,Jn=i.unstable_cancelCallback,rl=i.unstable_shouldYield,Ri=i.unstable_requestPaint,nt=i.unstable_now,ac=i.unstable_getCurrentPriorityLevel,al=i.unstable_ImmediatePriority,ll=i.unstable_UserBlockingPriority,Di=i.unstable_NormalPriority,lc=i.unstable_LowPriority,ol=i.unstable_IdlePriority,oc=i.log,cl=i.unstable_setDisableYieldValue,li=null,ft=null;function Ft(e){if(typeof oc=="function"&&cl(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(li,e)}catch{}}var Ct=Math.clz32?Math.clz32:zi,Hr=Math.log,Pr=Math.LN2;function zi(e){return e>>>=0,e===0?32:31-(Hr(e)/Pr|0)|0}var vs=256,Qn=262144,_s=4194304;function An(e){var t=e&42;if(t!==0)return t;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 oi(e,t,r){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=An(l):(p&=b,p!==0?c=An(p):r||(r=b&~e,r!==0&&(c=An(r))))):(b=l&~u,b!==0?c=An(b):p!==0?c=An(p):r||(r=l&~e,r!==0&&(c=An(r)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,r=t&-t,u>=r||u===32&&(r&4194048)!==0)?t:c}function ci(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $r(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 qi(){var e=_s;return _s<<=1,(_s&62914560)===0&&(_s=4194304),e}function ws(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function jn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ss(e,t,r,l,c,u){var p=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var b=e.entanglements,j=e.expirationTimes,B=e.hiddenUpdates;for(r=p&~r;0<r;){var I=31-Ct(r),ee=1<<I;b[I]=0,j[I]=-1;var L=B[I];if(L!==null)for(B[I]=null,I=0;I<L.length;I++){var Y=L[I];Y!==null&&(Y.lane&=-536870913)}r&=~ee}l!==0&&Es(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function Es(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Ct(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|r&261930}function ui(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var l=31-Ct(r),c=1<<l;c&t|e[l]&t&&(e[l]|=t),r&=~c}}function As(e,t){var r=t&-t;return r=(r&42)!==0?1:Xn(r),(r&(e.suspendedLanes|t))!==0?0:r}function Xn(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 fi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Yr(){var e=se.p;return e!==0?e:(e=window.event,e===void 0?32:l0(e.type))}function ul(e,t){var r=se.p;try{return se.p=e,t()}finally{se.p=r}}var Un=Math.random().toString(36).slice(2),Xe="__reactFiber$"+Un,ot="__reactProps$"+Un,It="__reactContainer$"+Un,hi="__reactEvents$"+Un,Gr="__reactListeners$"+Un,fl="__reactHandles$"+Un,hl="__reactResources$"+Un,_t="__reactMarker$"+Un;function Ui(e){delete e[Xe],delete e[ot],delete e[hi],delete e[Gr],delete e[fl]}function x(e){var t=e[Xe];if(t)return t;for(var r=e.parentNode;r;){if(t=r[It]||r[Xe]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Vp(e);e!==null;){if(r=e[Xe])return r;e=Vp(e)}return t}e=r,r=e.parentNode}return null}function S(e){if(e=e[Xe]||e[It]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[hl];return t||(t=e[hl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function k(e){e[_t]=!0}var D=new Set,Z={};function ne(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Z[e]=t,e=0;e<t.length;e++)D.add(t[e])}var K=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]*$"),me={},ke={};function Ze(e){return Br.call(ke,e)?!0:Br.call(me,e)?!1:K.test(e)?ke[e]=!0:(me[e]=!0,!1)}function Mt(e,t,r){if(Ze(t))if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+r)}}function On(e,t,r){if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+r)}}function Kn(e,t,r,l){if(l===null)e.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(t,r,""+l)}}function un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Nh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $y(e,t,r){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){r=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(p){r=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function cc(e){if(!e._valueTracker){var t=Nh(e)?"checked":"value";e._valueTracker=$y(e,t,""+e[t])}}function kh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),l="";return e&&(l=Nh(e)?e.checked?"true":"false":e.value),e=l,e!==r?(t.setValue(e),!0):!1}function dl(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 Yy=/[\n"\\]/g;function fn(e){return e.replace(Yy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function uc(e,t,r,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+un(t)):e.value!==""+un(t)&&(e.value=""+un(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?fc(e,p,un(t)):r!=null?fc(e,p,un(r)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+un(b):e.removeAttribute("name")}function Ch(e,t,r,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||r!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){cc(e);return}r=r!=null?""+un(r):"",t=t!=null?""+un(t):r,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),cc(e)}function fc(e,t,r){t==="number"&&dl(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Bi(e,t,r,l){if(e=e.options,t){t={};for(var c=0;c<r.length;c++)t["$"+r[c]]=!0;for(r=0;r<e.length;r++)c=t.hasOwnProperty("$"+e[r].value),e[r].selected!==c&&(e[r].selected=c),c&&l&&(e[r].defaultSelected=!0)}else{for(r=""+un(r),t=null,c=0;c<e.length;c++){if(e[c].value===r){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Mh(e,t,r){if(t!=null&&(t=""+un(t),t!==e.value&&(e.value=t),r==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=r!=null?""+un(r):""}function Rh(e,t,r,l){if(t==null){if(l!=null){if(r!=null)throw Error(a(92));if(Te(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),t=r}r=un(t),e.defaultValue=r,l=e.textContent,l===r&&l!==""&&l!==null&&(e.value=l),cc(e)}function Li(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Gy=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 Dh(e,t,r){var l=t.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,r):typeof r!="number"||r===0||Gy.has(t)?t==="float"?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}function zh(e,t,r){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&r[c]!==l&&Dh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&Dh(e,u,t[u])}function hc(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 Vy=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"]]),Fy=/^[\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 ml(e){return Fy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Zn(){}var dc=null;function mc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Hi=null,Pi=null;function qh(e){var t=S(e);if(t&&(e=t.stateNode)){var r=e[ot]||null;e:switch(e=t.stateNode,t.type){case"input":if(uc(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+fn(""+t)+'"][type="radio"]'),t=0;t<r.length;t++){var l=r[t];if(l!==e&&l.form===e.form){var c=l[ot]||null;if(!c)throw Error(a(90));uc(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<r.length;t++)l=r[t],l.form===e.form&&kh(l)}break e;case"textarea":Mh(e,r.value,r.defaultValue);break e;case"select":t=r.value,t!=null&&Bi(e,!!r.multiple,t,!1)}}}var pc=!1;function Uh(e,t,r){if(pc)return e(t,r);pc=!0;try{var l=e(t);return l}finally{if(pc=!1,(Hi!==null||Pi!==null)&&(to(),Hi&&(t=Hi,e=Pi,Pi=Hi=null,qh(t),e)))for(t=0;t<e.length;t++)qh(e[t])}}function Vr(e,t){var r=e.stateNode;if(r===null)return null;var l=r[ot]||null;if(l===null)return null;r=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(a(231,t,typeof r));return r}var Wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gc=!1;if(Wn)try{var Fr={};Object.defineProperty(Fr,"passive",{get:function(){gc=!0}}),window.addEventListener("test",Fr,Fr),window.removeEventListener("test",Fr,Fr)}catch{gc=!1}var js=null,yc=null,pl=null;function Bh(){if(pl)return pl;var e,t=yc,r=t.length,l,c="value"in js?js.value:js.textContent,u=c.length;for(e=0;e<r&&t[e]===c[e];e++);var p=r-e;for(l=1;l<=p&&t[r-l]===c[u-l];l++);return pl=c.slice(e,1<l?1-l:void 0)}function gl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function yl(){return!0}function Lh(){return!1}function Bt(e){function t(r,l,c,u,p){this._reactName=r,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(r=e[b],this[b]=r?r(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?yl:Lh,this.isPropagationStopped=Lh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=yl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=yl)},persist:function(){},isPersistent:yl}),t}var di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bl=Bt(di),Ir=w({},di,{view:0,detail:0}),Iy=Bt(Ir),bc,xc,Jr,xl=w({},Ir,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_c,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!==Jr&&(Jr&&e.type==="mousemove"?(bc=e.screenX-Jr.screenX,xc=e.screenY-Jr.screenY):xc=bc=0,Jr=e),bc)},movementY:function(e){return"movementY"in e?e.movementY:xc}}),Hh=Bt(xl),Jy=w({},xl,{dataTransfer:0}),Qy=Bt(Jy),Xy=w({},Ir,{relatedTarget:0}),vc=Bt(Xy),Ky=w({},di,{animationName:0,elapsedTime:0,pseudoElement:0}),Zy=Bt(Ky),Wy=w({},di,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),eb=Bt(Wy),tb=w({},di,{data:0}),Ph=Bt(tb),nb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sb={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"},ib={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ib[e])?!!t[e]:!1}function _c(){return rb}var ab=w({},Ir,{key:function(e){if(e.key){var t=nb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?sb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_c,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lb=Bt(ab),ob=w({},xl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$h=Bt(ob),cb=w({},Ir,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_c}),ub=Bt(cb),fb=w({},di,{propertyName:0,elapsedTime:0,pseudoElement:0}),hb=Bt(fb),db=w({},xl,{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}),mb=Bt(db),pb=w({},di,{newState:0,oldState:0}),gb=Bt(pb),yb=[9,13,27,32],wc=Wn&&"CompositionEvent"in window,Qr=null;Wn&&"documentMode"in document&&(Qr=document.documentMode);var bb=Wn&&"TextEvent"in window&&!Qr,Yh=Wn&&(!wc||Qr&&8<Qr&&11>=Qr),Gh=" ",Vh=!1;function Fh(e,t){switch(e){case"keyup":return yb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ih(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $i=!1;function xb(e,t){switch(e){case"compositionend":return Ih(t);case"keypress":return t.which!==32?null:(Vh=!0,Gh);case"textInput":return e=t.data,e===Gh&&Vh?null:e;default:return null}}function vb(e,t){if($i)return e==="compositionend"||!wc&&Fh(e,t)?(e=Bh(),pl=yc=js=null,$i=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Yh&&t.locale!=="ko"?null:t.data;default:return null}}var _b={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 Jh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!_b[e.type]:t==="textarea"}function Qh(e,t,r,l){Hi?Pi?Pi.push(l):Pi=[l]:Hi=l,t=oo(t,"onChange"),0<t.length&&(r=new bl("onChange","change",null,r,l),e.push({event:r,listeners:t}))}var Xr=null,Kr=null;function wb(e){Cp(e,0)}function vl(e){var t=_(e);if(kh(t))return e}function Xh(e,t){if(e==="change")return t}var Kh=!1;if(Wn){var Sc;if(Wn){var Ec="oninput"in document;if(!Ec){var Zh=document.createElement("div");Zh.setAttribute("oninput","return;"),Ec=typeof Zh.oninput=="function"}Sc=Ec}else Sc=!1;Kh=Sc&&(!document.documentMode||9<document.documentMode)}function Wh(){Xr&&(Xr.detachEvent("onpropertychange",ed),Kr=Xr=null)}function ed(e){if(e.propertyName==="value"&&vl(Kr)){var t=[];Qh(t,Kr,e,mc(e)),Uh(wb,t)}}function Sb(e,t,r){e==="focusin"?(Wh(),Xr=t,Kr=r,Xr.attachEvent("onpropertychange",ed)):e==="focusout"&&Wh()}function Eb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vl(Kr)}function Ab(e,t){if(e==="click")return vl(t)}function jb(e,t){if(e==="input"||e==="change")return vl(t)}function Ob(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jt=typeof Object.is=="function"?Object.is:Ob;function Zr(e,t){if(Jt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),l=Object.keys(t);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var c=r[l];if(!Br.call(t,c)||!Jt(e[c],t[c]))return!1}return!0}function td(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function nd(e,t){var r=td(e);e=0;for(var l;r;){if(r.nodeType===3){if(l=e+r.textContent.length,e<=t&&l>=t)return{node:r,offset:t-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=td(r)}}function sd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function id(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=dl(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=dl(e.document)}return t}function Ac(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Tb=Wn&&"documentMode"in document&&11>=document.documentMode,Yi=null,jc=null,Wr=null,Oc=!1;function rd(e,t,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Oc||Yi==null||Yi!==dl(l)||(l=Yi,"selectionStart"in l&&Ac(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Wr&&Zr(Wr,l)||(Wr=l,l=oo(jc,"onSelect"),0<l.length&&(t=new bl("onSelect","select",null,t,r),e.push({event:t,listeners:l}),t.target=Yi)))}function mi(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Gi={animationend:mi("Animation","AnimationEnd"),animationiteration:mi("Animation","AnimationIteration"),animationstart:mi("Animation","AnimationStart"),transitionrun:mi("Transition","TransitionRun"),transitionstart:mi("Transition","TransitionStart"),transitioncancel:mi("Transition","TransitionCancel"),transitionend:mi("Transition","TransitionEnd")},Tc={},ad={};Wn&&(ad=document.createElement("div").style,"AnimationEvent"in window||(delete Gi.animationend.animation,delete Gi.animationiteration.animation,delete Gi.animationstart.animation),"TransitionEvent"in window||delete Gi.transitionend.transition);function pi(e){if(Tc[e])return Tc[e];if(!Gi[e])return e;var t=Gi[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in ad)return Tc[e]=t[r];return e}var ld=pi("animationend"),od=pi("animationiteration"),cd=pi("animationstart"),Nb=pi("transitionrun"),kb=pi("transitionstart"),Cb=pi("transitioncancel"),ud=pi("transitionend"),fd=new Map,Nc="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(" ");Nc.push("scrollEnd");function Tn(e,t){fd.set(e,t),ne(t,[e])}var _l=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},hn=[],Vi=0,kc=0;function wl(){for(var e=Vi,t=kc=Vi=0;t<e;){var r=hn[t];hn[t++]=null;var l=hn[t];hn[t++]=null;var c=hn[t];hn[t++]=null;var u=hn[t];if(hn[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&hd(r,c,u)}}function Sl(e,t,r,l){hn[Vi++]=e,hn[Vi++]=t,hn[Vi++]=r,hn[Vi++]=l,kc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Cc(e,t,r,l){return Sl(e,t,r,l),El(e)}function gi(e,t){return Sl(e,null,null,t),El(e)}function hd(e,t,r){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r);for(var c=!1,u=e.return;u!==null;)u.childLanes|=r,l=u.alternate,l!==null&&(l.childLanes|=r),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Ct(r),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=r|536870912),u):null}function El(e){if(50<_a)throw _a=0,Hu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Fi={};function Mb(e,t,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qt(e,t,r,l){return new Mb(e,t,r,l)}function Mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function es(e,t){var r=e.alternate;return r===null?(r=Qt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function dd(e,t){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,t=r.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Al(e,t,r,l,c,u){var p=0;if(l=e,typeof e=="function")Mc(e)&&(p=1);else if(typeof e=="string")p=Ux(e,r,Pe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F:return e=Qt(31,r,t,c),e.elementType=F,e.lanes=u,e;case q:return yi(r.children,c,u,t);case Q:p=8,c|=24;break;case W:return e=Qt(12,r,t,c|2),e.elementType=W,e.lanes=u,e;case N:return e=Qt(13,r,t,c),e.elementType=N,e.lanes=u,e;case V:return e=Qt(19,r,t,c),e.elementType=V,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fe:p=10;break e;case te:p=9;break e;case re:p=11;break e;case ae:p=14;break e;case P:p=16,l=null;break e}p=29,r=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Qt(p,r,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function yi(e,t,r,l){return e=Qt(7,e,l,t),e.lanes=r,e}function Rc(e,t,r){return e=Qt(6,e,null,t),e.lanes=r,e}function md(e){var t=Qt(18,null,null,0);return t.stateNode=e,t}function Dc(e,t,r){return t=Qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var pd=new WeakMap;function dn(e,t){if(typeof e=="object"&&e!==null){var r=pd.get(e);return r!==void 0?r:(t={value:e,source:t,stack:il(t)},pd.set(e,t),t)}return{value:e,source:t,stack:il(t)}}var Ii=[],Ji=0,jl=null,ea=0,mn=[],pn=0,Os=null,Bn=1,Ln="";function ts(e,t){Ii[Ji++]=ea,Ii[Ji++]=jl,jl=e,ea=t}function gd(e,t,r){mn[pn++]=Bn,mn[pn++]=Ln,mn[pn++]=Os,Os=e;var l=Bn;e=Ln;var c=32-Ct(l)-1;l&=~(1<<c),r+=1;var u=32-Ct(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Bn=1<<32-Ct(t)+c|r<<c|l,Ln=u+e}else Bn=1<<u|r<<c|l,Ln=e}function zc(e){e.return!==null&&(ts(e,1),gd(e,1,0))}function qc(e){for(;e===jl;)jl=Ii[--Ji],Ii[Ji]=null,ea=Ii[--Ji],Ii[Ji]=null;for(;e===Os;)Os=mn[--pn],mn[pn]=null,Ln=mn[--pn],mn[pn]=null,Bn=mn[--pn],mn[pn]=null}function yd(e,t){mn[pn++]=Bn,mn[pn++]=Ln,mn[pn++]=Os,Bn=t.id,Ln=t.overflow,Os=e}var Ot=null,We=null,ze=!1,Ts=null,gn=!1,Uc=Error(a(519));function Ns(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ta(dn(t,e)),Uc}function bd(e){var t=e.stateNode,r=e.type,l=e.memoizedProps;switch(t[Xe]=e,t[ot]=l,r){case"dialog":Me("cancel",t),Me("close",t);break;case"iframe":case"object":case"embed":Me("load",t);break;case"video":case"audio":for(r=0;r<Sa.length;r++)Me(Sa[r],t);break;case"source":Me("error",t);break;case"img":case"image":case"link":Me("error",t),Me("load",t);break;case"details":Me("toggle",t);break;case"input":Me("invalid",t),Ch(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Me("invalid",t);break;case"textarea":Me("invalid",t),Rh(t,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||t.textContent===""+r||l.suppressHydrationWarning===!0||zp(t.textContent,r)?(l.popover!=null&&(Me("beforetoggle",t),Me("toggle",t)),l.onScroll!=null&&Me("scroll",t),l.onScrollEnd!=null&&Me("scrollend",t),l.onClick!=null&&(t.onclick=Zn),t=!0):t=!1,t||Ns(e,!0)}function xd(e){for(Ot=e.return;Ot;)switch(Ot.tag){case 5:case 31:case 13:gn=!1;return;case 27:case 3:gn=!0;return;default:Ot=Ot.return}}function Qi(e){if(e!==Ot)return!1;if(!ze)return xd(e),ze=!0,!1;var t=e.tag,r;if((r=t!==3&&t!==27)&&((r=t===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||tf(e.type,e.memoizedProps)),r=!r),r&&We&&Ns(e),xd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Gp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Gp(e)}else t===27?(t=We,Ys(e.type)?(e=lf,lf=null,We=e):We=t):We=Ot?bn(e.stateNode.nextSibling):null;return!0}function bi(){We=Ot=null,ze=!1}function Bc(){var e=Ts;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),Ts=null),e}function ta(e){Ts===null?Ts=[e]:Ts.push(e)}var Lc=G(null),xi=null,ns=null;function ks(e,t,r){xe(Lc,t._currentValue),t._currentValue=r}function ss(e){e._currentValue=Lc.current,ge(Lc)}function Hc(e,t,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===r)break;e=e.return}}function Pc(e,t,r,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var j=0;j<t.length;j++)if(b.context===t[j]){u.lanes|=r,b=u.alternate,b!==null&&(b.lanes|=r),Hc(u.return,r,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=r,u=p.alternate,u!==null&&(u.lanes|=r),Hc(p,r,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Xi(e,t,r,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Jt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===at.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Ta):e=[Ta])}c=c.return}e!==null&&Pc(t,e,r,l),t.flags|=262144}function Ol(e){for(e=e.firstContext;e!==null;){if(!Jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function vi(e){xi=e,ns=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return vd(xi,e)}function Tl(e,t){return xi===null&&vi(e),vd(e,t)}function vd(e,t){var r=t._currentValue;if(t={context:t,memoizedValue:r,next:null},ns===null){if(e===null)throw Error(a(308));ns=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ns=ns.next=t;return r}var Rb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(r,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(r){return r()})}},Db=i.unstable_scheduleCallback,zb=i.unstable_NormalPriority,pt={$$typeof:fe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $c(){return{controller:new Rb,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Db(zb,function(){e.controller.abort()})}var sa=null,Yc=0,Ki=0,Zi=null;function qb(e,t){if(sa===null){var r=sa=[];Yc=0,Ki=Fu(),Zi={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Yc++,t.then(_d,_d),t}function _d(){if(--Yc===0&&sa!==null){Zi!==null&&(Zi.status="fulfilled");var e=sa;sa=null,Ki=0,Zi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ub(e,t){var r=[],l={status:"pending",value:null,reason:null,then:function(c){r.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<r.length;c++)(0,r[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<r.length;c++)(0,r[c])(void 0)}),l}var wd=$.S;$.S=function(e,t){rp=nt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&qb(e,t),wd!==null&&wd(e,t)};var _i=G(null);function Gc(){var e=_i.current;return e!==null?e:Ke.pooledCache}function Nl(e,t){t===null?xe(_i,_i.current):xe(_i,t.pool)}function Sd(){var e=Gc();return e===null?null:{parent:pt._currentValue,pool:e}}var Wi=Error(a(460)),Vc=Error(a(474)),kl=Error(a(542)),Cl={then:function(){}};function Ed(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ad(e,t,r){switch(r=e[r],r===void 0?e.push(t):r!==t&&(t.then(Zn,Zn),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Od(e),e;default:if(typeof t.status=="string")t.then(Zn,Zn);else{if(e=Ke,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Od(e),e}throw Si=t,Wi}}function wi(e){try{var t=e._init;return t(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Si=r,Wi):r}}var Si=null;function jd(){if(Si===null)throw Error(a(459));var e=Si;return Si=null,e}function Od(e){if(e===Wi||e===kl)throw Error(a(483))}var er=null,ia=0;function Ml(e){var t=ia;return ia+=1,er===null&&(er=[]),Ad(er,e,t)}function ra(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Rl(e,t){throw t.$$typeof===T?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Td(e){function t(R,C){if(e){var U=R.deletions;U===null?(R.deletions=[C],R.flags|=16):U.push(C)}}function r(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function c(R,C){return R=es(R,C),R.index=0,R.sibling=null,R}function u(R,C,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<C?(R.flags|=67108866,C):U):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,C,U,J){return C===null||C.tag!==6?(C=Rc(U,R.mode,J),C.return=R,C):(C=c(C,U),C.return=R,C)}function j(R,C,U,J){var be=U.type;return be===q?I(R,C,U.props.children,J,U.key):C!==null&&(C.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===P&&wi(be)===C.type)?(C=c(C,U.props),ra(C,U),C.return=R,C):(C=Al(U.type,U.key,U.props,null,R.mode,J),ra(C,U),C.return=R,C)}function B(R,C,U,J){return C===null||C.tag!==4||C.stateNode.containerInfo!==U.containerInfo||C.stateNode.implementation!==U.implementation?(C=Dc(U,R.mode,J),C.return=R,C):(C=c(C,U.children||[]),C.return=R,C)}function I(R,C,U,J,be){return C===null||C.tag!==7?(C=yi(U,R.mode,J,be),C.return=R,C):(C=c(C,U),C.return=R,C)}function ee(R,C,U){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=Rc(""+C,R.mode,U),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case z:return U=Al(C.type,C.key,C.props,null,R.mode,U),ra(U,C),U.return=R,U;case M:return C=Dc(C,R.mode,U),C.return=R,C;case P:return C=wi(C),ee(R,C,U)}if(Te(C)||ie(C))return C=yi(C,R.mode,U,null),C.return=R,C;if(typeof C.then=="function")return ee(R,Ml(C),U);if(C.$$typeof===fe)return ee(R,Tl(R,C),U);Rl(R,C)}return null}function L(R,C,U,J){var be=C!==null?C.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return be!==null?null:b(R,C,""+U,J);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case z:return U.key===be?j(R,C,U,J):null;case M:return U.key===be?B(R,C,U,J):null;case P:return U=wi(U),L(R,C,U,J)}if(Te(U)||ie(U))return be!==null?null:I(R,C,U,J,null);if(typeof U.then=="function")return L(R,C,Ml(U),J);if(U.$$typeof===fe)return L(R,C,Tl(R,U),J);Rl(R,U)}return null}function Y(R,C,U,J,be){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return R=R.get(U)||null,b(C,R,""+J,be);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case z:return R=R.get(J.key===null?U:J.key)||null,j(C,R,J,be);case M:return R=R.get(J.key===null?U:J.key)||null,B(C,R,J,be);case P:return J=wi(J),Y(R,C,U,J,be)}if(Te(J)||ie(J))return R=R.get(U)||null,I(C,R,J,be,null);if(typeof J.then=="function")return Y(R,C,U,Ml(J),be);if(J.$$typeof===fe)return Y(R,C,U,Tl(C,J),be);Rl(C,J)}return null}function pe(R,C,U,J){for(var be=null,Le=null,ye=C,Oe=C=0,De=null;ye!==null&&Oe<U.length;Oe++){ye.index>Oe?(De=ye,ye=null):De=ye.sibling;var He=L(R,ye,U[Oe],J);if(He===null){ye===null&&(ye=De);break}e&&ye&&He.alternate===null&&t(R,ye),C=u(He,C,Oe),Le===null?be=He:Le.sibling=He,Le=He,ye=De}if(Oe===U.length)return r(R,ye),ze&&ts(R,Oe),be;if(ye===null){for(;Oe<U.length;Oe++)ye=ee(R,U[Oe],J),ye!==null&&(C=u(ye,C,Oe),Le===null?be=ye:Le.sibling=ye,Le=ye);return ze&&ts(R,Oe),be}for(ye=l(ye);Oe<U.length;Oe++)De=Y(ye,R,Oe,U[Oe],J),De!==null&&(e&&De.alternate!==null&&ye.delete(De.key===null?Oe:De.key),C=u(De,C,Oe),Le===null?be=De:Le.sibling=De,Le=De);return e&&ye.forEach(function(Js){return t(R,Js)}),ze&&ts(R,Oe),be}function _e(R,C,U,J){if(U==null)throw Error(a(151));for(var be=null,Le=null,ye=C,Oe=C=0,De=null,He=U.next();ye!==null&&!He.done;Oe++,He=U.next()){ye.index>Oe?(De=ye,ye=null):De=ye.sibling;var Js=L(R,ye,He.value,J);if(Js===null){ye===null&&(ye=De);break}e&&ye&&Js.alternate===null&&t(R,ye),C=u(Js,C,Oe),Le===null?be=Js:Le.sibling=Js,Le=Js,ye=De}if(He.done)return r(R,ye),ze&&ts(R,Oe),be;if(ye===null){for(;!He.done;Oe++,He=U.next())He=ee(R,He.value,J),He!==null&&(C=u(He,C,Oe),Le===null?be=He:Le.sibling=He,Le=He);return ze&&ts(R,Oe),be}for(ye=l(ye);!He.done;Oe++,He=U.next())He=Y(ye,R,Oe,He.value,J),He!==null&&(e&&He.alternate!==null&&ye.delete(He.key===null?Oe:He.key),C=u(He,C,Oe),Le===null?be=He:Le.sibling=He,Le=He);return e&&ye.forEach(function(Jx){return t(R,Jx)}),ze&&ts(R,Oe),be}function Qe(R,C,U,J){if(typeof U=="object"&&U!==null&&U.type===q&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case z:e:{for(var be=U.key;C!==null;){if(C.key===be){if(be=U.type,be===q){if(C.tag===7){r(R,C.sibling),J=c(C,U.props.children),J.return=R,R=J;break e}}else if(C.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===P&&wi(be)===C.type){r(R,C.sibling),J=c(C,U.props),ra(J,U),J.return=R,R=J;break e}r(R,C);break}else t(R,C);C=C.sibling}U.type===q?(J=yi(U.props.children,R.mode,J,U.key),J.return=R,R=J):(J=Al(U.type,U.key,U.props,null,R.mode,J),ra(J,U),J.return=R,R=J)}return p(R);case M:e:{for(be=U.key;C!==null;){if(C.key===be)if(C.tag===4&&C.stateNode.containerInfo===U.containerInfo&&C.stateNode.implementation===U.implementation){r(R,C.sibling),J=c(C,U.children||[]),J.return=R,R=J;break e}else{r(R,C);break}else t(R,C);C=C.sibling}J=Dc(U,R.mode,J),J.return=R,R=J}return p(R);case P:return U=wi(U),Qe(R,C,U,J)}if(Te(U))return pe(R,C,U,J);if(ie(U)){if(be=ie(U),typeof be!="function")throw Error(a(150));return U=be.call(U),_e(R,C,U,J)}if(typeof U.then=="function")return Qe(R,C,Ml(U),J);if(U.$$typeof===fe)return Qe(R,C,Tl(R,U),J);Rl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,C!==null&&C.tag===6?(r(R,C.sibling),J=c(C,U),J.return=R,R=J):(r(R,C),J=Rc(U,R.mode,J),J.return=R,R=J),p(R)):r(R,C)}return function(R,C,U,J){try{ia=0;var be=Qe(R,C,U,J);return er=null,be}catch(ye){if(ye===Wi||ye===kl)throw ye;var Le=Qt(29,ye,null,R.mode);return Le.lanes=J,Le.return=R,Le}finally{}}}var Ei=Td(!0),Nd=Td(!1),Cs=!1;function Fc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ms(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Rs(e,t,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,($e&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=El(e),hd(e,null,r),t}return Sl(e,l,t,r),El(e)}function aa(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,ui(e,r)}}function Jc(e,t){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var c=null,u=null;if(r=r.firstBaseUpdate,r!==null){do{var p={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,r=r.next}while(r!==null);u===null?c=u=t:u=u.next=t}else c=u=t;r={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var Qc=!1;function la(){if(Qc){var e=Zi;if(e!==null)throw e}}function oa(e,t,r,l){Qc=!1;var c=e.updateQueue;Cs=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var j=b,B=j.next;j.next=null,p===null?u=B:p.next=B,p=j;var I=e.alternate;I!==null&&(I=I.updateQueue,b=I.lastBaseUpdate,b!==p&&(b===null?I.firstBaseUpdate=B:b.next=B,I.lastBaseUpdate=j))}if(u!==null){var ee=c.baseState;p=0,I=B=j=null,b=u;do{var L=b.lane&-536870913,Y=L!==b.lane;if(Y?(Re&L)===L:(l&L)===L){L!==0&&L===Ki&&(Qc=!0),I!==null&&(I=I.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var pe=e,_e=b;L=t;var Qe=r;switch(_e.tag){case 1:if(pe=_e.payload,typeof pe=="function"){ee=pe.call(Qe,ee,L);break e}ee=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=_e.payload,L=typeof pe=="function"?pe.call(Qe,ee,L):pe,L==null)break e;ee=w({},ee,L);break e;case 2:Cs=!0}}L=b.callback,L!==null&&(e.flags|=64,Y&&(e.flags|=8192),Y=c.callbacks,Y===null?c.callbacks=[L]:Y.push(L))}else Y={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},I===null?(B=I=Y,j=ee):I=I.next=Y,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;Y=b,b=Y.next,Y.next=null,c.lastBaseUpdate=Y,c.shared.pending=null}}while(!0);I===null&&(j=ee),c.baseState=j,c.firstBaseUpdate=B,c.lastBaseUpdate=I,u===null&&(c.shared.lanes=0),Bs|=p,e.lanes=p,e.memoizedState=ee}}function kd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function Cd(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)kd(r[e],t)}var tr=G(null),Dl=G(0);function Md(e,t){e=hs,xe(Dl,e),xe(tr,t),hs=e|t.baseLanes}function Xc(){xe(Dl,hs),xe(tr,tr.current)}function Kc(){hs=Dl.current,ge(tr),ge(Dl)}var Xt=G(null),yn=null;function Ds(e){var t=e.alternate;xe(ht,ht.current&1),xe(Xt,e),yn===null&&(t===null||tr.current!==null||t.memoizedState!==null)&&(yn=e)}function Zc(e){xe(ht,ht.current),xe(Xt,e),yn===null&&(yn=e)}function Rd(e){e.tag===22?(xe(ht,ht.current),xe(Xt,e),yn===null&&(yn=e)):zs()}function zs(){xe(ht,ht.current),xe(Xt,Xt.current)}function Kt(e){ge(Xt),yn===e&&(yn=null),ge(ht)}var ht=G(0);function zl(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||rf(r)||af(r)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var is=0,je=null,Ie=null,gt=null,ql=!1,nr=!1,Ai=!1,Ul=0,ca=0,sr=null,Bb=0;function ct(){throw Error(a(321))}function Wc(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Jt(e[r],t[r]))return!1;return!0}function eu(e,t,r,l,c,u){return is=u,je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?gm:pu,Ai=!1,u=r(l,c),Ai=!1,nr&&(u=zd(t,r,l,c)),Dd(e),u}function Dd(e){$.H=ha;var t=Ie!==null&&Ie.next!==null;if(is=0,gt=Ie=je=null,ql=!1,ca=0,sr=null,t)throw Error(a(300));e===null||yt||(e=e.dependencies,e!==null&&Ol(e)&&(yt=!0))}function zd(e,t,r,l){je=e;var c=0;do{if(nr&&(sr=null),ca=0,nr=!1,25<=c)throw Error(a(301));if(c+=1,gt=Ie=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=ym,u=t(r,l)}while(nr);return u}function Lb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ua(t):t,e=e.useState()[0],(Ie!==null?Ie.memoizedState:null)!==e&&(je.flags|=1024),t}function tu(){var e=Ul!==0;return Ul=0,e}function nu(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function su(e){if(ql){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ql=!1}is=0,gt=Ie=je=null,nr=!1,ca=Ul=0,sr=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?je.memoizedState=gt=e:gt=gt.next=e,gt}function dt(){if(Ie===null){var e=je.alternate;e=e!==null?e.memoizedState:null}else e=Ie.next;var t=gt===null?je.memoizedState:gt.next;if(t!==null)gt=t,Ie=e;else{if(e===null)throw je.alternate===null?Error(a(467)):Error(a(310));Ie=e,e={memoizedState:Ie.memoizedState,baseState:Ie.baseState,baseQueue:Ie.baseQueue,queue:Ie.queue,next:null},gt===null?je.memoizedState=gt=e:gt=gt.next=e}return gt}function Bl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ua(e){var t=ca;return ca+=1,sr===null&&(sr=[]),e=Ad(sr,e,t),t=je,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?gm:pu),e}function Ll(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ua(e);if(e.$$typeof===fe)return Tt(e)}throw Error(a(438,String(e)))}function iu(e){var t=null,r=je.updateQueue;if(r!==null&&(t=r.memoCache),t==null){var l=je.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),r===null&&(r=Bl(),je.updateQueue=r),r.memoCache=t,r=t.data[t.index],r===void 0)for(r=t.data[t.index]=Array(e),l=0;l<e;l++)r[l]=X;return t.index++,r}function rs(e,t){return typeof t=="function"?t(e):t}function Hl(e){var t=dt();return ru(t,Ie,e)}function ru(e,t,r){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,j=null,B=t,I=!1;do{var ee=B.lane&-536870913;if(ee!==B.lane?(Re&ee)===ee:(is&ee)===ee){var L=B.revertLane;if(L===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),ee===Ki&&(I=!0);else if((is&L)===L){B=B.next,L===Ki&&(I=!0);continue}else ee={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=ee,p=u):j=j.next=ee,je.lanes|=L,Bs|=L;ee=B.action,Ai&&r(u,ee),u=B.hasEagerState?B.eagerState:r(u,ee)}else L={lane:ee,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=L,p=u):j=j.next=L,je.lanes|=ee,Bs|=ee;B=B.next}while(B!==null&&B!==t);if(j===null?p=u:j.next=b,!Jt(u,e.memoizedState)&&(yt=!0,I&&(r=Zi,r!==null)))throw r;e.memoizedState=u,e.baseState=p,e.baseQueue=j,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function au(e){var t=dt(),r=t.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var l=r.dispatch,c=r.pending,u=t.memoizedState;if(c!==null){r.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Jt(u,t.memoizedState)||(yt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),r.lastRenderedState=u}return[u,l]}function qd(e,t,r){var l=je,c=dt(),u=ze;if(u){if(r===void 0)throw Error(a(407));r=r()}else r=t();var p=!Jt((Ie||c).memoizedState,r);if(p&&(c.memoizedState=r,yt=!0),c=c.queue,cu(Ld.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||gt!==null&>.memoizedState.tag&1){if(l.flags|=2048,ir(9,{destroy:void 0},Bd.bind(null,l,c,r,t),null),Ke===null)throw Error(a(349));u||(is&127)!==0||Ud(l,t,r)}return r}function Ud(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=je.updateQueue,t===null?(t=Bl(),je.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Bd(e,t,r,l){t.value=r,t.getSnapshot=l,Hd(t)&&Pd(e)}function Ld(e,t,r){return r(function(){Hd(t)&&Pd(e)})}function Hd(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Jt(e,r)}catch{return!0}}function Pd(e){var t=gi(e,2);t!==null&&Yt(t,e,2)}function lu(e){var t=Dt();if(typeof e=="function"){var r=e;if(e=r(),Ai){Ft(!0);try{r()}finally{Ft(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:e},t}function $d(e,t,r,l){return e.baseState=r,ru(e,Ie,typeof l=="function"?l:rs)}function Hb(e,t,r,l,c){if(Yl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?r(!0):u.isTransition=!1,l(u),r=t.pending,r===null?(u.next=t.pending=u,Yd(t,u)):(u.next=r.next,t.pending=r.next=u)}}function Yd(e,t){var r=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=r(c,l),j=$.S;j!==null&&j(p,b),Gd(e,t,b)}catch(B){ou(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=r(c,l),Gd(e,t,u)}catch(B){ou(e,t,B)}}function Gd(e,t,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){Vd(e,t,l)},function(l){return ou(e,t,l)}):Vd(e,t,r)}function Vd(e,t,r){t.status="fulfilled",t.value=r,Fd(t),e.state=r,t=e.pending,t!==null&&(r=t.next,r===t?e.pending=null:(r=r.next,t.next=r,Yd(e,r)))}function ou(e,t,r){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=r,Fd(t),t=t.next;while(t!==l)}e.action=null}function Fd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Id(e,t){return t}function Jd(e,t){if(ze){var r=Ke.formState;if(r!==null){e:{var l=je;if(ze){if(We){t:{for(var c=We,u=gn;c.nodeType!==8;){if(!u){c=null;break t}if(c=bn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){We=bn(c.nextSibling),l=c.data==="F!";break e}}Ns(l)}l=!1}l&&(t=r[0])}}return r=Dt(),r.memoizedState=r.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Id,lastRenderedState:t},r.queue=l,r=dm.bind(null,je,l),l.dispatch=r,l=lu(!1),u=mu.bind(null,je,!1,l.queue),l=Dt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,r=Hb.bind(null,je,c,u,r),c.dispatch=r,l.memoizedState=e,[t,r,!1]}function Qd(e){var t=dt();return Xd(t,Ie,e)}function Xd(e,t,r){if(t=ru(e,t,Id)[0],e=Hl(rs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ua(t)}catch(p){throw p===Wi?kl:p}else l=t;t=dt();var c=t.queue,u=c.dispatch;return r!==t.memoizedState&&(je.flags|=2048,ir(9,{destroy:void 0},Pb.bind(null,c,r),null)),[l,u,e]}function Pb(e,t){e.action=t}function Kd(e){var t=dt(),r=Ie;if(r!==null)return Xd(t,r,e);dt(),t=t.memoizedState,r=dt();var l=r.queue.dispatch;return r.memoizedState=e,[t,l,!1]}function ir(e,t,r,l){return e={tag:e,create:r,deps:l,inst:t,next:null},t=je.updateQueue,t===null&&(t=Bl(),je.updateQueue=t),r=t.lastEffect,r===null?t.lastEffect=e.next=e:(l=r.next,r.next=e,e.next=l,t.lastEffect=e),e}function Zd(){return dt().memoizedState}function Pl(e,t,r,l){var c=Dt();je.flags|=e,c.memoizedState=ir(1|t,{destroy:void 0},r,l===void 0?null:l)}function $l(e,t,r,l){var c=dt();l=l===void 0?null:l;var u=c.memoizedState.inst;Ie!==null&&l!==null&&Wc(l,Ie.memoizedState.deps)?c.memoizedState=ir(t,u,r,l):(je.flags|=e,c.memoizedState=ir(1|t,u,r,l))}function Wd(e,t){Pl(8390656,8,e,t)}function cu(e,t){$l(2048,8,e,t)}function $b(e){je.flags|=4;var t=je.updateQueue;if(t===null)t=Bl(),je.updateQueue=t,t.events=[e];else{var r=t.events;r===null?t.events=[e]:r.push(e)}}function em(e){var t=dt().memoizedState;return $b({ref:t,nextImpl:e}),function(){if(($e&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function tm(e,t){return $l(4,2,e,t)}function nm(e,t){return $l(4,4,e,t)}function sm(e,t){if(typeof t=="function"){e=e();var r=t(e);return function(){typeof r=="function"?r():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function im(e,t,r){r=r!=null?r.concat([e]):null,$l(4,4,sm.bind(null,t,e),r)}function uu(){}function rm(e,t){var r=dt();t=t===void 0?null:t;var l=r.memoizedState;return t!==null&&Wc(t,l[1])?l[0]:(r.memoizedState=[e,t],e)}function am(e,t){var r=dt();t=t===void 0?null:t;var l=r.memoizedState;if(t!==null&&Wc(t,l[1]))return l[0];if(l=e(),Ai){Ft(!0);try{e()}finally{Ft(!1)}}return r.memoizedState=[l,t],l}function fu(e,t,r){return r===void 0||(is&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=r,e=lp(),je.lanes|=e,Bs|=e,r)}function lm(e,t,r,l){return Jt(r,t)?r:tr.current!==null?(e=fu(e,r,l),Jt(e,t)||(yt=!0),e):(is&42)===0||(is&1073741824)!==0&&(Re&261930)===0?(yt=!0,e.memoizedState=r):(e=lp(),je.lanes|=e,Bs|=e,t)}function om(e,t,r,l,c){var u=se.p;se.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,mu(e,!1,t,r);try{var j=c(),B=$.S;if(B!==null&&B(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var I=Ub(j,l);fa(e,t,I,en(e))}else fa(e,t,l,en(e))}catch(ee){fa(e,t,{then:function(){},status:"rejected",reason:ee},en())}finally{se.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function Yb(){}function hu(e,t,r,l){if(e.tag!==5)throw Error(a(476));var c=cm(e).queue;om(e,c,t,he,r===null?Yb:function(){return um(e),r(l)})}function cm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:he},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function um(e){var t=cm(e);t.next===null&&(t=e.alternate.memoizedState),fa(e,t.next.queue,{},en())}function du(){return Tt(Ta)}function fm(){return dt().memoizedState}function hm(){return dt().memoizedState}function Gb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=en();e=Ms(r);var l=Rs(t,e,r);l!==null&&(Yt(l,t,r),aa(l,t,r)),t={cache:$c()},e.payload=t;return}t=t.return}}function Vb(e,t,r){var l=en();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Yl(e)?mm(t,r):(r=Cc(e,t,r,l),r!==null&&(Yt(r,e,l),pm(r,t,l)))}function dm(e,t,r){var l=en();fa(e,t,r,l)}function fa(e,t,r,l){var c={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Yl(e))mm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,r);if(c.hasEagerState=!0,c.eagerState=b,Jt(b,p))return Sl(e,t,c,0),Ke===null&&wl(),!1}catch{}finally{}if(r=Cc(e,t,c,l),r!==null)return Yt(r,e,l),pm(r,t,l),!0}return!1}function mu(e,t,r,l){if(l={lane:2,revertLane:Fu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Yl(e)){if(t)throw Error(a(479))}else t=Cc(e,r,l,2),t!==null&&Yt(t,e,2)}function Yl(e){var t=e.alternate;return e===je||t!==null&&t===je}function mm(e,t){nr=ql=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function pm(e,t,r){if((r&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,ui(e,r)}}var ha={readContext:Tt,use:Ll,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useLayoutEffect:ct,useInsertionEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useSyncExternalStore:ct,useId:ct,useHostTransitionStatus:ct,useFormState:ct,useActionState:ct,useOptimistic:ct,useMemoCache:ct,useCacheRefresh:ct};ha.useEffectEvent=ct;var gm={readContext:Tt,use:Ll,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:Wd,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,Pl(4194308,4,sm.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Pl(4194308,4,e,t)},useInsertionEffect:function(e,t){Pl(4,2,e,t)},useMemo:function(e,t){var r=Dt();t=t===void 0?null:t;var l=e();if(Ai){Ft(!0);try{e()}finally{Ft(!1)}}return r.memoizedState=[l,t],l},useReducer:function(e,t,r){var l=Dt();if(r!==void 0){var c=r(t);if(Ai){Ft(!0);try{r(t)}finally{Ft(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=Vb.bind(null,je,e),[l.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:function(e){e=lu(e);var t=e.queue,r=dm.bind(null,je,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:uu,useDeferredValue:function(e,t){var r=Dt();return fu(r,e,t)},useTransition:function(){var e=lu(!1);return e=om.bind(null,je,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var l=je,c=Dt();if(ze){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Ke===null)throw Error(a(349));(Re&127)!==0||Ud(l,t,r)}c.memoizedState=r;var u={value:r,getSnapshot:t};return c.queue=u,Wd(Ld.bind(null,l,u,e),[e]),l.flags|=2048,ir(9,{destroy:void 0},Bd.bind(null,l,u,r,t),null),r},useId:function(){var e=Dt(),t=Ke.identifierPrefix;if(ze){var r=Ln,l=Bn;r=(l&~(1<<32-Ct(l)-1)).toString(32)+r,t="_"+t+"R_"+r,r=Ul++,0<r&&(t+="H"+r.toString(32)),t+="_"}else r=Bb++,t="_"+t+"r_"+r.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:du,useFormState:Jd,useActionState:Jd,useOptimistic:function(e){var t=Dt();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=mu.bind(null,je,!0,r),r.dispatch=t,[e,t]},useMemoCache:iu,useCacheRefresh:function(){return Dt().memoizedState=Gb.bind(null,je)},useEffectEvent:function(e){var t=Dt(),r={impl:e};return t.memoizedState=r,function(){if(($e&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},pu={readContext:Tt,use:Ll,useCallback:rm,useContext:Tt,useEffect:cu,useImperativeHandle:im,useInsertionEffect:tm,useLayoutEffect:nm,useMemo:am,useReducer:Hl,useRef:Zd,useState:function(){return Hl(rs)},useDebugValue:uu,useDeferredValue:function(e,t){var r=dt();return lm(r,Ie.memoizedState,e,t)},useTransition:function(){var e=Hl(rs)[0],t=dt().memoizedState;return[typeof e=="boolean"?e:ua(e),t]},useSyncExternalStore:qd,useId:fm,useHostTransitionStatus:du,useFormState:Qd,useActionState:Qd,useOptimistic:function(e,t){var r=dt();return $d(r,Ie,e,t)},useMemoCache:iu,useCacheRefresh:hm};pu.useEffectEvent=em;var ym={readContext:Tt,use:Ll,useCallback:rm,useContext:Tt,useEffect:cu,useImperativeHandle:im,useInsertionEffect:tm,useLayoutEffect:nm,useMemo:am,useReducer:au,useRef:Zd,useState:function(){return au(rs)},useDebugValue:uu,useDeferredValue:function(e,t){var r=dt();return Ie===null?fu(r,e,t):lm(r,Ie.memoizedState,e,t)},useTransition:function(){var e=au(rs)[0],t=dt().memoizedState;return[typeof e=="boolean"?e:ua(e),t]},useSyncExternalStore:qd,useId:fm,useHostTransitionStatus:du,useFormState:Kd,useActionState:Kd,useOptimistic:function(e,t){var r=dt();return Ie!==null?$d(r,Ie,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:iu,useCacheRefresh:hm};ym.useEffectEvent=em;function gu(e,t,r,l){t=e.memoizedState,r=r(l,t),r=r==null?t:w({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var yu={enqueueSetState:function(e,t,r){e=e._reactInternals;var l=en(),c=Ms(l);c.payload=t,r!=null&&(c.callback=r),t=Rs(e,c,l),t!==null&&(Yt(t,e,l),aa(t,e,l))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var l=en(),c=Ms(l);c.tag=1,c.payload=t,r!=null&&(c.callback=r),t=Rs(e,c,l),t!==null&&(Yt(t,e,l),aa(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=en(),l=Ms(r);l.tag=2,t!=null&&(l.callback=t),t=Rs(e,l,r),t!==null&&(Yt(t,e,r),aa(t,e,r))}};function bm(e,t,r,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Zr(r,l)||!Zr(c,u):!0}function xm(e,t,r,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,l),t.state!==e&&yu.enqueueReplaceState(t,t.state,null)}function ji(e,t){var r=t;if("ref"in t){r={};for(var l in t)l!=="ref"&&(r[l]=t[l])}if(e=e.defaultProps){r===t&&(r=w({},r));for(var c in e)r[c]===void 0&&(r[c]=e[c])}return r}function vm(e){_l(e)}function _m(e){console.error(e)}function wm(e){_l(e)}function Gl(e,t){try{var r=e.onUncaughtError;r(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Sm(e,t,r){try{var l=e.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function bu(e,t,r){return r=Ms(r),r.tag=3,r.payload={element:null},r.callback=function(){Gl(e,t)},r}function Em(e){return e=Ms(e),e.tag=3,e}function Am(e,t,r,l){var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){Sm(t,r,l)}}var p=r.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Sm(t,r,l),typeof c!="function"&&(Ls===null?Ls=new Set([this]):Ls.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function Fb(e,t,r,l,c){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=r.alternate,t!==null&&Xi(t,r,c,!0),r=Xt.current,r!==null){switch(r.tag){case 31:case 13:return yn===null?no():r.alternate===null&&ut===0&&(ut=3),r.flags&=-257,r.flags|=65536,r.lanes=c,l===Cl?r.flags|=16384:(t=r.updateQueue,t===null?r.updateQueue=new Set([l]):t.add(l),Yu(e,l,c)),!1;case 22:return r.flags|=65536,l===Cl?r.flags|=16384:(t=r.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=t):(r=t.retryQueue,r===null?t.retryQueue=new Set([l]):r.add(l)),Yu(e,l,c)),!1}throw Error(a(435,r.tag))}return Yu(e,l,c),no(),!1}if(ze)return t=Xt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Uc&&(e=Error(a(422),{cause:l}),ta(dn(e,r)))):(l!==Uc&&(t=Error(a(423),{cause:l}),ta(dn(t,r))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=dn(l,r),c=bu(e.stateNode,l,c),Jc(e,c),ut!==4&&(ut=2)),!1;var u=Error(a(520),{cause:l});if(u=dn(u,r),va===null?va=[u]:va.push(u),ut!==4&&(ut=2),t===null)return!0;l=dn(l,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=c&-c,r.lanes|=e,e=bu(r.stateNode,l,e),Jc(r,e),!1;case 1:if(t=r.type,u=r.stateNode,(r.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ls===null||!Ls.has(u))))return r.flags|=65536,c&=-c,r.lanes|=c,c=Em(c),Am(c,e,r,l),Jc(r,c),!1}r=r.return}while(r!==null);return!1}var xu=Error(a(461)),yt=!1;function Nt(e,t,r,l){t.child=e===null?Nd(t,null,r,l):Ei(t,e.child,r,l)}function jm(e,t,r,l,c){r=r.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return vi(t),l=eu(e,t,r,p,u,c),b=tu(),e!==null&&!yt?(nu(e,t,c),as(e,t,c)):(ze&&b&&zc(t),t.flags|=1,Nt(e,t,l,c),t.child)}function Om(e,t,r,l,c){if(e===null){var u=r.type;return typeof u=="function"&&!Mc(u)&&u.defaultProps===void 0&&r.compare===null?(t.tag=15,t.type=u,Tm(e,t,u,l,c)):(e=Al(r.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Ou(e,c)){var p=u.memoizedProps;if(r=r.compare,r=r!==null?r:Zr,r(p,l)&&e.ref===t.ref)return as(e,t,c)}return t.flags|=1,e=es(u,l),e.ref=t.ref,e.return=t,t.child=e}function Tm(e,t,r,l,c){if(e!==null){var u=e.memoizedProps;if(Zr(u,l)&&e.ref===t.ref)if(yt=!1,t.pendingProps=l=u,Ou(e,c))(e.flags&131072)!==0&&(yt=!0);else return t.lanes=e.lanes,as(e,t,c)}return vu(e,t,r,l,c)}function Nm(e,t,r,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|r:r,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return km(e,t,u,r,l)}if((r&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nl(t,u!==null?u.cachePool:null),u!==null?Md(t,u):Xc(),Rd(t);else return l=t.lanes=536870912,km(e,t,u!==null?u.baseLanes|r:r,r,l)}else u!==null?(Nl(t,u.cachePool),Md(t,u),zs(),t.memoizedState=null):(e!==null&&Nl(t,null),Xc(),zs());return Nt(e,t,c,r),t.child}function da(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function km(e,t,r,l,c){var u=Gc();return u=u===null?null:{parent:pt._currentValue,pool:u},t.memoizedState={baseLanes:r,cachePool:u},e!==null&&Nl(t,null),Xc(),Rd(t),e!==null&&Xi(e,t,l,!0),t.childLanes=c,null}function Vl(e,t){return t=Il({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Cm(e,t,r){return Ei(t,e.child,null,r),e=Vl(t,t.pendingProps),e.flags|=2,Kt(t),t.memoizedState=null,e}function Ib(e,t,r){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=Vl(t,l),t.lanes=536870912,da(null,e);if(Zc(t),(e=We)?(e=Yp(e,gn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Os!==null?{id:Bn,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},r=md(e),r.return=t,t.child=r,Ot=t,We=null)):e=null,e===null)throw Ns(t);return t.lanes=536870912,null}return Vl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Zc(t),c)if(t.flags&256)t.flags&=-257,t=Cm(e,t,r);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(yt||Xi(e,t,r,!1),c=(r&e.childLanes)!==0,yt||c){if(l=Ke,l!==null&&(p=As(l,r),p!==0&&p!==u.retryLane))throw u.retryLane=p,gi(e,p),Yt(l,e,p),xu;no(),t=Cm(e,t,r)}else e=u.treeContext,We=bn(p.nextSibling),Ot=t,ze=!0,Ts=null,gn=!1,e!==null&&yd(t,e),t=Vl(t,l),t.flags|=4096;return t}return e=es(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Fl(e,t){var r=t.ref;if(r===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(t.flags|=4194816)}}function vu(e,t,r,l,c){return vi(t),r=eu(e,t,r,l,void 0,c),l=tu(),e!==null&&!yt?(nu(e,t,c),as(e,t,c)):(ze&&l&&zc(t),t.flags|=1,Nt(e,t,r,c),t.child)}function Mm(e,t,r,l,c,u){return vi(t),t.updateQueue=null,r=zd(t,l,r,c),Dd(e),l=tu(),e!==null&&!yt?(nu(e,t,u),as(e,t,u)):(ze&&l&&zc(t),t.flags|=1,Nt(e,t,r,u),t.child)}function Rm(e,t,r,l,c){if(vi(t),t.stateNode===null){var u=Fi,p=r.contextType;typeof p=="object"&&p!==null&&(u=Tt(p)),u=new r(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=yu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Fc(t),p=r.contextType,u.context=typeof p=="object"&&p!==null?Tt(p):Fi,u.state=t.memoizedState,p=r.getDerivedStateFromProps,typeof p=="function"&&(gu(t,r,p,l),u.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&yu.enqueueReplaceState(u,u.state,null),oa(t,l,u,c),la(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,j=ji(r,b);u.props=j;var B=u.context,I=r.contextType;p=Fi,typeof I=="object"&&I!==null&&(p=Tt(I));var ee=r.getDerivedStateFromProps;I=typeof ee=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,I||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&xm(t,u,l,p),Cs=!1;var L=t.memoizedState;u.state=L,oa(t,l,u,c),la(),B=t.memoizedState,b||L!==B||Cs?(typeof ee=="function"&&(gu(t,r,ee,l),B=t.memoizedState),(j=Cs||bm(t,r,j,l,L,B,p))?(I||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=j):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Ic(e,t),p=t.memoizedProps,I=ji(r,p),u.props=I,ee=t.pendingProps,L=u.context,B=r.contextType,j=Fi,typeof B=="object"&&B!==null&&(j=Tt(B)),b=r.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==ee||L!==j)&&xm(t,u,l,j),Cs=!1,L=t.memoizedState,u.state=L,oa(t,l,u,c),la();var Y=t.memoizedState;p!==ee||L!==Y||Cs||e!==null&&e.dependencies!==null&&Ol(e.dependencies)?(typeof b=="function"&&(gu(t,r,b,l),Y=t.memoizedState),(I=Cs||bm(t,r,I,l,L,Y,j)||e!==null&&e.dependencies!==null&&Ol(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,Y,j),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,Y,j)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=Y),u.props=l,u.state=Y,u.context=j,l=I):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Fl(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=Ei(t,e.child,null,c),t.child=Ei(t,null,r,c)):Nt(e,t,r,c),t.memoizedState=u.state,e=t.child):e=as(e,t,c),e}function Dm(e,t,r,l){return bi(),t.flags|=256,Nt(e,t,r,l),t.child}var _u={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function wu(e){return{baseLanes:e,cachePool:Sd()}}function Su(e,t,r){return e=e!==null?e.childLanes&~r:0,t&&(e|=Wt),e}function zm(e,t,r){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ht.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ds(t):zs(),(e=We)?(e=Yp(e,gn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Os!==null?{id:Bn,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},r=md(e),r.return=t,t.child=r,Ot=t,We=null)):e=null,e===null)throw Ns(t);return af(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(zs(),c=t.mode,b=Il({mode:"hidden",children:b},c),l=yi(l,c,r,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=wu(r),l.childLanes=Su(e,p,r),t.memoizedState=_u,da(null,l)):(Ds(t),Eu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(u)t.flags&256?(Ds(t),t.flags&=-257,t=Au(e,t,r)):t.memoizedState!==null?(zs(),t.child=e.child,t.flags|=128,t=null):(zs(),b=l.fallback,c=t.mode,l=Il({mode:"visible",children:l.children},c),b=yi(b,c,r,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,Ei(t,e.child,null,r),l=t.child,l.memoizedState=wu(r),l.childLanes=Su(e,p,r),t.memoizedState=_u,t=da(null,l));else if(Ds(t),af(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,ta({value:l,source:null,stack:null}),t=Au(e,t,r)}else if(yt||Xi(e,t,r,!1),p=(r&e.childLanes)!==0,yt||p){if(p=Ke,p!==null&&(l=As(p,r),l!==0&&l!==j.retryLane))throw j.retryLane=l,gi(e,l),Yt(p,e,l),xu;rf(b)||no(),t=Au(e,t,r)}else rf(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,We=bn(b.nextSibling),Ot=t,ze=!0,Ts=null,gn=!1,e!==null&&yd(t,e),t=Eu(t,l.children),t.flags|=4096);return t}return c?(zs(),b=l.fallback,c=t.mode,j=e.child,B=j.sibling,l=es(j,{mode:"hidden",children:l.children}),l.subtreeFlags=j.subtreeFlags&65011712,B!==null?b=es(B,b):(b=yi(b,c,r,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,da(null,l),l=t.child,b=e.child.memoizedState,b===null?b=wu(r):(c=b.cachePool,c!==null?(j=pt._currentValue,c=c.parent!==j?{parent:j,pool:j}:c):c=Sd(),b={baseLanes:b.baseLanes|r,cachePool:c}),l.memoizedState=b,l.childLanes=Su(e,p,r),t.memoizedState=_u,da(e.child,l)):(Ds(t),r=e.child,e=r.sibling,r=es(r,{mode:"visible",children:l.children}),r.return=t,r.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=r,t.memoizedState=null,r)}function Eu(e,t){return t=Il({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Il(e,t){return e=Qt(22,e,null,t),e.lanes=0,e}function Au(e,t,r){return Ei(t,e.child,null,r),e=Eu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qm(e,t,r){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Hc(e.return,t,r)}function ju(e,t,r,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=r,p.tailMode=c,p.treeForkCount=u)}function Um(e,t,r){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ht.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,xe(ht,p),Nt(e,t,l,r),l=ze?ea:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qm(e,r,t);else if(e.tag===19)qm(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(r=t.child,c=null;r!==null;)e=r.alternate,e!==null&&zl(e)===null&&(c=r),r=r.sibling;r=c,r===null?(c=t.child,t.child=null):(c=r.sibling,r.sibling=null),ju(t,!1,c,r,u,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&zl(e)===null){t.child=c;break}e=c.sibling,c.sibling=r,r=c,c=e}ju(t,!0,r,null,u,l);break;case"together":ju(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function as(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Bs|=t.lanes,(r&t.childLanes)===0)if(e!==null){if(Xi(e,t,r,!1),(r&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,r=es(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=es(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Ou(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ol(e)))}function Jb(e,t,r){switch(t.tag){case 3:lt(t,t.stateNode.containerInfo),ks(t,pt,e.memoizedState.cache),bi();break;case 27:case 5:vt(t);break;case 4:lt(t,t.stateNode.containerInfo);break;case 10:ks(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Zc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ds(t),t.flags|=128,null):(r&t.child.childLanes)!==0?zm(e,t,r):(Ds(t),e=as(e,t,r),e!==null?e.sibling:null);Ds(t);break;case 19:var c=(e.flags&128)!==0;if(l=(r&t.childLanes)!==0,l||(Xi(e,t,r,!1),l=(r&t.childLanes)!==0),c){if(l)return Um(e,t,r);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),xe(ht,ht.current),l)break;return null;case 22:return t.lanes=0,Nm(e,t,r,t.pendingProps);case 24:ks(t,pt,e.memoizedState.cache)}return as(e,t,r)}function Bm(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps)yt=!0;else{if(!Ou(e,r)&&(t.flags&128)===0)return yt=!1,Jb(e,t,r);yt=(e.flags&131072)!==0}else yt=!1,ze&&(t.flags&1048576)!==0&&gd(t,ea,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=wi(t.elementType),t.type=e,typeof e=="function")Mc(e)?(l=ji(e,l),t.tag=1,t=Rm(null,t,e,l,r)):(t.tag=0,t=vu(null,t,e,l,r));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=jm(null,t,e,l,r);break e}else if(c===ae){t.tag=14,t=Om(null,t,e,l,r);break e}}throw t=Ue(e)||e,Error(a(306,t,""))}}return t;case 0:return vu(e,t,t.type,t.pendingProps,r);case 1:return l=t.type,c=ji(l,t.pendingProps),Rm(e,t,l,c,r);case 3:e:{if(lt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Ic(e,t),oa(t,l,null,r);var p=t.memoizedState;if(l=p.cache,ks(t,pt,l),l!==u.cache&&Pc(t,[pt],r,!0),la(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Dm(e,t,l,r);break e}else if(l!==c){c=dn(Error(a(424)),t),ta(c),t=Dm(e,t,l,r);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(We=bn(e.firstChild),Ot=t,ze=!0,Ts=null,gn=!0,r=Nd(t,null,l,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(bi(),l===c){t=as(e,t,r);break e}Nt(e,t,l,r)}t=t.child}return t;case 26:return Fl(e,t),e===null?(r=Qp(t.type,null,t.pendingProps,null))?t.memoizedState=r:ze||(r=t.type,e=t.pendingProps,l=co(St.current).createElement(r),l[Xe]=t,l[ot]=e,kt(l,r,e),k(l),t.stateNode=l):t.memoizedState=Qp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return vt(t),e===null&&ze&&(l=t.stateNode=Fp(t.type,t.pendingProps,St.current),Ot=t,gn=!0,c=We,Ys(t.type)?(lf=c,We=bn(l.firstChild)):We=c),Nt(e,t,t.pendingProps.children,r),Fl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=We)&&(l=Ex(l,t.type,t.pendingProps,gn),l!==null?(t.stateNode=l,Ot=t,We=bn(l.firstChild),gn=!1,c=!0):c=!1),c||Ns(t)),vt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,tf(c,u)?l=null:p!==null&&tf(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=eu(e,t,Lb,null,null,r),Ta._currentValue=c),Fl(e,t),Nt(e,t,l,r),t.child;case 6:return e===null&&ze&&((e=r=We)&&(r=Ax(r,t.pendingProps,gn),r!==null?(t.stateNode=r,Ot=t,We=null,e=!0):e=!1),e||Ns(t)),null;case 13:return zm(e,t,r);case 4:return lt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ei(t,null,l,r):Nt(e,t,l,r),t.child;case 11:return jm(e,t,t.type,t.pendingProps,r);case 7:return Nt(e,t,t.pendingProps,r),t.child;case 8:return Nt(e,t,t.pendingProps.children,r),t.child;case 12:return Nt(e,t,t.pendingProps.children,r),t.child;case 10:return l=t.pendingProps,ks(t,t.type,l.value),Nt(e,t,l.children,r),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,vi(t),c=Tt(c),l=l(c),t.flags|=1,Nt(e,t,l,r),t.child;case 14:return Om(e,t,t.type,t.pendingProps,r);case 15:return Tm(e,t,t.type,t.pendingProps,r);case 19:return Um(e,t,r);case 31:return Ib(e,t,r);case 22:return Nm(e,t,r,t.pendingProps);case 24:return vi(t),l=Tt(pt),e===null?(c=Gc(),c===null&&(c=Ke,u=$c(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=r),c=u),t.memoizedState={parent:l,cache:c},Fc(t),ks(t,pt,c)):((e.lanes&r)!==0&&(Ic(e,t),oa(t,null,null,r),la()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),ks(t,pt,l)):(l=u.cache,ks(t,pt,l),l!==c.cache&&Pc(t,[pt],r,!0))),Nt(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ls(e){e.flags|=4}function Tu(e,t,r,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(fp())e.flags|=8192;else throw Si=Cl,Vc}else e.flags&=-16777217}function Lm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!e0(t))if(fp())e.flags|=8192;else throw Si=Cl,Vc}function Jl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?qi():536870912,e.lanes|=t,or|=t)}function ma(e,t){if(!ze)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function et(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,l=0;if(t)for(var c=e.child;c!==null;)r|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)r|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=r,t}function Qb(e,t,r){var l=t.pendingProps;switch(qc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(t),null;case 1:return et(t),null;case 3:return r=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ss(pt),Se(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Qi(t)?ls(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Bc())),et(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ls(t),u!==null?(et(t),Lm(t,u)):(et(t),Tu(t,c,null,l,r))):u?u!==e.memoizedState?(ls(t),et(t),Lm(t,u)):(et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ls(t),et(t),Tu(t,c,e,l,r)),null;case 27:if(qn(t),r=St.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return et(t),null}e=Pe.current,Qi(t)?bd(t):(e=Fp(c,l,r),t.stateNode=e,ls(t))}return et(t),null;case 5:if(qn(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return et(t),null}if(u=Pe.current,Qi(t))bd(t);else{var p=co(St.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Xe]=t,u[ot]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(kt(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ls(t)}}return et(t),Tu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=St.current,Qi(t)){if(e=t.stateNode,r=t.memoizedProps,l=null,c=Ot,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Xe]=t,e=!!(e.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||zp(e.nodeValue,r)),e||Ns(t,!0)}else e=co(e).createTextNode(l),e[Xe]=t,t.stateNode=e}return et(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(l=Qi(t),r!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Xe]=t}else bi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),e=!1}else r=Bc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Kt(t),t):(Kt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return et(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Qi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Xe]=t}else bi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),c=!1}else c=Bc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Kt(t),t):(Kt(t),null)}return Kt(t),(t.flags&128)!==0?(t.lanes=r,t):(r=l!==null,e=e!==null&&e.memoizedState!==null,r&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),Jl(t,t.updateQueue),et(t),null);case 4:return Se(),e===null&&Xu(t.stateNode.containerInfo),et(t),null;case 10:return ss(t.type),et(t),null;case 19:if(ge(ht),l=t.memoizedState,l===null)return et(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ma(l,!1);else{if(ut!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=zl(e),u!==null){for(t.flags|=128,ma(l,!1),e=u.updateQueue,t.updateQueue=e,Jl(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)dd(r,e),r=r.sibling;return xe(ht,ht.current&1|2),ze&&ts(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&nt()>Wl&&(t.flags|=128,c=!0,ma(l,!1),t.lanes=4194304)}else{if(!c)if(e=zl(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Jl(t,e),ma(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return et(t),null}else 2*nt()-l.renderingStartTime>Wl&&r!==536870912&&(t.flags|=128,c=!0,ma(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=nt(),e.sibling=null,r=ht.current,xe(ht,c?r&1|2:r&1),ze&&ts(t,l.treeForkCount),e):(et(t),null);case 22:case 23:return Kt(t),Kc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(r&536870912)!==0&&(t.flags&128)===0&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),r=t.updateQueue,r!==null&&Jl(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==r&&(t.flags|=2048),e!==null&&ge(_i),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ss(pt),et(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Xb(e,t){switch(qc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ss(pt),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return qn(t),null;case 31:if(t.memoizedState!==null){if(Kt(t),t.alternate===null)throw Error(a(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Kt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ge(ht),null;case 4:return Se(),null;case 10:return ss(t.type),null;case 22:case 23:return Kt(t),Kc(),e!==null&&ge(_i),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ss(pt),null;case 25:return null;default:return null}}function Hm(e,t){switch(qc(t),t.tag){case 3:ss(pt),Se();break;case 26:case 27:case 5:qn(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&Kt(t);break;case 13:Kt(t);break;case 19:ge(ht);break;case 10:ss(t.type);break;case 22:case 23:Kt(t),Kc(),e!==null&&ge(_i);break;case 24:ss(pt)}}function pa(e,t){try{var r=t.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var c=l.next;r=c;do{if((r.tag&e)===e){l=void 0;var u=r.create,p=r.inst;l=u(),p.destroy=l}r=r.next}while(r!==c)}}catch(b){Ve(t,t.return,b)}}function qs(e,t,r){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var j=r,B=b;try{B()}catch(I){Ve(c,j,I)}}}l=l.next}while(l!==u)}}catch(I){Ve(t,t.return,I)}}function Pm(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Cd(t,r)}catch(l){Ve(e,e.return,l)}}}function $m(e,t,r){r.props=ji(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(l){Ve(e,t,l)}}function ga(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof r=="function"?e.refCleanup=r(l):r.current=l}}catch(c){Ve(e,t,c)}}function Hn(e,t){var r=e.ref,l=e.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(c){Ve(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(c){Ve(e,t,c)}else r.current=null}function Ym(e){var t=e.type,r=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(c){Ve(e,e.return,c)}}function Nu(e,t,r){try{var l=e.stateNode;bx(l,e.type,r,t),l[ot]=t}catch(c){Ve(e,e.return,c)}}function Gm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ys(e.type)||e.tag===4}function ku(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gm(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&&Ys(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 Cu(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,t):(t=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,t.appendChild(e),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Zn));else if(l!==4&&(l===27&&Ys(e.type)&&(r=e.stateNode,t=null),e=e.child,e!==null))for(Cu(e,t,r),e=e.sibling;e!==null;)Cu(e,t,r),e=e.sibling}function Ql(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(l!==4&&(l===27&&Ys(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Ql(e,t,r),e=e.sibling;e!==null;)Ql(e,t,r),e=e.sibling}function Vm(e){var t=e.stateNode,r=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);kt(t,l,r),t[Xe]=e,t[ot]=r}catch(u){Ve(e,e.return,u)}}var os=!1,bt=!1,Mu=!1,Fm=typeof WeakSet=="function"?WeakSet:Set,Et=null;function Kb(e,t){if(e=e.containerInfo,Wu=yo,e=id(e),Ac(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{r.nodeType,u.nodeType}catch{r=null;break e}var p=0,b=-1,j=-1,B=0,I=0,ee=e,L=null;t:for(;;){for(var Y;ee!==r||c!==0&&ee.nodeType!==3||(b=p+c),ee!==u||l!==0&&ee.nodeType!==3||(j=p+l),ee.nodeType===3&&(p+=ee.nodeValue.length),(Y=ee.firstChild)!==null;)L=ee,ee=Y;for(;;){if(ee===e)break t;if(L===r&&++B===c&&(b=p),L===u&&++I===l&&(j=p),(Y=ee.nextSibling)!==null)break;ee=L,L=ee.parentNode}ee=Y}r=b===-1||j===-1?null:{start:b,end:j}}else r=null}r=r||{start:0,end:0}}else r=null;for(ef={focusedElem:e,selectionRange:r},yo=!1,Et=t;Et!==null;)if(t=Et,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Et=e;else for(;Et!==null;){switch(t=Et,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)c=e[r],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,r=t,c=u.memoizedProps,u=u.memoizedState,l=r.stateNode;try{var pe=ji(r.type,c);e=l.getSnapshotBeforeUpdate(pe,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(_e){Ve(r,r.return,_e)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,r=e.nodeType,r===9)sf(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":sf(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(a(163))}if(e=t.sibling,e!==null){e.return=t.return,Et=e;break}Et=t.return}}function Im(e,t,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:us(e,r),l&4&&pa(5,r);break;case 1:if(us(e,r),l&4)if(e=r.stateNode,t===null)try{e.componentDidMount()}catch(p){Ve(r,r.return,p)}else{var c=ji(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ve(r,r.return,p)}}l&64&&Pm(r),l&512&&ga(r,r.return);break;case 3:if(us(e,r),l&64&&(e=r.updateQueue,e!==null)){if(t=null,r.child!==null)switch(r.child.tag){case 27:case 5:t=r.child.stateNode;break;case 1:t=r.child.stateNode}try{Cd(e,t)}catch(p){Ve(r,r.return,p)}}break;case 27:t===null&&l&4&&Vm(r);case 26:case 5:us(e,r),t===null&&l&4&&Ym(r),l&512&&ga(r,r.return);break;case 12:us(e,r);break;case 31:us(e,r),l&4&&Xm(e,r);break;case 13:us(e,r),l&4&&Km(e,r),l&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=ax.bind(null,r),jx(e,r))));break;case 22:if(l=r.memoizedState!==null||os,!l){t=t!==null&&t.memoizedState!==null||bt,c=os;var u=bt;os=l,(bt=t)&&!u?fs(e,r,(r.subtreeFlags&8772)!==0):us(e,r),os=c,bt=u}break;case 30:break;default:us(e,r)}}function Jm(e){var t=e.alternate;t!==null&&(e.alternate=null,Jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ui(t)),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,Lt=!1;function cs(e,t,r){for(r=r.child;r!==null;)Qm(e,t,r),r=r.sibling}function Qm(e,t,r){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(li,r)}catch{}switch(r.tag){case 26:bt||Hn(r,t),cs(e,t,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:bt||Hn(r,t);var l=st,c=Lt;Ys(r.type)&&(st=r.stateNode,Lt=!1),cs(e,t,r),Aa(r.stateNode),st=l,Lt=c;break;case 5:bt||Hn(r,t);case 6:if(l=st,c=Lt,st=null,cs(e,t,r),st=l,Lt=c,st!==null)if(Lt)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(r.stateNode)}catch(u){Ve(r,t,u)}else try{st.removeChild(r.stateNode)}catch(u){Ve(r,t,u)}break;case 18:st!==null&&(Lt?(e=st,Pp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),gr(e)):Pp(st,r.stateNode));break;case 4:l=st,c=Lt,st=r.stateNode.containerInfo,Lt=!0,cs(e,t,r),st=l,Lt=c;break;case 0:case 11:case 14:case 15:qs(2,r,t),bt||qs(4,r,t),cs(e,t,r);break;case 1:bt||(Hn(r,t),l=r.stateNode,typeof l.componentWillUnmount=="function"&&$m(r,t,l)),cs(e,t,r);break;case 21:cs(e,t,r);break;case 22:bt=(l=bt)||r.memoizedState!==null,cs(e,t,r),bt=l;break;default:cs(e,t,r)}}function Xm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{gr(e)}catch(r){Ve(t,t.return,r)}}}function Km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{gr(e)}catch(r){Ve(t,t.return,r)}}function Zb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Fm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Fm),t;default:throw Error(a(435,e.tag))}}function Xl(e,t){var r=Zb(e);t.forEach(function(l){if(!r.has(l)){r.add(l);var c=lx.bind(null,e,l);l.then(c,c)}})}function Ht(e,t){var r=t.deletions;if(r!==null)for(var l=0;l<r.length;l++){var c=r[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Ys(b.type)){st=b.stateNode,Lt=!1;break e}break;case 5:st=b.stateNode,Lt=!1;break e;case 3:case 4:st=b.stateNode.containerInfo,Lt=!0;break e}b=b.return}if(st===null)throw Error(a(160));Qm(u,p,c),st=null,Lt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Zm(t,e),t=t.sibling}var Nn=null;function Zm(e,t){var r=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ht(t,e),Pt(e),l&4&&(qs(3,e,e.return),pa(3,e),qs(5,e,e.return));break;case 1:Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),l&64&&os&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?l:r.concat(l))));break;case 26:var c=Nn;if(Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),l&4){var u=r!==null?r.memoizedState:null;if(l=e.memoizedState,r===null)if(l===null)if(e.stateNode===null){e:{l=e.type,r=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[_t]||u[Xe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),kt(u,l,r),u[Xe]=e,k(u),l=u;break e;case"link":var p=Zp("link","href",c).get(l+(r.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&u.getAttribute("rel")===(r.rel==null?null:r.rel)&&u.getAttribute("title")===(r.title==null?null:r.title)&&u.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),kt(u,l,r),c.head.appendChild(u);break;case"meta":if(p=Zp("meta","content",c).get(l+(r.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(r.content==null?null:""+r.content)&&u.getAttribute("name")===(r.name==null?null:r.name)&&u.getAttribute("property")===(r.property==null?null:r.property)&&u.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&u.getAttribute("charset")===(r.charSet==null?null:r.charSet)){p.splice(b,1);break t}}u=c.createElement(l),kt(u,l,r),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Xe]=e,k(u),l=u}e.stateNode=l}else Wp(c,e.type,e.stateNode);else e.stateNode=Kp(c,l,e.memoizedProps);else u!==l?(u===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):u.count--,l===null?Wp(c,e.type,e.stateNode):Kp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Nu(e,e.memoizedProps,r.memoizedProps)}break;case 27:Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),r!==null&&l&4&&Nu(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Ht(t,e),Pt(e),l&512&&(bt||r===null||Hn(r,r.return)),e.flags&32){c=e.stateNode;try{Li(c,"")}catch(pe){Ve(e,e.return,pe)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,Nu(e,c,r!==null?r.memoizedProps:c)),l&1024&&(Mu=!0);break;case 6:if(Ht(t,e),Pt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,r=e.stateNode;try{r.nodeValue=l}catch(pe){Ve(e,e.return,pe)}}break;case 3:if(ho=null,c=Nn,Nn=uo(t.containerInfo),Ht(t,e),Nn=c,Pt(e),l&4&&r!==null&&r.memoizedState.isDehydrated)try{gr(t.containerInfo)}catch(pe){Ve(e,e.return,pe)}Mu&&(Mu=!1,Wm(e));break;case 4:l=Nn,Nn=uo(e.stateNode.containerInfo),Ht(t,e),Pt(e),Nn=l;break;case 12:Ht(t,e),Pt(e);break;case 31:Ht(t,e),Pt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 13:Ht(t,e),Pt(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Zl=nt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 22:c=e.memoizedState!==null;var j=r!==null&&r.memoizedState!==null,B=os,I=bt;if(os=B||c,bt=I||j,Ht(t,e),bt=I,os=B,Pt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(r===null||j||os||bt||Oi(e)),r=null,t=e;;){if(t.tag===5||t.tag===26){if(r===null){j=r=t;try{if(u=j.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=j.stateNode;var ee=j.memoizedProps.style,L=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(pe){Ve(j,j.return,pe)}}}else if(t.tag===6){if(r===null){j=t;try{j.stateNode.nodeValue=c?"":j.memoizedProps}catch(pe){Ve(j,j.return,pe)}}}else if(t.tag===18){if(r===null){j=t;try{var Y=j.stateNode;c?$p(Y,!0):$p(j.stateNode,!1)}catch(pe){Ve(j,j.return,pe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,Xl(e,r))));break;case 19:Ht(t,e),Pt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 30:break;case 21:break;default:Ht(t,e),Pt(e)}}function Pt(e){var t=e.flags;if(t&2){try{for(var r,l=e.return;l!==null;){if(Gm(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var c=r.stateNode,u=ku(e);Ql(e,u,c);break;case 5:var p=r.stateNode;r.flags&32&&(Li(p,""),r.flags&=-33);var b=ku(e);Ql(e,b,p);break;case 3:case 4:var j=r.stateNode.containerInfo,B=ku(e);Cu(e,B,j);break;default:throw Error(a(161))}}catch(I){Ve(e,e.return,I)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Wm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Wm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function us(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Im(e,t.alternate,t),t=t.sibling}function Oi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:qs(4,t,t.return),Oi(t);break;case 1:Hn(t,t.return);var r=t.stateNode;typeof r.componentWillUnmount=="function"&&$m(t,t.return,r),Oi(t);break;case 27:Aa(t.stateNode);case 26:case 5:Hn(t,t.return),Oi(t);break;case 22:t.memoizedState===null&&Oi(t);break;case 30:Oi(t);break;default:Oi(t)}e=e.sibling}}function fs(e,t,r){for(r=r&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:fs(c,u,r),pa(4,u);break;case 1:if(fs(c,u,r),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ve(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var j=c.shared.hiddenCallbacks;if(j!==null)for(c.shared.hiddenCallbacks=null,c=0;c<j.length;c++)kd(j[c],b)}catch(B){Ve(l,l.return,B)}}r&&p&64&&Pm(u),ga(u,u.return);break;case 27:Vm(u);case 26:case 5:fs(c,u,r),r&&l===null&&p&4&&Ym(u),ga(u,u.return);break;case 12:fs(c,u,r);break;case 31:fs(c,u,r),r&&p&4&&Xm(c,u);break;case 13:fs(c,u,r),r&&p&4&&Km(c,u);break;case 22:u.memoizedState===null&&fs(c,u,r),ga(u,u.return);break;case 30:break;default:fs(c,u,r)}t=t.sibling}}function Ru(e,t){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&na(r))}function Du(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function kn(e,t,r,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ep(e,t,r,l),t=t.sibling}function ep(e,t,r,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:kn(e,t,r,l),c&2048&&pa(9,t);break;case 1:kn(e,t,r,l);break;case 3:kn(e,t,r,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(c&2048){kn(e,t,r,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(j){Ve(t,t.return,j)}}else kn(e,t,r,l);break;case 31:kn(e,t,r,l);break;case 13:kn(e,t,r,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?kn(e,t,r,l):ya(e,t):u._visibility&2?kn(e,t,r,l):(u._visibility|=2,rr(e,t,r,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Ru(p,t);break;case 24:kn(e,t,r,l),c&2048&&Du(t.alternate,t);break;default:kn(e,t,r,l)}}function rr(e,t,r,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=r,j=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:rr(u,p,b,j,c),pa(8,p);break;case 23:break;case 22:var I=p.stateNode;p.memoizedState!==null?I._visibility&2?rr(u,p,b,j,c):ya(u,p):(I._visibility|=2,rr(u,p,b,j,c)),c&&B&2048&&Ru(p.alternate,p);break;case 24:rr(u,p,b,j,c),c&&B&2048&&Du(p.alternate,p);break;default:rr(u,p,b,j,c)}t=t.sibling}}function ya(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var r=e,l=t,c=l.flags;switch(l.tag){case 22:ya(r,l),c&2048&&Ru(l.alternate,l);break;case 24:ya(r,l),c&2048&&Du(l.alternate,l);break;default:ya(r,l)}t=t.sibling}}var ba=8192;function ar(e,t,r){if(e.subtreeFlags&ba)for(e=e.child;e!==null;)tp(e,t,r),e=e.sibling}function tp(e,t,r){switch(e.tag){case 26:ar(e,t,r),e.flags&ba&&e.memoizedState!==null&&Bx(r,Nn,e.memoizedState,e.memoizedProps);break;case 5:ar(e,t,r);break;case 3:case 4:var l=Nn;Nn=uo(e.stateNode.containerInfo),ar(e,t,r),Nn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ba,ba=16777216,ar(e,t,r),ba=l):ar(e,t,r));break;default:ar(e,t,r)}}function np(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function xa(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var l=t[r];Et=l,ip(l,e)}np(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sp(e),e=e.sibling}function sp(e){switch(e.tag){case 0:case 11:case 15:xa(e),e.flags&2048&&qs(9,e,e.return);break;case 3:xa(e);break;case 12:xa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kl(e)):xa(e);break;default:xa(e)}}function Kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var l=t[r];Et=l,ip(l,e)}np(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:qs(8,t,t.return),Kl(t);break;case 22:r=t.stateNode,r._visibility&2&&(r._visibility&=-3,Kl(t));break;default:Kl(t)}e=e.sibling}}function ip(e,t){for(;Et!==null;){var r=Et;switch(r.tag){case 0:case 11:case 15:qs(8,r,t);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:na(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,Et=l;else e:for(r=e;Et!==null;){l=Et;var c=l.sibling,u=l.return;if(Jm(l),l===r){Et=null;break e}if(c!==null){c.return=u,Et=c;break e}Et=u}}}var Wb={getCacheForType:function(e){var t=Tt(pt),r=t.data.get(e);return r===void 0&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return Tt(pt).controller.signal}},ex=typeof WeakMap=="function"?WeakMap:Map,$e=0,Ke=null,Ce=null,Re=0,Ge=0,Zt=null,Us=!1,lr=!1,zu=!1,hs=0,ut=0,Bs=0,Ti=0,qu=0,Wt=0,or=0,va=null,$t=null,Uu=!1,Zl=0,rp=0,Wl=1/0,eo=null,Ls=null,wt=0,Hs=null,cr=null,ds=0,Bu=0,Lu=null,ap=null,_a=0,Hu=null;function en(){return($e&2)!==0&&Re!==0?Re&-Re:$.T!==null?Fu():Yr()}function lp(){if(Wt===0)if((Re&536870912)===0||ze){var e=Qn;Qn<<=1,(Qn&3932160)===0&&(Qn=262144),Wt=e}else Wt=536870912;return e=Xt.current,e!==null&&(e.flags|=32),Wt}function Yt(e,t,r){(e===Ke&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)&&(ur(e,0),Ps(e,Re,Wt,!1)),jn(e,r),(($e&2)===0||e!==Ke)&&(e===Ke&&(($e&2)===0&&(Ti|=r),ut===4&&Ps(e,Re,Wt,!1)),Pn(e))}function op(e,t,r){if(($e&6)!==0)throw Error(a(327));var l=!r&&(t&127)===0&&(t&e.expiredLanes)===0||ci(e,t),c=l?sx(e,t):$u(e,t,!0),u=l;do{if(c===0){lr&&!l&&Ps(e,t,0,!1);break}else{if(r=e.current.alternate,u&&!tx(r)){c=$u(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=va;var j=b.current.memoizedState.isDehydrated;if(j&&(ur(b,p).flags|=256),p=$u(b,p,!1),p!==2){if(zu&&!j){b.errorRecoveryDisabledLanes|=u,Ti|=u,c=4;break e}u=$t,$t=c,u!==null&&($t===null?$t=u:$t.push.apply($t,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){ur(e,0),Ps(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:Ps(l,t,Wt,!Us);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Zl+300-nt(),10<c)){if(Ps(l,t,Wt,!Us),oi(l,0,!0)!==0)break e;ds=t,l.timeoutHandle=Lp(cp.bind(null,l,r,$t,eo,Uu,t,Wt,Ti,or,Us,u,"Throttled",-0,0),c);break e}cp(l,r,$t,eo,Uu,t,Wt,Ti,or,Us,u,null,-0,0)}}break}while(!0);Pn(e)}function cp(e,t,r,l,c,u,p,b,j,B,I,ee,L,Y){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zn},tp(t,u,ee);var pe=(u&62914560)===u?Zl-nt():(u&4194048)===u?rp-nt():0;if(pe=Lx(ee,pe),pe!==null){ds=u,e.cancelPendingCommit=pe(yp.bind(null,e,t,u,r,l,c,p,b,j,I,ee,null,L,Y)),Ps(e,u,p,!B);return}}yp(e,t,u,r,l,c,p,b,j)}function tx(e){for(var t=e;;){var r=t.tag;if((r===0||r===11||r===15)&&t.flags&16384&&(r=t.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var c=r[l],u=c.getSnapshot;c=c.value;try{if(!Jt(u(),c))return!1}catch{return!1}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ps(e,t,r,l){t&=~qu,t&=~Ti,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Ct(c),p=1<<u;l[u]=-1,c&=~p}r!==0&&Es(e,r,t)}function to(){return($e&6)===0?(wa(0),!1):!0}function Pu(){if(Ce!==null){if(Ge===0)var e=Ce.return;else e=Ce,ns=xi=null,su(e),er=null,ia=0,e=Ce;for(;e!==null;)Hm(e.alternate,e),e=e.return;Ce=null}}function ur(e,t){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,_x(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),ds=0,Pu(),Ke=e,Ce=r=es(e.current,null),Re=t,Ge=0,Zt=null,Us=!1,lr=ci(e,t),zu=!1,or=Wt=qu=Ti=Bs=ut=0,$t=va=null,Uu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Ct(l),u=1<<c;t|=e[c],l&=~u}return hs=t,wl(),r}function up(e,t){je=null,$.H=ha,t===Wi||t===kl?(t=jd(),Ge=3):t===Vc?(t=jd(),Ge=4):Ge=t===xu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Zt=t,Ce===null&&(ut=1,Gl(e,dn(t,e.current)))}function fp(){var e=Xt.current;return e===null?!0:(Re&4194048)===Re?yn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===yn:!1}function hp(){var e=$.H;return $.H=ha,e===null?ha:e}function dp(){var e=$.A;return $.A=Wb,e}function no(){ut=4,Us||(Re&4194048)!==Re&&Xt.current!==null||(lr=!0),(Bs&134217727)===0&&(Ti&134217727)===0||Ke===null||Ps(Ke,Re,Wt,!1)}function $u(e,t,r){var l=$e;$e|=2;var c=hp(),u=dp();(Ke!==e||Re!==t)&&(eo=null,ur(e,t)),t=!1;var p=ut;e:do try{if(Ge!==0&&Ce!==null){var b=Ce,j=Zt;switch(Ge){case 8:Pu(),p=6;break e;case 3:case 2:case 9:case 6:Xt.current===null&&(t=!0);var B=Ge;if(Ge=0,Zt=null,fr(e,b,j,B),r&&lr){p=0;break e}break;default:B=Ge,Ge=0,Zt=null,fr(e,b,j,B)}}nx(),p=ut;break}catch(I){up(e,I)}while(!0);return t&&e.shellSuspendCounter++,ns=xi=null,$e=l,$.H=c,$.A=u,Ce===null&&(Ke=null,Re=0,wl()),p}function nx(){for(;Ce!==null;)mp(Ce)}function sx(e,t){var r=$e;$e|=2;var l=hp(),c=dp();Ke!==e||Re!==t?(eo=null,Wl=nt()+500,ur(e,t)):lr=ci(e,t);e:do try{if(Ge!==0&&Ce!==null){t=Ce;var u=Zt;t:switch(Ge){case 1:Ge=0,Zt=null,fr(e,t,u,1);break;case 2:case 9:if(Ed(u)){Ge=0,Zt=null,pp(t);break}t=function(){Ge!==2&&Ge!==9||Ke!==e||(Ge=7),Pn(e)},u.then(t,t);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:Ed(u)?(Ge=0,Zt=null,pp(t)):(Ge=0,Zt=null,fr(e,t,u,7));break;case 5:var p=null;switch(Ce.tag){case 26:p=Ce.memoizedState;case 5:case 27:var b=Ce;if(p?e0(p):b.stateNode.complete){Ge=0,Zt=null;var j=b.sibling;if(j!==null)Ce=j;else{var B=b.return;B!==null?(Ce=B,so(B)):Ce=null}break t}}Ge=0,Zt=null,fr(e,t,u,5);break;case 6:Ge=0,Zt=null,fr(e,t,u,6);break;case 8:Pu(),ut=6;break e;default:throw Error(a(462))}}ix();break}catch(I){up(e,I)}while(!0);return ns=xi=null,$.H=l,$.A=c,$e=r,Ce!==null?0:(Ke=null,Re=0,wl(),ut)}function ix(){for(;Ce!==null&&!rl();)mp(Ce)}function mp(e){var t=Bm(e.alternate,e,hs);e.memoizedProps=e.pendingProps,t===null?so(e):Ce=t}function pp(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=Mm(r,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=Mm(r,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:su(t);default:Hm(r,t),t=Ce=dd(t,hs),t=Bm(r,t,hs)}e.memoizedProps=e.pendingProps,t===null?so(e):Ce=t}function fr(e,t,r,l){ns=xi=null,su(t),er=null,ia=0;var c=t.return;try{if(Fb(e,c,t,r,Re)){ut=1,Gl(e,dn(r,e.current)),Ce=null;return}}catch(u){if(c!==null)throw Ce=c,u;ut=1,Gl(e,dn(r,e.current)),Ce=null;return}t.flags&32768?(ze||l===1?e=!0:lr||(Re&536870912)!==0?e=!1:(Us=e=!0,(l===2||l===9||l===3||l===6)&&(l=Xt.current,l!==null&&l.tag===13&&(l.flags|=16384))),gp(t,e)):so(t)}function so(e){var t=e;do{if((t.flags&32768)!==0){gp(t,Us);return}e=t.return;var r=Qb(t.alternate,t,hs);if(r!==null){Ce=r;return}if(t=t.sibling,t!==null){Ce=t;return}Ce=t=e}while(t!==null);ut===0&&(ut=5)}function gp(e,t){do{var r=Xb(e.alternate,e);if(r!==null){r.flags&=32767,Ce=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!t&&(e=e.sibling,e!==null)){Ce=e;return}Ce=e=r}while(e!==null);ut=6,Ce=null}function yp(e,t,r,l,c,u,p,b,j){e.cancelPendingCommit=null;do io();while(wt!==0);if(($e&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=kc,Ss(e,r,u,p,b,j),e===Ke&&(Ce=Ke=null,Re=0),cr=t,Hs=e,ds=r,Bu=u,Lu=c,ap=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,ox(Di,function(){return wp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=se.p,se.p=2,p=$e,$e|=4;try{Kb(e,t,r)}finally{$e=p,se.p=c,$.T=l}}wt=1,bp(),xp(),vp()}}function bp(){if(wt===1){wt=0;var e=Hs,t=cr,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=$.T,$.T=null;var l=se.p;se.p=2;var c=$e;$e|=4;try{Zm(t,e);var u=ef,p=id(e.containerInfo),b=u.focusedElem,j=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&sd(b.ownerDocument.documentElement,b)){if(j!==null&&Ac(b)){var B=j.start,I=j.end;if(I===void 0&&(I=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(I,b.value.length);else{var ee=b.ownerDocument||document,L=ee&&ee.defaultView||window;if(L.getSelection){var Y=L.getSelection(),pe=b.textContent.length,_e=Math.min(j.start,pe),Qe=j.end===void 0?_e:Math.min(j.end,pe);!Y.extend&&_e>Qe&&(p=Qe,Qe=_e,_e=p);var R=nd(b,_e),C=nd(b,Qe);if(R&&C&&(Y.rangeCount!==1||Y.anchorNode!==R.node||Y.anchorOffset!==R.offset||Y.focusNode!==C.node||Y.focusOffset!==C.offset)){var U=ee.createRange();U.setStart(R.node,R.offset),Y.removeAllRanges(),_e>Qe?(Y.addRange(U),Y.extend(C.node,C.offset)):(U.setEnd(C.node,C.offset),Y.addRange(U))}}}}for(ee=[],Y=b;Y=Y.parentNode;)Y.nodeType===1&&ee.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<ee.length;b++){var J=ee[b];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}yo=!!Wu,ef=Wu=null}finally{$e=c,se.p=l,$.T=r}}e.current=t,wt=2}}function xp(){if(wt===2){wt=0;var e=Hs,t=cr,r=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||r){r=$.T,$.T=null;var l=se.p;se.p=2;var c=$e;$e|=4;try{Im(e,t.alternate,t)}finally{$e=c,se.p=l,$.T=r}}wt=3}}function vp(){if(wt===4||wt===3){wt=0,Ri();var e=Hs,t=cr,r=ds,l=ap;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?wt=5:(wt=0,cr=Hs=null,_p(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ls=null),fi(r),t=t.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(li,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=se.p,se.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,se.p=c}}(ds&3)!==0&&io(),Pn(e),c=e.pendingLanes,(r&261930)!==0&&(c&42)!==0?e===Hu?_a++:(_a=0,Hu=e):_a=0,wa(0)}}function _p(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function io(){return bp(),xp(),vp(),wp()}function wp(){if(wt!==5)return!1;var e=Hs,t=Bu;Bu=0;var r=fi(ds),l=$.T,c=se.p;try{se.p=32>r?32:r,$.T=null,r=Lu,Lu=null;var u=Hs,p=ds;if(wt=0,cr=Hs=null,ds=0,($e&6)!==0)throw Error(a(331));var b=$e;if($e|=4,sp(u.current),ep(u,u.current,p,r),$e=b,wa(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(li,u)}catch{}return!0}finally{se.p=c,$.T=l,_p(e,t)}}function Sp(e,t,r){t=dn(r,t),t=bu(e.stateNode,t,2),e=Rs(e,t,2),e!==null&&(jn(e,2),Pn(e))}function Ve(e,t,r){if(e.tag===3)Sp(e,e,r);else for(;t!==null;){if(t.tag===3){Sp(t,e,r);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ls===null||!Ls.has(l))){e=dn(r,e),r=Em(2),l=Rs(t,r,2),l!==null&&(Am(r,l,t,e),jn(l,2),Pn(l));break}}t=t.return}}function Yu(e,t,r){var l=e.pingCache;if(l===null){l=e.pingCache=new ex;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(r)||(zu=!0,c.add(r),e=rx.bind(null,e,t,r),t.then(e,e))}function rx(e,t,r){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Ke===e&&(Re&r)===r&&(ut===4||ut===3&&(Re&62914560)===Re&&300>nt()-Zl?($e&2)===0&&ur(e,0):qu|=r,or===Re&&(or=0)),Pn(e)}function Ep(e,t){t===0&&(t=qi()),e=gi(e,t),e!==null&&(jn(e,t),Pn(e))}function ax(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Ep(e,r)}function lx(e,t){var r=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(r=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),Ep(e,r)}function ox(e,t){return Lr(e,t)}var ro=null,hr=null,Gu=!1,ao=!1,Vu=!1,$s=0;function Pn(e){e!==hr&&e.next===null&&(hr===null?ro=hr=e:hr=hr.next=e),ao=!0,Gu||(Gu=!0,ux())}function wa(e,t){if(!Vu&&ao){Vu=!0;do for(var r=!1,l=ro;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Ct(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(r=!0,Tp(l,u))}else u=Re,u=oi(l,l===Ke?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ci(l,u)||(r=!0,Tp(l,u));l=l.next}while(r);Vu=!1}}function cx(){Ap()}function Ap(){ao=Gu=!1;var e=0;$s!==0&&vx()&&(e=$s);for(var t=nt(),r=null,l=ro;l!==null;){var c=l.next,u=jp(l,t);u===0?(l.next=null,r===null?ro=c:r.next=c,c===null&&(hr=r)):(r=l,(e!==0||(u&3)!==0)&&(ao=!0)),l=c}wt!==0&&wt!==5||wa(e),$s!==0&&($s=0)}function jp(e,t){for(var r=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Ct(u),b=1<<p,j=c[p];j===-1?((b&r)===0||(b&l)!==0)&&(c[p]=$r(b,t)):j<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ke,r=Re,r=oi(e,e===t?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,r===0||e===t&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Jn(l),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||ci(e,r)){if(t=r&-r,t===e.callbackPriority)return t;switch(l!==null&&Jn(l),fi(r)){case 2:case 8:r=ll;break;case 32:r=Di;break;case 268435456:r=ol;break;default:r=Di}return l=Op.bind(null,e),r=Lr(r,l),e.callbackPriority=t,e.callbackNode=r,t}return l!==null&&l!==null&&Jn(l),e.callbackPriority=2,e.callbackNode=null,2}function Op(e,t){if(wt!==0&&wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(io()&&e.callbackNode!==r)return null;var l=Re;return l=oi(e,e===Ke?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(op(e,l,t),jp(e,nt()),e.callbackNode!=null&&e.callbackNode===r?Op.bind(null,e):null)}function Tp(e,t){if(io())return null;op(e,t,!0)}function ux(){wx(function(){($e&6)!==0?Lr(al,cx):Ap()})}function Fu(){if($s===0){var e=Ki;e===0&&(e=vs,vs<<=1,(vs&261888)===0&&(vs=256)),$s=e}return $s}function Np(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ml(""+e)}function kp(e,t){var r=t.ownerDocument.createElement("input");return r.name=t.name,r.value=t.value,e.id&&r.setAttribute("form",e.id),t.parentNode.insertBefore(r,t),e=new FormData(e),r.parentNode.removeChild(r),e}function fx(e,t,r,l,c){if(t==="submit"&&r&&r.stateNode===c){var u=Np((c[ot]||null).action),p=l.submitter;p&&(t=(t=p[ot]||null)?Np(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new bl("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if($s!==0){var j=p?kp(c,p):new FormData(c);hu(r,{pending:!0,data:j,method:c.method,action:u},null,j)}}else typeof u=="function"&&(b.preventDefault(),j=p?kp(c,p):new FormData(c),hu(r,{pending:!0,data:j,method:c.method,action:u},u,j))},currentTarget:c}]})}}for(var Iu=0;Iu<Nc.length;Iu++){var Ju=Nc[Iu],hx=Ju.toLowerCase(),dx=Ju[0].toUpperCase()+Ju.slice(1);Tn(hx,"on"+dx)}Tn(ld,"onAnimationEnd"),Tn(od,"onAnimationIteration"),Tn(cd,"onAnimationStart"),Tn("dblclick","onDoubleClick"),Tn("focusin","onFocus"),Tn("focusout","onBlur"),Tn(Nb,"onTransitionRun"),Tn(kb,"onTransitionStart"),Tn(Cb,"onTransitionCancel"),Tn(ud,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),ne("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ne("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ne("onBeforeInput",["compositionend","keypress","textInput","paste"]),ne("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ne("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ne("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sa="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(" "),mx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Sa));function Cp(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var l=e[r],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],j=b.instance,B=b.currentTarget;if(b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(I){_l(I)}c.currentTarget=null,u=j}else for(p=0;p<l.length;p++){if(b=l[p],j=b.instance,B=b.currentTarget,b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(I){_l(I)}c.currentTarget=null,u=j}}}}function Me(e,t){var r=t[hi];r===void 0&&(r=t[hi]=new Set);var l=e+"__bubble";r.has(l)||(Mp(t,e,2,!1),r.add(l))}function Qu(e,t,r){var l=0;t&&(l|=4),Mp(r,e,l,t)}var lo="_reactListening"+Math.random().toString(36).slice(2);function Xu(e){if(!e[lo]){e[lo]=!0,D.forEach(function(r){r!=="selectionchange"&&(mx.has(r)||Qu(r,!1,e),Qu(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[lo]||(t[lo]=!0,Qu("selectionchange",!1,t))}}function Mp(e,t,r,l){switch(l0(t)){case 2:var c=$x;break;case 8:c=Yx;break;default:c=hf}r=c.bind(null,t,r,e),c=void 0,!gc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,r,{capture:!0,passive:c}):e.addEventListener(t,r,!0):c!==void 0?e.addEventListener(t,r,{passive:c}):e.addEventListener(t,r,!1)}function Ku(e,t,r,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var j=p.tag;if((j===3||j===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(j=p.tag,j===5||j===6||j===26||j===27){l=u=p;continue e}b=b.parentNode}}l=l.return}Uh(function(){var B=u,I=mc(r),ee=[];e:{var L=fd.get(e);if(L!==void 0){var Y=bl,pe=e;switch(e){case"keypress":if(gl(r)===0)break e;case"keydown":case"keyup":Y=lb;break;case"focusin":pe="focus",Y=vc;break;case"focusout":pe="blur",Y=vc;break;case"beforeblur":case"afterblur":Y=vc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Y=Hh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=Qy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=ub;break;case ld:case od:case cd:Y=Zy;break;case ud:Y=hb;break;case"scroll":case"scrollend":Y=Iy;break;case"wheel":Y=mb;break;case"copy":case"cut":case"paste":Y=eb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=$h;break;case"toggle":case"beforetoggle":Y=gb}var _e=(t&4)!==0,Qe=!_e&&(e==="scroll"||e==="scrollend"),R=_e?L!==null?L+"Capture":null:L;_e=[];for(var C=B,U;C!==null;){var J=C;if(U=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||U===null||R===null||(J=Vr(C,R),J!=null&&_e.push(Ea(C,J,U))),Qe)break;C=C.return}0<_e.length&&(L=new Y(L,pe,null,r,I),ee.push({event:L,listeners:_e}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",Y=e==="mouseout"||e==="pointerout",L&&r!==dc&&(pe=r.relatedTarget||r.fromElement)&&(x(pe)||pe[It]))break e;if((Y||L)&&(L=I.window===I?I:(L=I.ownerDocument)?L.defaultView||L.parentWindow:window,Y?(pe=r.relatedTarget||r.toElement,Y=B,pe=pe?x(pe):null,pe!==null&&(Qe=f(pe),_e=pe.tag,pe!==Qe||_e!==5&&_e!==27&&_e!==6)&&(pe=null)):(Y=null,pe=B),Y!==pe)){if(_e=Hh,J="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(_e=$h,J="onPointerLeave",R="onPointerEnter",C="pointer"),Qe=Y==null?L:_(Y),U=pe==null?L:_(pe),L=new _e(J,C+"leave",Y,r,I),L.target=Qe,L.relatedTarget=U,J=null,x(I)===B&&(_e=new _e(R,C+"enter",pe,r,I),_e.target=U,_e.relatedTarget=Qe,J=_e),Qe=J,Y&&pe)t:{for(_e=px,R=Y,C=pe,U=0,J=R;J;J=_e(J))U++;J=0;for(var be=C;be;be=_e(be))J++;for(;0<U-J;)R=_e(R),U--;for(;0<J-U;)C=_e(C),J--;for(;U--;){if(R===C||C!==null&&R===C.alternate){_e=R;break t}R=_e(R),C=_e(C)}_e=null}else _e=null;Y!==null&&Rp(ee,L,Y,_e,!1),pe!==null&&Qe!==null&&Rp(ee,Qe,pe,_e,!0)}}e:{if(L=B?_(B):window,Y=L.nodeName&&L.nodeName.toLowerCase(),Y==="select"||Y==="input"&&L.type==="file")var Le=Xh;else if(Jh(L))if(Kh)Le=jb;else{Le=Eb;var ye=Sb}else Y=L.nodeName,!Y||Y.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&hc(B.elementType)&&(Le=Xh):Le=Ab;if(Le&&(Le=Le(e,B))){Qh(ee,Le,r,I);break e}ye&&ye(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&fc(L,"number",L.value)}switch(ye=B?_(B):window,e){case"focusin":(Jh(ye)||ye.contentEditable==="true")&&(Yi=ye,jc=B,Wr=null);break;case"focusout":Wr=jc=Yi=null;break;case"mousedown":Oc=!0;break;case"contextmenu":case"mouseup":case"dragend":Oc=!1,rd(ee,r,I);break;case"selectionchange":if(Tb)break;case"keydown":case"keyup":rd(ee,r,I)}var Oe;if(wc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else $i?Fh(e,r)&&(De="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(De="onCompositionStart");De&&(Yh&&r.locale!=="ko"&&($i||De!=="onCompositionStart"?De==="onCompositionEnd"&&$i&&(Oe=Bh()):(js=I,yc="value"in js?js.value:js.textContent,$i=!0)),ye=oo(B,De),0<ye.length&&(De=new Ph(De,e,null,r,I),ee.push({event:De,listeners:ye}),Oe?De.data=Oe:(Oe=Ih(r),Oe!==null&&(De.data=Oe)))),(Oe=bb?xb(e,r):vb(e,r))&&(De=oo(B,"onBeforeInput"),0<De.length&&(ye=new Ph("onBeforeInput","beforeinput",null,r,I),ee.push({event:ye,listeners:De}),ye.data=Oe)),fx(ee,e,B,r,I)}Cp(ee,t)})}function Ea(e,t,r){return{instance:e,listener:t,currentTarget:r}}function oo(e,t){for(var r=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Vr(e,r),c!=null&&l.unshift(Ea(e,c,u)),c=Vr(e,t),c!=null&&l.push(Ea(e,c,u))),e.tag===3)return l;e=e.return}return[]}function px(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Rp(e,t,r,l,c){for(var u=t._reactName,p=[];r!==null&&r!==l;){var b=r,j=b.alternate,B=b.stateNode;if(b=b.tag,j!==null&&j===l)break;b!==5&&b!==26&&b!==27||B===null||(j=B,c?(B=Vr(r,u),B!=null&&p.unshift(Ea(r,B,j))):c||(B=Vr(r,u),B!=null&&p.push(Ea(r,B,j)))),r=r.return}p.length!==0&&e.push({event:t,listeners:p})}var gx=/\r\n?/g,yx=/\u0000|\uFFFD/g;function Dp(e){return(typeof e=="string"?e:""+e).replace(gx,`
|
|
26
|
-
`).replace(yx,"")}function zp(e,t){return t=Dp(t),Dp(e)===t}function Je(e,t,r,l,c,u){switch(r){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Li(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Li(e,""+l);break;case"className":On(e,"class",l);break;case"tabIndex":On(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":On(e,r,l);break;case"style":zh(e,l,u);break;case"data":if(t!=="object"){On(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||r!=="href")){e.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=ml(""+l),e.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(r,"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 u=="function"&&(r==="formAction"?(t!=="input"&&Je(e,t,"name",c.name,c,null),Je(e,t,"formEncType",c.formEncType,c,null),Je(e,t,"formMethod",c.formMethod,c,null),Je(e,t,"formTarget",c.formTarget,c,null)):(Je(e,t,"encType",c.encType,c,null),Je(e,t,"method",c.method,c,null),Je(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=ml(""+l),e.setAttribute(r,l);break;case"onClick":l!=null&&(e.onclick=Zn);break;case"onScroll":l!=null&&Me("scroll",e);break;case"onScrollEnd":l!=null&&Me("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}r=ml(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,""+l):e.removeAttribute(r);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":l===!0?e.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,l):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(r,l):e.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(r):e.setAttribute(r,l);break;case"popover":Me("beforetoggle",e),Me("toggle",e),Mt(e,"popover",l);break;case"xlinkActuate":Kn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Kn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Kn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Kn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Kn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Kn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Mt(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Vy.get(r)||r,Mt(e,r,l))}}function Zu(e,t,r,l,c,u){switch(r){case"style":zh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"children":typeof l=="string"?Li(e,l):(typeof l=="number"||typeof l=="bigint")&&Li(e,""+l);break;case"onScroll":l!=null&&Me("scroll",e);break;case"onScrollEnd":l!=null&&Me("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Zn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Z.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(c=r.endsWith("Capture"),t=r.slice(2,c?r.length-7:void 0),u=e[ot]||null,u=u!=null?u[r]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(t,l,c);break e}r in e?e[r]=l:l===!0?e.setAttribute(r,""):Mt(e,r,l)}}}function kt(e,t,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Me("error",e),Me("load",e);var l=!1,c=!1,u;for(u in r)if(r.hasOwnProperty(u)){var p=r[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,u,p,r,null)}}c&&Je(e,t,"srcSet",r.srcSet,r,null),l&&Je(e,t,"src",r.src,r,null);return;case"input":Me("invalid",e);var b=u=p=c=null,j=null,B=null;for(l in r)if(r.hasOwnProperty(l)){var I=r[l];if(I!=null)switch(l){case"name":c=I;break;case"type":p=I;break;case"checked":j=I;break;case"defaultChecked":B=I;break;case"value":u=I;break;case"defaultValue":b=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(a(137,t));break;default:Je(e,t,l,I,r,null)}}Ch(e,u,b,j,B,p,c,!1);return;case"select":Me("invalid",e),l=p=u=null;for(c in r)if(r.hasOwnProperty(c)&&(b=r[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Je(e,t,c,b,r,null)}t=u,r=p,e.multiple=!!l,t!=null?Bi(e,!!l,t,!1):r!=null&&Bi(e,!!l,r,!0);return;case"textarea":Me("invalid",e),u=c=l=null;for(p in r)if(r.hasOwnProperty(p)&&(b=r[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Je(e,t,p,b,r,null)}Rh(e,l,c,u);return;case"option":for(j in r)if(r.hasOwnProperty(j)&&(l=r[j],l!=null))switch(j){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Je(e,t,j,l,r,null)}return;case"dialog":Me("beforetoggle",e),Me("toggle",e),Me("cancel",e),Me("close",e);break;case"iframe":case"object":Me("load",e);break;case"video":case"audio":for(l=0;l<Sa.length;l++)Me(Sa[l],e);break;case"image":Me("error",e),Me("load",e);break;case"details":Me("toggle",e);break;case"embed":case"source":case"link":Me("error",e),Me("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(B in r)if(r.hasOwnProperty(B)&&(l=r[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,B,l,r,null)}return;default:if(hc(t)){for(I in r)r.hasOwnProperty(I)&&(l=r[I],l!==void 0&&Zu(e,t,I,l,r,void 0));return}}for(b in r)r.hasOwnProperty(b)&&(l=r[b],l!=null&&Je(e,t,b,l,r,null))}function bx(e,t,r,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,j=null,B=null,I=null;for(Y in r){var ee=r[Y];if(r.hasOwnProperty(Y)&&ee!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":j=ee;default:l.hasOwnProperty(Y)||Je(e,t,Y,null,l,ee)}}for(var L in l){var Y=l[L];if(ee=r[L],l.hasOwnProperty(L)&&(Y!=null||ee!=null))switch(L){case"type":u=Y;break;case"name":c=Y;break;case"checked":B=Y;break;case"defaultChecked":I=Y;break;case"value":p=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Y!==ee&&Je(e,t,L,Y,l,ee)}}uc(e,p,b,j,B,I,u,c);return;case"select":Y=p=b=L=null;for(u in r)if(j=r[u],r.hasOwnProperty(u)&&j!=null)switch(u){case"value":break;case"multiple":Y=j;default:l.hasOwnProperty(u)||Je(e,t,u,null,l,j)}for(c in l)if(u=l[c],j=r[c],l.hasOwnProperty(c)&&(u!=null||j!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==j&&Je(e,t,c,u,l,j)}t=b,r=p,l=Y,L!=null?Bi(e,!!r,L,!1):!!l!=!!r&&(t!=null?Bi(e,!!r,t,!0):Bi(e,!!r,r?[]:"",!1));return;case"textarea":Y=L=null;for(b in r)if(c=r[b],r.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Je(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=r[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":Y=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Je(e,t,p,c,l,u)}Mh(e,L,Y);return;case"option":for(var pe in r)if(L=r[pe],r.hasOwnProperty(pe)&&L!=null&&!l.hasOwnProperty(pe))switch(pe){case"selected":e.selected=!1;break;default:Je(e,t,pe,null,l,L)}for(j in l)if(L=l[j],Y=r[j],l.hasOwnProperty(j)&&L!==Y&&(L!=null||Y!=null))switch(j){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Je(e,t,j,L,l,Y)}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 _e in r)L=r[_e],r.hasOwnProperty(_e)&&L!=null&&!l.hasOwnProperty(_e)&&Je(e,t,_e,null,l,L);for(B in l)if(L=l[B],Y=r[B],l.hasOwnProperty(B)&&L!==Y&&(L!=null||Y!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Je(e,t,B,L,l,Y)}return;default:if(hc(t)){for(var Qe in r)L=r[Qe],r.hasOwnProperty(Qe)&&L!==void 0&&!l.hasOwnProperty(Qe)&&Zu(e,t,Qe,void 0,l,L);for(I in l)L=l[I],Y=r[I],!l.hasOwnProperty(I)||L===Y||L===void 0&&Y===void 0||Zu(e,t,I,L,l,Y);return}}for(var R in r)L=r[R],r.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Je(e,t,R,null,l,L);for(ee in l)L=l[ee],Y=r[ee],!l.hasOwnProperty(ee)||L===Y||L==null&&Y==null||Je(e,t,ee,L,l,Y)}function qp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function xx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var c=r[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&qp(p)){for(p=0,b=c.responseEnd,l+=1;l<r.length;l++){var j=r[l],B=j.startTime;if(B>b)break;var I=j.transferSize,ee=j.initiatorType;I&&qp(ee)&&(j=j.responseEnd,p+=I*(j<b?1:(b-B)/(j-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Wu=null,ef=null;function co(e){return e.nodeType===9?e:e.ownerDocument}function Up(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 Bp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function tf(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var nf=null;function vx(){var e=window.event;return e&&e.type==="popstate"?e===nf?!1:(nf=e,!0):(nf=null,!1)}var Lp=typeof setTimeout=="function"?setTimeout:void 0,_x=typeof clearTimeout=="function"?clearTimeout:void 0,Hp=typeof Promise=="function"?Promise:void 0,wx=typeof queueMicrotask=="function"?queueMicrotask:typeof Hp<"u"?function(e){return Hp.resolve(null).then(e).catch(Sx)}:Lp;function Sx(e){setTimeout(function(){throw e})}function Ys(e){return e==="head"}function Pp(e,t){var r=t,l=0;do{var c=r.nextSibling;if(e.removeChild(r),c&&c.nodeType===8)if(r=c.data,r==="/$"||r==="/&"){if(l===0){e.removeChild(c),gr(t);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Aa(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Aa(r);for(var u=r.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[_t]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||r.removeChild(u),u=p}}else r==="body"&&Aa(e.ownerDocument.body);r=c}while(r);gr(t)}function $p(e,t){var r=e;e=0;do{var l=r.nextSibling;if(r.nodeType===1?t?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(t?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=l}while(r)}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var r=t;switch(t=t.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":sf(r),Ui(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Ex(e,t,r,l){for(;e.nodeType===1;){var c=r;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[_t])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=bn(e.nextSibling),e===null)break}return null}function Ax(e,t,r){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=bn(e.nextSibling),e===null))return null;return e}function Yp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=bn(e.nextSibling),e===null))return null;return e}function rf(e){return e.data==="$?"||e.data==="$~"}function af(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function jx(e,t){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||r.readyState!=="loading")t();else{var l=function(){t(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function bn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var lf=null;function Gp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(t===0)return bn(e.nextSibling);t--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||t++}e=e.nextSibling}return null}function Vp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(t===0)return e;t--}else r!=="/$"&&r!=="/&"||t++}e=e.previousSibling}return null}function Fp(e,t,r){switch(t=co(r),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Aa(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ui(e)}var xn=new Map,Ip=new Set;function uo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ms=se.d;se.d={f:Ox,r:Tx,D:Nx,C:kx,L:Cx,m:Mx,X:Dx,S:Rx,M:zx};function Ox(){var e=ms.f(),t=to();return e||t}function Tx(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?um(t):ms.r(e)}var dr=typeof document>"u"?null:document;function Jp(e,t,r){var l=dr;if(l&&typeof t=="string"&&t){var c=fn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof r=="string"&&(c+='[crossorigin="'+r+'"]'),Ip.has(c)||(Ip.add(c),e={rel:e,crossOrigin:r,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),kt(t,"link",e),k(t),l.head.appendChild(t)))}}function Nx(e){ms.D(e),Jp("dns-prefetch",e,null)}function kx(e,t){ms.C(e,t),Jp("preconnect",e,t)}function Cx(e,t,r){ms.L(e,t,r);var l=dr;if(l&&e&&t){var c='link[rel="preload"][as="'+fn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(c+='[imagesrcset="'+fn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(c+='[imagesizes="'+fn(r.imageSizes)+'"]')):c+='[href="'+fn(e)+'"]';var u=c;switch(t){case"style":u=mr(e);break;case"script":u=pr(e)}xn.has(u)||(e=w({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),xn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ja(u))||t==="script"&&l.querySelector(Oa(u))||(t=l.createElement("link"),kt(t,"link",e),k(t),l.head.appendChild(t)))}}function Mx(e,t){ms.m(e,t);var r=dr;if(r&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+fn(l)+'"][href="'+fn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=pr(e)}if(!xn.has(u)&&(e=w({rel:"modulepreload",href:e},t),xn.set(u,e),r.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Oa(u)))return}l=r.createElement("link"),kt(l,"link",e),k(l),r.head.appendChild(l)}}}function Rx(e,t,r){ms.S(e,t,r);var l=dr;if(l&&e){var c=A(l).hoistableStyles,u=mr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ja(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},r),(r=xn.get(u))&&of(e,r);var j=p=l.createElement("link");k(j),kt(j,"link",e),j._p=new Promise(function(B,I){j.onload=B,j.onerror=I}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,fo(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function Dx(e,t){ms.X(e,t);var r=dr;if(r&&e){var l=A(r).hoistableScripts,c=pr(e),u=l.get(c);u||(u=r.querySelector(Oa(c)),u||(e=w({src:e,async:!0},t),(t=xn.get(c))&&cf(e,t),u=r.createElement("script"),k(u),kt(u,"link",e),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function zx(e,t){ms.M(e,t);var r=dr;if(r&&e){var l=A(r).hoistableScripts,c=pr(e),u=l.get(c);u||(u=r.querySelector(Oa(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=xn.get(c))&&cf(e,t),u=r.createElement("script"),k(u),kt(u,"link",e),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Qp(e,t,r,l){var c=(c=St.current)?uo(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(t=mr(r.href),r=A(c).hoistableStyles,l=r.get(t),l||(l={type:"style",instance:null,count:0,state:null},r.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=mr(r.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ja(e)))&&!u._p&&(p.instance=u,p.state.loading=5),xn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},xn.set(e,r),u||qx(c,e,r,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=pr(r),r=A(c).hoistableScripts,l=r.get(t),l||(l={type:"script",instance:null,count:0,state:null},r.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function mr(e){return'href="'+fn(e)+'"'}function ja(e){return'link[rel="stylesheet"]['+e+"]"}function Xp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function qx(e,t,r,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),kt(t,"link",r),k(t),e.head.appendChild(t))}function pr(e){return'[src="'+fn(e)+'"]'}function Oa(e){return"script[async]"+e}function Kp(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+fn(r.href)+'"]');if(l)return t.instance=l,k(l),l;var c=w({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),k(l),kt(l,"style",c),fo(l,r.precedence,e),t.instance=l;case"stylesheet":c=mr(r.href);var u=e.querySelector(ja(c));if(u)return t.state.loading|=4,t.instance=u,k(u),u;l=Xp(r),(c=xn.get(c))&&of(l,c),u=(e.ownerDocument||e).createElement("link"),k(u);var p=u;return p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),kt(u,"link",l),t.state.loading|=4,fo(u,r.precedence,e),t.instance=u;case"script":return u=pr(r.src),(c=e.querySelector(Oa(u)))?(t.instance=c,k(c),c):(l=r,(c=xn.get(u))&&(l=w({},r),cf(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),k(c),kt(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,fo(l,r.precedence,e));return t.instance}function fo(e,t,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=r.nodeType===9?r.head:r,t.insertBefore(e,t.firstChild))}function of(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function cf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ho=null;function Zp(e,t,r){if(ho===null){var l=new Map,c=ho=new Map;c.set(r,l)}else c=ho,l=c.get(r),l||(l=new Map,c.set(r,l));if(l.has(e))return l;for(l.set(e,null),r=r.getElementsByTagName(e),c=0;c<r.length;c++){var u=r[c];if(!(u[_t]||u[Xe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Wp(e,t,r){e=e.ownerDocument||e,e.head.insertBefore(r,t==="title"?e.querySelector("head > title"):null)}function Ux(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function e0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Bx(e,t,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var c=mr(l.href),u=t.querySelector(ja(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=mo.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=u,k(u);return}u=t.ownerDocument||t,l=Xp(l),(c=xn.get(c))&&of(l,c),u=u.createElement("link"),k(u);var p=u;p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),kt(u,"link",l),r.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=mo.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var uf=0;function Lx(e,t){return e.stylesheets&&e.count===0&&go(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var l=setTimeout(function(){if(e.stylesheets&&go(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&uf===0&&(uf=62500*xx());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&go(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>uf?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function mo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var po=null;function go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,po=new Map,t.forEach(Hx,e),po=null,mo.call(e))}function Hx(e,t){if(!(t.state.loading&4)){var r=po.get(e);if(r)var l=r.get(null);else{r=new Map,po.set(e,r);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(r.set(p.dataset.precedence,p),l=p)}l&&r.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=r.get(p)||l,u===l&&r.set(null,c),r.set(p,c),this.count++,l=mo.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Ta={$$typeof:fe,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function Px(e,t,r,l,c,u,p,b,j){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=ws(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ws(0),this.hiddenUpdates=ws(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function t0(e,t,r,l,c,u,p,b,j,B,I,ee){return e=new Px(e,t,r,p,j,B,I,ee,b),t=1,u===!0&&(t|=24),u=Qt(3,null,null,t),e.current=u,u.stateNode=e,t=$c(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:r,cache:t},Fc(u),e}function n0(e){return e?(e=Fi,e):Fi}function s0(e,t,r,l,c,u){c=n0(c),l.context===null?l.context=c:l.pendingContext=c,l=Ms(t),l.payload={element:r},u=u===void 0?null:u,u!==null&&(l.callback=u),r=Rs(e,l,t),r!==null&&(Yt(r,e,t),aa(r,e,t))}function i0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function ff(e,t){i0(e,t),(e=e.alternate)&&i0(e,t)}function r0(e){if(e.tag===13||e.tag===31){var t=gi(e,67108864);t!==null&&Yt(t,e,67108864),ff(e,67108864)}}function a0(e){if(e.tag===13||e.tag===31){var t=en();t=Xn(t);var r=gi(e,t);r!==null&&Yt(r,e,t),ff(e,t)}}var yo=!0;function $x(e,t,r,l){var c=$.T;$.T=null;var u=se.p;try{se.p=2,hf(e,t,r,l)}finally{se.p=u,$.T=c}}function Yx(e,t,r,l){var c=$.T;$.T=null;var u=se.p;try{se.p=8,hf(e,t,r,l)}finally{se.p=u,$.T=c}}function hf(e,t,r,l){if(yo){var c=df(l);if(c===null)Ku(e,t,l,bo,r),o0(e,l);else if(Vx(c,e,t,r,l))l.stopPropagation();else if(o0(e,l),t&4&&-1<Gx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=An(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var j=1<<31-Ct(p);b.entanglements[1]|=j,p&=~j}Pn(u),($e&6)===0&&(Wl=nt()+500,wa(0))}}break;case 31:case 13:b=gi(u,2),b!==null&&Yt(b,u,2),to(),ff(u,2)}if(u=df(l),u===null&&Ku(e,t,l,bo,r),u===c)break;c=u}c!==null&&l.stopPropagation()}else Ku(e,t,l,null,r)}}function df(e){return e=mc(e),mf(e)}var bo=null;function mf(e){if(bo=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var r=t.tag;if(r===13){if(e=d(t),e!==null)return e;e=null}else if(r===31){if(e=m(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return bo=e,null}function l0(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(ac()){case al:return 2;case ll:return 8;case Di:case lc:return 32;case ol:return 268435456;default:return 32}default:return 32}}var pf=!1,Gs=null,Vs=null,Fs=null,Na=new Map,ka=new Map,Is=[],Gx="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 o0(e,t){switch(e){case"focusin":case"focusout":Gs=null;break;case"dragenter":case"dragleave":Vs=null;break;case"mouseover":case"mouseout":Fs=null;break;case"pointerover":case"pointerout":Na.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ka.delete(t.pointerId)}}function Ca(e,t,r,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:r,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&r0(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Vx(e,t,r,l,c){switch(t){case"focusin":return Gs=Ca(Gs,e,t,r,l,c),!0;case"dragenter":return Vs=Ca(Vs,e,t,r,l,c),!0;case"mouseover":return Fs=Ca(Fs,e,t,r,l,c),!0;case"pointerover":var u=c.pointerId;return Na.set(u,Ca(Na.get(u)||null,e,t,r,l,c)),!0;case"gotpointercapture":return u=c.pointerId,ka.set(u,Ca(ka.get(u)||null,e,t,r,l,c)),!0}return!1}function c0(e){var t=x(e.target);if(t!==null){var r=f(t);if(r!==null){if(t=r.tag,t===13){if(t=d(r),t!==null){e.blockedOn=t,ul(e.priority,function(){a0(r)});return}}else if(t===31){if(t=m(r),t!==null){e.blockedOn=t,ul(e.priority,function(){a0(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function xo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=df(e.nativeEvent);if(r===null){r=e.nativeEvent;var l=new r.constructor(r.type,r);dc=l,r.target.dispatchEvent(l),dc=null}else return t=S(r),t!==null&&r0(t),e.blockedOn=r,!1;t.shift()}return!0}function u0(e,t,r){xo(e)&&r.delete(t)}function Fx(){pf=!1,Gs!==null&&xo(Gs)&&(Gs=null),Vs!==null&&xo(Vs)&&(Vs=null),Fs!==null&&xo(Fs)&&(Fs=null),Na.forEach(u0),ka.forEach(u0)}function vo(e,t){e.blockedOn===t&&(e.blockedOn=null,pf||(pf=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Fx)))}var _o=null;function f0(e){_o!==e&&(_o=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){_o===e&&(_o=null);for(var t=0;t<e.length;t+=3){var r=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(mf(l||r)===null)continue;break}var u=S(r);u!==null&&(e.splice(t,3),t-=3,hu(u,{pending:!0,data:c,method:r.method,action:l},l,c))}}))}function gr(e){function t(j){return vo(j,e)}Gs!==null&&vo(Gs,e),Vs!==null&&vo(Vs,e),Fs!==null&&vo(Fs,e),Na.forEach(t),ka.forEach(t);for(var r=0;r<Is.length;r++){var l=Is[r];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Is.length&&(r=Is[0],r.blockedOn===null);)c0(r),r.blockedOn===null&&Is.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var c=r[l],u=r[l+1],p=c[ot]||null;if(typeof u=="function")p||f0(r);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[ot]||null)b=p.formAction;else if(mf(c)!==null)continue}else b=p.action;typeof b=="function"?r[l+1]=b:(r.splice(l,3),l-=3),f0(r)}}}function h0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function gf(e){this._internalRoot=e}wo.prototype.render=gf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var r=t.current,l=en();s0(r,l,e,t,null,null)},wo.prototype.unmount=gf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;s0(e.current,2,null,e,null,null),to(),t[It]=null}};function wo(e){this._internalRoot=e}wo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yr();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Is.length&&t!==0&&t<Is[r].priority;r++);Is.splice(r,0,e),r===0&&c0(e)}};var d0=n.version;if(d0!=="19.2.4")throw Error(a(527,d0,"19.2.4"));se.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var Ix={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var So=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!So.isDisabled&&So.supportsFiber)try{li=So.inject(Ix),ft=So}catch{}}return Ma.createRoot=function(e,t){if(!o(e))throw Error(a(299));var r=!1,l="",c=vm,u=_m,p=wm;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=t0(e,1,!1,null,null,r,l,null,c,u,p,h0),e[It]=t.current,Xu(e),new gf(t)},Ma.hydrateRoot=function(e,t,r){if(!o(e))throw Error(a(299));var l=!1,c="",u=vm,p=_m,b=wm,j=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(u=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError),r.formState!==void 0&&(j=r.formState)),t=t0(e,1,!0,t,r??null,l,c,j,u,p,b,h0),t.context=n0(null),r=t.current,l=en(),l=Xn(l),c=Ms(l),c.callback=null,Rs(r,c,l),r=l,t.current.lanes=r,jn(t,r),Pn(t),e[It]=t.current,Xu(e),new wo(t)},Ma.version="19.2.4",Ma}var _0;function Cv(){if(_0)return yf.exports;_0=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),yf.exports=kv(),yf.exports}var Mv=Cv();const Rv="modulepreload",Dv=function(i,n){return new URL(i,n).href},w0={},Ee=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let d=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(T=>({status:"fulfilled",value:T}),T=>({status:"rejected",reason:T}))))};const m=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=d(s.map(E=>{if(E=Dv(E,a),E in w0)return;w0[E]=!0;const w=E.endsWith(".css"),T=w?'[rel="stylesheet"]':"";if(!!a)for(let q=m.length-1;q>=0;q--){const Q=m[q];if(Q.href===E&&(!w||Q.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${T}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":Rv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((q,Q)=>{M.addEventListener("load",q),M.addEventListener("error",()=>Q(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return o.then(d=>{for(const m of d||[])m.status==="rejected"&&f(m.reason);return n().catch(f)})};function ah(i){try{const n=i.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function Rg(i){const n=ah(i);return!n||typeof n.exp!="number"?null:n.exp}function lh(i,n=0){const s=Rg(i);return s===null?!0:Date.now()/1e3>=s-n}const Vt=window.__LT_BASE__??"",qf=`${Vt}/api`;let Ks=null;function Eo(i){Ks=i}function Dg(){return Ks}async function S0(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:n,password:s}=JSON.parse(i),a=await fetch(`${qf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Qs=null;async function Ye(i,n={}){const s={"Content-Type":"application/json",...n.headers};if(Ks){if(lh(Ks)){Qs||(Qs=S0().finally(()=>{Qs=null}));const o=await Qs;if(o)Ks=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Ks}`}let a=await fetch(`${qf}${i}`,{...n,headers:s});if(a.status===401&&Ks){Qs||(Qs=S0().finally(()=>{Qs=null}));const o=await Qs;if(o&&(Ks=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${qf}${i}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const zg=O.createContext(null),zv=300;function vf(i,n){if(lh(i))return null;const s=ah(i);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function qv({children:i}){const[n,s]=O.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?lh(w)?(sessionStorage.removeItem("lt_token"),null):(Eo(w),vf(w)):null}),a=O.useRef(void 0),o=O.useCallback(w=>{clearTimeout(a.current);const T=Rg(w);if(!T)return;const z=(T-zv)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{try{const M=ah(w);if(M!=null&&M.sso){const re=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const N=await re.json();N.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:N.token}}));return}const q=sessionStorage.getItem("lt_credentials");if(!q)return;const{username:Q,password:W}=JSON.parse(q),te=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:Q,password:W})});if(!te.ok)return;const fe=await te.json();fe.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:fe.token}}))}catch{}},z))},[]),f=O.useCallback((w,T,z)=>{const M={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(T==null?void 0:T.username)??null},q=vf(w,M);q&&(Eo(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),T&&sessionStorage.setItem("lt_credentials",JSON.stringify(T)),s(q),o(w))},[o]),d=O.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");Eo(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);O.useEffect(()=>{const w=()=>d(),T=z=>{var Q;const M=(Q=z.detail)==null?void 0:Q.token;if(!M)return;const q=vf(M);q&&(Eo(M),sessionStorage.setItem("lt_token",M),s(q),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",T),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",T)}},[d,o]),O.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const m=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=O.useCallback(w=>(n==null?void 0:n.roles.some(T=>T.role===w))??!1,[n]),y=O.useCallback(w=>(n==null?void 0:n.roles.some(T=>T.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return h.jsx(zg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:m,login:f,logout:d,hasRole:g,hasRoleType:y,userRoleNames:E},children:i})}function ai(){const i=O.useContext(zg);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const an=new Uint8Array(0),Ci=new TextEncoder,sn=new TextDecoder;function Uv(...i){let n=0;for(let o=0;o<i.length;o++)n+=i[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<i.length;o++)s.set(i[o],a),a+=i[o].length;return s}function Ya(...i){const n=[];for(let s=0;s<i.length;s++)n.push(Ci.encode(i[s]));return n.length===0?an:n.length===1?n[0]:Uv(...n)}function E0(i){return!i||i.length===0?"":sn.decode(i)}const A0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",j0=36,Bv=0xcfd41b9100000,O0=33,Lv=333,T0=22;function Hv(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*255)}function Pv(i){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(i):Hv(i)}class $v{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(T0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Bv),this.inc=Math.floor(Math.random()*(Lv-O0)+O0)}setPre(){const n=new Uint8Array(12);Pv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=A0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=T0-1;s>=12;s--)this.buf[s]=A0.charCodeAt(n%j0),n=Math.floor(n/j0)}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 si=new $v;var ps;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(ps||(ps={}));var jr;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(jr||(jr={}));var le;(function(i){i.ApiError="BAD API",i.BadAuthentication="BAD_AUTHENTICATION",i.BadCreds="BAD_CREDS",i.BadHeader="BAD_HEADER",i.BadJson="BAD_JSON",i.BadPayload="BAD_PAYLOAD",i.BadSubject="BAD_SUBJECT",i.Cancelled="CANCELLED",i.ConnectionClosed="CONNECTION_CLOSED",i.ConnectionDraining="CONNECTION_DRAINING",i.ConnectionRefused="CONNECTION_REFUSED",i.ConnectionTimeout="CONNECTION_TIMEOUT",i.Disconnect="DISCONNECT",i.InvalidOption="INVALID_OPTION",i.InvalidPayload="INVALID_PAYLOAD",i.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",i.NoResponders="503",i.NotFunction="NOT_FUNC",i.RequestError="REQUEST_ERROR",i.ServerOptionNotAvailable="SERVER_OPT_NA",i.SubClosed="SUB_CLOSED",i.SubDraining="SUB_DRAINING",i.Timeout="TIMEOUT",i.Tls="TLS",i.Unknown="UNKNOWN_ERROR",i.WssRequired="WSS_REQUIRED",i.JetStreamInvalidAck="JESTREAM_INVALID_ACK",i.JetStream404NoMessages="404",i.JetStream408RequestTimeout="408",i.JetStream409MaxAckPendingExceeded="409",i.JetStream409="409",i.JetStreamNotEnabled="503",i.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",i.AuthorizationViolation="AUTHORIZATION_VIOLATION",i.AuthenticationExpired="AUTHENTICATION_EXPIRED",i.ProtocolError="NATS_PROTOCOL_ERR",i.PermissionsViolation="PERMISSIONS_VIOLATION",i.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",i.AccountExpired="ACCOUNT_EXPIRED"})(le||(le={}));function Yv(i){return typeof i.code=="string"}class qg{constructor(){v(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(n){return Gv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const Gv=new qg;class de extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=qg.getMessage(s);return new de(o,s,a)}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 tn;(function(i){i[i.Exact=0]="Exact",i[i.CanonicalMIME=1]="CanonicalMIME",i[i.IgnoreCase=2]="IgnoreCase"})(tn||(tn={}));var Dn;(function(i){i.Timer="timer",i.Count="count",i.JitterTimer="jitterTimer",i.SentinelMsg="sentinelMsg"})(Dn||(Dn={}));var Ga;(function(i){i.STATS="io.nats.micro.v1.stats_response",i.INFO="io.nats.micro.v1.info_response",i.PING="io.nats.micro.v1.ping_response"})(Ga||(Ga={}));const Yo="Nats-Service-Error",Go="Nats-Service-Error-Code";class Vo extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Vo.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Go))||"";if(a!==""){const d=parseInt(a)||400,m=((f=s==null?void 0:s.headers)==null?void 0:f.get(Yo))||"";return new Vo(d,m.length?m:a)}return null}}function gs(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${si.next()}`}const Uf="127.0.0.1";var Zs;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(Zs||(Zs={}));function ec(i,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){i[o]=a[o]})}return i}function Ao(i){return sn.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Cr(i,n=!0){const s=n?de.errorForCode(le.Timeout):null;let a,o;const f=new Promise((d,m)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(s===null?de.errorForCode(le.Timeout):s)},i)});return Object.assign(f,a)}function zr(i=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},i);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function rt(){let i={};const n=new Promise((s,a)=>{i={resolve:s,reject:a}});return Object.assign(n,i)}function Ug(i){for(let n=i.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[i[n],i[s]]=[i[s],i[n]]}return i}function Vv(i){return i===0?0:Math.floor(i/2+Math.random()*i)}function oh(i=[0,250,250,500,500,3e3,5e3]){Array.isArray(i)||(i=[0,250,250,500,500,3e3,5e3]);const n=i.length-1;return{backoff(s){return Vv(s>n?i[n]:i[s])}}}function it(i){return i*1e6}function ch(i){return Math.floor(i/1e6)}function N0(i){let a=!0;const o=new Array(i.length);for(let f=0;f<i.length;f++){let d=i.charCodeAt(f);if(d===58||d<33||d>126)throw new de(`'${i[f]}' is not a valid character for a header key`,le.BadHeader);a&&97<=d&&d<=122?d-=32:!a&&65<=d&&d<=90&&(d+=32),o[f]=d,a=d==45}return String.fromCharCode(...o)}function ys(i=0,n=""){if(i===0&&n!==""||i>0&&n==="")throw new Error("setting status requires both code and description");return new Ws(i,n)}const _f="NATS/1.0";class Ws{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),d=[...o].sort();for(let m=0;m<f.length;m++)if(f[m]!==d[m])return!1}return!0}return!1}static decode(n){const s=new Ws,o=sn.decode(n).split(`\r
|
|
27
|
-
`),f=o[0];if(f!==_f){let d=f.replace(_f,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const m=s._code.toString();d=d.replace(m,""),s._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const m=d.indexOf(":");if(m>-1){const g=d.slice(0,m),y=d.slice(m+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=_f;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
|
|
28
|
-
${s}: ${a[o]}`;return`${n}\r
|
|
29
|
-
\r
|
|
30
|
-
`}encode(){return Ci.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new de("invalid header value - \\r and \\n are not allowed.",le.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=tn.Exact){const a=this.keys();switch(s){case tn.Exact:return a.filter(o=>o===n);case tn.CanonicalMIME:return n=N0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=tn.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=tn.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=tn.Exact){return this.findKeys(n,s).length>0}set(n,s,a=tn.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=tn.Exact){const o=N0(n);a===tn.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const d=Ws.validHeaderValue(s);let m=this.headers.get(n);m||(m=[],this.headers.set(n,m)),m.push(d)}values(n,s=tn.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const d=this.headers.get(f);d&&a.push(...d)}),a}delete(n,s=tn.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Ws;for(const a in n)s.headers.set(a,n[a]);return s}}function Bf(){return{encode(i){return Ci.encode(i)},decode(i){return sn.decode(i)}}}function zn(i){return{encode(n){try{return n===void 0&&(n=null),Ci.encode(JSON.stringify(n))}catch(s){throw de.errorForCode(le.BadJson,s)}},decode(n){try{return JSON.parse(sn.decode(n),i)}catch(s){throw de.errorForCode(le.BadJson,s)}}}}function Bg(i){var n;return i&&i.data.length===0&&((n=i.headers)==null?void 0:n.code)===503?de.errorForCode(le.NoResponders):null}class uh{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=sn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=sn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Ws.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=an,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return zn(n).decode(this.data)}string(){return sn.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(uh,"jc");function Or(i){return tc("durable",i)}function zt(i){return tc("stream",i)}function tc(i,n=""){if(n==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
|
-
`,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
|
|
32
|
-
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${i} name - ${i} name cannot contain '${a}'`)}}),""}function La(i,n=""){if(n==="")throw Error(`${i} name required`);const s=Fv(n);if(s.length)throw new Error(`invalid ${i} name - ${i} name ${s}`)}function Fv(i=""){if(i==="")throw Error("name required");const n=/^[-\w]+$/g;if(i.match(n)===null){for(const a of i.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Lf(i){if(i.data.length>0)return!1;const n=i.headers;return n?n.code>=100&&n.code<200:!1}function Hf(i){var n;return Lf(i)&&((n=i.headers)==null?void 0:n.description)==="Idle Heartbeat"}function Iv(i,n,s){const a=ys(i,n),o={hdr:1,sid:0,size:0},f=new uh(o,an,{});return f._headers=a,f._subject=s,f}function Tr(i){if(i.data.length!==0)return null;const n=i.headers;return n?Lg(n.code,n.description):null}var _n;(function(i){i.MaxBatchExceeded="exceeded maxrequestbatch of",i.MaxExpiresExceeded="exceeded maxrequestexpires of",i.MaxBytesExceeded="exceeded maxrequestmaxbytes of",i.MaxMessageSizeExceeded="message size exceeds maxbytes",i.PushConsumer="consumer is push based",i.MaxWaitingExceeded="exceeded maxwaiting",i.IdleHeartbeatMissed="idle heartbeats missed",i.ConsumerDeleted="consumer deleted"})(_n||(_n={}));function Jv(i){return i.code!==le.JetStream409?!1:[_n.MaxBatchExceeded,_n.MaxExpiresExceeded,_n.MaxBytesExceeded,_n.MaxMessageSizeExceeded,_n.PushConsumer,_n.IdleHeartbeatMissed,_n.ConsumerDeleted].find(s=>i.message.indexOf(s)!==-1)!==void 0}function Lg(i,n=""){if(i<300)return null;switch(n=n.toLowerCase(),i){case 404:return new de(n,le.JetStream404NoMessages);case 408:return new de(n,le.JetStream408RequestTimeout);case 409:{const s=n.startsWith(_n.IdleHeartbeatMissed)?le.JetStreamIdleHeartBeat:le.JetStream409;return new de(n,s)}case 503:return de.errorForCode(le.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=le.Unknown),new de(n,`${i}`)}}class jt{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(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=rt(),this.yields=[],this.iterClosed=rt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new de("unsupported iterator",le.ApiError);if(this.yielding)throw new de("already yielding",le.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=rt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class fh{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.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(n,s=0,a=2){this.interval=n,this.maxOut=a,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(n){console.log(n)}},this.interval)}}var Pf;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})(Pf||(Pf={}));var Ja;(function(i){i.Old="old",i.New="new"})(Ja||(Ja={}));var $f;(function(i){i.File="file",i.Memory="memory"})($f||($f={}));var mt;(function(i){i.All="all",i.Last="last",i.New="new",i.StartSequence="by_start_sequence",i.StartTime="by_start_time",i.LastPerSubject="last_per_subject"})(mt||(mt={}));var At;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(At||(At={}));var Mr;(function(i){i.Instant="instant",i.Original="original"})(Mr||(Mr={}));var ii;(function(i){i.None="none",i.S2="s2"})(ii||(ii={}));var Fo;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Fo||(Fo={}));function Qv(i,n={}){return Object.assign({name:i,deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Mr.Instant},n)}var k0;(function(i){i.API="api_audit",i.StreamAction="stream_action",i.ConsumerAction="consumer_action",i.SnapshotCreate="snapshot_create",i.SnapshotComplete="snapshot_complete",i.RestoreCreate="restore_create",i.RestoreComplete="restore_complete",i.MaxDeliver="max_deliver",i.Terminated="terminated",i.Ack="consumer_ack",i.StreamLeaderElected="stream_leader_elected",i.StreamQuorumLost="stream_quorum_lost",i.ConsumerLeaderElected="consumer_leader_elected",i.ConsumerQuorumLost="consumer_quorum_lost"})(k0||(k0={}));var Ut;(function(i){i.StreamSourceHdr="Nats-Stream-Source",i.LastConsumerSeqHdr="Nats-Last-Consumer",i.LastStreamSeqHdr="Nats-Last-Stream",i.ConsumerStalledHdr="Nats-Consumer-Stalled",i.MessageSizeHdr="Nats-Msg-Size",i.RollupHdr="Nats-Rollup",i.RollupValueSubject="sub",i.RollupValueAll="all",i.PendingMessagesHdr="Nats-Pending-Messages",i.PendingBytesHdr="Nats-Pending-Bytes"})(Ut||(Ut={}));var Mn;(function(i){i.LastValue="",i.AllHistory="history",i.UpdatesOnly="updates"})(Mn||(Mn={}));var wr;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(wr||(wr={}));var C0;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(C0||(C0={}));const nn="KV_";class Xv{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Qv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?At.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return Or(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=mt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=mt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=mt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=mt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=mt.Last,this}deliverNew(){return this.config.deliver_policy=mt.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=At.None,this}ackAll(){return this.config.ack_policy=At.All,this}ackExplicit(){return this.config.ack_policy=At.Explicit,this}ackWait(n){return this.config.ack_wait=it(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Mr.Instant,this}replayOriginal(){return this.config.replay_policy=Mr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=it(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=it(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=it(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function ei(i){return new Xv(i)}function M0(i){return typeof i.getOpts=="function"}class Kv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class Nr{static encode(n){return Nr.toB64URLEncoding(Kv.encode(n))}static decode(n,s=!1){return Nr.decode(Nr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Rr{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),Ci.encode(n)}static toAscii(n){return sn.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Zv(i,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in i)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(i,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(i)}var Wv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Ra=Wv.performance||{};Ra.now||Ra.mozNow||Ra.msNow||Ra.oNow||Ra.webkitNow;var R0={versions:{}},e1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function t1(i){if(i.__esModule)return i;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(s){var a=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return i[s]}})}),n}var wf,nc={exports:{}},D0={},z0=t1(Zv({__proto__:null,default:D0},[D0]));wf=nc,(function(){var i="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&R0.versions&&R0.versions.node;o?s=e1:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&wf.exports,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",m="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[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],w=["hex","array","digest","arrayBuffer"],T=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(N){return Object.prototype.toString.call(N)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(N){return typeof N=="object"&&N.buffer&&N.buffer.constructor===ArrayBuffer});var z=function(N,V){return function(ae){return new te(V,!0).update(ae)[N]()}},M=function(N){var V=z("hex",N);o&&(V=q(V,N)),V.create=function(){return new te(N)},V.update=function(F){return V.create().update(F)};for(var ae=0;ae<w.length;++ae){var P=w[ae];V[P]=z(P,N)}return V},q=function(N,V){var ae,P=z0,F=z0.Buffer,X=V?"sha224":"sha256";return ae=F.from&&!s.JS_SHA256_NO_BUFFER_FROM?F.from:function(oe){return new F(oe)},function(oe){if(typeof oe=="string")return P.createHash(X).update(oe,"utf8").digest("hex");if(oe==null)throw new Error(i);return oe.constructor===ArrayBuffer&&(oe=new Uint8Array(oe)),Array.isArray(oe)||ArrayBuffer.isView(oe)||oe.constructor===F?P.createHash(X).update(ae(oe)).digest("hex"):N(oe)}},Q=function(N,V){return function(ae,P){return new fe(ae,V,!0).update(P)[N]()}},W=function(N){var V=Q("hex",N);V.create=function(F){return new fe(F,N)},V.update=function(F,X){return V.create(F).update(X)};for(var ae=0;ae<w.length;++ae){var P=w[ae];V[P]=Q(P,N)}return V};function te(N,V){V?(T[0]=T[16]=T[1]=T[2]=T[3]=T[4]=T[5]=T[6]=T[7]=T[8]=T[9]=T[10]=T[11]=T[12]=T[13]=T[14]=T[15]=0,this.blocks=T):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],N?(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=N}function fe(N,V,ae){var P,F=typeof N;if(F==="string"){var X,oe=[],ie=N.length,Ne=0;for(P=0;P<ie;++P)(X=N.charCodeAt(P))<128?oe[Ne++]=X:X<2048?(oe[Ne++]=192|X>>>6,oe[Ne++]=128|63&X):X<55296||X>=57344?(oe[Ne++]=224|X>>>12,oe[Ne++]=128|X>>>6&63,oe[Ne++]=128|63&X):(X=65536+((1023&X)<<10|1023&N.charCodeAt(++P)),oe[Ne++]=240|X>>>18,oe[Ne++]=128|X>>>12&63,oe[Ne++]=128|X>>>6&63,oe[Ne++]=128|63&X);N=oe}else{if(F!=="object")throw new Error(i);if(N===null)throw new Error(i);if(d&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!(Array.isArray(N)||d&&ArrayBuffer.isView(N)))throw new Error(i)}N.length>64&&(N=new te(V,!0).update(N).array());var Ue=[],Te=[];for(P=0;P<64;++P){var $=N[P]||0;Ue[P]=92^$,Te[P]=54^$}te.call(this,V,ae),this.update(Te),this.oKeyPad=Ue,this.inner=!0,this.sharedMemory=ae}te.prototype.update=function(N){if(!this.finalized){var V,ae=typeof N;if(ae!=="string"){if(ae!=="object")throw new Error(i);if(N===null)throw new Error(i);if(d&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!(Array.isArray(N)||d&&ArrayBuffer.isView(N)))throw new Error(i);V=!0}for(var P,F,X=0,oe=N.length,ie=this.blocks;X<oe;){if(this.hashed&&(this.hashed=!1,ie[0]=this.block,this.block=ie[16]=ie[1]=ie[2]=ie[3]=ie[4]=ie[5]=ie[6]=ie[7]=ie[8]=ie[9]=ie[10]=ie[11]=ie[12]=ie[13]=ie[14]=ie[15]=0),V)for(F=this.start;X<oe&&F<64;++X)ie[F>>>2]|=N[X]<<y[3&F++];else for(F=this.start;X<oe&&F<64;++X)(P=N.charCodeAt(X))<128?ie[F>>>2]|=P<<y[3&F++]:P<2048?(ie[F>>>2]|=(192|P>>>6)<<y[3&F++],ie[F>>>2]|=(128|63&P)<<y[3&F++]):P<55296||P>=57344?(ie[F>>>2]|=(224|P>>>12)<<y[3&F++],ie[F>>>2]|=(128|P>>>6&63)<<y[3&F++],ie[F>>>2]|=(128|63&P)<<y[3&F++]):(P=65536+((1023&P)<<10|1023&N.charCodeAt(++X)),ie[F>>>2]|=(240|P>>>18)<<y[3&F++],ie[F>>>2]|=(128|P>>>12&63)<<y[3&F++],ie[F>>>2]|=(128|P>>>6&63)<<y[3&F++],ie[F>>>2]|=(128|63&P)<<y[3&F++]);this.lastByteIndex=F,this.bytes+=F-this.start,F>=64?(this.block=ie[16],this.start=F-64,this.hash(),this.hashed=!0):this.start=F}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},te.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var N=this.blocks,V=this.lastByteIndex;N[16]=this.block,N[V>>>2]|=g[3&V],this.block=N[16],V>=56&&(this.hashed||this.hash(),N[0]=this.block,N[16]=N[1]=N[2]=N[3]=N[4]=N[5]=N[6]=N[7]=N[8]=N[9]=N[10]=N[11]=N[12]=N[13]=N[14]=N[15]=0),N[14]=this.hBytes<<3|this.bytes>>>29,N[15]=this.bytes<<3,this.hash()}},te.prototype.hash=function(){var N,V,ae,P,F,X,oe,ie,Ne,Ue=this.h0,Te=this.h1,$=this.h2,se=this.h3,he=this.h4,Ae=this.h5,ve=this.h6,G=this.h7,ge=this.blocks;for(N=16;N<64;++N)V=((F=ge[N-15])>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,ae=((F=ge[N-2])>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,ge[N]=ge[N-16]+V+ge[N-7]+ae|0;for(Ne=Te&$,N=0;N<64;N+=4)this.first?(this.is224?(X=300032,G=(F=ge[0]-1413257819)-150054599|0,se=F+24177077|0):(X=704751109,G=(F=ge[0]-210244248)-1521486534|0,se=F+143694565|0),this.first=!1):(V=(Ue>>>2|Ue<<30)^(Ue>>>13|Ue<<19)^(Ue>>>22|Ue<<10),P=(X=Ue&Te)^Ue&$^Ne,G=se+(F=G+(ae=(he>>>6|he<<26)^(he>>>11|he<<21)^(he>>>25|he<<7))+(he&Ae^~he&ve)+E[N]+ge[N])|0,se=F+(V+P)|0),V=(se>>>2|se<<30)^(se>>>13|se<<19)^(se>>>22|se<<10),P=(oe=se&Ue)^se&Te^X,ve=$+(F=ve+(ae=(G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7))+(G&he^~G&Ae)+E[N+1]+ge[N+1])|0,V=(($=F+(V+P)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),P=(ie=$&se)^$&Ue^oe,Ae=Te+(F=Ae+(ae=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&G^~ve&he)+E[N+2]+ge[N+2])|0,V=((Te=F+(V+P)|0)>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),P=(Ne=Te&$)^Te&se^ie,he=Ue+(F=he+(ae=(Ae>>>6|Ae<<26)^(Ae>>>11|Ae<<21)^(Ae>>>25|Ae<<7))+(Ae&ve^~Ae&G)+E[N+3]+ge[N+3])|0,Ue=F+(V+P)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ue|0,this.h1=this.h1+Te|0,this.h2=this.h2+$|0,this.h3=this.h3+se|0,this.h4=this.h4+he|0,this.h5=this.h5+Ae|0,this.h6=this.h6+ve|0,this.h7=this.h7+G|0},te.prototype.hex=function(){this.finalize();var N=this.h0,V=this.h1,ae=this.h2,P=this.h3,F=this.h4,X=this.h5,oe=this.h6,ie=this.h7,Ne=m[N>>>28&15]+m[N>>>24&15]+m[N>>>20&15]+m[N>>>16&15]+m[N>>>12&15]+m[N>>>8&15]+m[N>>>4&15]+m[15&N]+m[V>>>28&15]+m[V>>>24&15]+m[V>>>20&15]+m[V>>>16&15]+m[V>>>12&15]+m[V>>>8&15]+m[V>>>4&15]+m[15&V]+m[ae>>>28&15]+m[ae>>>24&15]+m[ae>>>20&15]+m[ae>>>16&15]+m[ae>>>12&15]+m[ae>>>8&15]+m[ae>>>4&15]+m[15&ae]+m[P>>>28&15]+m[P>>>24&15]+m[P>>>20&15]+m[P>>>16&15]+m[P>>>12&15]+m[P>>>8&15]+m[P>>>4&15]+m[15&P]+m[F>>>28&15]+m[F>>>24&15]+m[F>>>20&15]+m[F>>>16&15]+m[F>>>12&15]+m[F>>>8&15]+m[F>>>4&15]+m[15&F]+m[X>>>28&15]+m[X>>>24&15]+m[X>>>20&15]+m[X>>>16&15]+m[X>>>12&15]+m[X>>>8&15]+m[X>>>4&15]+m[15&X]+m[oe>>>28&15]+m[oe>>>24&15]+m[oe>>>20&15]+m[oe>>>16&15]+m[oe>>>12&15]+m[oe>>>8&15]+m[oe>>>4&15]+m[15&oe];return this.is224||(Ne+=m[ie>>>28&15]+m[ie>>>24&15]+m[ie>>>20&15]+m[ie>>>16&15]+m[ie>>>12&15]+m[ie>>>8&15]+m[ie>>>4&15]+m[15&ie]),Ne},te.prototype.toString=te.prototype.hex,te.prototype.digest=function(){this.finalize();var N=this.h0,V=this.h1,ae=this.h2,P=this.h3,F=this.h4,X=this.h5,oe=this.h6,ie=this.h7,Ne=[N>>>24&255,N>>>16&255,N>>>8&255,255&N,V>>>24&255,V>>>16&255,V>>>8&255,255&V,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,P>>>24&255,P>>>16&255,P>>>8&255,255&P,F>>>24&255,F>>>16&255,F>>>8&255,255&F,X>>>24&255,X>>>16&255,X>>>8&255,255&X,oe>>>24&255,oe>>>16&255,oe>>>8&255,255&oe];return this.is224||Ne.push(ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie),Ne},te.prototype.array=te.prototype.digest,te.prototype.arrayBuffer=function(){this.finalize();var N=new ArrayBuffer(this.is224?28:32),V=new DataView(N);return V.setUint32(0,this.h0),V.setUint32(4,this.h1),V.setUint32(8,this.h2),V.setUint32(12,this.h3),V.setUint32(16,this.h4),V.setUint32(20,this.h5),V.setUint32(24,this.h6),this.is224||V.setUint32(28,this.h7),N},fe.prototype=new te,fe.prototype.finalize=function(){if(te.prototype.finalize.call(this),this.inner){this.inner=!1;var N=this.array();te.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(N),te.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=W(),re.sha224.hmac=W(!0),f?wf.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();nc.exports;nc.exports.sha224;var q0=nc.exports.sha256;function Yf(i){return l1(i)}function n1(i){if(!/^[0-9A-Fa-f]+$/.test(i))return!1;const s=/^[0-9A-F]+$/.test(i),a=/^[0-9a-f]+$/.test(i);return s||a?i.length%2===0:!1}function s1(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function i1(i){return n1(i)?"hex":s1(i)?"b64":""}function r1(i){if(i.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(i.length/2);for(let s=0;s<i.length;s+=2)n[s/2]=parseInt(i.substring(s,s+2),16);return n}function a1(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const n=atob(i);return Uint8Array.from(n,s=>s.charCodeAt(0))}function l1(i){switch(i1(i)){case"hex":return r1(i);case"b64":return a1(i)}return null}function o1(i,n){const s=typeof i=="string"?Yf(i):i,a=typeof n=="string"?Yf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class Hg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=si.next(),a&&(this.ctx=new Error)}}class c1 extends Hg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=rt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
33
|
-
|
|
34
|
-
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Dn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Dn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Dn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class Pg extends Hg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=rt(),this.timer=Cr(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
|
-
|
|
36
|
-
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||de.errorForCode(le.Cancelled))}}const u1="$JS.API";function f1(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),ec({apiPrefix:u1,timeout:5e3},i)}class Wa{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=f1(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=zn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=an;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const d=oh();for(let m=0;m<f;m++)try{const g=await this.nc.request(n,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===le.Timeout)&&m+1<f)await zr(d.backoff(m));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=Lg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Ha{constructor(n,s,a,o){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function ki(i=""){const n=i.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${i}' is not a semver value`)}function Gf(i,n){return i.major<n.major?-1:i.major>n.major?1:i.minor<n.minor?-1:i.minor>n.minor?1:i.micro<n.micro?-1:i.micro>n.micro?1:0}var Be;(function(i){i.JS_KV="js_kv",i.JS_OBJECTSTORE="js_objectstore",i.JS_PULL_MAX_BYTES="js_pull_max_bytes",i.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",i.JS_ALLOW_DIRECT="js_allow_direct",i.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",i.JS_SIMPLIFICATION="js_simplification",i.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",i.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",i.JS_STREAM_FIRST_SEQ="js_stream_first_seq",i.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",i.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",i.JS_STREAM_COMPRESSION="js_stream_compression",i.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",i.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Be||(Be={}));class h1{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=ki(n)),this.server=n,this.set(Be.JS_KV,"2.6.2"),this.set(Be.JS_OBJECTSTORE,"2.6.3"),this.set(Be.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Be.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Be.JS_ALLOW_DIRECT,"2.9.0"),this.set(Be.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Be.JS_SIMPLIFICATION,"2.9.4"),this.set(Be.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Be.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Be.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Be.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Be.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Be.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Be.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Be.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:Gf(this.server,ki(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=ki(n)),Gf(this.server,n)>=0}}class Io extends Wa{constructor(n,s){super(n,s)}async add(n,s,a=Fo.Create){if(zt(n),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 o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&Or(o.config.durable_name);const f=this.nc;let{min:d,ok:m}=f.features.get(Be.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!m)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{tc("name",g)}catch(T){const z=T.message,M=z.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${z.substring(M)}`):T}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:T,ok:z}=f.features.get(Be.JS_MULTIPLE_CONSUMER_FILTER);if(!z)throw new Error(`consumer 'filter_subjects' requires server ${T}`);m=!1}if(s.metadata){const{min:T,ok:z}=f.features.get(Be.JS_STREAM_CONSUMER_METADATA);if(!z)throw new Error(`consumer 'metadata' requires server ${T}`)}if(m&&(E=s.name??s.durable_name??""),E!==""){let T=s.filter_subject??void 0;T===">"&&(T=void 0),y=T!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${T}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Fo.Update)}async info(n,s){return zt(n),Or(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return zt(n),Or(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){zt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Ha(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function yr(i,n,s=!1){if(s===!0&&!i)throw de.errorForCode(le.ApiError,new Error(`${n} is not a function`));if(i&&typeof i!="function")throw de.errorForCode(le.ApiError,new Error(`${n} is not a function`))}class d1 extends jt{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");yr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&yr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(yr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(yr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(yr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&yr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,T)=>{const[z,M]=this.adapter(w,T);if(z){E(z,null);return}const{ingest:q}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};q&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(z,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:d,queue:m,timeout:g}=o,y={queue:m,timeout:g,callback:f};d&&d>0&&(y.max=d),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=rt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async E=>{await E.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,a){this.sub.cancelTimeout();const[o,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}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 rn;function m1(i){rn=i}function $g(){return rn!==void 0&&rn.defaultPort!==void 0?rn.defaultPort:4222}function Sf(){return rn!==void 0&&rn.urlParseFn?rn.urlParseFn:void 0}function p1(){if(!rn||typeof rn.factory!="function")throw new Error("transport fn is not set");return rn.factory()}function Vf(){return rn!==void 0&&rn.dnsResolveFn?rn.dnsResolveFn:void 0}const zo=`\r
|
|
37
|
-
`,Jo=Rr.fromAscii(zo),g1=new Uint8Array(Jo)[0],y1=new Uint8Array(Jo)[1];function b1(i){for(let n=0;n<i.length;n++){const s=n+1;if(i.byteLength>s&&i[n]===g1&&i[s]===y1)return s+1}return 0}function x1(i){const n=b1(i);if(n>0){const a=new Uint8Array(i).slice(0,n);return sn.decode(a)}return""}const v1=4,Yg=48,_1=65,w1=97;function S1(i,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,m)=>{o[m]=d}),o[12]=i,o[13]=n,o[14]=s,o[15]=a,o}function Ff(i){return E1(i)!==void 0}function E1(i){for(let n=0;n<i.length;n++)switch(i[n]){case".":return Gg(i);case":":return A1(i)}}function Gg(i){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(i.length===0)return;if(s>0){if(i[0]!==".")return;i=i.substring(1)}const{n:a,c:o,ok:f}=j1(i);if(!f||a>255)return;i=i.substring(o),n[s]=a}return S1(n[0],n[1],n[2],n[3])}function A1(i){const n=new Uint8Array(16);let s=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(s=0,i=i.substring(2),i.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:d}=O1(i);if(!d||o>65535)return;if(f<i.length&&i[f]==="."){if(s<0&&a!=12||a+4>16)return;const m=Gg(i);if(m===void 0)return;n[a]=m[12],n[a+1]=m[13],n[a+2]=m[14],n[a+3]=m[15],i="",a+=v1;break}if(n[a]=o>>8,n[a+1]=o,a+=2,i=i.substring(f),i.length===0)break;if(i[0]!==":"||i.length==1)return;if(i=i.substring(1),i[0]===":"){if(s>=0)return;if(s=a,i=i.substring(1),i.length===0)break}}if(i.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function j1(i){let n=0,s=0;for(n=0;n<i.length&&48<=i.charCodeAt(n)&&i.charCodeAt(n)<=57;n++)if(s=s*10+(i.charCodeAt(n)-Yg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function O1(i){let n=0,s=0;for(s=0;s<i.length;s++){if(48<=i.charCodeAt(s)&&i.charCodeAt(s)<=57)n*=16,n+=i.charCodeAt(s)-Yg;else if(97<=i.charCodeAt(s)&&i.charCodeAt(s)<=102)n*=16,n+=i.charCodeAt(s)-w1+10;else if(65<=i.charCodeAt(s)&&i.charCodeAt(s)<=70)n*=16,n+=i.charCodeAt(s)-_1+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function T1(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function If(i){return!T1(i)}function N1(i){const n="::FFFF:",s=i.toUpperCase().indexOf(n);if(s!==-1&&i.indexOf(".")!==-1){let a=i.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return i}function k1(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=N1(i),If(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const n=If(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${i}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class Va{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=k1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(Ff(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",d=new URL(`${f}://${If(o)?"["+o+"]":o}`);d.port=`${this.port}`;const m=new Va(d.host,!1);m.tlsName=this.hostname,s.push(m)}}return n.randomize&&Ug(s),this.resolves=s,s}}class C1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=Sf();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new Va(o))}),this.randomize&&(this.servers=Ug(this.servers))),this.servers.length===0&&this.addServer(`${Uf}:${$g()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Ff(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=Sf();n=a?a(n):n;const o=new Va(n,s);Ff(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);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(n,s){const a=[];let o=[];const f=Sf(),d=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Va(g,!0);d.set(g,y)});const m=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&d.get(E)===void 0&&m.push(y),d.delete(E)}),m.reverse(),m.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),d.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class M1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${gs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=Bg(s)),o.resolver(n,s))}}}close(){const n=de.errorForCode(le.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class R1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:jr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=rt();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class D1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function z1(i,n="Assertion failed."){if(!i)throw new D1(n)}const U0=32*1024,Ef=2**32-2;function jo(i,n,s=0){const a=n.byteLength-s;return i.byteLength>a&&(i=i.subarray(0,a)),n.set(i,s),i.byteLength}class Af{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.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(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){z1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=jo(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Ci.encode(n))}write(n){const s=this._grow(n.byteLength);return jo(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)jo(this._buf.subarray(this._off),this._buf);else{if(o+n>Ef)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,Ef));jo(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,Ef)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(U0);for(;;){const o=this.capacity-this.length<U0,f=o?a:new Uint8Array(this._buf.buffer,this.length),d=n.read(f);if(d===null)return s;o?this.write(f.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var qt;(function(i){i[i.OK=0]="OK",i[i.ERR=1]="ERR",i[i.MSG=2]="MSG",i[i.INFO=3]="INFO",i[i.PING=4]="PING",i[i.PONG=5]="PONG"})(qt||(qt={}));function B0(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const q1=48;class L0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=ce.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case ce.OP_START:switch(a){case ue.M:case ue.m:this.state=ce.OP_M,this.hdr=-1,this.ma=B0();break;case ue.H:case ue.h:this.state=ce.OP_H,this.hdr=0,this.ma=B0();break;case ue.P:case ue.p:this.state=ce.OP_P;break;case ue.PLUS:this.state=ce.OP_PLUS;break;case ue.MINUS:this.state=ce.OP_MINUS;break;case ue.I:case ue.i:this.state=ce.OP_I;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_H:switch(a){case ue.M:case ue.m:this.state=ce.OP_M;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_M:switch(a){case ue.S:case ue.s:this.state=ce.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MS:switch(a){case ue.G:case ue.g:this.state=ce.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MSG:switch(a){case ue.SPACE:case ue.TAB:this.state=ce.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MSG_SPC:switch(a){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.MSG_ARG,this.as=s}break;case ce.MSG_ARG:switch(a){case ue.CR:this.drop=1;break;case ue.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=ce.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case ce.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:qt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ce.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:qt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ce.MSG_END);break;case ce.MSG_END:switch(a){case ue.NL:this.drop=0,this.as=s+1,this.state=ce.OP_START;break;default:continue}break;case ce.OP_PLUS:switch(a){case ue.O:case ue.o:this.state=ce.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PLUS_O:switch(a){case ue.K:case ue.k:this.state=ce.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PLUS_OK:switch(a){case ue.NL:this.dispatcher.push({kind:qt.OK}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_MINUS:switch(a){case ue.E:case ue.e:this.state=ce.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_E:switch(a){case ue.R:case ue.r:this.state=ce.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_ER:switch(a){case ue.R:case ue.r:this.state=ce.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_ERR:switch(a){case ue.SPACE:case ue.TAB:this.state=ce.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_MINUS_ERR_SPC:switch(a){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.MINUS_ERR_ARG,this.as=s}break;case ce.MINUS_ERR_ARG:switch(a){case ue.CR:this.drop=1;break;case ue.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:qt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=ce.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case ce.OP_P:switch(a){case ue.I:case ue.i:this.state=ce.OP_PI;break;case ue.O:case ue.o:this.state=ce.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PO:switch(a){case ue.N:case ue.n:this.state=ce.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PON:switch(a){case ue.G:case ue.g:this.state=ce.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PONG:switch(a){case ue.NL:this.dispatcher.push({kind:qt.PONG}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_PI:switch(a){case ue.N:case ue.n:this.state=ce.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PIN:switch(a){case ue.G:case ue.g:this.state=ce.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_PING:switch(a){case ue.NL:this.dispatcher.push({kind:qt.PING}),this.drop=0,this.state=ce.OP_START;break}break;case ce.OP_I:switch(a){case ue.N:case ue.n:this.state=ce.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_IN:switch(a){case ue.F:case ue.f:this.state=ce.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_INF:switch(a){case ue.O:case ue.o:this.state=ce.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_INFO:switch(a){case ue.SPACE:case ue.TAB:this.state=ce.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case ce.OP_INFO_SPC:switch(a){case ue.SPACE:case ue.TAB:continue;default:this.state=ce.INFO_ARG,this.as=s}break;case ce.INFO_ARG:switch(a){case ue.CR:this.drop=1;break;case ue.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:qt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=ce.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===ce.MSG_ARG||this.state===ce.MINUS_ERR_ARG||this.state===ce.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Af(n.subarray(this.as,s-this.drop))),this.state===ce.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Af(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new Af(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ue.SPACE:case ue.TAB:case ue.CR:case ue.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),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(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${sn.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ue.SPACE:case ue.TAB:case ue.CR:case ue.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),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(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-q1)}return s}}var ce;(function(i){i[i.OP_START=0]="OP_START",i[i.OP_PLUS=1]="OP_PLUS",i[i.OP_PLUS_O=2]="OP_PLUS_O",i[i.OP_PLUS_OK=3]="OP_PLUS_OK",i[i.OP_MINUS=4]="OP_MINUS",i[i.OP_MINUS_E=5]="OP_MINUS_E",i[i.OP_MINUS_ER=6]="OP_MINUS_ER",i[i.OP_MINUS_ERR=7]="OP_MINUS_ERR",i[i.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",i[i.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",i[i.OP_M=10]="OP_M",i[i.OP_MS=11]="OP_MS",i[i.OP_MSG=12]="OP_MSG",i[i.OP_MSG_SPC=13]="OP_MSG_SPC",i[i.MSG_ARG=14]="MSG_ARG",i[i.MSG_PAYLOAD=15]="MSG_PAYLOAD",i[i.MSG_END=16]="MSG_END",i[i.OP_H=17]="OP_H",i[i.OP_P=18]="OP_P",i[i.OP_PI=19]="OP_PI",i[i.OP_PIN=20]="OP_PIN",i[i.OP_PING=21]="OP_PING",i[i.OP_PO=22]="OP_PO",i[i.OP_PON=23]="OP_PON",i[i.OP_PONG=24]="OP_PONG",i[i.OP_I=25]="OP_I",i[i.OP_IN=26]="OP_IN",i[i.OP_INF=27]="OP_INF",i[i.OP_INFO=28]="OP_INFO",i[i.OP_INFO_SPC=29]="OP_INFO_SPC",i[i.INFO_ARG=30]="INFO_ARG"})(ce||(ce={}));var ue;(function(i){i[i.CR=13]="CR",i[i.E=69]="E",i[i.e=101]="e",i[i.F=70]="F",i[i.f=102]="f",i[i.G=71]="G",i[i.g=103]="g",i[i.H=72]="H",i[i.h=104]="h",i[i.I=73]="I",i[i.i=105]="i",i[i.K=75]="K",i[i.k=107]="k",i[i.M=77]="M",i[i.m=109]="m",i[i.MINUS=45]="MINUS",i[i.N=78]="N",i[i.n=110]="n",i[i.NL=10]="NL",i[i.O=79]="O",i[i.o=111]="o",i[i.P=80]="P",i[i.p=112]="p",i[i.PLUS=43]="PLUS",i[i.R=82]="R",i[i.r=114]="r",i[i.S=83]="S",i[i.s=115]="s",i[i.SPACE=32]="SPACE",i[i.TAB=9]="TAB"})(ue||(ue={}));(function(i){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var d=s(),m=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),T=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function q(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function Q(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function W(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function te(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function fe(x,S,_,A,k){var D,Z=0;for(D=0;D<k;D++)Z|=x[S+D]^_[A+D];return(1&Z-1>>>8)-1}function re(x,S,_,A){return fe(x,S,_,A,16)}function N(x,S,_,A){return fe(x,S,_,A,32)}function V(x,S,_,A,k){var D=new Uint32Array(16),Z=new Uint32Array(16),ne=new Uint32Array(16),H=new Uint32Array(4),K,me,ke;for(K=0;K<4;K++)Z[5*K]=q(A,4*K),Z[1+K]=q(_,4*K),Z[6+K]=q(S,4*K),Z[11+K]=q(_,16+4*K);for(K=0;K<16;K++)ne[K]=Z[K];for(K=0;K<20;K++){for(me=0;me<4;me++){for(ke=0;ke<4;ke++)H[ke]=Z[(5*me+4*ke)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),ke=0;ke<4;ke++)D[4*me+(me+ke)%4]=H[ke]}for(ke=0;ke<16;ke++)Z[ke]=D[ke]}if(k){for(K=0;K<16;K++)Z[K]=Z[K]+ne[K]|0;for(K=0;K<4;K++)Z[5*K]=Z[5*K]-q(A,4*K)|0,Z[6+K]=Z[6+K]-q(S,4*K)|0;for(K=0;K<4;K++)W(x,4*K,Z[5*K]),W(x,16+4*K,Z[6+K])}else for(K=0;K<16;K++)W(x,4*K,Z[K]+ne[K]|0)}function ae(x,S,_,A){return V(x,S,_,A,!1),0}function P(x,S,_,A){return V(x,S,_,A,!0),0}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function X(x,S,_,A,k,D,Z){var ne=new Uint8Array(16),H=new Uint8Array(64),K,me;if(!k)return 0;for(me=0;me<16;me++)ne[me]=0;for(me=0;me<8;me++)ne[me]=D[me];for(;k>=64;){for(ae(H,ne,Z,F),me=0;me<64;me++)x[S+me]=(_?_[A+me]:0)^H[me];for(K=1,me=8;me<16;me++)K=K+(ne[me]&255)|0,ne[me]=K&255,K>>>=8;k-=64,S+=64,_&&(A+=64)}if(k>0)for(ae(H,ne,Z,F),me=0;me<k;me++)x[S+me]=(_?_[A+me]:0)^H[me];return 0}function oe(x,S,_,A,k){return X(x,S,null,0,_,A,k)}function ie(x,S,_,A,k){var D=new Uint8Array(32);return P(D,A,k,F),oe(x,S,_,A.subarray(16),D)}function Ne(x,S,_,A,k,D,Z){var ne=new Uint8Array(32);return P(ne,D,Z,F),X(x,S,_,A,k,D.subarray(16),ne)}function Ue(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,k,D){var Z,ne,H,K,me=new Uint32Array(17),ke=new Uint32Array(17),Ze=new Uint32Array(17),Mt=new Uint32Array(17),On=new Uint32Array(17);for(H=0;H<17;H++)ke[H]=Ze[H]=0;for(H=0;H<16;H++)ke[H]=D[H];for(ke[3]&=15,ke[4]&=252,ke[7]&=15,ke[8]&=252,ke[11]&=15,ke[12]&=252,ke[15]&=15;k>0;){for(H=0;H<17;H++)Mt[H]=0;for(H=0;H<16&&H<k;++H)Mt[H]=_[A+H];for(Mt[H]=1,A+=H,k-=H,Ue(Ze,Mt),ne=0;ne<17;ne++)for(me[ne]=0,H=0;H<17;H++)me[ne]=me[ne]+Ze[H]*(H<=ne?ke[ne-H]:320*ke[ne+17-H]|0)|0|0;for(ne=0;ne<17;ne++)Ze[ne]=me[ne];for(K=0,H=0;H<16;H++)K=K+Ze[H]|0,Ze[H]=K&255,K>>>=8;for(K=K+Ze[16]|0,Ze[16]=K&3,K=5*(K>>>2)|0,H=0;H<16;H++)K=K+Ze[H]|0,Ze[H]=K&255,K>>>=8;K=K+Ze[16]|0,Ze[16]=K}for(H=0;H<17;H++)On[H]=Ze[H];for(Ue(Ze,Te),Z=-(Ze[16]>>>7)|0,H=0;H<17;H++)Ze[H]^=Z&(On[H]^Ze[H]);for(H=0;H<16;H++)Mt[H]=D[H+16];for(Mt[16]=0,Ue(Ze,Mt),H=0;H<16;H++)x[S+H]=Ze[H];return 0}function se(x,S,_,A,k,D){var Z=new Uint8Array(16);return $(Z,0,_,A,k,D),re(x,S,Z,0)}function he(x,S,_,A,k){var D;if(_<32)return-1;for(Ne(x,0,S,0,_,A,k),$(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function Ae(x,S,_,A,k){var D,Z=new Uint8Array(32);if(_<32||(ie(Z,0,32,A,k),se(S,16,S,32,_-32,Z)!==0))return-1;for(Ne(x,0,S,0,_,A,k),D=0;D<32;D++)x[D]=0;return 0}function ve(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function G(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function ge(x,S,_){for(var A,k=~(_-1),D=0;D<16;D++)A=k&(x[D]^S[D]),x[D]^=A,S[D]^=A}function xe(x,S){var _,A,k,D=s(),Z=s();for(_=0;_<16;_++)Z[_]=S[_];for(G(Z),G(Z),G(Z),A=0;A<2;A++){for(D[0]=Z[0]-65517,_=1;_<15;_++)D[_]=Z[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=Z[15]-32767-(D[14]>>16&1),k=D[15]>>16&1,D[14]&=65535,ge(Z,D,1-k)}for(_=0;_<16;_++)x[2*_]=Z[_]&255,x[2*_+1]=Z[_]>>8}function Pe(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return xe(_,x),xe(A,S),N(_,0,A,0)}function tt(x){var S=new Uint8Array(32);return xe(S,x),S[0]&1}function St(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function at(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function lt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function Se(x,S,_){var A,k,D=new Float64Array(31);for(A=0;A<31;A++)D[A]=0;for(A=0;A<16;A++)for(k=0;k<16;k++)D[A+k]+=S[A]*_[k];for(A=0;A<15;A++)D[A]+=38*D[A+16];for(A=0;A<16;A++)x[A]=D[A];G(x),G(x)}function vt(x,S){Se(x,S,S)}function qn(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)vt(_,_),A!==2&&A!==4&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function In(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)vt(_,_),A!==1&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Rt(x,S,_){var A=new Uint8Array(32),k=new Float64Array(80),D,Z,ne=s(),H=s(),K=s(),me=s(),ke=s(),Ze=s();for(Z=0;Z<31;Z++)A[Z]=S[Z];for(A[31]=S[31]&127|64,A[0]&=248,St(k,_),Z=0;Z<16;Z++)H[Z]=k[Z],me[Z]=ne[Z]=K[Z]=0;for(ne[0]=me[0]=1,Z=254;Z>=0;--Z)D=A[Z>>>3]>>>(Z&7)&1,ge(ne,H,D),ge(K,me,D),at(ke,ne,K),lt(ne,ne,K),at(K,H,me),lt(H,H,me),vt(me,ke),vt(Ze,ne),Se(ne,K,ne),Se(K,H,ke),at(ke,ne,K),lt(ne,ne,K),vt(H,ne),lt(K,me,Ze),Se(ne,K,g),at(ne,ne,me),Se(K,K,ne),Se(ne,me,Ze),Se(me,H,k),vt(H,ke),ge(ne,H,D),ge(K,me,D);for(Z=0;Z<16;Z++)k[Z+16]=ne[Z],k[Z+32]=K[Z],k[Z+48]=H[Z],k[Z+64]=me[Z];var Mt=k.subarray(32),On=k.subarray(16);return qn(Mt,Mt),Se(On,On,Mt),xe(x,On),0}function cn(x,S){return Rt(x,S,f)}function Mi(x,S){return a(S,32),cn(x,S)}function xs(x,S,_){var A=new Uint8Array(32);return Rt(A,_,S),P(x,o,A,F)}var sl=he,il=Ae;function Br(x,S,_,A,k,D){var Z=new Uint8Array(32);return xs(Z,k,D),sl(x,S,_,A,Z)}function Lr(x,S,_,A,k,D){var Z=new Uint8Array(32);return xs(Z,k,D),il(x,S,_,A,Z)}function Jn(){var x=0,S=0,_=0,A=0,k=65535,D,Z,ne;for(ne=0;ne<arguments.length;ne++)D=arguments[ne].lo,Z=arguments[ne].hi,x+=D&k,S+=D>>>16,_+=Z&k,A+=Z>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&k|A<<16,x&k|S<<16)}function rl(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ri(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function nt(x,S){var _,A,k=32-S;return S<32?(_=x.hi>>>S|x.lo<<k,A=x.lo>>>S|x.hi<<k):S<64&&(_=x.lo>>>S|x.hi<<k,A=x.hi>>>S|x.lo<<k),new n(_,A)}function ac(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,k=x.lo&S.lo^~x.lo&_.lo;return new n(A,k)}function al(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,k=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,k)}function ll(x){return Ri(nt(x,28),nt(x,34),nt(x,39))}function Di(x){return Ri(nt(x,14),nt(x,18),nt(x,41))}function lc(x){return Ri(nt(x,1),nt(x,8),rl(x,7))}function ol(x){return Ri(nt(x,19),nt(x,61),rl(x,6))}var oc=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function cl(x,S,_){var A=[],k=[],D=[],Z=[],ne,H,K;for(H=0;H<8;H++)A[H]=D[H]=Q(x,8*H);for(var me=0;_>=128;){for(H=0;H<16;H++)Z[H]=Q(S,8*H+me);for(H=0;H<80;H++){for(K=0;K<8;K++)k[K]=D[K];for(ne=Jn(D[7],Di(D[4]),ac(D[4],D[5],D[6]),oc[H],Z[H%16]),k[7]=Jn(ne,ll(D[0]),al(D[0],D[1],D[2])),k[3]=Jn(k[3],ne),K=0;K<8;K++)D[(K+1)%8]=k[K];if(H%16===15)for(K=0;K<16;K++)Z[K]=Jn(Z[K],Z[(K+9)%16],lc(Z[(K+1)%16]),ol(Z[(K+14)%16]))}for(H=0;H<8;H++)D[H]=Jn(D[H],A[H]),A[H]=D[H];me+=128,_-=128}for(H=0;H<8;H++)te(x,8*H,A[H]);return _}var li=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 ft(x,S,_){var A=new Uint8Array(64),k=new Uint8Array(256),D,Z=_;for(D=0;D<64;D++)A[D]=li[D];for(cl(A,S,_),_%=128,D=0;D<256;D++)k[D]=0;for(D=0;D<_;D++)k[D]=S[Z-_+D];for(k[_]=128,_=256-128*(_<112?1:0),k[_-9]=0,te(k,_-8,new n(Z/536870912|0,Z<<3)),cl(A,k,_),D=0;D<64;D++)x[D]=A[D];return 0}function Ft(x,S){var _=s(),A=s(),k=s(),D=s(),Z=s(),ne=s(),H=s(),K=s(),me=s();lt(_,x[1],x[0]),lt(me,S[1],S[0]),Se(_,_,me),at(A,x[0],x[1]),at(me,S[0],S[1]),Se(A,A,me),Se(k,x[3],S[3]),Se(k,k,E),Se(D,x[2],S[2]),at(D,D,D),lt(Z,A,_),lt(ne,D,k),at(H,D,k),at(K,A,_),Se(x[0],Z,ne),Se(x[1],K,H),Se(x[2],H,ne),Se(x[3],Z,K)}function Ct(x,S,_){var A;for(A=0;A<4;A++)ge(x[A],S[A],_)}function Hr(x,S){var _=s(),A=s(),k=s();qn(k,S[2]),Se(_,S[0],k),Se(A,S[1],k),xe(x,A),x[31]^=tt(_)<<7}function Pr(x,S,_){var A,k;for(ve(x[0],d),ve(x[1],m),ve(x[2],m),ve(x[3],d),k=255;k>=0;--k)A=_[k/8|0]>>(k&7)&1,Ct(x,S,A),Ft(S,x),Ft(x,x),Ct(x,S,A)}function zi(x,S){var _=[s(),s(),s(),s()];ve(_[0],w),ve(_[1],T),ve(_[2],m),Se(_[3],w,T),Pr(x,_,S)}function vs(x,S,_){var A=new Uint8Array(64),k=[s(),s(),s(),s()],D;for(_||a(S,32),ft(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,zi(k,A),Hr(x,k),D=0;D<32;D++)S[D+32]=x[D];return 0}var Qn=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 _s(x,S){var _,A,k,D;for(A=63;A>=32;--A){for(_=0,k=A-32,D=A-12;k<D;++k)S[k]+=_-16*S[A]*Qn[k-(A-32)],_=Math.floor((S[k]+128)/256),S[k]-=_*256;S[k]+=_,S[A]=0}for(_=0,k=0;k<32;k++)S[k]+=_-(S[31]>>4)*Qn[k],_=S[k]>>8,S[k]&=255;for(k=0;k<32;k++)S[k]-=_*Qn[k];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function An(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;_s(x,S)}function oi(x,S,_,A){var k=new Uint8Array(64),D=new Uint8Array(64),Z=new Uint8Array(64),ne,H,K=new Float64Array(64),me=[s(),s(),s(),s()];ft(k,A,32),k[0]&=248,k[31]&=127,k[31]|=64;var ke=_+64;for(ne=0;ne<_;ne++)x[64+ne]=S[ne];for(ne=0;ne<32;ne++)x[32+ne]=k[32+ne];for(ft(Z,x.subarray(32),_+32),An(Z),zi(me,Z),Hr(x,me),ne=32;ne<64;ne++)x[ne]=A[ne];for(ft(D,x,_+64),An(D),ne=0;ne<64;ne++)K[ne]=0;for(ne=0;ne<32;ne++)K[ne]=Z[ne];for(ne=0;ne<32;ne++)for(H=0;H<32;H++)K[ne+H]+=D[ne]*k[H];return _s(x.subarray(32),K),ke}function ci(x,S){var _=s(),A=s(),k=s(),D=s(),Z=s(),ne=s(),H=s();return ve(x[2],m),St(x[1],S),vt(k,x[1]),Se(D,k,y),lt(k,k,x[2]),at(D,x[2],D),vt(Z,D),vt(ne,Z),Se(H,ne,Z),Se(_,H,k),Se(_,_,D),In(_,_),Se(_,_,k),Se(_,_,D),Se(_,_,D),Se(x[0],_,D),vt(A,x[0]),Se(A,A,D),Pe(A,k)&&Se(x[0],x[0],z),vt(A,x[0]),Se(A,A,D),Pe(A,k)?-1:(tt(x[0])===S[31]>>7&<(x[0],d,x[0]),Se(x[3],x[0],x[1]),0)}function $r(x,S,_,A){var k,D=new Uint8Array(32),Z=new Uint8Array(64),ne=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ci(H,A))return-1;for(k=0;k<_;k++)x[k]=S[k];for(k=0;k<32;k++)x[k+32]=A[k];if(ft(Z,x,_),An(Z),Pr(ne,H,Z),zi(H,S.subarray(32)),Ft(ne,H),Hr(D,ne),_-=64,N(S,0,D,0)){for(k=0;k<_;k++)x[k]=0;return-1}for(k=0;k<_;k++)x[k]=S[k+64];return _}var qi=32,ws=24,jn=32,Ss=16,Es=32,ui=32,As=32,Xn=32,fi=32,Yr=ws,ul=jn,Un=Ss,Xe=64,ot=32,It=64,hi=32,Gr=64;i.lowlevel={crypto_core_hsalsa20:P,crypto_stream_xor:Ne,crypto_stream:ie,crypto_stream_salsa20_xor:X,crypto_stream_salsa20:oe,crypto_onetimeauth:$,crypto_onetimeauth_verify:se,crypto_verify_16:re,crypto_verify_32:N,crypto_secretbox:he,crypto_secretbox_open:Ae,crypto_scalarmult:Rt,crypto_scalarmult_base:cn,crypto_box_beforenm:xs,crypto_box_afternm:sl,crypto_box:Br,crypto_box_open:Lr,crypto_box_keypair:Mi,crypto_hash:ft,crypto_sign:oi,crypto_sign_keypair:vs,crypto_sign_open:$r,crypto_secretbox_KEYBYTES:qi,crypto_secretbox_NONCEBYTES:ws,crypto_secretbox_ZEROBYTES:jn,crypto_secretbox_BOXZEROBYTES:Ss,crypto_scalarmult_BYTES:Es,crypto_scalarmult_SCALARBYTES:ui,crypto_box_PUBLICKEYBYTES:As,crypto_box_SECRETKEYBYTES:Xn,crypto_box_BEFORENMBYTES:fi,crypto_box_NONCEBYTES:Yr,crypto_box_ZEROBYTES:ul,crypto_box_BOXZEROBYTES:Un,crypto_sign_BYTES:Xe,crypto_sign_PUBLICKEYBYTES:ot,crypto_sign_SECRETKEYBYTES:It,crypto_sign_SEEDBYTES:hi,crypto_hash_BYTES:Gr,gf:s,D:y,L:Qn,pack25519:xe,unpack25519:St,M:Se,A:at,S:vt,Z:lt,pow2523:In,add:Ft,set25519:ve,modL:_s,scalarmult:Pr,scalarbase:zi};function fl(x,S){if(x.length!==qi)throw new Error("bad key size");if(S.length!==ws)throw new Error("bad nonce size")}function hl(x,S){if(x.length!==As)throw new Error("bad public key size");if(S.length!==Xn)throw new Error("bad secret key size")}function _t(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ui(x){for(var S=0;S<x.length;S++)x[S]=0}i.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},i.secretbox=function(x,S,_){_t(x,S,_),fl(_,S);for(var A=new Uint8Array(jn+x.length),k=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+jn]=x[D];return he(k,A,A.length,S,_),k.subarray(Ss)},i.secretbox.open=function(x,S,_){_t(x,S,_),fl(_,S);for(var A=new Uint8Array(Ss+x.length),k=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+Ss]=x[D];return A.length<32||Ae(k,A,A.length,S,_)!==0?null:k.subarray(jn)},i.secretbox.keyLength=qi,i.secretbox.nonceLength=ws,i.secretbox.overheadLength=Ss,i.scalarMult=function(x,S){if(_t(x,S),x.length!==ui)throw new Error("bad n size");if(S.length!==Es)throw new Error("bad p size");var _=new Uint8Array(Es);return Rt(_,x,S),_},i.scalarMult.base=function(x){if(_t(x),x.length!==ui)throw new Error("bad n size");var S=new Uint8Array(Es);return cn(S,x),S},i.scalarMult.scalarLength=ui,i.scalarMult.groupElementLength=Es,i.box=function(x,S,_,A){var k=i.box.before(_,A);return i.secretbox(x,S,k)},i.box.before=function(x,S){_t(x,S),hl(x,S);var _=new Uint8Array(fi);return xs(_,x,S),_},i.box.after=i.secretbox,i.box.open=function(x,S,_,A){var k=i.box.before(_,A);return i.secretbox.open(x,S,k)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var x=new Uint8Array(As),S=new Uint8Array(Xn);return Mi(x,S),{publicKey:x,secretKey:S}},i.box.keyPair.fromSecretKey=function(x){if(_t(x),x.length!==Xn)throw new Error("bad secret key size");var S=new Uint8Array(As);return cn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},i.box.publicKeyLength=As,i.box.secretKeyLength=Xn,i.box.sharedKeyLength=fi,i.box.nonceLength=Yr,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(x,S){if(_t(x,S),S.length!==It)throw new Error("bad secret key size");var _=new Uint8Array(Xe+x.length);return oi(_,x,x.length,S),_},i.sign.open=function(x,S){if(_t(x,S),S.length!==ot)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=$r(_,x,x.length,S);if(A<0)return null;for(var k=new Uint8Array(A),D=0;D<k.length;D++)k[D]=_[D];return k},i.sign.detached=function(x,S){for(var _=i.sign(x,S),A=new Uint8Array(Xe),k=0;k<A.length;k++)A[k]=_[k];return A},i.sign.detached.verify=function(x,S,_){if(_t(x,S,_),S.length!==Xe)throw new Error("bad signature size");if(_.length!==ot)throw new Error("bad public key size");var A=new Uint8Array(Xe+x.length),k=new Uint8Array(Xe+x.length),D;for(D=0;D<Xe;D++)A[D]=S[D];for(D=0;D<x.length;D++)A[D+Xe]=x[D];return $r(k,A,A.length,_)>=0},i.sign.keyPair=function(){var x=new Uint8Array(ot),S=new Uint8Array(It);return vs(x,S),{publicKey:x,secretKey:S}},i.sign.keyPair.fromSecretKey=function(x){if(_t(x),x.length!==It)throw new Error("bad secret key size");for(var S=new Uint8Array(ot),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},i.sign.keyPair.fromSeed=function(x){if(_t(x),x.length!==hi)throw new Error("bad seed size");for(var S=new Uint8Array(ot),_=new Uint8Array(It),A=0;A<32;A++)_[A]=x[A];return vs(S,_,!0),{publicKey:S,secretKey:_}},i.sign.publicKeyLength=ot,i.sign.secretKeyLength=It,i.sign.seedLength=hi,i.sign.signatureLength=Xe,i.hash=function(x){_t(x);var S=new Uint8Array(Gr);return ft(S,x,x.length),S},i.hash.hashLength=Gr,i.verify=function(x,S){return _t(x,S),x.length===0||S.length===0||x.length!==S.length?!1:fe(x,0,S,0,x.length)===0},i.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;i.setPRNG(function(_,A){var k,D=new Uint8Array(A);for(k=0;k<A;k+=S)x.getRandomValues(D.subarray(k,k+Math.min(A-k,S)));for(k=0;k<A;k++)_[k]=D[k];Ui(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&i.setPRNG(function(_,A){var k,D=x.randomBytes(A);for(k=0;k<A;k++)_[k]=D[k];Ui(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Oo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Oo.sign.keyPair.fromSeed,Oo.sign.detached,Oo.sign.detached.verify,Oo.randomBytes;var H0;(function(i){i.InvalidPrefixByte="nkeys: invalid prefix byte",i.InvalidKey="nkeys: invalid key",i.InvalidPublicKey="nkeys: invalid public key",i.InvalidSeedLen="nkeys: invalid seed length",i.InvalidSeed="nkeys: invalid seed",i.InvalidEncoding="nkeys: invalid encoded key",i.InvalidSignature="nkeys: signature verification failed",i.CannotSign="nkeys: cannot sign, no private key available",i.PublicKeyOnly="nkeys: no seed or private key available",i.InvalidChecksum="nkeys: invalid checksum",i.SerializationError="nkeys: serialization error",i.ApiError="nkeys: api error",i.ClearedPair="nkeys: pair is cleared"})(H0||(H0={}));var P0;(function(i){i[i.Seed=144]="Seed",i[i.Private=120]="Private",i[i.Operator=112]="Operator",i[i.Server=104]="Server",i[i.Cluster=16]="Cluster",i[i.Account=0]="Account",i[i.User=160]="User"})(P0||(P0={}));function U1(i){return n=>{let s={};return i.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function B1(){return()=>{}}function L1(i,n){return()=>{const s=typeof i=="function"?i():i,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function H1(i){return()=>({auth_token:typeof i=="function"?i():i})}const Vg=120*1e3,P1=2,Fg=2*1e3;function $1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Vg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Fg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function Y1(i){const n=[];return typeof i.authenticator=="function"&&n.push(i.authenticator),Array.isArray(i.authenticator)&&n.push(...i.authenticator),i.token&&n.push(H1(i.token)),i.user&&n.push(L1(i.user,i.pass)),n.length===0?B1():U1(n)}function G1(i){const n=`${Uf}:${$g()}`;if(i=i||{servers:[n]},i.servers=i.servers||[],typeof i.servers=="string"&&(i.servers=[i.servers]),i.servers.length>0&&i.port)throw new de("port and servers options are mutually exclusive",le.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${Uf}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[n]);const s=ec($1(),i);if(s.authenticator=Y1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new de(`${a} option should be a function`,le.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{gs(s.inboxPrefix)}catch(a){throw new de(a.message,le.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Vf()=="function"),s.resolve&&typeof Vf()!="function")throw new de("'resolve' is not supported on this client",le.InvalidOption);return s}function V1(i,n){const{proto:s,tls_required:a,tls_available:o}=i;if((s===void 0||s<1)&&n.noEcho)throw new de("noEcho",le.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new de("tls",le.ServerOptionNotAvailable)}const F1=1024*32,I1=/^INFO\s+([^\r\n]+)\r\n/i,J1=Ya(`PONG\r
|
|
38
|
-
`),$0=Ya(`PING\r
|
|
39
|
-
`);class Q1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.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 o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};ec(this,o)}}class Ig extends jt{constructor(s,a,o={}){var d;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");ec(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=rt();const f=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=Cr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(m=>{this.stop(m),this.noIterator&&this.callback(m,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(m,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(m,g),d(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}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(de.errorForCode(le.ConnectionClosed)):this.isClosed()?Promise.reject(de.errorForCode(le.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(rt()).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 X1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Qo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=F1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new X1,this.muxSubscriptions=new M1,this.outbound=new Rr,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new h1({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new C1(a,{randomize:!n.noRandomize}),this.closed=rt(),this.parser=new L0(this),this.heartbeats=new R1(this,this.options.pingInterval||Vg,this.options.maxPingOut||P1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=de.errorForCode(le.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new L0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new jt;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=rt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=p1(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:jr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:jr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:ps.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:ps.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(n)}async dial(n){const s=this.prepare();let a;try{a=Cr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.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(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Vf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:jr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(d){o=d}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Fg;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:de.errorForCode(le.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(n=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const m=this.options.maxReconnectAttempts||0;m!==-1&&o.reconnects>=m&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await zr(a)}}static async connect(n,s){const a=new Qo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new de(n,le.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new de(n,le.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new de(n,le.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new de(n,le.AccountExpired):s.indexOf("authentication timeout")!==-1?new de(n,le.AuthenticationTimeout):new de(n,le.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new uh(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=E0(n),a=Qo.toError(s),o={type:ps.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const d=this.subscriptions.getMux();f=(d==null?void 0:d.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(J1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(E0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ki(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:d}=this.transport;try{const m=new Q1({version:f,lang:d},this.options,s.nonce);s.headers&&(m.headers=!0,m.no_responders=!0);const g=JSON.stringify(m);this.transport.send(Ya(`CONNECT ${g}${zo}`)),this.transport.send($0)}catch(m){this._close(m)}}a&&this.dispatchStatus({type:ps.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:ps.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case qt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case qt.OK:break;case qt.ERR:this.processError(n.data);break;case qt.PING:this.processPing();break;case qt.PONG:this.processPong();break;case qt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Ya(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=an,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Ci.encode(s);else throw de.errorForCode(le.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let d=an,m=0;if(a.headers){if(this.info&&!this.info.headers)throw new de("headers",le.ServerOptionNotAvailable);d=a.headers.encode(),m=d.length,f=o.length+m}if(this.info&&f>this.info.max_payload)throw de.errorForCode(le.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${m} ${f}\r
|
|
40
|
-
`:g=`HPUB ${n} ${m} ${f}\r
|
|
41
|
-
`,this.sendCommand(g,d,o,Jo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
|
|
42
|
-
`:g=`PUB ${n} ${f}\r
|
|
43
|
-
`,this.sendCommand(g,o,Jo))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
|
|
44
|
-
`):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
|
|
45
|
-
`)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
|
|
46
|
-
`):this.sendCommand(`UNSUB ${n.sid}\r
|
|
47
|
-
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=rt()),this.pongs.push(n),this.outbound.fill($0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${zo}`):n.push(`SUB ${a.subject} ${a.sid}${zo}`)}),n.length&&this.transport.send(Ya(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.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 n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Ig(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const K1="$SRV";class Y0{constructor(n){v(this,"msg");this.msg=n}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(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,d;return o=o||{},o.headers=o.headers||ys(),(f=o.headers)==null||f.set(Go,`${n}`),(d=o.headers)==null||d.set(Yo,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Qa{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&W1("service group",s);let o="";if(n instanceof el)this.srv=n,o="";else if(n instanceof Qa){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;La("endpoint",n);let{subject:o,handler:f,metadata:d,queue:m}=a;o=o||n,m=m||this.queue,Z1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:m,handler:f,metadata:d};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Qa(this,n,s)}}function Z1(i,n){if(n==="")throw new Error(`${i} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${i} cannot have internal '>': '${n}'`)})}function W1(i,n){if(n.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${i} name cannot contain internal '>': '${n}'`)})}class el{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),La("name",this.config.name),La("queue",this.config.queue),ki(this.config.version),this._id=si.next(),this.internal=[],this._done=rt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??K1;return s===""&&a===""?`${f}.${n}`:(La("control subject name",s),a!==""?(La("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.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(n){const s=ys();if(n instanceof Vo){const a=n;s.set(Yo,a.message),s.set(Go,`${a.code}`)}else s.set(Yo,n.message),s.set(Go,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:d}=n,m=n;m.internal=s,s&&this.internal.push(m),m.stats=new e_(o,f,a),m.queue=a;const g=d?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{d(y,new Y0(E))}catch(T){m.stats.countError(T),E==null||E.respond(an,{headers:this.errorToHeader(T)})}finally{m.stats.countLatency(w)}}:void 0;return m.sub=this.nc.subscribe(f,{callback:g,queue:a}),m.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),m}info(){return{type:Ga.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Ga.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const d={};d.name=n,d.subject=el.controlSubject(s,o,f),d.handler=a,this.setupHandler(d,!0)}start(){const n=zn(),s=(d,m)=>d?(this.close(d),Promise.reject(d)):this.stats().then(g=>(m==null||m.respond(n.encode(g)),Promise.resolve())),a=(d,m)=>d?(this.close(d),Promise.reject(d)):(m==null||m.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(d,m)=>d?(this.close(d).then().catch(),Promise.reject(d)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Zs.PING,f),this.addInternalHandler(Zs.STATS,s),this.addInternalHandler(Zs.INFO,a),this.handlers.forEach(d=>{const{subject:m}=d;typeof m=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Ga.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new Qa(this,n,s)}addEndpoint(n,s){return new Qa(this).addEndpoint(n,s)}_addEndpoint(n){const s=new jt;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new Y0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class e_{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){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=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=it(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:g,queue_group:y}}stats(n){const s=n;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 t_{constructor(n,s={strategy:Dn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Zs.PING,n,s)}stats(n="",s=""){return this.q(Zs.STATS,n,s)}info(n="",s=""){return this.q(Zs.INFO,n,s)}async q(n,s="",a=""){const o=new jt,f=zn(),d=el.controlSubject(n,s,a,this.prefix),m=await this.nc.requestMany(d,an,this.opts);return(async()=>{for await(const g of m)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Jg(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function n_(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Jg(),storage:$f.File}}const Xo="KV-Operation",G0="$KV",s_=/^[-/=.\w]+$/,i_=/^[-/=.>*\w]+$/,r_=/^[-\w]+$/;function a_(i){if(i.startsWith(".")||i.endsWith(".")||!s_.test(i))throw new Error(`invalid key: ${i}`)}function l_(i){if(i.startsWith(".")||i.endsWith(".")||!i_.test(i))throw new Error(`invalid key: ${i}`)}function o_(i){if(i.startsWith(".")||i.endsWith("."))throw new Error(`invalid key: ${i}`);const n=i.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${i}`);s=!0;break}return s}function qo(i){if(!r_.test(i))throw new Error(`invalid bucket name: ${i}`)}var Yn;(function(i){i.MsgIdHdr="Nats-Msg-Id",i.ExpectedStreamHdr="Nats-Expected-Stream",i.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",i.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",i.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Yn||(Yn={}));class Xa{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",a_);v(this,"validateSearchKey",l_);v(this,"hasWildcards",o_);qo(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=G0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){qo(s);const o=await n.jetstreamManager(),f=new Xa(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};qo(s);const d=new Xa(s,n,o);return f.config.name=a.streamName??d.bucketName(),Object.assign(d,f),d.stream=f.config.name,d.codec=a.codec||Jg(),d.direct=f.config.allow_direct??!1,d.initializePrefixes(f),d}async init(n={}){const s=Object.assign(n_(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Pf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(nn)||(w.name=`${nn}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(T=>{const z=Object.assign({},T),M=z.name.startsWith(nn)?z.name.substring(nn.length):z.name;return z.name.startsWith(nn)||(z.name=`${nn}${z.name}`),!T.external&&M!==this.bucket&&(z.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?ii.S2:ii.None);const f=this.js.nc,d=f.getServerVersion(),m=d?Gf(d,ki("2.7.2"))>=0:!1;a.discard=m?Ja.New:Ja.Old;const{ok:g,min:y}=f.features.get(Be.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=it(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(nn)&&(a=a.substring(nn.length)),s.external&&s.external.api!==""){const o=s.name.substring(nn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${nn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${G0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Ut.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new S_(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new E_(this.bucket,s,n)}async create(n,s){var f;let a;try{const d=await this.put(n,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(a=d,((f=d==null?void 0:d.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(n);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(d){return Promise.reject(d)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var d,m;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=ys();f.headers=g,g.set(Yn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(d=y.api_error)==null?void 0:d.description,y.code=`${(m=y.api_error)==null?void 0:m.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(f);return d.key!==a?null:d}catch(d){if(d.code===le.JetStream404NoMessages)return null;throw d}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=rt(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,d=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),m=await Promise.all(d);return m.unshift({success:!0,purged:0}),m.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const d of o)f.push(this._doDeleteOrPurge(d,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=ys();f.set(Xo,s),s==="PURGE"&&f.set(Ut.RollupHdr,Ut.RollupValueSubject),a!=null&&a.previousSeq&&f.set(Yn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),an,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),d=mt.LastPerSubject;s===Mn.AllHistory&&(d=mt.All),s===Mn.UpdatesOnly&&(d=mt.New);let m;return f.length===1&&(m=f[0],f=void 0),Object.assign({deliver_policy:d,ack_policy:At.None,filter_subjects:f,filter_subject:m,flow_control:!0,idle_heartbeat:it(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new jt,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let d=0;const m=this._buildCC(s,Mn.AllHistory,o),g=m.filter_subject,y=ei(m);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,T)=>{if(w){a.stop(w);return}if(T){const z=this.jmToEntry(T);a.push(z),a.received++,(f&&d>0&&a.received>=d||T.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,T=w.num_pending+w.delivered.consumer_seq;if(T===0||a.received>=T)try{f()}catch(z){a.stop(z)}finally{f=void 0}else d=T}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Be.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new jt,o={};o.headers_only=n.headers_only||!1;let f=Mn.LastValue;n.include===Mn.AllHistory?f=Mn.AllHistory:n.include===Mn.UpdatesOnly&&(f=Mn.UpdatesOnly);const d=n.ignoreDeletes===!0;let m=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=ei(y);this.canSetWatcherName()&&w.consumerName(si.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((z,M)=>{if(z){a.stop(z);return}if(M){const q=this.jmToEntry(M);if(d&&q.operation==="DEL")return;a.push(q),a.received++,m&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(m),m=void 0)}});const T=await this.js.subscribe(E,w);if(m){const{info:{last:z}}=T,M=z.num_pending+z.delivered.consumer_seq;if(M===0||a.received>=M)try{m()}catch(q){a.stop(q)}finally{m=void 0}else g=M}return a._data=T,a.iterClosed.then(()=>{T.unsubscribe()}),T.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new jt,a=this._buildCC(n,Mn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=ei(a);f.bindStream(this.stream),f.orderedConsumer();const d=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of d){const E=(g=y.headers)==null?void 0:g.get(Xo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&d.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),d.info.last.num_pending===0&&d.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Qg(o,s)}}class Qg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(nn)?this.si.config.name.substring(nn.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 ch(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 n;return((n=this.si.config.placement)==null?void 0:n.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!==ii.None:!1}}const hh="OBJ_",V0="SHA-256=";function c_(i){return qo(i),`${hh}${i}`}function u_(i){return i.startsWith(hh)?i.substring(4):i}class Jf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return u_(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!==ii.None:!1}}function To(i){if(i===void 0)return;const{domain:n}=i;if(n===void 0)return i;const s=Object.assign({},i);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var vn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(vn||(vn={}));var Gn;(function(i){i.HeartbeatsMissed="heartbeats_missed",i.ConsumerNotFound="consumer_not_found",i.StreamNotFound="stream_not_found",i.ConsumerDeleted="consumer_deleted",i.OrderedConsumerRecreated="ordered_consumer_recreated",i.NoResponders="no_responders"})(Gn||(Gn={}));var kr;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})(kr||(kr={}));const F0=Uint8Array.of(43,65,67,75),f_=Uint8Array.of(45,78,65,75),Da=Uint8Array.of(43,87,80,73),h_=Uint8Array.of(43,78,88,84),d_=Uint8Array.of(43,84,69,82,77),m_=Uint8Array.of(32);function Ka(i,n=5e3){return new C_(i,n)}class jf extends jt{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=gs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:d}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:m}=this;m&&m.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,T,z,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Hf(y))return;const q=(T=y.headers)==null?void 0:T.code,Q=((M=(z=y.headers)==null?void 0:z.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:W,bytesLeft:te}=this.parseDiscard(y.headers);if(W>0||te>0)this.pending.msgs-=W,this.pending.bytes-=te,this.pending.requests--,this.notify(kr.Discard,{msgsLeft:W,bytesLeft:te});else if(q===400){this.stop(new de(Q,`${q}`));return}else if(q===409&&Q==="consumer deleted"){if(this.notify(Gn.ConsumerDeleted,`${q} ${Q}`),!this.refilling||this.abortOnMissingResource){const fe=new de(Q,`${q}`);this.stop(fe);return}}else if(q===503){if(this.notify(Gn.NoResponders,`${q} No Responders`),!this.refilling||this.abortOnMissingResource){const fe=new de("no responders",`${q}`);this.stop(fe);return}}else this.notify(kr.DebugEvent,`${q} ${Q}`)}else this._push(Ka(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=d||a&&this.pending.bytes<=f){const q=this.pullOptions();this.pull(q)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new fh(o,g=>(this.notify(Gn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case ps.Disconnect:(y=this.monitor)==null||y.cancel();break;case ps.Reconnect:this.resetPending().then(w=>{var T;w&&((T=this.monitor)==null||T.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}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,a=0;const o=oh([this.opts.expires]);let f=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(d){if(d.message==="stream not found"){if(a++,this.notify(Gn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(Gn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const m=o.backoff(f),g=zr(m);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.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(kr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=it(this.opts.idle_heartbeat),f=it(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Ut.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Ut.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const s=new jt;return this.listeners.push(s),Promise.resolve(s)}}class p_ extends jt{constructor(){super();v(this,"src");v(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(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new jt;return this.listeners.push(s),Promise.resolve(s)}}class Qf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new jf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new jf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Cr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=rt(),a=n;a.max_messages=1;const o=new jf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const m of await o.status())if(m.type===Gn.HeartbeatsMissed&&m.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const m of o){s.resolve(m);break}})().catch(()=>{});const d=Cr(f);return o.closed().then(m=>{m?s.reject(m):s.resolve(null)}).catch(m=>{s.reject(m)}).finally(()=>{d.cancel()}),d.catch(m=>{s.resolve(null),o.close().catch()}),o.trackTimeout(d),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class g_{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=si.next(),typeof a.name_prefix=="string"&&(tc("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=vn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:mt.StartSequence,opt_start_seq:n,ack_policy:At.None,inactive_threshold:it(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||mt.StartSequence,(this.consumerOpts.deliver_policy===mt.LastPerSubject||this.consumerOpts.deliver_policy===mt.New||this.consumerOpts.deliver_policy===mt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===mt.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=mt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=it(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var d,m,g,y,E;si.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=oh([((m=this.opts)==null?void 0:m.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(Gn.OrderedConsumerRecreated,f.name);break}catch(T){if(T.message==="stream not found"&&((y=this.iter)==null||y.notify(Gn.StreamNotFound,w),this.type===vn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(T),Promise.reject(T);if(s&&w>=this.maxInitialReset)throw T;await zr(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===vn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new p_),this.consumer=new Qf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let d=null;this.type===vn.Fetch&&a?d=await this.consumer.fetch(n):this.type===vn.Consume&&(d=await this.consumer.consume(n));const m=d;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(kr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===vn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===vn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=vn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===vn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=vn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=rt();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Xf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Be.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Qf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Qf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new dh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new g_(this.api,n,s))).catch(f=>Promise.reject(f))}}class sc{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new sc(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Xf(new Io(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Xf(new Io(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class dh extends Wa{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Be.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Be.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Be.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Be.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Be.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var m;if((((m=f==null?void 0:f.subject_transforms)==null?void 0:m.length)||0)>0){const{min:g,ok:y}=s.features.get(Be.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),zt(n.name),n.mirror=To(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(To);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return zt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var m;if(typeof n=="object"){const g=n;n=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),zt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=To(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(To);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(d),d}async info(n,s){zt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:d,limit:m}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(d&&d>g){const y=[f],E=s||{};let w=0;for(;d>g;){w++,E.offset=m*w;const z=await this._request(a,E);d=z.total,y.push(z);const M=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=M,M<m)break}let T={};for(let z=0;z<y.length;z++)f=y[z],f.state.subjects&&(T=Object.assign(T,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=T}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const d=f;return d.streams.forEach(m=>{this._fixInfo(m)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new Ha(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return zt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){zt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){zt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Xg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(nn));f.forEach(y=>{this._fixInfo(y)});let d="";return f.length&&(d=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Qg(y,d))},s=`${this.prefix}.STREAM.LIST`;return new Ha(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(m=>m.config.name.startsWith(hh));return f.forEach(m=>{this._fixInfo(m)}),f.map(m=>new Jf(m))},s=`${this.prefix}.STREAM.LIST`;return new Ha(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Ha(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new sc(this,s))}}class y_ extends Wa{constructor(n,s){super(n,s)}async getMessage(n,s){zt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):an,d=this.opts.apiPrefix||"$JS.API",m=o?`${d}.DIRECT.GET.${n}.${o}`:`${d}.DIRECT.GET.${n}`,g=await this.nc.request(m,f,{timeout:this.timeout}),y=Tr(g);if(y)return Promise.reject(y);const E=new Kf(g);return Promise.resolve(E)}async getBatch(n,s){zt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),d=new jt,m=await this.nc.requestMany(o,f,{strategy:Dn.SentinelMsg});return(async()=>{var w,T,z;let g=!1,y=!1,E;for await(const M of m){if(!g){g=!0;const q=((w=M.headers)==null?void 0:w.code)||0;if(q!==0&&q<200||q>299){E=(T=M.headers)==null?void 0:T.description.toLowerCase();break}if(((z=M.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;d.push(new Kf(M))}d.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);d.stop()})})(),Promise.resolve(d)}}class Kf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(wr.Subject)}get seq(){const n=this.header.last(wr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(wr.TimeStamp)}get stream(){return this.header.last(wr.Stream)}json(n){return zn(n).decode(this.data)}string(){return sn.decode(this.data)}}v(Kf,"jc");class b_ extends Wa{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new dh(s,a),this.consumers=new Io(s,a),this.direct=new y_(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new jt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),d=f.type.split("."),m=d[d.length-1];s.push({kind:m,data:f})}catch(f){s.stop(f)}}}),s}}class Xg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}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):an}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Ws.decode(n)}else this._header=ys();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return zn(n).decode(this.data)}string(){return sn.decode(this.data)}}v(Xg,"jc");class x_{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new sc(this.api,s))}}class Of{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Ws.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 n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function I0(i){const n={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const s=i.headers;n.headers=s.toRecord()}return n}function v_(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class Fa{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new Of(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),m=zn().decode(f.data);return m.revision=f.seq,m}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Jf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Jf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:d}=a,m=this.js.nc.info,g=(m==null?void 0:m.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:T}=this._checkNotEmpty(n.name);if(T)return Promise.reject(T);const z=si.next(),M=this._chunkSubject(z),q=this._metaSubject(w),Q=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},I0(n)),W=rt(),te=[],fe=new Rr;try{const N=s?s.getReader():null,V=q0.create();for(;;){const{done:ae,value:P}=N?await N.read():{done:!0,value:void 0};if(ae){if(fe.size()>0){const ie=fe.drain();V.update(ie),Q.chunks++,Q.size+=ie.length,te.push(this.js.publish(M,ie,{timeout:f}))}await Promise.all(te),te.length=0,Q.mtime=new Date().toISOString();const F=Nr.encode(V.digest());Q.digest=`${V0}${F}`,Q.deleted=!1;const X=ys();typeof d=="number"&&X.set(Yn.ExpectedLastSubjectSequenceHdr,`${d}`),X.set(Ut.RollupHdr,Ut.RollupValueSubject);const oe=await this.js.publish(q,zn().encode(Q),{headers:X,timeout:f});if(Q.revision=oe.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}W.resolve(new Of(Q));break}if(P)for(fe.fill(P);fe.size()>y;){Q.chunks++,Q.size+=y;const F=fe.drain(n.options.max_chunk_size);V.update(F),te.push(this.js.publish(M,F,{timeout:f}))}}}catch(N){await this.jsm.streams.purge(this.stream,{filter:M}),W.reject(N)}return W}putBlob(n,s,a){function o(f){return new ReadableStream({pull(d){d.enqueue(f),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const d=new Rr,m=f.getReader();for(;;){const{done:g,value:y}=await m.read();if(g)return d.drain();y&&y.length&&d.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Fa.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(V0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Yf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=rt(),f={info:new Of(s),error:o};if(s.size===0)return f.data=v_(),o.resolve(null),Promise.resolve(f);let d;const m=ei();m.orderedConsumer();const g=q0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,m);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),d.enqueue(w.data)),w.info.pending===0&&(o1(a,g.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{d.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){d=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Fa))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const d={name:o,options:{link:{bucket:a.name}}};return this._put(d,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);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 f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},m={name:a,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(n),JSON.stringify(m));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=zn(),o=ys();return o.set(Ut.RollupHdr,Ut.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==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=o;const d=Object.assign({},a,I0(s)),m=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(m)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new jt,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=zn(),d=ei();d.orderedConsumer(),n.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const m=await this.js.subscribe(o,d);return a._data=m,a.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${Nr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=c_(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ja.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?ii.S2:ii.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new Fa(s,o,n);return await f.init(a),Promise.resolve(f)}}class __{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Be.JS_KV);return o?s.bindOnly?Xa.bind(this.js,n,s):Xa.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(Be.JS_OBJECTSTORE);return o?Fa.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class mh extends Wa{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Io(s,a),this.streamAPI=new dh(s,a),this.consumers=new Xf(this.consumerAPI),this.streams=new x_(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new __(this)}async publish(s,a=an,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||ys();o&&(o.msgID&&f.set(Yn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Yn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Yn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Yn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Yn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,m={};d&&(m.timeout=d),o&&(m.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let T=0;T<g;T++)try{E=await this.nc.request(s,a,m);break}catch(z){if(z.code==="503"&&T+1<g)await zr(y);else throw z}const w=this.parseJsResponse(E);if(w.stream==="")throw de.errorForCode(le.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){zt(s),Or(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:it(o);const d={batch:1,no_wait:o===0,expires:o},m=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(d),{noMux:!0,timeout:f}),g=Tr(m);if(g)throw g;return Ka(m,this.timeout)}fetch(s,a,o={}){zt(s),Or(a);let f=null;const d=(o.max_bytes??0)>0;let m=0;const g=d?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const te=this.nc.features.get(Be.JS_PULL_MAX_BYTES);if(!te.ok)throw new Error(`max_bytes is only supported on servers ${te.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=it(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const T=o.idle_heartbeat||0;T&&(E.idle_heartbeat=it(T),o.delay_heartbeat===!0&&(E.idle_heartbeat=it(T*4)));const z=new jt,M=E.batch;let q=0;z.protocolFilterFn=(te,fe=!1)=>Hf(te.msg)?(y==null||y.work(),!1):!0,z.dispatchedFn=te=>{if(te){if(d&&(m+=te.data.length),q++,f&&te.info.pending===0)return;(z.getPending()===1&&te.info.pending===0||M===q||g>0&&m>=g)&&z.stop()}};const Q=gs(this.nc.options.inboxPrefix),W=this.nc.subscribe(Q,{max:o.batch,callback:(te,fe)=>{te===null&&(te=Tr(fe)),te!==null?(f&&(f.cancel(),f=null),Yv(te)?z.stop(Zg(te)===null?void 0:te):z.stop(te)):(y==null||y.work(),z.received++,z.push(Ka(fe,this.timeout)))}});return w&&(f=Cr(w),f.catch(()=>{W.isClosed()||(W.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{T&&(y=new fh(T,te=>(z.push(()=>{z.err=new de(`${_n.IdleHeartbeatMissed}: ${te}`,le.JetStreamIdleHeartBeat)}),!0)))}catch{}await W.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:Q}),z}async pullSubscribe(s,a=ei()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===At.None||f===At.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),m=new A_(this,o.deliver,d);m.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw m.unsubscribe(),g}return m}async subscribe(s,a=ei()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),d=new Kg(this,o.deliver,f);d.info=o;try{await this._maybeCreateConsumer(o)}catch(m){throw d.unsubscribe(),m}return d._maybeSetupHbMonitoring(),d}async _processOptions(s,a=ei()){const o=M0(a)?a.getOpts():a;if(o.isBind=M0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==At.NotSet&&o.config.ack_policy!==At.None)throw new de("ordered consumer: ack_policy can only be set to 'none'",le.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new de("ordered consumer: durable_name cannot be set",le.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new de("ordered consumer: deliver_subject cannot be set",le.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new de("ordered consumer: max_deliver cannot be set",le.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new de("ordered consumer: deliver_group cannot be set",le.ApiError);o.config.deliver_subject=gs(this.nc.options.inboxPrefix),o.config.ack_policy=At.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||it(5e3),o.config.ack_wait=it(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===At.NotSet&&(o.config.ack_policy=At.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&f.push_bound===!0)throw new Error("duplicate subscription");const m=f.config.deliver_group??"";if(d!==m)throw m===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${m}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||gs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=j_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=mh.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const d=o;return Lf(d.msg)?(f||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==At.None&&(a.dispatchedFn=N_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}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:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Mr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const d=a;if(Tr(d.msg)||(g=f.monitor)==null||g.work(),Hf(d.msg)){const y=s?f._checkHbOrderConsumer(d.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Lf(d.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class ph{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=G1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new ph(n);Qo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const d of f.status())o.listeners.forEach(m=>{m.push(d)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw de.errorForCode(le.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw de.errorForCode(le.ConnectionDraining);if(n=n||"",n.length===0)throw de.errorForCode(le.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Ig(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=an,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Dn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new de("timeout",le.InvalidOption));const f=new jt;function d(g){f.push(()=>{f.stop(g)})}function m(g,y){g||y===null?d(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(gs(this.options.inboxPrefix),{callback:(M,q)=>{var Q,W;if(((Q=q==null?void 0:q.data)==null?void 0:Q.length)===0&&((W=q==null?void 0:q.headers)==null?void 0:W.status)===le.NoResponders&&(M=de.errorForCode(le.NoResponders)),M){g&&(M.stack+=`
|
|
48
|
-
|
|
49
|
-
${g}`),w(M);return}m(null,q),a.strategy===Dn.Count&&(y--,y===0&&w()),a.strategy===Dn.JitterTimer&&(z(),T=setTimeout(()=>{w()},300)),a.strategy===Dn.SentinelMsg&&q&&q.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{d()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),z(),E.drain().then(()=>{d()}).catch(q=>{d()})};f.iterClosed.then(()=>{z(),E==null||E.unsubscribe()}).catch(M=>{z(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let T=setTimeout(()=>{w()},a.maxWait);const z=()=>{T&&clearTimeout(T)}}else{const g=a;g.callback=m,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new c1(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(E){y.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new de("timeout",le.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new de("reply can only be used with noMux",le.InvalidOption));if(a.noMux){const f=a.reply?a.reply:gs(this.options.inboxPrefix),d=rt(),m=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(m&&y.code!==le.Timeout&&(y.stack+=`
|
|
50
|
-
|
|
51
|
-
${m.stack}`),g.unsubscribe(),d.reject(y)):(y=Bg(E),y?(m&&(y.stack+=`
|
|
52
|
-
|
|
53
|
-
${m.stack}`),d.reject(y)):d.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),d}else{const f=new Pg(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(m){f.cancel(m)}const d=Promise.race([f.timer,f.deferred]);return d.catch(()=>{f.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(de.errorForCode(le.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(de.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(de.errorForCode(le.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new jt;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new b_(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===le.NoResponders&&(o.code=le.JetStreamNotEnabled),o}return s}jetstream(n={}){return new mh(this,n)}getServerVersion(){const n=this.info;return n?ki(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw de.errorForCode(le.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new w_(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(de.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(de.errorForCode(le.ConnectionDraining)):this.protocol.reconnect()}}class w_{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new el(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new t_(this.nc,n,s)}}class S_{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}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(Xo)||"PUT"}get length(){const n=this.sm.header.get(Ut.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class E_{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(ch(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Xo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Ut.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Kg extends d1{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(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 a=gs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=si.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=mt.StartSequence,f.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,d,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new de(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,le.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(ch(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,d=m=>{var E,w,T,z;const g=Iv(409,`${_n.IdleHeartbeatMissed}: ${m}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((T=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:T.stream_seq)||0;return this._resetOrderedConsumer(M+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new fh(s,d,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Ut.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Ut.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class A_ extends Kg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,d={};if(d.batch=n.batch||1,d.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(Be.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);d.max_bytes=n.max_bytes}let m=0;n.expires&&n.expires>0&&(m=n.expires,d.expires=it(m));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,d.idle_heartbeat=it(g)),g&&m===0)throw new Error("idle_heartbeat requires expires");if(g>m)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),m&&g&&(this.monitor?this.monitor._change(g,m):this._setupHbMonitoring(g,m));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(d),{reply:w})}}}function j_(i,n){return i?T_(n):O_(n)}function O_(i){return(n,s)=>n?[n,null]:(n=Tr(s),n?[n,null]:[null,Ka(s,i)])}function T_(i){return(n,s)=>{if(n)return[n,null];const a=Tr(s);return a!==null?[Zg(a),null]:[null,Ka(s,i)]}}function Zg(i){if(i!==null)switch(i.code){case le.JetStream404NoMessages:case le.JetStream408RequestTimeout:return null;case le.JetStream409:return Jv(i)?i:null;default:return i}return null}function N_(i){i&&i.ack()}function k_(i){const n=i.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class C_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,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=k_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Da[0]&&n[1]===Da[1]&&n[2]===Da[2]&&n[3]===Da[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=rt();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,d=!((a=f.options)!=null&&a.noAsyncTraces),m=new Pg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},d);f.request(m);try{f.publish(this.msg.reply,F0,{reply:`${f.muxSubscriptions.baseInbox}${m.token}`})}catch(g){m.cancel(g)}try{await Promise.race([m.timer,m.deferred]),s.resolve(!0)}catch(g){m.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(F0)}nak(n){let s=f_;n&&(s=Bf().encode(`-NAK ${JSON.stringify({delay:it(n)})}`)),this.doAck(s)}working(){this.doAck(Da)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=it(s.expires));const o=zn().encode(a),f=Rr.concat(h_,m_,o),d=n?{reply:n}:void 0;this.msg.respond(f,d)}term(n=""){let s=d_;(n==null?void 0:n.length)>0&&(s=Bf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const M_="1.30.3",R_="nats.ws";class D_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=M_,this.lang=R_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=rt(),this.closedNotification=rt()}async connect(n,s){const a=rt();if(s.tls)return a.reject(new de("tls",le.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:d}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=d}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const d=Rr.concat(...this.yields),m=x1(d);if(m!==""){const g=I1.exec(m);if(!g){s.debug&&console.error("!!!",Ao(d)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);V1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(f.wasClean||(d=new Error(f.reason)),this._closed(d))},this.socket.onerror=f=>{if(this.isDiscarded())return;const d=f,m=new de(d.message,le.Unknown,new Error(d.error));a.reject(m)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await zr(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}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 n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${Ao(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=rt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${Ao(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${Ao(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function z_(i,n){/^(.*:\/\/)(.*)/.test(i)||(typeof n=="boolean"?i=`${n===!0?"https":"http"}://${i}`:i=`https://${i}`);let a=new URL(i);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${i}`));let f,d;const m=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":d=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":d=a.port||"443",f="wss:";break;default:d=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${m}:${d}${g}${y}`}function q_(i={}){return m1({defaultPort:443,urlParseFn:z_,factory:()=>new D_}),ph.connect(i)}const U_=null,B_=null,L_="lt.events";function Wg(i,n){const s=i.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const tl=O.createContext({connected:!1,subscribe:()=>()=>{}});function H_(){const{connected:i}=O.useContext(tl);return{connected:i}}function P_(i,n){const{subscribe:s}=O.useContext(tl),a=O.useRef(n);a.current=n,O.useEffect(()=>s(i,f=>a.current(f)),[s,i])}const $_=O.createContext({connected:!1,subscribe:()=>()=>{}}),Y_=Bf();function G_({children:i,url:n,token:s}){const a=O.useRef(null),o=O.useRef(null),[f,d]=O.useState(!1),m=O.useRef(null),g=O.useRef(new Map),y=O.useCallback((T,z)=>{const M=g.current;return M.has(T)||M.set(T,new Set),M.get(T).add(z),()=>{const q=M.get(T);q&&(q.delete(z),q.size===0&&M.delete(T))}},[]),E=O.useCallback((T,z)=>{for(const[M,q]of g.current)if(Wg(T,M))for(const Q of q)try{Q(z)}catch{}},[]),w=O.useCallback(async()=>{try{if(a.current)return;const T=n||U_;if(!T){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const z=await q_({servers:T,token:s||B_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=z,d(!0);const M=z.subscribe("lt.>");o.current=M,(async()=>{for await(const q of M)try{const Q=JSON.parse(Y_.decode(q.data));E(q.subject,Q)}catch{}})(),(async()=>{for await(const q of z.status())q.type==="disconnect"||q.type==="error"?d(!1):q.type==="reconnect"&&d(!0)})()}catch{d(!1),m.current=setTimeout(w,3e3)}},[E]);return O.useEffect(()=>(w(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),d(!1)}),[w]),h.jsx($_.Provider,{value:{connected:f,subscribe:y},children:h.jsx(tl.Provider,{value:{connected:f,subscribe:y},children:i})})}const Fn=Object.create(null);Fn.open="0";Fn.close="1";Fn.ping="2";Fn.pong="3";Fn.message="4";Fn.upgrade="5";Fn.noop="6";const Uo=Object.create(null);Object.keys(Fn).forEach(i=>{Uo[Fn[i]]=i});const Zf={type:"error",data:"parser error"},ey=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ty=typeof ArrayBuffer=="function",ny=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,gh=({type:i,data:n},s,a)=>ey&&n instanceof Blob?s?a(n):J0(n,a):ty&&(n instanceof ArrayBuffer||ny(n))?s?a(n):J0(new Blob([n]),a):a(Fn[i]+(n||"")),J0=(i,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(i)};function Q0(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Tf;function V_(i,n){if(ey&&i.data instanceof Blob)return i.data.arrayBuffer().then(Q0).then(n);if(ty&&(i.data instanceof ArrayBuffer||ny(i.data)))return n(Q0(i.data));gh(i,!1,s=>{Tf||(Tf=new TextEncoder),n(Tf.encode(s))})}const X0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<X0.length;i++)Pa[X0.charCodeAt(i)]=i;const F_=i=>{let n=i.length*.75,s=i.length,a,o=0,f,d,m,g;i[i.length-1]==="="&&(n--,i[i.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Pa[i.charCodeAt(a)],d=Pa[i.charCodeAt(a+1)],m=Pa[i.charCodeAt(a+2)],g=Pa[i.charCodeAt(a+3)],E[o++]=f<<2|d>>4,E[o++]=(d&15)<<4|m>>2,E[o++]=(m&3)<<6|g&63;return y},I_=typeof ArrayBuffer=="function",yh=(i,n)=>{if(typeof i!="string")return{type:"message",data:sy(i,n)};const s=i.charAt(0);return s==="b"?{type:"message",data:J_(i.substring(1),n)}:Uo[s]?i.length>1?{type:Uo[s],data:i.substring(1)}:{type:Uo[s]}:Zf},J_=(i,n)=>{if(I_){const s=F_(i);return sy(s,n)}else return{base64:!0,data:i}},sy=(i,n)=>{switch(n){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},iy="",Q_=(i,n)=>{const s=i.length,a=new Array(s);let o=0;i.forEach((f,d)=>{gh(f,!1,m=>{a[d]=m,++o===s&&n(a.join(iy))})})},X_=(i,n)=>{const s=i.split(iy),a=[];for(let o=0;o<s.length;o++){const f=yh(s[o],n);if(a.push(f),f.type==="error")break}return a};function K_(){return new TransformStream({transform(i,n){V_(i,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}i.data&&typeof i.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let Nf;function No(i){return i.reduce((n,s)=>n+s.length,0)}function ko(i,n){if(i[0].length===n)return i.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=i[0][a++],a===i[0].length&&(i.shift(),a=0);return i.length&&a<i[0].length&&(i[0]=i[0].slice(a)),s}function Z_(i,n){Nf||(Nf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(d,m){for(s.push(d);;){if(a===0){if(No(s)<1)break;const g=ko(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(No(s)<2)break;const g=ko(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(No(s)<8)break;const g=ko(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue(Zf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(No(s)<o)break;const g=ko(s,o);m.enqueue(yh(f?g:Nf.decode(g),n)),a=0}if(o===0||o>i){m.enqueue(Zf);break}}}})}const ry=4;function xt(i){if(i)return W_(i)}function W_(i){for(var n in xt.prototype)i[n]=xt.prototype[n];return i}xt.prototype.on=xt.prototype.addEventListener=function(i,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(n),this};xt.prototype.once=function(i,n){function s(){this.off(i,s),n.apply(this,arguments)}return s.fn=n,this.on(i,s),this};xt.prototype.off=xt.prototype.removeListener=xt.prototype.removeAllListeners=xt.prototype.removeEventListener=function(i,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+i];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+i],this};xt.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+i],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};xt.prototype.emitReserved=xt.prototype.emit;xt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};xt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const ic=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),wn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),ew="arraybuffer";function ay(i,...n){return n.reduce((s,a)=>(i.hasOwnProperty(a)&&(s[a]=i[a]),s),{})}const tw=wn.setTimeout,nw=wn.clearTimeout;function rc(i,n){n.useNativeTimers?(i.setTimeoutFn=tw.bind(wn),i.clearTimeoutFn=nw.bind(wn)):(i.setTimeoutFn=wn.setTimeout.bind(wn),i.clearTimeoutFn=wn.clearTimeout.bind(wn))}const sw=1.33;function iw(i){return typeof i=="string"?rw(i):Math.ceil((i.byteLength||i.size)*sw)}function rw(i){let n=0,s=0;for(let a=0,o=i.length;a<o;a++)n=i.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function ly(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function aw(i){let n="";for(let s in i)i.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(i[s]));return n}function lw(i){let n={},s=i.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class ow extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class bh extends xt{constructor(n){super(),this.writable=!1,rc(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new ow(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=yh(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_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(n){const s=aw(n);return s.length?"?"+s:""}}class cw extends bh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};X_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,Q_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=ly()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let oy=!1;try{oy=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const uw=oy;function fw(){}class hw extends cw{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Vn extends xt{constructor(n,s,a){super(),this.createRequest=n,rc(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=ay(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Vn.requestsCount++,Vn.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=fw,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Vn.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Vn.requestsCount=0;Vn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",K0);else if(typeof addEventListener=="function"){const i="onpagehide"in wn?"pagehide":"unload";addEventListener(i,K0,!1)}}function K0(){for(let i in Vn.requests)Vn.requests.hasOwnProperty(i)&&Vn.requests[i].abort()}const dw=(function(){const i=cy({xdomain:!1});return i&&i.responseType!==null})();class mw extends hw{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=dw&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Vn(cy,this.uri(),n)}}function cy(i){const n=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||uw))return new XMLHttpRequest}catch{}if(!n)try{return new wn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const uy=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class pw extends bh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=uy?{}:ay(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;gh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&ic(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=ly()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const kf=wn.WebSocket||wn.MozWebSocket;class gw extends pw{createSocket(n,s,a){return uy?new kf(n,s,a):s?new kf(n,s):new kf(n)}doWrite(n,s){this.ws.send(s)}}class yw extends bh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=Z_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=K_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:m,value:g})=>{m||(this.onPacket(g),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&ic(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const bw={websocket:gw,webtransport:yw,polling:mw},xw=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vw=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Wf(i){if(i.length>8e3)throw"URI too long";const n=i,s=i.indexOf("["),a=i.indexOf("]");s!=-1&&a!=-1&&(i=i.substring(0,s)+i.substring(s,a).replace(/:/g,";")+i.substring(a,i.length));let o=xw.exec(i||""),f={},d=14;for(;d--;)f[vw[d]]=o[d]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=_w(f,f.path),f.queryKey=ww(f,f.query),f}function _w(i,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function ww(i,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const eh=typeof addEventListener=="function"&&typeof removeEventListener=="function",Bo=[];eh&&addEventListener("offline",()=>{Bo.forEach(i=>i())},!1);class ti extends xt{constructor(n,s){if(super(),this.binaryType=ew,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Wf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Wf(s.host).host);rc(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(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),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=lw(this.opts.query)),eh&&(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"})},Bo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=ry,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&ti.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.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",ti.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.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=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),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 n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=iw(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,ic(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{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?a():n()}):this.upgrading?a():n()),this}_onError(n){if(ti.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,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(),eh&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Bo.indexOf(this._offlineEventListener);a!==-1&&Bo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}ti.protocol=ry;class Sw extends ti{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;ti.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;ti.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const T=new Error("probe error");T.transport=s.name,this.emitReserved("upgradeError",T)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const d=w=>{const T=new Error("probe error: "+w);T.transport=s.name,f(),this.emitReserved("upgradeError",T)};function m(){d("transport closed")}function g(){d("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",m),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",d),s.once("close",m),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let Ew=class extends Sw{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>bw[o]).filter(o=>!!o)),super(n,a)}};function Aw(i,n="",s){let a=i;s=s||typeof location<"u"&&location,i==null&&(i=s.protocol+"//"+s.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=s.protocol+i:i=s.host+i),/^(https?|wss?):\/\//.test(i)||(typeof s<"u"?i=s.protocol+"//"+i:i="https://"+i),a=Wf(i)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const jw=typeof ArrayBuffer=="function",Ow=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,fy=Object.prototype.toString,Tw=typeof Blob=="function"||typeof Blob<"u"&&fy.call(Blob)==="[object BlobConstructor]",Nw=typeof File=="function"||typeof File<"u"&&fy.call(File)==="[object FileConstructor]";function xh(i){return jw&&(i instanceof ArrayBuffer||Ow(i))||Tw&&i instanceof Blob||Nw&&i instanceof File}function Lo(i,n){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let s=0,a=i.length;s<a;s++)if(Lo(i[s]))return!0;return!1}if(xh(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Lo(i.toJSON(),!0);for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&Lo(i[s]))return!0;return!1}function kw(i){const n=[],s=i.data,a=i;return a.data=th(s,n),a.attachments=n.length,{packet:a,buffers:n}}function th(i,n){if(!i)return i;if(xh(i)){const s={_placeholder:!0,num:n.length};return n.push(i),s}else if(Array.isArray(i)){const s=new Array(i.length);for(let a=0;a<i.length;a++)s[a]=th(i[a],n);return s}else if(typeof i=="object"&&!(i instanceof Date)){const s={};for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=th(i[a],n));return s}return i}function Cw(i,n){return i.data=nh(i.data,n),delete i.attachments,i}function nh(i,n){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<n.length)return n[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let s=0;s<i.length;s++)i[s]=nh(i[s],n);else if(typeof i=="object")for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(i[s]=nh(i[s],n));return i}const Mw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(qe||(qe={}));class Rw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&Lo(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=kw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class vh extends xt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new Dw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(xh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),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: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const d=n.substring(f,s);if(d!=Number(d)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(d);if(!zw(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=m}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const d=n.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(vh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case qe.CONNECT:return Z0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||Z0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Mw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Dw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=Cw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const zw=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function Z0(i){return Object.prototype.toString.call(i)==="[object Object]"}const qw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:vh,Encoder:Rw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function Rn(i,n,s){return i.on(n,s),function(){i.off(n,s)}}const Uw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class hy extends xt{constructor(n,s,a){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=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[Rn(n,"open",this.onopen.bind(this)),Rn(n,"packet",this.onpacket.bind(this)),Rn(n,"error",this.onerror.bind(this)),Rn(n,"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(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(Uw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:qe.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),d.id=E}const m=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===n&&this.sendBuffer.splice(m,1);s.call(this,new Error("operation has timed out"))},o),d=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};d.withError=!0,this.acks[n]=d}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(d,m)=>d?o(d):a(m);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:qe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case qe.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.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 qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function qr(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}qr.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*i);i=(Math.floor(n*10)&1)==0?i-s:i+s}return Math.min(i,this.max)|0};qr.prototype.reset=function(){this.attempts=0};qr.prototype.setMin=function(i){this.ms=i};qr.prototype.setMax=function(i){this.max=i};qr.prototype.setJitter=function(i){this.jitter=i};class sh extends xt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,rc(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((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new qr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||qw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new Ew(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Rn(s,"open",function(){a.onopen(),n&&n()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},d=Rn(s,"error",f);if(this._timeout!==!1){const m=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},m);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(Rn(n,"ping",this.onping.bind(this)),Rn(n,"data",this.ondata.bind(this)),Rn(n,"error",this.onerror.bind(this)),Rn(n,"close",this.onclose.bind(this)),Rn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){ic(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new hy(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=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 a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const za={};function Ho(i,n){typeof i=="object"&&(n=i,i=void 0),n=n||{};const s=Aw(i,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,d=za[o]&&f in za[o].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||d;let g;return m?g=new sh(a,n):(za[o]||(za[o]=new sh(a,n)),g=za[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(Ho,{Manager:sh,Socket:hy,io:Ho,connect:Ho});const Bw=O.createContext({connected:!1,subscribe:()=>()=>{}});function Lw({children:i}){const n=O.useRef(null),[s,a]=O.useState(!1),o=O.useRef(new Map),f=O.useCallback((m,g)=>{const y=o.current;return y.has(m)||y.set(m,new Set),y.get(m).add(g),()=>{const E=y.get(m);E&&(E.delete(g),E.size===0&&y.delete(m))}},[]),d=O.useCallback((m,g)=>{for(const[y,E]of o.current)if(Wg(m,y))for(const w of E)try{w(g)}catch{}},[]);return O.useEffect(()=>{const m=Dg(),g=Ho({path:`${Vt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...m?{auth:{token:m}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;d(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[d]),h.jsx(Bw.Provider,{value:{connected:s,subscribe:f},children:h.jsx(tl.Provider,{value:{connected:s,subscribe:f},children:i})})}function Hw({children:i}){const[n,s]=O.useState(null),[a,o]=O.useState({url:null,token:null});return O.useEffect(()=>{let f=!1;async function d(){var m;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Vt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(m=y==null?void 0:y.events)==null?void 0:m.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,T=null;const z=Dg();if(z)try{const M=await fetch(`${Vt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${z}`}});if(M.ok){const q=await M.json();w=q.natsWsUrl??w,T=q.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:T})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return d(),()=>{f=!0}},[]),n==="nats"?h.jsx(G_,{url:a.url,token:a.token,children:i}):n==="socketio"?h.jsx(Lw,{children:i}):h.jsx(h.Fragment,{children:i})}const _h="lt_view_as",wh="lt_ai_override";function dy(){try{const i=localStorage.getItem(wh);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function Pw(i){try{localStorage.setItem(wh,String(i))}catch{}}function $w(){try{localStorage.removeItem(wh)}catch{}}function my(){try{const i=localStorage.getItem(_h);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function Yw(i){try{localStorage.setItem(_h,i)}catch{}window.location.reload()}function py(){try{localStorage.removeItem(_h)}catch{}window.location.reload()}function gy(){const{isSuperAdmin:i,hasRoleType:n,hasRole:s}=ai(),a=my(),o=i||s("engineer"),f=n("admin"),d=i||n("admin");return{isBuilder:a?!1:o,isOps:a?a==="admin"||a==="engineer":f,canBulk:a?!1:d,viewAs:a,realIsBuilder:o}}const Gw="lt_ai_override";function Vw(){return Ye("/settings")}function Fw(){try{if(localStorage.getItem(Gw)==="off")return!1}catch{}return null}function Ur(){var s;const i=Sn({queryKey:["settings"],queryFn:Vw,staleTime:1/0}),n=Fw();return i.data&&n===!1&&((s=i.data.ai)!=null&&s.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}const yy=O.createContext(null),W0="lt_sidebar_collapsed";function Iw({children:i}){const[n,s]=O.useState(()=>{try{return localStorage.getItem(W0)==="true"}catch{return!1}}),a=O.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(W0,String(f))}catch{}return f})},[]);return h.jsx(yy.Provider,{value:{collapsed:n,toggle:a},children:i})}function by(){const i=O.useContext(yy);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}function xy(i,n){var s,a,o,f,d;n.facets&&Object.keys(n.facets).length&&i.set("facets",JSON.stringify(n.facets)),(s=n.block)!=null&&s.length&&i.set("block",JSON.stringify(n.block)),(a=n.range)!=null&&a.length&&i.set("range",JSON.stringify(n.range)),(o=n.exists)!=null&&o.length&&i.set("exists",JSON.stringify(n.exists)),(f=n.roles)!=null&&f.length&&i.set("roles",JSON.stringify(n.roles)),(d=n.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(n.orderBy)),n.available!==void 0&&i.set("available",String(n.available))}function RA(i,n){const s=i??"24h";return Sn({queryKey:["stationMetrics",s],queryFn:()=>Ye(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(n==null?void 0:n.enabled)??!0})}function DA(i){const n=i?`?period=${i}`:"";return Sn({queryKey:["escalationStats",i],queryFn:()=>Ye(`/escalations/stats${n}`)})}function zA(){return Sn({queryKey:["escalationTypes"],queryFn:()=>Ye("/escalations/types")})}function qA(i=!0){return Sn({queryKey:["escalationFacetKeys"],queryFn:()=>Ye("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function Jw(i){const{enabled:n=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),xy(o,a),Sn({queryKey:["escalations",a],queryFn:()=>Ye(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function Qw(i){const{enabled:n=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),xy(o,a),Sn({queryKey:["escalations","available",a],queryFn:()=>Ye(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function UA(i){return Sn({queryKey:["escalations","by-workflow",i],queryFn:()=>Ye(`/escalations/by-workflow/${i}`),enabled:!!i})}function BA(i){return Sn({queryKey:["escalations",i],queryFn:()=>Ye(`/escalations/${i}`),enabled:!!i})}function LA(){const i=on();return En({mutationFn:({id:n,durationMinutes:s})=>Ye(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function HA(){const i=on();return En({mutationFn:n=>Ye(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function PA(){const i=on();return En({mutationFn:({id:n,resolverPayload:s})=>Ye(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function $A(){const i=on();return En({mutationFn:({id:n,targetRole:s})=>Ye(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function YA(){const i=on();return En({mutationFn:({ids:n,priority:s})=>Ye("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function GA(){const i=on();return En({mutationFn:({ids:n,durationMinutes:s})=>Ye("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function VA(){const i=on();return En({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Ye("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function FA(){const i=on();return En({mutationFn:({ids:n,targetRole:s})=>Ye("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function IA(){const i=on();return En({mutationFn:({ids:n,hint:s})=>Ye("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function JA(){const i=on();return En({mutationFn:n=>Ye(`/escalations/${n}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function QA(){const i=on();return En({mutationFn:({ids:n})=>Ye("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:n})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Xw(){const{user:i}=ai(),n=i==null?void 0:i.userId,s=on(),a=O.useRef(null),o=O.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);P_(`${L_}.system.escalation.>`,o);const{data:f}=Qw({limit:1}),{data:d}=Jw({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(d==null?void 0:d.total)??0}}function Sh({size:i="sm",hideLabel:n=!1,className:s="",appName:a="LongTail"}){const o=i==="lg",f=o?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",d=o?"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 h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":a,className:`logo-mark shrink-0 z-0 ${f}`,style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${d} ${n?"opacity-0":""}`,children:a})]})}const Kw=[{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"}],Zw=["operator","engineer","admin","superadmin"];function eg(i){return Zw.indexOf(i)}function Ww(i,n){return eg(i)>=eg(n)}function e2(i){return i==="superadmin"?"superadmin":i==="admin"?"admin":i==="engineer"?"engineer":"operator"}function t2({onClose:i}){var fe,re,N,V,ae;const{isSuperAdmin:n,hasRoleType:s,hasRole:a}=ai(),{data:o}=Ur(),f=my(),d=!!((fe=o==null?void 0:o.ai)!=null&&fe.enabled),m=dy(),g=m!==null?m:d,[y,E]=O.useState(g),w=n?"superadmin":s("admin")?"admin":a("engineer")?"engineer":"operator",T=((re=o==null?void 0:o.branding)==null?void 0:re.appName)??"LongTail",z=(N=o==null?void 0:o.environment)==null?void 0:N.longTailVersion,M=(V=o==null?void 0:o.environment)==null?void 0:V.hotmeshVersion,q=(ae=o==null?void 0:o.environment)==null?void 0:ae.nodeEnv;O.useEffect(()=>{const P=F=>{F.key==="Escape"&&i()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[i]);const Q=Kw.filter(P=>Ww(w,P.minTier)),W=Q.length>1,te=P=>{P===null?py():Yw(P)};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:P=>P.stopPropagation(),children:[h.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Dr,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:T}),z&&h.jsxs("p",{className:"mt-1 text-[11px] text-text-tertiary",children:["v",z,M&&h.jsxs(h.Fragment,{children:[" · HotMesh v",M]}),q&&q!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:q})]})]})]}),W&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/50 mb-6"}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),Q.map(P=>{const F=f===P.id,X=P.id===null?`Your view · ${e2(w)}`:P.label;return h.jsxs("button",{onClick:()=>te(P.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${F?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:F&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${F?"text-accent":"text-text-primary group-hover:text-accent"}`,children:X}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:P.description})]})]},String(P.id))})]}),h.jsx("div",{className:"mt-6 mb-2"})]}),h.jsx("hr",{className:"border-surface-border/50 mt-4"}),h.jsxs("div",{className:"mt-6 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:()=>{const P=!y;E(P),P===d?$w():Pw(P),window.location.reload()},className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:y?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${y?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${y?"translate-x-4":"translate-x-0"}`})})]})]}),h.jsx("hr",{className:"border-surface-border/50 mt-4"}),h.jsx("p",{className:"mt-4 text-[10px] text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const vy=["violet","red","green","blue","rose","orange"],tg="blue",n2={violet:"#7B3BE0",red:"#DC382D",green:"#059669",blue:"#2563EB",rose:"#D6246E",orange:"#E85D04"},ng={violet:"Violet",red:"Brick",green:"Emerald",blue:"Electric",rose:"Raspberry",orange:"Harvest"},_y="lt.theme";function s2(i){return vy.includes(i)}function wy(){try{const i=localStorage.getItem(_y);return s2(i)?i:tg}catch{return tg}}function Sy(i){document.documentElement.dataset.theme=i}function i2(i){try{localStorage.setItem(_y,i)}catch{}Sy(i)}function r2(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function a2(i){var n;return((n=i.title)==null?void 0:n.trim())||r2(i.role)}const Ey=800,Ay=270,Sr=40,l2=76,Eh=24,o2=72,Po=Ey-Sr-l2,jy=Ay-Eh-o2,Cn=Eh+jy,sg=Sr+Po,Gt="0.5s cubic-bezier(0.4, 0, 0.2, 1)",ig=9;function c2(i){return`M ${(i.x-ig).toFixed(1)} ${i.y.toFixed(1)} L ${(i.x+ig).toFixed(1)} ${i.y.toFixed(1)}`}function Er(i){if(i.length===0)return"";if(i.length===1)return c2(i[0]);const n=[];for(let s=0;s<i.length-1;s++){const a=i[Math.max(0,s-1)],o=i[s],f=i[s+1],d=i[Math.min(i.length-1,s+2)],m=(o.x+(f.x-a.x)/6).toFixed(1),g=(o.y+(f.y-a.y)/6).toFixed(1),y=(f.x-(d.x-o.x)/6).toFixed(1),E=(f.y-(d.y-o.y)/6).toFixed(1);s===0&&n.push(`M ${o.x.toFixed(1)} ${o.y.toFixed(1)}`),n.push(`C ${m} ${g}, ${y} ${E}, ${f.x.toFixed(1)} ${f.y.toFixed(1)}`)}return n.join(" ")}function u2(i,n){if(i.length<2||n.length<2)return"";const s=Er(i),a=[...n].reverse(),o=Er(a),f=o.slice(o.indexOf("C"));return`${s} L ${a[0].x.toFixed(1)} ${a[0].y.toFixed(1)} ${f} Z`}function f2(i){return i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}function Co(i){return i.length>0?i[i.length-1]:void 0}const vr="#f97316",$a="#0ea5e9",br="#16a34a",Mo="#94a3b8",h2="#b0e0e6",d2="#5b93ad",m2=13;function p2(i,n){const s=[...i].sort((d,m)=>d.y-m.y);let a=-1/0;const o=s.map(d=>{const m=Math.max(d.y+3,a+m2);return a=m,{...d,labelY:m}}),f=o.length>0?o[o.length-1].labelY-n:0;if(f>0)for(const d of o)d.labelY-=f;return o}function XA({stations:i,selectedRole:n,onSelect:s,onUpstreamSelect:a,onPrioritySelect:o,onCmdClick:f,periodHours:d}){const[m,g]=O.useState(null),y=i.length;if(y===0)return null;const E=G=>y===1?Sr+Po/2:Sr+G/(y-1)*Po,w=new Map(i.map((G,ge)=>[G.role,E(ge)])),T=i.map((G,ge)=>{var tt,St,at,lt;const xe=G.target_per_hour??null,Pe=xe!=null?xe*d:null;return{idx:ge,x:E(ge),expected:Pe,actual:((tt=G.metric)==null?void 0:tt.resolved)??0,active:((St=G.metric)==null?void 0:St.claimed)??0,pending:((at=G.metric)==null?void 0:at.pending)??0,priorityCount:((lt=G.metric)==null?void 0:lt.priority_count)??0}}),z=T.some(G=>G.expected!=null),q=Math.max(1,...T.map(G=>G.expected??0),...T.map(G=>G.actual),...T.map(G=>G.expected!=null?G.pending:0))*1.15,Q=G=>Eh+jy*(1-Math.max(0,Math.min(G,q))/q),W=T.filter(G=>G.expected!=null),te=W.map(G=>({...G,y:Q(G.expected)})),fe=W.map(G=>({...G,y:Q(G.actual)})),re=W.map(G=>({...G,y:Q(G.active)})),N=W.map(G=>({...G,y:Q(G.pending)})),V=Er(te),ae=Er(fe),P=Er(re),F=Er(N),X=Co(fe),oe=Co(te),ie=Co(re),Ne=Co(N),Ue=fe.length>=2&&X?`${ae} L ${X.x.toFixed(1)} ${Cn} L ${fe[0].x.toFixed(1)} ${Cn} Z`:"",Te=W.some(G=>G.pending>0||G.active>0),$=Te&&re.length>=2&&ie?`${P} L ${ie.x.toFixed(1)} ${Cn} L ${re[0].x.toFixed(1)} ${Cn} Z`:"",se=Te?u2(N,re):"",he=W.some(G=>G.active>0),Ae=W.some(G=>G.pending>G.active),ve=p2([oe?{key:"target",text:"Target",color:Mo,y:oe.y}:null,X?{key:"actual",text:"Resolved",color:br,y:X.y}:null,he&&ie?{key:"active",text:"Claimed",color:vr,y:ie.y}:null,Ae&&Ne?{key:"queued",text:"Pending",color:$a,y:Ne.y}:null].filter(Boolean),Cn+4);return h.jsxs("svg",{viewBox:`0 0 ${Ey} ${Ay}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",style:{display:"block"},children:[i.map(G=>{if(!G.parent_role)return null;const ge=w.get(G.parent_role);if(ge==null)return null;const xe=E(i.findIndex(Pe=>Pe.role===G.role));return h.jsx("line",{x1:ge,y1:Cn,x2:xe,y2:Cn,stroke:"#e2e8f0",strokeWidth:.75},`dep-${G.role}`)}),Ue&&h.jsx("path",{d:Ue,fill:br,opacity:.05,style:{transition:`d ${Gt}`}}),$&&h.jsx("path",{d:$,fill:vr,opacity:.12,style:{transition:`d ${Gt}`}}),se&&h.jsx("path",{d:se,fill:$a,opacity:.12,style:{transition:`d ${Gt}`}}),V&&h.jsx("path",{d:V,fill:"none",stroke:Mo,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.7,style:{transition:`d ${Gt}`}}),te.map(G=>h.jsxs("g",{transform:`translate(${G.x} ${G.y})`,style:{transition:`transform ${Gt}`},children:[h.jsx("circle",{r:2,fill:Mo,opacity:.8}),h.jsx("text",{y:-5,textAnchor:"middle",fontSize:6.5,fill:Mo,fontFamily:"ui-monospace, monospace",fontWeight:"500",opacity:.7,children:Math.round(G.expected)})]},`tval-${G.idx}`)),Te&&F&&h.jsx("path",{d:F,fill:"none",stroke:$a,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.55,style:{transition:`d ${Gt}`}}),P&&h.jsx("path",{d:P,fill:"none",stroke:vr,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.5,style:{transition:`d ${Gt}`}}),ae&&h.jsx("path",{d:ae,fill:"none",stroke:br,strokeWidth:.6,strokeLinejoin:"round",strokeLinecap:"round",opacity:.65,style:{transition:`d ${Gt}`}}),re.map((G,ge)=>{if(G.pending<=0&&G.active<=0)return null;const xe=Math.max(2.5,Math.min(5,2.5+G.active/10)),Pe=G.pending>G.active,tt=Math.min(N[ge].y-4,G.y-xe-4);return h.jsxs("g",{children:[G.pending>0&&h.jsx("text",{x:G.x,y:tt,textAnchor:"middle",fontSize:7.5,fill:Pe?$a:"#64748b",fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{transition:`y ${Gt}`},children:G.pending}),h.jsxs("g",{transform:`translate(${G.x} ${G.y})`,style:{transition:`transform ${Gt}`},children:[h.jsx("circle",{r:xe,fill:vr,opacity:.85}),G.active>0&&h.jsx("text",{y:xe+9,textAnchor:"middle",fontSize:7.5,fill:vr,fontFamily:"ui-monospace, monospace",fontWeight:"600",children:G.active})]})]},`active-${G.idx}`)}),T.map(G=>{var In;const ge=i[G.idx],xe=G.x,Pe=G.expected!=null?Q(G.actual):Cn,tt=Math.max(2.25,Math.min(4,2.25+G.actual/160)),St=ge.role===n,at=m===G.idx,lt=G.expected==null?"idle · set a target rate to plot pace":`${G.actual} resolved · target ${Math.round(G.expected)}`+(G.pending>G.active?` · ${G.pending-G.active} pending`:"")+(G.active>0?` · ${G.active} claimed`:"")+(G.priorityCount>0?` · ${G.priorityCount} priority`:""),Se=lt.length*5.5+20,vt=Math.max(Sr+Se/2+4,Math.min(sg-Se/2-4,xe)),qn=Pe-tt-10;return h.jsxs("g",{onClick:Rt=>{Rt.metaKey||Rt.ctrlKey?(Rt.stopPropagation(),f==null||f(ge.role)):s(ge.role)},onMouseEnter:()=>g(G.idx),onMouseLeave:()=>g(null),style:{cursor:"pointer"},children:[h.jsxs("g",{transform:`translate(${xe} ${Pe})`,style:{transition:`transform ${Gt}`},children:[h.jsx("circle",{r:22,fill:"transparent"}),h.jsx("circle",{r:tt,fill:br,opacity:.9,style:{transition:`r ${Gt}`}}),G.expected!=null&&h.jsx("text",{y:-tt-5,textAnchor:"middle",fontSize:9.5,fill:br,fontFamily:"ui-monospace, monospace",fontWeight:"500",children:f2(G.actual)}),at&&!St&&h.jsx("circle",{r:tt+3,fill:"none",stroke:br,strokeWidth:1,opacity:.4}),St&&h.jsx("circle",{r:tt+4,fill:"none",stroke:"#6366f1",strokeWidth:2})]}),G.priorityCount>0&&h.jsxs("g",{transform:`translate(${xe+15} ${Math.max(Pe-15,12)})`,onClick:Rt=>{Rt.stopPropagation(),o==null||o(ge.role)},style:{cursor:"pointer",transition:`transform ${Gt}`},children:[h.jsx("title",{children:`${G.priorityCount} past the priority threshold — click to pull oldest first`}),h.jsx("circle",{r:6.5+(String(G.priorityCount).length-1)*2,fill:h2,opacity:.9}),h.jsx("text",{y:2.5,textAnchor:"middle",fontSize:7,fill:d2,fontFamily:"ui-monospace, monospace",fontWeight:"700",children:G.priorityCount})]}),(((In=ge.upstream_roles)==null?void 0:In.length)??0)>0&&h.jsxs("g",{transform:`translate(${xe-20} ${Cn})`,onClick:Rt=>{Rt.stopPropagation(),a==null||a(ge.upstream_roles[0])},style:{cursor:"pointer"},children:[h.jsx("title",{children:`Fed by ${ge.upstream_roles.join(", ")} — click to view that sequence`}),h.jsx("circle",{r:9,cy:-6,fill:"transparent"}),h.jsx("path",{d:"M -7 -14 C -3 -14 -1 -9 0 -2",fill:"none",stroke:"#94a3b8",strokeWidth:1,strokeDasharray:"2 2",strokeLinecap:"round"}),h.jsx("path",{d:"M 0 -2 L 8 -2",stroke:"#94a3b8",strokeWidth:1,strokeLinecap:"round"}),h.jsx("path",{d:"M 8 -2 l -3.5 -2 v 4 z",fill:"#94a3b8"})]}),h.jsx("text",{x:xe,y:Cn+(G.idx%2===0?14:27),textAnchor:"middle",fontSize:9.5,fill:"#475569",fontFamily:"ui-sans-serif, sans-serif",fontWeight:"500",children:a2(ge)}),at&&h.jsxs("g",{children:[h.jsx("rect",{x:vt-Se/2,y:qn-16,width:Se,height:19,rx:3,fill:"#0f172a",opacity:.88}),h.jsx("text",{x:vt,y:qn-3,textAnchor:"middle",fontSize:8.5,fill:"white",fontFamily:"ui-monospace, monospace",children:lt})]})]},ge.role)}),!z&&h.jsx("text",{x:Sr+Po/2,y:Cn+48,textAnchor:"middle",fontSize:8.5,fill:"#94a3b8",fontFamily:"ui-sans-serif, sans-serif",children:"Set target_per_hour on each role in Admin → Roles to enable the pace chart"}),ve.map(G=>h.jsx("text",{x:sg+6,y:G.labelY,fontSize:8,fill:G.color,fontFamily:"ui-sans-serif, sans-serif",fontWeight:G.key==="actual"?700:500,opacity:G.key==="active"?.85:1,style:{transition:`y ${Gt}`},children:G.text},G.key))]})}function g2({onToggleEventFeed:i,onToggleDocs:n}){var N;const{user:s,logout:a}=ai(),{isBuilder:o,isOps:f,viewAs:d,realIsBuilder:m}=gy(),{available:g,mine:y}=Xw(),{connected:E}=H_(),{data:w}=Ur(),[T,z]=O.useState(!1),[M,q]=O.useState(!1),[Q,W]=O.useState(wy),te=O.useRef(null),fe=(N=w==null?void 0:w.branding)==null?void 0:N.appName,re=V=>{i2(V),W(V)};return O.useEffect(()=>{if(!T)return;const V=ae=>{te.current&&!te.current.contains(ae.target)&&z(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[T]),h.jsxs(h.Fragment,{children:[h.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 z-30",children:[h.jsx(_r,{to:"/","aria-label":"Home",onClick:V=>{(V.ctrlKey||V.metaKey)&&(V.preventDefault(),q(!0))},children:h.jsx(Sh,{appName:fe})}),h.jsxs("div",{className:"flex items-center gap-5",children:[h.jsxs(_r,{to:"/escalations/available",className:"flex items-center gap-1.5 text-[11px] transition-colors text-text-quaternary hover:text-text-secondary",style:g>0?{color:$a}:void 0,title:"All escalations",children:[h.jsx(Df,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",g>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),h.jsxs(_r,{to:"/escalations/queue",className:"flex items-center gap-1.5 text-[11px] transition-colors text-text-quaternary hover:text-text-secondary",style:y>0?{color:vr}:void 0,title:"My escalation queue",children:[h.jsx(Df,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",y>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:y})]}),(o||f)&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-px h-4 bg-surface-border"}),h.jsxs("button",{type:"button",onClick:()=>{E?i==null||i():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${E?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:E?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[h.jsx(Ng,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]})]}),m&&h.jsx(h.Fragment,{children:h.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[h.jsx(kg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})}),d&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-[10px] text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[d," View"]}),h.jsx("button",{onClick:py,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Dr,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&h.jsxs("div",{className:"relative",ref:te,children:[h.jsxs("button",{onClick:()=>z(V=>!V),className:"btn-ghost text-xs flex items-center gap-1",children:[h.jsx(sv,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,h.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),T&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[h.jsx(_r,{to:"/credentials",onClick:()=>z(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2",children:vy.map(V=>h.jsx("button",{type:"button",onClick:()=>re(V),title:ng[V],"aria-label":`${ng[V]} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${Q===V?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:n2[V]}},V))})]}),h.jsx("button",{onClick:()=>{z(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]}),M&&h.jsx(t2,{onClose:()=>q(!1)})]})}function Ah({open:i,children:n}){const[s,a]=O.useState(i);return O.useEffect(()=>{i&&a(!0)},[i]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||a(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function ih(i){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function y2(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function b2({group:i,collapsed:n}){const{pathname:s}=ri(),a=i.matchPaths.some(m=>s.startsWith(m)),[o,f]=O.useState(a),d=o||a;return n?h.jsx(h.Fragment,{children:i.items.map(m=>h.jsx($o,{to:m.to,className:ih(!0),title:m.label,children:m.icon&&h.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>f(m=>!m),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:[h.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:i.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Ah,{open:d,children:i.items.map(m=>h.jsxs($o,{to:m.to,end:m.end,className:y2(),children:[m.icon&&h.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:m.label})]},m.to))})]})}function x2(i){return i.kind==="group"}function v2({entry:i,collapsed:n}){const{pathname:s,search:a}=ri();if(i.to.includes("?")){const[f,d]=i.to.split("?"),m=s===f&&a===`?${d}`,g=ih(n)({isActive:m});return h.jsxs($o,{to:i.to,className:g,title:n?i.label:void 0,children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&h.jsx("span",{children:i.label})]})}return h.jsxs($o,{to:i.to,end:i.end,className:ih(n),title:n?i.label:void 0,children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&h.jsx("span",{children:i.label})]})}function ni({heading:i,entries:n}){const{collapsed:s}=by();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:i}),n.map(a=>x2(a)?h.jsx(b2,{group:a,collapsed:s},a.label):h.jsx(v2,{entry:a,collapsed:s},a.to))]})}const _2=[{to:"/escalations/queue",label:"My Queue",icon:Df},{to:"/escalations/available",label:"All",icon:zf}];function w2({aiEnabled:i=!1,isBuilder:n=!1,isOps:s=!1,viewAs:a=null}){if(!n&&(!s||a==="engineer"||a==="operator"))return h.jsx(ni,{heading:"Work",entries:_2});if(!n)return h.jsx(ni,{heading:"Monitor",entries:[{to:"/operations",label:"Pace Board",icon:m0}]});const o=[...s||n?[{to:"/operations",label:"Pace Board",icon:m0}]:[],{to:"/topics",label:"Event Topics",icon:Ng},{to:"/agents",label:i?"Agents":"Automations",icon:iv},{to:"/capabilities",label:"Capabilities",icon:rv}];return h.jsx(ni,{heading:"Monitor",entries:o})}function S2(){const i=[{kind:"group",label:"Procedural",icon:av,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Registry",icon:p0},{to:"/workflows/durable/invoke",label:"Invoke",icon:g0},{to:"/workflows/executions",label:"Executions",icon:zf}]},{kind:"group",label:"Graph",icon:rh,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:p0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:g0},{to:"/mcp/executions",label:"Executions",icon:zf}]}];return h.jsx(ni,{heading:"Orchestrate",entries:i})}const E2=[{to:"/mcp/queries",label:"Designer",icon:lv},{to:"/mcp/servers",label:"Servers & Tools",icon:ov}];function A2(){return h.jsx(ni,{heading:"Design",entries:E2})}const j2=[{to:"/files",label:"Files",icon:cv},{to:"/knowledge",label:"Knowledge",icon:uv}];function O2(){return h.jsx(ni,{heading:"Storage",entries:j2})}function T2({isBuilder:i=!1,isOps:n=!1}){var d;const{data:s}=Ur(),a=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:fv},...i||n?[{to:"/admin/roles",label:"Roles",icon:hv}]:[]],f=[{to:"/admin/controlplane",label:"Routers",icon:dv},{to:"/admin/streams",label:"Messages",icon:mv},...a?[{to:"/admin/maintenance",label:"DB Maintenance",icon:pv}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(ni,{heading:"Identity & Access",entries:o}),i&&h.jsx(ni,{heading:"Infrastructure",entries:f})]})}const Oy="lt_event_feed_patterns";function N2(i){if(i.startsWith("/topics/")){const f=decodeURIComponent(i.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=i.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(i.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=i.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const o=i.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function k2(){try{const i=localStorage.getItem(Oy);return i?JSON.parse(i):[]}catch{return[]}}function Cf(i){try{localStorage.setItem(Oy,JSON.stringify(i))}catch{}}function C2(){const{pathname:i}=ri(),[n,s]=O.useState(k2),a=O.useMemo(()=>N2(i),[i]),o=O.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=O.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return Cf(w),w})},[]),d=O.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return Cf(E),E})},[]),m=O.useCallback(()=>{s([]),Cf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:d,clearUserPatterns:m}}function M2({children:i,className:n=""}){return h.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:i})}const Mf=280,rg="cubic-bezier(0.4, 0, 0.2, 1)",Ro=40;function R2(i){if(!i)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-Ro*2,o=s-Ro*2,f=i.width/a,d=i.height/o,m=i.left+i.width/2-(Ro+a/2),g=i.top+i.height/2-(Ro+o/2);return`translate(${m}px, ${g}px) scale(${f}, ${d})`}function Ty({open:i,onClose:n,sourceRef:s,children:a}){const[o,f]=O.useState(null),d=O.useRef(null),m=O.useRef(!1);O.useEffect(()=>{var T,z;i&&!m.current?(d.current=((T=s==null?void 0:s.current)==null?void 0:T.getBoundingClientRect())??null,f("entering")):!i&&m.current&&o==="open"&&(d.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),m.current=i},[i,s,o]),O.useEffect(()=>{if(o!=="entering")return;const T=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(T)},[o]),O.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),O.useEffect(()=>{if(!o)return;const T=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[o,n]);const g=O.useCallback(T=>{T.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(O.useEffect(()=>{if(o!=="exiting")return;const T=setTimeout(()=>f(null),Mf+50);return()=>clearTimeout(T)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?R2(d.current):"none",w=y?0:1;return Og.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Mf}ms ${rg}, opacity ${Mf}ms ${rg}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function D2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function z2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function q2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 U2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function B2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 L2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 H2(i){const n=i.trim().split(`
|
|
54
|
-
`);if(n.length<2)return i;const s=m=>m.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),o=n.slice(2),f=a.map(m=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${m}</th>`).join(""),d=o.map(m=>`<tr class="border-t border-surface-border">${s(m).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${d}</tbody></table>`}function Do(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function P2(i){const n=[];let s=i.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>H2(`${y}
|
|
55
|
-
${E}
|
|
56
|
-
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${Do(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${Do(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${Do(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${Do(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</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 y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",m=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,T;for(;(T=m.exec(w))!==null;){const z=T.index+T[0].length;E.push(w.slice(0,z)),w=w.slice(z).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return w&&E.push(w),E.map(z=>{const M=z.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${d}">${M}</p>`:""}).join("")}).join(""),s}const $2=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Y2(i){return $2.test(i)}function jh({content:i,className:n,onClick:s}){const a=O.useMemo(()=>P2(i),[i]);return h.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Ko({data:i,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,d]=O.useState(o),[m,g]=O.useState(s);if(s!==void 0&&s!==m&&(g(s),d(s%2===0&&n>0)),i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((y,E)=>h.jsxs("div",{children:[h.jsx(Ko,{data:y,depth:n+1,generation:s}),E<i.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const y=Object.entries(i);return y.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],T)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:E}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(Ko,{data:w,depth:n+1,generation:s}),T<y.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(i)})}function Ia({data:i,depth:n=0}){if(i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&Y2(i)?h.jsx(jh,{content:i}):h.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:i.map((s,a)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Ia,{data:s,depth:n+1})})]},a))});if(typeof i=="object"){const s=Object.entries(i);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Ia,{data:o,depth:n+1})}):h.jsx(Ia,{data:o,depth:n+1})]},a)})})}return h.jsx("span",{children:String(i)})}function ag({mode:i,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:d,onClose:m,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&h.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?h.jsx(L2,{className:y}):h.jsx(B2,{className:y})}),h.jsx("button",{onClick:()=>n(i==="json"?"tree":"json"),className:E,title:i==="json"?"Outline view":"JSON view",children:i==="json"?h.jsx(D2,{className:y}):h.jsx(z2,{className:y})}),h.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?h.jsx(U2,{className:`${y} text-status-success`}):h.jsx(q2,{className:y})}),d&&h.jsx("button",{onClick:d,className:E,title:"Fullscreen",children:h.jsx(Cg,{className:y})}),m&&h.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:h.jsx(Mg,{className:y})})]})}function G2({data:i,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=O.useRef(null),[d,m]=O.useState(o??"json"),[g,y]=O.useState(!1),[E,w]=O.useState(!1),[T,z]=O.useState(a?0:1),[M,q]=O.useState(1),Q=T%2===0,W=M%2===0,te=O.useCallback(()=>z(X=>X+1),[]),fe=O.useCallback(()=>q(X=>X+1),[]);let re=i;if(typeof i=="string")try{re=JSON.parse(i)}catch{}const N=async()=>{const X=typeof i=="string"?i:JSON.stringify(re,null,2);await navigator.clipboard.writeText(X),y(!0),setTimeout(()=>y(!1),2e3)},V=O.useCallback(()=>{q(1),w(!0)},[]),ae=s==="panel",P=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",F=ae?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:P,children:[n&&h.jsx(M2,{children:n}),h.jsxs("div",{ref:f,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(ag,{mode:d,setMode:m,isCollapsed:Q,onToggleCollapse:te,onCopy:N,copied:g,onFullscreen:V})}),h.jsx("div",{className:F,children:d==="json"?h.jsx(Ko,{data:re,generation:T}):h.jsx(Ia,{data:re})})]}),h.jsxs(Ty,{open:E,onClose:()=>w(!1),sourceRef:f,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(ag,{mode:d,setMode:m,isCollapsed:W,onToggleCollapse:fe,onCopy:N,copied:g,onClose:()=>w(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(Ko,{data:re,generation:M}):h.jsx(Ia,{data:re})})]})]})}const V2=100,lg=500;let F2=0;const Ny={"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 ky(i){const n=i.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:i}function og({event:i,forceExpanded:n=!1}){var T,z;const[s,a]=O.useState(n),o=Ny[ky(i.type)]||"text-text-tertiary";O.useEffect(()=>{a(n)},[n]);const f=n,d=f?"text-xs":"text-[9px]",m=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${m} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(T=i.data)!=null&&T.workflowId?String(i.data.workflowId):"",(z=i.data)!=null&&z.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Ah,{open:s,children:h.jsx("div",{className:w,children:h.jsx(G2,{data:i.data})})})]})}function I2({open:i,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=O.useState([]),[d,m]=O.useState(!1),[g,y]=O.useState(""),E=O.useRef(null),w=O.useRef(new Map),{subscribe:T}=O.useContext(tl),{patterns:z,pagePattern:M,userPatterns:q,addPattern:Q,removePattern:W}=C2(),te=O.useCallback(re=>{const N=String(re.type||"unknown");if(N.startsWith("mesh."))return;const V=`${N}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ae=Date.now(),P=w.current.get(V);if(!(P&&ae-P<lg)){if(w.current.set(V,ae),w.current.size>200)for(const[F,X]of w.current)ae-X>lg*2&&w.current.delete(F);f(F=>[{id:++F2,type:N,timestamp:re.timestamp||new Date().toISOString(),data:re},...F].slice(0,V2))}},[]),fe=O.useRef(te);return fe.current=te,O.useEffect(()=>{const re=z.map(N=>T(N,V=>fe.current(V)));return()=>re.forEach(N=>N())},[T,z.join(",")]),O.useEffect(()=>{i&&E.current&&(E.current.scrollTop=0)},[o.length,i]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?h.jsx(gv,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(yv,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!i&&h.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Ny[ky(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:h.jsx(bv,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),m(!0)},children:h.jsx(Cg,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:h.jsx(xv,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),q.map(re=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),h.jsx("button",{onClick:()=>W(re),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Dr,{className:"w-2 h-2"})})]},re))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(Q(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(Q(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(vv,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Ah,{open:i,children:h.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>h.jsx(og,{event:re},re.id))})}),h.jsxs(Ty,{open:d,onClose:()=>m(!1),sourceRef:E,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>m(!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:h.jsx(Mg,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>h.jsx(og,{event:re,forceExpanded:!0},re.id))]})]})}function J2(){return Sn({queryKey:["docs"],queryFn:()=>Ye("/docs"),staleTime:5*6e4})}function Q2(i){return Sn({queryKey:["docs",i],queryFn:()=>Ye(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function X2(){const[i,n]=O.useState([]),[s,a]=O.useState([]),[o,f]=O.useState(null),d=O.useRef(o),m=O.useRef(i),g=O.useRef(s);d.current=o,m.current=i,g.current=s;const y=O.useCallback((M,q)=>{var W;const Q=d.current;if(Q){const te=((W=q==null?void 0:q.current)==null?void 0:W.scrollTop)??0;n([...m.current,{...Q,scrollTop:te}])}a([]),f({path:M,scrollTop:0})},[]),E=O.useCallback(M=>{var te;const q=m.current;if(q.length===0)return;const Q=q[q.length-1],W=d.current;if(W){const fe=((te=M==null?void 0:M.current)==null?void 0:te.scrollTop)??0;a([...g.current,{...W,scrollTop:fe}])}n(q.slice(0,-1)),f(Q),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=Q.scrollTop)})},[]),w=O.useCallback(M=>{var te;const q=g.current;if(q.length===0)return;const Q=q[q.length-1],W=d.current;if(W){const fe=((te=M==null?void 0:M.current)==null?void 0:te.scrollTop)??0;n([...m.current,{...W,scrollTop:fe}])}a(q.slice(0,-1)),f(Q),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=Q.scrollTop)})},[]),T=O.useCallback(M=>{var W,te;const q=d.current;if(!q)return;const Q=((W=M==null?void 0:M.current)==null?void 0:W.scrollTop)??0;n([...m.current,{...q,scrollTop:Q}]),a([]),f({...q,scrollTop:((te=M==null?void 0:M.current)==null?void 0:te.scrollTop)??0})},[]),z=O.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:i,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:T,reset:z}}function K2(i,n){const[s,a]=i.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),m=[];for(const g of d)g===".."?m.pop():g&&g!=="."&&m.push(g);o=m.join("/")}return{path:o,anchor:a}}function Z2(i){if(!i.startsWith("#docs"))return null;const n=i.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function W2(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function eS({content:i,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const d=f.target,m=d.closest("[data-anchor]");if(m){f.preventDefault(),a();const E=m.dataset.anchor,w=(y=m.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=K2(g.dataset.docLink,n);s(E,w);return}};return h.jsx(jh,{content:i,className:"docs-content",onClick:o})}function tS(i){const n=[],s=new Map;for(const a of i){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let d=0;d<o.length-1;d++){const m=o[d];f.has(m)||f.set(m,{label:m,children:[],subdirs:new Map});const g=f.get(m);d===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function nS({docs:i,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=tS(i),f=m=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===m?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(m,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(_v,{className:"w-3 h-3",strokeWidth:1.5}),m.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...m.subdirs.values()].map(y=>d(y)),m.children.map(y=>h.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},m.label)}return h.jsxs("div",{className:"space-y-0.5",children:[a.map(m=>h.jsx("button",{className:f(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>d(m))]})}function sS({open:i,onClose:n}){var ae,P,F;const[s,a]=O.useState(!1),{data:o}=J2(),f=X2(),{data:d,isLoading:m}=Q2(((ae=f.current)==null?void 0:ae.path)??null),g=O.useRef(null),[y,E]=O.useState(null);O.useEffect(()=>{y&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var oe;const X=(oe=g.current)==null?void 0:oe.querySelector(`#${CSS.escape(y)}`);X==null||X.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,d]);const w=O.useCallback(()=>{var ie;const X=Z2(window.location.hash),oe=(X==null?void 0:X.path)??"README.md";((ie=f.current)==null?void 0:ie.path)!==oe&&f.navigate(oe,g),X!=null&&X.anchor&&E(X.anchor)},[f]),T=O.useRef(!0);O.useEffect(()=>{if(!i||!f.current)return;if(T.current){T.current=!1;return}const X=W2(f.current.path);window.location.hash!==X&&window.history.replaceState(null,"",window.location.pathname+window.location.search+X)},[i,(P=f.current)==null?void 0:P.path]),O.useEffect(()=>{if(!i)return;const X=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",X),()=>window.removeEventListener("hashchange",X)},[i,w]);const z=O.useCallback((X,oe)=>{oe&&E(oe),f.navigate(X,g)},[f]),M=O.useCallback(X=>{f.navigate(X,g)},[f]),q=O.useCallback(()=>{f.goBack(g)},[f]),Q=O.useCallback(()=>{f.goForward(g)},[f]),W=O.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(O.useEffect(()=>{if(i){T.current=!0,w();const X=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(X)}},[i]),!(i||s))return null;const fe=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((F=f.current)==null?void 0:F.path)??null,N=f.backStack.length>0,V=f.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&i?"opacity-100":"opacity-0"}`,onClick:fe}),h.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&&i?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:q,disabled:!N,className:`p-0.5 transition-colors ${N?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(wv,{className:"w-4 h-4"})}),h.jsx("button",{onClick:Q,disabled:!V,className:`p-0.5 transition-colors ${V?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(y0,{className:"w-4 h-4"})}),h.jsx(kg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:fe,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Dr,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(nS,{docs:o.docs,selected:re,onSelect:M}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?m?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):d!=null&&d.content?h.jsx(eS,{content:d.content,currentPath:re,onNavigate:z,onAnchorClick:W}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(y0,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function iS(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const cg=2e3;function rS(i){const s=i.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
57
|
-
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
58
|
-
`)}
|
|
59
|
-
[End prior conversation]
|
|
60
|
-
|
|
61
|
-
`}function aS(i){const n=i.summary,s=i.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof i=="string"?i:"Query completed.")}const Cy=O.createContext(null);function lS({children:i}){const n=ri(),[s,a]=O.useState(!1),[o,f]=O.useState([]),[d,m]=O.useState(null),[g,y]=O.useState({}),E=O.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??iS(n.pathname)};O.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const T=O.useCallback(()=>a(W=>!W),[]),z=O.useCallback(W=>{y(W)},[]),M=O.useCallback(()=>{f([]),m(null)},[]),q=O.useCallback(async W=>{var P;const te=new Date().toISOString(),fe={id:`user-${Date.now()}`,role:"user",content:W,timestamp:te},re={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:te,pending:!0};f(F=>[...F,fe,re]);const N={...w};(P=N.entities)!=null&&P.yamlContent&&N.entities.yamlContent.length>cg&&(N.entities={...N.entities,yamlContent:N.entities.yamlContent.slice(0,cg)+`
|
|
62
|
-
... (truncated)`});const ae=`${rS(o.concat(fe))}${W}`;try{const X=(await Ye("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:N.suggestedTags,context:N,wait:!1,direct:!0})})).workflow_id;m(X),f(oe=>oe.map(ie=>ie.id===re.id?{...ie,workflowId:X}:ie)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var oe;try{const ie=await Ye(`/workflows/${X}/result`),Ne=(oe=ie==null?void 0:ie.result)==null?void 0:oe.data;if(Ne){E.current&&clearInterval(E.current),E.current=null,m(null);const Ue=aS(Ne);let Te;try{Te=(await Ye(`/workflow-states/${X}/execution`)).duration_ms}catch{}f($=>$.map(se=>se.id===re.id?{...se,content:Ue,timestamp:new Date().toISOString(),pending:!1,durationMs:Te}:se))}}catch{}},3e3)}catch{f(F=>F.map(X=>X.id===re.id?{...X,content:"Failed to submit query. Please try again.",pending:!1}:X))}},[o,w]),Q=O.useCallback(async W=>{const te=o.find(N=>N.id===W);if(!(te!=null&&te.workflowId)||te.compilationStatus==="compiling"||te.compilationStatus==="done")return;const fe=o.indexOf(te),re=o.slice(0,fe).reverse().find(N=>N.role==="user");if(re){f(N=>N.map(V=>V.id===W?{...V,compilationStatus:"compiling"}:V));try{const N=await Ye("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:te.content})}),V=await Ye("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:te.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:N.tool_name,description:N.description,tags:N.tags,app_id:""})});await Ye(`/yaml-workflows/${V.id}/deploy`,{method:"POST"}),f(ae=>ae.map(P=>P.id===W?{...P,compilationStatus:"done"}:P))}catch(N){const V=N instanceof Error?N.message:"Compilation failed";f(ae=>ae.map(P=>P.id===W?{...P,compilationStatus:"error",compilationError:V}:P))}}},[o]);return h.jsx(Cy.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:T,messages:o,sendMessage:q,pageContext:w,setPageContext:z,activeWorkflowId:d,clearMessages:M,compileMessage:Q},children:i})}function My(){const i=O.useContext(Cy);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function oS(){const{helpOpen:i,toggleHelp:n}=My();return h.jsx("button",{onClick:n,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":i?"Close help":"Ask for help",children:i?h.jsx(Dr,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Vt}/logo512.png)`}})})}const Ry=6048e5,cS=864e5,ug=6e4,fg=525600,hg=43200,dg=1440,mg=Symbol.for("constructDateFrom");function bs(i,n){return typeof i=="function"?i(n):i&&typeof i=="object"&&mg in i?i[mg](n):i instanceof Date?new i.constructor(n):new Date(n)}function ln(i,n){return bs(n||i,i)}let uS={};function nl(){return uS}function Za(i,n){var m,g,y,E;const s=nl(),a=(n==null?void 0:n.weekStartsOn)??((g=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=ln(i,n==null?void 0:n.in),f=o.getDay(),d=(f<a?7:0)+f-a;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function Zo(i,n){return Za(i,{...n,weekStartsOn:1})}function Dy(i,n){const s=ln(i,n==null?void 0:n.in),a=s.getFullYear(),o=bs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Zo(o),d=bs(s,0);d.setFullYear(a,0,4),d.setHours(0,0,0,0);const m=Zo(d);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function Wo(i){const n=ln(i),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+i-+s}function zy(i,...n){const s=bs.bind(null,i||n.find(a=>typeof a=="object"));return n.map(s)}function pg(i,n){const s=ln(i,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function fS(i,n,s){const[a,o]=zy(s==null?void 0:s.in,i,n),f=pg(a),d=pg(o),m=+f-Wo(f),g=+d-Wo(d);return Math.round((m-g)/cS)}function hS(i,n){const s=Dy(i,n),a=bs(i,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Zo(a)}function dS(i,n){const s=+ln(i)-+ln(n);return s<0?-1:s>0?1:s}function mS(i){return bs(i,Date.now())}function pS(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function gS(i){return!(!pS(i)&&typeof i!="number"||isNaN(+ln(i)))}function yS(i){return n=>{const a=(i?Math[i]:Math.trunc)(n);return a===0?0:a}}function bS(i,n){const s=ln(i,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const xS={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"}},vS=(i,n,s)=>{let a;const o=xS[i];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Rf(i){return(n={})=>{const s=n.width?String(n.width):i.defaultWidth;return i.formats[s]||i.formats[i.defaultWidth]}}const _S={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},SS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ES={date:Rf({formats:_S,defaultWidth:"full"}),time:Rf({formats:wS,defaultWidth:"full"}),dateTime:Rf({formats:SS,defaultWidth:"full"})},AS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},jS=(i,n,s,a)=>AS[i];function qa(i){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&i.formattingValues){const d=i.defaultFormattingWidth||i.defaultWidth,m=s!=null&&s.width?String(s.width):d;o=i.formattingValues[m]||i.formattingValues[d]}else{const d=i.defaultWidth,m=s!=null&&s.width?String(s.width):i.defaultWidth;o=i.values[m]||i.values[d]}const f=i.argumentCallback?i.argumentCallback(n):n;return o[f]}}const OS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},TS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},NS={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"]},kS={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"]},CS={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"}},MS={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"}},RS=(i,n)=>{const s=Number(i),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},DS={ordinalNumber:RS,era:qa({values:OS,defaultWidth:"wide"}),quarter:qa({values:TS,defaultWidth:"wide",argumentCallback:i=>i-1}),month:qa({values:NS,defaultWidth:"wide"}),day:qa({values:kS,defaultWidth:"wide"}),dayPeriod:qa({values:CS,defaultWidth:"wide",formattingValues:MS,defaultFormattingWidth:"wide"})};function Ua(i){return(n,s={})=>{const a=s.width,o=a&&i.matchPatterns[a]||i.matchPatterns[i.defaultMatchWidth],f=n.match(o);if(!f)return null;const d=f[0],m=a&&i.parsePatterns[a]||i.parsePatterns[i.defaultParseWidth],g=Array.isArray(m)?qS(m,w=>w.test(d)):zS(m,w=>w.test(d));let y;y=i.valueCallback?i.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(d.length);return{value:y,rest:E}}}function zS(i,n){for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&n(i[s]))return s}function qS(i,n){for(let s=0;s<i.length;s++)if(n(i[s]))return s}function US(i){return(n,s={})=>{const a=n.match(i.matchPattern);if(!a)return null;const o=a[0],f=n.match(i.parsePattern);if(!f)return null;let d=i.valueCallback?i.valueCallback(f[0]):f[0];d=s.valueCallback?s.valueCallback(d):d;const m=n.slice(o.length);return{value:d,rest:m}}}const BS=/^(\d+)(th|st|nd|rd)?/i,LS=/\d+/i,HS={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},PS={any:[/^b/i,/^(a|c)/i]},$S={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},YS={any:[/1/i,/2/i,/3/i,/4/i]},GS={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},VS={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]},FS={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},IS={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]},JS={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},QS={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}},XS={ordinalNumber:US({matchPattern:BS,parsePattern:LS,valueCallback:i=>parseInt(i,10)}),era:Ua({matchPatterns:HS,defaultMatchWidth:"wide",parsePatterns:PS,defaultParseWidth:"any"}),quarter:Ua({matchPatterns:$S,defaultMatchWidth:"wide",parsePatterns:YS,defaultParseWidth:"any",valueCallback:i=>i+1}),month:Ua({matchPatterns:GS,defaultMatchWidth:"wide",parsePatterns:VS,defaultParseWidth:"any"}),day:Ua({matchPatterns:FS,defaultMatchWidth:"wide",parsePatterns:IS,defaultParseWidth:"any"}),dayPeriod:Ua({matchPatterns:JS,defaultMatchWidth:"any",parsePatterns:QS,defaultParseWidth:"any"})},qy={code:"en-US",formatDistance:vS,formatLong:ES,formatRelative:jS,localize:DS,match:XS,options:{weekStartsOn:0,firstWeekContainsDate:1}};function KS(i,n){const s=ln(i,n==null?void 0:n.in);return fS(s,bS(s))+1}function ZS(i,n){const s=ln(i,n==null?void 0:n.in),a=+Zo(s)-+hS(s);return Math.round(a/Ry)+1}function Uy(i,n){var E,w,T,z;const s=ln(i,n==null?void 0:n.in),a=s.getFullYear(),o=nl(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((z=(T=o.locale)==null?void 0:T.options)==null?void 0:z.firstWeekContainsDate)??1,d=bs((n==null?void 0:n.in)||i,0);d.setFullYear(a+1,0,f),d.setHours(0,0,0,0);const m=Za(d,n),g=bs((n==null?void 0:n.in)||i,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Za(g,n);return+s>=+m?a+1:+s>=+y?a:a-1}function WS(i,n){var m,g,y,E;const s=nl(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=Uy(i,n),f=bs((n==null?void 0:n.in)||i,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Za(f,n)}function eE(i,n){const s=ln(i,n==null?void 0:n.in),a=+Za(s,n)-+WS(s,n);return Math.round(a/Ry)+1}function Fe(i,n){const s=i<0?"-":"",a=Math.abs(i).toString().padStart(n,"0");return s+a}const Xs={y(i,n){const s=i.getFullYear(),a=s>0?s:1-s;return Fe(n==="yy"?a%100:a,n.length)},M(i,n){const s=i.getMonth();return n==="M"?String(s+1):Fe(s+1,2)},d(i,n){return Fe(i.getDate(),n.length)},a(i,n){const s=i.getHours()/12>=1?"pm":"am";switch(n){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(i,n){return Fe(i.getHours()%12||12,n.length)},H(i,n){return Fe(i.getHours(),n.length)},m(i,n){return Fe(i.getMinutes(),n.length)},s(i,n){return Fe(i.getSeconds(),n.length)},S(i,n){const s=n.length,a=i.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Fe(o,n.length)}},xr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gg={G:function(i,n,s){const a=i.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(i,n,s){if(n==="yo"){const a=i.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Xs.y(i,n)},Y:function(i,n,s,a){const o=Uy(i,a),f=o>0?o:1-o;if(n==="YY"){const d=f%100;return Fe(d,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Fe(f,n.length)},R:function(i,n){const s=Dy(i);return Fe(s,n.length)},u:function(i,n){const s=i.getFullYear();return Fe(s,n.length)},Q:function(i,n,s){const a=Math.ceil((i.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Fe(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(i,n,s){const a=Math.ceil((i.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Fe(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(i,n,s){const a=i.getMonth();switch(n){case"M":case"MM":return Xs.M(i,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(i,n,s){const a=i.getMonth();switch(n){case"L":return String(a+1);case"LL":return Fe(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(i,n,s,a){const o=eE(i,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Fe(o,n.length)},I:function(i,n,s){const a=ZS(i);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Fe(a,n.length)},d:function(i,n,s){return n==="do"?s.ordinalNumber(i.getDate(),{unit:"date"}):Xs.d(i,n)},D:function(i,n,s){const a=KS(i);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Fe(a,n.length)},E:function(i,n,s){const a=i.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(i,n,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Fe(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(i,n,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Fe(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(i,n,s){const a=i.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Fe(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(i,n,s){const o=i.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(i,n,s){const a=i.getHours();let o;switch(a===12?o=xr.noon:a===0?o=xr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(i,n,s){const a=i.getHours();let o;switch(a>=17?o=xr.evening:a>=12?o=xr.afternoon:a>=4?o=xr.morning:o=xr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(i,n,s){if(n==="ho"){let a=i.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Xs.h(i,n)},H:function(i,n,s){return n==="Ho"?s.ordinalNumber(i.getHours(),{unit:"hour"}):Xs.H(i,n)},K:function(i,n,s){const a=i.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Fe(a,n.length)},k:function(i,n,s){let a=i.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Fe(a,n.length)},m:function(i,n,s){return n==="mo"?s.ordinalNumber(i.getMinutes(),{unit:"minute"}):Xs.m(i,n)},s:function(i,n,s){return n==="so"?s.ordinalNumber(i.getSeconds(),{unit:"second"}):Xs.s(i,n)},S:function(i,n){return Xs.S(i,n)},X:function(i,n,s){const a=i.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return bg(a);case"XXXX":case"XX":return Ni(a);case"XXXXX":case"XXX":default:return Ni(a,":")}},x:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"x":return bg(a);case"xxxx":case"xx":return Ni(a);case"xxxxx":case"xxx":default:return Ni(a,":")}},O:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+yg(a,":");case"OOOO":default:return"GMT"+Ni(a,":")}},z:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+yg(a,":");case"zzzz":default:return"GMT"+Ni(a,":")}},t:function(i,n,s){const a=Math.trunc(+i/1e3);return Fe(a,n.length)},T:function(i,n,s){return Fe(+i,n.length)}};function yg(i,n=""){const s=i>0?"-":"+",a=Math.abs(i),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Fe(f,2)}function bg(i,n){return i%60===0?(i>0?"-":"+")+Fe(Math.abs(i)/60,2):Ni(i,n)}function Ni(i,n=""){const s=i>0?"-":"+",a=Math.abs(i),o=Fe(Math.trunc(a/60),2),f=Fe(a%60,2);return s+o+n+f}const xg=(i,n)=>{switch(i){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},By=(i,n)=>{switch(i){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},tE=(i,n)=>{const s=i.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return xg(i,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",xg(a,n)).replace("{{time}}",By(o,n))},nE={p:By,P:tE},sE=/^D+$/,iE=/^Y+$/,rE=["D","DD","YY","YYYY"];function aE(i){return sE.test(i)}function lE(i){return iE.test(i)}function oE(i,n,s){const a=cE(i,n,s);if(console.warn(a),rE.includes(i))throw new RangeError(a)}function cE(i,n,s){const a=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const uE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,hE=/^'([^]*?)'?$/,dE=/''/g,mE=/[a-zA-Z]/;function Oh(i,n,s){var E,w,T,z;const a=nl(),o=a.locale??qy,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,d=a.weekStartsOn??((z=(T=a.locale)==null?void 0:T.options)==null?void 0:z.weekStartsOn)??0,m=ln(i,s==null?void 0:s.in);if(!gS(m))throw new RangeError("Invalid time value");let g=n.match(fE).map(M=>{const q=M[0];if(q==="p"||q==="P"){const Q=nE[q];return Q(M,o.formatLong)}return M}).join("").match(uE).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const q=M[0];if(q==="'")return{isToken:!1,value:pE(M)};if(gg[q])return{isToken:!0,value:M};if(q.match(mE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+q+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(m,g));const y={firstWeekContainsDate:f,weekStartsOn:d,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const q=M.value;(lE(q)||aE(q))&&oE(q,n,String(i));const Q=gg[q[0]];return Q(m,q,o.localize,y)}).join("")}function pE(i){const n=i.match(hE);return n?n[1].replace(dE,"'"):i}function gE(i,n,s){const a=nl(),o=(s==null?void 0:s.locale)??a.locale??qy,f=dS(i,n);if(isNaN(f))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,g]=zy(s==null?void 0:s.in,...f>0?[n,i]:[i,n]),y=yS((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-m.getTime(),w=E/ug,T=Wo(g)-Wo(m),z=(E-T)/ug,M=s==null?void 0:s.unit;let q;if(M?q=M:w<1?q="second":w<60?q="minute":w<dg?q="hour":z<hg?q="day":z<fg?q="month":q="year",q==="second"){const Q=y(E/1e3);return o.formatDistance("xSeconds",Q,d)}else if(q==="minute"){const Q=y(w);return o.formatDistance("xMinutes",Q,d)}else if(q==="hour"){const Q=y(w/60);return o.formatDistance("xHours",Q,d)}else if(q==="day"){const Q=y(z/dg);return o.formatDistance("xDays",Q,d)}else if(q==="month"){const Q=y(z/hg);return Q===12&&M!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",Q,d)}else{const Q=y(z/fg);return o.formatDistance("xYears",Q,d)}}function yE(i,n){return gE(i,mS(i),n)}function KA(i){return i.toLocaleString()}function ZA(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function bE(i){const n=new Date(i);return n.getTime()>Date.now()?"just now":yE(n,{addSuffix:!0})}function WA(i){const n=Date.now()-new Date(i).getTime();if(n<0)return"now";const s=Math.floor(n/1e3);if(s<60)return`${s}s`;const a=Math.floor(s/60);if(a<60)return`${a}m`;const o=Math.floor(a/60);if(o<24)return`${o}h`;const f=Math.floor(o/24);return f<7?`${f}d`:f<30?`${Math.floor(f/7)}w`:f<365?`${Math.floor(f/30)}mo`:`${Math.floor(f/365)}y`}function e3(i){return i<=0?"Expired":Th(i)}function xE(i){return i==null?"--":Th(i)}function t3(i){return i?Oh(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Th(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const d=i/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const n=Math.floor(i/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function n3(i,n){const s=new Date(i).getTime(),a=n?new Date(n).getTime():Date.now();return Th(a-s)}function Ly({options:i,children:n,className:s=""}){const[a,o]=O.useState(!1),[f,d]=O.useState(null),[m,g]=O.useState(null),y=O.useRef(null),E=O.useRef(void 0),w=O.useRef(void 0),T=220,z=O.useCallback(()=>{if(!y.current)return;const W=y.current.getBoundingClientRect(),te=window.innerWidth-T-8,fe=Math.max(8,Math.min(W.left,te));g({top:W.bottom+4,left:fe})},[]),M=O.useCallback(async(W,te)=>{try{await navigator.clipboard.writeText(W),d(te),clearTimeout(E.current),E.current=setTimeout(()=>d(null),1200)}catch{}},[]),q=O.useCallback(()=>{clearTimeout(w.current),z(),o(!0)},[z]),Q=O.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return O.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),h.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:q,onMouseLeave:Q,children:[n,a&&m&&Og.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:m.top,left:m.left},onMouseEnter:q,onMouseLeave:Q,children:i.map(W=>h.jsxs("button",{onClick:te=>{te.stopPropagation(),M(W.value,W.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:W.label}),h.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===W.label?"✓":W.value})]},W.label))}),document.body)]})}function vE(i,n){const s=new Date(i);switch(n){case"relative":return bE(i);case"datetime":return Oh(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function _E(i){const n=new Date(i);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:Oh(n,"MMM d, yyyy h:mm:ss a")}]}function wE({date:i,format:n="relative",className:s=""}){const[,a]=O.useState(0);O.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(d=>d+1),3e4);return()=>clearInterval(f)},[n]);const o=O.useMemo(()=>_E(i),[i]);return h.jsx(Ly,{options:o,children:h.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${s}`,children:vE(i,n)})})}function SE({ms:i,className:n=""}){const s=xE(i),a=O.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:s}],[i,s]);return i==null?h.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):h.jsx(Ly,{options:a,children:h.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const EE=["sm","md","lg","full"],vg={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"},_g={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function AE({which:i}){const n="stroke-current";switch(i){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function jE({msg:i}){const[n,s]=O.useState(0);O.useEffect(()=>{const d=new Date(i.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-d)/1e3));m();const g=setInterval(m,1e3);return()=>clearInterval(g)},[i.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),i.workflowId&&h.jsxs(_r,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[h.jsx(rh,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function OE({msg:i,compileMessage:n}){const s=i.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(wE,{date:i.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),i.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),h.jsx(SE,{ms:i.durationMs,className:"!text-[9px] text-text-muted/50"})]}),i.workflowId&&h.jsx(_r,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(rh,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&i.workflowId&&!i.pending&&h.jsx("button",{onClick:()=>n(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(Sv,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function TE(){const{helpOpen:i,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:d,compileMessage:m}=My(),[g,y]=O.useState(""),[E,w]=O.useState("md"),[T,z]=O.useState(!0),M=O.useRef(null),q=O.useRef(null);if(O.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),O.useEffect(()=>{i&&q.current&&q.current.focus()},[i]),O.useEffect(()=>{if(!i)return;const N=V=>{V.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,E,n]),!i)return null;const Q=()=>{const N=g.trim();!N||f||(a(N),y(""),q.current&&(q.current.style.height="auto"))},W=N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),Q())},te=E==="full",fe=o.page.replace(/-/g," "),re=te?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${te?vg.full:`right-6 ${vg[E]}`} ${T?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${T?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:fe})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:EE.map(N=>h.jsx("button",{onClick:()=>w(N),className:`p-1 rounded transition-colors ${N===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":N===E,"aria-label":_g[N],title:_g[N],children:h.jsx(AE,{which:N})},N))}),s.length>0&&h.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(Ev,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Dr,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${T?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(N=>h.jsxs("div",{className:`text-xs leading-relaxed ${N.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${N.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:N.pending?h.jsx(jE,{msg:N}):N.role==="assistant"?h.jsx(jh,{content:N.content}):N.content}),!N.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(OE,{msg:N,compileMessage:m})})]},N.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${T?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:q,value:g,onChange:N=>{y(N.target.value);const V=N.target;V.style.height="auto",V.style.height=`${Math.min(V.scrollHeight,120)}px`},onKeyDown:W,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:!!f}),h.jsx("button",{onClick:Q,disabled:!g.trim()||!!f,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:h.jsx(Av,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function NE(){var Q;const{isBuilder:i,isOps:n,viewAs:s}=gy(),{data:a}=Ur(),o=dy(),f=o!==null?o:!!((Q=a==null?void 0:a.ai)!=null&&Q.enabled),{collapsed:d,toggle:m}=by(),[g,y]=O.useState(!1),[E,w]=O.useState(!1),[T,z]=O.useState(()=>window.location.hash.startsWith("#docs")),M=ri(),q=O.useRef(null);return O.useEffect(()=>{const W=q.current;W&&(W.classList.remove("animate-page-in"),W.offsetWidth,W.classList.add("animate-page-in"))},[M.pathname]),O.useEffect(()=>{const W=()=>{window.location.hash.startsWith("#docs")&&z(!0)};return window.addEventListener("hashchange",W),()=>window.removeEventListener("hashchange",W)},[]),h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(g2,{onToggleEventFeed:()=>y(W=>!W),onToggleDocs:()=>z(W=>!W)}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsxs("aside",{className:`${d?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[h.jsx(w2,{aiEnabled:f,isBuilder:i,isOps:n,viewAs:s}),i&&h.jsx(S2,{}),i&&f&&h.jsx(A2,{}),i&&h.jsx(O2,{}),(i||n)&&h.jsx(T2,{isBuilder:i,isOps:n})]}),h.jsx("button",{onClick:m,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${d?"flex justify-center":"flex items-center px-7"}`,"aria-label":d?"Expand sidebar":"Collapse sidebar",children:d?h.jsx(jv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(Ov,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!d&&(a==null?void 0:a.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-[10px] leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${a.environment.longTailVersion} · HotMesh v${a.environment.hotmeshVersion} · Node ${a.environment.nodeVersion} · ${a.environment.nodeEnv}`,children:["long-tail v",a.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",a.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 overflow-y-auto",children:h.jsx("div",{ref:q,className:"w-full px-10 py-10 pb-16 animate-page-in h-full flex flex-col",children:h.jsx(Ar,{})})})]}),h.jsx(I2,{open:g,onToggle:()=>y(W=>!W),configOpen:E,onToggleConfig:()=>w(W=>!W)}),h.jsx(sS,{open:T,onClose:()=>{z(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),f&&h.jsx(oS,{}),f&&h.jsx(TE,{})]})}function kE(){const{isAuthenticated:i}=ai(),n=ri();return i?h.jsx(Iw,{children:h.jsx(lS,{children:h.jsx(NE,{})})}):h.jsx($n,{to:"/login",state:{from:n.pathname},replace:!0})}function Hy({provider:i,className:n="w-5 h-5"}){switch(i){case"google":return h.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[h.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"}),h.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"}),h.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"}),h.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 h.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function CE(){return Ye("/auth/oauth/providers")}async function ME(i,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Ye(`/auth/oauth/connections/${i}${s}`,{method:"DELETE"})}function s3(){return Sn({queryKey:["oauth-connections"],queryFn:()=>Ye("/auth/oauth/connections")})}function i3(){const i=on();return En({mutationFn:({provider:n,label:s})=>ME(n,s),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function RE(){var ae;const{login:i,isAuthenticated:n}=ai(),s=Tg(),a=ri(),o=new URLSearchParams(a.search),f=o.get("token"),d=o.get("error"),m=((ae=a.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=O.useRef(!1);f&&!g.current&&(g.current=!0,i(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=O.useState(""),[w,T]=O.useState(""),[z,M]=O.useState(d||""),[q,Q]=O.useState(!1),[W,te]=O.useState(!!f),[fe,re]=O.useState([]),N=O.useRef(!1);if(O.useEffect(()=>{f||N.current||(N.current=!0,(async()=>{var P,F,X,oe;try{const ie=await fetch(`${Vt}/api/settings`);if(!ie.ok)return;const Ne=await ie.json();if(!((P=Ne.auth)!=null&&P.sso))return;const Ue=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!Ue.ok){M("Host authentication required — please log in to your organization first");return}const Te=await Ue.json();Te.token&&((F=Ne.auth)!=null&&F.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",Ne.auth.ssoLogoutUrl),te(!0),i(Te.token,void 0,{displayName:(X=Te.user)==null?void 0:X.display_name,username:(oe=Te.user)==null?void 0:oe.external_id}))}catch{}})())},[]),O.useEffect(()=>{f||CE().then(re).catch(()=>{})},[]),O.useEffect(()=>{if(!W)return;const P=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(P)},[W]),n&&!W)return h.jsx($n,{to:m,replace:!0});const V=async P=>{var F,X;if(P.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}Q(!0);try{const oe=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ie=await oe.json();if(!oe.ok){M(ie.error||"Login failed");return}te(!0),i(ie.token,{username:y.trim(),password:w},{displayName:(F=ie.user)==null?void 0:F.display_name,username:(X=ie.user)==null?void 0:X.external_id})}catch{M("Unable to connect to server")}finally{Q(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${W?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Sh,{size:"lg",hideLabel:W})}),h.jsxs("form",{onSubmit:V,className:`space-y-5 transition-opacity duration-300 ${W?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:y,onChange:P=>E(P.target.value),className:"input",placeholder:"Enter your username",autoFocus:!W,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:w,onChange:P=>T(P.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&h.jsx("p",{className:"text-sm text-status-error",children:z}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:q||W,children:q?"Signing in...":"Sign In"}),fe.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:fe.filter(P=>P.provider!=="anthropic").map(P=>h.jsxs("a",{href:`${Vt}/api/auth/oauth/${P.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Hy,{provider:P.provider}),"Sign in with ",P.name]},P.provider))})]})]})]})})}function wg(){const{isAuthenticated:i}=ai(),n=Tg(),s=ri(),a=new URLSearchParams(s.search),o=a.get("state")||"";O.useEffect(()=>{i||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[i]);const[f,d]=O.useState(""),[m,g]=O.useState(a.get("label")||"default"),[y,E]=O.useState(""),[w,T]=O.useState(!1),z=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),q=Q=>{Q.preventDefault();const W=f.trim();if(!W){E("A token or API key is required");return}if(!W.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}T(!0),E("");const te=`${Vt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(W)}&state=${encodeURIComponent(o)}`;window.location.href=te};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Sh,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Hy,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),h.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."}),h.jsxs("form",{onSubmit:q,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:f,onChange:Q=>d(Q.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:m,onChange:Q=>g(Q.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.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").'})]}),y&&h.jsx("p",{className:"text-sm text-status-error",children:y}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.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 Ba({roleTypes:i,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=ai();return a?h.jsx(Ar,{}):i&&i.some(d=>f(d))?h.jsx(Ar,{}):n&&n.some(d=>o(d))?h.jsx(Ar,{}):h.jsx($n,{to:s,replace:!0})}function DE({redirectTo:i="/"}){var a;const{data:n,isLoading:s}=Ur();return s||!n?null:(a=n.ai)!=null&&a.enabled?h.jsx(Ar,{}):h.jsx($n,{to:i,replace:!0})}function zE({flag:i,redirectTo:n="/"}){var o;const{data:s,isLoading:a}=Ur();return a||!s?null:((o=s.features)==null?void 0:o[i])===!1?h.jsx($n,{to:n,replace:!0}):h.jsx(Ar,{})}const qE=O.lazy(()=>Ee(()=>import("./ProcessesListPage-DSsIGmBB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),UE=O.lazy(()=>Ee(()=>import("./ProcessDetailPage-C3gE4OHq.js"),__vite__mapDeps([18,1,2,4,19,15,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),BE=O.lazy(()=>Ee(()=>import("./McpOverview-DXrkDkU-.js"),__vite__mapDeps([24,1,25,26,27,28,14,15,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),LE=O.lazy(()=>Ee(()=>import("./McpRunsPage-Bx5DiGk7.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,15,32,14,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),HE=O.lazy(()=>Ee(()=>import("./McpRunDetailPage-B7e6AVl1.js"),__vite__mapDeps([34,1,26,20,14,15,35,6,36,37,13,38,39,16]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),PE=O.lazy(()=>Ee(()=>import("./McpQueryPage-oE9eWAus.js"),__vite__mapDeps([40,1,14,15,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),$E=O.lazy(()=>Ee(()=>import("./McpQueryDetailPage-CnLYE26v.js"),__vite__mapDeps([42,1,14,15,20,41,6,27,4,43,36,26,3,2,44,45,46,47,48,49,35,50,38,39]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),YE=O.lazy(()=>Ee(()=>import("./EscalationsOverview-uHb8ni_5.js"),__vite__mapDeps([51,1,4,14,15,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),GE=O.lazy(()=>Ee(()=>import("./AvailableEscalationsPage-CUvrKkgS.js"),__vite__mapDeps([52,1,6,4,53,54,55,56,20,57,15,5,7,8,9,10,12,14,23,58,13,59,21,17,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),VE=O.lazy(()=>Ee(()=>import("./OperatorDashboard-r6hQ57eO.js"),__vite__mapDeps([60,1,4,56,5,6,7,8,9,10,14,15,12,33,58,13,59,21,17,57,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),FE=O.lazy(()=>Ee(()=>import("./index-DIrYjyRG.js"),__vite__mapDeps([61,1,53,54,6,55,56,14,15,16,57,3,4,62,20,21,35,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),IE=O.lazy(()=>Ee(()=>import("./WorkflowsOverview-l-0KYP7Y.js"),__vite__mapDeps([63,1,3,4,14,15,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),JE=O.lazy(()=>Ee(()=>import("./index-BMQopgAx.js"),__vite__mapDeps([64,1,3,14,15,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),QE=O.lazy(()=>Ee(()=>import("./index-BMQopgAx.js"),__vite__mapDeps([64,1,3,14,15,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),XE=O.lazy(()=>Ee(()=>import("./WorkflowsDashboard-DEq9fkhl.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),KE=O.lazy(()=>Ee(()=>import("./WorkflowsDashboard-DEq9fkhl.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),ZE=O.lazy(()=>Ee(()=>import("./YamlWorkflowsPage-CabXXA9r.js"),__vite__mapDeps([67,1,27,5,6,14,15,13,10,49,65,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),WE=O.lazy(()=>Ee(()=>import("./GraphInvokePage-C6sfPjSc.js"),__vite__mapDeps([68,1,27,14,15,44,46,47,48,45,6,49,65]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),eA=O.lazy(()=>Ee(()=>import("./YamlWorkflowDetailPage-BgimL3VT.js"),__vite__mapDeps([69,1,27,20,65,15,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),tA=O.lazy(()=>Ee(()=>import("./TasksListPage-C_PwExQC.js"),__vite__mapDeps([70,1,2,3,5,6,9,10,20,59,50,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),nA=O.lazy(()=>Ee(()=>import("./TaskDetailPage-BUKHu2oD.js"),__vite__mapDeps([71,1,2,20,59,14,15,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),Sg=O.lazy(()=>Ee(()=>import("./WorkflowExecutionPage-DrwKB2x8.js"),__vite__mapDeps([72,1,3,4,37,13,38,20,6,39,15,2,14,36,16,62,35]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),sA=O.lazy(()=>Ee(()=>import("./AdminDashboard-JobmypiO.js"),__vite__mapDeps([73,1,2,4,25,19,15,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),iA=O.lazy(()=>Ee(()=>import("./index-BfDn7j4K.js"),__vite__mapDeps([74,1,3,9,10,13,33,5,6,14,15,75,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),rA=O.lazy(()=>Ee(()=>import("./index-xBNf5aFb.js"),__vite__mapDeps([76,1,3,13,77,54,6,21,15,17,14,56,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),Eg=O.lazy(()=>Ee(()=>import("./index-xBNf5aFb.js"),__vite__mapDeps([76,1,3,13,77,54,6,21,15,17,14,56,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),aA=O.lazy(()=>Ee(()=>import("./index-BmbO85oT.js"),__vite__mapDeps([78,1,25,10,77,54,6,14,15,13,12,5,79,46,47,48,49,45,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),Ag=O.lazy(()=>Ee(()=>import("./index-BZfX_ziz.js"),__vite__mapDeps([80,1,25,14,15,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),lA=O.lazy(()=>Ee(()=>import("./index-1WCiN-pF.js"),__vite__mapDeps([81,1,23,5,6,9,10,12,13,77,54,33,14,15,21,48,11,56,50]),import.meta.url).then(i=>({default:i.UsersPage}))),oA=O.lazy(()=>Ee(()=>import("./RolesPage-CE5fui18.js"),__vite__mapDeps([82,1,56,14,15,54,6]),import.meta.url).then(i=>({default:i.RolesPage}))),cA=O.lazy(()=>Ee(()=>import("./RoleDetailPage-DiFISbnq.js"),__vite__mapDeps([83,1,56,77,54,6,23,15]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),uA=O.lazy(()=>Ee(()=>import("./EscalationSchemaPage-BcYcj-b8.js"),__vite__mapDeps([84,1,56,15,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),fA=O.lazy(()=>Ee(()=>import("./EscalationListSchemaPage-ClFRLeKV.js"),__vite__mapDeps([85,1,56,15,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),hA=O.lazy(()=>Ee(()=>import("./index-CJFA7aLp.js"),__vite__mapDeps([86,1,14,15,54,6,55]),import.meta.url).then(i=>({default:i.MaintenancePage}))),dA=O.lazy(()=>Ee(()=>import("./OperationsPage-BmG3qzdR.js").then(i=>i.O),__vite__mapDeps([87,1,56,4,14,15,6]),import.meta.url).then(i=>({default:i.OperationsPage}))),mA=O.lazy(()=>Ee(()=>import("./index-C75E0-Wd.js"),__vite__mapDeps([88,1,19,15,13,5,6,31,28,54,36,75,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),pA=O.lazy(()=>Ee(()=>import("./index-wZzl3bcK.js"),__vite__mapDeps([89,1,62,15,39,5,6,31,28,8,9,10,12,13,14,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),gA=O.lazy(()=>Ee(()=>import("./CredentialsPage-D5H_kyRL.js"),__vite__mapDeps([90,1,14,15,50,77,54,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),yA=O.lazy(()=>Ee(()=>import("./index-B4zWCfQr.js"),__vite__mapDeps([91,1,6,14,15,13,16,8,10,92,50]),import.meta.url).then(i=>({default:i.FilesPage}))),bA=O.lazy(()=>Ee(()=>import("./index-QOTnrFd1.js"),__vite__mapDeps([93,1,14,15,13,16,12,10,92,50,94,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),xA=O.lazy(()=>Ee(()=>import("./HomePage-CUHZxihq.js"),__vite__mapDeps([95,1,56,3,26,28,4,21,15,17,16,87,14,6]),import.meta.url).then(i=>({default:i.HomePage}))),vA=O.lazy(()=>Ee(()=>import("./AgentsPage-DTKto-gL.js"),__vite__mapDeps([96,1,97,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),_A=O.lazy(()=>Ee(()=>import("./AgentDetailPage-Cj22NZLI.js"),__vite__mapDeps([98,1,97,99,15,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),jg=O.lazy(()=>Ee(()=>import("./AgentConfigPage-D_HuaRN9.js"),__vite__mapDeps([100,1,97,99,15,14,94,46,47,48,3,27,101,102,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),wA=O.lazy(()=>Ee(()=>import("./CapabilitiesPage-1ZMO_0UU.js"),__vite__mapDeps([103,1,101,79,25,46,47,48,15,49,6,45,14,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),SA=O.lazy(()=>Ee(()=>import("./TopicsPage-BZknsApe.js"),__vite__mapDeps([104,1,102,14,15,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),EA=O.lazy(()=>Ee(()=>import("./TopicDetailPage-DKAvbkxD.js"),__vite__mapDeps([105,1,102,16,15,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function AA(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function we({children:i}){return h.jsx(O.Suspense,{fallback:h.jsx(AA,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Py=new Zx({defaultOptions:{queries:{staleTime:1e4,retry:(i,n)=>n instanceof Error&&n.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Py.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",n=`${i}/login`;if(window.location.pathname!==n){const s=window.location.pathname+window.location.search,a=i&&s.startsWith(i)?s.slice(i.length)||"/":s;window.location.href=`${n}?returnTo=${encodeURIComponent(a)}`}});const jA=tv([{path:"/login",element:h.jsx(RE,{})},{path:"/connect/anthropic",element:h.jsx(wg,{})},{path:"/connect/:provider",element:h.jsx(wg,{})},{path:"/",element:h.jsx(kE,{}),children:[{index:!0,element:h.jsx(we,{children:h.jsx(xA,{})})},{path:"processes/all",element:h.jsx(we,{children:h.jsx(qE,{})})},{path:"processes/detail/:originId",element:h.jsx(we,{children:h.jsx(UE,{})})},{path:"credentials",element:h.jsx(we,{children:h.jsx(gA,{})})},{path:"connections",element:h.jsx($n,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(we,{children:h.jsx(YE,{})})},{path:"escalations/available",element:h.jsx(we,{children:h.jsx(GE,{})})},{path:"escalations/queue",element:h.jsx(we,{children:h.jsx(VE,{})})},{path:"escalations/detail/:id",element:h.jsx(we,{children:h.jsx(FE,{})})},{path:"capabilities",element:h.jsx(we,{children:h.jsx(wA,{})})},{path:"agents",element:h.jsx(we,{children:h.jsx(vA,{})})},{path:"agents/new",element:h.jsx(we,{children:h.jsx(jg,{})})},{path:"agents/:id",element:h.jsx(we,{children:h.jsx(_A,{})})},{path:"agents/:id/edit",element:h.jsx(we,{children:h.jsx(jg,{})})},{path:"topics",element:h.jsx(we,{children:h.jsx(SA,{})})},{path:"topics/:topic",element:h.jsx(we,{children:h.jsx(EA,{})})},{element:h.jsx(Ba,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(we,{children:h.jsx(IE,{})})},{path:"workflows/executions",element:h.jsx(we,{children:h.jsx(KE,{})})},{path:"workflows/durable/executions",element:h.jsx(we,{children:h.jsx(XE,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Sg,{})})},{path:"workflows/tasks",element:h.jsx(we,{children:h.jsx(tA,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(we,{children:h.jsx(nA,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Sg,{})})},{path:"workflows/start",element:h.jsx(we,{children:h.jsx(JE,{})})},{path:"workflows/durable/invoke",element:h.jsx(we,{children:h.jsx(QE,{})})},{path:"workflows/cron",element:h.jsx($n,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(we,{children:h.jsx(iA,{})})},{path:"workflows/registry",element:h.jsx(we,{children:h.jsx(rA,{})})},{path:"workflows/registry/new",element:h.jsx(we,{children:h.jsx(Eg,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(we,{children:h.jsx(Eg,{})})}]},{element:h.jsx(Ba,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(we,{children:h.jsx(ZE,{})})},{path:"mcp/workflows/invoke",element:h.jsx(we,{children:h.jsx(WE,{})})},{path:"mcp/workflows/:id",element:h.jsx(we,{children:h.jsx(eA,{})})},{path:"mcp/executions",element:h.jsx(we,{children:h.jsx(LE,{})})},{path:"mcp/executions/:jobId",element:h.jsx(we,{children:h.jsx(HE,{})})},{path:"files",element:h.jsx(we,{children:h.jsx(yA,{})})},{path:"knowledge",element:h.jsx(we,{children:h.jsx(bA,{})})},{element:h.jsx(DE,{}),children:[{path:"mcp",element:h.jsx(we,{children:h.jsx(BE,{})})},{path:"mcp/queries",element:h.jsx(we,{children:h.jsx(PE,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(we,{children:h.jsx($E,{})})},{path:"mcp/tools",element:h.jsx($n,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(we,{children:h.jsx(aA,{})})},{path:"mcp/servers/new",element:h.jsx(we,{children:h.jsx(Ag,{})})},{path:"mcp/servers/:serverId",element:h.jsx(we,{children:h.jsx(Ag,{})})}]}]},{element:h.jsx(Ba,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"operations",element:h.jsx(we,{children:h.jsx(dA,{})})}]},{element:h.jsx(Ba,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(we,{children:h.jsx(sA,{})})},{path:"admin/users",element:h.jsx(we,{children:h.jsx(lA,{})})},{path:"admin/escalation-chains",element:h.jsx($n,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(we,{children:h.jsx(oA,{})})},{path:"admin/roles/:role",element:h.jsx(we,{children:h.jsx(cA,{})})},{path:"admin/roles/:role/schema",element:h.jsx(we,{children:h.jsx(uA,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(we,{children:h.jsx(fA,{})})}]},{element:h.jsx(Ba,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx($n,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(zE,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(we,{children:h.jsx(hA,{})})}]},{path:"admin/controlplane",element:h.jsx(we,{children:h.jsx(mA,{})})},{path:"admin/streams",element:h.jsx(we,{children:h.jsx(pA,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function OA(){return h.jsx(Wx,{client:Py,children:h.jsx(qv,{children:h.jsx(Hw,{children:h.jsx(nv,{router:jA})})})})}Sy(wy());Mv.createRoot(document.getElementById("root")).render(h.jsx(O.StrictMode,{children:h.jsx(OA,{})}));export{i3 as $,Th as A,BA as B,Ah as C,SE as D,$A as E,Ty as F,JA as G,Oh as H,Ly as I,G2 as J,e3 as K,KA as L,jh as M,L_ as N,Vt as O,Dg as P,RA as Q,a2 as R,M2 as S,d2 as T,XA as U,Mo as V,$a as W,vr as X,br as Y,h2 as Z,s3 as _,n3 as a,Hy as a0,ZA as a1,wE as b,P_ as c,Ye as d,UA as e,xE as f,LA as g,PA as h,DA as i,Jw as j,dy as k,ai as l,qA as m,gy as n,YA as o,GA as p,VA as q,FA as r,IA as s,QA as t,Ur as u,zA as v,Qw as w,HA as x,t3 as y,WA as z};
|
|
63
|
-
//# sourceMappingURL=index-so192yXP.js.map
|