@hotmeshio/long-tail 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/build/api/escalations/accumulate.d.ts +96 -0
- package/build/api/escalations/accumulate.js +516 -0
- package/build/api/escalations/index.d.ts +1 -0
- package/build/api/escalations/index.js +10 -1
- package/build/api/roles.d.ts +4 -5
- package/build/api/roles.js +53 -4
- package/build/api/scan-codes/execute.js +2 -0
- package/build/api/scan-codes/verbs.d.ts +15 -0
- package/build/api/scan-codes/verbs.js +65 -0
- package/build/index.js +60 -0
- package/build/lib/db/schemas/036_role_portals.sql +12 -0
- package/build/routes/escalations/accumulate.d.ts +7 -0
- package/build/routes/escalations/accumulate.js +150 -0
- package/build/routes/escalations/index.js +5 -0
- package/build/sdk/index.d.ts +25 -0
- package/build/sdk/index.js +8 -0
- package/build/services/escalation/accumulate.d.ts +81 -0
- package/build/services/escalation/accumulate.js +154 -0
- package/build/services/escalation/index.d.ts +1 -0
- package/build/services/escalation/index.js +1 -0
- package/build/services/mcp/playwright-server/schemas.d.ts +2 -2
- package/build/services/orchestrator/condition.d.ts +40 -3
- package/build/services/orchestrator/condition.js +42 -2
- package/build/services/role/index.js +1 -0
- package/build/services/role/seed.js +6 -1
- package/build/services/role/sql.d.ts +6 -3
- package/build/services/role/sql.js +7 -2
- package/build/services/role/types.d.ts +38 -10
- package/build/services/role/types.js +10 -1
- package/build/services/scan-code/validate.js +16 -0
- package/build/shared/form-validation/display-only-widgets.d.ts +16 -0
- package/build/shared/form-validation/display-only-widgets.js +25 -0
- package/build/shared/form-validation/index.d.ts +2 -0
- package/build/shared/form-validation/index.js +2 -0
- package/build/shared/form-validation/x-lt-bind.d.ts +2 -14
- package/build/shared/form-validation/x-lt-bind.js +12 -8
- package/build/shared/form-validation/x-lt-invoke.d.ts +38 -0
- package/build/shared/form-validation/x-lt-invoke.js +103 -0
- package/build/system/mcp-servers/admin/escalations.js +39 -0
- package/build/system/mcp-servers/admin/schemas.d.ts +192 -13
- package/build/system/mcp-servers/admin/schemas.js +39 -3
- package/build/system/mcp-servers/admin/users.js +1 -0
- package/build/system/mcp-servers/docs.js +4 -0
- package/build/system/mcp-servers/human-queue-schemas.d.ts +85 -0
- package/build/system/mcp-servers/human-queue-schemas.js +19 -1
- package/build/system/mcp-servers/human-queue.d.ts +2 -0
- package/build/system/mcp-servers/human-queue.js +77 -0
- package/build/system/seed/tool-manifests-admin.d.ts +922 -103
- package/build/system/seed/tool-manifests-admin.js +4 -1
- package/build/system/seed/tool-manifests-escalation.d.ts +174 -0
- package/build/system/seed/tool-manifests-escalation.js +56 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/escalation.d.ts +52 -0
- package/build/types/escalation.js +29 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.js +3 -1
- package/build/types/scan-code.d.ts +24 -0
- package/build/types/scan-code.js +9 -0
- package/build/types/startup.d.ts +20 -0
- package/dashboard/dist/assets/{AdminDashboard-DplvDBti.js → AdminDashboard-uarpHB88.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-DplvDBti.js.map → AdminDashboard-uarpHB88.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-D8Bf6YxO.js → AgentConfigPage-BcUaDD5E.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-D8Bf6YxO.js.map → AgentConfigPage-BcUaDD5E.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-BN8g0Y2G.js → AgentDetailPage-BaZBhK6i.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-BN8g0Y2G.js.map → AgentDetailPage-BaZBhK6i.js.map} +1 -1
- package/dashboard/dist/assets/AgentsPage-CuVFSDc4.js +2 -0
- package/dashboard/dist/assets/{AgentsPage-7JJBHku8.js.map → AgentsPage-CuVFSDc4.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-iO5NyyIK.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-iO5NyyIK.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-CGCnIz8I.js → BotPicker-CClMby6B.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-CGCnIz8I.js.map → BotPicker-CClMby6B.js.map} +1 -1
- package/dashboard/dist/assets/BulkAssignModal-BL8FRgkN.js +2 -0
- package/dashboard/dist/assets/{BulkAssignModal-NJBcoj-f.js.map → BulkAssignModal-BL8FRgkN.js.map} +1 -1
- package/dashboard/dist/assets/CapabilitiesPage-D53ogPor.js +2 -0
- package/dashboard/dist/assets/{CapabilitiesPage-F8dpNn9B.js.map → CapabilitiesPage-D53ogPor.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-BZW6VpCU.js → CollapsibleSection-ow8jpbtD.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-BZW6VpCU.js.map → CollapsibleSection-ow8jpbtD.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-64adXLdq.js → ConfirmDeleteModal-CeEDt9iJ.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-64adXLdq.js.map → ConfirmDeleteModal-CeEDt9iJ.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-BxDub9d2.js → CountdownTimer-CSqyZMCG.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-BxDub9d2.js.map → CountdownTimer-CSqyZMCG.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-CnLzopLL.js → CredentialsPage-Dx7SxA23.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CnLzopLL.js.map → CredentialsPage-Dx7SxA23.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CAD5UYDT.js → CronLabel-LYPxpvNN.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CAD5UYDT.js.map → CronLabel-LYPxpvNN.js.map} +1 -1
- package/dashboard/dist/assets/DataTable-spX1dFyb.js +2 -0
- package/dashboard/dist/assets/DataTable-spX1dFyb.js.map +1 -0
- package/dashboard/dist/assets/{DropZone-XlcY8hEH.js → DropZone-f1o-GLM8.js} +2 -2
- package/dashboard/dist/assets/{DropZone-XlcY8hEH.js.map → DropZone-f1o-GLM8.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CwO4ufd0.js → ElapsedCell-BZJTSm9N.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CwO4ufd0.js.map → ElapsedCell-BZJTSm9N.js.map} +1 -1
- package/dashboard/dist/assets/EntityTimelinePanel-0wIIW2en.js +2 -0
- package/dashboard/dist/assets/{EntityTimelinePanel-CkF-oW-m.js.map → EntityTimelinePanel-0wIIW2en.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-h9JO_q5f.js → EscalationListSchemaPage-CoYvtMzj.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-h9JO_q5f.js.map → EscalationListSchemaPage-CoYvtMzj.js.map} +1 -1
- package/dashboard/dist/assets/EscalationListView-DWFHPufv.js +2 -0
- package/dashboard/dist/assets/EscalationListView-DWFHPufv.js.map +1 -0
- package/dashboard/dist/assets/{EscalationSchemaPage-mJFL5_Se.js → EscalationSchemaPage-C9Xu_A25.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-mJFL5_Se.js.map → EscalationSchemaPage-C9Xu_A25.js.map} +1 -1
- package/dashboard/dist/assets/EscalationTimeline-D8W2LNNk.js +2 -0
- package/dashboard/dist/assets/EscalationTimeline-D8W2LNNk.js.map +1 -0
- package/dashboard/dist/assets/EscalationTitleSelect-DLK8NWMp.js +2 -0
- package/dashboard/dist/assets/EscalationTitleSelect-DLK8NWMp.js.map +1 -0
- package/dashboard/dist/assets/{EscalationsOverview-DlXUFqWJ.js → EscalationsOverview-CW57FaP9.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DlXUFqWJ.js.map → EscalationsOverview-CW57FaP9.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-Ike2xchn.js → EventTable-D1ctWhKf.js} +2 -2
- package/dashboard/dist/assets/{EventTable-Ike2xchn.js.map → EventTable-D1ctWhKf.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-DMOR-O1c.js → FilterBar-C-iur-Nj.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-DMOR-O1c.js.map → FilterBar-C-iur-Nj.js.map} +1 -1
- package/dashboard/dist/assets/GraphInvokePage-CcA_44M4.js +2 -0
- package/dashboard/dist/assets/{GraphInvokePage-CKtvWowP.js.map → GraphInvokePage-CcA_44M4.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-Dc085ghJ.js +2 -0
- package/dashboard/dist/assets/{HomePage-BQ3Q791Q.js.map → HomePage-Dc085ghJ.js.map} +1 -1
- package/dashboard/dist/assets/ListToolbar-h_ziBt4O.js +2 -0
- package/dashboard/dist/assets/{ListToolbar-DdJzj472.js.map → ListToolbar-h_ziBt4O.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-BbtrduWn.js → McpOverview-qXXhbNWV.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-BbtrduWn.js.map → McpOverview-qXXhbNWV.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-C1L4T-Wt.js → McpQueryDetailPage-SEzSbZrd.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-C1L4T-Wt.js.map → McpQueryDetailPage-SEzSbZrd.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryPage-Cy0V0kv9.js +2 -0
- package/dashboard/dist/assets/{McpQueryPage-CfJy7HZ7.js.map → McpQueryPage-Cy0V0kv9.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CA9yv7he.js → McpRunDetailPage-DjJO5vSb.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CA9yv7he.js.map → McpRunDetailPage-DjJO5vSb.js.map} +1 -1
- package/dashboard/dist/assets/McpRunsPage-BfjiJ8mM.js +2 -0
- package/dashboard/dist/assets/{McpRunsPage-D7QXjW9z.js.map → McpRunsPage-BfjiJ8mM.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-Bb3revqD.js → NamespacePill-DADRJOUl.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-Bb3revqD.js.map → NamespacePill-DADRJOUl.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-dJcER0T_.js +3 -0
- package/dashboard/dist/assets/OperationsPage-dJcER0T_.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-zCkW4eqk.js +2 -0
- package/dashboard/dist/assets/{OperatorDashboard-sXNDh1Ph.js.map → OperatorDashboard-zCkW4eqk.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-Di5Sz3an.js → PageHeader-Csq434-v.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Di5Sz3an.js.map → PageHeader-Csq434-v.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-DutKJ-h2.js → PageHeaderWithStats-CSnk1p5A.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-DutKJ-h2.js.map → PageHeaderWithStats-CSnk1p5A.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-NeHD-Gra.js → PersonaDetailPage-Cx6L3Jvu.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-NeHD-Gra.js.map → PersonaDetailPage-Cx6L3Jvu.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-DavKXRWX.js → PersonasPage-DOgGUlJl.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-DavKXRWX.js.map → PersonasPage-DOgGUlJl.js.map} +1 -1
- package/dashboard/dist/assets/PortalPage-BKuL1BeJ.js +2 -0
- package/dashboard/dist/assets/PortalPage-BKuL1BeJ.js.map +1 -0
- package/dashboard/dist/assets/{ProcessDetailPage-DkdKJGe6.js → ProcessDetailPage-BFcFSDUv.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-DkdKJGe6.js.map → ProcessDetailPage-BFcFSDUv.js.map} +1 -1
- package/dashboard/dist/assets/ProcessesListPage-BaHV2cXp.js +2 -0
- package/dashboard/dist/assets/{ProcessesListPage-CjwVKe32.js.map → ProcessesListPage-BaHV2cXp.js.map} +1 -1
- package/dashboard/dist/assets/ResolverForm-Bgc0Zrya.js +7 -0
- package/dashboard/dist/assets/ResolverForm-Bgc0Zrya.js.map +1 -0
- package/dashboard/dist/assets/RoleDetailPage-BPY6i3CU.js +8 -0
- package/dashboard/dist/assets/RoleDetailPage-BPY6i3CU.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-DhnVPK4q.js → RolePill-BafrASDX.js} +2 -2
- package/dashboard/dist/assets/{RolePill-DhnVPK4q.js.map → RolePill-BafrASDX.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-OM9KM8Pg.js → RolesPage-DSqqKPbv.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-OM9KM8Pg.js.map → RolesPage-DSqqKPbv.js.map} +1 -1
- package/dashboard/dist/assets/RunAsSelector-B29iWwel.js +2 -0
- package/dashboard/dist/assets/{RunAsSelector-fFMt1bGe.js.map → RunAsSelector-B29iWwel.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-AujH-pPQ.js → ScanCodesPage-S8aAJfnC.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-AujH-pPQ.js.map → ScanCodesPage-S8aAJfnC.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-eKQpmsC_.js → ScanSchemeDetailPage-CUBRAtmJ.js} +2 -2
- package/dashboard/dist/assets/{ScanSchemeDetailPage-eKQpmsC_.js.map → ScanSchemeDetailPage-CUBRAtmJ.js.map} +1 -1
- package/dashboard/dist/assets/ScanStationPage-R9t1-CeQ.js +2 -0
- package/dashboard/dist/assets/{ScanStationPage-C1_ppDoZ.js.map → ScanStationPage-R9t1-CeQ.js.map} +1 -1
- package/dashboard/dist/assets/{ScopeBadge-CXUg0FHo.js → ScopeBadge-b6MIBiYD.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-CXUg0FHo.js.map → ScopeBadge-b6MIBiYD.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-B91Pk9xh.js → StickyPagination-CkW_A507.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-B91Pk9xh.js.map → StickyPagination-CkW_A507.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-C7SPqaJt.js → StreamMessageDetail-yzWX0wac.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-C7SPqaJt.js.map → StreamMessageDetail-yzWX0wac.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BcHR8ylf.js → SwimlaneTimeline-Cf4DXFxj.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BcHR8ylf.js.map → SwimlaneTimeline-Cf4DXFxj.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-BZ8vb2oW.js → TagInput-ZrIIrEUP.js} +2 -2
- package/dashboard/dist/assets/{TagInput-BZ8vb2oW.js.map → TagInput-ZrIIrEUP.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-Bqj0I_I0.js → TaskDetailPage-DCDcEps9.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-Bqj0I_I0.js.map → TaskDetailPage-DCDcEps9.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-Bxir8WRl.js → TaskQueuePill-DkQ1uc6y.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-Bxir8WRl.js.map → TaskQueuePill-DkQ1uc6y.js.map} +1 -1
- package/dashboard/dist/assets/TasksListPage-BBATgpf7.js +2 -0
- package/dashboard/dist/assets/{TasksListPage-BB1f79lL.js.map → TasksListPage-BBATgpf7.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-BFnODmNe.js → TimeAgo-CSNVEjch.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-BFnODmNe.js.map → TimeAgo-CSNVEjch.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BXgLOBsr.js → TimestampCell-Du1nBrPn.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BXgLOBsr.js.map → TimestampCell-Du1nBrPn.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-FkgTXIhq.js → ToolPill-Baxm02L6.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-FkgTXIhq.js.map → ToolPill-Baxm02L6.js.map} +1 -1
- package/dashboard/dist/assets/ToolTestPanel-CF-h_5Rg.js +2 -0
- package/dashboard/dist/assets/{ToolTestPanel-Bwe3J5lj.js.map → ToolTestPanel-CF-h_5Rg.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-DAF07vZ9.js → TopicDetailPage-Dr1UmWcp.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-DAF07vZ9.js.map → TopicDetailPage-Dr1UmWcp.js.map} +1 -1
- package/dashboard/dist/assets/TopicsPage-CUUo-Ylf.js +2 -0
- package/dashboard/dist/assets/{TopicsPage-C1gxBUap.js.map → TopicsPage-CUUo-Ylf.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-BzXJUE6q.js → UserName-kBh1dc39.js} +2 -2
- package/dashboard/dist/assets/{UserName-BzXJUE6q.js.map → UserName-kBh1dc39.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-SkRU5cRX.js → WorkflowExecutionPage-CCRSbnDx.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-SkRU5cRX.js.map → WorkflowExecutionPage-CCRSbnDx.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill--AYMW7u_.js → WorkflowPill-ZepbO_ny.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill--AYMW7u_.js.map → WorkflowPill-ZepbO_ny.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsDashboard-BNQVvyek.js +2 -0
- package/dashboard/dist/assets/{WorkflowsDashboard-CZAqRk1N.js.map → WorkflowsDashboard-BNQVvyek.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-BoN44VTE.js → WorkflowsOverview-DswubNJN.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-BoN44VTE.js.map → WorkflowsOverview-DswubNJN.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CqjhtdJf.js → YamlWorkflowDetailPage-Cw9Dlmup.js} +11 -11
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CqjhtdJf.js.map → YamlWorkflowDetailPage-Cw9Dlmup.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-CwnJkzyb.js → YamlWorkflowsPage-DB8xnIXy.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-CwnJkzyb.js.map → YamlWorkflowsPage-DB8xnIXy.js.map} +1 -1
- package/dashboard/dist/assets/{agents-gV0Ys-sY.js → agents-BwEnf6N9.js} +2 -2
- package/dashboard/dist/assets/{agents-gV0Ys-sY.js.map → agents-BwEnf6N9.js.map} +1 -1
- package/dashboard/dist/assets/{bots-B97itB3I.js → bots-CCmJTT2u.js} +2 -2
- package/dashboard/dist/assets/{bots-B97itB3I.js.map → bots-CCmJTT2u.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-CR9xZgGd.js → capabilities-BZHgp_nh.js} +2 -2
- package/dashboard/dist/assets/{capabilities-CR9xZgGd.js.map → capabilities-BZHgp_nh.js.map} +1 -1
- package/dashboard/dist/assets/{constants-BHkpVaqx.js → constants-CeBBTzf5.js} +2 -2
- package/dashboard/dist/assets/{constants-BHkpVaqx.js.map → constants-CeBBTzf5.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-YxvP1KCa.js → controlplane-CyfwUlFA.js} +2 -2
- package/dashboard/dist/assets/{controlplane-YxvP1KCa.js.map → controlplane-CyfwUlFA.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-BJPTNmLW.js +2 -0
- package/dashboard/dist/assets/escalation-columns-BJPTNmLW.js.map +1 -0
- package/dashboard/dist/assets/index-3gbd5neL.js +67 -0
- package/dashboard/dist/assets/index-3gbd5neL.js.map +1 -0
- package/dashboard/dist/assets/index-BAAVTyZ-.js +2 -0
- package/dashboard/dist/assets/{index-BQpV-DTG.js.map → index-BAAVTyZ-.js.map} +1 -1
- package/dashboard/dist/assets/{index-B9BBCqLI.js → index-BC6Jenlo.js} +2 -2
- package/dashboard/dist/assets/{index-B9BBCqLI.js.map → index-BC6Jenlo.js.map} +1 -1
- package/dashboard/dist/assets/index-C7KHqOTQ.js +2 -0
- package/dashboard/dist/assets/{index-Bp9KBLT5.js.map → index-C7KHqOTQ.js.map} +1 -1
- package/dashboard/dist/assets/index-CDrqqbSR.js +3 -0
- package/dashboard/dist/assets/index-CDrqqbSR.js.map +1 -0
- package/dashboard/dist/assets/index-CVwzCZ43.js +2 -0
- package/dashboard/dist/assets/{index-CFbo9FU9.js.map → index-CVwzCZ43.js.map} +1 -1
- package/dashboard/dist/assets/index-CaGF6TCC.js +2 -0
- package/dashboard/dist/assets/index-CaGF6TCC.js.map +1 -0
- package/dashboard/dist/assets/index-ClVbfe4z.js +13 -0
- package/dashboard/dist/assets/{index-Cfvkl2J0.js.map → index-ClVbfe4z.js.map} +1 -1
- package/dashboard/dist/assets/{index-DMeaiKgf.js → index-CuVkSmj5.js} +2 -2
- package/dashboard/dist/assets/{index-DMeaiKgf.js.map → index-CuVkSmj5.js.map} +1 -1
- package/dashboard/dist/assets/{index-ipqwPavs.js → index-DAuX_PlL.js} +2 -2
- package/dashboard/dist/assets/{index-ipqwPavs.js.map → index-DAuX_PlL.js.map} +1 -1
- package/dashboard/dist/assets/{index-CIpHj4di.js → index-DBWS5QL8.js} +2 -2
- package/dashboard/dist/assets/{index-CIpHj4di.js.map → index-DBWS5QL8.js.map} +1 -1
- package/dashboard/dist/assets/index-DIWCI6HC.js +2 -0
- package/dashboard/dist/assets/{index-CUZ6LYye.js.map → index-DIWCI6HC.js.map} +1 -1
- package/dashboard/dist/assets/{index-DwOnWeu8.js → index-DZ8X_Gp4.js} +2 -2
- package/dashboard/dist/assets/{index-DwOnWeu8.js.map → index-DZ8X_Gp4.js.map} +1 -1
- package/dashboard/dist/assets/index-Dh8MJl3L.css +1 -0
- package/dashboard/dist/assets/{knowledge-XX6cW4Ob.js → knowledge-CqyLhUMg.js} +2 -2
- package/dashboard/dist/assets/{knowledge-XX6cW4Ob.js.map → knowledge-CqyLhUMg.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CH13hNH2.js → mcp-Cvu6bFYH.js} +2 -2
- package/dashboard/dist/assets/{mcp-CH13hNH2.js.map → mcp-Cvu6bFYH.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-Duydd3JA.js → mcp-query-qC6A3e9l.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-Duydd3JA.js.map → mcp-query-qC6A3e9l.js.map} +1 -1
- package/dashboard/dist/assets/metadata-display-COo3mMCr.js +2 -0
- package/dashboard/dist/assets/metadata-display-COo3mMCr.js.map +1 -0
- package/dashboard/dist/assets/{personas-mDk4lLQS.js → personas-BKN_lJuV.js} +2 -2
- package/dashboard/dist/assets/{personas-mDk4lLQS.js.map → personas-BKN_lJuV.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-B5GcgCeF.js → pipelines-BldIfv85.js} +2 -2
- package/dashboard/dist/assets/{pipelines-B5GcgCeF.js.map → pipelines-BldIfv85.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-CItmNsRp.js → tasks-B-Uay8uL.js} +2 -2
- package/dashboard/dist/assets/{tasks-CItmNsRp.js.map → tasks-B-Uay8uL.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CJYG7BX5.js → topics-438EQogt.js} +2 -2
- package/dashboard/dist/assets/{topics-CJYG7BX5.js.map → topics-438EQogt.js.map} +1 -1
- package/dashboard/dist/assets/useContainerWidth-DSLp1gEm.js +2 -0
- package/dashboard/dist/assets/useContainerWidth-DSLp1gEm.js.map +1 -0
- package/dashboard/dist/assets/{useDebouncedValue-BrwgXcp8.js → useDebouncedValue-Cw8hYZ8y.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-BrwgXcp8.js.map → useDebouncedValue-Cw8hYZ8y.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-CHty0HAS.js → useNamespace-D1218GQ8.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-CHty0HAS.js.map → useNamespace-D1218GQ8.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-CoTsia7t.js → useYamlActivityEvents-BAQf_y_U.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-CoTsia7t.js.map → useYamlActivityEvents-BAQf_y_U.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-DeBdvyKJ.js → vendor-icons-B7OcUM6b.js} +2 -2
- package/dashboard/dist/assets/{vendor-icons-DeBdvyKJ.js.map → vendor-icons-B7OcUM6b.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-CiWwx5rM.js → yaml-workflows-CN01gEB0.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-CiWwx5rM.js.map → yaml-workflows-CN01gEB0.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/accumulator.md +113 -0
- package/docs/api/http/escalations.md +89 -0
- package/docs/api/http/roles.md +1 -0
- package/docs/api/sdk/escalations.md +91 -0
- package/docs/api/sdk/roles.md +2 -0
- package/docs/architecture.md +1 -1
- package/docs/code-owned-configuration.md +2 -1
- package/docs/dashboard.md +10 -4
- package/docs/hitl/design.md +1 -1
- package/docs/hitl/escalation.md +37 -1
- package/docs/hitl/invoke-form.md +4 -0
- package/docs/hitl/pinned-views.md +4 -0
- package/docs/hitl/portal.md +97 -0
- package/docs/hitl/resolution.md +41 -0
- package/docs/hitl/x-lt-embed.md +1 -1
- package/docs/hitl/x-lt-invoke.md +95 -0
- package/docs/hitl/x-lt-list-schema.md +3 -1
- package/docs/hitl/x-lt-widget.md +1 -0
- package/docs/hitl-guide.md +8 -1
- package/docs/scan-codes.md +15 -2
- package/docs/sdk.md +1 -1
- package/docs/workflows.md +2 -2
- package/package.json +4 -2
- package/dashboard/dist/assets/AgentsPage-7JJBHku8.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-lz5qwSjg.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-lz5qwSjg.js.map +0 -1
- package/dashboard/dist/assets/BulkAssignModal-NJBcoj-f.js +0 -2
- package/dashboard/dist/assets/CapabilitiesPage-F8dpNn9B.js +0 -2
- package/dashboard/dist/assets/DataTable-7C7riavf.js +0 -2
- package/dashboard/dist/assets/DataTable-7C7riavf.js.map +0 -1
- package/dashboard/dist/assets/EntityTimelinePanel-CkF-oW-m.js +0 -2
- package/dashboard/dist/assets/EscalationListView-AHW2xtlr.js +0 -2
- package/dashboard/dist/assets/EscalationListView-AHW2xtlr.js.map +0 -1
- package/dashboard/dist/assets/GraphInvokePage-CKtvWowP.js +0 -2
- package/dashboard/dist/assets/HomePage-BQ3Q791Q.js +0 -2
- package/dashboard/dist/assets/ListToolbar-DdJzj472.js +0 -2
- package/dashboard/dist/assets/McpQueryPage-CfJy7HZ7.js +0 -2
- package/dashboard/dist/assets/McpRunsPage-D7QXjW9z.js +0 -2
- package/dashboard/dist/assets/OperationsPage-aLHHAP2X.js +0 -3
- package/dashboard/dist/assets/OperationsPage-aLHHAP2X.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-sXNDh1Ph.js +0 -2
- package/dashboard/dist/assets/ProcessesListPage-CjwVKe32.js +0 -2
- package/dashboard/dist/assets/ResolverForm-Bk-wDkN-.js +0 -3
- package/dashboard/dist/assets/ResolverForm-Bk-wDkN-.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-WQt0y5l7.js +0 -8
- package/dashboard/dist/assets/RoleDetailPage-WQt0y5l7.js.map +0 -1
- package/dashboard/dist/assets/RunAsSelector-fFMt1bGe.js +0 -2
- package/dashboard/dist/assets/ScanStationPage-C1_ppDoZ.js +0 -2
- package/dashboard/dist/assets/TasksListPage-BB1f79lL.js +0 -2
- package/dashboard/dist/assets/ToolTestPanel-Bwe3J5lj.js +0 -2
- package/dashboard/dist/assets/TopicsPage-C1gxBUap.js +0 -2
- package/dashboard/dist/assets/WorkflowsDashboard-CZAqRk1N.js +0 -2
- package/dashboard/dist/assets/escalation-columns-uq-IV2aj.js +0 -2
- package/dashboard/dist/assets/escalation-columns-uq-IV2aj.js.map +0 -1
- package/dashboard/dist/assets/index-3ezfWLkE.js +0 -6
- package/dashboard/dist/assets/index-3ezfWLkE.js.map +0 -1
- package/dashboard/dist/assets/index-BQpV-DTG.js +0 -2
- package/dashboard/dist/assets/index-Bp9KBLT5.js +0 -2
- package/dashboard/dist/assets/index-Bpvfr4OW.css +0 -1
- package/dashboard/dist/assets/index-CFbo9FU9.js +0 -2
- package/dashboard/dist/assets/index-CIwlVfvV.js +0 -67
- package/dashboard/dist/assets/index-CIwlVfvV.js.map +0 -1
- package/dashboard/dist/assets/index-CUZ6LYye.js +0 -2
- package/dashboard/dist/assets/index-Cfvkl2J0.js +0 -13
- package/dashboard/dist/assets/index-SGyrXGp8.js +0 -3
- package/dashboard/dist/assets/index-SGyrXGp8.js.map +0 -1
- package/dashboard/dist/assets/invoke-context-DrVyUEfs.js +0 -2
- package/dashboard/dist/assets/invoke-context-DrVyUEfs.js.map +0 -1
- package/dashboard/dist/assets/metadata-display--TzK0REC.js +0 -2
- package/dashboard/dist/assets/metadata-display--TzK0REC.js.map +0 -1
- package/dashboard/dist/assets/resolver-payload-m9AGKZ3a.js +0 -2
- package/dashboard/dist/assets/resolver-payload-m9AGKZ3a.js.map +0 -1
- package/docs/compilation.md +0 -152
- package/docs/compiler.md +0 -311
- package/docs/contributing.md +0 -56
- package/docs/design-principles.md +0 -245
- package/docs/schema-exchange.md +0 -173
- package/docs/self-test.md +0 -106
- package/docs/story.md +0 -184
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-BaHV2cXp.js","./vendor-query-DvWWuNIB.js","./tasks-B-Uay8uL.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-Cw8hYZ8y.js","./api-path-u2Jf9QXS.js","./DataTable-spX1dFyb.js","./EmptyState-DgC_6njU.js","./useContainerWidth-DSLp1gEm.js","./TimestampCell-Du1nBrPn.js","./StickyPagination-CkW_A507.js","./FilterBar-C-iur-Nj.js","./vendor-icons-B7OcUM6b.js","./PageHeader-Csq434-v.js","./ListToolbar-h_ziBt4O.js","./WorkflowPill-ZepbO_ny.js","./ProcessDetailPage-BFcFSDUv.js","./PageHeaderWithStats-CSnk1p5A.js","./StatusBadge-DHVwxre2.js","./RolePill-BafrASDX.js","./UserName-kBh1dc39.js","./McpOverview-qXXhbNWV.js","./mcp-Cvu6bFYH.js","./pipelines-BldIfv85.js","./yaml-workflows-CN01gEB0.js","./controlplane-CyfwUlFA.js","./StatCard-nWY4sndl.js","./McpRunsPage-BfjiJ8mM.js","./useNamespace-D1218GQ8.js","./ElapsedCell-BZJTSm9N.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-DjJO5vSb.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-D1ctWhKf.js","./SwimlaneTimeline-Cf4DXFxj.js","./StreamMessageDetail-yzWX0wac.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-Cy0V0kv9.js","./mcp-query-qC6A3e9l.js","./McpQueryDetailPage-SEzSbZrd.js","./TagInput-ZrIIrEUP.js","./CollapsibleSection-ow8jpbtD.js","./useYamlActivityEvents-BAQf_y_U.js","./helpers-DzO-OGPe.js","./RunAsSelector-B29iWwel.js","./BotPicker-CClMby6B.js","./bots-CCmJTT2u.js","./ToolPill-Baxm02L6.js","./TimeAgo-CSNVEjch.js","./EscalationsOverview-CW57FaP9.js","./AvailableEscalationsPage-iO5NyyIK.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-BL8FRgkN.js","./constants-CeBBTzf5.js","./EscalationTitleSelect-DLK8NWMp.js","./EscalationTimeline-D8W2LNNk.js","./EscalationListView-DWFHPufv.js","./escalation-columns-BJPTNmLW.js","./EntityTimelinePanel-0wIIW2en.js","./PriorityBadge-r33mpDju.js","./CountdownTimer-CSqyZMCG.js","./OperatorDashboard-zCkW4eqk.js","./index-CDrqqbSR.js","./ResolverForm-Bgc0Zrya.js","./metadata-display-COo3mMCr.js","./WorkflowsOverview-DswubNJN.js","./index-CaGF6TCC.js","./NamespacePill-DADRJOUl.js","./WorkflowsDashboard-BNQVvyek.js","./YamlWorkflowsPage-DB8xnIXy.js","./GraphInvokePage-CcA_44M4.js","./YamlWorkflowDetailPage-Cw9Dlmup.js","./TasksListPage-BBATgpf7.js","./TaskDetailPage-DCDcEps9.js","./WorkflowExecutionPage-CCRSbnDx.js","./AdminDashboard-uarpHB88.js","./index-C7KHqOTQ.js","./TaskQueuePill-DkQ1uc6y.js","./index-ClVbfe4z.js","./ConfirmDeleteModal-CeEDt9iJ.js","./index-CuVkSmj5.js","./ToolTestPanel-CF-h_5Rg.js","./index-DBWS5QL8.js","./index-BAAVTyZ-.js","./personas-BKN_lJuV.js","./ScopeBadge-b6MIBiYD.js","./RolesPage-DSqqKPbv.js","./RoleDetailPage-BPY6i3CU.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-DOgGUlJl.js","./PersonaDetailPage-Cx6L3Jvu.js","./EscalationSchemaPage-C9Xu_A25.js","./PortalPage-BKuL1BeJ.js","./EscalationListSchemaPage-CoYvtMzj.js","./ScanCodesPage-S8aAJfnC.js","./ScanSchemeDetailPage-CUBRAtmJ.js","./ScanStationPage-R9t1-CeQ.js","./index-BC6Jenlo.js","./OperationsPage-dJcER0T_.js","./index-DIWCI6HC.js","./index-CVwzCZ43.js","./CredentialsPage-Dx7SxA23.js","./index-DZ8X_Gp4.js","./DropZone-f1o-GLM8.js","./index-DAuX_PlL.js","./knowledge-CqyLhUMg.js","./HomePage-Dc085ghJ.js","./AgentsPage-CuVFSDc4.js","./agents-BwEnf6N9.js","./AgentDetailPage-BaZBhK6i.js","./CronLabel-LYPxpvNN.js","./AgentConfigPage-BcUaDD5E.js","./capabilities-BZHgp_nh.js","./topics-438EQogt.js","./CapabilitiesPage-D53ogPor.js","./TopicsPage-CUUo-Ylf.js","./TopicDetailPage-Dr1UmWcp.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Yw=Object.defineProperty;var Kw=(n,t,s)=>t in n?Yw(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var j=(n,t,s)=>Kw(n,typeof t!="symbol"?t+"":t,s);import{r as Jw,u as Pe,a as O,j as h,b as Ue,c as He,g as Qw,d as Xw,Q as Ww,e as Zw}from"./vendor-query-DvWWuNIB.js";import{r as eS,u as ra,a as On,b as Qd,L as Cr,N as Ss,c as xn,O as Ws,d as tS,R as nS}from"./vendor-react-_9U4mKFr.js";import{X as Xt,E as rS,S as sS,M as iS,a as No,C as Xd,b as aS,c as oS,d as Kb,e as ud,I as fd,U as lS,L as hd,B as cS,G as uS,T as fS,R as Jb,f as hS,Z as dS,P as _g,g as Qb,h as mS,i as wg,j as dd,k as Sg,l as pS,W as Wd,m as yS,n as gS,F as bS,o as Xb,p as xS,D as vS,N as _S,q as wS,r as Wb,s as Zb,t as ex,u as SS,v as ES,w as OS,x as AS,y as jS,z as kS,A as NS,H as TS,J as CS}from"./vendor-icons-B7OcUM6b.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Fh={exports:{}},to={},Gh={exports:{}},Vh={};/**
|
|
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 Eg;function MS(){return Eg||(Eg=1,(function(n){function t(H,Z){var oe=H.length;H.push(Z);e:for(;0<oe;){var _e=oe-1>>>1,Se=H[_e];if(0<o(Se,Z))H[_e]=Z,H[oe]=Se,oe=_e;else break e}}function s(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var Z=H[0],oe=H.pop();if(oe!==Z){H[0]=oe;e:for(var _e=0,Se=H.length,Ne=Se>>>1;_e<Ne;){var ke=2*(_e+1)-1,Te=H[ke],st=ke+1,Nt=H[st];if(0>o(Te,oe))st<Se&&0>o(Nt,Te)?(H[_e]=Nt,H[st]=oe,_e=st):(H[_e]=Te,H[ke]=oe,_e=ke);else if(st<Se&&0>o(Nt,oe))H[_e]=Nt,H[st]=oe,_e=st;else break e}}return Z}function o(H,Z){var oe=H.sortIndex-Z.sortIndex;return oe!==0?oe:H.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,y=d.now();n.unstable_now=function(){return d.now()-y}}var g=[],f=[],m=1,b=null,x=3,v=!1,_=!1,S=!1,C=!1,L=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,re=typeof setImmediate<"u"?setImmediate:null;function le(H){for(var Z=s(f);Z!==null;){if(Z.callback===null)i(f);else if(Z.startTime<=H)i(f),Z.sortIndex=Z.expirationTime,t(g,Z);else break;Z=s(f)}}function R(H){if(S=!1,le(H),!_)if(s(g)!==null)_=!0,$||($=!0,J());else{var Z=s(f);Z!==null&&je(R,Z.startTime-H)}}var $=!1,ee=-1,K=5,U=-1;function D(){return C?!0:!(n.unstable_now()-U<K)}function X(){if(C=!1,$){var H=n.unstable_now();U=H;var Z=!0;try{e:{_=!1,S&&(S=!1,P(ee),ee=-1),v=!0;var oe=x;try{t:{for(le(H),b=s(g);b!==null&&!(b.expirationTime>H&&D());){var _e=b.callback;if(typeof _e=="function"){b.callback=null,x=b.priorityLevel;var Se=_e(b.expirationTime<=H);if(H=n.unstable_now(),typeof Se=="function"){b.callback=Se,le(H),Z=!0;break t}b===s(g)&&i(g),le(H)}else i(g);b=s(g)}if(b!==null)Z=!0;else{var Ne=s(f);Ne!==null&&je(R,Ne.startTime-H),Z=!1}}break e}finally{b=null,x=oe,v=!1}Z=void 0}}finally{Z?J():$=!1}}}var J;if(typeof re=="function")J=function(){re(X)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,be=he.port2;he.port1.onmessage=X,J=function(){be.postMessage(null)}}else J=function(){L(X,0)};function je(H,Z){ee=L(function(){H(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(H){H.callback=null},n.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<H?Math.floor(1e3/H):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(H){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var oe=x;x=Z;try{return H()}finally{x=oe}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(H,Z){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var oe=x;x=H;try{return Z()}finally{x=oe}},n.unstable_scheduleCallback=function(H,Z,oe){var _e=n.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?_e+oe:_e):oe=_e,H){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=oe+Se,H={id:m++,callback:Z,priorityLevel:H,startTime:oe,expirationTime:Se,sortIndex:-1},oe>_e?(H.sortIndex=oe,t(f,H),s(g)===null&&H===s(f)&&(S?(P(ee),ee=-1):S=!0,je(R,oe-_e))):(H.sortIndex=Se,t(g,H),_||v||(_=!0,$||($=!0,J()))),H},n.unstable_shouldYield=D,n.unstable_wrapCallback=function(H){var Z=x;return function(){var oe=x;x=Z;try{return H.apply(this,arguments)}finally{x=oe}}}})(Vh)),Vh}var Og;function RS(){return Og||(Og=1,Gh.exports=MS()),Gh.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 Ag;function DS(){if(Ag)return to;Ag=1;var n=RS(),t=Jw(),s=eS();function i(e){var r="https://react.dev/errors/"+e;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+r+" 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 c(e){var r=e,a=e;if(e.alternate)for(;r.return;)r=r.return;else{e=r;do r=e,(r.flags&4098)!==0&&(a=r.return),e=r.return;while(e)}return r.tag===3?a:null}function d(e){if(e.tag===13){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function y(e){if(e.tag===31){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(i(188))}function f(e){var r=e.alternate;if(!r){if(r=c(e),r===null)throw Error(i(188));return r!==e?null:e}for(var a=e,l=r;;){var u=a.return;if(u===null)break;var p=u.alternate;if(p===null){if(l=u.return,l!==null){a=l;continue}break}if(u.child===p.child){for(p=u.child;p;){if(p===a)return g(u),e;if(p===l)return g(u),r;p=p.sibling}throw Error(i(188))}if(a.return!==l.return)a=u,l=p;else{for(var w=!1,E=u.child;E;){if(E===a){w=!0,a=u,l=p;break}if(E===l){w=!0,l=u,a=p;break}E=E.sibling}if(!w){for(E=p.child;E;){if(E===a){w=!0,a=p,l=u;break}if(E===l){w=!0,l=p,a=u;break}E=E.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:r}function m(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e;for(e=e.child;e!==null;){if(r=m(e),r!==null)return r;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),re=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=X&&e[X]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function be(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case C:return"StrictMode";case R:return"Suspense";case $:return"SuspenseList";case U:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case re:return e.displayName||"Context";case P:return(e._context.displayName||"Context")+".Consumer";case le:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return r=e.displayName||null,r!==null?r:be(e.type)||"Memo";case K:r=e._payload,e=e._init;try{return be(e(r))}catch{}}return null}var je=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},_e=[],Se=-1;function Ne(e){return{current:e}}function ke(e){0>Se||(e.current=_e[Se],_e[Se]=null,Se--)}function Te(e,r){Se++,_e[Se]=e.current,e.current=r}var st=Ne(null),Nt=Ne(null),Bt=Ne(null),gt=Ne(null);function bt(e,r){switch(Te(Bt,r),Te(Nt,e),Te(st,null),r.nodeType){case 9:case 11:e=(e=r.documentElement)&&(e=e.namespaceURI)?Fy(e):0;break;default:if(e=r.tagName,r=r.namespaceURI)r=Fy(r),e=Gy(r,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ke(st),Te(st,e)}function ue(){ke(st),ke(Nt),ke(Bt)}function Je(e){e.memoizedState!==null&&Te(gt,e);var r=st.current,a=Gy(r,e.type);r!==a&&(Te(Nt,e),Te(st,a))}function jn(e){Nt.current===e&&(ke(st),ke(Nt)),gt.current===e&&(ke(gt),Xa._currentValue=oe)}var lr,ve;function Fe(e){if(lr===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);lr=r&&r[1]||"",ve=-1<a.stack.indexOf(`
|
|
19
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
+
`+lr+e+ve}var St=!1;function lt(e,r){if(!e||St)return"";St=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Q){var V=Q}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(Q){V=Q}e.call(ie.prototype)}}else{try{throw Error()}catch(Q){V=Q}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Q){if(Q&&V&&typeof Q.stack=="string")return[Q.stack,V.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),w=p[0],E=p[1];if(w&&E){var M=w.split(`
|
|
21
|
+
`),G=E.split(`
|
|
22
|
+
`);for(u=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;u<G.length&&!G[u].includes("DetermineComponentFrameRoot");)u++;if(l===M.length||u===G.length)for(l=M.length-1,u=G.length-1;1<=l&&0<=u&&M[l]!==G[u];)u--;for(;1<=l&&0<=u;l--,u--)if(M[l]!==G[u]){if(l!==1||u!==1)do if(l--,u--,0>u||M[l]!==G[u]){var W=`
|
|
23
|
+
`+M[l].replace(" at new "," at ");return e.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",e.displayName)),W}while(1<=l&&0<=u);break}}}finally{St=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Fe(a):""}function Pr(e,r){switch(e.tag){case 26:case 27:case 5:return Fe(e.type);case 16:return Fe("Lazy");case 13:return e.child!==r&&r!==null?Fe("Suspense Fallback"):Fe("Suspense");case 19:return Fe("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return Fe("Activity");default:return""}}function Bo(e){try{var r="",a=null;do r+=Pr(e,a),a=e,e=e.return;while(e);return r}catch(l){return`
|
|
24
|
+
Error generating stack: `+l.message+`
|
|
25
|
+
`+l.stack}}var oa=Object.prototype.hasOwnProperty,la=n.unstable_scheduleCallback,cr=n.unstable_cancelCallback,Po=n.unstable_shouldYield,ni=n.unstable_requestPaint,ct=n.unstable_now,Ru=n.unstable_getCurrentPriorityLevel,Uo=n.unstable_ImmediatePriority,zo=n.unstable_UserBlockingPriority,ri=n.unstable_NormalPriority,Du=n.unstable_LowPriority,Io=n.unstable_IdlePriority,qu=n.log,$o=n.unstable_setDisableYieldValue,As=null,xt=null;function an(e){if(typeof qu=="function"&&$o(e),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(As,e)}catch{}}var Ht=Math.clz32?Math.clz32:si,ca=Math.log,ua=Math.LN2;function si(e){return e>>>=0,e===0?32:31-(ca(e)/ua|0)|0}var Ur=256,ur=262144,zr=4194304;function In(e){var r=e&42;if(r!==0)return r;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 js(e,r,a){var l=e.pendingLanes;if(l===0)return 0;var u=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var E=l&134217727;return E!==0?(l=E&~p,l!==0?u=In(l):(w&=E,w!==0?u=In(w):a||(a=E&~e,a!==0&&(u=In(a))))):(E=l&~p,E!==0?u=In(E):w!==0?u=In(w):a||(a=l&~e,a!==0&&(u=In(a)))),u===0?0:r!==0&&r!==u&&(r&p)===0&&(p=u&-u,a=r&-r,p>=a||p===32&&(a&4194048)!==0)?r:u}function ks(e,r){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&r)===0}function fa(e,r){switch(e){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 ii(){var e=zr;return zr<<=1,(zr&62914560)===0&&(zr=4194304),e}function Ir(e){for(var r=[],a=0;31>a;a++)r.push(e);return r}function $n(e,r){e.pendingLanes|=r,r!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $r(e,r,a,l,u,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,M=e.expirationTimes,G=e.hiddenUpdates;for(a=w&~a;0<a;){var W=31-Ht(a),ie=1<<W;E[W]=0,M[W]=-1;var V=G[W];if(V!==null)for(G[W]=null,W=0;W<V.length;W++){var Q=V[W];Q!==null&&(Q.lane&=-536870913)}a&=~ie}l!==0&&Hr(e,l,0),p!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~r))}function Hr(e,r,a){e.pendingLanes|=r,e.suspendedLanes&=~r;var l=31-Ht(r);e.entangledLanes|=r,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Ns(e,r){var a=e.entangledLanes|=r;for(e=e.entanglements;a;){var l=31-Ht(a),u=1<<l;u&r|e[l]&r&&(e[l]|=r),a&=~u}}function Fr(e,r){var a=r&-r;return a=(a&42)!==0?1:fr(a),(a&(e.suspendedLanes|r))!==0?0:a}function fr(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 Ts(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ha(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:mg(e.type))}function Ho(e,r){var a=Z.p;try{return Z.p=e,r()}finally{Z.p=a}}var Zn=Math.random().toString(36).slice(2),nt="__reactFiber$"+Zn,dt="__reactProps$"+Zn,on="__reactContainer$"+Zn,Cs="__reactEvents$"+Zn,da="__reactListeners$"+Zn,Fo="__reactHandles$"+Zn,Go="__reactResources$"+Zn,Tt="__reactMarker$"+Zn;function ai(e){delete e[nt],delete e[dt],delete e[Cs],delete e[da],delete e[Fo]}function A(e){var r=e[nt];if(r)return r;for(var a=e.parentNode;a;){if(r=a[on]||a[nt]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(e=Wy(e);e!==null;){if(a=e[nt])return a;e=Wy(e)}return r}e=a,a=e.parentNode}return null}function N(e){if(e=e[nt]||e[on]){var r=e.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return e}return null}function k(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e.stateNode;throw Error(i(33))}function T(e){var r=e[Go];return r||(r=e[Go]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function q(e){e[Tt]=!0}var I=new Set,se={};function ae(e,r){Y(e,r),Y(e+"Capture",r)}function Y(e,r){for(se[e]=r,e=0;e<r.length;e++)I.add(r[e])}var ne=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]*$"),ye={},Re={};function it(e){return oa.call(Re,e)?!0:oa.call(ye,e)?!1:ne.test(e)?Re[e]=!0:(ye[e]=!0,!1)}function Ft(e,r,a){if(it(r))if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(r);return}}e.setAttribute(r,""+a)}}function Hn(e,r,a){if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttribute(r,""+a)}}function hr(e,r,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(r,a,""+l)}}function kn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Lm(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function zv(e,r,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,r);if(!e.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,p=l.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return u.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function Lu(e){if(!e._valueTracker){var r=Lm(e)?"checked":"value";e._valueTracker=zv(e,r,""+e[r])}}function Bm(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return e&&(l=Lm(e)?e.checked?"true":"false":e.value),e=l,e!==a?(r.setValue(e),!0):!1}function Vo(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 Iv=/[\n"\\]/g;function Nn(e){return e.replace(Iv,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Bu(e,r,a,l,u,p,w,E){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),r!=null?w==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+kn(r)):e.value!==""+kn(r)&&(e.value=""+kn(r)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),r!=null?Pu(e,w,kn(r)):a!=null?Pu(e,w,kn(a)):l!=null&&e.removeAttribute("value"),u==null&&p!=null&&(e.defaultChecked=!!p),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+kn(E):e.removeAttribute("name")}function Pm(e,r,a,l,u,p,w,E){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),r!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||r!=null)){Lu(e);return}a=a!=null?""+kn(a):"",r=r!=null?""+kn(r):a,E||r===e.value||(e.value=r),e.defaultValue=r}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=E?e.checked:!!l,e.defaultChecked=!!l,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),Lu(e)}function Pu(e,r,a){r==="number"&&Vo(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function oi(e,r,a,l){if(e=e.options,r){r={};for(var u=0;u<a.length;u++)r["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=r.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&l&&(e[a].defaultSelected=!0)}else{for(a=""+kn(a),r=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,l&&(e[u].defaultSelected=!0);return}r!==null||e[u].disabled||(r=e[u])}r!==null&&(r.selected=!0)}}function Um(e,r,a){if(r!=null&&(r=""+kn(r),r!==e.value&&(e.value=r),a==null)){e.defaultValue!==r&&(e.defaultValue=r);return}e.defaultValue=a!=null?""+kn(a):""}function zm(e,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(je(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=kn(r),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Lu(e)}function li(e,r){if(r){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=r;return}}e.textContent=r}var $v=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 Im(e,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="":l?e.setProperty(r,a):typeof a!="number"||a===0||$v.has(r)?r==="float"?e.cssFloat=a:e[r]=(""+a).trim():e[r]=a+"px"}function $m(e,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var u in r)l=r[u],r.hasOwnProperty(u)&&a[u]!==l&&Im(e,u,l)}else for(var p in r)r.hasOwnProperty(p)&&Im(e,p,r[p])}function Uu(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 Hv=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"]]),Fv=/^[\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 Yo(e){return Fv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function dr(){}var zu=null;function Iu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ci=null,ui=null;function Hm(e){var r=N(e);if(r&&(e=r.stateNode)){var a=e[dt]||null;e:switch(e=r.stateNode,r.type){case"input":if(Bu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Nn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==e&&l.form===e.form){var u=l[dt]||null;if(!u)throw Error(i(90));Bu(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===e.form&&Bm(l)}break e;case"textarea":Um(e,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&oi(e,!!a.multiple,r,!1)}}}var $u=!1;function Fm(e,r,a){if($u)return e(r,a);$u=!0;try{var l=e(r);return l}finally{if($u=!1,(ci!==null||ui!==null)&&(Dl(),ci&&(r=ci,e=ui,ui=ci=null,Hm(r),e)))for(r=0;r<e.length;r++)Hm(e[r])}}function ma(e,r){var a=e.stateNode;if(a===null)return null;var l=a[dt]||null;if(l===null)return null;a=l[r];e:switch(r){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(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hu=!1;if(mr)try{var pa={};Object.defineProperty(pa,"passive",{get:function(){Hu=!0}}),window.addEventListener("test",pa,pa),window.removeEventListener("test",pa,pa)}catch{Hu=!1}var Gr=null,Fu=null,Ko=null;function Gm(){if(Ko)return Ko;var e,r=Fu,a=r.length,l,u="value"in Gr?Gr.value:Gr.textContent,p=u.length;for(e=0;e<a&&r[e]===u[e];e++);var w=a-e;for(l=1;l<=w&&r[a-l]===u[p-l];l++);return Ko=u.slice(e,1<l?1-l:void 0)}function Jo(e){var r=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&r===13&&(e=13)):e=r,e===10&&(e=13),32<=e||e===13?e:0}function Qo(){return!0}function Vm(){return!1}function Wt(e){function r(a,l,u,p,w){this._reactName=a,this._targetInst=u,this.type=l,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(p):p[E]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Qo:Vm,this.isPropagationStopped=Vm,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Qo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Qo)},persist:function(){},isPersistent:Qo}),r}var Ms={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xo=Wt(Ms),ya=b({},Ms,{view:0,detail:0}),Gv=Wt(ya),Gu,Vu,ga,Wo=b({},ya,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,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!==ga&&(ga&&e.type==="mousemove"?(Gu=e.screenX-ga.screenX,Vu=e.screenY-ga.screenY):Vu=Gu=0,ga=e),Gu)},movementY:function(e){return"movementY"in e?e.movementY:Vu}}),Ym=Wt(Wo),Vv=b({},Wo,{dataTransfer:0}),Yv=Wt(Vv),Kv=b({},ya,{relatedTarget:0}),Yu=Wt(Kv),Jv=b({},Ms,{animationName:0,elapsedTime:0,pseudoElement:0}),Qv=Wt(Jv),Xv=b({},Ms,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Wv=Wt(Xv),Zv=b({},Ms,{data:0}),Km=Wt(Zv),e_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},t_={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"},n_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function r_(e){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(e):(e=n_[e])?!!r[e]:!1}function Ku(){return r_}var s_=b({},ya,{key:function(e){if(e.key){var r=e_[e.key]||e.key;if(r!=="Unidentified")return r}return e.type==="keypress"?(e=Jo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?t_[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(e){return e.type==="keypress"?Jo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Jo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),i_=Wt(s_),a_=b({},Wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jm=Wt(a_),o_=b({},ya,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),l_=Wt(o_),c_=b({},Ms,{propertyName:0,elapsedTime:0,pseudoElement:0}),u_=Wt(c_),f_=b({},Wo,{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}),h_=Wt(f_),d_=b({},Ms,{newState:0,oldState:0}),m_=Wt(d_),p_=[9,13,27,32],Ju=mr&&"CompositionEvent"in window,ba=null;mr&&"documentMode"in document&&(ba=document.documentMode);var y_=mr&&"TextEvent"in window&&!ba,Qm=mr&&(!Ju||ba&&8<ba&&11>=ba),Xm=" ",Wm=!1;function Zm(e,r){switch(e){case"keyup":return p_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function e0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fi=!1;function g_(e,r){switch(e){case"compositionend":return e0(r);case"keypress":return r.which!==32?null:(Wm=!0,Xm);case"textInput":return e=r.data,e===Xm&&Wm?null:e;default:return null}}function b_(e,r){if(fi)return e==="compositionend"||!Ju&&Zm(e,r)?(e=Gm(),Ko=Fu=Gr=null,fi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Qm&&r.locale!=="ko"?null:r.data;default:return null}}var x_={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 t0(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r==="input"?!!x_[e.type]:r==="textarea"}function n0(e,r,a,l){ci?ui?ui.push(l):ui=[l]:ci=l,r=Il(r,"onChange"),0<r.length&&(a=new Xo("onChange","change",null,a,l),e.push({event:a,listeners:r}))}var xa=null,va=null;function v_(e){Py(e,0)}function Zo(e){var r=k(e);if(Bm(r))return e}function r0(e,r){if(e==="change")return r}var s0=!1;if(mr){var Qu;if(mr){var Xu="oninput"in document;if(!Xu){var i0=document.createElement("div");i0.setAttribute("oninput","return;"),Xu=typeof i0.oninput=="function"}Qu=Xu}else Qu=!1;s0=Qu&&(!document.documentMode||9<document.documentMode)}function a0(){xa&&(xa.detachEvent("onpropertychange",o0),va=xa=null)}function o0(e){if(e.propertyName==="value"&&Zo(va)){var r=[];n0(r,va,e,Iu(e)),Fm(v_,r)}}function __(e,r,a){e==="focusin"?(a0(),xa=r,va=a,xa.attachEvent("onpropertychange",o0)):e==="focusout"&&a0()}function w_(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zo(va)}function S_(e,r){if(e==="click")return Zo(r)}function E_(e,r){if(e==="input"||e==="change")return Zo(r)}function O_(e,r){return e===r&&(e!==0||1/e===1/r)||e!==e&&r!==r}var ln=typeof Object.is=="function"?Object.is:O_;function _a(e,r){if(ln(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;var a=Object.keys(e),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var u=a[l];if(!oa.call(r,u)||!ln(e[u],r[u]))return!1}return!0}function l0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function c0(e,r){var a=l0(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=r&&l>=r)return{node:a,offset:r-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=l0(a)}}function u0(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?u0(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function f0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var r=Vo(e.document);r instanceof e.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)e=r.contentWindow;else break;r=Vo(e.document)}return r}function Wu(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}var A_=mr&&"documentMode"in document&&11>=document.documentMode,hi=null,Zu=null,wa=null,ef=!1;function h0(e,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ef||hi==null||hi!==Vo(l)||(l=hi,"selectionStart"in l&&Wu(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}),wa&&_a(wa,l)||(wa=l,l=Il(Zu,"onSelect"),0<l.length&&(r=new Xo("onSelect","select",null,r,a),e.push({event:r,listeners:l}),r.target=hi)))}function Rs(e,r){var a={};return a[e.toLowerCase()]=r.toLowerCase(),a["Webkit"+e]="webkit"+r,a["Moz"+e]="moz"+r,a}var di={animationend:Rs("Animation","AnimationEnd"),animationiteration:Rs("Animation","AnimationIteration"),animationstart:Rs("Animation","AnimationStart"),transitionrun:Rs("Transition","TransitionRun"),transitionstart:Rs("Transition","TransitionStart"),transitioncancel:Rs("Transition","TransitionCancel"),transitionend:Rs("Transition","TransitionEnd")},tf={},d0={};mr&&(d0=document.createElement("div").style,"AnimationEvent"in window||(delete di.animationend.animation,delete di.animationiteration.animation,delete di.animationstart.animation),"TransitionEvent"in window||delete di.transitionend.transition);function Ds(e){if(tf[e])return tf[e];if(!di[e])return e;var r=di[e],a;for(a in r)if(r.hasOwnProperty(a)&&a in d0)return tf[e]=r[a];return e}var m0=Ds("animationend"),p0=Ds("animationiteration"),y0=Ds("animationstart"),j_=Ds("transitionrun"),k_=Ds("transitionstart"),N_=Ds("transitioncancel"),g0=Ds("transitionend"),b0=new Map,nf="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(" ");nf.push("scrollEnd");function Fn(e,r){b0.set(e,r),ae(r,[e])}var el=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Tn=[],mi=0,rf=0;function tl(){for(var e=mi,r=rf=mi=0;r<e;){var a=Tn[r];Tn[r++]=null;var l=Tn[r];Tn[r++]=null;var u=Tn[r];Tn[r++]=null;var p=Tn[r];if(Tn[r++]=null,l!==null&&u!==null){var w=l.pending;w===null?u.next=u:(u.next=w.next,w.next=u),l.pending=u}p!==0&&x0(a,u,p)}}function nl(e,r,a,l){Tn[mi++]=e,Tn[mi++]=r,Tn[mi++]=a,Tn[mi++]=l,rf|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function sf(e,r,a,l){return nl(e,r,a,l),rl(e)}function qs(e,r){return nl(e,null,null,r),rl(e)}function x0(e,r,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var u=!1,p=e.return;p!==null;)p.childLanes|=a,l=p.alternate,l!==null&&(l.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(u=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,u&&r!==null&&(u=31-Ht(a),e=p.hiddenUpdates,l=e[u],l===null?e[u]=[r]:l.push(r),r.lane=a|536870912),p):null}function rl(e){if(50<Fa)throw Fa=0,mh=null,Error(i(185));for(var r=e.return;r!==null;)e=r,r=e.return;return e.tag===3?e.stateNode:null}var pi={};function T_(e,r,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,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 cn(e,r,a,l){return new T_(e,r,a,l)}function af(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pr(e,r){var a=e.alternate;return a===null?(a=cn(e.tag,r,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=r,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,r=e.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function v0(e,r){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=r,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,r=a.dependencies,e.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),e}function sl(e,r,a,l,u,p){var w=0;if(l=e,typeof e=="function")af(e)&&(w=1);else if(typeof e=="string")w=qw(e,a,st.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case U:return e=cn(31,a,r,u),e.elementType=U,e.lanes=p,e;case S:return Ls(a.children,u,p,r);case C:w=8,u|=24;break;case L:return e=cn(12,a,r,u|2),e.elementType=L,e.lanes=p,e;case R:return e=cn(13,a,r,u),e.elementType=R,e.lanes=p,e;case $:return e=cn(19,a,r,u),e.elementType=$,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case re:w=10;break e;case P:w=9;break e;case le:w=11;break e;case ee:w=14;break e;case K:w=16,l=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),l=null}return r=cn(w,a,r,u),r.elementType=e,r.type=l,r.lanes=p,r}function Ls(e,r,a,l){return e=cn(7,e,l,r),e.lanes=a,e}function of(e,r,a){return e=cn(6,e,null,r),e.lanes=a,e}function _0(e){var r=cn(18,null,null,0);return r.stateNode=e,r}function lf(e,r,a){return r=cn(4,e.children!==null?e.children:[],e.key,r),r.lanes=a,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}var w0=new WeakMap;function Cn(e,r){if(typeof e=="object"&&e!==null){var a=w0.get(e);return a!==void 0?a:(r={value:e,source:r,stack:Bo(r)},w0.set(e,r),r)}return{value:e,source:r,stack:Bo(r)}}var yi=[],gi=0,il=null,Sa=0,Mn=[],Rn=0,Vr=null,er=1,tr="";function yr(e,r){yi[gi++]=Sa,yi[gi++]=il,il=e,Sa=r}function S0(e,r,a){Mn[Rn++]=er,Mn[Rn++]=tr,Mn[Rn++]=Vr,Vr=e;var l=er;e=tr;var u=32-Ht(l)-1;l&=~(1<<u),a+=1;var p=32-Ht(r)+u;if(30<p){var w=u-u%5;p=(l&(1<<w)-1).toString(32),l>>=w,u-=w,er=1<<32-Ht(r)+u|a<<u|l,tr=p+e}else er=1<<p|a<<u|l,tr=e}function cf(e){e.return!==null&&(yr(e,1),S0(e,1,0))}function uf(e){for(;e===il;)il=yi[--gi],yi[gi]=null,Sa=yi[--gi],yi[gi]=null;for(;e===Vr;)Vr=Mn[--Rn],Mn[Rn]=null,tr=Mn[--Rn],Mn[Rn]=null,er=Mn[--Rn],Mn[Rn]=null}function E0(e,r){Mn[Rn++]=er,Mn[Rn++]=tr,Mn[Rn++]=Vr,er=r.id,tr=r.overflow,Vr=e}var Pt=null,at=null,ze=!1,Yr=null,Dn=!1,ff=Error(i(519));function Kr(e){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ea(Cn(r,e)),ff}function O0(e){var r=e.stateNode,a=e.type,l=e.memoizedProps;switch(r[nt]=e,r[dt]=l,a){case"dialog":qe("cancel",r),qe("close",r);break;case"iframe":case"object":case"embed":qe("load",r);break;case"video":case"audio":for(a=0;a<Va.length;a++)qe(Va[a],r);break;case"source":qe("error",r);break;case"img":case"image":case"link":qe("error",r),qe("load",r);break;case"details":qe("toggle",r);break;case"input":qe("invalid",r),Pm(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":qe("invalid",r);break;case"textarea":qe("invalid",r),zm(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||$y(r.textContent,a)?(l.popover!=null&&(qe("beforetoggle",r),qe("toggle",r)),l.onScroll!=null&&qe("scroll",r),l.onScrollEnd!=null&&qe("scrollend",r),l.onClick!=null&&(r.onclick=dr),r=!0):r=!1,r||Kr(e,!0)}function A0(e){for(Pt=e.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Dn=!1;return;case 27:case 3:Dn=!0;return;default:Pt=Pt.return}}function bi(e){if(e!==Pt)return!1;if(!ze)return A0(e),ze=!0,!1;var r=e.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Nh(e.type,e.memoizedProps)),a=!a),a&&at&&Kr(e),A0(e),r===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));at=Xy(e)}else if(r===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));at=Xy(e)}else r===27?(r=at,ls(e.type)?(e=Dh,Dh=null,at=e):at=r):at=Pt?Ln(e.stateNode.nextSibling):null;return!0}function Bs(){at=Pt=null,ze=!1}function hf(){var e=Yr;return e!==null&&(nn===null?nn=e:nn.push.apply(nn,e),Yr=null),e}function Ea(e){Yr===null?Yr=[e]:Yr.push(e)}var df=Ne(null),Ps=null,gr=null;function Jr(e,r,a){Te(df,r._currentValue),r._currentValue=a}function br(e){e._currentValue=df.current,ke(df)}function mf(e,r,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&r)!==r?(e.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),e===a)break;e=e.return}}function pf(e,r,a,l){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var p=u.dependencies;if(p!==null){var w=u.child;p=p.firstContext;e:for(;p!==null;){var E=p;p=u;for(var M=0;M<r.length;M++)if(E.context===r[M]){p.lanes|=a,E=p.alternate,E!==null&&(E.lanes|=a),mf(p.return,a,e),l||(w=null);break e}p=E.next}}else if(u.tag===18){if(w=u.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),mf(w,a,e),w=null}else w=u.child;if(w!==null)w.return=u;else for(w=u;w!==null;){if(w===e){w=null;break}if(u=w.sibling,u!==null){u.return=w.return,w=u;break}w=w.return}u=w}}function xi(e,r,a,l){e=null;for(var u=r,p=!1;u!==null;){if(!p){if((u.flags&524288)!==0)p=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var w=u.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var E=u.type;ln(u.pendingProps.value,w.value)||(e!==null?e.push(E):e=[E])}}else if(u===gt.current){if(w=u.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Xa):e=[Xa])}u=u.return}e!==null&&pf(r,e,a,l),r.flags|=262144}function al(e){for(e=e.firstContext;e!==null;){if(!ln(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Us(e){Ps=e,gr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ut(e){return j0(Ps,e)}function ol(e,r){return Ps===null&&Us(e),j0(e,r)}function j0(e,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},gr===null){if(e===null)throw Error(i(308));gr=r,e.dependencies={lanes:0,firstContext:r},e.flags|=524288}else gr=gr.next=r;return a}var C_=typeof AbortController<"u"?AbortController:function(){var e=[],r=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){r.aborted=!0,e.forEach(function(a){return a()})}},M_=n.unstable_scheduleCallback,R_=n.unstable_NormalPriority,Et={$$typeof:re,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yf(){return{controller:new C_,data:new Map,refCount:0}}function Oa(e){e.refCount--,e.refCount===0&&M_(R_,function(){e.controller.abort()})}var Aa=null,gf=0,vi=0,_i=null;function D_(e,r){if(Aa===null){var a=Aa=[];gf=0,vi=vh(),_i={status:"pending",value:void 0,then:function(l){a.push(l)}}}return gf++,r.then(k0,k0),r}function k0(){if(--gf===0&&Aa!==null){_i!==null&&(_i.status="fulfilled");var e=Aa;Aa=null,vi=0,_i=null;for(var r=0;r<e.length;r++)(0,e[r])()}}function q_(e,r){var a=[],l={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){l.status="fulfilled",l.value=r;for(var u=0;u<a.length;u++)(0,a[u])(r)},function(u){for(l.status="rejected",l.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),l}var N0=H.S;H.S=function(e,r){hy=ct(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&D_(e,r),N0!==null&&N0(e,r)};var zs=Ne(null);function bf(){var e=zs.current;return e!==null?e:rt.pooledCache}function ll(e,r){r===null?Te(zs,zs.current):Te(zs,r.pool)}function T0(){var e=bf();return e===null?null:{parent:Et._currentValue,pool:e}}var wi=Error(i(460)),xf=Error(i(474)),cl=Error(i(542)),ul={then:function(){}};function C0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function M0(e,r,a){switch(a=e[a],a===void 0?e.push(r):a!==r&&(r.then(dr,dr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,D0(e),e;default:if(typeof r.status=="string")r.then(dr,dr);else{if(e=rt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=r,e.status="pending",e.then(function(l){if(r.status==="pending"){var u=r;u.status="fulfilled",u.value=l}},function(l){if(r.status==="pending"){var u=r;u.status="rejected",u.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,D0(e),e}throw $s=r,wi}}function Is(e){try{var r=e._init;return r(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?($s=a,wi):a}}var $s=null;function R0(){if($s===null)throw Error(i(459));var e=$s;return $s=null,e}function D0(e){if(e===wi||e===cl)throw Error(i(483))}var Si=null,ja=0;function fl(e){var r=ja;return ja+=1,Si===null&&(Si=[]),M0(Si,e,r)}function ka(e,r){r=r.props.ref,e.ref=r!==void 0?r:null}function hl(e,r){throw r.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(r),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)))}function q0(e){function r(z,B){if(e){var F=z.deletions;F===null?(z.deletions=[B],z.flags|=16):F.push(B)}}function a(z,B){if(!e)return null;for(;B!==null;)r(z,B),B=B.sibling;return null}function l(z){for(var B=new Map;z!==null;)z.key!==null?B.set(z.key,z):B.set(z.index,z),z=z.sibling;return B}function u(z,B){return z=pr(z,B),z.index=0,z.sibling=null,z}function p(z,B,F){return z.index=F,e?(F=z.alternate,F!==null?(F=F.index,F<B?(z.flags|=67108866,B):F):(z.flags|=67108866,B)):(z.flags|=1048576,B)}function w(z){return e&&z.alternate===null&&(z.flags|=67108866),z}function E(z,B,F,te){return B===null||B.tag!==6?(B=of(F,z.mode,te),B.return=z,B):(B=u(B,F),B.return=z,B)}function M(z,B,F,te){var Ee=F.type;return Ee===S?W(z,B,F.props.children,te,F.key):B!==null&&(B.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===K&&Is(Ee)===B.type)?(B=u(B,F.props),ka(B,F),B.return=z,B):(B=sl(F.type,F.key,F.props,null,z.mode,te),ka(B,F),B.return=z,B)}function G(z,B,F,te){return B===null||B.tag!==4||B.stateNode.containerInfo!==F.containerInfo||B.stateNode.implementation!==F.implementation?(B=lf(F,z.mode,te),B.return=z,B):(B=u(B,F.children||[]),B.return=z,B)}function W(z,B,F,te,Ee){return B===null||B.tag!==7?(B=Ls(F,z.mode,te,Ee),B.return=z,B):(B=u(B,F),B.return=z,B)}function ie(z,B,F){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=of(""+B,z.mode,F),B.return=z,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case v:return F=sl(B.type,B.key,B.props,null,z.mode,F),ka(F,B),F.return=z,F;case _:return B=lf(B,z.mode,F),B.return=z,B;case K:return B=Is(B),ie(z,B,F)}if(je(B)||J(B))return B=Ls(B,z.mode,F,null),B.return=z,B;if(typeof B.then=="function")return ie(z,fl(B),F);if(B.$$typeof===re)return ie(z,ol(z,B),F);hl(z,B)}return null}function V(z,B,F,te){var Ee=B!==null?B.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Ee!==null?null:E(z,B,""+F,te);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case v:return F.key===Ee?M(z,B,F,te):null;case _:return F.key===Ee?G(z,B,F,te):null;case K:return F=Is(F),V(z,B,F,te)}if(je(F)||J(F))return Ee!==null?null:W(z,B,F,te,null);if(typeof F.then=="function")return V(z,B,fl(F),te);if(F.$$typeof===re)return V(z,B,ol(z,F),te);hl(z,F)}return null}function Q(z,B,F,te,Ee){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return z=z.get(F)||null,E(B,z,""+te,Ee);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case v:return z=z.get(te.key===null?F:te.key)||null,M(B,z,te,Ee);case _:return z=z.get(te.key===null?F:te.key)||null,G(B,z,te,Ee);case K:return te=Is(te),Q(z,B,F,te,Ee)}if(je(te)||J(te))return z=z.get(F)||null,W(B,z,te,Ee,null);if(typeof te.then=="function")return Q(z,B,F,fl(te),Ee);if(te.$$typeof===re)return Q(z,B,F,ol(B,te),Ee);hl(B,te)}return null}function ge(z,B,F,te){for(var Ee=null,Ve=null,xe=B,Me=B=0,Be=null;xe!==null&&Me<F.length;Me++){xe.index>Me?(Be=xe,xe=null):Be=xe.sibling;var Ye=V(z,xe,F[Me],te);if(Ye===null){xe===null&&(xe=Be);break}e&&xe&&Ye.alternate===null&&r(z,xe),B=p(Ye,B,Me),Ve===null?Ee=Ye:Ve.sibling=Ye,Ve=Ye,xe=Be}if(Me===F.length)return a(z,xe),ze&&yr(z,Me),Ee;if(xe===null){for(;Me<F.length;Me++)xe=ie(z,F[Me],te),xe!==null&&(B=p(xe,B,Me),Ve===null?Ee=xe:Ve.sibling=xe,Ve=xe);return ze&&yr(z,Me),Ee}for(xe=l(xe);Me<F.length;Me++)Be=Q(xe,z,Me,F[Me],te),Be!==null&&(e&&Be.alternate!==null&&xe.delete(Be.key===null?Me:Be.key),B=p(Be,B,Me),Ve===null?Ee=Be:Ve.sibling=Be,Ve=Be);return e&&xe.forEach(function(ds){return r(z,ds)}),ze&&yr(z,Me),Ee}function Ae(z,B,F,te){if(F==null)throw Error(i(151));for(var Ee=null,Ve=null,xe=B,Me=B=0,Be=null,Ye=F.next();xe!==null&&!Ye.done;Me++,Ye=F.next()){xe.index>Me?(Be=xe,xe=null):Be=xe.sibling;var ds=V(z,xe,Ye.value,te);if(ds===null){xe===null&&(xe=Be);break}e&&xe&&ds.alternate===null&&r(z,xe),B=p(ds,B,Me),Ve===null?Ee=ds:Ve.sibling=ds,Ve=ds,xe=Be}if(Ye.done)return a(z,xe),ze&&yr(z,Me),Ee;if(xe===null){for(;!Ye.done;Me++,Ye=F.next())Ye=ie(z,Ye.value,te),Ye!==null&&(B=p(Ye,B,Me),Ve===null?Ee=Ye:Ve.sibling=Ye,Ve=Ye);return ze&&yr(z,Me),Ee}for(xe=l(xe);!Ye.done;Me++,Ye=F.next())Ye=Q(xe,z,Me,Ye.value,te),Ye!==null&&(e&&Ye.alternate!==null&&xe.delete(Ye.key===null?Me:Ye.key),B=p(Ye,B,Me),Ve===null?Ee=Ye:Ve.sibling=Ye,Ve=Ye);return e&&xe.forEach(function(Vw){return r(z,Vw)}),ze&&yr(z,Me),Ee}function tt(z,B,F,te){if(typeof F=="object"&&F!==null&&F.type===S&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case v:e:{for(var Ee=F.key;B!==null;){if(B.key===Ee){if(Ee=F.type,Ee===S){if(B.tag===7){a(z,B.sibling),te=u(B,F.props.children),te.return=z,z=te;break e}}else if(B.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===K&&Is(Ee)===B.type){a(z,B.sibling),te=u(B,F.props),ka(te,F),te.return=z,z=te;break e}a(z,B);break}else r(z,B);B=B.sibling}F.type===S?(te=Ls(F.props.children,z.mode,te,F.key),te.return=z,z=te):(te=sl(F.type,F.key,F.props,null,z.mode,te),ka(te,F),te.return=z,z=te)}return w(z);case _:e:{for(Ee=F.key;B!==null;){if(B.key===Ee)if(B.tag===4&&B.stateNode.containerInfo===F.containerInfo&&B.stateNode.implementation===F.implementation){a(z,B.sibling),te=u(B,F.children||[]),te.return=z,z=te;break e}else{a(z,B);break}else r(z,B);B=B.sibling}te=lf(F,z.mode,te),te.return=z,z=te}return w(z);case K:return F=Is(F),tt(z,B,F,te)}if(je(F))return ge(z,B,F,te);if(J(F)){if(Ee=J(F),typeof Ee!="function")throw Error(i(150));return F=Ee.call(F),Ae(z,B,F,te)}if(typeof F.then=="function")return tt(z,B,fl(F),te);if(F.$$typeof===re)return tt(z,B,ol(z,F),te);hl(z,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,B!==null&&B.tag===6?(a(z,B.sibling),te=u(B,F),te.return=z,z=te):(a(z,B),te=of(F,z.mode,te),te.return=z,z=te),w(z)):a(z,B)}return function(z,B,F,te){try{ja=0;var Ee=tt(z,B,F,te);return Si=null,Ee}catch(xe){if(xe===wi||xe===cl)throw xe;var Ve=cn(29,xe,null,z.mode);return Ve.lanes=te,Ve.return=z,Ve}finally{}}}var Hs=q0(!0),L0=q0(!1),Qr=!1;function vf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _f(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Xr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wr(e,r,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ke&2)!==0){var u=l.pending;return u===null?r.next=r:(r.next=u.next,u.next=r),l.pending=r,r=rl(e),x0(e,null,a),r}return nl(e,l,r,a),rl(e)}function Na(e,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Ns(e,a)}}function wf(e,r){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var u=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?u=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?u=p=r:p=p.next=r}else u=p=r;a={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=r:e.next=r,a.lastBaseUpdate=r}var Sf=!1;function Ta(){if(Sf){var e=_i;if(e!==null)throw e}}function Ca(e,r,a,l){Sf=!1;var u=e.updateQueue;Qr=!1;var p=u.firstBaseUpdate,w=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var M=E,G=M.next;M.next=null,w===null?p=G:w.next=G,w=M;var W=e.alternate;W!==null&&(W=W.updateQueue,E=W.lastBaseUpdate,E!==w&&(E===null?W.firstBaseUpdate=G:E.next=G,W.lastBaseUpdate=M))}if(p!==null){var ie=u.baseState;w=0,W=G=M=null,E=p;do{var V=E.lane&-536870913,Q=V!==E.lane;if(Q?(Le&V)===V:(l&V)===V){V!==0&&V===vi&&(Sf=!0),W!==null&&(W=W.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ge=e,Ae=E;V=r;var tt=a;switch(Ae.tag){case 1:if(ge=Ae.payload,typeof ge=="function"){ie=ge.call(tt,ie,V);break e}ie=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ae.payload,V=typeof ge=="function"?ge.call(tt,ie,V):ge,V==null)break e;ie=b({},ie,V);break e;case 2:Qr=!0}}V=E.callback,V!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=u.callbacks,Q===null?u.callbacks=[V]:Q.push(V))}else Q={lane:V,tag:E.tag,payload:E.payload,callback:E.callback,next:null},W===null?(G=W=Q,M=ie):W=W.next=Q,w|=V;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;Q=E,E=Q.next,Q.next=null,u.lastBaseUpdate=Q,u.shared.pending=null}}while(!0);W===null&&(M=ie),u.baseState=M,u.firstBaseUpdate=G,u.lastBaseUpdate=W,p===null&&(u.shared.lanes=0),rs|=w,e.lanes=w,e.memoizedState=ie}}function B0(e,r){if(typeof e!="function")throw Error(i(191,e));e.call(r)}function P0(e,r){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)B0(a[e],r)}var Ei=Ne(null),dl=Ne(0);function U0(e,r){e=jr,Te(dl,e),Te(Ei,r),jr=e|r.baseLanes}function Ef(){Te(dl,jr),Te(Ei,Ei.current)}function Of(){jr=dl.current,ke(Ei),ke(dl)}var un=Ne(null),qn=null;function Zr(e){var r=e.alternate;Te(vt,vt.current&1),Te(un,e),qn===null&&(r===null||Ei.current!==null||r.memoizedState!==null)&&(qn=e)}function Af(e){Te(vt,vt.current),Te(un,e),qn===null&&(qn=e)}function z0(e){e.tag===22?(Te(vt,vt.current),Te(un,e),qn===null&&(qn=e)):es()}function es(){Te(vt,vt.current),Te(un,un.current)}function fn(e){ke(un),qn===e&&(qn=null),ke(vt)}var vt=Ne(0);function ml(e){for(var r=e;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Mh(a)||Rh(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var xr=0,Ce=null,Ze=null,Ot=null,pl=!1,Oi=!1,Fs=!1,yl=0,Ma=0,Ai=null,L_=0;function mt(){throw Error(i(321))}function jf(e,r){if(r===null)return!1;for(var a=0;a<r.length&&a<e.length;a++)if(!ln(e[a],r[a]))return!1;return!0}function kf(e,r,a,l,u,p){return xr=p,Ce=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,H.H=e===null||e.memoizedState===null?Sp:Hf,Fs=!1,p=a(l,u),Fs=!1,Oi&&(p=$0(r,a,l,u)),I0(e),p}function I0(e){H.H=qa;var r=Ze!==null&&Ze.next!==null;if(xr=0,Ot=Ze=Ce=null,pl=!1,Ma=0,Ai=null,r)throw Error(i(300));e===null||At||(e=e.dependencies,e!==null&&al(e)&&(At=!0))}function $0(e,r,a,l){Ce=e;var u=0;do{if(Oi&&(Ai=null),Ma=0,Oi=!1,25<=u)throw Error(i(301));if(u+=1,Ot=Ze=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}H.H=Ep,p=r(a,l)}while(Oi);return p}function B_(){var e=H.H,r=e.useState()[0];return r=typeof r.then=="function"?Ra(r):r,e=e.useState()[0],(Ze!==null?Ze.memoizedState:null)!==e&&(Ce.flags|=1024),r}function Nf(){var e=yl!==0;return yl=0,e}function Tf(e,r,a){r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~a}function Cf(e){if(pl){for(e=e.memoizedState;e!==null;){var r=e.queue;r!==null&&(r.pending=null),e=e.next}pl=!1}xr=0,Ot=Ze=Ce=null,Oi=!1,Ma=yl=0,Ai=null}function Gt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Ce.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function _t(){if(Ze===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Ze.next;var r=Ot===null?Ce.memoizedState:Ot.next;if(r!==null)Ot=r,Ze=e;else{if(e===null)throw Ce.alternate===null?Error(i(467)):Error(i(310));Ze=e,e={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},Ot===null?Ce.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function gl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ra(e){var r=Ma;return Ma+=1,Ai===null&&(Ai=[]),e=M0(Ai,e,r),r=Ce,(Ot===null?r.memoizedState:Ot.next)===null&&(r=r.alternate,H.H=r===null||r.memoizedState===null?Sp:Hf),e}function bl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ra(e);if(e.$$typeof===re)return Ut(e)}throw Error(i(438,String(e)))}function Mf(e){var r=null,a=Ce.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=Ce.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(u){return u.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=gl(),Ce.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(e),l=0;l<e;l++)a[l]=D;return r.index++,a}function vr(e,r){return typeof r=="function"?r(e):r}function xl(e){var r=_t();return Rf(r,Ze,e)}function Rf(e,r,a){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var u=e.baseQueue,p=l.pending;if(p!==null){if(u!==null){var w=u.next;u.next=p.next,p.next=w}r.baseQueue=u=p,l.pending=null}if(p=e.baseState,u===null)e.memoizedState=p;else{r=u.next;var E=w=null,M=null,G=r,W=!1;do{var ie=G.lane&-536870913;if(ie!==G.lane?(Le&ie)===ie:(xr&ie)===ie){var V=G.revertLane;if(V===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ie===vi&&(W=!0);else if((xr&V)===V){G=G.next,V===vi&&(W=!0);continue}else ie={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},M===null?(E=M=ie,w=p):M=M.next=ie,Ce.lanes|=V,rs|=V;ie=G.action,Fs&&a(p,ie),p=G.hasEagerState?G.eagerState:a(p,ie)}else V={lane:ie,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},M===null?(E=M=V,w=p):M=M.next=V,Ce.lanes|=ie,rs|=ie;G=G.next}while(G!==null&&G!==r);if(M===null?w=p:M.next=E,!ln(p,e.memoizedState)&&(At=!0,W&&(a=_i,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=M,l.lastRenderedState=p}return u===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Df(e){var r=_t(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var l=a.dispatch,u=a.pending,p=r.memoizedState;if(u!==null){a.pending=null;var w=u=u.next;do p=e(p,w.action),w=w.next;while(w!==u);ln(p,r.memoizedState)||(At=!0),r.memoizedState=p,r.baseQueue===null&&(r.baseState=p),a.lastRenderedState=p}return[p,l]}function H0(e,r,a){var l=Ce,u=_t(),p=ze;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=r();var w=!ln((Ze||u).memoizedState,a);if(w&&(u.memoizedState=a,At=!0),u=u.queue,Bf(V0.bind(null,l,u,e),[e]),u.getSnapshot!==r||w||Ot!==null&&Ot.memoizedState.tag&1){if(l.flags|=2048,ji(9,{destroy:void 0},G0.bind(null,l,u,a,r),null),rt===null)throw Error(i(349));p||(xr&127)!==0||F0(l,r,a)}return a}function F0(e,r,a){e.flags|=16384,e={getSnapshot:r,value:a},r=Ce.updateQueue,r===null?(r=gl(),Ce.updateQueue=r,r.stores=[e]):(a=r.stores,a===null?r.stores=[e]:a.push(e))}function G0(e,r,a,l){r.value=a,r.getSnapshot=l,Y0(r)&&K0(e)}function V0(e,r,a){return a(function(){Y0(r)&&K0(e)})}function Y0(e){var r=e.getSnapshot;e=e.value;try{var a=r();return!ln(e,a)}catch{return!0}}function K0(e){var r=qs(e,2);r!==null&&rn(r,e,2)}function qf(e){var r=Gt();if(typeof e=="function"){var a=e;if(e=a(),Fs){an(!0);try{a()}finally{an(!1)}}}return r.memoizedState=r.baseState=e,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vr,lastRenderedState:e},r}function J0(e,r,a,l){return e.baseState=a,Rf(e,Ze,typeof l=="function"?l:vr)}function P_(e,r,a,l,u){if(wl(e))throw Error(i(485));if(e=r.action,e!==null){var p={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};H.T!==null?a(!0):p.isTransition=!1,l(p),a=r.pending,a===null?(p.next=r.pending=p,Q0(r,p)):(p.next=a.next,r.pending=a.next=p)}}function Q0(e,r){var a=r.action,l=r.payload,u=e.state;if(r.isTransition){var p=H.T,w={};H.T=w;try{var E=a(u,l),M=H.S;M!==null&&M(w,E),X0(e,r,E)}catch(G){Lf(e,r,G)}finally{p!==null&&w.types!==null&&(p.types=w.types),H.T=p}}else try{p=a(u,l),X0(e,r,p)}catch(G){Lf(e,r,G)}}function X0(e,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){W0(e,r,l)},function(l){return Lf(e,r,l)}):W0(e,r,a)}function W0(e,r,a){r.status="fulfilled",r.value=a,Z0(r),e.state=a,r=e.pending,r!==null&&(a=r.next,a===r?e.pending=null:(a=a.next,r.next=a,Q0(e,a)))}function Lf(e,r,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,Z0(r),r=r.next;while(r!==l)}e.action=null}function Z0(e){e=e.listeners;for(var r=0;r<e.length;r++)(0,e[r])()}function ep(e,r){return r}function tp(e,r){if(ze){var a=rt.formState;if(a!==null){e:{var l=Ce;if(ze){if(at){t:{for(var u=at,p=Dn;u.nodeType!==8;){if(!p){u=null;break t}if(u=Ln(u.nextSibling),u===null){u=null;break t}}p=u.data,u=p==="F!"||p==="F"?u:null}if(u){at=Ln(u.nextSibling),l=u.data==="F!";break e}}Kr(l)}l=!1}l&&(r=a[0])}}return a=Gt(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ep,lastRenderedState:r},a.queue=l,a=vp.bind(null,Ce,l),l.dispatch=a,l=qf(!1),p=$f.bind(null,Ce,!1,l.queue),l=Gt(),u={state:r,dispatch:null,action:e,pending:null},l.queue=u,a=P_.bind(null,Ce,u,p,a),u.dispatch=a,l.memoizedState=e,[r,a,!1]}function np(e){var r=_t();return rp(r,Ze,e)}function rp(e,r,a){if(r=Rf(e,r,ep)[0],e=xl(vr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Ra(r)}catch(w){throw w===wi?cl:w}else l=r;r=_t();var u=r.queue,p=u.dispatch;return a!==r.memoizedState&&(Ce.flags|=2048,ji(9,{destroy:void 0},U_.bind(null,u,a),null)),[l,p,e]}function U_(e,r){e.action=r}function sp(e){var r=_t(),a=Ze;if(a!==null)return rp(r,a,e);_t(),r=r.memoizedState,a=_t();var l=a.queue.dispatch;return a.memoizedState=e,[r,l,!1]}function ji(e,r,a,l){return e={tag:e,create:a,deps:l,inst:r,next:null},r=Ce.updateQueue,r===null&&(r=gl(),Ce.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,r.lastEffect=e),e}function ip(){return _t().memoizedState}function vl(e,r,a,l){var u=Gt();Ce.flags|=e,u.memoizedState=ji(1|r,{destroy:void 0},a,l===void 0?null:l)}function _l(e,r,a,l){var u=_t();l=l===void 0?null:l;var p=u.memoizedState.inst;Ze!==null&&l!==null&&jf(l,Ze.memoizedState.deps)?u.memoizedState=ji(r,p,a,l):(Ce.flags|=e,u.memoizedState=ji(1|r,p,a,l))}function ap(e,r){vl(8390656,8,e,r)}function Bf(e,r){_l(2048,8,e,r)}function z_(e){Ce.flags|=4;var r=Ce.updateQueue;if(r===null)r=gl(),Ce.updateQueue=r,r.events=[e];else{var a=r.events;a===null?r.events=[e]:a.push(e)}}function op(e){var r=_t().memoizedState;return z_({ref:r,nextImpl:e}),function(){if((Ke&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function lp(e,r){return _l(4,2,e,r)}function cp(e,r){return _l(4,4,e,r)}function up(e,r){if(typeof r=="function"){e=e();var a=r(e);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return e=e(),r.current=e,function(){r.current=null}}function fp(e,r,a){a=a!=null?a.concat([e]):null,_l(4,4,up.bind(null,r,e),a)}function Pf(){}function hp(e,r){var a=_t();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&jf(r,l[1])?l[0]:(a.memoizedState=[e,r],e)}function dp(e,r){var a=_t();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&jf(r,l[1]))return l[0];if(l=e(),Fs){an(!0);try{e()}finally{an(!1)}}return a.memoizedState=[l,r],l}function Uf(e,r,a){return a===void 0||(xr&1073741824)!==0&&(Le&261930)===0?e.memoizedState=r:(e.memoizedState=a,e=my(),Ce.lanes|=e,rs|=e,a)}function mp(e,r,a,l){return ln(a,r)?a:Ei.current!==null?(e=Uf(e,a,l),ln(e,r)||(At=!0),e):(xr&42)===0||(xr&1073741824)!==0&&(Le&261930)===0?(At=!0,e.memoizedState=a):(e=my(),Ce.lanes|=e,rs|=e,r)}function pp(e,r,a,l,u){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=H.T,E={};H.T=E,$f(e,!1,r,a);try{var M=u(),G=H.S;if(G!==null&&G(E,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var W=q_(M,l);Da(e,r,W,mn(e))}else Da(e,r,l,mn(e))}catch(ie){Da(e,r,{then:function(){},status:"rejected",reason:ie},mn())}finally{Z.p=p,w!==null&&E.types!==null&&(w.types=E.types),H.T=w}}function I_(){}function zf(e,r,a,l){if(e.tag!==5)throw Error(i(476));var u=yp(e).queue;pp(e,u,r,oe,a===null?I_:function(){return gp(e),a(l)})}function yp(e){var r=e.memoizedState;if(r!==null)return r;r={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vr,lastRenderedState:oe},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vr,lastRenderedState:a},next:null},e.memoizedState=r,e=e.alternate,e!==null&&(e.memoizedState=r),r}function gp(e){var r=yp(e);r.next===null&&(r=e.alternate.memoizedState),Da(e,r.next.queue,{},mn())}function If(){return Ut(Xa)}function bp(){return _t().memoizedState}function xp(){return _t().memoizedState}function $_(e){for(var r=e.return;r!==null;){switch(r.tag){case 24:case 3:var a=mn();e=Xr(a);var l=Wr(r,e,a);l!==null&&(rn(l,r,a),Na(l,r,a)),r={cache:yf()},e.payload=r;return}r=r.return}}function H_(e,r,a){var l=mn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},wl(e)?_p(r,a):(a=sf(e,r,a,l),a!==null&&(rn(a,e,l),wp(a,r,l)))}function vp(e,r,a){var l=mn();Da(e,r,a,l)}function Da(e,r,a,l){var u={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(wl(e))_p(r,u);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=r.lastRenderedReducer,p!==null))try{var w=r.lastRenderedState,E=p(w,a);if(u.hasEagerState=!0,u.eagerState=E,ln(E,w))return nl(e,r,u,0),rt===null&&tl(),!1}catch{}finally{}if(a=sf(e,r,u,l),a!==null)return rn(a,e,l),wp(a,r,l),!0}return!1}function $f(e,r,a,l){if(l={lane:2,revertLane:vh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},wl(e)){if(r)throw Error(i(479))}else r=sf(e,a,l,2),r!==null&&rn(r,e,2)}function wl(e){var r=e.alternate;return e===Ce||r!==null&&r===Ce}function _p(e,r){Oi=pl=!0;var a=e.pending;a===null?r.next=r:(r.next=a.next,a.next=r),e.pending=r}function wp(e,r,a){if((a&4194048)!==0){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Ns(e,a)}}var qa={readContext:Ut,use:bl,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useLayoutEffect:mt,useInsertionEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useSyncExternalStore:mt,useId:mt,useHostTransitionStatus:mt,useFormState:mt,useActionState:mt,useOptimistic:mt,useMemoCache:mt,useCacheRefresh:mt};qa.useEffectEvent=mt;var Sp={readContext:Ut,use:bl,useCallback:function(e,r){return Gt().memoizedState=[e,r===void 0?null:r],e},useContext:Ut,useEffect:ap,useImperativeHandle:function(e,r,a){a=a!=null?a.concat([e]):null,vl(4194308,4,up.bind(null,r,e),a)},useLayoutEffect:function(e,r){return vl(4194308,4,e,r)},useInsertionEffect:function(e,r){vl(4,2,e,r)},useMemo:function(e,r){var a=Gt();r=r===void 0?null:r;var l=e();if(Fs){an(!0);try{e()}finally{an(!1)}}return a.memoizedState=[l,r],l},useReducer:function(e,r,a){var l=Gt();if(a!==void 0){var u=a(r);if(Fs){an(!0);try{a(r)}finally{an(!1)}}}else u=r;return l.memoizedState=l.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},l.queue=e,e=e.dispatch=H_.bind(null,Ce,e),[l.memoizedState,e]},useRef:function(e){var r=Gt();return e={current:e},r.memoizedState=e},useState:function(e){e=qf(e);var r=e.queue,a=vp.bind(null,Ce,r);return r.dispatch=a,[e.memoizedState,a]},useDebugValue:Pf,useDeferredValue:function(e,r){var a=Gt();return Uf(a,e,r)},useTransition:function(){var e=qf(!1);return e=pp.bind(null,Ce,e.queue,!0,!1),Gt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,r,a){var l=Ce,u=Gt();if(ze){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),rt===null)throw Error(i(349));(Le&127)!==0||F0(l,r,a)}u.memoizedState=a;var p={value:a,getSnapshot:r};return u.queue=p,ap(V0.bind(null,l,p,e),[e]),l.flags|=2048,ji(9,{destroy:void 0},G0.bind(null,l,p,a,r),null),a},useId:function(){var e=Gt(),r=rt.identifierPrefix;if(ze){var a=tr,l=er;a=(l&~(1<<32-Ht(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=yl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=L_++,r="_"+r+"r_"+a.toString(32)+"_";return e.memoizedState=r},useHostTransitionStatus:If,useFormState:tp,useActionState:tp,useOptimistic:function(e){var r=Gt();r.memoizedState=r.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=$f.bind(null,Ce,!0,a),a.dispatch=r,[e,r]},useMemoCache:Mf,useCacheRefresh:function(){return Gt().memoizedState=$_.bind(null,Ce)},useEffectEvent:function(e){var r=Gt(),a={impl:e};return r.memoizedState=a,function(){if((Ke&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Hf={readContext:Ut,use:bl,useCallback:hp,useContext:Ut,useEffect:Bf,useImperativeHandle:fp,useInsertionEffect:lp,useLayoutEffect:cp,useMemo:dp,useReducer:xl,useRef:ip,useState:function(){return xl(vr)},useDebugValue:Pf,useDeferredValue:function(e,r){var a=_t();return mp(a,Ze.memoizedState,e,r)},useTransition:function(){var e=xl(vr)[0],r=_t().memoizedState;return[typeof e=="boolean"?e:Ra(e),r]},useSyncExternalStore:H0,useId:bp,useHostTransitionStatus:If,useFormState:np,useActionState:np,useOptimistic:function(e,r){var a=_t();return J0(a,Ze,e,r)},useMemoCache:Mf,useCacheRefresh:xp};Hf.useEffectEvent=op;var Ep={readContext:Ut,use:bl,useCallback:hp,useContext:Ut,useEffect:Bf,useImperativeHandle:fp,useInsertionEffect:lp,useLayoutEffect:cp,useMemo:dp,useReducer:Df,useRef:ip,useState:function(){return Df(vr)},useDebugValue:Pf,useDeferredValue:function(e,r){var a=_t();return Ze===null?Uf(a,e,r):mp(a,Ze.memoizedState,e,r)},useTransition:function(){var e=Df(vr)[0],r=_t().memoizedState;return[typeof e=="boolean"?e:Ra(e),r]},useSyncExternalStore:H0,useId:bp,useHostTransitionStatus:If,useFormState:sp,useActionState:sp,useOptimistic:function(e,r){var a=_t();return Ze!==null?J0(a,Ze,e,r):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Mf,useCacheRefresh:xp};Ep.useEffectEvent=op;function Ff(e,r,a,l){r=e.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Gf={enqueueSetState:function(e,r,a){e=e._reactInternals;var l=mn(),u=Xr(l);u.payload=r,a!=null&&(u.callback=a),r=Wr(e,u,l),r!==null&&(rn(r,e,l),Na(r,e,l))},enqueueReplaceState:function(e,r,a){e=e._reactInternals;var l=mn(),u=Xr(l);u.tag=1,u.payload=r,a!=null&&(u.callback=a),r=Wr(e,u,l),r!==null&&(rn(r,e,l),Na(r,e,l))},enqueueForceUpdate:function(e,r){e=e._reactInternals;var a=mn(),l=Xr(a);l.tag=2,r!=null&&(l.callback=r),r=Wr(e,l,a),r!==null&&(rn(r,e,a),Na(r,e,a))}};function Op(e,r,a,l,u,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,p,w):r.prototype&&r.prototype.isPureReactComponent?!_a(a,l)||!_a(u,p):!0}function Ap(e,r,a,l){e=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==e&&Gf.enqueueReplaceState(r,r.state,null)}function Gs(e,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(e=e.defaultProps){a===r&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function jp(e){el(e)}function kp(e){console.error(e)}function Np(e){el(e)}function Sl(e,r){try{var a=e.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function Tp(e,r,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Vf(e,r,a){return a=Xr(a),a.tag=3,a.payload={element:null},a.callback=function(){Sl(e,r)},a}function Cp(e){return e=Xr(e),e.tag=3,e}function Mp(e,r,a,l){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var p=l.value;e.payload=function(){return u(p)},e.callback=function(){Tp(r,a,l)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){Tp(r,a,l),typeof u!="function"&&(ss===null?ss=new Set([this]):ss.add(this));var E=l.stack;this.componentDidCatch(l.value,{componentStack:E!==null?E:""})})}function F_(e,r,a,l,u){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&xi(r,a,u,!0),a=un.current,a!==null){switch(a.tag){case 31:case 13:return qn===null?ql():a.alternate===null&&pt===0&&(pt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,l===ul?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),gh(e,l,u)),!1;case 22:return a.flags|=65536,l===ul?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),gh(e,l,u)),!1}throw Error(i(435,a.tag))}return gh(e,l,u),ql(),!1}if(ze)return r=un.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=u,l!==ff&&(e=Error(i(422),{cause:l}),Ea(Cn(e,a)))):(l!==ff&&(r=Error(i(423),{cause:l}),Ea(Cn(r,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,l=Cn(l,a),u=Vf(e.stateNode,l,u),wf(e,u),pt!==4&&(pt=2)),!1;var p=Error(i(520),{cause:l});if(p=Cn(p,a),Ha===null?Ha=[p]:Ha.push(p),pt!==4&&(pt=2),r===null)return!0;l=Cn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Vf(a.stateNode,l,e),wf(a,e),!1;case 1:if(r=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(ss===null||!ss.has(p))))return a.flags|=65536,u&=-u,a.lanes|=u,u=Cp(u),Mp(u,e,a,l),wf(a,u),!1}a=a.return}while(a!==null);return!1}var Yf=Error(i(461)),At=!1;function zt(e,r,a,l){r.child=e===null?L0(r,null,a,l):Hs(r,e.child,a,l)}function Rp(e,r,a,l,u){a=a.render;var p=r.ref;if("ref"in l){var w={};for(var E in l)E!=="ref"&&(w[E]=l[E])}else w=l;return Us(r),l=kf(e,r,a,w,p,u),E=Nf(),e!==null&&!At?(Tf(e,r,u),_r(e,r,u)):(ze&&E&&cf(r),r.flags|=1,zt(e,r,l,u),r.child)}function Dp(e,r,a,l,u){if(e===null){var p=a.type;return typeof p=="function"&&!af(p)&&p.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=p,qp(e,r,p,l,u)):(e=sl(a.type,null,l,r,r.mode,u),e.ref=r.ref,e.return=r,r.child=e)}if(p=e.child,!th(e,u)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:_a,a(w,l)&&e.ref===r.ref)return _r(e,r,u)}return r.flags|=1,e=pr(p,l),e.ref=r.ref,e.return=r,r.child=e}function qp(e,r,a,l,u){if(e!==null){var p=e.memoizedProps;if(_a(p,l)&&e.ref===r.ref)if(At=!1,r.pendingProps=l=p,th(e,u))(e.flags&131072)!==0&&(At=!0);else return r.lanes=e.lanes,_r(e,r,u)}return Kf(e,r,a,l,u)}function Lp(e,r,a,l){var u=l.children,p=e!==null?e.memoizedState:null;if(e===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(l=r.child=e.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~p}else l=0,r.child=null;return Bp(e,r,p,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},e!==null&&ll(r,p!==null?p.cachePool:null),p!==null?U0(r,p):Ef(),z0(r);else return l=r.lanes=536870912,Bp(e,r,p!==null?p.baseLanes|a:a,a,l)}else p!==null?(ll(r,p.cachePool),U0(r,p),es(),r.memoizedState=null):(e!==null&&ll(r,null),Ef(),es());return zt(e,r,u,a),r.child}function La(e,r){return e!==null&&e.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Bp(e,r,a,l,u){var p=bf();return p=p===null?null:{parent:Et._currentValue,pool:p},r.memoizedState={baseLanes:a,cachePool:p},e!==null&&ll(r,null),Ef(),z0(r),e!==null&&xi(e,r,l,!0),r.childLanes=u,null}function El(e,r){return r=Al({mode:r.mode,children:r.children},e.mode),r.ref=e.ref,e.child=r,r.return=e,r}function Pp(e,r,a){return Hs(r,e.child,null,a),e=El(r,r.pendingProps),e.flags|=2,fn(r),r.memoizedState=null,e}function G_(e,r,a){var l=r.pendingProps,u=(r.flags&128)!==0;if(r.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=El(r,l),r.lanes=536870912,La(null,e);if(Af(r),(e=at)?(e=Qy(e,Dn),e=e!==null&&e.data==="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Vr!==null?{id:er,overflow:tr}:null,retryLane:536870912,hydrationErrors:null},a=_0(e),a.return=r,r.child=a,Pt=r,at=null)):e=null,e===null)throw Kr(r);return r.lanes=536870912,null}return El(r,l)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Af(r),u)if(r.flags&256)r.flags&=-257,r=Pp(e,r,a);else if(r.memoizedState!==null)r.child=e.child,r.flags|=128,r=null;else throw Error(i(558));else if(At||xi(e,r,a,!1),u=(a&e.childLanes)!==0,At||u){if(l=rt,l!==null&&(w=Fr(l,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,qs(e,w),rn(l,e,w),Yf;ql(),r=Pp(e,r,a)}else e=p.treeContext,at=Ln(w.nextSibling),Pt=r,ze=!0,Yr=null,Dn=!1,e!==null&&E0(r,e),r=El(r,l),r.flags|=4096;return r}return e=pr(e.child,{mode:l.mode,children:l.children}),e.ref=r.ref,r.child=e,e.return=r,e}function Ol(e,r){var a=r.ref;if(a===null)e!==null&&e.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(r.flags|=4194816)}}function Kf(e,r,a,l,u){return Us(r),a=kf(e,r,a,l,void 0,u),l=Nf(),e!==null&&!At?(Tf(e,r,u),_r(e,r,u)):(ze&&l&&cf(r),r.flags|=1,zt(e,r,a,u),r.child)}function Up(e,r,a,l,u,p){return Us(r),r.updateQueue=null,a=$0(r,l,a,u),I0(e),l=Nf(),e!==null&&!At?(Tf(e,r,p),_r(e,r,p)):(ze&&l&&cf(r),r.flags|=1,zt(e,r,a,p),r.child)}function zp(e,r,a,l,u){if(Us(r),r.stateNode===null){var p=pi,w=a.contextType;typeof w=="object"&&w!==null&&(p=Ut(w)),p=new a(l,p),r.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Gf,r.stateNode=p,p._reactInternals=r,p=r.stateNode,p.props=l,p.state=r.memoizedState,p.refs={},vf(r),w=a.contextType,p.context=typeof w=="object"&&w!==null?Ut(w):pi,p.state=r.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Ff(r,a,w,l),p.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Gf.enqueueReplaceState(p,p.state,null),Ca(r,l,p,u),Ta(),p.state=r.memoizedState),typeof p.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(e===null){p=r.stateNode;var E=r.memoizedProps,M=Gs(a,E);p.props=M;var G=p.context,W=a.contextType;w=pi,typeof W=="object"&&W!==null&&(w=Ut(W));var ie=a.getDerivedStateFromProps;W=typeof ie=="function"||typeof p.getSnapshotBeforeUpdate=="function",E=r.pendingProps!==E,W||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(E||G!==w)&&Ap(r,p,l,w),Qr=!1;var V=r.memoizedState;p.state=V,Ca(r,l,p,u),Ta(),G=r.memoizedState,E||V!==G||Qr?(typeof ie=="function"&&(Ff(r,a,ie,l),G=r.memoizedState),(M=Qr||Op(r,a,M,l,V,G,w))?(W||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(r.flags|=4194308)):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=G),p.props=l,p.state=G,p.context=w,l=M):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{p=r.stateNode,_f(e,r),w=r.memoizedProps,W=Gs(a,w),p.props=W,ie=r.pendingProps,V=p.context,G=a.contextType,M=pi,typeof G=="object"&&G!==null&&(M=Ut(G)),E=a.getDerivedStateFromProps,(G=typeof E=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ie||V!==M)&&Ap(r,p,l,M),Qr=!1,V=r.memoizedState,p.state=V,Ca(r,l,p,u),Ta();var Q=r.memoizedState;w!==ie||V!==Q||Qr||e!==null&&e.dependencies!==null&&al(e.dependencies)?(typeof E=="function"&&(Ff(r,a,E,l),Q=r.memoizedState),(W=Qr||Op(r,a,W,l,V,Q,M)||e!==null&&e.dependencies!==null&&al(e.dependencies))?(G||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,Q,M),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,Q,M)),typeof p.componentDidUpdate=="function"&&(r.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&V===e.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&V===e.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=Q),p.props=l,p.state=Q,p.context=M,l=W):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&V===e.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&V===e.memoizedState||(r.flags|=1024),l=!1)}return p=l,Ol(e,r),l=(r.flags&128)!==0,p||l?(p=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:p.render(),r.flags|=1,e!==null&&l?(r.child=Hs(r,e.child,null,u),r.child=Hs(r,null,a,u)):zt(e,r,a,u),r.memoizedState=p.state,e=r.child):e=_r(e,r,u),e}function Ip(e,r,a,l){return Bs(),r.flags|=256,zt(e,r,a,l),r.child}var Jf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qf(e){return{baseLanes:e,cachePool:T0()}}function Xf(e,r,a){return e=e!==null?e.childLanes&~a:0,r&&(e|=dn),e}function $p(e,r,a){var l=r.pendingProps,u=!1,p=(r.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(vt.current&2)!==0),w&&(u=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,e===null){if(ze){if(u?Zr(r):es(),(e=at)?(e=Qy(e,Dn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Vr!==null?{id:er,overflow:tr}:null,retryLane:536870912,hydrationErrors:null},a=_0(e),a.return=r,r.child=a,Pt=r,at=null)):e=null,e===null)throw Kr(r);return Rh(e)?r.lanes=32:r.lanes=536870912,null}var E=l.children;return l=l.fallback,u?(es(),u=r.mode,E=Al({mode:"hidden",children:E},u),l=Ls(l,u,a,null),E.return=r,l.return=r,E.sibling=l,r.child=E,l=r.child,l.memoizedState=Qf(a),l.childLanes=Xf(e,w,a),r.memoizedState=Jf,La(null,l)):(Zr(r),Wf(r,E))}var M=e.memoizedState;if(M!==null&&(E=M.dehydrated,E!==null)){if(p)r.flags&256?(Zr(r),r.flags&=-257,r=Zf(e,r,a)):r.memoizedState!==null?(es(),r.child=e.child,r.flags|=128,r=null):(es(),E=l.fallback,u=r.mode,l=Al({mode:"visible",children:l.children},u),E=Ls(E,u,a,null),E.flags|=2,l.return=r,E.return=r,l.sibling=E,r.child=l,Hs(r,e.child,null,a),l=r.child,l.memoizedState=Qf(a),l.childLanes=Xf(e,w,a),r.memoizedState=Jf,r=La(null,l));else if(Zr(r),Rh(E)){if(w=E.nextSibling&&E.nextSibling.dataset,w)var G=w.dgst;w=G,l=Error(i(419)),l.stack="",l.digest=w,Ea({value:l,source:null,stack:null}),r=Zf(e,r,a)}else if(At||xi(e,r,a,!1),w=(a&e.childLanes)!==0,At||w){if(w=rt,w!==null&&(l=Fr(w,a),l!==0&&l!==M.retryLane))throw M.retryLane=l,qs(e,l),rn(w,e,l),Yf;Mh(E)||ql(),r=Zf(e,r,a)}else Mh(E)?(r.flags|=192,r.child=e.child,r=null):(e=M.treeContext,at=Ln(E.nextSibling),Pt=r,ze=!0,Yr=null,Dn=!1,e!==null&&E0(r,e),r=Wf(r,l.children),r.flags|=4096);return r}return u?(es(),E=l.fallback,u=r.mode,M=e.child,G=M.sibling,l=pr(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,G!==null?E=pr(G,E):(E=Ls(E,u,a,null),E.flags|=2),E.return=r,l.return=r,l.sibling=E,r.child=l,La(null,l),l=r.child,E=e.child.memoizedState,E===null?E=Qf(a):(u=E.cachePool,u!==null?(M=Et._currentValue,u=u.parent!==M?{parent:M,pool:M}:u):u=T0(),E={baseLanes:E.baseLanes|a,cachePool:u}),l.memoizedState=E,l.childLanes=Xf(e,w,a),r.memoizedState=Jf,La(e.child,l)):(Zr(r),a=e.child,e=a.sibling,a=pr(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,e!==null&&(w=r.deletions,w===null?(r.deletions=[e],r.flags|=16):w.push(e)),r.child=a,r.memoizedState=null,a)}function Wf(e,r){return r=Al({mode:"visible",children:r},e.mode),r.return=e,e.child=r}function Al(e,r){return e=cn(22,e,null,r),e.lanes=0,e}function Zf(e,r,a){return Hs(r,e.child,null,a),e=Wf(r,r.pendingProps.children),e.flags|=2,r.memoizedState=null,e}function Hp(e,r,a){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r),mf(e.return,r,a)}function eh(e,r,a,l,u,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:u,treeForkCount:p}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=l,w.tail=a,w.tailMode=u,w.treeForkCount=p)}function Fp(e,r,a){var l=r.pendingProps,u=l.revealOrder,p=l.tail;l=l.children;var w=vt.current,E=(w&2)!==0;if(E?(w=w&1|2,r.flags|=128):w&=1,Te(vt,w),zt(e,r,l,a),l=ze?Sa:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=r.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hp(e,a,r);else if(e.tag===19)Hp(e,a,r);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===r)break e;for(;e.sibling===null;){if(e.return===null||e.return===r)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=r.child,u=null;a!==null;)e=a.alternate,e!==null&&ml(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=r.child,r.child=null):(u=a.sibling,a.sibling=null),eh(r,!1,u,a,p,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=r.child,r.child=null;u!==null;){if(e=u.alternate,e!==null&&ml(e)===null){r.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}eh(r,!0,a,null,p,l);break;case"together":eh(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function _r(e,r,a){if(e!==null&&(r.dependencies=e.dependencies),rs|=r.lanes,(a&r.childLanes)===0)if(e!==null){if(xi(e,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(e!==null&&r.child!==e.child)throw Error(i(153));if(r.child!==null){for(e=r.child,a=pr(e,e.pendingProps),r.child=a,a.return=r;e.sibling!==null;)e=e.sibling,a=a.sibling=pr(e,e.pendingProps),a.return=r;a.sibling=null}return r.child}function th(e,r){return(e.lanes&r)!==0?!0:(e=e.dependencies,!!(e!==null&&al(e)))}function V_(e,r,a){switch(r.tag){case 3:bt(r,r.stateNode.containerInfo),Jr(r,Et,e.memoizedState.cache),Bs();break;case 27:case 5:Je(r);break;case 4:bt(r,r.stateNode.containerInfo);break;case 10:Jr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Af(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(Zr(r),r.flags|=128,null):(a&r.child.childLanes)!==0?$p(e,r,a):(Zr(r),e=_r(e,r,a),e!==null?e.sibling:null);Zr(r);break;case 19:var u=(e.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(xi(e,r,a,!1),l=(a&r.childLanes)!==0),u){if(l)return Fp(e,r,a);r.flags|=128}if(u=r.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Te(vt,vt.current),l)break;return null;case 22:return r.lanes=0,Lp(e,r,a,r.pendingProps);case 24:Jr(r,Et,e.memoizedState.cache)}return _r(e,r,a)}function Gp(e,r,a){if(e!==null)if(e.memoizedProps!==r.pendingProps)At=!0;else{if(!th(e,a)&&(r.flags&128)===0)return At=!1,V_(e,r,a);At=(e.flags&131072)!==0}else At=!1,ze&&(r.flags&1048576)!==0&&S0(r,Sa,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(e=Is(r.elementType),r.type=e,typeof e=="function")af(e)?(l=Gs(e,l),r.tag=1,r=zp(null,r,e,l,a)):(r.tag=0,r=Kf(null,r,e,l,a));else{if(e!=null){var u=e.$$typeof;if(u===le){r.tag=11,r=Rp(null,r,e,l,a);break e}else if(u===ee){r.tag=14,r=Dp(null,r,e,l,a);break e}}throw r=be(e)||e,Error(i(306,r,""))}}return r;case 0:return Kf(e,r,r.type,r.pendingProps,a);case 1:return l=r.type,u=Gs(l,r.pendingProps),zp(e,r,l,u,a);case 3:e:{if(bt(r,r.stateNode.containerInfo),e===null)throw Error(i(387));l=r.pendingProps;var p=r.memoizedState;u=p.element,_f(e,r),Ca(r,l,null,a);var w=r.memoizedState;if(l=w.cache,Jr(r,Et,l),l!==p.cache&&pf(r,[Et],a,!0),Ta(),l=w.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=p,r.memoizedState=p,r.flags&256){r=Ip(e,r,l,a);break e}else if(l!==u){u=Cn(Error(i(424)),r),Ea(u),r=Ip(e,r,l,a);break e}else{switch(e=r.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(at=Ln(e.firstChild),Pt=r,ze=!0,Yr=null,Dn=!0,a=L0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Bs(),l===u){r=_r(e,r,a);break e}zt(e,r,l,a)}r=r.child}return r;case 26:return Ol(e,r),e===null?(a=ng(r.type,null,r.pendingProps,null))?r.memoizedState=a:ze||(a=r.type,e=r.pendingProps,l=$l(Bt.current).createElement(a),l[nt]=r,l[dt]=e,It(l,a,e),q(l),r.stateNode=l):r.memoizedState=ng(r.type,e.memoizedProps,r.pendingProps,e.memoizedState),null;case 27:return Je(r),e===null&&ze&&(l=r.stateNode=Zy(r.type,r.pendingProps,Bt.current),Pt=r,Dn=!0,u=at,ls(r.type)?(Dh=u,at=Ln(l.firstChild)):at=u),zt(e,r,r.pendingProps.children,a),Ol(e,r),e===null&&(r.flags|=4194304),r.child;case 5:return e===null&&ze&&((u=l=at)&&(l=ww(l,r.type,r.pendingProps,Dn),l!==null?(r.stateNode=l,Pt=r,at=Ln(l.firstChild),Dn=!1,u=!0):u=!1),u||Kr(r)),Je(r),u=r.type,p=r.pendingProps,w=e!==null?e.memoizedProps:null,l=p.children,Nh(u,p)?l=null:w!==null&&Nh(u,w)&&(r.flags|=32),r.memoizedState!==null&&(u=kf(e,r,B_,null,null,a),Xa._currentValue=u),Ol(e,r),zt(e,r,l,a),r.child;case 6:return e===null&&ze&&((e=a=at)&&(a=Sw(a,r.pendingProps,Dn),a!==null?(r.stateNode=a,Pt=r,at=null,e=!0):e=!1),e||Kr(r)),null;case 13:return $p(e,r,a);case 4:return bt(r,r.stateNode.containerInfo),l=r.pendingProps,e===null?r.child=Hs(r,null,l,a):zt(e,r,l,a),r.child;case 11:return Rp(e,r,r.type,r.pendingProps,a);case 7:return zt(e,r,r.pendingProps,a),r.child;case 8:return zt(e,r,r.pendingProps.children,a),r.child;case 12:return zt(e,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Jr(r,r.type,l.value),zt(e,r,l.children,a),r.child;case 9:return u=r.type._context,l=r.pendingProps.children,Us(r),u=Ut(u),l=l(u),r.flags|=1,zt(e,r,l,a),r.child;case 14:return Dp(e,r,r.type,r.pendingProps,a);case 15:return qp(e,r,r.type,r.pendingProps,a);case 19:return Fp(e,r,a);case 31:return G_(e,r,a);case 22:return Lp(e,r,a,r.pendingProps);case 24:return Us(r),l=Ut(Et),e===null?(u=bf(),u===null&&(u=rt,p=yf(),u.pooledCache=p,p.refCount++,p!==null&&(u.pooledCacheLanes|=a),u=p),r.memoizedState={parent:l,cache:u},vf(r),Jr(r,Et,u)):((e.lanes&a)!==0&&(_f(e,r),Ca(r,null,null,a),Ta()),u=e.memoizedState,p=r.memoizedState,u.parent!==l?(u={parent:l,cache:l},r.memoizedState=u,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=u),Jr(r,Et,l)):(l=p.cache,Jr(r,Et,l),l!==u.cache&&pf(r,[Et],a,!0))),zt(e,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function wr(e){e.flags|=4}function nh(e,r,a,l,u){if((r=(e.mode&32)!==0)&&(r=!1),r){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(by())e.flags|=8192;else throw $s=ul,xf}else e.flags&=-16777217}function Vp(e,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!og(r))if(by())e.flags|=8192;else throw $s=ul,xf}function jl(e,r){r!==null&&(e.flags|=4),e.flags&16384&&(r=e.tag!==22?ii():536870912,e.lanes|=r,Ci|=r)}function Ba(e,r){if(!ze)switch(e.tailMode){case"hidden":r=e.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function ot(e){var r=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(r)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=l,e.childLanes=a,r}function Y_(e,r,a){var l=r.pendingProps;switch(uf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ot(r),null;case 1:return ot(r),null;case 3:return a=r.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),br(Et),ue(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(bi(r)?wr(r):e===null||e.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,hf())),ot(r),null;case 26:var u=r.type,p=r.memoizedState;return e===null?(wr(r),p!==null?(ot(r),Vp(r,p)):(ot(r),nh(r,u,null,l,a))):p?p!==e.memoizedState?(wr(r),ot(r),Vp(r,p)):(ot(r),r.flags&=-16777217):(e=e.memoizedProps,e!==l&&wr(r),ot(r),nh(r,u,e,l,a)),null;case 27:if(jn(r),a=Bt.current,u=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&wr(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ot(r),null}e=st.current,bi(r)?O0(r):(e=Zy(u,l,a),r.stateNode=e,wr(r))}return ot(r),null;case 5:if(jn(r),u=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&wr(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ot(r),null}if(p=st.current,bi(r))O0(r);else{var w=$l(Bt.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?w.createElement("select",{is:l.is}):w.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?w.createElement(u,{is:l.is}):w.createElement(u)}}p[nt]=r,p[dt]=l;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===r)break e;for(;w.sibling===null;){if(w.return===null||w.return===r)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}r.stateNode=p;e:switch(It(p,u,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&wr(r)}}return ot(r),nh(r,r.type,e===null?null:e.memoizedProps,r.pendingProps,a),null;case 6:if(e&&r.stateNode!=null)e.memoizedProps!==l&&wr(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(e=Bt.current,bi(r)){if(e=r.stateNode,a=r.memoizedProps,l=null,u=Pt,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}e[nt]=r,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||$y(e.nodeValue,a)),e||Kr(r,!0)}else e=$l(e).createTextNode(l),e[nt]=r,r.stateNode=e}return ot(r),null;case 31:if(a=r.memoizedState,e===null||e.memoizedState!==null){if(l=bi(r),a!==null){if(e===null){if(!l)throw Error(i(318));if(e=r.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[nt]=r}else Bs(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ot(r),e=!1}else a=hf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return r.flags&256?(fn(r),r):(fn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return ot(r),null;case 13:if(l=r.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=bi(r),l!==null&&l.dehydrated!==null){if(e===null){if(!u)throw Error(i(318));if(u=r.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));u[nt]=r}else Bs(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ot(r),u=!1}else u=hf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return r.flags&256?(fn(r),r):(fn(r),null)}return fn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=r.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==u&&(l.flags|=2048)),a!==e&&a&&(r.child.flags|=8192),jl(r,r.updateQueue),ot(r),null);case 4:return ue(),e===null&&Eh(r.stateNode.containerInfo),ot(r),null;case 10:return br(r.type),ot(r),null;case 19:if(ke(vt),l=r.memoizedState,l===null)return ot(r),null;if(u=(r.flags&128)!==0,p=l.rendering,p===null)if(u)Ba(l,!1);else{if(pt!==0||e!==null&&(e.flags&128)!==0)for(e=r.child;e!==null;){if(p=ml(e),p!==null){for(r.flags|=128,Ba(l,!1),e=p.updateQueue,r.updateQueue=e,jl(r,e),r.subtreeFlags=0,e=a,a=r.child;a!==null;)v0(a,e),a=a.sibling;return Te(vt,vt.current&1|2),ze&&yr(r,l.treeForkCount),r.child}e=e.sibling}l.tail!==null&&ct()>Ml&&(r.flags|=128,u=!0,Ba(l,!1),r.lanes=4194304)}else{if(!u)if(e=ml(p),e!==null){if(r.flags|=128,u=!0,e=e.updateQueue,r.updateQueue=e,jl(r,e),Ba(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!ze)return ot(r),null}else 2*ct()-l.renderingStartTime>Ml&&a!==536870912&&(r.flags|=128,u=!0,Ba(l,!1),r.lanes=4194304);l.isBackwards?(p.sibling=r.child,r.child=p):(e=l.last,e!==null?e.sibling=p:r.child=p,l.last=p)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ct(),e.sibling=null,a=vt.current,Te(vt,u?a&1|2:a&1),ze&&yr(r,l.treeForkCount),e):(ot(r),null);case 22:case 23:return fn(r),Of(),l=r.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(ot(r),r.subtreeFlags&6&&(r.flags|=8192)):ot(r),a=r.updateQueue,a!==null&&jl(r,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),e!==null&&ke(zs),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),br(Et),ot(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function K_(e,r){switch(uf(r),r.tag){case 1:return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return br(Et),ue(),e=r.flags,(e&65536)!==0&&(e&128)===0?(r.flags=e&-65537|128,r):null;case 26:case 27:case 5:return jn(r),null;case 31:if(r.memoizedState!==null){if(fn(r),r.alternate===null)throw Error(i(340));Bs()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 13:if(fn(r),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Bs()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return ke(vt),null;case 4:return ue(),null;case 10:return br(r.type),null;case 22:case 23:return fn(r),Of(),e!==null&&ke(zs),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 24:return br(Et),null;case 25:return null;default:return null}}function Yp(e,r){switch(uf(r),r.tag){case 3:br(Et),ue();break;case 26:case 27:case 5:jn(r);break;case 4:ue();break;case 31:r.memoizedState!==null&&fn(r);break;case 13:fn(r);break;case 19:ke(vt);break;case 10:br(r.type);break;case 22:case 23:fn(r),Of(),e!==null&&ke(zs);break;case 24:br(Et)}}function Pa(e,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var u=l.next;a=u;do{if((a.tag&e)===e){l=void 0;var p=a.create,w=a.inst;l=p(),w.destroy=l}a=a.next}while(a!==u)}}catch(E){Xe(r,r.return,E)}}function ts(e,r,a){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var p=u.next;l=p;do{if((l.tag&e)===e){var w=l.inst,E=w.destroy;if(E!==void 0){w.destroy=void 0,u=r;var M=a,G=E;try{G()}catch(W){Xe(u,M,W)}}}l=l.next}while(l!==p)}}catch(W){Xe(r,r.return,W)}}function Kp(e){var r=e.updateQueue;if(r!==null){var a=e.stateNode;try{P0(r,a)}catch(l){Xe(e,e.return,l)}}}function Jp(e,r,a){a.props=Gs(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Xe(e,r,l)}}function Ua(e,r){try{var a=e.ref;if(a!==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 a=="function"?e.refCleanup=a(l):a.current=l}}catch(u){Xe(e,r,u)}}function nr(e,r){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(u){Xe(e,r,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Xe(e,r,u)}else a.current=null}function Qp(e){var r=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(u){Xe(e,e.return,u)}}function rh(e,r,a){try{var l=e.stateNode;yw(l,e.type,a,r),l[dt]=r}catch(u){Xe(e,e.return,u)}}function Xp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ls(e.type)||e.tag===4}function sh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ls(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 ih(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(e),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=dr));else if(l!==4&&(l===27&&ls(e.type)&&(a=e.stateNode,r=null),e=e.child,e!==null))for(ih(e,r,a),e=e.sibling;e!==null;)ih(e,r,a),e=e.sibling}function kl(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?a.insertBefore(e,r):a.appendChild(e);else if(l!==4&&(l===27&&ls(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(kl(e,r,a),e=e.sibling;e!==null;)kl(e,r,a),e=e.sibling}function Wp(e){var r=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,u=r.attributes;u.length;)r.removeAttributeNode(u[0]);It(r,l,a),r[nt]=e,r[dt]=a}catch(p){Xe(e,e.return,p)}}var Sr=!1,jt=!1,ah=!1,Zp=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function J_(e,r){if(e=e.containerInfo,jh=Jl,e=f0(e),Wu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,E=-1,M=-1,G=0,W=0,ie=e,V=null;t:for(;;){for(var Q;ie!==a||u!==0&&ie.nodeType!==3||(E=w+u),ie!==p||l!==0&&ie.nodeType!==3||(M=w+l),ie.nodeType===3&&(w+=ie.nodeValue.length),(Q=ie.firstChild)!==null;)V=ie,ie=Q;for(;;){if(ie===e)break t;if(V===a&&++G===u&&(E=w),V===p&&++W===l&&(M=w),(Q=ie.nextSibling)!==null)break;ie=V,V=ie.parentNode}ie=Q}a=E===-1||M===-1?null:{start:E,end:M}}else a=null}a=a||{start:0,end:0}}else a=null;for(kh={focusedElem:e,selectionRange:a},Jl=!1,Rt=r;Rt!==null;)if(r=Rt,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,Rt=e;else for(;Rt!==null;){switch(r=Rt,p=r.alternate,e=r.flags,r.tag){case 0:if((e&4)!==0&&(e=r.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=r,u=p.memoizedProps,p=p.memoizedState,l=a.stateNode;try{var ge=Gs(a.type,u);e=l.getSnapshotBeforeUpdate(ge,p),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ae){Xe(a,a.return,Ae)}}break;case 3:if((e&1024)!==0){if(e=r.stateNode.containerInfo,a=e.nodeType,a===9)Ch(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ch(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=r.sibling,e!==null){e.return=r.return,Rt=e;break}Rt=r.return}}function ey(e,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Or(e,a),l&4&&Pa(5,a);break;case 1:if(Or(e,a),l&4)if(e=a.stateNode,r===null)try{e.componentDidMount()}catch(w){Xe(a,a.return,w)}else{var u=Gs(a.type,r.memoizedProps);r=r.memoizedState;try{e.componentDidUpdate(u,r,e.__reactInternalSnapshotBeforeUpdate)}catch(w){Xe(a,a.return,w)}}l&64&&Kp(a),l&512&&Ua(a,a.return);break;case 3:if(Or(e,a),l&64&&(e=a.updateQueue,e!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{P0(e,r)}catch(w){Xe(a,a.return,w)}}break;case 27:r===null&&l&4&&Wp(a);case 26:case 5:Or(e,a),r===null&&l&4&&Qp(a),l&512&&Ua(a,a.return);break;case 12:Or(e,a);break;case 31:Or(e,a),l&4&&ry(e,a);break;case 13:Or(e,a),l&4&&sy(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=sw.bind(null,a),Ew(e,a))));break;case 22:if(l=a.memoizedState!==null||Sr,!l){r=r!==null&&r.memoizedState!==null||jt,u=Sr;var p=jt;Sr=l,(jt=r)&&!p?Ar(e,a,(a.subtreeFlags&8772)!==0):Or(e,a),Sr=u,jt=p}break;case 30:break;default:Or(e,a)}}function ty(e){var r=e.alternate;r!==null&&(e.alternate=null,ty(r)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(r=e.stateNode,r!==null&&ai(r)),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 ut=null,Zt=!1;function Er(e,r,a){for(a=a.child;a!==null;)ny(e,r,a),a=a.sibling}function ny(e,r,a){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(As,a)}catch{}switch(a.tag){case 26:jt||nr(a,r),Er(e,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:jt||nr(a,r);var l=ut,u=Zt;ls(a.type)&&(ut=a.stateNode,Zt=!1),Er(e,r,a),Ka(a.stateNode),ut=l,Zt=u;break;case 5:jt||nr(a,r);case 6:if(l=ut,u=Zt,ut=null,Er(e,r,a),ut=l,Zt=u,ut!==null)if(Zt)try{(ut.nodeType===9?ut.body:ut.nodeName==="HTML"?ut.ownerDocument.body:ut).removeChild(a.stateNode)}catch(p){Xe(a,r,p)}else try{ut.removeChild(a.stateNode)}catch(p){Xe(a,r,p)}break;case 18:ut!==null&&(Zt?(e=ut,Ky(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ui(e)):Ky(ut,a.stateNode));break;case 4:l=ut,u=Zt,ut=a.stateNode.containerInfo,Zt=!0,Er(e,r,a),ut=l,Zt=u;break;case 0:case 11:case 14:case 15:ts(2,a,r),jt||ts(4,a,r),Er(e,r,a);break;case 1:jt||(nr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Jp(a,r,l)),Er(e,r,a);break;case 21:Er(e,r,a);break;case 22:jt=(l=jt)||a.memoizedState!==null,Er(e,r,a),jt=l;break;default:Er(e,r,a)}}function ry(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ui(e)}catch(a){Xe(r,r.return,a)}}}function sy(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ui(e)}catch(a){Xe(r,r.return,a)}}function Q_(e){switch(e.tag){case 31:case 13:case 19:var r=e.stateNode;return r===null&&(r=e.stateNode=new Zp),r;case 22:return e=e.stateNode,r=e._retryCache,r===null&&(r=e._retryCache=new Zp),r;default:throw Error(i(435,e.tag))}}function Nl(e,r){var a=Q_(e);r.forEach(function(l){if(!a.has(l)){a.add(l);var u=iw.bind(null,e,l);l.then(u,u)}})}function en(e,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var u=a[l],p=e,w=r,E=w;e:for(;E!==null;){switch(E.tag){case 27:if(ls(E.type)){ut=E.stateNode,Zt=!1;break e}break;case 5:ut=E.stateNode,Zt=!1;break e;case 3:case 4:ut=E.stateNode.containerInfo,Zt=!0;break e}E=E.return}if(ut===null)throw Error(i(160));ny(p,w,u),ut=null,Zt=!1,p=u.alternate,p!==null&&(p.return=null),u.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)iy(r,e),r=r.sibling}var Gn=null;function iy(e,r){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:en(r,e),tn(e),l&4&&(ts(3,e,e.return),Pa(3,e),ts(5,e,e.return));break;case 1:en(r,e),tn(e),l&512&&(jt||a===null||nr(a,a.return)),l&64&&Sr&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var u=Gn;if(en(r,e),tn(e),l&512&&(jt||a===null||nr(a,a.return)),l&4){var p=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":p=u.getElementsByTagName("title")[0],(!p||p[Tt]||p[nt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=u.createElement(l),u.head.insertBefore(p,u.querySelector("head > title"))),It(p,l,a),p[nt]=e,q(p),l=p;break e;case"link":var w=ig("link","href",u).get(l+(a.href||""));if(w){for(var E=0;E<w.length;E++)if(p=w[E],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(E,1);break t}}p=u.createElement(l),It(p,l,a),u.head.appendChild(p);break;case"meta":if(w=ig("meta","content",u).get(l+(a.content||""))){for(E=0;E<w.length;E++)if(p=w[E],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(E,1);break t}}p=u.createElement(l),It(p,l,a),u.head.appendChild(p);break;default:throw Error(i(468,l))}p[nt]=e,q(p),l=p}e.stateNode=l}else ag(u,e.type,e.stateNode);else e.stateNode=sg(u,l,e.memoizedProps);else p!==l?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,l===null?ag(u,e.type,e.stateNode):sg(u,l,e.memoizedProps)):l===null&&e.stateNode!==null&&rh(e,e.memoizedProps,a.memoizedProps)}break;case 27:en(r,e),tn(e),l&512&&(jt||a===null||nr(a,a.return)),a!==null&&l&4&&rh(e,e.memoizedProps,a.memoizedProps);break;case 5:if(en(r,e),tn(e),l&512&&(jt||a===null||nr(a,a.return)),e.flags&32){u=e.stateNode;try{li(u,"")}catch(ge){Xe(e,e.return,ge)}}l&4&&e.stateNode!=null&&(u=e.memoizedProps,rh(e,u,a!==null?a.memoizedProps:u)),l&1024&&(ah=!0);break;case 6:if(en(r,e),tn(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ge){Xe(e,e.return,ge)}}break;case 3:if(Gl=null,u=Gn,Gn=Hl(r.containerInfo),en(r,e),Gn=u,tn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ui(r.containerInfo)}catch(ge){Xe(e,e.return,ge)}ah&&(ah=!1,ay(e));break;case 4:l=Gn,Gn=Hl(e.stateNode.containerInfo),en(r,e),tn(e),Gn=l;break;case 12:en(r,e),tn(e);break;case 31:en(r,e),tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Nl(e,l)));break;case 13:en(r,e),tn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Cl=ct()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Nl(e,l)));break;case 22:u=e.memoizedState!==null;var M=a!==null&&a.memoizedState!==null,G=Sr,W=jt;if(Sr=G||u,jt=W||M,en(r,e),jt=W,Sr=G,tn(e),l&8192)e:for(r=e.stateNode,r._visibility=u?r._visibility&-2:r._visibility|1,u&&(a===null||M||Sr||jt||Vs(e)),a=null,r=e;;){if(r.tag===5||r.tag===26){if(a===null){M=a=r;try{if(p=M.stateNode,u)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{E=M.stateNode;var ie=M.memoizedProps.style,V=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;E.style.display=V==null||typeof V=="boolean"?"":(""+V).trim()}}catch(ge){Xe(M,M.return,ge)}}}else if(r.tag===6){if(a===null){M=r;try{M.stateNode.nodeValue=u?"":M.memoizedProps}catch(ge){Xe(M,M.return,ge)}}}else if(r.tag===18){if(a===null){M=r;try{var Q=M.stateNode;u?Jy(Q,!0):Jy(M.stateNode,!1)}catch(ge){Xe(M,M.return,ge)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===e)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break e;for(;r.sibling===null;){if(r.return===null||r.return===e)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Nl(e,a))));break;case 19:en(r,e),tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Nl(e,l)));break;case 30:break;case 21:break;default:en(r,e),tn(e)}}function tn(e){var r=e.flags;if(r&2){try{for(var a,l=e.return;l!==null;){if(Xp(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var u=a.stateNode,p=sh(e);kl(e,p,u);break;case 5:var w=a.stateNode;a.flags&32&&(li(w,""),a.flags&=-33);var E=sh(e);kl(e,E,w);break;case 3:case 4:var M=a.stateNode.containerInfo,G=sh(e);ih(e,G,M);break;default:throw Error(i(161))}}catch(W){Xe(e,e.return,W)}e.flags&=-3}r&4096&&(e.flags&=-4097)}function ay(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var r=e;ay(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),e=e.sibling}}function Or(e,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)ey(e,r.alternate,r),r=r.sibling}function Vs(e){for(e=e.child;e!==null;){var r=e;switch(r.tag){case 0:case 11:case 14:case 15:ts(4,r,r.return),Vs(r);break;case 1:nr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&Jp(r,r.return,a),Vs(r);break;case 27:Ka(r.stateNode);case 26:case 5:nr(r,r.return),Vs(r);break;case 22:r.memoizedState===null&&Vs(r);break;case 30:Vs(r);break;default:Vs(r)}e=e.sibling}}function Ar(e,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,u=e,p=r,w=p.flags;switch(p.tag){case 0:case 11:case 15:Ar(u,p,a),Pa(4,p);break;case 1:if(Ar(u,p,a),l=p,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(G){Xe(l,l.return,G)}if(l=p,u=l.updateQueue,u!==null){var E=l.stateNode;try{var M=u.shared.hiddenCallbacks;if(M!==null)for(u.shared.hiddenCallbacks=null,u=0;u<M.length;u++)B0(M[u],E)}catch(G){Xe(l,l.return,G)}}a&&w&64&&Kp(p),Ua(p,p.return);break;case 27:Wp(p);case 26:case 5:Ar(u,p,a),a&&l===null&&w&4&&Qp(p),Ua(p,p.return);break;case 12:Ar(u,p,a);break;case 31:Ar(u,p,a),a&&w&4&&ry(u,p);break;case 13:Ar(u,p,a),a&&w&4&&sy(u,p);break;case 22:p.memoizedState===null&&Ar(u,p,a),Ua(p,p.return);break;case 30:break;default:Ar(u,p,a)}r=r.sibling}}function oh(e,r){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(e=r.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Oa(a))}function lh(e,r){e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&Oa(e))}function Vn(e,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)oy(e,r,a,l),r=r.sibling}function oy(e,r,a,l){var u=r.flags;switch(r.tag){case 0:case 11:case 15:Vn(e,r,a,l),u&2048&&Pa(9,r);break;case 1:Vn(e,r,a,l);break;case 3:Vn(e,r,a,l),u&2048&&(e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&Oa(e)));break;case 12:if(u&2048){Vn(e,r,a,l),e=r.stateNode;try{var p=r.memoizedProps,w=p.id,E=p.onPostCommit;typeof E=="function"&&E(w,r.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){Xe(r,r.return,M)}}else Vn(e,r,a,l);break;case 31:Vn(e,r,a,l);break;case 13:Vn(e,r,a,l);break;case 23:break;case 22:p=r.stateNode,w=r.alternate,r.memoizedState!==null?p._visibility&2?Vn(e,r,a,l):za(e,r):p._visibility&2?Vn(e,r,a,l):(p._visibility|=2,ki(e,r,a,l,(r.subtreeFlags&10256)!==0||!1)),u&2048&&oh(w,r);break;case 24:Vn(e,r,a,l),u&2048&&lh(r.alternate,r);break;default:Vn(e,r,a,l)}}function ki(e,r,a,l,u){for(u=u&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var p=e,w=r,E=a,M=l,G=w.flags;switch(w.tag){case 0:case 11:case 15:ki(p,w,E,M,u),Pa(8,w);break;case 23:break;case 22:var W=w.stateNode;w.memoizedState!==null?W._visibility&2?ki(p,w,E,M,u):za(p,w):(W._visibility|=2,ki(p,w,E,M,u)),u&&G&2048&&oh(w.alternate,w);break;case 24:ki(p,w,E,M,u),u&&G&2048&&lh(w.alternate,w);break;default:ki(p,w,E,M,u)}r=r.sibling}}function za(e,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=e,l=r,u=l.flags;switch(l.tag){case 22:za(a,l),u&2048&&oh(l.alternate,l);break;case 24:za(a,l),u&2048&&lh(l.alternate,l);break;default:za(a,l)}r=r.sibling}}var Ia=8192;function Ni(e,r,a){if(e.subtreeFlags&Ia)for(e=e.child;e!==null;)ly(e,r,a),e=e.sibling}function ly(e,r,a){switch(e.tag){case 26:Ni(e,r,a),e.flags&Ia&&e.memoizedState!==null&&Lw(a,Gn,e.memoizedState,e.memoizedProps);break;case 5:Ni(e,r,a);break;case 3:case 4:var l=Gn;Gn=Hl(e.stateNode.containerInfo),Ni(e,r,a),Gn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Ia,Ia=16777216,Ni(e,r,a),Ia=l):Ni(e,r,a));break;default:Ni(e,r,a)}}function cy(e){var r=e.alternate;if(r!==null&&(e=r.child,e!==null)){r.child=null;do r=e.sibling,e.sibling=null,e=r;while(e!==null)}}function $a(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Rt=l,fy(l,e)}cy(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)uy(e),e=e.sibling}function uy(e){switch(e.tag){case 0:case 11:case 15:$a(e),e.flags&2048&&ts(9,e,e.return);break;case 3:$a(e);break;case 12:$a(e);break;case 22:var r=e.stateNode;e.memoizedState!==null&&r._visibility&2&&(e.return===null||e.return.tag!==13)?(r._visibility&=-3,Tl(e)):$a(e);break;default:$a(e)}}function Tl(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Rt=l,fy(l,e)}cy(e)}for(e=e.child;e!==null;){switch(r=e,r.tag){case 0:case 11:case 15:ts(8,r,r.return),Tl(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Tl(r));break;default:Tl(r)}e=e.sibling}}function fy(e,r){for(;Rt!==null;){var a=Rt;switch(a.tag){case 0:case 11:case 15:ts(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Oa(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Rt=l;else e:for(a=e;Rt!==null;){l=Rt;var u=l.sibling,p=l.return;if(ty(l),l===a){Rt=null;break e}if(u!==null){u.return=p,Rt=u;break e}Rt=p}}}var X_={getCacheForType:function(e){var r=Ut(Et),a=r.data.get(e);return a===void 0&&(a=e(),r.data.set(e,a)),a},cacheSignal:function(){return Ut(Et).controller.signal}},W_=typeof WeakMap=="function"?WeakMap:Map,Ke=0,rt=null,De=null,Le=0,Qe=0,hn=null,ns=!1,Ti=!1,ch=!1,jr=0,pt=0,rs=0,Ys=0,uh=0,dn=0,Ci=0,Ha=null,nn=null,fh=!1,Cl=0,hy=0,Ml=1/0,Rl=null,ss=null,Ct=0,is=null,Mi=null,kr=0,hh=0,dh=null,dy=null,Fa=0,mh=null;function mn(){return(Ke&2)!==0&&Le!==0?Le&-Le:H.T!==null?vh():ha()}function my(){if(dn===0)if((Le&536870912)===0||ze){var e=ur;ur<<=1,(ur&3932160)===0&&(ur=262144),dn=e}else dn=536870912;return e=un.current,e!==null&&(e.flags|=32),dn}function rn(e,r,a){(e===rt&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)&&(Ri(e,0),as(e,Le,dn,!1)),$n(e,a),((Ke&2)===0||e!==rt)&&(e===rt&&((Ke&2)===0&&(Ys|=a),pt===4&&as(e,Le,dn,!1)),rr(e))}function py(e,r,a){if((Ke&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&e.expiredLanes)===0||ks(e,r),u=l?tw(e,r):yh(e,r,!0),p=l;do{if(u===0){Ti&&!l&&as(e,r,0,!1);break}else{if(a=e.current.alternate,p&&!Z_(a)){u=yh(e,r,!1),p=!1;continue}if(u===2){if(p=r,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var E=e;u=Ha;var M=E.current.memoizedState.isDehydrated;if(M&&(Ri(E,w).flags|=256),w=yh(E,w,!1),w!==2){if(ch&&!M){E.errorRecoveryDisabledLanes|=p,Ys|=p,u=4;break e}p=nn,nn=u,p!==null&&(nn===null?nn=p:nn.push.apply(nn,p))}u=w}if(p=!1,u!==2)continue}}if(u===1){Ri(e,0),as(e,r,0,!0);break}e:{switch(l=e,p=u,p){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:as(l,r,dn,!ns);break e;case 2:nn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(u=Cl+300-ct(),10<u)){if(as(l,r,dn,!ns),js(l,0,!0)!==0)break e;kr=r,l.timeoutHandle=Vy(yy.bind(null,l,a,nn,Rl,fh,r,dn,Ys,Ci,ns,p,"Throttled",-0,0),u);break e}yy(l,a,nn,Rl,fh,r,dn,Ys,Ci,ns,p,null,-0,0)}}break}while(!0);rr(e)}function yy(e,r,a,l,u,p,w,E,M,G,W,ie,V,Q){if(e.timeoutHandle=-1,ie=r.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:dr},ly(r,p,ie);var ge=(p&62914560)===p?Cl-ct():(p&4194048)===p?hy-ct():0;if(ge=Bw(ie,ge),ge!==null){kr=p,e.cancelPendingCommit=ge(Ey.bind(null,e,r,p,a,l,u,w,E,M,W,ie,null,V,Q)),as(e,p,w,!G);return}}Ey(e,r,p,a,l,u,w,E,M)}function Z_(e){for(var r=e;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var u=a[l],p=u.getSnapshot;u=u.value;try{if(!ln(p(),u))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function as(e,r,a,l){r&=~uh,r&=~Ys,e.suspendedLanes|=r,e.pingedLanes&=~r,l&&(e.warmLanes|=r),l=e.expirationTimes;for(var u=r;0<u;){var p=31-Ht(u),w=1<<p;l[p]=-1,u&=~w}a!==0&&Hr(e,a,r)}function Dl(){return(Ke&6)===0?(Ga(0),!1):!0}function ph(){if(De!==null){if(Qe===0)var e=De.return;else e=De,gr=Ps=null,Cf(e),Si=null,ja=0,e=De;for(;e!==null;)Yp(e.alternate,e),e=e.return;De=null}}function Ri(e,r){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,xw(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),kr=0,ph(),rt=e,De=a=pr(e.current,null),Le=r,Qe=0,hn=null,ns=!1,Ti=ks(e,r),ch=!1,Ci=dn=uh=Ys=rs=pt=0,nn=Ha=null,fh=!1,(r&8)!==0&&(r|=r&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=r;0<l;){var u=31-Ht(l),p=1<<u;r|=e[u],l&=~p}return jr=r,tl(),a}function gy(e,r){Ce=null,H.H=qa,r===wi||r===cl?(r=R0(),Qe=3):r===xf?(r=R0(),Qe=4):Qe=r===Yf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,hn=r,De===null&&(pt=1,Sl(e,Cn(r,e.current)))}function by(){var e=un.current;return e===null?!0:(Le&4194048)===Le?qn===null:(Le&62914560)===Le||(Le&536870912)!==0?e===qn:!1}function xy(){var e=H.H;return H.H=qa,e===null?qa:e}function vy(){var e=H.A;return H.A=X_,e}function ql(){pt=4,ns||(Le&4194048)!==Le&&un.current!==null||(Ti=!0),(rs&134217727)===0&&(Ys&134217727)===0||rt===null||as(rt,Le,dn,!1)}function yh(e,r,a){var l=Ke;Ke|=2;var u=xy(),p=vy();(rt!==e||Le!==r)&&(Rl=null,Ri(e,r)),r=!1;var w=pt;e:do try{if(Qe!==0&&De!==null){var E=De,M=hn;switch(Qe){case 8:ph(),w=6;break e;case 3:case 2:case 9:case 6:un.current===null&&(r=!0);var G=Qe;if(Qe=0,hn=null,Di(e,E,M,G),a&&Ti){w=0;break e}break;default:G=Qe,Qe=0,hn=null,Di(e,E,M,G)}}ew(),w=pt;break}catch(W){gy(e,W)}while(!0);return r&&e.shellSuspendCounter++,gr=Ps=null,Ke=l,H.H=u,H.A=p,De===null&&(rt=null,Le=0,tl()),w}function ew(){for(;De!==null;)_y(De)}function tw(e,r){var a=Ke;Ke|=2;var l=xy(),u=vy();rt!==e||Le!==r?(Rl=null,Ml=ct()+500,Ri(e,r)):Ti=ks(e,r);e:do try{if(Qe!==0&&De!==null){r=De;var p=hn;t:switch(Qe){case 1:Qe=0,hn=null,Di(e,r,p,1);break;case 2:case 9:if(C0(p)){Qe=0,hn=null,wy(r);break}r=function(){Qe!==2&&Qe!==9||rt!==e||(Qe=7),rr(e)},p.then(r,r);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:C0(p)?(Qe=0,hn=null,wy(r)):(Qe=0,hn=null,Di(e,r,p,7));break;case 5:var w=null;switch(De.tag){case 26:w=De.memoizedState;case 5:case 27:var E=De;if(w?og(w):E.stateNode.complete){Qe=0,hn=null;var M=E.sibling;if(M!==null)De=M;else{var G=E.return;G!==null?(De=G,Ll(G)):De=null}break t}}Qe=0,hn=null,Di(e,r,p,5);break;case 6:Qe=0,hn=null,Di(e,r,p,6);break;case 8:ph(),pt=6;break e;default:throw Error(i(462))}}nw();break}catch(W){gy(e,W)}while(!0);return gr=Ps=null,H.H=l,H.A=u,Ke=a,De!==null?0:(rt=null,Le=0,tl(),pt)}function nw(){for(;De!==null&&!Po();)_y(De)}function _y(e){var r=Gp(e.alternate,e,jr);e.memoizedProps=e.pendingProps,r===null?Ll(e):De=r}function wy(e){var r=e,a=r.alternate;switch(r.tag){case 15:case 0:r=Up(a,r,r.pendingProps,r.type,void 0,Le);break;case 11:r=Up(a,r,r.pendingProps,r.type.render,r.ref,Le);break;case 5:Cf(r);default:Yp(a,r),r=De=v0(r,jr),r=Gp(a,r,jr)}e.memoizedProps=e.pendingProps,r===null?Ll(e):De=r}function Di(e,r,a,l){gr=Ps=null,Cf(r),Si=null,ja=0;var u=r.return;try{if(F_(e,u,r,a,Le)){pt=1,Sl(e,Cn(a,e.current)),De=null;return}}catch(p){if(u!==null)throw De=u,p;pt=1,Sl(e,Cn(a,e.current)),De=null;return}r.flags&32768?(ze||l===1?e=!0:Ti||(Le&536870912)!==0?e=!1:(ns=e=!0,(l===2||l===9||l===3||l===6)&&(l=un.current,l!==null&&l.tag===13&&(l.flags|=16384))),Sy(r,e)):Ll(r)}function Ll(e){var r=e;do{if((r.flags&32768)!==0){Sy(r,ns);return}e=r.return;var a=Y_(r.alternate,r,jr);if(a!==null){De=a;return}if(r=r.sibling,r!==null){De=r;return}De=r=e}while(r!==null);pt===0&&(pt=5)}function Sy(e,r){do{var a=K_(e.alternate,e);if(a!==null){a.flags&=32767,De=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);pt=6,De=null}function Ey(e,r,a,l,u,p,w,E,M){e.cancelPendingCommit=null;do Bl();while(Ct!==0);if((Ke&6)!==0)throw Error(i(327));if(r!==null){if(r===e.current)throw Error(i(177));if(p=r.lanes|r.childLanes,p|=rf,$r(e,a,p,w,E,M),e===rt&&(De=rt=null,Le=0),Mi=r,is=e,kr=a,hh=p,dh=u,dy=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,aw(ri,function(){return Ny(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,u=Z.p,Z.p=2,w=Ke,Ke|=4;try{J_(e,r,a)}finally{Ke=w,Z.p=u,H.T=l}}Ct=1,Oy(),Ay(),jy()}}function Oy(){if(Ct===1){Ct=0;var e=is,r=Mi,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var l=Z.p;Z.p=2;var u=Ke;Ke|=4;try{iy(r,e);var p=kh,w=f0(e.containerInfo),E=p.focusedElem,M=p.selectionRange;if(w!==E&&E&&E.ownerDocument&&u0(E.ownerDocument.documentElement,E)){if(M!==null&&Wu(E)){var G=M.start,W=M.end;if(W===void 0&&(W=G),"selectionStart"in E)E.selectionStart=G,E.selectionEnd=Math.min(W,E.value.length);else{var ie=E.ownerDocument||document,V=ie&&ie.defaultView||window;if(V.getSelection){var Q=V.getSelection(),ge=E.textContent.length,Ae=Math.min(M.start,ge),tt=M.end===void 0?Ae:Math.min(M.end,ge);!Q.extend&&Ae>tt&&(w=tt,tt=Ae,Ae=w);var z=c0(E,Ae),B=c0(E,tt);if(z&&B&&(Q.rangeCount!==1||Q.anchorNode!==z.node||Q.anchorOffset!==z.offset||Q.focusNode!==B.node||Q.focusOffset!==B.offset)){var F=ie.createRange();F.setStart(z.node,z.offset),Q.removeAllRanges(),Ae>tt?(Q.addRange(F),Q.extend(B.node,B.offset)):(F.setEnd(B.node,B.offset),Q.addRange(F))}}}}for(ie=[],Q=E;Q=Q.parentNode;)Q.nodeType===1&&ie.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ie.length;E++){var te=ie[E];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Jl=!!jh,kh=jh=null}finally{Ke=u,Z.p=l,H.T=a}}e.current=r,Ct=2}}function Ay(){if(Ct===2){Ct=0;var e=is,r=Mi,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var l=Z.p;Z.p=2;var u=Ke;Ke|=4;try{ey(e,r.alternate,r)}finally{Ke=u,Z.p=l,H.T=a}}Ct=3}}function jy(){if(Ct===4||Ct===3){Ct=0,ni();var e=is,r=Mi,a=kr,l=dy;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Ct=5:(Ct=0,Mi=is=null,ky(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(ss=null),Ts(a),r=r.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(As,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=H.T,u=Z.p,Z.p=2,H.T=null;try{for(var p=e.onRecoverableError,w=0;w<l.length;w++){var E=l[w];p(E.value,{componentStack:E.stack})}}finally{H.T=r,Z.p=u}}(kr&3)!==0&&Bl(),rr(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===mh?Fa++:(Fa=0,mh=e):Fa=0,Ga(0)}}function ky(e,r){(e.pooledCacheLanes&=r)===0&&(r=e.pooledCache,r!=null&&(e.pooledCache=null,Oa(r)))}function Bl(){return Oy(),Ay(),jy(),Ny()}function Ny(){if(Ct!==5)return!1;var e=is,r=hh;hh=0;var a=Ts(kr),l=H.T,u=Z.p;try{Z.p=32>a?32:a,H.T=null,a=dh,dh=null;var p=is,w=kr;if(Ct=0,Mi=is=null,kr=0,(Ke&6)!==0)throw Error(i(331));var E=Ke;if(Ke|=4,uy(p.current),oy(p,p.current,w,a),Ke=E,Ga(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(As,p)}catch{}return!0}finally{Z.p=u,H.T=l,ky(e,r)}}function Ty(e,r,a){r=Cn(a,r),r=Vf(e.stateNode,r,2),e=Wr(e,r,2),e!==null&&($n(e,2),rr(e))}function Xe(e,r,a){if(e.tag===3)Ty(e,e,a);else for(;r!==null;){if(r.tag===3){Ty(r,e,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ss===null||!ss.has(l))){e=Cn(a,e),a=Cp(2),l=Wr(r,a,2),l!==null&&(Mp(a,l,r,e),$n(l,2),rr(l));break}}r=r.return}}function gh(e,r,a){var l=e.pingCache;if(l===null){l=e.pingCache=new W_;var u=new Set;l.set(r,u)}else u=l.get(r),u===void 0&&(u=new Set,l.set(r,u));u.has(a)||(ch=!0,u.add(a),e=rw.bind(null,e,r,a),r.then(e,e))}function rw(e,r,a){var l=e.pingCache;l!==null&&l.delete(r),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,rt===e&&(Le&a)===a&&(pt===4||pt===3&&(Le&62914560)===Le&&300>ct()-Cl?(Ke&2)===0&&Ri(e,0):uh|=a,Ci===Le&&(Ci=0)),rr(e)}function Cy(e,r){r===0&&(r=ii()),e=qs(e,r),e!==null&&($n(e,r),rr(e))}function sw(e){var r=e.memoizedState,a=0;r!==null&&(a=r.retryLane),Cy(e,a)}function iw(e,r){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),Cy(e,a)}function aw(e,r){return la(e,r)}var Pl=null,qi=null,bh=!1,Ul=!1,xh=!1,os=0;function rr(e){e!==qi&&e.next===null&&(qi===null?Pl=qi=e:qi=qi.next=e),Ul=!0,bh||(bh=!0,lw())}function Ga(e,r){if(!xh&&Ul){xh=!0;do for(var a=!1,l=Pl;l!==null;){if(e!==0){var u=l.pendingLanes;if(u===0)var p=0;else{var w=l.suspendedLanes,E=l.pingedLanes;p=(1<<31-Ht(42|e)+1)-1,p&=u&~(w&~E),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,qy(l,p))}else p=Le,p=js(l,l===rt?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||ks(l,p)||(a=!0,qy(l,p));l=l.next}while(a);xh=!1}}function ow(){My()}function My(){Ul=bh=!1;var e=0;os!==0&&bw()&&(e=os);for(var r=ct(),a=null,l=Pl;l!==null;){var u=l.next,p=Ry(l,r);p===0?(l.next=null,a===null?Pl=u:a.next=u,u===null&&(qi=a)):(a=l,(e!==0||(p&3)!==0)&&(Ul=!0)),l=u}Ct!==0&&Ct!==5||Ga(e),os!==0&&(os=0)}function Ry(e,r){for(var a=e.suspendedLanes,l=e.pingedLanes,u=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-Ht(p),E=1<<w,M=u[w];M===-1?((E&a)===0||(E&l)!==0)&&(u[w]=fa(E,r)):M<=r&&(e.expiredLanes|=E),p&=~E}if(r=rt,a=Le,a=js(e,e===r?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===r&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&cr(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ks(e,a)){if(r=a&-a,r===e.callbackPriority)return r;switch(l!==null&&cr(l),Ts(a)){case 2:case 8:a=zo;break;case 32:a=ri;break;case 268435456:a=Io;break;default:a=ri}return l=Dy.bind(null,e),a=la(a,l),e.callbackPriority=r,e.callbackNode=a,r}return l!==null&&l!==null&&cr(l),e.callbackPriority=2,e.callbackNode=null,2}function Dy(e,r){if(Ct!==0&&Ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Bl()&&e.callbackNode!==a)return null;var l=Le;return l=js(e,e===rt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(py(e,l,r),Ry(e,ct()),e.callbackNode!=null&&e.callbackNode===a?Dy.bind(null,e):null)}function qy(e,r){if(Bl())return null;py(e,r,!0)}function lw(){vw(function(){(Ke&6)!==0?la(Uo,ow):My()})}function vh(){if(os===0){var e=vi;e===0&&(e=Ur,Ur<<=1,(Ur&261888)===0&&(Ur=256)),os=e}return os}function Ly(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Yo(""+e)}function By(e,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,e.id&&a.setAttribute("form",e.id),r.parentNode.insertBefore(a,r),e=new FormData(e),a.parentNode.removeChild(a),e}function cw(e,r,a,l,u){if(r==="submit"&&a&&a.stateNode===u){var p=Ly((u[dt]||null).action),w=l.submitter;w&&(r=(r=w[dt]||null)?Ly(r.formAction):w.getAttribute("formAction"),r!==null&&(p=r,w=null));var E=new Xo("action","action",null,l,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(os!==0){var M=w?By(u,w):new FormData(u);zf(a,{pending:!0,data:M,method:u.method,action:p},null,M)}}else typeof p=="function"&&(E.preventDefault(),M=w?By(u,w):new FormData(u),zf(a,{pending:!0,data:M,method:u.method,action:p},p,M))},currentTarget:u}]})}}for(var _h=0;_h<nf.length;_h++){var wh=nf[_h],uw=wh.toLowerCase(),fw=wh[0].toUpperCase()+wh.slice(1);Fn(uw,"on"+fw)}Fn(m0,"onAnimationEnd"),Fn(p0,"onAnimationIteration"),Fn(y0,"onAnimationStart"),Fn("dblclick","onDoubleClick"),Fn("focusin","onFocus"),Fn("focusout","onBlur"),Fn(j_,"onTransitionRun"),Fn(k_,"onTransitionStart"),Fn(N_,"onTransitionCancel"),Fn(g0,"onTransitionEnd"),Y("onMouseEnter",["mouseout","mouseover"]),Y("onMouseLeave",["mouseout","mouseover"]),Y("onPointerEnter",["pointerout","pointerover"]),Y("onPointerLeave",["pointerout","pointerover"]),ae("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ae("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ae("onBeforeInput",["compositionend","keypress","textInput","paste"]),ae("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ae("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ae("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Va="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(" "),hw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Va));function Py(e,r){r=(r&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],u=l.event;l=l.listeners;e:{var p=void 0;if(r)for(var w=l.length-1;0<=w;w--){var E=l[w],M=E.instance,G=E.currentTarget;if(E=E.listener,M!==p&&u.isPropagationStopped())break e;p=E,u.currentTarget=G;try{p(u)}catch(W){el(W)}u.currentTarget=null,p=M}else for(w=0;w<l.length;w++){if(E=l[w],M=E.instance,G=E.currentTarget,E=E.listener,M!==p&&u.isPropagationStopped())break e;p=E,u.currentTarget=G;try{p(u)}catch(W){el(W)}u.currentTarget=null,p=M}}}}function qe(e,r){var a=r[Cs];a===void 0&&(a=r[Cs]=new Set);var l=e+"__bubble";a.has(l)||(Uy(r,e,2,!1),a.add(l))}function Sh(e,r,a){var l=0;r&&(l|=4),Uy(a,e,l,r)}var zl="_reactListening"+Math.random().toString(36).slice(2);function Eh(e){if(!e[zl]){e[zl]=!0,I.forEach(function(a){a!=="selectionchange"&&(hw.has(a)||Sh(a,!1,e),Sh(a,!0,e))});var r=e.nodeType===9?e:e.ownerDocument;r===null||r[zl]||(r[zl]=!0,Sh("selectionchange",!1,r))}}function Uy(e,r,a,l){switch(mg(r)){case 2:var u=zw;break;case 8:u=Iw;break;default:u=Uh}a=u.bind(null,r,a,e),u=void 0,!Hu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(u=!0),l?u!==void 0?e.addEventListener(r,a,{capture:!0,passive:u}):e.addEventListener(r,a,!0):u!==void 0?e.addEventListener(r,a,{passive:u}):e.addEventListener(r,a,!1)}function Oh(e,r,a,l,u){var p=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var w=l.tag;if(w===3||w===4){var E=l.stateNode.containerInfo;if(E===u)break;if(w===4)for(w=l.return;w!==null;){var M=w.tag;if((M===3||M===4)&&w.stateNode.containerInfo===u)return;w=w.return}for(;E!==null;){if(w=A(E),w===null)return;if(M=w.tag,M===5||M===6||M===26||M===27){l=p=w;continue e}E=E.parentNode}}l=l.return}Fm(function(){var G=p,W=Iu(a),ie=[];e:{var V=b0.get(e);if(V!==void 0){var Q=Xo,ge=e;switch(e){case"keypress":if(Jo(a)===0)break e;case"keydown":case"keyup":Q=i_;break;case"focusin":ge="focus",Q=Yu;break;case"focusout":ge="blur",Q=Yu;break;case"beforeblur":case"afterblur":Q=Yu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Ym;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=Yv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=l_;break;case m0:case p0:case y0:Q=Qv;break;case g0:Q=u_;break;case"scroll":case"scrollend":Q=Gv;break;case"wheel":Q=h_;break;case"copy":case"cut":case"paste":Q=Wv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Jm;break;case"toggle":case"beforetoggle":Q=m_}var Ae=(r&4)!==0,tt=!Ae&&(e==="scroll"||e==="scrollend"),z=Ae?V!==null?V+"Capture":null:V;Ae=[];for(var B=G,F;B!==null;){var te=B;if(F=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||F===null||z===null||(te=ma(B,z),te!=null&&Ae.push(Ya(B,te,F))),tt)break;B=B.return}0<Ae.length&&(V=new Q(V,ge,null,a,W),ie.push({event:V,listeners:Ae}))}}if((r&7)===0){e:{if(V=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",V&&a!==zu&&(ge=a.relatedTarget||a.fromElement)&&(A(ge)||ge[on]))break e;if((Q||V)&&(V=W.window===W?W:(V=W.ownerDocument)?V.defaultView||V.parentWindow:window,Q?(ge=a.relatedTarget||a.toElement,Q=G,ge=ge?A(ge):null,ge!==null&&(tt=c(ge),Ae=ge.tag,ge!==tt||Ae!==5&&Ae!==27&&Ae!==6)&&(ge=null)):(Q=null,ge=G),Q!==ge)){if(Ae=Ym,te="onMouseLeave",z="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Ae=Jm,te="onPointerLeave",z="onPointerEnter",B="pointer"),tt=Q==null?V:k(Q),F=ge==null?V:k(ge),V=new Ae(te,B+"leave",Q,a,W),V.target=tt,V.relatedTarget=F,te=null,A(W)===G&&(Ae=new Ae(z,B+"enter",ge,a,W),Ae.target=F,Ae.relatedTarget=tt,te=Ae),tt=te,Q&&ge)t:{for(Ae=dw,z=Q,B=ge,F=0,te=z;te;te=Ae(te))F++;te=0;for(var Ee=B;Ee;Ee=Ae(Ee))te++;for(;0<F-te;)z=Ae(z),F--;for(;0<te-F;)B=Ae(B),te--;for(;F--;){if(z===B||B!==null&&z===B.alternate){Ae=z;break t}z=Ae(z),B=Ae(B)}Ae=null}else Ae=null;Q!==null&&zy(ie,V,Q,Ae,!1),ge!==null&&tt!==null&&zy(ie,tt,ge,Ae,!0)}}e:{if(V=G?k(G):window,Q=V.nodeName&&V.nodeName.toLowerCase(),Q==="select"||Q==="input"&&V.type==="file")var Ve=r0;else if(t0(V))if(s0)Ve=E_;else{Ve=w_;var xe=__}else Q=V.nodeName,!Q||Q.toLowerCase()!=="input"||V.type!=="checkbox"&&V.type!=="radio"?G&&Uu(G.elementType)&&(Ve=r0):Ve=S_;if(Ve&&(Ve=Ve(e,G))){n0(ie,Ve,a,W);break e}xe&&xe(e,V,G),e==="focusout"&&G&&V.type==="number"&&G.memoizedProps.value!=null&&Pu(V,"number",V.value)}switch(xe=G?k(G):window,e){case"focusin":(t0(xe)||xe.contentEditable==="true")&&(hi=xe,Zu=G,wa=null);break;case"focusout":wa=Zu=hi=null;break;case"mousedown":ef=!0;break;case"contextmenu":case"mouseup":case"dragend":ef=!1,h0(ie,a,W);break;case"selectionchange":if(A_)break;case"keydown":case"keyup":h0(ie,a,W)}var Me;if(Ju)e:{switch(e){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else fi?Zm(e,a)&&(Be="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Be="onCompositionStart");Be&&(Qm&&a.locale!=="ko"&&(fi||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&fi&&(Me=Gm()):(Gr=W,Fu="value"in Gr?Gr.value:Gr.textContent,fi=!0)),xe=Il(G,Be),0<xe.length&&(Be=new Km(Be,e,null,a,W),ie.push({event:Be,listeners:xe}),Me?Be.data=Me:(Me=e0(a),Me!==null&&(Be.data=Me)))),(Me=y_?g_(e,a):b_(e,a))&&(Be=Il(G,"onBeforeInput"),0<Be.length&&(xe=new Km("onBeforeInput","beforeinput",null,a,W),ie.push({event:xe,listeners:Be}),xe.data=Me)),cw(ie,e,G,a,W)}Py(ie,r)})}function Ya(e,r,a){return{instance:e,listener:r,currentTarget:a}}function Il(e,r){for(var a=r+"Capture",l=[];e!==null;){var u=e,p=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||p===null||(u=ma(e,a),u!=null&&l.unshift(Ya(e,u,p)),u=ma(e,r),u!=null&&l.push(Ya(e,u,p))),e.tag===3)return l;e=e.return}return[]}function dw(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function zy(e,r,a,l,u){for(var p=r._reactName,w=[];a!==null&&a!==l;){var E=a,M=E.alternate,G=E.stateNode;if(E=E.tag,M!==null&&M===l)break;E!==5&&E!==26&&E!==27||G===null||(M=G,u?(G=ma(a,p),G!=null&&w.unshift(Ya(a,G,M))):u||(G=ma(a,p),G!=null&&w.push(Ya(a,G,M)))),a=a.return}w.length!==0&&e.push({event:r,listeners:w})}var mw=/\r\n?/g,pw=/\u0000|\uFFFD/g;function Iy(e){return(typeof e=="string"?e:""+e).replace(mw,`
|
|
26
|
+
`).replace(pw,"")}function $y(e,r){return r=Iy(r),Iy(e)===r}function et(e,r,a,l,u,p){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||li(e,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&li(e,""+l);break;case"className":Hn(e,"class",l);break;case"tabIndex":Hn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Hn(e,a,l);break;case"style":$m(e,l,p);break;case"data":if(r!=="object"){Hn(e,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Yo(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(r!=="input"&&et(e,r,"name",u.name,u,null),et(e,r,"formEncType",u.formEncType,u,null),et(e,r,"formMethod",u.formMethod,u,null),et(e,r,"formTarget",u.formTarget,u,null)):(et(e,r,"encType",u.encType,u,null),et(e,r,"method",u.method,u,null),et(e,r,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Yo(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=dr);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}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}a=Yo(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Ft(e,"popover",l);break;case"xlinkActuate":hr(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":hr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":hr(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":hr(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":hr(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":hr(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":hr(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":hr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":hr(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ft(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Hv.get(a)||a,Ft(e,a,l))}}function Ah(e,r,a,l,u,p){switch(a){case"style":$m(e,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof l=="string"?li(e,l):(typeof l=="number"||typeof l=="bigint")&&li(e,""+l);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=dr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!se.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),r=a.slice(2,u?a.length-7:void 0),p=e[dt]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(r,p,u),typeof l=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(r,l,u);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Ft(e,a,l)}}}function It(e,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var l=!1,u=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:et(e,r,p,w,a,null)}}u&&et(e,r,"srcSet",a.srcSet,a,null),l&&et(e,r,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=p=w=u=null,M=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var W=a[l];if(W!=null)switch(l){case"name":u=W;break;case"type":w=W;break;case"checked":M=W;break;case"defaultChecked":G=W;break;case"value":p=W;break;case"defaultValue":E=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(i(137,r));break;default:et(e,r,l,W,a,null)}}Pm(e,p,E,M,G,w,u,!1);return;case"select":qe("invalid",e),l=w=p=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":p=E;break;case"defaultValue":w=E;break;case"multiple":l=E;default:et(e,r,u,E,a,null)}r=p,a=w,e.multiple=!!l,r!=null?oi(e,!!l,r,!1):a!=null&&oi(e,!!l,a,!0);return;case"textarea":qe("invalid",e),p=u=l=null;for(w in a)if(a.hasOwnProperty(w)&&(E=a[w],E!=null))switch(w){case"value":l=E;break;case"defaultValue":u=E;break;case"children":p=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:et(e,r,w,E,a,null)}zm(e,l,u,p);return;case"option":for(M in a)if(a.hasOwnProperty(M)&&(l=a[M],l!=null))switch(M){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:et(e,r,M,l,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(l=0;l<Va.length;l++)qe(Va[l],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(l=a[G],l!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:et(e,r,G,l,a,null)}return;default:if(Uu(r)){for(W in a)a.hasOwnProperty(W)&&(l=a[W],l!==void 0&&Ah(e,r,W,l,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(l=a[E],l!=null&&et(e,r,E,l,a,null))}function yw(e,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,p=null,w=null,E=null,M=null,G=null,W=null;for(Q in a){var ie=a[Q];if(a.hasOwnProperty(Q)&&ie!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":M=ie;default:l.hasOwnProperty(Q)||et(e,r,Q,null,l,ie)}}for(var V in l){var Q=l[V];if(ie=a[V],l.hasOwnProperty(V)&&(Q!=null||ie!=null))switch(V){case"type":p=Q;break;case"name":u=Q;break;case"checked":G=Q;break;case"defaultChecked":W=Q;break;case"value":w=Q;break;case"defaultValue":E=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,r));break;default:Q!==ie&&et(e,r,V,Q,l,ie)}}Bu(e,w,E,M,G,W,p,u);return;case"select":Q=w=E=V=null;for(p in a)if(M=a[p],a.hasOwnProperty(p)&&M!=null)switch(p){case"value":break;case"multiple":Q=M;default:l.hasOwnProperty(p)||et(e,r,p,null,l,M)}for(u in l)if(p=l[u],M=a[u],l.hasOwnProperty(u)&&(p!=null||M!=null))switch(u){case"value":V=p;break;case"defaultValue":E=p;break;case"multiple":w=p;default:p!==M&&et(e,r,u,p,l,M)}r=E,a=w,l=Q,V!=null?oi(e,!!a,V,!1):!!l!=!!a&&(r!=null?oi(e,!!a,r,!0):oi(e,!!a,a?[]:"",!1));return;case"textarea":Q=V=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!l.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:et(e,r,E,null,l,u)}for(w in l)if(u=l[w],p=a[w],l.hasOwnProperty(w)&&(u!=null||p!=null))switch(w){case"value":V=u;break;case"defaultValue":Q=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(i(91));break;default:u!==p&&et(e,r,w,u,l,p)}Um(e,V,Q);return;case"option":for(var ge in a)if(V=a[ge],a.hasOwnProperty(ge)&&V!=null&&!l.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:et(e,r,ge,null,l,V)}for(M in l)if(V=l[M],Q=a[M],l.hasOwnProperty(M)&&V!==Q&&(V!=null||Q!=null))switch(M){case"selected":e.selected=V&&typeof V!="function"&&typeof V!="symbol";break;default:et(e,r,M,V,l,Q)}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 Ae in a)V=a[Ae],a.hasOwnProperty(Ae)&&V!=null&&!l.hasOwnProperty(Ae)&&et(e,r,Ae,null,l,V);for(G in l)if(V=l[G],Q=a[G],l.hasOwnProperty(G)&&V!==Q&&(V!=null||Q!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(i(137,r));break;default:et(e,r,G,V,l,Q)}return;default:if(Uu(r)){for(var tt in a)V=a[tt],a.hasOwnProperty(tt)&&V!==void 0&&!l.hasOwnProperty(tt)&&Ah(e,r,tt,void 0,l,V);for(W in l)V=l[W],Q=a[W],!l.hasOwnProperty(W)||V===Q||V===void 0&&Q===void 0||Ah(e,r,W,V,l,Q);return}}for(var z in a)V=a[z],a.hasOwnProperty(z)&&V!=null&&!l.hasOwnProperty(z)&&et(e,r,z,null,l,V);for(ie in l)V=l[ie],Q=a[ie],!l.hasOwnProperty(ie)||V===Q||V==null&&Q==null||et(e,r,ie,V,l,Q)}function Hy(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var u=a[l],p=u.transferSize,w=u.initiatorType,E=u.duration;if(p&&E&&Hy(w)){for(w=0,E=u.responseEnd,l+=1;l<a.length;l++){var M=a[l],G=M.startTime;if(G>E)break;var W=M.transferSize,ie=M.initiatorType;W&&Hy(ie)&&(M=M.responseEnd,w+=W*(M<E?1:(E-G)/(M-G)))}if(--l,r+=8*(p+w)/(u.duration/1e3),e++,10<e)break}}if(0<e)return r/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var jh=null,kh=null;function $l(e){return e.nodeType===9?e:e.ownerDocument}function Fy(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 Gy(e,r){if(e===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&r==="foreignObject"?0:e}function Nh(e,r){return e==="textarea"||e==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Th=null;function bw(){var e=window.event;return e&&e.type==="popstate"?e===Th?!1:(Th=e,!0):(Th=null,!1)}var Vy=typeof setTimeout=="function"?setTimeout:void 0,xw=typeof clearTimeout=="function"?clearTimeout:void 0,Yy=typeof Promise=="function"?Promise:void 0,vw=typeof queueMicrotask=="function"?queueMicrotask:typeof Yy<"u"?function(e){return Yy.resolve(null).then(e).catch(_w)}:Vy;function _w(e){setTimeout(function(){throw e})}function ls(e){return e==="head"}function Ky(e,r){var a=r,l=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(u),Ui(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Ka(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ka(a);for(var p=a.firstChild;p;){var w=p.nextSibling,E=p.nodeName;p[Tt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&Ka(e.ownerDocument.body);a=u}while(a);Ui(r)}function Jy(e,r){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Ch(e){var r=e.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Ch(a),ai(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function ww(e,r,a,l){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Tt])switch(r){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(r==="input"&&e.type==="hidden"){var p=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=Ln(e.nextSibling),e===null)break}return null}function Sw(e,r,a){if(r==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Ln(e.nextSibling),e===null))return null;return e}function Qy(e,r){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Ln(e.nextSibling),e===null))return null;return e}function Mh(e){return e.data==="$?"||e.data==="$~"}function Rh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ew(e,r){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=r;else if(e.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Ln(e){for(;e!=null;e=e.nextSibling){var r=e.nodeType;if(r===1||r===3)break;if(r===8){if(r=e.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return e}var Dh=null;function Xy(e){e=e.nextSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(r===0)return Ln(e.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}e=e.nextSibling}return null}function Wy(e){e=e.previousSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return e;r--}else a!=="/$"&&a!=="/&"||r++}e=e.previousSibling}return null}function Zy(e,r,a){switch(r=$l(a),e){case"html":if(e=r.documentElement,!e)throw Error(i(452));return e;case"head":if(e=r.head,!e)throw Error(i(453));return e;case"body":if(e=r.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Ka(e){for(var r=e.attributes;r.length;)e.removeAttributeNode(r[0]);ai(e)}var Bn=new Map,eg=new Set;function Hl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Nr=Z.d;Z.d={f:Ow,r:Aw,D:jw,C:kw,L:Nw,m:Tw,X:Mw,S:Cw,M:Rw};function Ow(){var e=Nr.f(),r=Dl();return e||r}function Aw(e){var r=N(e);r!==null&&r.tag===5&&r.type==="form"?gp(r):Nr.r(e)}var Li=typeof document>"u"?null:document;function tg(e,r,a){var l=Li;if(l&&typeof r=="string"&&r){var u=Nn(r);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),eg.has(u)||(eg.add(u),e={rel:e,crossOrigin:a,href:r},l.querySelector(u)===null&&(r=l.createElement("link"),It(r,"link",e),q(r),l.head.appendChild(r)))}}function jw(e){Nr.D(e),tg("dns-prefetch",e,null)}function kw(e,r){Nr.C(e,r),tg("preconnect",e,r)}function Nw(e,r,a){Nr.L(e,r,a);var l=Li;if(l&&e&&r){var u='link[rel="preload"][as="'+Nn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Nn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Nn(a.imageSizes)+'"]')):u+='[href="'+Nn(e)+'"]';var p=u;switch(r){case"style":p=Bi(e);break;case"script":p=Pi(e)}Bn.has(p)||(e=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:e,as:r},a),Bn.set(p,e),l.querySelector(u)!==null||r==="style"&&l.querySelector(Ja(p))||r==="script"&&l.querySelector(Qa(p))||(r=l.createElement("link"),It(r,"link",e),q(r),l.head.appendChild(r)))}}function Tw(e,r){Nr.m(e,r);var a=Li;if(a&&e){var l=r&&typeof r.as=="string"?r.as:"script",u='link[rel="modulepreload"][as="'+Nn(l)+'"][href="'+Nn(e)+'"]',p=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Pi(e)}if(!Bn.has(p)&&(e=b({rel:"modulepreload",href:e},r),Bn.set(p,e),a.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Qa(p)))return}l=a.createElement("link"),It(l,"link",e),q(l),a.head.appendChild(l)}}}function Cw(e,r,a){Nr.S(e,r,a);var l=Li;if(l&&e){var u=T(l).hoistableStyles,p=Bi(e);r=r||"default";var w=u.get(p);if(!w){var E={loading:0,preload:null};if(w=l.querySelector(Ja(p)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":r},a),(a=Bn.get(p))&&qh(e,a);var M=w=l.createElement("link");q(M),It(M,"link",e),M._p=new Promise(function(G,W){M.onload=G,M.onerror=W}),M.addEventListener("load",function(){E.loading|=1}),M.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Fl(w,r,l)}w={type:"stylesheet",instance:w,count:1,state:E},u.set(p,w)}}}function Mw(e,r){Nr.X(e,r);var a=Li;if(a&&e){var l=T(a).hoistableScripts,u=Pi(e),p=l.get(u);p||(p=a.querySelector(Qa(u)),p||(e=b({src:e,async:!0},r),(r=Bn.get(u))&&Lh(e,r),p=a.createElement("script"),q(p),It(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(u,p))}}function Rw(e,r){Nr.M(e,r);var a=Li;if(a&&e){var l=T(a).hoistableScripts,u=Pi(e),p=l.get(u);p||(p=a.querySelector(Qa(u)),p||(e=b({src:e,async:!0,type:"module"},r),(r=Bn.get(u))&&Lh(e,r),p=a.createElement("script"),q(p),It(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(u,p))}}function ng(e,r,a,l){var u=(u=Bt.current)?Hl(u):null;if(!u)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Bi(a.href),a=T(u).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Bi(a.href);var p=T(u).hoistableStyles,w=p.get(e);if(w||(u=u.ownerDocument||u,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=u.querySelector(Ja(e)))&&!p._p&&(w.instance=p,w.state.loading=5),Bn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Bn.set(e,a),p||Dw(u,e,a,w.state))),r&&l===null)throw Error(i(528,""));return w}if(r&&l!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Pi(a),a=T(u).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Bi(e){return'href="'+Nn(e)+'"'}function Ja(e){return'link[rel="stylesheet"]['+e+"]"}function rg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Dw(e,r,a,l){e.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=e.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),It(r,"link",a),q(r),e.head.appendChild(r))}function Pi(e){return'[src="'+Nn(e)+'"]'}function Qa(e){return"script[async]"+e}function sg(e,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=e.querySelector('style[data-href~="'+Nn(a.href)+'"]');if(l)return r.instance=l,q(l),l;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),q(l),It(l,"style",u),Fl(l,a.precedence,e),r.instance=l;case"stylesheet":u=Bi(a.href);var p=e.querySelector(Ja(u));if(p)return r.state.loading|=4,r.instance=p,q(p),p;l=rg(a),(u=Bn.get(u))&&qh(l,u),p=(e.ownerDocument||e).createElement("link"),q(p);var w=p;return w._p=new Promise(function(E,M){w.onload=E,w.onerror=M}),It(p,"link",l),r.state.loading|=4,Fl(p,a.precedence,e),r.instance=p;case"script":return p=Pi(a.src),(u=e.querySelector(Qa(p)))?(r.instance=u,q(u),u):(l=a,(u=Bn.get(p))&&(l=b({},a),Lh(l,u)),e=e.ownerDocument||e,u=e.createElement("script"),q(u),It(u,"link",l),e.head.appendChild(u),r.instance=u);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,Fl(l,a.precedence,e));return r.instance}function Fl(e,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,p=u,w=0;w<l.length;w++){var E=l[w];if(E.dataset.precedence===r)p=E;else if(p!==u)break}p?p.parentNode.insertBefore(e,p.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(e,r.firstChild))}function qh(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.title==null&&(e.title=r.title)}function Lh(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.integrity==null&&(e.integrity=r.integrity)}var Gl=null;function ig(e,r,a){if(Gl===null){var l=new Map,u=Gl=new Map;u.set(a,l)}else u=Gl,l=u.get(a),l||(l=new Map,u.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var p=a[u];if(!(p[Tt]||p[nt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(r)||"";w=e+w;var E=l.get(w);E?E.push(p):l.set(w,[p])}}return l}function ag(e,r,a){e=e.ownerDocument||e,e.head.insertBefore(a,r==="title"?e.querySelector("head > title"):null)}function qw(e,r,a){if(a===1||r.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return e=r.disabled,typeof r.precedence=="string"&&e==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function og(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Lw(e,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Bi(l.href),p=r.querySelector(Ja(u));if(p){r=p._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(e.count++,e=Vl.bind(e),r.then(e,e)),a.state.loading|=4,a.instance=p,q(p);return}p=r.ownerDocument||r,l=rg(l),(u=Bn.get(u))&&qh(l,u),p=p.createElement("link"),q(p);var w=p;w._p=new Promise(function(E,M){w.onload=E,w.onerror=M}),It(p,"link",l),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Vl.bind(e),r.addEventListener("load",a),r.addEventListener("error",a))}}var Bh=0;function Bw(e,r){return e.stylesheets&&e.count===0&&Kl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Kl(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+r);0<e.imgBytes&&Bh===0&&(Bh=62500*gw());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Kl(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Bh?50:800)+r);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Vl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yl=null;function Kl(e,r){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yl=new Map,r.forEach(Pw,e),Yl=null,Vl.call(e))}function Pw(e,r){if(!(r.state.loading&4)){var a=Yl.get(e);if(a)var l=a.get(null);else{a=new Map,Yl.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<u.length;p++){var w=u[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),l=w)}l&&a.set(null,l)}u=r.instance,w=u.getAttribute("data-precedence"),p=a.get(w)||l,p===l&&a.set(null,u),a.set(w,u),this.count++,l=Vl.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),p?p.parentNode.insertBefore(u,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),r.state.loading|=4}}var Xa={$$typeof:re,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function Uw(e,r,a,l,u,p,w,E,M){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=Ir(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ir(0),this.hiddenUpdates=Ir(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function lg(e,r,a,l,u,p,w,E,M,G,W,ie){return e=new Uw(e,r,a,w,M,G,W,ie,E),r=1,p===!0&&(r|=24),p=cn(3,null,null,r),e.current=p,p.stateNode=e,r=yf(),r.refCount++,e.pooledCache=r,r.refCount++,p.memoizedState={element:l,isDehydrated:a,cache:r},vf(p),e}function cg(e){return e?(e=pi,e):pi}function ug(e,r,a,l,u,p){u=cg(u),l.context===null?l.context=u:l.pendingContext=u,l=Xr(r),l.payload={element:a},p=p===void 0?null:p,p!==null&&(l.callback=p),a=Wr(e,l,r),a!==null&&(rn(a,e,r),Na(a,e,r))}function fg(e,r){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<r?a:r}}function Ph(e,r){fg(e,r),(e=e.alternate)&&fg(e,r)}function hg(e){if(e.tag===13||e.tag===31){var r=qs(e,67108864);r!==null&&rn(r,e,67108864),Ph(e,67108864)}}function dg(e){if(e.tag===13||e.tag===31){var r=mn();r=fr(r);var a=qs(e,r);a!==null&&rn(a,e,r),Ph(e,r)}}var Jl=!0;function zw(e,r,a,l){var u=H.T;H.T=null;var p=Z.p;try{Z.p=2,Uh(e,r,a,l)}finally{Z.p=p,H.T=u}}function Iw(e,r,a,l){var u=H.T;H.T=null;var p=Z.p;try{Z.p=8,Uh(e,r,a,l)}finally{Z.p=p,H.T=u}}function Uh(e,r,a,l){if(Jl){var u=zh(l);if(u===null)Oh(e,r,l,Ql,a),pg(e,l);else if(Hw(u,e,r,a,l))l.stopPropagation();else if(pg(e,l),r&4&&-1<$w.indexOf(e)){for(;u!==null;){var p=N(u);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=In(p.pendingLanes);if(w!==0){var E=p;for(E.pendingLanes|=2,E.entangledLanes|=2;w;){var M=1<<31-Ht(w);E.entanglements[1]|=M,w&=~M}rr(p),(Ke&6)===0&&(Ml=ct()+500,Ga(0))}}break;case 31:case 13:E=qs(p,2),E!==null&&rn(E,p,2),Dl(),Ph(p,2)}if(p=zh(l),p===null&&Oh(e,r,l,Ql,a),p===u)break;u=p}u!==null&&l.stopPropagation()}else Oh(e,r,l,null,a)}}function zh(e){return e=Iu(e),Ih(e)}var Ql=null;function Ih(e){if(Ql=null,e=A(e),e!==null){var r=c(e);if(r===null)e=null;else{var a=r.tag;if(a===13){if(e=d(r),e!==null)return e;e=null}else if(a===31){if(e=y(r),e!==null)return e;e=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;e=null}else r!==e&&(e=null)}}return Ql=e,null}function mg(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(Ru()){case Uo:return 2;case zo:return 8;case ri:case Du:return 32;case Io:return 268435456;default:return 32}default:return 32}}var $h=!1,cs=null,us=null,fs=null,Wa=new Map,Za=new Map,hs=[],$w="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 pg(e,r){switch(e){case"focusin":case"focusout":cs=null;break;case"dragenter":case"dragleave":us=null;break;case"mouseover":case"mouseout":fs=null;break;case"pointerover":case"pointerout":Wa.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Za.delete(r.pointerId)}}function eo(e,r,a,l,u,p){return e===null||e.nativeEvent!==p?(e={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:p,targetContainers:[u]},r!==null&&(r=N(r),r!==null&&hg(r)),e):(e.eventSystemFlags|=l,r=e.targetContainers,u!==null&&r.indexOf(u)===-1&&r.push(u),e)}function Hw(e,r,a,l,u){switch(r){case"focusin":return cs=eo(cs,e,r,a,l,u),!0;case"dragenter":return us=eo(us,e,r,a,l,u),!0;case"mouseover":return fs=eo(fs,e,r,a,l,u),!0;case"pointerover":var p=u.pointerId;return Wa.set(p,eo(Wa.get(p)||null,e,r,a,l,u)),!0;case"gotpointercapture":return p=u.pointerId,Za.set(p,eo(Za.get(p)||null,e,r,a,l,u)),!0}return!1}function yg(e){var r=A(e.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=d(a),r!==null){e.blockedOn=r,Ho(e.priority,function(){dg(a)});return}}else if(r===31){if(r=y(a),r!==null){e.blockedOn=r,Ho(e.priority,function(){dg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Xl(e){if(e.blockedOn!==null)return!1;for(var r=e.targetContainers;0<r.length;){var a=zh(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);zu=l,a.target.dispatchEvent(l),zu=null}else return r=N(a),r!==null&&hg(r),e.blockedOn=a,!1;r.shift()}return!0}function gg(e,r,a){Xl(e)&&a.delete(r)}function Fw(){$h=!1,cs!==null&&Xl(cs)&&(cs=null),us!==null&&Xl(us)&&(us=null),fs!==null&&Xl(fs)&&(fs=null),Wa.forEach(gg),Za.forEach(gg)}function Wl(e,r){e.blockedOn===r&&(e.blockedOn=null,$h||($h=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Fw)))}var Zl=null;function bg(e){Zl!==e&&(Zl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Zl===e&&(Zl=null);for(var r=0;r<e.length;r+=3){var a=e[r],l=e[r+1],u=e[r+2];if(typeof l!="function"){if(Ih(l||a)===null)continue;break}var p=N(a);p!==null&&(e.splice(r,3),r-=3,zf(p,{pending:!0,data:u,method:a.method,action:l},l,u))}}))}function Ui(e){function r(M){return Wl(M,e)}cs!==null&&Wl(cs,e),us!==null&&Wl(us,e),fs!==null&&Wl(fs,e),Wa.forEach(r),Za.forEach(r);for(var a=0;a<hs.length;a++){var l=hs[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<hs.length&&(a=hs[0],a.blockedOn===null);)yg(a),a.blockedOn===null&&hs.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var u=a[l],p=a[l+1],w=u[dt]||null;if(typeof p=="function")w||bg(a);else if(w){var E=null;if(p&&p.hasAttribute("formAction")){if(u=p,w=p[dt]||null)E=w.formAction;else if(Ih(u)!==null)continue}else E=w.action;typeof E=="function"?a[l+1]=E:(a.splice(l,3),l-=3),bg(a)}}}function xg(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return u=w})},focusReset:"manual",scroll:"manual"})}function r(){u!==null&&(u(),u=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),u!==null&&(u(),u=null)}}}function Hh(e){this._internalRoot=e}ec.prototype.render=Hh.prototype.render=function(e){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=mn();ug(a,l,e,r,null,null)},ec.prototype.unmount=Hh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var r=e.containerInfo;ug(e.current,2,null,e,null,null),Dl(),r[on]=null}};function ec(e){this._internalRoot=e}ec.prototype.unstable_scheduleHydration=function(e){if(e){var r=ha();e={blockedOn:null,target:e,priority:r};for(var a=0;a<hs.length&&r!==0&&r<hs[a].priority;a++);hs.splice(a,0,e),a===0&&yg(e)}};var vg=t.version;if(vg!=="19.2.4")throw Error(i(527,vg,"19.2.4"));Z.findDOMNode=function(e){var r=e._reactInternals;if(r===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=f(r),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var Gw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tc.isDisabled&&tc.supportsFiber)try{As=tc.inject(Gw),xt=tc}catch{}}return to.createRoot=function(e,r){if(!o(e))throw Error(i(299));var a=!1,l="",u=jp,p=kp,w=Np;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(u=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=lg(e,1,!1,null,null,a,l,null,u,p,w,xg),e[on]=r.current,Eh(e),new Hh(r)},to.hydrateRoot=function(e,r,a){if(!o(e))throw Error(i(299));var l=!1,u="",p=jp,w=kp,E=Np,M=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(M=a.formState)),r=lg(e,1,!0,r,a??null,l,u,M,p,w,E,xg),r.context=cg(null),a=r.current,l=mn(),l=fr(l),u=Xr(l),u.callback=null,Wr(a,u,l),a=l,r.current.lanes=a,$n(r,a),rr(r),e[on]=r.current,Eh(e),new ec(r)},to.version="19.2.4",to}var jg;function qS(){if(jg)return Fh.exports;jg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Fh.exports=DS(),Fh.exports}var LS=qS();const BS="modulepreload",PS=function(n,t){return new URL(n,t).href},kg={},Oe=function(t,s,i){let o=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const y=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),f=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=d(s.map(m=>{if(m=PS(m,i),m in kg)return;kg[m]=!0;const b=m.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=y.length-1;S>=0;S--){const C=y[S];if(C.href===m&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${x}`))return;const _=document.createElement("link");if(_.rel=b?"stylesheet":BS,b||(_.as="script"),_.crossOrigin="",_.href=m,f&&_.setAttribute("nonce",f),document.head.appendChild(_),b)return new Promise((S,C)=>{_.addEventListener("load",S),_.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=d,window.dispatchEvent(y),!y.defaultPrevented)throw d}return o.then(d=>{for(const y of d||[])y.status==="rejected"&&c(y.reason);return t().catch(c)})};function _u(n){try{const t=n.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function tx(n){const t=_u(n);return!t||typeof t.exp!="number"?null:t.exp}function Zd(n,t=0){const s=tx(n);return s===null?!0:Date.now()/1e3>=s-t}const $t=window.__LT_BASE__??"",md=`${$t}/api`;class Ng extends Error{constructor(t,s,i){super(t),this.status=s,this.body=i,this.name="ApiError"}}let gs=null;function nc(n){gs=n}function nx(){return gs}const US="X-LT-Acting-Token";let Zc=null,eu=null;function Tg(n){Zc=n}function Cg(n){eu=n}function zS(n){const t=n==null?void 0:n.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function Mg(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:t,password:s}=JSON.parse(n),i=await fetch(`${md}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:s})});if(!i.ok)return null;const o=await i.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 ms=null;async function fe(n,t={}){const s={"Content-Type":"application/json",...t.headers};if(gs){if(Zd(gs)){ms||(ms=Mg().finally(()=>{ms=null}));const c=await ms;if(c)gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${gs}`}const i=(Zc==null?void 0:Zc())??null;i&&(s[US]=i);let o=await fetch(`${md}${n}`,{...t,headers:s});if(o.status===401&&i){const c=await o.clone().json().catch(()=>null);if(zS(c))throw eu==null||eu(),new Ng(c.error,401,c)}if(o.status===401&&gs){ms||(ms=Mg().finally(()=>{ms=null}));const c=await ms;if(c&&(gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,o=await fetch(`${md}${n}`,{...t,headers:s})),o.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(o.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!o.ok){const c=await o.json().catch(()=>({error:o.statusText}));throw new Ng(c.message||c.error||o.statusText,o.status,c)}return o.json()}const IS="lt_ai_override";let rc=null;function em(){return rc||(rc=fetch(`${$t}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw rc=null,n})),rc}function $S(){try{if(localStorage.getItem(IS)==="off")return!1}catch{}return null}function Wn(){var s;const n=Pe({queryKey:["settings"],queryFn:em,staleTime:1/0}),t=$S();return n.data&&t===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function HS(n){var f,m,b;const{data:t}=Wn(),s=((f=t==null?void 0:t.auth)==null?void 0:f.ssoKeepaliveSeconds)??0,i=((m=t==null?void 0:t.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,o=O.useRef(Date.now()),c=O.useRef(Date.now()),d=O.useRef(!1),g=!!n&&((b=_u(n))==null?void 0:b.sso)===!0&&s>0;O.useEffect(()=>{if(!g)return;const x=()=>{o.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!d.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-o.current>i*1e3)){d.current=!0;try{const C=await fetch(`${$t}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const L=await C.json().catch(()=>null);L!=null&&L.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:L.token}})))}catch{}finally{d.current=!1}}},_=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(_),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const rx=O.createContext(null),FS=300;function Yh(n,t){if(Zd(n))return null;const s=_u(n);if(!s)return null;const i=t??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function GS({children:n}){const[t,s]=O.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Zd(b)?(sessionStorage.removeItem("lt_token"),null):(nc(b),Yh(b)):null}),i=O.useRef(void 0),o=O.useCallback(b=>{clearTimeout(i.current);const x=tx(b);if(!x)return;const v=(x-FS)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const _=_u(b);if(_!=null&&_.sso){const le=await fetch(`${$t}/api/auth/sso`,{method:"POST"});if(!le.ok)return;const R=await le.json();R.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:R.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:L}=JSON.parse(S),P=await fetch(`${$t}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:L})});if(!P.ok)return;const re=await P.json();re.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:re.token}}))}catch{}},v))},[]),c=O.useCallback((b,x,v)=>{const _={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=Yh(b,_);S&&(nc(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(_)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),o(b))},[o]),d=O.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");nc(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);O.useEffect(()=>{const b=()=>d(),x=v=>{var C;const _=(C=v.detail)==null?void 0:C.token;if(!_)return;const S=Yh(_);S&&(nc(_),sessionStorage.setItem("lt_token",_),s(S),o(_))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[d,o]),O.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&o(b),()=>clearTimeout(i.current)},[]);const y=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=O.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.role===b))??!1,[t]),f=O.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.type===b))??!1,[t]),m=(t==null?void 0:t.roles.map(b=>b.role))??[];return h.jsxs(rx.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:y,login:c,logout:d,hasRole:g,hasRoleType:f,userRoleNames:m},children:[h.jsx(VS,{authenticated:t!==null}),n]})}function VS({authenticated:n}){return HS(n?sessionStorage.getItem("lt_token"):null),null}function Lt(){const n=O.useContext(rx);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}const Sn=new Uint8Array(0),ei=new TextEncoder,vn=new TextDecoder;function YS(...n){let t=0;for(let o=0;o<n.length;o++)t+=n[o].length;const s=new Uint8Array(t);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function go(...n){const t=[];for(let s=0;s<n.length;s++)t.push(ei.encode(n[s]));return t.length===0?Sn:t.length===1?t[0]:YS(...t)}function Rg(n){return!n||n.length===0?"":vn.decode(n)}const Dg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",qg=36,KS=0xcfd41b9100000,Lg=33,JS=333,Bg=22;function QS(n){for(let t=0;t<n.length;t++)n[t]=Math.floor(Math.random()*255)}function XS(n){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(n):QS(n)}class WS{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(Bg),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*KS),this.inc=Math.floor(Math.random()*(JS-Lg)+Lg)}setPre(){const t=new Uint8Array(12);XS(t);for(let s=0;s<12;s++){const i=t[s]%36;this.buf[s]=Dg.charCodeAt(i)}}fillSeq(){let t=this.seq;for(let s=Bg-1;s>=12;s--)this.buf[s]=Dg.charCodeAt(t%qg),t=Math.floor(t/qg)}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 Es=new WS;var Mr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Mr||(Mr={}));var Yi;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Yi||(Yi={}));var ce;(function(n){n.ApiError="BAD API",n.BadAuthentication="BAD_AUTHENTICATION",n.BadCreds="BAD_CREDS",n.BadHeader="BAD_HEADER",n.BadJson="BAD_JSON",n.BadPayload="BAD_PAYLOAD",n.BadSubject="BAD_SUBJECT",n.Cancelled="CANCELLED",n.ConnectionClosed="CONNECTION_CLOSED",n.ConnectionDraining="CONNECTION_DRAINING",n.ConnectionRefused="CONNECTION_REFUSED",n.ConnectionTimeout="CONNECTION_TIMEOUT",n.Disconnect="DISCONNECT",n.InvalidOption="INVALID_OPTION",n.InvalidPayload="INVALID_PAYLOAD",n.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",n.NoResponders="503",n.NotFunction="NOT_FUNC",n.RequestError="REQUEST_ERROR",n.ServerOptionNotAvailable="SERVER_OPT_NA",n.SubClosed="SUB_CLOSED",n.SubDraining="SUB_DRAINING",n.Timeout="TIMEOUT",n.Tls="TLS",n.Unknown="UNKNOWN_ERROR",n.WssRequired="WSS_REQUIRED",n.JetStreamInvalidAck="JESTREAM_INVALID_ACK",n.JetStream404NoMessages="404",n.JetStream408RequestTimeout="408",n.JetStream409MaxAckPendingExceeded="409",n.JetStream409="409",n.JetStreamNotEnabled="503",n.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",n.AuthorizationViolation="AUTHORIZATION_VIOLATION",n.AuthenticationExpired="AUTHENTICATION_EXPIRED",n.ProtocolError="NATS_PROTOCOL_ERR",n.PermissionsViolation="PERMISSIONS_VIOLATION",n.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",n.AccountExpired="ACCOUNT_EXPIRED"})(ce||(ce={}));function ZS(n){return typeof n.code=="string"}class sx{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(ce.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ce.BadJson,"Bad JSON"),this.messages.set(ce.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return eE.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const eE=new sx;class pe extends Error{constructor(s,i,o){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=o}static errorForCode(s,i){const o=sx.getMessage(s);return new pe(o,s,i)}isAuthError(){return this.code===ce.AuthenticationExpired||this.code===ce.AuthorizationViolation||this.code===ce.AccountExpired}isAuthTimeout(){return this.code===ce.AuthenticationTimeout}isPermissionError(){return this.code===ce.PermissionsViolation}isProtocolError(){return this.code===ce.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var gn;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(gn||(gn={}));var Qn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Qn||(Qn={}));var bo;(function(n){n.STATS="io.nats.micro.v1.stats_response",n.INFO="io.nats.micro.v1.info_response",n.PING="io.nats.micro.v1.ping_response"})(bo||(bo={}));const lu="Nats-Service-Error",cu="Nats-Service-Error-Code";class uu extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return uu.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(cu))||"";if(i!==""){const d=parseInt(i)||400,y=((c=s==null?void 0:s.headers)==null?void 0:c.get(lu))||"";return new uu(d,y.length?y:i)}return null}}function Rr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${Es.next()}`}const pd="127.0.0.1";var xs;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(xs||(xs={}));function wu(n,...t){for(let s=0;s<t.length;s++){const i=t[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function sc(n){return vn.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ea(n,t=!0){const s=t?pe.errorForCode(ce.Timeout):null;let i,o;const c=new Promise((d,y)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{y(s===null?pe.errorForCode(ce.Timeout):s)},n)});return Object.assign(c,i)}function sa(n=0){let t;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);t={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,t)}function ht(){let n={};const t=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(t,n)}function ix(n){for(let t=n.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[n[t],n[s]]=[n[s],n[t]]}return n}function tE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function tm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const t=n.length-1;return{backoff(s){return tE(s>t?n[t]:n[s])}}}function ft(n){return n*1e6}function nm(n){return Math.floor(n/1e6)}function Pg(n){let i=!0;const o=new Array(n.length);for(let c=0;c<n.length;c++){let d=n.charCodeAt(c);if(d===58||d<33||d>126)throw new pe(`'${n[c]}' is not a valid character for a header key`,ce.BadHeader);i&&97<=d&&d<=122?d-=32:!i&&65<=d&&d<=90&&(d+=32),o[c]=d,i=d==45}return String.fromCharCode(...o)}function qr(n=0,t=""){if(n===0&&t!==""||n>0&&t==="")throw new Error("setting status requires both code and description");return new vs(n,t)}const Kh="NATS/1.0";class vs{constructor(t=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,i]of this.headers){const o=t.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),d=[...o].sort();for(let y=0;y<c.length;y++)if(c[y]!==d[y])return!1}return!0}return!1}static decode(t){const s=new vs,o=vn.decode(t).split(`\r
|
|
27
|
+
`),c=o[0];if(c!==Kh){let d=c.replace(Kh,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const y=s._code.toString();d=d.replace(y,""),s._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const y=d.indexOf(":");if(y>-1){const g=d.slice(0,y),f=d.slice(y+1).trim();s.append(g,f)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Kh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let o=0;o<i.length;o++)t=`${t}\r
|
|
28
|
+
${s}: ${i[o]}`;return`${t}\r
|
|
29
|
+
\r
|
|
30
|
+
`}encode(){return ei.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new pe("invalid header value - \\r and \\n are not allowed.",ce.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=gn.Exact){const i=this.keys();switch(s){case gn.Exact:return i.filter(o=>o===t);case gn.CanonicalMIME:return t=Pg(t),i.filter(o=>o===t);default:{const o=t.toLowerCase();return i.filter(c=>o===c.toLowerCase())}}}get(t,s=gn.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(t,s=gn.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(t,s=gn.Exact){return this.findKeys(t,s).length>0}set(t,s,i=gn.Exact){this.delete(t,i),this.append(t,s,i)}append(t,s,i=gn.Exact){const o=Pg(t);i===gn.CanonicalMIME&&(t=o);const c=this.findKeys(t,i);t=c.length>0?c[0]:t;const d=vs.validHeaderValue(s);let y=this.headers.get(t);y||(y=[],this.headers.set(t,y)),y.push(d)}values(t,s=gn.Exact){const i=[];return this.findKeys(t,s).forEach(c=>{const d=this.headers.get(c);d&&i.push(...d)}),i}delete(t,s=gn.Exact){this.findKeys(t,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new vs;for(const i in t)s.headers.set(i,t[i]);return s}}function yd(){return{encode(n){return ei.encode(n)},decode(n){return vn.decode(n)}}}function Xn(n){return{encode(t){try{return t===void 0&&(t=null),ei.encode(JSON.stringify(t))}catch(s){throw pe.errorForCode(ce.BadJson,s)}},decode(t){try{return JSON.parse(vn.decode(t),n)}catch(s){throw pe.errorForCode(ce.BadJson,s)}}}}function ax(n){var t;return n&&n.data.length===0&&((t=n.headers)==null?void 0:t.code)===503?pe.errorForCode(ce.NoResponders):null}class rm{constructor(t,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=t,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=vn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=vn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=vs.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=Sn,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var o;const t=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,i=this._msg.size===-1?0:this._msg.size;return t+s+i}json(t){return Xn(t).decode(this.data)}string(){return vn.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(i,o){return(i==="start"||i==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}j(rm,"jc");function Ki(n){return Su("durable",n)}function Yt(n){return Su("stream",n)}function Su(n,t=""){if(t==="")throw Error(`${n} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
|
+
`,"\r"].forEach(i=>{if(t.indexOf(i)!==-1){switch(i){case`
|
|
32
|
+
`:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${n} name - ${n} name cannot contain '${i}'`)}}),""}function mo(n,t=""){if(t==="")throw Error(`${n} name required`);const s=nE(t);if(s.length)throw new Error(`invalid ${n} name - ${n} name ${s}`)}function nE(n=""){if(n==="")throw Error("name required");const t=/^[-\w]+$/g;if(n.match(t)===null){for(const i of n.split(""))if(i.match(t)===null)return`cannot contain '${i}'`}return""}function gd(n){if(n.data.length>0)return!1;const t=n.headers;return t?t.code>=100&&t.code<200:!1}function bd(n){var t;return gd(n)&&((t=n.headers)==null?void 0:t.description)==="Idle Heartbeat"}function rE(n,t,s){const i=qr(n,t),o={hdr:1,sid:0,size:0},c=new rm(o,Sn,{});return c._headers=i,c._subject=s,c}function Ji(n){if(n.data.length!==0)return null;const t=n.headers;return t?ox(t.code,t.description):null}var Un;(function(n){n.MaxBatchExceeded="exceeded maxrequestbatch of",n.MaxExpiresExceeded="exceeded maxrequestexpires of",n.MaxBytesExceeded="exceeded maxrequestmaxbytes of",n.MaxMessageSizeExceeded="message size exceeds maxbytes",n.PushConsumer="consumer is push based",n.MaxWaitingExceeded="exceeded maxwaiting",n.IdleHeartbeatMissed="idle heartbeats missed",n.ConsumerDeleted="consumer deleted"})(Un||(Un={}));function sE(n){return n.code!==ce.JetStream409?!1:[Un.MaxBatchExceeded,Un.MaxExpiresExceeded,Un.MaxBytesExceeded,Un.MaxMessageSizeExceeded,Un.PushConsumer,Un.IdleHeartbeatMissed,Un.ConsumerDeleted].find(s=>n.message.indexOf(s)!==-1)!==void 0}function ox(n,t=""){if(n<300)return null;switch(t=t.toLowerCase(),n){case 404:return new pe(t,ce.JetStream404NoMessages);case 408:return new pe(t,ce.JetStream408RequestTimeout);case 409:{const s=t.startsWith(Un.IdleHeartbeatMissed)?ce.JetStreamIdleHeartBeat:ce.JetStream409;return new pe(t,s)}case 503:return pe.errorForCode(ce.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ce.Unknown),new pe(t,`${n}`)}}class qt{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(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=ht(),this.yields=[],this.iterClosed=ht(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new pe("unsupported iterator",ce.ApiError);if(this.yielding)throw new pe("already yielding",ce.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const o=t[s];try{o()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const o=Date.now();yield t[s],this.time=Date.now()-o,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ht())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class sm{constructor(t,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=t,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,s=0,i=2){this.interval=t,this.maxOut=i,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var xd;(function(n){n.Limits="limits",n.Interest="interest",n.Workqueue="workqueue"})(xd||(xd={}));var wo;(function(n){n.Old="old",n.New="new"})(wo||(wo={}));var vd;(function(n){n.File="file",n.Memory="memory"})(vd||(vd={}));var wt;(function(n){n.All="all",n.Last="last",n.New="new",n.StartSequence="by_start_sequence",n.StartTime="by_start_time",n.LastPerSubject="last_per_subject"})(wt||(wt={}));var Dt;(function(n){n.None="none",n.All="all",n.Explicit="explicit",n.NotSet=""})(Dt||(Dt={}));var ta;(function(n){n.Instant="instant",n.Original="original"})(ta||(ta={}));var Os;(function(n){n.None="none",n.S2="s2"})(Os||(Os={}));var fu;(function(n){n.CreateOrUpdate="",n.Update="update",n.Create="create"})(fu||(fu={}));function iE(n,t={}){return Object.assign({name:n,deliver_policy:wt.All,ack_policy:Dt.Explicit,ack_wait:ft(30*1e3),replay_policy:ta.Instant},t)}var Ug;(function(n){n.API="api_audit",n.StreamAction="stream_action",n.ConsumerAction="consumer_action",n.SnapshotCreate="snapshot_create",n.SnapshotComplete="snapshot_complete",n.RestoreCreate="restore_create",n.RestoreComplete="restore_complete",n.MaxDeliver="max_deliver",n.Terminated="terminated",n.Ack="consumer_ack",n.StreamLeaderElected="stream_leader_elected",n.StreamQuorumLost="stream_quorum_lost",n.ConsumerLeaderElected="consumer_leader_elected",n.ConsumerQuorumLost="consumer_quorum_lost"})(Ug||(Ug={}));var Qt;(function(n){n.StreamSourceHdr="Nats-Stream-Source",n.LastConsumerSeqHdr="Nats-Last-Consumer",n.LastStreamSeqHdr="Nats-Last-Stream",n.ConsumerStalledHdr="Nats-Consumer-Stalled",n.MessageSizeHdr="Nats-Msg-Size",n.RollupHdr="Nats-Rollup",n.RollupValueSubject="sub",n.RollupValueAll="all",n.PendingMessagesHdr="Nats-Pending-Messages",n.PendingBytesHdr="Nats-Pending-Bytes"})(Qt||(Qt={}));var Kn;(function(n){n.LastValue="",n.AllHistory="history",n.UpdatesOnly="updates"})(Kn||(Kn={}));var Vi;(function(n){n.Stream="Nats-Stream",n.Sequence="Nats-Sequence",n.TimeStamp="Nats-Time-Stamp",n.Subject="Nats-Subject"})(Vi||(Vi={}));var zg;(function(n){n.Stream="Nats-Stream",n.Subject="Nats-Subject",n.Sequence="Nats-Sequence",n.LastSequence="Nats-Last-Sequence",n.Size="Nats-Msg-Size"})(zg||(zg={}));const bn="KV_";class aE{constructor(t){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=iE("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?Dt.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Ki(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=wt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=wt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=wt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=wt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=wt.Last,this}deliverNew(){return this.config.deliver_policy=wt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Dt.None,this}ackAll(){return this.config.ack_policy=Dt.All,this}ackExplicit(){return this.config.ack_policy=Dt.Explicit,this}ackWait(t){return this.config.ack_wait=ft(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=ta.Instant,this}replayOriginal(){return this.config.replay_policy=ta.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=ft(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=ft(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=ft(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function _s(n){return new aE(n)}function Ig(n){return typeof n.getOpts=="function"}class oE{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const i=atob(t);return s?Uint8Array.from(i,o=>o.charCodeAt(0)):i}}class Qi{static encode(t){return Qi.toB64URLEncoding(oE.encode(t))}static decode(t,s=!1){return Qi.decode(Qi.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class na{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let c=0;c<t.length;c++)s+=t[c].length;const i=new Uint8Array(s);let o=0;for(let c=0;c<t.length;c++)i.set(t[c],o),o+=t[c].length;return i}static fromAscii(t){return t||(t=""),ei.encode(t)}static toAscii(t){return vn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)t.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(t===void 0||t>i)&&(t=i);const o=s.subarray(0,t);return i>t&&this.buffers.push(s.subarray(t)),this.byteLength=i-t,o}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function lE(n,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(n)}var cE=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},no=cE.performance||{};no.now||no.mozNow||no.msNow||no.oNow||no.webkitNow;var $g={versions:{}},uE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fE(n){if(n.__esModule)return n;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),t}var Jh,Eu={exports:{}},Hg={},Fg=fE(lE({__proto__:null,default:Hg},[Hg]));Jh=Eu,(function(){var n="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&$g.versions&&$g.versions.node;o?s=uE:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&Jh.exports,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",y="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],f=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});var v=function(R,$){return function(ee){return new P($,!0).update(ee)[R]()}},_=function(R){var $=v("hex",R);o&&($=S($,R)),$.create=function(){return new P(R)},$.update=function(U){return $.create().update(U)};for(var ee=0;ee<b.length;++ee){var K=b[ee];$[K]=v(K,R)}return $},S=function(R,$){var ee,K=Fg,U=Fg.Buffer,D=$?"sha224":"sha256";return ee=U.from&&!s.JS_SHA256_NO_BUFFER_FROM?U.from:function(X){return new U(X)},function(X){if(typeof X=="string")return K.createHash(D).update(X,"utf8").digest("hex");if(X==null)throw new Error(n);return X.constructor===ArrayBuffer&&(X=new Uint8Array(X)),Array.isArray(X)||ArrayBuffer.isView(X)||X.constructor===U?K.createHash(D).update(ee(X)).digest("hex"):R(X)}},C=function(R,$){return function(ee,K){return new re(ee,$,!0).update(K)[R]()}},L=function(R){var $=C("hex",R);$.create=function(U){return new re(U,R)},$.update=function(U,D){return $.create(U).update(D)};for(var ee=0;ee<b.length;++ee){var K=b[ee];$[K]=C(K,R)}return $};function P(R,$){$?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],R?(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=R}function re(R,$,ee){var K,U=typeof R;if(U==="string"){var D,X=[],J=R.length,he=0;for(K=0;K<J;++K)(D=R.charCodeAt(K))<128?X[he++]=D:D<2048?(X[he++]=192|D>>>6,X[he++]=128|63&D):D<55296||D>=57344?(X[he++]=224|D>>>12,X[he++]=128|D>>>6&63,X[he++]=128|63&D):(D=65536+((1023&D)<<10|1023&R.charCodeAt(++K)),X[he++]=240|D>>>18,X[he++]=128|D>>>12&63,X[he++]=128|D>>>6&63,X[he++]=128|63&D);R=X}else{if(U!=="object")throw new Error(n);if(R===null)throw new Error(n);if(d&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!(Array.isArray(R)||d&&ArrayBuffer.isView(R)))throw new Error(n)}R.length>64&&(R=new P($,!0).update(R).array());var be=[],je=[];for(K=0;K<64;++K){var H=R[K]||0;be[K]=92^H,je[K]=54^H}P.call(this,$,ee),this.update(je),this.oKeyPad=be,this.inner=!0,this.sharedMemory=ee}P.prototype.update=function(R){if(!this.finalized){var $,ee=typeof R;if(ee!=="string"){if(ee!=="object")throw new Error(n);if(R===null)throw new Error(n);if(d&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!(Array.isArray(R)||d&&ArrayBuffer.isView(R)))throw new Error(n);$=!0}for(var K,U,D=0,X=R.length,J=this.blocks;D<X;){if(this.hashed&&(this.hashed=!1,J[0]=this.block,this.block=J[16]=J[1]=J[2]=J[3]=J[4]=J[5]=J[6]=J[7]=J[8]=J[9]=J[10]=J[11]=J[12]=J[13]=J[14]=J[15]=0),$)for(U=this.start;D<X&&U<64;++D)J[U>>>2]|=R[D]<<f[3&U++];else for(U=this.start;D<X&&U<64;++D)(K=R.charCodeAt(D))<128?J[U>>>2]|=K<<f[3&U++]:K<2048?(J[U>>>2]|=(192|K>>>6)<<f[3&U++],J[U>>>2]|=(128|63&K)<<f[3&U++]):K<55296||K>=57344?(J[U>>>2]|=(224|K>>>12)<<f[3&U++],J[U>>>2]|=(128|K>>>6&63)<<f[3&U++],J[U>>>2]|=(128|63&K)<<f[3&U++]):(K=65536+((1023&K)<<10|1023&R.charCodeAt(++D)),J[U>>>2]|=(240|K>>>18)<<f[3&U++],J[U>>>2]|=(128|K>>>12&63)<<f[3&U++],J[U>>>2]|=(128|K>>>6&63)<<f[3&U++],J[U>>>2]|=(128|63&K)<<f[3&U++]);this.lastByteIndex=U,this.bytes+=U-this.start,U>=64?(this.block=J[16],this.start=U-64,this.hash(),this.hashed=!0):this.start=U}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,$=this.lastByteIndex;R[16]=this.block,R[$>>>2]|=g[3&$],this.block=R[16],$>=56&&(this.hashed||this.hash(),R[0]=this.block,R[16]=R[1]=R[2]=R[3]=R[4]=R[5]=R[6]=R[7]=R[8]=R[9]=R[10]=R[11]=R[12]=R[13]=R[14]=R[15]=0),R[14]=this.hBytes<<3|this.bytes>>>29,R[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var R,$,ee,K,U,D,X,J,he,be=this.h0,je=this.h1,H=this.h2,Z=this.h3,oe=this.h4,_e=this.h5,Se=this.h6,Ne=this.h7,ke=this.blocks;for(R=16;R<64;++R)$=((U=ke[R-15])>>>7|U<<25)^(U>>>18|U<<14)^U>>>3,ee=((U=ke[R-2])>>>17|U<<15)^(U>>>19|U<<13)^U>>>10,ke[R]=ke[R-16]+$+ke[R-7]+ee|0;for(he=je&H,R=0;R<64;R+=4)this.first?(this.is224?(D=300032,Ne=(U=ke[0]-1413257819)-150054599|0,Z=U+24177077|0):(D=704751109,Ne=(U=ke[0]-210244248)-1521486534|0,Z=U+143694565|0),this.first=!1):($=(be>>>2|be<<30)^(be>>>13|be<<19)^(be>>>22|be<<10),K=(D=be&je)^be&H^he,Ne=Z+(U=Ne+(ee=(oe>>>6|oe<<26)^(oe>>>11|oe<<21)^(oe>>>25|oe<<7))+(oe&_e^~oe&Se)+m[R]+ke[R])|0,Z=U+($+K)|0),$=(Z>>>2|Z<<30)^(Z>>>13|Z<<19)^(Z>>>22|Z<<10),K=(X=Z&be)^Z&je^D,Se=H+(U=Se+(ee=(Ne>>>6|Ne<<26)^(Ne>>>11|Ne<<21)^(Ne>>>25|Ne<<7))+(Ne&oe^~Ne&_e)+m[R+1]+ke[R+1])|0,$=((H=U+($+K)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),K=(J=H&Z)^H&be^X,_e=je+(U=_e+(ee=(Se>>>6|Se<<26)^(Se>>>11|Se<<21)^(Se>>>25|Se<<7))+(Se&Ne^~Se&oe)+m[R+2]+ke[R+2])|0,$=((je=U+($+K)|0)>>>2|je<<30)^(je>>>13|je<<19)^(je>>>22|je<<10),K=(he=je&H)^je&Z^J,oe=be+(U=oe+(ee=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&Se^~_e&Ne)+m[R+3]+ke[R+3])|0,be=U+($+K)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+be|0,this.h1=this.h1+je|0,this.h2=this.h2+H|0,this.h3=this.h3+Z|0,this.h4=this.h4+oe|0,this.h5=this.h5+_e|0,this.h6=this.h6+Se|0,this.h7=this.h7+Ne|0},P.prototype.hex=function(){this.finalize();var R=this.h0,$=this.h1,ee=this.h2,K=this.h3,U=this.h4,D=this.h5,X=this.h6,J=this.h7,he=y[R>>>28&15]+y[R>>>24&15]+y[R>>>20&15]+y[R>>>16&15]+y[R>>>12&15]+y[R>>>8&15]+y[R>>>4&15]+y[15&R]+y[$>>>28&15]+y[$>>>24&15]+y[$>>>20&15]+y[$>>>16&15]+y[$>>>12&15]+y[$>>>8&15]+y[$>>>4&15]+y[15&$]+y[ee>>>28&15]+y[ee>>>24&15]+y[ee>>>20&15]+y[ee>>>16&15]+y[ee>>>12&15]+y[ee>>>8&15]+y[ee>>>4&15]+y[15&ee]+y[K>>>28&15]+y[K>>>24&15]+y[K>>>20&15]+y[K>>>16&15]+y[K>>>12&15]+y[K>>>8&15]+y[K>>>4&15]+y[15&K]+y[U>>>28&15]+y[U>>>24&15]+y[U>>>20&15]+y[U>>>16&15]+y[U>>>12&15]+y[U>>>8&15]+y[U>>>4&15]+y[15&U]+y[D>>>28&15]+y[D>>>24&15]+y[D>>>20&15]+y[D>>>16&15]+y[D>>>12&15]+y[D>>>8&15]+y[D>>>4&15]+y[15&D]+y[X>>>28&15]+y[X>>>24&15]+y[X>>>20&15]+y[X>>>16&15]+y[X>>>12&15]+y[X>>>8&15]+y[X>>>4&15]+y[15&X];return this.is224||(he+=y[J>>>28&15]+y[J>>>24&15]+y[J>>>20&15]+y[J>>>16&15]+y[J>>>12&15]+y[J>>>8&15]+y[J>>>4&15]+y[15&J]),he},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var R=this.h0,$=this.h1,ee=this.h2,K=this.h3,U=this.h4,D=this.h5,X=this.h6,J=this.h7,he=[R>>>24&255,R>>>16&255,R>>>8&255,255&R,$>>>24&255,$>>>16&255,$>>>8&255,255&$,ee>>>24&255,ee>>>16&255,ee>>>8&255,255&ee,K>>>24&255,K>>>16&255,K>>>8&255,255&K,U>>>24&255,U>>>16&255,U>>>8&255,255&U,D>>>24&255,D>>>16&255,D>>>8&255,255&D,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||he.push(J>>>24&255,J>>>16&255,J>>>8&255,255&J),he},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var R=new ArrayBuffer(this.is224?28:32),$=new DataView(R);return $.setUint32(0,this.h0),$.setUint32(4,this.h1),$.setUint32(8,this.h2),$.setUint32(12,this.h3),$.setUint32(16,this.h4),$.setUint32(20,this.h5),$.setUint32(24,this.h6),this.is224||$.setUint32(28,this.h7),R},re.prototype=new P,re.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var R=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(R),P.prototype.finalize.call(this)}};var le=_();le.sha256=le,le.sha224=_(!0),le.sha256.hmac=L(),le.sha224.hmac=L(!0),c?Jh.exports=le:(s.sha256=le.sha256,s.sha224=le.sha224)})();Eu.exports;Eu.exports.sha224;var Gg=Eu.exports.sha256;function _d(n){return gE(n)}function hE(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const s=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return s||i?n.length%2===0:!1}function dE(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}function mE(n){return hE(n)?"hex":dE(n)?"b64":""}function pE(n){if(n.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(n.length/2);for(let s=0;s<n.length;s+=2)t[s/2]=parseInt(n.substring(s,s+2),16);return t}function yE(n){n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/");const t=atob(n);return Uint8Array.from(t,s=>s.charCodeAt(0))}function gE(n){switch(mE(n)){case"hex":return pE(n);case"b64":return yE(n)}return null}function bE(n,t){const s=typeof n=="string"?_d(n):n,i=typeof t=="string"?_d(t):t;if(s===null||i===null||s.length!==i.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==i[o])return!1;return!0}class lx{constructor(t,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=Es.next(),i&&(this.ctx=new Error)}}class xE extends lx{constructor(s,i,o={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(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=ht(),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,i){s?(this.ctx&&(s.stack+=`
|
|
33
|
+
|
|
34
|
+
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Qn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Qn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Qn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class cx extends lx{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=ht(),this.timer=ea(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
|
+
|
|
36
|
+
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||pe.errorForCode(ce.Cancelled))}}const vE="$JS.API";function _E(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),wu({apiPrefix:vE,timeout:5e3},n)}class To{constructor(t,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=t,this.opts=_E(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Xn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,i){i=i||{},i.timeout=this.timeout;let o=Sn;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const d=tm();for(let y=0;y<c;y++)try{const g=await this.nc.request(t,o,i);return this.parseJsResponse(g)}catch(g){const f=g;if((f.code==="503"||f.code===ce.Timeout)&&y+1<c)await sa(d.backoff(y));else throw g}}async findStream(t){const s={subject:t},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(t){const s=this.jc.decode(t.data),i=s;if(i.error){const o=ox(i.error.code,i.error.description);if(o!==null)throw o.api_error=i.error,o}return s}}class po{constructor(t,s,i,o){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(t){var s,i,o;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=t.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((o=t.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function Zs(n=""){const t=n.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${n}' is not a semver value`)}function wd(n,t){return n.major<t.major?-1:n.major>t.major?1:n.minor<t.minor?-1:n.minor>t.minor?1:n.micro<t.micro?-1:n.micro>t.micro?1:0}var Ge;(function(n){n.JS_KV="js_kv",n.JS_OBJECTSTORE="js_objectstore",n.JS_PULL_MAX_BYTES="js_pull_max_bytes",n.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",n.JS_ALLOW_DIRECT="js_allow_direct",n.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",n.JS_SIMPLIFICATION="js_simplification",n.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",n.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",n.JS_STREAM_FIRST_SEQ="js_stream_first_seq",n.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",n.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",n.JS_STREAM_COMPRESSION="js_stream_compression",n.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",n.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ge||(Ge={}));class wE{constructor(t){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=Zs(t)),this.server=t,this.set(Ge.JS_KV,"2.6.2"),this.set(Ge.JS_OBJECTSTORE,"2.6.3"),this.set(Ge.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ge.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ge.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ge.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ge.JS_SIMPLIFICATION,"2.9.4"),this.set(Ge.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ge.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ge.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ge.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ge.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ge.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ge.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ge.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:wd(this.server,Zs(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=Zs(t)),wd(this.server,t)>=0}}class hu extends To{constructor(t,s){super(t,s)}async add(t,s,i=fu.Create){if(Yt(t),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=t,o.action=i,o.config.durable_name&&Ki(o.config.durable_name);const c=this.nc;let{min:d,ok:y}=c.features.get(Ge.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!y)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{Su("name",g)}catch(x){const v=x.message,_=v.indexOf("cannot contain");throw _!==-1?new Error(`consumer 'name' ${v.substring(_)}`):x}let f,m="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(Ge.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);y=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(Ge.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(y&&(m=s.name??s.durable_name??""),m!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),f=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${m}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${m}`}else f=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,o)}async update(t,s,i){const o=await this.info(t,s),c=i;return this.add(t,Object.assign(o.config,c),fu.Update)}async info(t,s){return Yt(t),Ki(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return Yt(t),Ki(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){Yt(t);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${t}`;return new po(i,s,this)}pause(t,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(t,s){return this.pause(t,s,new Date(0))}}function zi(n,t,s=!1){if(s===!0&&!n)throw pe.errorForCode(ce.ApiError,new Error(`${t} is not a function`));if(n&&typeof n!="function")throw pe.errorForCode(ce.ApiError,new Error(`${t} is not a function`))}class SE extends qt{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");zi(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&zi(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(zi(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(zi(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(zi(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&zi(o.cleanupFn,"cleanupFn");let c=(m,b)=>{this.callback(m,b)};if(o.callback){const m=o.callback;c=(b,x)=>{const[v,_]=this.adapter(b,x);if(v){m(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(_,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(_))&&(m(v,_),this.dispatchedFn&&_&&this.dispatchedFn(_))}}const{max:d,queue:y,timeout:g}=o,f={queue:y,timeout:g,callback:c};d&&d>0&&(f.max=d),this.sub=s.subscribe(i,f),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=ht(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async m=>{await m.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,i){this.sub.cancelTimeout();const[o,c]=this.adapter(s,i);o&&this.stop(o),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let _n;function EE(n){_n=n}function ux(){return _n!==void 0&&_n.defaultPort!==void 0?_n.defaultPort:4222}function Qh(){return _n!==void 0&&_n.urlParseFn?_n.urlParseFn:void 0}function OE(){if(!_n||typeof _n.factory!="function")throw new Error("transport fn is not set");return _n.factory()}function Sd(){return _n!==void 0&&_n.dnsResolveFn?_n.dnsResolveFn:void 0}const tu=`\r
|
|
37
|
+
`,du=na.fromAscii(tu),AE=new Uint8Array(du)[0],jE=new Uint8Array(du)[1];function kE(n){for(let t=0;t<n.length;t++){const s=t+1;if(n.byteLength>s&&n[t]===AE&&n[s]===jE)return s+1}return 0}function NE(n){const t=kE(n);if(t>0){const i=new Uint8Array(n).slice(0,t);return vn.decode(i)}return""}const TE=4,fx=48,CE=65,ME=97;function RE(n,t,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,y)=>{o[y]=d}),o[12]=n,o[13]=t,o[14]=s,o[15]=i,o}function Ed(n){return DE(n)!==void 0}function DE(n){for(let t=0;t<n.length;t++)switch(n[t]){case".":return hx(n);case":":return qE(n)}}function hx(n){const t=new Uint8Array(4);for(let s=0;s<4;s++){if(n.length===0)return;if(s>0){if(n[0]!==".")return;n=n.substring(1)}const{n:i,c:o,ok:c}=LE(n);if(!c||i>255)return;n=n.substring(o),t[s]=i}return RE(t[0],t[1],t[2],t[3])}function qE(n){const t=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return t;let i=0;for(;i<16;){const{n:o,c,ok:d}=BE(n);if(!d||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const y=hx(n);if(y===void 0)return;t[i]=y[12],t[i+1]=y[13],t[i+2]=y[14],t[i+3]=y[15],n="",i+=TE;break}if(t[i]=o>>8,t[i+1]=o,i+=2,n=n.substring(c),n.length===0)break;if(n[0]!==":"||n.length==1)return;if(n=n.substring(1),n[0]===":"){if(s>=0)return;if(s=i,n=n.substring(1),n.length===0)break}}if(n.length===0){if(i<16){if(s<0)return;const o=16-i;for(let c=i-1;c>=s;c--)t[c+o]=t[c];for(let c=s+o-1;c>=s;c--)t[c]=0}else if(s>=0)return;return t}}function LE(n){let t=0,s=0;for(t=0;t<n.length&&48<=n.charCodeAt(t)&&n.charCodeAt(t)<=57;t++)if(s=s*10+(n.charCodeAt(t)-fx),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function BE(n){let t=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)t*=16,t+=n.charCodeAt(s)-fx;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)t*=16,t+=n.charCodeAt(s)-ME+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)t*=16,t+=n.charCodeAt(s)-CE+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function PE(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function Od(n){return!PE(n)}function UE(n){const t="::FFFF:",s=n.toUpperCase().indexOf(t);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+t.length);return i=i.replace("[",""),i.replace("]","")}return n}function zE(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=UE(n),Od(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const t=Od(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,i=s===80?"https":"http",o=new URL(`${i}://${n}`);o.port=`${s}`;let c=o.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:o.host,hostname:c,port:s}}class xo{constructor(t,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=t,this.tlsName="";const i=zE(t);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(Ed(this.hostname))return[this];{const i=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",d=new URL(`${c}://${Od(o)?"["+o+"]":o}`);d.port=`${this.port}`;const y=new xo(d.host,!1);y.tlsName=this.hostname,s.push(y)}}return t.randomize&&ix(s),this.resolves=s,s}}class IE{constructor(t=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=Qh();t&&(t.forEach(o=>{o=i?i(o):o,this.servers.push(new xo(o))}),this.randomize&&(this.servers=ix(this.servers))),this.servers.length===0&&this.addServer(`${pd}:${ux()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();Ed(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const i=Qh();t=i?i(t):t;const o=new xo(t,s);Ed(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,s){const i=[];let o=[];const c=Qh(),d=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,s):g;const f=new xo(g,!0);d.set(g,f)});const y=[];return this.servers.forEach((g,f)=>{const m=g.listen;g.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&y.push(f),d.delete(m)}),y.reverse(),y.forEach(g=>{const f=this.servers.splice(g,1);o=o.concat(f[0].listen)}),d.forEach((g,f)=>{this.servers.push(g),i.push(f)}),{added:i,deleted:o}}}class $E{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Rr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const o=this.all().find(c=>c.requestSubject===i.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(t===null&&s.headers&&(t=ax(s)),o.resolver(t,s))}}}close(){const t=pe.errorForCode(ce.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class HE{constructor(t,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=t,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Yi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=ht();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class FE extends Error{constructor(t){super(t),this.name="AssertionError"}}function GE(n,t="Assertion failed."){if(!n)throw new FE(t)}const Vg=32*1024,Xh=2**32-2;function ic(n,t,s=0){const i=t.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),t.set(n,s),n.byteLength}class Wh{constructor(t){j(this,"_buf");j(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){GE(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=ic(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(ei.encode(t))}write(t){const s=this._grow(t.byteLength);return ic(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(t);if(i>=0)return i;const o=this.capacity;if(t<=Math.floor(o/2)-s)ic(this._buf.subarray(this._off),this._buf);else{if(o+t>Xh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+t,Xh));ic(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+t,Xh)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const i=new Uint8Array(Vg);for(;;){const o=this.capacity-this.length<Vg,c=o?i:new Uint8Array(this._buf.buffer,this.length),d=t.read(c);if(d===null)return s;o?this.write(c.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var Kt;(function(n){n[n.OK=0]="OK",n[n.ERR=1]="ERR",n[n.MSG=2]="MSG",n[n.INFO=3]="INFO",n[n.PING=4]="PING",n[n.PONG=5]="PONG"})(Kt||(Kt={}));function Yg(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const VE=48;class Kg{constructor(t){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=t,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const i=t[s];switch(this.state){case de.OP_START:switch(i){case me.M:case me.m:this.state=de.OP_M,this.hdr=-1,this.ma=Yg();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=Yg();break;case me.P:case me.p:this.state=de.OP_P;break;case me.PLUS:this.state=de.OP_PLUS;break;case me.MINUS:this.state=de.OP_MINUS;break;case me.I:case me.i:this.state=de.OP_I;break;default:throw this.fail(t.subarray(s))}break;case de.OP_H:switch(i){case me.M:case me.m:this.state=de.OP_M;break;default:throw this.fail(t.subarray(s))}break;case de.OP_M:switch(i){case me.S:case me.s:this.state=de.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MS:switch(i){case me.G:case me.g:this.state=de.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MSG_ARG,this.as=s}break;case de.MSG_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{const o=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=de.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case de.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Kt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const c=t.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(t.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Kt.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END);break;case de.MSG_END:switch(i){case me.NL:this.drop=0,this.as=s+1,this.state=de.OP_START;break;default:continue}break;case de.OP_PLUS:switch(i){case me.O:case me.o:this.state=de.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_O:switch(i){case me.K:case me.k:this.state=de.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Kt.OK}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_MINUS:switch(i){case me.E:case me.e:this.state=de.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_E:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ER:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MINUS_ERR_ARG,this.as=s}break;case de.MINUS_ERR_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Kt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case de.OP_P:switch(i){case me.I:case me.i:this.state=de.OP_PI;break;case me.O:case me.o:this.state=de.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PO:switch(i){case me.N:case me.n:this.state=de.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PON:switch(i){case me.G:case me.g:this.state=de.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Kt.PONG}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_PI:switch(i){case me.N:case me.n:this.state=de.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PIN:switch(i){case me.G:case me.g:this.state=de.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Kt.PING}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_I:switch(i){case me.N:case me.n:this.state=de.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_IN:switch(i){case me.F:case me.f:this.state=de.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INF:switch(i){case me.O:case me.o:this.state=de.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.INFO_ARG,this.as=s}break;case de.INFO_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Kt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(t.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Wh(t.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Wh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(t+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,t),this.argBuf=new Wh(i),this.ma.subject=i.subarray(0,t),this.ma.reply&&(this.ma.reply=i.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${vn.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let i=0;i<t.length;i++){if(t[i]<48||t[i]>57)return-1;s=s*10+(t[i]-VE)}return s}}var de;(function(n){n[n.OP_START=0]="OP_START",n[n.OP_PLUS=1]="OP_PLUS",n[n.OP_PLUS_O=2]="OP_PLUS_O",n[n.OP_PLUS_OK=3]="OP_PLUS_OK",n[n.OP_MINUS=4]="OP_MINUS",n[n.OP_MINUS_E=5]="OP_MINUS_E",n[n.OP_MINUS_ER=6]="OP_MINUS_ER",n[n.OP_MINUS_ERR=7]="OP_MINUS_ERR",n[n.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",n[n.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",n[n.OP_M=10]="OP_M",n[n.OP_MS=11]="OP_MS",n[n.OP_MSG=12]="OP_MSG",n[n.OP_MSG_SPC=13]="OP_MSG_SPC",n[n.MSG_ARG=14]="MSG_ARG",n[n.MSG_PAYLOAD=15]="MSG_PAYLOAD",n[n.MSG_END=16]="MSG_END",n[n.OP_H=17]="OP_H",n[n.OP_P=18]="OP_P",n[n.OP_PI=19]="OP_PI",n[n.OP_PIN=20]="OP_PIN",n[n.OP_PING=21]="OP_PING",n[n.OP_PO=22]="OP_PO",n[n.OP_PON=23]="OP_PON",n[n.OP_PONG=24]="OP_PONG",n[n.OP_I=25]="OP_I",n[n.OP_IN=26]="OP_IN",n[n.OP_INF=27]="OP_INF",n[n.OP_INFO=28]="OP_INFO",n[n.OP_INFO_SPC=29]="OP_INFO_SPC",n[n.INFO_ARG=30]="INFO_ARG"})(de||(de={}));var me;(function(n){n[n.CR=13]="CR",n[n.E=69]="E",n[n.e=101]="e",n[n.F=70]="F",n[n.f=102]="f",n[n.G=71]="G",n[n.g=103]="g",n[n.H=72]="H",n[n.h=104]="h",n[n.I=73]="I",n[n.i=105]="i",n[n.K=75]="K",n[n.k=107]="k",n[n.M=77]="M",n[n.m=109]="m",n[n.MINUS=45]="MINUS",n[n.N=78]="N",n[n.n=110]="n",n[n.NL=10]="NL",n[n.O=79]="O",n[n.o=111]="o",n[n.P=80]="P",n[n.p=112]="p",n[n.PLUS=43]="PLUS",n[n.R=82]="R",n[n.r=114]="r",n[n.S=83]="S",n[n.s=115]="s",n[n.SPACE=32]="SPACE",n[n.TAB=9]="TAB"})(me||(me={}));(function(n){var t=function(A,N){this.hi=A|0,this.lo=N|0},s=function(A){var N,k=new Float64Array(16);if(A)for(N=0;N<A.length;N++)k[N]=A[N];return k},i=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var d=s(),y=s([1]),g=s([56129,1]),f=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),m=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(A,N){return A<<N|A>>>32-N}function S(A,N){var k=A[N+3]&255;return k=k<<8|A[N+2]&255,k=k<<8|A[N+1]&255,k<<8|A[N+0]&255}function C(A,N){var k=A[N]<<24|A[N+1]<<16|A[N+2]<<8|A[N+3],T=A[N+4]<<24|A[N+5]<<16|A[N+6]<<8|A[N+7];return new t(k,T)}function L(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function P(A,N,k){A[N]=k.hi>>24&255,A[N+1]=k.hi>>16&255,A[N+2]=k.hi>>8&255,A[N+3]=k.hi&255,A[N+4]=k.lo>>24&255,A[N+5]=k.lo>>16&255,A[N+6]=k.lo>>8&255,A[N+7]=k.lo&255}function re(A,N,k,T,q){var I,se=0;for(I=0;I<q;I++)se|=A[N+I]^k[T+I];return(1&se-1>>>8)-1}function le(A,N,k,T){return re(A,N,k,T,16)}function R(A,N,k,T){return re(A,N,k,T,32)}function $(A,N,k,T,q){var I=new Uint32Array(16),se=new Uint32Array(16),ae=new Uint32Array(16),Y=new Uint32Array(4),ne,ye,Re;for(ne=0;ne<4;ne++)se[5*ne]=S(T,4*ne),se[1+ne]=S(k,4*ne),se[6+ne]=S(N,4*ne),se[11+ne]=S(k,16+4*ne);for(ne=0;ne<16;ne++)ae[ne]=se[ne];for(ne=0;ne<20;ne++){for(ye=0;ye<4;ye++){for(Re=0;Re<4;Re++)Y[Re]=se[(5*ye+4*Re)%16];for(Y[1]^=_(Y[0]+Y[3]|0,7),Y[2]^=_(Y[1]+Y[0]|0,9),Y[3]^=_(Y[2]+Y[1]|0,13),Y[0]^=_(Y[3]+Y[2]|0,18),Re=0;Re<4;Re++)I[4*ye+(ye+Re)%4]=Y[Re]}for(Re=0;Re<16;Re++)se[Re]=I[Re]}if(q){for(ne=0;ne<16;ne++)se[ne]=se[ne]+ae[ne]|0;for(ne=0;ne<4;ne++)se[5*ne]=se[5*ne]-S(T,4*ne)|0,se[6+ne]=se[6+ne]-S(N,4*ne)|0;for(ne=0;ne<4;ne++)L(A,4*ne,se[5*ne]),L(A,16+4*ne,se[6+ne])}else for(ne=0;ne<16;ne++)L(A,4*ne,se[ne]+ae[ne]|0)}function ee(A,N,k,T){return $(A,N,k,T,!1),0}function K(A,N,k,T){return $(A,N,k,T,!0),0}var U=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(A,N,k,T,q,I,se){var ae=new Uint8Array(16),Y=new Uint8Array(64),ne,ye;if(!q)return 0;for(ye=0;ye<16;ye++)ae[ye]=0;for(ye=0;ye<8;ye++)ae[ye]=I[ye];for(;q>=64;){for(ee(Y,ae,se,U),ye=0;ye<64;ye++)A[N+ye]=(k?k[T+ye]:0)^Y[ye];for(ne=1,ye=8;ye<16;ye++)ne=ne+(ae[ye]&255)|0,ae[ye]=ne&255,ne>>>=8;q-=64,N+=64,k&&(T+=64)}if(q>0)for(ee(Y,ae,se,U),ye=0;ye<q;ye++)A[N+ye]=(k?k[T+ye]:0)^Y[ye];return 0}function X(A,N,k,T,q){return D(A,N,null,0,k,T,q)}function J(A,N,k,T,q){var I=new Uint8Array(32);return K(I,T,q,U),X(A,N,k,T.subarray(16),I)}function he(A,N,k,T,q,I,se){var ae=new Uint8Array(32);return K(ae,I,se,U),D(A,N,k,T,q,I.subarray(16),ae)}function be(A,N){var k,T=0;for(k=0;k<17;k++)T=T+(A[k]+N[k]|0)|0,A[k]=T&255,T>>>=8}var je=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function H(A,N,k,T,q,I){var se,ae,Y,ne,ye=new Uint32Array(17),Re=new Uint32Array(17),it=new Uint32Array(17),Ft=new Uint32Array(17),Hn=new Uint32Array(17);for(Y=0;Y<17;Y++)Re[Y]=it[Y]=0;for(Y=0;Y<16;Y++)Re[Y]=I[Y];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;q>0;){for(Y=0;Y<17;Y++)Ft[Y]=0;for(Y=0;Y<16&&Y<q;++Y)Ft[Y]=k[T+Y];for(Ft[Y]=1,T+=Y,q-=Y,be(it,Ft),ae=0;ae<17;ae++)for(ye[ae]=0,Y=0;Y<17;Y++)ye[ae]=ye[ae]+it[Y]*(Y<=ae?Re[ae-Y]:320*Re[ae+17-Y]|0)|0|0;for(ae=0;ae<17;ae++)it[ae]=ye[ae];for(ne=0,Y=0;Y<16;Y++)ne=ne+it[Y]|0,it[Y]=ne&255,ne>>>=8;for(ne=ne+it[16]|0,it[16]=ne&3,ne=5*(ne>>>2)|0,Y=0;Y<16;Y++)ne=ne+it[Y]|0,it[Y]=ne&255,ne>>>=8;ne=ne+it[16]|0,it[16]=ne}for(Y=0;Y<17;Y++)Hn[Y]=it[Y];for(be(it,je),se=-(it[16]>>>7)|0,Y=0;Y<17;Y++)it[Y]^=se&(Hn[Y]^it[Y]);for(Y=0;Y<16;Y++)Ft[Y]=I[Y+16];for(Ft[16]=0,be(it,Ft),Y=0;Y<16;Y++)A[N+Y]=it[Y];return 0}function Z(A,N,k,T,q,I){var se=new Uint8Array(16);return H(se,0,k,T,q,I),le(A,N,se,0)}function oe(A,N,k,T,q){var I;if(k<32)return-1;for(he(A,0,N,0,k,T,q),H(A,16,A,32,k-32,A),I=0;I<16;I++)A[I]=0;return 0}function _e(A,N,k,T,q){var I,se=new Uint8Array(32);if(k<32||(J(se,0,32,T,q),Z(N,16,N,32,k-32,se)!==0))return-1;for(he(A,0,N,0,k,T,q),I=0;I<32;I++)A[I]=0;return 0}function Se(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ne(A){var N,k;for(k=0;k<16;k++)A[k]+=65536,N=Math.floor(A[k]/65536),A[(k+1)*(k<15?1:0)]+=N-1+37*(N-1)*(k===15?1:0),A[k]-=N*65536}function ke(A,N,k){for(var T,q=~(k-1),I=0;I<16;I++)T=q&(A[I]^N[I]),A[I]^=T,N[I]^=T}function Te(A,N){var k,T,q,I=s(),se=s();for(k=0;k<16;k++)se[k]=N[k];for(Ne(se),Ne(se),Ne(se),T=0;T<2;T++){for(I[0]=se[0]-65517,k=1;k<15;k++)I[k]=se[k]-65535-(I[k-1]>>16&1),I[k-1]&=65535;I[15]=se[15]-32767-(I[14]>>16&1),q=I[15]>>16&1,I[14]&=65535,ke(se,I,1-q)}for(k=0;k<16;k++)A[2*k]=se[k]&255,A[2*k+1]=se[k]>>8}function st(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Te(k,A),Te(T,N),R(k,0,T,0)}function Nt(A){var N=new Uint8Array(32);return Te(N,A),N[0]&1}function Bt(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function gt(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function bt(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function ue(A,N,k){var T,q,I=new Float64Array(31);for(T=0;T<31;T++)I[T]=0;for(T=0;T<16;T++)for(q=0;q<16;q++)I[T+q]+=N[T]*k[q];for(T=0;T<15;T++)I[T]+=38*I[T+16];for(T=0;T<16;T++)A[T]=I[T];Ne(A),Ne(A)}function Je(A,N){ue(A,N,N)}function jn(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)Je(k,k),T!==2&&T!==4&&ue(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function lr(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)Je(k,k),T!==1&&ue(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function ve(A,N,k){var T=new Uint8Array(32),q=new Float64Array(80),I,se,ae=s(),Y=s(),ne=s(),ye=s(),Re=s(),it=s();for(se=0;se<31;se++)T[se]=N[se];for(T[31]=N[31]&127|64,T[0]&=248,Bt(q,k),se=0;se<16;se++)Y[se]=q[se],ye[se]=ae[se]=ne[se]=0;for(ae[0]=ye[0]=1,se=254;se>=0;--se)I=T[se>>>3]>>>(se&7)&1,ke(ae,Y,I),ke(ne,ye,I),gt(Re,ae,ne),bt(ae,ae,ne),gt(ne,Y,ye),bt(Y,Y,ye),Je(ye,Re),Je(it,ae),ue(ae,ne,ae),ue(ne,Y,Re),gt(Re,ae,ne),bt(ae,ae,ne),Je(Y,ae),bt(ne,ye,it),ue(ae,ne,g),gt(ae,ae,ye),ue(ne,ne,ae),ue(ae,ye,it),ue(ye,Y,q),Je(Y,Re),ke(ae,Y,I),ke(ne,ye,I);for(se=0;se<16;se++)q[se+16]=ae[se],q[se+32]=ne[se],q[se+48]=Y[se],q[se+64]=ye[se];var Ft=q.subarray(32),Hn=q.subarray(16);return jn(Ft,Ft),ue(Hn,Hn,Ft),Te(A,Hn),0}function Fe(A,N){return ve(A,N,c)}function St(A,N){return i(N,32),Fe(A,N)}function lt(A,N,k){var T=new Uint8Array(32);return ve(T,k,N),K(A,o,T,U)}var Pr=oe,Bo=_e;function oa(A,N,k,T,q,I){var se=new Uint8Array(32);return lt(se,q,I),Pr(A,N,k,T,se)}function la(A,N,k,T,q,I){var se=new Uint8Array(32);return lt(se,q,I),Bo(A,N,k,T,se)}function cr(){var A=0,N=0,k=0,T=0,q=65535,I,se,ae;for(ae=0;ae<arguments.length;ae++)I=arguments[ae].lo,se=arguments[ae].hi,A+=I&q,N+=I>>>16,k+=se&q,T+=se>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new t(k&q|T<<16,A&q|N<<16)}function Po(A,N){return new t(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function ni(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new t(N,A)}function ct(A,N){var k,T,q=32-N;return N<32?(k=A.hi>>>N|A.lo<<q,T=A.lo>>>N|A.hi<<q):N<64&&(k=A.lo>>>N|A.hi<<q,T=A.hi>>>N|A.lo<<q),new t(k,T)}function Ru(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,q=A.lo&N.lo^~A.lo&k.lo;return new t(T,q)}function Uo(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,q=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new t(T,q)}function zo(A){return ni(ct(A,28),ct(A,34),ct(A,39))}function ri(A){return ni(ct(A,14),ct(A,18),ct(A,41))}function Du(A){return ni(ct(A,1),ct(A,8),Po(A,7))}function Io(A){return ni(ct(A,19),ct(A,61),Po(A,6))}var qu=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function $o(A,N,k){var T=[],q=[],I=[],se=[],ae,Y,ne;for(Y=0;Y<8;Y++)T[Y]=I[Y]=C(A,8*Y);for(var ye=0;k>=128;){for(Y=0;Y<16;Y++)se[Y]=C(N,8*Y+ye);for(Y=0;Y<80;Y++){for(ne=0;ne<8;ne++)q[ne]=I[ne];for(ae=cr(I[7],ri(I[4]),Ru(I[4],I[5],I[6]),qu[Y],se[Y%16]),q[7]=cr(ae,zo(I[0]),Uo(I[0],I[1],I[2])),q[3]=cr(q[3],ae),ne=0;ne<8;ne++)I[(ne+1)%8]=q[ne];if(Y%16===15)for(ne=0;ne<16;ne++)se[ne]=cr(se[ne],se[(ne+9)%16],Du(se[(ne+1)%16]),Io(se[(ne+14)%16]))}for(Y=0;Y<8;Y++)I[Y]=cr(I[Y],T[Y]),T[Y]=I[Y];ye+=128,k-=128}for(Y=0;Y<8;Y++)P(A,8*Y,T[Y]);return k}var As=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 xt(A,N,k){var T=new Uint8Array(64),q=new Uint8Array(256),I,se=k;for(I=0;I<64;I++)T[I]=As[I];for($o(T,N,k),k%=128,I=0;I<256;I++)q[I]=0;for(I=0;I<k;I++)q[I]=N[se-k+I];for(q[k]=128,k=256-128*(k<112?1:0),q[k-9]=0,P(q,k-8,new t(se/536870912|0,se<<3)),$o(T,q,k),I=0;I<64;I++)A[I]=T[I];return 0}function an(A,N){var k=s(),T=s(),q=s(),I=s(),se=s(),ae=s(),Y=s(),ne=s(),ye=s();bt(k,A[1],A[0]),bt(ye,N[1],N[0]),ue(k,k,ye),gt(T,A[0],A[1]),gt(ye,N[0],N[1]),ue(T,T,ye),ue(q,A[3],N[3]),ue(q,q,m),ue(I,A[2],N[2]),gt(I,I,I),bt(se,T,k),bt(ae,I,q),gt(Y,I,q),gt(ne,T,k),ue(A[0],se,ae),ue(A[1],ne,Y),ue(A[2],Y,ae),ue(A[3],se,ne)}function Ht(A,N,k){var T;for(T=0;T<4;T++)ke(A[T],N[T],k)}function ca(A,N){var k=s(),T=s(),q=s();jn(q,N[2]),ue(k,N[0],q),ue(T,N[1],q),Te(A,T),A[31]^=Nt(k)<<7}function ua(A,N,k){var T,q;for(Se(A[0],d),Se(A[1],y),Se(A[2],y),Se(A[3],d),q=255;q>=0;--q)T=k[q/8|0]>>(q&7)&1,Ht(A,N,T),an(N,A),an(A,A),Ht(A,N,T)}function si(A,N){var k=[s(),s(),s(),s()];Se(k[0],b),Se(k[1],x),Se(k[2],y),ue(k[3],b,x),ua(A,k,N)}function Ur(A,N,k){var T=new Uint8Array(64),q=[s(),s(),s(),s()],I;for(k||i(N,32),xt(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,si(q,T),ca(A,q),I=0;I<32;I++)N[I+32]=A[I];return 0}var ur=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 zr(A,N){var k,T,q,I;for(T=63;T>=32;--T){for(k=0,q=T-32,I=T-12;q<I;++q)N[q]+=k-16*N[T]*ur[q-(T-32)],k=Math.floor((N[q]+128)/256),N[q]-=k*256;N[q]+=k,N[T]=0}for(k=0,q=0;q<32;q++)N[q]+=k-(N[31]>>4)*ur[q],k=N[q]>>8,N[q]&=255;for(q=0;q<32;q++)N[q]-=k*ur[q];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function In(A){var N=new Float64Array(64),k;for(k=0;k<64;k++)N[k]=A[k];for(k=0;k<64;k++)A[k]=0;zr(A,N)}function js(A,N,k,T){var q=new Uint8Array(64),I=new Uint8Array(64),se=new Uint8Array(64),ae,Y,ne=new Float64Array(64),ye=[s(),s(),s(),s()];xt(q,T,32),q[0]&=248,q[31]&=127,q[31]|=64;var Re=k+64;for(ae=0;ae<k;ae++)A[64+ae]=N[ae];for(ae=0;ae<32;ae++)A[32+ae]=q[32+ae];for(xt(se,A.subarray(32),k+32),In(se),si(ye,se),ca(A,ye),ae=32;ae<64;ae++)A[ae]=T[ae];for(xt(I,A,k+64),In(I),ae=0;ae<64;ae++)ne[ae]=0;for(ae=0;ae<32;ae++)ne[ae]=se[ae];for(ae=0;ae<32;ae++)for(Y=0;Y<32;Y++)ne[ae+Y]+=I[ae]*q[Y];return zr(A.subarray(32),ne),Re}function ks(A,N){var k=s(),T=s(),q=s(),I=s(),se=s(),ae=s(),Y=s();return Se(A[2],y),Bt(A[1],N),Je(q,A[1]),ue(I,q,f),bt(q,q,A[2]),gt(I,A[2],I),Je(se,I),Je(ae,se),ue(Y,ae,se),ue(k,Y,q),ue(k,k,I),lr(k,k),ue(k,k,q),ue(k,k,I),ue(k,k,I),ue(A[0],k,I),Je(T,A[0]),ue(T,T,I),st(T,q)&&ue(A[0],A[0],v),Je(T,A[0]),ue(T,T,I),st(T,q)?-1:(Nt(A[0])===N[31]>>7&&bt(A[0],d,A[0]),ue(A[3],A[0],A[1]),0)}function fa(A,N,k,T){var q,I=new Uint8Array(32),se=new Uint8Array(64),ae=[s(),s(),s(),s()],Y=[s(),s(),s(),s()];if(k<64||ks(Y,T))return-1;for(q=0;q<k;q++)A[q]=N[q];for(q=0;q<32;q++)A[q+32]=T[q];if(xt(se,A,k),In(se),ua(ae,Y,se),si(Y,N.subarray(32)),an(ae,Y),ca(I,ae),k-=64,R(N,0,I,0)){for(q=0;q<k;q++)A[q]=0;return-1}for(q=0;q<k;q++)A[q]=N[q+64];return k}var ii=32,Ir=24,$n=32,$r=16,Hr=32,Ns=32,Fr=32,fr=32,Ts=32,ha=Ir,Ho=$n,Zn=$r,nt=64,dt=32,on=64,Cs=32,da=64;n.lowlevel={crypto_core_hsalsa20:K,crypto_stream_xor:he,crypto_stream:J,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:X,crypto_onetimeauth:H,crypto_onetimeauth_verify:Z,crypto_verify_16:le,crypto_verify_32:R,crypto_secretbox:oe,crypto_secretbox_open:_e,crypto_scalarmult:ve,crypto_scalarmult_base:Fe,crypto_box_beforenm:lt,crypto_box_afternm:Pr,crypto_box:oa,crypto_box_open:la,crypto_box_keypair:St,crypto_hash:xt,crypto_sign:js,crypto_sign_keypair:Ur,crypto_sign_open:fa,crypto_secretbox_KEYBYTES:ii,crypto_secretbox_NONCEBYTES:Ir,crypto_secretbox_ZEROBYTES:$n,crypto_secretbox_BOXZEROBYTES:$r,crypto_scalarmult_BYTES:Hr,crypto_scalarmult_SCALARBYTES:Ns,crypto_box_PUBLICKEYBYTES:Fr,crypto_box_SECRETKEYBYTES:fr,crypto_box_BEFORENMBYTES:Ts,crypto_box_NONCEBYTES:ha,crypto_box_ZEROBYTES:Ho,crypto_box_BOXZEROBYTES:Zn,crypto_sign_BYTES:nt,crypto_sign_PUBLICKEYBYTES:dt,crypto_sign_SECRETKEYBYTES:on,crypto_sign_SEEDBYTES:Cs,crypto_hash_BYTES:da,gf:s,D:f,L:ur,pack25519:Te,unpack25519:Bt,M:ue,A:gt,S:Je,Z:bt,pow2523:lr,add:an,set25519:Se,modL:zr,scalarmult:ua,scalarbase:si};function Fo(A,N){if(A.length!==ii)throw new Error("bad key size");if(N.length!==Ir)throw new Error("bad nonce size")}function Go(A,N){if(A.length!==Fr)throw new Error("bad public key size");if(N.length!==fr)throw new Error("bad secret key size")}function Tt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ai(A){for(var N=0;N<A.length;N++)A[N]=0}n.randomBytes=function(A){var N=new Uint8Array(A);return i(N,A),N},n.secretbox=function(A,N,k){Tt(A,N,k),Fo(k,N);for(var T=new Uint8Array($n+A.length),q=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+$n]=A[I];return oe(q,T,T.length,N,k),q.subarray($r)},n.secretbox.open=function(A,N,k){Tt(A,N,k),Fo(k,N);for(var T=new Uint8Array($r+A.length),q=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+$r]=A[I];return T.length<32||_e(q,T,T.length,N,k)!==0?null:q.subarray($n)},n.secretbox.keyLength=ii,n.secretbox.nonceLength=Ir,n.secretbox.overheadLength=$r,n.scalarMult=function(A,N){if(Tt(A,N),A.length!==Ns)throw new Error("bad n size");if(N.length!==Hr)throw new Error("bad p size");var k=new Uint8Array(Hr);return ve(k,A,N),k},n.scalarMult.base=function(A){if(Tt(A),A.length!==Ns)throw new Error("bad n size");var N=new Uint8Array(Hr);return Fe(N,A),N},n.scalarMult.scalarLength=Ns,n.scalarMult.groupElementLength=Hr,n.box=function(A,N,k,T){var q=n.box.before(k,T);return n.secretbox(A,N,q)},n.box.before=function(A,N){Tt(A,N),Go(A,N);var k=new Uint8Array(Ts);return lt(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var q=n.box.before(k,T);return n.secretbox.open(A,N,q)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Fr),N=new Uint8Array(fr);return St(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(Tt(A),A.length!==fr)throw new Error("bad secret key size");var N=new Uint8Array(Fr);return Fe(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Fr,n.box.secretKeyLength=fr,n.box.sharedKeyLength=Ts,n.box.nonceLength=ha,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(Tt(A,N),N.length!==on)throw new Error("bad secret key size");var k=new Uint8Array(nt+A.length);return js(k,A,A.length,N),k},n.sign.open=function(A,N){if(Tt(A,N),N.length!==dt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=fa(k,A,A.length,N);if(T<0)return null;for(var q=new Uint8Array(T),I=0;I<q.length;I++)q[I]=k[I];return q},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(nt),q=0;q<T.length;q++)T[q]=k[q];return T},n.sign.detached.verify=function(A,N,k){if(Tt(A,N,k),N.length!==nt)throw new Error("bad signature size");if(k.length!==dt)throw new Error("bad public key size");var T=new Uint8Array(nt+A.length),q=new Uint8Array(nt+A.length),I;for(I=0;I<nt;I++)T[I]=N[I];for(I=0;I<A.length;I++)T[I+nt]=A[I];return fa(q,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(dt),N=new Uint8Array(on);return Ur(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(Tt(A),A.length!==on)throw new Error("bad secret key size");for(var N=new Uint8Array(dt),k=0;k<N.length;k++)N[k]=A[32+k];return{publicKey:N,secretKey:new Uint8Array(A)}},n.sign.keyPair.fromSeed=function(A){if(Tt(A),A.length!==Cs)throw new Error("bad seed size");for(var N=new Uint8Array(dt),k=new Uint8Array(on),T=0;T<32;T++)k[T]=A[T];return Ur(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=dt,n.sign.secretKeyLength=on,n.sign.seedLength=Cs,n.sign.signatureLength=nt,n.hash=function(A){Tt(A);var N=new Uint8Array(da);return xt(N,A,A.length),N},n.hash.hashLength=da,n.verify=function(A,N){return Tt(A,N),A.length===0||N.length===0||A.length!==N.length?!1:re(A,0,N,0,A.length)===0},n.setPRNG=function(A){i=A},(function(){var A=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(A&&A.getRandomValues){var N=65536;n.setPRNG(function(k,T){var q,I=new Uint8Array(T);for(q=0;q<T;q+=N)A.getRandomValues(I.subarray(q,q+Math.min(T-q,N)));for(q=0;q<T;q++)k[q]=I[q];ai(I)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var q,I=A.randomBytes(T);for(q=0;q<T;q++)k[q]=I[q];ai(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const ac=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;ac.sign.keyPair.fromSeed,ac.sign.detached,ac.sign.detached.verify,ac.randomBytes;var Jg;(function(n){n.InvalidPrefixByte="nkeys: invalid prefix byte",n.InvalidKey="nkeys: invalid key",n.InvalidPublicKey="nkeys: invalid public key",n.InvalidSeedLen="nkeys: invalid seed length",n.InvalidSeed="nkeys: invalid seed",n.InvalidEncoding="nkeys: invalid encoded key",n.InvalidSignature="nkeys: signature verification failed",n.CannotSign="nkeys: cannot sign, no private key available",n.PublicKeyOnly="nkeys: no seed or private key available",n.InvalidChecksum="nkeys: invalid checksum",n.SerializationError="nkeys: serialization error",n.ApiError="nkeys: api error",n.ClearedPair="nkeys: pair is cleared"})(Jg||(Jg={}));var Qg;(function(n){n[n.Seed=144]="Seed",n[n.Private=120]="Private",n[n.Operator=112]="Operator",n[n.Server=104]="Server",n[n.Cluster=16]="Cluster",n[n.Account=0]="Account",n[n.User=160]="User"})(Qg||(Qg={}));function YE(n){return t=>{let s={};return n.forEach(i=>{const o=i(t)||{};s=Object.assign(s,o)}),s}}function KE(){return()=>{}}function JE(n,t){return()=>{const s=typeof n=="function"?n():n,i=typeof t=="function"?t():t;return{user:s,pass:i}}}function QE(n){return()=>({auth_token:typeof n=="function"?n():n})}const dx=120*1e3,XE=2,mx=2*1e3;function WE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:dx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:mx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function ZE(n){const t=[];return typeof n.authenticator=="function"&&t.push(n.authenticator),Array.isArray(n.authenticator)&&t.push(...n.authenticator),n.token&&t.push(QE(n.token)),n.user&&t.push(JE(n.user,n.pass)),t.length===0?KE():YE(t)}function e2(n){const t=`${pd}:${ux()}`;if(n=n||{servers:[t]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new pe("port and servers options are mutually exclusive",ce.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${pd}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[t]);const s=wu(WE(),n);if(s.authenticator=ZE(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new pe(`${i} option should be a function`,ce.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Rr(s.inboxPrefix)}catch(i){throw new pe(i.message,ce.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Sd()=="function"),s.resolve&&typeof Sd()!="function")throw new pe("'resolve' is not supported on this client",ce.InvalidOption);return s}function t2(n,t){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&t.noEcho)throw new pe("noEcho",ce.ServerOptionNotAvailable);const c=i||o||!1;if(t.tls&&!c)throw new pe("tls",ce.ServerOptionNotAvailable)}const n2=1024*32,r2=/^INFO\s+([^\r\n]+)\r\n/i,s2=go(`PONG\r
|
|
38
|
+
`),Xg=go(`PING\r
|
|
39
|
+
`);class i2{constructor(t,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};wu(this,o)}}class px extends qt{constructor(s,i,o={}){var d;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");wu(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=ht();const c=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=ea(o.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(y=>{this.stop(y),this.noIterator&&this.callback(y,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(y,g)=>{const{ingest:f}=o(g);f&&c(g)&&(i(y,g),d(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(pe.errorForCode(ce.ConnectionClosed)):this.isClosed()?Promise.reject(pe.errorForCode(ce.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(ht()).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 a2{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,i=this.all();let o;if(s.operation==="subscription"&&(o=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(o=i.find(c=>c.requestSubject===s.subject)),o)return o.callback(t,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class mu{constructor(t,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=n2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new a2,this.muxSubscriptions=new $E,this.outbound=new na,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new wE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new IE(i,{randomize:!t.noRandomize}),this.closed=ht(),this.parser=new Kg(this),this.heartbeats=new HE(this,this.options.pingInterval||dx,this.options.maxPingOut||XE)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=pe.errorForCode(ce.Disconnect);s.stack="",t.forEach(i=>{i.reject(s)}),this.parser=new Kg(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new qt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=ht();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=OE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:Yi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Yi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Mr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Mr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ce.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let i;try{i=ea(this.options.timeout||2e4);const o=this.transport.connect(t,this.options);await Promise.race([o,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(o){s.reject(o)}try{await Promise.race([i,s]),i&&i.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw i&&i.cancel(),await this.transport.close(o),o}}async _doDial(t){const{resolve:s}=this.options,i=await t.resolve({fn:Sd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Yi.Reconnecting,data:c.toString()}),await this.dial(c);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 t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():mx;let i=s;const o=this.selectServer();if(!o||this.abortReconnect)throw t||(this.lastError?this.lastError:pe.errorForCode(ce.ConnectionRefused));const c=Date.now();if(o.lastConnect===0||o.lastConnect+s<=c){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(t=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const y=this.options.maxReconnectAttempts||0;y!==-1&&o.reconnects>=y&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await sa(i)}}static async connect(t,s){const i=new mu(t,s);return await i.dialLoop(),i}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new pe(t,ce.PermissionsViolation),o=t.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new pe(t,ce.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new pe(t,ce.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new pe(t,ce.AccountExpired):s.indexOf("authentication timeout")!==-1?new pe(t,ce.AuthenticationTimeout):new pe(t,ce.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(t.sid);i&&(i.received+=1,i.callback&&i.callback(null,new rm(t,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(t){const s=Rg(t),i=mu.toError(s),o={type:Mr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){o.permissionContext=i.permissionContext;const d=this.subscriptions.getMux();c=(d==null?void 0:d.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(i)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(s2)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(Rg(t));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Zs(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:d}=this.transport;try{const y=new i2({version:c,lang:d},this.options,s.nonce);s.headers&&(y.headers=!0,y.no_responders=!0);const g=JSON.stringify(y);this.transport.send(go(`CONNECT ${g}${tu}`)),this.transport.send(Xg)}catch(y){this._close(y)}}i&&this.dispatchStatus({type:Mr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Mr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Kt.MSG:{const{msg:s,data:i}=t;this.processMsg(s,i);break}case Kt.OK:break;case Kt.ERR:this.processError(t.data);break;case Kt.PING:this.processPing();break;case Kt.PONG:this.processPong();break;case Kt.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const i=this.outbound.length();let o;typeof t=="string"?o=go(t):o=t,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=Sn,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ei.encode(s);else throw pe.errorForCode(ce.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let d=Sn,y=0;if(i.headers){if(this.info&&!this.info.headers)throw new pe("headers",ce.ServerOptionNotAvailable);d=i.headers.encode(),y=d.length,c=o.length+y}if(this.info&&c>this.info.max_payload)throw pe.errorForCode(ce.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${t} ${i.reply} ${y} ${c}\r
|
|
40
|
+
`:g=`HPUB ${t} ${y} ${c}\r
|
|
41
|
+
`,this.sendCommand(g,d,o,du)):(i.reply?g=`PUB ${t} ${i.reply} ${c}\r
|
|
42
|
+
`:g=`PUB ${t} ${c}\r
|
|
43
|
+
`,this.sendCommand(g,o,du))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
|
|
44
|
+
`):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
|
|
45
|
+
`)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
|
|
46
|
+
`):this.sendCommand(`UNSUB ${t.sid}\r
|
|
47
|
+
`),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=ht()),this.pongs.push(t),this.outbound.fill(Xg),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?t.push(`SUB ${i.subject} ${i.queue} ${i.sid}${tu}`):t.push(`SUB ${i.subject} ${i.sid}${tu}`)}),t.length&&this.transport.send(go(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.forEach(i=>{s.push(i.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new px(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const o2="$SRV";class Wg{constructor(t){j(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,s){return this.msg.respond(t,s)}respondError(t,s,i,o){var c,d;return o=o||{},o.headers=o.headers||qr(),(c=o.headers)==null||c.set(cu,`${t}`),(d=o.headers)==null||d.set(lu,s),this.msg.respond(i,o)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class So{constructor(t,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&c2("service group",s);let o="";if(t instanceof Co)this.srv=t,o="";else if(t instanceof So){const c=t;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),o=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=i}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const i=typeof s=="function"?{handler:s,subject:t}:s;mo("endpoint",t);let{subject:o,handler:c,metadata:d,queue:y}=i;o=o||t,y=y||this.queue,l2("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:t,subject:o,queue:y,handler:c,metadata:d};return this.srv._addEndpoint(g)}addGroup(t="",s=""){return new So(this,t,s)}}function l2(n,t){if(t==="")throw new Error(`${n} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((i,o)=>{if(i===">"&&o!==s.length-1)throw new Error(`${n} cannot have internal '>': '${t}'`)})}function c2(n,t){if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);t.split(".").forEach(i=>{if(i===">")throw new Error(`${n} name cannot contain internal '>': '${t}'`)})}class Co{constructor(t,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),mo("name",this.config.name),mo("queue",this.config.queue),Zs(this.config.version),this._id=Es.next(),this.internal=[],this._done=ht(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(t,s="",i="",o){const c=o??o2;return s===""&&i===""?`${c}.${t}`:(mo("control subject name",s),i!==""?(mo("control subject id",i),`${c}.${t}.${s}.${i}`):`${c}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const s=qr();if(t instanceof uu){const i=t;s.set(lu,i.message),s.set(cu,`${i.code}`)}else s.set(lu,t.message),s.set(cu,"500");return s}setupHandler(t,s=!1){const i=s?"":t.queue?t.queue:this.config.queue,{name:o,subject:c,handler:d}=t,y=t;y.internal=s,s&&this.internal.push(y),y.stats=new u2(o,c,i),y.queue=i;const g=d?(f,m)=>{if(f){this.close(f);return}const b=Date.now();try{d(f,new Wg(m))}catch(x){y.stats.countError(x),m==null||m.respond(Sn,{headers:this.errorToHeader(x)})}finally{y.stats.countLatency(b)}}:void 0;return y.sub=this.nc.subscribe(c,{callback:g,queue:i}),y.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const m=new Error(`required subscription ${t.subject} errored: ${f.message}`);m.stack=f.stack,this.close(m).catch()}}),y}info(){return{type:bo.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:i,name:o,queue:c}=t;return{subject:s,metadata:i,name:o,queue_group:c}})}async stats(){const t=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}t.push(s.stats.stats(s.qi))}return{type:bo.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const i=`${t}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,t,s),this._doAddInternalHandler(`${i}-kind`,t,s,this.name),this._doAddInternalHandler(`${i}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,i,o="",c=""){const d={};d.name=t,d.subject=Co.controlSubject(s,o,c),d.handler=i,this.setupHandler(d,!0)}start(){const t=Xn(),s=(d,y)=>d?(this.close(d),Promise.reject(d)):this.stats().then(g=>(y==null||y.respond(t.encode(g)),Promise.resolve())),i=(d,y)=>d?(this.close(d),Promise.reject(d)):(y==null||y.respond(t.encode(this.info())),Promise.resolve()),o=t.encode(this.ping()),c=(d,y)=>d?(this.close(d).then().catch(),Promise.reject(d)):(y.respond(o),Promise.resolve());return this.addInternalHandler(xs.PING,c),this.addInternalHandler(xs.STATS,s),this.addInternalHandler(xs.INFO,i),this.handlers.forEach(d=>{const{subject:y}=d;typeof y=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:bo.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new So(this,t,s)}addEndpoint(t,s){return new So(this).addEndpoint(t,s)}_addEndpoint(t){const s=new qt;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(o,c)=>{o?this.stop(o).catch():s.push(new Wg(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(t,!1);return i.qi=s,this.handlers.push(i),s}}class u2{constructor(t,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=ft(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:d,last_error:y,data:g,queue:f}=this;return{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:d,last_error:y,data:g,queue_group:f}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=ft(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 f2{constructor(t,s={strategy:Qn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=t,this.prefix=i,this.opts=s}ping(t="",s=""){return this.q(xs.PING,t,s)}stats(t="",s=""){return this.q(xs.STATS,t,s)}info(t="",s=""){return this.q(xs.INFO,t,s)}async q(t,s="",i=""){const o=new qt,c=Xn(),d=Co.controlSubject(t,s,i,this.prefix),y=await this.nc.requestMany(d,Sn,this.opts);return(async()=>{for await(const g of y)try{const f=c.decode(g.data);o.push(f)}catch(f){o.push(()=>{o.stop(f)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function yx(){return{key:{encode(n){return n},decode(n){return n}},value:{encode(n){return n},decode(n){return n}}}}function h2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:yx(),storage:vd.File}}const pu="KV-Operation",Zg="$KV",d2=/^[-/=.\w]+$/,m2=/^[-/=.>*\w]+$/,p2=/^[-\w]+$/;function y2(n){if(n.startsWith(".")||n.endsWith(".")||!d2.test(n))throw new Error(`invalid key: ${n}`)}function g2(n){if(n.startsWith(".")||n.endsWith(".")||!m2.test(n))throw new Error(`invalid key: ${n}`)}function b2(n){if(n.startsWith(".")||n.endsWith("."))throw new Error(`invalid key: ${n}`);const t=n.split(".");let s=!1;for(let i=0;i<t.length;i++)switch(t[i]){case"*":s=!0;break;case">":if(i!==t.length-1)throw new Error(`invalid key: ${n}`);s=!0;break}return s}function nu(n){if(!p2.test(n))throw new Error(`invalid bucket name: ${n}`)}var sr;(function(n){n.MsgIdHdr="Nats-Msg-Id",n.ExpectedStreamHdr="Nats-Expected-Stream",n.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",n.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",n.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(sr||(sr={}));class Eo{constructor(t,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",y2);j(this,"validateSearchKey",g2);j(this,"hasWildcards",b2);nu(t),this.js=s,this.jsm=i,this.bucket=t,this.prefix=Zg,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,i={}){nu(s);const o=await t.jetstreamManager(),c=new Eo(s,t,o);return await c.init(i),c}static async bind(t,s,i={}){const o=await t.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};nu(s);const d=new Eo(s,t,o);return c.config.name=i.streamName??d.bucketName(),Object.assign(d,c),d.stream=c.config.name,d.codec=i.codec||yx(),d.direct=c.config.allow_direct??!1,d.initializePrefixes(c),d}async init(t={}){const s=Object.assign(h2(),t);this.codec=s.codec;const i={};this.stream=i.name=t.streamName??this.bucketName(),i.retention=xd.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const o=t.placementCluster??"";if(o&&(t.placement={},t.placement.cluster=o,t.placement.tags=[]),t.placement&&(i.placement=t.placement),t.republish&&(i.republish=t.republish),t.description&&(i.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(bn)||(b.name=`${bn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(t.sources){const b=t.sources.map(x=>{const v=Object.assign({},x),_=v.name.startsWith(bn)?v.name.substring(bn.length):v.name;return v.name.startsWith(bn)||(v.name=`${bn}${v.name}`),!x.external&&_!==this.bucket&&(v.subject_transforms=[{src:`$KV.${_}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?Os.S2:Os.None);const c=this.js.nc,d=c.getServerVersion(),y=d?wd(d,Zs("2.7.2"))>=0:!1;i.discard=y?wo.New:wo.Old;const{ok:g,min:f}=c.features.get(Ge.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,i.allow_direct=t.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=ft(s.ttl)),i.allow_rollup_hdrs=!0;let m;try{m=await this.jsm.streams.info(i.name),!m.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")m=await this.jsm.streams.add(i);else throw b}this.initializePrefixes(m)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=t.config;if(s){let i=s.name;if(i.startsWith(bn)&&(i=i.substring(bn.length)),s.external&&s.external.api!==""){const o=s.name.substring(bn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${bn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(t),i.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${Zg}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(t,s){const i=s&&s.get(Qt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):t.length}smToEntry(t){return new R2(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new D2(this.bucket,s,t)}async create(t,s){var c;let i;try{const d=await this.put(t,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(i=d,((c=d==null?void 0:d.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(t);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(t,s,o)):Promise.reject(i)}catch(d){return Promise.reject(d)}}update(t,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:i})}async put(t,s,i={}){var d,y;const o=this.encodeKey(t);this.validateKey(o);const c={};if(i.previousSeq!==void 0){const g=qr();c.headers=g,g.set(sr.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,c)).seq}catch(g){const f=g;return f.isJetStreamError()?(f.message=(d=f.api_error)==null?void 0:d.description,f.code=`${(y=f.api_error)==null?void 0:y.code}`,Promise.reject(f)):Promise.reject(g)}}async get(t,s){const i=this.encodeKey(t);this.validateKey(i);let o={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(o={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),o):c=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(c);return d.key!==i?null:d}catch(d){if(d.code===ce.JetStream404NoMessages)return null;throw d}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=ht(),i=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,o.stop();const c=Date.now()-t,d=i.map(g=>{const f=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),y=await Promise.all(d);return y.unshift({success:!0,purged:0}),y.reduce((g,f)=>(g.purged+=f.purged,g))}async _deleteOrPurge(t,s,i){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,i);const o=await this.keys(t),c=[];for await(const d of o)c.push(this._doDeleteOrPurge(d,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,s,i){const o=this.encodeKey(t);this.validateKey(o);const c=qr();c.set(pu,s),s==="PURGE"&&c.set(Qt.RollupHdr,Qt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(sr.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),Sn,{headers:c})}_buildCC(t,s,i={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const f=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(f)}),d=wt.LastPerSubject;s===Kn.AllHistory&&(d=wt.All),s===Kn.UpdatesOnly&&(d=wt.New);let y;return c.length===1&&(y=c[0],c=void 0),Object.assign({deliver_policy:d,ack_policy:Dt.None,filter_subjects:c,filter_subject:y,flow_control:!0,idle_heartbeat:ft(5*1e3)},i)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",i=new qt,o={};o.headers_only=t.headers_only||!1;let c;c=()=>{i.stop()};let d=0;const y=this._buildCC(s,Kn.AllHistory,o),g=y.filter_subject,f=_s(y);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&d>0&&i.received>=d||x.info.pending===0)&&(i.push(c),c=void 0)}});const m=await this.js.subscribe(g,f);if(c){const{info:{last:b}}=m,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else d=x}return i._data=m,i.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get(Ge.JS_NEW_CONSUMER_CREATE_API);return i}async watch(t={}){const s=t.key??">",i=new qt,o={};o.headers_only=t.headers_only||!1;let c=Kn.LastValue;t.include===Kn.AllHistory?c=Kn.AllHistory:t.include===Kn.UpdatesOnly&&(c=Kn.UpdatesOnly);const d=t.ignoreDeletes===!0;let y=t.initializedFn,g=0;const f=this._buildCC(s,c,o),m=f.filter_subject,b=_s(f);this.canSetWatcherName()&&b.consumerName(Es.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((v,_)=>{if(v){i.stop(v);return}if(_){const S=this.jmToEntry(_);if(d&&S.operation==="DEL")return;i.push(S),i.received++,y&&(g>0&&i.received>=g||_.info.pending===0)&&(i.push(y),y=void 0)}});const x=await this.js.subscribe(m,b);if(y){const{info:{last:v}}=x,_=v.num_pending+v.delivered.consumer_seq;if(_===0||i.received>=_)try{y()}catch(S){i.stop(S)}finally{y=void 0}else g=_}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(t=">"){const s=new qt,i=this._buildCC(t,Kn.LastValue,{headers_only:!0}),o=Array.isArray(t)?">":i.filter_subject,c=_s(i);c.bindStream(this.stream),c.orderedConsumer();const d=await this.js.subscribe(o,c);return(async()=>{var g;for await(const f of d){const m=(g=f.headers)==null?void 0:g.get(pu);if(m!=="DEL"&&m!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));s.push(b)}f.info.pending===0&&d.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),d.info.last.num_pending===0&&d.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),o=await this.jsm.streams.info(i);return new gx(o,s)}}class gx{constructor(t,s=""){j(this,"si");j(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(bn)?this.si.config.name.substring(bn.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 nm(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Os.None:!1}}const im="OBJ_",e1="SHA-256=";function x2(n){return nu(n),`${im}${n}`}function v2(n){return n.startsWith(im)?n.substring(4):n}class Ad{constructor(t){j(this,"si");j(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return v2(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!==Os.None:!1}}function oc(n){if(n===void 0)return;const{domain:t}=n;if(t===void 0)return n;const s=Object.assign({},n);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var Pn;(function(n){n[n.Unset=-1]="Unset",n[n.Consume=0]="Consume",n[n.Fetch=1]="Fetch"})(Pn||(Pn={}));var ir;(function(n){n.HeartbeatsMissed="heartbeats_missed",n.ConsumerNotFound="consumer_not_found",n.StreamNotFound="stream_not_found",n.ConsumerDeleted="consumer_deleted",n.OrderedConsumerRecreated="ordered_consumer_recreated",n.NoResponders="no_responders"})(ir||(ir={}));var Xi;(function(n){n.DebugEvent="debug",n.Discard="discard",n.Reset="reset",n.Next="next"})(Xi||(Xi={}));const t1=Uint8Array.of(43,65,67,75),_2=Uint8Array.of(45,78,65,75),ro=Uint8Array.of(43,87,80,73),w2=Uint8Array.of(43,78,88,84),S2=Uint8Array.of(43,84,69,82,77),E2=Uint8Array.of(32);function Oo(n,t=5e3){return new I2(n,t)}class Zh extends qt{constructor(s,i,o=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,o),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=Rr(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:o,threshold_bytes:c,threshold_messages:d}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:y}=this;y&&y.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,f)=>{var b,x,v,_;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(bd(f))return;const S=(x=f.headers)==null?void 0:x.code,C=((_=(v=f.headers)==null?void 0:v.description)==null?void 0:_.toLowerCase())||"unknown",{msgsLeft:L,bytesLeft:P}=this.parseDiscard(f.headers);if(L>0||P>0)this.pending.msgs-=L,this.pending.bytes-=P,this.pending.requests--,this.notify(Xi.Discard,{msgsLeft:L,bytesLeft:P});else if(S===400){this.stop(new pe(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(ir.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const re=new pe(C,`${S}`);this.stop(re);return}}else if(S===503){if(this.notify(ir.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const re=new pe("no responders",`${S}`);this.stop(re);return}}else this.notify(Xi.DebugEvent,`${S} ${C}`)}else this._push(Oo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=d||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new sm(o,g=>(this.notify(ir.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const m of g)switch(m.type){case Mr.Disconnect:(f=this.monitor)==null||f.cancel();break;case Mr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(o){this.stop(o)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,i=0;const o=tm([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(i++,this.notify(ir.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(ir.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,i=0;this.inBackOff=!0;const y=o.backoff(c),g=sa(y);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Xi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,o=ft(this.opts.idle_heartbeat),c=ft(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:o,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Qt.PendingMessagesHdr);o&&(i.msgsLeft=parseInt(o));const c=s==null?void 0:s.get(Qt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,o;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!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,i){const c=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||c;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const s=new qt;return this.listeners.push(s),Promise.resolve(s)}}class O2 extends qt{constructor(){super();j(this,"src");j(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const o of i)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.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 qt;return this.listeners.push(s),Promise.resolve(s)}}class jd{constructor(t,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Zh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new Zh(this,t,!1),i=Math.round(s.opts.expires*1.05),o=ea(i);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(t={expires:3e4}){const s=ht(),i=t;i.max_messages=1;const o=new Zh(this,i,!1),c=Math.round(o.opts.expires*1.05);c>=6e4&&(async()=>{for await(const y of await o.status())if(y.type===ir.HeartbeatsMissed&&y.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const y of o){s.resolve(y);break}})().catch(()=>{});const d=ea(c);return o.closed().then(y=>{y?s.reject(y):s.resolve(null)}).catch(y=>{s.reject(y)}).finally(()=>{d.cancel()}),d.catch(y=>{s.resolve(null),o.close().catch()}),o.trackTimeout(d),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(o=>(this._info=o,this._info))}}class A2{constructor(t,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Es.next(),typeof i.name_prefix=="string"&&(Su("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Pn.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const i={name:s,deliver_policy:wt.StartSequence,opt_start_seq:t,ack_policy:Dt.None,inactive_threshold:ft(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||wt.StartSequence,(this.consumerOpts.deliver_policy===wt.LastPerSubject||this.consumerOpts.deliver_policy===wt.New||this.consumerOpts.deliver_policy===wt.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===wt.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=wt.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=ft(this.consumerOpts.inactive_threshold))),i}async resetConsumer(t=0){var d,y,g,f,m;Es.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(t);i.max_deliver=1,i.mem_storage=!0;const o=tm([((y=this.opts)==null?void 0:y.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(ir.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((f=this.iter)==null||f.notify(ir.StreamNotFound,b),this.type===Pn.Fetch||this.opts.abort_on_missing_resource===!0))return(m=this.iter)==null||m.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await sa(o.backoff(b+1))}return c}internalHandler(t){return s=>{var o;if(this.serial!==t)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(t={max_messages:100,expires:3e4},s){var g,f;s=s||{};const i=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===Pn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new O2),this.consumer=new jd(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let d=null;this.type===Pn.Fetch&&i?d=await this.consumer.fetch(t):this.type===Pn.Consume&&(d=await this.consumer.consume(t));const y=d;y.forOrderedConsumer=!0,y.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(y)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(Xi.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Pn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Pn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Pn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var o;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Pn.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:i}=t;return i&&(this.userCallback=i),this.type=Pn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=ht();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class kd{constructor(t){j(this,"api");j(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ge.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new jd(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new jd(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(t,s){await this.checkVersion();const i=this.api;return new am(i.nc,i.opts).info(t).then(c=>Promise.resolve(new A2(this.api,t,s))).catch(c=>Promise.reject(c))}}class Ou{constructor(t,s){j(this,"api");j(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new Ou(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(t){return new kd(new hu(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new kd(new hu(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class am extends To{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:o,ok:c}=s.features.get(Ge.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${o}`)}if(t.first_seq){const{min:o,ok:c}=s.features.get(Ge.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${o}`)}if(t.subject_transform){const{min:o,ok:c}=s.features.get(Ge.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(t.compression){const{min:o,ok:c}=s.features.get(Ge.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${o}`)}if(t.consumer_limits){const{min:o,ok:c}=s.features.get(Ge.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function i(o,c){var y;if((((y=c==null?void 0:c.subject_transforms)==null?void 0:y.length)||0)>0){const{min:g,ok:f}=s.features.get(Ge.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(o=>{i("stream sources",o)}),t.mirror&&i("stream mirror",t.mirror)}async add(t={}){var o;this.checkStreamConfigVersions(t),Yt(t.name),t.mirror=oc(t.mirror),t.sources=(o=t.sources)==null?void 0:o.map(oc);const i=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(i),i}async delete(t){return Yt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var y;if(typeof t=="object"){const g=t;t=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Yt(t);const i=await this.info(t),o=Object.assign(i.config,s);o.mirror=oc(o.mirror),o.sources=(y=o.sources)==null?void 0:y.map(oc);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,o);return this._fixInfo(d),d}async info(t,s){Yt(t);const i=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(i,s),{total:d,limit:y}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(d&&d>g){const f=[c],m=s||{};let b=0;for(;d>g;){b++,m.offset=y*b;const v=await this._request(i,m);d=v.total,f.push(v);const _=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=_,_<y)break}let x={};for(let v=0;v<f.length;v++)c=f[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>{const d=c;return d.streams.forEach(y=>{this._fixInfo(y)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new po(o,i,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:o,seq:c}=s;if(typeof o=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Yt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,i=!0){Yt(t);const o={seq:s};return i||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,o)).success}async getMessage(t,s){Yt(t);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new bx(o)}find(t){return this.findStream(t)}listKvs(){const t=i=>{var g;const c=i.streams.filter(f=>f.config.name.startsWith(bn));c.forEach(f=>{this._fixInfo(f)});let d="";return c.length&&(d=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(f=>new gx(f,d))},s=`${this.prefix}.STREAM.LIST`;return new po(s,t,this)}listObjectStores(){const t=i=>{const c=i.streams.filter(y=>y.config.name.startsWith(im));return c.forEach(y=>{this._fixInfo(y)}),c.map(y=>new Ad(y))},s=`${this.prefix}.STREAM.LIST`;return new po(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>c.streams,o=`${this.prefix}.STREAM.NAMES`;return new po(o,i,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new Ou(this,s))}}class j2 extends To{constructor(t,s){super(t,s)}async getMessage(t,s){Yt(t);let i=s;const{last_by_subj:o}=i;o&&(i=null);const c=i?this.jc.encode(i):Sn,d=this.opts.apiPrefix||"$JS.API",y=o?`${d}.DIRECT.GET.${t}.${o}`:`${d}.DIRECT.GET.${t}`,g=await this.nc.request(y,c,{timeout:this.timeout}),f=Ji(g);if(f)return Promise.reject(f);const m=new Nd(g);return Promise.resolve(m)}async getBatch(t,s){Yt(t);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,f)=>g==="up_to_time"&&f instanceof Date?f.toISOString():f),d=new qt,y=await this.nc.requestMany(o,c,{strategy:Qn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,f=!1,m;for await(const _ of y){if(!g){g=!0;const S=((b=_.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){m=(x=_.headers)==null?void 0:x.description.toLowerCase();break}if(((v=_.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){f=!0;break}}if(_.data.length===0)break;d.push(new Nd(_))}d.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(m)throw new Error(`bad request: ${m}`);d.stop()})})(),Promise.resolve(d)}}class Nd{constructor(t){j(this,"data");j(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Vi.Subject)}get seq(){const t=this.header.last(Vi.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Vi.TimeStamp)}get stream(){return this.header.last(Vi.Stream)}json(t){return Xn(t).decode(this.data)}string(){return vn.decode(this.data)}}j(Nd,"jc");class k2 extends To{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new am(s,i),this.consumers=new hu(s,i),this.direct=new j2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new qt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,o)=>{if(i)throw i;try{const c=this.parseJsResponse(o),d=c.type.split("."),y=d[d.length-1];s.push({kind:y,data:c})}catch(c){s.stop(c)}}}),s}}class bx{constructor(t){j(this,"_header");j(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):Sn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=vs.decode(t)}else this._header=qr();return this._header}_parse(t){const s=atob(t),i=s.length,o=new Uint8Array(i);for(let c=0;c<i;c++)o[c]=s.charCodeAt(c);return o}json(t){return Xn(t).decode(this.data)}string(){return vn.decode(this.data)}}j(bx,"jc");class N2{constructor(t){j(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new Ou(this.api,s))}}class ed{constructor(t){j(this,"info");j(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=vs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function n1(n){const t={name:n.name,description:n.description??"",options:n.options,metadata:n.metadata};if(n.headers){const s=n.headers;t.headers=s.toRecord()}return t}function T2(){return new ReadableStream({pull(n){n.enqueue(new Uint8Array(0)),n.close()}})}class vo{constructor(t,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=t,this.jsm=s,this.js=i}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new ed(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;t.push(i)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:i}=this._checkNotEmpty(t);if(i)return Promise.reject(i);const o=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),y=Xn().decode(c.data);return y.revision=c.seq,y}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new Ad(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Ad(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,s,i){var le;const o=this.js.getOptions();i=i||{timeout:o.timeout},i.timeout=i.timeout||o.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:d}=i,y=this.js.nc.info,g=(y==null?void 0:y.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((le=t.options)==null?void 0:le.max_chunk_size)||128*1024;f=f>g?g:f,t.options.max_chunk_size=f;const m=await this.info(t.name),{name:b,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Es.next(),_=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},n1(t)),L=ht(),P=[],re=new na;try{const R=s?s.getReader():null,$=Gg.create();for(;;){const{done:ee,value:K}=R?await R.read():{done:!0,value:void 0};if(ee){if(re.size()>0){const J=re.drain();$.update(J),C.chunks++,C.size+=J.length,P.push(this.js.publish(_,J,{timeout:c}))}await Promise.all(P),P.length=0,C.mtime=new Date().toISOString();const U=Qi.encode($.digest());C.digest=`${e1}${U}`,C.deleted=!1;const D=qr();typeof d=="number"&&D.set(sr.ExpectedLastSubjectSequenceHdr,`${d}`),D.set(Qt.RollupHdr,Qt.RollupValueSubject);const X=await this.js.publish(S,Xn().encode(C),{headers:D,timeout:c});if(C.revision=X.seq,m)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${m.nuid}`})}catch{}L.resolve(new ed(C));break}if(K)for(re.fill(K);re.size()>f;){C.chunks++,C.size+=f;const U=re.drain(t.options.max_chunk_size);$.update(U),P.push(this.js.publish(_,U,{timeout:c}))}}}catch(R){await this.jsm.streams.purge(this.stream,{filter:_}),L.reject(R)}return L}putBlob(t,s,i){function o(c){return new ReadableStream({pull(d){d.enqueue(c),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,o(s),i)}put(t,s,i){var o;return(o=t==null?void 0:t.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,i)}async getBlob(t){async function s(c){const d=new na,y=c.getReader();for(;;){const{done:g,value:f}=await y.read();if(g)return d.drain();f&&f.length&&d.fill(f)}}const i=await this.get(t);if(i===null)return Promise.resolve(null);const o=await Promise.all([i.error,s(i.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await vo.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(e1))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=_d(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=ht(),c={info:new ed(s),error:o};if(s.size===0)return c.data=T2(),o.resolve(null),Promise.resolve(c);let d;const y=_s();y.orderedConsumer();const g=Gg.create(),f=`$O.${this.name}.C.${s.nuid}`,m=await this.js.subscribe(f,y);return(async()=>{for await(const b of m)b.data.length>0&&(g.update(b.data),d.enqueue(b.data)),b.info.pending===0&&(bE(i,g.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),m.unsubscribe())})().then(()=>{o.resolve()}).catch(b=>{d.error(b),o.reject(b)}),c.data=new ReadableStream({start(b){d=b},cancel(){m.unsubscribe()}}),c}linkStore(t,s){if(!(s instanceof vo))return Promise.reject("bucket required");const i=s,{name:o,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const d={name:o,options:{link:{bucket:i.name}}};return this._put(d,null)}async link(t,s){const{name:i,error:o}=this._checkNotEmpty(t);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 c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},y={name:i,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(t),JSON.stringify(y));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Xn(),o=qr();return o.set(Qt.RollupHdr,Qt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(t,s={}){const i=await this.rawInfo(t);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:o,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(t!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const d=Object.assign({},i,n1(s)),y=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return t!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(y)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let s=!1;const i=new qt,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Xn(),d=_s();d.orderedConsumer(),t.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((g,f)=>{var m;if(g){i.stop(g);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||i.push(b),((m=f.info)==null?void 0:m.pending)===0&&!s&&(s=!0,i.push(null))}});const y=await this.js.subscribe(o,d);return i._data=y,i.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Qi.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=x2(this.name)}catch(o){return Promise.reject(o)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const i=Object.assign({max_age:s},t);i.name=this.stream,i.num_replicas=t.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=wo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(i.placement=t.placement),t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?Os.S2:Os.None);try{await this.jsm.streams.info(i.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(t,s,i={}){const o=await t.jetstreamManager(),c=new vo(s,o,t);return await c.init(i),Promise.resolve(c)}}class C2{constructor(t){j(this,"js");this.js=t}kv(t,s={}){const i=this.js,{ok:o,min:c}=i.nc.features.get(Ge.JS_KV);return o?s.bindOnly?Eo.bind(this.js,t,s):Eo.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,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 i=this.js,{ok:o,min:c}=i.nc.features.get(Ge.JS_OBJECTSTORE);return o?vo.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class om extends To{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new hu(s,i),this.streamAPI=new am(s,i),this.consumers=new kd(this.consumerAPI),this.streams=new N2(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new C2(this)}async publish(s,i=Sn,o){o=o||{},o.expect=o.expect||{};const c=(o==null?void 0:o.headers)||qr();o&&(o.msgID&&c.set(sr.MsgIdHdr,o.msgID),o.expect.lastMsgID&&c.set(sr.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&c.set(sr.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&c.set(sr.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&c.set(sr.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,y={};d&&(y.timeout=d),o&&(y.headers=c);let{retries:g,retry_delay:f}=o;g=g||1,f=f||250;let m;for(let x=0;x<g;x++)try{m=await this.nc.request(s,i,y);break}catch(v){if(v.code==="503"&&x+1<g)await sa(f);else throw v}const b=this.parseJsResponse(m);if(b.stream==="")throw pe.errorForCode(ce.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,o=0){Yt(s),Ki(i);let c=this.timeout;o>c&&(c=o),o=o<0?0:ft(o);const d={batch:1,no_wait:o===0,expires:o},y=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{noMux:!0,timeout:c}),g=Ji(y);if(g)throw g;return Oo(y,this.timeout)}fetch(s,i,o={}){Yt(s),Ki(i);let c=null;const d=(o.max_bytes??0)>0;let y=0;const g=d?o.max_bytes:0;let f=null;const m={};if(m.batch=o.batch||1,g){const P=this.nc.features.get(Ge.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.min} or better`);m.max_bytes=g}m.no_wait=o.no_wait||!1,m.no_wait&&m.expires&&(m.expires=0);const b=o.expires||0;if(b&&(m.expires=ft(b)),b===0&&m.no_wait===!1)throw new Error("expires or no_wait is required");const x=o.idle_heartbeat||0;x&&(m.idle_heartbeat=ft(x),o.delay_heartbeat===!0&&(m.idle_heartbeat=ft(x*4)));const v=new qt,_=m.batch;let S=0;v.protocolFilterFn=(P,re=!1)=>bd(P.msg)?(f==null||f.work(),!1):!0,v.dispatchedFn=P=>{if(P){if(d&&(y+=P.data.length),S++,c&&P.info.pending===0)return;(v.getPending()===1&&P.info.pending===0||_===S||g>0&&y>=g)&&v.stop()}};const C=Rr(this.nc.options.inboxPrefix),L=this.nc.subscribe(C,{max:o.batch,callback:(P,re)=>{P===null&&(P=Ji(re)),P!==null?(c&&(c.cancel(),c=null),ZS(P)?v.stop(vx(P)===null?void 0:P):v.stop(P)):(f==null||f.work(),v.received++,v.push(Oo(re,this.timeout)))}});return b&&(c=ea(b),c.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{x&&(f=new sm(x,P=>(v.push(()=>{v.err=new pe(`${Un.IdleHeartbeatMissed}: ${P}`,ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{reply:C}),v}async pullSubscribe(s,i=_s()){const o=await this._processOptions(s,i);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 c=o.config.ack_policy;if(c===Dt.None||c===Dt.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),y=new q2(this,o.deliver,d);y.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw y.unsubscribe(),g}return y}async subscribe(s,i=_s()){const o=await this._processOptions(s,i);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(o),d=new xx(this,o.deliver,c);d.info=o;try{await this._maybeCreateConsumer(o)}catch(y){throw d.unsubscribe(),y}return d._maybeSetupHbMonitoring(),d}async _processOptions(s,i=_s()){const o=Ig(i)?i.getOpts():i;if(o.isBind=Ig(i)?i.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!==Dt.NotSet&&o.config.ack_policy!==Dt.None)throw new pe("ordered consumer: ack_policy can only be set to 'none'",ce.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new pe("ordered consumer: durable_name cannot be set",ce.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new pe("ordered consumer: deliver_subject cannot be set",ce.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new pe("ordered consumer: max_deliver cannot be set",ce.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new pe("ordered consumer: deliver_group cannot be set",ce.ApiError);o.config.deliver_subject=Rr(this.nc.options.inboxPrefix),o.config.ack_policy=Dt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||ft(5e3),o.config.ack_wait=ft(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===Dt.NotSet&&(o.config.ack_policy=Dt.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 c=await this.consumerAPI.info(o.stream,o.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&c.push_bound===!0)throw new Error("duplicate subscription");const y=c.config.deliver_group??"";if(d!==y)throw y===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${y}'`);o.last=c,o.config=c.config,o.attached=!0,o.config.durable_name||(o.name=c.name)}}catch(c){if(c.code!=="404")throw c}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||Rr(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=L2(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=om.ingestionFn(s.ordered),i.protocolFilterFn=(o,c=!1)=>{const d=o;return gd(d.msg)?(c||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Dt.None&&(i.dispatchedFn=U2),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:wt.All,ack_policy:Dt.Explicit,ack_wait:ft(30*1e3),replay_policy:ta.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,o)=>{var g;const c=o;if(!i)return{ingest:!1,protocol:!1};const d=i;if(Ji(d.msg)||(g=c.monitor)==null||g.work(),bd(d.msg)){const f=s?c._checkHbOrderConsumer(d.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(gd(d.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class lm{constructor(t){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=e2(t),this.listeners=[]}static connect(t={}){return new Promise((s,i)=>{const o=new lm(t);mu.connect(o.options,o).then(c=>{o.protocol=c,(async function(){for await(const d of c.status())o.listeners.forEach(y=>{y.push(d)})})(),s(o)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,i){if(this.isClosed())throw pe.errorForCode(ce.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw pe.errorForCode(ce.ConnectionDraining);if(t=t||"",t.length===0)throw pe.errorForCode(ce.BadSubject)}publish(t,s,i){this._check(t,!1,!0),this.protocol.publish(t,s,i)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const i=new px(this.protocol,t,s);return this.protocol.subscribe(i),i}_resub(t,s,i){this._check(s,!0,!1);const o=t;o.max=i,i&&(o.max=i+o.received),this.protocol.resub(o,s)}requestMany(t,s=Sn,i={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Qn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new pe("timeout",ce.InvalidOption));const c=new qt;function d(g){c.push(()=>{c.stop(g)})}function y(g,f){g||f===null?d(g===null?void 0:g):c.push(f)}if(i.noMux){const g=o?new Error().stack:null;let f=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const m=this.subscribe(Rr(this.options.inboxPrefix),{callback:(_,S)=>{var C,L;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((L=S==null?void 0:S.headers)==null?void 0:L.status)===ce.NoResponders&&(_=pe.errorForCode(ce.NoResponders)),_){g&&(_.stack+=`
|
|
48
|
+
|
|
49
|
+
${g}`),b(_);return}y(null,S),i.strategy===Qn.Count&&(f--,f===0&&b()),i.strategy===Qn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Qn.SentinelMsg&&S&&S.data.length===0&&b()}});m.requestSubject=t,m.closed.then(()=>{d()}).catch(_=>{c.stop(_)});const b=_=>{_&&c.push(()=>{throw _}),v(),m.drain().then(()=>{d()}).catch(S=>{d()})};c.iterClosed.then(()=>{v(),m==null||m.unsubscribe()}).catch(_=>{v(),m==null||m.unsubscribe()});try{this.publish(t,s,{reply:m.getSubject()})}catch(_){b(_)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=y,c.iterClosed.then(()=>{f.cancel()}).catch(m=>{f.cancel(m)});const f=new xE(this.protocol.muxSubscriptions,t,g);this.protocol.request(f);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:i.headers})}catch(m){f.cancel(m)}}return Promise.resolve(c)}request(t,s,i={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const o=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new pe("timeout",ce.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new pe("reply can only be used with noMux",ce.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Rr(this.options.inboxPrefix),d=ht(),y=o?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(f,m)=>{f?(y&&f.code!==ce.Timeout&&(f.stack+=`
|
|
50
|
+
|
|
51
|
+
${y.stack}`),g.unsubscribe(),d.reject(f)):(f=ax(m),f?(y&&(f.stack+=`
|
|
52
|
+
|
|
53
|
+
${y.stack}`),d.reject(f)):d.resolve(m))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:c,headers:i.headers}),d}else{const c=new cx(this.protocol.muxSubscriptions,t,i,o);this.protocol.request(c);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(y){c.cancel(y)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(pe.errorForCode(ce.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(pe.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(pe.errorForCode(ce.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new qt;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new k2(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===ce.NoResponders&&(o.code=ce.JetStreamNotEnabled),o}return s}jetstream(t={}){return new om(this,t)}getServerVersion(){const t=this.info;return t?Zs(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw pe.errorForCode(ce.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new M2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(pe.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(pe.errorForCode(ce.ConnectionDraining)):this.protocol.reconnect()}}class M2{constructor(t){j(this,"nc");this.nc=t}add(t){try{return new Co(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new f2(this.nc,t,s)}}class R2{constructor(t,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=i}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(pu)||"PUT"}get length(){const t=this.sm.header.get(Qt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class D2{constructor(t,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=t,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(nm(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(pu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Qt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class xx extends SE{constructor(s,i,o){super(s.nc,i,o);j(this,"js");j(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const i=Rr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=Es.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=wt.StartSequence,c.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=c.config;const y=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(y,d,{retries:-1}).then(g=>{const f=g,m=this.sub.info;m.last=f,this.info.config=f.config,this.info.name=f.name}).catch(g=>{const f=new pe(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,ce.RequestError,g);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var i,o;const s=((o=(i=this.info)==null?void 0:i.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(nm(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,d=y=>{var m,b,x,v;const g=rE(409,`${Un.IdleHeartbeatMissed}: ${y}`,this.sub.subject);if(!((m=this.info)==null?void 0:m.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const _=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(_+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new sm(s,d,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Qt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Qt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,o=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(o);return s.last=c,c}}class q2 extends xx{constructor(t,s,i){super(t,s,i)}pull(t={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get(Ge.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);d.max_bytes=t.max_bytes}let y=0;t.expires&&t.expires>0&&(y=t.expires,d.expires=ft(y));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,d.idle_heartbeat=ft(g)),g&&y===0)throw new Error("idle_heartbeat requires expires");if(g>y)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),y&&g&&(this.monitor?this.monitor._change(g,y):this._setupHbMonitoring(g,y));const f=this.info.api,m=`${f.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;f.nc.publish(m,f.jc.encode(d),{reply:b})}}}function L2(n,t){return n?P2(t):B2(t)}function B2(n){return(t,s)=>t?[t,null]:(t=Ji(s),t?[t,null]:[null,Oo(s,n)])}function P2(n){return(t,s)=>{if(t)return[t,null];const i=Ji(s);return i!==null?[vx(i),null]:[null,Oo(s,n)]}}function vx(n){if(n!==null)switch(n.code){case ce.JetStream404NoMessages:case ce.JetStream408RequestTimeout:return null;case ce.JetStream409:return sE(n)?n:null;default:return n}return null}function U2(n){n&&n.ack()}function z2(n){const t=n.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class I2{constructor(t,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=z2(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===ro[0]&&t[1]===ro[1]&&t[2]===ro[2]&&t[3]===ro[3]}async ackAck(t){var i;t=t||{},t.timeout=t.timeout||this.timeout;const s=ht();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,d=!((i=c.options)!=null&&i.noAsyncTraces),y=new cx(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);c.request(y);try{c.publish(this.msg.reply,t1,{reply:`${c.muxSubscriptions.baseInbox}${y.token}`})}catch(g){y.cancel(g)}try{await Promise.race([y.timer,y.deferred]),s.resolve(!0)}catch(g){y.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(t1)}nak(t){let s=_2;t&&(s=yd().encode(`-NAK ${JSON.stringify({delay:ft(t)})}`)),this.doAck(s)}working(){this.doAck(ro)}next(t,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=ft(s.expires));const o=Xn().encode(i),c=na.concat(w2,E2,o),d=t?{reply:t}:void 0;this.msg.respond(c,d)}term(t=""){let s=S2;(t==null?void 0:t.length)>0&&(s=yd().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const $2="1.30.3",H2="nats.ws";class F2{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=$2,this.lang=H2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ht(),this.closedNotification=ht()}async connect(t,s){const i=ht();if(s.tls)return i.reject(new pe("tls",ce.InvalidOption)),i;this.options=s;const o=t.src;if(s.wsFactory){const{socket:c,encrypted:d}=await s.wsFactory(t.src,s);this.socket=c,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=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const d=na.concat(...this.yields),y=NE(d);if(y!==""){const g=r2.exec(y);if(!g){s.debug&&console.error("!!!",sc(d)),i.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(g[1]);t2(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(f){i.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(c.wasClean||(d=new Error(c.reason)),this._closed(d))},this.socket.onerror=c=>{if(this.isDiscarded())return;const d=c,y=new pe(d.message,ce.Unknown,new Error(d.error));i.reject(y)},i}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await sa(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${sc(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ht())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${sc(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${sc(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function G2(n,t){/^(.*:\/\/)(.*)/.test(n)||(typeof t=="boolean"?n=`${t===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(t=!1),o==="wss:"&&(t=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,d;const y=i.hostname,g=i.pathname,f=i.search||"";switch(o){case"http:":case"ws:":case"nats:":d=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":d=i.port||"443",c="wss:";break;default:d=i.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${y}:${d}${g}${f}`}function V2(n={}){return EE({defaultPort:443,urlParseFn:G2,factory:()=>new F2}),lm.connect(n)}const Y2=null,K2=null,Jt="lt.events";function _x(n,t){const s=n.split("."),i=t.split(".");for(let o=0;o<i.length;o++){const c=i[o];if(c===">")return!0;if(o>=s.length||c!=="*"&&c!==s[o])return!1}return s.length===i.length}const ia=O.createContext({connected:!1,subscribe:()=>()=>{}});function wx(){const{connected:n}=O.useContext(ia);return{connected:n}}function wn(n,t){const{subscribe:s}=O.useContext(ia),i=O.useRef(t);i.current=t,O.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function ti(n,t){const{subscribe:s}=O.useContext(ia),i=O.useRef(t);i.current=t;const o=n.join(","),c=O.useMemo(()=>o.split(",").filter(Boolean),[o]);O.useEffect(()=>{const d=g=>i.current(g),y=c.map(g=>s(g,d));return()=>y.forEach(g=>g())},[s,c])}const J2=O.createContext({connected:!1,subscribe:()=>()=>{}}),Q2=yd();function X2({children:n,url:t,token:s}){const i=O.useRef(null),[o,c]=O.useState(!1),d=O.useRef(null),y=O.useRef(new Map),g=O.useRef(new Map),f=O.useCallback((v,_)=>{(async()=>{for await(const S of _)try{if(!_x(S.subject,v))continue;const C=JSON.parse(Q2.decode(S.data)),L=y.current.get(v);if(!L)continue;for(const P of L)try{P(C)}catch{}}catch{}})()},[]),m=O.useCallback(v=>{var S;const _=i.current;if(!(!_||(S=_.isClosed)!=null&&S.call(_)||g.current.has(v)))try{const C=_.subscribe(v);g.current.set(v,C),f(v,C)}catch{}},[f]),b=O.useCallback((v,_)=>{const S=y.current;return S.has(v)||S.set(v,new Set),S.get(v).add(_),m(v),()=>{const C=S.get(v);if(C&&(C.delete(_),C.size===0)){S.delete(v);const L=g.current.get(v);if(L){g.current.delete(v);try{L.unsubscribe()}catch{}}}}},[m]),x=O.useCallback(async()=>{try{if(i.current)return;const v=t||Y2;if(!v){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const _=await V2({servers:v,token:s||K2||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});i.current=_,c(!0);for(const S of y.current.keys())m(S);(async()=>{for await(const S of _.status())S.type==="disconnect"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),d.current=setTimeout(x,3e3)}},[m]);return O.useEffect(()=>(x(),()=>{d.current&&clearTimeout(d.current);for(const v of g.current.values())try{v.unsubscribe()}catch{}g.current.clear(),i.current&&(i.current.close().catch(()=>{}),i.current=null),c(!1)}),[x]),h.jsx(J2.Provider,{value:{connected:o,subscribe:b},children:h.jsx(ia.Provider,{value:{connected:o,subscribe:b},children:n})})}const or=Object.create(null);or.open="0";or.close="1";or.ping="2";or.pong="3";or.message="4";or.upgrade="5";or.noop="6";const ru=Object.create(null);Object.keys(or).forEach(n=>{ru[or[n]]=n});const Td={type:"error",data:"parser error"},Sx=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ex=typeof ArrayBuffer=="function",Ox=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,cm=({type:n,data:t},s,i)=>Sx&&t instanceof Blob?s?i(t):r1(t,i):Ex&&(t instanceof ArrayBuffer||Ox(t))?s?i(t):r1(new Blob([t]),i):i(or[n]+(t||"")),r1=(n,t)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];t("b"+(i||""))},s.readAsDataURL(n)};function s1(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let td;function W2(n,t){if(Sx&&n.data instanceof Blob)return n.data.arrayBuffer().then(s1).then(t);if(Ex&&(n.data instanceof ArrayBuffer||Ox(n.data)))return t(s1(n.data));cm(n,!1,s=>{td||(td=new TextEncoder),t(td.encode(s))})}const i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<i1.length;n++)yo[i1.charCodeAt(n)]=n;const Z2=n=>{let t=n.length*.75,s=n.length,i,o=0,c,d,y,g;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);const f=new ArrayBuffer(t),m=new Uint8Array(f);for(i=0;i<s;i+=4)c=yo[n.charCodeAt(i)],d=yo[n.charCodeAt(i+1)],y=yo[n.charCodeAt(i+2)],g=yo[n.charCodeAt(i+3)],m[o++]=c<<2|d>>4,m[o++]=(d&15)<<4|y>>2,m[o++]=(y&3)<<6|g&63;return f},eO=typeof ArrayBuffer=="function",um=(n,t)=>{if(typeof n!="string")return{type:"message",data:Ax(n,t)};const s=n.charAt(0);return s==="b"?{type:"message",data:tO(n.substring(1),t)}:ru[s]?n.length>1?{type:ru[s],data:n.substring(1)}:{type:ru[s]}:Td},tO=(n,t)=>{if(eO){const s=Z2(n);return Ax(s,t)}else return{base64:!0,data:n}},Ax=(n,t)=>{switch(t){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},jx="",nO=(n,t)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,d)=>{cm(c,!1,y=>{i[d]=y,++o===s&&t(i.join(jx))})})},rO=(n,t)=>{const s=n.split(jx),i=[];for(let o=0;o<s.length;o++){const c=um(s[o],t);if(i.push(c),c.type==="error")break}return i};function sO(){return new TransformStream({transform(n,t){W2(n,s=>{const i=s.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(s)})}})}let nd;function lc(n){return n.reduce((t,s)=>t+s.length,0)}function cc(n,t){if(n[0].length===t)return n.shift();const s=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)s[o]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),s}function iO(n,t){nd||(nd=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(d,y){for(s.push(d);;){if(i===0){if(lc(s)<1)break;const g=cc(s,1);c=(g[0]&128)===128,o=g[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(lc(s)<2)break;const g=cc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(lc(s)<8)break;const g=cc(s,8),f=new DataView(g.buffer,g.byteOffset,g.length),m=f.getUint32(0);if(m>Math.pow(2,21)-1){y.enqueue(Td);break}o=m*Math.pow(2,32)+f.getUint32(4),i=3}else{if(lc(s)<o)break;const g=cc(s,o);y.enqueue(um(c?g:nd.decode(g),t)),i=0}if(o===0||o>n){y.enqueue(Td);break}}}})}const kx=4;function kt(n){if(n)return aO(n)}function aO(n){for(var t in kt.prototype)n[t]=kt.prototype[t];return n}kt.prototype.on=kt.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this};kt.prototype.once=function(n,t){function s(){this.off(n,s),t.apply(this,arguments)}return s.fn=t,this.on(n,s),this};kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.prototype.removeEventListener=function(n,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,o=0;o<s.length;o++)if(i=s[o],i===t||i.fn===t){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};kt.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,t)}return this};kt.prototype.emitReserved=kt.prototype.emit;kt.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};kt.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Au=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),zn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),oO="arraybuffer";function Nx(n,...t){return t.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const lO=zn.setTimeout,cO=zn.clearTimeout;function ju(n,t){t.useNativeTimers?(n.setTimeoutFn=lO.bind(zn),n.clearTimeoutFn=cO.bind(zn)):(n.setTimeoutFn=zn.setTimeout.bind(zn),n.clearTimeoutFn=zn.clearTimeout.bind(zn))}const uO=1.33;function fO(n){return typeof n=="string"?hO(n):Math.ceil((n.byteLength||n.size)*uO)}function hO(n){let t=0,s=0;for(let i=0,o=n.length;i<o;i++)t=n.charCodeAt(i),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(i++,s+=4);return s}function Tx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function dO(n){let t="";for(let s in n)n.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return t}function mO(n){let t={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class pO extends Error{constructor(t,s,i){super(t),this.description=s,this.context=i,this.type="TransportError"}}class fm extends kt{constructor(t){super(),this.writable=!1,ju(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,i){return super.emitReserved("error",new pO(t,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=um(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=dO(t);return s.length?"?"+s:""}}class yO extends fm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};rO(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,nO(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Tx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let Cx=!1;try{Cx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const gO=Cx;function bO(){}class xO extends yO{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,s){const i=this.request({method:"POST",data:t});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=t}}class ar extends kt{constructor(t,s,i){super(),this.createRequest=t,ju(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const s=Nx(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=ar.requestsCount++,ar.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bO,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ar.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}ar.requestsCount=0;ar.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",a1);else if(typeof addEventListener=="function"){const n="onpagehide"in zn?"pagehide":"unload";addEventListener(n,a1,!1)}}function a1(){for(let n in ar.requests)ar.requests.hasOwnProperty(n)&&ar.requests[n].abort()}const vO=(function(){const n=Mx({xdomain:!1});return n&&n.responseType!==null})();class _O extends xO{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=vO&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new ar(Mx,this.uri(),t)}}function Mx(n){const t=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||gO))return new XMLHttpRequest}catch{}if(!t)try{return new zn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Rx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class wO extends fm{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,i=Rx?{}:Nx(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,i)}catch(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=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;cm(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&Au(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Tx()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const rd=zn.WebSocket||zn.MozWebSocket;class SO extends wO{createSocket(t,s,i){return Rx?new rd(t,s,i):s?new rd(t,s):new rd(t)}doWrite(t,s){this.ws.send(s)}}class EO extends fm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=iO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(s).getReader(),o=sO();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:y,value:g})=>{y||(this.onPacket(g),c())}).catch(y=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;this._writer.write(i).then(()=>{o&&Au(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const OO={websocket:SO,webtransport:EO,polling:_O},AO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,jO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Cd(n){if(n.length>8e3)throw"URI too long";const t=n,s=n.indexOf("["),i=n.indexOf("]");s!=-1&&i!=-1&&(n=n.substring(0,s)+n.substring(s,i).replace(/:/g,";")+n.substring(i,n.length));let o=AO.exec(n||""),c={},d=14;for(;d--;)c[jO[d]]=o[d]||"";return s!=-1&&i!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=kO(c,c.path),c.queryKey=NO(c,c.query),c}function kO(n,t){const s=/\/{2,9}/g,i=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function NO(n,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const Md=typeof addEventListener=="function"&&typeof removeEventListener=="function",su=[];Md&&addEventListener("offline",()=>{su.forEach(n=>n())},!1);class ws extends kt{constructor(t,s){if(super(),this.binaryType=oO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const i=Cd(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Cd(s.host).host);ju(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{const o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=mO(this.opts.query)),Md&&(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"})},su.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=kx,s.transport=t,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ws.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",ws.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const o=this.writeBuffer[i].data;if(o&&(s+=fO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Au(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,o){if(typeof s=="function"&&(o=s,s=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:t,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(ws.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Md&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=su.indexOf(this._offlineEventListener);i!==-1&&su.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}ws.protocol=kx;class TO extends ws{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),i=!1;ws.priorWebsocketSuccess=!1;const o=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;ws.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(m(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,m(),s.close(),s=null)}const d=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function y(){d("transport closed")}function g(){d("socket closed")}function f(b){s&&b.name!==s.name&&c()}const m=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",y),this.off("close",g),this.off("upgrading",f)};s.once("open",o),s.once("error",d),s.once("close",y),this.once("close",g),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&s.push(t[i]);return s}}let CO=class extends TO{constructor(t,s={}){const i=typeof t=="object"?t:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>OO[o]).filter(o=>!!o)),super(t,i)}};function MO(n,t="",s){let i=n;s=s||typeof location<"u"&&location,n==null&&(n=s.protocol+"//"+s.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=s.protocol+n:n=s.host+n),/^(https?|wss?):\/\//.test(n)||(typeof s<"u"?n=s.protocol+"//"+n:n="https://"+n),i=Cd(n)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+t,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const RO=typeof ArrayBuffer=="function",DO=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Dx=Object.prototype.toString,qO=typeof Blob=="function"||typeof Blob<"u"&&Dx.call(Blob)==="[object BlobConstructor]",LO=typeof File=="function"||typeof File<"u"&&Dx.call(File)==="[object FileConstructor]";function hm(n){return RO&&(n instanceof ArrayBuffer||DO(n))||qO&&n instanceof Blob||LO&&n instanceof File}function iu(n,t){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(iu(n[s]))return!0;return!1}if(hm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return iu(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&iu(n[s]))return!0;return!1}function BO(n){const t=[],s=n.data,i=n;return i.data=Rd(s,t),i.attachments=t.length,{packet:i,buffers:t}}function Rd(n,t){if(!n)return n;if(hm(n)){const s={_placeholder:!0,num:t.length};return t.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=Rd(n[i],t);return s}else if(typeof n=="object"&&!(n instanceof Date)){const s={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=Rd(n[i],t));return s}return n}function PO(n,t){return n.data=Dd(n.data,t),delete n.attachments,n}function Dd(n,t){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<t.length)return t[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=Dd(n[s],t);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=Dd(n[s],t));return n}const UO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ie;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Ie||(Ie={}));class zO{constructor(t){this.replacer=t}encode(t){return(t.type===Ie.EVENT||t.type===Ie.ACK)&&iu(t)?this.encodeAsBinary({type:t.type===Ie.EVENT?Ie.BINARY_EVENT:Ie.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Ie.BINARY_EVENT||t.type===Ie.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=BO(t),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class dm extends kt{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const i=s.type===Ie.BINARY_EVENT;i||s.type===Ie.BINARY_ACK?(s.type=i?Ie.EVENT:Ie.ACK,this.reconstructor=new IO(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(hm(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const i={type:Number(t.charAt(0))};if(Ie[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ie.BINARY_EVENT||i.type===Ie.BINARY_ACK){const c=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const d=t.substring(c,s);if(d!=Number(d)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const y=Number(d);if(!$O(y)||y<0)throw new Error("Illegal attachments");if(y>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=y}if(t.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););i.nsp=t.substring(c,s)}else i.nsp="/";const o=t.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const d=t.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===t.length)break}i.id=Number(t.substring(c,s+1))}if(t.charAt(++s)){const c=this.tryParse(t.substr(s));if(dm.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Ie.CONNECT:return o1(s);case Ie.DISCONNECT:return s===void 0;case Ie.CONNECT_ERROR:return typeof s=="string"||o1(s);case Ie.EVENT:case Ie.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&UO.indexOf(s[0])===-1);case Ie.ACK:case Ie.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class IO{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=PO(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const $O=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function o1(n){return Object.prototype.toString.call(n)==="[object Object]"}const HO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:dm,Encoder:zO,get PacketType(){return Ie}},Symbol.toStringTag,{value:"Module"}));function Jn(n,t,s){return n.on(t,s),function(){n.off(t,s)}}const FO=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class qx extends kt{constructor(t,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Jn(t,"open",this.onopen.bind(this)),Jn(t,"packet",this.onpacket.bind(this)),Jn(t,"error",this.onerror.bind(this)),Jn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var i,o,c;if(FO.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Ie.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const m=this.ids++,b=s.pop();this._registerAckCallback(m,b),d.id=m}const y=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!y||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[t]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===t&&this.sendBuffer.splice(y,1);s.call(this,new Error("operation has timed out"))},o),d=(...y)=>{this.io.clearTimeoutFn(c),s.apply(this,y)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...s){return new Promise((i,o)=>{const c=(d,y)=>d?o(d):i(y);c.withError=!0,s.push(c),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...c)=>(this._queue[0],o!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ie.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ie.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ie.EVENT:case Ie.BINARY_EVENT:this.onevent(t);break;case Ie.ACK:case Ie.BINARY_ACK:this.onack(t);break;case Ie.DISCONNECT:this.ondisconnect();break;case Ie.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ie.ACK,id:t,data:o}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ie.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,t.data)}}}function aa(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}aa.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*n);n=(Math.floor(t*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};aa.prototype.reset=function(){this.attempts=0};aa.prototype.setMin=function(n){this.ms=n};aa.prototype.setMax=function(n){this.max=n};aa.prototype.setJitter=function(n){this.jitter=n};class qd extends kt{constructor(t,s){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,ju(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new aa({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const o=s.parser||HO;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new CO(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Jn(s,"open",function(){i.onopen(),t&&t()}),c=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),t?t(y):this.maybeReconnectOnOpen()},d=Jn(s,"error",c);if(this._timeout!==!1){const y=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Jn(t,"ping",this.onping.bind(this)),Jn(t,"data",this.ondata.bind(this)),Jn(t,"error",this.onerror.bind(this)),Jn(t,"close",this.onclose.bind(this)),Jn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){Au(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new qx(this,t,s),this.nsps[t]=i),i}_destroy(t){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let i=0;i<s.length;i++)this.engine.write(s[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const so={};function au(n,t){typeof n=="object"&&(t=n,n=void 0),t=t||{};const s=MO(n,t.path||"/socket.io"),i=s.source,o=s.id,c=s.path,d=so[o]&&c in so[o].nsps,y=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let g;return y?g=new qd(i,t):(so[o]||(so[o]=new qd(i,t)),g=so[o]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(au,{Manager:qd,Socket:qx,io:au,connect:au});const GO=O.createContext({connected:!1,subscribe:()=>()=>{}});function VO({children:n}){const{isAuthenticated:t}=Lt(),s=O.useRef(null),[i,o]=O.useState(!1),c=O.useRef(new Map),d=O.useCallback((g,f)=>{var b;const m=c.current;return m.has(g)||(m.set(g,new Set),(b=s.current)==null||b.emit("lt.subscribe",g)),m.get(g).add(f),()=>{var v;const x=m.get(g);x&&(x.delete(f),x.size===0&&(m.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),y=O.useCallback((g,f)=>{for(const[m,b]of c.current)if(_x(g,m))for(const x of b)try{x(f)}catch{}},[]);return O.useEffect(()=>{if(!t)return;const g=au({path:`${$t}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:f=>{const m=nx();f(m?{token:m}:{})}});return s.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),o(!0);for(const f of c.current.keys())g.emit("lt.subscribe",f)}),g.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),o(!1)}),g.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),o(!1)}),g.onAny((f,m)=>{if(f.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;y(f,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[y,t]),h.jsx(GO.Provider,{value:{connected:i,subscribe:d},children:h.jsx(ia.Provider,{value:{connected:i,subscribe:d},children:n})})}function YO({children:n}){const{isAuthenticated:t}=Lt(),[s,i]=O.useState(null),[o,c]=O.useState({url:null,token:null});return O.useEffect(()=>{let d=!1;async function y(){var g;try{console.log("[lt-transport] detecting event transport...");const f=await em(),m=(g=f==null?void 0:f.events)==null?void 0:g.transport;if(console.log("[lt-transport] server reports:",m),!d){if(m==="nats"){let b=f.events.natsWsUrl??null,x=null;const v=nx();if(v)try{const _=await fetch(`${$t}/api/nats-credentials`,{headers:{Authorization:`Bearer ${v}`}});if(_.ok){const S=await _.json();b=S.natsWsUrl??b,x=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}c({url:b,token:x})}i(m==="nats"?"nats":"socketio")}}catch(f){console.warn("[lt-transport] settings fetch error, falling back to socketio",f),d||i("socketio")}}return y(),()=>{d=!0}},[t]),s==="nats"?h.jsx(X2,{url:o.url,token:o.token,children:n}):s==="socketio"?h.jsx(VO,{children:n}):h.jsx(h.Fragment,{children:n})}const mm="lt_view_as",pm="lt_ai_override",Ld="lt_graph_enabled",Bd="lt_infrastructure_enabled",ym="lt_scan_override";function Lx(){try{const n=localStorage.getItem(pm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function KO(n){try{localStorage.setItem(pm,String(n))}catch{}}function JO(){try{localStorage.removeItem(pm)}catch{}}function gm(){try{const n=localStorage.getItem(mm);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function QO(n){try{localStorage.setItem(mm,n)}catch{}window.location.reload()}function Pd(){try{localStorage.removeItem(mm)}catch{}window.location.reload()}function Bx(){try{return localStorage.getItem(Ld)==="true"}catch{return!1}}function XO(n){try{n?localStorage.setItem(Ld,"true"):localStorage.removeItem(Ld)}catch{}}function Px(){try{return localStorage.getItem(Bd)==="true"}catch{return!1}}function WO(n){try{n?localStorage.setItem(Bd,"true"):localStorage.removeItem(Bd)}catch{}}function Ux(){try{const n=localStorage.getItem(ym);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function ZO(n){try{localStorage.setItem(ym,String(n))}catch{}}function eA(){try{localStorage.removeItem(ym)}catch{}}function zx(){const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=Lt(),i=gm(),o=n||s("engineer"),c=t("admin"),d=n||t("admin");return{isBuilder:i?!1:o,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":d,viewAs:i,realIsBuilder:o}}function Ix(){var f;const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=Lt(),{data:i}=Wn(),o=((f=i==null?void 0:i.features)==null?void 0:f.publicPaceBoard)!==!1,c=n?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",d=gm(),y=d==="admin"||d==="engineer"||d==="operator"?d:null,g=y??c;return{tier:g,realTier:c,viewAs:y,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}function $x(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function Lr(n={}){const t=n.role?$x(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Jt}.system.escalation.${t}.${s}.${i}`}function Ud(n){return n.verbs.map(t=>Lr({role:n.role,verb:t}))}function bm(n){const{user:t,isSuperAdmin:s,hasRoleType:i}=Lt(),o=s||i("admin"),c=((t==null?void 0:t.roles)??[]).map(y=>y.role).sort().join(","),d=(n??[]).join(",");return O.useMemo(()=>{const y=d?d.split(","):null;return o||!c?y?Ud({verbs:y}):[Lr({})]:c.split(",").flatMap(g=>y?Ud({role:g,verbs:y}):[Lr({role:g})])},[o,c,d])}const zd="/escalations/detail/";function tA(n){return n.startsWith(zd)&&n.slice(zd.length).split("/")[0]||void 0}function nA(){const{user:n}=Lt(),t=ra(),s=On(),i=O.useRef(s.pathname);i.current=s.pathname;const o=O.useRef(n==null?void 0:n.userId);o.current=n==null?void 0:n.userId;const c=O.useCallback(d=>{var b,x,v;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const y=(d==null?void 0:d.escalationId)??((b=d==null?void 0:d.data)==null?void 0:b.id),g=(x=d==null?void 0:d.data)==null?void 0:x.assigned_to,f=(v=d==null?void 0:d.data)==null?void 0:v.parent_id;if(!y||g!==o.current||!f||f!==tA(i.current))return;const m=`${zd}${y}`;i.current!==m&&t(m)},[t]);ti(bm(["claimed"]),c)}function rA(n){const t=n??[];return t.length>0&&t.every(s=>s.type==="member"&&s.write_scope==="none")}const xm={staleTime:5*6e4,refetchOnWindowFocus:!1};function v3(n={},t={}){const s=new URLSearchParams;return n.role&&s.set("role",n.role),n.roleType&&s.set("roleType",n.roleType),n.status&&s.set("status",n.status),n.search&&s.set("search",n.search),n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),Pe({queryKey:["users",n],queryFn:()=>fe(`/users?${s}`),enabled:t.enabled??!0,...xm})}const l1=200;async function sA(n){const t=[];for(let s=0;s<n.length;s+=l1){const i=await fe("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+l1)})});t.push(...i.users??[])}return t}let Id=[],$d=new Map,Hd=!1;function iA(){const n=Id,t=$d;Id=[],$d=new Map,Hd=!1,sA(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of t)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of t.values())i.reject(s)})}function aA(n){return new Promise((t,s)=>{Id.push(n),$d.set(n,{resolve:t,reject:s}),Hd||(Hd=!0,setTimeout(iA,0))})}function _3(n){return Pe({queryKey:["user-name",n],queryFn:()=>aA(n),enabled:!!n,...xm})}function oA(n){return Pe({queryKey:["users",n,"roles"],queryFn:async()=>(await fe(`/users/${n}/roles`)).roles??[],enabled:!!n,...xm})}function w3(){const n=Ue();return He({mutationFn:t=>fe("/users",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function S3(){const n=Ue();return He({mutationFn:({id:t,...s})=>fe(`/users/${t}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function E3(){const n=Ue();return He({mutationFn:({id:t,ops:s})=>fe(`/users/${t}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function O3(){return Pe({queryKey:["users","system-property-keys"],queryFn:()=>fe("/users/system-property-keys")})}function A3(){const n=Ue();return He({mutationFn:t=>fe(`/users/${t}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function j3(){const n=Ue();return He({mutationFn:({userId:t,role:s,type:i,read_scope:o,write_scope:c})=>fe(`/users/${t}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function k3(){const n=Ue();return He({mutationFn:({userId:t,role:s})=>fe(`/users/${t}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const N3={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function lA(){return Pe({queryKey:["roles"],queryFn:()=>fe("/roles")})}function ku(n){return Pe({queryKey:["roles","details"],queryFn:()=>fe("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function T3(n,t,s=!0){return Pe({queryKey:["roles",n,"schema",t??"latest"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function C3(n){return Pe({queryKey:["roles",n,"schema-versions"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function M3(n,t,s=!0){return Pe({queryKey:["roles",n,"list-schema",t??"latest"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function R3(n){return Pe({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function D3(){const n=Ue();return He({mutationFn:t=>fe("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function q3(){const n=Ue();return He({mutationFn:({role:t,...s})=>fe(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await n.cancelQueries({queryKey:["roles","details"]});const i=n.getQueryData(["roles","details"]);return i&&n.setQueryData(["roles","details"],{roles:i.roles.map(o=>o.role===t?{...o,...s}:o)}),{previous:i}},onError:(t,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function L3(){const n=Ue();return He({mutationFn:t=>fe(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const Hx="lt:station:kiosk-role:";function Fd(n){return`${Hx}${n}`}const Gd=new Set;function cA(){for(const n of Gd)n()}function uA(n){try{return localStorage.getItem(Fd(n))}catch{return null}}function fA(n,t){try{t===null?localStorage.removeItem(Fd(n)):localStorage.setItem(Fd(n),t)}catch{}cA()}function hA(n){Gd.add(n);const t=s=>{(s.key===null||s.key.startsWith(Hx))&&n()};try{window.addEventListener("storage",t)}catch{}return()=>{Gd.delete(n);try{window.removeEventListener("storage",t)}catch{}}}function dA(n){return O.useSyncExternalStore(hA,()=>n?uA(n):null)}const yu="/portal";function mA(n){return n===yu||n.startsWith(`${yu}/`)}function vm(n,t){const s=`${yu}/${encodeURIComponent(n)}`;return t?`${s}/${encodeURIComponent(t)}`:s}function Wi(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function pA(n){return Wi(n).length>0}function B3(n,t){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(t);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function Fx(n,t){return t.length>0?vm(n,t[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Gx(){const{user:n}=Lt(),t=(n==null?void 0:n.userId)??null,{data:s}=oA(t),{data:i}=ku(),o=dA(t),c=O.useCallback(d=>{t&&fA(t,d)},[t]);return O.useMemo(()=>{const d={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},y=s??[];if(y.length===0||y.some(v=>v.type!=="member"))return d;const g=v=>{var _;return(_=i==null?void 0:i.roles)==null?void 0:_.find(S=>S.role===v)},f=v=>{var _,S;return((S=(_=g(v))==null?void 0:_.properties)==null?void 0:S.kiosk)===!0},m=y.map(v=>v.role).filter(f),b=v=>({kiosk:!0,role:v,homePath:Fx(v,Wi(g(v))),targets:m,selectable:m.length>=2,selectRole:c});if(y.length===1)return m.length===1?b(m[0]):d;if(!rA(y)||m.length===0)return d;const x=o&&m.includes(o)?o:m.length===1?m[0]:null;return x?b(x):{...d,targets:m,selectable:!0}},[s,i,o,c])}const yA=["/escalations",yu,"/scan","/login"];function gA(n){return yA.some(t=>n===t||n.startsWith(`${t}/`)||n.startsWith(`${t}?`))}const _m=O.createContext(null),sd="lt_sidebar_collapsed",Vx="(max-width: 1023px)";function bA(){try{return window.matchMedia(Vx).matches}catch{return!1}}function xA({children:n}){const[t,s]=O.useState(()=>{if(bA())return!0;try{return localStorage.getItem(sd)==="true"}catch{return!1}});O.useEffect(()=>{let o;try{o=window.matchMedia(Vx)}catch{return}const c=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(sd)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=O.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(sd,String(c))}catch{}return c})},[]);return h.jsx(_m.Provider,{value:{collapsed:t,toggle:i},children:n})}function vA({children:n}){return h.jsx(_m.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function wm(){const n=O.useContext(_m);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const c1=380,Sm=O.createContext(null);function _A({children:n}){const[t,s]=O.useState({node:null,width:c1,open:!1,ownerKey:null}),i=On(),o=O.useRef(i.pathname),c=O.useCallback((y,g)=>{s({node:y,width:(g==null?void 0:g.width)??c1,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=O.useCallback(y=>{s(g=>typeof y=="string"&&g.ownerKey!==y?g:{...g,open:!1})},[]);return O.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(y=>y.open||y.node?{...y,node:null,open:!1,ownerKey:null}:y))},[i.pathname]),h.jsx(Sm.Provider,{value:{...t,setPanel:c,closePanel:d},children:n})}function Em(){const n=O.useContext(Sm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function P3(){return O.useContext(Sm)}function wA({open:n,width:t=380,children:s,className:i=""}){const[o,c]=O.useState(n);return O.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?t:0,maxWidth:"50%"},onTransitionEnd:d=>{!n&&d.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:t},className:"h-full",children:o?s:null})})}function U3({label:n,children:t}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:n}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function z3({views:n,activeId:t,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:d}){const y=n.find(g=>g.id===t)??n[0];return y?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${d?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:n.map(g=>{const f=g.icon,m=g.id===y.id;return h.jsx("button",{role:"radio","aria-checked":m,onClick:()=>s(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${m?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:h.jsx(f,{className:"w-3.5 h-3.5"})},g.id)})}),d&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:y.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(Xt,{className:"w-3.5 h-3.5"})})]})]}),!d&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:y.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:y.content})]})}):null}function Yx(n,t){var s,i,o,c,d;t.facets&&Object.keys(t.facets).length&&n.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&n.set("block",JSON.stringify(t.block)),(i=t.range)!=null&&i.length&&n.set("range",JSON.stringify(t.range)),(o=t.exists)!=null&&o.length&&n.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&n.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&n.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&n.set("available",String(t.available)),t.jeopardy===!0&&n.set("jeopardy","1"),t.include&&n.set("include",t.include)}function I3(n,t,s){const i=n??"24h",o=t&&Object.keys(t).length?JSON.stringify(t):null;return Pe({queryKey:["stationMetrics",i,o],queryFn:()=>fe(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function $3(n){const t=n?`?period=${n}`:"";return Pe({queryKey:["escalationStats",n],queryFn:()=>fe(`/escalations/stats${t}`)})}function H3(){return Pe({queryKey:["escalationTypes"],queryFn:()=>fe("/escalations/types")})}function F3(n=!0){return Pe({queryKey:["escalationFacetKeys"],queryFn:()=>fe("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function SA(n){return Pe({queryKey:["escalationFacetValues",n],queryFn:()=>fe(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function Kx(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.status&&o.set("status",i.status),i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.assigned_to&&o.set("assigned_to",i.assigned_to),i.parent_id&&o.set("parent_id",i.parent_id),i.claimed&&o.set("claimed","true"),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),Yx(o,i),Pe({queryKey:["escalations",i],queryFn:()=>fe(`/escalations?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function Jx(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),Yx(o,i),Pe({queryKey:["escalations","available",i],queryFn:()=>fe(`/escalations/available?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function G3(n){return Pe({queryKey:["escalations","by-workflow",n],queryFn:()=>fe(`/escalations/by-workflow/${n}`),enabled:!!n})}function V3(n){return Pe({queryKey:["escalations",n],queryFn:()=>fe(`/escalations/${n}`),enabled:!!n})}function Y3(n,t){return Pe({queryKey:["escalations",n,"lookups"],queryFn:()=>fe(`/escalations/${n}/lookups`),enabled:!!n&&t,staleTime:1/0})}function K3(){const n=Ue();return He({mutationFn:({id:t,durationMinutes:s})=>fe(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function J3(){const n=Ue();return He({mutationFn:t=>fe(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function Q3(){const n=Ue();return He({mutationFn:({id:t,resolverPayload:s})=>fe(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),n.resetQueries({queryKey:["tasks"]}),n.resetQueries({queryKey:["jobs"]})}})}function X3(){const n=Ue();return He({mutationFn:({id:t,itemKey:s,payload:i})=>fe(`/escalations/${t}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function W3(){const n=Ue();return He({mutationFn:({id:t,itemKey:s})=>fe(`/escalations/${t}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function Z3(){const n=Ue();return He({mutationFn:({id:t,targetRole:s})=>fe(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function e5(){const n=Ue();return He({mutationFn:({ids:t,priority:s})=>fe("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function t5(){const n=Ue();return He({mutationFn:({ids:t,durationMinutes:s})=>fe("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function n5(){const n=Ue();return He({mutationFn:({ids:t,targetUserId:s,durationMinutes:i,reassign:o})=>fe("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function r5(){const n=Ue();return He({mutationFn:({ids:t})=>fe("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function s5(){const n=Ue();return He({mutationFn:({ids:t,hint:s})=>fe("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function i5(){const n=Ue();return He({mutationFn:t=>fe(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function a5(){const n=Ue();return He({mutationFn:({ids:t})=>fe("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Om(n){const t=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":t.push(["tasks"]),t.push(["jobs"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),n.originId&&t.push(["processes",n.originId]);break;case"escalation":t.push(["escalations"]),t.push(["escalationStats"]),t.push(["stationMetrics"]),n.workflowId&&t.push(["workflowExecution",n.workflowId]);break;case"workflow":t.push(["jobs"]),t.push(["tasks"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId]),t.push(["mcpQueryResult",n.workflowId]),t.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&t.push(["mcpRunExecution",n.workflowId]),t.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),t.push(["tasks"]);break;case"knowledge":t.push(["knowledge"]);break;case"file":t.push(["files"]);break;case"agent":t.push(["agents"]);break;default:t.push(["jobs"]),t.push(["tasks"]);break}return t}const EA={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},o5=300,u1={DETAIL:0,LIST:1,SUMMARY:2};function OA(n){const t=new Map,s={},i={};let o=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function d(m){delete s[m],i[m]=Date.now();const b=[];for(const[v,_]of t)_===m&&b.push(v);for(const v of b)t.delete(v);if(b.length===0)return;const x=c();x&&(o=!0);for(const v of b)n.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function y(m){if(s[m])return;const{coalesceMs:b,minIntervalMs:x}=EA[m],v=i[m],_=v===void 0?0:v+x-Date.now(),S=Math.max(b,_);s[m]=setTimeout(()=>d(m),S)}function g(m,b){for(const x of b){const v=JSON.stringify(x),_=t.get(v);(_===void 0||u1[m]<u1[_])&&t.set(v,m)}y(m)}const f=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",f),{request:g,dispose(){for(const m of Object.keys(s)){const b=s[m];b&&clearTimeout(b),delete s[m]}t.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",f)}}}const f1=new WeakMap;function AA(n){let t=f1.get(n);return t||(t=OA(n),f1.set(n,t)),t}function sn(n){const t=Ue();return O.useCallback(s=>{AA(t).request(n,s)},[t,n])}function Am(n){return n?[`${Jt}.system.workflow.>`,`${Jt}.system.activity.>`,`${Jt}.system.milestone.>`,`${Jt}.system.task.>`,`${Jt}.system.escalation.>`]:[]}function l5(){const n=sn("LIST");wn(`${Jt}.system.task.>`,()=>{n([["jobs"]])}),wn(`${Jt}.system.workflow.>`,()=>{n([["jobs"]])})}function c5(n){const t=sn("DETAIL");ti(Am(n),s=>{var y;if(!n||!(s.workflowId===n||((y=s.workflowId)==null?void 0:y.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=Om(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),t(d)})}function u5(n){const t=sn("DETAIL");ti(Am(n),s=>{var y;if(!n||!(s.workflowId===n||((y=s.workflowId)==null?void 0:y.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=Om(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),t(d)})}function f5(n){const t=sn("DETAIL");ti(Am(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=Om(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),t(o)})}function h5(n){const t=sn("DETAIL"),s=O.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||t([["processes",n]]))},[n,t]);wn(`${Jt}.system.task.>`,s),wn(`${Jt}.system.workflow.>`,s),wn(`${Jt}.system.escalation.>`,s)}function d5(){const n=sn("SUMMARY");wn(Lr({}),()=>{n([["escalationStats"]])})}function m5(){const n=sn("SUMMARY");wn(Lr({}),()=>{n([["stationMetrics"]])})}function p5(){const n=sn("SUMMARY");wn(Lr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function y5(n){const t=sn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=O.useMemo(()=>{const c=i?i.split(","):null;return c?Ud({role:s,verbs:c}):[Lr({role:s})]},[s,i]);ti(o,()=>{t([["escalations"]])})}function g5(n){const t=sn("DETAIL");wn(Lr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||t([["escalations",n]])})}function b5(){const n=sn("LIST");wn(`${Jt}.system.agent.>`,()=>{n([["agents"]])})}function x5(){const n=sn("LIST");wn(`${Jt}.system.task.>`,()=>{n([["processes"]])}),wn(`${Jt}.system.workflow.>`,()=>{n([["processes"]])})}function jA(){const{user:n}=Lt(),t=n==null?void 0:n.userId,s=sn("SUMMARY");ti(bm(),()=>{s([["escalations"]])});const{data:i}=Jx({limit:1}),{data:o}=Kx({assigned_to:t,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function jm({size:n="sm",hideLabel:t=!1,className:s="",appName:i="LongTail",variant:o="full"}){const c=n==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${$t}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${$t}/logo512.png)`}})});const d=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",y=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${$t}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${y} ${t?"opacity-0":""}`,children:i})]})}const kA="system.surfaces.dashboard",NA=`${Jt}.${kA}`;function Qx(n=!0){return Pe({queryKey:["announcements"],queryFn:()=>fe("/announcements"),enabled:n,staleTime:3e4})}function TA(){const n=Ue();return He({mutationFn:t=>fe("/announcements",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function CA(){const n=Ue();return He({mutationFn:t=>fe(`/announcements/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}const Xx=6048e5,MA=864e5,h1=6e4,d1=525600,m1=43200,p1=1440,y1=Symbol.for("constructDateFrom");function Br(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&y1 in n?n[y1](t):n instanceof Date?new n.constructor(t):new Date(t)}function En(n,t){return Br(t||n,n)}let RA={};function Mo(){return RA}function Ao(n,t){var y,g,f,m;const s=Mo(),i=(t==null?void 0:t.weekStartsOn)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,o=En(n,t==null?void 0:t.in),c=o.getDay(),d=(c<i?7:0)+c-i;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function gu(n,t){return Ao(n,{...t,weekStartsOn:1})}function Wx(n,t){const s=En(n,t==null?void 0:t.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=gu(o),d=Br(s,0);d.setFullYear(i,0,4),d.setHours(0,0,0,0);const y=gu(d);return s.getTime()>=c.getTime()?i+1:s.getTime()>=y.getTime()?i:i-1}function bu(n){const t=En(n),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+n-+s}function Zx(n,...t){const s=Br.bind(null,n||t.find(i=>typeof i=="object"));return t.map(s)}function g1(n,t){const s=En(n,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function DA(n,t,s){const[i,o]=Zx(s==null?void 0:s.in,n,t),c=g1(i),d=g1(o),y=+c-bu(c),g=+d-bu(d);return Math.round((y-g)/MA)}function qA(n,t){const s=Wx(n,t),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),gu(i)}function LA(n,t){const s=+En(n)-+En(t);return s<0?-1:s>0?1:s}function BA(n){return Br(n,Date.now())}function PA(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function UA(n){return!(!PA(n)&&typeof n!="number"||isNaN(+En(n)))}function zA(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function IA(n,t){const s=En(n,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const $A={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"}},HA=(n,t,s)=>{let i;const o=$A[n];return typeof o=="string"?i=o:t===1?i=o.one:i=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function id(n){return(t={})=>{const s=t.width?String(t.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const FA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},GA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},VA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},YA={date:id({formats:FA,defaultWidth:"full"}),time:id({formats:GA,defaultWidth:"full"}),dateTime:id({formats:VA,defaultWidth:"full"})},KA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},JA=(n,t,s,i)=>KA[n];function io(n){return(t,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const d=n.defaultFormattingWidth||n.defaultWidth,y=s!=null&&s.width?String(s.width):d;o=n.formattingValues[y]||n.formattingValues[d]}else{const d=n.defaultWidth,y=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[y]||n.values[d]}const c=n.argumentCallback?n.argumentCallback(t):t;return o[c]}}const QA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},XA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},WA={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"]},ZA={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"]},ej={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"}},tj={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"}},nj=(n,t)=>{const s=Number(n),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},rj={ordinalNumber:nj,era:io({values:QA,defaultWidth:"wide"}),quarter:io({values:XA,defaultWidth:"wide",argumentCallback:n=>n-1}),month:io({values:WA,defaultWidth:"wide"}),day:io({values:ZA,defaultWidth:"wide"}),dayPeriod:io({values:ej,defaultWidth:"wide",formattingValues:tj,defaultFormattingWidth:"wide"})};function ao(n){return(t,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=t.match(o);if(!c)return null;const d=c[0],y=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(y)?ij(y,b=>b.test(d)):sj(y,b=>b.test(d));let f;f=n.valueCallback?n.valueCallback(g):g,f=s.valueCallback?s.valueCallback(f):f;const m=t.slice(d.length);return{value:f,rest:m}}}function sj(n,t){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&t(n[s]))return s}function ij(n,t){for(let s=0;s<n.length;s++)if(t(n[s]))return s}function aj(n){return(t,s={})=>{const i=t.match(n.matchPattern);if(!i)return null;const o=i[0],c=t.match(n.parsePattern);if(!c)return null;let d=n.valueCallback?n.valueCallback(c[0]):c[0];d=s.valueCallback?s.valueCallback(d):d;const y=t.slice(o.length);return{value:d,rest:y}}}const oj=/^(\d+)(th|st|nd|rd)?/i,lj=/\d+/i,cj={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},uj={any:[/^b/i,/^(a|c)/i]},fj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hj={any:[/1/i,/2/i,/3/i,/4/i]},dj={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},mj={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]},pj={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},yj={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]},gj={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},bj={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}},xj={ordinalNumber:aj({matchPattern:oj,parsePattern:lj,valueCallback:n=>parseInt(n,10)}),era:ao({matchPatterns:cj,defaultMatchWidth:"wide",parsePatterns:uj,defaultParseWidth:"any"}),quarter:ao({matchPatterns:fj,defaultMatchWidth:"wide",parsePatterns:hj,defaultParseWidth:"any",valueCallback:n=>n+1}),month:ao({matchPatterns:dj,defaultMatchWidth:"wide",parsePatterns:mj,defaultParseWidth:"any"}),day:ao({matchPatterns:pj,defaultMatchWidth:"wide",parsePatterns:yj,defaultParseWidth:"any"}),dayPeriod:ao({matchPatterns:gj,defaultMatchWidth:"any",parsePatterns:bj,defaultParseWidth:"any"})},ev={code:"en-US",formatDistance:HA,formatLong:YA,formatRelative:JA,localize:rj,match:xj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function vj(n,t){const s=En(n,t==null?void 0:t.in);return DA(s,IA(s))+1}function _j(n,t){const s=En(n,t==null?void 0:t.in),i=+gu(s)-+qA(s);return Math.round(i/Xx)+1}function tv(n,t){var m,b,x,v;const s=En(n,t==null?void 0:t.in),i=s.getFullYear(),o=Mo(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((v=(x=o.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,d=Br((t==null?void 0:t.in)||n,0);d.setFullYear(i+1,0,c),d.setHours(0,0,0,0);const y=Ao(d,t),g=Br((t==null?void 0:t.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const f=Ao(g,t);return+s>=+y?i+1:+s>=+f?i:i-1}function wj(n,t){var y,g,f,m;const s=Mo(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=tv(n,t),c=Br((t==null?void 0:t.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),Ao(c,t)}function Sj(n,t){const s=En(n,t==null?void 0:t.in),i=+Ao(s,t)-+wj(s,t);return Math.round(i/Xx)+1}function We(n,t){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return s+i}const ps={y(n,t){const s=n.getFullYear(),i=s>0?s:1-s;return We(t==="yy"?i%100:i,t.length)},M(n,t){const s=n.getMonth();return t==="M"?String(s+1):We(s+1,2)},d(n,t){return We(n.getDate(),t.length)},a(n,t){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(n,t){return We(n.getHours()%12||12,t.length)},H(n,t){return We(n.getHours(),t.length)},m(n,t){return We(n.getMinutes(),t.length)},s(n,t){return We(n.getSeconds(),t.length)},S(n,t){const s=t.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return We(o,t.length)}},Ii={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},b1={G:function(n,t,s){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(n,t,s){if(t==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ps.y(n,t)},Y:function(n,t,s,i){const o=tv(n,i),c=o>0?o:1-o;if(t==="YY"){const d=c%100;return We(d,2)}return t==="Yo"?s.ordinalNumber(c,{unit:"year"}):We(c,t.length)},R:function(n,t){const s=Wx(n);return We(s,t.length)},u:function(n,t){const s=n.getFullYear();return We(s,t.length)},Q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return We(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return We(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,s){const i=n.getMonth();switch(t){case"M":case"MM":return ps.M(n,t);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,s){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return We(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,s,i){const o=Sj(n,i);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):We(o,t.length)},I:function(n,t,s){const i=_j(n);return t==="Io"?s.ordinalNumber(i,{unit:"week"}):We(i,t.length)},d:function(n,t,s){return t==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ps.d(n,t)},D:function(n,t,s){const i=vj(n);return t==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):We(i,t.length)},E:function(n,t,s){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return We(c,2);case"eo":return s.ordinalNumber(c,{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(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return We(c,t.length);case"co":return s.ordinalNumber(c,{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(n,t,s){const i=n.getDay(),o=i===0?7:i;switch(t){case"i":return String(o);case"ii":return We(o,t.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,s){const o=n.getHours()/12>=1?"pm":"am";switch(t){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(n,t,s){const i=n.getHours();let o;switch(i===12?o=Ii.noon:i===0?o=Ii.midnight:o=i/12>=1?"pm":"am",t){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(n,t,s){const i=n.getHours();let o;switch(i>=17?o=Ii.evening:i>=12?o=Ii.afternoon:i>=4?o=Ii.morning:o=Ii.night,t){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(n,t,s){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ps.h(n,t)},H:function(n,t,s){return t==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ps.H(n,t)},K:function(n,t,s){const i=n.getHours()%12;return t==="Ko"?s.ordinalNumber(i,{unit:"hour"}):We(i,t.length)},k:function(n,t,s){let i=n.getHours();return i===0&&(i=24),t==="ko"?s.ordinalNumber(i,{unit:"hour"}):We(i,t.length)},m:function(n,t,s){return t==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ps.m(n,t)},s:function(n,t,s){return t==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ps.s(n,t)},S:function(n,t){return ps.S(n,t)},X:function(n,t,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return v1(i);case"XXXX":case"XX":return Qs(i);case"XXXXX":case"XXX":default:return Qs(i,":")}},x:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"x":return v1(i);case"xxxx":case"xx":return Qs(i);case"xxxxx":case"xxx":default:return Qs(i,":")}},O:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+x1(i,":");case"OOOO":default:return"GMT"+Qs(i,":")}},z:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+x1(i,":");case"zzzz":default:return"GMT"+Qs(i,":")}},t:function(n,t,s){const i=Math.trunc(+n/1e3);return We(i,t.length)},T:function(n,t,s){return We(+n,t.length)}};function x1(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=Math.trunc(i/60),c=i%60;return c===0?s+String(o):s+String(o)+t+We(c,2)}function v1(n,t){return n%60===0?(n>0?"-":"+")+We(Math.abs(n)/60,2):Qs(n,t)}function Qs(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=We(Math.trunc(i/60),2),c=We(i%60,2);return s+o+t+c}const _1=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},nv=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Ej=(n,t)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return _1(n,t);let c;switch(i){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",_1(i,t)).replace("{{time}}",nv(o,t))},Oj={p:nv,P:Ej},Aj=/^D+$/,jj=/^Y+$/,kj=["D","DD","YY","YYYY"];function Nj(n){return Aj.test(n)}function Tj(n){return jj.test(n)}function Cj(n,t,s){const i=Mj(n,t,s);if(console.warn(i),kj.includes(n))throw new RangeError(i)}function Mj(n,t,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Rj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Dj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,qj=/^'([^]*?)'?$/,Lj=/''/g,Bj=/[a-zA-Z]/;function km(n,t,s){var m,b,x,v;const i=Mo(),o=i.locale??ev,c=i.firstWeekContainsDate??((b=(m=i.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??1,d=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,y=En(n,s==null?void 0:s.in);if(!UA(y))throw new RangeError("Invalid time value");let g=t.match(Dj).map(_=>{const S=_[0];if(S==="p"||S==="P"){const C=Oj[S];return C(_,o.formatLong)}return _}).join("").match(Rj).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const S=_[0];if(S==="'")return{isToken:!1,value:Pj(_)};if(b1[S])return{isToken:!0,value:_};if(S.match(Bj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:_}});o.localize.preprocessor&&(g=o.localize.preprocessor(y,g));const f={firstWeekContainsDate:c,weekStartsOn:d,locale:o};return g.map(_=>{if(!_.isToken)return _.value;const S=_.value;(Tj(S)||Nj(S))&&Cj(S,t,String(n));const C=b1[S[0]];return C(y,S,o.localize,f)}).join("")}function Pj(n){const t=n.match(qj);return t?t[1].replace(Lj,"'"):n}function Uj(n,t,s){const i=Mo(),o=(s==null?void 0:s.locale)??i.locale??ev,c=LA(n,t);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[y,g]=Zx(s==null?void 0:s.in,...c>0?[t,n]:[n,t]),f=zA((s==null?void 0:s.roundingMethod)??"round"),m=g.getTime()-y.getTime(),b=m/h1,x=bu(g)-bu(y),v=(m-x)/h1,_=s==null?void 0:s.unit;let S;if(_?S=_:b<1?S="second":b<60?S="minute":b<p1?S="hour":v<m1?S="day":v<d1?S="month":S="year",S==="second"){const C=f(m/1e3);return o.formatDistance("xSeconds",C,d)}else if(S==="minute"){const C=f(b);return o.formatDistance("xMinutes",C,d)}else if(S==="hour"){const C=f(b/60);return o.formatDistance("xHours",C,d)}else if(S==="day"){const C=f(v/p1);return o.formatDistance("xDays",C,d)}else if(S==="month"){const C=f(v/m1);return C===12&&_!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",C,d)}else{const C=f(v/d1);return o.formatDistance("xYears",C,d)}}function zj(n,t){return Uj(n,BA(n),t)}function v5(n){return n.toLocaleString()}function _5(n){return n>=1e9?`${(n/1e9).toFixed(1).replace(/\.0$/,"")}B`:n>=1e6?`${(n/1e6).toFixed(1).replace(/\.0$/,"")}M`:n>=1e4?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}K`:n.toLocaleString()}function Ij(n){const t=new Date(n);return t.getTime()>Date.now()?"just now":zj(t,{addSuffix:!0})}function w5(n){const t=Date.now()-new Date(n).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const c=Math.floor(o/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function S5(n){return n<=0?"Expired":Nm(n)}function $j(n){return n==null?"--":Nm(n)}function E5(n){return n?km(new Date(n),"MMM d, yyyy h:mm a"):"--"}function Nm(n){if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4){const d=n/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(n/1e3),s=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),c=t%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?o>0?`${i}h ${o}m`:`${i}h`:c>0?`${o}m ${c}s`:`${o}m`}function O5(n,t){const s=new Date(n).getTime(),i=t?new Date(t).getTime():Date.now();return Nm(i-s)}function rv({options:n,children:t,className:s=""}){const[i,o]=O.useState(!1),[c,d]=O.useState(null),[y,g]=O.useState(null),f=O.useRef(null),m=O.useRef(void 0),b=O.useRef(void 0),x=220,v=O.useCallback(()=>{if(!f.current)return;const L=f.current.getBoundingClientRect(),P=window.innerWidth-x-8,re=Math.max(8,Math.min(L.left,P));g({top:L.bottom+4,left:re})},[]),_=O.useCallback(async(L,P)=>{try{await navigator.clipboard.writeText(L),d(P),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=O.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=O.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return O.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[t,i&&y&&Qd.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:y.top,left:y.left},onMouseEnter:S,onMouseLeave:C,children:n.map(L=>h.jsxs("button",{onClick:P=>{P.stopPropagation(),_(L.value,L.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:L.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===L.label?"✓":L.value})]},L.label))}),document.body)]})}function Hj(n,t){const s=new Date(n);switch(t){case"relative":return Ij(n);case"datetime":return km(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function Fj(n){const t=new Date(n);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:km(t,"MMM d, yyyy h:mm:ss a")}]}function sv({date:n,format:t="relative",className:s=""}){const[,i]=O.useState(0);O.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>i(d=>d+1),3e4);return()=>clearInterval(c)},[t]);const o=O.useMemo(()=>Fj(n),[n]);return h.jsx(rv,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:Hj(n,t)})})}function Gj({values:n,options:t,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const d=t.filter(y=>!n.includes(y));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(y=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==y)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${y}`,children:[y,h.jsx(Xt,{className:"w-3 h-3",strokeWidth:1.5})]},y)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),d.length>0&&h.jsxs("select",{value:"",onChange:y=>y.target.value&&s([...n,y.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),d.map(y=>h.jsx("option",{value:y,children:y},y))]})]})}const Vj=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function Yj(){const{data:n}=Qx(),{data:t}=lA(),s=TA(),i=CA(),[o,c]=O.useState(""),[d,y]=O.useState(""),[g,f]=O.useState(1440),[m,b]=O.useState([]),x=(n==null?void 0:n.announcements)??[],v=()=>{d.trim()&&s.mutate({body:d.trim(),...o.trim()?{title:o.trim()}:{},...m.length?{roles:m}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),y(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:o,onChange:_=>c(_.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:d,onChange:_=>y(_.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:_=>f(Number(_.target.value)),className:"select text-xs w-full",children:Vj.map(_=>h.jsx("option",{value:_.minutes,children:_.label},_.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(Gj,{values:m,options:(t==null?void 0:t.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!d.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(_=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:_.title??_.body.split(`
|
|
54
|
+
`)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(sv,{date:_.expires_at,format:"relative"})]})]}),h.jsx("button",{onClick:()=>i.mutate(_.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${_.title??"announcement"}`,children:h.jsx(Xt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},_.id))})]})]})}const Kj=[{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"}],Jj=["operator","engineer","admin","superadmin"];function w1(n){return Jj.indexOf(n)}function Qj(n,t){return w1(n)>=w1(t)}function Xj({onClose:n}){var ke,Te,st,Nt,Bt,gt,bt;const{isSuperAdmin:t,hasRoleType:s,hasRole:i}=Lt(),{data:o}=Wn(),c=gm(),d=!!((ke=o==null?void 0:o.ai)!=null&&ke.enabled),y=Lx(),g=y!==null?y:d,[f,m]=O.useState(g),b=(Te=o==null?void 0:o.features)==null?void 0:Te.graphWorkflows,x=b==null,[v,_]=O.useState(b===!0||x&&Bx()),S=t||i("engineer"),[C,L]=O.useState(Px()),P=!!((st=o==null?void 0:o.features)!=null&&st.scanCodes),re=Ux(),[le,R]=O.useState(re!==null?re:P),$=t?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ee=((Nt=o==null?void 0:o.branding)==null?void 0:Nt.appName)??"LongTail",K=(Bt=o==null?void 0:o.environment)==null?void 0:Bt.longTailVersion,U=(gt=o==null?void 0:o.environment)==null?void 0:gt.hotmeshVersion,D=(bt=o==null?void 0:o.environment)==null?void 0:bt.nodeEnv;O.useEffect(()=>{const ue=Je=>{Je.key==="Escape"&&n()};return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[n]);const X=Kj.filter(ue=>Qj($,ue.minTier)),J=X.length>1,he=$!=="operator",be=[...J?[{id:"viewas",label:"View As",icon:rS}]:[],{id:"features",label:"Features",icon:sS},...he?[{id:"alerts",label:"Alerts",icon:iS}]:[]],[je,H]=O.useState(be[0].id),Z=ue=>{ue===null?Pd():QO(ue)},oe=()=>{const ue=!f;m(ue),ue===d?JO():KO(ue),window.location.reload()},_e=()=>{const ue=!v;_(ue),XO(ue),window.location.reload()},Se=()=>{const ue=!C;L(ue),WO(ue),window.location.reload()},Ne=()=>{const ue=!le;R(ue),ue===P?eA():ZO(ue),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:n,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:ue=>ue.stopPropagation(),children:[h.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Xt,{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(${$t}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ee}),K&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",K,U&&h.jsxs(h.Fragment,{children:[" · HotMesh v",U]}),D&&D!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:D})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),be.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:be.map(ue=>{const Je=je===ue.id;return h.jsxs("button",{role:"tab","aria-selected":Je,onClick:()=>H(ue.id),title:ue.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Je?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(ue.icon,{className:"w-5 h-5",strokeWidth:1.5,...Je?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:ue.label})]},ue.id)})}),je==="viewas"&&J&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(ue=>{const Je=c===ue.id,jn=ue.id===null?`Your view · ${$}`:ue.label;return h.jsxs("button",{onClick:()=>Z(ue.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 ${Je?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Je&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${Je?"text-accent":"text-text-primary group-hover:text-accent"}`,children:jn}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:ue.description})]})]},String(ue.id))})]}),je==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:oe,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:f?"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 ${f?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:_e,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:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),S&&h.jsxs("button",{onClick:Se,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group","data-testid":"feature-infrastructure",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Infrastructure"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:C?"Visible — Routers, Messages, and DB Maintenance in the sidebar":"Hidden — routers, message streams, and database maintenance"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${C?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:Ne,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:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:le?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${le?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${le?"translate-x-4":"translate-x-0"}`})})]})]}),je==="alerts"&&he&&h.jsx(Yj,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const iv=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],S1="blue",av="lt.theme";let ov=[];function Wj(n){const t=new Set(iv.map(i=>i.id)),s=new Set;ov=n.filter(i=>!(i!=null&&i.id)||t.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function Zj(){return[...iv,...ov]}function lv(){try{return localStorage.getItem(av)||S1}catch{return S1}}function cv(n){document.documentElement.dataset.theme=n}function ek(n){try{localStorage.setItem(av,n)}catch{}cv(n)}const uv=O.createContext(null);function tk(){const n=O.useContext(uv);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function nk({children:n}){const[t,s]=O.useState(null),i=O.useRef(t);i.current=t,O.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){s(null);return}const f=setTimeout(()=>s(null),g);return()=>clearTimeout(f)},[t]);const o=O.useCallback(g=>{var m;if(!g.actingToken||!g.actor)return null;const f=((m=i.current)==null?void 0:m.actingToken)??null;return s({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),f},[]),c=O.useCallback(()=>s(null),[]);O.useEffect(()=>(Tg(()=>{var g;return((g=i.current)==null?void 0:g.actingToken)??null}),Cg(c),()=>{Tg(null),Cg(null)}),[c]);const d=O.useCallback(()=>{var f;const g=(f=i.current)==null?void 0:f.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),y=O.useMemo(()=>({identity:t,prime:o,clear:c,remainingSeconds:d}),[t,o,c,d]);return h.jsx(uv.Provider,{value:y,children:n})}const ou={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},fv="lt_scan_wedge_config";function hv(){try{const n=localStorage.getItem(fv);return n?{...ou,...JSON.parse(n)}:ou}catch{return ou}}function rk(n){const t={...hv(),...n};return localStorage.setItem(fv,JSON.stringify(t)),t}const sk=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function E1(n){let t=null;for(const s of sk){const i=n.match(s);i&&(!t||i[0].length>t.length)&&(t=i[0])}return t}const ik=new Set(["Shift","CapsLock"]),uc={suppress:!1,emit:null};function ak(n=ou){let t={buffer:"",times:[],lastKeyMs:0};function s(){t={buffer:"",times:[],lastKeyMs:0}}function i(d){const{key:y,timeMs:g,hasModifier:f,isRepeat:m}=d;if(ik.has(y))return uc;if(n.terminators.includes(y)){const S=E1(t.buffer);return s(),S&&S.length>=n.minLength?{suppress:!0,emit:S,consumedLength:S.length}:uc}if(f||m||y.length!==1)return s(),uc;const b=g-t.lastKeyMs,x=t.lastKeyMs>0&&b<=n.maxKeyGapMs,v=(x?t.buffer+y:y).slice(-128),_=(x?[...t.times,g]:[g]).slice(-128);return t={buffer:v,times:_,lastKeyMs:g},uc}function o(){return{buffer:t.buffer}}function c(){const d=E1(t.buffer);if(!d||d.length<n.minLength)return null;const y=t.times.slice(-d.length);return y.length<2||(y[y.length-1]-y[0])/(y.length-1)>n.autoFireMaxAvgKeyMs?null:{code:d,consumedLength:d.length}}return{step:i,reset:s,snapshot:o,pendingAutoFire:c}}function ok(){const n=document.activeElement;return n instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(n.type)?n:null:n instanceof HTMLTextAreaElement?n:null}function lk(n,t,s){var c;const i=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;o?o.call(n,t):n.value=t;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function O1(n){if(n<=0)return;const t=ok();if(!t)return;const s=t.selectionStart??t.value.length,i=Math.max(0,s-n);lk(t,t.value.slice(0,i)+t.value.slice(s),i)}function ck({active:n,wedgeConfig:t,diagnosticsOn:s,onScan:i,onDiag:o}){const c=O.useRef({diagnosticsOn:s,onScan:i,onDiag:o});c.current={diagnosticsOn:s,onScan:i,onDiag:o};const d=O.useRef(0),y=O.useRef(0);O.useEffect(()=>{if(!n)return;const g=ak(t);let f=null;const m=()=>{f&&(clearTimeout(f),f=null)},b=(_,S,C)=>{S&&O1(S),c.current.diagnosticsOn&&(console.debug("[scan]",C),c.current.onDiag({seq:++d.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:C})),c.current.onScan(_)},x=()=>{m(),g.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const _=g.pendingAutoFire();_&&(g.reset(),b(_.code,_.consumedLength,`capture → ${_.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},v=_=>{const S=g.snapshot().buffer,{suppress:C,emit:L,consumedLength:P}=g.step({key:_.key,timeMs:_.timeStamp,hasModifier:_.ctrlKey||_.metaKey||_.altKey,isRepeat:_.repeat});if(C&&(_.preventDefault(),_.stopPropagation()),c.current.diagnosticsOn){const re=g.snapshot().buffer,le=t.terminators.includes(_.key),R=L?`capture → ${L}`:le?`terminator — no code tail in "${S.slice(-24)}"`:re===S?S?"neutral (chord key)":"ignored":re===""?"reset (edit/chord/non-printable)":re.length<=1&&S.length>1?"gap — new episode":"accumulate",$=y.current?Math.round(_.timeStamp-y.current):0,ee={seq:++d.current,key:_.key,code:_.code!==_.key?_.code:"",deltaMs:$,buffer:re.slice(-24),note:R};console.debug("[scan]",ee.key,ee.code,`${ee.deltaMs}ms`,ee.note),c.current.onDiag(ee)}y.current=_.timeStamp,L?(m(),P&&O1(P),c.current.onScan(L)):x()};return window.addEventListener("keydown",v,{capture:!0}),()=>{m(),window.removeEventListener("keydown",v,{capture:!0})}},[n,t])}const $e={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},fc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},uk={ACTION:"action",IDENTITY:"identity"};function fk(n,t){return fe("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function A5(n){return fe("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function hk(n){return Pe({queryKey:["scan-schemes"],queryFn:()=>fe("/scan-codes/schemes"),...n})}function j5(n){return Pe({queryKey:["scan-schemes",n],queryFn:()=>fe(`/scan-codes/schemes/${n}`),enabled:n!=null})}function k5(){const n=Ue();return He({mutationFn:t=>fe(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function N5(){const n=Ue();return He({mutationFn:t=>fe(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function T5(){const n=Ue();return He({mutationFn:t=>fe(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function C5(){const n=Ue();return He({mutationFn:t=>fe(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const jo={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar"},$i=n=>{if(n)try{return JSON.parse(n)}catch{return}},Xs=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function dk(n){const t={},s=$i(n.get("facets"));Xs(s)||(t.facets=s);const i=$i(n.get("block"));Xs(i)||(t.block=i);const o=$i(n.get("range"));Xs(o)||(t.range=o);const c=$i(n.get("exists"));Xs(c)||(t.exists=c);const d=$i(n.get("roles"));Xs(d)||(t.roles=d);const y=$i(n.get("orderBy"));Xs(y)||(t.orderBy=y),n.get("available")!=null&&(t.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function M5(n,t){const s=(i,o)=>Xs(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?n.delete("available"):n.set("available",String(t.available)),t.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const A1=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function dv(n,t){const s={};for(const[o,c]of Object.entries(n))s[o]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${i}${A1}`:`/escalations/available?facets=${i}${A1}`}function mk(n,t,s){return dv({[n]:t},s)}function R5(n){var t,s,i;return Object.keys(n.facets??{}).length+(((t=n.block)==null?void 0:t.length)??0)+(((s=n.range)==null?void 0:s.length)??0)+(((i=n.exists)==null?void 0:i.length)??0)+(n.available!=null?1:0)+(n.jeopardy===!0?1:0)}function Tm(){var s;const{data:n}=Wn(),t=Ux();return t!==null?t:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const mv=O.createContext(null);function Cm(){const n=O.useContext(mv);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}const pk="scanPendingAction",yk="scanChoices",gk="/scan/station";function bk({children:n}){const{user:t}=Lt(),s=Tm(),i=ra(),{identity:o,prime:c}=tk(),[d,y]=O.useState(null),[g,f]=O.useState(!1),[m,b]=O.useState(()=>hv()),[x,v]=O.useState([]),[_,S]=O.useState(!1),C=O.useCallback(U=>{var X;const{outcome:D}=U;if(D===$e.CONFIRM_REQUIRED&&U.pendingAction)return i(`/escalations/detail/${U.pendingAction.escalationId}`,{state:{[pk]:U.pendingAction}}),!0;if(D===$e.EXECUTED&&U.escalation){const J=[fc.SHOW_DETAIL,fc.CLAIM_SHOW_DETAIL,fc.CLAIM,fc.ESCALATE];return U.verb&&J.includes(U.verb)?(i(`/escalations/detail/${U.escalation.id}`),!0):!1}if(D===$e.MATCHED_LIST&&U.listQuery){const{targetFacet:J,target:he,roles:be}=U.listQuery;return i(dv({[J]:he},(be==null?void 0:be[0])??null)),!0}return D===$e.CHOICES&&U.choices?(i(gk,{state:{[yk]:U}}),!0):D===$e.NO_MATCH_FALLBACK&&((X=U.fallback)!=null&&X.route)?(i(U.fallback.route),!0):!1},[i]),L=O.useRef(null);L.current=(o==null?void 0:o.actingToken)??null;const P=O.useRef(null),re=O.useRef(null),le=O.useCallback(U=>{re.current=U},[]),R=O.useCallback(async(U,D=jo.MANUAL)=>{var J;if((J=re.current)!=null&&J.call(re,U))return;f(!0);const X=Date.now();try{const he=await fk(U,{actingToken:L.current??void 0,previousActingToken:P.current??void 0});he.outcome===$e.IDENTITY_PRIMED&&(P.current=c(he));const be=C(he);y({code:U,source:D,at:X,response:he,error:null,navigated:be})}catch(he){y({code:U,source:D,at:X,response:null,error:he.message,navigated:!1})}finally{f(!1)}},[C,c]),$=O.useRef(R);$.current=R,ck({active:!!t&&s,wedgeConfig:m,diagnosticsOn:_,onScan:U=>void $.current(U,jo.KEYBOARD_WEDGE),onDiag:U=>v(D=>[...D.slice(-29),U])});const ee=O.useCallback(U=>{b(rk(U))},[]),K=O.useMemo(()=>({submitCode:R,setCodeInterceptor:le,lastResult:d,busy:g,wedgeConfig:m,updateWedgeConfig:ee,diagnostics:x,diagnosticsOn:_,setDiagnosticsOn:S}),[R,le,d,g,m,ee,x,_]);return h.jsx(mv.Provider,{value:K,children:n})}var hc={},oo={},dc={},j1;function An(){if(j1)return dc;j1=1,Object.defineProperty(dc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var t=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return dc.default=t,dc}var k1;function xk(){if(k1)return oo;k1=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.CODE39=void 0;var n=(function(){function S(C,L){for(var P=0;P<L.length;P++){var re=L[P];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(C,re.key,re)}}return function(C,L,P){return L&&S(C.prototype,L),P&&S(C,P),C}})(),t=An(),s=i(t);function i(S){return S&&S.__esModule?S:{default:S}}function o(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function d(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var y=(function(S){d(C,S);function C(L,P){return o(this,C),L=L.toUpperCase(),P.mod43&&(L+=x(_(L))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,L,P))}return n(C,[{key:"encode",value:function(){for(var P=m("*"),re=0;re<this.data.length;re++)P+=m(this.data[re])+"0";return P+=m("*"),{data:P,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],f=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function m(S){return b(v(S))}function b(S){return f[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function _(S){for(var C=0,L=0;L<S.length;L++)C+=v(S[L]);return C=C%43,C}return oo.CODE39=y,oo}var Yn={},mc={},pc={},yt={},N1;function Ro(){if(N1)return yt;N1=1,Object.defineProperty(yt,"__esModule",{value:!0});var n;function t(g,f,m){return f in g?Object.defineProperty(g,f,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[f]=m,g}var s=yt.SET_A=0,i=yt.SET_B=1,o=yt.SET_C=2;yt.SHIFT=98;var c=yt.START_A=103,d=yt.START_B=104,y=yt.START_C=105;return yt.MODULO=103,yt.STOP=106,yt.FNC1=207,yt.SET_BY_CODE=(n={},t(n,c,s),t(n,d,i),t(n,y,o),n),yt.SWAP={101:s,100:i,99:o},yt.A_START_CHAR="Ð",yt.B_START_CHAR="Ñ",yt.C_START_CHAR="Ò",yt.A_CHARS="[\0-_È-Ï]",yt.B_CHARS="[ -È-Ï]",yt.C_CHARS="(Ï*[0-9]{2}Ï*)",yt.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],yt}var T1;function Nu(){if(T1)return pc;T1=1,Object.defineProperty(pc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=An(),s=o(t),i=Ro();function o(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){c(this,m);var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(_){return _.charCodeAt(0)}),v}return n(m,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,_=i.SET_BY_CODE[v];if(_===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=m.next(x,1,_);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:m.getBar(v)+S.result+m.getBar((S.checksum+v)%i.MODULO)+m.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var _=x.shift();return _<32?_+64:_-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,_){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var L=i.SWAP[C];L!==void 0?S=m.next(x,v+1,L):((_===i.SET_A||_===i.SET_B)&&C===i.SHIFT&&(x[0]=_===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=m.next(x,v+1,_))}else C=m.correctIndex(x,_),S=m.next(x,v+1,_);var P=m.getBar(C),re=C*v;return{result:P+S.result,checksum:re+S.checksum}}}]),m})(s.default);return pc.default=g,pc}var yc={},C1;function vk(){if(C1)return yc;C1=1,Object.defineProperty(yc,"__esModule",{value:!0});var n=Ro(),t=function(y){return y.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(y){return y.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(y){return y.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(d,y){var g=y?n.A_CHARS:n.B_CHARS,f=d.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(d.substring(f[1].length));var m=d.match(new RegExp("^"+g+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(y?205:206)+o(d.substring(m.length),!y)}function c(d){var y=i(d),g=y.length;if(g===d.length)return d;d=d.substring(g);var f=t(d)>=s(d);return y+String.fromCharCode(f?206:205)+o(d,f)}return yc.default=function(d){var y=void 0,g=i(d).length;if(g>=2)y=n.C_START_CHAR+c(d);else{var f=t(d)>s(d);y=(f?n.A_START_CHAR:n.B_START_CHAR)+o(d,f)}return y.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},yc}var M1;function _k(){if(M1)return mc;M1=1,Object.defineProperty(mc,"__esModule",{value:!0});var n=Nu(),t=o(n),s=vk(),i=o(s);function o(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){if(c(this,m),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,(0,i.default)(b),x));else var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x));return d(v)}return m})(t.default);return mc.default=g,mc}var gc={},R1;function wk(){if(R1)return gc;R1=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Nu(),s=o(t),i=Ro();function o(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.A_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),m})(s.default);return gc.default=g,gc}var bc={},D1;function Sk(){if(D1)return bc;D1=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Nu(),s=o(t),i=Ro();function o(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.B_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),m})(s.default);return bc.default=g,bc}var xc={},q1;function Ek(){if(q1)return xc;q1=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Nu(),s=o(t),i=Ro();function o(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.C_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),m})(s.default);return xc.default=g,xc}var L1;function Ok(){if(L1)return Yn;L1=1,Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.CODE128C=Yn.CODE128B=Yn.CODE128A=Yn.CODE128=void 0;var n=_k(),t=g(n),s=wk(),i=g(s),o=Sk(),c=g(o),d=Ek(),y=g(d);function g(f){return f&&f.__esModule?f:{default:f}}return Yn.CODE128=t.default,Yn.CODE128A=i.default,Yn.CODE128B=c.default,Yn.CODE128C=y.default,Yn}var Vt={},vc={},Tr={},B1;function Do(){return B1||(B1=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.SIDE_BIN="101",Tr.MIDDLE_BIN="01010",Tr.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},Tr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Tr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Tr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Tr}var _c={},wc={},P1;function qo(){if(P1)return wc;P1=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=Do(),t=function(i,o,c){var d=i.split("").map(function(g,f){return n.BINARIES[o[f]]}).map(function(g,f){return g?g[i[f]]:""});if(c){var y=i.length-1;d=d.map(function(g,f){return f<y?g+c:g})}return d.join("")};return wc.default=t,wc}var U1;function pv(){if(U1)return _c;U1=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),t=Do(),s=qo(),i=d(s),o=An(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function f(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){f(x,b);function x(v,_){y(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.fontSize=!_.flat&&_.fontSize>_.width*10?_.width*10:_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(_,S){return this.text.substr(_,S)}},{key:"leftEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"rightText",value:function(_,S){return this.text.substr(_,S)}},{key:"rightEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"encodeGuarded",value:function(){var _={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:_},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:_},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var _=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:_.join(""),text:this.text}}}]),x})(c.default);return _c.default=m,_c}var z1;function Ak(){if(z1)return vc;z1=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),t=function b(x,v,_){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,_)}else{if("value"in S)return S.value;var L=S.get;return L===void 0?void 0:L.call(_)}},s=Do(),i=pv(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var f=function(x){var v=x.substr(0,12).split("").map(function(_){return+_}).reduce(function(_,S,C){return C%2?_+S*3:_+S},0);return(10-v%10)%10},m=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=f(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.lastChar=_.lastChar,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var _=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,_,S)}},{key:"rightText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var _=this.data.substr(7,6);return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,_,"RRRRRR")}},{key:"encodeGuarded",value:function(){var _=t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(_.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(_.push({data:"00"}),_.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),_}}]),x})(o.default);return vc.default=m,vc}var Sc={},I1;function jk(){if(I1)return Sc;I1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var n=(function(){function m(b,x){for(var v=0;v<x.length;v++){var _=x[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(b,_.key,_)}}return function(b,x,v){return x&&m(b.prototype,x),v&&m(b,v),b}})(),t=function m(b,x,v){b===null&&(b=Function.prototype);var _=Object.getOwnPropertyDescriptor(b,x);if(_===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:m(S,x,v)}else{if("value"in _)return _.value;var C=_.get;return C===void 0?void 0:C.call(v)}},s=pv(),i=o(s);function o(m){return m&&m.__esModule?m:{default:m}}function c(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function d(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function y(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var g=function(b){var x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,_,S){return S%2?v+_:v+_*3},0);return(10-x%10)%10},f=(function(m){y(b,m);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),d(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return n(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Sc.default=f,Sc}var Ec={},$1;function kk(){if($1)return Ec;$1=1,Object.defineProperty(Ec,"__esModule",{value:!0});var n=(function(){function x(v,_){for(var S=0;S<_.length;S++){var C=_[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,_,S){return _&&x(v.prototype,_),S&&x(v,S),v}})(),t=Do(),s=qo(),i=d(s),o=An(),c=d(o);function d(x){return x&&x.__esModule?x:{default:x}}function y(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function f(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var m=function(v){var _=v.split("").map(function(S){return+S}).reduce(function(S,C,L){return L%2?S+C*9:S+C*3},0);return _%10},b=(function(x){f(v,x);function v(_,S){return y(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,S))}return n(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return Ec.default=b,Ec}var Oc={},H1;function Nk(){if(H1)return Oc;H1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),t=Do(),s=qo(),i=d(s),o=An(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function f(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){f(x,b);function x(v,_){return y(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_))}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var _=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,_,"01"),text:this.text}}}]),x})(c.default);return Oc.default=m,Oc}var lo={},F1;function yv(){if(F1)return lo;F1=1,Object.defineProperty(lo,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})();lo.checksum=m;var t=qo(),s=c(t),i=An(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var f=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=m(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.displayValue=_.displayValue,_.fontSize>_.width*10?S.fontSize=_.width*10:S.fontSize=_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==m(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var _="";return _+="101",_+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),_+="01010",_+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),_+="101",{data:_,text:this.text}}},{key:"guardedEncoding",value:function(){var _=[];return this.displayValue&&_.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),_.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),_.push({data:"01010",options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),_.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&_.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),_}}]),x})(o.default);function m(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return lo.default=f,lo}var Ac={},G1;function Tk(){if(G1)return Ac;G1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var n=(function(){function _(S,C){for(var L=0;L<C.length;L++){var P=C[L];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}return function(S,C,L){return C&&_(S.prototype,C),L&&_(S,L),S}})(),t=qo(),s=d(t),i=An(),o=d(i),c=yv();function d(_){return _&&_.__esModule?_:{default:_}}function y(_,S){if(!(_ instanceof S))throw new TypeError("Cannot call a class as a function")}function g(_,S){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:_}function f(_,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);_.prototype=Object.create(S&&S.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(_,S):_.__proto__=S)}var m=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],x=(function(_){f(S,_);function S(C,L){y(this,S);var P=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,L));if(P.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)P.middleDigits=C,P.upcA=v(C,"0"),P.text=L.text||""+P.upcA[0]+C+P.upcA[P.upcA.length-1],P.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(P.middleDigits=C.substring(1,C.length-1),P.upcA=v(P.middleDigits,C[0]),P.upcA[P.upcA.length-1]===C[C.length-1])P.isValid=!0;else return g(P);else return g(P);return P.displayValue=L.displayValue,L.fontSize>L.width*10?P.fontSize=L.width*10:P.fontSize=L.fontSize,P.guardHeight=L.height+P.fontSize/2+L.textMargin,P}return n(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var L="";return L+="101",L+=this.encodeMiddleDigits(),L+="010101",{data:L,text:this.text}}},{key:"guardedEncoding",value:function(){var L=[];return this.displayValue&&L.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),L.push({data:"101",options:{height:this.guardHeight}}),L.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),L.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&L.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),L}},{key:"encodeMiddleDigits",value:function(){var L=this.upcA[0],P=this.upcA[this.upcA.length-1],re=b[parseInt(P)][parseInt(L)];return(0,s.default)(this.middleDigits,re)}}]),S})(o.default);function v(_,S){for(var C=parseInt(_[_.length-1]),L=m[C],P="",re=0,le=0;le<L.length;le++){var R=L[le];R==="X"?P+=_[re++]:P+=R}return P=""+S+P,""+P+(0,c.checksum)(P)}return Ac.default=x,Ac}var V1;function Ck(){if(V1)return Vt;V1=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.UPCE=Vt.UPC=Vt.EAN2=Vt.EAN5=Vt.EAN8=Vt.EAN13=void 0;var n=Ak(),t=x(n),s=jk(),i=x(s),o=kk(),c=x(o),d=Nk(),y=x(d),g=yv(),f=x(g),m=Tk(),b=x(m);function x(v){return v&&v.__esModule?v:{default:v}}return Vt.EAN13=t.default,Vt.EAN8=i.default,Vt.EAN5=c.default,Vt.EAN2=y.default,Vt.UPC=f.default,Vt.UPCE=b.default,Vt}var Ks={},jc={},Hi={},Y1;function Mk(){return Y1||(Y1=1,Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.START_BIN="1010",Hi.END_BIN="11101",Hi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Hi}var K1;function gv(){if(K1)return jc;K1=1,Object.defineProperty(jc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Mk(),s=An(),i=o(s);function o(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return n(m,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(_){return x.encodePair(_)}).join("");return{data:t.START_BIN+v+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=t.BINARIES[x[1]];return t.BINARIES[x[0]].split("").map(function(_,S){return(_==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),m})(i.default);return jc.default=g,jc}var kc={},J1;function Rk(){if(J1)return kc;J1=1,Object.defineProperty(kc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=gv(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function o(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=function(m){var b=m.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,_){return x+v*(3-_%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(f){d(m,f);function m(b,x){return o(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=y(b)),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===y(this.data)}}]),m})(s.default);return kc.default=g,kc}var Q1;function Dk(){if(Q1)return Ks;Q1=1,Object.defineProperty(Ks,"__esModule",{value:!0}),Ks.ITF14=Ks.ITF=void 0;var n=gv(),t=o(n),s=Rk(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Ks.ITF=t.default,Ks.ITF14=i.default,Ks}var pn={},Nc={},X1;function Lo(){if(X1)return Nc;X1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=An(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function o(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){d(m,f);function m(b,x){return o(this,m),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var _=parseInt(this.data[v]),S=_.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),m})(s.default);function g(f,m){for(var b=0;b<m;b++)f="0"+f;return f}return Nc.default=y,Nc}var Tc={},co={},W1;function Tu(){if(W1)return co;W1=1,Object.defineProperty(co,"__esModule",{value:!0}),co.mod10=n,co.mod11=t;function n(s){for(var i=0,o=0;o<s.length;o++){var c=parseInt(s[o]);(o+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function t(s){for(var i=0,o=[2,3,4,5,6,7],c=0;c<s.length;c++){var d=parseInt(s[s.length-1-c]);i+=o[c%o.length]*d}return(11-i%11)%11}return co}var Z1;function qk(){if(Z1)return Tc;Z1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=Lo(),t=i(n),s=Tu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return o(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,s.mod10)(m),b))}return f})(t.default);return Tc.default=y,Tc}var Cc={},eb;function Lk(){if(eb)return Cc;eb=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=Lo(),t=i(n),s=Tu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return o(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,s.mod11)(m),b))}return f})(t.default);return Cc.default=y,Cc}var Mc={},tb;function Bk(){if(tb)return Mc;tb=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=Lo(),t=i(n),s=Tu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return o(this,f),m+=(0,s.mod10)(m),m+=(0,s.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return Mc.default=y,Mc}var Rc={},nb;function Pk(){if(nb)return Rc;nb=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=Lo(),t=i(n),s=Tu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return o(this,f),m+=(0,s.mod11)(m),m+=(0,s.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return Rc.default=y,Rc}var rb;function Uk(){if(rb)return pn;rb=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.MSI1110=pn.MSI1010=pn.MSI11=pn.MSI10=pn.MSI=void 0;var n=Lo(),t=m(n),s=qk(),i=m(s),o=Lk(),c=m(o),d=Bk(),y=m(d),g=Pk(),f=m(g);function m(b){return b&&b.__esModule?b:{default:b}}return pn.MSI=t.default,pn.MSI10=i.default,pn.MSI11=c.default,pn.MSI1010=y.default,pn.MSI1110=f.default,pn}var uo={},sb;function zk(){if(sb)return uo;sb=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.pharmacode=void 0;var n=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=An(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){o(this,f);var x=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b));return x.number=parseInt(m,10),x}return n(f,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(s.default);return uo.pharmacode=y,uo}var fo={},ib;function Ik(){if(ib)return fo;ib=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.codabar=void 0;var n=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=An(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){o(this,f),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var x=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),f})(s.default);return fo.codabar=y,fo}var Js={},Dc={},Fi={},ab;function $k(){return ab||(ab=1,Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Fi.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Fi.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Fi}var ob;function bv(){if(ob)return Dc;ob=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=$k(),s=An(),i=o(s);function o(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return t.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return m.getEncoding(C)}).join(""),_=m.checksum(x,20),S=m.checksum(x.concat(_),15);return{text:this.text,data:m.getEncoding("ÿ")+v+m.getEncoding(_)+m.getEncoding(S)+m.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return t.BINARIES[m.symbolValue(x)]}},{key:"getSymbol",value:function(x){return t.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return t.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var _=x.slice().reverse().reduce(function(S,C,L){var P=L%v+1;return S+m.symbolValue(C)*P},0);return m.getSymbol(_%47)}}]),m})(i.default);return Dc.default=g,Dc}var qc={},lb;function Hk(){if(lb)return qc;lb=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=bv(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return o(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return n(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(s.default);return qc.default=y,qc}var cb;function Fk(){if(cb)return Js;cb=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.CODE93FullASCII=Js.CODE93=void 0;var n=bv(),t=o(n),s=Hk(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Js.CODE93=t.default,Js.CODE93FullASCII=i.default,Js}var ho={},ub;function Gk(){if(ub)return ho;ub=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.GenericBarcode=void 0;var n=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=An(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return o(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return n(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(s.default);return ho.GenericBarcode=y,ho}var fb;function Vk(){if(fb)return hc;fb=1,Object.defineProperty(hc,"__esModule",{value:!0});var n=xk(),t=Ok(),s=Ck(),i=Dk(),o=Uk(),c=zk(),d=Ik(),y=Fk(),g=Gk();return hc.default={CODE39:n.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:c.pharmacode,codabar:d.codabar,CODE93:y.CODE93,CODE93FullASCII:y.CODE93FullASCII,GenericBarcode:g.GenericBarcode},hc}var Lc={},hb;function Cu(){if(hb)return Lc;hb=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=Object.assign||function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t};return Lc.default=function(t,s){return n({},t,s)},Lc}var Bc={},db;function Yk(){if(db)return Bc;db=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.default=n;function n(t){var s=[];function i(o){if(Array.isArray(o))for(var c=0;c<o.length;c++)i(o[c]);else o.text=o.text||"",o.data=o.data||"",s.push(o)}return i(t),s}return Bc}var Pc={},mb;function Kk(){if(mb)return Pc;mb=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.default=n;function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return Pc}var Uc={},zc={},Ic={},pb;function xv(){if(pb)return Ic;pb=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.default=n;function n(t){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof t[i]=="string"&&(t[i]=parseInt(t[i],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Ic}var $c={},yb;function vv(){if(yb)return $c;yb=1,Object.defineProperty($c,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return $c.default=n,$c}var gb;function Jk(){if(gb)return zc;gb=1,Object.defineProperty(zc,"__esModule",{value:!0});var n=xv(),t=o(n),s=vv(),i=o(s);function o(d){return d&&d.__esModule?d:{default:d}}function c(d){var y={};for(var g in i.default)i.default.hasOwnProperty(g)&&(d.hasAttribute("jsbarcode-"+g.toLowerCase())&&(y[g]=d.getAttribute("jsbarcode-"+g.toLowerCase())),d.hasAttribute("data-"+g.toLowerCase())&&(y[g]=d.getAttribute("data-"+g.toLowerCase())));return y.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),y=(0,t.default)(y),y}return zc.default=c,zc}var Hc={},Fc={},yn={},bb;function _v(){if(bb)return yn;bb=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.getTotalWidthOfEncodings=yn.calculateEncodingAttributes=yn.getBarcodePadding=yn.getEncodingHeight=yn.getMaximumHeightOfEncodings=void 0;var n=Cu(),t=s(n);function s(f){return f&&f.__esModule?f:{default:f}}function i(f,m){return m.height+(m.displayValue&&f.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function o(f,m,b){if(b.displayValue&&m<f){if(b.textAlign=="center")return Math.floor((f-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-m)}return 0}function c(f,m,b){for(var x=0;x<f.length;x++){var v=f[x],_=(0,t.default)(m,v.options),S;_.displayValue?S=g(v.text,_,b):S=0;var C=v.data.length*_.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,_),v.barcodePadding=o(S,C,_)}}function d(f){for(var m=0,b=0;b<f.length;b++)m+=f[b].width;return m}function y(f){for(var m=0,b=0;b<f.length;b++)f[b].height>m&&(m=f[b].height);return m}function g(f,m,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=m.fontOptions+" "+m.fontSize+"px "+m.font;var v=x.measureText(f);if(!v)return 0;var _=v.width;return _}return yn.getMaximumHeightOfEncodings=y,yn.getEncodingHeight=i,yn.getBarcodePadding=o,yn.calculateEncodingAttributes=c,yn.getTotalWidthOfEncodings=d,yn}var xb;function Qk(){if(xb)return Fc;xb=1,Object.defineProperty(Fc,"__esModule",{value:!0});var n=(function(){function y(g,f){for(var m=0;m<f.length;m++){var b=f[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,f,m){return f&&y(g.prototype,f),m&&y(g,m),g}})(),t=Cu(),s=o(t),i=_v();function o(y){return y&&y.__esModule?y:{default:y}}function c(y,g){if(!(y instanceof g))throw new TypeError("Cannot call a class as a function")}var d=(function(){function y(g,f,m){c(this,y),this.canvas=g,this.encodings=f,this.options=m}return n(y,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var m=(0,s.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(m,this.encodings[f]),this.drawCanvasText(m,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,f);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=m+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,m){var b=this.canvas.getContext("2d"),x=m.data,v;f.textPosition=="top"?v=f.marginTop+f.fontSize+f.textMargin:v=f.marginTop,b.fillStyle=f.lineColor;for(var _=0;_<x.length;_++){var S=_*f.width+m.barcodePadding;x[_]==="1"?b.fillRect(S,v,f.width,f.height):x[_]&&b.fillRect(S,v,f.width,f.height*x[_])}}},{key:"drawCanvasText",value:function(f,m){var b=this.canvas.getContext("2d"),x=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var v,_;f.textPosition=="top"?_=f.marginTop+f.fontSize-f.textMargin:_=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=x,f.textAlign=="left"||m.barcodePadding>0?(v=0,b.textAlign="left"):f.textAlign=="right"?(v=m.width-1,b.textAlign="right"):(v=m.width/2,b.textAlign="center"),b.fillText(m.text,v,_)}}},{key:"moveCanvasDrawing",value:function(f){var m=this.canvas.getContext("2d");m.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),y})();return Fc.default=d,Fc}var Gc={},vb;function Xk(){if(vb)return Gc;vb=1,Object.defineProperty(Gc,"__esModule",{value:!0});var n=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=Cu(),s=o(t),i=_v();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",y=(function(){function g(f,m,b){c(this,g),this.svg=f,this.encodings=m,this.options=b,this.document=b.xmlDocument||document}return n(g,[{key:"render",value:function(){var m=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),_=this.createGroup(m,v.marginTop,this.svg);this.setGroupOptions(_,v),this.drawSvgBarcode(_,v,x),this.drawSVGText(_,v,x),m+=x.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),x=m+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(m,b,x){var v=x.data,_;b.textPosition=="top"?_=b.fontSize+b.textMargin:_=0;for(var S=0,C=0,L=0;L<v.length;L++)C=L*b.width+x.barcodePadding,v[L]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,_,b.width*S,b.height,m),S=0);S>0&&this.drawRect(C-b.width*(S-1),_,b.width*S,b.height,m)}},{key:"drawSVGText",value:function(m,b,x){var v=this.document.createElementNS(d,"text");if(b.displayValue){var _,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(_=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(_=x.width-1,v.setAttribute("text-anchor","end")):(_=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",_),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),m.appendChild(v)}}},{key:"setSvgAttributes",value:function(m,b){var x=this.svg;x.setAttribute("width",m+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+m+" "+b),x.setAttribute("xmlns",d),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(m,b,x){var v=this.document.createElementNS(d,"g");return v.setAttribute("transform","translate("+m+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(m,b){m.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(m,b,x,v,_){var S=this.document.createElementNS(d,"rect");return S.setAttribute("x",m),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),_.appendChild(S),S}}]),g})();return Gc.default=y,Gc}var Vc={},_b;function Wk(){if(_b)return Vc;_b=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var y=c[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(o,y.key,y)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,d){t(this,i),this.object=o,this.encodings=c,this.options=d}return n(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Vc.default=s,Vc}var wb;function Zk(){if(wb)return Hc;wb=1,Object.defineProperty(Hc,"__esModule",{value:!0});var n=Qk(),t=d(n),s=Xk(),i=d(s),o=Wk(),c=d(o);function d(y){return y&&y.__esModule?y:{default:y}}return Hc.default={CanvasRenderer:t.default,SVGRenderer:i.default,ObjectRenderer:c.default},Hc}var Gi={},Sb;function wv(){if(Sb)return Gi;Sb=1,Object.defineProperty(Gi,"__esModule",{value:!0});function n(d,y){if(!(d instanceof y))throw new TypeError("Cannot call a class as a function")}function t(d,y){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:d}function s(d,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);d.prototype=Object.create(y&&y.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(d,y):d.__proto__=y)}var i=(function(d){s(y,d);function y(g,f){n(this,y);var m=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return m.name="InvalidInputException",m.symbology=g,m.input=f,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return y})(Error),o=(function(d){s(y,d);function y(){n(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return y})(Error),c=(function(d){s(y,d);function y(){n(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return y})(Error);return Gi.InvalidInputException=i,Gi.InvalidElementException=o,Gi.NoElementException=c,Gi}var Eb;function eN(){if(Eb)return Uc;Eb=1,Object.defineProperty(Uc,"__esModule",{value:!0});var n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},t=Jk(),s=d(t),i=Zk(),o=d(i),c=wv();function d(m){return m&&m.__esModule?m:{default:m}}function y(m){if(typeof m=="string")return g(m);if(Array.isArray(m)){for(var b=[],x=0;x<m.length;x++)b.push(y(m[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return f(m);if(m&&m.nodeName&&m.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&m instanceof SVGElement)return{element:m,options:(0,s.default)(m),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLCanvasElement)return{element:m,options:(0,s.default)(m),renderer:o.default.CanvasRenderer};if(m&&m.getContext)return{element:m,renderer:o.default.CanvasRenderer};if(m&&(typeof m>"u"?"undefined":n(m))==="object"&&!m.nodeName)return{element:m,renderer:o.default.ObjectRenderer};throw new c.InvalidElementException}}function g(m){var b=document.querySelectorAll(m);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(y(b[v]));return x}}function f(m){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(m),renderer:o.default.CanvasRenderer,afterRender:function(){m.setAttribute("src",b.toDataURL())}}}return Uc.default=y,Uc}var Yc={},Ob;function tN(){if(Ob)return Yc;Ob=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var y=c[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(o,y.key,y)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){t(this,i),this.api=o}return n(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var d=c.apply(void 0,arguments);return this.api._options.valid(!0),d}catch(y){return this.handleCatch(y),this.api}}}]),i})();return Yc.default=s,Yc}var ad,Ab;function nN(){if(Ab)return ad;Ab=1;var n=Vk(),t=L(n),s=Cu(),i=L(s),o=Yk(),c=L(o),d=Kk(),y=L(d),g=eN(),f=L(g),m=xv(),b=L(m),x=tN(),v=L(x),_=wv(),S=vv(),C=L(S);function L(U){return U&&U.__esModule?U:{default:U}}var P=function(){},re=function(D,X,J){var he=new P;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,f.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof X<"u"&&(J=J||{},J.format||(J.format=ee()),he.options(J)[J.format](X,J).render()),he};re.getModule=function(U){return t.default[U]};for(var le in t.default)t.default.hasOwnProperty(le)&&R(t.default,le);function R(U,D){P.prototype[D]=P.prototype[D.toUpperCase()]=P.prototype[D.toLowerCase()]=function(X,J){var he=this;return he._errorHandler.wrapBarcodeCall(function(){J.text=typeof J.text>"u"?void 0:""+J.text;var be=(0,i.default)(he._options,J);be=(0,b.default)(be);var je=U[D],H=$(X,je,be);return he._encodings.push(H),he})}}function $(U,D,X){U=""+U;var J=new D(U,X);if(!J.valid())throw new _.InvalidInputException(J.constructor.name,U);var he=J.encode();he=(0,c.default)(he);for(var be=0;be<he.length;be++)he[be].options=(0,i.default)(X,he[be].options);return he}function ee(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}P.prototype.options=function(U){return this._options=(0,i.default)(this._options,U),this},P.prototype.blank=function(U){var D=new Array(U+1).join("0");return this._encodings.push({data:D}),this},P.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var U;for(var D in this._renderProperties){U=this._renderProperties[D];var X=(0,i.default)(this._options,U.options);X.format=="auto"&&(X.format=ee()),this._errorHandler.wrapBarcodeCall(function(){var J=X.value,he=t.default[X.format.toUpperCase()],be=$(J,he,X);K(U,be,X)})}}},P.prototype.render=function(){if(!this._renderProperties)throw new _.NoElementException;if(Array.isArray(this._renderProperties))for(var U=0;U<this._renderProperties.length;U++)K(this._renderProperties[U],this._encodings,this._options);else K(this._renderProperties,this._encodings,this._options);return this},P.prototype._defaults=C.default;function K(U,D,X){D=(0,c.default)(D);for(var J=0;J<D.length;J++)D[J].options=(0,i.default)(X,D[J].options),(0,y.default)(D[J].options);(0,y.default)(X);var he=U.renderer,be=new he(U.element,D,X);be.render(),U.afterRender&&U.afterRender()}return typeof window<"u"&&(window.JsBarcode=re),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(U,D){var X=[];return jQuery(this).each(function(){X.push(this)}),re(X,U,D)}),ad=re,ad}var rN=nN();const sN=Qw(rN),iN={[$e.EXECUTED]:"Executed",[$e.MATCHED_LIST]:"Matched list",[$e.CONFIRM_REQUIRED]:"Awaiting confirmation",[$e.NO_MATCH_FALLBACK]:"No match",[$e.UNCONFIGURED]:"Not configured",[$e.INVALID_CODE]:"Invalid code",[$e.FORBIDDEN]:"Not permitted",[$e.CONFLICT]:"Conflict",[$e.IDENTITY_PRIMED]:"Identity primed",[$e.IDENTITY_UNKNOWN]:"Badge not recognized",[$e.NOT_PRIMED]:"Badge required",[$e.CHOICES]:"Choices presented"},aN={[$e.EXECUTED]:"text-status-success",[$e.MATCHED_LIST]:"text-status-success",[$e.CONFIRM_REQUIRED]:"text-status-warning",[$e.NO_MATCH_FALLBACK]:"text-text-secondary",[$e.UNCONFIGURED]:"text-status-warning",[$e.INVALID_CODE]:"text-status-error",[$e.FORBIDDEN]:"text-status-error",[$e.CONFLICT]:"text-status-warning",[$e.IDENTITY_PRIMED]:"text-status-success",[$e.IDENTITY_UNKNOWN]:"text-status-warning",[$e.NOT_PRIMED]:"text-status-warning",[$e.CHOICES]:"text-status-success"};function oN(n){return n.outcome===$e.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${iN[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function jb(n){var t,s,i;return n.outcome===$e.NO_MATCH_FALLBACK?((t=n.fallback)==null?void 0:t.markdown)??null:n.outcome===$e.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===$e.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:null}function ys(n){return n.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function lN({content:n,compact:t}){const s=[],i=/^```(\w*)\n([\s\S]*?)^```$/gm;let o=0,c;for(;(c=i.exec(n))!==null;)c.index>o&&s.push({type:"text",text:n.slice(o,c.index)}),s.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),o=c.index+c[0].length;o<n.length&&s.push({type:"text",text:n.slice(o)});const d=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},y=[];for(const g of s){if(g.type==="code"){const f=g.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");y.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}y.push(...cN(g.text,d))}return h.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:y.join(`
|
|
55
|
+
`)}})}function cN(n,t){const s=n.split(`
|
|
56
|
+
`),i=[];let o=!1,c=!1,d=[];for(const y of s){const g=y.trim();if(g.startsWith("|")&&g.endsWith("|")){const f=g.slice(1,-1).split("|").map(m=>m.trim());if(f.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(f);continue}if(c){c=!1;const[f,...m]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ys(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of m){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${ys(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),d=[]}if(!g){o&&(i.push("</ul>"),o=!1);continue}if(g.startsWith("### ")){o&&(i.push("</ul>"),o=!1),i.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ys(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ys(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){o&&(i.push("</ul>"),o=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){o||(i.push('<ul class="space-y-1 my-1">'),o=!0),i.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ys(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${t.text} text-text-secondary my-1">${ys(g)}</p>`)}if(c&&d.length){const[y,...g]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of y)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ys(f)}</th>`);i.push("</tr></thead><tbody>");for(const f of g){i.push("<tr>");for(const m of f)i.push(`<td class="py-1 px-2 border-b border-border/50">${ys(m)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Mm({result:n,compact:t=!1}){const{response:s}=n,i=t?"text-xs":"text-sm";return h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:`${i} font-mono text-text-secondary truncate`,children:n.code}),s?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${i} font-medium ${aN[s.outcome]}`,children:oN(s)}),s.error&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:s.error}),jb(s)&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(lN,{content:jb(s),compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function Sv(n){return n.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function uN(n){const t=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&t.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function fN({value:n}){const t=O.useRef(null),[s,i]=O.useState(!1);return O.useEffect(()=>{if(!(!t.current||!n))try{sN(t.current,n,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[n]),n?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:uN(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function hN({onClose:n}){const{submitCode:t,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:y,setDiagnosticsOn:g}=Cm(),[f,m]=O.useState(""),[b,x]=O.useState(!1),v=_=>{_.preventDefault();const S=f.trim();S&&(m(""),t(S))};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(No,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:n,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(Xt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:f,onChange:_=>m(Sv(_.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),h.jsx("button",{type:"submit",disabled:i||!f.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),h.jsx(fN,{value:f.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx(Mm,{result:s})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(_=>!_),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:o.maxKeyGapMs,onChange:_=>c({maxKeyGapMs:Number(_.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:y,onChange:_=>g(_.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),y&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[d.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),d.map(_=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${_.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(_.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(_.key)}),_.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",_.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",_.note]})]},_.seq))]}),h.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Ev=/^\{lt:([A-Za-z0-9_]+)\}$/;function D5(n){return`{lt:${n}}`}const Ov="lt:station:link-vars:";function Vd(n){return`${Ov}${n}`}const Yd=new Set;function dN(){for(const n of Yd)n()}let xu,Kc={};function Av(n){let t=null;try{t=localStorage.getItem(Vd(n))}catch{t=null}if(t===xu)return Kc;xu=t;try{const s=t?JSON.parse(t):{};Kc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Kc={}}return Kc}function mN(n,t,s){const i={...Av(n)};s===null||s===""?delete i[t]:i[t]=s;try{Object.keys(i).length===0?localStorage.removeItem(Vd(n)):localStorage.setItem(Vd(n),JSON.stringify(i))}catch{}xu=void 0,dN()}function pN(n){Yd.add(n);const t=s=>{(s.key===null||s.key.startsWith(Ov))&&(xu=void 0,n())};try{window.addEventListener("storage",t)}catch{}return()=>{Yd.delete(n);try{window.removeEventListener("storage",t)}catch{}}}const yN={};function gN(n){return O.useSyncExternalStore(pN,()=>n?Av(n):yN)}function bN(n,t,s){let i;try{i=new URL(n,"http://local")}catch{return n}const o=i.searchParams.get("facets");if(!o)return n;let c;try{const y=JSON.parse(o);if(!y||typeof y!="object"||Array.isArray(y))return n;c=y}catch{return n}let d=!1;for(const[y,g]of Object.entries(c)){if(typeof g!="string")continue;const f=Ev.exec(g);if(!f)continue;const m=t[f[1]]??s[f[1]];typeof m=="string"&&m!==""?c[y]=m:delete c[y],d=!0}return d?(Object.keys(c).length===0?i.searchParams.delete("facets"):i.searchParams.set("facets",JSON.stringify(c)),i.pathname+i.search):n}function q5(n){let t;try{t=new URL(n,"http://local")}catch{return[]}const s=t.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const o=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const d=Ev.exec(c);d&&!o.includes(d[1])&&o.push(d[1])}return o}catch{return[]}}function Rm(){const{user:n,isSuperAdmin:t,hasRoleType:s}=Lt(),i=(n==null?void 0:n.userId)??null,o=t||s("admin"),c=O.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(x=>x.role)),[n]),{data:d}=ku({enabled:o||c.size>0}),y=gN(i),g=O.useMemo(()=>{var _;const x=[],v=new Set;for(const S of(d==null?void 0:d.roles)??[]){if(!o&&!c.has(S.role))continue;const C=(_=S.properties)==null?void 0:_.link_variables;if(Array.isArray(C))for(const L of C){const P=L==null?void 0:L.name;if(typeof P!="string"||P===""||v.has(P))continue;v.add(P);const re=L.label,le=L.default;x.push({name:P,...typeof re=="string"&&re!==""?{label:re}:{},...typeof le=="string"&&le!==""?{default:le}:{},fromRole:S.role})}}return x},[d,c,o]),f=O.useMemo(()=>{const x={};for(const v of g)v.default!==void 0&&(x[v.name]=v.default);return x},[g]),m=O.useCallback(x=>bN(x,y,f),[y,f]),b=O.useCallback((x,v)=>{i&&mN(i,x,v)},[i]);return{declarations:g,values:y,defaults:f,resolveUrl:m,setValue:b}}function xN({open:n,onClose:t,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return O.useEffect(()=>{if(!n)return;const d=y=>{y.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,t]),n?Qd.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:c?t:void 0}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${o??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:t,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function vN({open:n,onClose:t}){const{declarations:s,values:i,setValue:o}=Rm();return h.jsxs(xN,{open:n,onClose:t,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,d)=>h.jsx(_N,{declaration:c,value:i[c.name]??"",autoFocus:d===0,onChange:y=>o(c.name,y),onClear:()=>o(c.name,null),onEnter:t},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function _N({declaration:n,value:t,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const d=O.useId(),{data:y}=SA(n.name),g=(y==null?void 0:y.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:n.name,children:n.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${n.fromRole}`,children:n.label??n.fromRole})]}),h.jsx("input",{type:"text",list:d,autoFocus:s,value:t,onChange:f=>i(f.target.value),onKeyDown:f=>{f.key==="Enter"&&c()},placeholder:n.default?`${n.default} (default)`:"no filter","aria-label":`Value for ${n.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:d,children:g.map(f=>h.jsx("option",{value:f},f))}),h.jsx("button",{onClick:o,disabled:t==="",title:`Clear ${n.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const kb=["escalationId","workflowId"],wN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,jv="lt:search:mode",SN="lt:search:facet",Mt={FACET:"facet",COMMAND:"command"};function EN(n,t){return{version:n.version,category:t.category,name:t.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length}}function ko(n){return n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function ON(n,t){if(n.encoding==="delimited")return AN(n,t)?{code:t}:{code:`${ko(n)}${t}`};if(!/^[0-9]+$/.test(t))return{error:`${n.name} takes digits only`};const s=n.targetLength;return s&&t.length!==s&&t.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${ko(n)}${t}`}}function AN(n,t){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(t)}function jN(n,t){return n==="escalationId"||n==="workflowId"?null:mk(n,t)}function kN(n){return n.kind===Mt.FACET?n.facet:n.command.name}function NN(n){return n.kind===Mt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function TN(n){return n.kind===Mt.FACET?{kind:Mt.FACET,facet:n.facet}:{kind:Mt.COMMAND,version:n.command.version,category:n.command.category}}function CN(n,t,s){if((n==null?void 0:n.kind)===Mt.FACET&&t.includes(n.facet))return{kind:Mt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Mt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Mt.COMMAND,command:i}}return t.length>0?{kind:Mt.FACET,facet:t[0]}:s.length>0?{kind:Mt.COMMAND,command:s[0]}:null}function MN(){try{const n=localStorage.getItem(jv);if(n){const s=JSON.parse(n);if(s.kind===Mt.FACET&&typeof s.facet=="string"||s.kind===Mt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const t=localStorage.getItem(SN);return t?{kind:Mt.FACET,facet:t}:null}catch{return null}}function RN(n){try{localStorage.setItem(jv,JSON.stringify(n))}catch{}}const Nb=5*6e4,DN=n=>({rules:n.map(t=>{var s;return((s=t.data)==null?void 0:s.rules)??null}),loading:n.some(t=>t.isLoading)});function qN(n){const t=hk({enabled:n,staleTime:Nb}),s=O.useMemo(()=>{var d;return(((d=t.data)==null?void 0:d.schemes)??[]).filter(y=>y.enabled&&y.kind===uk.ACTION).sort((y,g)=>y.version-g.version)},[t.data]),{rules:i,loading:o}=Xw({queries:s.map(d=>({queryKey:["scan-schemes",d.version,"actions"],queryFn:()=>fe(`/scan-codes/schemes/${d.version}/actions`),enabled:n,staleTime:Nb})),combine:DN});return{commands:O.useMemo(()=>s.flatMap((d,y)=>(i[y]??[]).filter(g=>g.enabled).sort((g,f)=>g.category.localeCompare(f.category)).map(g=>EN(d,g))),[s,i]),loading:t.isLoading||o}}const LN={escalationId:"opens the item",workflowId:"opens the run"};function BN({mode:n,facets:t,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,d]=O.useState(!1),y=O.useRef(null);O.useEffect(()=>{if(!c)return;const x=_=>{y.current&&!y.current.contains(_.target)&&d(!1)},v=_=>{_.key==="Escape"&&d(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v)}},[c]);const g=n.kind===Mt.COMMAND,f=g?`${n.command.schemeName} · ${n.command.name} — ${ko(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,m=PN(s),b=x=>{i(x),d(!1)};return h.jsxs("div",{ref:y,className:"relative h-full shrink-0",children:[h.jsxs("button",{type:"button",onClick:()=>d(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":"Search or run as",title:f,className:"group flex items-center gap-1 h-full pl-2.5 pr-2 border-l border-surface-field-border hover:bg-surface-hover transition-colors rounded-r-[var(--lt-radius-field)]","data-testid":"search-mode",children:[h.jsx("span",{className:`text-2xs whitespace-nowrap truncate max-w-[9rem] ${g?"font-medium text-accent":"font-mono text-text-tertiary"}`,children:kN(n)}),h.jsx(Xd,{className:`w-3 h-3 shrink-0 text-text-quaternary group-hover:text-accent transition-transform ${c?"rotate-180":""}`,strokeWidth:1.5})]}),c&&h.jsxs("div",{role:"listbox","aria-label":"Search or run as",className:"absolute z-50 top-full right-0 mt-1.5 min-w-[17rem] max-w-[24rem] max-h-[70vh] overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[t.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(Tb,{children:"Find"}),t.map(x=>h.jsx(Cb,{label:x,mono:!0,note:LN[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Mt.FACET,facet:x})},x))]}),m.map(({schemeName:x,targetFacet:v,items:_})=>h.jsxs("div",{children:[h.jsxs(Tb,{note:v,children:["Run · ",x]}),_.map(S=>h.jsx(Cb,{label:S.name,note:ko(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Mt.COMMAND,command:S})},`${S.version}:${S.category}`))]},x)),o&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/60 my-1"}),h.jsxs("button",{type:"button",onClick:()=>{d(!1),o()},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-accent hover:bg-surface-hover","data-testid":"search-mode-scan-panel",children:[h.jsx(No,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function PN(n){const t=[];for(const s of n){const i=t.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):t.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return t}function Tb({children:n,note:t}){return h.jsxs("p",{className:"px-3 pt-2 pb-1 flex items-baseline gap-2 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:[h.jsx("span",{className:"truncate",children:n}),t&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:t})]})}function Cb({label:n,note:t,active:s,mono:i,noteMono:o,onClick:c}){return h.jsxs("button",{type:"button",role:"option","aria-selected":s,onClick:c,className:`w-full text-left pl-3 pr-3 py-1.5 flex items-baseline gap-3 border-l-2 transition-colors ${s?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[h.jsx("span",{className:`text-xs font-medium truncate ${i?"font-mono":""}`,children:n}),h.jsx("span",{className:`ml-auto text-2xs shrink-0 ${o?"font-mono tabular-nums":""} ${s?"text-accent/70":"text-text-quaternary"}`,children:t})]})}const UN=6e3;function zN({onOpenScanPanel:n}){const t=ra(),{data:s}=Wn(),i=Tm(),{submitCode:o,busy:c,lastResult:d}=Cm(),{commands:y}=qN(i),[g,f]=O.useState(""),[m,b]=O.useState(!1),[x,v]=O.useState(null),[_,S]=O.useState(null),[C,L]=O.useState(""),[P,re]=O.useState(null),[le,R]=O.useState(MN),$=O.useRef(null),ee=O.useMemo(()=>{var oe;if(!((oe=s==null?void 0:s.search)!=null&&oe.enabled))return[];const Z=(s.search.facets??[]).filter(_e=>!kb.includes(_e));return[...kb,...Z]},[s]),K=O.useMemo(()=>CN(le,ee,y),[le,ee,y]),U=(d==null?void 0:d.source)===jo.TOOLBAR&&!d.navigated&&P!==d.at?d:null;O.useEffect(()=>{if(!U)return;const Z=setTimeout(()=>re(U.at),UN);return()=>clearTimeout(Z)},[U]);const D=()=>{v(null),S(null),d&&re(d.at)},X=Z=>{var _e;const oe=TN(Z);R(oe),RN(oe),D(),(_e=$.current)==null||_e.focus()},J=(Z,oe)=>{const _e=ON(Z.command,Sv(oe));if("error"in _e){v(_e.error);return}f(""),o(_e.code,jo.TOOLBAR)},he=async(Z,oe)=>{const _e=jN(Z,oe);if(_e){f(""),t(_e);return}if(Z==="escalationId"&&!wN.test(oe)){v("That is not a valid escalation id");return}b(!0);try{if(Z==="escalationId")await fe(`/escalations/${encodeURIComponent(oe)}`),f(""),t(`/escalations/detail/${encodeURIComponent(oe)}`);else{const Se=await fe(`/escalations/by-workflow/${encodeURIComponent(oe)}`),Ne=(Se==null?void 0:Se.escalations)??[];Ne.length===1?(f(""),t(`/escalations/detail/${Ne[0].id}`)):(L(oe),S(Ne))}}catch{v(`No ${Z==="escalationId"?"escalation":"workflow"} found for "${oe}"`)}finally{b(!1)}},be=()=>{const Z=g.trim();!Z||m||c||!K||(D(),K.kind===Mt.COMMAND?J(K,Z):he(K.facet,Z))};if(!K)return null;const je=K.kind===Mt.COMMAND,H=m||c;return h.jsxs("div",{className:"relative w-full max-w-[28rem]","data-testid":"global-search",children:[h.jsxs("div",{className:"flex items-center h-8 bg-surface-field border border-surface-field-border rounded-[var(--lt-radius-field)] focus-within:border-accent focus-within:bg-surface-field-focus transition-colors",children:[h.jsxs("label",{htmlFor:"global-search-input",className:"flex items-center gap-1.5 pl-2.5 shrink-0 cursor-text",children:[je?h.jsx(No,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(aS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),je&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:ko(K.command)})]}),h.jsx("input",{ref:$,id:"global-search-input",type:"text",value:g,onChange:Z=>{f(Z.target.value),D()},onKeyDown:Z=>{Z.key==="Enter"&&be(),Z.key==="Escape"&&(f(""),D())},placeholder:NN(K),"aria-label":je?"Run target":"Global search",autoComplete:"off",spellCheck:!1,className:`flex-1 min-w-0 h-full bg-transparent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none ${je?"pl-0.5 pr-2 font-mono":"px-2"}`}),H&&h.jsx("span",{className:"w-1.5 h-1.5 mr-2 rounded-full bg-accent animate-pulse shrink-0","aria-label":"Working"}),h.jsx(BN,{mode:K,facets:ee,commands:y,onSelect:X,onOpenScanPanel:n})]}),x&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:x}),U&&h.jsx("div",{role:"status",className:"absolute top-full left-0 mt-1.5 z-50 w-full max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg px-3 py-2 animate-fade-in","data-testid":"search-run-outcome",children:h.jsx(Mm,{result:U,compact:!0})}),_!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[_.map(Z=>h.jsxs(Cr,{to:`/escalations/detail/${Z.id}`,onClick:()=>{S(null),f("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:Z.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),Z.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:Z.type})]},Z.id)),_.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(Cr,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),f("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function IN(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Kd(n){var t;return((t=n.title)==null?void 0:t.trim())||IN(n.role)}const kv="lt:bookmarks",Jc="scan";function $N(){try{const n=localStorage.getItem(kv);if(!n)return[];const t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}function Mb(n){try{localStorage.setItem(kv,JSON.stringify(n))}catch{}}function HN({onToggleEventFeed:n,onToggleDocs:t,onToggleNav:s}){var Je,jn,lr;const i=ra(),{user:o,logout:c,isSuperAdmin:d,hasRoleType:y}=Lt(),{viewAs:g,realIsBuilder:f}=zx(),{available:m,mine:b}=jA();Ix();const{connected:x}=wx(),{data:v}=Wn(),{role:_,targets:S,selectable:C,selectRole:L}=Gx(),{declarations:P,values:re}=Rm(),[le,R]=O.useState(!1),{data:$}=ku(),ee=O.useMemo(()=>{const ve=($==null?void 0:$.roles)??[],Fe=new Set(((o==null?void 0:o.roles)??[]).map(lt=>lt.role)),St=d||y("admin");return ve.filter(lt=>Wi(lt).length>0&&(St||Fe.has(lt.role))).map(lt=>({role:lt.role,title:Kd(lt),portals:Wi(lt)}))},[$,o,d,y]),{setPanel:K,closePanel:U,open:D,ownerKey:X}=Em(),J=Tm(),he=On(),be=()=>{D&&X===Jc?U(Jc):K(h.jsx(hN,{onClose:()=>U(Jc)}),{width:360,key:Jc})},[je,H]=O.useState(!1),[Z,oe]=O.useState(!1),[_e,Se]=O.useState(lv),[Ne,ke]=O.useState($N),Te=O.useRef(null),st=(Je=v==null?void 0:v.branding)==null?void 0:Je.appName,Nt=(jn=v==null?void 0:v.branding)==null?void 0:jn.themes,Bt=O.useMemo(()=>(Wj(Nt??[]),Zj()),[Nt]),gt=ve=>{ek(ve),Se(ve)},bt=()=>{const ve=window.prompt("Bookmark label:");if(!(ve!=null&&ve.trim()))return;const Fe=he.pathname+he.search,St=[...Ne,{label:ve.trim(),url:Fe}].sort((lt,Pr)=>lt.label.localeCompare(Pr.label));ke(St),Mb(St),H(!1)},ue=ve=>{const Fe=Ne.filter(St=>!(St.label===ve.label&&St.url===ve.url));ke(Fe),Mb(Fe)};return O.useEffect(()=>{if(!je)return;const ve=Fe=>{Te.current&&!Te.current.contains(Fe.target)&&H(!1)};return document.addEventListener("mousedown",ve),()=>document.removeEventListener("mousedown",ve)},[je]),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 ${je?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(oS,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(Cr,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:ve=>{(ve.ctrlKey||ve.metaKey)&&(ve.preventDefault(),oe(!0))},children:h.jsx(jm,{appName:st,className:"flex"})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(Kb,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(ud,{className:"w-5 h-5",strokeWidth:2})})]}),(((lr=v==null?void 0:v.search)==null?void 0:lr.enabled)||J)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(zN,{onOpenScanPanel:J?be:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsxs(Cr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${m>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(fd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),m>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:m})]}),h.jsxs(Cr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${b>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(fd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),b>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:b})]}),g&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Pd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Xt,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:Te,children:[h.jsxs("button",{onClick:()=>H(ve=>!ve),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(lS,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block 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"})})]}),je&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(Cr,{to:"/credentials",onClick:()=>H(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),J&&h.jsx("button",{onClick:()=>{H(!1),be()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{H(!1),x?n==null||n():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:x?"Events":"Reconnect events"}),f&&h.jsx("button",{onClick:()=>{H(!1),t==null||t()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{H(!1),Pd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Bt.map(ve=>h.jsx("button",{type:"button",onClick:()=>gt(ve.id),title:ve.label,"aria-label":`${ve.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${_e===ve.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:ve.swatch}},ve.id))})]}),C&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{H(!1),L(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${_?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${_?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),S.map(ve=>{var lt;const Fe=(lt=$==null?void 0:$.roles)==null?void 0:lt.find(Pr=>Pr.role===ve),St=ve===_;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),L(ve),i(Fx(ve,Wi(Fe)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${St?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${St?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Kd({role:ve,title:Fe==null?void 0:Fe.title})})]},ve)})]})]}),ee.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60","data-testid":"menu-portals",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Portals"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:ee.map(ve=>h.jsxs("div",{children:[ee.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:ve.role,children:ve.title}),ve.portals.map(Fe=>{const St=vm(ve.role,Fe.key),lt=he.pathname===St;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),i(St)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${lt?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${ve.role}-${Fe.key}`,children:[h.jsx(hd,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:Fe.label})]},Fe.key)})]},ve.role))})]}),P.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{H(!1),R(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(re).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(re).length>0?Object.entries(re).map(([ve,Fe])=>`${ve} = ${Fe}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{H(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[Ne.map(ve=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Cr,{to:ve.url,onClick:()=>H(!1),title:ve.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:ve.label}),h.jsx("button",{type:"button",onClick:()=>ue(ve),title:`Remove "${ve.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(Xt,{className:"w-3 h-3"})})]},`${ve.label}::${ve.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:bt,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(cS,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),Z&&h.jsx(Xj,{onClose:()=>oe(!1)}),h.jsx(vN,{open:le,onClose:()=>R(!1)})]})}function Dm({open:n,children:t}){const[s,i]=O.useState(n);return O.useEffect(()=>{n&&i(!0)},[n]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${n?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{n||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function Jd(n){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return n?`${s} justify-center w-10 h-10 mx-auto ${t?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${t?i:o}`}}function FN(){return({isActive:n})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${n?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function GN({group:n,collapsed:t}){const{pathname:s}=On(),i=n.matchPaths.some(y=>s.startsWith(y)),[o,c]=O.useState(i),d=o||i;return t?h.jsx(h.Fragment,{children:n.items.map(y=>h.jsx(Ss,{to:y.to,className:Jd(!0),title:y.label,children:y.icon&&h.jsx(y.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},y.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(y=>!y),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[h.jsxs("span",{className:"flex items-center gap-3",children:[n.icon&&h.jsx(n.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:n.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(Dm,{open:d,children:n.items.map(y=>h.jsxs(Ss,{to:y.to,end:y.end,className:FN(),children:[y.icon&&h.jsx(y.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:y.label})]},y.to))})]})}function VN(n){return n.kind==="group"}function YN({entry:n,collapsed:t}){const{pathname:s,search:i}=On(),o=n.to.includes("?"),c=n.icon&&h.jsx(n.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${n.iconClassName??""}`,strokeWidth:1.5,...n.solid?{fill:"currentColor"}:{}});if(o){const[d,y]=n.to.split("?"),g=s===d&&i===`?${y}`,f=Jd(t)({isActive:g});return h.jsxs(Ss,{to:n.to,className:f,title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}return h.jsxs(Ss,{to:n.to,end:n.end,className:Jd(t),title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}function Dr({heading:n,entries:t}){const{collapsed:s}=wm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:n}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:n}),t.map(i=>VN(i)?h.jsx(GN,{group:i,collapsed:s},i.label):h.jsx(YN,{entry:i,collapsed:s},i.to))]})}function KN({aiEnabled:n=!1,isBuilder:t=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1}){const c=[{to:"/pace",label:"Pace Board",icon:uS},{to:"/trends",label:"Trend Board",icon:fS}];if(!t&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(Dr,{heading:"Monitor",entries:c}):null;if(!t)return h.jsx(Dr,{heading:"Monitor",entries:o?c:[]});const d=[...o?c:[],{to:"/topics",label:"Event Topics",icon:Jb},{to:"/agents",label:n?"Agents":"Automations",icon:hS},{to:"/capabilities",label:"Capabilities",icon:dS}];return h.jsx(Dr,{heading:"Monitor",entries:d})}function JN(){return Pe({queryKey:["me","preferences"],queryFn:()=>fe("/me/preferences"),staleTime:6e4})}function QN(){const n=Ue();return He({mutationFn:t=>fe("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{n.setQueryData(["me","preferences"],t)}})}const bs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},Rb={COMPACT:"compact",CARDS:"cards"},od={AVAILABLE:"/escalations/available",ALL:"/escalations"},Zi={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},XN={[Zi.RESOLVED]:"resolved",[Zi.CANCELLED]:"cancelled",[Zi.EXPIRED]:"expired"};function WN(n){const t=n===Zi.CLAIMED;return{available:n===Zi.AVAILABLE,claimed:t,apiStatus:t?"pending":XN[n]}}function ZN(n){return n===bs.TABLE||n===bs.RICH||n===bs.TIMELINE}function eT(n){return n===Rb.COMPACT||n===Rb.CARDS}function tT(n,t=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||t,role:n.get("role")||void 0,type:n.get("type")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:dk(n),view:ZN(i)?i:null,layout:eT(o)?o:null}}function nT(n){let t;try{t=new URL(n,"http://local")}catch{return null}if(t.pathname!==od.AVAILABLE&&t.pathname!==od.ALL)return null;const s=t.pathname===od.AVAILABLE?Zi.AVAILABLE:"";return tT(t.searchParams,s)}function L5(n){var t;return n.role||(((t=n.facets.roles)==null?void 0:t.length)===1?n.facets.roles[0]:null)}function B5(n,t){return n===bs.TIMELINE?bs.TIMELINE:t&&(!n||n===bs.RICH)?bs.RICH:bs.TABLE}function rT(n,t){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(y=>y.label)),c=[...s],d=new Set;for(const{role:y,pins:g}of t)for(const f of g)o.has(f.label)||i.has(f.label)||d.has(f.label)||(d.add(f.label),c.push({...f,id:`role:${y}:${f.label}`,fromRole:y}));return c}function sT(n){const t=nT(n);if(!t)return null;const{available:s,claimed:i,apiStatus:o}=WN(t.statusFilter);return{available:s,params:{...t.facets,role:t.role,type:t.type,priority:t.priority,status:o,...i?{claimed:!0}:{},search:t.search}}}function iT(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function aT(){var U;const{collapsed:n}=wm(),{user:t}=Lt(),s=JN(),i=QN(),o=O.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(D=>D.role)),[t]),{data:c}=ku({enabled:o.size>0}),d=sn("SUMMARY");ti(bm(),()=>{d([["escalations"]])});const y=(U=s.data)==null?void 0:U.preferences,g=O.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Array.isArray(D.default_pins)&&D.default_pins.length>0).map(D=>({role:D.role,pins:D.default_pins})),[c,o]),{resolveUrl:f}=Rm(),m=O.useMemo(()=>rT(y,g),[y,g]),b=O.useMemo(()=>new Map(m.map(D=>[D.id,D.url])),[m]),x=O.useMemo(()=>m.map(D=>({...D,url:f(D.url)})),[m,f]),v=O.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,Kd(D)])),[c]),_=O.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=O.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&pA(D)).map(D=>D.role)),[c,o]),C=O.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(X=>X.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?Wi(D):[],pins:x.filter(X=>X.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),L=(y==null?void 0:y.pinnedViews)??[],P=O.useRef(null),re=D=>i.mutate({pinnedViews:D}),le=D=>re(L.filter(X=>X.id!==D)),R=D=>re([...L,{id:iT(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),$=D=>i.mutate({hiddenRolePins:[...(y==null?void 0:y.hiddenRolePins)??[],D]}),ee=(D,X)=>{if(D===X)return;const J=[...L],[he]=J.splice(D,1);J.splice(X,0,he),re(J)};if(x.length===0&&S.size===0)return null;const K="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[n&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!n&&_.length>0&&h.jsx("p",{className:K,children:"Pinned"}),_.map(D=>{const X=L.findIndex(J=>J.id===D.id);return h.jsx(Db,{pin:D,collapsed:n,draggable:X!==-1,onDragStart:()=>{P.current=X},onDropOn:()=>{P.current!==null&&X!==-1&&ee(P.current,X),P.current=null},onRemove:()=>le(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:K,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(X=>h.jsx(oT,{role:D.role,portal:X,collapsed:n},X.key)),D.pins.map(X=>h.jsx(Db,{pin:X,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>R(X),onHide:()=>$(X.label)},X.id))]},D.role))]})}function oT({role:n,portal:t,collapsed:s}){const i=vm(n,t.key),o="flex items-center rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",c=`portal-link-${n}-${t.key}`;return s?h.jsx(Ss,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:t.label,"data-testid":c,children:h.jsx(hd,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(Ss,{to:i,title:t.label,className:({isActive:d})=>`${o} gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] ${d?"bg-surface-hover text-text-primary font-medium":""}`,"data-testid":c,children:[h.jsx(hd,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:t.label})]})}function Db({pin:n,collapsed:t,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:d,onHide:y}){const{pathname:g,search:f}=On(),[m,b=""]=n.url.split("?"),x=g===m&&f===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",_=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(Ss,{to:n.url,className:`${v} ${_} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(_g,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${_} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:o,children:[h.jsxs(Ss,{to:n.url,title:n.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(_g,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...n.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:n.label}),n.badge&&h.jsx(lT,{url:n.url})]}),h.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[d&&h.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(Qb,{className:"w-3 h-3"})}),y&&h.jsx("button",{onClick:y,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(mS,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${n.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Xt,{className:"w-3 h-3"})})]})]})}function lT({url:n}){var d;const t=O.useMemo(()=>sT(n),[n]),s={limit:1,staleTime:15e3},i=Jx({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),o=Kx({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?i:o;return c.isError||((d=c.data)==null?void 0:d.total)===void 0?null:h.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function cT(){var c;const{data:n}=Wn(),t=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=t===!0||t!==!1&&Bx(),i=[{to:"/workflows/registry",label:"Registry",icon:wg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:dd},{to:"/workflows/executions",label:"Executions",icon:Sg}],o=s?[{kind:"group",label:"Procedural",icon:pS,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:Wd,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:wg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:dd},{to:"/mcp/executions",label:"Executions",icon:Sg}]}]:i;return h.jsx(Dr,{heading:"Orchestrate",entries:o})}function P5(){return Pe({queryKey:["activeWorkers"],queryFn:async()=>(await fe("/workflows/workers")).workers})}function U5(){return Pe({queryKey:["discoveredWorkflows"],queryFn:async()=>(await fe("/workflows/discovered")).workflows})}function z5(){return Pe({queryKey:["workflowConfigs"],queryFn:async()=>(await fe("/workflows/config")).workflows})}function Nv(){return Pe({queryKey:["invocableWorkflows"],queryFn:async()=>(await fe("/workflows/invocable")).workflows})}function I5(n){return Object.fromEntries(n.filter(t=>!t.missing).map(t=>[t.as??t.key,t.data]))}function $5(n,t){return Pe({queryKey:["workflows",n,"input-lookups"],queryFn:()=>fe(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&t,staleTime:1/0})}function H5(){return Pe({queryKey:["cronStatus"],queryFn:async()=>(await fe("/workflows/cron/status")).schedules})}function F5(n){return Pe({queryKey:["workflowExecution",n],queryFn:()=>fe(`/workflow-states/${n}/execution`),enabled:!!n})}function G5(n,t){const s=new URLSearchParams;return n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),n.entity&&s.set("entity",n.entity),n.search&&s.set("search",n.search),n.status&&s.set("status",n.status),n.sort_by&&s.set("sort_by",n.sort_by),n.order&&s.set("order",n.order),n.registered&&s.set("registered",n.registered),n.namespace&&s.set("namespace",n.namespace),Pe({queryKey:["jobs",n],queryFn:()=>fe(`/workflow-states/jobs?${s}`),enabled:(t==null?void 0:t.enabled)??!0})}function V5(){const n=Ue();return He({mutationFn:t=>fe(`/workflows/${t}/terminate`,{method:"POST"}),onSuccess:(t,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function Y5(){const n=Ue();return He({mutationFn:({workflow_type:t,...s})=>fe(`/workflows/${encodeURIComponent(t)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function K5(){const n=Ue();return He({mutationFn:t=>fe(`/workflows/${encodeURIComponent(t)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function J5(){const n=Ue();return He({mutationFn:({workflowType:t,data:s,metadata:i,execute_as:o})=>fe(`/workflows/${t}/invoke`,{method:"POST",body:JSON.stringify({data:s,metadata:i,...o?{execute_as:o}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function uT(){const{data:n}=Nv();return n!=null&&n.length?h.jsx(Dr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:dd}]}):null}const fT=[{to:"/mcp/queries",label:"Designer",icon:yS},{to:"/mcp/servers",label:"Servers & Tools",icon:gS}];function hT(){return h.jsx(Dr,{heading:"Design",entries:fT})}const dT=[{to:"/files",label:"Files",icon:bS},{to:"/knowledge",label:"Knowledge Base",icon:Xb}];function mT(){return h.jsx(Dr,{heading:"Storage",entries:dT})}function pT({isBuilder:n=!1,isOps:t=!1}){var d;const{data:s}=Wn(),i=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:xS},...n||t?[{to:"/admin/roles",label:"Roles",icon:fd},{to:"/admin/personas",label:"Personas",icon:vS},{to:"/admin/scan-codes",label:"Scan Codes",icon:No}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:_S},{to:"/admin/streams",label:"Messages",icon:Xb},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:wS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(Dr,{heading:"Identity & Access",entries:o}),n&&Px()&&h.jsx(Dr,{heading:"Infrastructure",entries:c})]})}function Tv({aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(KN,{aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}),h.jsx(aT,{}),!t&&h.jsx(uT,{}),t&&h.jsx(cT,{}),t&&n&&h.jsx(hT,{}),t&&h.jsx(mT,{}),(t||s)&&h.jsx(pT,{isBuilder:t,isOps:s})]})}function yT({open:n,onClose:t,...s}){const i=On();return O.useEffect(()=>{t()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${n?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${n?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${n?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Xt,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(vA,{children:h.jsx(Tv,{...s})})})]})]})}const Cv="lt_event_feed_patterns";function gT(n,t){if(n.startsWith("/topics/")){const d=decodeURIComponent(n.replace("/topics/",""));if(d&&!d.includes("/"))return`lt.events.${d}`}const s=n.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(n.startsWith("/escalations")){const d=new URLSearchParams(t).get("role");return d?`lt.events.system.escalation.${$x(d)}.>`:"lt.events.system.escalation.>"}const i=n.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(n.startsWith("/workflows"))return"lt.events.system.workflow.>";const o=n.match(/^\/agents\/([^/]+)$/);if(o&&o[1]!=="new")return`lt.events.system.agent.${o[1]}.>`;if(n.startsWith("/agents"))return"lt.events.system.agent.>";if(n.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(n.startsWith("/files"))return"lt.events.system.file.>";if(n==="/")return"lt.events.system.>";const c=n.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(n.startsWith("/mcp"),"lt.events.system.>")}function bT(){try{const n=localStorage.getItem(Cv);return n?JSON.parse(n):[]}catch{return[]}}function ld(n){try{localStorage.setItem(Cv,JSON.stringify(n))}catch{}}function xT(){const{pathname:n,search:t}=On(),[s,i]=O.useState(bT),o=O.useMemo(()=>gT(n,t),[n,t]),c=O.useMemo(()=>{const f=new Set([o,...s]);return Array.from(f)},[o,s]),d=O.useCallback(f=>{const m=f.startsWith("lt.events.")?f:`lt.events.${f}`;i(b=>{if(b.includes(m))return b;const x=[...b,m];return ld(x),x})},[]),y=O.useCallback(f=>{i(m=>{const b=m.filter(x=>x!==f);return ld(b),b})},[]),g=O.useCallback(()=>{i([]),ld([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:d,removePattern:y,clearUserPatterns:g}}function vT({children:n,className:t=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:n})}const cd=280,qb="cubic-bezier(0.4, 0, 0.2, 1)",Qc=40;function _T(n){if(!n)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,i=t-Qc*2,o=s-Qc*2,c=n.width/i,d=n.height/o,y=n.left+n.width/2-(Qc+i/2),g=n.top+n.height/2-(Qc+o/2);return`translate(${y}px, ${g}px) scale(${c}, ${d})`}function Mv({open:n,onClose:t,sourceRef:s,children:i}){const[o,c]=O.useState(null),d=O.useRef(null),y=O.useRef(!1);O.useEffect(()=>{var x,v;n&&!y.current?(d.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&y.current&&o==="open"&&(d.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),y.current=n},[n,s,o]),O.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),O.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),O.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&t()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,t]);const g=O.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(O.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),cd+50);return()=>clearTimeout(x)},[o]),!o)return null;const f=o==="entering"||o==="exiting",m=f?_T(d.current):"none",b=f?0:1;return Qd.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${cd}ms ${qb}, opacity ${cd}ms ${qb}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function wT({className:n}){return h.jsx("svg",{className:n,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 ST({className:n}){return h.jsx("svg",{className:n,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 ET({className:n}){return h.jsx("svg",{className:n,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 OT({className:n}){return h.jsx("svg",{className:n,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 AT({className:n}){return h.jsx("svg",{className:n,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 jT({className:n}){return h.jsx("svg",{className:n,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 kT(n){const t=n.trim().split(`
|
|
57
|
+
`);if(t.length<2)return n;const s=y=>y.split("|").map(g=>g.trim()).filter(Boolean),i=s(t[0]),o=t.slice(2),c=i.map(y=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${y}</th>`).join(""),d=o.map(y=>`<tr class="border-t border-surface-border">${s(y).map(m=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${m}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${d}</tbody></table>`}function Xc(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function NT(n){const t=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,f,m)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${m}</code></pre>`),`\0CODE${b}\0`});const i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,f,m,b)=>kT(`${f}
|
|
58
|
+
${m}
|
|
59
|
+
${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,f)=>`<h4 id="${Xc(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(g,f)=>`<h3 id="${Xc(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(g,f)=>`<h2 id="${Xc(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(g,f)=>`<h1 id="${Xc(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const f=g.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${m?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${m?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,f)=>t[parseInt(f,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",y=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const f=g.trim();if(!f)return"";const m=[];let b=f,x;for(;(x=y.exec(b))!==null;){const v=x.index+x[0].length;m.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),y.lastIndex=0}return b&&m.push(b),m.map(v=>{const _=v.trim();return _?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(_)?_:`<p class="${d}">${_}</p>`:""}).join("")}).join(""),s}const TT=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function CT(n){return TT.test(n)}function Mu({content:n,className:t,onClick:s}){const i=O.useMemo(()=>NT(n),[n]);return h.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function vu({data:n,depth:t=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:t>0,[c,d]=O.useState(o),[y,g]=O.useState(s);if(s!==void 0&&s!==y&&(g(s),d(s%2===0&&t>0)),n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',n,'"']});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",n.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:n.map((f,m)=>h.jsxs("div",{children:[h.jsx(vu,{data:f,depth:t+1,generation:s}),m<n.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof n=="object"){const f=Object.entries(n);return f.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?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:f.map(([m,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:m}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(vu,{data:b,depth:t+1,generation:s}),x<f.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(n)})}function _o({data:n,depth:t=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&CT(n)?h.jsx(Mu,{content:n}):h.jsx("span",{className:"text-text-primary",children:n});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:n.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(_o,{data:s,depth:t+1})})]},i))});if(typeof n=="object"){const s=Object.entries(n);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,o])=>{const c=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(_o,{data:o,depth:t+1})}):h.jsx(_o,{data:o,depth:t+1})]},i)})})}return h.jsx("span",{children:String(n)})}function Lb({mode:n,setMode:t,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:d,onClose:y,large:g}){const f=g?"w-5 h-5":"w-3.5 h-3.5",m=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent 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:[n==="json"&&h.jsx("button",{onClick:i,className:m,title:s?"Expand all":"Collapse all",children:s?h.jsx(jT,{className:f}):h.jsx(AT,{className:f})}),h.jsx("button",{onClick:()=>t(n==="json"?"tree":"json"),className:m,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(wT,{className:f}):h.jsx(ST,{className:f})}),h.jsx("button",{onClick:o,className:m,title:"Copy to clipboard",children:c?h.jsx(OT,{className:`${f} text-status-success`}):h.jsx(ET,{className:f})}),d&&h.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:h.jsx(Wb,{className:f})}),y&&h.jsx("button",{onClick:y,className:m,title:"Close (Esc)",children:h.jsx(Zb,{className:f})})]})}function MT({data:n,label:t,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=O.useRef(null),[d,y]=O.useState(o??"json"),[g,f]=O.useState(!1),[m,b]=O.useState(!1),[x,v]=O.useState(i?0:1),[_,S]=O.useState(1),C=x%2===0,L=_%2===0,P=O.useCallback(()=>v(D=>D+1),[]),re=O.useCallback(()=>S(D=>D+1),[]);let le=n;if(typeof n=="string")try{le=JSON.parse(n)}catch{}const R=async()=>{const D=typeof n=="string"?n:JSON.stringify(le,null,2);await navigator.clipboard.writeText(D),f(!0),setTimeout(()=>f(!1),2e3)},$=O.useCallback(()=>{S(1),b(!0)},[]),ee=s==="panel",K=ee?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",U=ee?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:K,children:[t&&h.jsx(vT,{children:t}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(Lb,{mode:d,setMode:y,isCollapsed:C,onToggleCollapse:P,onCopy:R,copied:g,onFullscreen:$})}),h.jsx("div",{className:U,children:d==="json"?h.jsx(vu,{data:le,generation:x}):h.jsx(_o,{data:le})})]}),h.jsxs(Mv,{open:m,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(Lb,{mode:d,setMode:y,isCollapsed:L,onToggleCollapse:re,onCopy:R,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(vu,{data:le,generation:_}):h.jsx(_o,{data:le})})]})]})}const RT=100,Bb=500;let DT=0;const Rv={"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 Dv(n){const t=n.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:n}function Pb({event:n,forceExpanded:t=!1}){var x,v;const[s,i]=O.useState(t),o=Rv[Dv(n.type)]||"text-text-tertiary";O.useEffect(()=>{i(t)},[t]);const c=t,d=c?"text-xs":"text-2xs",y=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",m=c?"py-2 px-4":"py-1 px-3",b=c?"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:()=>i(!s),className:`flex items-center gap-2 ${m} 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(n.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${y} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:n.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=n.data)!=null&&x.workflowId?String(n.data.workflowId):"",(v=n.data)!=null&&v.escalationId?` esc:${String(n.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Dm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(MT,{data:n.data})})})]})}function qT({open:n,onToggle:t,configOpen:s,onToggleConfig:i}){const[o,c]=O.useState([]),[d,y]=O.useState(!1),[g,f]=O.useState(""),m=O.useRef(null),b=O.useRef(new Map),{subscribe:x}=O.useContext(ia),{connected:v}=wx(),{patterns:_,pagePattern:S,userPatterns:C,addPattern:L,removePattern:P}=xT(),re=O.useCallback($=>{const ee=String($.type||"unknown");if(ee.startsWith("mesh."))return;const K=`${ee}:${$.timestamp||""}:${$.escalationId||$.workflowId||$.taskId||""}`,U=Date.now(),D=b.current.get(K);if(!(D&&U-D<Bb)){if(b.current.set(K,U),b.current.size>200)for(const[X,J]of b.current)U-J>Bb*2&&b.current.delete(X);c(X=>[{id:++DT,type:ee,timestamp:$.timestamp||new Date().toISOString(),data:$},...X].slice(0,RT))}},[]),le=O.useRef(re);le.current=re;const R=n||d||s;return O.useEffect(()=>{if(!R)return;const $=_.map(ee=>x(ee,K=>le.current(K)));return()=>$.forEach(ee=>ee())},[x,_.join(","),R]),O.useEffect(()=>{n&&m.current&&(m.current.scrollTop=0)},[o.length,n]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[n?h.jsx(Xd,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(ex,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!n&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Rv[Dv(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 ${v?"text-status-success":"text-status-warning hover:text-text-primary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:$=>{$.stopPropagation(),v||window.location.reload()},children:h.jsx(Jb,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:$=>{$.stopPropagation(),i()},children:h.jsx(SS,{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:$=>{$.stopPropagation(),y(!0)},children:h.jsx(Wb,{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:$=>{$.stopPropagation(),c([])},children:h.jsx(ES,{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-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map($=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[$.replace("lt.events.",""),h.jsx("button",{onClick:()=>P($),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Xt,{className:"w-2 h-2"})})]},$))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:$=>f($.target.value),onKeyDown:$=>{$.key==="Enter"&&g.trim()&&(L(g.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(L(g.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(Qb,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Dm,{open:n,children:h.jsx("div",{ref:m,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map($=>h.jsx(Pb,{event:$},$.id))})}),h.jsxs(Mv,{open:d,onClose:()=>y(!1),sourceRef:m,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>y(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:h.jsx(Zb,{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($=>h.jsx(Pb,{event:$,forceExpanded:!0},$.id))]})]})}function LT(){return Pe({queryKey:["docs"],queryFn:()=>fe("/docs"),staleTime:5*6e4})}function BT(n){return Pe({queryKey:["docs",n],queryFn:()=>fe(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function PT(){const[n,t]=O.useState([]),[s,i]=O.useState([]),[o,c]=O.useState(null),d=O.useRef(o),y=O.useRef(n),g=O.useRef(s);d.current=o,y.current=n,g.current=s;const f=O.useCallback((_,S)=>{var L;const C=d.current;if(C){const P=((L=S==null?void 0:S.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...C,scrollTop:P}])}i([]),c({path:_,scrollTop:0})},[]),m=O.useCallback(_=>{var P;const S=y.current;if(S.length===0)return;const C=S[S.length-1],L=d.current;if(L){const re=((P=_==null?void 0:_.current)==null?void 0:P.scrollTop)??0;i([...g.current,{...L,scrollTop:re}])}t(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),b=O.useCallback(_=>{var P;const S=g.current;if(S.length===0)return;const C=S[S.length-1],L=d.current;if(L){const re=((P=_==null?void 0:_.current)==null?void 0:P.scrollTop)??0;t([...y.current,{...L,scrollTop:re}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),x=O.useCallback(_=>{var L,P;const S=d.current;if(!S)return;const C=((L=_==null?void 0:_.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((P=_==null?void 0:_.current)==null?void 0:P.scrollTop)??0})},[]),v=O.useCallback(()=>{t([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:f,goBack:m,goForward:b,pushScrollPosition:x,reset:v}}function UT(n,t){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((t?t.replace(/[^/]+$/,""):"")+o).split("/"),y=[];for(const g of d)g===".."?y.pop():g&&g!=="."&&y.push(g);o=y.join("/")}return{path:o,anchor:i}}function zT(n){if(!n.startsWith("#docs"))return null;const t=n.slice(1).split(":"),s=t[1]||"README.md",i=t[2]||void 0;return{path:s,anchor:i}}function IT(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function $T({content:n,currentPath:t,onNavigate:s,onAnchorClick:i}){const o=c=>{var f;const d=c.target,y=d.closest("[data-anchor]");if(y){c.preventDefault(),i();const m=y.dataset.anchor,b=(f=y.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(m)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){c.preventDefault();const{path:m,anchor:b}=UT(g.dataset.docLink,t);s(m,b);return}};return h.jsx(Mu,{content:n,className:"docs-content",onClick:o})}function HT(n){const t=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){t.push(i);continue}let c=s;for(let d=0;d<o.length-1;d++){const y=o[d];c.has(y)||c.set(y,{label:y,children:[],subdirs:new Map});const g=c.get(y);d===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:t,dirs:s}}function FT({docs:n,selected:t,onSelect:s}){const{topLevel:i,dirs:o}=HT(n),c=y=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===y?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(y,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(OS,{className:"w-3 h-3",strokeWidth:1.5}),y.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...y.subdirs.values()].map(f=>d(f)),y.children.map(f=>h.jsx("button",{className:c(f.path),onClick:()=>s(f.path),children:f.title},f.path))]})]},y.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(y=>h.jsx("button",{className:c(y.path),onClick:()=>s(y.path),children:y.title},y.path)),[...o.values()].map(y=>d(y))]})}function GT({open:n,onClose:t}){var ee,K,U;const[s,i]=O.useState(!1),{data:o}=LT(),c=PT(),{data:d,isLoading:y}=BT(((ee=c.current)==null?void 0:ee.path)??null),g=O.useRef(null),[f,m]=O.useState(null);O.useEffect(()=>{f&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var X;const D=(X=g.current)==null?void 0:X.querySelector(`#${CSS.escape(f)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[f,d]);const b=O.useCallback(()=>{var J;const D=zT(window.location.hash),X=(D==null?void 0:D.path)??"README.md";((J=c.current)==null?void 0:J.path)!==X&&c.navigate(X,g),D!=null&&D.anchor&&m(D.anchor)},[c]),x=O.useRef(!0);O.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=IT(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,(K=c.current)==null?void 0:K.path]),O.useEffect(()=>{if(!n)return;const D=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[n,b]);const v=O.useCallback((D,X)=>{X&&m(X),c.navigate(D,g)},[c]),_=O.useCallback(D=>{c.navigate(D,g)},[c]),S=O.useCallback(()=>{c.goBack(g)},[c]),C=O.useCallback(()=>{c.goForward(g)},[c]),L=O.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(O.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const re=()=>{i(!1),setTimeout(()=>{t(),c.reset()},200)},le=((U=c.current)==null?void 0:U.path)??null,R=c.backStack.length>0,$=c.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&&n?"opacity-100":"opacity-0"}`,onClick:re}),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&&n?"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:S,disabled:!R,className:`p-0.5 transition-colors ${R?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(Kb,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!$,className:`p-0.5 transition-colors ${$?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(ud,{className:"w-4 h-4"})}),h.jsx(AS,{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:re,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Xt,{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(FT,{docs:o.docs,selected:le,onSelect:_}):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:le?y?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($T,{content:d.content,currentPath:le,onNavigate:v,onAnchorClick:L}):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(ud,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function VT(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const Ub=2e3;function YT(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
60
|
+
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
61
|
+
`)}
|
|
62
|
+
[End prior conversation]
|
|
63
|
+
|
|
64
|
+
`}function KT(n){const t=n.summary,s=n.title;if(t){const i=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?t.slice(0,i).trim():t}return s||(typeof n=="string"?n:"Query completed.")}const qv=O.createContext(null);function JT({children:n}){const t=On(),[s,i]=O.useState(!1),[o,c]=O.useState([]),[d,y]=O.useState(null),[g,f]=O.useState({}),m=O.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??VT(t.pathname)};O.useEffect(()=>()=>{m.current&&clearInterval(m.current)},[]);const x=O.useCallback(()=>i(L=>!L),[]),v=O.useCallback(L=>{f(L)},[]),_=O.useCallback(()=>{c([]),y(null)},[]),S=O.useCallback(async L=>{var K;const P=new Date().toISOString(),re={id:`user-${Date.now()}`,role:"user",content:L,timestamp:P},le={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:P,pending:!0};c(U=>[...U,re,le]);const R={...b};(K=R.entities)!=null&&K.yamlContent&&R.entities.yamlContent.length>Ub&&(R.entities={...R.entities,yamlContent:R.entities.yamlContent.slice(0,Ub)+`
|
|
65
|
+
... (truncated)`});const ee=`${YT(o.concat(re))}${L}`;try{const D=(await fe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ee,tags:R.suggestedTags,context:R,wait:!1,direct:!0})})).workflow_id;y(D),c(X=>X.map(J=>J.id===le.id?{...J,workflowId:D}:J)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var X;try{const J=await fe(`/workflows/${D}/result`),he=(X=J==null?void 0:J.result)==null?void 0:X.data;if(he){m.current&&clearInterval(m.current),m.current=null,y(null);const be=KT(he);let je;try{je=(await fe(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(H=>H.map(Z=>Z.id===le.id?{...Z,content:be,timestamp:new Date().toISOString(),pending:!1,durationMs:je}:Z))}}catch{}},3e3)}catch{c(U=>U.map(D=>D.id===le.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=O.useCallback(async L=>{const P=o.find(R=>R.id===L);if(!(P!=null&&P.workflowId)||P.compilationStatus==="compiling"||P.compilationStatus==="done")return;const re=o.indexOf(P),le=o.slice(0,re).reverse().find(R=>R.role==="user");if(le){c(R=>R.map($=>$.id===L?{...$,compilationStatus:"compiling"}:$));try{const R=await fe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:le.content,summary:P.content})}),$=await fe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:P.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:R.tool_name,description:R.description,tags:R.tags,app_id:""})});await fe(`/yaml-workflows/${$.id}/deploy`,{method:"POST"}),c(ee=>ee.map(K=>K.id===L?{...K,compilationStatus:"done"}:K))}catch(R){const $=R instanceof Error?R.message:"Compilation failed";c(ee=>ee.map(K=>K.id===L?{...K,compilationStatus:"error",compilationError:$}:K))}}},[o]);return h.jsx(qv.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:d,clearMessages:_,compileMessage:C},children:n})}function Lv(){const n=O.useContext(qv);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function QT(){const{helpOpen:n,toggleHelp:t}=Lv();return h.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":n?"Close help":"Ask for help",children:n?h.jsx(Xt,{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(${$t}/logo512.png)`}})})}function XT({ms:n,className:t=""}){const s=$j(n),i=O.useMemo(()=>n==null?[]:[{label:"ms",value:String(n)},{label:"sec",value:`${(n/1e3).toFixed(3)}s`},{label:"text",value:s}],[n,s]);return n==null?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(rv,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const WT=["sm","md","lg","full"],zb={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},Ib={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function ZT({which:n}){const t="stroke-current";switch(n){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:t,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:t,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:t,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:t,strokeWidth:"1.5"})})}}function eC({msg:n}){const[t,s]=O.useState(0);O.useEffect(()=>{const d=new Date(n.timestamp).getTime(),y=()=>s(Math.floor((Date.now()-d)/1e3));y();const g=setInterval(y,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(t/60),o=t%60,c=i>0?`${i}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:c})]}),n.workflowId&&h.jsxs(Cr,{to:`/workflows/executions/${n.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(Wd,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function tC({msg:n,compileMessage:t}){const s=n.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(sv,{date:n.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),n.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(XT,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(Cr,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(Wd,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>t(n.id),disabled:n.compilationStatus==="compiling"||n.compilationStatus==="done",className:"transition-colors",title:n.compilationStatus==="done"?"Compiled — future queries will match this pipeline":n.compilationStatus==="error"?n.compilationError??"Compilation failed":n.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(jS,{className:`w-2.5 h-2.5 ${n.compilationStatus==="done"?"text-status-success":n.compilationStatus==="error"?"text-status-error":n.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function nC(){const{helpOpen:n,setHelpOpen:t,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:d,compileMessage:y}=Lv(),[g,f]=O.useState(""),[m,b]=O.useState("md"),[x,v]=O.useState(!0),_=O.useRef(null),S=O.useRef(null);if(O.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[s]),O.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),O.useEffect(()=>{if(!n)return;const R=$=>{$.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[n,m,t]),!n)return null;const C=()=>{const R=g.trim();!R||c||(i(R),f(""),S.current&&(S.current.style.height="auto"))},L=R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),C())},P=m==="full",re=o.page.replace(/-/g," "),le=P?{}:{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 ${P?zb.full:`right-6 ${zb[m]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:le,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!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 ${x?"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-2xs text-text-tertiary truncate",children:re})]}),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:WT.map(R=>h.jsx("button",{onClick:()=>b(R),className:`p-1 rounded transition-colors ${R===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":R===m,"aria-label":Ib[R],title:Ib[R],children:h.jsx(ZT,{which:R})},R))}),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(kS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Xt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:_,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"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(R=>h.jsxs("div",{className:`text-xs leading-relaxed ${R.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 ${R.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:R.pending?h.jsx(eC,{msg:R}):R.role==="assistant"?h.jsx(Mu,{content:R.content}):R.content}),!R.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(tC,{msg:R,compileMessage:y})})]},R.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:R=>{f(R.target.value);const $=R.target;$.style.height="auto",$.style.height=`${Math.min($.scrollHeight,120)}px`},onKeyDown:L,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),h.jsx("button",{onClick:C,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(NS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const rC=6e3,sC="scan";function iC(){const{lastResult:n}=Cm(),{open:t,ownerKey:s}=Em(),[i,o]=O.useState(null);return O.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),rC);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||t&&s===sC||n.source===jo.TOOLBAR?null:h.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(No,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx(Mm,{result:n})}),h.jsx("button",{type:"button",onClick:()=>o(n.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(Xt,{className:"w-3.5 h-3.5"})})]})})}const Bv="lt-announcement-dismissed:";function aC(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function oC(n){try{return localStorage.getItem(`${Bv}${n}`)==="1"}catch{return!1}}function lC(){const{isAuthenticated:n,userRoleNames:t}=Lt(),{data:s}=Qx(n),i=Ue(),[o,c]=O.useState(null),[d,y]=O.useState(0);wn(NA,()=>{i.invalidateQueries({queryKey:["announcements"]})});const g=Date.now(),f=((s==null?void 0:s.announcements)??[]).filter(b=>!oC(b.id)&&new Date(b.expires_at).getTime()>g&&(b.roles.length===0||b.roles.some(x=>t.includes(x))));if(O.useEffect(()=>{const b=((s==null?void 0:s.announcements)??[]).map(v=>new Date(v.expires_at).getTime()-Date.now()).filter(v=>v>0);if(b.length===0)return;const x=setTimeout(()=>y(v=>v+1),Math.min(...b)+250);return()=>clearTimeout(x)},[s,d]),f.length===0)return null;const m=b=>{try{localStorage.setItem(`${Bv}${b}`,"1")}catch{}y(x=>x+1)};return h.jsx("div",{"data-testid":"announcement-banner",className:"relative z-40",children:f.map(b=>{const x=o===b.id,v=b.title??b.body.split(`
|
|
66
|
+
`)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(x?null:b.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:v}),x?h.jsx(ex,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(Xd,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>m(b.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${v}`,children:h.jsx(Xt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),x&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(Mu,{content:aC(b.body)})})]},b.id)})})}function cC(){var $;const{isBuilder:n,isOps:t,viewAs:s}=zx(),{canSeePaceBoard:i}=Ix();nA();const{data:o}=Wn(),c=Lx(),d=c!==null?c:!!(($=o==null?void 0:o.ai)!=null&&$.enabled),{collapsed:y,toggle:g}=wm(),[f,m]=O.useState(!1),[b,x]=O.useState(!1),[v,_]=O.useState(!1),[S,C]=O.useState(()=>window.location.hash.startsWith("#docs")),L=On(),P=O.useRef(null),{kiosk:re,homePath:le}=Gx(),R=re||mA(L.pathname);return O.useEffect(()=>{const ee=P.current;ee&&(ee.classList.remove("animate-page-in"),ee.offsetWidth,ee.classList.add("animate-page-in"))},[L.pathname]),O.useEffect(()=>{const ee=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",ee),()=>window.removeEventListener("hashchange",ee)},[]),re&&le&&!gA(L.pathname)?h.jsx(xn,{to:le,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(HN,{onToggleEventFeed:()=>m(ee=>!ee),onToggleDocs:()=>C(ee=>!ee),onToggleNav:R?void 0:()=>x(ee=>!ee)}),h.jsx(lC,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!R&&h.jsxs("aside",{className:`${y?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Tv,{aiEnabled:d,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${y?"flex justify-center":"flex items-center px-7"}`,"aria-label":y?"Expand sidebar":"Collapse sidebar",children:y?h.jsx(TS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(CS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!y&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:P,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(Ws,{})})}),h.jsx(uC,{})]}),!R&&h.jsx(yT,{open:b,onClose:()=>x(!1),aiEnabled:d,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i}),h.jsx(qT,{open:f,onToggle:()=>m(ee=>!ee),configOpen:v,onToggleConfig:()=>_(ee=>!ee)}),h.jsx(GT,{open:S,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(QT,{}),d&&h.jsx(nC,{}),h.jsx(iC,{})]})}function uC(){const{node:n,width:t,open:s}=Em();return h.jsx(wA,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:n})}function fC(){const{isAuthenticated:n}=Lt(),t=On();return n?h.jsx(xA,{children:h.jsx(_A,{children:h.jsx(JT,{children:h.jsx(nk,{children:h.jsx(bk,{children:h.jsx(cC,{})})})})})}):h.jsx(xn,{to:"/login",state:{from:t.pathname},replace:!0})}function Pv({provider:n,className:t="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:t,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:t,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:t,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:t,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:t,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 hC(){return fe("/auth/oauth/providers")}async function dC(n,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return fe(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function Q5(){return Pe({queryKey:["oauth-connections"],queryFn:()=>fe("/auth/oauth/connections")})}function X5(){const n=Ue();return He({mutationFn:({provider:t,label:s})=>dC(t,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function mC(){var ee;const{login:n,isAuthenticated:t}=Lt(),s=ra(),i=On(),o=new URLSearchParams(i.search),c=o.get("token"),d=o.get("error"),y=((ee=i.state)==null?void 0:ee.from)??o.get("returnTo")??"/",g=O.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[f,m]=O.useState(""),[b,x]=O.useState(""),[v,_]=O.useState(d||""),[S,C]=O.useState(!1),[L,P]=O.useState(!!c),[re,le]=O.useState([]),R=O.useRef(!1);if(O.useEffect(()=>{c||R.current||(R.current=!0,(async()=>{var K,U,D,X;try{const J=await em().catch(()=>null);if(!((K=J==null?void 0:J.auth)!=null&&K.sso))return;const he=await fetch(`${$t}/api/auth/sso`,{method:"POST"});if(!he.ok){_("Host authentication required — please log in to your organization first");return}const be=await he.json();be.token&&((U=J.auth)!=null&&U.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",J.auth.ssoLogoutUrl),P(!0),n(be.token,void 0,{displayName:(D=be.user)==null?void 0:D.display_name,username:(X=be.user)==null?void 0:X.external_id}))}catch{}})())},[]),O.useEffect(()=>{c||hC().then(le).catch(()=>{})},[]),O.useEffect(()=>{if(!L)return;const K=setTimeout(()=>s(y,{replace:!0}),1500);return()=>clearTimeout(K)},[L]),t&&!L)return h.jsx(xn,{to:y,replace:!0});const $=async K=>{var U,D;if(K.preventDefault(),_(""),!f.trim()||!b){_("Username and password are required");return}C(!0);try{const X=await fetch(`${$t}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),J=await X.json();if(!X.ok){_(J.error||"Login failed");return}P(!0),n(J.token,{username:f.trim(),password:b},{displayName:(U=J.user)==null?void 0:U.display_name,username:(D=J.user)==null?void 0:D.external_id})}catch{_("Unable to connect to server")}finally{C(!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 ${L?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(jm,{size:"lg",hideLabel:L})}),h.jsxs("form",{onSubmit:$,className:`space-y-5 transition-opacity duration-300 ${L?"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:f,onChange:K=>m(K.target.value),className:"input",placeholder:"Enter your username",autoFocus:!L,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:b,onChange:K=>x(K.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||L,children:S?"Signing in...":"Sign In"}),re.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:re.filter(K=>K.provider!=="anthropic").map(K=>h.jsxs("a",{href:`${$t}/api/auth/oauth/${K.provider}?returnTo=${encodeURIComponent(y)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Pv,{provider:K.provider}),"Sign in with ",K.name]},K.provider))})]})]})]})})}function $b(){const{isAuthenticated:n}=Lt(),t=ra(),s=On(),i=new URLSearchParams(s.search),o=i.get("state")||"";O.useEffect(()=>{n||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,d]=O.useState(""),[y,g]=O.useState(i.get("label")||"default"),[f,m]=O.useState(""),[b,x]=O.useState(!1),v=c.trim().startsWith("sk-ant-oat"),_=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const L=c.trim();if(!L){m("A token or API key is required");return}if(!L.startsWith("sk-ant-")){m('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),m("");const P=`${$t}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(L)}&state=${encodeURIComponent(o)}`;window.location.href=P};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(jm,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Pv,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",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:S,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:c,onChange:C=>d(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),_&&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:y,onChange:C=>g(C.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").'})]}),f&&h.jsx("p",{className:"text-sm text-status-error",children:f}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"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-2xs",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 Wc({roleTypes:n,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=Lt();return i?h.jsx(Ws,{}):n&&n.some(d=>c(d))?h.jsx(Ws,{}):t&&t.some(d=>o(d))?h.jsx(Ws,{}):h.jsx(xn,{to:s,replace:!0})}function pC(){const{data:n,isSuccess:t}=Nv();return t&&n.length===0?h.jsx(xn,{to:"/",replace:!0}):h.jsx(Ws,{})}function yC({redirectTo:n="/"}){var i;const{data:t,isLoading:s}=Wn();return s||!t?null:(i=t.ai)!=null&&i.enabled?h.jsx(Ws,{}):h.jsx(xn,{to:n,replace:!0})}function gC({flag:n,redirectTo:t="/"}){var o;const{data:s,isLoading:i}=Wn();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(xn,{to:t,replace:!0}):h.jsx(Ws,{})}const bC=O.lazy(()=>Oe(()=>import("./ProcessesListPage-BaHV2cXp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(n=>({default:n.ProcessesListPage}))),xC=O.lazy(()=>Oe(()=>import("./ProcessDetailPage-BFcFSDUv.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),vC=O.lazy(()=>Oe(()=>import("./McpOverview-qXXhbNWV.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),_C=O.lazy(()=>Oe(()=>import("./McpRunsPage-BfjiJ8mM.js"),__vite__mapDeps([28,1,24,25,3,4,29,26,6,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(n=>({default:n.McpRunsPage}))),wC=O.lazy(()=>Oe(()=>import("./McpRunDetailPage-DjJO5vSb.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,4,36,15,37]),import.meta.url).then(n=>({default:n.McpRunDetailPage}))),SC=O.lazy(()=>Oe(()=>import("./McpQueryPage-Cy0V0kv9.js"),__vite__mapDeps([38,1,14,13,7,8,9,12,11,15,6,10,30,16,31,3,4,39]),import.meta.url).then(n=>({default:n.McpQueryPage}))),EC=O.lazy(()=>Oe(()=>import("./McpQueryDetailPage-SEzSbZrd.js"),__vite__mapDeps([40,1,14,13,19,39,4,25,41,42,24,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(n=>({default:n.McpQueryDetailPage}))),OC=O.lazy(()=>Oe(()=>import("./EscalationsOverview-CW57FaP9.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),AC=O.lazy(()=>Oe(()=>import("./AvailableEscalationsPage-iO5NyyIK.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,7,8,9,19,21,11,58,59,12,60,20,16,61,3,31]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),jC=O.lazy(()=>Oe(()=>import("./OperatorDashboard-zCkW4eqk.js"),__vite__mapDeps([62,1,3,4,5,6,52,7,8,9,11,31,58,59,13,12,60,20,16,21,61,57,19,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),kC=O.lazy(()=>Oe(()=>import("./index-CDrqqbSR.js"),__vite__mapDeps([63,1,53,54,5,64,13,57,7,8,9,19,21,11,4,16,14,15,20,61,37,65]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),NC=O.lazy(()=>Oe(()=>import("./WorkflowsOverview-DswubNJN.js"),__vite__mapDeps([66,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),TC=O.lazy(()=>Oe(()=>import("./index-CaGF6TCC.js"),__vite__mapDeps([67,1,14,13,12,16,64,57,7,8,9,19,21,11,4,54,68,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),CC=O.lazy(()=>Oe(()=>import("./index-CaGF6TCC.js"),__vite__mapDeps([67,1,14,13,12,16,64,57,7,8,9,19,21,11,4,54,68,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),MC=O.lazy(()=>Oe(()=>import("./WorkflowsDashboard-BNQVvyek.js"),__vite__mapDeps([69,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"durable"})}))),RC=O.lazy(()=>Oe(()=>import("./WorkflowsDashboard-BNQVvyek.js"),__vite__mapDeps([69,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"all"})}))),DC=O.lazy(()=>Oe(()=>import("./YamlWorkflowsPage-DB8xnIXy.js"),__vite__mapDeps([70,1,25,3,4,14,13,12,8,48,68,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),qC=O.lazy(()=>Oe(()=>import("./GraphInvokePage-CcA_44M4.js"),__vite__mapDeps([71,1,25,14,13,43,45,46,47,44,4,48,68]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),LC=O.lazy(()=>Oe(()=>import("./YamlWorkflowDetailPage-Cw9Dlmup.js"),__vite__mapDeps([72,1,25,19,68,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),BC=O.lazy(()=>Oe(()=>import("./TasksListPage-BBATgpf7.js"),__vite__mapDeps([73,1,2,3,4,7,8,9,19,60,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),PC=O.lazy(()=>Oe(()=>import("./TaskDetailPage-DCDcEps9.js"),__vite__mapDeps([74,1,2,19,60,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),Hb=O.lazy(()=>Oe(()=>import("./WorkflowExecutionPage-CCRSbnDx.js"),__vite__mapDeps([75,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),UC=O.lazy(()=>Oe(()=>import("./AdminDashboard-uarpHB88.js"),__vite__mapDeps([76,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),zC=O.lazy(()=>Oe(()=>import("./index-C7KHqOTQ.js"),__vite__mapDeps([77,1,7,8,9,12,13,31,3,4,14,78,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),IC=O.lazy(()=>Oe(()=>import("./index-ClVbfe4z.js"),__vite__mapDeps([79,1,12,13,80,20,16,14,4,46,47,68,64,57,7,8,9,19,21,11,54]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),Fb=O.lazy(()=>Oe(()=>import("./index-ClVbfe4z.js"),__vite__mapDeps([79,1,12,13,80,20,16,14,4,46,47,68,64,57,7,8,9,19,21,11,54]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),$C=O.lazy(()=>Oe(()=>import("./index-CuVkSmj5.js"),__vite__mapDeps([81,1,23,8,80,14,13,12,11,3,4,82,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),Gb=O.lazy(()=>Oe(()=>import("./index-DBWS5QL8.js"),__vite__mapDeps([83,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),HC=O.lazy(()=>Oe(()=>import("./index-BAAVTyZ-.js"),__vite__mapDeps([84,1,3,4,7,8,9,11,12,13,80,31,14,20,47,49,85,86,33]),import.meta.url).then(n=>({default:n.UsersPage}))),FC=O.lazy(()=>Oe(()=>import("./RolesPage-DSqqKPbv.js"),__vite__mapDeps([87,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),GC=O.lazy(()=>Oe(()=>import("./RoleDetailPage-BPY6i3CU.js"),__vite__mapDeps([88,1,89,80,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),VC=O.lazy(()=>Oe(()=>import("./PersonasPage-DOgGUlJl.js"),__vite__mapDeps([90,1,85,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),YC=O.lazy(()=>Oe(()=>import("./PersonaDetailPage-Cx6L3Jvu.js"),__vite__mapDeps([91,1,85,20,13,86,89,80,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),KC=O.lazy(()=>Oe(()=>import("./EscalationSchemaPage-C9Xu_A25.js"),__vite__mapDeps([92,1,13,4]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),JC=O.lazy(()=>Oe(()=>import("./PortalPage-BKuL1BeJ.js"),__vite__mapDeps([93,1,9,56,13,57,7,8,19,21,11,4,58,59,12,60,20,16,61]),import.meta.url).then(n=>({default:n.PortalPage}))),QC=O.lazy(()=>Oe(()=>import("./EscalationListSchemaPage-CoYvtMzj.js"),__vite__mapDeps([94,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),XC=O.lazy(()=>Oe(()=>import("./ScanCodesPage-S8aAJfnC.js"),__vite__mapDeps([95,1,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),WC=O.lazy(()=>Oe(()=>import("./ScanSchemeDetailPage-CUBRAtmJ.js"),__vite__mapDeps([96,1,80,14,13,4]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),ZC=O.lazy(()=>Oe(()=>import("./ScanStationPage-R9t1-CeQ.js"),__vite__mapDeps([97,1,13,65,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),e3=O.lazy(()=>Oe(()=>import("./index-BC6Jenlo.js"),__vite__mapDeps([98,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),Vb=O.lazy(()=>Oe(()=>import("./OperationsPage-dJcER0T_.js").then(n=>n.O),__vite__mapDeps([99,1,59,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),t3=O.lazy(()=>Oe(()=>import("./index-DIWCI6HC.js"),__vite__mapDeps([100,1,18,13,12,3,4,29,26,42,78,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),n3=O.lazy(()=>Oe(()=>import("./index-CVwzCZ43.js"),__vite__mapDeps([101,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),r3=O.lazy(()=>Oe(()=>import("./CredentialsPage-Dx7SxA23.js"),__vite__mapDeps([102,1,14,13,49,80,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),s3=O.lazy(()=>Oe(()=>import("./index-DZ8X_Gp4.js"),__vite__mapDeps([103,1,4,14,13,12,15,6,8,104,49]),import.meta.url).then(n=>({default:n.FilesPage}))),i3=O.lazy(()=>Oe(()=>import("./index-DAuX_PlL.js"),__vite__mapDeps([105,1,14,13,12,15,11,8,104,49,106,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),a3=O.lazy(()=>Oe(()=>import("./HomePage-Dc085ghJ.js"),__vite__mapDeps([107,1,24,26,20,13,16,15,99,59,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),o3=O.lazy(()=>Oe(()=>import("./AgentsPage-CuVFSDc4.js"),__vite__mapDeps([108,1,109,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),l3=O.lazy(()=>Oe(()=>import("./AgentDetailPage-BaZBhK6i.js"),__vite__mapDeps([110,1,109,111,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),Yb=O.lazy(()=>Oe(()=>import("./AgentConfigPage-BcUaDD5E.js"),__vite__mapDeps([112,1,109,111,13,14,106,45,46,47,25,113,114,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),c3=O.lazy(()=>Oe(()=>import("./CapabilitiesPage-D53ogPor.js"),__vite__mapDeps([115,1,113,82,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),u3=O.lazy(()=>Oe(()=>import("./TopicsPage-CUUo-Ylf.js"),__vite__mapDeps([116,1,114,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),f3=O.lazy(()=>Oe(()=>import("./TopicDetailPage-Dr1UmWcp.js"),__vite__mapDeps([117,1,114,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function h3(){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:n}){return h.jsx(O.Suspense,{fallback:h.jsx(h3,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const Uv=new Ww({defaultOptions:{queries:{staleTime:1e4,retry:(n,t)=>t instanceof Error&&t.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{Uv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",t=`${n}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(i)}`}});const d3=tS([{path:"/login",element:h.jsx(mC,{})},{path:"/connect/anthropic",element:h.jsx($b,{})},{path:"/connect/:provider",element:h.jsx($b,{})},{path:"/",element:h.jsx(fC,{}),children:[{index:!0,element:h.jsx(we,{children:h.jsx(a3,{})})},{path:"processes/all",element:h.jsx(we,{children:h.jsx(bC,{})})},{path:"processes/detail/:originId",element:h.jsx(we,{children:h.jsx(xC,{})})},{path:"credentials",element:h.jsx(we,{children:h.jsx(r3,{})})},{path:"connections",element:h.jsx(xn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(we,{children:h.jsx(OC,{})})},{path:"escalations/available",element:h.jsx(we,{children:h.jsx(AC,{})})},{path:"escalations/queue",element:h.jsx(we,{children:h.jsx(jC,{})})},{path:"escalations/detail/:id",element:h.jsx(we,{children:h.jsx(kC,{})})},{path:"portal/:role/:portal?",element:h.jsx(we,{children:h.jsx(JC,{})})},{path:"scan/station",element:h.jsx(we,{children:h.jsx(ZC,{})})},{path:"capabilities",element:h.jsx(we,{children:h.jsx(c3,{})})},{path:"agents",element:h.jsx(we,{children:h.jsx(o3,{})})},{path:"agents/new",element:h.jsx(we,{children:h.jsx(Yb,{})})},{path:"agents/:id",element:h.jsx(we,{children:h.jsx(l3,{})})},{path:"agents/:id/edit",element:h.jsx(we,{children:h.jsx(Yb,{})})},{path:"topics",element:h.jsx(we,{children:h.jsx(u3,{})})},{path:"topics/:topic",element:h.jsx(we,{children:h.jsx(f3,{})})},{element:h.jsx(pC,{}),children:[{path:"workflows/start",element:h.jsx(we,{children:h.jsx(TC,{})})},{path:"workflows/durable/invoke",element:h.jsx(we,{children:h.jsx(CC,{})})}]},{element:h.jsx(Wc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(we,{children:h.jsx(NC,{})})},{path:"workflows/executions",element:h.jsx(we,{children:h.jsx(RC,{})})},{path:"workflows/durable/executions",element:h.jsx(we,{children:h.jsx(MC,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Hb,{})})},{path:"workflows/tasks",element:h.jsx(we,{children:h.jsx(BC,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(we,{children:h.jsx(PC,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Hb,{})})},{path:"workflows/cron",element:h.jsx(xn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(we,{children:h.jsx(zC,{})})},{path:"workflows/registry",element:h.jsx(we,{children:h.jsx(IC,{})})},{path:"workflows/registry/new",element:h.jsx(we,{children:h.jsx(Fb,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(we,{children:h.jsx(Fb,{})})}]},{element:h.jsx(Wc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(we,{children:h.jsx(DC,{})})},{path:"mcp/workflows/invoke",element:h.jsx(we,{children:h.jsx(qC,{})})},{path:"mcp/workflows/:id",element:h.jsx(we,{children:h.jsx(LC,{})})},{path:"mcp/executions",element:h.jsx(we,{children:h.jsx(_C,{})})},{path:"mcp/executions/:jobId",element:h.jsx(we,{children:h.jsx(wC,{})})},{path:"files",element:h.jsx(we,{children:h.jsx(s3,{})})},{path:"knowledge",element:h.jsx(we,{children:h.jsx(i3,{})})},{element:h.jsx(yC,{}),children:[{path:"mcp",element:h.jsx(we,{children:h.jsx(vC,{})})},{path:"mcp/queries",element:h.jsx(we,{children:h.jsx(SC,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(we,{children:h.jsx(EC,{})})},{path:"mcp/tools",element:h.jsx(xn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(we,{children:h.jsx($C,{})})},{path:"mcp/servers/new",element:h.jsx(we,{children:h.jsx(Gb,{})})},{path:"mcp/servers/:serverId",element:h.jsx(we,{children:h.jsx(Gb,{})})}]}]},{path:"pace",element:h.jsx(we,{children:h.jsx(Vb,{})})},{path:"trends",element:h.jsx(we,{children:h.jsx(Vb,{})})},{path:"operations",element:h.jsx(xn,{to:"/pace",replace:!0})},{element:h.jsx(Wc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(we,{children:h.jsx(UC,{})})},{path:"admin/users",element:h.jsx(we,{children:h.jsx(HC,{})})},{path:"admin/escalation-chains",element:h.jsx(xn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(we,{children:h.jsx(FC,{})})},{path:"admin/roles/:role",element:h.jsx(we,{children:h.jsx(GC,{})})},{path:"admin/roles/:role/schema",element:h.jsx(we,{children:h.jsx(KC,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(we,{children:h.jsx(QC,{})})},{path:"admin/scan-codes",element:h.jsx(we,{children:h.jsx(XC,{})})},{path:"admin/scan-codes/:version",element:h.jsx(we,{children:h.jsx(WC,{})})},{path:"admin/personas",element:h.jsx(we,{children:h.jsx(VC,{})})},{path:"admin/personas/:key",element:h.jsx(we,{children:h.jsx(YC,{})})}]},{element:h.jsx(Wc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(xn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(gC,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(we,{children:h.jsx(e3,{})})}]},{path:"admin/controlplane",element:h.jsx(we,{children:h.jsx(t3,{})})},{path:"admin/streams",element:h.jsx(we,{children:h.jsx(n3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function m3(){return h.jsx(Zw,{client:Uv,children:h.jsx(GS,{children:h.jsx(YO,{children:h.jsx(nS,{router:d3})})})})}cv(lv());const qm=document.createElement("link");qm.rel="stylesheet";qm.href=`${$t}/api/settings/custom.css`;document.head.appendChild(qm);LS.createRoot(document.getElementById("root")).render(h.jsx(O.StrictMode,{children:h.jsx(m3,{})}));export{Lt as $,dk as A,M5 as B,Dm as C,XT as D,F3 as E,Mv as F,R5 as G,Em as H,JN as I,MT as J,QN as K,iT as L,xN as M,Jt as N,zx as O,U3 as P,Gx as Q,e5 as R,vT as S,t5 as T,n5 as U,r5 as V,s5 as W,a5 as X,lA as Y,ku as Z,H3 as _,z5 as a,v5 as a$,Kd as a0,eT as a1,ZN as a2,T3 as a3,B5 as a4,Nm as a5,bs as a6,J3 as a7,M3 as a8,Kx as a9,c5 as aA,V5 as aB,P5 as aC,K5 as aD,Y5 as aE,w5 as aF,ti as aG,_o as aH,J5 as aI,wx as aJ,P3 as aK,w3 as aL,S3 as aM,j3 as aN,k3 as aO,E3 as aP,O3 as aQ,A3 as aR,D3 as aS,L3 as aT,q3 as aU,D5 as aV,N3 as aW,vm as aX,B3 as aY,nT as aZ,C3 as a_,IN as aa,pk as ab,fc as ac,X3 as ad,W3 as ae,Mu as af,mk as ag,lN as ah,tk as ai,Tm as aj,oA as ak,V3 as al,g5 as am,Y3 as an,Z3 as ao,i5 as ap,rA as aq,Ng as ar,v3 as as,G5 as at,$5 as au,I5 as av,Nv as aw,H5 as ax,U5 as ay,rv as az,h5 as b,$t as b0,nx as b1,_3 as b2,WN as b3,L5 as b4,Jx as b5,Rb as b6,dv as b7,p5 as b8,E5 as b9,bm as bA,Ix as bB,b5 as bC,km as ba,S5 as bb,Lr as bc,$x as bd,_5 as be,Wi as bf,R3 as bg,hk as bh,uk as bi,k5 as bj,Gj as bk,T5 as bl,C5 as bm,j5 as bn,N5 as bo,Cm as bp,Ij as bq,yk as br,A5 as bs,$e as bt,I3 as bu,m5 as bv,vN as bw,Q5 as bx,X5 as by,Pv as bz,Wn as c,O5 as d,o5 as e,$j as f,sv as g,wA as h,z3 as i,sn as j,wn as k,l5 as l,fe as m,F5 as n,u5 as o,f5 as p,G3 as q,K3 as r,Q3 as s,d5 as t,x5 as u,$3 as v,Rm as w,q5 as x,Lx as y,y5 as z};
|
|
67
|
+
//# sourceMappingURL=index-3gbd5neL.js.map
|